mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Split out code to generate action links
Add (and use) two new helper functions html_account_link() and html_account_form() to generate the links in the package actions box. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
3dbaee80b4
commit
4bc990f9c0
3 changed files with 86 additions and 107 deletions
|
@ -221,6 +221,43 @@ function html_format_maintainers($maintainer, $comaintainers) {
|
|||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue