Changeset 152 for www/index.php
- Timestamp:
- Feb 16, 2009, 2:09:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/index.php
r148 r152 2 2 3 3 include_once('global.php'); 4 include_once('style.php'); 5 ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Rozcestník'); 6 7 $Database->select_db('share'); 8 9 function CategoryItemCompare($Item1, $Item2) 4 5 class IndexPage extends Page 10 6 { 11 if ($Item1['Index'] == $Item2['Index']) return(0); 12 return ($Item1['Index'] > $Item2['Index']) ? -1 : 1; 13 } 14 15 // Process cookies 16 if(array_key_exists('Action', $_GET)) 17 { 18 if($_GET['Action'] == 'CustomizeNewsSave') 19 { 20 $Checkbox = array('' => 0, 'on' => 1); 21 // print_r($_POST); 22 $Setting = array(); 23 for($I = 0; $I < $_POST['NewsCategoryCount']; $I++) 24 { 25 if(($_POST['NewsCategoryDaysAgo'.$I]*1) < 0) $_POST['NewsCategoryIndex'.$I] = 0; 26 if(($_POST['NewsCategoryCount'.$I]*1) < 0) $_POST['NewsCategoryCount'.$I] = 0; 27 if(!array_key_exists('NewsCategoryEnabled'.$I, $_POST)) $_POST['NewsCategoryEnabled'.$I] = ''; 28 $Setting[] = array('CategoryId' => $_POST['NewsCategoryId'.$I], 'Enabled' => $Checkbox[$_POST['NewsCategoryEnabled'.$I]], 'ItemCount' => ($_POST['NewsCategoryCount'.$I]*1), 'DaysAgo' => ($_POST['NewsCategoryDaysAgo'.$I]*1), 'Index' => ($_POST['NewsCategoryIndex'.$I]*1)); 29 } 30 // Sort indexes 31 usort($Setting, 'CategoryItemCompare'); 32 $Setting = array_reverse($Setting); 33 // Normalize indexes 34 foreach($Setting as $Index => $Item) 35 $Setting[$Index]['Index'] = $Index + 1; 36 37 // print_r($Setting); 38 39 // Store new cookie value 40 $_COOKIE['NewsSetting'] = serialize($Setting); 41 setcookie('NewsSetting', $_COOKIE['NewsSetting']); 42 } else 43 if($_GET['Action'] == 'LoginForm') 44 { 45 $Output = ' 46 <form action="?Action=Login" method="post"> 47 <table class="hidden"> 48 <tr align="left"><td colspan="2">Jméno:</td></tr> 49 <tr align="left"><td colspan="2"><input type="text" name="Username" size="40" maxlength="16" /></td></tr> 50 <tr align="left"><td colspan="2">Heslo:</td></tr> 51 <tr align="left"><td colspan="2"><input type="password" name="Password" size="40" maxlength="16" /></td></tr> 52 <tr><td colspan="2"> </td></tr> 53 <tr align="left"> 54 <td><input type="checkbox" name="remember" value="1" checked="checked" /> Trvalé přihlášení</td> 7 var $Dependencies = array('News'); 8 var $FullTitle = '<strong>ZděchovNET</strong> - komunitní počítačová síť'; 9 var $ShortTitle = 'Rozcestník'; 10 var $Links = array( 11 'main' => array('Důležité odkazy', 12 array('Finance', '/finance/', 'money.gif'), 13 array('Statistika', 'http://stat.zdechov.net/centrala/', 'chart.gif'), 14 array('Prohledat sdílení', '/share/', 'prohledavac_sdileni.gif', array('Share', 'Display')), 15 array('Seznam uživatelů', '/userlist.php', 'comp.gif'), 16 array('Seznam počítačů', '/hostlist.php', 'comp.gif'), 17 array('Historie chatu', '/chat/history.php', 'sunrisechat.gif', array('Chat', 'Display')), 18 array('Webový chat', 'http://embed.mibbit.com/?server=game.zdechov.net%3A6667&channel=%23zdechov&forcePrompt=true&charset=utf-8', 'sunrisechat.gif'), 19 array('Diskusní fórum', '/forum/', 'discus.gif'), 20 array('WebMail', '/webmail/', 'openwebmail.gif'), 21 array('Jídelníček', '/jidelna/', 'apple.gif'), 22 array('Televize', 'http://tv.zdechov.net/', 'clear.gif'), 23 array('Herní server', 'http://game-server.zdechov.net/', 'cube.gif'), 24 array('Rozpis mší', 'http://farnost.zdechov.net/', 'cfix.gif'), 25 array('Telefonní seznam', '/telseznam.php', 'tel.gif'), 26 array('Mapa Zděchova', 'http://www.mapy.cz/#x=141560832@y=133134848@z=13@mm=FP@sa=s@st=s@ssq=zd%C4%9Bchov@sss=1@ssp=120738725_123701121_150360997_149800833', 'clear.gif'), 27 array('Otvírací doby', '/otevreno.php', 'otv_doby.gif'), 28 array('Topologie sítě', '/is/topologie.php', 'topologie.gif'), 29 array('Dostupnost sítě', '/network/dostupnost.php', 'satellite.gif'), 30 array('Technické informace', '/network.php', 'tech.gif'), 31 array('Fotbal Sokol Zděchov', 'http://fotbal.zdechov.net/', 'socer.gif'), 32 array('Webkamera', '/webcam/', 'clear.gif'), 33 array('Stránky naší sítě', 'http://www.zdechov.net/', 'clear.gif'), 34 ), 35 'other' => array('Další odkazy', 36 array('Kanály kabelovky', '/tkr.php', 'tv.gif'), 37 array('Historie sítě', '/history.php', 'clear.gif'), 38 array('Měřič spotřeby', '/merak.php', 'electric.gif'), 39 array('Plány do budoucna', '/ukoly.php', 'clear.gif'), 40 ), 41 'search' => array('Vyhledávání', 42 array('Google', 'http://www.google.cz/', 'www_google_com.gif'), 43 array('Morfeo', 'http://morfeo.centrum.cz/', 'morfeo.png'), 44 array('Centrum', 'http://www.centrum.cz/', 'www_centrum_cz.gif'), 45 array('Seznam', 'http://www.seznam.cz/', 'www_seznam_cz.gif'), 46 array('Atlas', 'http://www.atlas.cz/', 'www_atlas_cz.gif'), 47 array('Tiscali', 'http://www.tiscali.cz/', 'www_tiscali_cz.gif'), 48 ), 49 'usefull' => array('Užitečné', 50 array('Mapa ČR', 'http://www.mapy.cz/', 'clear.gif'), 51 array('Online TV', 'http://www.tvinfo.cz/live/televize/cz/', 'www_tvinfo_cz.gif'), 52 array('Jízdní řády', 'http://jizdnirady.idnes.cz/', 'www_idos_cz.gif'), 53 array('TV programy', 'http://tv.atlas.cz/', 'www_atlas_cz.gif'), 54 array('ICQ', 'javascript:openClient(\'flash\')', 'www_icq_com.gif'), 55 array('Slovníky', 'http://slovniky.centrum.cz/', 'www_centrum_cz.gif'), 56 array('Počasí', 'http://www.meteopress.cz/', 'pocasi.gif'), 57 array('T-Mobile SMS', 'http://www.tzones.cz/', 'www_tzones_cz.gif'), 58 array('Knihovna Vsetín', 'http://www.mvk.cz/', 'www_mvk_cz.png'), 59 ), 60 'fun' => array('Zábava', 61 array('Youtube', 'http://www.youtube.com/', 'clear.gif'), 62 array('Last.fm', 'http://www.last.fm/', 'clear.gif'), 63 ), 64 /*'computers' => array('Prodej počítačů', 65 array('SOFTCOM', 'http://www.softcom.cz/', 'www_computershop_cz.png'), 66 array('Alfacomp', 'http://www.alfacomp.cz/php/zbozi.php?akc=2', 'www_alfacomp_cz.gif'), 67 array('Petracomp', 'http://www.petracomp.cz/', 'www_petracomp_cz.png'), 68 array('TS Bohemia', 'http://interlink.tsbohemia.cz/', 'www_tsbohemia_cz.png'), 69 ), 70 */ 71 ); 72 73 function ShowLinks($LinkGroup) 74 { 75 $Result = ''; 76 //foreach($this->Links as $LinkGroup) 77 //{ 78 $Title = array_shift($LinkGroup); 79 $Result .= '<div class="PanelTitle">'.$Title.':</div>'; 80 foreach($LinkGroup as $Link) 81 { 82 if(substr($Link[1], 0, 4) != 'http') $Link[1] = $this->System->Config['Web']['RootFolder'].$Link[1]; 83 if(!isset($Link[3]) or (isset($Link[3]) and $this->System->Modules['User']->CheckPermission($Link[3][0], $Link[3][1]))) 84 $Result .= '<img alt="'.$Link[0].'" src="images/favicons/'.$Link[2].'" width="16" height="16" /> <a href="'.$Link[1].'">'.$Link[0].'</a><br />'; 85 } 86 //} 87 return($Result); 88 } 89 90 function InfoBar() 91 { 92 $this->Database->select_db('is'); 93 94 $Output2 = ''; 95 96 $DbResult = $this->Database->select('hosts', 'COUNT(*)', 'show_online=1'); 97 $DbRow = $DbResult->fetch_array(); 98 $TotalComputers = $DbRow[0]; 99 100 $DbResult = $this->Database->select('hosts', 'COUNT(*)', 'show_online=1 AND online=1'); 101 $DbRow = $DbResult->fetch_array(); 102 $OnlineComputers = $DbRow[0]; 103 104 $Output = '<img alt="" src="images/favicons/comp.gif" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' '; 105 106 $DbResult = $this->Database->select('users', 'COUNT(*)', 'role=2'); 107 $DbRow = $DbResult->fetch_array(); 108 $TotalUser = $DbRow[0]; 109 110 $DbResult = $this->Database->select('hosts', 'COUNT(DISTINCT(user))', 'show_online=1 AND online=1'); 111 $DbRow = $DbResult->fetch_array(); 112 $OnlineUser = $DbRow[0]; 113 114 $Output .= '<img alt="" src="images/favicons/house.gif" width="16" height="16" /> '.$OnlineUser.' / '.$TotalUser.' '; 115 116 $NetworkUsage = 0; 117 $Output .= '<img alt="" src="images/favicons/usage.gif" width="16" height="16" /> '.$NetworkUsage.' % '; 118 119 //$Output .= 'Server běží: '.$this->GetServerUptime().' '; 120 121 if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) 122 { 123 $DbResult = $this->Database->select('users', 'cash', 'User='.$this->System->Modules['User']->User['Id']); 124 if($DbResult->num_rows > 0) 125 { 126 $DbRow = $DbResult->fetch_array(); 127 $Finance = $DbRow[0]; 128 $Output2 .= ' <img alt="" src="images/favicons/money.gif" width="16" height="16" /> '.$Finance.' Kč'; 129 } 130 } 131 132 $Output = '<div class="Navigation"><span class="MenuItem">'.$Output.'</span><div class="MenuItem2"> '.$Output2.'</div></div>'; 133 return($Output); 134 } 135 136 function UserPanel() 137 { 138 $Output = '<div class="PanelTitle">Nabídka uživatele:</div>'. 139 '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení účtu</a><br />'. 140 '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/user_state.php">Stav financí</a><br />'. 141 '<a href="'.$this->System->Config['Web']['RootFolder'].'/network/user_hosts.php">Registrované počítače</a><br />'. 142 '<a href="'.$this->System->Config['Web']['RootFolder'].'/aktuality/?action=add">Vložení aktuality</a><br />'; 143 if($this->System->Modules['User']->CheckPermission('EatingPlace', 'Edit')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/jidelna/menuedit.php">Editace jídelníčků</a><br />'; 144 if($this->System->Modules['User']->CheckPermission('Finance', 'Manage')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/manage.php">Správa financí</a><br />'; 145 if($this->System->Modules['User']->CheckPermission('Network', 'Administration')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/is/administration_page.php">Správa sítě</a><br />'; 146 return($Output); 147 } 148 149 function WebcamPanel() 150 { 151 $Output = '<div class="PanelTitle">Webkamery:</div>'; 152 $Output .= $this->System->Modules['Webcam']->ShowImage(); 153 return($Output); 154 } 155 156 // Zobrazení seznamu online počítačů 157 function OnlineHostList() 158 { 159 global $Database; 160 161 $Output = '<div class="PanelTitle">Online počítače:</div><span style="font-size: smaller;">'; 162 $DbResult = $Database->select('hosts', '*', 'online=1 AND show_online=1 ORDER BY name'); 163 while($Row = $DbResult->fetch_array()) 164 { 165 $Output .= $Row['name'].'<br />'; 166 } 167 $Output .= '</span>'; 168 return($Output); 169 } 170 171 /* 172 // Zobrazení seznamu neplaticich uzivatelu 173 function ShowBadPayerList() 174 { 175 $Output .= '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">'; 176 $DbResult = $Database->select('users', 'CONCAT(second_name, " ", first_name) as fullname', 'cash<0 AND role=2 ORDER BY cash'); 177 while($Row = $DbResult->fetch_array()) 178 { 179 $Output .= $Row['fullname'].'<br />'; 180 } 181 echo('</span>'); 182 return($Output); 183 } 184 */ 185 186 // Zobrazení času běhu počítače 187 function GetServerUptime() 188 { 189 $Data = explode(' ',exec('uptime')); 190 $Data = array_slice($Data,3,-8); 191 $Uptime = ''; 192 foreach($Data as $Item) 193 { 194 if(strpos($Item,':')) $Uptime .= substr($Item,0,-1).' hodin'; 195 else $Uptime .= $Item.' '; 196 } 197 $Uptime = str_replace('2 days,','2 dny a',$Uptime); 198 $Uptime = str_replace('3 days,','3 dny a',$Uptime); 199 $Uptime = str_replace('4 days,','4 dny a',$Uptime); 200 $Uptime = str_replace('days,','dní a',$Uptime); 201 $Uptime = str_replace('day,','den a',$Uptime); 202 $Uptime = str_replace('min,','minut',$Uptime); 203 return($Uptime); 204 } 205 206 function Show() 207 { 208 global $Database, $Config, $User; 209 210 $Database->select_db('share'); 211 //$Output = $this->InfoBar(); 212 213 // Process cookies 214 if(array_key_exists('Action', $_GET)) 215 { 216 if($_GET['Action'] == 'CustomizeNewsSave') 217 { 218 $Output .= $this->System->Modules['News']->CustomizeSave(); 219 } else 220 if($_GET['Action'] == 'LoginForm') 221 { 222 $Output .= '<form action="?Action=Login" method="post"><center><fieldset style="width: 500px;"><legend>Přihlašovací údaje</legend> 223 <table class="hidden"> 224 <tr align="left"><td colspan="2">Jméno:</td></tr> 225 <tr align="left"><td colspan="2"><input type="text" name="Username" size="40" maxlength="16" /></td></tr> 226 <tr align="left"><td colspan="2">Heslo:</td></tr> 227 <tr align="left"><td colspan="2"><input type="password" name="Password" size="40" maxlength="16" /></td></tr> 228 <tr><td colspan="2"> </td></tr> 229 <tr align="left"> 230 <td><input type="checkbox" name="remember" value="1" checked="checked" /> Trvalé přihlášení</td> 55 231 <td align="right"><input type="submit" value="Přihlásit" /></td> 56 232 </tr> … … 59 235 <td><a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></td> 60 236 </tr> 61 </table> 62 </form>'; 63 SystemMessage('Test', $Output); 64 } else 65 if($_GET['Action'] == 'Login') 66 { 67 SystemMessage('Přihlášení', $User->Login($_POST['Username'], $_POST['Password'])); 68 } else 69 if($_GET['Action'] == 'Logout') 70 { 71 SystemMessage('Odhlášení', $User->Logout()); 72 } else 73 if($_GET['Action'] == 'UserOptions') 74 { 75 76 $Output = '<center><fieldset style="width: 500px;"><legend>Základní nastavení</legend>'; 77 $Output .= '<form action="?Action=UserOptionsSave"><table>'; 78 $Output .= '<tr><td>Přihlašovací jméno:</td><td><input type="text" name="Name"></td><td>'; 79 $Output .= '<tr><td>Heslo:</td><td><input type="password" name="Password"></td><td>'; 80 $Output .= '<tr><td>Křestní jméno:</td><td><input type="text" name="FirstName"></td><td>'; 81 $Output .= '<tr><td>Příjmení:</td><td><input type="text" name="SecondName"></td><td>'; 82 $Output .= '<tr><td>E-mail:</td><td><input type="text" name="Email"></td><td>'; 83 $Output .= '<tr><td colspan="2" align="center"><input type="submit" value="Uložit" /></td></tr></table></form></fieldset></center>'; 84 echo($Output); 237 </table> 238 </fieldset></center> 239 </form>'; 240 // $Output .= $this->SystemMessage('Test', $Output); 241 } else 242 if($_GET['Action'] == 'Login') 243 { 244 $Output .= $this->SystemMessage('Přihlášení', $this->System->Modules['User']->Login($_POST['Username'], $_POST['Password'])); 245 } else 246 if($_GET['Action'] == 'Logout') 247 { 248 $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout()); 249 } else 250 if($_GET['Action'] == 'UserOptions') 251 { 252 $UserOptions = new Form('UserOptions'); 253 $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 254 $UserOptions->OnSubmit = '?Action=UserOptionsSave'; 255 $Output .= $UserOptions->ShowEditForm(); 256 } else 257 if($_GET['Action'] == 'UserOptionsSave') 258 { 259 $UserOptions = new Form('UserOptions', array()); 260 $UserOptions->LoadValuesFromForm(); 261 $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']); 262 $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.'); 263 $this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']); 264 } 265 if($_GET['Action'] == 'UserRegister') 266 { 267 $UserRegister = new Form('UserRegister'); 268 $UserRegister->OnSubmit = '?Action=UserRegisterSave'; 269 $Output .= $UserRegister->ShowEditForm(); 270 } else 271 if($_GET['Action'] == 'UserRegisterConfirm') 272 { 273 $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H'])); 274 } else 275 if($_GET['Action'] == 'PasswordRecovery') 276 { 277 $Form = new Form('PasswordRecovery'); 278 $Form->OnSubmit = '?Action=PasswordRecovery2'; 279 $Output .= $Form->ShowEditForm(); 280 } else 281 if($_GET['Action'] == 'PasswordRecovery2') 282 { 283 $Form = new Form('PasswordRecovery'); 284 $Form->LoadValuesFromForm(); 285 286 $Output .= $this->SystemMessage('Obnova hesla', $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email'])); 287 } else 288 if($_GET['Action'] == 'PasswordRecoveryConfirm') 289 { 290 $Output .= $this->SystemMessage('Obnova hesla', $this->System->Modules['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P'])); 291 } else 292 if($_GET['Action'] == 'UserRegisterSave') 293 { 294 $UserRegister = new Form('UserRegister', array()); 295 $UserRegister->LoadValuesFromForm(); 296 $Output .= $this->SystemMessage('Nastavení', $this->System->Modules['User']->Register($UserRegister->Values['Name'], $UserRegister->Values['Password'], $UserRegister->Values['Password2'], $UserRegister->Values['Email'], $UserRegister->Values['FirstName'], $UserRegister->Values['SecondName'])); 297 } 298 } 299 300 $Database->select_db('is'); 301 302 $Output .= '<table id="MainTable"><tr><td valign="top">'; 303 $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['main']).'</div>'; 304 $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['other']).'</div>'; 305 $Output .= '</td><td valign="top">'; 306 $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['search']).'</div>'; 307 $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['usefull']).'</div>'; 308 $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['fun']).'</div>'; 309 $Output .= '</td><td id="NewsColumn" valign="top">'; 310 $Output .= '<div class="Panel">'.$this->System->Modules['News']->Show().'</div>'; 311 $Output .= '</td><td valign="top">'; 312 if($this->System->Modules['User']->User['Id'] != $this->System->Modules['User']->AnonymousUserId) $Output .= '<div class="Panel">'.$this->UserPanel().'</div>'; 313 $Output .= '<div class="Panel">'.$this->WebcamPanel().'</div>'; 314 $Output .= '<div class="Panel">'.$this->OnlineHostList().'</div>'; 315 $Output .= '<br />'; 316 $Output .= '</td></tr></table>'; 317 //if(IsInternetAddr()) echo('Internet'); else echo('LAN'); 318 return($Output); 85 319 } 86 320 } 87 321 322 $System->AddModule(new IndexPage()); 323 $System->Modules['IndexPage']->GetOutput(); 324 88 325 ?> 89 90 <table width="100%"><tr><td valign="top">91 <?php92 $Database->select_db('is');93 ?>94 95 <table width="100%">96 <tr><td valign="top">97 <strong>Důležité odkazy:</strong><br />98 <img alt="" src="images/favicons/money.gif" width="16" height="16" /> <a href="finance/">Finance</a><br />99 <img alt="" src="images/favicons/chart.gif" width="16" height="16" /> <a href="http://stat.zdechov.net/centrala/">Statistiky</a><br />100 <img alt="" src="images/favicons/prohledavac_sdileni.gif" width="15" height="15" /> <a href="share">Prohledat sdílení</a><br />101 <img alt="" src="images/favicons/comp.gif" width="16" height="16" /> <a href="userlist.php">Seznam uživatelů</a><br />102 <img alt="" src="images/favicons/comp.gif" width="16" height="16" /> <a href="hostlist.php">Seznam počítačů</a><br />103 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="http://embed.mibbit.com/?server=game.zdechov.net%3A6667&channel=%23zdechov&forcePrompt=true&charset=utf-8">Webový chat</a><br />104 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="sunrisechat/history.php">Historie chatu</a><br />105 <img alt="" src="images/favicons/discus.gif" width="16" height="16" /> <a href="forum">Diskusní fórum</a><br />106 <img alt="" src="images/favicons/openwebmail.gif" width="16" height="16" /> <a href="https://centrala.zdechov.net/cgi-bin/openwebmail/openwebmail.pl">WebMail</a><br />107 <img alt="" src="images/favicons/apple.gif" width="16" height="16" /> <a href="jidelna">Jídelníček</a><br />108 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="http://tv.zdechov.net/">Televize</a><br />109 <img alt="" src="images/favicons/cube.gif" width="16" height="16" /> <a href="http://game.zdechov.net/">Herní server</a><br />110 <img alt="" src="images/favicons/cfix.gif" width="16" height="16" /> <a href="http://farnost.zdechov.net/">Rozpis mší</a><br />111 <img alt="" src="images/favicons/tel.gif" width="16" height="16" /> <a href="telseznam.php">Telefonní seznam</a><br />112 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="mapy/mapa.php">Mapa Zděchova</a><br />113 <img alt="" src="images/favicons/otv_doby.gif" width="16" height="16" /> <a href="otevreno.php">Otvírací doby</a><br />114 <img alt="" src="images/favicons/topologie.gif" width="16" height="16" /> <a href="is/topologie.php">Topologie sítě</a><br />115 <img alt="" src="images/favicons/satellite.gif" width="16" height="16" /> <a href="network/dostupnost.php">Dostupnost sítě</a><br />116 <img alt="" src="images/favicons/tech.gif" width="16" height="16" /> <a href="network.php">Technické informace</a><br />117 <img alt="" src="images/favicons/socer.gif" width="16" height="16" /> <a href="http://fotbal.zdechov.net/">Fotbal Sokol Zděchov</a><br />118 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="webcam/">Web kamera</a><br />119 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="http://www.zdechov.net">Stránky naší sítě</a><br />120 <br />121 <strong>Další odkazy:</strong><br />122 <img alt="" src="images/favicons/tv.gif" width="16" height="16" /> <a href="tkr.php">Kanály kabelovky</a><br />123 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="mapy/mapa_nabidka.php">Nabídka mapy</a><br />124 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="history.php">Historie sítě</a><br />125 <img alt="" src="images/favicons/electric.gif" width="16" height="16" /> <a href="merak.php">Měřič spotřeby</a><br />126 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="ukoly.php">Plány do budoucna</a><br />127 128 129 <?php130 //<a href="/cgi-bin/openwebmail/openwebmail.pl">Poątovní schránka</a><br />131 //<a href="/download/addfile.php">Stahování souborů</a><br />132 ?>133 <br />134 </td><td valign="top">135 <strong>Vyhledávání:</strong><br />136 <img alt="" src="images/favicons/www_google_com.gif" width="16" height="16" /> <a href="http://www.google.cz/">Google</a><br />137 <img alt="" src="images/favicons/morfeo.png" width="16" height="16" /> <a href="http://morfeo.centrum.cz">Morfeo</a><br />138 <img alt="" src="images/favicons/www_centrum_cz.gif" width="16" height="16" /> <a href="http://www.centrum.cz">Centrum</a><br />139 <img alt="" src="images/favicons/www_seznam_cz.gif" width="16" height="16" /> <a href="http://www.seznam.cz">Seznam</a><br />140 <img alt="" src="images/favicons/www_atlas_cz.gif" width="16" height="16" /> <a href="http://www.atlas.cz">Atlas</a><br />141 <img alt="" src="images/favicons/www_tiscali_cz.gif" width="16" height="16" /> <a href="http://www.tiscali.cz">Tiscali</a><br />142 <br />143 <strong>Užitečné:</strong><br />144 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="http://www.mapy.cz/">Mapa ČR</a><br />145 <img alt="" src="images/favicons/www_tvinfo_cz.gif" width="16" height="16" /> <a href="http://www.tvinfo.cz/live/televize/cz">Online TV</a><br />146 <img alt="" src="images/favicons/www_idos_cz.gif" width="16" height="16" /> <a href="http://jizdnirady.idnes.cz/">Jízdní řády</a><br />147 <img alt="" src="images/favicons/www_atlas_cz.gif" width="16" height="16" /> <a href="http://tv.atlas.cz">TV programy</a><br />148 <img alt="" src="images/favicons/www_icq_com.gif" width="16" height="16" /> Web ICQ <a href="javascript:openClient('flash')">Flash</a> <a href="javascript:openClient('java')">Java</a><br />149 <img alt="" src="images/favicons/www_centrum_cz.gif" width="16" height="16" /> <a href="http://slovniky.centrum.cz">Slovníky</a><br />150 <img alt="" src="images/favicons/pocasi.gif" width="16" height="16" /> <a href="http://www.meteopress.cz/">Počasí</a><br />151 <img alt="" src="images/favicons/www_tzones_cz.gif" width="16" height="16" /> <a href="http://www.tzones.cz/">T-Mobile SMS</a><br />152 <img alt="" src="images/favicons/www_mvk_cz.png" width="16" height="16" /> <a href="http://www.mvk.cz/">Knihovna Vsetín</a><br />153 <br />154 <strong>Zábava:</strong><br />155 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="http://www.youtube.com/">YouTube</a><br />156 <img alt="" src="images/favicons/clear.gif" width="16" height="16" /> <a href="http://www.last.fm/">Last.fm</a><br />157 <br />158 <?php159 /*160 <strong>Osobní stránky:</strong><br />161 <img alt="" src="images/favicons/bomi.gif" width="16" height="16"> <a href="~mirek/">Miroslav Hajda</a><br />162 <img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="~george/">Jiří Hajda</a><br />163 */164 ?>165 </td>166 <td valign="top">167 <?php168 // Zobrazení seznamu online počítačů169 echo('<strong>Online počítače:</strong><br /><span style="font-size: smaller;">');170 $DbResult = $Database->select('hosts', '*', 'online=1 AND show_online=1 ORDER BY name');171 while($Row = $DbResult->fetch_array())172 {173 echo(strtoupper($Row['name']).'<br>');174 }175 echo('</span>');176 177 echo('<br />');178 179 // Zobrazení seznamu neplaticich uzivatelu180 /*181 echo('<strong>Dlužníci:</strong><br /><span style="font-size: smaller;">');182 $DbResult = $Database->select('users', 'CONCAT(second_name, " ", first_name) as fullname', 'cash<0 AND role=2 ORDER BY cash');183 while($Row = $DbResult->fetch_array())184 {185 echo($Row['fullname'].'<br />');186 }187 echo('</span>');188 */189 190 echo('</td></tr></table>');191 192 // Zobrazení času běhu počítače193 function GetServerUptime()194 {195 $Data = explode(' ',exec('uptime'));196 $Data = array_slice($Data,3,-8);197 $Uptime = '';198 foreach($Data as $Item)199 {200 if(strpos($Item,':')) $Uptime .= substr($Item,0,-1).' hodin';201 else $Uptime .= $Item.' ';202 }203 $Uptime = str_replace('2 days,','2 dny a',$Uptime);204 $Uptime = str_replace('3 days,','3 dny a',$Uptime);205 $Uptime = str_replace('4 days,','4 dny a',$Uptime);206 $Uptime = str_replace('days,','dní a',$Uptime);207 $Uptime = str_replace('day,','den a',$Uptime);208 $Uptime = str_replace('min,','minut',$Uptime);209 return('Server běží '.$Uptime);210 }211 212 echo(GetServerUptime());213 214 echo('</td><td id="NewsColumn" valign="top">');215 216 /*217 $File = fopen('/tmp/temperature2','r');218 $Teplota = fgets($File);219 $Teplota = round($Teplota*10)/10;220 fclose($File);221 */222 $Teplota = 0;223 224 echo('<table width="100%"><tr><td><strong>Aktuálně:</strong></td><td align="right">225 <a href="?Action=CustomizeNews">Upravit</a></td></tr></table>');226 //<img alt="Teplomer" width="10" height="18" src="images/teplomer3.png"><a href="statistic/trafficview2.php?type=temp">'.$Teplota.'°C (mimo provoz)</a></td></tr></table>');227 228 $UploadedFilesFolder = 'aktuality/uploads/';229 230 // Initialize default news setting231 $NewsSetting = array();232 $I = 1;233 $DbResult = $Database->select('news_category', '*');234 while($NewsCategory = $DbResult->fetch_array())235 {236 $NewsSetting[] = array('CategoryId' => $NewsCategory['id'], 'Index' => $I, 'Enabled' => 1, 'ItemCount' => $Config['Web']['News']['Count'], 'DaysAgo' => $Config['Web']['News']['DaysAgo']);237 $I++;238 }239 // Merge defaults with user setting240 if(array_key_exists('NewsSetting', $_COOKIE))241 {242 $NewsSettingCookie = unserialize($_COOKIE['NewsSetting']);243 foreach($NewsSetting as $Index => $NewSetting)244 {245 $NewsSetting[$Index] = array_merge($NewSetting, $NewsSettingCookie[$Index]);246 }247 }248 249 if(array_key_exists('Action', $_GET))250 {251 // Show news customize menu252 if($_GET['Action'] == 'CustomizeNews')253 {254 echo('<form action="?Action=CustomizeNewsSave" method="post">');255 echo('<table width="100%" cellspacing="0" border="1"><tr><td><table cellspacing="0" width="100%">');256 echo('<tr><th>Kategorie</th><th>Pozice</th><th>Zobrazit</th><th>Max. počet</th><th>Posledních dnů</th></tr>');257 $I = 0;258 foreach($NewsSetting as $SettingItem)259 {260 $DbResult = $Database->select('news_category', '*', 'id='.$SettingItem['CategoryId']);261 $NewsCategory = $DbResult->fetch_array();262 echo('<tr><td>'.$NewsCategory['caption'].'</td><td align="center"><input type="text" size="1" name="NewsCategoryIndex'.$I.'" value="'.$SettingItem['Index'].'" /></td><td align="center"><input type="checkbox" name="NewsCategoryEnabled'.$I.'"');263 if($SettingItem['Enabled'] == 1) echo(' checked="checked"');264 echo(' /></td>'.265 '<td align="center"><input type="text" size="1" name="NewsCategoryCount'.$I.'" value="'.$SettingItem['ItemCount'].'" />'.266 '<input type="hidden" name="NewsCategoryId'.$I.'" value="'.$SettingItem['CategoryId'].'" /></td><td align="center"><input type="text" size="1" name="NewsCategoryDaysAgo'.$I.'" value="'.$SettingItem['DaysAgo'].'" /></td></tr>');267 $I++;268 }269 echo('</table><input type="hidden" name="NewsCategoryCount" value="'.count($NewsSetting).'" /><input type="submit" value="Uložit" /></form></td></tr></table>');270 }271 }272 273 echo('<div onmouseout="skryj(predchozi)">');274 275 function ShowNews($Category, $ItemCount, $DaysAgo)276 {277 global $Database, $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder;278 279 $ItemCount = abs($ItemCount);280 $DaysAgo = abs($DaysAgo);281 $DbResult = $Database->select('news_category', '*', 'id='.$Category);282 $Row = $DbResult->fetch_array();283 echo('<table cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: small; padding-bottom: 5px;"><tr>');284 echo('<td>'.$Row['caption'].'</td><td align="right">');285 echo('<a href="aktuality/index.php?category='.$Category.'">Zobrazit všechny aktuality</a> ');286 if($Row['permission'] == 1) echo('<a href="aktuality/index.php?action=add&category='.$Category.'">Přidat aktualitu</a> ');287 echo('</td></tr><tr><td colspan="2">');288 $DbResult = $Database->query('SELECT * FROM `news` WHERE (`category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `date`) ORDER BY `date` DESC LIMIT 0,'.$ItemCount);289 //echo($Database->error.'<br />');290 //echo($Database->LastQuery.'<br />');291 //echo('<table cellpadding="0" cellspacing="0" width="100%"><tr><td>');292 $Index = 0;293 $FontSize = 12;294 if($DbResult->num_rows > 0)295 {296 echo('<table cellspacing="0" width="100%" class="NewsTable">');297 while($Row = $DbResult->fetch_array())298 {299 echo('<tr><td onmouseover="zobraz('."'new".$Category.$Index."'".')" style="cursor: pointer; margin: 0px;"><table cellspacing="0" cellpadding="0" style="padding: 0px; margin: 0px; font-size: small; color: red;" width="100%">300 <tr><td style="font-size: '.$FontSize.'pt"><strong>'.$Row['title'].'</strong></td>301 <td align="right" style="font-size: '.$FontSize.'pt">'.$Row['author'].' ('.HumanDate($Row['date']).')</td></tr></table>');302 echo('<div id="new'.$Category.$Index.'" class="NewsTableItem">'.$Row['content']);303 304 if($Row['enclosure'] != '')305 {306 echo('<br />Přílohy: ');307 $Enclosures = explode(';', $Row['enclosure']);308 foreach($Enclosures as $Enclosure)309 {310 if(file_exists($UploadedFilesFolder.$Enclosure)) echo(' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>');311 }312 }313 314 echo('</div></td></tr>');315 $Index = $Index + 1;316 $FontSize = $FontSize - 1;317 }318 echo('</table>');319 }320 echo('</td></tr></table>'."\n\n");321 }322 323 foreach($NewsSetting as $SettingItem)324 if($SettingItem['Enabled'] == 1) ShowNews($SettingItem['CategoryId'], $SettingItem['ItemCount'], $SettingItem['DaysAgo']);325 326 echo('<a href="aktuality/subscription.php"><img class="RSSIcon" src="images/rss20.png" alt="Aktuality přes RSS" /></a> <a href="aktuality/subscription.php">Automatické sledování novinek</a>');327 328 //echo('</td></tr></table>'329 echo('</div></td></tr></table>');330 //if(IsInternetAddr()) echo('Internet'); else echo('LAN');331 332 ShowFooter();333 334 ?>
Note:
See TracChangeset
for help on using the changeset viewer.