diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/html/pkgbase.php | 7 | ||||
-rw-r--r-- | web/html/pkgflag.php | 5 | ||||
-rw-r--r-- | web/lib/pkgbasefuncs.inc.php | 14 |
3 files changed, 19 insertions, 7 deletions
diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php index bc32e43c..a241c749 100644 --- a/web/html/pkgbase.php +++ b/web/html/pkgbase.php @@ -49,7 +49,12 @@ $output = ""; $fragment = ""; if (check_token()) { if (current_action("do_Flag")) { - list($ret, $output) = pkgbase_flag($ids); + if (strlen($_POST['comments']) >= 3) { + list($ret, $output) = pkgbase_flag($ids, $_POST['comments']); + } else { + $output = __("The selected packages have not been flagged, please enter a comment."); + $ret = false; + } } elseif (current_action("do_UnFlag")) { list($ret, $output) = pkgbase_unflag($ids); } elseif (current_action("do_Adopt")) { diff --git a/web/html/pkgflag.php b/web/html/pkgflag.php index 9d86909d..bfe89e03 100644 --- a/web/html/pkgflag.php +++ b/web/html/pkgflag.php @@ -25,12 +25,17 @@ if (has_credential(CRED_PKGBASE_FLAG)): ?> <p> <?= __('Please do %snot%s use this form to report bugs. Use the package comments instead.', '<strong>', '</strong>'); ?> + <?= __('Enter details on why the package is out-of-date below, preferably including links to the release announcement or the new release tarball.'); ?> </p> <form action="<?= get_uri('/pkgbase/'); ?>" method="post"> <fieldset> <input type="hidden" name="IDs[<?= $base_id ?>]" value="1" /> <input type="hidden" name="ID" value="<?= $base_id ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> + <p> + <label for="id_comments"><?= __("Comments") ?>:</label> + <textarea name="comments" id="id_comments" rows="5" cols="50"></textarea> + </p> <p><input type="submit" class="button" name="do_Flag" value="<?= __("Flag") ?>" /></p> </fieldset> </form> diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 24d3393f..799f1da9 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -316,10 +316,11 @@ function pkgbase_maintainer_uids($base_ids) { * Flag package(s) as out-of-date * * @param array $base_ids Array of package base IDs to flag/unflag + * @param string $comment The comment to add * * @return array Tuple of success/failure indicator and error message */ -function pkgbase_flag($base_ids) { +function pkgbase_flag($base_ids, $comment) { if (!has_credential(CRED_PKGBASE_FLAG)) { return array(false, __("You must be logged in before you can flag packages.")); } @@ -332,14 +333,15 @@ function pkgbase_flag($base_ids) { $uid = uid_from_sid($_COOKIE['AURSID']); $dbh = DB::connect(); - $q = "UPDATE PackageBases SET"; - $q.= " OutOfDateTS = UNIX_TIMESTAMP(), FlaggerUID = " . $uid; - $q.= " WHERE ID IN (" . implode(",", $base_ids) . ")"; - $q.= " AND OutOfDateTS IS NULL"; + $q = "UPDATE PackageBases SET "; + $q.= "OutOfDateTS = UNIX_TIMESTAMP(), FlaggerUID = " . $uid . ", "; + $q.= "FlaggerComment = " . $dbh->quote($comment) . " "; + $q.= "WHERE ID IN (" . implode(",", $base_ids) . ") "; + $q.= "AND OutOfDateTS IS NULL"; $dbh->exec($q); foreach ($base_ids as $base_id) { - notify(array('flag', $uid, $base_id)); + notify(array('flag', $uid, $base_id), $comment); } return array(true, __("The selected packages have been flagged out-of-date.")); |