Show
Ignore:
Timestamp:
06/14/09 06:51:49 (11 years ago)
Author:
kovell
Message:

- SQL queries optimised for speed and error protection.
- feed syndication optimised
- front page includes optional clock and optional kill/loss display
- mysqli support added
- transaction protection of kills added where supported (mysqli and InnoDB)
- summary tables and contracts show total destroyed value instead of ship value
- html errors reduced
- related kill calculation improved
- query caching errors reduced
- minor bugfixes
- Smarty 2.6.25 added
- apoc fitting mod added and modded
- code optimisations
- code comments added (doxygen format)
- conflicting mods are now identified

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/mods/known_members/corp_detail.php

    r343 r370  
    88require_once("common/includes/class.toplist.php"); 
    99require_once("common/includes/class.pilot.php"); 
     10require_once("common/includes/evelogo.php"); 
     11require_once("common/includes/class.eveapi.php"); 
    1012 
    1113if (!$crp_id = intval($_GET['crp_id'])) 
     
    3032$summary_html = $kill_summary->generate(); 
    3133 
    32 $page = new Page('Corporation details - '.$corp->getName()); 
     34$corpname = str_replace(" ", "%20", $corp->getName() ); 
     35$myID = new API_NametoID(); 
     36$myID->setNames($corpname); 
     37$html .= $myID->fetchXML(); 
     38$myNames = $myID->getNameData(); 
     39                 
     40$myAPI = new API_CorporationSheet(); 
     41$myAPI->setCorpID($myNames[0]['characterID']); 
     42 
     43$result .= $myAPI->fetchXML(); 
     44 
     45if ($result == "Corporation is not part of alliance.") 
     46{ 
     47        $page = new Page('Corporation details - '.$corp->getName()); 
     48} else { 
     49        $page = new Page('Corporation details - '.$corp->getName() . " [" . $myAPI->getTicker() . "]"); 
     50}        
    3351$html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center bgcolor=black>"; 
    3452 
     
    3957else 
    4058{ 
    41     $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\"></td>"; 
     59        if ($alliance != 0) 
     60        {        
     61                $mylogo = $myAPI->getLogo(); 
     62                 
     63                if ($result == "Corporation is not part of alliance.") 
     64                { 
     65                        $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\"></td>"; 
     66                } elseif ($result == "") { 
     67                        // create two sized logo's in 2 places - this allows checks already in place not to keep requesting corp logos each time page is viewed 
     68                        // class.thumb.php cannot work with png (although saved as jpg these are actually pngs) therefore we have to create the 128 size for it 
     69                        // doing this prevents the images being rendered each time the function is called and allows it to use one in the cache instead. 
     70                        CorporationLogo( $mylogo, 64, $corp->getID() ); 
     71                        CorporationLogo( $mylogo, 128, $corp->getID() ); 
     72                         
     73                        $html .= "<img src=\"".$corp->getPortraitURL(128)."\" border=\"0\"></td>"; 
     74                } else { 
     75                        // some kind of error getting details from CCP so abort writing file(s) allowing us to try again later - in the meantime, lets print trusty default 
     76                        // error text will also appear where the picture is, which is nice 
     77                        $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\"></td>"; 
     78                }        
     79        } else { 
     80                $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\"></td>"; 
     81        } 
    4282} 
    4383 
    44 $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; 
    45 if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 
     84if ($result == "Corporation is not part of alliance.") 
    4685{ 
    47     $html .= "<b>".$alliance->getName()."</b>"; 
     86        $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; 
     87        if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 
     88        { 
     89                $html .= "<b>".$alliance->getName()."</b>"; 
     90        } 
     91        else 
     92        { 
     93        $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 
     94        } 
     95        $html .= "</td></tr>"; 
     96        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td></tr>"; 
     97        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td></tr>"; 
     98        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000000, 2)."B</td></tr>"; 
     99        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000000, 2)."B</td></tr>"; 
     100        if ($kill_summary->getTotalKillISK()) 
     101        { 
     102        $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); 
     103        } 
     104        else 
     105        { 
     106                $efficiency = 0; 
     107        } 
     108 
     109        $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>"; 
     110        $html .= "</table>"; 
     111        $html .= "<br/>"; 
     112} else { 
     113        $html .= "<td class=kb-table-cell width=150><b>Alliance:</b></td><td class=kb-table-cell>"; 
     114        if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 
     115        { 
     116                $html .= "<b>".$alliance->getName()."</b>"; 
     117        } 
     118        else 
     119        { 
     120        $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 
     121        } 
     122        $html .= "</td><td class=kb-table-cell width=65><b>CEO:</b></td><td class=kb-table-cell><a href=\"?a=search&searchtype=pilot&searchphrase=" . $myAPI->getCeoName() . "\">" . $myAPI->getCeoName() . "</a></td></tr>"; 
     123        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td>"; 
     124        $html .= "<td class=kb-table-cell><b>HQ:</b></td><td class=kb-table-cell>" . $myAPI->getStationName() . "</td></tr>"; 
     125        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td>"; 
     126        $html .= "<td class=kb-table-cell><b>Members:</b></td><td class=kb-table-cell>" . $myAPI->getMemberCount() . "</td></tr>"; 
     127        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000000, 2)."B</td>"; 
     128        $html .= "<td class=kb-table-cell><b>Shares:</b></td><td class=kb-table-cell>" . $myAPI->getShares() . "</td></tr>"; 
     129        $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000000, 2)."B</td>"; 
     130        $html .= "<td class=kb-table-cell><b>Tax Rate:</b></td><td class=kb-table-cell>" . $myAPI->getTaxRate() . "%</td></tr>"; 
     131        if ($kill_summary->getTotalKillISK()) 
     132        { 
     133        $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); 
     134        } 
     135        else 
     136        { 
     137                $efficiency = 0; 
     138        } 
     139 
     140        $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>"; 
     141        $html .= "<td class=kb-table-cell><b>Website:</b></td><td class=kb-table-cell><a href=\"" . $myAPI->getUrl() . "\">" . $myAPI->getUrl() . "</a></td></tr>"; 
     142        $html .= "</table>"; 
     143        //$html .= "Corporation Description:"; 
     144        $html .= "<div class=kb-table-row-even style=width:100%;height:100px;overflow:auto>"; 
     145        $html .= $myAPI->getDescription(); 
     146        $html .= "</div>"; 
     147        $html .= "<br/>"; 
    48148} 
    49 else 
    50 { 
    51     $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 
    52 } 
    53 $html .= "</td></tr>"; 
    54 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td></tr>"; 
    55 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td></tr>"; 
    56 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000000, 2)."B</td></tr>"; 
    57 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000000, 2)."B</td></tr>"; 
    58 if ($kill_summary->getTotalKillISK()) 
    59 { 
    60     $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); 
    61 } 
    62 else 
    63 { 
    64     $efficiency = 0; 
    65 } 
    66  
    67 $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>"; 
    68 $html .= "</table>"; 
    69 $html .= "<br/>"; 
    70149 
    71150if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses") 
     
    527606} 
    528607 
     608$html .= "<hr><b>Extended Corp Detail " . EVELOGOVERSION . " by " . FindThunk() . ". Logo generation by Entity. Thanks to Arkady and Exi.<b/></br>"; 
     609 
    529610$menubox = new box("Menu"); 
    530611$menubox->setIcon("menu-item.gif");