Changeset 10
- Timestamp:
- 10/16/06 20:59:42 (16 years ago)
- Location:
- dev
- Files:
-
- 5 added
- 27 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/about.php
r2 r10 1 <? 2 require_once( "db.php" ); 3 require_once( "class.page.php" ); 4 require_once( "class.ship.php" ); 5 6 $page = new Page( "About" ); 1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 4 require_once("class.ship.php"); 7 5 8 $html .= "<div class=block-header2>About</div>"; 9 $html .= KB_TITLE." killboard hosted on <a href=\"http://www.eve-killboard.net\">eve-killboard.net</a>, a killboard service for <a href=\"http://www.eve-online.com/\">EVE Online</a> corporations and alliances.<br><p>Created by <a href=\"mailto:rig0r@eve-killboard.net\">rig0r</a>. All EVE graphics used are © <a href=\"http://www.ccpgames.com/\">CCP</a>."; 6 $page = new Page("About"); 10 7 11 $qry = new DBQuery(); 12 $qry->execute( "select count(*) as cnt from kb3_kills" ); 13 $row = $qry->getRow(); 14 $kills = $row['cnt']; 15 $qry->execute( "select sum(itd_quantity) as cnt from kb3_items_destroyed" ); 16 $row = $qry->getRow(); 17 $items = $row['cnt']; 18 $qry->execute( "select count(*) as cnt from kb3_pilots" ); 19 $row = $qry->getRow(); 20 $pilots = $row['cnt']; 21 $qry->execute( "select count(*) as cnt from kb3_corps" ); 22 $row = $qry->getRow(); 23 $corps = $row['cnt']; 24 $qry->execute( "select count(*) as cnt from kb3_alliances" ); 25 $row = $qry->getRow(); 26 $alliances = $row['cnt']; 27 // $html .= "<div class=block-header2>Killboard stats</div>"; 28 $html .= "<p>The eve-killboard.net database currently stores <b>".number_format( $kills, 0, ',', '.' )."</b> killmails, <b>".number_format( $items, 0, ',', '.' )."</b> destroyed items, <b>".number_format( $pilots, 0, ',', '.' )."</b> pilots, <b>".number_format( $corps, 0, ',', '.' )."</b> corporations and <b>".number_format( $alliances, 0, ',', '.' )."</b> alliances."; 29 30 $html .= "<div class=block-header2>Portraits</div>"; 31 $html .= "If you would like your ingame character portrait to show up on the killboard, please visit the killboard using the ingame browser and select the 'Update portrait' option presented.<br><br>"; 32 $html .= "After trusting the site (press Yes when prompted), your character ID will be grabbed and recorded in the database.<br>"; 8 $html .= "<div class=block-header2>Killboard</div>"; 9 $html .= KB_TITLE . ", a killboard for <a href=\"http://www.eve-online.com/\">EVE Online</a> corporations and alliances.<br><p>Based on EVE-Killboard created by <a href=\"mailto:rig0r@eve-killboard.net\">rig0r</a>. All EVE graphics used are © <a href=\"http://www.ccpgames.com/\">CCP</a>.<br><br>"; 33 10 34 $html .= "<div class=block-header2>Kills & Real kills</div>"; 35 $html .= "Real kills are all recorded kills minus pod, shuttle and noobship kills. This value is used throughout all award and statistic pages you see on the killboard.<br>"; 11 $qry = new DBQuery(); 12 $qry->execute("select count(*) as cnt from kb3_kills"); 13 $row = $qry->getRow(); 14 $kills = $row['cnt']; 15 $qry->execute("select sum(itd_quantity) as cnt from kb3_items_destroyed"); 16 $row = $qry->getRow(); 17 $items = $row['cnt']; 18 $qry->execute("select count(*) as cnt from kb3_pilots"); 19 $row = $qry->getRow(); 20 $pilots = $row['cnt']; 21 $qry->execute("select count(*) as cnt from kb3_corps"); 22 $row = $qry->getRow(); 23 $corps = $row['cnt']; 24 $qry->execute("select count(*) as cnt from kb3_alliances"); 25 $row = $qry->getRow(); 26 $alliances = $row['cnt']; 27 // $html .= "<div class=block-header2>Killboard stats</div>"; 28 $html .= "The eve-killboard.net database currently stores <b>" . number_format($kills, 0, ',', '.') . "</b> killmails, <b>" . number_format($items, 0, ',', '.') . "</b> destroyed items, <b>" . number_format($pilots, 0, ',', '.') . "</b> pilots, <b>" . number_format($corps, 0, ',', '.') . "</b> corporations and <b>" . number_format($alliances, 0, ',', '.') . "</b> alliances.<br><br>"; 36 29 37 $html .= "<div class=block-header2>Kill points</div>"; 38 $html .= "If enabled, every kill gets a certain amount of points assigned. The number of points says something about the difficulty of the kill. It is based on the shiptype destroyed, and the number and types of ships involved in the kill. As a result, a gank will get a lot less points awarded than a kill in a small engagement."; 30 $html .= "<div class=block-header2>Portraits</div>"; 31 $html .= "If you would like your ingame character portrait to show up on the killboard, please visit the killboard using the ingame browser and select the 'Update portrait' option presented.<br>"; 32 $html .= "After trusting the site (press Yes when prompted), your character ID will be grabbed and recorded in the database.<br><br>"; 39 33 40 $html .= "<div class=block-header2>Efficiency</div>"; 41 $html .= "Every shipclass has a value in ISK assigned. This is based on the average amount of ISK that would have been lost if the ship was destroyed, taking current average market prices, insurance costs and insurance payouts into account. "; 42 $html .= "Any modules that might have been fitted or cargo that might have been destroyed or confiscated is not included.<br><br>"; 43 $html .= "The efficiency is calculated as the ratio of damage done in ISK versus the damage received in ISK. This comes down to <i>damagedone / (damagedone + damagereceived ) * 100</i>.<br><br>"; 34 $html .= "<div class=block-header2>Kills & Real kills</div>"; 35 $html .= "Real kills are all recorded kills minus pod, shuttle and noobship kills. This value is used throughout all award and statistic pages you see on the killboard.<br><br>"; 44 36 45 $html .= "<div class=block-header2>Ship values</div>"; 46 $html .= "The shipclasses and average ISK value are as follows:<br><br>"; 47 $sql = "select scl_id 37 $html .= "<div class=block-header2>Kill points</div>"; 38 $html .= "If enabled, every kill gets a certain amount of points assigned. The number of points says something about the difficulty of the kill. It is based on the shiptype destroyed, and the number and types of ships involved in the kill. As a result, a gank will get a lot less points awarded than a kill in a small engagement.<br><br>"; 39 40 $html .= "<div class=block-header2>Efficiency</div>"; 41 $html .= "Every shipclass has a value in ISK assigned. This is based on the average amount of ISK that would have been lost if the ship was destroyed, taking current average market prices, insurance costs and insurance payouts into account. "; 42 $html .= "Any modules that might have been fitted or cargo that might have been destroyed or confiscated is not included.<br><br>"; 43 $html .= "The efficiency is calculated as the ratio of damage done in ISK versus the damage received in ISK. This comes down to <i>damagedone / (damagedone + damagereceived ) * 100</i>.<br><br>"; 44 45 $html .= "<div class=block-header2>Ship values</div>"; 46 $html .= "The shipclasses and average ISK value are as follows:<br><br>"; 47 $sql = "select scl_id 48 48 from kb3_ship_classes 49 49 where scl_class not in ( 'Drone', 'Unknown' ) 50 50 order by scl_value"; 51 51 52 $qry = new DBQuery(); 53 $qry->execute( $sql ); 54 $html .= "<table class=kb-table cellspacing=1>"; 55 $html .= "<tr class=kb-table-header><td width=110>Ship class</td><td>Value in ISK (M)</td><td align=center>Indicator</td></tr>"; 56 while ( $row = $qry->getRow() ) { 57 $shipclass = new ShipClass( $row['scl_id'] ); 58 $html .= "<tr class=kb-table-row-odd><td>".$shipclass->getName()."</td><td>".$shipclass->getValue()."</td><td align=center><img class=ship src=\"".$shipclass->getValueIndicator()."\" border=\"0\"></td></tr>"; 59 } 60 $html .= "</table><br>"; 52 $qry = new DBQuery(); 53 $qry->execute($sql); 54 $html .= "<table class=kb-table cellspacing=1>"; 55 $html .= "<tr class=kb-table-header><td width=110>Ship class</td><td>Value in ISK (M)</td><td align=center>Indicator</td></tr>"; 56 while ($row = $qry->getRow()) 57 { 58 $shipclass = new ShipClass($row['scl_id']); 59 $html .= "<tr class=kb-table-row-odd><td>" . $shipclass->getName() . "</td><td>" . $shipclass->getValue() . "</td><td align=center><img class=ship src=\"" . $shipclass->getValueIndicator() . "\" border=\"0\"></td></tr>"; 60 } 61 $html .= "</table>"; 61 62 62 63 $page->setContent( $html ); 64 $page->generate(); 65 63 $page->setContent($html); 64 $page->generate(); 66 65 ?> -
dev/common/admin.php
r2 r10 1 <? 2 require_once( "db.php" ); 3 require_once( "class.killboard.php" ); 4 require_once( "class.page.php" ); 5 require_once( "class.tabbedform.php" ); 6 require_once( "admin_menu.php" ); 7 8 $killboard = new Killboard( KB_SITE ); 9 $page = new Page( "Administration - Generic" ); 10 $page->setAdmin(); 1 <?php 2 require_once("db.php"); 3 require_once("class.killboard.php"); 4 require_once("class.page.php"); 5 require_once("class.tabbedform.php"); 6 require_once("admin_menu.php"); 11 7 12 $config = $killboard->getConfig(); 13 if ( $_POST['submit'] ) { 14 $config->setStyleBanner( $_POST['style_banner'] ); 15 $config->setStyleName( $_POST['style_name'] ); 16 if ( $_POST['kill_points'] == "on" ) $killpoints = 1; else $killpoints = 0; 17 if ( $_POST['least_active'] == "on" ) $leastactive = 1; 8 $killboard = new Killboard(KB_SITE); 9 $page = new Page("Administration - Generic"); 10 $page->setAdmin(); 11 12 $config = $killboard->getConfig(); 13 if ($_POST['submit']) 14 { 15 $config->setStyleBanner($_POST['style_banner']); 16 $config->setStyleName($_POST['style_name']); 17 if ($_POST['kill_points'] == "on") $killpoints = 1; 18 else $killpoints = 0; 19 if ($_POST['least_active'] == "on") $leastactive = 1; 18 20 else $leastactive = 0; 19 $config->setKillPoints( $killpoints);20 $config->setLeastActive( $leastactive);21 $config->setPostPassword( $_POST['post_password']);22 $config->setPostMailto( $_POST['post_mailto']);23 21 $config->setKillPoints($killpoints); 22 $config->setLeastActive($leastactive); 23 $config->setPostPassword($_POST['post_password']); 24 $config->setPostMailto($_POST['post_mailto']); 25 24 26 $html .= "Changes saved."; 25 27 } 26 28 27 $html .= "<form id=options name=options method=post action=?a=admin>"; 28 $html .= "<div class=block-header2>Look and feel</div>"; 29 $html .= "<table class=kb-subtable>"; 30 $html .= "<tr><td width=120><b>Banner:</b></td><td><select id=style_banner name=style_banner>"; 31 $dir = "img/banners/"; 32 if ( is_dir( $dir ) ) { 33 if ( $dh = opendir( $dir ) ) { 34 while ( ( $file = readdir( $dh ) ) !== false ) { 35 $file = substr( $file, 0, strpos( $file, "." ) ); 36 if ( !is_dir( $dir.$file ) ) { 37 $html .= "<option value=\"".$file."\""; 38 if ( $file == $config->getStyleBanner() ) 39 $html .= " selected=\"selected\""; 40 $html .= ">".$file."</option>"; 41 } 42 } 43 closedir( $dh ); 29 $html .= "<form id=options name=options method=post action=?a=admin>"; 30 $html .= "<div class=block-header2>Look and feel</div>"; 31 $html .= "<table class=kb-subtable>"; 32 $html .= "<tr><td width=120><b>Banner:</b></td><td><select id=style_banner name=style_banner>"; 33 $dir = "img/banners/"; 34 if (is_dir($dir)) 35 { 36 if ($dh = opendir($dir)) 37 { 38 while (($file = readdir($dh)) !== false) 39 { 40 $file = substr($file, 0, strpos($file, ".")); 41 if (!is_dir($dir . $file)) 42 { 43 $html .= "<option value=\"" . $file . "\""; 44 if ($file == $config->getStyleBanner()) 45 $html .= " selected=\"selected\""; 46 $html .= ">" . $file . "</option>"; 47 } 48 } 49 closedir($dh); 44 50 } 45 46 47 if ( $config->getStyleBanner() == "custom")51 } 52 $html .= "<option value=\"custom\""; 53 if ($config->getStyleBanner() == "custom") 48 54 $html .= " selected=\"selected\""; 49 $html .= ">custom</option></select></td></tr>"; 50 $html .= "<tr><td width=120><b>Style:</b></td><td><select id=style_name name=style_name>"; 51 $dir = "style/"; 52 if ( is_dir( $dir ) ) { 53 if ( $dh = opendir( $dir ) ) { 54 while ( ( $file = readdir( $dh ) ) !== false ) { 55 if ( is_dir( $dir.$file ) ) { 56 if ( $file == "." || $file == ".." ) 57 continue; 58 $html .= "<option value=\"".$file."\""; 59 if ( $file == $config->getStyleName() ) 60 $html .= " selected=\"selected\""; 61 $html .= ">".$file."</option>"; 62 } 63 } 64 closedir( $dh ); 55 $html .= ">custom</option></select></td></tr>"; 56 $html .= "<tr><td width=120><b>Style:</b></td><td><select id=style_name name=style_name>"; 57 $dir = "style/"; 58 if (is_dir($dir)) 59 { 60 if ($dh = opendir($dir)) 61 { 62 while (($file = readdir($dh)) !== false) 63 { 64 if (is_dir($dir . $file)) 65 { 66 if ($file == "." || $file == "..") 67 continue; 68 $html .= "<option value=\"" . $file . "\""; 69 if ($file == $config->getStyleName()) 70 $html .= " selected=\"selected\""; 71 $html .= ">" . $file . "</option>"; 72 } 73 } 74 closedir($dh); 65 75 } 66 67 68 69 70 71 72 73 if ( $config->getKillPoints())76 } 77 $html .= "</select></td></tr>"; 78 $html .= "<tr><td></td></tr></table>"; 79 80 $html .= "<div class=block-header2>Global options</div>"; 81 $html .= "<table class=kb-subtable>"; 82 $html .= "<tr><td width=120><b>Display killpoints:</b></td><td><input type=checkbox name=kill_points id=kill_points"; 83 if ($config->getKillPoints()) 74 84 $html .= " checked=\"checked\""; 75 $html .= "></td></tr>"; 76 // $html .= "<tr><td width=120><b>Display least active:</b></td><td><input type=checkbox name=least_active id=least_active"; 77 // if ( $config->getLeastActive() ) 78 // $html .= " checked=\"checked\""; 79 // $html .= "></td></tr>"; 80 $html .= "<tr><td></td></tr></table>"; 81 82 $html .= "<div class=block-header2>Posting</div>"; 83 $html .= "<table class=kb-subtable>"; 84 85 $html .= "<tr><td width=120><b>Post password:</b></td><td><input type=text name=post_password id=post_password size=20 maxlength=20 value=\"".$config->getPostPassword()."\"></td></tr>"; 86 $html .= "<tr><td width=120><b>Killmail CC:</b></td><td><input type=text name=post_mailto id=post_mailto size=20 maxlength=80 value=\"".$config->getPostMailto()."\"> (e-mail address)</td></tr>"; 87 $html .= "</table>"; 85 $html .= "></td></tr>"; 86 // $html .= "<tr><td width=120><b>Display least active:</b></td><td><input type=checkbox name=least_active id=least_active"; 87 // if ( $config->getLeastActive() ) 88 // $html .= " checked=\"checked\""; 89 // $html .= "></td></tr>"; 90 $html .= "<tr><td></td></tr></table>"; 88 91 89 $html .= "<div class=block-header2>Save changes</div>"; 90 $html .= "<table class=kb-subtable>"; 91 92 $html .= "<tr><td width=120></td><td><input type=submit name=submit value=\"Save\"></td></tr>"; 93 $html .= "</table>"; 92 $html .= "<div class=block-header2>Posting</div>"; 93 $html .= "<table class=kb-subtable>"; 94 94 95 $html .= "</form>"; 95 $html .= "<tr><td width=120><b>Post password:</b></td><td><input type=text name=post_password id=post_password size=20 maxlength=20 value=\"" . $config->getPostPassword() . "\"></td></tr>"; 96 $html .= "<tr><td width=120><b>Killmail CC:</b></td><td><input type=text name=post_mailto id=post_mailto size=20 maxlength=80 value=\"" . $config->getPostMailto() . "\"> (e-mail address)</td></tr>"; 97 $html .= "</table>"; 96 98 97 $page->setContent( $html ); 98 $page->addContext( $menubox->generate() ); 99 $page->generate(); 99 $html .= "<div class=block-header2>Save changes</div>"; 100 $html .= "<table class=kb-subtable>"; 101 102 $html .= "<tr><td width=120></td><td><input type=submit name=submit value=\"Save\"></td></tr>"; 103 $html .= "</table>"; 104 105 $html .= "</form>"; 106 107 $page->setContent($html); 108 $page->addContext($menubox->generate()); 109 $page->generate(); 100 110 ?> -
dev/common/admin_menu.php
r3 r10 1 <? 2 require_once( "class.box.php");1 <?php 2 require_once("class.box.php"); 3 3 4 $menubox = new MenuBox(); 5 $menubox->addOption( "Generic", "?a=admin" ); 6 $menubox->addOption( "Contracts", "?a=admin_cc&op=view&type=contract" ); 7 $menubox->addOption( "Campaigns", "?a=admin_cc&op=view&type=campaign" ); 8 /* REMOVED: This code is no longer present */ 9 /* $menubox->addOption( "Rental", "?a=admin_rental" ); */ 10 $menubox->addOption( "Delete kill", "?a=kill_delete" ); 11 4 $menubox = new MenuBox(); 5 $menubox->addOption("Generic", "?a=admin"); 6 $menubox->addOption("Contracts", "?a=admin_cc&op=view&type=contract"); 7 $menubox->addOption("Campaigns", "?a=admin_cc&op=view&type=campaign"); 8 //$menubox->addOption("Rental", "?a=admin_rental"); 12 9 ?> -
dev/common/alliance_detail.php
r2 r10 1 <? 2 require_once( "db.php");3 require_once( "class.page.php");4 require_once( "class.corp.php");5 require_once( "class.alliance.php");6 require_once( "class.killlist.php");7 require_once( "class.killlisttable.php");8 require_once( "class.killsummarytable.php");9 require_once( "class.box.php");10 require_once( "class.toplist.php");11 12 $alliance = new Alliance( $_GET['all_id']);13 14 $klist->setOrdered( false);15 // 16 // 17 18 $llist->setOrdered( false);19 $klist->addInvolvedAlliance( $alliance);20 // 21 // 22 $llist->addVictimAlliance( $alliance);23 24 25 26 $page = new Page( "Alliance details - ".$alliance->getName());27 28 29 30 $html .= "<img src=\"".IMG_URL."/alliances/default.gif\" border=\"0\">";31 32 33 $html .= "<td class=kb-table-cell width=180><b>Kills:</b></td><td class=kl-kill>".$klist->getCount()."</td></tr>";34 // 35 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$llist->getCount()."</td></tr>";36 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".$klist->getISK()."M</td></tr>";37 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".$llist->getISK()."M</td></tr>";38 if ( $klist->getISK())39 $efficiency = round( $klist->getISK() / ( $klist->getISK() + $llist->getISK() ) * 100, 2);40 1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 4 require_once("class.corp.php"); 5 require_once("class.alliance.php"); 6 require_once("class.killlist.php"); 7 require_once("class.killlisttable.php"); 8 require_once("class.killsummarytable.php"); 9 require_once("class.box.php"); 10 require_once("class.toplist.php"); 11 12 $alliance = new Alliance($_GET['all_id']); 13 $klist = new KillList(); 14 $klist->setOrdered(false); 15 // $tklist = new KillList(); 16 // $tklist->setOrdered( false ); 17 $llist = new KillList(); 18 $llist->setOrdered(false); 19 $klist->addInvolvedAlliance($alliance); 20 // $tklist->addInvolvedAlliance( $alliance ); 21 // $tklist->setPodsNoobShips( false ); 22 $llist->addVictimAlliance($alliance); 23 $klist->getAllKills(); 24 $llist->getAllKills(); 25 26 $page = new Page("Alliance details - " . $alliance->getName()); 27 28 $html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center>"; 29 30 $html .= "<img src=\"" . IMG_URL . "/alliances/default.gif\" border=\"0\">"; 31 $html .= "</td>"; 32 33 $html .= "<td class=kb-table-cell width=180><b>Kills:</b></td><td class=kl-kill>" . $klist->getCount() . "</td></tr>"; 34 // $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Real kills:</b></td><td class=kl-kill>".$tklist->getCount()."</td></tr>"; 35 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>" . $llist->getCount() . "</td></tr>"; 36 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>" . $klist->getISK() . "M</td></tr>"; 37 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>" . $llist->getISK() . "M</td></tr>"; 38 if ($klist->getISK()) 39 $efficiency = round($klist->getISK() / ($klist->getISK() + $llist->getISK()) * 100, 2); 40 else 41 41 $efficiency = 0; 42 42 43 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>".$efficiency."%</b></td></tr>"; 44 45 $html .= "</table>"; 46 $html .= "<br/>"; 47 48 if ( $_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses" ) { 49 $summarytable = new KillSummaryTable( $klist, $llist ); 50 $summarytable->setBreak( 6 ); 51 43 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $efficiency . "%</b></td></tr>"; 44 45 $html .= "</table>"; 46 $html .= "<br/>"; 47 48 if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses") 49 { 50 $summarytable = new KillSummaryTable($klist, $llist); 51 $summarytable->setBreak(6); 52 52 53 $html .= $summarytable->generate(); 53 } 54 55 switch ( $_GET['view'] ) { 54 } 55 56 switch ($_GET['view']) 57 { 56 58 case "": 57 $html .= "<div class=kb-kills-header>10 Most recent kills</div>";58 59 $list = new KillList();60 $list->setOrdered( true);61 $list->setLimit( 10);62 $list->setPodsNoobships( true);63 $list->addInvolvedAlliance( $alliance);64 if ( $_GET['scl_id'])65 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));66 67 $ktab = new KillListTable( $list);68 $ktab->setLimit( 10);69 $ktab->setDayBreak( false);70 $html .= $ktab->generate();71 72 $html .= "<div class=kb-losses-header>10 Most recent losses</div>";73 74 $list = new KillList();75 $list->setLimit( 10);76 $list->setPodsNoobships( true);77 $list->addVictimAlliance( $alliance);78 if ( $_GET['scl_id'])79 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));80 81 $ltab = new KillListTable( $list);82 $ltab->setLimit( 10);83 $ltab->setDayBreak( false);84 $html .= $ltab->generate();85 86 break;59 $html .= "<div class=kb-kills-header>10 Most recent kills</div>"; 60 61 $list = new KillList(); 62 $list->setOrdered(true); 63 $list->setLimit(10); 64 $list->setPodsNoobships(true); 65 $list->addInvolvedAlliance($alliance); 66 if ($_GET['scl_id']) 67 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 68 69 $ktab = new KillListTable($list); 70 $ktab->setLimit(10); 71 $ktab->setDayBreak(false); 72 $html .= $ktab->generate(); 73 74 $html .= "<div class=kb-losses-header>10 Most recent losses</div>"; 75 76 $list = new KillList(); 77 $list->setLimit(10); 78 $list->setPodsNoobships(true); 79 $list->addVictimAlliance($alliance); 80 if ($_GET['scl_id']) 81 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 82 83 $ltab = new KillListTable($list); 84 $ltab->setLimit(10); 85 $ltab->setDayBreak(false); 86 $html .= $ltab->generate(); 87 88 break; 87 89 case "kills": 88 $html .= "<div class=kb-kills-header>All kills</div>";89 90 $list = new KillList();91 $list->setOrdered( true);92 $list->addInvolvedAlliance( $alliance);93 if ( $_GET['scl_id'])94 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));95 $pagesplitter = new PageSplitter( $list->getCount(), 30);96 $list->setPageSplitter( $pagesplitter);97 $table = new KillListTable( $list);98 $table->setDayBreak( false);99 $html .= $table->generate();100 $html .= $pagesplitter->generate();101 102 break;90 $html .= "<div class=kb-kills-header>All kills</div>"; 91 92 $list = new KillList(); 93 $list->setOrdered(true); 94 $list->addInvolvedAlliance($alliance); 95 if ($_GET['scl_id']) 96 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 97 $pagesplitter = new PageSplitter($list->getCount(), 30); 98 $list->setPageSplitter($pagesplitter); 99 $table = new KillListTable($list); 100 $table->setDayBreak(false); 101 $html .= $table->generate(); 102 $html .= $pagesplitter->generate(); 103 104 break; 103 105 case "losses": 104 $html .= "<div class=kb-losses-header>All losses</div>";105 106 $list = new KillList();107 $list->setOrdered( true);108 $list->setPodsNoobships( true);109 $list->addVictimAlliance( $alliance);110 if ( $_GET['scl_id'])111 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));112 $pagesplitter = new PageSplitter( $list->getCount(), 30);113 $list->setPageSplitter( $pagesplitter);114 115 $table = new KillListTable( $list);116 $table->setDayBreak( false);117 $html .= $table->generate();118 $html .= $pagesplitter->generate();119 120 break;106 $html .= "<div class=kb-losses-header>All losses</div>"; 107 108 $list = new KillList(); 109 $list->setOrdered(true); 110 $list->setPodsNoobships(true); 111 $list->addVictimAlliance($alliance); 112 if ($_GET['scl_id']) 113 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 114 $pagesplitter = new PageSplitter($list->getCount(), 30); 115 $list->setPageSplitter($pagesplitter); 116 117 $table = new KillListTable($list); 118 $table->setDayBreak(false); 119 $html .= $table->generate(); 120 $html .= $pagesplitter->generate(); 121 122 break; 121 123 case "corp_kills": 122 $html .= "<div class=block-header2>Top killers</div>";123 124 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";125 $html .= "<div class=block-header>This month</div>";126 127 $list = new TopCorpKillsList();128 $list->addInvolvedAlliance( $alliance);129 $list->setPodsNoobShips( false);130 $list->setMonth( date( "m" ));131 $list->setYear( date( "Y" ));132 $table = new TopCorpTable( $list, "Kills");133 $html .= $table->generate();134 135 $html .= "</td><td valign=top width=400>";136 $html .= "<div class=block-header>All time</div>";137 138 $list = new TopCorpKillsList();139 $list->addInvolvedAlliance( $alliance);140 $list->setPodsNoobShips( false);141 $table = new TopCorpTable( $list, "Kills");142 $html .= $table->generate();143 144 $html .= "</td></tr></table>";145 146 break;124 $html .= "<div class=block-header2>Top killers</div>"; 125 126 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 127 $html .= "<div class=block-header>This month</div>"; 128 129 $list = new TopCorpKillsList(); 130 $list->addInvolvedAlliance($alliance); 131 $list->setPodsNoobShips(false); 132 $list->setMonth(date("m")); 133 $list->setYear(date("Y")); 134 $table = new TopCorpTable($list, "Kills"); 135 $html .= $table->generate(); 136 137 $html .= "</td><td valign=top width=400>"; 138 $html .= "<div class=block-header>All time</div>"; 139 140 $list = new TopCorpKillsList(); 141 $list->addInvolvedAlliance($alliance); 142 $list->setPodsNoobShips(false); 143 $table = new TopCorpTable($list, "Kills"); 144 $html .= $table->generate(); 145 146 $html .= "</td></tr></table>"; 147 148 break; 147 149 case "corp_losses": 148 $html .= "<div class=block-header2>Top losers</div>";149 150 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";151 $html .= "<div class=block-header>This month</div>";152 153 $list = new TopCorpLossesList();154 $list->addVictimAlliance( $alliance);155 $list->setPodsNoobShips( false);156 $list->setMonth( date( "m" ));157 $list->setYear( date( "Y" ));158 $table = new TopCorpTable( $list, "Losses");159 $html .= $table->generate();160 161 $html .= "</td><td valign=top width=400>";162 $html .= "<div class=block-header>All time</div>";163 164 $list = new TopCorpLossesList();165 $list->addVictimAlliance( $alliance);166 $list->setPodsNoobShips( false);167 $table = new TopCorpTable( $list, "Losses");168 $html .= $table->generate();169 170 $html .= "</td></tr></table>";171 172 break;150 $html .= "<div class=block-header2>Top losers</div>"; 151 152 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 153 $html .= "<div class=block-header>This month</div>"; 154 155 $list = new TopCorpLossesList(); 156 $list->addVictimAlliance($alliance); 157 $list->setPodsNoobShips(false); 158 $list->setMonth(date("m")); 159 $list->setYear(date("Y")); 160 $table = new TopCorpTable($list, "Losses"); 161 $html .= $table->generate(); 162 163 $html .= "</td><td valign=top width=400>"; 164 $html .= "<div class=block-header>All time</div>"; 165 166 $list = new TopCorpLossesList(); 167 $list->addVictimAlliance($alliance); 168 $list->setPodsNoobShips(false); 169 $table = new TopCorpTable($list, "Losses"); 170 $html .= $table->generate(); 171 172 $html .= "</td></tr></table>"; 173 174 break; 173 175 case "pilot_kills": 174 $html .= "<div class=block-header2>Top killers</div>";175 176 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";177 $html .= "<div class=block-header>This month</div>";178 179 $list = new TopKillsList();180 $list->addInvolvedAlliance( $alliance);181 $list->setPodsNoobShips( false);182 $list->setMonth( date( "m" ));183 $list->setYear( date( "Y" ));184 $table = new TopPilotTable( $list, "Kills");185 $html .= $table->generate();186 187 $html .= "</td><td valign=top width=400>";188 $html .= "<div class=block-header>All time</div>";189 190 $list = new TopKillsList();191 $list->addInvolvedAlliance( $alliance);192 $list->setPodsNoobShips( false);193 $table = new TopPilotTable( $list, "Kills");194 $html .= $table->generate();195 196 $html .= "</td></tr></table>";197 198 break;176 $html .= "<div class=block-header2>Top killers</div>"; 177 178 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 179 $html .= "<div class=block-header>This month</div>"; 180 181 $list = new TopKillsList(); 182 $list->addInvolvedAlliance($alliance); 183 $list->setPodsNoobShips(false); 184 $list->setMonth(date("m")); 185 $list->setYear(date("Y")); 186 $table = new TopPilotTable($list, "Kills"); 187 $html .= $table->generate(); 188 189 $html .= "</td><td valign=top width=400>"; 190 $html .= "<div class=block-header>All time</div>"; 191 192 $list = new TopKillsList(); 193 $list->addInvolvedAlliance($alliance); 194 $list->setPodsNoobShips(false); 195 $table = new TopPilotTable($list, "Kills"); 196 $html .= $table->generate(); 197 198 $html .= "</td></tr></table>"; 199 200 break; 199 201 case "pilot_scores": 200 $html .= "<div class=block-header2>Top scorers</div>";201 202 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";203 $html .= "<div class=block-header>This month</div>";204 205 $list = new TopScoreList();206 $list->addInvolvedAlliance( $alliance);207 $list->setPodsNoobShips( false);208 $list->setMonth( date( "m" ));209 $list->setYear( date( "Y" ));210 $table = new TopPilotTable( $list, "Points");211 $html .= $table->generate();212 213 $html .= "</td><td valign=top width=400>";214 $html .= "<div class=block-header>All time</div>";215 216 $list = new TopScoreList();217 $list->addInvolvedAlliance( $alliance);218 $list->setPodsNoobShips( false);219 $table = new TopPilotTable( $list, "Points");220 $html .= $table->generate();221 222 $html .= "</td></tr></table>";223 224 break;202 $html .= "<div class=block-header2>Top scorers</div>"; 203 204 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 205 $html .= "<div class=block-header>This month</div>"; 206 207 $list = new TopScoreList(); 208 $list->addInvolvedAlliance($alliance); 209 $list->setPodsNoobShips(false); 210 $list->setMonth(date("m")); 211 $list->setYear(date("Y")); 212 $table = new TopPilotTable($list, "Points"); 213 $html .= $table->generate(); 214 215 $html .= "</td><td valign=top width=400>"; 216 $html .= "<div class=block-header>All time</div>"; 217 218 $list = new TopScoreList(); 219 $list->addInvolvedAlliance($alliance); 220 $list->setPodsNoobShips(false); 221 $table = new TopPilotTable($list, "Points"); 222 $html .= $table->generate(); 223 224 $html .= "</td></tr></table>"; 225 226 break; 225 227 case "pilot_losses": 226 $html .= "<div class=block-header2>Top losers</div>";227 228 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";229 $html .= "<div class=block-header>This month</div>";230 231 $list = new TopLossesList();232 $list->addVictimAlliance( $alliance);233 $list->setPodsNoobShips( false);234 $list->setMonth( date( "m" ));235 $list->setYear( date( "Y" ));236 $table = new TopPilotTable( $list, "Losses");237 $html .= $table->generate();238 239 $html .= "</td><td valign=top width=400>";240 $html .= "<div class=block-header>All time</div>";241 242 $list = new TopLossesList();243 $list->addVictimAlliance( $alliance);244 $list->setPodsNoobShips( false);245 $table = new TopPilotTable( $list, "Losses");246 $html .= $table->generate();247 248 $html .= "</td></tr></table>";249 250 break;228 $html .= "<div class=block-header2>Top losers</div>"; 229 230 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 231 $html .= "<div class=block-header>This month</div>"; 232 233 $list = new TopLossesList(); 234 $list->addVictimAlliance($alliance); 235 $list->setPodsNoobShips(false); 236 $list->setMonth(date("m")); 237 $list->setYear(date("Y")); 238 $table = new TopPilotTable($list, "Losses"); 239 $html .= $table->generate(); 240 241 $html .= "</td><td valign=top width=400>"; 242 $html .= "<div class=block-header>All time</div>"; 243 244 $list = new TopLossesList(); 245 $list->addVictimAlliance($alliance); 246 $list->setPodsNoobShips(false); 247 $table = new TopPilotTable($list, "Losses"); 248 $html .= $table->generate(); 249 250 $html .= "</td></tr></table>"; 251 252 break; 251 253 case "ships_weapons": 252 $html .= "<div class=block-header2>Ships & weapons used</div>"; 253 254 $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; 255 $shiplist = new TopShipList(); 256 $shiplist->addInvolvedAlliance( $alliance ); 257 $shiplisttable = new TopShipListTable( $shiplist ); 258 $html .= $shiplisttable->generate(); 259 $html .= "</td><td valign=top align=right width=400>"; 260 261 $weaponlist = new TopWeaponList(); 262 $weaponlist->addInvolvedAlliance( $alliance ); 263 $weaponlisttable = new TopWeaponListTable( $weaponlist ); 264 $html .= $weaponlisttable->generate(); 265 $html .= "</td></tr></table>"; 266 267 break; 268 } 269 270 $menubox = new MenuBox(); 271 $menubox->addCaption( "Kills & losses" ); 272 $menubox->addOption( "Recent activity", "?a=alliance_detail&all_id=".$alliance->getID() ); 273 $menubox->addOption( "Kills", "?a=alliance_detail&all_id=".$alliance->getID()."&view=kills" ); 274 $menubox->addOption( "Losses", "?a=alliance_detail&all_id=".$alliance->getID()."&view=losses" ); 275 $menubox->addCaption( "Corp statistics" ); 276 $menubox->addOption( "Top killers", "?a=alliance_detail&all_id=".$alliance->getID()."&view=corp_kills" ); 277 $menubox->addOption( "Top losers", "?a=alliance_detail&all_id=".$alliance->getID()."&view=corp_losses" ); 278 279 $menubox->addCaption( "Pilot statistics" ); 280 $menubox->addOption( "Top killers", "?a=alliance_detail&all_id=".$alliance->getID()."&view=pilot_kills" ); 281 282 $killboard = $page->killboard_; 283 $config = $killboard->getConfig(); 284 if ( $config->getKillPoints() ) 285 $menubox->addOption( "Top scorers", "?a=alliance_detail&all_id=".$alliance->getID()."&view=pilot_scores" ); 286 $menubox->addOption( "Top losers", "?a=alliance_detail&all_id=".$alliance->getID()."&view=pilot_losses" ); 287 $menubox->addCaption( "Global statistics" ); 288 $menubox->addOption( "Ships & weapons", "?a=alliance_detail&all_id=".$alliance->getID()."&view=ships_weapons" ); 289 $page->addContext( $menubox->generate() ); 290 291 $page->setContent( $html ); 292 $page->generate(); 254 $html .= "<div class=block-header2>Ships & weapons used</div>"; 255 256 $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; 257 $shiplist = new TopShipList(); 258 $shiplist->addInvolvedAlliance($alliance); 259 $shiplisttable = new TopShipListTable($shiplist); 260 $html .= $shiplisttable->generate(); 261 $html .= "</td><td valign=top align=right width=400>"; 262 263 $weaponlist = new TopWeaponList(); 264 $weaponlist->addInvolvedAlliance($alliance); 265 $weaponlisttable = new TopWeaponListTable($weaponlist); 266 $html .= $weaponlisttable->generate(); 267 $html .= "</td></tr></table>"; 268 269 break; 270 } 271 272 $menubox = new MenuBox(); 273 $menubox->addCaption("Kills & losses"); 274 $menubox->addOption("Recent activity", "?a=alliance_detail&all_id=" . $alliance->getID()); 275 $menubox->addOption("Kills", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=kills"); 276 $menubox->addOption("Losses", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=losses"); 277 $menubox->addCaption("Corp statistics"); 278 $menubox->addOption("Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_kills"); 279 $menubox->addOption("Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_losses"); 280 281 $menubox->addCaption("Pilot statistics"); 282 $menubox->addOption("Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_kills"); 283 284 $killboard = $page->killboard_; 285 $config = $killboard->getConfig(); 286 if ($config->getKillPoints()) 287 $menubox->addOption("Top scorers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_scores"); 288 $menubox->addOption("Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_losses"); 289 $menubox->addCaption("Global statistics"); 290 $menubox->addOption("Ships & weapons", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=ships_weapons"); 291 $page->addContext($menubox->generate()); 292 293 $page->setContent($html); 294 $page->generate(); 295 293 296 ?> -
dev/common/cc_detail.php
r2 r10 1 <? 2 require_once( "db.php");3 require_once( "class.page.php");4 require_once( "class.killlist.php");5 require_once( "class.killlisttable.php");6 require_once( "class.killsummarytable.php" ); 7 require_once( "class.contract.php");8 require_once( "class.box.php");9 require_once( "class.toplist.php");10 require_once( "class.graph.php");1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 4 require_once("class.killlist.php"); 5 require_once("class.killlisttable.php"); 6 require_once("class.killsummarytable.php"); 7 require_once("class.contract.php"); 8 require_once("class.box.php"); 9 require_once("class.toplist.php"); 10 require_once("class.graph.php"); 11 11 12 13 14 $contract = new Contract( $ctr_id);15 16 if ( $contract->getCampaign())12 $ctr_id = $_GET['ctr_id']; 13 14 $contract = new Contract($ctr_id); 15 16 if ($contract->getCampaign()) 17 17 $title = "Campaign details"; 18 18 else 19 19 $title = "Contract details"; 20 20 21 $page = new Page( $title." - ".$contract->getName() ); 22 23 $html .= "<table align=center class=kb-table width=\"100%\" height=\"80\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=5 align=center width=80 height=80>"; 24 // table class=kb-subtable cellspacing=0><tr class=kb-table-row-even><td width=80 height=80 align=center>"; 25 26 if ( $contract->getCampaign() ) 27 $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" align=center>"; 28 else 29 $html .= "<img src=\"".IMG_URL."/contract-big.gif\" align=center>"; 30 31 $html .= "</td>"; 32 33 // $html .= "<td valign=top align=left height=80>"; 34 35 // $html .= "<table class=kb-subtable width=\"100%\" height=\"100%\" cellspacing=1 border=\"0\">"; 36 37 if ( $contract->getEndDate() == "" ) 21 $page = new Page($title . " - " . $contract->getName()); 22 23 $html .= "<table align=center class=kb-table width=\"100%\" height=\"80\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=5 align=center width=80 height=80>"; 24 // table class=kb-subtable cellspacing=0><tr class=kb-table-row-even><td width=80 height=80 align=center>"; 25 if ($contract->getCampaign()) 26 $html .= "<img src=\"" . IMG_URL . "/campaign-big.gif\" align=center>"; 27 else 28 $html .= "<img src=\"" . IMG_URL . "/contract-big.gif\" align=center>"; 29 30 $html .= "</td>"; 31 // $html .= "<td valign=top align=left height=80>"; 32 // $html .= "<table class=kb-subtable width=\"100%\" height=\"100%\" cellspacing=1 border=\"0\">"; 33 if ($contract->getEndDate() == "") 38 34 $ended = "Active"; 39 else 40 $ended = substr( $contract->getEndDate(), 0, 10 ); 41 $html .= "<td class=kb-table-cell><b>Start date:</b></td><td class=kb-table-cell width=120><b>".substr( $contract->getStartDate(), 0, 10 )."</b></td><td class=kb-table-cell><b>End date:</b></td><td class=kb-table-cell width=120><b>".$ended."</b></td></tr>"; 42 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$contract->getKills()."</td><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$contract->getLosses()."</td></tr>"; 43 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".$contract->getKillISK()."M</td><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".$contract->getLossISK()."M</td></tr>"; 44 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Runtime:</b></td><td class=kb-table-cell><b>".$contract->getRunTime()." days</b></td><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>".$contract->getEfficiency()."%</b></td></tr>"; 45 $html .= "</table>"; 46 47 // $html .= "</td></tr></table>"; 48 49 $klist = $contract->getKillList(); 50 $llist = $contract->getLossList(); 51 $killsummary = new KillSummaryTable( $klist, $llist ); 52 $killsummary->setBreak( 6 ); 53 if ( $_GET['view'] == "" ) 54 $killsummary->setFilter( false ); 55 56 $html .= "<br>"; 57 $html .= $killsummary->generate(); 35 else 36 $ended = substr($contract->getEndDate(), 0, 10); 37 $html .= "<td class=kb-table-cell><b>Start date:</b></td><td class=kb-table-cell width=120><b>" . substr($contract->getStartDate(), 0, 10) . "</b></td><td class=kb-table-cell><b>End date:</b></td><td class=kb-table-cell width=120><b>" . $ended . "</b></td></tr>"; 38 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>" . $contract->getKills() . "</td><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>" . $contract->getLosses() . "</td></tr>"; 39 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>" . $contract->getKillISK() . "M</td><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>" . $contract->getLossISK() . "M</td></tr>"; 40 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Runtime:</b></td><td class=kb-table-cell><b>" . $contract->getRunTime() . " days</b></td><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $contract->getEfficiency() . "%</b></td></tr>"; 41 $html .= "</table>"; 42 // $html .= "</td></tr></table>"; 43 $klist = $contract->getKillList(); 44 $llist = $contract->getLossList(); 45 $killsummary = new KillSummaryTable($klist, $llist); 46 $killsummary->setBreak(6); 47 if ($_GET['view'] == "") 48 $killsummary->setFilter(false); 58 49 59 switch ( $_GET['view'] ) { 50 $html .= "<br>"; 51 $html .= $killsummary->generate(); 52 53 switch ($_GET['view']) 54 { 60 55 case "": 61 while ( $target = &$contract->getContractTarget() ) { 62 $kl = &$target->getKillList(); 63 $ll = &$target->getLossList(); 64 $summary = new KillSummaryTable( $kl, $ll ); 65 $summary->setVerbose( true ); 66 $summary->setBreak( 12 ); 67 $summary->setFilter( false ); 56 while ($target = &$contract->getContractTarget()) 57 { 58 $kl = &$target->getKillList(); 59 $ll = &$target->getLossList(); 60 $summary = new KillSummaryTable($kl, $ll); 61 $summary->setVerbose(true); 62 $summary->setBreak(12); 63 $summary->setFilter(false); 68 64 69 $html .= "<br><div class=kb-contract-target-header>Target ".$target->getType()." - ".$target->getName()."</div>"; 70 $html .= $summary->generate(); 71 72 $html .= "<br><table class=kb-subtable border=\"0\" cellspacing=0 width=\"100%\"><tr><td>"; 65 $html .= "<br><div class=kb-contract-target-header>Target " . $target->getType() . " - " . $target->getName() . "</div>"; 66 $html .= $summary->generate(); 73 67 74 if ( $summary->getTotalKillISK() ) 75 $efficiency = round( $summary->getTotalKillISK() / ( $summary->getTotalKillISK() + $summary->getTotalLossISK() ) * 100, 2 ); 76 else 77 $efficiency = 0; 68 $html .= "<br><table class=kb-subtable border=\"0\" cellspacing=0 width=\"100%\"><tr><td>"; 78 69 79 $bar = new BarGraph( $efficiency, 100, 120 );80 $html .= "<table class=kb-table cellspacing=1 border=\"0\" width=\"100%\"><tr class=kb-table-row-even>";81 $html .= "<td class=kb-table-cell width=108><b>Totals:</b></td><td class=kl-kill-bg width=60 align=center>".$summary->getTotalKills()."</td><td class=kl-kill-bg width=60 align=center>".$summary->getTotalKillISK()."M</td>"; 82 $html .= "<td class=kl-loss-bg width=64 align=center>".$summary->getTotalLosses()."</td><td class=kl-loss-bg width=60 align=center>".$summary->getTotalLossISK()."M</td></tr></table>";70 if ($summary->getTotalKillISK()) 71 $efficiency = round($summary->getTotalKillISK() / ($summary->getTotalKillISK() + $summary->getTotalLossISK()) * 100, 2); 72 else 73 $efficiency = 0; 83 74 84 $html .= "</td><td align=left>"; 75 $bar = new BarGraph($efficiency, 100, 120); 76 $html .= "<table class=kb-table cellspacing=1 border=\"0\" width=\"100%\"><tr class=kb-table-row-even>"; 77 $html .= "<td class=kb-table-cell width=108><b>Totals:</b></td><td class=kl-kill-bg width=60 align=center>" . $summary->getTotalKills() . "</td><td class=kl-kill-bg width=60 align=center>" . $summary->getTotalKillISK() . "M</td>"; 78 $html .= "<td class=kl-loss-bg width=64 align=center>" . $summary->getTotalLosses() . "</td><td class=kl-loss-bg width=60 align=center>" . $summary->getTotalLossISK() . "M</td></tr></table>"; 85 79 86 $html .= "<table class=kb-table cellspacing=1 border=\"0\"><tr class=kb-table-row-even>"; 87 $html .= "<td class=kb-table-cell width=108><b>Efficiency:</b></td><td class=kb-table-cell align=center colspan=2 width=120><b>".$efficiency."%</b></td>"; 88 $html .= "<td class=kb-table-cell colspan=2 width=120>".$bar->generate()."</td></tr>"; 89 $html .= "</tr></table>"; 80 $html .= "</td><td align=left>"; 90 81 91 $html .= "</td></tr></table>"; 92 } 93 94 break; 82 $html .= "<table class=kb-table cellspacing=1 border=\"0\"><tr class=kb-table-row-even>"; 83 $html .= "<td class=kb-table-cell width=108><b>Efficiency:</b></td><td class=kb-table-cell align=center colspan=2 width=120><b>" . $efficiency . "%</b></td>"; 84 $html .= "<td class=kb-table-cell colspan=2 width=120>" . $bar->generate() . "</td></tr>"; 85 $html .= "</tr></table>"; 86 87 $html .= "</td></tr></table>"; 88 } 89 90 break; 95 91 case "recent_activity": 96 $html .= "<div class=kb-kills-header>10 Most recent kills</div>";92 $html .= "<div class=kb-kills-header>10 Most recent kills</div>"; 97 93 98 $contract = new Contract( $ctr_id);99 $klist = $contract->getKillList();100 $klist->setOrdered( true);101 if ( $_GET['scl_id'])102 $klist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));103 else104 $klist->setPodsNoobShips( false);94 $contract = new Contract($ctr_id); 95 $klist = $contract->getKillList(); 96 $klist->setOrdered(true); 97 if ($_GET['scl_id']) 98 $klist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 99 else 100 $klist->setPodsNoobShips(false); 105 101 106 $table = new KillListTable( $klist);107 $table->setLimit( 10);108 $table->setDayBreak( false);109 $html .= $table->generate();102 $table = new KillListTable($klist); 103 $table->setLimit(10); 104 $table->setDayBreak(false); 105 $html .= $table->generate(); 110 106 111 $html .= "<div class=kb-losses-header>10 Most recent losses</div>";112 $llist = $contract->getLossList();113 $llist->setOrdered( true);114 if ( $_GET['scl_id'])115 $llist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));116 else117 $llist->setPodsNoobShips( false);107 $html .= "<div class=kb-losses-header>10 Most recent losses</div>"; 108 $llist = $contract->getLossList(); 109 $llist->setOrdered(true); 110 if ($_GET['scl_id']) 111 $llist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 112 else 113 $llist->setPodsNoobShips(false); 118 114 119 $table = new KillListTable( $llist);120 $table->setLimit( 10);121 $table->setDayBreak( false);122 $html .= $table->generate();123 break;115 $table = new KillListTable($llist); 116 $table->setLimit(10); 117 $table->setDayBreak(false); 118 $html .= $table->generate(); 119 break; 124 120 case "kills": 125 $html .= "<div class=kb-kills-header>All kills</div>";121 $html .= "<div class=kb-kills-header>All kills</div>"; 126 122 127 $contract = new Contract( $ctr_id);128 $list = $contract->getKillList();129 $list->setOrdered( true);130 if ( $_GET['scl_id'])131 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));123 $contract = new Contract($ctr_id); 124 $list = $contract->getKillList(); 125 $list->setOrdered(true); 126 if ($_GET['scl_id']) 127 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 132 128 133 $pagesplitter = new PageSplitter( $list->getCount(), 30);134 $list->setPageSplitter( $pagesplitter);135 $table = new KillListTable( $list);136 $table->setDayBreak( false);137 $html .= $table->generate();138 $html .= $pagesplitter->generate();139 break;129 $pagesplitter = new PageSplitter($list->getCount(), 30); 130 $list->setPageSplitter($pagesplitter); 131 $table = new KillListTable($list); 132 $table->setDayBreak(false); 133 $html .= $table->generate(); 134 $html .= $pagesplitter->generate(); 135 break; 140 136 case "losses": 141 $html .= "<div class=kb-losses-header>All losses</div>";137 $html .= "<div class=kb-losses-header>All losses</div>"; 142 138 143 $contract = new Contract( $ctr_id ); 144 $llist = $contract->getLossList(); 145 $llist->setOrdered( true ); 146 if ( $_GET['scl_id'] ) 147 $llist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ) ); 148 149 $pagesplitter = new PageSplitter( $llist->getCount(), 30 ); 150 $llist->setPageSplitter( $pagesplitter ); 151 $table = new KillListTable( $llist ); 152 $table->setDayBreak( false ); 153 $html .= $table->generate(); 154 $html .= $pagesplitter->generate(); 155 break; 156 } 139 $contract = new Contract($ctr_id); 140 $llist = $contract->getLossList(); 141 $llist->setOrdered(true); 142 if ($_GET['scl_id']) 143 $llist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 157 144 158 $menubox = new MenuBox(); 159 $menubox->addCaption( "Overview" ); 160 $menubox->addOption( "Target overview", "?a=cc_detail&ctr_id=".$_GET['ctr_id'] ); 161 $menubox->addCaption( "Kills & losses" ); 162 $menubox->addOption( "Recent activity", "?a=cc_detail&ctr_id=".$_GET['ctr_id']."&view=recent_activity" ); 163 $menubox->addOption( "All kills", "?a=cc_detail&ctr_id=".$_GET['ctr_id']."&view=kills" ); 164 $menubox->addOption( "All losses", "?a=cc_detail&ctr_id=".$_GET['ctr_id']."&view=losses" ); 145 $pagesplitter = new PageSplitter($llist->getCount(), 30); 146 $llist->setPageSplitter($pagesplitter); 147 $table = new KillListTable($llist); 148 $table->setDayBreak(false); 149 $html .= $table->generate(); 150 $html .= $pagesplitter->generate(); 151 break; 152 } 165 153 166 $page->addContext( $menubox->generate() ); 154 $menubox = new MenuBox(); 155 $menubox->addCaption("Overview"); 156 $menubox->addOption("Target overview", "?a=cc_detail&ctr_id=" . $_GET['ctr_id']); 157 $menubox->addCaption("Kills & losses"); 158 $menubox->addOption("Recent activity", "?a=cc_detail&ctr_id=" . $_GET['ctr_id'] . "&view=recent_activity"); 159 $menubox->addOption("All kills", "?a=cc_detail&ctr_id=" . $_GET['ctr_id'] . "&view=kills"); 160 $menubox->addOption("All losses", "?a=cc_detail&ctr_id=" . $_GET['ctr_id'] . "&view=losses"); 167 161 168 $tklist = new TopContractKillsList(); 169 $tklist->setContract( new Contract( $ctr_id ) ); 170 if ( CORP_ID ) 171 $tklist->addInvolvedCorp( new Corporation( CORP_ID ) ); 172 if ( ALLIANCE_ID ) 173 $tklist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) ); 174 175 $tklist->generate(); 176 if ( $contract->getCampaign() ) 162 $page->addContext($menubox->generate()); 163 164 $tklist = new TopContractKillsList(); 165 $tklist->setContract(new Contract($ctr_id)); 166 if (CORP_ID) 167 $tklist->addInvolvedCorp(new Corporation(CORP_ID)); 168 if (ALLIANCE_ID) 169 $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 170 171 $tklist->generate(); 172 if ($contract->getCampaign()) 177 173 $campaign = "campaign"; 178 174 else 179 175 $campaign = "contract"; 180 $tkbox = new AwardBox( $tklist, "Top killers", "kills in this ".$campaign, "kills", "eagle");176 $tkbox = new AwardBox($tklist, "Top killers", "kills in this " . $campaign, "kills", "eagle"); 181 177 182 $page->addContext( $tkbox->generate() ); 178 $page->addContext($tkbox->generate()); 183 179 184 $killboard = $page->killboard_; 185 $config = $killboard->getConfig(); 186 if ( $config->getKillPoints() ) { 180 $killboard = $page->killboard_; 181 $config = $killboard->getConfig(); 182 if ($config->getKillPoints()) 183 { 187 184 $tklist = new TopContractScoreList(); 188 $tklist->setContract( new Contract( $ctr_id ));189 if ( CORP_ID)190 $tklist->addInvolvedCorp( new Corporation( CORP_ID ));191 if ( ALLIANCE_ID)192 $tklist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ));193 185 $tklist->setContract(new Contract($ctr_id)); 186 if (CORP_ID) 187 $tklist->addInvolvedCorp(new Corporation(CORP_ID)); 188 if (ALLIANCE_ID) 189 $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 190 194 191 $tklist->generate(); 195 $tkbox = new AwardBox( $tklist, "Top scorers", "points in this ".$campaign, "points", "redcross");196 $page->addContext( $tkbox->generate() );197 198 199 $page->setContent( $html);200 192 $tkbox = new AwardBox($tklist, "Top scorers", "points in this " . $campaign, "points", "redcross"); 193 $page->addContext($tkbox->generate()); 194 } 195 196 $page->setContent($html); 197 $page->generate(); 201 198 ?> -
dev/common/class.box.php
r2 r10 1 <? 2 require_once( "class.graph.php");1 <?php 2 require_once("class.graph.php"); 3 3 4 5 6 function Box( $title = "")4 class Box 5 { 6 function Box($title = "") 7 7 { 8 $this->title_ = $title;8 $this->title_ = $title; 9 9 } 10 10 11 function setContent( $html)11 function setContent($html) 12 12 { 13 $this->content_ = $html; 14 } 15 16 function setHeight( $height ) 17 { 18 $this->height_ = $height; 13 $this->content_ = $html; 19 14 } 20 15 21 function set Icon( $icon)16 function setHeight($height) 22 17 { 23 $this->icon_ = $icon; 18 $this->height_ = $height; 19 } 20 21 function setIcon($icon) 22 { 23 $this->icon_ = $icon; 24 24 } 25 25 26 26 function generate() 27 27 { 28 $html = "<table class=kb-table width=150";29 if ( $this->height_ ) $html .= " height=".$this->height_;30 $html .= " cellspacing=\"1\"><tr>";31 $html .= "<td class=kb-table-header align=center>";32 if ( $this->icon_ ) $html .= "<img src=\"".IMG_URL."/".$this->icon_."\" border=\"0\">";33 $html .= $this->title_."</td></tr>";34 $html .= "<tr class=kb-table-row-even><td>".$this->content_."</td></tr>";35 $html .= "</table><p>";28 $html = "<table class=kb-table width=150"; 29 if ($this->height_) $html .= " height=" . $this->height_; 30 $html .= " cellspacing=\"1\"><tr>"; 31 $html .= "<td class=kb-table-header align=center>"; 32 if ($this->icon_) $html .= "<img src=\"" . IMG_URL . "/" . $this->icon_ . "\" border=\"0\">"; 33 $html .= $this->title_ . "</td></tr>"; 34 $html .= "<tr class=kb-table-row-even><td>" . $this->content_ . "</td></tr>"; 35 $html .= "</table><p>"; 36 36 37 return $html;37 return $html; 38 38 } 39 39 } 40 40 41 42 41 class MenuBox 42 { 43 43 function MenuBox() 44 44 { 45 $this->box_ = new Box( "Menu");46 //$this->box_->setIcon( "menu.gif" );45 $this->box_ = new Box("Menu"); 46 // $this->box_->setIcon( "menu.gif" ); 47 47 } 48 48 49 function addCaption( $name)49 function addCaption($name) 50 50 { 51 $this->html_ .= "<div class=menu-caption>".$name."</div>";51 $this->html_ .= "<div class=menu-caption>" . $name . "</div>"; 52 52 } 53 53 54 function addOption( $name, $url, $icon = "")54 function addOption($name, $url, $icon = "") 55 55 { 56 $this->html_ .= "<div class=menu-item>";57 if ( $icon == "") $icon = "menu-item.gif";58 $this->html_ .= "<img src=\"".IMG_URL."/".$icon."\" border=\"0\"> <a href=\"".$url."\">".$name."</a><br>";59 $this->html_ .= "</div>";56 $this->html_ .= "<div class=menu-item>"; 57 if ($icon == "") $icon = "menu-item.gif"; 58 $this->html_ .= "<img src=\"" . IMG_URL . "/" . $icon . "\" border=\"0\"> <a href=\"" . $url . "\">" . $name . "</a><br>"; 59 $this->html_ .= "</div>"; 60 60 } 61 62 function setHeight( $height)61 62 function setHeight($height) 63 63 { 64 $this->box_->setHeight( $height);64 $this->box_->setHeight($height); 65 65 } 66 66 67 67 function generate() 68 68 { 69 $this->box_->setContent( "<div class=menu-wrapper>".$this->html_."</div>");70 return $this->box_->generate();69 $this->box_->setContent("<div class=menu-wrapper>" . $this->html_ . "</div>"); 70 return $this->box_->generate(); 71 71 } 72 73 74 75 76 function AwardBox( $list, $title, $comment, $entity, $award)72 } 73 74 class AwardBox 75 { 76 function AwardBox($list, $title, $comment, $entity, $award) 77 77 { 78 $this->toplist_ = $list;79 $this->box_ = new Box( $title);80 $this->comment_ = $comment;81 $this->entity_ = $entity;82 $this->award_ = $award;78 $this->toplist_ = $list; 79 $this->box_ = new Box($title); 80 $this->comment_ = $comment; 81 $this->entity_ = $entity; 82 $this->award_ = $award; 83 83 } 84 84 85 85 function generate() 86 86 { 87 $rows = array(); 88 $max = 0; 89 for ( $i = 1; $i < 4; $i++ ) { 90 $row = $this->toplist_->getRow(); 91 if ( $row ) array_push( $rows, $row ); 92 if ( $row['cnt'] > $max ) $max = $row['cnt']; 93 } 94 if ( !$rows[0]['plt_id'] ) return; 95 $pilot = new Pilot( $rows[0]['plt_id'] ); 87 $rows = array(); 88 $max = 0; 89 for ($i = 1; $i < 4; $i++) 90 { 91 $row = $this->toplist_->getRow(); 92 if ($row) array_push($rows, $row); 93 if ($row['cnt'] > $max) $max = $row['cnt']; 94 } 95 if (!$rows[0]['plt_id']) return; 96 $pilot = new Pilot($rows[0]['plt_id']); 96 97 97 $html .= "<table class=kb-subtable cellspacing=0 border=0 width=\"100%\"><tr class=kb-table-row-odd>";98 $html .= "<td align=left>";99 $html .= "<img src=\"".$pilot->getPortraitURL( 64 )."\">";100 $html .= "</td><td align=center>";101 $html .= "<img src=\"".IMG_URL."/awards/".$this->award_.".gif\">";102 $html .= "</td>";103 $html .= "</tr></table>";104 $html .= "<table class=kb-subtable cellspacing=0 border=0 width=\"100%\">";105 $html .= "<tr><td width=15><b>1.</b></td><td align=left colspan=2><a class=kb-shipclass href=\"?a=pilot_detail&plt_id=".$rows[0]['plt_id']."\">".$pilot->getName()."</a></td><td></td></tr><tr>";106 $bar = new BarGraph( $rows[0]['cnt'], $max, 60);107 $html .= "<td></td><td align=left>".$bar->generate()."</td>";108 $html .= "<td align=right><b>".$rows[0]['cnt']."</b></td><td></td></tr>";98 $html .= "<table class=kb-subtable cellspacing=0 border=0 width=\"100%\"><tr class=kb-table-row-odd>"; 99 $html .= "<td align=left>"; 100 $html .= "<img src=\"" . $pilot->getPortraitURL(64) . "\">"; 101 $html .= "</td><td align=center>"; 102 $html .= "<img src=\"" . IMG_URL . "/awards/" . $this->award_ . ".gif\">"; 103 $html .= "</td>"; 104 $html .= "</tr></table>"; 105 $html .= "<table class=kb-subtable cellspacing=0 border=0 width=\"100%\">"; 106 $html .= "<tr><td width=15><b>1.</b></td><td align=left colspan=2><a class=kb-shipclass href=\"?a=pilot_detail&plt_id=" . $rows[0]['plt_id'] . "\">" . $pilot->getName() . "</a></td><td></td></tr><tr>"; 107 $bar = new BarGraph($rows[0]['cnt'], $max, 60); 108 $html .= "<td></td><td align=left>" . $bar->generate() . "</td>"; 109 $html .= "<td align=right><b>" . $rows[0]['cnt'] . "</b></td><td></td></tr>"; 109 110 110 for ( $i = 2; $i < 4; $i++ ) { 111 if ( !$rows[$i - 1]['plt_id'] ) break; 112 $pilot = new Pilot( $rows[$i - 1]['plt_id'] ); 113 $html .= "<tr><td><b>".$i.".</b></td><td colspan=2><a class=kb-shipclass href=\"?a=pilot_detail&plt_id=".$rows[$i - 1]['plt_id']."\">".$pilot->getName()."</a></td></tr><tr>"; 114 $bar = new BarGraph( $rows[$i - 1]['cnt'], $max, 60 ); 115 $html .= "<td></td><td align=left>".$bar->generate()."</td>"; 116 $html .= "<td align=right><b>".$rows[$i - 1]['cnt']."</b></td></tr>"; 117 } 111 for ($i = 2; $i < 4; $i++) 112 { 113 if (!$rows[$i - 1]['plt_id']) break; 114 $pilot = new Pilot($rows[$i - 1]['plt_id']); 115 $html .= "<tr><td><b>" . $i . ".</b></td><td colspan=2><a class=kb-shipclass href=\"?a=pilot_detail&plt_id=" . $rows[$i - 1]['plt_id'] . "\">" . $pilot->getName() . "</a></td></tr><tr>"; 116 $bar = new BarGraph($rows[$i - 1]['cnt'], $max, 60); 117 $html .= "<td></td><td align=left>" . $bar->generate() . "</td>"; 118 $html .= "<td align=right><b>" . $rows[$i - 1]['cnt'] . "</b></td></tr>"; 119 } 118 120 119 $html .= "<tr><td colspan=3 align=center>(".$this->comment_.")</td></tr>";121 $html .= "<tr><td colspan=3 align=center>(" . $this->comment_ . ")</td></tr>"; 120 122 121 $html .= "</table>";123 $html .= "</table>"; 122 124 123 $this->box_->setContent( $html);124 return $this->box_->generate();125 $this->box_->setContent($html); 126 return $this->box_->generate(); 125 127 } 126 } 127 128 } 128 129 ?> -
dev/common/class.corp.php
r2 r10 1 <? 2 require_once( "db.php");3 require_once( "class.alliance.php");1 <?php 2 require_once("db.php"); 3 require_once("class.alliance.php"); 4 4 5 class Corporation { 5 class Corporation 6 { 7 function Corporation($id = 0) 8 { 9 $this->id_ = $id; 10 $this->qry_ = new DBQuery(); 11 } 6 12 7 function Corporation( $id = 0)13 function isNPCCorp() 8 14 { 9 $this->id_ = $id; 10 $this->qry_ = new DBQuery(); 15 global $corp_npc; 16 if (in_array($this->getName(), $corp_npc)) 17 { 18 return true; 19 } 20 } 11 21 22 function getPortraitURL($size = 64) 23 { 24 return "?a=corpportrait&id=".$this->id_."&size=".$size; 12 25 } 13 26 14 27 function getID() 15 28 { 16 return $this->id_;29 return $this->id_; 17 30 } 18 31 19 32 function getName() 20 33 { 21 $this->execQuery();22 return $this->row_['crp_name'];34 $this->execQuery(); 35 return $this->row_['crp_name']; 23 36 } 24 37 25 38 function getAlliance() 26 39 { 27 $this->execQuery();28 return new Alliance( $this->row_['crp_all_id']);40 $this->execQuery(); 41 return new Alliance($this->row_['crp_all_id']); 29 42 } 30 43 31 function lookup( $name)44 function lookup($name) 32 45 { 33 $qry = new DBQuery();34 $qry->execute("select *46 $qry = new DBQuery(); 47 $qry->execute("select * 35 48 from kb3_corps 36 where crp_name = '" .slashfix( $name )."'");37 38 $row = $qry->getRow();39 if ( $row['crp_id']) $this->id_ = $row['crp_id'];49 where crp_name = '" . slashfix($name) . "'"); 50 51 $row = $qry->getRow(); 52 if ($row['crp_id']) $this->id_ = $row['crp_id']; 40 53 } 41 54 42 55 function execQuery() 43 56 { 44 if ( !$this->qry_->executed_ ) { 45 $this->sql_ = "select * 57 if (!$this->qry_->executed_) 58 { 59 $this->sql_ = "select * 46 60 from kb3_corps 47 where crp_id = " .$this->id_;48 $this->qry_->execute( $this->sql_);49 50 }61 where crp_id = " . $this->id_; 62 $this->qry_->execute($this->sql_); 63 $this->row_ = $this->qry_->getRow(); 64 } 51 65 } 52 66 53 function add( $name, $alliance, $timestamp)67 function add($name, $alliance, $timestamp) 54 68 { 55 $qry = new DBQuery();56 $qry->execute("select *69 $qry = new DBQuery(); 70 $qry->execute("select * 57 71 from kb3_corps 58 where crp_name = '".slashfix( $name )."'" ); 59 60 if ( $qry->recordCount() == 0 ) { 61 $qry->execute( "insert into kb3_corps values ( null, 62 '".slashfix( $name )."', 63 ".$alliance->getID().", 72 where crp_name = '" . slashfix($name) . "'"); 73 74 if ($qry->recordCount() == 0) 75 { 76 $qry->execute("insert into kb3_corps values ( null, 77 '" . slashfix($name) . "', 78 " . $alliance->getID() . ", 64 79 0, 65 80 date_format( '" 66 .$timestamp."',81 . $timestamp . "', 67 82 '%Y.%m.%d %H:%i:%s') 68 )" ); 69 $this->id_ = $qry->getInsertID(); 70 } 71 else { 72 $row = $qry->getRow(); 73 $this->id_ = $row['crp_id']; 74 if ( $this->isUpdatable( $timestamp ) && 75 $row['crp_all_id'] != $alliance->getID() ) { 76 $qry->execute( "update kb3_corps 77 set crp_all_id = ".$alliance->getID().", 78 crp_updated = date_format( '".$timestamp."', 83 )"); 84 $this->id_ = $qry->getInsertID(); 85 } 86 else 87 { 88 $row = $qry->getRow(); 89 $this->id_ = $row['crp_id']; 90 if ($this->isUpdatable($timestamp) && $row['crp_all_id'] != $alliance->getID()) 91 { 92 $qry->execute("update kb3_corps 93 set crp_all_id = " . $alliance->getID() . ", 94 crp_updated = date_format( '" . $timestamp . "', 79 95 '%Y.%m.%d %H:%i:%s') 80 where crp_id = ".$this->id_ ); 96 where crp_id = " . $this->id_); 97 } 81 98 } 82 }83 99 84 return $this->id_;100 return $this->id_; 85 101 } 86 102 87 function isUpdatable( $timestamp)103 function isUpdatable($timestamp) 88 104 { 89 $qry = new DBQuery();90 $qry->execute("select crp_id105 $qry = new DBQuery(); 106 $qry->execute("select crp_id 91 107 from kb3_corps 92 where crp_id = " .$this->id_."93 and ( crp_updated < date_format( '" .$timestamp."',108 where crp_id = " . $this->id_ . " 109 and ( crp_updated < date_format( '" . $timestamp . "', 94 110 '%Y.%m.%d %H:%i' ) 95 or crp_updated is null )" 111 or crp_updated is null )"); 96 112 97 return $qry->recordCount() == 1;113 return $qry->recordCount() == 1; 98 114 } 99 115 } 100 116 ?> -
dev/common/class.killboard.php
r2 r10 1 <? 2 require_once( "db.php");1 <?php 2 require_once("db.php"); 3 3 4 class Killboard { 4 class Killboard 5 { 6 function Killboard($site) 7 { 8 $this->qry_ = new DBQuery(); 5 9 6 function Killboard( $site ) 7 { 8 $this->qry_ = new DBQuery(); 9 10 $this->site_ = $site; 11 $this->config_ = new Config( $site ); 10 $this->site_ = $site; 11 $this->config_ = new Config($site); 12 12 } 13 13 14 14 function isSuspended() 15 15 { 16 $this->execQuery();17 return $this->row_['rtl_suspended'] == "1";16 $this->execQuery(); 17 return $this->row_['rtl_suspended'] == "1"; 18 18 } 19 19 20 20 function getConfig() 21 21 { 22 $this->execQuery();23 return $this->config_;22 $this->execQuery(); 23 return $this->config_; 24 24 } 25 25 26 function hasCampaigns( $active = false)26 function hasCampaigns($active = false) 27 27 { 28 $qry = new DBQuery();29 $sql ="select ctr_id28 $qry = new DBQuery(); 29 $sql = "select ctr_id 30 30 from kb3_contracts 31 31 where ctr_campaign = 1 32 and ctr_site = '" .$this->site_."'";33 if ( $active) $sql .= " and ctr_ended is null";34 $qry->execute( $sql ) or die ( $qry->getErrorMessage());35 return ( $qry->recordCount() > 0);32 and ctr_site = '" . $this->site_ . "'"; 33 if ($active) $sql .= " and ctr_ended is null"; 34 $qry->execute($sql) or die ($qry->getErrorMessage()); 35 return ($qry->recordCount() > 0); 36 36 } 37 37 38 function hasContracts( $active = false)38 function hasContracts($active = false) 39 39 { 40 $qry = new DBQuery();41 $sql ="select ctr_id40 $qry = new DBQuery(); 41 $sql = "select ctr_id 42 42 from kb3_contracts 43 43 where ctr_campaign = 0 44 and ctr_site = '" .$this->site_."'";45 if ( $active) $sql .= " and ( ctr_ended is null or now() <= ctr_ended )";46 $qry->execute( $sql ) or die ( $qry->getErrorMessage());47 return ( $qry->recordCount() > 0);44 and ctr_site = '" . $this->site_ . "'"; 45 if ($active) $sql .= " and ( ctr_ended is null or now() <= ctr_ended )"; 46 $qry->execute($sql) or die ($qry->getErrorMessage()); 47 return ($qry->recordCount() > 0); 48 48 } 49 49 … … 51 51 { 52 52 } 53 53 } 54 54 55 56 57 function Config( $site)55 class Config 56 { 57 function Config($site) 58 58 { 59 $this->qry_ = new DBQuery(); 60 $this->sql_ = "select * 61 from kb3_config 62 where cfg_site = '".$site."'"; 59 $this->qry_ = new DBQuery(); 60 $this->sql_ = "select * from kb3_config where cfg_site = '" . $site . "'"; 63 61 64 $this->site_ = $site;62 $this->site_ = $site; 65 63 } 66 64 67 65 function getStyleName() 68 66 { 69 $this->execQuery();70 return $this->style_name_;67 $this->execQuery(); 68 return $this->config['style_name']; 71 69 } 72 70 73 71 function getStyleBanner() 74 72 { 75 $this->execQuery();76 return $this->style_banner_;73 $this->execQuery(); 74 return $this->config['style_banner']; 77 75 } 78 76 79 77 function getPostPassword() 80 78 { 81 $this->execQuery();82 return $this->post_password_;79 $this->execQuery(); 80 return $this->config['post_password']; 83 81 } 84 82 85 83 function getPostMailto() 86 84 { 87 $this->execQuery();88 return $this->post_mailto_;85 $this->execQuery(); 86 return $this->config['post_mailto']; 89 87 } 90 88 91 89 function getKillPoints() 92 90 { 93 $this->execQuery();94 return $this->kill_points_;91 $this->execQuery(); 92 return $this->config['kill_points']; 95 93 } 96 94 97 95 function getLeastActive() 98 96 { 99 $this->execQuery();100 return $this->least_active_;97 $this->execQuery(); 98 return $this->config['least_active']; 101 99 } 102 100 103 function setConfig( $key, $value)101 function getConfig($key) 104 102 { 105 $qry = new DBQuery(); 106 $qry->execute( "select cfg_value from kb3_config 107 where cfg_key = '".$key."' 108 and cfg_site = '".$this->site_."'" ); 109 if ( $qry->recordCount() ) { 110 $sql = "update kb3_config 111 set cfg_value = '".$value."' 112 where cfg_site = '".$this->site_."' 113 and cfg_key = '".$key."'"; 114 } else { 115 $sql = "insert into kb3_config values ( '".$this->site_."', 116 '".$key."', 117 '".$value."' )"; 118 } 119 $qry->execute( $sql ) or die( $qry->getErrorMsg() ); 120 } 121 122 function setStyleName( $name ) 123 { 124 $this->setConfig( "style_name", $name ); 103 $this->execQuery(); 104 return $this->config[$key]; 125 105 } 126 106 127 function set StyleBanner( $banner)107 function setConfig($key, $value) 128 108 { 129 $this->setConfig( "style_banner", $banner ); 109 $qry = new DBQuery(); 110 $qry->execute("select cfg_value from kb3_config 111 where cfg_key = '" . $key . "' 112 and cfg_site = '" . $this->site_ . "'"); 113 if ($qry->recordCount()) 114 { 115 $sql = "update kb3_config 116 set cfg_value = '" . $value . "' 117 where cfg_site = '" . $this->site_ . "' 118 and cfg_key = '" . $key . "'"; 119 } 120 else 121 { 122 $sql = "insert into kb3_config values ( '" . $this->site_ . "', 123 '" . $key . "', 124 '" . $value . "' )"; 125 } 126 $qry->execute($sql) or die($qry->getErrorMsg()); 127 $this->config[$key] = $value; 130 128 } 131 129 132 function set PostPassword( $password)130 function setStyleName($name) 133 131 { 134 $this->setConfig( "post_password", $password);132 $this->setConfig("style_name", $name); 135 133 } 136 134 137 function set PostMailto( $mailto)135 function setStyleBanner($banner) 138 136 { 139 $this->setConfig( "post_mailto", $mailto);137 $this->setConfig("style_banner", $banner); 140 138 } 141 139 142 function set KillPoints( $flag)140 function setPostPassword($password) 143 141 { 144 $this->setConfig( "kill_points", $flag);142 $this->setConfig("post_password", $password); 145 143 } 146 144 147 function set LeastActive( $flag)145 function setPostMailto($mailto) 148 146 { 149 $this->setConfig( "least_active", $flag ); 147 $this->setConfig("post_mailto", $mailto); 148 } 149 150 function setKillPoints($flag) 151 { 152 $this->setConfig("kill_points", $flag); 153 } 154 155 function setLeastActive($flag) 156 { 157 $this->setConfig("least_active", $flag); 150 158 } 151 159 152 160 function execQuery() 153 161 { 154 if ( !$this->qry_->executed_ ) { 155 $this->qry_->execute( $this->sql_ ); 162 if (!$this->qry_->executed_) 163 { 164 $this->qry_->execute($this->sql_); 156 165 157 while ( $row = $this->qry_->getRow() ) 158 { 159 switch( $row['cfg_key'] ) { 160 case 'style_name': 161 $this->style_name_ = $row['cfg_value']; 162 break; 163 case 'style_banner': 164 $this->style_banner_ = $row['cfg_value']; 165 break; 166 case 'post_password': 167 $this->post_password_ = $row['cfg_value']; 168 break; 169 case 'post_mailto': 170 $this->post_mailto_ = $row['cfg_value']; 171 break; 172 case 'kill_points': 173 $this->kill_points_ = $row['cfg_value']; 174 break; 175 case 'least_active': 176 $this->least_active_ = $row['cfg_value']; 177 break; 178 } 179 } 180 } 166 $this->config = array(); 167 while ($row = $this->qry_->getRow()) 168 { 169 $this->config[$row['cfg_key']] = $row['cfg_value']; 170 } 171 if (count($this->config) == 0) 172 { 173 // no config supplied, generate standard one 174 175 $this->setConfig('style_name', 'default'); 176 $this->setConfig('style_banner', 'default'); 177 $this->setConfig('kill_points', 1); 178 $this->setConfig('least_active', 0); 179 $this->setConfig('post_password', 'CHANGEME'); 180 } 181 } 181 182 } 182 183 } 183 184 ?> -
dev/common/class.killlist.php
r2 r10 1 <? 2 require_once( "class.kill.php");3 require_once( "class.profiler.php");4 require_once( "class.pagesplitter.php");5 6 7 1 <?php 2 require_once("class.kill.php"); 3 require_once("class.profiler.php"); 4 require_once("class.pagesplitter.php"); 5 6 class KillList 7 { 8 8 function KillList() 9 9 { 10 $this->qry_ = new DBQuery();11 $this->killpointer_ = 0;12 $this->kills_ = 0;13 $this->losses_ = 0;14 $this->killisk_ = 0;15 $this->lossisk_ = 0;16 $this->exclude_scl_ = array();17 $this->vic_scl_id_ = array();18 $this->regions_ = array();19 $this->groupby_ = array();20 $this->offset_ = 0;21 $this->killcounter_ = 0;22 $this->realkillcounter_ = 0;23 $this->ordered_ = false;10 $this->qry_ = new DBQuery(); 11 $this->killpointer_ = 0; 12 $this->kills_ = 0; 13 $this->losses_ = 0; 14 $this->killisk_ = 0; 15 $this->lossisk_ = 0; 16 $this->exclude_scl_ = array(); 17 $this->vic_scl_id_ = array(); 18 $this->regions_ = array(); 19 $this->groupby_ = array(); 20 $this->offset_ = 0; 21 $this->killcounter_ = 0; 22 $this->realkillcounter_ = 0; 23 $this->ordered_ = false; 24 24 } 25 25 26 26 function execQuery() 27 27 { 28 if ( !$this->qry_->executed_ ) {29 30 if ( !count( $this->groupby_ ))31 $this->sql_ = "select kll.kll_id, kll.kll_timestamp, plt.plt_name,28 if (!$this->qry_->executed_) 29 { 30 if (!count($this->groupby_)) 31 $this->sql_ = "select kll.kll_id, kll.kll_timestamp, plt.plt_name, 32 32 crp.crp_name, ali.all_name, kll.kll_ship_id, 33 33 kll.kll_system_id, kll.kll_ship_id, … … 41 41 fbcrp.crp_name as fbcrp_name"; 42 42 43 if ( count( $this->groupby_ ) ) { 44 $this->sql_ .= "select count(*) as cnt, ".implode( ",", $this->groupby_ ); 45 } 46 47 $this->sql_ .= " from kb3_kills kll 43 if (count($this->groupby_)) 44 { 45 $this->sql_ .= "select count(*) as cnt, " . implode(",", $this->groupby_); 46 } 47 48 $this->sql_ .= " from kb3_kills kll 48 49 inner join kb3_ships shp 49 50 on ( shp.shp_id = kll.kll_ship_id ) … … 62 63 inner join kb3_systems sys 63 64 on ( sys.sys_id = kll.kll_system_id )"; 64 65 // involved filter 66 if ( ! $this->mixedinvolved_ ) { 67 if ( $this->inv_plt_ ) 68 $this->sql_ .= " inner join kb3_inv_plt inp 69 on ( inp.inp_plt_id in ( ".substr( $this->inv_plt_, 0, strlen( $this->inv_plt_ ) - 2 )." ) and kll.kll_id = inp.inp_kll_id ) "; 70 if ( $this->inv_crp_ ) 71 $this->sql_ .= " inner join kb3_inv_crp inc 72 on ( inc.inc_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." ) and kll.kll_id = inc.inc_kll_id ) "; 73 if ( $this->inv_all_ ) 74 $this->sql_ .= " inner join kb3_inv_all ina 75 on ( ina.ina_all_id in ( ".substr( $this->inv_all_, 0, strlen( $this->inv_all_ ) - 2 )." ) and kll.kll_id = ina.ina_kll_id ) "; 76 } 77 else { 78 $this->sql_ .= " <ph> "; 79 } 80 //echo $this->sql_; 81 82 // regions 83 if ( count( $this->regions_ ) ) { 84 $this->sql_ .= " inner join kb3_constellations con 65 // involved filter 66 if (! $this->mixedinvolved_) 67 { 68 if ($this->inv_plt_) 69 $this->sql_ .= " inner join kb3_inv_plt inp 70 on ( inp.inp_plt_id in ( " . substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2) . " ) and kll.kll_id = inp.inp_kll_id ) "; 71 if ($this->inv_crp_) 72 $this->sql_ .= " inner join kb3_inv_crp inc 73 on ( inc.inc_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " ) and kll.kll_id = inc.inc_kll_id ) "; 74 if ($this->inv_all_) 75 $this->sql_ .= " inner join kb3_inv_all ina 76 on ( ina.ina_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) . " ) and kll.kll_id = ina.ina_kll_id ) "; 77 } 78 else 79 { 80 $this->sql_ .= " <ph> "; 81 } 82 // echo $this->sql_; 83 // regions 84 if (count($this->regions_)) 85 { 86 $this->sql_ .= " inner join kb3_constellations con 85 87 on ( con.con_id = sys.sys_con_id ) 86 88 inner join kb3_regions reg 87 89 on ( reg.reg_id = con.con_reg_id 88 and reg.reg_id in ( " .implode( $this->regions_, "," )." ) )";89 90 91 // victim filter 92 if ( $this->mixedvictims_ ){93 94 95 96 97 98 if ( $this->vic_plt_)99 $this->sql_ .= " ".$op." kll.kll_victim_id in ( ".substr( $this->vic_plt_, 0, strlen( $this->vic_plt_ ) - 2 )." )";100 if ( $this->vic_crp_)101 $this->sql_ .= " ".$op." kll.kll_crp_id in ( ".substr( $this->vic_crp_, 0, strlen( $this->vic_crp_ ) - 2 )." )";102 if ( $this->vic_all_)103 $this->sql_ .= " ".$op." kll.kll_all_id in ( ".substr( $this->vic_all_, 0, strlen( $this->vic_all_ ) - 2 )." )";104 105 if ( $this->mixedvictims_)106 107 108 //echo $this->sql_; 109 110 // ship filter111 if ( count( $this->exclude_scl_ ) ) {112 $this->sql_ .= " and scl.scl_id not in ( ".implode( ",", $this->exclude_scl_ )." )";113 }114 if ( count( $this->vic_scl_id_ ) ){115 $this->sql_ .= " and scl.scl_id in ( ".implode( ",", $this->vic_scl_id_ )." )";116 }117 118 // related 119 if ( $this->related_ ){120 121 90 and reg.reg_id in ( " . implode($this->regions_, ",") . " ) )"; 91 } 92 // victim filter 93 if ($this->mixedvictims_) 94 { 95 $this->sql_ .= " and ( 1 = 0 "; 96 $op = "or"; 97 } 98 else $op = "and"; 99 100 if ($this->vic_plt_) 101 $this->sql_ .= " " . $op . " kll.kll_victim_id in ( " . substr($this->vic_plt_, 0, strlen($this->vic_plt_) - 2) . " )"; 102 if ($this->vic_crp_) 103 $this->sql_ .= " " . $op . " kll.kll_crp_id in ( " . substr($this->vic_crp_, 0, strlen($this->vic_crp_) - 2) . " )"; 104 if ($this->vic_all_) 105 $this->sql_ .= " " . $op . " kll.kll_all_id in ( " . substr($this->vic_all_, 0, strlen($this->vic_all_) - 2) . " )"; 106 107 if ($this->mixedvictims_) 108 $this->sql_ .= " ) "; 109 // echo $this->sql_; 110 // ship filter 111 if (count($this->exclude_scl_)) 112 { 113 $this->sql_ .= " and scl.scl_id not in ( " . implode(",", $this->exclude_scl_) . " )"; 114 } 115 if (count($this->vic_scl_id_)) 116 { 117 $this->sql_ .= " and scl.scl_id in ( " . implode(",", $this->vic_scl_id_) . " )"; 118 } 119 // related 120 if ($this->related_) 121 { 122 $rqry = new DBQuery(); 123 $rsql = "select kll_timestamp, kll_system_id 122 124 from kb3_kills 123 where kll_id = ".$this->related_; 124 125 $rqry->execute( $rsql ) or die( $rqry->getErrorMsg() ); 126 $rrow = $rqry->getRow(); 127 128 $this->sql_ .= " and kll.kll_system_id = ".$rrow['kll_system_id']." 129 and kll.kll_timestamp <= 130 date_add( '".$rrow['kll_timestamp']."', INTERVAL '15:0' MINUTE_SECOND ) 131 and kll.kll_timestamp >= 132 date_sub( '".$rrow['kll_timestamp']."', INTERVAL '15:0' MINUTE_SECOND )"; 133 } 134 135 // timeframe 136 if ( $this->timeframe_ ) 137 $this->sql_ .= $this->timeframe_; 138 139 if ( !strpos( $this->sql_, " join " ) && !$this->mixedinvolved_ ) 140 $this->sqlhead_ .= " where 1 = 1"; 141 142 if ( $this->mixedinvolved_ ) { 143 if ( $this->inv_plt_ ) { 144 $replace = " inner join kb3_inv_plt inp 145 on ( inp.inp_plt_id in ( ".substr( $this->inv_plt_, 0, strlen( $this->inv_plt_ ) - 2 )." ) and kll.kll_id = inp.inp_kll_id ) "; 146 $psql = str_replace( "<ph>", $replace, $this->sql_ ); 147 } 148 if ( $this->inv_crp_ ) { 149 $replace = " inner join kb3_inv_crp inc 150 on ( inc.inc_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." ) and kll.kll_id = inc.inc_kll_id ) "; 151 $csql = str_replace( "<ph>", $replace, $this->sql_ ); 152 } 153 if ( $this->inv_all_ ) { 154 $replace = " inner join kb3_inv_all ina 155 on ( ina.ina_all_id in ( ".substr( $this->inv_all_, 0, strlen( $this->inv_all_ ) - 2 )." ) and kll.kll_id = ina.ina_kll_id ) "; 156 $asql = str_replace( "<ph>", $replace, $this->sql_ ); 157 } 158 159 if ( $psql ) 160 $nsql = $psql." union "; 161 if ( $csql ) 162 $nsql .= $csql." union "; 163 if ( $asql ) 164 $nsql .= $asql; 165 166 $this->sql_ = $nsql; 167 } 168 169 // group by 170 if ( $this->groupby_ ) $this->sql_ .= " group by ".implode( ",", $this->groupby_ ); 171 172 // order/limit 173 if ( $this->ordered_ ) { 174 if ( !$this->orderby_ ) $this->sql_ .= " order by kll_timestamp desc"; else $this->sql_ .= " order by ".$this->orderby_; 175 } 176 if ( $this->limit_ ) $this->sql_ .= " limit ".$this->offset_.", ".$this->limit_; 177 178 //echo $this->sql_."<p>"; 179 $this->qry_->execute( $this->sql_ ); 180 181 } 182 } 183 125 where kll_id = " . $this->related_; 126 127 $rqry->execute($rsql) or die($rqry->getErrorMsg()); 128 $rrow = $rqry->getRow(); 129 130 $this->sql_ .= " and kll.kll_system_id = " . $rrow['kll_system_id'] . " 131 and kll.kll_timestamp <= 132 date_add( '" . $rrow['kll_timestamp'] . "', INTERVAL '15:0' MINUTE_SECOND ) 133 and kll.kll_timestamp >= 134 date_sub( '" . $rrow['kll_timestamp'] . "', INTERVAL '15:0' MINUTE_SECOND )"; 135 } 136 // timeframe 137 if ($this->timeframe_) 138 $this->sql_ .= $this->timeframe_; 139 140 if (!strpos($this->sql_, " join ") && !$this->mixedinvolved_) 141 $this->sqlhead_ .= " where 1 = 1"; 142 143 if ($this->mixedinvolved_) 144 { 145 if ($this->inv_plt_) 146 { 147 $replace = " inner join kb3_inv_plt inp 148 on ( inp.inp_plt_id in ( " . substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2) . " ) and kll.kll_id = inp.inp_kll_id ) "; 149 $psql = str_replace("<ph>", $replace, $this->sql_); 150 } 151 if ($this->inv_crp_) 152 { 153 $replace = " inner join kb3_inv_crp inc 154 on ( inc.inc_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " ) and kll.kll_id = inc.inc_kll_id ) "; 155 $csql = str_replace("<ph>", $replace, $this->sql_); 156 } 157 if ($this->inv_all_) 158 { 159 $replace = " inner join kb3_inv_all ina 160 on ( ina.ina_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) . " ) and kll.kll_id = ina.ina_kll_id ) "; 161 $asql = str_replace("<ph>", $replace, $this->sql_); 162 } 163 164 if ($psql) 165 $nsql = $psql . " union "; 166 if ($csql) 167 $nsql .= $csql . " union "; 168 if ($asql) 169 $nsql .= $asql; 170 171 $this->sql_ = $nsql; 172 } 173 // group by 174 if ($this->groupby_) $this->sql_ .= " group by " . implode(",", $this->groupby_); 175 // order/limit 176 if ($this->ordered_) 177 { 178 if (!$this->orderby_) $this->sql_ .= " order by kll_timestamp desc"; 179 else $this->sql_ .= " order by " . $this->orderby_; 180 } 181 if ($this->limit_) $this->sql_ .= " limit " . $this->offset_ . ", " . $this->limit_; 182 // echo $this->sql_."<p>"; 183 $this->qry_->execute($this->sql_); 184 } 185 } 186 184 187 function getRow() 185 188 { 186 $this->execQuery(); 187 if ( $this->plimit_ && $this->killcounter_ >= $this->plimit_ ) 188 { 189 //echo $this->plimit_." ".$this->killcounter_; 190 return null; 191 } 192 193 $skip = $this->poffset_ - $this->killpointer_; 194 if ( $skip > 0 ) { 195 for ( $i = 0; $i < $skip; $i++ ) { 196 $this->killpointer_++; 197 $row = $this->qry_->getRow(); 198 } 199 } 200 201 $row = $this->qry_->getRow(); 202 203 return $row; 189 $this->execQuery(); 190 if ($this->plimit_ && $this->killcounter_ >= $this->plimit_) 191 { 192 // echo $this->plimit_." ".$this->killcounter_; 193 return null; 194 } 195 196 $skip = $this->poffset_ - $this->killpointer_; 197 if ($skip > 0) 198 { 199 for ($i = 0; $i < $skip; $i++) 200 { 201 $this->killpointer_++; 202 $row = $this->qry_->getRow(); 203 } 204 } 205 206 $row = $this->qry_->getRow(); 207 208 return $row; 204 209 } 205 210 206 211 function getKill() 207 212 { 208 $this->execQuery(); 209 if ( $this->plimit_ && $this->killcounter_ >= $this->plimit_ ) 210 { 211 //echo $this->plimit_." ".$this->killcounter_; 212 return null; 213 } 214 215 $skip = $this->poffset_ - $this->killpointer_; 216 if ( $skip > 0 ) { 217 for ( $i = 0; $i < $skip; $i++ ) { 218 $this->killpointer_++; 219 $row = $this->qry_->getRow(); 220 } 221 } 222 223 $row = $this->qry_->getRow(); 224 if ( $row ) { 225 $this->killcounter_++; 226 if ( $row['scl_class'] != 2 && $row['scl_class'] != 3 && $row['scl_class'] != 11 ) 227 $this->realkillcounter_++; 228 229 $this->killisk_ += $row['scl_value'] / 1000000; 230 $this->killpoints_ += $row['kll_points']; 231 232 $kill = new Kill( $row['kll_id'] ); 233 $kill->setTimeStamp( $row['kll_timestamp'] ); 234 $kill->setSolarSystemName( $row['sys_name'] ); 235 $kill->setSolarSystemSecurity( $row['sys_sec'] ); 236 $kill->setVictimName( $row['plt_name'] ); 237 $kill->setVictimCorpName( $row['crp_name'] ); 238 $kill->setVictimAllianceName( $row['ali_name'] ); 239 $kill->setVictimShipName( $row['shp_name'] ); 240 $kill->setVictimShipExternalID( $row['shp_externalid'] ); 241 $kill->setVictimShipClassName( $row['scl_class'] ); 242 $kill->setVictimShipValue( round( $row['scl_value'] / 1000000, 2 ) ); 243 $kill->setFBPilotName( $row['fbplt_name'] ); 244 $kill->setFBCorpName( $row['fbcrp_name'] ); 245 $kill->setKillPoints( $row['kll_points'] ); 246 return $kill; 247 } 248 else return null; 249 } 250 213 $this->execQuery(); 214 if ($this->plimit_ && $this->killcounter_ >= $this->plimit_) 215 { 216 // echo $this->plimit_." ".$this->killcounter_; 217 return null; 218 } 219 220 $skip = $this->poffset_ - $this->killpointer_; 221 if ($skip > 0) 222 { 223 for ($i = 0; $i < $skip; $i++) 224 { 225 $this->killpointer_++; 226 $row = $this->qry_->getRow(); 227 } 228 } 229 230 $row = $this->qry_->getRow(); 231 if ($row) 232 { 233 $this->killcounter_++; 234 if ($row['scl_class'] != 2 && $row['scl_class'] != 3 && $row['scl_class'] != 11) 235 $this->realkillcounter_++; 236 237 $this->killisk_ += $row['scl_value'] / 1000000; 238 $this->killpoints_ += $row['kll_points']; 239 240 $kill = new Kill($row['kll_id']); 241 $kill->setTimeStamp($row['kll_timestamp']); 242 $kill->setSolarSystemName($row['sys_name']); 243 $kill->setSolarSystemSecurity($row['sys_sec']); 244 $kill->setVictimName($row['plt_name']); 245 $kill->setVictimCorpName($row['crp_name']); 246 $kill->setVictimAllianceName($row['ali_name']); 247 $kill->setVictimShipName($row['shp_name']); 248 $kill->setVictimShipExternalID($row['shp_externalid']); 249 $kill->setVictimShipClassName($row['scl_class']); 250 $kill->setVictimShipValue(round($row['scl_value'] / 1000000, 2)); 251 $kill->setFBPilotName($row['fbplt_name']); 252 $kill->setFBCorpName($row['fbcrp_name']); 253 $kill->setKillPoints($row['kll_points']); 254 return $kill; 255 } 256 else return null; 257 } 258 251 259 function getAllKills() 252 260 { 253 while ( $this->getKill() ) {} 254 $this->rewind(); 255 } 256 257 function addInvolvedPilot( $pilot ) 258 { 259 $this->inv_plt_ .= $pilot->getID().", "; 260 if ( $this->inv_crp_ || $this->inv_all_ ) 261 $this->mixedinvolved_ = true; 262 } 263 264 function addInvolvedCorp( $corp ) 265 { 266 $this->inv_crp_ .= $corp->getID().", "; 267 if ( $this->inv_plt_ || $this->inv_all_ ) 268 $this->mixedinvolved_ = true; 269 } 270 271 function addInvolvedAlliance( $alliance ) 272 { 273 $this->inv_all_ .= $alliance->getID().", "; 274 if ( $this->inv_plt_ || $this->inv_crp_ ) 275 $this->mixedinvolved_ = true; 276 } 277 278 function addVictimPilot( $pilot ) 279 { 280 $this->vic_plt_ .= $pilot->getID().", "; 281 if ( $this->vic_crp_ || $this->vic_all_ ) 282 $this->mixedvictims_ = true; 283 } 284 285 function addVictimCorp( $corp ) 286 { 287 $this->vic_crp_ .= $corp->getID().", "; 288 if ( $this->vic_plt_ || $this->vic_all_ ) 289 $this->mixedvictims_ = true; 290 } 291 292 function addVictimAlliance( $alliance ) 293 { 294 $this->vic_all_ .= $alliance->getID().", "; 295 if ( $this->vic_plt_ || $this->vic_crp_ ) 296 $this->mixedvictims_ = true; 297 } 298 299 function addVictimShipClass( $shipclass ) 300 { 301 array_push( $this->vic_scl_id_, $shipclass->getID() ); 302 } 303 304 function addVictimShip( $ship ) 305 { 306 } 307 308 function addItemDestroyed( $item ) 309 { 310 } 311 312 function addRegion( $region ) 313 { 314 array_push( $this->regions_, $region->getID() ); 315 } 316 317 function addGroupBy( $groupby ) 318 { 319 array_push( $this->groupby_, $groupby ); 320 } 321 322 function setPageSplitter( $pagesplitter ) 323 { 324 if ( isset( $_GET['page'] ) ) $page = $_GET['page']; else $page = 1; 325 $this->plimit_ = $pagesplitter->getSplit(); 326 $this->poffset_ = ( $page * $this->plimit_ ) - $this->plimit_; 327 //echo $this->offset_; 328 //echo $this->limit_; 329 } 330 331 function setWeek( $weekno ) 332 { 333 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) = "; 334 $this->timeframe_ .= $weekno; 335 } 336 337 function setYear( $yearno ) 338 { 339 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%Y\" ) = "; 340 $this->timeframe_ .= $yearno; 341 } 342 343 function setStartWeek( $weekno ) 344 { 345 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) >= "; 346 $this->timeframe_ .= $weekno; 347 } 348 349 function setStartDate( $timestamp ) 350 { 351 $this->timeframe_ .= " and kll.kll_timestamp >= '".$timestamp."'"; 352 } 353 354 function setEndDate( $timestamp ) 355 { 356 $this->timeframe_ .= " and kll.kll_timestamp <= '".$timestamp."'"; 357 } 358 359 function setRelated( $killid ) 360 { 361 $this->related_ = $killid; 362 } 363 364 function setLimit( $limit ) 365 { 366 $this->limit_ = $limit; 367 } 368 369 function setOrderBy( $orderby ) 370 { 371 $this->orderby_ = $orderby; 261 while ($this->getKill()) 262 { 263 } 264 $this->rewind(); 265 } 266 267 function addInvolvedPilot($pilot) 268 { 269 $this->inv_plt_ .= $pilot->getID() . ", "; 270 if ($this->inv_crp_ || $this->inv_all_) 271 $this->mixedinvolved_ = true; 272 } 273 274 function addInvolvedCorp($corp) 275 { 276 $this->inv_crp_ .= $corp->getID() . ", "; 277 if ($this->inv_plt_ || $this->inv_all_) 278 $this->mixedinvolved_ = true; 279 } 280 281 function addInvolvedAlliance($alliance) 282 { 283 $this->inv_all_ .= $alliance->getID() . ", "; 284 if ($this->inv_plt_ || $this->inv_crp_) 285 $this->mixedinvolved_ = true; 286 } 287 288 function addVictimPilot($pilot) 289 { 290 $this->vic_plt_ .= $pilot->getID() . ", "; 291 if ($this->vic_crp_ || $this->vic_all_) 292 $this->mixedvictims_ = true; 293 } 294 295 function addVictimCorp($corp) 296 { 297 $this->vic_crp_ .= $corp->getID() . ", "; 298 if ($this->vic_plt_ || $this->vic_all_) 299 $this->mixedvictims_ = true; 300 } 301 302 function addVictimAlliance($alliance) 303 { 304 $this->vic_all_ .= $alliance->getID() . ", "; 305 if ($this->vic_plt_ || $this->vic_crp_) 306 $this->mixedvictims_ = true; 307 } 308 309 function addVictimShipClass($shipclass) 310 { 311 array_push($this->vic_scl_id_, $shipclass->getID()); 312 } 313 314 function addVictimShip($ship) 315 { 316 } 317 318 function addItemDestroyed($item) 319 { 320 } 321 322 function addRegion($region) 323 { 324 array_push($this->regions_, $region->getID()); 325 } 326 327 function addGroupBy($groupby) 328 { 329 array_push($this->groupby_, $groupby); 330 } 331 332 function setPageSplitter($pagesplitter) 333 { 334 if (isset($_GET['page'])) $page = $_GET['page']; 335 else $page = 1; 336 $this->plimit_ = $pagesplitter->getSplit(); 337 $this->poffset_ = ($page * $this->plimit_) - $this->plimit_; 338 // echo $this->offset_; 339 // echo $this->limit_; 340 } 341 342 function setWeek($weekno) 343 { 344 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) = "; 345 $this->timeframe_ .= $weekno; 346 } 347 348 function setYear($yearno) 349 { 350 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%Y\" ) = "; 351 $this->timeframe_ .= $yearno; 352 } 353 354 function setStartWeek($weekno) 355 { 356 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) >= "; 357 $this->timeframe_ .= $weekno; 358 } 359 360 function setStartDate($timestamp) 361 { 362 $this->timeframe_ .= " and kll.kll_timestamp >= '" . $timestamp . "'"; 363 } 364 365 function setEndDate($timestamp) 366 { 367 $this->timeframe_ .= " and kll.kll_timestamp <= '" . $timestamp . "'"; 368 } 369 370 function setRelated($killid) 371 { 372 $this->related_ = $killid; 373 } 374 375 function setLimit($limit) 376 { 377 $this->limit_ = $limit; 378 } 379 380 function setOrderBy($orderby) 381 { 382 $this->orderby_ = $orderby; 372 383 } 373 384 374 385 function getCount() 375 386 { 376 $this->execQuery();377 return $this->qry_->recordCount();387 $this->execQuery(); 388 return $this->qry_->recordCount(); 378 389 } 379 390 380 391 function getRealCount() 381 392 { 382 $this->execQuery();383 return $this->qry_->recordCount();393 $this->execQuery(); 394 return $this->qry_->recordCount(); 384 395 } 385 396 386 397 function getISK() 387 398 { 388 $this->execQuery();389 return $this->killisk_;399 $this->execQuery(); 400 return $this->killisk_; 390 401 } 391 402 392 403 function getPoints() 393 404 { 394 return $this->killpoints_;405 return $this->killpoints_; 395 406 } 396 407 397 408 function rewind() 398 409 { 399 $this->qry_->rewind(); 400 $this->killcounter_ = 0; 401 } 402 403 function setPodsNoobShips( $flag ) 404 { 405 if ( !$flag ) { 406 array_push( $this->exclude_scl_, 2 ); 407 array_push( $this->exclude_scl_, 3 ); 408 array_push( $this->exclude_scl_, 11 ); 409 } 410 } 411 412 function setOrdered( $flag ) 413 { 414 $this->ordered_ = $flag; 415 } 416 } 410 $this->qry_->rewind(); 411 $this->killcounter_ = 0; 412 } 413 414 function setPodsNoobShips($flag) 415 { 416 if (!$flag) 417 { 418 array_push($this->exclude_scl_, 2); 419 array_push($this->exclude_scl_, 3); 420 array_push($this->exclude_scl_, 11); 421 } 422 } 423 424 function setOrdered($flag) 425 { 426 $this->ordered_ = $flag; 427 } 428 } 417 429 ?> -
dev/common/class.map.php
r2 r10 1 <? 2 3 require_once( "db.php" ); 4 require_once( "globals.php" ); 5 6 class MapView 7 { 8 function MapView( $mode, $size = 200 ) 9 { 10 $this->mode_ = $mode; 11 $this->imgwidth_ = $size; 12 $this->imgheight_ = $size; 13 $this->ly_ = 0.4 / 1000000000000000; 14 $this->offset_ = 10; 15 16 // colors 17 $this->sys_colors_[0] = array( 200, 20, 48 ); 18 $this->sys_colors_[1] = array( 200, 20, 48 ); 19 $this->sys_colors_[2] = array( 200, 20, 48 ); 20 $this->sys_colors_[3] = array( 241, 176, 48 ); 21 $this->sys_colors_[4] = array( 200, 200, 48 ); 22 $this->sys_colors_[5] = array( 219, 241, 48 ); 23 $this->sys_colors_[6] = array( 103, 241, 62 ); 24 $this->sys_colors_[7] = array( 83, 241, 114 ); 25 $this->sys_colors_[8] = array( 26, 241, 183 ); 26 $this->sys_colors_[9] = array( 99, 241, 255 ); 27 $this->sys_colors_[10] = array( 99, 241, 255 ); 28 $this->linecolor_ = array( 75, 75, 75 ); 29 $this->captioncolor_ = array( 110, 110, 110 ); 30 31 // $this->normalcolor_ = array( 140, 90, 140 ); 32 $this->normalcolor_ = array( 81, 103, 146 ); 33 // $this->normalcolor_ = array( 151, 141, 191 ); 34 $this->hlcolor_ = array( 200, 200, 200 ); 1 <?php 2 require_once("db.php"); 3 require_once("globals.php"); 4 5 class MapView 6 { 7 function MapView($mode, $size = 200) 8 { 9 $this->mode_ = $mode; 10 $this->imgwidth_ = $size; 11 $this->imgheight_ = $size; 12 $this->ly_ = 0.4 / 1000000000000000; 13 $this->offset_ = 10; 14 // colors 15 $this->sys_colors_[0] = array(200, 20, 48); 16 $this->sys_colors_[1] = array(200, 20, 48); 17 $this->sys_colors_[2] = array(200, 20, 48); 18 $this->sys_colors_[3] = array(241, 176, 48); 19 $this->sys_colors_[4] = array(200, 200, 48); 20 $this->sys_colors_[5] = array(219, 241, 48); 21 $this->sys_colors_[6] = array(103, 241, 62); 22 $this->sys_colors_[7] = array(83, 241, 114); 23 $this->sys_colors_[8] = array(26, 241, 183); 24 $this->sys_colors_[9] = array(99, 241, 255); 25 $this->sys_colors_[10] = array(99, 241, 255); 26 $this->linecolor_ = array(75, 75, 75); 27 $this->captioncolor_ = array(110, 110, 110); 28 // $this->normalcolor_ = array( 140, 90, 140 ); 29 $this->normalcolor_ = array(81, 103, 146); 30 // $this->normalcolor_ = array( 151, 141, 191 ); 31 $this->hlcolor_ = array(200, 200, 200); 35 32 } 36 33 … … 39 36 } 40 37 41 function setOffset( $offset)42 { 43 $this->offset_ = $offset;44 } 45 46 function showLines( $enable)47 { 48 $this->showlines_ = $enable;49 } 50 51 function showSysNames( $enable)52 { 53 $this->showsysnames_ = $enable;54 } 55 56 function colorSystems( $enable)57 { 58 $this->colorsystems_ = $enable;59 } 60 61 function setRegionID( $regionid)62 { 63 $this->regionid_ = $regionid;64 } 65 66 function setSystemID( $systemid)67 { 68 $this->systemid_ = $systemid;69 70 $sql = "select reg.reg_id, reg.reg_name, con.con_id, con.con_name, sys.sys_name, sys.sys_sec38 function setOffset($offset) 39 { 40 $this->offset_ = $offset; 41 } 42 43 function showLines($enable) 44 { 45 $this->showlines_ = $enable; 46 } 47 48 function showSysNames($enable) 49 { 50 $this->showsysnames_ = $enable; 51 } 52 53 function colorSystems($enable) 54 { 55 $this->colorsystems_ = $enable; 56 } 57 58 function setRegionID($regionid) 59 { 60 $this->regionid_ = $regionid; 61 } 62 63 function setSystemID($systemid) 64 { 65 $this->systemid_ = $systemid; 66 67 $sql = "select reg.reg_id, reg.reg_name, con.con_id, con.con_name, sys.sys_name, sys.sys_sec 71 68 from kb3_regions reg, kb3_constellations con, kb3_systems sys 72 69 where reg.reg_id = con.con_reg_id 73 70 and con.con_id = sys.sys_con_id 74 and sys.sys_id = " .$this->systemid_;75 76 $qry = new DBQuery();77 $qry->execute( $sql ) or die( $qry->getErrorMsg());78 $row = $qry->getRow();79 80 $this->conid_ = $row['con_id'];81 $this->regionid_ = $row['reg_id'];82 $this->conname_ = $row['con_name'];83 $this->regname_ = $row['reg_name'];84 $this->sysname_ = $row['sys_name'];85 $this->syssec_ = $row['sys_sec'];86 } 87 88 function setTitle( $title)89 { 90 $this->title_ = $title;71 and sys.sys_id = " . $this->systemid_; 72 73 $qry = new DBQuery(); 74 $qry->execute($sql) or die($qry->getErrorMsg()); 75 $row = $qry->getRow(); 76 77 $this->conid_ = $row['con_id']; 78 $this->regionid_ = $row['reg_id']; 79 $this->conname_ = $row['con_name']; 80 $this->regname_ = $row['reg_name']; 81 $this->sysname_ = $row['sys_name']; 82 $this->syssec_ = $row['sys_sec']; 83 } 84 85 function setTitle($title) 86 { 87 $this->title_ = $title; 91 88 } 92 89 93 90 function generate() 94 91 { 95 $sql = "select sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec,92 $sql = "select sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, 96 93 sys.sys_id, sys.sys_name, sys.sys_eve_id, sjp.sjp_to, con.con_id, 97 94 con.con_name, reg.reg_id, reg.reg_name, … … 103 100 and sjp.sjp_from = sys.sys_eve_id"; 104 101 105 $regioncache = "cache/map/".$this->regionid_."_".$this->imgwidth_.".gif"; 106 $cached = false; 107 108 if ( $this->mode_ == "map" ) { 109 $img = @imagecreatefromgif( $regioncache ); 110 if ( $img ) { 111 Header( "Content-type: image/gif" ); 112 imagegif( $img ); 113 $cached = true; 114 } 115 $caption = $this->regname_; 116 } 117 118 if ( $this->mode_ == "region" ) { 119 $sql .= " and reg.reg_id = ".$this->regionid_; 120 $caption = $this->conname_; 121 } 122 123 if ( $this->mode_ == "cons" ) { 124 $sql .= " and con.con_id = ".$this->conid_; 125 $caption = $this->sysname_." (".roundsec( $this->syssec_ ).")"; 126 } 127 128 if ( !$cached ) { 129 $qry = new DBQuery(); 130 $qry->execute( $sql ) or die( $qry->getErrorMsg() ); 131 132 if ( !$img ) $img = imagecreatetruecolor( $this->imgwidth_, $this->imgheight_ ); 133 $white = imagecolorallocate( $img, 255, 255, 255 ); 134 $bgcolor = imagecolorallocate( $img, 30, 30, 30 ); 135 imagefilledrectangle( $img, 0, 0, $this->imgwidth_, 136 $this->imgheight_, $bgcolor ); 137 138 $color = $white; 139 140 $fov = 0; 141 142 $i = 0; 143 $minx = 0; 144 $minz = 0; 145 $maxx = 0; 146 $maxz = 0; 147 $mini = 0; 148 $maxi = 0; 149 $pi = 0; 150 $sc = 0; 151 while ( $row = $qry->getRow() ) { 152 $i = $row['sys_eve_id']; 153 if ( $i < $mini || $mini == 0 ) 154 $mini = $i; 155 if ( $i > $maxi || $maxi == 0 ) 156 $maxi = $i; 157 $x = $row['sys_x'] * $this->ly_; 158 $z = $row['sys_z'] * $this->ly_; 159 160 if ( $x < $minx || $minx == 0 ) 161 $minx = $x; 162 if ( $x > $maxx || $maxx == 0 ) 163 $maxx = $x; 164 if ( $z < $minz || $minz == 0 ) 165 $minz = $z; 166 if ( $z > $maxz || $maxz == 0 ) 167 $maxz = $z; 168 169 $sys[$i][0] = $x; 170 $sys[$i][1] = $z; 171 if ( $i == $pi || $pi == 0 ) { 172 $sys[$i][2][$sc] = $row['sjp_to']; 173 $sys[$i][3] = $sc++; 174 } 175 else { 102 $regioncache = "cache/map/" . $this->regionid_ . "_" . $this->imgwidth_ . ".png"; 103 $cached = false; 104 105 if ($this->mode_ == "map") 106 { 107 if (file_exists($regioncache)) 108 { 109 header("Content-type: image/png"); 110 readfile($regioncache); 111 $cached = true; 112 } 113 $caption = $this->regname_; 114 } 115 116 if ($this->mode_ == "region") 117 { 118 $sql .= " and reg.reg_id = " . $this->regionid_; 119 $caption = $this->conname_; 120 } 121 122 if ($this->mode_ == "cons") 123 { 124 $sql .= " and con.con_id = " . $this->conid_; 125 $caption = $this->sysname_ . " (" . roundsec($this->syssec_) . ")"; 126 } 127 128 if (!$cached) 129 { 130 $qry = new DBQuery(); 131 $qry->execute($sql) or die($qry->getErrorMsg()); 132 133 if (!$img) $img = imagecreatetruecolor($this->imgwidth_, $this->imgheight_); 134 $white = imagecolorallocate($img, 255, 255, 255); 135 $red = imagecolorallocate($img, 255, 0, 0); 136 $bgcolor = imagecolorallocate($img, 30, 30, 30); 137 imagefilledrectangle($img, 0, 0, $this->imgwidth_, $this->imgheight_, $bgcolor); 138 139 $color = $white; 140 141 $fov = 0; 142 143 $i = 0; 144 $minx = 0; 145 $minz = 0; 146 $maxx = 0; 147 $maxz = 0; 148 $mini = 0; 149 $maxi = 0; 150 $pi = 0; 176 151 $sc = 0; 177 178 179 } 180 $sys[$i][4] = $row['sys_id']; 181 $sys[$i][5] = $row['sys_name']; 182 $sys[$i][6] = $row['sys_sec']; 183 $sys[$i][7] = $row['con_id']; 184 $sys[$i][8] = $row['con_name']; 185 $sys[$i][9] = $row['reg_id']; 186 $sys[$i][10] = $row['reg_name']; 187 $pi = $i; 152 while ($row = $qry->getRow()) 153 { 154 $i = $row['sys_eve_id']; 155 if ($i < $mini || $mini == 0) 156 $mini = $i; 157 if ($i > $maxi || $maxi == 0) 158 $maxi = $i; 159 $x = $row['sys_x'] * $this->ly_; 160 $z = $row['sys_z'] * $this->ly_; 161 162 if ($x < $minx || $minx == 0) 163 $minx = $x; 164 if ($x > $maxx || $maxx == 0) 165 $maxx = $x; 166 if ($z < $minz || $minz == 0) 167 $minz = $z; 168 if ($z > $maxz || $maxz == 0) 169 $maxz = $z; 170 171 $sys[$i][0] = $x; 172 $sys[$i][1] = $z; 173 if ($i == $pi || $pi == 0) 174 { 175 $sys[$i][2][$sc] = $row['sjp_to']; 176 $sys[$i][3] = $sc++; 177 } 178 else 179 { 180 $sc = 0; 181 } 182 $sys[$i][4] = $row['sys_id']; 183 $sys[$i][5] = $row['sys_name']; 184 $sys[$i][6] = $row['sys_sec']; 185 $sys[$i][7] = $row['con_id']; 186 $sys[$i][8] = $row['con_name']; 187 $sys[$i][9] = $row['reg_id']; 188 $sys[$i][10] = $row['reg_name']; 189 $pi = $i; 190 } 191 $dx = abs($maxx - $minx); 192 $dz = abs($maxz - $minz); 193 $xscale = 1 / ($dx / ($this->imgwidth_ - ($this->offset_ * 2))); 194 $yscale = 1 / ($dz / ($this->imgheight_ - ($this->offset_ * 2))); 195 // echo "dx:".$dx." dz:".$dz." xscale:".$scale." ".$yscale."<br>"; 196 // echo "minx:".$minx." maxx:".$maxx." "; 197 // echo "minz:".$minz." maxz:".$maxz." "; 198 // exit; 199 // exit; 200 201 // draw lines 202 if ($this->showlines_) 203 { 204 $n = $mini; 205 while ($n <= $maxi) 206 { 207 $px = $this->offset_ + ($sys[$n][0] - $minx) * $xscale; 208 $py = $this->offset_ + ($sys[$n][1] - $minz) * $yscale; 209 210 $line_col = imagecolorallocate($img, $this->linecolor_[0], 211 $this->linecolor_[1], 212 $this->linecolor_[2]); 213 214 for ($m = 0; $m <= $sys[$n][3]; $m++) 215 { 216 $sys_to = $sys[$n][2][$m]; 217 218 if ($sys[$sys_to][4] != "") 219 { 220 $px_to = $this->offset_ + ($sys[$sys_to][0] - $minx) * $xscale; 221 $py_to = $this->offset_ + ($sys[$sys_to][1] - $minz) * $yscale; 222 223 imageline($img, $px, $py, $px_to, $py_to, $line_col); 224 } 225 } 226 227 $n++; 228 } 229 } 230 // draw systems 231 $n = $mini; 232 while ($n <= $maxi) 233 { 234 $px = round($this->offset_ + ($sys[$n][0] - $minx) * $xscale); 235 $py = round($this->offset_ + ($sys[$n][1] - $minz) * $yscale); 236 237 if ($this->mode_ == "map") 238 { 239 if ($sys[$n][9] == $this->regionid_) 240 $color = imagecolorallocate($img, $this->hlcolor_[0], $this->hlcolor_[1], $this->hlcolor_[2]); 241 else 242 $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]); 243 } 244 if ($this->mode_ == "region") 245 { 246 if ($sys[$n][7] == $this->conid_) 247 $color = imagecolorallocate($img, $this->hlcolor_[0], $this->hlcolor_[1], $this->hlcolor_[2]); 248 else 249 $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]); 250 } 251 if ($this->mode_ == "cons") 252 { 253 if ($sys[$n][4] == $this->systemid_) 254 $color = imagecolorallocate($img, $this->hlcolor_[0], $this->hlcolor_[1], $this->hlcolor_[2]); 255 else 256 $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]); 257 } 258 // if ( $sys[$n][3] > 0 ) 259 // $sec_status = round( $sys[$n][3] * 10 ); 260 // else 261 // $sec_status = 0; 262 // $color = imagecolorallocate( $img, $this->sys_colors_[$sec_status][0], 263 // $this->sys_colors_[$sec_status][1], 264 // $this->sys_colors_[$sec_status][2] ); 265 if ($this->showsysnames_) 266 { 267 $tlen = 5 * strlen($sys[$n][5]); 268 if (($px + $tlen > ($this->imgwidth_ - 20))) 269 $sx = $px - $tlen; 270 else 271 $sx = $px + 5; 272 if (($py + 5 > ($this->imgheight_ - 20))) 273 $sy = $py - 5; 274 else 275 $sy = $py + 5; 276 277 imagestring($img, 1, $sx, $sy, $sys[$n][5], $color); 278 // imagettftext ( $img, 6, 0, 279 // $sx, 280 // $sy, 281 // $color, 282 // "../fonts/04B_03__.TTF", 283 // $sys[$n][5] ); 284 } 285 286 $ed = $xscale * 0.75; 287 if ($ed > 5) 288 { 289 $ed = 5; 290 } 291 292 // bug compat: imagefilledellipse doesnt draw ellipses with 1px size 293 // on some installations 294 if ($ed < 1) 295 { 296 imagesetpixel($img, $px, $py, $color); 297 } 298 else 299 { 300 imagefilledellipse($img, $px, $py, $ed, $ed, $color); 301 } 302 303 $n++; 304 } 188 305 } 189 $dx = abs( $maxx - $minx ); 190 $dz = abs( $maxz - $minz ); 191 $xscale = 1 / ($dx / ( $this->imgwidth_ - ( $this->offset_ * 2 ) ) ); 192 $yscale = 1 / ($dz / ( $this->imgheight_ - ( $this->offset_ * 2 ) ) ); 193 194 //echo "dx:".$dx." dz:".$dz." xscale:".$scale." ".$yscale."<br>"; 195 //echo "minx:".$minx." maxx:".$maxx." "; 196 //echo "minz:".$minz." maxz:".$maxz." "; 197 198 //exit; 199 // exit; 200 // draw 201 202 // draw lines 203 if ( $this->showlines_ ) { 204 $n = $mini; 205 while ( $n <= $maxi ) { 206 $px = $this->offset_ + ( $sys[$n][0] - $minx ) * $xscale; 207 $py = $this->offset_ + ( $sys[$n][1] - $minz ) * $yscale; 208 209 $line_col = imagecolorallocate( $img, $this->linecolor_[0], 210 $this->linecolor_[1], 211 $this->linecolor_[2] ); 212 213 214 for ( $m = 0; $m <= $sys[$n][3]; $m++ ) { 215 $sys_to = $sys[$n][2][$m]; 216 217 if ( $sys[$sys_to][4] != "" ) { 218 $px_to = $this->offset_ + ( $sys[$sys_to][0] - $minx ) * $xscale; 219 $py_to = $this->offset_ + ( $sys[$sys_to][1] - $minz ) * $yscale; 220 221 imageline( $img, $px, $py, $px_to, $py_to, $line_col ); 222 } 223 } 224 225 $n++; 226 } 227 } 228 229 // draw systems 230 $n = $mini; 231 while ( $n <= $maxi ) { 232 $px = $this->offset_ + ( $sys[$n][0] - $minx ) * $xscale; 233 $py = $this->offset_ + ( $sys[$n][1] - $minz ) * $yscale; 234 235 if ( $this->mode_ == "map" ) { 236 if ( $sys[$n][9] == $this->regionid_ ) 237 $color = imagecolorallocate( $img, $this->hlcolor_[0], $this->hlcolor_[1], $this->hlcolor_[2] ); 238 else 239 $color = imagecolorallocate( $img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2] ); 240 } 241 if ( $this->mode_ == "region" ) { 242 if ( $sys[$n][7] == $this->conid_ ) 243 $color = imagecolorallocate( $img, $this->hlcolor_[0], $this->hlcolor_[1], $this->hlcolor_[2] ); 244 else 245 $color = imagecolorallocate( $img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2] ); 246 } 247 if ( $this->mode_ == "cons" ) { 248 if ( $sys[$n][4] == $this->systemid_ ) 249 $color = imagecolorallocate( $img, $this->hlcolor_[0], $this->hlcolor_[1], $this->hlcolor_[2] ); 250 else 251 $color = imagecolorallocate( $img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2] ); 252 } 253 254 //if ( $sys[$n][3] > 0 ) 255 // $sec_status = round( $sys[$n][3] * 10 ); 256 //else 257 // $sec_status = 0; 258 259 //$color = imagecolorallocate( $img, $this->sys_colors_[$sec_status][0], 260 // $this->sys_colors_[$sec_status][1], 261 // $this->sys_colors_[$sec_status][2] ); 262 263 if ( $this->showsysnames_ ) { 264 $tlen = 5 * strlen( $sys[$n][5] ); 265 if ( ( $px + $tlen > ( $this->imgwidth_ - 20 ) ) ) 266 $sx = $px - $tlen; 267 else 268 $sx = $px + 5; 269 if ( ( $py + 5 > ( $this->imgheight_ - 20 ) ) ) 270 $sy = $py - 5; 271 else 272 $sy = $py + 5; 273 274 imagestring( $img, 1, $sx, $sy, $sys[$n][5], $color ); 275 //imagettftext ( $img, 6, 0, 276 // $sx, 277 // $sy, 278 // $color, 279 // "../fonts/04B_03__.TTF", 280 // $sys[$n][5] ); 281 } 282 283 $ed = $xscale * 0.75; 284 if ( $ed > 5 ) 285 $ed = 5; 286 287 imagefilledellipse( $img, $px, $py, $ed, $ed, $color ); 288 289 $n++; 290 } 291 } 292 293 $captioncolor = imagecolorallocate( $img, $this->captioncolor_[0], $this->captioncolor_[1], $this->captioncolor_[2] ); 294 if ( strlen( $this->title_ ) > 0 ) 295 $title = $this->title_." ".$caption; 296 else 297 $title = $caption; 298 299 imagestring( $img, 1, 2, 2, $title, $captioncolor ); 300 // imagettftext ( $img, 6, 0, 301 // 5, 302 // 10, 303 // $captioncolor, 304 // "../fonts/04B_03__.TTF", 305 // $title ); 306 307 if ( $this->mode_ == "map" && !$cached ) imagegif( $img, $regioncache ); 308 Header( "Content-type: image/gif" ); 309 imagegif( $img ); 310 } 311 } 306 307 $captioncolor = imagecolorallocate($img, $this->captioncolor_[0], $this->captioncolor_[1], $this->captioncolor_[2]); 308 if (strlen($this->title_) > 0) 309 $title = $this->title_ . " " . $caption; 310 else 311 $title = $caption; 312 313 imagestring($img, 1, 2, 2, $title, $captioncolor); 314 // imagettftext ( $img, 6, 0, 315 // 5, 316 // 10, 317 // $captioncolor, 318 // "../fonts/04B_03__.TTF", 319 // $title ); 320 if ($this->mode_ == "map" && !$cached) imagepng($img, $regioncache); 321 header("Content-type: image/png"); 322 imagepng($img); 323 } 324 } 312 325 ?> -
dev/common/class.page.php
r2 r10 1 <? 2 require_once( "config.php" ); 3 require_once( "class.killboard.php" ); 4 require_once( "class.session.php" ); 5 6 class Page 7 { 1 <?php 2 require_once("config.php"); 3 require_once("class.killboard.php"); 4 require_once("class.session.php"); 8 5 9 function Page( $title = "", $cachable = true ) 6 class Page 7 { 8 function Page($title = "", $cachable = true) 10 9 { 11 $this->title_ = $title;12 $this->admin_ = false;10 $this->title_ = $title; 11 $this->admin_ = false; 13 12 14 if ( substr( $_SERVER['HTTP_USER_AGENT'], 0, 15 ) == "EVE-minibrowser")15 $this->igb_ = true;16 else17 $this->igb_ = false;13 if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == "EVE-minibrowser") 14 $this->igb_ = true; 15 else 16 $this->igb_ = false; 18 17 19 $this->timestart_ = strtok(microtime(), ' ') + strtok('');18 $this->timestart_ = strtok(microtime(), ' ') + strtok(''); 20 19 21 $this->killboard_ = new Killboard( KB_SITE);20 $this->killboard_ = new Killboard(KB_SITE); 22 21 23 $this->session_ = new Session($_COOKIE['EVK_COOKIE'],24 $_SERVER['REMOTE_ADDR']);22 $this->session_ = new Session($_COOKIE['EVK_COOKIE'], 23 $_SERVER['REMOTE_ADDR']); 25 24 26 $this->cachable_ = $cachable;27 $this->cachetime_ = 5;25 $this->cachable_ = $cachable; 26 $this->cachetime_ = 5; 28 27 } 29 28 30 function setContent( $html)29 function setContent($html) 31 30 { 32 $this->contenthtml_ = $html;31 $this->contenthtml_ = $html; 33 32 } 34 33 35 function addContext( $html)34 function addContext($html) 36 35 { 37 $this->contexthtml_ .= $html;36 $this->contexthtml_ .= $html; 38 37 } 39 38 40 39 function generate() 41 40 { 42 $html = "<html>";43 $html .= "<head>";44 $html .= "<title>".KB_TITLE." Killboard - ".$this->title_."</title>\n";45 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".STYLE_URL."/common.css\">";46 $config = $this->killboard_->getConfig();47 $style = $config->getStyleName();48 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".STYLE_URL."/".$style."/style.css\">";41 $html = "<html>"; 42 $html .= "<head>"; 43 $html .= "<title>" . KB_TITLE . " Killboard - " . $this->title_ . "</title>\n"; 44 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . STYLE_URL . "/common.css\">"; 45 $config = $this->killboard_->getConfig(); 46 $style = $config->getStyleName(); 47 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . STYLE_URL . "/" . $style . "/style.css\">"; 49 48 50 if ( !$this->igb_)51 $html .= "<script language=javascript src=\"".COMMON_URL."/generic.js\"></script>";52 $html .= "</head>\n";53 $html .= "<body bgcolor=\"#222222\"";54 if ( $this->onload_)55 $html .= " onload=\"".$this->onload_."\"";49 if (!$this->igb_) 50 $html .= "<script language=javascript src=\"" . COMMON_URL . "/generic.js\"></script>"; 51 $html .= "</head>\n"; 52 $html .= "<body bgcolor=\"#222222\""; 53 if ($this->onload_) 54 $html .= " onload=\"" . $this->onload_ . "\""; 56 55 57 $html .= ">\n"; 56 $html .= ">\n"; 57 // header 58 $html .= "<table class=main-table height=\"100%\" align=\"center\" bgcolor=\"#111111\" border=\"0\" cellspacing=\"1\"><tr><td valign=\"top\" height=\"100%\">\n"; 59 if (!$this->igb_) 60 { 61 $html .= "<div id=header>\n"; 62 $html .= "<img src=\""; 63 $banner = $config->getStyleBanner(); 64 if ($banner != "custom") 65 $html .= IMG_URL . "/banners/" . $banner . ".jpg"; 66 else 67 $html .= "kb-banner.jpg"; 58 68 59 // header 60 $html .= "<table class=main-table height=\"100%\" align=\"center\" bgcolor=\"#111111\" border=\"0\" cellspacing=\"1\"><tr><td valign=\"top\" height=\"100%\">\n"; 61 if ( !$this->igb_ ) { 62 $html .= "<div id=header>\n"; 63 $html .= "<img src=\""; 64 $banner = $config->getStyleBanner(); 65 if ( $banner != "custom" ) 66 $html .= IMG_URL."/banners/".$banner.".jpg"; 67 else 68 $html .= "kb-banner.jpg"; 69 70 $html .= "\" border=\"0\">"; 69 $html .= "\" border=\"0\">"; 71 70 72 $html .= "</div>\n";73 74 75 76 if ( $contracts || $campaigns) $w = "\"9%\"";77 if ( $contracts && $campaigns) $w = "\"8%\"";78 $html .= "<table class=navigation width=\"100%\" height=\"25\" border=\"0\" cellspacing=\"1\"><tr class=kb-table-row-odd>\n";79 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=home\">Home</a></td>";71 $html .= "</div>\n"; 72 $contracts = $this->killboard_->hasContracts(); 73 $campaigns = $this->killboard_->hasCampaigns(); 74 $w = "\"10%\""; 75 if ($contracts || $campaigns) $w = "\"9%\""; 76 if ($contracts && $campaigns) $w = "\"8%\""; 77 $html .= "<table class=navigation width=\"100%\" height=\"25\" border=\"0\" cellspacing=\"1\"><tr class=kb-table-row-odd>\n"; 78 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=home\">Home</a></td>"; 80 79 81 if ( $contracts ) 82 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=contracts\">Contracts</a></td>"; 83 84 if ( $campaigns ) 85 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=campaigns\">Campaigns</a></td>"; 86 87 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=kills\">Kills</a></td>"; 88 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=losses\">Losses</a></td>"; 89 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=post\">Post mail</a></td>"; 90 $html .= "<td width=".$w." align=\"center\"><a class=link href=\""; 80 if ($contracts) 81 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=contracts\">Contracts</a></td>"; 91 82 92 if ( CORP_ID ) $html .= "?a=corp_detail&crp_id=".CORP_ID; 93 if ( ALLIANCE_ID ) $html .= "?a=alliance_detail&all_id=".ALLIANCE_ID;83 if ($campaigns) 84 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=campaigns\">Campaigns</a></td>"; 94 85 95 $html .= "\">Stats</a></td>"; 86 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=kills\">Kills</a></td>"; 87 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=losses\">Losses</a></td>"; 88 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=post\">Post mail</a></td>"; 89 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\""; 96 90 97 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=awards\">Awards</a></td>"; 98 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=search\">Search</a></td>"; 99 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=admin\">Admin</a></td>"; 100 $html .= "<td width=".$w." align=\"center\"><a class=link href=\"?a=about\">About</a></td>"; 101 102 $html .= "\n</tr></table>\n"; 103 } 104 $html .= "<div id=page-title>".$this->title_."</div>"; 105 $html .= "<table cellpadding=0 cellspacing=0 width=\"100%\" border=\"0\"><tr>"; 106 $html .= "<td valign=top><div id=content>\n"; 107 $html .= $this->contenthtml_; 108 $this->timeend_ = strtok(microtime(), ' ') + strtok(''); 109 $this->processingtime_ = $this->timeend_ - $this->timestart_; 110 $html .= "</div></td>"; 111 if ( $this->contexthtml_ != "" ) { 112 $html .= "<td valign=top align=right><div id=context>\n"; 113 $html .= $this->contexthtml_; 114 $html .= "</div></td>\n"; 115 } 116 $html .= "</tr></table>"; 117 118 if ( KB_PROFILE > 0 ) 119 $html .= "<table class=kb-subtable width=\"99%\" border=0><tr><td height=100% align=right valign=bottom>".$this->processingtime_."s</td></tr></table>\n"; 120 else 121 $html .= "<!-- ".$this->processingtime_."s -->"; 91 if (CORP_ID) $html .= "?a=corp_detail&crp_id=" . CORP_ID; 92 if (ALLIANCE_ID) $html .= "?a=alliance_detail&all_id=" . ALLIANCE_ID; 122 93 123 $html .= "</td></tr></table>\n"; 124 $html .= "</body></html>\n"; 94 $html .= "\">Stats</a></td>"; 125 95 126 //ob_start( "ob_gzhandler" ); 127 echo $html; 128 //ob_end_flush(); 96 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=awards\">Awards</a></td>"; 97 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=search\">Search</a></td>"; 98 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=admin\">Admin</a></td>"; 99 $html .= "<td width=" . $w . " align=\"center\"><a class=link href=\"?a=about\">About</a></td>"; 100 101 $html .= "\n</tr></table>\n"; 102 } 103 $html .= "<div id=page-title>" . $this->title_ . "</div>"; 104 $html .= "<table cellpadding=0 cellspacing=0 width=\"100%\" border=\"0\"><tr>"; 105 $html .= "<td valign=top><div id=content>\n"; 106 $html .= $this->contenthtml_; 107 $this->timeend_ = strtok(microtime(), ' ') + strtok(''); 108 $this->processingtime_ = $this->timeend_ - $this->timestart_; 109 $html .= "</div></td>"; 110 if ($this->contexthtml_ != "") 111 { 112 $html .= "<td valign=top align=right><div id=context>\n"; 113 $html .= $this->contexthtml_; 114 $html .= "</div></td>\n"; 115 } 116 $html .= "</tr></table>"; 117 118 if (KB_PROFILE > 0) 119 $html .= "<table class=kb-subtable width=\"99%\" border=0><tr><td height=100% align=right valign=bottom>" . $this->processingtime_ . "s</td></tr></table>\n"; 120 else 121 $html .= "<!-- " . $this->processingtime_ . "s -->"; 122 $html .= '<div class="counter"> 123 <script language="JavaScript" type="text/javascript"> 124 <!-- 125 webstats4u("AD8WGQh5SuZS6pHrvjrf6o6Q5mPQ", 0); 126 // --> 127 </script> 128 <a target="_blank" href="http://www.webstats4u.com/stats?AD8WGQh5SuZS6pHrvjrf6o6Q5mPQ"> 129 <img src="http://m1.webstats4u.com/n?id=AD8WGQh5SuZS6pHrvjrf6o6Q5mPQ" border="0" width="8" height="8" alt="Webstats4U"> 130 </a> 131 </div>'; 132 $html .= "</td></tr></table>\n"; 133 $html .= "</body></html>\n"; 134 // ob_start( "ob_gzhandler" ); 135 echo $html; 136 // ob_end_flush(); 129 137 } 130 138 131 139 function igb() 132 140 { 133 return $this->igb_;141 return $this->igb_; 134 142 } 135 136 function setOnLoad( $onload )143 144 function setOnLoad($onload) 137 145 { 138 $this->onload_ = $onload;146 $this->onload_ = $onload; 139 147 } 140 141 function setTitle( $title)148 149 function setTitle($title) 142 150 { 143 $this->title_ = $title;151 $this->title_ = $title; 144 152 } 145 153 146 154 function setAdmin() 147 155 { 148 if ( !$this->session_->isAdmin() ) 149 Header( "Location: ?a=login" ); 156 if (!$this->session_->isAdmin()) 157 Header("Location: ?a=login"); 158 } 159 160 function isAdmin() 161 { 162 return $this->session_->isAdmin(); 163 } 164 165 function isSuperAdmin() 166 { 167 return $this->session_->isSuperAdmin(); 150 168 } 151 169 152 170 function setSuperAdmin() 153 171 { 154 if ( !$this->session_->isSuperAdmin())155 Header( "Location: ?a=login");172 if (!$this->session_->isSuperAdmin()) 173 Header("Location: ?a=login"); 156 174 } 157 175 158 function setCachable( $cachable)176 function setCachable($cachable) 159 177 { 160 $this->cachable_ = $cachable;178 $this->cachable_ = $cachable; 161 179 } 162 180 163 function setCacheTime( $cachetime)181 function setCacheTime($cachetime) 164 182 { 165 $this->cachetime_ = $cachetime;183 $this->cachetime_ = $cachetime; 166 184 } 167 185 168 function error( $errormsg)186 function error($errormsg) 169 187 { 170 echo $errormsg;171 exit;188 echo $errormsg; 189 exit; 172 190 } 173 } 174 191 } 175 192 ?> -
dev/common/class.pilot.php
r2 r10 1 <? 2 require_once( "db.php");3 require_once( "class.corp.php");1 <?php 2 require_once("db.php"); 3 require_once("class.corp.php"); 4 4 5 class Pilot { 6 7 function Pilot( $id = 0)5 class Pilot 6 { 7 function Pilot($id = 0) 8 8 { 9 $this->id_ = $id; 10 $this->qry_ = new DBQuery(); 11 9 $this->id_ = $id; 10 $this->qry_ = new DBQuery(); 12 11 } 13 12 14 13 function getID() 15 14 { 16 return $this->id_;15 return $this->id_; 17 16 } 18 17 19 18 function getName() 20 19 { 21 $this->execQuery();22 return $this->row_['plt_name'];20 $this->execQuery(); 21 return $this->row_['plt_name']; 23 22 } 24 23 25 function getPortraitURL( $size = 64)24 function getPortraitURL($size = 64) 26 25 { 27 $this->execQuery();28 return "?a=portrait&id=".$this->row_['plt_externalid']."&size=".$size;26 $this->execQuery(); 27 return "?a=portrait&id=" . $this->row_['plt_externalid'] . "&size=" . $size; 29 28 } 30 29 31 30 function execQuery() 32 31 { 33 if ( !$this->qry_->executed_ ) { 34 $this->sql_ = "select * 32 if (!$this->qry_->executed_) 33 { 34 $this->sql_ = "select * 35 35 from kb3_pilots plt, kb3_corps crp, kb3_alliances ali 36 36 where crp.crp_id = plt.plt_crp_id 37 37 and ali.all_id = crp.crp_all_id 38 and plt.plt_id = " .$this->id_;39 $this->qry_->execute( $this->sql_ ) or die( $this->qry_->getErrorMsg());40 41 if ( !$this->row_)42 $this->valid_ = false;43 else44 $this->valid_ = true;45 }38 and plt.plt_id = " . $this->id_; 39 $this->qry_->execute($this->sql_) or die($this->qry_->getErrorMsg()); 40 $this->row_ = $this->qry_->getRow(); 41 if (!$this->row_) 42 $this->valid_ = false; 43 else 44 $this->valid_ = true; 45 } 46 46 } 47 47 48 48 function getCorp() 49 49 { 50 $this->execQuery();51 return new Corporation( $this->row_['plt_crp_id']);50 $this->execQuery(); 51 return new Corporation($this->row_['plt_crp_id']); 52 52 } 53 53 54 54 function exists() 55 55 { 56 $this->execQuery();57 return $this->valid_;56 $this->execQuery(); 57 return $this->valid_; 58 58 } 59 59 60 function add( $name, $corp, $timestamp)60 function add($name, $corp, $timestamp) 61 61 { 62 $qry = new DBQuery();63 $qry->execute("select *62 $qry = new DBQuery(); 63 $qry->execute("select * 64 64 from kb3_pilots 65 where plt_name = '".slashfix( $name )."'" ); 66 67 if ( $qry->recordCount() == 0 ) { 68 $qry->execute( "insert into kb3_pilots values ( null, 69 '".slashfix( $name )."', 70 ".$corp->getID().", 71 0, 72 0, 73 0, 74 date_format( '" 75 .$timestamp."', 76 '%Y.%m.%d %H:%i:%s') 77 )" ); 78 $this->id_ = $qry->getInsertID(); 79 } 80 else { 81 $row = $qry->getRow(); 82 $this->id_ = $row['plt_id']; 83 if ( $this->isUpdatable( $timestamp ) && 84 $row['plt_crp_id'] != $corp->getID() ) { 85 $qry->execute( "update kb3_pilots 65 where plt_name = '" . slashfix($name) . "'"); 66 67 if ($qry->recordCount() == 0) 68 { 69 $qry->execute("insert into kb3_pilots values ( null, 70 '" . slashfix($name) . "', 71 " . $corp->getID() . ", 72 0, 0, 0, 73 date_format( '".$timestamp."', '%Y.%m.%d %H:%i:%s'))"); 74 $this->id_ = $qry->getInsertID(); 75 } 76 else 77 { 78 $row = $qry->getRow(); 79 $this->id_ = $row['plt_id']; 80 if ($this->isUpdatable($timestamp) && $row['plt_crp_id'] != $corp->getID()) 81 { 82 $qry->execute("update kb3_pilots 86 83 set plt_crp_id = ".$corp->getID().", 87 plt_updated = date_format( '".$timestamp."', 88 '%Y.%m.%d %H:%i:%s') where plt_id = ".$this->id_ );84 plt_updated = date_format( '".$timestamp."', '%Y.%m.%d %H:%i:%s') where plt_id = " . $this->id_); 85 } 89 86 } 90 } 91 92 return $this->id_; 87 88 return $this->id_; 93 89 } 94 90 95 function isUpdatable( $timestamp)91 function isUpdatable($timestamp) 96 92 { 97 $qry = new DBQuery();98 $qry->execute("select plt_id93 $qry = new DBQuery(); 94 $qry->execute("select plt_id 99 95 from kb3_pilots 100 where plt_id = ".$this->id_." 101 and ( plt_updated < date_format( '".$timestamp."', 102 '%Y.%m.%d %H:%i' ) 103 or plt_updated is null )" ); 104 105 return $qry->recordCount() == 1; 96 where plt_id = " . $this->id_ . " 97 and ( plt_updated < date_format( '" . $timestamp . "', '%Y.%m.%d %H:%i') 98 or plt_updated is null )"); 99 100 return $qry->recordCount() == 1; 106 101 } 107 102 108 function setCharacterID( $id)103 function setCharacterID($id) 109 104 { 110 $qry = new DBQuery();111 $qry->execute( "update kb3_pilots set plt_externalid = ".$id."112 where plt_id = " .$this->id_ ) or die($qry->getErrorMsg());105 $qry = new DBQuery(); 106 $qry->execute("update kb3_pilots set plt_externalid = " . $id . " 107 where plt_id = " . $this->id_) or die($qry->getErrorMsg()); 113 108 } 114 109 } 115 110 ?> -
dev/common/class.session.php
r2 r10 1 <? 2 require_once( "db.php");1 <?php 2 require_once("db.php"); 3 3 4 class Session { 5 6 function Session( $cookie, $ip)4 class Session 5 { 6 function Session($cookie, $ip) 7 7 { 8 $this->qry_ = new DBQuery();9 $this->sql_ = "select *8 $this->qry_ = new DBQuery(); 9 $this->sql_ = "select * 10 10 from kb3_sessions ses 11 where ses.ses_id = '" .$cookie."'12 and ses.ses_ip = '" .$ip."'";11 where ses.ses_id = '" . $cookie . "' 12 and ses.ses_ip = '" . $ip . "'"; 13 13 } 14 14 15 15 function isAdmin() 16 16 { 17 $this->execQuery();18 return $this->qry_->recordCount() == 1;17 $this->execQuery(); 18 return $this->qry_->recordCount() == 1; 19 19 } 20 20 21 21 function isSuperAdmin() 22 22 { 23 $this->execQuery();24 return $this->qry_->recordCount() == 1 && $this->row_['ses_super'] = 1;23 $this->execQuery(); 24 return ($this->qry_->recordCount() == 1 && $this->row_['ses_super'] == 1); 25 25 } 26 26 27 27 function execQuery() 28 28 { 29 if ( !$this->qry_->executed_)30 $this->qry_->execute( $this->sql_);29 if (!$this->qry_->executed_) 30 $this->qry_->execute($this->sql_); 31 31 32 $this->row_ = $this->qry_->getRow();32 $this->row_ = $this->qry_->getRow(); 33 33 } 34 34 35 35 function cleanup() 36 36 { 37 $qry = new DBQuery(); 38 $qry->execute( "delete from kb3_sessions 39 where ses_logon < date_sub( now(), 40 INTERVAL '120:0' 41 MINUTE_SECOND )" ); 37 $qry = new DBQuery(); 38 $qry->execute("delete from kb3_sessions 39 where ses_logon < date_sub( now(), INTERVAL '120:0' MINUTE_SECOND )"); 42 40 } 43 41 44 function create( $super)42 function create($super) 45 43 { 46 $current = time(); 47 $random = $_SERVER['REMOTE_ADDR'].$current.KB_SITE; 48 $ses_id = md5( $random ); 49 50 if ( !setcookie( "EVK_COOKIE", $ses_id, 0 ) ) 51 die( "Unable to set cookie" ); 44 $current = time(); 45 $random = $_SERVER['REMOTE_ADDR'] . $current . KB_SITE; 46 $ses_id = md5($random); 52 47 53 $qry = new DBQuery(); 54 $qry->execute( "insert into kb3_sessions values ( '".$ses_id."', 55 '".$_SERVER['REMOTE_ADDR']."', 56 now(), 57 ".$super." )" ); 58 48 if (!setcookie("EVK_COOKIE", $ses_id, 0)) 49 die("Unable to set cookie"); 50 51 $qry = new DBQuery(); 52 $qry->execute("insert into kb3_sessions values ('" . $ses_id . "', 53 '" . $_SERVER['REMOTE_ADDR'] . "', 54 now(), " . $super . " )"); 59 55 } 60 56 } 61 57 ?> -
dev/common/corp_detail.php
r2 r10 1 <? 2 require_once( "db.php" ); 3 require_once( "class.page.php" ); 4 require_once( "class.corp.php" ); 5 require_once( "class.alliance.php" ); 6 require_once( "class.killlist.php" ); 7 require_once( "class.killlisttable.php" ); 8 require_once( "class.killsummarytable.php" ); 9 require_once( "class.box.php" ); 10 require_once( "class.toplist.php" ); 11 12 $corp = new Corporation( $_GET['crp_id'] ); 13 $alliance = $corp->getAlliance(); 14 15 $klist = new KillList(); 16 $tklist = new KillList(); 17 $llist = new KillList(); 18 $klist->addInvolvedCorp( $corp ); 19 $tklist->addInvolvedCorp( $corp ); 20 $tklist->setPodsNoobShips( false ); 21 $llist->addVictimCorp( $corp ); 22 $klist->getAllKills(); 23 $llist->getAllKills(); 24 25 $page = new Page( "Corporation details - ".$corp->getName() ); 26 27 $html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center>"; 28 29 if ( file_exists( "img/corps/".$corp->getID().".gif" ) ) $html .= "<img src=\"".IMG_URL."/corps/".$corp->getID().".gif\" border=\"0\"></td>"; 30 else $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\"></td>"; 31 // $html .= "</tr>"; 32 33 $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; 34 if ( $alliance->getName() == "Unknown" || $alliance->getName() == "None" ) 35 $html .= "<b>".$alliance->getName()."</b>"; 36 else 37 $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 38 $html .= "</td></tr>"; 39 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$klist->getCount()."</td></tr>"; 40 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Real kills:</b></td><td class=kl-kill>".$tklist->getCount()."</td></tr>"; 41 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$llist->getCount()."</td></tr>"; 42 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".$klist->getISK()."M</td></tr>"; 43 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".$llist->getISK()."M</td></tr>"; 44 if ( $klist->getISK() ) 45 $efficiency = round( $klist->getISK() / ( $klist->getISK() + $llist->getISK() ) * 100, 2 ); 46 else 1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 4 require_once("class.corp.php"); 5 require_once("class.alliance.php"); 6 require_once("class.killlist.php"); 7 require_once("class.killlisttable.php"); 8 require_once("class.killsummarytable.php"); 9 require_once("class.box.php"); 10 require_once("class.toplist.php"); 11 12 $corp = new Corporation($_GET['crp_id']); 13 $alliance = $corp->getAlliance(); 14 15 $klist = new KillList(); 16 $tklist = new KillList(); 17 $llist = new KillList(); 18 $klist->addInvolvedCorp($corp); 19 $tklist->addInvolvedCorp($corp); 20 $tklist->setPodsNoobShips(false); 21 $llist->addVictimCorp($corp); 22 $klist->getAllKills(); 23 $llist->getAllKills(); 24 25 $page = new Page("Corporation details - " . $corp->getName()); 26 $html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center>"; 27 28 if (file_exists("img/corps/".$corp->getID().".jpg")) 29 { 30 $html .= "<img src=\"".$corp->getPortraitURL(128)."\" border=\"0\"></td>"; 31 } 32 else 33 { 34 $html .= "<img src=\"" . IMG_URL . "/campaign-big.gif\" border=\"0\"></td>"; 35 } 36 37 // $html .= "</tr>"; 38 $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; 39 if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 40 $html .= "<b>" . $alliance->getName() . "</b>"; 41 else 42 $html .= "<a href=\"?a=alliance_detail&all_id=" . $alliance->getID() . "\">" . $alliance->getName() . "</a>"; 43 $html .= "</td></tr>"; 44 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>" . $klist->getCount() . "</td></tr>"; 45 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Real kills:</b></td><td class=kl-kill>" . $tklist->getCount() . "</td></tr>"; 46 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>" . $llist->getCount() . "</td></tr>"; 47 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>" . $klist->getISK() . "M</td></tr>"; 48 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>" . $llist->getISK() . "M</td></tr>"; 49 if ($klist->getISK()) 50 $efficiency = round($klist->getISK() / ($klist->getISK() + $llist->getISK()) * 100, 2); 51 else 47 52 $efficiency = 0; 48 53 49 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>".$efficiency."%</b></td></tr>"; 50 51 $html .= "</table>"; 52 53 $html .= "<br/>"; 54 55 if ( $_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses" ) { 56 $summarytable = new KillSummaryTable( $klist, $llist ); 57 $summarytable->setBreak( 6 ); 58 54 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $efficiency . "%</b></td></tr>"; 55 56 $html .= "</table>"; 57 58 $html .= "<br/>"; 59 60 if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses") 61 { 62 $summarytable = new KillSummaryTable($klist, $llist); 63 $summarytable->setBreak(6); 64 59 65 $html .= $summarytable->generate(); 60 } 61 62 switch ( $_GET['view'] ) { 66 } 67 68 switch ($_GET['view']) 69 { 63 70 case "": 64 $html .= "<div class=kb-kills-header>10 Most recent kills</div>";65 66 $list = new KillList();67 $list->setOrdered( true);68 $list->setLimit( 10);69 $list->setPodsNoobships( true);70 $list->addInvolvedCorp( $corp);71 if ( $_GET['scl_id'])72 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));73 74 $ktab = new KillListTable( $list);75 $ktab->setLimit( 10);76 $ktab->setDayBreak( false);77 $html .= $ktab->generate();78 79 $html .= "<div class=kb-losses-header>10 Most recent losses</div>";80 81 $list = new KillList();82 $list->setOrdered( true);83 $list->setLimit( 10);84 $list->setPodsNoobships( true);85 $list->addVictimCorp( $corp);86 if ( $_GET['scl_id'])87 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));88 89 $ltab = new KillListTable( $list);90 $ltab->setLimit( 10);91 $ltab->setDayBreak( false);92 $html .= $ltab->generate();93 94 break;71 $html .= "<div class=kb-kills-header>10 Most recent kills</div>"; 72 73 $list = new KillList(); 74 $list->setOrdered(true); 75 $list->setLimit(10); 76 $list->setPodsNoobships(true); 77 $list->addInvolvedCorp($corp); 78 if ($_GET['scl_id']) 79 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 80 81 $ktab = new KillListTable($list); 82 $ktab->setLimit(10); 83 $ktab->setDayBreak(false); 84 $html .= $ktab->generate(); 85 86 $html .= "<div class=kb-losses-header>10 Most recent losses</div>"; 87 88 $list = new KillList(); 89 $list->setOrdered(true); 90 $list->setLimit(10); 91 $list->setPodsNoobships(true); 92 $list->addVictimCorp($corp); 93 if ($_GET['scl_id']) 94 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 95 96 $ltab = new KillListTable($list); 97 $ltab->setLimit(10); 98 $ltab->setDayBreak(false); 99 $html .= $ltab->generate(); 100 101 break; 95 102 case "kills": 96 $html .= "<div class=kb-kills-header>All kills</div>";97 98 $list = new KillList();99 $list->setOrdered( true);100 $list->addInvolvedCorp( $corp);101 if ( $_GET['scl_id'])102 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));103 $pagesplitter = new PageSplitter( $list->getCount(), 30);104 $list->setPageSplitter( $pagesplitter);105 $table = new KillListTable( $list);106 $table->setDayBreak( false);107 $html .= $table->generate();108 $html .= $pagesplitter->generate();109 110 break;103 $html .= "<div class=kb-kills-header>All kills</div>"; 104 105 $list = new KillList(); 106 $list->setOrdered(true); 107 $list->addInvolvedCorp($corp); 108 if ($_GET['scl_id']) 109 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 110 $pagesplitter = new PageSplitter($list->getCount(), 30); 111 $list->setPageSplitter($pagesplitter); 112 $table = new KillListTable($list); 113 $table->setDayBreak(false); 114 $html .= $table->generate(); 115 $html .= $pagesplitter->generate(); 116 117 break; 111 118 case "losses": 112 $html .= "<div class=kb-losses-header>All losses</div>";113 114 $list = new KillList();115 $list->setOrdered( true);116 $list->setPodsNoobships( true);117 $list->addVictimCorp( $corp);118 if ( $_GET['scl_id'])119 $list->addVictimShipClass( new ShipClass( $_GET['scl_id'] ));120 $pagesplitter = new PageSplitter( $list->getCount(), 30);121 $list->setPageSplitter( $pagesplitter);122 123 $table = new KillListTable( $list);124 $table->setDayBreak( false);125 $html .= $table->generate();126 $html .= $pagesplitter->generate();127 128 break;119 $html .= "<div class=kb-losses-header>All losses</div>"; 120 121 $list = new KillList(); 122 $list->setOrdered(true); 123 $list->setPodsNoobships(true); 124 $list->addVictimCorp($corp); 125 if ($_GET['scl_id']) 126 $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); 127 $pagesplitter = new PageSplitter($list->getCount(), 30); 128 $list->setPageSplitter($pagesplitter); 129 130 $table = new KillListTable($list); 131 $table->setDayBreak(false); 132 $html .= $table->generate(); 133 $html .= $pagesplitter->generate(); 134 135 break; 129 136 case "pilot_kills": 130 $html .= "<div class=block-header2>Top killers</div>";131 132 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";133 $html .= "<div class=block-header>This month</div>";134 135 $list = new TopKillsList();136 $list->addInvolvedCorp( $corp);137 $list->setPodsNoobShips( false);138 $list->setMonth( date( "m" ));139 $list->setYear( date( "Y" ));140 $table = new TopPilotTable( $list, "Kills");141 $html .= $table->generate();142 143 $html .= "</td><td valign=top width=400>";144 $html .= "<div class=block-header>All time</div>";145 146 $list = new TopKillsList();147 $list->addInvolvedCorp( $corp);148 $list->setPodsNoobShips( false);149 $table = new TopPilotTable( $list, "Kills");150 $html .= $table->generate();151 152 $html .= "</td></tr></table>";153 154 break;137 $html .= "<div class=block-header2>Top killers</div>"; 138 139 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 140 $html .= "<div class=block-header>This month</div>"; 141 142 $list = new TopKillsList(); 143 $list->addInvolvedCorp($corp); 144 $list->setPodsNoobShips(false); 145 $list->setMonth(date("m")); 146 $list->setYear(date("Y")); 147 $table = new TopPilotTable($list, "Kills"); 148 $html .= $table->generate(); 149 150 $html .= "</td><td valign=top width=400>"; 151 $html .= "<div class=block-header>All time</div>"; 152 153 $list = new TopKillsList(); 154 $list->addInvolvedCorp($corp); 155 $list->setPodsNoobShips(false); 156 $table = new TopPilotTable($list, "Kills"); 157 $html .= $table->generate(); 158 159 $html .= "</td></tr></table>"; 160 161 break; 155 162 case "pilot_scores": 156 $html .= "<div class=block-header2>Top scorers</div>";157 158 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";159 $html .= "<div class=block-header>This month</div>";160 161 $list = new TopScoreList();162 $list->addInvolvedCorp( $corp);163 $list->setPodsNoobShips( false);164 $list->setMonth( date( "m" ));165 $list->setYear( date( "Y" ));166 $table = new TopPilotTable( $list, "Points");167 $html .= $table->generate();168 169 $html .= "</td><td valign=top width=400>";170 $html .= "<div class=block-header>All time</div>";171 172 $list = new TopScoreList();173 $list->addInvolvedCorp( $corp);174 $list->setPodsNoobShips( false);175 $table = new TopPilotTable( $list, "Points");176 $html .= $table->generate();177 178 $html .= "</td></tr></table>";179 180 break;163 $html .= "<div class=block-header2>Top scorers</div>"; 164 165 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 166 $html .= "<div class=block-header>This month</div>"; 167 168 $list = new TopScoreList(); 169 $list->addInvolvedCorp($corp); 170 $list->setPodsNoobShips(false); 171 $list->setMonth(date("m")); 172 $list->setYear(date("Y")); 173 $table = new TopPilotTable($list, "Points"); 174 $html .= $table->generate(); 175 176 $html .= "</td><td valign=top width=400>"; 177 $html .= "<div class=block-header>All time</div>"; 178 179 $list = new TopScoreList(); 180 $list->addInvolvedCorp($corp); 181 $list->setPodsNoobShips(false); 182 $table = new TopPilotTable($list, "Points"); 183 $html .= $table->generate(); 184 185 $html .= "</td></tr></table>"; 186 187 break; 181 188 case "pilot_solo": 182 $html .= "<div class=block-header2>Top solokillers</div>";183 184 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";185 $html .= "<div class=block-header>This month</div>";186 187 $list = new TopSoloKillerList();188 $list->addInvolvedCorp( $corp);189 $list->setPodsNoobShips( false);190 $list->setMonth( date( "m" ));191 $list->setYear( date( "Y" ));192 $table = new TopPilotTable( $list, "Solokills");193 $html .= $table->generate();194 195 $html .= "</td><td valign=top width=400>";196 $html .= "<div class=block-header>All time</div>";197 198 $list = new TopSoloKillerList();199 $list->addInvolvedCorp( $corp);200 $list->setPodsNoobShips( false);201 $table = new TopPilotTable( $list, "Solokills");202 $html .= $table->generate();203 204 $html .= "</td></tr></table>";205 206 break;189 $html .= "<div class=block-header2>Top solokillers</div>"; 190 191 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 192 $html .= "<div class=block-header>This month</div>"; 193 194 $list = new TopSoloKillerList(); 195 $list->addInvolvedCorp($corp); 196 $list->setPodsNoobShips(false); 197 $list->setMonth(date("m")); 198 $list->setYear(date("Y")); 199 $table = new TopPilotTable($list, "Solokills"); 200 $html .= $table->generate(); 201 202 $html .= "</td><td valign=top width=400>"; 203 $html .= "<div class=block-header>All time</div>"; 204 205 $list = new TopSoloKillerList(); 206 $list->addInvolvedCorp($corp); 207 $list->setPodsNoobShips(false); 208 $table = new TopPilotTable($list, "Solokills"); 209 $html .= $table->generate(); 210 211 $html .= "</td></tr></table>"; 212 213 break; 207 214 208 215 case "pilot_damage": 209 $html .= "<div class=block-header2>Top damagedealers</div>";210 211 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";212 $html .= "<div class=block-header>This month</div>";213 214 $list = new TopDamageDealerList();215 $list->addInvolvedCorp( $corp);216 $list->setPodsNoobShips( false);217 $list->setMonth( date( "m" ));218 $list->setYear( date( "Y" ));219 $table = new TopPilotTable( $list, "Kills");220 $html .= $table->generate();221 222 $html .= "</td><td valign=top width=400>";223 $html .= "<div class=block-header>All time</div>";224 225 $list = new TopDamageDealerList();226 $list->addInvolvedCorp( $corp);227 $list->setPodsNoobShips( false);228 $table = new TopPilotTable( $list, "Kills");229 $html .= $table->generate();230 231 $html .= "</td></tr></table>";232 233 break;216 $html .= "<div class=block-header2>Top damagedealers</div>"; 217 218 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 219 $html .= "<div class=block-header>This month</div>"; 220 221 $list = new TopDamageDealerList(); 222 $list->addInvolvedCorp($corp); 223 $list->setPodsNoobShips(false); 224 $list->setMonth(date("m")); 225 $list->setYear(date("Y")); 226 $table = new TopPilotTable($list, "Kills"); 227 $html .= $table->generate(); 228 229 $html .= "</td><td valign=top width=400>"; 230 $html .= "<div class=block-header>All time</div>"; 231 232 $list = new TopDamageDealerList(); 233 $list->addInvolvedCorp($corp); 234 $list->setPodsNoobShips(false); 235 $table = new TopPilotTable($list, "Kills"); 236 $html .= $table->generate(); 237 238 $html .= "</td></tr></table>"; 239 240 break; 234 241 235 242 case "pilot_griefer": 236 $html .= "<div class=block-header2>Top griefers</div>";237 238 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";239 $html .= "<div class=block-header>This month</div>";240 241 $list = new TopGrieferList();242 $list->addInvolvedCorp( $corp);243 $list->setMonth( date( "m" ));244 $list->setYear( date( "Y" ));245 $table = new TopPilotTable( $list, "Kills");246 $html .= $table->generate();247 248 $html .= "</td><td valign=top width=400>";249 $html .= "<div class=block-header>All time</div>";250 251 $list = new TopGrieferList();252 $list->addInvolvedCorp( $corp);253 $table = new TopPilotTable( $list, "Kills");254 $html .= $table->generate();255 256 $html .= "</td></tr></table>";257 258 break;243 $html .= "<div class=block-header2>Top griefers</div>"; 244 245 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 246 $html .= "<div class=block-header>This month</div>"; 247 248 $list = new TopGrieferList(); 249 $list->addInvolvedCorp($corp); 250 $list->setMonth(date("m")); 251 $list->setYear(date("Y")); 252 $table = new TopPilotTable($list, "Kills"); 253 $html .= $table->generate(); 254 255 $html .= "</td><td valign=top width=400>"; 256 $html .= "<div class=block-header>All time</div>"; 257 258 $list = new TopGrieferList(); 259 $list->addInvolvedCorp($corp); 260 $table = new TopPilotTable($list, "Kills"); 261 $html .= $table->generate(); 262 263 $html .= "</td></tr></table>"; 264 265 break; 259 266 260 267 case "pilot_losses": 261 $html .= "<div class=block-header2>Top losers</div>";262 263 $html .= "<table class=kb-subtable><tr><td valign=top width=440>";264 $html .= "<div class=block-header>This month</div>";265 266 $list = new TopLossesList();267 $list->addVictimCorp( $corp);268 $list->setPodsNoobShips( false);269 $list->setMonth( date( "m" ));270 $list->setYear( date( "Y" ));271 $table = new TopPilotTable( $list, "Losses");272 $html .= $table->generate();273 274 $html .= "</td><td valign=top width=400>";275 $html .= "<div class=block-header>All time</div>";276 277 $list = new TopLossesList();278 $list->addVictimCorp( $corp);279 $list->setPodsNoobShips( false);280 $table = new TopPilotTable( $list, "Losses");281 $html .= $table->generate();282 283 $html .= "</td></tr></table>";284 285 break;268 $html .= "<div class=block-header2>Top losers</div>"; 269 270 $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; 271 $html .= "<div class=block-header>This month</div>"; 272 273 $list = new TopLossesList(); 274 $list->addVictimCorp($corp); 275 $list->setPodsNoobShips(false); 276 $list->setMonth(date("m")); 277 $list->setYear(date("Y")); 278 $table = new TopPilotTable($list, "Losses"); 279 $html .= $table->generate(); 280 281 $html .= "</td><td valign=top width=400>"; 282 $html .= "<div class=block-header>All time</div>"; 283 284 $list = new TopLossesList(); 285 $list->addVictimCorp($corp); 286 $list->setPodsNoobShips(false); 287 $table = new TopPilotTable($list, "Losses"); 288 $html .= $table->generate(); 289 290 $html .= "</td></tr></table>"; 291 292 break; 286 293 case "ships_weapons": 287 $html .= "<div class=block-header2>Ships & weapons used</div>"; 288 289 $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; 290 $shiplist = new TopShipList(); 291 $shiplist->addInvolvedCorp( $corp ); 292 $shiplisttable = new TopShipListTable( $shiplist ); 293 $html .= $shiplisttable->generate(); 294 $html .= "</td><td valign=top align=right width=400>"; 295 296 $weaponlist = new TopWeaponList(); 297 $weaponlist->addInvolvedCorp( $corp ); 298 $weaponlisttable = new TopWeaponListTable( $weaponlist ); 299 $html .= $weaponlisttable->generate(); 300 $html .= "</td></tr></table>"; 301 302 break; 303 } 304 305 $menubox = new MenuBox(); 306 $menubox->addCaption( "Kills & losses" ); 307 $menubox->addOption( "Recent activity", "?a=corp_detail&crp_id=".$corp->getID() ); 308 $menubox->addOption( "Kills", "?a=corp_detail&crp_id=".$corp->getID()."&view=kills" ); 309 $menubox->addOption( "Losses", "?a=corp_detail&crp_id=".$corp->getID()."&view=losses" ); 310 $menubox->addCaption( "Pilot statistics" ); 311 $menubox->addOption( "Top killers", "?a=corp_detail&crp_id=".$corp->getID()."&view=pilot_kills" ); 312 313 $killboard = $page->killboard_; 314 $config = $killboard->getConfig(); 315 if ( $config->getKillPoints() ) 316 $menubox->addOption( "Top scorers", "?a=corp_detail&crp_id=".$corp->getID()."&view=pilot_scores" ); 317 $menubox->addOption( "Top solokillers", "?a=corp_detail&crp_id=".$corp->getID()."&view=pilot_solo" ); 318 $menubox->addOption( "Top damagedealers", "?a=corp_detail&crp_id=".$corp->getID()."&view=pilot_damage" ); 319 $menubox->addOption( "Top griefers", "?a=corp_detail&crp_id=".$corp->getID()."&view=pilot_griefer" ); 320 $menubox->addOption( "Top losers", "?a=corp_detail&crp_id=".$corp->getID()."&view=pilot_losses" ); 321 $menubox->addCaption( "Global statistics" ); 322 $menubox->addOption( "Ships & weapons", "?a=corp_detail&crp_id=".$corp->getID()."&view=ships_weapons" ); 323 $page->addContext( $menubox->generate() ); 324 $page->setContent( $html ); 325 $page->generate(); 326 294 $html .= "<div class=block-header2>Ships & weapons used</div>"; 295 296 $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; 297 $shiplist = new TopShipList(); 298 $shiplist->addInvolvedCorp($corp); 299 $shiplisttable = new TopShipListTable($shiplist); 300 $html .= $shiplisttable->generate(); 301 $html .= "</td><td valign=top align=right width=400>"; 302 303 $weaponlist = new TopWeaponList(); 304 $weaponlist->addInvolvedCorp($corp); 305 $weaponlisttable = new TopWeaponListTable($weaponlist); 306 $html .= $weaponlisttable->generate(); 307 $html .= "</td></tr></table>"; 308 309 break; 310 } 311 312 $menubox = new MenuBox(); 313 $menubox->addCaption("Kills & losses"); 314 $menubox->addOption("Recent activity", "?a=corp_detail&crp_id=" . $corp->getID()); 315 $menubox->addOption("Kills", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=kills"); 316 $menubox->addOption("Losses", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=losses"); 317 $menubox->addCaption("Pilot statistics"); 318 $menubox->addOption("Top killers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_kills"); 319 320 $killboard = $page->killboard_; 321 $config = $killboard->getConfig(); 322 if ($config->getKillPoints()) 323 $menubox->addOption("Top scorers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_scores"); 324 $menubox->addOption("Top solokillers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_solo"); 325 $menubox->addOption("Top damagedealers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_damage"); 326 $menubox->addOption("Top griefers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_griefer"); 327 $menubox->addOption("Top losers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_losses"); 328 $menubox->addCaption("Global statistics"); 329 $menubox->addOption("Ships & weapons", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=ships_weapons"); 330 $page->addContext($menubox->generate()); 331 $page->setContent($html); 332 $page->generate(); 327 333 ?> -
dev/common/globals.php
r2 r10 1 <? 2 3 function shorten( $shorten, $by = 22 ) 4 { 5 if ( strlen( $shorten ) > $by ) { 6 $s = substr( $shorten, 0, $by ) . "..."; 7 } else $s = $shorten; 1 <?php 2 3 function shorten($shorten, $by = 22) 4 { 5 if (strlen($shorten) > $by) 6 { 7 $s = substr($shorten, 0, $by) . "..."; 8 } 9 else $s = $shorten; 8 10 9 11 return $s; 10 12 } 11 13 12 function slashfix( $fix)13 14 return addslashes( stripslashes( $fix ));15 14 function slashfix($fix) 15 { 16 return addslashes(stripslashes($fix)); 17 } 16 18 17 function roundsec( $sec)18 19 if ( $sec <= 0)20 $s = 0.0;19 function roundsec($sec) 20 { 21 if ($sec <= 0) 22 $s = 0.0; 21 23 else 22 $s = $sec;24 $s = $sec; 23 25 24 return number_format( round( $s, 1 ), 1 ); 25 } 26 26 return number_format(round($s, 1), 1); 27 } 27 28 ?> -
dev/common/home.php
r2 r10 1 <? 2 require_once( "class.page.php");3 require_once( "class.killsummarytable.php");4 require_once( "class.box.php");5 require_once( "class.corp.php");6 require_once( "class.alliance.php");7 require_once( "class.killlist.php");8 require_once( "class.killlisttable.php");9 require_once( "class.contract.php");10 require_once( "class.graph.php");11 require_once( "class.toplist.php");1 <?php 2 require_once("class.page.php"); 3 require_once("class.killsummarytable.php"); 4 require_once("class.box.php"); 5 require_once("class.corp.php"); 6 require_once("class.alliance.php"); 7 require_once("class.killlist.php"); 8 require_once("class.killlisttable.php"); 9 require_once("class.contract.php"); 10 require_once("class.graph.php"); 11 require_once("class.toplist.php"); 12 12 13 $week = date( "W");14 $year = date( "Y");13 $week = date("W"); 14 $year = date("Y"); 15 15 16 $page = new Page( "Week ".$week);16 $page = new Page("Week " . $week); 17 17 18 19 if ( CORP_ID)20 $kslist->addInvolvedCorp( new Corporation( CORP_ID ));21 if ( ALLIANCE_ID)22 $kslist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ));18 $kslist = new KillList(); 19 if (CORP_ID) 20 $kslist->addInvolvedCorp(new Corporation(CORP_ID)); 21 if (ALLIANCE_ID) 22 $kslist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 23 23 24 $kslist->setWeek( $week);25 $kslist->setYear( $year);24 $kslist->setWeek($week); 25 $kslist->setYear($year); 26 26 27 28 if ( CORP_ID)29 $llist->addVictimCorp( new Corporation( CORP_ID ));30 if ( ALLIANCE_ID)31 $llist->addVictimAlliance( new Alliance( ALLIANCE_ID ));27 $llist = new KillList(); 28 if (CORP_ID) 29 $llist->addVictimCorp(new Corporation(CORP_ID)); 30 if (ALLIANCE_ID) 31 $llist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 32 32 33 $llist->setWeek( $week);34 $llist->setYear( $year);33 $llist->setWeek($week); 34 $llist->setYear($year); 35 35 36 $summarytable = new KillSummaryTable( $kslist, $llist);37 $summarytable->setBreak( 6);38 36 $summarytable = new KillSummaryTable($kslist, $llist); 37 $summarytable->setBreak(6); 38 $html .= $summarytable->generate(); 39 39 40 if ( $week == 1 ) { 41 $pyear = date( "Y" ) - 1; 40 if ($week == 1) 41 { 42 $pyear = date("Y") - 1; 42 43 $pweek = 52; 43 } 44 else { 45 $pyear = date( "Y" ); 44 } 45 else 46 { 47 $pyear = date("Y"); 46 48 $pweek = $week - 1; 47 } 48 49 if ( $page->killboard_->hasCampaigns( true ) ) { 49 } 50 51 if ($page->killboard_->hasCampaigns(true)) 52 { 50 53 $html .= "<div class=kb-campaigns-header>Active campaigns</div>"; 51 54 $list = new ContractList(); 52 $list->setActive( "yes");53 $list->setCampaigns( true);54 $table = new ContractListTable( $list);55 $list->setActive("yes"); 56 $list->setCampaigns(true); 57 $table = new ContractListTable($list); 55 58 $html .= $table->generate(); 56 59 } 57 60 58 if ( $page->killboard_->hasContracts( true ) ) { 61 if ($page->killboard_->hasContracts(true)) 62 { 59 63 $html .= "<div class=kb-campaigns-header>Active contracts</div>"; 60 64 $list = new ContractList(); 61 $list->setActive( "yes");62 $list->setCampaigns( false);63 $table = new ContractListTable( $list);65 $list->setActive("yes"); 66 $list->setCampaigns(false); 67 $table = new ContractListTable($list); 64 68 $html .= $table->generate(); 65 69 } 66 70 67 71 $html .= "<div class=kb-kills-header>20 most recent kills</div>"; 68 72 69 $klist = new KillList(); 70 $klist->setOrdered( true ); 71 if ( CORP_ID ) 72 $klist->addInvolvedCorp( new Corporation( CORP_ID ) ); 73 if ( ALLIANCE_ID ) 74 $klist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) ); 75 $klist->setStartWeek( $week - 1 ); 76 $klist->setYear( $year ); 73 $klist = new KillList(); 74 $klist->setOrdered(true); 75 if (CORP_ID) 76 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 77 if (ALLIANCE_ID) 78 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 77 79 78 if ( $_GET['scl_id'] ) 79 $klist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ) ); 80 else 81 $klist->setPodsNoobShips( false ); 82 83 $table = new KillListTable( $klist ); 84 $table->setLimit( 20 ); 85 $html .= $table->generate(); 80 // boards with low killcount could not display 20 kills with those limits 81 //$klist->setStartWeek($week - 1); 82 //$klist->setYear($year); 86 83 87 $page->setContent( $html ); 88 $menubox = new MenuBox(); 89 $menubox->addCaption( "Navigation" ); 90 $menubox->addOption( "Previous week", "?a=kills&w=".$pweek."&y=".$pyear ); 91 $page->addContext( $menubox->generate() ); 84 if ($_GET['scl_id']) 85 $klist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 86 else 87 $klist->setPodsNoobShips(false); 92 88 93 $tklist = new TopKillsList(); 94 $tklist->setWeek( $week ); 95 $tklist->setYear( $year ); 96 if ( CORP_ID ) 97 $tklist->addInvolvedCorp( new Corporation( CORP_ID ) ); 98 if ( ALLIANCE_ID ) 99 $tklist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) ); 100 101 $tklist->generate(); 102 $tkbox = new AwardBox( $tklist, "Top killers", "kills in week ".$week, "kills", "eagle" ); 103 $page->addContext( $tkbox->generate() ); 89 $table = new KillListTable($klist); 90 $table->setLimit(20); 91 $html .= $table->generate(); 104 92 105 $config = $page->killboard_->getConfig(); 106 if ( $config->getKillPoints() ) { 93 $page->setContent($html); 94 $menubox = new MenuBox(); 95 $menubox->addCaption("Navigation"); 96 $menubox->addOption("Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear); 97 $page->addContext($menubox->generate()); 98 99 $tklist = new TopKillsList(); 100 $tklist->setWeek($week); 101 $tklist->setYear($year); 102 if (CORP_ID) 103 $tklist->addInvolvedCorp(new Corporation(CORP_ID)); 104 if (ALLIANCE_ID) 105 $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 106 107 $tklist->generate(); 108 $tkbox = new AwardBox($tklist, "Top killers", "kills in week " . $week, "kills", "eagle"); 109 $page->addContext($tkbox->generate()); 110 111 $config = $page->killboard_->getConfig(); 112 if ($config->getKillPoints()) 113 { 107 114 $tklist = new TopScoreList(); 108 $tklist->setWeek( $week);109 $tklist->setYear( $year);110 if ( CORP_ID)111 $tklist->addInvolvedCorp( new Corporation( CORP_ID ));112 if ( ALLIANCE_ID)113 $tklist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ));114 115 $tklist->setWeek($week); 116 $tklist->setYear($year); 117 if (CORP_ID) 118 $tklist->addInvolvedCorp(new Corporation(CORP_ID)); 119 if (ALLIANCE_ID) 120 $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 121 115 122 $tklist->generate(); 116 $tkbox = new AwardBox( $tklist, "Top scorers", "points in week ".$week, "points", "redcross");117 $page->addContext( $tkbox->generate() );118 119 120 123 $tkbox = new AwardBox($tklist, "Top scorers", "points in week " . $week, "points", "redcross"); 124 $page->addContext($tkbox->generate()); 125 } 126 127 $page->generate(); 121 128 ?> -
dev/common/index.php
r2 r10 1 <? 2 require_once( "db.php");3 require_once( "class.killboard.php");1 <?php 2 require_once("db.php"); 3 require_once("class.killboard.php"); 4 4 5 $page = str_replace( ".", "", $_GET['a']);6 $page = str_replace( "/", "", $page ); 5 $page = str_replace(".", "", $_GET['a']); 6 $page = str_replace("/", "", $page); 7 7 8 if ( $page == "")8 if ($page == "") 9 9 $page = "home"; 10 11 require_once( "config.php" ); 10 if (!file_exists("common/".$page.".php")) 11 { 12 $page = "home"; 13 } 12 14 13 $killboard = new Killboard( KB_SITE ); 14 if ( $killboard->isSuspended() ) 15 $page = "suspended"; 15 require_once("config.php"); 16 16 17 if ( substr( $_SERVER['HTTP_USER_AGENT'], 0, 15 ) == "EVE-minibrowser" 18 && $page != "igb" && $page != "post_igb" && $page != "portrait_grab" && $page != "bills" ) 17 $killboard = new Killboard(KB_SITE); 18 //if ($killboard->isSuspended()) 19 // $page = "suspended"; 20 21 if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == "EVE-minibrowser" && $page != "igb" && $page != "post_igb" && $page != "portrait_grab" && $page != "bills") 19 22 $page = "igb"; 20 23 21 if ( KB_CACHE == 1 && count( $_POST ) == 0 22 && !in_array( $page, $cacheignore ) ) $docache = true; 24 if (KB_CACHE == 1 && count($_POST) == 0 && !in_array($page, $cacheignore)) $docache = true; 23 25 24 if ( $docache ) { 25 if ( !file_exists( KB_CACHEDIR."/".KB_SITE ) ) 26 @mkdir( KB_CACHEDIR."/".KB_SITE ); 26 if ($docache) 27 { 28 if (!file_exists(KB_CACHEDIR . "/" . KB_SITE)) 29 @mkdir(KB_CACHEDIR . "/" . KB_SITE); 27 30 28 if ( $cachetimes[$page]) $cachetime = $cachetimes[$page];31 if ($cachetimes[$page]) $cachetime = $cachetimes[$page]; 29 32 else $cachetime = 5; 30 33 31 34 $cachetime = $cachetime * 60; 32 35 33 $cachefile = KB_CACHEDIR ."/".KB_SITE."/".md5( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ).".cache";34 $timestamp = ( ( @file_exists( $cachefile ) ) ) ? @filemtime( $cachefile) : 0;36 $cachefile = KB_CACHEDIR . "/" . KB_SITE . "/" . md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . ".cache"; 37 $timestamp = ((@file_exists($cachefile))) ? @filemtime($cachefile) : 0; 35 38 36 if ( time() - $cachetime < $timestamp ) { 37 ob_start('ob_gzhandler'); 38 @readfile($cachefile); 39 ob_end_flush(); 40 exit(); 39 if (time() - $cachetime < $timestamp) 40 { 41 ob_start('ob_gzhandler'); 42 @readfile($cachefile); 43 ob_end_flush(); 44 exit(); 41 45 } 42 46 43 47 ob_start(); 44 48 } 45 49 46 include( "common/".$page.".php");50 include("common/" . $page . ".php"); 47 51 48 if ( $docache ) { 49 $fp = @fopen( $cachefile, 'w' ); 52 if ($docache) 53 { 54 $fp = @fopen($cachefile, 'w'); 50 55 @fwrite($fp, ob_get_contents()); 51 @fwrite($fp, "<!-- Generated from cache -->" 56 @fwrite($fp, "<!-- Generated from cache -->"); 52 57 @fclose($fp); 53 ob_end_flush(); 54 58 ob_end_flush(); 59 } 55 60 ?> -
dev/common/kill_delete.php
r3 r10 1 <? 2 require_once( "db.php" ); 3 require_once( "class.page.php" ); 4 require_once( "class.kill.php" ); 5 require_once( "class.tabbedform.php" ); 6 require_once( "admin_menu.php" ); 1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 4 require_once("class.kill.php"); 7 5 8 $page = new Page( "Administration - Deletion of Kills");6 $page = new Page("Administration - Deletion of Kill ID \"" . $_GET['kll_id'] . "\""); 9 7 $page->setAdmin(); 10 8 $dbconn = new DBConnection(); 11 9 $kll_id = $_GET['kll_id']; 12 10 13 if ( $_GET['confirm'] ) { 14 $kill = new Kill( $kll_id ); 15 $kill->remove(); 16 $html .= "Kill ID \"".$_GET['kll_id']."\" deleted!"; 17 $html .= "<br><br><a href=\"javascript:window.history.go(-3);\">[go back]</a>"; 18 $page->setContent( $html ); 19 $page->addContext( $menubox->generate() ); 20 $page->generate(); 21 exit; 11 if ($_GET['confirm']) 12 { 13 $kill = new Kill($kll_id); 14 $kill->remove(); 15 $html .= "Kill ID \"" . $_GET['kll_id'] . "\" deleted!"; 16 $html .= "<br><br><a href=\"javascript:window.close();\">[close]</a>"; 22 17 } 23 if (!isset($_POST['submit'])) { 24 $html .= "<form method='post' action="; 25 echo $PHP_SELF; 26 $html .= ">"; 27 $html .= "Kill ID: <input type='text' size='12' maxlength='12' name='killd'> "; 28 $html .= "<input type='submit' value='Submit' name='submit'>"; 29 $html .= "</form>"; 30 } else { 31 $html .= "Confirm deletion of Kill ID \"".$_POST["killd"]."\"? "; 32 $html .= "<br /><br /><button onClick=\"window.location.href='?a=kill_delete&confirm=yes&kll_id=".$_POST["killd"]."'\">Yes</button> "; 33 $html .= " <button onClick=\"window.history.back();\">No</button>"; 18 else 19 { 20 $html .= "Confirm deletion of Kill ID \"" . $_GET['kll_id'] . "\": "; 21 $html .= "<button onClick=\"window.location.href='?a=kill_delete&confirm=yes&kll_id=" . $_GET['kll_id'] . "'\">Yes</button> "; 22 $html .= "<button onClick=\"window.close();\">No</button>"; 34 23 } 35 36 $page->setContent( $html ); 37 $page->addContext( $menubox->generate() ); 24 $page->setContent($html); 38 25 $page->generate(); 39 26 ?> -
dev/common/kill_detail.php
r2 r10 1 <? 2 require_once( "class.kill.php" ); 3 require_once( "class.page.php" ); 4 require_once( "class.pilot.php" ); 5 require_once( "class.corp.php" ); 6 require_once( "class.box.php" ); 7 require_once( "class.alliance.php" ); 8 require_once( "globals.php" ); 9 10 $page = new Page( "Kill details" ); 11 12 $kill = new Kill( $_GET['kll_id'] ); 13 if ( !$kill->exists() ) { 1 <?php 2 require_once("class.kill.php"); 3 require_once("class.page.php"); 4 require_once("class.pilot.php"); 5 require_once("class.corp.php"); 6 require_once("class.box.php"); 7 require_once("class.alliance.php"); 8 require_once("globals.php"); 9 10 $page = new Page("Kill details"); 11 12 $kill = new Kill($_GET['kll_id']); 13 if (!$kill->exists()) 14 { 14 15 $html = "That kill doesn't exist."; 15 $page->generate( $html);16 $page->generate($html); 16 17 exit; 17 } 18 19 $html .= "<table cellpadding=0 cellspacing=1 border=0><tr><td width=360 align=left valign=top>"; 20 21 // victim 22 $html .= "<table class=kb-table width=360 cellpadding=0 cellspacing=1 border=0>"; 23 $html .= "<tr class=kb-table-row-odd><td rowspan=3 width=\"64\"><img src=\"".$kill->getVictimPortrait( 64 )."\" border=\"0\"></td>"; 24 $html .= "<td class=kb-table-cell width=64><b>Victim:</b></td><td class=kb-table-cell><a href=\"?a=pilot_detail&plt_id=".$kill->getVictimID()."\">".$kill->getVictimName()."</a></td>"; 25 $html .= "</tr>"; 26 $html .= "<tr class=kb-table-row-odd>"; 27 $html .= "<td class=kb-table-cell width=64><b>Corp:</b></td><td class=kb-table-cell><a href=\"?a=corp_detail&crp_id=".$kill->getVictimCorpID()."\">".$kill->getVictimCorpName()."</a></td>"; 28 $html .= "</tr>"; 29 $html .= "<tr class=kb-table-row-odd>"; 30 $html .= "<td class=kb-table-cell width=64><b>Alliance:</b></td><td class=kb-table-cell><b>".$kill->getVictimAllianceName()."</b></td>"; 31 $html .= "</tr>"; 32 $html .= "</table>"; 33 34 // involved 35 36 $html .= "<div class=block-header>Involved parties</div>"; 37 $html .= "<table class=kb-table width=360 border=0 cellspacing=\"1\">"; 38 $odd = true; 39 foreach( $kill->involvedparties_ as $inv ) { 40 $pilot = new Pilot( $inv->getPilotID() ); 41 $corp = new Corporation( $inv->getCorpID() ); 42 $alliance = new Alliance( $inv->getAllianceID() ); 18 } 19 20 $html .= "<table cellpadding=0 cellspacing=1 border=0><tr><td width=360 align=left valign=top>"; 21 // victim 22 $html .= "<table class=kb-table width=360 cellpadding=0 cellspacing=1 border=0>"; 23 $html .= "<tr class=kb-table-row-odd><td rowspan=3 width=\"64\"><img src=\"" . $kill->getVictimPortrait(64) . "\" border=\"0\"></td>"; 24 $html .= "<td class=kb-table-cell width=64><b>Victim:</b></td><td class=kb-table-cell><a href=\"?a=pilot_detail&plt_id=" . $kill->getVictimID() . "\">" . $kill->getVictimName() . "</a></td>"; 25 $html .= "</tr>"; 26 $html .= "<tr class=kb-table-row-odd>"; 27 $html .= "<td class=kb-table-cell width=64><b>Corp:</b></td><td class=kb-table-cell><a href=\"?a=corp_detail&crp_id=" . $kill->getVictimCorpID() . "\">" . $kill->getVictimCorpName() . "</a></td>"; 28 $html .= "</tr>"; 29 $html .= "<tr class=kb-table-row-odd>"; 30 $html .= "<td class=kb-table-cell width=64><b>Alliance:</b></td><td class=kb-table-cell><b>" . $kill->getVictimAllianceName() . "</b></td>"; 31 $html .= "</tr>"; 32 $html .= "</table>"; 33 // involved 34 $html .= "<div class=block-header>Involved parties</div>"; 35 $html .= "<table class=kb-table width=360 border=0 cellspacing=\"1\">"; 36 $odd = true; 37 foreach($kill->involvedparties_ as $inv) 38 { 39 $pilot = new Pilot($inv->getPilotID()); 40 $corp = new Corporation($inv->getCorpID()); 41 $alliance = new Alliance($inv->getAllianceID()); 43 42 $ship = $inv->getShip(); 44 43 $weapon = $inv->getWeapon(); 45 44 46 if ( $odd ) { 47 $odd = false; 48 $rowclass = "kb-table-row-even"; 49 } 50 else { 51 $odd = true; 52 $rowclass = "kb-table-row-odd"; 53 } 54 55 if ( $pilot->getID() == $kill->getFBPilotID() ) { 56 $imgclass = "class=finalblow "; 57 } 58 else { 59 $imgclass = ""; 45 if ($odd) 46 { 47 $odd = false; 48 $rowclass = "kb-table-row-even"; 49 } 50 else 51 { 52 $odd = true; 53 $rowclass = "kb-table-row-odd"; 54 } 55 56 if ($pilot->getID() == $kill->getFBPilotID()) 57 { 58 $imgclass = "class=finalblow "; 59 } 60 else 61 { 62 $imgclass = ""; 60 63 } 61 64 62 65 $html .= "<tr class=kb-table-row-even>"; 63 $html .= "<td rowspan=4 width=\"64\"><img ".$imgclass."src=\"".$pilot->getPortraitURL( 64 )."\" border=\"0\"></td>"; 64 $html .= "<td rowspan=4 width=\"64\"><img ".$imgclass."src=\"".$ship->getImage( 64 )."\" border=\"0\"></td>"; 65 $html .= "<td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=pilot_detail&plt_id=".$pilot->getID()."\">".$pilot->getName()."</a></td>"; 66 if ($corp->isNPCCorp()) 67 { 68 $html .= "<td rowspan=4 width=\"64\"><img " . $imgclass . "src=\"" . $corp->getPortraitURL(64) . "\" border=\"0\"></td>"; 69 } 70 else 71 { 72 $html .= "<td rowspan=4 width=\"64\"><img " . $imgclass . "src=\"" . $pilot->getPortraitURL(64) . "\" border=\"0\"></td>"; 73 } 74 $html .= "<td rowspan=4 width=\"64\"><img " . $imgclass . "src=\"" . $ship->getImage(64) . "\" border=\"0\"></td>"; 75 $html .= "<td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=pilot_detail&plt_id=" . $pilot->getID() . "\">" . $pilot->getName() . "</a></td>"; 66 76 $html .= "</tr>"; 67 68 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=corp_detail&crp_id=".$corp->getID()."\">".$corp->getName()."</a></td></tr>"; 69 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><b>".$ship->getName()."</b></td></tr>"; 70 71 if ( $weapon->getName() != "Unknown" && $weapon->getName() != $ship->getName() ) 72 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\">".$weapon->getName()."</td></tr>"; 73 else 74 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\">Unknown</td></tr>"; 75 } 76 $html .= "</table>"; 77 78 $html .= "</td><td width=50> </td>"; 79 80 // ship, ship details 81 $html .= "<td align=left valign=top width=360>"; 82 83 $html .= "<table class=kb-table width=360 cellspacing=\"1\">"; 84 $ship = $kill->getVictimShip(); 85 $shipclass = $ship->getClass(); 86 $html .= "<tr class=kb-table-row-odd><td width=\"64\" rowspan=3><img src=\"".$ship->getImage( 64 )."\"></td>"; 87 $html .= "<td class=kb-table-cell><b>Ship:</b></td><td class=kb-table-cell><b>".$ship->getName()."</b> (".$shipclass->getName().")</td>"; 88 $html .= "</tr>"; 89 //$html .= "<tr class=kb-table-row-odd><td><b>Location:</b></td><td><b>".$sys_name."</b> (".$sys_sec.")</td>"; 90 $system = $kill->getSystem(); 91 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Location:</b></td><td class=kb-table-cell><b><a href=\"javascript:openWindow( '?a=system_detail&sys_id=".$system->getID()."', '', 620, 260, '' );\">".$system->getName()."</a></b> (".$system->getSecurity( true ).")</td>"; 92 93 $html .= "</tr>"; 94 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Date:</b></td><td class=kb-table-cell>".$kill->getTimeStamp()."</td>"; 95 $html .= "</tr>"; 96 $html .= "</table>"; 97 98 // ship fitting 99 if ( count( $kill->destroyeditems_ ) > 0 ) { 77 78 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=corp_detail&crp_id=" . $corp->getID() . "\">" . $corp->getName() . "</a></td></tr>"; 79 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><b>" . $ship->getName() . "</b></td></tr>"; 80 81 if ($weapon->getName() != "Unknown" && $weapon->getName() != $ship->getName()) 82 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\">" . $weapon->getName() . "</td></tr>"; 83 else 84 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\">Unknown</td></tr>"; 85 } 86 $html .= "</table>"; 87 88 $html .= "</td><td width=50> </td>"; 89 // ship, ship details 90 $html .= "<td align=left valign=top width=360>"; 91 92 $html .= "<table class=kb-table width=360 cellspacing=\"1\">"; 93 $ship = $kill->getVictimShip(); 94 $shipclass = $ship->getClass(); 95 $html .= "<tr class=kb-table-row-odd><td width=\"64\" rowspan=3><img src=\"" . $ship->getImage(64) . "\"></td>"; 96 $html .= "<td class=kb-table-cell><b>Ship:</b></td><td class=kb-table-cell><b>" . $ship->getName() . "</b> (" . $shipclass->getName() . ")</td>"; 97 $html .= "</tr>"; 98 // $html .= "<tr class=kb-table-row-odd><td><b>Location:</b></td><td><b>".$sys_name."</b> (".$sys_sec.")</td>"; 99 $system = $kill->getSystem(); 100 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Location:</b></td><td class=kb-table-cell><b><a href=\"javascript:openWindow( '?a=system_detail&sys_id=" . $system->getID() . "', '', 620, 260, '' );\">" . $system->getName() . "</a></b> (" . $system->getSecurity(true) . ")</td>"; 101 102 $html .= "</tr>"; 103 $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Date:</b></td><td class=kb-table-cell>" . $kill->getTimeStamp() . "</td>"; 104 $html .= "</tr>"; 105 $html .= "</table>"; 106 // ship fitting 107 if (count($kill->destroyeditems_) > 0) 108 { 100 109 $html .= "<div class=block-header>Ship details</div>"; 101 110 $html .= "<table class=kb-table width=360 border=\"0\" cellspacing=\"1\">"; 102 111 $imgid = 0; 103 foreach( $kill->destroyeditems_ as $destroyed ) 104 { 105 $item = $destroyed->getItem(); 106 switch( $destroyed->getLocationID() ) { 107 case 4: 108 $location = "Cargo"; 109 break; 110 case 6: // drone 111 $location = "Drone Bay"; 112 break; 113 default: 114 switch( $item->getSlot() ) { 115 case 1: // high 116 $location = "Fitted - High slot"; 117 break; 118 case 2: // high 119 $location = "Fitted - Medium slot"; 120 break; 121 case 3: // high 122 $location = "Fitted - Low slot"; 123 break; 112 foreach($kill->destroyeditems_ as $destroyed) 113 { 114 $item = $destroyed->getItem(); 115 switch ($destroyed->getLocationID()) 116 { 117 case 4: 118 $location = "Cargo"; 119 break; 124 120 case 6: // drone 125 $location = "Drone Bay"; 126 break; 127 } 128 break; 129 } 130 131 if ( $location != $lastlocation ) { 132 $lastlocation = $location; 133 $html .= "<tr class=kb-table-row-odd>"; 134 $html .= "<td width=\"32\"><img src=\"".IMG_URL."/".strtolower( str_replace( ' ', '_', $location ) ).".jpg\" alt=\"".$location."\" border=\"0\"></a></td>"; 135 $html .= "<td class=kb-table-cell colspan=2><b>".$location."</b></td>"; 121 $location = "Drone Bay"; 122 break; 123 default: 124 switch ($item->getSlot()) 125 { 126 case 1: // high 127 $location = "Fitted - High slot"; 128 break; 129 case 2: // high 130 $location = "Fitted - Medium slot"; 131 break; 132 case 3: // high 133 $location = "Fitted - Low slot"; 134 break; 135 case 6: // drone 136 $location = "Drone Bay"; 137 break; 138 } 139 break; 140 } 141 142 if ($location != $lastlocation) 143 { 144 $lastlocation = $location; 145 $html .= "<tr class=kb-table-row-odd>"; 146 $html .= "<td width=\"32\"><img src=\"" . IMG_URL . "/" . strtolower(str_replace(' ', '_', $location)) . ".jpg\" alt=\"" . $location . "\" border=\"0\"></a></td>"; 147 $html .= "<td class=kb-table-cell colspan=2><b>" . $location . "</b></td>"; 148 $html .= "</tr>"; 149 } 150 // item detail 151 // $html .= "<tr class=kb-table-row-even onclick=\"openWindow( '?a=item_detail&itm_id=".$row['itm_id']."', null, 225, 250, '' );\" onmouseover=\"document.getElementById('item_img".$imgid."').className='icon-hover'; this.style.cursor='pointer';\" onmouseout=\"document.getElementById('item_img".$imgid."').className='icon';\">"; 152 $html .= "<tr class=kb-table-row-even>"; 153 // $html .= "<td width=\"32\"><img id=item_img".$imgid." class=icon src=\"".IMG_URL."/items/32_32/".$row['itm_icon'].".png\"></td>"; 154 // $html .= "<td class=icon width=\"32\" height=\"32\"></td>"; 155 // $html .= "<td class=item-icon width=\"30\" height=\"34\" background=\"".$destroyed->getItem()->getIcon( 32 )."\" valign=top>"; 156 // if ( substr( $destroyed->getItem()->getName(), strlen( $destroyed->getItem()->getName() ) - 2, 2 ) == "II" ) 157 // $html .= "<img src=\"".IMG_URL."/items/32_32/t2.gif\" border=\"0\">"; 158 // else 159 // $html .= "<img src=\"".IMG_URL."/items/32_32/blank.gif\" border=\"0\">"; 160 // $hmtl .= "</td>"; 161 $html .= $item->getIcon(32); 162 163 $html .= "<td class=kb-table-cell>" . $item->getName() . "</td>"; 164 $html .= "<td width=\"30\" align=\"center\">" . $destroyed->getQuantity() . "</td>"; 136 165 $html .= "</tr>"; 137 } 138 139 // item detail 140 // $html .= "<tr class=kb-table-row-even onclick=\"openWindow( '?a=item_detail&itm_id=".$row['itm_id']."', null, 225, 250, '' );\" onmouseover=\"document.getElementById('item_img".$imgid."').className='icon-hover'; this.style.cursor='pointer';\" onmouseout=\"document.getElementById('item_img".$imgid."').className='icon';\">"; 141 $html .= "<tr class=kb-table-row-even>"; 142 143 //$html .= "<td width=\"32\"><img id=item_img".$imgid." class=icon src=\"".IMG_URL."/items/32_32/".$row['itm_icon'].".png\"></td>"; 144 //$html .= "<td class=icon width=\"32\" height=\"32\"></td>"; 145 //$html .= "<td class=item-icon width=\"30\" height=\"34\" background=\"".$destroyed->getItem()->getIcon( 32 )."\" valign=top>"; 146 //if ( substr( $destroyed->getItem()->getName(), strlen( $destroyed->getItem()->getName() ) - 2, 2 ) == "II" ) 147 // $html .= "<img src=\"".IMG_URL."/items/32_32/t2.gif\" border=\"0\">"; 148 // else 149 // $html .= "<img src=\"".IMG_URL."/items/32_32/blank.gif\" border=\"0\">"; 150 151 //$hmtl .= "</td>"; 152 153 $html .= $item->getIcon( 32 ); 154 155 $html .= "<td class=kb-table-cell>".$item->getName()."</td>"; 156 $html .= "<td width=\"30\" align=\"center\">".$destroyed->getQuantity()."</td>"; 157 $html .= "</tr>"; 158 $imgid++; 166 $imgid++; 159 167 } 160 168 $html .= "</table>"; 161 162 169 } 170 else 163 171 $html .= "<div class=block-header>No ship details</div>"; 164 172 165 $html .= "</td></tr></table>"; 166 167 $menubox = new MenuBox(); 168 $menubox->addCaption( "View" ); 169 $menubox->addOption( "Killmail", "javascript:openWindow( '?a=kill_mail&kll_id=".$kill->getID()."', null, 420, 550, '' );" ); 170 if ( $kill->relatedKillCount() > 1 || $kill->relatedLossCount() > 1 ) 171 $menubox->addOption( "Related kills (".$kill->relatedKillCount()."/".$kill->relatedLossCount().")", "?a=kill_related&kll_id=".$kill->getID() ); 172 173 $page->addContext( $menubox->generate() ); 174 175 $config = $page->killboard_->getConfig(); 176 if ( $config->getKillPoints() ) { 177 $scorebox = new Box( "Points awarded" ); 178 $scorebox->setHeight( 64 ); 179 $scorebox->setContent( "<div class=kill-points>".$kill->getKillPoints()."</div>" ); 180 $page->addContext( $scorebox->generate() ); 181 } 182 183 $mapbox = new Box( "Map" ); 184 $maphtml = "<img src=\"?a=mapview&sys_id=".$system->getID()."&mode=map&size=145\" border=0><br>"; 185 $maphtml .= "<img src=\"?a=mapview&sys_id=".$system->getID()."&mode=region&size=145\" border=0><br>"; 186 $maphtml .= "<img src=\"?a=mapview&sys_id=".$system->getID()."&mode=cons&size=145\" border=0>"; 187 $mapbox->setContent( $maphtml ); 188 $page->addContext( $mapbox->generate() ); 189 190 $page->setContent( $html ); 191 $page->generate(); 192 173 $html .= "</td></tr></table>"; 174 175 $menubox = new MenuBox(); 176 $menubox->addCaption("View"); 177 $menubox->addOption("Killmail", "javascript:openWindow( '?a=kill_mail&kll_id=" . $kill->getID() . "', null, 420, 550, '' );"); 178 if ($kill->relatedKillCount() > 1 || $kill->relatedLossCount() > 1) 179 { 180 $menubox->addOption("Related kills (" . $kill->relatedKillCount() . "/" . $kill->relatedLossCount() . ")", "?a=kill_related&kll_id=" . $kill->getID()); 181 } 182 if ($page->isSuperAdmin()) 183 { 184 $menubox->addCaption("Admin"); 185 $menubox->addOption("Löschen", "javascript:openWindow('?a=kill_delete&kll_id=".$kill->getID()."', null, 420, 300, '' );"); 186 } 187 $page->addContext($menubox->generate()); 188 189 $config = $page->killboard_->getConfig(); 190 if ($config->getKillPoints()) 191 { 192 $scorebox = new Box("Points awarded"); 193 $scorebox->setHeight(64); 194 $scorebox->setContent("<div class=kill-points>" . $kill->getKillPoints() . "</div>"); 195 $page->addContext($scorebox->generate()); 196 } 197 198 $mapbox = new Box("Map"); 199 $maphtml = "<img src=\"?a=mapview&sys_id=" . $system->getID() . "&mode=map&size=145\" border=0><br>"; 200 $maphtml .= "<img src=\"?a=mapview&sys_id=" . $system->getID() . "&mode=region&size=145\" border=0><br>"; 201 $maphtml .= "<img src=\"?a=mapview&sys_id=" . $system->getID() . "&mode=cons&size=145\" border=0>"; 202 $mapbox->setContent($maphtml); 203 $page->addContext($mapbox->generate()); 204 205 $page->setContent($html); 206 $page->generate(); 193 207 ?> -
dev/common/kill_mail.php
r2 r10 1 <? 2 require_once( "db.php" ); 3 require_once( "class.page.php" ); 4 require_once( "class.kill.php" ); 5 require_once( "globals.php" ); 6 7 $kll_id = $_GET['kll_id']; 8 $kill = new Kill( $kll_id ); 9 10 $html .= "<html><head><title>Killmail</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head>"; 11 $html .= "<body bgcolor=\"#222222\"><table class=kb-table width=\"100%\" height=\"100%\"><tr><td valign=top class=killmail>"; 1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 4 require_once("class.kill.php"); 5 require_once("globals.php"); 12 6 13 $html .= "<textarea class=killmail id=killmail name=killmail cols=\"55\" rows=\"35\" readonly=readonly>".$kill->getRawMail()."</textarea>"; 14 15 $html .= "</td></tr>"; 16 $html .= "<tr><td align=center><button id=close name=close value=\"Close\" onclick=\"window.close();\">Close</button></td></tr>"; 17 $html .= "</table></body></html>"; 7 $kll_id = $_GET['kll_id']; 8 $kill = new Kill($kll_id); 18 9 19 echo $html; 10 $html .= "<html><head><title>Killmail</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head>"; 11 $html .= "<body bgcolor=\"#222222\"><table class=kb-table width=\"100%\" height=\"100%\"><tr><td valign=top class=killmail>"; 12 13 $html .= "<textarea class=killmail id=killmail name=killmail cols=\"55\" rows=\"35\" readonly=readonly>".$kill->getRawMail()."</textarea>"; 14 15 $html .= "</td></tr>"; 16 $html .= "<tr><td align=center><button id=close name=close value=\"Close\" onclick=\"window.close();\">Close</button></td></tr>"; 17 $html .= "</table></body></html>"; 18 19 echo $html; 20 20 ?> -
dev/common/login.php
r2 r10 1 <? 2 require_once( "db.php" ); 3 require_once( "class.page.php" ); 4 5 $page = new Page( "Login" ); 6 7 if ( $_POST['password'] ) { 8 if ( $_POST['password'] == ADMIN_PASSWORD || 9 $_POST['password'] == SUPERADMIN_PASSWORD ) { 1 <?php 2 require_once("db.php"); 3 require_once("class.page.php"); 10 4 11 if ( $_POST['password'] == SUPERADMIN_PASSWORD ) { 12 $redir = "superadmin"; 13 $super = 1; 14 } 15 else { 16 $redir = "admin"; 17 $super = 0; 18 } 5 $page = new Page("Login"); 19 6 20 $page->session_->create( $super ); 7 if ($_POST['password']) 8 { 9 if ($_POST['password'] == ADMIN_PASSWORD || $_POST['password'] == SUPERADMIN_PASSWORD) 10 { 11 if ($_POST['password'] == SUPERADMIN_PASSWORD) 12 { 13 $redir = "admin"; 14 $super = 1; 15 } 16 else 17 { 18 $redir = "admin"; 19 $super = 0; 20 } 21 21 22 Header( "Location: ?a=".$redir ); 22 $page->session_->create($super); 23 24 header("Location: ?a=" . $redir); 23 25 } 24 26 else 25 $html .= "Invalid password.<br><br>";26 27 $html .= "Invalid password.<br><br>"; 28 } 27 29 28 29 30 31 32 $page->setContent( $html);33 34 30 $html .= "<form name=login id=login method=post action=?a=login>"; 31 $html .= "Admin password: <input name=password id=password type=password> <input type=\"submit\" name=submit id=submit name=Go value=Go>"; 32 $html .= "</form>"; 33 34 $page->setContent($html); 35 $page->generate(); 36 35 37 ?> -
dev/common/maintenance.php
r2 r10 1 <? 2 require_once( "class.page.php");1 <?php 2 require_once("class.page.php"); 3 3 4 $page = new Page( "Down for maintenance");5 6 if ( KB_MAINTENANCE_MSG != "")7 $html .= "<p><br/>Additional info: " .KB_MAINTENANCE_MSG;8 4 $page = new Page("Down for maintenance"); 5 $html .= "The killboard is currently down for maintenance and/or updates. We'll be back soon !"; 6 if (KB_MAINTENANCE_MSG != "") 7 $html .= "<p><br/>Additional info: " . KB_MAINTENANCE_MSG; 8 $html .= "<p><br/><a href=\"http://eve-killboard.net\">eve-killboard.net</a>"; 9 9 10 $page->setContent( $html);11 10 $page->setContent($html); 11 $page->generate(); 12 12 ?> -
dev/common/mapview.php
r2 r10 1 <? 2 require_once( "class.map.php");1 <?php 2 require_once("class.map.php"); 3 3 4 $view = new MapView( $_GET['mode'], $_GET['size'] ); 5 $view->setSystemID( $_GET['sys_id'] ); 6 switch ( $_GET['mode'] ) { 4 $view = new MapView($_GET['mode'], $_GET['size']); 5 $view->setSystemID($_GET['sys_id']); 6 switch ($_GET['mode']) 7 { 7 8 case "map": 8 $view->setTitle( "Region");9 break;9 $view->setTitle("Region"); 10 break; 10 11 case "region": 11 $view->setTitle( "Constellation");12 $view->showLines( true);13 $view->setOffset( 25);14 break;12 $view->setTitle("Constellation"); 13 $view->showLines(true); 14 $view->setOffset(25); 15 break; 15 16 case "cons": 16 $view->showLines( true);17 $view->showSysNames( true);18 <