/[qa]/trunk/wml/developer.wml
ViewVC logotype

Contents of /trunk/wml/developer.wml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1153 - (hide annotations) (download)
Sun Nov 20 11:37:45 2005 UTC (7 years, 5 months ago) by myon
File size: 63220 byte(s)
fix popcon formula
1 igenibel 789 <?
2 igenibel 818 # keep the header in php generated file
3     <protect>/*
4     +-------------------------------------------------------------------------+
5     | Copyright (C) 2002 Igor Genibel |
6 myon 1132 | Copyright (C) 2005 Christoph Berg |
7 igenibel 818 | |
8     | This program is free software; you can redistribute it and/or |
9     | modify it under the terms of the GNU General Public License |
10     | as published by the Free Software Foundation; either version 2 |
11     | of the License, or (at your option) any later version. |
12     | |
13     | This program is distributed in the hope that it will be useful, |
14     | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15     | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16     | GNU General Public License for more details. |
17     +-------------------------------------------------------------------------+
18     | This code is currently maintained and debugged by Igor Genibel, any |
19     | questions or comments regarding this code should be directed to: |
20     | - igor@genibel.org |
21     +-------------------------------------------------------------------------+
22     | - Igor Genibel - http://genibel.org/ |
23     | $Id$
24     +-------------------------------------------------------------------------+
25    
26     */</protect>
27 igenibel 789 header('Content-Type: text/html; charset="utf-8"');
28 igenibel 804 header('Content-Script-Type: text/javascript');
29     header('Content-Style-Type: text/css');
30 igenibel 818 header('Pragma: no-cache');
31    
32     // global variables
33 igenibel 810 $arg_cookie = array();
34 igenibel 818 $prefix="/org/qa.debian.org/data/ddpo/results";
35     $counter_span = 0;
36 myon 1150 $seen_packages = array();
37 igenibel 810
38 igenibel 818 error_reporting(0);
39     $time = microtime();
40    
41     $branch = array ("main",
42     "contrib",
43     "non-free",
44     "non-US/main",
45     "non-US/contrib",
46     "non-US/non-free" );
47    
48     setlocale(LC_ALL, 'fr_FR');
49     setlocale(LC_TIME, 'C');
50     setlocale(LC_NUMERIC, 'C');
51    
52     /* pick up cookies information or generate default one */
53     if (!empty($_COOKIE['columnsinfo']) and ($_GET['reset'] != 'yes'))
54     {
55     $tmp = $_COOKIE['columnsinfo'];
56     $arg_cookie = unserialize(base64_decode($tmp));
57 igenibel 810 }else{
58 igenibel 818 $arg_cookie = array ( bugs => 1,
59     version => 1,
60     excuses => 1,
61     watch => 1,
62     bin => 1,
63     buildd => 1,
64     security => 1,
65     problems => 1,
66 myon 1132 popc => 1,
67 igenibel 818 section => 1,
68 myon 1141 uninstallable => 1,
69     uploads => 1);
70 igenibel 810 }
71 myon 1140 /* add missing popc column, can be removed after some time (2005-11-16) */
72     if (!in_array('popc', array_keys($arg_cookie))) {
73     $arg_cookie['popc'] = 1;
74     }
75 myon 1141 if (!in_array('uploads', array_keys($arg_cookie))) {
76     $arg_cookie['uploads'] = 1;
77     }
78 igenibel 818 /* always set cookie with that values in order to keep it 3 months old since the last visit */
79     setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month'));
80 igenibel 810
81    
82 igenibel 818 /* if the "reset" arg is passed, need to extract action parameter in order to store the
83     value into the new cookie */
84     if($_GET['reset'] != 'yes')
85     {
86     foreach(array_keys($_GET) as $key)
87     {
88     if (($key == 'comaint') or ($key == 'login') or ($key == 'package') or ($key == 'wnpp') or ($key == 'gpg_key') or ($key == 'popcon'))
89     {
90     continue;
91     }else{
92     $arg_cookie[$key] = $_GET[$key];
93     }
94     }
95     if ($_GET['set'] == 'yes') setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month'));
96     }
97 igenibel 810
98 igenibel 789 ?>
99    
100 igenibel 818
101 myon 1132 #use wml::templ::template title="Debian Developer's Packages Overview" author="Igor Genibel, Christoph Berg, and others"
102 igenibel 358
103 igenibel 818 {#style#:
104 igenibel 617 <style type="text/css">
105 igenibel 797 a.dash:link,a.dash:visited,a.dash:active {text-decoration: none;}
106     .general {color:black}
107 igenibel 818 .span_general { text-align:left;
108     cursor:pointer;
109     border-bottom-style:dashed;
110     border-width:thin}
111     h3 { font-family: Arial, Helvetica, sans-serif;
112     margin-left:10px }
113 myon 1132 .small { font-size:small }
114 igenibel 617 </style>
115 igenibel 818 :##}
116    
117     {#script#:
118     <script type="text/javascript" language="JavaScript">
119 igenibel 803 function objectOver(x){
120 igenibel 818 x.style.color="blue";
121 igenibel 803 }
122     function objectOut(x){
123 igenibel 818 x.style.color="black";
124 igenibel 803 }
125 igenibel 797 function collapse(x, txt){
126 igenibel 818 var oTemp=document.getElementById("text_"+x) ;
127     var oClick=document.getElementById("click_"+x);
128 igenibel 797
129 igenibel 818 if(oTemp.style.display=="block"){
130     oTemp.style.display="none";
131     oClick.innerHTML=txt+"&nbsp<small>(click to expand)<\/small><br>";
132     }
133     else{
134     oTemp.style.display="block";
135     oClick.innerHTML=txt+"&nbsp<small>(click to collapse)<\/small><br>";
136     }
137 igenibel 797 }
138     </script>
139 igenibel 818 :##}
140    
141 igenibel 358 <?
142    
143    
144 igenibel 818 /* Used to return a file line while I didn't find such a function
145     in php
146     Args:
147     $fp: opened file
148     return:
149     String: line
150     */
151 igenibel 777 function freadline($fp)
152     {
153 igenibel 818 $line = "";
154     do
155     {
156     $line .= fgets($fp, "10240");
157     }
158     while($line != "" && $line[strlen($line)-1] != "\n");
159     return $line;
160 igenibel 777 }
161    
162 igenibel 358
163 igenibel 818 /*
164     All generated page are html 4.0 and css1 compliant
165     Action:
166     print the links to w3c
167     */
168     function print_validator()
169 igenibel 615 {
170 igenibel 818 print '<p><a href="http://jigsaw.w3.org/css-validator/validator/?uri=qa.debian.org/developer.php"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
171     <a href="http://validator.w3.org/check?uri=referer"><img border="0" src="http://www.w3.org/Icons/valid-html40" alt="Valid HTML 4.0!" height="31" width="88"></a></p>';
172 igenibel 615 }
173    
174 igenibel 818
175     /*
176     Print the footer information such as page generating time.
177     */
178     function print_footer()
179     {
180     global $time;
181     global $prefix;
182     $fp = fopen("$prefix/extract.date", "r");
183     $general = freadline($fp, "512");
184     fclose($fp);
185     $fp = fopen("$prefix/bugs.date", "r");
186     $bugs = freadline($fp, "512");
187     fclose($fp);
188    
189 myon 1106 $footer .= "General information: $general (updated once per day)" . html_br();
190     $footer .= "Bug information: $bugs (updated every 15 minutes)" . html_br();
191 igenibel 818 list($micro,$sec) = explode(' ', microtime());
192     list($smicro,$ssec) = explode(' ', $time);
193 jeroen 1096 $footer .= sprintf("Time needed to generate page: %.2fs", $sec-$ssec+$micro-$smicro);
194 igenibel 818
195     print html_p(html_small($footer));
196     print html_hr(). print_validator();
197 igenibel 358 }
198    
199 igenibel 818 /*
200     form function
201     Args:
202     $method: "GET" "POST"
203     $preamble: inner form data not considered as visible
204     parameters
205     $data: visible parameters
206     $name: submit button name
207     Returns:
208     an valid html form
209     */
210     function html_form($method, $preamble, $fields, $name)
211 igenibel 358 {
212 igenibel 818 $form = "<form method=\"$method\" action=\"developer.php\">";
213     $form .= $preamble;
214     $form .= $fields;
215     $form .= html_input_submit($name);
216     $form .= "</form>\n";
217     return $form;
218     }
219 igenibel 358
220 igenibel 818 /*
221     label function
222     Args:
223     $text: text to be labelized
224     Return:
225     labelized text
226     */
227     function html_label($text)
228     {
229     return "<label>$text</label>\n";
230     }
231 igenibel 797
232 igenibel 818 /*
233     submit button function
234     Args:
235     $name: submit button name
236     Returns:
237     a valid html submit button
238     */
239     function html_input_submit($name)
240     {
241     return "<input type=\"submit\" value=\"$name\">\n";
242 igenibel 358 }
243 igenibel 818
244     /*
245     text field unction
246     Args:
247     $name: the text field name
248     Returns:
249     a valid html text field
250     */
251 myon 1131 function html_input_text($name, $value)
252 igenibel 818 {
253 myon 1131 if ($value) $value = " value=\"$value\"";
254     return "<input type=\"text\" size=\"30\" maxlength=\"40\" name=\"$name\"$value>\n";
255 igenibel 358 }
256    
257 igenibel 818 /*
258     hidden field unction
259     Args:
260     $name: the hidden field name
261     $value: hidden field value
262     Returns:
263     a valid html hidden field
264     */
265     function html_input_hidden($name,$value)
266 igenibel 358 {
267 igenibel 818 return "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n";
268     }
269    
270     /*
271     radio button function
272     Args:
273     $name: the radio button field name
274     $value: radio button field value
275     $checked: boolean
276     $text: text to explain the radio button
277     Returns:
278     a valid html radio button
279     */
280     function html_input_radio($name,$value,$checked,$text)
281     {
282     $data = "<input type=\"radio\" name=\"$name\" value=\"$value\"";
283     if($checked) $data .= " checked";
284     $data .= ">$text";
285     return "$data\n";
286     }
287    
288     /*
289     table header element
290     Args:
291     $title: header text
292     $extra: th args (align, ...)
293     $rowspan: how many rows in the table the header covers
294     $colspan: how many cols in the table the header covers
295     Returns:
296     A valid table header element
297     */
298     function html_th($title, $extra, $rowspan, $colspan)
299     {
300     if($colspan == "") $colspan = 1;
301     if($rowspan == "") $rowspan = 1;
302     if ($extra != "")
303     {
304 myon 1135 return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_color("$title ", "green") . html_br() . html_color("($extra)", "black") . "</th>\n";
305 igenibel 818 }else{
306 myon 1135 return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_color($title, "green") . "</th>\n";
307 igenibel 611 }
308 igenibel 818 }
309    
310     /*
311     table element
312     Args:
313     $data: text element
314     $width: width in %
315     $rowspan: how many rows in the table the element covers
316     $colspan: how many cols in the table the element covers
317     Returns:
318     A valid table element
319     */
320     function html_td($data, $width, $colspan, $rowspan)
321     {
322     if($colspan == "") $colspan = 1;
323     if($rowspan == "") $rowspan = 1;
324     if($width == "")
325     {
326     return "<td rowspan=\"$rowspan\" colspan=\"$colspan\">$data</td>\n";
327     }else{
328     return "<td width=\"$width\" rowspan=\"$rowspan\" colspan=\"$colspan\">$data</td>";
329 igenibel 611 }
330 igenibel 799 }
331 igenibel 818
332     /*
333     table line
334     Args:
335     $data: all tds
336     $align: center, left, right
337     $bgcolor: background color
338     Returns:
339     A valid table line
340     */
341     function html_tr($data, $align, $bgcolor)
342     {
343     if($align == "") $align = "center";
344     if($bgcolor == "")
345     {
346     return "<tr align=\"$align\">$data</tr>\n";
347     }else{
348     return "<tr align=\"$align\" bgcolor=\"$bgcolor\">$data</tr>\n";
349     }
350 igenibel 358 }
351    
352 igenibel 818 /*
353     table
354     Args:
355     $header: all table headers (a tr)
356     $data: array of data lines
357     $width: table width in %
358     Returns:
359     A valid html table
360     */
361 myon 1135 function html_table($header, $data, $width, $class)
362 igenibel 818 {
363 myon 1132 if($width == "") $width = " width=\"${width}%\"";
364 myon 1135 if($class) $class = " class=\"$class\"";
365     $table = "<table$width$class border=\"1\" cellpadding=\"3\" cellspacing=\"1\" summary=\"\">";
366 igenibel 818 $table .= $header ;
367     foreach ($data as $line) $table .= $line;
368     return "$table\n</table>\n";
369     }
370 igenibel 358
371 igenibel 818 /*
372     Html Anchor
373     Args:
374     $text: anchor text
375     $link: anchor link
376     $class: anchor class
377     $title: info bullet text
378     Returns:
379     A valid html anchor
380     */
381     function html_a($text,$link,$class, $title)
382 igenibel 358 {
383 igenibel 818 if($title != "") $title = " title=\"$title\"";
384 myon 1114 if($class != "") $class = " class=\"$class\"";
385     return "<a$class href=\"$link\"$title>$text</a>";
386 igenibel 358 }
387    
388 igenibel 818 /*
389     Html headers
390     Args:
391     $text: header text
392     $level: header level
393     $align: header align
394     Returns:
395     A valid html header
396     */
397     function html_h($text, $level, $align)
398     {
399     if ($align == "")
400     {
401     return "<h$level>$text</h$level>\n";
402     }else{
403     return "<h$level align=\"$align\">$text</h$level>\n";
404     }
405     }
406 igenibel 358
407 igenibel 818 /* The following function are basic html functions (from html_tt to html_span */
408     function html_tt($text)
409     {
410     return "<tt>$text</tt>";
411     }
412 igenibel 358
413 igenibel 818 function html_b($text)
414 igenibel 358 {
415 igenibel 818 return "<b>$text</b>";
416     }
417 joy 366
418 igenibel 818 function html_u($text)
419     {
420     return "<u>$text</u>";
421     }
422 joy 366
423 igenibel 818 function html_em($text)
424     {
425     return "<em>$text</em>";
426     }
427 joy 366
428 igenibel 818 function html_p($text)
429     {
430     return "<p>$text</p>";
431 igenibel 358 }
432    
433    
434 igenibel 818 function html_blank()
435 igenibel 358 {
436 igenibel 818 return "&nbsp;";
437     }
438 joy 366
439 igenibel 818 function html_br()
440     {
441     return "<br>\n";
442     }
443 igenibel 358
444 igenibel 818 function html_hr()
445     {
446     return "<hr>\n";
447 igenibel 358 }
448    
449 igenibel 818 function html_small($text)
450 igenibel 358 {
451 igenibel 818 return "<small>$text</small>";
452     }
453 igenibel 358
454 igenibel 818 function html_font($text, $data)
455     {
456     return "<font $data>$text</font>";
457     }
458 joy 369
459 igenibel 818 function html_color($text, $color)
460     {
461     return "<font color=\"$color\">$text</font>";
462     }
463 joy 369
464 igenibel 818 function html_div($text,$id,$class,$extra)
465     {
466     if($class != "")
467     {
468     return "<div id=\"$id\" class=\"$class\" $extra>$text</div>\n";
469     }else{
470     return "<div id=\"$id\" $extra>$text</div>\n";
471     }
472     }
473 igenibel 358
474 igenibel 818 function html_span($text,$id,$class,$extra)
475     {
476     if($id != "") $id = "id=\"$id\"";
477     if($class != "")
478     {
479     return "<span $id class=\"$class\" $extra>$text</span>\n";
480     }else{
481     return "<span $id $extra>$text</span>\n";
482     }
483     }
484    
485 myon 1132 function html_ul($text, $class)
486 igenibel 834 {
487 myon 1135 if ($class) $class = " class=\"$class\"";
488 myon 1132 return "<ul$class>$text</ul>";
489 igenibel 834 }
490    
491     function html_li($text)
492     {
493     return "<li>$text</li>";
494     }
495    
496 myon 1098 function html_wrap2lines($text)
497     {
498     $list = explode(",", $text);
499     if(count($list) < 2)
500     {
501     return $text;
502     }
503     $half = (int)(count($list)/2);
504     return implode(html_blank(), array_slice($list, 0, $half)) . " " .
505     implode(html_blank(), array_slice($list, $half));
506     }
507 igenibel 834
508 myon 1098
509 igenibel 818 /*
510     This funtion is used to provide the collapsable areas and their title
511     You need to use an auto incremented number in order not to have collisions
512     when expand/collapse an area
513     You need to have a css style class named span_<something>
514     This function return a html valid block
515     */
516     function html_collexp($number, $text, $class, $collapsed, $data)
517     {
518     if($collapsed)
519     {
520     $info = html_blank() . "(click to expand)";
521     $display = "none";
522     }else{
523     $info = html_blank() . "(click to collapse)";
524     $display = "block";
525 igenibel 358 }
526 igenibel 818 $result = html_span($text . html_small("$info") . html_br(),"click_$number", "span_$class", "onmouseover='javascript:objectOver(this)' onmouseout='javascript:objectOut(this)' onclick='javascript:collapse($number,\"$text\")'");
527     $result .= html_div($data, "text_$number", $class, "style='margin-left:0;display:$display'") ;
528     return $result;
529 igenibel 358 }
530    
531 igenibel 818 /*
532     Function needed to know if the columns has to be displayed or not
533     */
534     function isdisplayed($value)
535     {
536     global $arg_cookie;
537     return $arg_cookie[$value];
538     }
539    
540     /*
541     This function is used for the display settings table
542     Note that there is a exception with bugs
543     */
544     function checkbox($value)
545     {
546     global $arg_cookie;
547     if($arg_cookie[$value] == 1)
548     {
549     $data = html_input_radio($value,1,true,"Show\n") . html_br();
550     $data .= html_input_radio($value,0,false,"Hide") . html_br();
551     }else{
552     $data = html_input_radio($value,1,false,"Show\n") . html_br();
553     $data .= html_input_radio($value,0,true,"Hide") . html_br();
554     }
555 igenibel 836 /* if($value == 'version')
556 igenibel 835 {
557     if($arg_cookie[$value] == 2)
558     {
559     $data = html_input_radio($value,1,false,"Show\n") . html_br();
560     $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
561     $data .= html_input_radio($value,2,true,"Without Exp. &amp; Prop. Upt.\n") . html_br();
562     }elseif($arg_cookie[$value] == 1)
563     {
564     $data = html_input_radio($value,1,true,"Show\n") . html_br();
565     $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
566     $data .= html_input_radio($value,2,false,"Without Exp. &amp; Prop. Upt.\n") . html_br();
567     }else{
568     $data = html_input_radio($value,1,false,"Show\n") . html_br();
569     $data .= html_input_radio($value,0,true,"Hide\n") . html_br();
570     $data .= html_input_radio($value,2,false,"Without Exp. &amp; Prop. Upt.\n") . html_br();
571     }
572 igenibel 836 } */
573 igenibel 818 if($value == 'bugs')
574     {
575 myon 1141 $data = html_input_radio($value,1,$arg_cookie[$value] == 1,"Show (1)\n") . html_br();
576     $data .= html_input_radio($value,0,$arg_cookie[$value] == 0,"Hide (0)\n") . html_br();
577     $data .= html_input_radio($value,2,$arg_cookie[$value] == 2,"Sum. (2)\n") . html_br();
578     $data .= html_input_radio($value,3,$arg_cookie[$value] == 3,"Sum.&amp;RC (3)\n") . html_br();
579 igenibel 818 }
580 myon 1135 $data = html_color($data,"green");
581 igenibel 818 return $data;
582     }
583    
584    
585     /*
586     return hidden fields with action parameters to be provided for the form validation
587     */
588     function setaction()
589     {
590     $action = "";
591     global $_GET;
592     foreach(array_keys($_GET) as $key)
593     {
594     if (($key == 'login') or ($key == 'package') or ($key == 'gpg_key') or ($key == 'comaint'))
595     {
596     $action .= html_input_hidden($key,$_GET[$key]);
597     }
598     }
599     return $action;
600     }
601    
602 igenibel 834
603     function process_wnpp_owner($name, $email)
604     {
605 tbm 1115 $null = exec("ldapsearch -h bts2ldap.debian.net -p 10101 -LLL -x -b dc=current,dc=bugs,dc=debian,dc=org '(&(debbugsOwner=*$email*)(debbugsState=open)(debbugsPackage=wnpp))' debbugsID debbugsTitle", $data, $ret);
606 igenibel 834 if(($ret != 0) or (count($data) == 0)) return;
607     $display = "";
608     $temp = "";
609 igenibel 1055 $title = "";
610 igenibel 834 print html_h("$name &lt;$email&gt; is owner:", 3);
611     foreach ($data as $elem)
612     {
613     if (strstr($elem, "debbugsID"))
614     {
615     $temp = str_replace("debbugsID: ", "", $elem);
616     }elseif(strstr($elem, "debbugsTitle"))
617     {
618 igenibel 1055 $title = str_replace("debbugsTitle: ", "", $elem);
619     }elseif(preg_match('/^\s(.+)$/', $elem, $matches))
620     {
621     $title .= $matches[1];
622     }elseif($elem == "")
623     {
624     $display .= html_li(html_a("#" . $temp . ": " . $title, "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=" . $temp));
625 igenibel 834 $temp = "";
626 igenibel 1055 $title = "";
627 igenibel 834 }
628     }
629     print html_ul($display);
630     }
631    
632 igenibel 818 /* These functions provides links to the bts for a maintainer */
633     function bugs_nonfixed($login)
634     {
635     return html_a("Non-fixed bugs, most recent first", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=maint&amp;data=". urlencode($login) . "&amp;archive=no&amp;raw=yes&amp;bug-rev=yes&amp;pend-exc=fixed&amp;pend-exc=done");
636     }
637    
638     function bugs_all_related($login)
639     {
640 igenibel 868 return html_a("All bugs related to &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?maint=". urlencode($login));
641 igenibel 818 }
642    
643     function bugs_rc($login)
644     {
645     return html_a("RC Bugs related to &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=maint&amp;data=" . urlencode($login) . "&amp;archive=no&amp;pend-exc=done&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
646     }
647    
648     function bugs_submitter($login)
649     {
650     return html_a("All bugs submitted by &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=" . urlencode($login));
651     }
652    
653     /* Functions used to construct the correct links in several fields (from bugs_display to stat_bug_link) */
654     function bugs_display($bug_number, $base_url)
655     {
656     $bug_link="";
657     preg_match("/(\d+)\((\d+)\)/", $bug_number, $result);
658     if (strcmp($result[1], $result[2]) == 0)
659     {
660     $bug_link = html_a($result[1], $base_url, "a");
661     }else{
662     $bug_link = html_a($result[1], "${base_url}&amp;repeatmerged=no", "a");
663 myon 1152 $bug_link .= " " . html_color("(", "blue") . html_a($result[2], "${base_url}&amp;repeatmerged=yes", "a") . html_color(")", "blue");
664 igenibel 818 }
665     return $bug_link;
666     }
667    
668     function lintian_link($lintian)
669     {
670     return html_a("Lintian report", "http://lintian.debian.org/reports/m${lintian}.html");
671     }
672    
673 igenibel 966 function buildd_link($buildd, $login)
674 igenibel 818 {
675 igenibel 982 return html_a("Buildd report", "http://buildd.debian.org/bymaint.php?maint=$buildd") . html_blank() . html_a("Igloo's buildd report", "http://people.debian.org/~igloo/status.php?email=". urlencode($login));
676 igenibel 818 }
677    
678     function stat_bug_link($login)
679     {
680     return html_a("Bug statistics", "http://www.debian.gr.jp/~kitame/maint.cgi?num=srcs&amp;limit=0&amp;showpkgs=on&amp;maint=" . urlencode($login));
681     }
682    
683     /* Function is used to display or not the extra features such as pocon, wnpp, and excuses */
684     function do_extra($data, $data_prefix, $error)
685     {
686     global $prefix;
687     $data = str_replace(" ", "+", $data);
688     $filepath = "$prefix/$data_prefix/" . $data{0} . "/$data";
689     if(file_exists($filepath))
690     {
691 igenibel 834 require "$filepath";
692 igenibel 818 }else{
693     print html_h($error, 2);
694     }
695 myon 1105 if($data_prefix == "excuses")
696     {
697     print html_br() . html_a("More excuses", "http://bjorn.haxx.se/debian/testing.pl?package=$data");
698     }
699 igenibel 818 }
700    
701    
702     function printBackLink() {
703     print html_p(html_a("Back to main page", "developer.php", ""));
704     }
705    
706     /* function used to display the main maintainer links in a collapsable area */
707     function print_header_entries_body($keys, $name, $comaint, $login)
708     {
709     global $counter_span;
710     global $prefix;
711     $add_comaint = "&amp;comaint=$comaint";
712     $lintian = preg_replace('/%../', "_", urlencode($name));
713     $lintian = preg_replace('/\+/', "_", $lintian);
714 igenibel 828 $lintian = preg_replace('/-/', "_", $lintian);
715 igenibel 818 $fp = fopen("$prefix/../../ftp/Maintainers", "r");
716     $ok = 0;
717     while(!feof($fp))
718     {
719     $line = freadline($fp, "10240");
720     if (preg_match("/$login/", $line))
721     {
722     $ok = 1;
723     $login = preg_replace('/\\\\/', '', $login);
724     if (preg_match("/$login \(/", $line))
725     {
726     $buildd=urlencode("$login ($name) ");
727     }else{
728     $buildd=urlencode("$name <$login> ");
729     }
730     }
731     if ($ok == 1 )
732     {
733     break;
734     }
735     }
736     fclose($fp);
737     $counter_span += 1;
738 myon 1141 $title = html_b("General information");
739 igenibel 818 $maintainer_data = "";
740 jeroen 1096 /* GPG is broken
741 igenibel 818 if ($keys == "NOID")
742     {
743     $maintainer_data = html_font("GPG key id not found!", 'size="+1" color="red"');
744     $maintainer_data .= html_blank() . html_font("(key id was not found neither in the Debian keyring nor on a public keyserver)", 'size="-2"');
745     $maintainer_data .= html_br();
746     }else{
747     $maintainer_data .= "GPG key id: ";
748     foreach (explode(",", $keys) as $key)
749     {
750     $maintainer_data .= html_small(html_a($key, "developer.php?gpg_key=" .$key . $add_comaint)) . " ";
751     }
752     $maintainer_data .= html_br();
753     }
754 jeroen 1096 */
755 myon 1135 $maintainer_data .= bugs_nonfixed($login) . html_br();
756     $maintainer_data .= bugs_all_related($login) . html_br();
757     $maintainer_data .= bugs_rc($login) . html_br();
758     $maintainer_data .= bugs_submitter($login) . html_br();
759     $maintainer_data .= lintian_link($lintian) . html_br();
760     $maintainer_data .= buildd_link($buildd, $login) . html_br();
761     $maintainer_data .= stat_bug_link($login);
762 igenibel 818 if(file_exists("$prefix/wnpp/" . $login{0} . "/$login"))
763     {
764 myon 1135 $maintainer_data .= html_br() . html_a("Wnpp bugs opened by &lt;$login&gt;", "developer.php?wnpp=$login");
765 igenibel 818 }
766    
767 myon 1135 print html_collexp($counter_span, $title, "general", false, html_small($maintainer_data));
768 igenibel 818 }
769    
770     /* Function used to display the generic information (help and display settings) */
771     function print_header_entries_top($login, $key, $name)
772     {
773     global $counter_span;
774 myon 1141 static $already_displayed;
775     print html_h("Packages overview for $name &lt;$login&gt;", 2, "center");
776 jeroen 1096
777 myon 1141 if($already_displayed) return;
778    
779 igenibel 818 $counter_span += 1;
780 myon 1141 $display_data = html_b(html_em("You need to allow cookies if you want the configuration to be stored. If not, remember/bookmark the right URL that will be provided after submitting changes. "));
781     $display_data .= "You can override the settings by providing an extra arg to the URL (e.g. &amp;buildd=1 if you want to display the buildd column). These args will not change the custom settings you defined before (the cookie is not modified)." . html_br();
782 igenibel 818 $display_data = html_small($display_data);
783     $display_table_th = html_th("Bugs","&amp;bugs=");
784     $display_table_th .= html_th("Version","&amp;version=");
785     $display_table_th .= html_th("Excuses","&amp;excuses=");
786     $display_table_th .= html_th("Binary" . html_br() . "Package Page","&amp;bin=");
787     $display_table_th .= html_th("Buildd","&amp;buildd=");
788     $display_table_th .= html_th("Security","&amp;security=");
789 myon 1131 $display_table_th .= html_th("Debcheck","&amp;problems=");
790 igenibel 818 $display_table_th .= html_th("Uninstallable","&amp;uninstallable=");
791 myon 1132 $display_table_th .= html_th("Popcon","&amp;popc=");
792 igenibel 818 $display_table_th .= html_th("Watch","&amp;watch=");
793     $display_table_th .= html_th("Section","&amp;section=");
794 myon 1141 $display_table_th .= html_th("Uploads","&amp;uploads=");
795    
796 igenibel 818 $display_table_tds = html_td(checkbox('bugs'));
797     $display_table_tds .= html_td(checkbox('version'));
798     $display_table_tds .= html_td(checkbox('excuses'));
799     $display_table_tds .= html_td(checkbox('bin'));
800     $display_table_tds .= html_td(checkbox('buildd'));
801     $display_table_tds .= html_td(checkbox('security'));
802     $display_table_tds .= html_td(checkbox('problems'));
803     $display_table_tds .= html_td(checkbox('uninstallable'));
804 myon 1132 $display_table_tds .= html_td(checkbox('popc'));
805 igenibel 818 $display_table_tds .= html_td(checkbox('watch'));
806     $display_table_tds .= html_td(checkbox('section'));
807 myon 1141 $display_table_tds .= html_td(checkbox('uploads'));
808 igenibel 818
809     $display_table_tr = html_tr($display_table_tds, "left");
810    
811 myon 1135 $display_data .= html_table(html_tr($display_table_th), array($display_table_tr), "", "small") . html_br();
812 myon 1131 $display_data .= "Additional packages to show: ". html_input_text("packages", isdisplayed('packages')) . html_br();
813 igenibel 818
814     $preamble = setaction() . html_input_hidden("set", "yes");
815     $display_data = html_form("GET", $preamble, $display_data, "Submit");
816    
817     $preamble = setaction() . html_input_hidden("reset", "yes");
818     $display_data .= html_form("GET", $preamble, "", "Show all");
819    
820     $title = html_b("Display configuration:");
821     print html_br() . html_collexp($counter_span, $title, "general", true, $display_data);
822    
823     $counter_span += 1;
824 myon 1099 $help_data = html_color("Blue", "blue") . " packages are co-maintained by developer (reference to Uploaders: field)" . html_br();
825 myon 1147 $help_data .= "The 'Bugs' columns display the real number of bugs. If there are merged bugs, the total is in parentheses" . html_br();
826     $help_data .= "Version columns:" . html_br();
827     $help_data .= html_blank(). html_color("Red", "red") . ": NMU" . html_br();
828     $help_data .= html_blank(). html_color("Magenta", "#ff00ff") . ": unstable version differs from testing version" . html_br();
829     $help_data .= "The 'Popcon' column displays the maximal install count for any binary in the source package" . html_br();
830 myon 1099 $help_data .= "Watch columns:" . html_br();
831     $help_data .= html_blank().html_blank(). html_color("green", "green") . ": upstream found version is in sync with version unstable/experimental" . html_br();
832     $help_data .= html_blank().html_blank(). html_color("magenta", "#ff00ff") . ": upstream found version is greater than version in unstable" . html_br();
833     $help_data .= html_blank().html_blank(). html_color("navy blue", "#2222AA") . ": upstream found version is lower than version in unstable (a bug in the watch file)" . html_br();
834     $help_data .= html_blank().html_blank(). html_color("error", "red") . ": uscan had problems following the watch file" . html_br();
835     $help_data .= html_blank().html_blank(). "Watch is N/A: package does not have a watch file" . html_br();
836     $help_data .= html_blank().html_blank(). "Wwiz is N/A: package does not have a copyright file suitable to automatically generate a watch file" . html_br();
837     $help_data .= html_blank().html_blank(). "Wwiz is " . html_color("notmatch", "red") . ": package had a copyright file but no useful URL download link was found to automatically generate a watch file" . html_br();
838 myon 1147 $help_data .= html_blank().html_blank(). html_color("no value", "grey") . ": there is a problem with the dehs database files" . html_br();
839     $help_data .= "The 'uploads' section shows all packages uploaded with this developer's key (NMUs, sponsored uploads)" . html_br().html_br();
840 igenibel 818 $help_data = html_small($help_data);
841    
842     $title = html_b("Help");
843     print html_collexp($counter_span, $title, "general", true, $help_data);
844     $already_displayed = true;
845     }
846    
847    
848     function print_notfound($login)
849     {
850     print html_h("No information available for $login", 2);
851     }
852    
853    
854     /* Construct page provided when no command is provided */
855     function print_form()
856     {
857 myon 1106 $form = html_h("Debian Developer's Packages Overview", 1);
858     $form .= html_p("Use the following search forms to determine the Debian developer whose packages overview you wish to see:");
859 igenibel 818
860 myon 1106 $preamble = "Search based on the Maintainer field in packages:" . html_br();
861 jeroen 1096 $preamble .= html_small("If a single username is provided, @debian.org is automatically appended.") . html_br();
862     $preamble .= html_small("If you start with an uppercase letter or type two words, it is assumed that you want to do a (partial) match on the maintainer name.") . html_br();
863    
864 igenibel 818 $preamble .= html_input_text("login");
865     $preamble = html_label($preamble) . html_br();
866    
867     $form_data = "Display co-maintained packages:" . html_blank();
868     $form_data .= html_input_radio("comaint", "yes", true, "yes");
869     $form_data .= html_input_radio("comaint", "no", false, "no");
870     $form_data .= html_input_radio("comaint", "only", false, "only");
871     $form_data = html_label($form_data) . html_br();
872    
873 myon 1106 $form .= html_form("GET", $preamble, $form_data, "Find");
874 igenibel 818
875 myon 1106 #$preamble = "Search based on the " . html_tt("GPG key ID:") . html_br();
876     #$preamble .= html_input_text("gpg_key");
877     #$preamble = html_label($preamble) . html_br();
878 igenibel 818
879 myon 1106 #$form_data = "Display co-maintained packages:" . html_blank();
880     #$form_data .= html_input_radio("comaint", "yes", true, "yes");
881     #$form_data .= html_input_radio("comaint", "no", false, "no");
882     #$form_data .= html_input_radio("comaint", "only", false, "only");
883     #$form_data = html_label($form_data) .html_br();
884 igenibel 818
885 myon 1106 #$form .= html_form("GET", $preamble, $form_data, "Find") . html_br();
886 igenibel 818
887 myon 1106 $preamble = "Search based on a source package name:" . html_br();
888 igenibel 818 $preamble .= html_input_text("package");
889     $preamble = html_label($preamble) . html_br();
890    
891     $form_data = "Display co-maintained packages:" . html_blank();
892     $form_data .= html_input_radio("comaint", "yes", true, "yes");
893     $form_data .= html_input_radio("comaint", "no", false, "no");
894     $form_data .= html_input_radio("comaint", "only", false, "only");
895     $form_data = html_label($form_data) .html_br();
896    
897 myon 1106 $form .= html_form("GET", $preamble, $form_data, "Find");
898 igenibel 818
899 myon 1106 $query = "Show complete, sorted list of developers (600kB)";
900 igenibel 818 $hidden = html_input_hidden("all", "1");
901 myon 1108 $form .= $query . html_form("GET", $hidden, "", "Show the list");
902 myon 1106
903 myon 1108 $form .= html_h("Subscribing to Packages", 2);
904     $form .= "Additional packages can be added to the list of packages shown. There are two interfaces, mail and URL based.". html_br().html_br();
905     $form .= "Using the DDPO control bot at ". html_a("ddpo@qa.debian.org", "mailto:ddpo@qa.debian.org") .", packages are added to the listing for a login (mail address), optionally sorted in user-defined sections. The following commands are accepted:";
906     $form .= "<pre>user &lt;address&gt;
907     Process commands for &lt;address&gt;. Defaults to the address used in the From:
908     header.
909     subscribe &lt;srcpackage&gt; [&lt;section&gt;]
910     Adds &lt;srcpackage&gt; to the listing. If &lt;section&gt; is omitted, defaults to
911     \"ddpo\". This command can also be used to move &lt;srcpackage&gt; to a different
912     section.
913     unsubscribe &lt;srcpackage&gt;
914     Removes the &lt;srcpackage&gt; from the listing.
915     help
916     Print help text.
917     quit
918     thanks
919     Stops processing commands.
920     </pre>";
921 myon 1147 $form .= "Alternatively, one can append &amp;packages=pkg1+pkg2+... to the URL, or enter package names in the 'Display configuration' form. This will create a new section \"url\" in the listing, independently of the selected login.". html_br().html_br();
922 myon 1108
923     $form .= "Report problems with DDPO to the ". html_a("qa.debian.org pseudopackage", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=qa.debian.org") .".";
924 igenibel 818 print $form;
925     }
926    
927     /* Construct the page where all maintainer are displayed */
928     function print_all()
929     {
930     global $prefix;
931 jeroen 1096 $maint = file("$prefix/ddpo_maintainers");
932 igenibel 818 $html = html_h("Sorted developer list", 2);
933    
934     $display_table_th = html_th("Name and email");
935     $display_table_th .= html_th("main");
936     $display_table_th .= html_th("non-us");
937     $display_table_th .= html_th("Other" . html_br(), html_small("all contrib &amp;" . html_br() . "non-free packages"));
938     $display_table_th .= html_th("Total");
939     $trs = array();
940 jeroen 1096 foreach($maint as $line)
941 igenibel 818 {
942     if($line != "")
943     {
944     $count = 0;
945     $line = preg_replace("/, /", ",", $line);
946 jeroen 1096 preg_match("/;([^;]+?);([^;]+?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*)$/", $line, $info_array);
947 igenibel 818
948 igenibel 837 $tds = html_td(html_b(html_a(str_replace(" ", html_blank(), "$info_array[3]") . html_blank() . "&lt;$info_array[1]&gt;", "developer.php?login=" . rawurlencode($info_array[1]))), 15);
949 igenibel 818 $main = 0;
950     $nonUS = 0;
951     $other = 0;
952     if($info_array[4] != "")
953     {
954     $main += count(explode(" ", $info_array[4]));
955     $count += count(explode(" ", $info_array[4]));
956     }
957     if($info_array[5] != "")
958     {
959     $other += count(explode(" ", $info_array[5]));
960     $count += count(explode(" ", $info_array[5]));
961     }
962     if($info_array[6] != "")
963     {
964     $nonUS += count(explode(" ", $info_array[6]));
965     $count += count(explode(" ", $info_array[6]));
966     }
967     if($info_array[7] != "")
968     {
969     $other += count(explode(" ", $info_array[7]));
970     $count += count(explode(" ", $info_array[7]));
971     }
972     if($info_array[8] != "")
973     {
974     $other += count(explode(" ", $info_array[8]));
975     $count += count(explode(" ", $info_array[8]));
976     }
977     if($info_array[9] != "")
978     {
979     $other += count(explode(" ", $info_array[9]));
980     $count += count(explode(" ", $info_array[9]));
981     }
982    
983     $tds .= html_td($main) . html_td($nonUS) . html_td($other) . html_td(html_b($count));
984     $trs[] = html_tr($tds, "center");
985     }
986     }
987     print html_table(html_tr($display_table_th), $trs, "80");
988     }
989    
990     /* Small useful function to construct the link to the excuses */
991 igenibel 358 function get_rep($package_name)
992     {
993     if(preg_match("/^lib/", $package_name)) {
994     return substr($package_name, 0, 4);
995     }else{
996     return substr($package_name, 0, 1);
997     }
998     }
999 igenibel 796 # Begin of Dehs functions
1000 igenibel 818 function dehsdb_conn ($dbname,$mode)
1001     {
1002 jeroen 1066 $id = dba_open($dbname, $mode, "db4");
1003 igenibel 813 return $id;
1004 igenibel 796 }
1005 igenibel 818
1006     function dehsdb_xml($xml)
1007     {
1008     $p = xml_parser_create();
1009     xml_parse_into_struct($p, $xml, $vals, $index);
1010     xml_parser_free($p);
1011     $values=array("id"=>$vals[1][value],"up_version"=>$vals[2][value],"wwiz"=>$vals[3][value]);
1012     return $values;
1013 igenibel 796 }
1014 igenibel 818 function dehs_value($pkg_name,$dist)
1015     {
1016     $id = dehsdb_conn("/org/qa.debian.org/data/dehs/dehs_qa_" . $dist . ".db","r");
1017     if(!$id) return "error";
1018 igenibel 796 if (!dba_exists($pkg_name,$id)) return array("id"=>"-","up_version"=>"-","wwiz"=>"-");
1019 igenibel 818 $xml=dba_fetch($pkg_name,$id);
1020     dba_close($id);
1021     return dehsdb_xml($xml);
1022 igenibel 796 }
1023     function vers_conv($debvers) {
1024 igenibel 835 preg_match("/(.+:)?([^-]+)(ds|dsfg|debian)/",$debvers,$matches);
1025     if (!$matches[3]) {
1026     unset($matches);
1027     preg_match("/(.+:)?([^-]+)/",$debvers,$matches);
1028     }
1029     if (substr($matches[2],-1)=='.') $matches[2]=substr($matches[2],0,-1);
1030     return $matches[2];
1031 igenibel 796 }
1032     function ver_comp($a,$b) {
1033 igenibel 818 exec("dpkg --compare-versions '$a' gt '" . vers_conv($b) . "'",$output,$res);
1034     if ($res==0) return 1;
1035     exec("dpkg --compare-versions '$a' lt '" . vers_conv($b) . "'",$output,$res);
1036     if ($res==0) return 2;
1037     else return 3;
1038 igenibel 796 }
1039 igenibel 818 function print_dehs($package,$version,$dist,$type)
1040     {
1041     $dehs_values=dehs_value($package,$dist);
1042 myon 1135 if($dehs_values=="error") return html_td(html_color("no value", "grey"));
1043 igenibel 818 if ($type=="up_version")
1044     {
1045 myon 1135 $dehs_link= html_br() . html_a("Details", "http://dehs.alioth.debian.org/maintainer.php?name=" . rawurlencode($package));
1046 igenibel 818 if($dehs_values[up_version]=="-")
1047     {
1048 myon 1135 $dehs_values[up_version] = "-";
1049 igenibel 818 $dehs_link='';
1050     }
1051     elseif ($dehs_values[up_version]=='N/A')
1052     {
1053     $color="black";
1054     }
1055     elseif ($dehs_values[up_version]=='Error') $color="red";
1056     elseif(ver_comp($dehs_values[up_version],$version)==1) $color="magenta";
1057     elseif(ver_comp($dehs_values[up_version],$version)==2) $color="#2222AA";
1058     else {
1059     $color="green";
1060     $dehs_link='';
1061     }
1062 myon 1135 $upstream_print = html_td(html_color($dehs_values[up_version], $color) . $dehs_link, "", 1, 1);
1063 igenibel 818 return $upstream_print;
1064     }else{
1065     $wwiz_link_desc="Details";
1066     if($dehs_values[wwiz]=='-' or !$dehs_values[wwiz])
1067     {
1068 myon 1135 $dehs_values[wwiz] = "-";
1069 igenibel 818 $dehs_link='';
1070     }
1071     elseif ($dehs_values[wwiz]=='N/A') $color="black";
1072     elseif ($dehs_values[wwiz]=='error' OR $dehs_values[wwiz]=='notmatch') $color="red";
1073     elseif(ver_comp($dehs_values[wwiz],$version)==1)
1074     {
1075     $color="magenta";
1076     $wwiz_link_desc="Watch";
1077     }
1078     elseif(ver_comp($dehs_values[wwiz],$version)==2)
1079     {
1080     $color="#2222AA";
1081     $wwiz_link_desc="Watch";
1082     }else{
1083     $color="green";
1084     $wwiz_link_desc="Watch";
1085     }
1086     if(!isset($dehs_link))
1087     {
1088 myon 1135 $dehs_link= html_br() . html_a($wwiz_link_desc, "http://dehs.alioth.debian.org/wwiz_detail.php?id=" . $dehs_values[id] . "&amp;type=watch");
1089 igenibel 818 }
1090 myon 1135 $wwiz_print= html_td(html_color($dehs_values[wwiz], $color, "", 1, 1));
1091 igenibel 818 return $wwiz_print;
1092     }
1093 igenibel 796 }
1094 weasel 362 # Check whether there is a debcheck entry for that package
1095 myon 1131 function debcheckavailable($suite, $package_name)
1096 igenibel 818 {
1097     $package = ereg_replace ("\.", "_", $package_name);
1098     if(ereg ("[^a-zA-Z0-9+_-]", $package) ||
1099 myon 1131 ($suite != "oldstable" && $suite != "stable" && $suite != "testing" && $suite != "unstable"))
1100 igenibel 818 {
1101     return 0;
1102     }
1103     $BASEDIR='/org/qa.debian.org/data/debcheck/result/';
1104 myon 1131 return file_exists($BASEDIR.'/'.$suite.'/packages/'.$package);
1105 weasel 362 }
1106    
1107 igenibel 818 /*
1108 igenibel 869 Print possible wnpp entries and/or removal requests for this source package
1109     as consise links, or nothing if there are none
1110     */
1111     function get_wnpp_rm($package)
1112     {
1113     static $db;
1114 jeroen 1066 if (!$db) $db = dba_open("/org/qa.debian.org/data/bts/wnpp_rm.db", 'r-', 'db4');
1115 igenibel 869 if (!$db) return;
1116     $entries = dba_fetch($package, $db);
1117     if (!$entries) return;
1118     $entries = explode('|', $entries);
1119     $ret = "";
1120     foreach ($entries as $entry) {
1121     preg_match('/(\\S+)\\s+(\\S+)/', $entry, $m);
1122     $ret .= "<a href=\"http://bugs.debian.org/$m[2]\"><strong>[$m[1]]</strong></a>";
1123     }
1124     return $ret;
1125     }
1126    
1127     /*
1128 jeroen 1096 This function prints a package table information row
1129     */
1130     function print_package_entry($branch, $package, $comaint, $back_tr_color)
1131     {
1132     global $prefix;
1133 myon 1132 global $pack_db;
1134 myon 1150 global $seen_packages;
1135 jeroen 1096
1136     # handle co-maintained packages
1137     $uploader = false;
1138     if(strstr($package, "#"))
1139     {
1140     $uploader = 1;
1141     $package = str_replace("#", "", $package);
1142     }
1143     if ((($uploader == 1) && ( $comaint == "no")) ||
1144     (($uploader == 0) && ( $comaint == "only"))) return "";
1145    
1146 myon 1147 # skip already displayed packages
1147     if(in_array($package, $seen_packages)) return "";
1148     $seen_packages[] = $package;
1149    
1150 jeroen 1096 # get package data
1151 myon 1112 $packagedata = dba_fetch($package, $pack_db);
1152     preg_match("/(.+)\((.+)\)/", $packagedata, $result);
1153 myon 1129 $binaries = split (", ", $result[2]);
1154 jeroen 1096
1155 myon 1112 if(strstr($packagedata, "%"))
1156 jeroen 1096 {
1157     $arch_all = 1;
1158 myon 1112 $packagedata = str_replace("%", "", $packagedata);
1159 jeroen 1096 }
1160 myon 1112 preg_match("/(.+?)\[(.+)\]\{(.+)\}\{(.+)\}\{(.+)\}\|(.*)\|:(.*):/", $packagedata, $results);
1161 jeroen 1096 $version = $results[2];
1162     $versions = explode (",", $version);
1163     $version_stable = $versions[0];
1164     $version_testing = $versions[1];
1165     $version_unstable = $versions[2];
1166     $version_prop = $versions[3];
1167     $version_experimental = $versions[4];
1168     $version_experimental_backup= $versions[4];
1169     $security_stable = $versions[5];
1170     $security_testing = $versions[6];
1171 myon 1098 $uninstalable_stable = html_wrap2lines($results[3]);
1172     $uninstalable_testing = html_wrap2lines($results[4]);
1173     $uninstalable_unstable = html_wrap2lines($results[5]);
1174 jeroen 1096 $priority = $results[6];
1175     $section = $results[7];
1176    
1177 myon 1113 $urlpackage = rawurlencode($package);
1178    
1179 jeroen 1096 // make $bugsdb link persistent during this pagerequest, we don't lock, so
1180     // this doesn't matter at all
1181     static $bugsdb;
1182     if (!$bugsdb) $bugsdb = dba_open("$prefix/bugs.db", 'r-', 'db4');
1183    
1184     if (!($bug_list = dba_fetch($package, $bugsdb))) $bug_list = '0(0) 0(0) 0(0) 0(0)';
1185     $bug_list = explode(' ', $bug_list);
1186    
1187     if(strcmp($version_stable, "-") == 0 || !debcheckavailable('stable', $package))
1188     {
1189 myon 1135 $stable_dep = "-";
1190 jeroen 1096 }else{
1191 myon 1135 $stable_dep = html_a("St", "http://qa.debian.org/debcheck.php?dist=stable&amp;package=$urlpackage");
1192 jeroen 1096 }
1193    
1194     if(strcmp($version_testing, "-")== 0 || !debcheckavailable('testing', $package))
1195     {
1196 myon 1135 $testing_dep = "-";
1197 jeroen 1096 }else{
1198 myon 1135 $testing_dep = html_a("Te", "http://qa.debian.org/debcheck.php?dist=testing&amp;package=$urlpackage");
1199 jeroen 1096 }
1200    
1201     if(strcmp($version_unstable, "-")== 0 || !debcheckavailable('unstable', $package))
1202     {
1203 myon 1135 $sid_dep = "-";
1204 jeroen 1096 }else{
1205 myon 1135 $sid_dep = html_a("Un", "http://qa.debian.org/debcheck.php?dist=unstable&amp;package=$urlpackage");
1206 jeroen 1096 }
1207    
1208 myon 1113 $buildd = "http://buildd.debian.org/build.php?pkg=$urlpackage";
1209 myon 1131
1210     $pool = "http://ftp.debian.org/debian/pool/";
1211     if(strstr($section, "non-free"))
1212 jeroen 1096 {
1213 myon 1131 $pool .= "non-free";
1214     }elseif(strstr($section, "contrib"))
1215     {
1216     $pool .= "contrib";
1217 jeroen 1096 }else{
1218 myon 1131 $pool .= "main";
1219 jeroen 1096 }
1220 myon 1131 $pool .= "/" . get_rep($urlpackage) . "/" . $urlpackage . "/";
1221 jeroen 1096
1222     if(file_exists("$prefix/excuses/" . $package{0} . "/$package"))
1223     {
1224 myon 1113 $excuse = html_a("Excuses", "developer.php?excuse=$urlpackage") . " ";
1225     $excuse .= html_a("More", "http://bjorn.haxx.se/debian/testing.pl?package=$urlpackage");
1226 jeroen 1096 }else{
1227     $excuse = "-";
1228     }
1229     if(strcmp($version_prop, "-"))
1230     {
1231     $version_prop = html_color(html_b($version_prop), "#2222AA");
1232     }
1233 myon 1135 $prop = html_td($version_prop);
1234 jeroen 1096
1235     if(strcmp($version_experimental, "-"))
1236     {
1237     $version_experimental = html_color(html_b($version_experimental), "#2222AA");
1238     }
1239 myon 1135 $experimental = html_td($version_experimental);
1240 jeroen 1096
1241    
1242     if((strcmp ($version_stable, $version_testing) == 0) &&
1243     (strcmp ($version_stable, "/") != 0))
1244     {
1245     if((strcmp ($version_unstable, $version_testing) == 0))
1246     {
1247 myon 1135 $version_print = html_td($version_stable, "", 3, 1) . $prop . $experimental;
1248 jeroen 1096 }else{
1249 myon 1135 $version_print = html_td($version_stable, "", 2, 1) . html_td($version_unstable) . $prop . $experimental;
1250 jeroen 1096 }
1251     $ver = explode("-", $version_unstable);
1252     if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))
1253     {
1254     $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);
1255     }
1256     }elseif(strcmp ($version_testing, $version_unstable) == 0)
1257     {
1258     if(strcmp($version_stable, "/") != 0)
1259     {
1260     $version_stable = html_color($version_stable, "#00AADD");
1261     }
1262 myon 1135 $version_print = html_td($version_stable) . html_td($version_testing, "", 2, 1) . $prop . $experimental;
1263 jeroen 1096 $ver = explode("-", $version_unstable);
1264     if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))
1265     {
1266     $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);
1267     }
1268     }else{
1269     if(strcmp($version_stable, "/") != 0)
1270     {
1271 myon 1135 $version_stable = html_color($version_stable, "#00AADD");
1272 jeroen 1096 }
1273 myon 1135 $version_print = html_td($version_stable) . html_td(html_color($version_testing, "#ff00ff")) . html_td($version_unstable) . $prop . $experimental;
1274 jeroen 1096 $ver = explode("-", $version_unstable);
1275     if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))
1276     {
1277     $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);
1278     }
1279     }
1280    
1281 myon 1131 /*
1282     * Create output
1283     */
1284 jeroen 1096
1285 myon 1131 $line_data = html_b(htmlspecialchars($package)) . get_wnpp_rm($package) . html_br() .
1286     html_a("PTS", "http://packages.qa.debian.org/".get_rep($urlpackage)."/$urlpackage.html") . html_blank() .
1287 myon 1132 html_a("Pool", $pool);
1288 myon 1135 $line = html_td(html_color($line_data, $uploader == 1 ? "blue" : ""));
1289 myon 1131
1290 jeroen 1096
1291     /* if bugs >= 1 always print the summary */
1292     if(isdisplayed('bugs'))
1293     {
1294 myon 1113 $bugs = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=$urlpackage&amp;archive=no&amp;pend-exc=pending-fixed&amp;pend-exc=fixed&amp;pend-exc=done";
1295     $bugs_all = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=$urlpackage";
1296 jeroen 1096 $bug_count = $bug_list[0] + $bug_list[1] + $bug_list[2] + $bug_list[3];
1297     $real_bug_count = 0;
1298     $bug_data = "";
1299     foreach($bug_list as $bug_item)
1300     {
1301     preg_match("/\d+\((\d+)\)/", $bug_item, $count_array);
1302     $real_bug_count += $count_array[1];
1303     }
1304     if($bug_count == 0)
1305     {
1306     $bug_data = html_a("-", $bugs_all, "dash");
1307     }else{
1308     $bug_data = bugs_display("$bug_count($real_bug_count)", $bugs_all);
1309     }
1310 myon 1135 $line .= html_td($bug_data);
1311 jeroen 1096
1312     /* user want to display all the bugs info */
1313     if(isdisplayed('bugs') == 1)
1314     {
1315     if(!strcmp($bug_list[0], "0(0)"))
1316     {
1317     $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");
1318     }else{
1319     $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
1320     }
1321 myon 1135 $line .= html_td($bug_data);
1322 jeroen 1096
1323     if(!strcmp($bug_list[1], "0(0)"))
1324     {
1325     $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=important&amp;sev-inc=normal", "dash");
1326     }else{
1327     $bug_data = bugs_display($bug_list[1], "$bugs" . "&amp;sev-inc=important&amp;sev-inc=normal");
1328     }
1329 myon 1135 $line .= html_td($bug_data);
1330 jeroen 1096
1331     if(!strcmp($bug_list[2], "0(0)"))
1332     {
1333     $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=minor&amp;sev-inc=wishlist", "dash");
1334     }else{
1335     $bug_data = bugs_display($bug_list[2], "$bugs" . "&amp;sev-inc=minor&amp;sev-inc=wishlist");
1336     }
1337 myon 1135 $line .= html_td($bug_data);
1338 jeroen 1096
1339     if(!strcmp($bug_list[3], "0(0)"))
1340     {
1341     $bug_data = html_a("-", $bugs_all . "&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed", "dash");
1342     }else{
1343     $bug_data = bugs_display($bug_list[3], $bugs_all ."&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed");
1344     }
1345 myon 1135 $line .= html_td($bug_data);
1346 jeroen 1096 /* user only wants summary + rc bugs count */
1347     }elseif(isdisplayed('bugs') == 3)
1348     {
1349     if(!strcmp($bug_list[0], "0(0)"))
1350     {
1351     $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");
1352     }else{
1353     $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
1354     }
1355 myon 1135 $line .= html_td($bug_data);
1356 jeroen 1096
1357     }
1358     }
1359    
1360     if(isdisplayed('version')) $line .= $version_print;
1361 myon 1135 if(isdisplayed('excuses')) $line .= html_td($excuse);
1362 jeroen 1096 if(isdisplayed('bin'))
1363     {
1364     $bin_display = "";
1365 myon 1129 for ($i = 1; $i <= count($binaries); $i++)
1366 jeroen 1096 {
1367 myon 1129 $bin_package = $binaries[$i - 1];
1368     if (!$bin_package) continue;
1369     $description = dba_fetch("d:$bin_package", $pack_db);
1370 myon 1152 $bin_display .= html_a($i, "http://packages.debian.org/" . rawurlencode($bin_package), "", "$bin_package - $description") . " ";
1371     if (count($binaries) > 9 and $i == 7) {
1372     $bin_display .= "... ";
1373     $i = count($binaries) - 1;
1374     continue;
1375 jeroen 1096 }
1376     }
1377 myon 1135 $line .= html_td($bin_display);
1378 jeroen 1096 }
1379    
1380     if(isdisplayed('buildd'))
1381     {
1382     $buildd_display = "";
1383     if(@$arch_all || preg_match("/non-free/", $branch) || (strcmp($version_unstable, "-") == 0))
1384     {
1385 myon 1135 $buildd_display = html_td("-");
1386 jeroen 1096 $arch_all = 0;
1387     }else{
1388 myon 1135 $buildd_display = html_td(html_a("Buildd", $buildd)
1389 jeroen 1096 . html_br() . html_a("More",
1390 myon 1135 "http://people.debian.org/~igloo/status.php?packages=$urlpackage"));
1391 jeroen 1096 }
1392     $line .= $buildd_display;
1393     }
1394    
1395     if(isdisplayed('security'))
1396     {
1397     if(strcmp($security_stable,"-")) $security_stable = html_color($security_stable, "red");
1398     if(strcmp($security_testing,"-")) $security_testing = html_color($security_testing, "red");
1399 myon 1135 $line .= html_td($security_stable) . html_td($security_testing);
1400 jeroen 1096 }
1401     if(isdisplayed('problems')) $line .= html_td($stable_dep) . html_td($testing_dep) . html_td($sid_dep);
1402 myon 1135 if(isdisplayed('uninstallable')) $line .= html_td($uninstalable_stable) . html_td($uninstalable_testing) . html_td($uninstalable_unstable);
1403 myon 1132
1404     if(isdisplayed('popc'))
1405     {
1406 myon 1135 $line .= html_td(dba_fetch("p:$package", $pack_db) . html_br().
1407     html_a("More", "developer.php?popcon=$urlpackage"));
1408 myon 1132 }
1409    
1410 jeroen 1096 if(isdisplayed('watch'))
1411     {
1412     $line .= print_dehs($package,$version_unstable,"unstable","up_version");
1413     $line .= print_dehs($package,$version_unstable,"unstable","wwiz");
1414     $line .= print_dehs($package,$version_experimental_backup,"experimental","up_version");
1415     $line .= print_dehs($package,$version_experimental_backup,"experimental","wwiz");
1416     }
1417 myon 1135 if(isdisplayed('section')) $line .= html_td($section . html_br() . $priority);
1418 jeroen 1096 return html_tr($line, "center", $back_tr_color);
1419     }
1420    
1421     /*
1422     This function prints a package table information for specific branch
1423 igenibel 818 given in argument
1424     */
1425 igenibel 665 function print_package_entries($branch, $packages, $comaint)
1426 igenibel 358 {
1427 igenibel 818 global $prefix;
1428     $packages = preg_replace ("/, /", ",", $packages);
1429     $pack_array = split(" ", $packages);
1430 jeroen 1096 $arch_all = 0;
1431 igenibel 358
1432 myon 1141 $trs = array();
1433     foreach($pack_array as $package)
1434 igenibel 818 {
1435 myon 1141 $tr = print_package_entry($branch, $package, $comaint, $back_tr_color);
1436     if($tr)
1437 igenibel 818 {
1438 myon 1141 $trs[] = $tr;
1439     $back_tr_color = $back_tr_color ? "" : "#dcdcdc";
1440 igenibel 818 }
1441     }
1442 igenibel 358
1443 myon 1141 if (!count($trs)) return;
1444 joy 369
1445 myon 1141 print html_h("Packages in " . html_em($branch) . " (" . count($trs) . ")", 3);
1446 joy 369
1447 igenibel 818 /* contruct the table header */
1448     $ths = html_th("Source" . html_blank(). "Name", "", 2);
1449     if(isdisplayed('bugs') == 1)
1450     {
1451 myon 1131 $ths .= html_th("Bugs", "", 1, 5);
1452 igenibel 818 }elseif(isdisplayed('bugs') == 2)
1453     {
1454 myon 1131 $ths .= html_th("Bugs", "", 1, 1);
1455 igenibel 818 }elseif(isdisplayed('bugs') == 3)
1456     {
1457 myon 1131 $ths .= html_th("Bugs", "", 1, 2);
1458 igenibel 818 }
1459     if(isdisplayed('version')) $ths .= html_th("Version", "", 1, 5);
1460     if(isdisplayed('excuses')) $ths .= html_th(html_span("Excuses", "", "", "title=\"Raw excuse and Björn Stenberg analysis\""), "", 2, 1);
1461 myon 1152 if(isdisplayed('bin')) $ths .= html_th("Binary" . html_br() . "Package Page", "", 2, 1);
1462 igenibel 818 if(isdisplayed('buildd')) $ths .= html_th("Buildd", "", 2, 1);
1463     if(isdisplayed('security')) $ths .= html_th("Security", "", 1, 2);
1464 myon 1131 if(isdisplayed('problems')) $ths .= html_th("Debcheck", "", 1, 3);
1465     if(isdisplayed('uninstallable')) $ths .= html_th("Uninstallable", "", 1, 3);
1466 myon 1132 if(isdisplayed('popc')) $ths .= html_th("Popcon", "", 2, 1);
1467 igenibel 818 if(isdisplayed('watch')) $ths .= html_th("Watch", "", 1, 4);
1468 myon 1131 if(isdisplayed('section')) $ths .= html_th("Section" . html_br() . "Priority", "", 2, 1);
1469 igenibel 358
1470 igenibel 818 $th_level1 = html_tr($ths);
1471     $ths = "";
1472    
1473     /* the second header line */
1474     if(isdisplayed('bugs') == 1)
1475     {
1476     $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\""));
1477     $ths .= html_th(html_span("RC", "", "", "title=\"Release Critical bugs\""));
1478     $ths .= html_th(html_span("I&amp;N", "", "", "title=\"Important &amp; Normal bugs\""));
1479     $ths .= html_th(html_span("M&amp;W", "", "", "title=\"Minor &amp; Wishlist bugs\""));
1480     $ths .= html_th(html_span("F&amp;P", "", "", "title=\"Fixed &amp; Pending bugs\""));
1481     }
1482     elseif(isdisplayed('bugs') == 2)
1483     {
1484     $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\""));
1485     }
1486     elseif(isdisplayed('bugs') == 3)
1487     {
1488     $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\""));
1489     $ths .= html_th(html_span("RC", "", "", "title=\"Release Critical bugs\""));
1490     }
1491 igenibel 694
1492 igenibel 818 if(isdisplayed('version'))
1493     {
1494     $ths .= html_th("Stable");
1495     $ths .= html_th("Testing");
1496     $ths .= html_th("Unstable");
1497 myon 1131 $ths .= html_th(html_span("Prop Up", "", "", "title=\"Stable Proposed Updates\""));
1498     $ths .= html_th("Exp");
1499 igenibel 818 }
1500     if(isdisplayed('security'))
1501     {
1502 myon 1131 $ths .= html_th("St");
1503     $ths .= html_th("Te");
1504 igenibel 818 }
1505     if(isdisplayed('problems'))
1506     {
1507 myon 1131 $ths .= html_th("St");
1508     $ths .= html_th("Te");
1509     $ths .= html_th("Un");
1510 igenibel 818 }
1511     if(isdisplayed('uninstallable'))
1512     {
1513 myon 1131 $ths .= html_th("St");
1514     $ths .= html_th("Te");
1515     $ths .= html_th("Un");
1516 igenibel 818 }
1517     if(isdisplayed('watch'))
1518     {
1519 myon 1099 $ths .= html_th("Watch Unstable");
1520     $ths .= html_th("WWiz Unstable");
1521 myon 1131 $ths .= html_th("W Exp");
1522     $ths .= html_th("WW Exp");
1523 igenibel 818 }
1524    
1525     $ths = $th_level1 . html_tr($ths);
1526 myon 1135 print html_table($ths, $trs, "", "small");
1527 igenibel 818 }
1528 igenibel 358
1529 myon 1102 function print_subscribed_packages($login, $comaint)
1530     {
1531     global $prefix;
1532     static $subscribe_db;
1533    
1534     # section1:pkg1 pkg2;section2:pkg3
1535     if (!$subscribe_db) $subscribe_db = dba_open("$prefix/ddpo_subscribe.db", 'r-', 'db4');
1536    
1537     $data = dba_fetch($login, $subscribe_db);
1538     if(!$data) { return; }
1539    
1540     $sections = explode(";", $data);
1541     foreach($sections as $section)
1542     {
1543     preg_match("/^([^:]*):(.*)/", $section, $secarray);
1544     print_package_entries($secarray[1], $secarray[2], $comaint);
1545     }
1546     }
1547    
1548 myon 1141 function print_uploaded_packages($login, $comaint)
1549     {
1550     global $prefix;
1551     static $uploads_db;
1552     if (!$uploads_db) $uploads_db = dba_open("$prefix/uploads.db", 'r-', 'db4');
1553    
1554     $packages = dba_fetch($login, $uploads_db);
1555     if(!$packages) { return; }
1556    
1557     print_package_entries("uploads", $packages, $comaint);
1558     }
1559    
1560     function print_developer($login, $key, $name, $comaint, $pack_array)
1561     {
1562     global $branch;
1563    
1564 myon 1150 # reset seen packages list
1565     global $seen_packages;
1566     $seen_packages = array();
1567    
1568 myon 1141 print_header_entries_top($login, $key, $name);
1569     print_header_entries_body($key, $name, $comaint, $login);
1570    
1571     $count = 1;
1572     foreach ($branch as $value)
1573     {
1574     if($pack_array[$count] != "")
1575     {
1576     print_package_entries($value, $pack_array[$count], $comaint);
1577     $no_packages = true;
1578     }elseif(! $no_packages){
1579     print html_h("No packages in unstable", 3);
1580     $no_packages = true;
1581     }
1582     $count += 1;
1583     }
1584     print_subscribed_packages($login, $comaint);
1585     if(isdisplayed('packages'))
1586     print_package_entries("url", isdisplayed('packages'), $comaint);
1587     if(isdisplayed('uploads'))
1588     print_uploaded_packages($login, $comaint);
1589     }
1590    
1591 myon 1132 # popcon
1592    
1593     function print_popcon_entry($package, $back_tr_color)
1594     {
1595     global $pack_db;
1596    
1597     $row = html_tr(
1598     html_td(html_b($package)) .
1599     html_td(dba_fetch("pi:$package", $pack_db)) .
1600 myon 1139 html_td(sprintf("%.2f%%", 100 * dba_fetch("pi:$package", $pack_db) / dba_fetch("pimax:", $pack_db))) .
1601 myon 1132 html_td(dba_fetch("pir:$package", $pack_db)) .
1602     html_td(dba_fetch("pv:$package", $pack_db)) .
1603 myon 1139 html_td(sprintf("%.2f%%", 100 * dba_fetch("pv:$package", $pack_db) / dba_fetch("pvmax:", $pack_db))) .
1604 myon 1132 html_td(dba_fetch("pvr:$package", $pack_db)) .
1605     html_td(dba_fetch("po:$package", $pack_db)) .
1606 myon 1153 html_td(sprintf("%.2f%%", 100 * dba_fetch("po:$package", $pack_db) / dba_fetch("pomax:", $pack_db))) .
1607 myon 1132 html_td(dba_fetch("por:$package", $pack_db)) .
1608     html_td(dba_fetch("pr:$package", $pack_db)) .
1609 myon 1139 html_td(sprintf("%.2f%%", 100 * dba_fetch("pr:$package", $pack_db) / dba_fetch("prmax:", $pack_db))) .
1610 myon 1132 html_td(dba_fetch("prr:$package", $pack_db)) .
1611     html_td(dba_fetch("pn:$package", $pack_db)) .
1612 myon 1139 html_td(sprintf("%.2f%%", 100 * dba_fetch("pn:$package", $pack_db) / dba_fetch("pnmax:", $pack_db))) .
1613 myon 1132 html_td(dba_fetch("pnr:$package", $pack_db)) .
1614 myon 1136 html_td(html_a("Graph", "http://people.debian.org/~igloo/popcon-graphs/index.php?packages=". rawurlencode($package))),
1615 myon 1132 "", $back_tr_color
1616     );
1617     return $row;
1618     }
1619    
1620     function print_popcon($popcon)
1621     {
1622     global $pack_db;
1623     global $counter_span;
1624    
1625     $packagedata = dba_fetch($popcon, $pack_db);
1626     if (!$packagedata) {
1627     print html_h("No Popularity contest entry for $popcon", 2);
1628     return;
1629     }
1630     preg_match("/(.+)\((.+)\)/", $packagedata, $result);
1631     $binaries = split (", ", $result[2]);
1632    
1633     print html_h("Popularity contest statistics for $popcon", 2);
1634     $help = html_ul(
1635     html_li("<b>Name</b> is the package name") .
1636     html_li("<b>Inst.</b> is the number of people who installed this package") .
1637     html_li("<b>Vote</b> is the number of people who use this package regularly") .
1638     html_li("<b>Old</b> is the number of people who installed, but do not use this package regularly") .
1639     html_li("<b>Recent</b> is the number of people who upgraded this package recently") .
1640     html_li("<b>No Files</b> is the number of people whose entry did not contain enough information (atime and ctime were 0)") .
1641     html_li("Within parenthesis the number represents the number of registered popcon users that sent information about this topic"),
1642 myon 1135 "small");
1643 myon 1132 print html_collexp($counter_span, html_b("Help"), "general", true, $help);
1644    
1645     $table = array();
1646     foreach ($binaries as $bin_package) {
1647     $table[] = print_popcon_entry($bin_package, $back_tr_color);
1648     $back_tr_color = $back_tr_color ? "" : "#dcdcdc";
1649     }
1650     print html_table(
1651     html_tr(
1652     html_th("Name", "", 2, 1) .
1653     html_th("Inst (". dba_fetch("pimax:", $pack_db) .")", "1st: ". dba_fetch("pimax:n", $pack_db), 1, 3) .
1654     html_th("Vote (". dba_fetch("pvmax:", $pack_db) .")", "1st: ". dba_fetch("pvmax:n", $pack_db), 1, 3) .
1655     html_th("Old (". dba_fetch("pomax:", $pack_db) .")", "1st: ". dba_fetch("pomax:n", $pack_db), 1, 3) .
1656     html_th("Recent (". dba_fetch("prmax:", $pack_db) .")", "1st: ". dba_fetch("prmax:n", $pack_db), 1, 3) .
1657     html_th("No Files (". dba_fetch("pnmax:", $pack_db) .")", "1st: ". dba_fetch("pnmax:n", $pack_db), 1, 3) .
1658     html_th("Graph", "", 2, 1)) .
1659     html_tr(
1660     html_th("Number") . html_th("%") . html_th("Rank") .
1661     html_th("Number") . html_th("%") . html_th("Rank") .
1662     html_th("Number") . html_th("%") . html_th("Rank") .
1663     html_th("Number") . html_th("%") . html_th("Rank") .
1664     html_th("Number") . html_th("%") . html_th("Rank")),
1665 myon 1135 $table, "", "small");
1666 myon 1132 }
1667    
1668 jeroen 1096 # main program
1669    
1670 myon 1132 # open package info db
1671     # source(binary, binary)[versions]{uninstalable_stable}{_testing}{_unstable}|priority|:section:
1672     $pack_db = dba_open("$prefix/ddpo_packages.db", 'r-', 'db4');
1673    
1674 igenibel 818 if($comaint == "")
1675     {
1676     $comaint = "yes";
1677     }
1678    
1679     if(@$excuse)
1680     {
1681     do_extra($excuse, "excuses", "No excuse for $excuse");
1682     }elseif(@$popcon)
1683     {
1684 myon 1132 print_popcon($popcon);
1685 myon 1135 printBackLink();
1686 myon 1132
1687 igenibel 818 }elseif(@$wnpp)
1688     {
1689     do_extra($wnpp, "wnpp", "No Wnpp entries for $wnpp");
1690 myon 1141
1691 igenibel 818 }else if(@$gpg_key)
1692     {
1693 jeroen 1096 $contents = file("$prefix/ddpo_maintainers");
1694 igenibel 818
1695     $match = 0;
1696     $gpg_key = preg_replace ("/0x/i", "", $gpg_key);
1697     foreach ($contents as $line)
1698     {
1699 jeroen 1096 if(preg_match("/^;[^;]*;[^;]*$gpg_key/i", $line))
1700 igenibel 818 {
1701 jeroen 1096 preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1702 igenibel 818 $match += 1;
1703 myon 1141 print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3));
1704 igenibel 818 print html_br();
1705 jeroen 1096 if($match > 10){ break; }
1706 igenibel 818 }
1707 igenibel 358 }
1708 igenibel 818 if($match == 0)
1709     {
1710     print_notfound($gpg_key);
1711     }
1712     printBackLink();
1713 myon 1141
1714 jeroen 1096 }elseif(@$login)
1715 igenibel 818 {
1716     $login = preg_replace ("/\+/", "\+", $login);
1717 jeroen 1096 if (preg_match("/^[a-z0-9]+$/", $login)) $login .= "@debian.org";
1718 joy 386
1719 jeroen 1096 $contents = file("$prefix/ddpo_maintainers");
1720    
1721 igenibel 836 $match = 0;
1722     foreach($contents as $line)
1723 igenibel 818 {
1724 jeroen 1096 if (preg_match("/^;[^;]*;[^;]*;[^;]*$login/i", $line) || # substring for name
1725     preg_match("/^;$login;/i", $line)) # exact match for mail
1726     {
1727     preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1728     $match += 1;
1729 myon 1141 print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3));
1730 jeroen 1096 print html_br();
1731     if($match > 10){ break; }
1732     }
1733 joy 386 }
1734 myon 1141 if($match == 0) {
1735 jeroen 1096 print_notfound($login);
1736 myon 1141 if(isdisplayed('uploads'))
1737     print_uploaded_packages($login, $comaint);
1738 igenibel 836 }
1739 igenibel 818 printBackLink();
1740 myon 1141
1741 igenibel 818 }elseif(@$package)
1742     {
1743 jeroen 1096 $contents = file("$prefix/ddpo_maintainers");
1744     $package_re = preg_replace("/\+/", ".", $package);
1745 igenibel 665
1746 jeroen 1096 $match = 0;
1747     foreach($contents as $line)
1748     {
1749     if (preg_match("/[; ]${package_re}[; \#]/i", $line))
1750     {
1751     preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1752     $match += 1;
1753 myon 1141 print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3));
1754 igenibel 818 print html_br();
1755 jeroen 1096 if($match > 10){ break; }
1756 igenibel 818 }
1757 igenibel 358 }
1758 jeroen 1096 if($match == 0)
1759 igenibel 818 {
1760     print_notfound($package);
1761     }
1762     printBackLink();
1763 myon 1141
1764 jeroen 1096 }elseif(@$all)
1765     {
1766 igenibel 358 print_all();
1767 jeroen 1096 }else{
1768 igenibel 818 print_form();
1769 igenibel 358 }
1770    
1771 igenibel 818 print_footer();
1772 igenibel 358 ?>
1773 jeroen 1096
1774 myon 1131 # vim:sw=4:ft=php:et:

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5