summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/html/login.php2
-rw-r--r--web/lib/acctfuncs.inc.php2
-rw-r--r--web/lib/pkgbasefuncs.inc.php5
-rw-r--r--web/lib/pkgreqfuncs.inc.php12
-rw-r--r--web/lib/routing.inc.php23
-rw-r--r--web/template/header.php2
6 files changed, 26 insertions, 20 deletions
diff --git a/web/html/login.php b/web/html/login.php
index dba3af5..9818d04 100644
--- a/web/html/login.php
+++ b/web/html/login.php
@@ -48,7 +48,7 @@ html_header('AUR ' . __("Login"));
<?php else: ?>
<p>
<?php printf(__("HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."),
- '<a href="' . aur_location() . get_uri('/login') . '">', '</a>'); ?>
+ '<a href="' . get_uri('/login', true) . '">', '</a>'); ?>
</p>
<?php endif; ?>
</div>
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 5e83f42..2d8dbaf 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -660,7 +660,7 @@ function send_resetkey($email, $subject, $body) {
/* Send e-mail with confirmation link. */
$body = wordwrap($body, 70);
- $body .= "\n\n". aur_location() . get_uri('/passreset/') .
+ $body .= "\n\n". get_uri('/passreset/', true) .
"?resetkey={$resetkey}";
$headers = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=UTF-8\r\n" .
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 9cdd8a3..708f861 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -131,8 +131,7 @@ function pkgbase_add_comment($base_id, $uid, $comment) {
* work, users would be getting emails in the language that the
* user who posted the comment was in.
*/
- $body =
- 'from ' . aur_location() . get_pkgbase_uri($row['Name']) . "\n"
+ $body = 'from ' . get_pkgbase_uri($row['Name'], true) . "\n"
. username_from_sid($_COOKIE['AURSID']) . " wrote:\n\n"
. $comment
. "\n\n---\nIf you no longer wish to receive notifications about this package, please go the the above package page and click the UnNotify button.";
@@ -380,7 +379,7 @@ function pkgbase_flag($base_ids) {
$result = $dbh->query($q);
if ($result) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- $body = "Your package " . $row['Name'] . " has been flagged out of date by " . $f_name . " [1]. You may view your package at:\n" . aur_location() . get_pkgbase_uri($row['Name']) . "\n\n[1] - " . aur_location() . get_user_uri($f_name);
+ $body = "Your package " . $row['Name'] . " has been flagged out of date by " . $f_name . " [1]. You may view your package at:\n" . get_pkgbase_uri($row['Name'], true) . "\n\n[1] - " . get_user_uri($f_name, true);
$body = wordwrap($body, 70);
$headers = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=UTF-8\r\n" .
diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php
index e285477..a5d6be8 100644
--- a/web/lib/pkgreqfuncs.inc.php
+++ b/web/lib/pkgreqfuncs.inc.php
@@ -160,15 +160,15 @@ function pkgreq_file($ids, $type, $merge_into, $comments) {
$username . " [1] filed a request to merge " .
$row['Name'] . " [2] into " . $merge_into .
" [3]:\n\n" . $comments . "\n\n" .
- "[1] " . aur_location() . get_user_uri($username) . "\n" .
- "[2] " . aur_location() . get_pkgbase_uri($row['Name']) . "\n" .
- "[3] " . aur_location() . get_pkgbase_uri($merge_into) . "\n";
+ "[1] " . get_user_uri($username, true) . "\n" .
+ "[2] " . get_pkgbase_uri($row['Name'], true) . "\n" .
+ "[3] " . get_pkgbase_uri($merge_into, true) . "\n";
} else {
$body =
$username . " [1] filed a " . $type . " request for " .
$row['Name'] . " [2]:\n\n" . $comments . "\n\n" .
- "[1] " . aur_location() . get_user_uri($username) . "\n" .
- "[2] " . aur_location() . get_pkgbase_uri($row['Name']) . "\n";
+ "[1] " . get_user_uri($username, true) . "\n" .
+ "[2] " . get_pkgbase_uri($row['Name'], true) . "\n";
}
$body = wordwrap($body, 70);
$cc = array_unique($cc);
@@ -278,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] " . get_user_uri($username, true);
$body .= "\n";
}
$body = wordwrap($body, 70);
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php
index 833ea0f..1ee2e35 100644
--- a/web/lib/routing.inc.php
+++ b/web/lib/routing.inc.php
@@ -37,8 +37,12 @@ function get_route($path) {
}
}
-function get_uri($path) {
- return $path;
+function get_uri($path, $absolute=false) {
+ if ($absolute) {
+ return rtrim(aur_location(), '/') . $path;
+ } else {
+ return $path;
+ }
}
function get_pkg_route() {
@@ -56,14 +60,16 @@ function get_pkgreq_route() {
return $PKGREQ_PATH;
}
-function get_pkg_uri($pkgname) {
+function get_pkg_uri($pkgname, $absolute=false) {
global $PKG_PATH;
- return $PKG_PATH . '/' . urlencode($pkgname) . '/';
+ $path = $PKG_PATH . '/' . urlencode($pkgname) . '/';
+ return get_uri($path, $absolute);
}
-function get_pkgbase_uri($pkgbase_name) {
+function get_pkgbase_uri($pkgbase_name, $absolute=false) {
global $PKGBASE_PATH;
- return $PKGBASE_PATH . '/' . urlencode($pkgbase_name) . '/';
+ $path = $PKGBASE_PATH . '/' . urlencode($pkgbase_name) . '/';
+ return get_uri($path, $absolute);
}
function get_user_route() {
@@ -71,7 +77,8 @@ function get_user_route() {
return $USER_PATH;
}
-function get_user_uri($username) {
+function get_user_uri($username, $absolute=false) {
global $USER_PATH;
- return $USER_PATH . '/' . urlencode($username) . '/';
+ $path = $USER_PATH . '/' . urlencode($username) . '/';
+ return get_uri($path, $absolute);
}
diff --git a/web/template/header.php b/web/template/header.php
index 8bc3fd1..6167fb7 100644
--- a/web/template/header.php
+++ b/web/template/header.php
@@ -70,7 +70,7 @@
<?php else: ?>
<li><a href="<?= get_uri('/register/'); ?>"><?= __("Register"); ?></a></li>
<?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?>
- <li><a href="<?= aur_location() . get_uri('/login/'); ?>"><?= __("Login"); ?></a></li>
+ <li><a href="<?= get_uri('/login/', true); ?>"><?= __("Login"); ?></a></li>
<?php else: ?>
<li><a href="<?= get_uri('/login/'); ?>"><?= __("Login"); ?></a></li>
<?php endif; ?>