Changeset 30
- Timestamp:
- 10/22/06 21:12:01 (14 years ago)
- Location:
- dev/common
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/admin.php
r22 r30 10 10 $page->setAdmin(); 11 11 12 $config = $killboard->getConfig();13 12 if ($_POST['submit']) 14 13 { … … 53 52 $config->setPostPassword($_POST['post_password']); 54 53 $config->setPostMailto($_POST['post_mailto']); 55 54 56 55 if ($_POST['filter_apply'] == "on") 57 { 56 { 58 57 $config->setConfig('filter_apply', '1'); 59 $config->setConfig('filter_date', mktime(0,0,0,$_POST['filter_month'],($_POST['filter_day'] > 31 ? 31 : $_POST['filter_day']),$_POST['filter_year'])); 60 }else{ 58 $config->setConfig('filter_date', mktime(0, 0, 0, $_POST['filter_month'], ($_POST['filter_day'] > 31 ? 31 : $_POST['filter_day']), $_POST['filter_year'])); 59 } 60 else 61 { 61 62 $config->setConfig('filter_apply', '0'); 62 63 $config->setConfig('filter_date', 0); … … 70 71 $html .= "<table class=kb-subtable>"; 71 72 $html .= "<tr><td width=120><b>Banner:</b></td><td><select id=style_banner name=style_banner>"; 73 72 74 $dir = "img/banners/"; 73 75 if (is_dir($dir)) … … 82 84 $html .= "<option value=\"" . $file . "\""; 83 85 if ($file == $config->getStyleBanner()) 86 { 84 87 $html .= " selected=\"selected\""; 88 } 85 89 $html .= ">" . $file . "</option>"; 86 90 } … … 91 95 $html .= "<option value=\"custom\""; 92 96 if ($config->getStyleBanner() == "custom") 97 { 93 98 $html .= " selected=\"selected\""; 99 } 94 100 $html .= ">custom</option></select></td></tr>"; 95 101 $html .= "<tr><td width=120><b>Style:</b></td><td><select id=style_name name=style_name>"; 102 96 103 $dir = "style/"; 97 104 if (is_dir($dir)) … … 104 111 { 105 112 if ($file == "." || $file == ".." || $file == ".svn") 113 { 106 114 continue; 115 } 107 116 $html .= "<option value=\"" . $file . "\""; 108 117 if ($file == $config->getStyleName()) 118 { 109 119 $html .= " selected=\"selected\""; 120 } 110 121 $html .= ">" . $file . "</option>"; 111 122 } … … 121 132 $html .= "<tr><td width=120><b>Display killpoints:</b></td><td><input type=checkbox name=kill_points id=kill_points"; 122 133 if ($config->getConfig('kill_points')) 134 { 123 135 $html .= " checked=\"checked\""; 136 } 124 137 $html .= "></td></tr>"; 125 138 $html .= "<tr><td width=120><b>Enable Comments:</b></td><td><input type=checkbox name=comments id=comments"; 126 139 if ($config->getConfig('comments')) 140 { 127 141 $html .= " checked=\"checked\""; 142 } 128 143 $html .= "></td></tr>"; 129 144 $html .= "<tr><td width=120><b>Require password for Comments:</b></td><td><input type=checkbox name=comments_pw id=comments_pw"; 130 145 if ($config->getConfig('comments_pw')) 146 { 131 147 $html .= " checked=\"checked\""; 148 } 132 149 $html .= "></td></tr>"; 133 150 … … 143 160 $html .= "<tr><td width=120><b>Post password:</b></td><td><input type=text name=post_password id=post_password size=20 maxlength=20 value=\"" . $config->getPostPassword() . "\"></td></tr>"; 144 161 $html .= "<tr><td width=120><b>Killmail CC:</b></td><td><input type=text name=post_mailto id=post_mailto size=20 maxlength=80 value=\"" . $config->getPostMailto() . "\"> (e-mail address)</td></tr>"; 145 $html .= "<tr><td width=120><b>Disallow any killmails before:</b></td><td>" . dateSelector($config->getConfig('filter_apply'), $config->getConfig('filter_date')) . "</td></tr>";162 $html .= "<tr><td width=120><b>Disallow any killmails before:</b></td><td>" . dateSelector($config->getConfig('filter_apply'), $config->getConfig('filter_date')) . "</td></tr>"; 146 163 $html .= "</table>"; 147 164 … … 158 175 $page->generate(); 159 176 160 function dateSelector($apply,$date){ 161 if($date > 0){ 162 $date = getdate($date); 163 }else{ 177 function dateSelector($apply, $date) 178 { 179 if ($date > 0) 180 { 181 $date = getdate($date); 182 } 183 else 184 { 164 185 $date = getdate(); 165 } 186 } 166 187 $html = "<input type=\"text\" name=\"filter_day\" id=\"filter_day\" style=\"width:20px\" value=\"{$date['mday']}\"/> "; 167 188 $html .= "<select name=\"filter_month\" id=\"filter_month\">"; 168 for($i=1;$i<=12;$i++){ 169 $t = mktime(0,0,0,$i,1,1980); 170 $month = date("M",$t); 171 if($date['mon'] == $i) $selected = " selected=\"selected\""; else $selected = ""; 189 for ($i = 1; $i <= 12; $i++) 190 { 191 $t = mktime(0, 0, 0, $i, 1, 1980); 192 $month = date("M", $t); 193 if($date['mon'] == $i) 194 { 195 $selected = " selected=\"selected\""; 196 } 197 else 198 { 199 $selected = ""; 200 } 201 172 202 $html .= "<option value=\"$i\"$selected>$month</option>"; 173 203 } 174 204 $html .= "</select> "; 175 205 176 206 $html .= "<select name=\"filter_year\" id=\"filter_year\">"; 177 for($i=date("Y")-7;$i<=date("Y");$i++){ 178 if($date['year'] == $i) $selected = " selected=\"selected\""; else $selected = ""; 207 for ($i = date("Y")-7; $i <= date("Y"); $i++) 208 { 209 if ($date['year'] == $i) 210 { 211 $selected = " selected=\"selected\""; 212 } 213 else 214 { 215 $selected = ""; 216 } 179 217 $html .= "<option value=\"$i\"$selected>$i</option>"; 180 218 } 181 219 $html .= "</select> "; 182 220 $html .= "<input type=checkbox name=filter_apply id=filter_apply"; 183 if($apply=="1") $html .= " checked=\"checked\""; 184 $html .= "/>Apply "; 221 if ($apply) 222 { 223 $html .= " checked=\"checked\""; 224 } 225 $html .= "/>Apply "; 185 226 return $html; 186 227 } -
dev/common/admin_menu.php
r24 r30 8 8 $menubox->addOption("Synchronization", "?a=admin_sync"); 9 9 $menubox->addOption("Mods", "?a=admin_mods"); 10 $menubox->addOption("Kill Import", "?a=kill_import"); 10 11 //$menubox->addOption("Rental", "?a=admin_rental"); 11 12 ?> -
dev/common/class.page.php
r12 r30 20 20 $this->killboard_ = new Killboard(KB_SITE); 21 21 22 $this->session_ = new Session($_COOKIE['EVK_COOKIE'], 23 $_SERVER['REMOTE_ADDR']); 22 $this->session_ = new Session(); 24 23 25 24 $this->cachable_ = $cachable; -
dev/common/class.session.php
r10 r30 1 1 <?php 2 require_once( "db.php");2 require_once('db.php'); 3 3 4 4 class Session 5 5 { 6 function Session( $cookie, $ip)6 function Session() 7 7 { 8 $this->qry_ = new DBQuery(); 9 $this->sql_ = "select * 10 from kb3_sessions ses 11 where ses.ses_id = '" . $cookie . "' 12 and ses.ses_ip = '" . $ip . "'"; 8 if ($_REQUEST['PHPSESSID']) 9 { 10 session_start(); 11 } 12 // $this->qry_ = new DBQuery(); 13 // $this->sql_ = "select * 14 // from kb3_sessions ses 15 // where ses.ses_id = '" . $cookie . "' 16 // and ses.ses_ip = '" . $ip . "'"; 13 17 } 14 18 15 19 function isAdmin() 16 20 { 21 return isset($_SESSION['admin']); 22 17 23 $this->execQuery(); 18 24 return $this->qry_->recordCount() == 1; … … 21 27 function isSuperAdmin() 22 28 { 29 return isset($_SESSION['admin_super']); 30 23 31 $this->execQuery(); 24 32 return ($this->qry_->recordCount() == 1 && $this->row_['ses_super'] == 1); … … 27 35 function execQuery() 28 36 { 37 return true; 38 29 39 if (!$this->qry_->executed_) 30 40 $this->qry_->execute($this->sql_); … … 35 45 function cleanup() 36 46 { 47 return true; 48 37 49 $qry = new DBQuery(); 38 50 $qry->execute("delete from kb3_sessions … … 42 54 function create($super) 43 55 { 44 $current = time(); 45 $random = $_SERVER['REMOTE_ADDR'] . $current . KB_SITE; 46 $ses_id = md5($random); 47 48 if (!setcookie("EVK_COOKIE", $ses_id, 0)) 49 die("Unable to set cookie"); 50 51 $qry = new DBQuery(); 52 $qry->execute("insert into kb3_sessions values ('" . $ses_id . "', 53 '" . $_SERVER['REMOTE_ADDR'] . "', 54 now(), " . $super . " )"); 56 session_start(); 57 $_SESSION['admin'] = 1; 58 $_SESSION['admin_super'] = $super; 59 // $current = time(); 60 // $random = $_SERVER['REMOTE_ADDR'] . $current . KB_SITE; 61 // $ses_id = md5($random); 62 // 63 // if (!setcookie("EVK_COOKIE", $ses_id, 0)) 64 // die("Unable to set cookie"); 65 // 66 // $qry = new DBQuery(); 67 // $qry->execute("insert into kb3_sessions values ('" . $ses_id . "', 68 // '" . $_SERVER['REMOTE_ADDR'] . "', 69 // now(), " . $super . " )"); 55 70 } 56 71 } -
dev/common/comments.php
r16 r30 21 21 22 22 $pw = false; 23 if (!$config->getConfig('comments_pw') )23 if (!$config->getConfig('comments_pw') || $page->isAdmin()) 24 24 { 25 25 $pw = true; … … 27 27 if ($_POST['password'] == $config->getPostPassword() || $pw) 28 28 { 29 if ($_POST['comment'] == null)29 if ($_POST['comment'] == '') 30 30 { 31 31 $html .= "Error: Sillent type hey? good for you, bad for a comment."; … … 81 81 $html .= "<b>Name:</b>"; 82 82 $html .= "<input style=\"position:relative; right:-3px;\" class=\"comment-button\" name=\"name\" type=\"text\" size=\"24\" maxlength=\"24\"> "; 83 if ($config->getConfig('comments_pw') )83 if ($config->getConfig('comments_pw') && !$page->isAdmin()) 84 84 { 85 85 $html .= "<br><b>Password:</b>"; -
dev/common/index.php
r24 r30 1 1 <?php 2 require_once( "db.php");3 require_once( "class.killboard.php");2 require_once('db.php'); 3 require_once('class.killboard.php'); 4 4 5 $page = str_replace(".", "", $_GET['a']); 6 $page = str_replace("/", "", $page); 7 8 require_once("config.php"); 9 10 $killboard = new Killboard(KB_SITE); 11 //if ($killboard->isSuspended()) 12 // $page = "suspended"; 13 14 if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == "EVE-minibrowser" && $page != "igb" && $page != "post_igb" && $page != "portrait_grab" && $page != "bills") 15 $page = "igb"; 16 17 if ($page == "") 18 $page = "home"; 19 if(substr($page,0,9) == "settings_"){ 20 $settingsPage = true; 5 $page = str_replace('.', '', $_GET['a']); 6 $page = str_replace('/', '', $page); 7 if ($page == '') 8 { 9 $page = 'home'; 21 10 } 22 $config = $killboard->getConfig(); 23 $mods_active = explode(",",$config->getConfig("mods_active")); 24 $modOverrides = false; 25 foreach($mods_active as $mod){ 26 if(file_exists("mods/$mod/$page.php")){ 27 if($modOverrides) die("Error: Two or more of the mods you have activated are conflicting"); 28 $modOverrides = true; 29 $modOverride = $mod; 30 } 31 } 32 if(!$settingsPage && !file_exists("common/".$page.".php") && !$modOverrides){ 33 $page = "home"; 11 if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == 'EVE-minibrowser' && $page != 'igb' && $page != 'post_igb' && $page != 'portrait_grab' && $page != 'bills') 12 { 13 $page = 'igb'; 34 14 } 35 15 36 if (KB_CACHE == 1 && count($_POST) == 0 && !in_array($page, $cacheignore)) $docache = true; 16 require_once('config.php'); 17 $killboard = new Killboard(KB_SITE); 18 $config = $killboard->getConfig(); 19 // if ($killboard->isSuspended()) 20 // $page = 'suspended'; 21 22 if (substr($page, 0, 9) == 'settings_') 23 { 24 $settingsPage = true; 25 } 26 $mods_active = explode(',', $config->getConfig('mods_active')); 27 $modOverrides = false; 28 foreach ($mods_active as $mod) 29 { 30 if (file_exists('mods/'.$mod.'/'.$page.'.php')) 31 { 32 if ($modOverrides) 33 { 34 die('Error: Two or more of the mods you have activated are conflicting'); 35 } 36 $modOverrides = true; 37 $modOverride = $mod; 38 } 39 } 40 if (!$settingsPage && !file_exists('common/'.$page.'.php') && !$modOverrides) 41 { 42 $page = 'home'; 43 } 44 45 if (KB_CACHE == 1 && count($_POST) == 0 && !in_array($page, $cacheignore)) 46 { 47 $docache = true; 48 } 37 49 38 50 if ($docache) 39 51 { 40 if (!file_exists(KB_CACHEDIR . "/" . KB_SITE)) 41 @mkdir(KB_CACHEDIR . "/" . KB_SITE); 52 if (!file_exists(KB_CACHEDIR . '/' . KB_SITE)) 53 { 54 @mkdir(KB_CACHEDIR . '/' . KB_SITE); 55 } 42 56 43 if ($cachetimes[$page]) $cachetime = $cachetimes[$page]; 44 else $cachetime = 5; 57 if ($cachetimes[$page]) 58 { 59 $cachetime = $cachetimes[$page]; 60 } 61 else 62 { 63 $cachetime = 5; 64 } 45 65 46 66 $cachetime = $cachetime * 60; 47 67 48 $cachefile = KB_CACHEDIR . "/" . KB_SITE . "/" . md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . ".cache";68 $cachefile = KB_CACHEDIR . '/' . KB_SITE . '/' . md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '.cache'; 49 69 $timestamp = ((@file_exists($cachefile))) ? @filemtime($cachefile) : 0; 50 70 … … 60 80 } 61 81 62 if($settingsPage) include ("mods/" . substr($page,9,strlen($page)-9) . "/settings.php"); 63 elseif($modOverrides) include("mods/$modOverride/" . $page . ".php"); 64 else include("common/" . $page . ".php"); 82 if ($settingsPage) 83 { 84 include ('mods/'.substr($page, 9, strlen($page)-9).'/settings.php'); 85 } 86 elseif ($modOverrides) 87 { 88 include('mods/'.$modOverride.'/'.$page.'.php'); 89 } 90 else 91 { 92 include('common/'.$page.'.php'); 93 } 65 94 66 95 if ($docache) … … 68 97 $fp = @fopen($cachefile, 'w'); 69 98 @fwrite($fp, ob_get_contents()); 70 @fwrite($fp, "<!-- Generated from cache -->");99 @fwrite($fp, '<!-- Generated from cache -->'); 71 100 @fclose($fp); 72 101 ob_end_flush();