- Timestamp:
- 12/12/06 20:06:30 (15 years ago)
- Location:
- 1.2.1/common
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
1.2.1/common/admin_feed.php
r148 r150 1 <?php 2 @set_time_limit(0); 1 <? 3 2 4 // liq's feed syndication mod v1.0 5 require_once("class.page.php"); 6 require_once("db.php"); 7 require_once("admin_menu.php"); 8 require_once("feed_fetcher.php"); 9 require_once("class.killboard.php"); 10 require_once('class.corp.php'); 11 require_once('class.alliance.php'); 3 // liq's feed syndication mod v1.2 4 5 @set_time_limit(0); 6 require_once( "class.page.php" ); 7 require_once( "admin_menu.php" ); 8 require_once( "feed_fetcher.php" ); 9 require_once( 'class.corp.php' ); 10 require_once( 'class.alliance.php' ); 11 require_once( "db.php" ); 12 13 $page = new Page( "Administration - Feeds" ); 14 $page->setAdmin(); 15 16 $validurl = "/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((:[0-9]{1,5})?\/.*)?$/i"; 17 $html .= "<table class=kb-subtable>"; 12 18 13 $page = new Page("Administration - Feeds"); 14 $page->setAdmin(); 15 $killboard = new Killboard(KB_SITE); 19 if (getConfig('fetch_feed_count')) 20 $feedcount = getConfig('fetch_feed_count'); 21 else 22 $feedcount = 3; 16 23 17 // the rig0r basecode does not have this functions 18 function setConfig($key, $value) 19 { 20 global $config; 24 25 if ( $_POST['submit'] || $_POST['fetch'] ) { 26 if ( ctype_digit($_POST['fetch_feed_count']) ) { 27 setConfig('fetch_feed_count', $_POST['fetch_feed_count']); 28 $feedcount = $_POST['fetch_feed_count']; 29 for ($i = 99; $i>=$feedcount; $i--) { 30 delConfig('fetch_url_'.$i); 31 } 32 } 21 33 22 if (method_exists($config, 'setConfig'))23 { 24 return $config->setConfig($key, $value); 25 } 34 if ( $_POST['fetch_verbose'] ) 35 setConfig('fetch_verbose', '1'); 36 else 37 setConfig('fetch_verbose', '0'); 26 38 27 $qry = new DBQuery(); 28 $qry->execute("select cfg_value from kb3_config 29 where cfg_key = '".$key."' and cfg_site = '".KB_SITE."'"); 30 if ($qry->recordCount()) 31 { 32 $sql = "update kb3_config set cfg_value = '".$value."' 33 where cfg_site = '".KB_SITE."' and cfg_key = '".$key."'"; 34 } 35 else 36 { 37 $sql = "insert into kb3_config values ( '".KB_SITE."','".$key."','".$value."' )"; 38 } 39 $qry->execute($sql); 40 } 39 if ( $_POST['fetch_comment'] ) 40 setConfig('fetch_comment', $_POST['fetch_comment']); 41 else 42 setConfig('fetch_comment', ''); 43 44 for ($i = 1; $i<=$feedcount; $i++) { 45 $url = "fetch_url_".$i; 46 if ( preg_match($validurl ,$_POST[$url]) ) { 47 setConfig($url, $_POST[$url].':::'.$time[$i]); 48 $feed[$i] = $_POST[$url]; 49 } else 50 setConfig($url, ''); 51 $feed[$i] = ''; 52 } 53 } 41 54 42 function getConfig($key) 43 { 44 global $config; 55 $feed = array(); 56 for ($i = 1; $i<=$feedcount; $i++) { 57 $str = getConfig('fetch_url_'.$i); 58 $tmp = explode(':::', $str); 59 $feed[$i] = $tmp[0]; 60 $time[$i] = $tmp[1]; 61 } 62 63 if ( $_POST['fetch'] ) { 64 if (CORP_ID) { 65 $corp = new Corporation(CORP_ID); 66 $myid = '&corp='.urlencode($corp->getName()); 67 } 68 if (ALLIANCE_ID) { 69 $alli = new Alliance(ALLIANCE_ID); 70 $myid = '&alli='.urlencode($alli->getName()); 71 } 45 72 46 if (method_exists($config, 'getConfig')) 47 { 48 return $config->getConfig($key); 49 } 50 $qry = new DBQuery(); 51 $qry->query("select ".$key." from kb3_config where cfg_site = '".KB_SITE."'"); 52 $row = $qry->getRow(); 53 if (isset($row[$key])) 54 { 55 return $row[$key]; 56 } 57 return false; 58 } 73 for ($i=1; $i<=$feedcount; $i++) { 74 $feedfetch = new Fetcher(); 75 $cfg = "fetch_url_".$i; 76 if (preg_match($validurl , $feed[$i]) && $_POST["fetch_feed_".$i]) { 77 $str = ''; 78 if ($time[$i]) 79 $str .= '&lastkllid='.$time[$i]; 80 if ( $_POST['fetch_losses'] ) 81 $str .= "&losses=1"; 82 if ( $_POST['graball'] ) { 83 for ($l = 1; $l<=52; $l++) { 84 $html .= "<b>Week: ". $l ."</b><br>"; 85 $html .= $feedfetch->grab( $feed[$i].$myid.$str."&week=".$l ); 86 } 87 } else 88 $html .= $feedfetch->grab( $feed[$i].$myid.$str ); 89 } 90 91 setConfig($cfg, $feed[$i].':::'.$lastkllid); 92 $time[$i] = $lastkllid; 93 } 94 } 95 96 $html .= "<form id=options name=options method=post action=?a=admin_feed>"; 97 $html .= "</table>"; 98 99 $html .= "<div class=block-header2>Feeds</div><table>"; 59 100 60 $validurl = "/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((:[0-9]{1,5})?\/.*)?$/i"; 101 for ($i = 1; $i<=$feedcount; $i++) { 102 $html .= "<tr><td width=85px><b>Feed url #".$i."</b></td><td><input type=text name=fetch_url_".$i." size=50 class=password value=\""; 103 if ( $feed[$i] ) 104 $html .= $feed[$i]; 105 $html .= "\"> "; 106 $html .= "<input type=checkbox name=fetch_feed_".$i." id=fetch_feed_".$i; 107 if ( $feed[$i] ) 108 $html .= " checked=\"checked\""; 109 $html .= "><b>Fetch?</b><br>"; 110 $html .= "</td></tr>"; 111 } 112 113 $html .= "</table><i>Example: http://killboard.eve-d2.com/?a=feed</i><br><br><br>"; 114 115 $html .= "<table><tr><td height=30px width=150px><b>Get kills instead of losses?</b></td>"; 116 $html .= "<td><input type=checkbox name=fetch_losses id=fetch_losses>"; 117 $html .= "<i> (by default only your losses get fetched, when ticked all kills where one of your pilots is involved get fetched instead)</i></td></tr>"; 61 118 62 $html .= "<table class=\"kb-subtable\">"; 119 $html .= "<tr><td height=30px width=150px><b>Grab ALL mails from the feed servers?</b></td>"; 120 $html .= "<td><input type=checkbox name=graball id=graball>"; 121 $html .= "<i> (fetches all mails from the feed servers! use this may take upto several hours depending on the amount of kills to import!)</i></td>"; 122 $html .= "</tr></table><br><br>"; 123 124 $html .= "<input type=submit id=submit name=fetch value=\"Fetch!\"><br><br>"; 125 126 $html .= "<div class=block-header2>Options</div><table>"; 127 $html .= "<tr><td height=30px width=150px><b>Number of feeds:</b></td>"; 128 $html .= "<td><input type=text name=fetch_feed_count size=2 maxlength=2 class=password value=\"".$feedcount."\"</td></tr>"; 129 130 $html .= "<tr><td height=50px width=150px><b>Comment for automatically parsed killmails?</b></td>"; 131 $html .= "<td><input type=text size=50 class=password name=fetch_comment id=fetch_comment value=\""; 132 if ( getConfig('fetch_comment') ) 133 $html .= getConfig('fetch_comment'); 134 $html .= "\"><br><i> (leave blank for none)</i><br></td></tr>"; 135 136 $html .= "<tr><td height=30px width=150px><b>Verbose mode?</b></td>"; 137 $html .= "<td><input type=checkbox name=fetch_verbose id=fetch_verbose"; 138 if ( getConfig('fetch_verbose') ) 139 $html .= " checked=\"checked\""; 140 $html .= "><i> (displays errormessages when the imported mail is malformed, already exists, is not related etc.)</i></td>"; 141 $html .= "</tr></table><br><br>"; 63 142 64 $feed = array(); 65 for ($i = 1; $i<=5; $i++) 66 { 67 $str = getConfig('fetch_url_'.$i); 68 $tmp = explode(':::', $str); 69 $feed[$i] = $tmp[0]; 70 $time[$i] = $tmp[1]; 71 } 143 $html .= "<input type=submit id=submit name=submit value=\"Save\">"; 144 $html .= "</form>"; 72 145 73 if ($_POST['fetch']) 74 { 75 $i = 1; 76 while ($i <= 5) 77 { 78 $feedfetch = new Fetcher(); 79 $url = "fetch_url_".$i; 80 if (preg_match($validurl , $feed[$i])) 81 { 82 $str = ''; 83 if (CORP_ID) 84 { 85 $corp = new Corporation(CORP_ID); 86 $str = '&corp_name='.urlencode($corp->getName()); 87 } 88 else 89 { 90 $all = new Alliance(ALLIANCE_ID); 91 $str = '&alliance_name='.urlencode($all->getName()); 92 } 93 if ($time[$i]) 94 { 95 $str .= '&lastkllid='.$time[$i]; 96 } 97 98 if ($_POST['graball']) 99 { 100 $l = 1; 101 while ($l <= 52) 102 { 103 $html .= "<b>Week: ".$l."</b><br>"; 104 $html .= $feedfetch->generate($feed[$i]."&week=".$l.$str); 105 $l++; 106 } 107 } 108 else 109 { 110 $html .= $feedfetch->generate($feed[$i].$str); 111 } 112 setConfig($url, $feed[$i].':::'.$lastkllid); 113 $time[$i] = $lastkllid; 114 } 115 $i++; 116 } 117 } 118 119 if ($_POST['submit']) 120 { 121 $i = 1; 122 while ($i <= 5) 123 { 124 $url = "fetch_url_".$i; 125 if (preg_match($validurl , $_POST[$url])) 126 { 127 setConfig($url, $_POST[$url].':::'.$time[$i]); 128 $feed[$i] = $_POST[$url]; 129 } 130 else 131 { 132 setConfig($url, ''); 133 } 134 $i++; 135 } 136 } 137 138 $html .= "<br><form id=options name=options method=post action=?a=admin_feed>"; 139 $html .= "<input type=submit id=submit name=fetch value=\"Fetch\">"; 140 $html .= "<br><br><input type=checkbox name=graball id=graball>grab ALL kills from the feed servers? <br> <i>(use this may take upto several hours depending on the amount of kills to import!)</i>"; 141 $html .= "</form></table><br>"; 142 143 $html .= "<table class=kb-subtable>"; 144 $html .= "<div class=block-header2>Feed options</div>"; 145 $html .= "<form id=options name=options method=post action=?a=admin_feed>"; 146 $html .= "Feed url #1<input type=text name=fetch_url_1 size=50 class=password value=\"".$feed[1]."\"><br><br>"; 147 $html .= "Feed url #2<input type=text name=fetch_url_2 size=50 class=password value=\"".$feed[2]."\"><br><br>"; 148 $html .= "Feed url #3<input type=text name=fetch_url_3 size=50 class=password value=\"".$feed[3]."\"><br><br>"; 149 $html .= "Feed url #4<input type=text name=fetch_url_4 size=50 class=password value=\"".$feed[4]."\"><br><br>"; 150 $html .= "Feed url #5<input type=text name=fetch_url_5 size=50 class=password value=\"".$feed[5]."\"><br><br>"; 151 $html .= "<i>Example: http://killboard.eve-d2.com/?a=feed</i>"; 152 $html .= "<br><br><br><input type=submit id=submit name=submit value=\"Save\">"; 153 $html .= "</form></table>"; 154 155 $page->addContext($menubox->generate()); 156 $page->setContent($html); 157 $page->generate(); 146 $page->addContext( $menubox->generate() ); 147 $page->setContent( $html ); 148 $page->generate(); 149 158 150 ?> -
1.2.1/common/feed.php
r148 r150 1 1 <?php 2 3 // liq's feed syndication mod v1.2 4 2 5 @set_time_limit(0); 3 4 // liq's feed syndication mod v1.0 5 require_once("class.corp.php"); 6 require_once("class.alliance.php"); 7 require_once("class.killlist.php"); 8 require_once("class.kill.php"); 9 require_once("db.php"); 10 require_once("globals.php"); 6 header('Content-type: text/xml'); 7 require_once( "class.corp.php" ); 8 require_once( "class.alliance.php" ); 9 require_once( "class.killlist.php" ); 10 require_once( "class.kill.php" ); 11 require_once( "db.php" ); 12 require_once( "globals.php" ); 11 13 12 14 class RSSTable 13 15 { 14 function RSSTable($kill_list) 15 { 16 function RSSTable($kill_list) { 16 17 $this->limit = 0; 17 18 $this->offset = 0; … … 19 20 } 20 21 21 function setLimit($limit) 22 { 22 function setLimit($limit) { 23 23 $this->limit_ = $limit; 24 24 } 25 25 26 function generate() 27 { 26 function generate() { 28 27 $prevdate = ""; 29 28 $this->kill_list_->rewind(); 30 29 31 30 while ($kill = $this->kill_list_->getKill()) 32 31 { 33 $rawkill = new Kill($kill->getID());34 35 32 $rawkill = new Kill( $kill->getID() ); 33 34 $html .= " 36 35 <item> 37 36 <title>".$rawkill->getID()."</title> 38 37 <description> <![CDATA[ ".$rawkill->getRawMail()." ]]> </description> 39 38 <guid>?a=kill_detail&kll_id=".$kill->getID()."</guid> 40 <pubDate>".strftime( "%a, %d %b %Y %T %Z" , strtotime($kill->getTimeStamp()))."</pubDate>41 </item> "; 39 <pubDate>".strftime( "%a, %d %b %Y %T %Z" , strtotime($kill->getTimeStamp()))."</pubDate> 40 </item> "; 42 41 } 43 42 return $html; … … 46 45 47 46 $html .= " 48 <rss version=\"2.0\"> 49 <channel> 47 <rss version=\"2.0\"><channel> 50 48 <title>".KB_TITLE."</title> 51 <description>Kill Feed</description> 52 <link>http://".KB_HOST."</link> 49 <link>".KB_HOST."</link> 53 50 <copyright>".KB_TITLE."</copyright>"; 54 51 … … 57 54 $klist->setPodsNoobShips(true); 58 55 59 if ($_GET[' week'])56 if ($_GET['corp'] || $_GET['corp_name']) 60 57 { 61 $klist->setWeek($_GET['week']); 58 if ($_GET['corp']) 59 $c=$_GET['corp']; 60 if ($_GET['corp_name']) 61 $c=$_GET['corp_name']; 62 $corp = new Corporation(); 63 $corp->lookup( urldecode($c) ); 62 64 } 63 elseif (!$_GET['lastkllid'])65 if ($_GET['alli'] || $_GET['alliance_name']) 64 66 { 65 $klist->setWeek(date("W")); 66 } 67 if ($_GET['lastkllid']) 68 { 69 if (method_exists($klist, 'setMinKllID')) 70 { 71 $klist->setMinKllID($_GET['lastkllid']); 72 } 67 if ($_GET['alli']) 68 $a=$_GET['alli']; 69 if ($_GET['alliance_name']) 70 $a=$_GET['alliance_name']; 71 $alli = new Alliance(); 72 $alli->add( urldecode($a) ); 73 73 } 74 74 75 if ($_GET['corp_name']) 76 { 77 $corp = new Corporation(); 78 $corp->lookup($_GET['corp_name']); 79 $klist->addInvolvedCorp($corp); 75 if ($_GET['week']) 76 $klist->setWeek( $_GET['week'] ); 77 elseif (!$_GET['lastkllid']) 78 $klist->setWeek( date("W") ); 79 if ($_GET['lastkllid']) { 80 if (method_exists($klist, 'setMinKllID')) 81 $klist->setMinKllID($_GET['lastkllid']); 80 82 } 81 elseif ($_GET['alliance_name']) 82 { 83 $ally = new Alliance(); 84 $ally->add($_GET['alliance_name']); 85 $klist->addInvolvedAlliance($ally); 83 84 if ( $_GET['losses']) { 85 $html .= "<description> Loss Feed v1.2</description>"; 86 if (CORP_ID) 87 $klist->addVictimCorp(new Corporation(CORP_ID)); 88 if (ALLIANCE_ID) 89 $klist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 90 if ($corp) 91 $klist->addInvolvedCorp($corp); 92 if ($alli) 93 $klist->addInvolvedAlliance($alli); 94 95 } else { 96 $html .= "<description> Kill Feed v1.2</description>"; 97 if (CORP_ID) 98 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 99 if (ALLIANCE_ID) 100 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 101 if ($corp) 102 $klist->addVictimCorp($corp); 103 if ($alli) 104 $klist->addVictimAlliance($alli); 86 105 } 87 106 88 107 $table = new RSSTable($klist); 108 $html .= $table->generate(); 109 $html .= "</channel></rss>"; 110 echo $html; 89 111 90 $html .= $table->generate();91 $html .= "92 </channel>93 </rss>";94 95 echo $html;96 112 ?> -
1.2.1/common/feed_fetcher.php
r148 r150 1 1 <?php 2 @set_time_limit(0);3 // liq's feed syndication mod v1.04 require_once("class.page.php");5 require_once("class.kill.php");6 require_once("class.parser.php");7 2 8 $insideitem = false; 3 // liq's feed syndication mod v1.2 4 5 @set_time_limit(0); 6 require_once( "class.kill.php" ); 7 require_once( "class.parser.php" ); 8 if ( file_exists("class.comments.php") ) // for the Eve-Dev Comment Class 9 require_once( "class.comments.php" ); 10 if ( file_exists("class.comment.php") ) // for the D2 Killboard Comment Class 11 require_once( "class.comment.php" ); 12 13 $insideitem = false; 9 14 $tag = ""; 10 15 $title = ""; 11 16 $description = ""; 12 $link = ""; 13 $x =0;17 $link = ""; 18 $x=0; 14 19 15 class Fetcher 16 { 17 function generate($url, $lastkllid = 0) 18 { 19 global $x; 20 function setConfig($key, $value) { 21 global $config; 22 if (method_exists($config, 'setConfig')) 23 return $config->setConfig($key, $value); 24 $qry = new DBQuery(); 25 $qry->execute("select cfg_value from kb3_config 26 where cfg_key = '".$key."' and cfg_site = '".KB_SITE."'"); 27 if ($qry->recordCount()) 28 $sql = "update kb3_config set cfg_value = '".$value."' 29 where cfg_site = '".KB_SITE."' and cfg_key = '".$key."'"; 30 else 31 $sql = "insert into kb3_config values ( '".KB_SITE."','".$key."','".$value."' )"; 32 $qry->execute($sql); 33 } 20 34 21 $xml_parser = xml_parser_create(); 22 xml_set_object($xml_parser, $this); 23 xml_set_element_handler($xml_parser, "startElement", "endElement"); 24 xml_set_character_data_handler ($xml_parser, 'characterData'); 35 function getConfig($key) { 36 global $config; 37 if (method_exists($config, 'getConfig')) 38 return $config->getConfig($key); 39 $qry = new DBQuery(); 40 $qry->query("select ".$key." from kb3_config where cfg_site = '".KB_SITE."'"); 41 $row = $qry->getRow(); 42 if (isset($row[$key])) 43 return $row[$key]; 44 return false; 45 } 25 46 26 $fp = @fopen($url, "r"); 27 $file = ''; 28 while ($data = fread($fp, 4096)) 29 { 30 $file .= $data; 31 } 32 fclose($fp); 47 function delConfig($key) { 48 global $config; 49 $qry = new DBQuery(); 50 $qry->execute("delete from kb3_config where cfg_key = '".$key."' and cfg_site = '".KB_SITE."'"); 51 } 33 52 34 if (!$file && file_exists('class.http.php')) 35 { 36 include_once('class.http.php'); 37 $file = new http($url); 38 $file = $file->get_content(); 39 } 40 if (!xml_parse($xml_parser, $file)) 41 return "<i>Error getting XML data from ".$url."</i><br><br>"; 42 xml_parser_free($xml_parser); 53 class Fetcher { 54 55 function grab($url) { 56 global $x, $fetchurl; 57 $x=0; 58 $fetchurl = $url; 59 $xml_parser = xml_parser_create(); 60 xml_set_object ( $xml_parser, $this ); 61 xml_set_element_handler($xml_parser, "startElement", "endElement"); 62 xml_set_character_data_handler ( $xml_parser, 'characterData' ); 63 $fp = @fopen($url,"r"); 64 while ($data = @fread($fp, 4096)) { 65 if (!xml_parse( $xml_parser, $data, feof($fp) ) && !feof($fp) ) 66 return "<i>Error getting XML data from ".$url."</i><br><br>"; 67 } 68 @fclose($fp); 69 xml_parser_free($xml_parser); 70 if ($x) 71 $html = "<div class=block-header2>".$x." kills added from feed: ".$url."</div>"; 72 else 73 $html = "<div class=block-header2>No kills added from feed: ".$url."</div>"; 74 return $html; 75 } 43 76 44 if ($x) 45 { 46 $html = "<div class=block-header2>".$x." kills added from feed: ".$url."</div>"; 47 } 48 else 49 { 50 $html = "<div class=block-header2>No kills added from feed: ".$url."</div>"; 51 } 77 function startElement($parser, $name, $attrs) { 78 global $insideitem, $tag, $title, $description, $link; 79 if ($insideitem) 80 $tag = $name; 81 elseif ($name == "ITEM") 82 $insideitem = true; 83 } 52 84 53 return $html; 54 } 85 function endElement($parser, $name) { 86 global $insideitem, $tag, $title, $description, $link, $html, $x, $fetchurl; 55 87 56 function startElement($parser, $name, $attrs) 57 { 58 global $insideitem, $tag, $title, $description, $link; 59 if ($insideitem) 60 { 61 $tag = $name; 62 } 63 elseif ($name == "ITEM") 64 { 65 $insideitem = true; 66 } 67 } 88 if ($name == "ITEM") { 89 if ( isset( $description ) ) { 90 $parser = new Parser( $description ); 91 $killid = $parser->parse( true ); 92 if ( $killid == 0 || $killid == -1 || $killid == -2 ) { 93 if ( $killid == 0 && getConfig('fetch_verbose') ) 94 $html .= "Killmail is malformed.<br>"; 95 if ( $killid == -2 && getConfig('fetch_verbose') ) 96 $html .= "Killmail is not related to ".KB_TITLE.".<br>"; 97 if ( $killid == -1 && getConfig('fetch_verbose') ) 98 $html .= "Killmail already posted <a href=\"?a=kill_detail&kll_id=".$parser->dupeid_."\">here</a>.<br>"; 99 } 100 else { 101 $qry = new DBQuery(); 102 $qry->execute( "insert into kb3_log values( ".$killid.", '".KB_SITE."','".$_SERVER['REMOTE_ADDR']."',now() )" ); 103 $html .= "Killmail succsessfully posted <a href=\"?a=kill_detail&kll_id=".$killid."\">here</a>.<br>"; 68 104 69 function endElement($parser, $name) 70 { 71 global $insideitem, $tag, $title, $description, $link, $html, $x, $lastkllid; 105 if (class_exists('Comments') && getConfig('fetch_comment')) { // for the Eve-Dev Comment Class 106 $comments = new Comments($killid); 107 $comments->addComment("liq's feed syndication", getConfig('fetch_comment')." (mail fetched from: ".$fetchurl.")"); 108 } 109 if (class_exists('Comment') && getConfig('fetch_comment')) { // for the D2 Killboard Comment Class 110 $comment = new Comment($killid); 111 $comment->postComment(getConfig('fetch_comment')." \n\n <i>(mail fetched from:\n ".$fetchurl.")</i>", "liquidism"); 112 } 113 $x++; 114 } 115 } 116 $title = ""; 117 $description = ""; 118 $link = ""; 119 $insideitem = false; 120 } 121 } 72 122 73 if ($name == "ITEM") 74 { 75 if (isset($description)) 76 { 77 $parser = new Parser($description); 78 $killid = $parser->parse(true); 79 if ($killid == 0 || $killid == -1 || $killid == -2 || $killid == -3) 80 { 81 $page = new Page("Error"); 82 if ($killid == 0) 83 $html .= "Killmail is malformed.<br>"; 84 if ($killid == -3) 85 $html .= "Killmail does not have a final blow! <p><br>To prevent the corruption of the database please just fake a <i>(laid the final blow)</i> behind one of the involved players on the killmail.<br><br><b>Example:</b><i><br>Name: liquidism (laid the final blow)</i></p>"; 86 if ($killid == -2) 87 $html .= "Killmail is not related to ".KB_TITLE.".<br>"; 88 if ($killid == -1) 89 $html .= "Killmail already posted <a href=\"?a=kill_detail&kll_id=".$parser->dupeid_."\">here</a>.<br>"; 90 } 91 else 92 { 93 $qry = new DBQuery(); 94 $qry->execute("insert into kb3_log values( ".$killid.", '".KB_SITE."','".$_SERVER['REMOTE_ADDR']."',now() )"); 95 $html .= "Killmail has succsessfully been posted <a href=\"?a=kill_detail&kll_id=".$killid."\">here</a>.<br>"; 96 $x++; 97 } 98 } 99 if (trim($title) > $lastkllid || $lastkllid == 0) 100 { 101 $lastkllid = trim($title); 102 } 103 $title = ""; 104 $description = ""; 105 $link = ""; 106 $insideitem = false; 107 } 108 } 123 function characterData($parser, $data) { 124 global $insideitem, $tag, $title, $description, $link; 125 if ($insideitem) { 126 switch ($tag) { 127 case "TITLE": 128 $title .= $data; 129 break; 130 case "DESCRIPTION": 131 $description .= $data; 132 break; 133 case "LINK": 134 $link .= $data; 135 break; 136 } 137 } 138 } 109 139 110 function characterData($parser, $data)111 {112 global $insideitem, $tag, $title, $description, $link;113 if ($insideitem)114 {115 switch ($tag)116 {117 case "TITLE":118 $title .= $data;119 break;120 case "DESCRIPTION":121 $description .= $data;122 break;123 case "LINK":124 $link .= $data;125 break;126 }127 }128 }129 140 } 141 130 142 ?>