Changeset 455 for trunk/includes/global.php
- Timestamp:
- Apr 13, 2010, 10:03:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global.php
r454 r455 15 15 16 16 include_once(dirname(__FILE__).'/config.php'); 17 include_once(dirname(__FILE__).'/error.php'); 18 include_once(dirname(__FILE__).'/databaseconection.php'); 17 include_once(dirname(__FILE__).'/Database.php'); 19 18 include_once(dirname(__FILE__).'/global_function.php'); 20 19 include_once(dirname(__FILE__).'/rss.php'); … … 22 21 include_once(dirname(__FILE__).'/user.php'); 23 22 24 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);25 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);26 $Database->SelectDatabase($Config['Database']['Database']);27 28 $TranslationTree = GetTranslationTree();29 $LanguageList = GetLanguageList();30 31 23 $System = new System(); 32 24 $System->Init(); 33 25 $User = new User($System); 34 26 27 include_once(dirname(__FILE__).'/error.php'); 28 29 $TranslationTree = GetTranslationTree(); 30 $LanguageList = GetLanguageList(); 31 35 32 function GetMicrotime() 36 33 { … … 41 38 function ShowShoutbox() 42 39 { 43 global $ Database, $Config, $User, $System;40 global $System, $Config, $User, $System; 44 41 45 42 echo('<strong><a href="'.$System->Link('/action.php?action=ShoutBoxView').'">Kecátko:</a></strong>'); … … 47 44 echo(' <a href="'.$System->Link('/action.php?action=shoutbox').'">Vložit</a>'); 48 45 echo('<div class="box"><table>'); 49 $ ID = $Database->SQLCommand('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');50 while($Line = mysql_fetch_assoc($ID))46 $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30'); 47 while($Line = $DbResult->fetch_assoc()) 51 48 echo('<tr><td><strong>'.$Line['User'].'</strong>: '.htmlspecialchars($Line['Text']).'</td></tr>'); 52 49 echo('</table></div>'); … … 55 52 function ShowTopBar() 56 53 { 57 global $Config, $ Database, $User, $System;54 global $Config, $System, $User, $System; 58 55 59 56 echo('<div class="Menu">'); … … 61 58 if($User->Licence(LICENCE_USER)) 62 59 { 63 $DbResult = $ Database->SQLCommand('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$User->Team);64 $Team = mysql_fetch_assoc($DbResult);60 $DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$User->Team); 61 $Team = $DbResult->fetch_assoc(); 65 62 66 63 //echo('<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>'); … … 159 156 function ShowTranslatedMenu() 160 157 { 161 global $TranslationTree, $ Config, $Database, $User, $System;158 global $TranslationTree, $User, $System; 162 159 163 160 echo('<strong>Překladové skupiny:</strong><br /><div id="TranslationMenu">'); … … 182 179 function ShowOnlineUserList() 183 180 { 184 global $ Database, $Moderators, $User;181 global $System, $Moderators, $User; 185 182 186 183 echo('Online překladatelé:<br />'); 187 $ ID = $Database->SQLCommand('SELECT `Name`, `GM`, `ID` FROM `User` WHERE `LastLogin` >= NOW() - 300 AND ((`LastLogout` < `LastLogin`) OR (ISNULL(`LastLogout`)))');188 while($DbUser = mysql_fetch_assoc($ID))184 $DbResult = $System->Database->query('SELECT `Name`, `GM`, `ID` FROM `User` WHERE `LastLogin` >= NOW() - 300 AND ((`LastLogout` < `LastLogin`) OR (ISNULL(`LastLogout`)))'); 185 while($DbUser = $DbResult->fetch_assoc()) 189 186 { 190 187 if($User->Licence(LICENCE_MODERATOR)) $Name = '<a href="user.php?user='.$DbUser['ID'].'">'.$DbUser['Name'].'</a>'; … … 197 194 function ShowPage() 198 195 { 199 global $User, $ Config, $Database, $RSSChannels, $PageFooterRequested, $System;200 201 echo('<?xml version="1.0" encoding="'.$ Config['Web']['Charset'].'"?>196 global $User, $RSSChannels, $PageFooterRequested, $System; 197 198 echo('<?xml version="1.0" encoding="'.$System->Config['Web']['Charset'].'"?> 202 199 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 203 200 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz">'. 204 201 '<head>'. 205 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$ Config['Web']['Charset'].'" />'.202 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$System->Config['Web']['Charset'].'" />'. 206 203 '<meta name="keywords" content="wow, quest, questy, questů, preklad, mangos, překlad, překládání, přeložený, přeložení, čeština, world of warcraft, open source, free, addon" />'. 207 '<meta name="description" content="'.$ Config['Web']['Title'].'" />'.204 '<meta name="description" content="'.$System->Config['Web']['Title'].'" />'. 208 205 '<meta name="robots" content="all" />'. 209 206 '<link rel="stylesheet" href="'.$System->Link('/style/style.css').'" type="text/css" media="all" />'. … … 213 210 foreach($RSSChannels as $Channel) 214 211 echo(' <link rel="alternate" title="'.$Channel['Title'].'" href="'.$Channel['URL'].'" type="application/rss+xml" />'); 215 echo('<title>'.$ Config['Web']['Title'].'</title>212 echo('<title>'.$System->Config['Web']['Title'].'</title> 216 213 </head> 217 214 <body>'); … … 268 265 function ShowFooter() 269 266 { 270 global $ Database, $Config, $ScriptStartTime, $PageFooterRequested, $User;267 global $System, $ScriptStartTime, $PageFooterRequested, $User; 271 268 272 269 if(isset($PageFooterRequested)) … … 291 288 292 289 echo('</td></tr>'); 293 if($ Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B <a href="http://validator.w3.org/check?uri='.htmlentities('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>');290 if($System->Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B <a href="http://validator.w3.org/check?uri='.htmlentities('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>'); 294 291 echo('</table>'. 295 292 '</body>'. 296 293 '</html>'); 297 $Database->Disconnect();298 294 $User->Store(); 299 295 }
Note:
See TracChangeset
for help on using the changeset viewer.