cvs: pearweb /public_html/bugs bug.php

From: Date: Thu, 20 Mar 2008 22:43:14 +0000
Subject: cvs: pearweb /public_html/bugs bug.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7345@lists.php.net to get a copy of this message
dufuz Thu Mar 20 22:43:14 2008 UTC Modified files: /pearweb/public_html/bugs bug.php Log: Doing the inital code for Request #12520 Reenable comment deleting for certain types of users # pear.bug.admin still has the final say in the deleting process, pear.dev people # can hide comments, admins then either activate it again or delete it # requires a UI and fun stuff like that http://cvs.php.net/viewvc.cgi/pearweb/public_html/bugs/bug.php?r1=1.193&r2=1.194&diff_format=u Index: pearweb/public_html/bugs/bug.php diff -u pearweb/public_html/bugs/bug.php:1.193 pearweb/public_html/bugs/bug.php:1.194 --- pearweb/public_html/bugs/bug.php:1.193 Sun Mar 16 15:13:49 2008 +++ pearweb/public_html/bugs/bug.php Thu Mar 20 22:43:14 2008 @@ -15,7 +15,7 @@ * @package Bugs * @copyright Copyright (c) 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id: bug.php,v 1.193 2008/03/16 15:13:49 dufuz Exp $ + * @version $Id: bug.php,v 1.194 2008/03/20 22:43:14 dufuz Exp $ */ /* @@ -206,15 +206,27 @@ $previous = $current = array(); // Delete comment -if ($edit == 1 && isset($auth_user) && $auth_user - && $auth_user->registered && isset($_GET['delete_comment'])) { +if ($edit === 1 && isset($auth_user) && $auth_user && $auth_user->registered) { $addon = ''; - if (auth_check('pear.dev')) { + if (isset($_GET['hide_comment']) && auth_check('pear.dev')) { + hide_comment($id, (int)$_GET['hide_comment']); + $addon = '&thanks=1'; + } + + if (isset($_GET['show_comment']) && auth_check('pear.bug.admin')) { + show_comment($id, (int)$_GET['show_comment']); + $addon = '&thanks=1'; + } + + if (isset($_GET['delete_comment']) && auth_check('pear.bug.admin')) { delete_comment($id, (int)$_GET['delete_comment']); $addon = '&thanks=1'; } - localRedirect('bug.php' . "?id=$id&edit=1$addon"); - exit; + + if ($addon !== '') { + localRedirect("bug.php?id=$id&edit=1$addon"); + exit; + } } // handle any updates, displaying errors if there were any @@ -1267,7 +1279,9 @@ if ($comment_name && $registered) { echo '(' . htmlspecialchars($comment_name) . ')'; } - echo ($edit == 1 && $com_id !== 0 && auth_check('pear.bug.admin')) ? "<a href=\"".htmlspecialchars($_SERVER['PHP_SELF'])."?id=$id&amp;edit=1&amp;delete_comment=$com_id\">[delete]</a>\n" : ''; + if ($edit === 1 && $com_id !== 0 && auth_check('pear.dev')) { + echo "&nbsp<a href=\"".htmlspecialchars($_SERVER['PHP_SELF'])."?id=$id&amp;edit=1&amp;delete_comment=$com_id\">[delete]</a>\n"; + } echo '<pre class="note">'. "\n"; // This has to be done so we don't wordwrap the changeset part again @@ -1282,6 +1296,23 @@ echo '</div>' . "\n"; } +/** + * This function only hides the comment so pear.bug.admin people can review it + */ +function hide_comment($id, $com_id) +{ + global $dbh; + $query ='UPDATE bugdb_comments SET active = 0 WHERE bug='.(int)$id.' AND id='.(int)$com_id; + $res =& $dbh->query($query); +} + +function show_comment($id, $com_id) +{ + global $dbh; + $query ='UPDATE bugdb_comments SET active = 1 WHERE bug='.(int)$id.' AND id='.(int)$com_id; + $res =& $dbh->query($query); +} + function delete_comment($id, $com_id) { global $dbh;

« previous php.pear.core (#7345) next »