Changeset 323
- Timestamp:
- Nov 28, 2011, 8:50:09 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config.sample.php
r303 r323 1 1 <?php 2 3 $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1')); 2 4 3 5 $Config = array -
trunk/database.php
r320 r323 35 35 var $insert_id; 36 36 var $LastQuery = ''; 37 var $ShowSQLError = false; 38 var $ShowSQLQuery = false; 37 39 38 40 function __construct($Host, $User, $Password, $Database) … … 51 53 function query($Query) 52 54 { 53 global $Config;54 55 55 $this->LastQuery = $Query; 56 if($ Config['Web']['ShowSQLQuery']== true)56 if($this->ShowSQLQuery == true) 57 57 echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>'."\n"); 58 58 $Result = new DatabaseResult(); 59 59 $Result->PDOStatement = $this->PDO->query($Query); 60 $Result->num_rows = $Result->PDOStatement->rowCount(); 61 if(($this->Error != '') and ($Config['Web']['ShowSQLError'] == true)) 62 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 63 60 if($Result) 61 { 62 $Result->num_rows = $Result->PDOStatement->rowCount(); 63 } else 64 { 65 $this->Error = $this->errorInfo[2]; 66 if(($this->Error != '') and ($this->ShowSQLError == true)) 67 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 68 } 64 69 return($Result); 65 70 } -
trunk/error.php
r245 r323 61 61 '<meta http-equiv="Content-Language" content="cs">'."\n". 62 62 '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"></head><body>'."\n". 63 'Došlo k vnitřní chybě!<br > O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br><br>');64 echo('<pre>'.$Error.'</pre><br >'); // V případě ladění chybu i zobraz63 'Došlo k vnitřní chybě!<br/> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br/><br/>'); 64 echo('<pre>'.$Error.'</pre><br/>'); // V případě ladění chybu i zobraz 65 65 echo('</body></html>'); 66 66 } -
trunk/global.php
r308 r323 1 1 <?php 2 2 3 $ScriptTimeStart = GetMicrotime(); 4 5 // SQL injection hack protection 6 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); 7 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); 8 9 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 10 include('config.php'); 11 include('database.php'); 3 $ConfigFileName = dirname(__FILE__).'/config.php'; 4 5 if(file_exists($ConfigFileName)) include_once($ConfigFileName); 6 else die('Nenalezen konfigurační soubor '.$ConfigFileName.'!'); 7 include_once('database.php'); 12 8 //include('error.php'); 13 9 include_once('code.php'); 14 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);15 $Database->Prefix = $Config['Database']['Prefix'];16 $Database->charset($Config['Database']['Charset']);17 10 include_once('module.php'); 18 11 include_once('forms.php'); 19 12 include_once('page.php'); 20 13 include_once('file.php'); 21 14 include_once('log.php'); 15 include_once('user.php'); 16 include_once('aktuality/news.php'); 17 include_once('webcam/webcam.php'); 18 include_once('finance/bills.php'); 19 include_once('finance/finance.php'); 20 22 21 $PrefixMultipliers = array 23 22 ( … … 192 191 } 193 192 194 $System = new System(); 195 $System->Config = $Config; 196 $System->Database = &$Database; 197 include_once('log.php'); 198 $System->AddModule(new Log()); 199 include_once('user.php'); 200 $System->AddModule(new User()); 201 if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check(); 202 include_once('aktuality/news.php'); 203 $System->AddModule(new News()); 204 include_once('webcam/webcam.php'); 205 $System->AddModule(new Webcam()); 206 include_once('finance/bills.php'); 207 $System->AddModule(new Bill()); 208 include_once('finance/finance.php'); 209 $System->AddModule(new Finance()); 210 $System->Modules['Finance']->LoadMonthParameters(0); 193 function GlobalInit() 194 { 195 global $Config, $Database, $System, $ScriptTimeStart, $ConfigFileName; 196 197 $ScriptTimeStart = GetMicrotime(); 198 // SQL injection hack protection 199 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); 200 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); 201 202 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 203 204 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 205 $Database->Prefix = $Config['Database']['Prefix']; 206 $Database->charset($Config['Database']['Charset']); 207 $Database->ShowSQLError = $Config['Web']['ShowSQLError']; 208 $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 209 210 $System = new System(); 211 $System->Config = $Config; 212 $System->Database = &$Database; 213 $System->AddModule(new Log()); 214 $System->AddModule(new User()); 215 if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check(); 216 $System->AddModule(new News()); 217 $System->AddModule(new Webcam()); 218 $System->AddModule(new Bill()); 219 $System->AddModule(new Finance()); 220 $System->Modules['Finance']->LoadMonthParameters(0); 221 } 211 222 212 223 $MonthNames = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'); … … 506 517 } 507 518 519 GlobalInit(); 520 508 521 ?> -
trunk/page.php
r256 r323 4 4 { 5 5 var $TimeStart; 6 var $FormatHTML = false; 7 var $ShowRuntimeInfo = false; 6 8 var $PathTree = array('Rozcestník', 7 9 'index.php' => '', … … 88 90 'mapa.php' => 'Mapa webu', 89 91 ); 92 93 function __construct() 94 { 95 global $Config; 96 97 $this->FormatHTML = $Config['Web']['FormatHTML']; 98 $this->ShowRuntimeInfo = $Config['Web']['ShowRuntimeInfo']; 99 } 90 100 91 101 function SystemMessage($Title, $Text) … … 157 167 $Output = '<div id="Footer"> 158 168 <i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' |'; 159 if($this->S ystem->Config['Web']['ShowRuntimeInfo']== true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';169 if($this->ShowRuntimeInfo == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |'; 160 170 $Output .= '</i></div></body></html>'; 161 171 return($Output); … … 164 174 function GetOutput() 165 175 { 166 global $Config;167 168 176 $Output = $this->Show(); 169 177 $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output; 170 178 $Output .= $this->ShowFooter(); 171 if($ Config['Web']['FormatHTML']== true) echo($this->FormatOutput($Output));179 if($this->FormatHTML == true) echo($this->FormatOutput($Output)); 172 180 else echo($Output); 173 181 }
Note:
See TracChangeset
for help on using the changeset viewer.