summaryrefslogtreecommitdiffstats
path: root/web/lib/aur.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib/aur.inc.php')
-rw-r--r--web/lib/aur.inc.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php
index 7f923d75..95f72cef 100644
--- a/web/lib/aur.inc.php
+++ b/web/lib/aur.inc.php
@@ -222,6 +222,43 @@ function html_format_maintainers($maintainer, $comaintainers) {
}
/**
+ * Format a link in the package actions box
+ *
+ * @param string $uri The link target
+ * @param string $desc The link label
+ *
+ * @return string The generated HTML code for the action link
+ */
+function html_action_link($uri, $desc) {
+ $code = '<a href="' . htmlspecialchars($uri, ENT_QUOTES) . '">';
+ $code .= htmlspecialchars($desc) . '</a>';
+
+ return $code;
+}
+
+/**
+ * Format a form in the package actions box
+ *
+ * @param string $uri The link target
+ * @param string $action The action name (passed as HTTP POST parameter)
+ * @param string $desc The link label
+ *
+ * @return string The generated HTML code for the action link
+ */
+function html_action_form($uri, $action, $desc) {
+ $code = '<form action="' . htmlspecialchars($uri, ENT_QUOTES) . '" ';
+ $code .= 'method="post">';
+ $code .= '<input type="hidden" name="token" value="';
+ $code .= htmlspecialchars($_COOKIE['AURSID'], ENT_QUOTES) . '" />';
+ $code .= '<input type="submit" class="button text-button" name="';
+ $code .= htmlspecialchars($action, ENT_QUOTES) . '" ';
+ $code .= 'value="' . htmlspecialchars($desc, ENT_QUOTES) . '" />';
+ $code .= '</form>';
+
+ return $code;
+}
+
+/**
* Determine the user's e-mail address in the database using a session ID
*
* @param string $sid User's session ID