[aur-dev] [PATCH 00/13] Status Update
Hello all, I've been doing quite a bit of testing lately and have collected a few patches. Note that the PDO patch isn't present because it is too large for the mailing list. The following things still need to be fixed: - Account registration needs to be modified to work with URL rewriting - When a user is logged out they get the "adopt package" button on orphan package pages - "View PKGBUILD" and "Download tarball" appear to be broken by rewriting - Move delete and merge to "Package Actions" so that the actions bar is deprecated (maybe?) - Fix undefined notice when a logged out user navigates to a package page - The "Latest Comments" link appends "?comments=all" to URL on every click Anything else? canyonknight (13): Migrate all DB code to use PDO Adjust user directions after registering to reflect new login page logout.php: Fix PHP undefined variable notice Add the new package icon back to the front page Use the "new" icon from archweb for the recent updates table Remove unused image "titlelogo.png" pkg_comment_form.php: Fix PHP undefined variable notice for package "ID" Fix account search page results routing to /account/ Use URL rewriting for user info page Use URL rewriting for user editing page Use URL rewriting for user account update page Overhaul ability to edit own account header.php: Update account editing link INSTALL | 2 +- UPGRADING | 2 + web/html/account.php | 34 +--- web/html/images/new.gif | Bin 116 -> 0 bytes web/html/images/new.png | Bin 0 -> 378 bytes web/html/images/titlelogo.png | Bin 4502 -> 0 bytes web/html/index.php | 21 ++- web/html/logout.php | 2 +- web/html/voters.php | 2 +- web/lib/acctfuncs.inc.php | 245 +++++++++++++------------ web/lib/aur.inc.php | 154 ++++++---------- web/lib/aurjson.class.php | 26 ++- web/lib/cachefuncs.inc.php | 4 +- web/lib/config.inc.php.proto | 3 +- web/lib/pkgfuncs.inc.php | 304 +++++++++++++++++--------------- web/lib/routing.inc.php | 17 ++ web/lib/stats.inc.php | 4 +- web/lib/translator.inc.php | 6 +- web/template/account_edit_form.php | 2 +- web/template/account_search_results.php | 8 +- web/template/header.php | 5 +- web/template/pkg_comment_form.php | 2 +- web/template/pkg_comments.php | 2 +- web/template/search_accounts_form.php | 2 +- web/template/stats/updates_table.php | 3 + 25 files changed, 414 insertions(+), 436 deletions(-) delete mode 100644 web/html/images/new.gif create mode 100644 web/html/images/new.png delete mode 100644 web/html/images/titlelogo.png -- 1.7.12
Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/lib/acctfuncs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 54e8381..e7dcb10 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -195,7 +195,7 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="", print __("The account, %s%s%s, has been successfully created.", "<b>", htmlspecialchars($U,ENT_QUOTES), "</b>"); print "<p>\n"; - print __("Click on the Home link above to login."); + print __("Click on the Login link above to use your account."); print "</p>\n"; } -- 1.7.12
Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/html/logout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/html/logout.php b/web/html/logout.php index 835f1c9..3d059e7 100644 --- a/web/html/logout.php +++ b/web/html/logout.php @@ -10,7 +10,7 @@ include_once("acctfuncs.inc.php"); # access AUR common functions # sending any HTML output. # if (isset($_COOKIE["AURSID"])) { - if (!$dbh) { + if (!isset($dbh)) { $dbh = db_connect(); } delete_session_id($_COOKIE["AURSID"], $dbh); -- 1.7.12
This regression was introduced with d2480e8b9d3d0f946d57fa9422811cb37296b8b4. Re-implement the functionality in a cleaner way. Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/template/stats/updates_table.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/template/stats/updates_table.php b/web/template/stats/updates_table.php index 4955ddc..93eb44f 100644 --- a/web/template/stats/updates_table.php +++ b/web/template/stats/updates_table.php @@ -7,6 +7,9 @@ <tr> <td> <a href="<?php echo get_pkg_uri($row["Name"]); ?>"><?php print htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]); ?></a> + <?php if ($row["ModifiedTS"] === $row["SubmittedTS"]): ?> + <img src="images/new.gif" alt="New!" /> + <?php endif; ?> </td> <td> <span><?php print gmdate("Y-m-d H:i", intval($row["ModifiedTS"])); ?></span> -- 1.7.12
Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/html/images/new.gif | Bin 116 -> 0 bytes web/html/images/new.png | Bin 0 -> 378 bytes web/html/index.php | 4 ++-- web/template/stats/updates_table.php | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 web/html/images/new.gif create mode 100644 web/html/images/new.png diff --git a/web/html/images/new.gif b/web/html/images/new.gif deleted file mode 100644 index 7df4823516538c5c60c6ce442ffeaea6644156dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 116 zcmZ?wbhEHblxN^!SjYeZ|3Lu6Q2fcl$iTqJpabH7<QbS;d-9vQ6z@E$Jb%$;^<=Z( z{|m(&CLYL4TXKx^`Q&L@x0gM8y=$Yzp^g1YAFDRpIm6L;qU)fN(M|?WN8K|=SDoOI M-r^e)#K2$;03sqS!vFvP diff --git a/web/html/images/new.png b/web/html/images/new.png new file mode 100644 index 0000000000000000000000000000000000000000..6a9bf0370708a165d3e49047c09e110e02074a53 GIT binary patch literal 378 zcmV-=0fqjFP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006JZ zHwB960000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz3`s;mR5;7s zlEF#>Q51$RwCw?WgWe;0fi^vY%UagXRhyB(O=1wVPFJlYqlK$kNFcaSBrLFKHcpU( zVj5rP+%se7wuRup#~J3_|C@8?jsx6(aN8gV+_?~^wID=7QAmWo&=P9GzK~Bj7P?xU z4^LybJ-~;P$nL)ri2Lx-f?f?uyKtX3G(76UWeycgm{0H$eX9nWr+ASHH8>r~vom;o zFz$}vYpDI9TZY<K7R&^TnN9E>Lgxm?Z}9nS!RQHI8Y*b~3AE}I>k|Ynq_|_kL0z^} zg`YWG?`i*VRiHt=)+fle*{;CjiLD9r5bPAPFRr!h8&+rODTKm>mjte|vSwTU#7zr+ Y0SIdSJYsEaB>(^b07*qoM6N<$g6XKB5dZ)H literal 0 HcmV?d00001 diff --git a/web/html/index.php b/web/html/index.php index df0d133..7c4eb47 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -59,8 +59,8 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { include "./$path"; break; case "/css/archnavbar/archlogo.gif": - case "/images/new.gif": - header("Content-Type: image/gif"); + case "/images/new.png": + header("Content-Type: image/png"); include "./$path"; break; case "/css/archnavbar/archlogo.png": diff --git a/web/template/stats/updates_table.php b/web/template/stats/updates_table.php index 93eb44f..e7ceec7 100644 --- a/web/template/stats/updates_table.php +++ b/web/template/stats/updates_table.php @@ -8,7 +8,7 @@ <td> <a href="<?php echo get_pkg_uri($row["Name"]); ?>"><?php print htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]); ?></a> <?php if ($row["ModifiedTS"] === $row["SubmittedTS"]): ?> - <img src="images/new.gif" alt="New!" /> + <img src="images/new.png" alt="New!" /> <?php endif; ?> </td> <td> -- 1.7.12
Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/html/images/titlelogo.png | Bin 4502 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 web/html/images/titlelogo.png diff --git a/web/html/images/titlelogo.png b/web/html/images/titlelogo.png deleted file mode 100644 index be7f14c79330f60391cfce0bfa772c349a663251..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4502 zcmV;H5ozv;P)<h;3K|Lk000e1NJLTq00CYA003tQ0{{R3fA`w?00003b3#c}2nYz< z;ZNWI008h%OjJcpO-=9b@0ppI8I;jFq}Zq0=TcHq#l^*Qb8~RL;*!nj-rn9ztlT4+ z)U~y>*4Ebe{QiW5gl1-D-S7BTvEISu?xm%r?DzT^l-4kw)<LG(((3k|((Hr9=6id4 z=H}*%jEq`ZTD`r!W@ct%w&1O;t<22KQLf$Z_xwev+vD;1yWjDdnVHV&@gSGeX}RGl zoYkz@?=+#;|NsBz_4$g(=z78BLapAI&+GO2{mtk0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QNR=nAI)4`u*a<)&H>E3So>({T(iZ^XEr9a<pet2CdIRkjT&x$uyZ`wP~ z*6q7Ta>?1J!yDI|9*(z7<@~KG(eYXEzDA{C$K|m8wjkC1eI~qNz3B=5M#B7-Sp4^S z@S=RqiT<+aaKd0$fP5aju-<ezI$7HMh9zf`J_FuIW^uJS<t0YT{9?jSgm;+TrScTA oxnGPvE8g#ahugHi|D@{se*qz_8?)wNMgRZ+07*qoM6N<$f}KL^umAu6 -- 1.7.12
Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/template/pkg_comment_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php index 95d2cb0..fb3ebff 100644 --- a/web/template/pkg_comment_form.php +++ b/web/template/pkg_comment_form.php @@ -8,7 +8,7 @@ if (isset($_REQUEST['comment']) && check_token()) { } ?> <div> - <input type="hidden" name="ID" value="<?php echo intval($_REQUEST['ID']) ?>" /> + <input type="hidden" name="ID" value="<?php echo intval($row['ID']) ?>" /> <input type="hidden" name="token" value="<?php echo htmlspecialchars($_COOKIE['AURSID']) ?>" /> </div> <p> -- 1.7.12
Account search page has /account/ in the address bar when it should still be /accounts/. The only time /account/ should be used is on a specific user's page. Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/template/account_search_results.php | 4 ++-- web/template/search_accounts_form.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/template/account_search_results.php b/web/template/account_search_results.php index 61887a3..8719928 100644 --- a/web/template/account_search_results.php +++ b/web/template/account_search_results.php @@ -63,7 +63,7 @@ else: <table class="results"> <tr> <td align="left"> - <form action="<?php echo get_uri('/account/'); ?>" method="post"> + <form action="<?php echo get_uri('/accounts/'); ?>" method="post"> <fieldset> <input type="hidden" name="Action" value="SearchAccounts" /> <input type="hidden" name="O" value="<?php echo ($OFFSET-$HITS_PER_PAGE) ?>" /> @@ -78,7 +78,7 @@ else: </form> </td> <td align="right"> - <form action="<?php echo get_uri('/account/'); ?>" method="post"> + <form action="<?php echo get_uri('/accounts/'); ?>" method="post"> <fieldset> <input type="hidden" name="Action" value="SearchAccounts" /> <input type="hidden" name="O" value="<?php echo ($OFFSET+$HITS_PER_PAGE) ?>" /> diff --git a/web/template/search_accounts_form.php b/web/template/search_accounts_form.php index 3080ecd..2fd003a 100644 --- a/web/template/search_accounts_form.php +++ b/web/template/search_accounts_form.php @@ -1,5 +1,5 @@ <br /> -<form action="<?php echo get_uri('/account/'); ?>" method="post"> +<form action="<?php echo get_uri('/accounts/'); ?>" method="post"> <table> <tr> -- 1.7.12
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> --- web/html/index.php | 6 ++++++ web/html/voters.php | 2 +- web/lib/acctfuncs.inc.php | 2 +- web/lib/pkgfuncs.inc.php | 2 +- web/lib/routing.inc.php | 17 +++++++++++++++++ web/template/pkg_comments.php | 2 +- 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/web/html/index.php b/web/html/index.php index 7c4eb47..e6f3771 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -48,6 +48,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]); } elseif (get_route($path) !== NULL) { include get_route($path); } else { diff --git a/web/html/voters.php b/web/html/voters.php index 0ec77ec..41c9d6f 100644 --- a/web/html/voters.php +++ b/web/html/voters.php @@ -19,7 +19,7 @@ if ($atype == 'Trusted User' || $atype== 'Developer'): <div class="boxbody"> <ul> <?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; ?> </ul> </div> diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index e7dcb10..7471d06 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -827,7 +827,7 @@ function voter_list($voteid, $dbh=NULL) { $result = $dbh->query($q); if ($result) { 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; diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 6cdab0f..b2daf0e 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -764,7 +764,7 @@ function pkg_flag ($atype, $ids, $action=true, $dbh=NULL) { if ($result) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) { # 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); $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); diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php index 4ca1150..dfd6942 100644 --- a/web/lib/routing.inc.php +++ b/web/lib/routing.inc.php @@ -18,6 +18,7 @@ $ROUTES = array( ); $PKG_PATH = '/packages'; +$USER_PATH = '/account'; function get_route($path) { global $ROUTES; @@ -56,3 +57,19 @@ function get_pkg_uri($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); + } +} diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index 46c1ef3..d0bd4f8 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -11,7 +11,7 @@ $pkgname = $row['Name']; <?php while (list($indx, $row) = each($comments)): ?> <?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; ?> <h4> <?php if (canDeleteCommentArray($row, $atype, $uid)): ?> -- 1.7.12
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@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
The "UpdateAccount" page displays information as to whether an account update was successful. All POST account info goes to this page, so use it with sane URLs. Before: AUR_URL/account/?Action=UpdateAccount&U=userfoo After: AUR_URL/account/userfoo/update Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/html/index.php | 2 ++ web/template/account_edit_form.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/html/index.php b/web/html/index.php index 8013362..0e36883 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -55,6 +55,8 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { if (isset($tokens[3])) { if ($tokens[3] == 'edit') { $_REQUEST['Action'] = "DisplayAccount"; + } elseif ($tokens[3] == 'update') { + $_REQUEST['Action'] = "UpdateAccount"; } else { $_REQUEST['Action'] = "AccountInfo"; } diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php index 7da8e33..9b5b1d8 100644 --- a/web/template/account_edit_form.php +++ b/web/template/account_edit_form.php @@ -1,4 +1,4 @@ -<form action="<?php echo get_uri('/account/'); ?>" method="post"> +<form action="<?php echo get_user_uri($U) . 'update/'; ?>" method="post"> <fieldset> <input type="hidden" name="Action" value="<?php echo $A ?>" /> <?php if ($UID): ?> -- 1.7.12
* Restructure account.php to remove redundant code. * Remove own_account_details(). * Rework logic check to default to no access to account edit form. * Make default account action viewing account info. Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/html/account.php | 34 +++++++++------------------------- web/html/index.php | 3 ++- web/lib/acctfuncs.inc.php | 18 ------------------ 3 files changed, 11 insertions(+), 44 deletions(-) diff --git a/web/html/account.php b/web/html/account.php index b0906d9..786ae02 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -50,14 +50,15 @@ if (isset($_COOKIE["AURSID"])) { } else { # double check to make sure logged in user can edit this account # - if ($atype == "User" || ($atype == "Trusted User" && $row["AccountType"] == "Developer")) { - print __("You do not have permission to edit this account."); - } else { - + if ($atype == "Developer" || ($atype == "Trusted User" && + $row["AccountType"] != "Developer") || + ($row["ID"] == uid_from_sid($_COOKIE["AURSID"]))) { display_account_form($atype, "UpdateAccount", $row["Username"], - $row["AccountType"], $row["Suspended"], $row["Email"], - "", "", $row["RealName"], $row["LangPreference"], - $row["IRCNick"], $row["PGPKey"], $row["ID"]); + $row["AccountType"], $row["Suspended"], $row["Email"], + "", "", $row["RealName"], $row["LangPreference"], + $row["IRCNick"], $row["PGPKey"], $row["ID"]); + } else { + print __("You do not have permission to edit this account."); } } @@ -89,24 +90,7 @@ if (isset($_COOKIE["AURSID"])) { search_accounts_form(); } else { - # A normal user, give them the ability to edit - # their own account - # - $row = own_account_details($_COOKIE["AURSID"]); - if (empty($row)) { - print __("Could not retrieve information for the specified user."); - } else { - # don't need to check if they have permissions, this is a - # normal user editing themselves. - # - print __("Use this form to update your account."); - print "<br />"; - print __("Leave the password fields blank to keep your same password."); - display_account_form($atype, "UpdateAccount", $row["Username"], - $row["AccountType"], $row["Suspended"], $row["Email"], - "", "", $row["RealName"], $row["LangPreference"], - $row["IRCNick"], $row["PGPKey"], $row["ID"]); - } + print __("You are not allowed to access this area."); } } diff --git a/web/html/index.php b/web/html/index.php index 0e36883..70698a4 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -60,8 +60,9 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { } else { $_REQUEST['Action'] = "AccountInfo"; } + } else { + $_REQUEST['Action'] = "AccountInfo"; } - } include get_route('/' . $tokens[1]); } elseif (get_route($path) !== NULL) { diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 7471d06..ed2c7c6 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -719,24 +719,6 @@ function account_details($uid, $username, $dbh=NULL) { return $row; } -function own_account_details($sid, $dbh=NULL) { - if(!$dbh) { - $dbh = db_connect(); - } - $q = "SELECT Users.*, AccountTypes.AccountType "; - $q.= "FROM Users, AccountTypes, Sessions "; - $q.= "WHERE AccountTypes.ID = Users.AccountTypeID "; - $q.= "AND Users.ID = Sessions.UsersID "; - $q.= "AND Sessions.SessionID = " . $dbh->quote($sid); - $result = $dbh->query($q); - - if ($result) { - $row = $result->fetch(PDO::FETCH_ASSOC); - } - - return $row; -} - function tu_voted($voteid, $uid, $dbh=NULL) { if (!$dbh) { $dbh = db_connect(); -- 1.7.12
* Use AUR_URL/account/userfoo/edit format for own account editing. * Change "Accounts" label to "My Account" for regular users. * Add ability for Developers and Trusted Users to edit their account without having to use the search form first. Signed-off-by: canyonknight <canyonknight@gmail.com> --- web/template/header.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/template/header.php b/web/template/header.php index 52c0ab8..2c04b58 100644 --- a/web/template/header.php +++ b/web/template/header.php @@ -55,7 +55,10 @@ <?php if (isset($_COOKIE['AURSID'])): ?> <li><a href="<?php echo get_uri('/packages/'); ?>?SeB=m&K=<?php print username_from_sid($_COOKIE["AURSID"]); ?>"><?php print __("My Packages"); ?></a></li> <li><a href="<?php echo get_uri('/submit/'); ?>"><?php print __("Submit"); ?></a></li> - <li><a href="<?php echo get_uri('/accounts/'); ?>"><?php print __("Accounts"); ?></a></li> + <?php if (check_user_privileges()): ?> + <li><a href="<?php echo get_uri('/accounts/') ; ?>"><?php print __("Accounts"); ?></a></li> + <?php endif; ?> + <li><a href="<?php echo get_user_uri(username_from_sid($_COOKIE['AURSID'])) . 'edit/'; ?>"><?php print __(" My Account"); ?></a></li> <?php if (check_user_privileges()): ?><li><a href="<?php echo get_uri('/tu/'); ?>"><?php print __("Trusted User"); ?></a></li><?php endif; ?> <li><a href="<?php echo get_uri('/logout/'); ?>"><?php print __("Logout"); ?></a></li> <?php else: ?> -- 1.7.12
On Sat, Sep 15, 2012 at 12:38:06PM -0400, canyonknight wrote:
Hello all,
I've been doing quite a bit of testing lately and have collected a few patches. Note that the PDO patch isn't present because it is too large for the mailing list.
I merged all of your patches into my working branch, including the PDO patch. Good job!
The following things still need to be fixed: - Account registration needs to be modified to work with URL rewriting
The registration form works for me with virtual URLs enabled. Am I missing something?
- When a user is logged out they get the "adopt package" button on orphan package pages
Good catch -- we should probably wrap the whole form in an if-statement that checks the login status.
- "View PKGBUILD" and "Download tarball" appear to be broken by rewriting
I don't think we should deal with that in the code. The virtual URL feature requires specific rewrite rules anyway; exceptions, such as any files in the upload area, can be easily declared using rewrite conditions or "blacklist" rewrite rules.
- Move delete and merge to "Package Actions" so that the actions bar is deprecated (maybe?)
Yes, I intended to do that. Initially, I even planned to move the package deletion form (including removal options, such as the confirmation check box and the target name of a merge operation) to a separate page. I'm not sure whether this breaks the "mass-deletion" feature (using check boxes and the "Actions" drop-down list on the package search results page), though.
- Fix undefined notice when a logged out user navigates to a package page
+1. That's a one-liner.
- The "Latest Comments" link appends "?comments=all" to URL on every click
Yes, should be easy to fix as well.
Anything else?
canyonknight (13): Migrate all DB code to use PDO Adjust user directions after registering to reflect new login page logout.php: Fix PHP undefined variable notice Add the new package icon back to the front page Use the "new" icon from archweb for the recent updates table Remove unused image "titlelogo.png" pkg_comment_form.php: Fix PHP undefined variable notice for package "ID" Fix account search page results routing to /account/ Use URL rewriting for user info page Use URL rewriting for user editing page Use URL rewriting for user account update page Overhaul ability to edit own account header.php: Update account editing link
INSTALL | 2 +- UPGRADING | 2 + web/html/account.php | 34 +--- web/html/images/new.gif | Bin 116 -> 0 bytes web/html/images/new.png | Bin 0 -> 378 bytes web/html/images/titlelogo.png | Bin 4502 -> 0 bytes web/html/index.php | 21 ++- web/html/logout.php | 2 +- web/html/voters.php | 2 +- web/lib/acctfuncs.inc.php | 245 +++++++++++++------------ web/lib/aur.inc.php | 154 ++++++---------- web/lib/aurjson.class.php | 26 ++- web/lib/cachefuncs.inc.php | 4 +- web/lib/config.inc.php.proto | 3 +- web/lib/pkgfuncs.inc.php | 304 +++++++++++++++++--------------- web/lib/routing.inc.php | 17 ++ web/lib/stats.inc.php | 4 +- web/lib/translator.inc.php | 6 +- web/template/account_edit_form.php | 2 +- web/template/account_search_results.php | 8 +- web/template/header.php | 5 +- web/template/pkg_comment_form.php | 2 +- web/template/pkg_comments.php | 2 +- web/template/search_accounts_form.php | 2 +- web/template/stats/updates_table.php | 3 + 25 files changed, 414 insertions(+), 436 deletions(-) delete mode 100644 web/html/images/new.gif create mode 100644 web/html/images/new.png delete mode 100644 web/html/images/titlelogo.png
-- 1.7.12
On Mon, Sep 17, 2012 at 7:48 PM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
On Sat, Sep 15, 2012 at 12:38:06PM -0400, canyonknight wrote:
<snip>
The following things still need to be fixed: - Account registration needs to be modified to work with URL rewriting
The registration form works for me with virtual URLs enabled. Am I missing something?
Nope. It works now. Must have been broken at some point because I wrote it down, but all is well!
- When a user is logged out they get the "adopt package" button on orphan package pages
Good catch -- we should probably wrap the whole form in an if-statement that checks the login status.
Sounds like a safe and easy solution.
- "View PKGBUILD" and "Download tarball" appear to be broken by rewriting
I don't think we should deal with that in the code. The virtual URL feature requires specific rewrite rules anyway; exceptions, such as any files in the upload area, can be easily declared using rewrite conditions or "blacklist" rewrite rules.
Sounds good. A note somewhere in the documentation probably wouldn't be a bad thing.
- Move delete and merge to "Package Actions" so that the actions bar is deprecated (maybe?)
Yes, I intended to do that. Initially, I even planned to move the package deletion form (including removal options, such as the confirmation check box and the target name of a merge operation) to a separate page. I'm not sure whether this breaks the "mass-deletion" feature (using check boxes and the "Actions" drop-down list on the package search results page), though.
That's what I thought. I'll explore whether it breaks "mass-deletion".
- Fix undefined notice when a logged out user navigates to a package page
+1. That's a one-liner.
- The "Latest Comments" link appends "?comments=all" to URL on every click
Yes, should be easy to fix as well.
Thanks!
participants (3)
-
canyonknight
-
canyonknight@gmail.com
-
Lukas Fleischer