source: trunk/www/common/page.php@ 54

Last change on this file since 54 was 54, checked in by george, 16 years ago
  • Přeorganizování složek a rozhození souborů do podsložek model, common, design a style.
  • Upraveno: Rozpracované oddělení serverů na více světů.
File size: 4.3 KB
Line 
1<?php
2
3class Page extends Module
4{
5 var $TimeStart;
6
7 function SystemMessage($Title, $Text)
8 {
9 return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div</td></tr></table>');
10 //ShowFooter();
11 //die();
12 }
13
14 function ShowHeader($Title, $Path)
15 {
16 $BodyParam = '';
17 if(isset($this->Load)) $BodyParam .= ' onload="'.$this->Load.'"';
18 if(isset($this->Unload)) $BodyParam .= ' onunload="'.$this->Unload.'"';
19 $Output = '<?xml version="1.0" encoding="'.$this->System->Config['Web']['Charset'].'"?>'."\n".
20 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
21 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'.
22 '<head><link rel="stylesheet" href="'.$this->System->Config['Web']['RootFolder'].'/style.css" type="text/css" media="all" />'.
23 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->System->Config['Web']['Charset'].'" />'.
24 '<script type="text/javascript" src="'.$this->System->Config['Web']['RootFolder'].'/global.js"></script>'.
25 '<title>'.$this->System->Config['Web']['Title'].' - '.$Path.'</title>
26 </head><body'.$BodyParam.'>'.
27 '<div class="Navigation"><span class="MenuItem">'.
28 '<a href="?Action=Info">Informace</a>'.
29 ' <a href="?Action=State">Stav systému</a>'.
30 ' <a href="?Action=ServerList">Seznam serverů</a>'.
31 ' <a href="?Action=ClientList">Verze klienta</a>'.
32 ' <a href="?Action=EmulatorList">Verze emulátoru</a>';
33 $Output .= '</span><div class="MenuItem2">';
34 if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId)
35 $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>';
36 else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>'.
37 ' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
38 $Output .= '</div></div>';
39 return($Output);
40 }
41
42 function ShowFooter()
43 {
44 global $ScriptTimeStart;
45
46 $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
47 $Output = '<div id="Footer">
48 <i>| Založeno na projektu <a href="http://svn.zdechov.net/trac/wowhosting/">WoW hosting</a>'.
49 ' | <a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a>'.
50 ' | <a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Novinky</a>'.
51 ' | Správce: '.$this->System->Config['Web']['Admin'].
52 ' | E-mail: '.$this->System->Config['Web']['AdminEmail'];
53 if($this->System->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 |';
54 $Output .= '</i></div></body></html>';
55 return($Output);
56 }
57
58 function GetOutput()
59 {
60 global $Config;
61
62 $Output = $this->Show();
63 $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
64 $Output .= $this->ShowFooter();
65 if($Config['Web']['FormatHTML'] == true) echo($this->FormatOutput($Output));
66 else echo($Output);
67 }
68
69 // Funkce formatovani vystupu
70 function FormatOutput($Text)
71 {
72 $Indentation = 2;
73
74 $Output = '';
75 $Indent = 0;
76 $IndentNew = 0;
77 while($Text != '')
78 {
79 $Start = strpos($Text, '<');
80 $End = strpos($Text, '>');
81 if($Start != 0)
82 {
83 $End = $Start - 1;
84 $Start = 0;
85 }
86 $Line = trim(substr($Text, $Start, $End + 1));
87 if(strlen($Line) > 0)
88 if($Line[0] == '<')
89 {
90 if($Text[$Start + 1] == '/')
91 {
92 $IndentNew = $IndentNew - $Indentation;
93 $Indent = $IndentNew;
94 } else
95 {
96 if(strpos($Line, ' ')) $Command = substr($Line, 1, strpos($Line, ' ') - 1);
97 else $Command = substr($Line, 1, strlen($Line) - $Indentation);
98 if(strpos($Text, '</'.$Command.'>')) $IndentNew = $IndentNew + $Indentation;
99 }
100 }
101 if($Line != '') $Output .= (str_repeat(' ', $Indent).$Line."\n");
102 $Text = substr($Text, $End + 1, strlen($Text));
103 $Indent = $IndentNew;
104 }
105 return($Output);
106 }
107}
108
109?>
Note: See TracBrowser for help on using the repository browser.