Changeset 30 for dev/common/index.php

Show
Ignore:
Timestamp:
10/22/06 21:12:01 (14 years ago)
Author:
exi
Message:

Added base killmail importer, it takes killmails from a specified directory, 1 mail per file.
Changed session interface to php, that reduces siteload by one mysql query and offers room for page variables.
Removed the need to enter a password to post comments if you're logged in as admin.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/common/index.php

    r24 r30  
    11<?php 
    2 require_once("db.php"); 
    3 require_once("class.killboard.php"); 
     2require_once('db.php'); 
     3require_once('class.killboard.php'); 
    44 
    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); 
     7if ($page == '') 
     8{ 
     9    $page = 'home'; 
    2110} 
    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"; 
     11if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == 'EVE-minibrowser' && $page != 'igb' && $page != 'post_igb' && $page != 'portrait_grab' && $page != 'bills') 
     12{ 
     13    $page = 'igb'; 
    3414} 
    3515 
    36 if (KB_CACHE == 1 && count($_POST) == 0 && !in_array($page, $cacheignore)) $docache = true; 
     16require_once('config.php'); 
     17$killboard = new Killboard(KB_SITE); 
     18$config = $killboard->getConfig(); 
     19// if ($killboard->isSuspended()) 
     20// $page = 'suspended'; 
     21 
     22if (substr($page, 0, 9) == 'settings_') 
     23{ 
     24    $settingsPage = true; 
     25} 
     26$mods_active = explode(',', $config->getConfig('mods_active')); 
     27$modOverrides = false; 
     28foreach ($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} 
     40if (!$settingsPage && !file_exists('common/'.$page.'.php') && !$modOverrides) 
     41{ 
     42    $page = 'home'; 
     43} 
     44 
     45if (KB_CACHE == 1 && count($_POST) == 0 && !in_array($page, $cacheignore)) 
     46{ 
     47    $docache = true; 
     48} 
    3749 
    3850if ($docache) 
    3951{ 
    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    } 
    4256 
    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    } 
    4565 
    4666    $cachetime = $cachetime * 60; 
    4767 
    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'; 
    4969    $timestamp = ((@file_exists($cachefile))) ? @filemtime($cachefile) : 0; 
    5070 
     
    6080} 
    6181 
    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"); 
     82if ($settingsPage) 
     83{ 
     84    include ('mods/'.substr($page, 9, strlen($page)-9).'/settings.php'); 
     85} 
     86elseif ($modOverrides) 
     87{ 
     88    include('mods/'.$modOverride.'/'.$page.'.php'); 
     89} 
     90else 
     91{ 
     92    include('common/'.$page.'.php'); 
     93} 
    6594 
    6695if ($docache) 
     
    6897    $fp = @fopen($cachefile, 'w'); 
    6998    @fwrite($fp, ob_get_contents()); 
    70     @fwrite($fp, "<!-- Generated from cache -->"); 
     99    @fwrite($fp, '<!-- Generated from cache -->'); 
    71100    @fclose($fp); 
    72101    ob_end_flush();