Changeset 192
- Timestamp:
- 03/21/07 20:41:09 (14 years ago)
- Location:
- dev
- Files:
-
- 3 added
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/admin/admin_sync.php
r190 r192 31 31 } 32 32 33 $content_file .= 'ITEMS_START'; 33 if (isset($_REQUEST['itm_update'])) 34 { 35 $content_file .= 'ITEMS_START'; 36 } 37 /* 34 38 $qry->execute("select itm_name, itm_externalid, itm_value from kb3_items where itm_value != 0"); 35 39 while ($data = $qry->getRow()) … … 37 41 $content_file .= '§'.$data['itm_name'].'|'.$data['itm_externalid'].'|'.$data['itm_value'].'-'; 38 42 } 43 */ 39 44 40 45 $content_file = gzdeflate($content_file); 41 46 42 47 $http->set_postdata('data', $content_file); 43 $http->set_useragent( "EVE-KB SYNC (VER ".KB_VERSION.")");48 $http->set_useragent('EVE-KB SYNC (VER '.KB_VERSION.')'); 44 49 $http->set_header('X-KBHost: '.base64_encode(KB_HOST)); 45 50 46 // wait 90s for processed answer47 $http->setSockettimeout( 90);51 // wait 30s for processed answer 52 $http->setSockettimeout(30); 48 53 $file = $http->get_content(); 49 54 $header = $http->get_header(); 50 55 51 preg_match( "/X-KBVersion: (.*)/", $header, $match);56 preg_match('/X-KBVersion: (.*)/', $header, $match); 52 57 $version = explode('.', trim($match[1])); 53 58 $recv = $http->get_recv(); … … 67 72 $html .= "getting compressed data failed, server response was:<br><pre>\n"; 68 73 $html .= $file."</pre>\n"; 69 $html .= "Sent ".round($sended/1024, 2)." kB and received ".round($recv/1024, 2)." kB of data.<br>\n";74 $html .= 'Sent '.round($sended/1024, 2)." kB and received ".round($recv/1024, 2)." kB of data.<br>\n"; 70 75 } 71 76 } … … 75 80 76 81 // get all names we'll find 77 preg_match_all( "^!(.*?)\|(.*?)-^", $data, $matches);82 preg_match_all('^!(.*?)\|(.*?)-^', $data, $matches); 78 83 $results = count($matches[1]); 79 84 $update = new DBQuery(); 85 $new = 0; 80 86 for ($i = 0; $i<$results; $i++) 81 87 { 82 88 $update->execute("update kb3_pilots set plt_externalid='".addslashes($matches[2][$i])."' where plt_name='".addslashes($matches[1][$i])."' limit 1"); 89 if (mysql_affected_rows() == 1) 90 { 91 $new++; 92 } 83 93 } 84 $html .= "Synchronization complete, got $ results new ids from server running version ".$version[0].'.'.$version[1].'.'.$version[2].'.<br/>';94 $html .= "Synchronization complete, got $new new ids and ".($results - $new)." unknown pilots from server running version ".$version[0].'.'.$version[1].'.'.$version[2].'.<br/>'; 85 95 86 96 if (isset($_REQUEST['itm_update'])) … … 147 157 $html .= "<table class=kb-subtable>"; 148 158 $html .= "<tr><td width=120><b>Update item values</b></td><td><input type=checkbox name=itm_update id=itm_update"; 149 $html .= " checked=\"checked\"></td></tr>";159 $html .= " ></td></tr>"; 150 160 $html .= "<tr><td width=120><b>Overwrite local values</b></td><td><input type=checkbox name=itm_overwrite id=itm_overwrite"; 151 $html .= " checked=\"checked\">(If disabled only values with 0 will be overwritten)</td></tr>";161 $html .= " >(If disabled only values with 0 will be overwritten)</td></tr>"; 152 162 $html .= '<input type="hidden" name="do" value="sync">'; 153 163 $html .= '<tr><td width=120></td><td><input type=submit name=submit value="Synchronize now"></td></tr></table></form>'; -
dev/common/feed.php
r190 r192 1 1 <?php 2 ////////////3 //////4 ////// feed writer after5 ////// liq's feed syndication mod v1.56 //////7 ////////////8 2 9 3 @set_time_limit(120); 10 require_once('common/includes/db.php');11 4 require_once('common/includes/class.corp.php'); 12 5 require_once('common/includes/class.alliance.php'); … … 24 17 $klist->setPodsNoobShips(true); 25 18 26 if ($_GET['week']) 19 $w = intval($_GET['week']); 20 if ($w) 27 21 { 28 $klist->setWeek($ _GET['week']);22 $klist->setWeek($w); 29 23 } 30 24 elseif (!$_GET['lastkllid']) … … 33 27 } 34 28 35 if ($_GET['year']) 29 $y = intval($_GET['year']); 30 if ($y) 36 31 { 37 $klist->setYear($ _GET['year']);32 $klist->setYear($y); 38 33 } 39 34 elseif (!$_GET['lastkllid']) … … 42 37 } 43 38 44 if ($_GET['lastkllid'] && method_exists($klist, 'setMinKllID')) 39 $kid = intval($_GET['lastkllid']); 40 if ( && method_exists($klist, 'setMinKllID')) 45 41 { 46 $klist->setMinKllID($ _GET['lastkllid']);42 $klist->setMinKllID($kid); 47 43 } 48 44 … … 129 125 { 130 126 $kill = new Kill($id); 131 $html .= "<item>132 <title> " . $id . "</title>133 <description><![CDATA[ ".$kill->getRawMail()."]]></description>134 <guid>?a=kill_detail&kll_id= ".$id."</guid>135 <pubDate> " . strftime("%a, %d %b %Y %T %Z", strtotime($timestamp)) ."</pubDate>127 $html .= '<item> 128 <title>'.$id.'</title> 129 <description><![CDATA[ '.$kill->getRawMail().' ]]></description> 130 <guid>?a=kill_detail&kll_id='.$id.'</guid> 131 <pubDate>'.strftime("%a, %d %b %Y %T %Z", strtotime($timestamp))."</pubDate> 136 132 </item>\n"; 137 133 } 138 $html .= "</channel></rss>";134 $html .= '</channel></rss>'; 139 135 140 136 if ($_GET['gz']) -
dev/common/includes/class.alliance.php
r190 r192 1 1 <?php 2 require_once("db.php");3 2 4 3 class Alliance -
dev/common/includes/class.pilot.php
r190 r192 8 8 function Pilot($id = 0) 9 9 { 10 $this->id_ = $id;10 $this->id_ = intval($id); 11 11 $this->qry_ = new DBQuery(); 12 12 } … … 113 113 function setCharacterID($id) 114 114 { 115 $id = intval($id); 116 if (!$id) 117 { 118 return false; 119 } 115 120 $qry = new DBQuery(); 116 121 $qry->execute("update kb3_pilots set plt_externalid = ".$id." 117 where plt_id = ".$this->id_) or die($qry->getErrorMsg());122 where plt_id = ".$this->id_); 118 123 } 119 124 } -
dev/common/index.php
r190 r192 30 30 require_once('common/includes/class.user.php'); 31 31 require_once('common/includes/class.session.php'); 32 require_once(' smarty/Smarty.class.php');32 require_once('common/smarty/Smarty.class.php'); 33 33 34 34 // smarty doesnt like it … … 38 38 $page = str_replace('.', '', $_GET['a']); 39 39 $page = str_replace('/', '', $page); 40 if ($page == '' )40 if ($page == '' || $page == 'index') 41 41 { 42 42 $page = 'home'; … … 143 143 if ($docache) 144 144 { 145 if (!file_exists(KB_CACHEDIR . '/' .KB_SITE))146 { 147 @mkdir(KB_CACHEDIR . '/' .KB_SITE);145 if (!file_exists(KB_CACHEDIR.'/'.KB_SITE)) 146 { 147 @mkdir(KB_CACHEDIR.'/'.KB_SITE); 148 148 } 149 149 … … 159 159 $cachetime = $cachetime * 60; 160 160 161 $cachefile = KB_CACHEDIR . '/' . KB_SITE . '/' . md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) .'.cache';161 $cachefile = KB_CACHEDIR.'/'.KB_SITE.'/'.md5($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']).'.cache'; 162 162 $timestamp = ((@file_exists($cachefile))) ? @filemtime($cachefile) : 0; 163 163 … … 175 175 if ($settingsPage) 176 176 { 177 include ('mods/'.substr($page, 9, strlen($page)-9).'/settings.php'); 177 if (!Session::isAdmin()) 178 { 179 header('Location: ?a=login'); 180 echo '<a href="?a=login">Login</a>'; 181 exit; 182 } 183 184 include('mods/'.substr($page, 9, strlen($page)-9).'/settings.php'); 178 185 } 179 186 elseif ($modOverrides) -
dev/common/portrait_grab.php
r190 r192 23 23 else 24 24 { 25 $now = date( "Y-m-d H:m:s");25 $now = date('Y-m-d H:m:s'); 26 26 27 27 $alliance = new Alliance(); … … 31 31 $pilot = new Pilot(); 32 32 $plt_id = $pilot->add($_SERVER['HTTP_EVE_CHARNAME'], $corp, $now); 33 $pilot->setCharacterID($_SERVER['HTTP_EVE_CHARID']); 34 @unlink("cache/portraits/".$_SERVER['HTTP_EVE_CHARID']."_32.jpg"); 35 @unlink("cache/portraits/".$_SERVER['HTTP_EVE_CHARID']."_64.jpg"); 36 @unlink("cache/portraits/".$_SERVER['HTTP_EVE_CHARID']."_128.jpg"); 37 @unlink("cache/portraits/".$_SERVER['HTTP_EVE_CHARID']."_256.jpg"); 38 @unlink("cache/portraits/".$_SERVER['HTTP_EVE_CHARID']."_512.jpg"); 33 $id = intval($_SERVER['HTTP_EVE_CHARID']); 34 $pilot->setCharacterID($id); 35 @unlink("cache/portraits/".$id."_32.jpg"); 36 @unlink("cache/portraits/".$id."_64.jpg"); 37 @unlink("cache/portraits/".$id."_128.jpg"); 38 @unlink("cache/portraits/".$id."_256.jpg"); 39 @unlink("cache/portraits/".$id."_512.jpg"); 39 40 $html .= "<img src=\"".$pilot->getPortraitURL(64).".jpg\" border=\"0\">"; 40 41 $html .= "Character portrait updated !<br>"; 41 42 $html .= "<a href=\"?a=igb\">Return</a><br>"; 42 43 //$updated = true;44 43 } 45 44 } … … 49 48 $page->setContent($html); 50 49 $page->generate(); 51 52 /*53 if ($updated)54 {55 flush();56 ignore_user_abort(1);57 $id = $_SERVER['HTTP_EVE_CHARID'];58 59 $img = imagecreatefromjpeg("http://img.eve.is/serv.asp?s=512&c=".$id);60 if ($img)61 {62 $newimg = imagecreatetruecolor(32, 32);63 imagecopyresampled($newimg, $img, 0, 0, 0, 0, 32, 32, 512, 512);64 imagejpeg($newimg, "cache/portraits/" . $id . "_32.jpg");65 $newimg = imagecreatetruecolor(64, 64);66 imagecopyresampled($newimg, $img, 0, 0, 0, 0, 64, 64, 512, 512);67 imagejpeg($newimg, "cache/portraits/" . $id . "_64.jpg");68 $newimg = imagecreatetruecolor(128, 128);69 imagecopyresampled($newimg, $img, 0, 0, 0, 0, 128, 128, 512, 512);70 imagejpeg($newimg, "cache/portraits/" . $id . "_128.jpg");71 }72 }73 */74 50 ?> -
dev/mods/signature_generator/sig.php
r190 r192 19 19 } 20 20 21 if (!$plt_id = $_GET['i'])21 if (!$plt_id = intval($_GET['i'])) 22 22 { 23 23 errorPic('No pilot id specified.');