]> git.pld-linux.org Git - projects/buildlogs.git/blob - obsolete/buildlogs/index.php
- added athlon
[projects/buildlogs.git] / obsolete / buildlogs / index.php
1 <?php
2 $buildlogs_server = "buildlogs.pld.org.pl";
3 $url = "index.php";
4 $addr = array(
5         "/nest/athlon",
6         "/nest/i386",
7         "/nest/i586",
8         "/nest/i686",
9         "/nest/ppc",
10         "/ra/i386",
11         "/ra/i586",
12         "/ra/i686",
13         "/ra/alpha",
14         "/ra/sparc",
15         "/ra/ppc"
16 );
17 $qa_base = "http://ftp.pld.org.pl/.stat/builder";
18 $qa_addr = array(
19         "",
20         "/kenny/rpmqa-nest-i386.txt",
21         "/kenny/rpmqa-nest-i586.txt",
22         "/kenny/rpmqa-nest-i686.txt",
23         "",
24         "/ep/rpmqa-ra-i386.txt",
25         "/ep/rpmqa-ra-i586.txt",
26         "/ep/rpmqa-ra-i686.txt",
27         "/mifgate/rpmqa-ra-alpha.txt",
28         "",
29         ""
30 );
31 $local = 1; /* $local=0 for FTP */ 
32 $root_directory = "/home/services/ftp/pub/logs";
33 /* It should be set */
34
35
36 function myheader()
37 {
38 ?>
39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
40     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
41 <html xmlns="http://www.w3.org/1999/xhtml">
42  <head>
43   <title>PLD Build Logs</title>
44   <style TYPE="text/css"><!--
45 A { text-decoration: none; }
46 A:hover { text-decoration: underline; }
47 H1 { font-family: arial,helvetica,sans-serif; 
48      font-size: 20pt; 
49      font-weight: bold;}
50 H2 { font-family: arial,helvetica,sans-serif; 
51      font-size: 18pt; 
52      font-weight: bold;}
53 BODY,TD { font-family: arial,helvetica,sans-serif; 
54           font-size: 13pt; }
55 TH { font-family: arial,helvetica,sans-serif; 
56      font-size: 13pt; 
57      font-weight: bold; }
58 //-->
59 </style>
60  </head>
61  <!-- Diffrent color for visited link doesn't make much sense here...
62       this page is autogenerated and it might be misleading after some
63       build log changes. -->
64  <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
65 <?php
66 }
67
68 function start_pre()
69 {
70         echo "<table cellpadding=10><tr><td bgcolor=\"#000000\">".
71                 "<font color=\"#cccccc\"><pre>";
72 }
73
74 function end_pre()
75 {
76         echo "</pre></font></td></tr></table>\n";
77 }
78
79 function trailer()
80 {
81         echo "</body></html>";
82 }
83
84
85 function mydie($msg)
86 {
87         echo "Fatal error: $msg";
88 }
89
90 function open_ftp()
91 {
92         global $idx, $addr, $buildlogs_server, $ok;
93         global $ftp_conn, $big_url, $url, $ns;
94         global $off, $cnt;
95         
96         if (!isset($idx) || !isset($addr[$idx]))
97                 return false;
98         
99         if ($ok != 1)
100                 $ok = 0;
101         if ($ns != 1)
102                 $ns = 0;
103                 
104         if ($ok == 1) {
105                 $a = "$addr[$idx]/OK";
106         } else {
107                 $a = "$addr[$idx]/FAIL";
108         }
109         
110         if (!isset($off))
111                 $off = 0;
112         if (!isset($cnt))
113                 $cnt = 16;
114                 
115         $big_url = "$url?idx=$idx&ok=$ok&ns=$ns";
116         
117         $ftp = ftp_connect($buildlogs_server);
118         
119         if ($ftp == false) {
120                 mydie("cannot connect to $buildlogs_server");
121                 return false;
122         }
123
124         if (ftp_login($ftp, "anonymous", 
125                       "buildlogs-iface@pld.org.pl") == false) {
126                 ftp_quit($ftp);
127                 mydie("cannot ftp login to $buildlogs_server");
128                 return false;
129         }
130
131         $list = ftp_nlist($ftp, $a);
132         if ($list == false) {
133                 ftp_quit($ftp);
134                 mydie("cannot list $a");
135                 return false;
136         }
137
138         $ftp_conn = $ftp;
139         
140         return $list;
141 }
142
143 function directory_list()
144 {
145         global $idx, $addr, $buildlogs_server, $ok;
146         global $root_directory, $big_url, $url, $ns;
147         global $off, $cnt;
148         
149         if (!isset($idx) || !isset($addr[$idx]))
150                 return false;
151         
152         if ($ok != 1)
153                 $ok = 0;
154         if ($ns != 1)
155                 $ns = 0;
156                 
157         if ($ok == 1) {
158                 $a = "$addr[$idx]/OK";
159         } else {
160                 $a = "$addr[$idx]/FAIL";
161         }
162         
163         if (!isset($off))
164                 $off = 0;
165         if (!isset($cnt))
166                 $cnt = 16;
167                 
168         $big_url = "$url?idx=$idx&ok=$ok&ns=$ns";
169         
170         $dir = opendir("$root_directory$a");
171         $i = 0;
172         while ($file = readdir($dir)) {
173                 if (($file != ".") && ($file != "..")) {
174                         $list[$i] = "$a/$file";
175                         $i++;
176                 }
177         }
178         closedir($dir);
179         return $list;
180 }
181
182 function list_logs()
183 {
184         global $idx, $addr, $ok;
185         global $ftp_conn, $big_url, $ns;
186         global $off, $cnt;
187
188         $list = open_ftp();
189
190         if ($list == false)
191                 return;
192         
193         if ($ok == 1) {
194                 echo "<h1>Listing of $addr[$idx]/OK "
195                         ."(<a href=\"$big_url&ok=0\">fail</a>)</h1>";
196         } else {
197                 echo "<h1>Listing of $addr[$idx]/FAIL "
198                         ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>";
199         }
200         
201         echo "<div align=center><table border=0 cellspacing=1 ".
202                 "cellpadding=3 bgcolor=#000000 width=90%>\n";
203         echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Log File ".
204                         "[<a href=\"$big_url&ns=1\">sort</a>]</th>".
205                  "<th bgcolor=#CCCCFF align=right width=15%>Size</th> ".
206                  "<th bgcolor=#CCCCFF align=left>Age ".
207                          "[<a href=\"$big_url&ns=0\">sort</a>]</th>".
208                  "</th></tr>";
209         
210         function cmp($f1, $f2) {
211                 global $ftp_conn;
212
213                 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
214         }
215
216         if ($ns != 1) {
217                 $ns = 0;
218                 usort($list, cmp);
219         } else {
220                 sort($list);
221         }
222         
223         $now = time();
224         for ($i = $off; $i < $cnt + $off; $i++) {
225                 if (!isset($list[$i]))
226                         continue;
227                 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
228                 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
229                 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
230                 $s = ftp_size($ftp_conn, $list[$i]);
231                 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
232                 $t /= 60;
233                 if ($t >= 60) {
234                         $t /= 60;
235                         if ($t >= 24) {
236                                 $t /= 24;
237                                 $t = round($t) . " days";
238                         } else {
239                                 $t = round($t) . " hour";
240                         }
241                 } else {
242                         $t = round($t) . " minutes";
243                 }
244                 $u = "$big_url&cnt=$cnt&off=$off&id=$h";
245                 echo "<tr><td bgcolor=#CCCCCC><a ".
246                         "href=\"$u\">".
247                      "$f</a> ".
248                      "[<a href=\"$u&action=text\">text</a> | ".
249                       "<a href=\"$u&action=tail\">tail</a>]".
250                      "</td><td bgcolor=#CCCCCC align=right>".
251                      "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
252         }
253         echo "</table></div>\n";
254
255         $back = "&lt;&lt;&lt; Page back";
256         $forward = "Page forward &gt;&gt;&gt;";
257
258         echo "<p align=center><table width=90%><tr><td align=left width=25%>";
259
260         if ($off > 0) {
261                 $noff = $off - $cnt;
262                 if ($noff < 0)  
263                         $noff = 0;
264                 echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$back</a>\n";
265         } else {
266                 echo "$back\n";
267         }
268         
269         echo "</td><td width=50% align=center>";
270         
271         echo "[<a href=\"$big_url&action=qa\">View rpm -qa of ".
272                 "builder</a>]\n";
273                 
274         echo "</td><td align=right width=25%>";
275         if ($off + $cnt < count($list)) {
276                 $noff = $off + $cnt;
277                 if ($noff < 0)  
278                         $noff = 0;
279                 echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$forward</a>\n";
280         } else {
281                 echo "$forward\n";
282         }
283         echo "</td></tr></table></p>";
284
285         ftp_quit($ftp_conn);
286         $ftp_conn = 0;
287 }
288
289 function local_list_logs()
290 {
291         global $idx, $addr, $ok;
292         global $root_directory, $big_url, $ns;
293         global $off, $cnt;
294
295         $list = directory_list();
296
297         if ($list == false)
298                 return;
299         
300         if ($ok == 1) {
301                 echo "<h1>Listing of $addr[$idx]/OK "
302                         ."(<a href=\"$big_url&ok=0\">fail</a>)</h1>";
303         } else {
304                 echo "<h1>Listing of $addr[$idx]/FAIL "
305                         ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>";
306         }
307         
308         echo "<div align=center><table border=0 cellspacing=1 ".
309                 "cellpadding=3 bgcolor=#000000 width=90%>\n";
310         echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Log File ".
311                         "[<a href=\"$big_url&ns=1\">sort</a>]</th>".
312                  "<th bgcolor=#CCCCFF align=right width=15%>Size</th> ".
313                  "<th bgcolor=#CCCCFF align=left>Age ".
314                          "[<a href=\"$big_url&ns=0\">sort</a>]</th>".
315                  "</th></tr>";
316         
317         function cmp($f1, $f2) {
318                 global $root_directory;
319                 
320         return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
321         }
322
323         if ($ns != 1) {
324                 $ns = 0;
325                 usort($list, cmp);
326         } else {
327                 sort($list);
328         }
329         
330         $now = time();
331         for ($i = $off; $i < $cnt + $off; $i++) {
332                 if (!isset($list[$i]))
333                         continue;
334                 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
335                 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
336                 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
337                 $s = filesize("$root_directory$list[$i]");
338                 $t = $now - filemtime("$root_directory$list[$i]");
339                 $t /= 60;
340                 if ($t >= 60) {
341                         $t /= 60;
342                         if ($t >= 24) {
343                                 $t /= 24;
344                                 $t = round($t) . " days";
345                         } else {
346                                 $t = round($t) . " hour";
347                         }
348                 } else {
349                         $t = round($t) . " minutes";
350                 }
351                 $u = "$big_url&cnt=$cnt&off=$off&id=$h";
352                 echo "<tr><td bgcolor=#CCCCCC><a ".
353                         "href=\"$u\">".
354                      "$f</a> ".
355                      "[<a href=\"$u&action=text\">text</a> | ".
356                       "<a href=\"$u&action=tail\">tail</a>]".
357                      "</td><td bgcolor=#CCCCCC align=right>".
358                      "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
359         }
360         echo "</table></div>\n";
361
362         $back = "&lt;&lt;&lt; Page back";
363         $forward = "Page forward &gt;&gt;&gt;";
364
365         echo "<p align=center><table width=90%><tr><td align=left width=25%>";
366
367         if ($off > 0) {
368                 $noff = $off - $cnt;
369                 if ($noff < 0)  
370                         $noff = 0;
371                 echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$back</a>\n";
372         } else {
373                 echo "$back\n";
374         }
375         
376         echo "</td><td width=50% align=center>";
377         
378         echo "[<a href=\"$big_url&action=qa\">View rpm -qa of ".
379                 "builder</a>]\n";
380                 
381         echo "</td><td align=right width=25%>";
382         if ($off + $cnt < count($list)) {
383                 $noff = $off + $cnt;
384                 if ($noff < 0)  
385                         $noff = 0;
386                 echo "<a href=\"$big_url&cnt=$cnt&off=$noff\">$forward</a>\n";
387         } else {
388                 echo "$forward\n";
389         }
390         echo "</td></tr></table></p>";
391 }
392
393 function file_name()
394 {
395         global $idx, $addr, $ok;
396         global $ftp_conn, $big_url, $ns, $id;
397         global $buildlogs_server;
398
399         if (!isset($id))
400                 return false;
401                 
402         $list = open_ftp();
403
404         if ($list == false)
405                 return false;
406
407         $f = false;
408         for ($i = 0; $i < count($list); $i++) {
409                 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
410                 if ($h == $id) {
411                         $f = $list[$i];
412                 }
413         }
414
415         if ($f == false) {
416                 mydie("cannot find specified file: $id");
417                 ftp_quit($ftp_conn);
418                 return false;
419         }
420
421         return $f;
422 }
423
424
425 function local_file_name()
426 {
427         global $idx, $addr, $ok;
428         global $root_directory, $big_url, $ns, $id;
429         global $buildlogs_server;
430
431         if (!isset($id))
432                 return false;
433                 
434         $list = directory_list();
435
436         if ($list == false)
437                 return false;
438
439         $f = false;
440         for ($i = 0; $i < count($list); $i++) {
441                 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
442                 if ($h == $id) {
443                         $f = $list[$i];
444                 }
445         }
446
447         if ($f == false) {
448                 mydie("cannot find specified file: $id");
449                 return false;
450         }
451
452         return $f;
453 }
454
455
456 function dump_log($tail)
457 {
458         global $idx, $addr, $ok, $url;
459         global $ftp_conn, $big_url, $ns, $id, $cnt, $off;
460         global $buildlogs_server;
461
462         $f = file_name();
463
464         if ($f == false)
465                 return;
466
467         $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
468         $df = preg_replace("/\.(bz2|gz)$/", "", $df);
469         
470         echo "<h1>$df</h1>";
471
472         echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>";
473
474         function one_item($h, $t) {
475                 echo "<tr><td bgcolor=#ccccff>$h:</td>".
476                          "<td bgcolor=#cccccc>$t</td></tr>";
477         }
478
479         function href($h, $c) {
480                 return "<a href=\"$h\">$c</a>";
481         }
482         
483         one_item("Status", ($ok == 1 ?  
484                                 "<font color=green><b>OK</b></font>" : 
485                                 "<font color=red><b>Failed</b></a>"));
486         one_item("Source URL", 
487                  href("ftp://$buildlogs_server$f", 
488                       "ftp://$buildlogs_server$f"));
489
490         $bu = "$big_url&cnt=$cnt&off=$off";
491         
492         one_item("text/plain URL", 
493                  href("$bu&id=$id&action=text",
494                       "View!"));
495         if ($tail) {
496                 one_item("full text", 
497                          href("$bu&&id=$id",
498                               "View!"));
499         }
500         
501         one_item("rpm -qa of builder", href("$bu&action=qa", "View!"));
502         one_item("Date", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
503         /*
504         echo "<tr><td>Here:</td><td>" . 
505                 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
506                 "http://" . getenv("SERVER_NAME") .
507                 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
508              "</td></tr>"; */
509
510         echo "</table><h2>Content:</h2>";
511         
512         ftp_quit($ftp_conn);
513         $ftp_conn = 0;
514         
515         
516         # what can I say beside PHP suxx? how the fuck should I create
517         # bidirectional pipe? gotta use wget
518         
519         if (preg_match("/\.bz2$/", $f)) {
520                 $filter = "| bzcat 2>&1";
521         } elseif (preg_match("/\.gz$/", $f)) {
522                 $filter = "| zcat 2>&1";
523         } else {
524                 $filter = "";
525         }
526
527         $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 $filter";
528         if ($tail)
529                 $cmd = "$cmd | tail -n 100";
530         $fd = popen($cmd, "r");
531         start_pre();
532         while (($s = fgets($fd, 1000)) != false) {
533                 $s = htmlspecialchars($s);
534                 echo $s;
535         }
536         end_pre();
537         pclose($fd);
538
539 ?>
540         <table width=100%>
541          <tr>
542           <td align=left>
543            [<a href="<?php echo $bu; ?>">Back to list of logs</a>]
544           </td>
545           <td align=right>
546            [<a href="<?php echo "$bu&action=qa" 
547                 ?>">View rpm -qa of builder</a>]
548           </td>
549          </tr>
550         </table>
551 <?php
552
553 }
554
555
556 function local_dump_log($tail)
557 {
558         global $idx, $addr, $ok, $url;
559         global $root_directory, $big_url, $ns, $id, $cnt, $off;
560         global $buildlogs_server;
561
562         $f = local_file_name();
563
564         if ($f == false)
565                 return;
566
567         $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
568         $df = preg_replace("/\.(bz2|gz)$/", "", $df);
569         
570         echo "<h1>$df</h1>";
571
572         echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>";
573
574         function one_item($h, $t) {
575                 echo "<tr><td bgcolor=#ccccff>$h:</td>".
576                          "<td bgcolor=#cccccc>$t</td></tr>";
577         }
578
579         function href($h, $c) {
580                 return "<a href=\"$h\">$c</a>";
581         }
582         
583         one_item("Status", ($ok == 1 ?  
584                                 "<font color=green><b>OK</b></font>" : 
585                                 "<font color=red><b>Failed</b></a>"));
586         one_item("Source URL", 
587                  href("ftp://$buildlogs_server$f", 
588                       "ftp://$buildlogs_server$f"));
589
590         $bu = "$big_url&cnt=$cnt&off=$off";
591         
592         one_item("text/plain URL", 
593                  href("$bu&id=$id&action=text",
594                       "View!"));
595         if ($tail) {
596                 one_item("full text", 
597                          href("$bu&&id=$id",
598                               "View!"));
599         }
600         
601         one_item("rpm -qa of builder", href("$bu&action=qa", "View!"));
602         one_item("Date", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
603         /*
604         echo "<tr><td>Here:</td><td>" . 
605                 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
606                 "http://" . getenv("SERVER_NAME") .
607                 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
608              "</td></tr>"; */
609
610         echo "</table><h2>Content:</h2>";
611         
612         # what can I say beside PHP suxx? how the fuck should I create
613         # bidirectional pipe? gotta use wget
614         
615         if (preg_match("/\.bz2$/", $f)) {
616                 $cmd = "bzcat $root_directory$f";
617         } elseif (preg_match("/\.gz$/", $f)) {
618                 $cmd = "zcat $root_directory$f";
619         } else {
620                 $cmd = "cat $root_directory$f";
621         }
622
623         if ($tail)
624                 $cmd = "$cmd | tail -n 100";
625         $fd = popen($cmd, "r");
626         start_pre();
627         while (($s = fgets($fd, 1000)) != false) {
628                 $s = htmlspecialchars($s);
629                 echo $s;
630         }
631         end_pre();
632         pclose($fd);
633
634 ?>
635         <table width=100%>
636          <tr>
637           <td align=left>
638            [<a href="<?php echo $bu; ?>">Back to list of logs</a>]
639           </td>
640           <td align=right>
641            [<a href="<?php echo "$bu&action=qa" 
642                 ?>">View rpm -qa of builder</a>]
643           </td>
644          </tr>
645         </table>
646 <?php
647
648 }
649
650 function dump_text()
651 {
652         global $ftp_conn;
653         global $buildlogs_server;
654         
655         header("Content-type: text/plain");
656
657         $f = file_name();
658
659         if ($f == false)
660                 return;
661
662         echo "# src  : ftp://$buildlogs_server$f\n";
663         echo "# date : " .  
664                 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
665
666         ftp_quit($ftp_conn);
667         $ftp_conn = 0;
668         
669         if (preg_match("/\.bz2$/", $f)) {
670                 $filter = "| bzcat 2>&1";
671         } elseif (preg_match("/\.gz$/", $f)) {
672                 $filter = "| zcat 2>&1";
673         } else {
674                 $filter = "";
675         }
676
677         $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 $filter";
678         $fd = popen($cmd, "r");
679         while (($s = fgets($fd, 1000)) != false) {
680                 echo $s;
681         }
682         pclose($fd);
683 }
684
685
686 function local_dump_text()
687 {
688         global $root_directory;
689         global $buildlogs_server;
690         
691         header("Content-type: text/plain");
692
693         $f = local_file_name();
694
695         if ($f == false)
696                 return;
697
698         echo "# src  : ftp://$buildlogs_server$f\n";
699         echo "# date : " .  
700                 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
701
702         if (preg_match("/\.bz2$/", $f)) {
703                 $cmd = "bzcat";
704         } elseif (preg_match("/\.gz$/", $f)) {
705                 $cmd = "zcat";
706         } else {
707                 $cmd = "cat";
708         }
709
710         $fd = popen("$cmd $root_directory$f", "r");
711         while (($s = fgets($fd, 1000)) != false) {
712                 echo $s;
713         }
714         pclose($fd);
715 }
716
717
718 function list_archs()
719 {
720         global $addr, $url, $idx;
721
722         echo "<table width=100% border=0>\n";
723         echo "<tr><td bgcolor=#cccccc nowrap=1>Failed</td><td bgcolor=#cccccc>Ok</td></tr>\n";
724         for ($i = 0; $i < count($addr); $i++)
725                 echo "<tr><td nowrap=1>".
726                      "<a href=\"$url?idx=$i&ok=0\">$addr[$i]</a></td><td nowrap=1>".
727                      "[<a href=\"$url?idx=$i&ok=1\">OK</a>]</td>".
728                      #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
729                      "</tr>\n";
730         echo "</table><hr />\n";
731         echo "<div align=\"center\"><a href=\"$url\">main()</a><hr />\n";
732         echo "<a href=\"http://www.pld.org.pl/\"><img src=powpld.png ".
733                 "alt=\"Powered by PLD Linux\" border=0></a><br />\n" .
734              "<small>(c) 2002 ".
735              "<a href=\"mailto:feedback@pld.org.pl\">PLD&nbsp;Team</a>\n".
736              "</small></div>\n";
737         
738         # smile ;)
739         echo "<div align=center><small>";
740         $pow = array("vim", "php", "brain", "power", "electricity",
741                      "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
742                      "voodoo magic", "Linux", "x-files", "X", "foobar",
743                      "/dev/null", "/dev/zero", "/dev/drzewo", 
744                      "Leppe'", "matrix", "Neo", "PDP-11",
745                      "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
746                      "foobarbaz", "ed", "Joe", "Unix conspiracy", 
747                      "overclock", "The Right Thing",
748                      "The Bad Thing", "Star Treck", "NSA", "NASA",
749                      "achelon", "VAX", "Real Programmer",
750                      "Real Operating System", "Real Computer",
751                      "computron", "bogon", "quantum bogodynamics",
752                      "BOFH", "/dev/ill", "nasi tu byli",
753                      "Paranoid Android", "Lunatic Corp"
754                      # feel free to add sth if you change this file ;)
755                      );
756         echo "Powered by ";
757         $max = 1;
758         for ($i = 0; $i < $max; $i++) {
759                 $x = rand(0, count($pow) - 1);
760                 if ($pow[$x] == "") $i--;
761                 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
762                 $pow[$x] = "";
763         }
764                 
765         echo "</small></div>";
766         
767         global $qa_addr;
768
769         if ($qa_addr[$idx] != "") {
770         echo "<form action=\"index.php\" method=\"post\">";
771         echo "<input type=hidden name=idx value=$idx />";
772         echo "<input type=hidden name=action value=sqa />";
773         echo "<input type=text size=14 name=str /><br/>";
774         echo "<input type=submit name=submit value=\"Search rpmqa!\" />";
775         echo "</form>";
776         }
777
778 }
779
780 function get_qa()
781 {
782         global $idx, $qa_addr, $qa_base;
783         
784         if (!isset($idx) || !isset($qa_addr[$idx]))
785                 return false;
786
787         $a = $qa_addr[$idx];
788         
789         if ($qa_addr[$idx] == "")
790                 return false;
791         else
792                 return fopen("$qa_base$qa_addr[$idx]", "r");
793 }
794
795 function search_qa()
796 {
797         global $url, $idx, $qa_addr, $str;
798
799         $f = get_qa();
800         echo "<h1>Search results for '$str' in $qa_addr[$idx]</h1>";
801
802         start_pre();
803
804         if ($f == 0) {
805                 echo "Sorry, cannot open.";
806         } else {
807                 while (($s = fgets($f, 1000)) != false) {
808                         if (stristr($s, $str))
809                                 echo $s;
810                 }
811                 echo "/* EOF */";
812         }
813         end_pre();
814 }
815
816 function dump_qa($plain)
817 {
818         global $url, $idx, $qa_addr;
819         
820         $a = $qa_addr[$idx];
821
822         $f = get_qa();
823         
824         if ($plain) {
825                 header("Content-type: text/plain"); 
826                 echo "# rpm -qa of $a\n";
827         } else {
828                 echo "<h1>rpm -qa of $a</h1>";
829                 echo "<a href=\"$url?idx=$idx&action=qatxt\">text/plain "
830                         ."version</a>";
831                 start_pre();
832         }
833
834         if ($f == 0) {
835                 echo "Sorry, cannot open.";
836         } else {
837                 while (($s = fgets($f, 1000)) != false) {
838                         echo $s;
839                 }
840         }
841         
842         if (!$plain)
843                 end_pre();
844 }
845
846 function welcome()
847 {
848 ?>
849 <table border=0 width=100%><tr><td width=20%>&nbsp;</td><td>
850 <h1>Zdrastwuj!</h1>
851 <p>Welcome to PLD Build Logs WWW interface.</p><p>
852 Feel free to email bug reports, complaints and feature requests 
853 <!-- ech... niech strace... -->
854 <a href="mailto:malekith /at/ pld-linux org">to us</a>. Positive opinions are also 
855 <a href="mailto:malekith /at/ pld-linux org">welcome</a> ;)</p>
856 <p>Version: $Id: index.php,v 1.12 2002/06/21 13:13:35 ankry Exp $</p>
857 </td><td width=20%>&nbsp;</td></tr>
858 </table>
859 <?php
860 }
861
862 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
863 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
864 header("Cache-Control: no-cache, must-revalidate");
865 header("Pragma: no-cache");
866
867 //phpinfo();
868 if ($local) {
869         if ($action == "text") {
870                 local_dump_text();
871         } else if ($action == "qatxt") {
872                 dump_qa(1);
873         } else {
874                 myheader();
875                 echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
876                 list_archs();
877                 echo "</td><td valign=top>";
878                 flush();
879                 if ($action == "qa")
880                         dump_qa(0);
881                 else if ($action == "sqa")
882                         search_qa();
883                 else if (isset($id))
884                         local_dump_log($action == "tail");
885                 else if (isset($idx))
886                         local_list_logs();
887                 else 
888                         welcome();
889                 echo "</td></tr></table>";
890                 trailer();
891         }
892 }
893 else {
894
895         if ($action == "text") {
896                 dump_text();
897         } else if ($action == "qatxt") {
898                 dump_qa(1);
899         } else {
900                 myheader();
901                 echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
902                 list_archs();
903                 echo "</td><td valign=top>";
904                 flush();
905                 if ($action == "qa")
906                         dump_qa(0);
907                 else if (isset($id))
908                         dump_log($action == "tail");
909                 else if (isset($idx))
910                         list_logs();
911                 else 
912                         welcome();
913                 echo "</td></tr></table>";
914                 trailer();
915         }
916 }
917 ?>
This page took 0.142463 seconds and 4 git commands to generate.