Signed-off-by: Nathan Jones <nathanj@insightbb.com> --- web/html/packages.php | 24 ++++++++++++++++++++++++ web/html/pkgedit.php | 9 +++++++++ web/lib/pkgfuncs.inc | 29 +++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 0 deletions(-) diff --git a/web/html/packages.php b/web/html/packages.php index ca2b26a..07220a2 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -37,26 +37,44 @@ if ($_POST['action'] == "do_Flag" || isset($_POST['do_Flag'])) { print "<p>"; print pkg_flag($atype, $ids, True); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_UnFlag" || isset($_POST['do_UnFlag'])) { print "<p>"; print pkg_flag($atype, $ids, False); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_Adopt" || isset($_POST['do_Adopt'])) { print "<p>"; print pkg_adopt($atype, $ids, True); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_Disown" || isset($_POST['do_Disown'])) { print "<p>"; print pkg_adopt($atype, $ids, False); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_Vote" || isset($_POST['do_Vote'])) { print "<p>"; print pkg_vote($atype, $ids, True); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_UnVote" || isset($_POST['do_UnVote'])) { print "<p>"; print pkg_vote($atype, $ids, False); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_Delete" || isset($_POST['do_Delete'])) { print "<p>"; print pkg_delete($atype, $ids); @@ -65,10 +83,16 @@ if ($_POST['action'] == "do_Flag" || isset($_POST['do_Flag'])) { print "<p>"; print pkg_notify($atype, $ids); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif ($_POST['action'] == "do_UnNotify" || isset($_POST['do_UnNotify'])) { print "<p>"; print pkg_notify($atype, $ids, False); print "</p>"; + print "<p>"; + print pkg_backlink($ids); + print "</p>"; } elseif (isset($_GET["ID"])) { if (!intval($_GET["ID"])) { diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php index 974f14b..d2e36d3 100644 --- a/web/html/pkgedit.php +++ b/web/html/pkgedit.php @@ -51,6 +51,9 @@ if ($_REQUEST["del_Comment"]) { } else { print __("Missing comment ID.")."<br />\n"; } + print "<p>"; + print pkg_backlink($_REQUEST["ID"]); + print "</p>"; html_footer(AUR_VERSION); exit(); } @@ -69,6 +72,9 @@ if ($_REQUEST["add_Comment"]) { $q.= "UNIX_TIMESTAMP())"; db_query($q, $dbh); print __("Comment has been added."); + print "<p>"; + print pkg_backlink($_REQUEST["ID"]); + print "</p>"; # Send email notifications # @@ -135,6 +141,9 @@ if ($_REQUEST["change_Category"]) { } else { print __("Invalid category ID.")."<br />\n"; } + print "<p>"; + print pkg_backlink($_REQUEST["ID"]); + print "</p>"; } else { # Prompt visitor for new category_id # diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index d383536..1e88009 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -1374,3 +1374,32 @@ function pkg_notify ($atype, $ids, $action = True) { return $output; } +/** + * Creates a return to package link + * + * @param array $ids Array of package IDs to flag/unflag, formatted as + * $package_id => $useless_crap. The array must only have one entry in it. + * If $ids is a string, it will be used as the id. + * + * @return string Translated return to package link or blank string + */ +function pkg_backlink ($ids) { + $output = ""; + + if (is_array($ids)) { + if (count($ids) == 1) { + $keys = array_keys($ids); + $id = $keys[0]; + $output .= "<a href='/packages.php?ID=$id'>"; + $output .= __("Return to the package details."); + $output .= "</a>"; + } + } else if (is_string($ids)) { + $output .= "<a href='/packages.php?ID=$ids'>"; + $output .= __("Return to the package details."); + $output .= "</a>"; + } + + return $output; +} + -- 1.6.0.4