Changeset 577 for trunk/includes/Page.php
- Timestamp:
- Sep 11, 2013, 10:37:54 PM (11 years ago)
- File:
-
- 1 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 }
Note:
See TracChangeset
for help on using the changeset viewer.