Changeset 148 for www/global.php
- Timestamp:
- Feb 15, 2009, 7:59:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/global.php
r145 r148 9 9 include('database.php'); 10 10 //include('error.php'); 11 include_once('code.php'); 11 12 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 12 13 $Database->Prefix = $Config['Database']['Prefix']; 13 14 $Database->charset($Config['Database']['Charset']); 14 include('module.php'); 15 //include('user.php'); 16 //$User = new User($Database); 17 //$User->Check(); 15 include_once('module.php'); 16 include_once('forms.php'); 17 include_once('page.php'); 18 19 class System extends Module 20 { 21 var $Modules = array(); 22 23 function ModulePresent($Name) 24 { 25 return(array_key_exists($Name, $this->Modules)); 26 } 27 28 function AddModule($Module) 29 { 30 global $Database; 31 32 //echo('Přidávám modul '.get_class($Module).'<br>'); 33 $Module->System = &$this; 34 $Module->Database = &$Database; 35 $this->Modules[get_class($Module)] = $Module; 36 } 37 } 38 39 $System = new System(); 40 $System->Config = $Config; 41 /* 42 include_once('log.php'); 43 $System->AddModule(new Log()); 44 include_once('user.php'); 45 $System->AddModule(new User()); 46 $System->Modules['User']->Check(); 47 include_once('aktuality/news.php'); 48 $System->AddModule(new News()); 49 include_once('webcam/webcam.php'); 50 $System->AddModule(new Webcam()); 51 include_once('finance/bills.php'); 52 $System->AddModule(new Bill()); 53 include_once('finance/finance.php'); 54 $System->AddModule(new Finance()); 55 */ 18 56 19 57 $MonthNames = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'); 20 58 21 $MaxSubnet = 7; 59 $MaxSubnet = $Config['Network']['MaxSubnetCount']; 60 61 $UnitNames = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); 22 62 63 function HumanSize($Value) 64 { 65 global $UnitNames; 66 67 $UnitIndex = 0; 68 while($Value > 1024) 69 { 70 $Value = round($Value / 1024, 3); 71 $UnitIndex++; 72 } 73 return($Value.' '.$UnitNames[$UnitIndex]); 74 } 75 23 76 function GetMicrotime() 24 77 { … … 120 173 { 121 174 if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'] ; 122 else $IP = $_SERVER['REMOTE_ADDR'];123 //if($IP == '127.0.0.1')175 else if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR']; 176 else $IP = '0.0.0.0'; 124 177 return($IP); 125 178 } … … 130 183 $RemoteAddr = explode('.', $RemoteAddr); 131 184 return(!(($RemoteAddr[0] == 192) and ($RemoteAddr[1] == 168))); 132 }133 134 // Funkce formatovani vystupu135 function FormatOutput($s)136 {137 $out = '';138 $nn = 0;139 $n = 0;140 while($s!='')141 {142 $start = strpos($s,'<');143 $end = strpos($s,'>');144 if($start != 0)145 {146 $end = $start-1;147 $start = 0;148 }149 $line = trim(substr($s,$start,$end+1));150 if(strlen($line)>0)151 if($line[0] == '<')152 {153 if($s[$start+1] == '/')154 {155 $n = $n - 2;156 $nn = $n;157 } else158 {159 if(strpos($line,' ')) $cmd = substr($line,1,strpos($line,' ')-1);160 else $cmd = substr($line,1,strlen($line)-2);161 //echo('['.$cmd.']');162 if(strpos($s,'</'.$cmd.'>')) $n = $n + 2;163 }164 }// else $line = '['.$line.']';165 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));166 if($line != '') $out .= (str_repeat(' ',$nn).$line."\n");167 $s = substr($s,$end+1,strlen($s));168 $nn = $n;169 }170 return($out);171 185 } 172 186
Note:
See TracChangeset
for help on using the changeset viewer.