svn: /web/php-bugs/trunk/ include/functions.php include/query.php www/bug.php www/fix.php www/report.php www/search.php

From: Date: Wed, 12 Oct 2011 17:48:44 +0000
Subject: svn: /web/php-bugs/trunk/ include/functions.php include/query.php www/bug.php www/fix.php www/report.php www/search.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-12359@lists.php.net to get a copy of this message
felipe Wed, 12 Oct 2011 17:48:44 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=318054 Log: - Added option to search for project (php, pecl) - Restored behavior to send mail to package maintainers instead of pecl lists Changed paths: U web/php-bugs/trunk/include/functions.php U web/php-bugs/trunk/include/query.php U web/php-bugs/trunk/www/bug.php U web/php-bugs/trunk/www/fix.php U web/php-bugs/trunk/www/report.php U web/php-bugs/trunk/www/search.php Modified: web/php-bugs/trunk/include/functions.php =================================================================== --- web/php-bugs/trunk/include/functions.php 2011-10-12 17:22:41 UTC (rev 318053) +++ web/php-bugs/trunk/include/functions.php 2011-10-12 17:48:44 UTC (rev 318054) @@ -33,6 +33,11 @@ 'Security' => 'Sec Bug' ); +$project_types = array( + 'PHP' => 'php', + 'PECL' => 'pecl' +); + // Used in show_state_options() $state_types = array ( 'Open' => 2, @@ -195,11 +200,19 @@ */ function get_pseudo_packages ($project, $return_disabled = true) { + global $project_types; + require_once 'Tree/Tree.php'; - $where = "project IN ('', '$project')"; - if (!$return_disabled) + $where = '1=1'; + $project = strtolower($project); + + if ($project !== false && in_array($project, $project_types)) { + $where .= " AND project IN ('', '". $project ."')"; + } + if (!$return_disabled) { $where.= " AND disabled = 0"; + } $pseudo_pkgs = array(); $tree = Tree::setup ( @@ -467,6 +480,40 @@ } /** + * Prints bug project <option>'s for use in a <select> + * + * Options include "PHP" and "PECL". + * + * @param string $current bug's current project + * @param bool $all whether or not 'All' should be an option + * + * @retun void + */ +function show_project_options($current = 'php', $all = false) +{ + global $project_types; + + if ($all) { + if (!$current) { + $current = 'All'; + } + echo '<option value="All"'; + if ($current == 'All') { + echo ' selected="selected"'; + } + echo ">All</option>\n"; + } elseif (!$current) { + $current = 'php'; + } else { + $current = strtolower($current); + } + + foreach ($project_types as $k => $v) { + echo '<option value="', $k, '"', (($current == strtolower($k)) ? ' selected="selected"' : ''), ">{$k}</option>\n"; + } +} + +/** * Prints bug type <option>'s for use in a <select> * * Options include "Bug", "Documentation Problem" and "Feature/Change Request." @@ -1259,6 +1306,7 @@ $to = array(); $params = '-f noreply@php.net'; + $mailfrom = $bugEmail; if ($bug_type === 'Documentation Problem') { // Documentation problems *always* go to the doc team @@ -1271,7 +1319,7 @@ else { /* Get package mailing list address */ $res = $dbh->prepare(' - SELECT list_email + SELECT list_email, project FROM bugdb_pseudo_packages WHERE name = ? ')->execute(array($package_name)); @@ -1280,15 +1328,33 @@ throw new Exception('SQL Error in get_package_name(): ' . $res->getMessage()); } - $list_email = $res->fetchOne(); + list($list_email, $project) = $res->->fetchRow(MDB2_FETCHMODE_ASSOC); + + if ($project == 'pecl') { + $mailfrom = 'pecl-dev@lists.php.net'; + } if ($list_email) { if ($list_email == 'systems@php.net') { $params = '-f bounce-no-user@php.net'; } $to[] = $list_email; - } else { // Fall back to default mailing list - $to[] = $bugEmail; + } else { + // Get the maintainers handle + if ($project == 'pecl') { + $handles = $dbh->prepare("SELECT GROUP_CONCAT(handle) FROM bugdb_packages_maintainers WHERE package_name = ?")->execute(array($package_name))->fetchOne(); + + if ($handles) { + foreach (explode(',', $handles) as $handle) { + $to[] = $handle .'@php.net'; + } + } else { + $to[] = $mailfrom; + } + } else { + // Fall back to default mailing list + $to[] = $bugEmail; + } } } Modified: web/php-bugs/trunk/include/query.php =================================================================== --- web/php-bugs/trunk/include/query.php 2011-10-12 17:22:41 UTC (rev 318053) +++ web/php-bugs/trunk/include/query.php 2011-10-12 17:48:44 UTC (rev 318054) @@ -37,6 +37,7 @@ $private = !empty($_GET['private']) ? $_GET['private'] : ''; $begin = (int) (!empty($_GET['begin']) ? $_GET['begin'] : 0); $limit = (defined('MAX_BUGS_RETURN')) ? MAX_BUGS_RETURN : 30; +$project = (!empty($_GET['project']) && $_GET['project'] != 'All') ? $_GET['project'] : ''; if (!empty($_GET['limit'])) { $limit = ($_GET['limit'] == 'All') ? 'All' : (($_GET['limit'] > 0) ? (int) $_GET['limit'] : $limit); } @@ -165,6 +166,10 @@ $where_clause .= " AND bugdb.php_version LIKE '" . $dbh->escape($phpver) . "%'"; } + if ($project != '') { + $where_clause .= " AND EXISTS (SELECT 1 FROM bugdb_pseudo_packages b WHERE b.name = bugdb.package_name AND b.project = '". $dbh->escape($project) ."' LIMIT 1)"; + } + if ($cve_id != '') { $where_clause .= " AND bugdb.cve_id {$cve_id_not} LIKE '" . $dbh->escape($cve_id) . "%'"; } Modified: web/php-bugs/trunk/www/bug.php =================================================================== --- web/php-bugs/trunk/www/bug.php 2011-10-12 17:22:41 UTC (rev 318053) +++ web/php-bugs/trunk/www/bug.php 2011-10-12 17:48:44 UTC (rev 318054) @@ -169,14 +169,16 @@ // Handle any updates, displaying errors if there were any $RESOLVE_REASONS = $FIX_VARIATIONS = $pseudo_pkgs = array(); +$project = !empty($_GET['project']) ? $_GET['project'] : false; + // Only fetch stuff when it's really needed if ($edit && $edit < 3) { - $pseudo_pkgs = get_pseudo_packages($site, false); // false == no read-only packages included + $pseudo_pkgs = get_pseudo_packages($project, false); // false == no read-only packages included } // Fetch RESOLVE_REASONS array if ($edit === 1) { - list($RESOLVE_REASONS, $FIX_VARIATIONS) = get_resolve_reasons($site); + list($RESOLVE_REASONS, $FIX_VARIATIONS) = get_resolve_reasons($project); } if (isset($_POST['ncomment']) && !isset($_POST['preview']) && $edit == 3) { Modified: web/php-bugs/trunk/www/fix.php =================================================================== --- web/php-bugs/trunk/www/fix.php 2011-10-12 17:22:41 UTC (rev 318053) +++ web/php-bugs/trunk/www/fix.php 2011-10-12 17:48:44 UTC (rev 318054) @@ -33,6 +33,8 @@ $errors[] = 'The username or password you supplied was incorrect.'; } +$project = !empty($_GET['project']) ? $_GET['project'] : false; + list($RESOLVE_REASONS, $FIX_VARIATIONS) = get_resolve_reasons($site); // Handle reason / comments Modified: web/php-bugs/trunk/www/report.php =================================================================== --- web/php-bugs/trunk/www/report.php 2011-10-12 17:22:41 UTC (rev 318053) +++ web/php-bugs/trunk/www/report.php 2011-10-12 17:48:44 UTC (rev 318054) @@ -254,9 +254,11 @@ } else { $type = 'unknown'; } + + $project = !empty($_GET['project']) ? $_GET['project'] : false; // provide shortcut URLS for "quick bug fixes" - list($RESOLVE_REASONS, $FIX_VARIATIONS) = get_resolve_reasons($site); + list($RESOLVE_REASONS, $FIX_VARIATIONS) = get_resolve_reasons($project); $dev_extra = ''; $maxkeysize = 0; Modified: web/php-bugs/trunk/www/search.php =================================================================== --- web/php-bugs/trunk/www/search.php 2011-10-12 17:22:41 UTC (rev 318053) +++ web/php-bugs/trunk/www/search.php 2011-10-12 17:48:44 UTC (rev 318054) @@ -202,7 +202,7 @@ (<a href="search-howto.php" target="_new">?</a>) </small> </td> - <td rowspan="3"> + <td rowspan="4"> <select name="limit"><?php show_limit_options($limit);?></select> &nbsp; <select name="order_by"><?php show_order_options($limit);?></select> @@ -233,6 +233,13 @@ </td> <td><select id="bug_type" name="bug_type"><?php show_type_options($bug_type, true);?></select></td> </tr> +<tr valign="top"> + <th>Project</th> + <td style="white-space: nowrap"> + <label for="bug_type">Return bugs with <b>project</b></label> + </td> + <td><select id="project" name="project"><?php show_project_options($project, true);?></select></td> +</tr> </table> <table style="font-size: 100%;">

« previous php.webmaster (#12359) next »