Changeset 185

Show
Ignore:
Timestamp:
02/02/07 01:25:07 (13 years ago)
Author:
exi
Message:

Added stripslashes to the mail_forward eventhandler.
Changed db.php to check for strict type of define.
Reworked large chunks of the battle overview to reflect the actual count of lost/killed ships which was really mind numbing.

Location:
dev
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • dev/common/db.php

    r183 r185  
    44require_once('php_compat.php'); 
    55 
    6 if (defined('DB_USE_QCACHE') && DB_USE_QCACHE == true) 
     6if (defined('DB_USE_QCACHE') && DB_USE_QCACHE === true) 
    77{ 
    88    require_once('class.db_cache.php'); 
  • dev/common/kill_related.php

    r164 r185  
    144144        // dont set pods as ships for pilots we already have 
    145145        if (isset($pilots[$side][$row['ind_plt_id']])) 
    146         { 
     146        {continue; 
    147147            if ($shipc->getID() == 18 || $shipc->getID() == 2) 
    148148            { 
     
    155155        $alliance = new Alliance($row['ind_all_id']); 
    156156 
    157         $pilots[$side][$row['ind_plt_id']] = array('name' => $pilot->getName(), 'sid' => $ship->getID(), 'spic' => $ship->getImage(32), 'aid' => $row['ind_all_id'], 
    158                                                   'corp' => $corp->getName(), 'alliance' => $alliance->getName(), 'scl' => $shipc->getPoints(), 
    159                                                   'ship' => $ship->getName(), 'weapon' => $weapon->getName(), 'cid' => $row['ind_crp_id']); 
     157        $pilots[$side][$row['ind_plt_id']][] = array('name' => $pilot->getName(), 'sid' => $ship->getID(), 
     158               'spic' => $ship->getImage(32), 'aid' => $row['ind_all_id'], 'ts' => strtotime($kill->getTimeStamp()), 
     159               'corp' => $corp->getName(), 'alliance' => $alliance->getName(), 'scl' => $shipc->getPoints(), 
     160               'ship' => $ship->getName(), 'weapon' => $weapon->getName(), 'cid' => $row['ind_crp_id']); 
    160161    } 
    161162} 
     
    171172    $shipc = $ship->getClass(); 
    172173 
     174    $ts = strtotime($kill->getTimeStamp()); 
     175 
    173176    // mark the pilot as podded 
    174177    if ($shipc->getID() == 18 || $shipc->getID() == 2) 
    175178    { 
     179        // increase the timestamp of a podkill by 1 so its for sure after the shipkill 
     180        $ts++; 
    176181        global $pods; 
    177182        $pods[$kill->getID()] = $kill->getVictimID(); 
     
    180185        if (isset($pilots[$side][$kill->getVictimId()])) 
    181186        { 
    182             return; 
    183         } 
    184     } 
    185  
    186     $pilots[$side][$kill->getVictimId()] = array('name' => $kill->getVictimName(), 'spic' => $ship->getImage(32), 'scl' => $shipc->getPoints(), 
    187                                               'corp' => $kill->getVictimCorpName(), 'alliance' => $kill->getVictimAllianceName(), 'aid' => $kill->getVictimAllianceID(), 
    188                                               'ship' => $kill->getVictimShipname(), 'sid' => $ship->getID(), 'cid' => $kill->getVictimCorpID()); 
     187            #return; 
     188        } 
     189    } 
     190 
     191    // search for ships with the same id 
     192    if (isset($pilots[$side][$kill->getVictimId()])) 
     193    { 
     194        foreach ($pilots[$side][$kill->getVictimId()] as $id => $_ship) 
     195        { 
     196            if ($shipc->getID() == $_ship['sid']) 
     197            { 
     198                $pilots[$side][$kill->getVictimId()][$id]['destroyed'] = true; 
     199                return; 
     200            } 
     201        } 
     202    } 
     203 
     204    $pilots[$side][$kill->getVictimId()][] = array('name' => $kill->getVictimName(), 'kll_id' => $kill->getID(), 
     205           'spic' => $ship->getImage(32), 'scl' => $shipc->getPoints(), 'destroyed' => true, 
     206           'corp' => $kill->getVictimCorpName(), 'alliance' => $kill->getVictimAllianceName(), 'aid' => $kill->getVictimAllianceID(), 
     207           'ship' => $kill->getVictimShipname(), 'sid' => $ship->getID(), 'cid' => $kill->getVictimCorpID(), 'ts' => $ts); 
    189208} 
    190209 
     
    205224function cmp_func($a, $b) 
    206225{ 
     226    // select the biggest fish of that pilot 
     227    $t_scl = 0; 
     228    foreach ($a as $i => $ai) 
     229    { 
     230        if ($ai['scl'] > $t_scl) 
     231        { 
     232            $t_scl = $ai['scl']; 
     233            $cur_i = $i; 
     234        } 
     235    } 
     236    $a = $a[$cur_i]; 
     237 
     238    $t_scl = 0; 
     239    foreach ($b as $i => $bi) 
     240    { 
     241        if ($bi['scl'] > $t_scl) 
     242        { 
     243            $t_scl = $bi['scl']; 
     244            $cur_i = $i; 
     245        } 
     246    } 
     247    $b = $b[$cur_i]; 
     248 
    207249    if ($a['scl'] > $b['scl']) 
    208250    { 
     
    257299} 
    258300 
     301function cmp_ts_func($a, $b) 
     302{ 
     303    if ($a['ts'] < $b['ts']) 
     304    { 
     305        return -1; 
     306    } 
     307    return 1; 
     308} 
     309 
     310// sort pilot ships, order pods after ships 
     311foreach ($pilots as $side => $pilot) 
     312{ 
     313    foreach ($pilot as $id => $kll) 
     314    { 
     315        uasort($pilots[$side][$id], 'cmp_ts_func'); 
     316    } 
     317} 
     318 
    259319// sort arrays, ships with high points first 
    260320uasort($pilots['a'], 'cmp_func'); 
    261321uasort($pilots['e'], 'cmp_func'); 
     322 
     323// now get the pods out and mark the ships the've flown as podded 
     324foreach ($pilots as $side => $pilot) 
     325{ 
     326    foreach ($pilot as $id => $kll) 
     327    { 
     328        $max = count($kll); 
     329        for ($i = 0; $i < $max; $i++) 
     330        { 
     331            if ($kll[$i]['ship'] == 'Capsule') 
     332            { 
     333                if (isset($kll[$i-1]['sid'])) 
     334                { 
     335                    $pilots[$side][$id][$i-1]['podded'] = true; 
     336                    $pilots[$side][$id][$i-1]['podid'] = $kll[$i]['kll_id']; 
     337                    unset($pilots[$side][$id][$i]); 
     338                } 
     339            } 
     340        } 
     341    } 
     342} 
     343 
    262344$smarty->assign_by_ref('pilots_a', $pilots['a']); 
    263345$smarty->assign_by_ref('pilots_e', $pilots['e']); 
  • dev/mods/mail_forward/init.php

    r181 r185  
    1111 
    1212        $req->set_postform('password', config::get('forward_pass')); 
    13         $req->set_postform('killmail', $_POST['killmail']); 
     13        $req->set_postform('killmail', stripslashes($_POST['killmail'])); 
    1414        $req->request(); 
    1515    } 
  • dev/templates/battle_overview.tpl

    r181 r185  
    55<div class="kb-date-header">Friendly ({$friendlycnt})</div> 
    66<br/> 
    7 <table class="kb-table" width="95%" align="center"> 
    8     <tr class="kb-table-header"> 
    9       <td class="kb-table-header" colspan="2" align="center">Ship/Pilot</td> 
    10       <td class="kb-table-header" align="center" style="min-width: 45%; width: 45%; max-width: 45%;">Corp/Alliance</td> 
    11     </tr> 
    12 {cycle reset=true print=false name=ccl values="kb-table-row-even,kb-table-row-odd"} 
    13 {foreach from=$pilots_a item=i key=pilot} 
    14     <tr class="{cycle name=ccl}"{if is_destroyed($pilot)} style="background-color: #EE4444;"{/if}> 
    15       <td width="32" height="32" style="max-width: 32px;"> 
    16 {if is_destroyed($pilot)} 
    17         <a href="?a=kill_detail&amp;kll_id={$kll_id}"><img src="{$i.spic}" width="32" height="32" border="0"></a> 
    18 {else} 
    19         <img src="{$i.spic}" width="32" height="32" border="0"> 
    20 {/if} 
    21       </td> 
    22 {if podded($pilot) and $i.ship != 'Capsule'} 
    23 {if $config->getConfig('bs_podlink')} 
    24       <td class="kb-table-cell"> 
    25         <b><a href="?a=pilot_detail&amp;plt_id={$pilot}">{$i.name}</a>&nbsp;<a href="?a=kill_detail&amp;kll_id={$pod_kll_id}">[Pod]</a></b><br/>{$i.ship} 
    26       </td> 
    27 {else} 
    28       <td class="kb-table-cell" style="background-image: url({$podpic}); background-repeat: no-repeat; background-position: right;"> 
    29         <b><a href="?a=pilot_detail&amp;plt_id={$pilot}">{$i.name}</a></b><br/>{$i.ship} 
    30       </td> 
    31 {/if} 
    32 {else} 
    33       <td class="kb-table-cell"><b><a href="?a=pilot_detail&amp;plt_id={$pilot}">{$i.name}</a></b><br/>{$i.ship}</td> 
    34 {/if} 
    35       <td class="kb-table-cell"><b><a href="?a=corp_detail&amp;crp_id={$i.cid}">{$i.corp}</a></b><br/><a href="?a=alliance_detail&amp;all_id={$i.aid}" style="font-weight: normal;">{$i.alliance}</a></td> 
    36     </tr> 
    37 {/foreach} 
    38 </table> 
     7 
     8{assign var='loop' value=$pilots_a} 
     9{include file="battle_overview_table.tpl"} 
     10 
    3911</td><td width="55%" valign="top"> 
    4012<div class="kb-date-header">Hostile ({$hostilecnt})</div> 
    4113<br/> 
    42 <table class="kb-table" width="95%" align="center"> 
    43     <tr class="kb-table-header"> 
    44       <td class="kb-table-header" colspan="2" align="center">Ship/Pilot</td> 
    45       <td class="kb-table-header" align="center" style="min-width: 45%; width: 45%; max-width: 45%;">Corp/Alliance</td> 
    46     </tr> 
    47 {cycle reset=true print=false name=ccl values="kb-table-row-even,kb-table-row-odd"} 
    48 {foreach from=$pilots_e item=i key=pilot} 
    49     <tr class="{cycle name=ccl}"{if is_destroyed($pilot)} style="background-color: #EE4444;"{/if}> 
    50       <td width="32" height="32" style="max-width: 32px;"> 
    51 {if is_destroyed($pilot)} 
    52         <a href="?a=kill_detail&amp;kll_id={$kll_id}"><img src="{$i.spic}" width="32" height="32" border="0"></a> 
    53 {else} 
    54         <img src="{$i.spic}" width="32" height="32" border="0"> 
    55 {/if} 
    56       </td> 
    57 {if podded($pilot) and $i.ship != 'Capsule'} 
    58 {if $config->getConfig('bs_podlink')} 
    59       <td class="kb-table-cell"> 
    60         <b><a href="?a=pilot_detail&amp;plt_id={$pilot}">{$i.name}</a></b>&nbsp;<a href="?a=kill_detail&amp;kll_id={$pod_kll_id}">[Pod]</a><br/>{$i.ship} 
    61       </td> 
    62 {else} 
    63       <td class="kb-table-cell" style="background-image: url({$podpic}); background-repeat: no-repeat; background-position: right;"> 
    64         <b><a href="?a=pilot_detail&amp;plt_id={$pilot}">{$i.name}</a></b><br/>{$i.ship} 
    65       </td> 
    66 {/if} 
    67 {else} 
    68       <td class="kb-table-cell"><b><a href="?a=pilot_detail&amp;plt_id={$pilot}">{$i.name}</a></b><br/>{$i.ship}</td> 
    69 {/if} 
    70       <td class="kb-table-cell"><b><a href="?a=corp_detail&amp;crp_id={$i.cid}">{$i.corp}</a></b><br/><a href="?a=alliance_detail&amp;all_id={$i.aid}" style="font-weight: normal;">{$i.alliance}</a></td> 
    71     </tr> 
    72 {/foreach} 
    73 </table> 
     14 
     15{assign var='loop' value=$pilots_e} 
     16{include file="battle_overview_table.tpl"} 
     17 
    7418</td> 
    7519</tr>