From e9fe1a9eb100b11fda80f05b5b3239ee97e3a905 Mon Sep 17 00:00:00 2001 From: Mark Weiman Date: Mon, 14 Dec 2015 16:18:16 -0500 Subject: Add link to flag OOD comment Implements: FS#46546 Signed-off-by: Mark Weiman Signed-off-by: Lukas Fleischer --- web/lib/pkgbasefuncs.inc.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'web/lib') diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 1abe426..2b1201d 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -444,6 +444,38 @@ function pkgbase_unflag($base_ids) { } } +/** + * Get package flag OOD comment + * + * @param int $base_id + * + * @return array Tuple of pkgbase ID, reason for OOD, and user who flagged + */ +function pkgbase_get_flag_comment($base_id) { + $base_id = intval($base_id); + $dbh = DB::connect(); + + $q = "SELECT FlaggerComment,OutOfDateTS,Username FROM PackageBases "; + $q.= "LEFT JOIN Users ON FlaggerUID = Users.ID "; + $q.= "WHERE PackageBases.ID = " . $base_id . " "; + $q.= "AND PackageBases.OutOfDateTS IS NOT NULL"; + $result = $dbh->query($q); + + $row = array(); + + if (!$result) { + $row['error'] = __("Error retrieving package details."); + } + else { + $row = $result->fetch(PDO::FETCH_ASSOC); + if (empty($row)) { + $row['error'] = __("Package details could not be found."); + } + } + + return $row; +} + /** * Delete package bases * -- cgit v1.2.3-54-g00ecf