From e571a694d6e15891b591c28dd40cd464740a7126 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 21 Oct 2011 15:15:55 -0500 Subject: Add a new AUR_LOCATION setting This should be set to something like 'http://localhost' for development or 'https://aur.archlinux.org' in production. It ensures all links in the site stay in the development site and there is no sudden jump from development to production environments. Signed-off-by: Dan McGee Signed-off-by: Lukas Fleischer --- web/lib/aur.inc.php | 1 + web/lib/config.inc.php.proto | 3 +++ web/lib/pkgfuncs.inc.php | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'web/lib') diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index ed0920f..c662b80 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -281,6 +281,7 @@ function html_header($title="") { global $LANG; global $SUPPORTED_LANGS; global $DISABLE_HTTP_LOGIN; + global $AUR_LOCATION; if (!$DISABLE_HTTP_LOGIN || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) { $login = try_login(); diff --git a/web/lib/config.inc.php.proto b/web/lib/config.inc.php.proto index d1f1cd1..1f19651 100644 --- a/web/lib/config.inc.php.proto +++ b/web/lib/config.inc.php.proto @@ -49,3 +49,6 @@ $MAX_FILESIZE_UNCOMPRESSED = 1024 * 1024 * 8; # Allow HTTPs logins only $DISABLE_HTTP_LOGIN = true; + +# Web URL used in email links and absolute redirects, no trailing slash +$AUR_LOCATION = "http://localhost"; diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 558cf3f..4204019 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -301,6 +301,8 @@ function pkgname_is_blacklisted($name, $dbh=NULL) { # display package details # function package_details($id=0, $SID="", $dbh=NULL) { + global $AUR_LOCATION; + if(!$dbh) { $dbh = db_connect(); } @@ -618,6 +620,8 @@ function sanitize_ids($ids) { * @return string Translated success or error messages */ function pkg_flag ($atype, $ids, $action=true, $dbh=NULL) { + global $AUR_LOCATION; + if (!$atype) { if ($action) { return __("You must be logged in before you can flag packages."); @@ -664,7 +668,7 @@ function pkg_flag ($atype, $ids, $action=true, $dbh=NULL) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { # construct email - $body = "Your package " . $row['Name'] . " has been flagged out of date by " . $f_name . " [1]. You may view your package at:\nhttps://aur.archlinux.org/packages.php?ID=" . $row['ID'] . "\n\n[1] - https://aur.archlinux.org/account.php?Action=AccountInfo&ID=" . $f_uid; + $body = "Your package " . $row['Name'] . " has been flagged out of date by " . $f_name . " [1]. You may view your package at:\n" . $AUR_LOCATION . "/packages.php?ID=" . $row['ID'] . "\n\n[1] - " . $AUR_LOCATION . "/account.php?Action=AccountInfo&ID=" . $f_uid; $body = wordwrap($body, 70); $headers = "Reply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR\n"; @mail($row['Email'], "AUR Out-of-date Notification for ".$row['Name'], $body, $headers); -- cgit v1.2.3-70-g09d2