Show
Ignore:
Timestamp:
01/28/07 16:04:10 (14 years ago)
Author:
exi
Message:

Changed admin/options to show the actual page as page title.
admin_menu.php now also loads settings from mods.
Added event manager and the first 2 events (comment/killmail added).
Changed config to be in a separate file and modified it to be called static with config::get().
http_request now stores the socket status in $this->status.
Changed MapView? to store pictures based on KB_SITE so it doesnt show a map with wrong colors for the current killboard on a multi-site installation.
Changed options to handle element options (like 'edit:size:40').
Changed options to use the static calls to config.
Changed Page to use the static calls to config.
Changed Session to use session_name() to determine if it should start a session.
index.php now loads module-init-scripts.
Changed post.php to use config and it should now also use the mailserver configuration directive to send emails.
Added a mail_forward-mod to show how easy it can be to develop mods once there are enough events listed.
Fixed 2 typos in battle_overview.tpl.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/common/class.killboard.php

    r159 r181  
    11<?php 
    22require_once("db.php"); 
     3require_once('class.config.php'); 
    34 
    45class Killboard 
     
    5253    } 
    5354} 
    54  
    55 class Config 
    56 { 
    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_config 
    115                        where cfg_key = '".$key."' 
    116                                and cfg_site = '".$this->site_."'"); 
    117         if ($qry->recordCount()) 
    118         { 
    119             $sql = "update kb3_config 
    120                     set cfg_value = '".$value."' 
    121                     where cfg_site = '".$this->site_."' 
    122                         and cfg_key = '".$key."'"; 
    123         } 
    124         else 
    125         { 
    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 one 
    200  
    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 } 
    21055?>