<?php // SQL injection hack protection foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); if(!isset($SessionDisable)) session_start(); include('config.php'); include('error.php'); include('database.php'); include('code.php'); $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); $Database->Prefix = $Config['Database']['Prefix']; $Database->charset($Config['Database']['Charset']); $Database->ShowError = TRUE; include('module.php'); include('page.php'); include('forms.php'); include('types/include.php'); include('lists/include.php'); include('base.php'); class System extends Module { var $Modules = array(); function ModulePresent($Name) { return(array_key_exists($Name, $this->Modules)); } function AddModule($Module) { global $Database; //echo('PÅ™idávám modul '.get_class($Module).'<br>'); $Module->System = &$this; $Module->Database = &$Database; $this->Modules[get_class($Module)] = $Module; } } $System = new System(); $System->Config = $Config; include_once('database_list.php'); $System->AddModule(new DatabaseList()); include_once('log.php'); $System->AddModule(new Log()); include_once('user.php'); $System->AddModule(new User()); $System->Modules['User']->Check(); $MonthNames = array('', 'Leden', 'Únor', 'BÅ™ezen', 'Duben', 'KvÄ›ten', 'ÄŒerven', 'ÄŒervenec', 'Srpen', 'ZářÃ', 'ŘÃjen', 'Listopad', 'Prosinec'); function GetMicrotime() { list($Usec, $Sec) = explode(" ", microtime()); return ((float)$Usec + (float)$Sec); } function ShowArray($Value) { echo('<pre style="font-size: 8pt;">'); print_r($Value); echo('</pre>'); } function TimeToMysqlDateTime($Time) { return(date('Y-m-d H:i:s', $Time)); } function MysqlDateTimeToTime($Time) { $Parts = explode(' ', $Time); $DateParts = explode('-', $Parts[0]); $TimeParts = explode(':', $Parts[1]); $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); return($Result); } function MysqlDateToTime($Time) { return(MysqlDateTimeToTime($Time.' 0:0:0')); } function HumanDate($Time) { $Date = explode(' ', $Time); $Parts = explode('-', $Date[0]); if($Date != '0000-00-00') return(($Parts[2] * 1).'.'.($Parts[1] * 1).'.'.$Parts[0]); else return(' '); } function PagesList($Page, $TotalCount) { global $Config; $URL = $_SERVER['QUERY_STRING']; $URLParts = explode('&', $URL); $URL = ''; foreach($URLParts as $Index => $Item) { $ItemParts = explode('=', $Item); if($ItemParts[0] != 'Page') $URL .= $Item.'&'; } $URL = '?'.$URL.'Page='; $Count = ceil($TotalCount / $Config['Web']['ItemsPerPage']); $Around = 10; $Result = ''; if($Count > 1) { if($Page > 0) { $Result .= '<a href="'.$URL.'0"><<</a> '; $Result .= '<a href="'.$URL.($Page - 1).'"><</a> '; } $PagesMax = $Count - 1; $PagesMin = 0; if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around; if($PagesMin < ($Page - $Around)) { $Result .= ' .. '; $PagesMin = $Page - $Around; } for($i = $PagesMin; $i <= $PagesMax; $i++) { if($i == $Page) $Result .= '<strong>'; $Result .= '<a href="'.$URL.$i.'">'.($i + 1).'</a> '; if($i == $Page) $Result .= '</strong>'; } if($PagesMax < ($Count - 1)) $Result .= ' .. '; if($Page < ($Count - 1)) { $Result .= '<a href="'.$URL.($Page + 1).'">></a> '; $Result .= '<a href="'.$URL.($Count - 1).'">>></a>'; } } return($Result); } function GetRemoteAddress() { if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'] ; else if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR']; else $IP = '0.0.0.0'; return($IP); } function IsInternetAddr() { $RemoteAddr = GetRemoteAddress(); $RemoteAddr = explode('.', $RemoteAddr); return(!(($RemoteAddr[0] == 192) and ($RemoteAddr[1] == 168))); } $UnitNames = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); function HumanSize($Value) { global $UnitNames; $UnitIndex = 0; while($Value > 1024) { $Value = round($Value / 1024, 3); $UnitIndex++; } return($Value.' '.$UnitNames[$UnitIndex]); } function SystemMessage($Title, $Text) { return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>'); //ShowFooter(); //die(); } ?>