Changeset 181
- Timestamp:
- 01/28/07 16:04:10 (16 years ago)
- Location:
- dev
- Files:
-
- 6 added
- 1 removed
- 16 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/admin.php
r177 r181 3 3 require_once('class.killboard.php'); 4 4 require_once('class.page.php'); 5 require_once('class.tabbedform.php');6 5 7 6 // admin menu now loads all admin pages with options … … 10 9 11 10 $killboard = new Killboard(KB_SITE); 12 $page = new Page( 'Administration - Generic (Current version: '.KB_VERSION.' Build '.SVN_REV.')');11 $page = new Page(); 13 12 $page->setAdmin(); 14 13 … … 41 40 $page->setContent(options::genOptionsPage()); 42 41 $page->addContext(options::genAdminMenu()); 42 if ($_REQUEST['sub'] == 'Generic' && $_REQUEST['field'] == 'Appearance') 43 { 44 $page->setTitle('Administration - Generic (Current version: '.KB_VERSION.' Build '.SVN_REV.')'); 45 } 43 46 $page->generate(); 44 47 } -
dev/common/admin/admin_generic.php
r177 r181 120 120 { 121 121 $t = mktime(0, 0, 0, $i, 1, 1980); 122 $month = date("M", $t);122 $month = gmdate("M", $t); 123 123 if($date['mon'] == $i) 124 124 { … … 135 135 136 136 $html .= "<select name=\"option[filter_year]\" id=\"option[filter_year]\">"; 137 for ($i = date("Y")-7; $i <=date("Y"); $i++)137 for ($i = gmdate("Y")-7; $i <= gmdate("Y"); $i++) 138 138 { 139 139 if ($date['year'] == $i) -
dev/common/admin_menu.php
r177 r181 20 20 } 21 21 22 $mods_active = explode(',', config::get('mods_active')); 23 $modOverrides = false; 24 foreach ($mods_active as $mod) 25 { 26 if (file_exists('mods/'.$mod.'/auto_settings.php')) 27 { 28 include('mods/'.$mod.'/auto_settings.php'); 29 } 30 } 31 22 32 // overload the box object to force every admin page to use the new options menu 23 33 class Box2 extends Box … … 38 48 options::oldMenu('Advanced', "Synchronization", "?a=admin_sync"); 39 49 options::oldMenu('Advanced', "Post Permissions", "?a=admin_postperm"); 40 options::oldMenu('Modules', "Mods", "?a=admin_mods");50 options::oldMenu('Modules', "Mods", "?a=admin_mods"); 41 51 options::oldMenu('Maintenance', "Auditing", "?a=admin_audit"); 42 52 options::oldMenu('Maintenance', "Kill Import - files", "?a=kill_import"); -
dev/common/class.comments.php
r149 r181 36 36 $id = $qry->getInsertID(); 37 37 $this->comments_[] = array('time' => date('Y-m-d H:i:s'), 'name' => $name, 'comment' => stripslashes($comment), 'id' => $id); 38 39 // create comment_added event 40 event::call('comment_added', &$this); 38 41 } 39 42 -
dev/common/class.http.php
r162 r181 151 151 } 152 152 } 153 $this->status = socket_get_status($fp); 153 154 fclose($fp); 154 155 $this->header = $http_header; -
dev/common/class.kill.php
r174 r181 698 698 $qry->execute($sql); 699 699 } 700 701 // call the event that we added this mail 702 event::call('killmail_added', &$this); 700 703 return $this->id_; 701 704 } -
dev/common/class.killboard.php
r159 r181 1 1 <?php 2 2 require_once("db.php"); 3 require_once('class.config.php'); 3 4 4 5 class Killboard … … 52 53 } 53 54 } 54 55 class Config56 {57 function Config($site)58 {59 $this->qry_ = new DBQuery();60 $this->sql_ = "select * from kb3_config where cfg_site = '".$site."'";61 62 $this->site_ = $site;63 }64 65 function getStyleName()66 {67 $this->execQuery();68 return $this->config['style_name'];69 }70 71 function getStyleBanner()72 {73 $this->execQuery();74 return $this->config['style_banner'];75 }76 77 function getPostPassword()78 {79 $this->execQuery();80 return $this->config['post_password'];81 }82 83 function getPostMailto()84 {85 $this->execQuery();86 return $this->config['post_mailto'];87 }88 89 function getKillPoints()90 {91 $this->execQuery();92 return $this->config['kill_points'];93 }94 95 function getLeastActive()96 {97 $this->execQuery();98 return $this->config['least_active'];99 }100 101 function getConfig($key)102 {103 $this->execQuery();104 if (isset($this->config[$key]))105 {106 return $this->config[$key];107 }108 return false;109 }110 111 function setConfig($key, $value)112 {113 $qry = new DBQuery();114 $qry->execute("select cfg_value from kb3_config115 where cfg_key = '".$key."'116 and cfg_site = '".$this->site_."'");117 if ($qry->recordCount())118 {119 $sql = "update kb3_config120 set cfg_value = '".$value."'121 where cfg_site = '".$this->site_."'122 and cfg_key = '".$key."'";123 }124 else125 {126 $sql = "insert into kb3_config values ( '".$this->site_."',127 '".$key."',128 '".$value."' )";129 }130 $qry->execute($sql) or die($qry->getErrorMsg());131 $this->config[$key] = $value;132 }133 134 function delConfig($key)135 {136 $qry = new DBQuery();137 $qry->execute("delete from kb3_config where cfg_key = '".$key."'138 and cfg_site = '".$this->site_."'");139 if (isset($this->config[$key]))140 {141 unset($this->config[$key]);142 }143 }144 145 function checkCheckbox($name)146 {147 if ($_POST[$name] == 'on')148 {149 $this->setConfig($name, '1');150 return true;151 }152 $this->setConfig($name, '0');153 return false;154 }155 156 function setStyleName($name)157 {158 $this->setConfig("style_name", $name);159 }160 161 function setStyleBanner($banner)162 {163 $this->setConfig("style_banner", $banner);164 }165 166 function setPostPassword($password)167 {168 $this->setConfig("post_password", $password);169 }170 171 function setPostMailto($mailto)172 {173 $this->setConfig("post_mailto", $mailto);174 }175 176 function setKillPoints($flag)177 {178 $this->setConfig("kill_points", $flag);179 }180 181 function setLeastActive($flag)182 {183 $this->setConfig("least_active", $flag);184 }185 186 function execQuery()187 {188 if (!$this->qry_->executed_)189 {190 $this->qry_->execute($this->sql_);191 192 $this->config = array();193 while ($row = $this->qry_->getRow())194 {195 $this->config[$row['cfg_key']] = $row['cfg_value'];196 }197 if (count($this->config) == 0)198 {199 // no config supplied, generate standard one200 201 $this->setConfig('style_name', 'default');202 $this->setConfig('style_banner', 'default');203 $this->setConfig('kill_points', 1);204 $this->setConfig('least_active', 0);205 $this->setConfig('post_password', 'CHANGEME');206 }207 }208 }209 }210 55 ?> -
dev/common/class.map.php
r155 r181 142 142 and sjp.sjp_from = sys.sys_eve_id'; 143 143 144 $regioncache = "cache/map/" . $this->regionid_ . "_" . $this->imgwidth_ . ".png";144 $regioncache = 'cache/map/'.KB_SITE.'_'.$this->regionid_.'_'.$this->imgwidth_.'.png'; 145 145 $cached = false; 146 146 … … 158 158 if ($this->mode_ == "region") 159 159 { 160 $sql .= " and reg.reg_id = " .$this->regionid_;160 $sql .= " and reg.reg_id = ".$this->regionid_; 161 161 $caption = $this->conname_; 162 162 } … … 164 164 if ($this->mode_ == "cons") 165 165 { 166 $sql .= " and con.con_id = " .$this->conid_;167 $caption = $this->sysname_ . " (" . roundsec($this->syssec_) .")";166 $sql .= " and con.con_id = ".$this->conid_; 167 $caption = $this->sysname_." (".roundsec($this->syssec_).")"; 168 168 } 169 169 … … 352 352 if (strlen($this->title_) > 0) 353 353 { 354 $title = $this->title_ . " " .$caption;354 $title = $this->title_." ".$caption; 355 355 } 356 356 else -
dev/common/class.options.php
r177 r181 4 4 * This is the class which should make it easier to add new options to the admin menu 5 5 * It may only be invoked statically like: options::add(...); 6 * Do NOT try to call $options = new options()!!!!!!6 * more functions will be added as needed, if you want one, add it or contact exi 7 7 */ 8 8 … … 42 42 } 43 43 44 // this will emulate the old options menu 44 45 function oldMenu($field, $subfield, $link) 45 46 { … … 49 50 } 50 51 52 // this handles the submit from the optionspage 51 53 function handlePost() 52 54 { 53 global $config;54 55 $data = &options::_getData(); 55 56 … … 59 60 foreach ($elements as $element) 60 61 { 62 // for callbacks we check their callback function on postdata to deal with it 61 63 if ($element['callback']) 62 64 { … … 69 71 continue; 70 72 } 73 74 // for checkboxes we need to set the value to zero if the option is not there 71 75 if ($element['type'] == 'checkbox') 72 76 { 73 77 if ($_POST['option'][$element['name']] == 'on') 74 78 { 75 $config->setConfig($element['name'], '1');79 config::set($element['name'], '1'); 76 80 } 77 81 else 78 82 { 79 $config->setConfig($element['name'], '0');83 config::set($element['name'], '0'); 80 84 } 81 85 } 82 86 else 83 87 { 84 $config->setConfig($element['name'], $_POST['option'][$element['name']]); 88 // edits and options will be set directly 89 config::set($element['name'], $_POST['option'][$element['name']]); 85 90 } 86 91 } … … 95 100 $sub = $_REQUEST['sub']; 96 101 97 global $smarty; 98 102 global $smarty, $page; 103 104 if (is_object($page)) 105 { 106 $page->setTitle('Administration - '.$sub); 107 } 108 109 // create the option field 99 110 $smarty->assign('field', $field); 100 111 $smarty->assign('sub', $sub); 101 112 $html = $smarty->fetch(get_tpl('admin_options_field_head')); 113 114 // create all option sets 102 115 foreach ($data[$field][$sub] as $set => $options) 103 116 { 104 117 $smarty->assign('set', $set); 105 118 $html .= $smarty->fetch(get_tpl('admin_options_set_head')); 119 120 // create all options in the set 106 121 foreach ($options as $option) 107 122 { … … 118 133 global $smarty; 119 134 135 // this will extract all options into an array 136 $options = array(); 137 if (strpos($element['type'], ':')) 138 { 139 $array = explode(':', $element['type']); 140 $element['type'] = array_shift($array); 141 142 $max = count($array); 143 for ($i=0; $i<=$max; $i+=2) 144 { 145 // make sure we assign a value 146 if (isset($array[$i+1])) 147 { 148 $options[$array[$i]] = $array[$i+1]; 149 } 150 } 151 } 152 120 153 if ($element['type'] == 'select') 121 154 { … … 141 174 { 142 175 $smarty->assign_by_ref('opt', $element); 176 177 if (!$options['size']) 178 { 179 $options['size'] = 20; 180 } 181 if (!$options['maxlength']) 182 { 183 $options['maxlength'] = 80; 184 } 185 $smarty->assign_by_ref('options', $options); 143 186 return $smarty->fetch(get_tpl('admin_options_edit')); 144 187 } 145 188 189 // for a custom element we call the callback to get the html we want 146 190 if ($element['type'] == 'custom') 147 191 { … … 165 209 $data = &options::_getData(); 166 210 211 // sort the menu alphabetically 167 212 ksort($data); 213 214 // create a standardbox to print all links into 168 215 $menubox = new Box('Options'); 169 216 $menubox->setIcon('menu-item.gif'); … … 174 221 foreach ($subfields as $subfield => $array) 175 222 { 223 // if this subfield has no options then it is a category 176 224 if (!is_array($array)) 177 225 { … … 179 227 continue; 180 228 } 229 230 // we're not a category, make it klickable 181 231 $menubox->addOption('link', $subfield, '?a=admin&field='.$field.'&sub='.$subfield); 182 232 } … … 186 236 } 187 237 238 // private data storage to store all options 188 239 function &_getData() 189 240 { -
dev/common/class.page.php
r169 r181 46 46 $smarty->assign('kb_title', KB_TITLE.' Killboard - '.$this->title_); 47 47 48 $style = $config->getStyleName();48 $style = config::get('style_name'); 49 49 $smarty->assign('style', $style); 50 50 … … 58 58 if (!$this->igb_) 59 59 { 60 if (strpos( $config->getConfig('mods_active'), 'rss_feed') !== false)60 if (strpos(config::get('mods_active'), 'rss_feed') !== false) 61 61 { 62 62 $smarty->assign('rss_feed', 1); … … 66 66 $smarty->assign('banner_link', MAIN_SITE); 67 67 } 68 $banner = $config->getStyleBanner();68 $banner = config::get('style_banner'); 69 69 if ($banner == 'custom') 70 70 { … … 95 95 $w--; 96 96 } 97 if ( $config->getConfig('show_standing'))97 if (config::get('show_standing')) 98 98 { 99 99 $w--; -
dev/common/class.session.php
r95 r181 6 6 function Session() 7 7 { 8 if (isset($_REQUEST[ 'PHPSESSID']))8 if (isset($_REQUEST[session_name()])) 9 9 { 10 10 session_start(); -
dev/common/index.php
r158 r181 3 3 require_once('class.killboard.php'); 4 4 require_once('smarty/Smarty.class.php'); 5 require_once('class.event.php'); 6 require_once('class.roles.php'); 7 // smarty doesnt like it (i either) 8 @set_magic_quotes_runtime(0); 5 9 6 10 $page = str_replace('.', '', $_GET['a']); … … 10 14 $page = 'home'; 11 15 } 16 17 // check for the igb 12 18 if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == 'EVE-minibrowser') 13 19 { … … 25 31 $killboard = new Killboard(KB_SITE); 26 32 $config = $killboard->getConfig(); 33 34 // setting up smarty 27 35 $smarty = new Smarty(); 28 36 $smarty->template_dir = './templates'; … … 32 40 $smarty->assign('img_url', IMG_URL); 33 41 $smarty->assign_by_ref('config', $config); 42 43 // this is to make sure that smarty is able to create output 34 44 if (!is_dir('./cache/templates_c')) 35 45 { … … 43 53 } 44 54 } 45 // if ($killboard->isSuspended())46 // $page = 'suspended';47 55 48 56 if (substr($page, 0, 9) == 'settings_') … … 58 66 foreach ($mods_active as $mod) 59 67 { 68 // load all modules which need initialization 69 if (file_exists('mods/'.$mod.'/init.php')) 70 { 71 include('mods/'.$mod.'/init.php'); 72 } 60 73 if (file_exists('mods/'.$mod.'/'.$page.'.php')) 61 74 { -
dev/common/post.php
r157 r181 11 11 if (isset($_POST['killmail'])) 12 12 { 13 if ($_POST['password'] == $config->getPostPassword() || $page->isAdmin())13 if ($_POST['password'] == config::get('post_password') || $page->isAdmin()) 14 14 { 15 15 $parser = new Parser($_POST['killmail']); 16 16 17 17 // Filtering 18 if ( $config->getConfig("filter_apply"))18 if (config::get("filter_apply")) 19 19 { 20 $filterdate = $config->getConfig("filter_date");20 $filterdate = config::get("filter_date"); 21 21 $year = substr($_POST['killmail'], 0, 4); 22 22 $month = substr($_POST['killmail'], 5, 2); … … 65 65 elseif ($killid == -3) 66 66 { 67 $filterdate = date("j F Y", $config->getConfig("filter_date"));67 $filterdate = date("j F Y", config::get("filter_date")); 68 68 $html = "You are not allowed to post killmails older than $filterdate."; 69 69 } … … 76 76 $kill = new Kill($killid); 77 77 78 $mailer->From = "mailer@".$config->getConfig('mail_host'); 79 $mailer->FromName = $config->getConfig('mail_host'); 78 if (!$server = config::get('post_mailserver')) 79 { 80 $server = 'localhost'; 81 } 82 $mailer->From = "mailer@".config::get('post_mailhost'); 83 $mailer->FromName = config::get('post_mailhost'); 80 84 $mailer->Subject = "Killmail #" . $killid; 81 $mailer->Host = "localhost";85 $mailer->Host = $server; 82 86 $mailer->Port = 25; 83 $mailer->Helo = "localhost";87 $mailer->Helo = $server; 84 88 $mailer->Mailer = "smtp"; 85 $mailer->AddReplyTo("no_reply@". $config->getConfig('mail_host'), "No-Reply");86 $mailer->Sender = "mailer@". $config->getConfig('mail_host');89 $mailer->AddReplyTo("no_reply@".config::get('post_mailhost'), "No-Reply"); 90 $mailer->Sender = "mailer@".config::get('post_mailhost'); 87 91 $mailer->Body = $kill->getRawMail(); 88 $mailer->AddAddress( $config->getPostMailto());92 $mailer->AddAddress(config::get('post_mailhost')); 89 93 $mailer->Send(); 90 94 } 91 95 92 96 $qry = new DBQuery(); 93 $qry->execute("insert into kb3_log 94 values(".$killid.",'".KB_SITE."','".$_SERVER['REMOTE_ADDR']."', now())"); 97 $qry->execute("insert into kb3_log values(".$killid.",'".KB_SITE."','".$_SERVER['REMOTE_ADDR']."', now())"); 95 98 96 99 header("Location: ?a=kill_detail&kll_id=".$killid); … … 103 106 } 104 107 } 105 elseif (! $config->getConfig('post_forbid'))108 elseif (!config::get('post_forbid')) 106 109 { 107 110 $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."; -
dev/index.php
r93 r181 1 1 <?php 2 error_reporting(E_ALL ^ E_NOTICE);2 @error_reporting(E_ALL ^ E_NOTICE); 3 3 include('common/index.php'); 4 4 ?> -
dev/templates/admin_options_edit.tpl
r177 r181 2 2 <tr><td width="120"><b>{$opt.descr}:</b></td><td> 3 3 <input type="edit" id="option[{$opt.name}]" name="option[{$opt.name}]" 4 value="{$config->getConfig($opt.name)}" size=" 20" maxlength="80">4 value="{$config->getConfig($opt.name)}" size="{$options.size}" maxlength="{$options.maxlength}"> 5 5 {if $opt.hint} 6 6 ({$opt.hint}) -
dev/templates/battle_overview.tpl
r164 r181 33 33 <td class="kb-table-cell"><b><a href="?a=pilot_detail&plt_id={$pilot}">{$i.name}</a></b><br/>{$i.ship}</td> 34 34 {/if} 35 <td class="kb-table-cell"><b><a href="?a=corp_detail&crp_id={$i.cid}">{$i.corp}</a></b><br/><a href="?a=alliance_detail& kll_id={$i.aid}" style="font-weight: normal;">{$i.alliance}</a></td>35 <td class="kb-table-cell"><b><a href="?a=corp_detail&crp_id={$i.cid}">{$i.corp}</a></b><br/><a href="?a=alliance_detail&all_id={$i.aid}" style="font-weight: normal;">{$i.alliance}</a></td> 36 36 </tr> 37 37 {/foreach} … … 68 68 <td class="kb-table-cell"><b><a href="?a=pilot_detail&plt_id={$pilot}">{$i.name}</a></b><br/>{$i.ship}</td> 69 69 {/if} 70 <td class="kb-table-cell"><b><a href="?a=corp_detail&crp_id={$i.cid}">{$i.corp}</a></b><br/><a href="?a=alliance_detail& kll_id={$i.aid}" style="font-weight: normal;">{$i.alliance}</a></td>70 <td class="kb-table-cell"><b><a href="?a=corp_detail&crp_id={$i.cid}">{$i.corp}</a></b><br/><a href="?a=alliance_detail&all_id={$i.aid}" style="font-weight: normal;">{$i.alliance}</a></td> 71 71 </tr> 72 72 {/foreach}