Changeset 134 for devel/web/index.pas
Legend:
- Unmodified
- Added
- Removed
-
devel/web
-
Property svn:ignore
set to
*.ppu
*.a
*.o
-
Property svn:ignore
set to
-
devel/web/index.pas
r1 r134 4 4 5 5 uses 6 USqlDatabase, SysUtils, PwuEnvVar, UMainPage, 7 {$ifdef STATIC} 8 pwumain; 9 {$else} 10 dynpwu; 11 {$endif} 12 13 type 14 TArrayOfString = array of string; 15 16 17 var 18 Database: TSqlDatabase; 19 20 function ShowHeader(Title, Path: string): string; 21 var 22 Charset: string; 23 Navigace: string; 24 begin 25 Charset := 'iso-8859-2'; // 'windows-1250'; 26 Navigace := CgiEnvVar.RequestURI; 27 Result := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'+ 28 '<html><head>'+ 29 ' <meta http-equiv="Content-Language" content="cs">'+ 30 ' <meta http-equiv="Content-Type" content="text/html; charset='+Charset+'">'+ 31 ' <title>Centrála - '+Path+'</title>'+ 32 ' </head><body style="font-family: sans-serif;">'+ 33 '<div style="padding: 3px; font-size: 20px; border-style: solid; border-color: blue; border-width: 1; background-color: #F0F0FF; margin-bottom: 4px;">'+Title+'</div>'+ 34 '<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;"><strong>Navigace >></strong> '+Navigace+'</div>'; 35 end; 36 37 function ShowFooter: string; 38 var 39 UpdateDate: string; 40 GenerateTime: string; 41 begin 42 UpdateDate := '2.5.2007'; 43 GenerateTime := '1 s'; 44 Result := '<div style="border-style: solid; border-top-color: gray; border-width: 1 0 0 0; margin-top: 7px; padding-top: 2px;" align="center">'+ 45 ' <i style="font-size: 10;">| Web mistr: Jiøí Hajda | e-mail: robie@centrum.cz | ICQ: 277158770 | Vygenerováno za '+GenerateTime+' s | Verze: 1.0 | Naposledy aktualizováno: '+UpdateDate+' |</i>'+ 46 ' </div>'; 47 //ShowArray($GLOBALS); 48 Result := Result + '</body></html>'; 49 end; 50 51 function Explode(Separator: Char; Data: string): TArrayOfString; 52 begin 53 SetLength(Result,0); 54 while Pos(Separator,Data)>0 do begin 55 SetLength(Result, Length(Result)+1); 56 Result[High(Result)]:= Copy(Data,1,Pos(Separator,Data)-1); 57 Delete(Data,1,Pos(Separator,Data)); 58 end; 59 SetLength(Result, Length(Result)+1); 60 Result[High(Result)]:= Data; 61 end; 62 63 function HumanDate(Date: string): string; 64 var 65 Parts: TArrayOfString; 66 Parts2: TArrayOfString; 67 begin 68 Parts := Explode(' ', Date); 69 // Result := Date; 70 Parts2 := Explode('-', Parts[0]); 71 if Date <> '0000-00-00' then Result := IntToStr(StrToInt(Parts2[2])*1) + '.' + IntToStr(StrToInt(Parts2[1])*1) + '.' + Parts2[0] 72 else Result := ' '; 73 end; 74 75 function ShowNews(Category: Integer): string; 76 var 77 DbRows: TDbRows; 78 Index: Integer; 79 FontSize: Integer; 80 I: Integer; 81 II: Integer; 82 Enclosures: TArrayOfString; 83 const 84 NewsCountPerCategory = 3; 85 UploadedFilesFolder = 'aktuality/uploads/'; 86 begin 87 // global $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder; 88 89 DbRows := Database.Select('news_category', '*', 'id=' + IntToStr(Category)); 90 91 Result := '<table cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: small; padding-bottom: 5px;"><tr>'+ 92 '<td width="40%">' + DbRows[0].Values['caption'] + '</td><td width="80%" align="right">'+ 93 '<a href="aktuality/index.php?category=' + IntToStr(Category) + '">Zobrazit v¹echny aktuality</a> '; 94 if StrToInt(DbRows[0].Values['permission']) = 1 then Result := Result + '<a href="aktuality/index.php?action=add&category=' + IntToStr(Category) + '">Pøidat aktualitu</a> '; 95 Result := Result + '</td></tr><tr><td colspan="2">'+ 96 '<table cellspacing="0" width="100%" style="padding: 2px 2px 2px 2px; font-size: small; border-style: solid; border-color: red; border-width: 1; background-color: #FFF0F0;">'; 97 Index := 0; 98 FontSize := 12; 99 DbRows := Database.Select('news', '*', 'category=' + IntToStr(Category) + ' ORDER BY date DESC LIMIT 0,' + IntToStr(NewsCountPerCategory)); 100 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 101 Result := Result + '<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%">'+ 102 '<tr><td style="font-size: ' + IntToStr(FontSize) + 'pt"><strong>' + Values['title'] + '</strong></td>'+ 103 '<td align="right" style="font-size: ' + IntToStr(FontSize) + 'pt">' + Values['author'] + ' (' + HumanDate(Values['date']) + ')</td></tr></table>'+ 104 '<div id="new' + IntToStr(Category) + IntToStr(Index) + '" class="skryty" style="display: none; border-width: 1; border-style: solid; border-color: blue; padding: 3px; font-size: 9pt;">' + Values['content']; 105 106 if Values['enclosure'] <> '' then begin 107 Result := Result + '<br>Pøílohy: '; 108 Enclosures := Explode(';', Values['enclosure']); 109 for II := 0 to High(Enclosures) do begin 110 // if(file_exists($UploadedFilesFolder.$Enclosure)) echo(' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>') 111 end; 112 end; 113 Result := Result + '</div></td></tr>'; 114 Index := Index + 1; 115 FontSize := FontSize - 2; 116 end; 117 Result := Result + '</table></td></tr></table>'; 118 end; 6 UCore, USqlDatabase, SysUtils, UMainPage, pwinit, pwmain, 7 UFinancePage; 119 8 120 9 var 121 10 Output: string; 122 DbRows: TDbRows;123 11 I: Integer; 12 PageName: string; 124 13 begin 125 Database := TSqlDatabase.Create; 126 with Database do begin 127 Hostname := 'localhost'; 128 Database := 'is'; 129 UserName := 'root'; 130 Password := '6yeyEtiAcr'; 131 Connect; 132 end; 133 DbRows := Database.Query('SET CHARACTER SET latin2'); 134 DbRows.Free; 135 Output := ShowHeader('Vítejte na <strong>Centrále!</strong> - serveru komunitní poèítaèové sítì <strong>ZdechovNET</strong>','Rozcestník'); 136 Output := Output + '<script type="text/javascript">'+ 137 '<!--'+ 138 'function openClient(client_type)'+ 139 '{'+ 140 'if(client_type=="java")clientWindow = window.open("http://go.icq.com/icq2go/web.html","ICQ2Go","left=20,top=20,width=156,height=446,toolbar=0,resizable=0");'+ 141 'else clientWindow = window.open("http://go.icq.com/icq2go/flicq.html","ICQ2Go","left=20,top=20,width=176,height=441,toolbar=0,resizable=0");'+ 142 '}'+ 143 144 'var predchozi = ''first'';'+ 145 ''+ 146 'function zobraz(idecko)'+ 147 '{'+ 148 ' skryj(predchozi);'+ 149 'el=document.getElementById(idecko).style;'+ 150 ' el.display=''block'';'+ 151 'predchozi = idecko;'+ 152 '}'+ 153 ''+ 154 'function skryj(idecko)'+ 155 '{'+ 156 'if(idecko != ''first'')'+ 157 '{'+ 158 ' el=document.getElementById(idecko).style;'+ 159 ' el.display=''none'';'+ 160 '}'+ 161 '}'+ 162 '//-->'+ 163 '</script>'+ 164 ''+ 165 '<table width="100%"><tr><td valign="top">'+ 166 '<table width="100%">'+ 167 '<tr><td width="20%" valign="top">'+ 168 '<strong>Dùle¾ité odkazy:</strong><br>'+ 169 '<img alt="" src="images/favicons/money.gif" width="16" height="16"> <a href="/finance/">Finance</a><br>'+ 170 '<img alt="" src="images/favicons/chart.gif" width="16" height="16"> <a href="/statistic/trafficview2.php">Statistika</a><br>'+ 171 '<img alt="" src="images/favicons/prohledavac_sdileni.gif" width="15" height="15"> <a href="/share">Prohledat sdílení</a><br>'+ 172 '<img alt="" src="images/favicons/comp.gif" width="16" height="16"> <a href="/userlist.php">Seznam u¾ivatelù</a><br>'+ 173 '<img alt="" src="images/favicons/comp.gif" width="16" height="16"> <a href="/hostlist.php">Seznam poèítaèù</a><br>'+ 174 '<img alt="" src="images/favicons/sunrisechat.gif" width="16" height="16"> <a href="/sunrisechat/history.php">Historie SunriseChatu</a><br>'+ 175 '<img alt="" src="images/favicons/sunrisechat.gif" width="16" height="16"> <a href="/sunrisechat/webchat.php">Webový SunriseChatu</a><br>'+ 176 '<img alt="" src="images/favicons/discus.gif" width="16" height="16"> <a href="/forum">Diskusní fórum</a><br>'+ 177 '<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>'+ 178 '<img alt="" src="images/favicons/apple.gif" width="16" height="16"> <a href="/jidelna">Jídelníèek</a><br>'+ 179 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="http://tv.zdechov.net/">Televize</a><br>'+ 180 '<img alt="" src="images/favicons/cube.gif" width="16" height="16"> <a href="http://game-server.zdechov.net/">Herní server</a><br>'+ 181 '<img alt="" src="images/favicons/cfix.gif" width="16" height="16"> <a href="/farnost">Rozpis m¹í</a><br>'+ 182 '<img alt="" src="images/favicons/tel.gif" width="16" height="16"> <a href="/telseznam.php">Telefonní seznam</a><br>'+ 183 '<img alt="" src="images/favicons/pripoj.gif" width="16" height="16"> <a href="/nabidky_pripojeni.php">Nabídky pøipojení</a><br>'+ 184 '<img alt="" src="images/favicons/zapisy.gif" width="16" height="16"> <a href="/docs/zapisy/zapisy.php">Zápisy ze schùzí</a><br>'+ 185 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/mapy/mapa.php">Mapa Zdìchova</a><br>'+ 186 '<img alt="" src="images/favicons/otv_doby.gif" width="16" height="16"> <a href="/otevreno.php">Otvírací doby</a><br>'+ 187 '<img alt="" src="images/favicons/topologie.gif" width="16" height="16"> <a href="/is/topologie.php">Topologie sítì</a><br>'+ 188 '<img alt="" src="images/favicons/satellite.gif" width="16" height="16"> <a href="/is/dostupnost.php">Dostupnost sítì</a><br>'+ 189 '<img alt="" src="images/favicons/tech.gif" width="16" height="16"> <a href="/network.php">Technické informace</a><br>'+ 190 '<img alt="" src="images/favicons/socer.gif" width="16" height="16"> <a href="http://fotbal.zdechov.net/">Fotbal Sokol Zdìchov</a><br>'+ 191 '<br>'+ 192 '<strong>Dal¹í odkazy:</strong><br>'+ 193 '<img alt="" src="images/favicons/tv.gif" width="16" height="16"> <a href="/tkr.php">Kanály kabelovky</a><br>'+ 194 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/mapy/mapa_nabidka.php">Nabídka mapy</a><br>'+ 195 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/history.php">Historie sítì</a><br>'+ 196 '<img alt="" src="images/favicons/electric.gif" width="16" height="16"> <a href="/merak.php">Mìøiè spotøeby</a><br>'+ 197 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/sluzby.php">Seznam slu¾eb</a><br>'+ 198 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/ukoly.php">Plány do budoucna</a><br>'+ 199 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/navody.php">Návody</a><br>'+ 200 '<img alt="" src="images/favicons/info.gif" width="16" height="16"> <a href="/infokanal/index.htm">Infokanál</a><br>'+ 201 '<img alt="" src="images/favicons/progman.gif" width="16" height="16"> <a href="/manualy.php">Programátorské manuály</a><br>'+ 202 '<br>'+ 203 '</td><td width="13%" valign="top">'+ 204 '<strong>Vyhledávání:</strong><br>'+ 205 '<img alt="" src="images/favicons/www_google_com.gif" width="16" height="16"> <a href="http://www.google.cz/">Google</a><br>'+ 206 '<img alt="" src="images/favicons/morfeo.png" width="16" height="16"> <a href="http://morfeo.centrum.cz">Morfeo</a><br>'+ 207 '<img alt="" src="images/favicons/www_centrum_cz.gif" width="16" height="16"> <a href="http://www.centrum.cz">Centrum</a><br>'+ 208 '<img alt="" src="images/favicons/www_seznam_cz.gif" width="16" height="16"> <a href="http://www.seznam.cz">Seznam</a><br>'+ 209 '<img alt="" src="images/favicons/www_atlas_cz.gif" width="16" height="16"> <a href="http://www.atlas.cz">Atlas</a><br>'+ 210 '<img alt="" src="images/favicons/www_tiscali_cz.gif" width="16" height="16"> <a href="http://www.tiscali.cz">Tiscali</a><br>'+ 211 '<br>'+ 212 '<strong>U¾iteèné:</strong><br>'+ 213 '<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="http://www.zdechov.net">Stránky na¹í sítì</a><br>'+ 214 '<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>'+ 215 '<img alt="" src="images/favicons/www_idos_cz.gif" width="16" height="16"> <a href="http://www.idos.cz/ConnForm.asp?tt=c">Jízdní øády</a><br>'+ 216 '<img alt="" src="images/favicons/www_atlas_cz.gif" width="16" height="16"> <a href="http://tv.atlas.cz">TV programy</a><br>'+ 217 '<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>'+ 218 '<img alt="" src="images/favicons/www_centrum_cz.gif" width="16" height="16"> <a href="http://slovniky.centrum.cz">Slovníky</a><br>'+ 219 '<img alt="" src="images/favicons/pocasi.gif" width="16" height="16"> <a href="http://www.meteopress.cz/">Poèasí</a><br>'+ 220 '<img alt="" src="images/favicons/www_tzones_cz.gif" width="16" height="16"> <a href="http://www.tzones.cz/">T-Mobile SMS</a><br>'+ 221 '<img alt="" src="images/favicons/www_mvk_cz.png" width="16" height="16"> <a href="http://www.mvk.cz/">Knihovna Vsetín</a><br>'+ 222 '<br>'+ 223 '<strong>Prodej poèítaèù:</strong><br>'+ 224 '<img alt="" src="images/favicons/www_computershop_cz.png" width="16" height="16"> <a href="http://shop.computershop.cz/eshop/">SOFTCOM</a><br>'+ 225 '<img alt="" src="images/favicons/www_alfacomp_cz.gif" width="16" height="16"> <a href="http://www.alfacomp.cz/php/zbozi.php?akc=2">Alfacomp</a><br>'+ 226 '<img alt="" src="images/favicons/www_petracomp_cz.png" width="16" height="16"> <a href="http://www.petracomp.cz/">Petracomp</a><br>'+ 227 '<img alt="" src="images/favicons/www_tsbohemia_cz.png" width="16" height="16"> <a href="http://interlink.tsbohemia.cz/">TS Bohemia</a><br>'+ 228 '<br>'+ 229 '</td>'+ 230 '<td width="15%" valign="top">'; 231 // Zobrazení seznamu online poèítaèù 232 Output := Output + '<strong>Online poèítaèe:</strong><br><span style="font-size: smaller;">'; 233 DbRows := Database.Select('hosts', 'name', 'online=1 AND show_online=1 ORDER BY name'); 234 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 235 Output := Output + Values['name'] + '<br>'; 236 end; 237 DbRows.Free; 238 Output := Output + '</span><br>'; 239 240 // Zobrazení seznamu dlu¾níkù 241 Output := Output + '<strong>Dlu¾níci:</strong><br><span style="font-size: smaller;">'; 242 DbRows := Database.Select('users', 'fullname', 'cash<0 ORDER BY cash'); 243 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 244 Output := Output + Values['fullname'] + '<br>'; 245 end; 246 DbRows.Free; 247 Output := Output + '</span>'; 248 Output := Output + '</td></tr></table>'; 249 250 (* 251 // Zobrazení èasu bìhu poèítaèe 252 Data = explode(' ', exec('uptime')); 253 Data = array_slice($Data,3,-8); 254 Uptime = ''; 255 foreach($Data as $Item) 256 { 257 if(strpos($Item,':')) $Uptime .= substr($Item,0,-1).' hodin'; 258 else $Uptime .= $Item.' '; 259 } 260 $Uptime = str_replace('2 days,','2 dny a',$Uptime); 261 $Uptime = str_replace('3 days,','3 dny a',$Uptime); 262 $Uptime = str_replace('4 days,','4 dny a',$Uptime); 263 $Uptime = str_replace('days,','dní a',$Uptime); 264 $Uptime = str_replace('day,','den a',$Uptime); 265 $Uptime = str_replace('min,','minut',$Uptime); 266 echo('Server bì¾í '.$Uptime); 267 *) 268 Output := Output + '</td><td width="50%" valign="top" style="font-size: smaller;">'; 269 270 (* 271 $File = fopen('/tmp/temperature2','r'); 272 $Teplota = fgets($File); 273 $Teplota = round($Teplota*10)/10; 274 fclose($File); 275 276 Output := Output + '<table width="100%"><tr><td><strong>Aktuálnì:</strong></td><td align="right">'+ 277 '<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>'; 278 *) 279 280 Output := Output + '<div onmouseout="skryj(predchozi)">'+ ShowNews(5) + ShowNews(3) + ShowNews(1) + ShowNews(2) + ShowNews(4) + ShowNews(6) + ShowNews(8) + ShowNews(9) + ShowNews(10); 281 282 Output := Output + '<a href="aktuality/subscription.php"><img style="margin: 0px 0px 0px 0px;" border="0" src="images/rss20.png" alt="Aktuality pøes RSS"></a> <a href="aktuality/subscription.php">Automatické sledování novinek</a>'+ 283 '</div></td></tr></table>'; 284 Output := Output + ShowFooter; 14 SetHeader('Content-Type', 'text/html; charset=utf-8'); 15 PageName := GetCgiVar('p'); 16 if PageName = '' then PageName := 'finance-clenove'; 17 I := 0; 18 while (I < Length(Pages)) and (Pages[I].Name <> PageName) do Inc(I); 19 if I < Length(Pages) then Output := Pages[I].Producer 20 else Output := 'Stránka nenalezena'; 285 21 WebWriteLn(Output); 286 Database.Free;287 22 end. 288
Note:
See TracChangeset
for help on using the changeset viewer.