[aur-dev] [PATCH 10/13] Use URL rewriting for user editing page

canyonknight canyonknight at gmail.com
Sat Sep 15 12:38:15 EDT 2012


Allows for easier account editing and saner URLs. Update account editing links
to use new URL.

Before:
AUR_URL/account/?Action=DisplayAccount&U=userfoo

After:
AUR_URL/account/userfoo/edit

Signed-off-by: canyonknight <canyonknight at gmail.com>
---
 web/html/index.php                      | 10 +++++++++-
 web/template/account_search_results.php |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/web/html/index.php b/web/html/index.php
index e6f3771..8013362 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -51,7 +51,15 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
 } elseif (isset($tokens[1]) && '/' . $tokens[1] == get_user_route()) {
 	if (isset($tokens[2])) {
 		$_REQUEST['U'] = $tokens[2];
-		$_REQUEST['Action'] = "AccountInfo";
+
+		if (isset($tokens[3])) {
+			if ($tokens[3] == 'edit') {
+				$_REQUEST['Action'] = "DisplayAccount";
+			} else {
+				$_REQUEST['Action'] = "AccountInfo";
+			}
+		}
+
 	}
 	include get_route('/' . $tokens[1]);
 } elseif (get_route($path) !== NULL) {
diff --git a/web/template/account_search_results.php b/web/template/account_search_results.php
index 8719928..f67cc6a 100644
--- a/web/template/account_search_results.php
+++ b/web/template/account_search_results.php
@@ -50,7 +50,7 @@ else:
 							print " ";
 						else:
 					?>
-						<a href="<?php echo get_uri('/account/'); ?>?Action=DisplayAccount&ID=<?php echo $row["ID"] ?>"><?php echo __("Edit") ?></a>
+						<a href="<?php echo get_user_uri($row["Username"]) . "edit/" ?>"><?php echo __("Edit") ?></a>
 					<?php endif; ?>
 					</td>
 				</tr>
-- 
1.7.12



More information about the aur-dev mailing list