Changeset 10 for dev/common/post.php

Show
Ignore:
Timestamp:
10/16/06 20:59:42 (16 years ago)
Author:
exi
Message:

Changed portrait generation to cache the pictures from img.eve.is
Changed about-page-spacing
Changed MapView? to use PNG instead of GIF
Added BugCompat? to MapView? for the GD<>imagefilledellipse()-Issue
Added Code for NPC-Corphandling (Corps have to be added manually)
Changed Raw-Killmail Window slightly
Added Killmail-Delete option within the killmail itself
Fixed privilege bug between admin and superadmin
Removed the need to enter the postpassword if you're logged in as admin
Changed coding style to Allman/BSD in all touched files
Various small changes i cant remember

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/common/post.php

    r2 r10  
    1 <? 
    2   require_once( "class.page.php" ); 
    3   require_once( "class.killboard.php" ); 
    4   require_once( "class.parser.php" ); 
    5   require_once( "class.phpmailer.php" ); 
    6   require_once( "class.kill.php" ); 
     1<?php 
     2require_once("class.page.php"); 
     3require_once("class.killboard.php"); 
     4require_once("class.parser.php"); 
     5require_once("class.phpmailer.php"); 
     6require_once("class.kill.php"); 
    77 
    8   $page = new Page( "Post killmail" ); 
    9   $kb = new Killboard( KB_SITE ); 
     8$page = new Page("Post killmail"); 
     9$kb = new Killboard(KB_SITE); 
    1010 
    11   $config = $kb->getConfig(); 
    12   if ( isset( $_POST['killmail'] ) ) { 
     11$config = $kb->getConfig(); 
     12if (isset($_POST['killmail'])) 
     13{ 
     14    if ($_POST['password'] == $config->getPostPassword() || $page->isAdmin()) 
     15    { 
     16        $parser = new Parser($_POST['killmail']); 
    1317 
    14     if ( $_POST['password'] == $config->getPostPassword() ) { 
    15       $parser = new Parser( $_POST['killmail'] ); 
     18        $killid = $parser->parse(true); 
    1619 
    17       $killid = $parser->parse( true ); 
     20        if ($killid == 0 || $killid == -1 || $killid == -2) 
     21        { 
     22            if ($killid == 0) 
     23                $html = "Killmail is malformed."; 
     24            if ($killid == -1) 
     25            { 
     26                $html = "That killmail has already been posted <a href=\"?a=kill_detail&kll_id=" . $parser->dupeid_ . "\">here</a>."; 
     27            } 
     28            if ($killid == -2) 
     29                $html = "You are not authorized to post this killmail."; 
     30        } 
     31        else 
     32        { 
     33            if ($config->getPostMailto() != "") 
     34            { 
     35                $mailer = new PHPMailer(); 
     36                $kill = new Kill($killid); 
    1837 
    19       if ( $killid == 0 || $killid == -1 || $killid == -2 ) { 
    20         if ( $killid == 0 ) 
    21           $html = "Killmail is malformed."; 
    22         if ( $killid == -1 ) { 
    23           $html = "That killmail has already been posted <a href=\"?a=kill_detail&kll_id=".$parser->dupeid_."\">here</a>."; 
    24         } 
    25         if ( $killid == -2 ) 
    26           $html = "You are not authorized to post this killmail."; 
    27       } 
    28       else { 
    29         if ( $config->getPostMailto() != "" ) { 
    30           $mailer = new PHPMailer(); 
    31           $kill = new Kill( $killid ); 
     38                $mailer->From = "mailer@eve-killboard.net"; 
     39                $mailer->FromName = "eve-killboard.net"; 
     40                $mailer->Subject = "Killmail #" . $killid; 
     41                $mailer->Host = "localhost"; 
     42                $mailer->Port = 25; 
     43                $mailer->Helo = "localhost"; 
     44                $mailer->Mailer = "smtp"; 
     45                $mailer->AddReplyTo("no_reply@eve-killboard.net", "No-Reply"); 
     46                $mailer->Sender = "mailer@eve-killboard.net"; 
     47                $mailer->Body = $kill->getRawMail(); 
     48                $mailer->AddAddress($config->getPostMailto()); 
     49                $mailer->Send(); 
     50            } 
    3251 
    33           $mailer->From = "mailer@eve-killboard.net"; 
    34           $mailer->FromName = "eve-killboard.net"; 
    35           $mailer->Subject = "Killmail #".$killid; 
    36           $mailer->Host = "localhost"; 
    37           $mailer->Port = 25; 
    38           $mailer->Helo = "localhost"; 
    39           $mailer->Mailer = "smtp"; 
    40           $mailer->AddReplyTo( "no_reply@eve-killboard.net", "No-Reply" ); 
    41           $mailer->Sender = "mailer@eve-killboard.net"; 
    42           $mailer->Body = $kill->getRawMail(); 
    43           $mailer->AddAddress( $config->getPostMailto() ); 
    44           $mailer->Send(); 
     52            $qry = new DBQuery(); 
     53            $qry->execute("insert into kb3_log 
     54                               values( " . $killid . ", '" . KB_SITE . "', 
     55                                       '" . $_SERVER['REMOTE_ADDR'] . "', 
     56                                       now() )"); 
     57 
     58            header("Location: ?a=kill_detail&kll_id=" . $killid); 
     59            exit; 
    4560        } 
    46  
    47         $qry = new DBQuery(); 
    48         $qry->execute( "insert into kb3_log 
    49                                values( ".$killid.", '".KB_SITE."', 
    50                                        '".$_SERVER['REMOTE_ADDR']."', 
    51                                        now() )" ); 
    52  
    53         Header( "Location: ?a=kill_detail&kll_id=".$killid ); 
    54         exit; 
    55       } 
    5661    } 
    57     else { 
    58       $html = "Invalid password."; 
     62    else 
     63    { 
     64        $html = "Invalid password."; 
    5965    } 
    60   } 
    61   else { 
     66} 
     67else 
     68{ 
    6269    $html .= "Paste the killmail from your EVEMail inbox into the box below. Make sure you post the <b>ENTIRE</b> mail.<br>Posting fake or otherwise edited mails is not allowed. All posts are logged."; 
    6370    $html .= "<br><br>Remember to post your losses as well.<br><br>"; 
     
    6572    $html .= "<form id=postform name=postform class=f_killmail method=post action=\"?a=post\">"; 
    6673    $html .= "<textarea name=killmail id=killmail class=f_killmail cols=\"70\" rows=\"24\"></textarea>"; 
    67     $html .= "<br><br><b>Password:</b><br><input id=password name=password type=password></input>"; 
     74    if (!$page->isAdmin()) 
     75    { 
     76        $html .= "<br><br><b>Password:</b><br><input id=password name=password type=password></input>"; 
     77    } 
    6878    $html .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id=submit name=submit type=submit value=\"Process !\"></input>"; 
    6979    $html .= "</form>"; 
     80} 
    7081 
    71   } 
    72  
    73   $page->setContent( $html ); 
    74   $page->generate(); 
     82$page->setContent($html); 
     83$page->generate(); 
    7584?>