mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use URL rewriting for user info page
Navigation to the "AccountInfo" page should only require a user to know the username of the account they are looking for. Update all AUR links that use the user info page to reflect the new URL. Before: AUR_URL/account/?Action=AccountInfo&U=userfoo After: AUR_URL/account/userfoo Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
440a66ced0
commit
98b6ba9479
6 changed files with 27 additions and 4 deletions
|
@ -47,6 +47,12 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include get_route('/' . $tokens[1]);
|
||||||
|
} elseif (isset($tokens[1]) && '/' . $tokens[1] == get_user_route()) {
|
||||||
|
if (isset($tokens[2])) {
|
||||||
|
$_REQUEST['U'] = $tokens[2];
|
||||||
|
$_REQUEST['Action'] = "AccountInfo";
|
||||||
|
}
|
||||||
include get_route('/' . $tokens[1]);
|
include get_route('/' . $tokens[1]);
|
||||||
} elseif (get_route($path) !== NULL) {
|
} elseif (get_route($path) !== NULL) {
|
||||||
include get_route($path);
|
include get_route($path);
|
||||||
|
|
|
@ -19,7 +19,7 @@ if ($atype == 'Trusted User' || $atype== 'Developer'):
|
||||||
<div class="boxbody">
|
<div class="boxbody">
|
||||||
<ul>
|
<ul>
|
||||||
<?php while (list($indx, $row) = each($votes)): ?>
|
<?php while (list($indx, $row) = each($votes)): ?>
|
||||||
<li><a href="<?php echo get_uri('/account/'); ?>?Action=AccountInfo&ID=<?php echo $row['UsersID'] ?>"><?php echo htmlspecialchars($row['Username']) ?></a></li>
|
<li><a href="<?php echo get_user_uri($row['Username']); ?>"><?php echo htmlspecialchars($row['Username']) ?></a></li>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -827,7 +827,7 @@ function voter_list($voteid, $dbh=NULL) {
|
||||||
$result = $dbh->query($q);
|
$result = $dbh->query($q);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$whovoted.= '<a href="' . get_uri('/accounts/') . '?Action=AccountInfo&ID='.$row['UserID'].'">'.$row['Username'].'</a> ';
|
$whovoted.= '<a href="' . get_user_uri($row['Username']) . '">'.$row['Username'].'</a> ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $whovoted;
|
return $whovoted;
|
||||||
|
|
|
@ -764,7 +764,7 @@ function pkg_flag ($atype, $ids, $action=true, $dbh=NULL) {
|
||||||
if ($result) {
|
if ($result) {
|
||||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
# construct email
|
# construct email
|
||||||
$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_pkg_uri($row['Name']) . "\n\n[1] - " . $AUR_LOCATION . "/" . get_uri('/accounts/') . "?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 . "/" . get_pkg_uri($row['Name']) . "\n\n[1] - " . $AUR_LOCATION . "/" . get_user_uri($f_name);
|
||||||
$body = wordwrap($body, 70);
|
$body = wordwrap($body, 70);
|
||||||
$headers = "Reply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR\n";
|
$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);
|
@mail($row['Email'], "AUR Out-of-date Notification for ".$row['Name'], $body, $headers);
|
||||||
|
|
|
@ -18,6 +18,7 @@ $ROUTES = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
$PKG_PATH = '/packages';
|
$PKG_PATH = '/packages';
|
||||||
|
$USER_PATH = '/account';
|
||||||
|
|
||||||
function get_route($path) {
|
function get_route($path) {
|
||||||
global $ROUTES;
|
global $ROUTES;
|
||||||
|
@ -56,3 +57,19 @@ function get_pkg_uri($pkgname) {
|
||||||
return get_route($PKG_PATH) . '?N=' . urlencode($pkgname);
|
return get_route($PKG_PATH) . '?N=' . urlencode($pkgname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_user_route() {
|
||||||
|
global $USER_PATH;
|
||||||
|
return $USER_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_user_uri($username) {
|
||||||
|
global $USE_VIRTUAL_URLS;
|
||||||
|
global $USER_PATH;
|
||||||
|
|
||||||
|
if ($USE_VIRTUAL_URLS) {
|
||||||
|
return $USER_PATH . '/' . urlencode($username) . '/';
|
||||||
|
} else {
|
||||||
|
return get_route($USER_PATH) . '?U=' . urlencode($username);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ $pkgname = $row['Name'];
|
||||||
|
|
||||||
<?php while (list($indx, $row) = each($comments)): ?>
|
<?php while (list($indx, $row) = each($comments)): ?>
|
||||||
<?php if ($SID):
|
<?php if ($SID):
|
||||||
$row['UserName'] = "<a href=\"" . get_uri('/account/') . "?Action=AccountInfo&ID={$row['UsersID']}\">{$row['UserName']}</a>";
|
$row['UserName'] = "<a href=\"" . get_user_uri($row['UserName']) . "\">{$row['UserName']}</a>";
|
||||||
endif; ?>
|
endif; ?>
|
||||||
<h4>
|
<h4>
|
||||||
<?php if (canDeleteCommentArray($row, $atype, $uid)): ?>
|
<?php if (canDeleteCommentArray($row, $atype, $uid)): ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue