From 76343fb91511b9f53e58b6c01b258bfe00ddb4c6 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 24 Oct 2014 08:31:47 +0200 Subject: Use an INI-style configuration file Replace web/lib/config.inc.php with an INI-style configuration file. This allows us to get rid of several globals and makes it easier to use the same configuration file in external scripts. Signed-off-by: Lukas Fleischer --- web/lib/pkgreqfuncs.inc.php | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'web/lib/pkgreqfuncs.inc.php') diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php index 1b54a6a..e285477 100644 --- a/web/lib/pkgreqfuncs.inc.php +++ b/web/lib/pkgreqfuncs.inc.php @@ -1,5 +1,6 @@ 0 && - time() - $details['OutOfDateTS'] >= $AUTO_ORPHAN_AGE && - $AUTO_ORPHAN_AGE > 0) { + time() - $details['OutOfDateTS'] >= $auto_orphan_age && + $auto_orphan_age > 0) { /* * Close package request. NOTE: This needs to happen *before* * the actual disown operation. Otherwise, the former @@ -214,8 +209,6 @@ function pkgreq_file($ids, $type, $merge_into, $comments) { /** * Close a deletion/orphan request * - * @global string $AUR_LOCATION The AUR's URL used for notification e-mails - * @global string $AUR_REQUEST_ML The request notification mailing list * @param int $id The package request to close * @param string $reason Whether the request was accepted or rejected * @param string $comments Comments to be added to the notification email @@ -224,9 +217,6 @@ function pkgreq_file($ids, $type, $merge_into, $comments) { * @return array Tuple of success/failure indicator and error message */ function pkgreq_close($id, $reason, $comments, $auto_close=false) { - global $AUR_LOCATION; - global $AUR_REQUEST_ML; - switch ($reason) { case 'accepted': $status = 2; @@ -288,7 +278,7 @@ function pkgreq_close($id, $reason, $comments, $auto_close=false) { } if (!$auto_close) { $body .= "\n"; - $body .= "[1] " . $AUR_LOCATION . get_user_uri($username); + $body .= "[1] " . aur_location() . get_user_uri($username); $body .= "\n"; } $body = wordwrap($body, 70); @@ -301,7 +291,8 @@ function pkgreq_close($id, $reason, $comments, $auto_close=false) { "In-Reply-To: $thread_id\r\n" . "References: $thread_id\r\n" . "X-Mailer: AUR"; - @mail($AUR_REQUEST_ML, "[PRQ#" . $id . "] Request " . ucfirst($reason), + $ml = config_get('options', 'aur_request_ml'); + @mail($ml, "[PRQ#" . $id . "] Request " . ucfirst($reason), $body, $headers); return array(true, __("Request closed successfully.")); -- cgit v1.2.3-70-g09d2