1 | <?php
|
---|
2 |
|
---|
3 | class Page extends Module
|
---|
4 | {
|
---|
5 | var $TimeStart;
|
---|
6 | var $FormatHTML = false;
|
---|
7 | var $ShowRuntimeInfo = false;
|
---|
8 | var $PathTree = array('Rozcestník',
|
---|
9 | 'index.php' => '',
|
---|
10 | 'missing.php' => '',
|
---|
11 | 'manualy.php' => 'Manuály',
|
---|
12 | 'is' => array('',
|
---|
13 | 'topologie.php' => 'Topologie sítě',
|
---|
14 | 'dostupnost.php' => 'Dostupnost zařízení',
|
---|
15 | ),
|
---|
16 | 'network.php' => 'Technické informace',
|
---|
17 | 'map' => array('',
|
---|
18 | 'index.php' => 'Mapa sítě',
|
---|
19 | ),
|
---|
20 | 'network' => array('',
|
---|
21 | 'administration.php' => 'Administrace sítě',
|
---|
22 | 'dostupnost.php' => 'Dostupnost zařízení',
|
---|
23 | 'restart.php' => 'Restart služeb',
|
---|
24 | ),
|
---|
25 | 'nabidky_pripojeni.php' => 'Nabídky připojení',
|
---|
26 | 'telseznam.php' => 'Telefonní seznam',
|
---|
27 | 'merak.php' => 'Měřič spotřeby',
|
---|
28 | 'tkr.php' => 'Kanály kabelové televize',
|
---|
29 | 'LogShow.php' => 'Záznamy operací',
|
---|
30 | 'share' => array('Prohledat sdílení',
|
---|
31 | 'index.php' => '',
|
---|
32 | 'firefox.php' => 'Integrace do prohlížeče',
|
---|
33 | ),
|
---|
34 | 'hostlist.php' => 'Seznam počítačů',
|
---|
35 | 'userlist.php' => 'Seznam uživatelů',
|
---|
36 | 'farnost' => array('',
|
---|
37 | 'index.php' => 'Rozpis mší',
|
---|
38 | ),
|
---|
39 | 'finance' => array('Finance',
|
---|
40 | 'index.php' => '',
|
---|
41 | 'spotreba.php' => 'Spotřeba',
|
---|
42 | 'zivnost.php' => 'Daňová evidence',
|
---|
43 | 'prepocet.php' => 'Přepočet financí',
|
---|
44 | 'changes.php' => 'Změny',
|
---|
45 | 'tarify.php' => 'Tarify',
|
---|
46 | 'inventory.php' => 'Skladové zásoby',
|
---|
47 | 'clenove.php' => 'Seznam členů',
|
---|
48 | 'zarizeni.php' => 'Zařízení',
|
---|
49 | 'strom.php' => 'Strom zařízení',
|
---|
50 | 'srovnani.php' => 'Porovnání tarifů s konkurencí',
|
---|
51 | 'bills_manage.php' => 'Faktury',
|
---|
52 | 'monthly_overall.php' => 'Měsíční přehledy',
|
---|
53 | 'manage.php' => 'Správa financí',
|
---|
54 | 'faktury' => array('',
|
---|
55 | 'index.php' => 'Faktury za internet',
|
---|
56 | ),
|
---|
57 | ),
|
---|
58 | 'statistic' => array('',
|
---|
59 | 'trafficview.php' => 'Vytížení internetu',
|
---|
60 | 'index.php' => 'Statistika',
|
---|
61 | 'trafficview2.php' => 'Statistika',
|
---|
62 | 'bandwidth.php' => 'Zatížení internetu',
|
---|
63 | 'bandwidth_full.php' => 'Zatížení internetu všech počítačů',
|
---|
64 | ),
|
---|
65 | 'fotbal.php' => 'Fotbal',
|
---|
66 | 'webcam' => array('',
|
---|
67 | 'index.php' => 'Web kamera',
|
---|
68 | ),
|
---|
69 | 'navody.php' => 'Návody',
|
---|
70 | 'ukoly.php' => 'Plánované projekty',
|
---|
71 | 'otevreno.php' => 'Otvírací doby',
|
---|
72 | 'aktuality' => array('',
|
---|
73 | 'index.php' => 'Aktuality',
|
---|
74 | 'subscription.php' => 'RSS aktuality',
|
---|
75 | ),
|
---|
76 | 'sluzby.php' => 'Služby',
|
---|
77 | 'history.php' => 'Historie',
|
---|
78 | 'docs' => array('',
|
---|
79 | 'zapisy' => array('',
|
---|
80 | 'zapisy.php' => 'Zápisy ze schůzí',
|
---|
81 | ),
|
---|
82 | ),
|
---|
83 | 'jidelna' => array('',
|
---|
84 | 'index.php' => 'Jídelníček',
|
---|
85 | 'menuedit.php' => 'Editace jídelníčku',
|
---|
86 | ),
|
---|
87 | 'backup' => array('',
|
---|
88 | 'index.php' => 'Nastavení zálohování',
|
---|
89 | ),
|
---|
90 | 'mapa.php' => 'Mapa webu',
|
---|
91 | );
|
---|
92 |
|
---|
93 | function __construct()
|
---|
94 | {
|
---|
95 | global $Config;
|
---|
96 |
|
---|
97 | $this->FormatHTML = $Config['Web']['FormatHTML'];
|
---|
98 | $this->ShowRuntimeInfo = $Config['Web']['ShowRuntimeInfo'];
|
---|
99 | }
|
---|
100 |
|
---|
101 | function SystemMessage($Title, $Text)
|
---|
102 | {
|
---|
103 | return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div</td></tr></table>');
|
---|
104 | //ShowFooter();
|
---|
105 | //die();
|
---|
106 | }
|
---|
107 |
|
---|
108 | function ShowHeader($Title, $Path)
|
---|
109 | {
|
---|
110 | $ScriptName = $_SERVER['SCRIPT_NAME'];
|
---|
111 | while(strpos($ScriptName, '//') !== false)
|
---|
112 | $ScriptName = str_replace('//', '/', $ScriptName);
|
---|
113 | $PathTreePath = '/';
|
---|
114 | $PathTreeItem = $this->PathTree;
|
---|
115 | $Navigation = '<a href="'.$this->System->Config['Web']['RootFolder'].$PathTreePath.'">'.$PathTreeItem[0].'</a> > ';
|
---|
116 | $ScriptName = substr($ScriptName, strlen($this->System->Config['Web']['RootFolder']));
|
---|
117 | $ScriptNameParts = explode('/', $ScriptName);
|
---|
118 | array_shift($ScriptNameParts);
|
---|
119 | foreach($ScriptNameParts as $ScriptNamePart)
|
---|
120 | {
|
---|
121 | //echo($ScriptNamePart.'<br />');
|
---|
122 | if(array_key_exists($ScriptNamePart, $PathTreeItem))
|
---|
123 | {
|
---|
124 | if(is_array($PathTreeItem[$ScriptNamePart]))
|
---|
125 | {
|
---|
126 | $PathTreeItem = $PathTreeItem[$ScriptNamePart];
|
---|
127 | $PathTreePath .= $ScriptNamePart.'/';
|
---|
128 | if($PathTreeItem[0] != '')
|
---|
129 | $Navigation .= '<a href="'.$this->System->Config['Web']['RootFolder'].$PathTreePath.'">'.$PathTreeItem[0].'</a> > ';
|
---|
130 | } else
|
---|
131 | {
|
---|
132 | if($PathTreeItem[$ScriptNamePart] != '')
|
---|
133 | $Navigation .= '<a href="'.$this->System->Config['Web']['RootFolder'].$PathTreePath.$ScriptNamePart.'">'.$PathTreeItem[$ScriptNamePart].'</a> > ';
|
---|
134 | }
|
---|
135 | }
|
---|
136 | }
|
---|
137 | $Navigation = substr($Navigation, 0, -6);
|
---|
138 |
|
---|
139 | $BodyParam = '';
|
---|
140 | if(isset($this->Load)) $BodyParam .= ' onload="'.$this->Load.'"';
|
---|
141 | if(isset($this->Unload)) $BodyParam .= ' onunload="'.$this->Unload.'"';
|
---|
142 | $Output = '<?xml version="1.0" encoding="'.$this->System->Config['Web']['Charset'].'"?>'."\n".
|
---|
143 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
|
---|
144 | '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'.
|
---|
145 | '<head><link rel="stylesheet" href="'.$this->System->Config['Web']['RootFolder'].'/style/'.$this->System->Config['Web']['Style'].'/style.css" type="text/css" media="all" />'.
|
---|
146 | '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->System->Config['Web']['Charset'].'" />'.
|
---|
147 | '<script type="text/javascript" src="'.$this->System->Config['Web']['RootFolder'].'/style/'.$this->System->Config['Web']['Style'].'/global.js"></script>'.
|
---|
148 | '<title>'.$this->System->Config['Web']['Title'].' - '.$Path.'</title>
|
---|
149 | </head><body'.$BodyParam.'>
|
---|
150 | <div id="Title">'.$Title.'</div>
|
---|
151 | <div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
|
---|
152 | if($this->System->Config['Web']['UserSupport'] == 1)
|
---|
153 | {
|
---|
154 | if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId)
|
---|
155 | $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>';
|
---|
156 | else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>';
|
---|
157 | } else $Output .= ' ';
|
---|
158 | // <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
|
---|
159 | $Output .= '</div></div>';
|
---|
160 | return($Output);
|
---|
161 | }
|
---|
162 |
|
---|
163 | function ShowFooter()
|
---|
164 | {
|
---|
165 | global $ScriptTimeStart;
|
---|
166 | $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
|
---|
167 | $Output = '<div id="Footer">
|
---|
168 | <i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' |';
|
---|
169 | if($this->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 |';
|
---|
170 | $Output .= '</i></div></body></html>';
|
---|
171 | return($Output);
|
---|
172 | }
|
---|
173 |
|
---|
174 | function GetOutput()
|
---|
175 | {
|
---|
176 | $Output = $this->Show();
|
---|
177 | $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
|
---|
178 | $Output .= $this->ShowFooter();
|
---|
179 | if($this->FormatHTML == true) echo($this->FormatOutput($Output));
|
---|
180 | else echo($Output);
|
---|
181 | }
|
---|
182 |
|
---|
183 | // Funkce formatovani vystupu
|
---|
184 | function FormatOutput($s)
|
---|
185 | {
|
---|
186 | $out = '';
|
---|
187 | $nn = 0;
|
---|
188 | $n = 0;
|
---|
189 | while($s != '')
|
---|
190 | {
|
---|
191 | $start = strpos($s, '<');
|
---|
192 | $end = strpos($s, '>');
|
---|
193 | if($start != 0)
|
---|
194 | {
|
---|
195 | $end = $start - 1;
|
---|
196 | $start = 0;
|
---|
197 | }
|
---|
198 | $line = trim(substr($s, $start, $end + 1));
|
---|
199 | if(strlen($line) > 0)
|
---|
200 | if($line[0] == '<')
|
---|
201 | {
|
---|
202 | if($s[$start + 1] == '/')
|
---|
203 | {
|
---|
204 | $n = $n - 2;
|
---|
205 | $nn = $n;
|
---|
206 | } else
|
---|
207 | {
|
---|
208 | if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
|
---|
209 | else $cmd = substr($line, 1, strlen($line) - 2);
|
---|
210 | //echo('['.$cmd.']');
|
---|
211 | if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
|
---|
212 | }
|
---|
213 | }// else $line = '['.$line.']';
|
---|
214 | //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
|
---|
215 | if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
|
---|
216 | $s = substr($s, $end + 1, strlen($s));
|
---|
217 | $nn = $n;
|
---|
218 | }
|
---|
219 | return($out);
|
---|
220 | }
|
---|
221 | }
|
---|
222 |
|
---|
223 | ?>
|
---|