Changeset 3

Show
Ignore:
Timestamp:
10/14/06 23:14:11 (14 years ago)
Author:
andrewgunn
Message:

Added: Delete Killmail option in admin menu (common/admin_menu.php), and code to handle deletions of killmails (common/kill_delete.php).

Fixed: Added some code to fix a serious bug when the killboard tries to import a mail with a "final blow".

Note: All of these code sniplets were grabbed off the EVE-Online forums. So I take no credit for them, and no responsiblity if break something else.

Location:
dev/common
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • dev/common/admin_menu.php

    r2 r3  
    66  $menubox->addOption( "Contracts", "?a=admin_cc&op=view&type=contract" ); 
    77  $menubox->addOption( "Campaigns", "?a=admin_cc&op=view&type=campaign" ); 
    8   $menubox->addOption( "Rental", "?a=admin_rental" ); 
     8  /* REMOVED: This code is no longer present */ 
     9  /* $menubox->addOption( "Rental", "?a=admin_rental" ); */ 
     10  $menubox->addOption( "Delete kill", "?a=kill_delete" ); 
    911 
    1012?> 
  • dev/common/class.parser.php

    r2 r3  
    1616        $this->killmail_ = str_replace( "**** Truncated - mail is too large ****", "", $this->killmail_ ); 
    1717      } 
     18 
     19/* Parser fix, since some killmails don't have a final blow, they would break the KB */ 
     20if ( strpos( $this->killmail_, "laid the final blow") < 1 ) { 
     21$this->needs_final_blow_ = 1; 
     22} 
     23/* END FIX */ 
    1824 
    1925//      if ( strpos( $this->killmail_, "Empty." ) > 0 ) { 
     
    106112        } else $finalblow = 0; 
    107113 
     114/* This is part of the final blow fix, mentioned above */ 
     115if ( $this->needs_final_blow_ ) { 
     116$finalblow = 1; 
     117$this->needs_final_blow_ = 0; 
     118} 
     119/* END FIX */ 
     120 
    108121        preg_match( "/Security: (.*)/", $involved[$i+1], $matches ); 
    109122        $secstatus = $matches[1]; 
  • dev/common/kill_delete.php

    r2 r3  
    11<? 
    2   require_once( "db.php" ); 
    3   require_once( "class.page.php" ); 
    4   require_once( "class.kill.php" ); 
    5    
    6   $page = new Page( "Delete kill" ); 
    7   $page->setSuperAdmin(); 
    8   $dbconn = new DBConnection(); 
     2require_once( "db.php" ); 
     3require_once( "class.page.php" ); 
     4require_once( "class.kill.php" ); 
     5require_once( "class.tabbedform.php" ); 
     6require_once( "admin_menu.php" ); 
    97 
    10   $kll_id = $_POST['kll_id']; 
     8$page = new Page( "Administration - Deletion of Kills" ); 
     9$page->setAdmin(); 
     10$dbconn = new DBConnection(); 
     11$kll_id = $_GET['kll_id']; 
    1112 
    12   $kill = new Kill( $kll_id ); 
    13   $kill->remove(); 
     13if ( $_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; 
     22} 
     23if (!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'>&nbsp;"; 
     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 .= "&nbsp<button onClick=\"window.history.back();\">No</button>"; 
     34} 
    1435 
    15   $html .= "<br><br><a href=\"?a=superadmin\">[Back]</a>"; 
    16  
    17   $page->setContent( $html ); 
    18   $page->generate(); 
     36$page->setContent( $html ); 
     37$page->addContext( $menubox->generate() ); 
     38$page->generate(); 
    1939?>