Changeset 577 for trunk/includes
- Timestamp:
- Sep 11, 2013, 10:37:54 PM (12 years ago)
- Location:
- trunk/includes
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/Page.php
r566 r577 1 1 <?php 2 3 function ShowTopBar()4 {5 global $Config, $System, $User;6 7 $Output = '<div class="Menu">';8 if(!$User->Licence(LICENCE_USER))9 $Output .= '<div class="advert">'.$Config['Web']['Advertisement'].'</div>';10 $Output .= '<span class="MenuItem"></span>';11 if($User->Licence(LICENCE_USER))12 {13 //$DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$User->Team);14 //$Team = $DbResult->fetch_assoc();15 //$Output .= ''<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>';16 $Output .= '<span class="MenuItem2">'.$User->Name.' <a href="'.$System->Link('/?action=logout').'">Odhlášení</a>'.17 ' <a href="'.$System->Link('/user.php?user='.$User->Id).'">Moje stránka</a>'.18 ' <a href="'.$System->Link('/Options.php').'">Nastavení</a>'.19 ' <a title="Vámi přeložené texty" href="'.$System->Link('/TranslationList.php?user='.$User->Id.'&group=0&state=2&text=&entry=').'">Přeložené</a>'.20 ' <a title="Vaše rozpracované text" href="'.$System->Link('/TranslationList.php?user='.$User->Id.'&group=0&state=3&text=&entry=').'">Rozpracované</a>'.21 ' <a title="Nikým nepřeložené texty" href="'.$System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">Nepřeložené</a>'.22 '</span>';23 } else24 {25 $Output .= '<span class="MenuItem2"><form action="'.$System->Link('/?action=login').'" method="post"> '.26 'Jméno: <input type="text" name="LoginUser" size="8 " /> '.27 'Heslo: <td><input type="password" name="LoginPass" size="8" /> '.28 '<input type="submit" value="Přihlásit" /></form> '.29 '<a href="'.$System->Link('/registrace.php').'">Registrace</a></span>';30 }31 $Output .= '</div>';32 return($Output);33 }34 35 function ShowLoginBox()36 {37 global $User;38 39 $Output = '';40 if($User->Licence(LICENCE_USER))41 {42 // $Output .= 'Jste přihlášen jako: <b>'.$User->Id.'</b> <a href="index.php?Logout">Odhlásit</a>';43 } else44 {45 $Output .= '<strong>Přihlášení:</strong>46 <form action="" method="post">47 <table>48 <tr>49 <td><input type="text" name="LoginUser" size="13" /></td>50 </tr>51 <tr>52 <td><input type="password" name="LoginPass" size="13" /></td>53 </tr>54 <tr>55 <th><input type="submit" value="Přihlásit" /></th>56 </tr>57 </table>58 </form>';59 }60 return($Output);61 }62 63 function ShowSearchBox()64 {65 global $System;66 67 $Output = '<strong>Hledání:</strong>'.68 '<form action="'.$System->Link('/action.php').'" method="get"><div>'.69 '<input type="hidden" name="action" value="search" />'.70 '<table>'.71 '<tr>'.72 '<td><input type="text" name="search" size="13" /></td>'.73 '</tr>'.74 '<tr>'.75 '<th><input type="submit" value="Hledat" /></th>'.76 '</tr>'.77 '</table></div>'.78 '</form>';79 return($Output);80 }81 82 function ShowMainMenu()83 {84 global $Config, $User, $System;85 86 $Output = '<strong>Nabídka:</strong>'.87 '<div class="verticalmenu"><ul>';88 foreach($System->Menu as $MenuItem)89 if($User->Licence($MenuItem['Permission']))90 {91 if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';92 else $OnClick = '';93 if($MenuItem['Icon'] != '') $Icon = '<img src="'.$System->Link('/images/menu/'.$MenuItem['Icon']).'"/>';94 else $Icon = '';95 $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'.96 $MenuItem['Link'].'"'.$OnClick.'>'.$MenuItem['Title'].'</a></li>';97 }98 $Output .= '</ul></div>';99 return($Output);100 }101 102 function ShowTranslatedMenu()103 {104 global $TranslationTree, $User, $System;105 106 $Output = '<strong>Překladové skupiny:</strong><br /><div id="TranslationMenu">';107 $DbResult = $System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`');108 while($Group = $DbResult->fetch_assoc())109 {110 $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'.111 '<a href="'.$System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.$Group['Name'].'</a></div>'.112 '<div id="group'.$Group['Id'].'" class="hidden-menu-item" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">';113 $Output .= ' <a title="Zde můžete začít překládat" href="'.$System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user=0&entry=&text=').'">Nepřeložené</a><br />'.114 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.$System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&text=').'">Přeložené</a><br />';115 if($User->Licence(LICENCE_USER))116 {117 $Output .= ' <a title="Nedokončené překlady" href="'.$System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">Rozepsané</a><br />118 <a title="Všechny překlady, které jste přeložil" href="'.$System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user='.$User->Id).'&entry=&text=">Vlastní</a><br />';119 }120 $Output .= ' <a title="Sestavit speciální filtr" href="'.$System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">Filtr</a><br />';121 $Output .= '</div>';122 }123 $Output .= '</div>';124 return($Output);125 }126 127 function ShowHeader()128 {129 global $User, $System;130 131 $Output = '<?xml version="1.0" encoding="'.$System->Config['Web']['Charset'].'"?>132 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">133 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz">'.134 '<head>'.135 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$System->Config['Web']['Charset'].'" />'.136 '<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" />'.137 '<meta name="description" content="'.$System->Config['Web']['Title'].'" />'.138 '<meta name="robots" content="all" />'.139 '<link rel="stylesheet" href="'.$System->Link('/style/style.css').'" type="text/css" media="all" />'.140 '<script type="text/javascript" src="'.$System->Link('/style/global.js').'"></script>'.141 '<link rel="shortcut icon" href="'.$System->Link('/images/favicon.ico').'" />';142 foreach($System->RSSChannels as $Channel)143 {144 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'.145 $System->Link('/rss.php?channel='.$Channel['Channel']).'" type="application/rss+xml" />';146 }147 $Output .= '<title>'.$System->Config['Web']['Title'].'</title>148 </head>149 <body>';150 151 $Output .= ShowTopBar();152 $Output .= '<table class="page"><tr><td class="menu">';153 $Output .= ShowMainMenu();154 $Output .= $System->ModuleManager->Modules['User']->ShowOnlineList();155 $Output .= '<br />';156 $Output .= ShowSearchBox();157 $Output .= '</td><td id="border-left"></td><td class="content">';158 return($Output);159 }160 161 function ShowFooter()162 {163 global $System, $ScriptStartTime, $User, $Revision, $ReleaseTime;164 165 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2);166 167 $Output = '</td>'.168 '<td class="menu2">';169 $Output .= ShowTranslatedMenu();170 $Output .= '</td>'.171 '</tr><tr>'.172 '<td colspan="4" class="page-bottom">Verze: '.$Revision.' ('.HumanDate($ReleaseTime).')'.173 ' <a href="http://svn.zdechov.net/trac/wowpreklad/browser/trunk">Zdrojové soubory</a> '.174 '<a href="http://svn.zdechov.net/trac/wowpreklad/log/trunk?verbose=on">Novinky</a> '.175 $System->Config['Web']['WebCounter'];176 177 $Output .= '</td></tr>';178 if($System->Config['Web']['ShowRuntimeInfo'] == true)179 $Output .= '<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>';180 $Output .= '</table>'.181 '</body>'.182 '</html>';183 $User->Store();184 return($Output);185 }186 187 function ShowPage($Content)188 {189 global $Config;190 191 $Output = ShowHeader().$Content.ShowFooter();192 //if($Config['Web']['FormatOutput']) $Output = FormatOutput($Output);193 echo($Output);194 }195 196 function FormatOutput($s)197 {198 $out = '';199 $nn = 0;200 $n = 0;201 while($s != '')202 {203 $start = strpos($s, '<');204 $end = strpos($s, '>');205 if($start != 0)206 {207 $end = $start - 1;208 $start = 0;209 }210 $line = trim(substr($s, $start, $end + 1));211 if(strlen($line) > 0)212 if($line[0] == '<')213 {214 if($s[$start + 1] == '/')215 {216 $n = $n - 2;217 $nn = $n;218 } else219 {220 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);221 else $cmd = substr($line, 1, strlen($line) - 2);222 //echo('['.$cmd.']');223 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;224 }225 }// else $line = '['.$line.']';226 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));227 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");228 $s = substr($s, $end + 1, strlen($s));229 $nn = $n;230 }231 return($out);232 }233 2 234 3 class Page … … 253 22 { 254 23 $Output = $this->Show(); 255 if($this->RawPage == false) $Output = ShowPage($Output);256 else echo($Output);257 24 return($Output); 258 25 } -
trunk/includes/global.php
r573 r577 29 29 include_once(dirname(__FILE__).'/../Modules/News/News.php'); 30 30 include_once(dirname(__FILE__).'/../Modules/Wiki/Wiki.php'); 31 include_once(dirname(__FILE__).'/../Modules/Search/Search.php'); 31 32 include_once(dirname(__FILE__).'/../Modules/FrontPage/FrontPage.php'); 32 33 33 GlobalInit(); 34 $User = &$System->User; // Back compatibility 35 36 function GlobalInit() 37 { 38 global $System, $ScriptStartTime, $TranslationTree, $User, $StopAfterUpdateManager, 39 $UpdateManager, $Config, $DatabaseRevision; 40 41 $ScriptStartTime = GetMicrotime(); 42 43 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 44 45 if(!isset($Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.'); 46 date_default_timezone_set($Config['Web']['Timezone']); 47 34 35 // Back compatibility, will be removed 36 if(isset($InitSystem) and $InitSystem) 37 { 48 38 $System = new System(); 49 $System->Init(); 50 51 // Check database persistence structure 52 $UpdateManager = new UpdateManager(); 53 $UpdateManager->Database = $System->Database; 54 $UpdateManager->Revision = $DatabaseRevision; 55 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 56 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 57 58 // SQL injection hack protection 59 foreach($_POST as $Index => $Item) 60 { 61 if(is_array($_POST[$Index])) 62 foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2); 63 else $_POST[$Index] = addslashes($_POST[$Index]); 64 } 65 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 66 67 // TODO: Global initialized variable should be removed 68 $TranslationTree = GetTranslationTree(); 69 70 // Initialize application modules 71 $System->ModuleManager->RegisterModule(new ModuleError($System)); 72 $System->ModuleManager->Modules['Error']->ShowError = $Config['Web']['ShowPHPError']; 73 $System->ModuleManager->RegisterModule(new ModuleLog($System)); 74 $System->ModuleManager->RegisterModule(new ModuleUser($System)); 75 $System->ModuleManager->RegisterModule(new ModuleAoWoW($System)); 76 $System->ModuleManager->RegisterModule(new ModuleReferrer($System)); 77 $System->ModuleManager->Modules['Referrer']->Excluded[] = $System->Config['Web']['Host']; 78 $System->ModuleManager->RegisterModule(new ModuleTeam($System)); 79 $System->ModuleManager->RegisterModule(new ModuleDictionary($System)); 80 $System->ModuleManager->RegisterModule(new ModuleTranslation($System)); 81 $System->ModuleManager->RegisterModule(new ModuleImport($System)); 82 $System->ModuleManager->RegisterModule(new ModuleExport($System)); 83 $System->ModuleManager->RegisterModule(new ModuleServer($System)); 84 $System->ModuleManager->RegisterModule(new ModuleClientVersion($System)); 85 $System->ModuleManager->RegisterModule(new ModuleShoutBox($System)); 86 $System->ModuleManager->RegisterModule(new ModuleNews($System)); 87 $System->ModuleManager->RegisterModule(new ModuleWiki($System)); 88 $System->ModuleManager->RegisterModule(new ModuleFrontPage($System)); 89 $System->ModuleManager->StartAll(); 90 } 39 $System->DoNotShowPage = true; 40 $System->Run(); 41 } 42 43 class TempPage extends Page 44 { 45 function Show() 46 { 47 global $TempPageContent; 48 return($TempPageContent); 49 } 50 } 51 function ShowPage($Content) 52 { 53 global $TempPageContent, $System; 54 55 $TempPage = new TempPage($System); 56 $System->Pages['temporary-page'] = 'TempPage'; 57 $_SERVER['REDIRECT_QUERY_STRING'] = 'temporary-page'; 58 $TempPageContent = $Content; 59 $System->PathItems = ProcessURL(); 60 $System->ShowPage(); 61 } 62 91 63 92 64 function GetMicrotime() … … 634 606 635 607 $IconName = array( 636 MESSAGE_INFORMATION => 'information',608 MESSAGE_INFORMATION => 'information', 637 609 MESSAGE_WARNING => 'warning', 638 610 MESSAGE_CRITICAL => 'critical' -
trunk/includes/system.php
r573 r577 2 2 3 3 include_once('Database.php'); 4 5 class System 4 include_once('Application.php'); 5 6 class System extends Application 6 7 { 7 8 var $Database; … … 11 12 var $Menu; 12 13 var $RSSChannels; 14 var $DoNotShowPage; 13 15 14 16 function __construct() … … 17 19 $this->Menu = array(); 18 20 $this->RSSChannels = array(); 21 $this->DoNotShowPage = false; 19 22 } 20 23 … … 85 88 'Icon' => '', 86 89 ), 87 ); 90 ); 91 } 92 93 function Run() 94 { 95 global $System, $ScriptStartTime, $TranslationTree, $User, $StopAfterUpdateManager, 96 $UpdateManager, $Config, $DatabaseRevision; 97 98 $ScriptStartTime = GetMicrotime(); 99 100 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 101 102 if(!isset($Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.'); 103 date_default_timezone_set($Config['Web']['Timezone']); 104 105 $this->Init(); 106 107 // Check database persistence structure 108 $UpdateManager = new UpdateManager(); 109 $UpdateManager->Database = $this->Database; 110 $UpdateManager->Revision = $DatabaseRevision; 111 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 112 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 113 114 // SQL injection hack protection 115 foreach($_POST as $Index => $Item) 116 { 117 if(is_array($_POST[$Index])) 118 foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2); 119 else $_POST[$Index] = addslashes($_POST[$Index]); 120 } 121 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 88 122 123 // TODO: Global initialized variable should be removed 124 $TranslationTree = GetTranslationTree(); 125 126 // Initialize application modules 127 $this->ModuleManager->RegisterModule(new ModuleError($System)); 128 $this->ModuleManager->Modules['Error']->ShowError = $Config['Web']['ShowPHPError']; 129 $this->ModuleManager->RegisterModule(new ModuleLog($System)); 130 $this->ModuleManager->RegisterModule(new ModuleUser($System)); 131 $this->ModuleManager->RegisterModule(new ModuleAoWoW($System)); 132 $this->ModuleManager->RegisterModule(new ModuleReferrer($System)); 133 $this->ModuleManager->Modules['Referrer']->Excluded[] = $System->Config['Web']['Host']; 134 $this->ModuleManager->RegisterModule(new ModuleTeam($System)); 135 $this->ModuleManager->RegisterModule(new ModuleDictionary($System)); 136 $this->ModuleManager->RegisterModule(new ModuleTranslation($System)); 137 $this->ModuleManager->RegisterModule(new ModuleImport($System)); 138 $this->ModuleManager->RegisterModule(new ModuleExport($System)); 139 $this->ModuleManager->RegisterModule(new ModuleServer($System)); 140 $this->ModuleManager->RegisterModule(new ModuleClientVersion($System)); 141 $this->ModuleManager->RegisterModule(new ModuleShoutBox($System)); 142 $this->ModuleManager->RegisterModule(new ModuleNews($System)); 143 $this->ModuleManager->RegisterModule(new ModuleWiki($System)); 144 $this->ModuleManager->RegisterModule(new ModuleSearch($System)); 145 $this->ModuleManager->RegisterModule(new ModuleFrontPage($System)); 146 $this->ModuleManager->StartAll(); 147 $User = &$this->User; // Back compatibility, will be removed 148 149 $this->BaseView = new BaseView($this); 150 if($this->DoNotShowPage == false) 151 { 152 $this->PathItems = ProcessURL(); 153 $this->ShowPage(); 154 } 89 155 } 90 156 … … 157 223 { 158 224 $Page = new $ClassName($this); 159 $Page->GetOutput(); 225 $Output = $Page->GetOutput(); 226 if($Page->RawPage == false) $Output = $this->BaseView->ShowPage($Output); 227 echo($Output); 160 228 } else echo($this->PageNotFound()); 161 229 } 162 230 } 231 232 class BaseView extends View 233 { 234 function ShowTopBar() 235 { 236 $Output = '<div class="Menu">'; 237 if(!$this->System->User->Licence(LICENCE_USER)) 238 $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>'; 239 $Output .= '<span class="MenuItem"></span>'; 240 if($this->System->User->Licence(LICENCE_USER)) 241 { 242 //$DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team); 243 //$Team = $DbResult->fetch_assoc(); 244 //$Output .= ''<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>'; 245 $Output .= '<span class="MenuItem2">'.$this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">Odhlášení</a>'. 246 ' <a href="'.$this->System->Link('/user.php?user='.$this->System->User->Id).'">Moje stránka</a>'. 247 ' <a href="'.$this->System->Link('/Options.php').'">Nastavení</a>'. 248 ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='. 249 $this->System->User->Id.'&group=0&state=2&text=&entry=').'">Přeložené</a>'. 250 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='. 251 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">Rozpracované</a>'. 252 ' <a title="Nikým nepřeložené texty" href="'.$this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">Nepřeložené</a>'. 253 '</span>'; 254 } else 255 { 256 $Output .= '<span class="MenuItem2"><form action="'.$this->System->Link('/?action=login').'" method="post"> '. 257 'Jméno: <input type="text" name="LoginUser" size="8 " /> '. 258 'Heslo: <td><input type="password" name="LoginPass" size="8" /> '. 259 '<input type="submit" value="Přihlásit" /></form> '. 260 '<a href="'.$this->System->Link('/registrace.php').'">Registrace</a></span>'; 261 } 262 $Output .= '</div>'; 263 return($Output); 264 } 265 266 function ShowLoginBox() 267 { 268 $Output = ''; 269 if($this->System->User->Licence(LICENCE_USER)) 270 { 271 // $Output .= 'Jste přihlášen jako: <b>'.$tUser->Id.'</b> <a href="index.php?Logout">Odhlásit</a>'; 272 } else 273 { 274 $Output .= '<strong>Přihlášení:</strong> 275 <form action="" method="post"> 276 <table> 277 <tr> 278 <td><input type="text" name="LoginUser" size="13" /></td> 279 </tr> 280 <tr> 281 <td><input type="password" name="LoginPass" size="13" /></td> 282 </tr> 283 <tr> 284 <th><input type="submit" value="Přihlásit" /></th> 285 </tr> 286 </table> 287 </form>'; 288 } 289 return($Output); 290 } 291 292 function ShowSearchBox() 293 { 294 $Output = '<strong>Hledání:</strong>'. 295 '<form action="'.$this->System->Link('/search/').'" method="get"><div>'. 296 '<table>'. 297 '<tr>'. 298 '<td><input type="text" name="text" size="13" /></td>'. 299 '</tr>'. 300 '<tr>'. 301 '<th><input type="submit" value="Hledat" /></th>'. 302 '</tr>'. 303 '</table></div>'. 304 '</form>'; 305 return($Output); 306 } 307 308 function ShowMainMenu() 309 { 310 $Output = '<strong>Nabídka:</strong>'. 311 '<div class="verticalmenu"><ul>'; 312 foreach($this->System->Menu as $MenuItem) 313 if($this->System->User->Licence($MenuItem['Permission'])) 314 { 315 if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"'; 316 else $OnClick = ''; 317 if($MenuItem['Icon'] != '') $Icon = '<img src="'.$this->System->Link('/images/menu/'.$MenuItem['Icon']).'"/>'; 318 else $Icon = ''; 319 $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'. 320 $MenuItem['Link'].'"'.$OnClick.'>'.$MenuItem['Title'].'</a></li>'; 321 } 322 $Output .= '</ul></div>'; 323 return($Output); 324 } 325 326 function ShowTranslatedMenu() 327 { 328 global $TranslationTree; 329 330 $Output = '<strong>Překladové skupiny:</strong><br /><div id="TranslationMenu">'; 331 $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`'); 332 while($Group = $DbResult->fetch_assoc()) 333 { 334 $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'. 335 '<a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.$Group['Name'].'</a></div>'. 336 '<div id="group'.$Group['Id'].'" class="hidden-menu-item" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'; 337 $Output .= ' <a title="Zde můžete začít překládat" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user=0&entry=&text=').'">Nepřeložené</a><br />'. 338 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&text=').'">Přeložené</a><br />'; 339 if($this->System->User->Licence(LICENCE_USER)) 340 { 341 $Output .= ' <a title="Nedokončené překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">Rozepsané</a><br /> 342 <a title="Všechny překlady, které jste přeložil" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user='.$this->System->User->Id).'&entry=&text=">Vlastní</a><br />'; 343 } 344 $Output .= ' <a title="Sestavit speciální filtr" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">Filtr</a><br />'; 345 $Output .= '</div>'; 346 } 347 $Output .= '</div>'; 348 return($Output); 349 } 350 351 function ShowHeader() 352 { 353 $Output = '<?xml version="1.0" encoding="'.$this->System->Config['Web']['Charset'].'"?>'. 354 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'. 355 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz">'. 356 '<head>'. 357 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->System->Config['Web']['Charset'].'" />'. 358 '<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" />'. 359 '<meta name="description" content="'.$this->System->Config['Web']['Title'].'" />'. 360 '<meta name="robots" content="all" />'. 361 '<link rel="stylesheet" href="'.$this->System->Link('/style/style.css').'" type="text/css" media="all" />'. 362 '<script type="text/javascript" src="'.$this->System->Link('/style/global.js').'"></script>'. 363 '<link rel="shortcut icon" href="'.$this->System->Link('/images/favicon.ico').'" />'; 364 foreach($this->System->RSSChannels as $Channel) 365 { 366 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 367 $this->System->Link('/rss.php?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 368 } 369 $Output .= '<title>'.$this->System->Config['Web']['Title'].'</title>'. 370 '</head><body>'; 371 372 $Output .= $this->ShowTopBar(); 373 $Output .= '<table class="page"><tr><td class="menu">'; 374 $Output .= $this->ShowMainMenu(); 375 $Output .= $this->System->ModuleManager->Modules['User']->ShowOnlineList(); 376 $Output .= '<br />'; 377 $Output .= $this->ShowSearchBox(); 378 $Output .= '</td><td id="border-left"></td><td class="content">'; 379 return($Output); 380 } 381 382 function ShowFooter() 383 { 384 global $ScriptStartTime, $Revision, $ReleaseTime; 385 386 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 387 388 $Output = '</td>'. 389 '<td class="menu2">'; 390 $Output .= $this->ShowTranslatedMenu(); 391 $Output .= '</td>'. 392 '</tr><tr>'. 393 '<td colspan="4" class="page-bottom">Verze: '.$Revision.' ('.HumanDate($ReleaseTime).')'. 394 ' <a href="http://svn.zdechov.net/trac/wowpreklad/browser/trunk">Zdrojové soubory</a> '. 395 '<a href="http://svn.zdechov.net/trac/wowpreklad/log/trunk?verbose=on">Novinky</a> '. 396 $this->System->Config['Web']['WebCounter']; 397 398 $Output .= '</td></tr>'; 399 if($this->System->Config['Web']['ShowRuntimeInfo'] == true) 400 $Output .= '<tr><td colspan="3" style="text-align: center;">Doba generování: '. 401 $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '. 402 HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B <a href="http://validator.w3.org/check?uri='. 403 htmlentities('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>'; 404 $Output .= '</table>'. 405 '</body>'. 406 '</html>'; 407 $this->System->User->Store(); 408 return($Output); 409 } 410 411 function ShowPage($Content) 412 { 413 $Output = $this->ShowHeader().$Content.$this->ShowFooter(); 414 //if($this->System->Config['Web']['FormatOutput']) $Output = $this->FormatOutput($Output); 415 return($Output); 416 } 417 418 function FormatOutput($s) 419 { 420 $out = ''; 421 $nn = 0; 422 $n = 0; 423 while($s != '') 424 { 425 $start = strpos($s, '<'); 426 $end = strpos($s, '>'); 427 if($start != 0) 428 { 429 $end = $start - 1; 430 $start = 0; 431 } 432 $line = trim(substr($s, $start, $end + 1)); 433 if(strlen($line) > 0) 434 if($line[0] == '<') 435 { 436 if($s[$start + 1] == '/') 437 { 438 $n = $n - 2; 439 $nn = $n; 440 } else 441 { 442 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 443 else $cmd = substr($line, 1, strlen($line) - 2); 444 //echo('['.$cmd.']'); 445 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2; 446 } 447 }// else $line = '['.$line.']'; 448 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 449 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); 450 $s = substr($s, $end + 1, strlen($s)); 451 $nn = $n; 452 } 453 return($out); 454 } 455 }
Note:
See TracChangeset
for help on using the changeset viewer.