mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add support for Terms of Service documents
This allows for adding Terms of Service documents to the database that registered users need to accept before using the AUR. A revision field can be used to indicate whether a document was updated. If it is increased, all users are again asked to accept the new terms. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
6892ec7791
commit
a8ac2004d3
6 changed files with 188 additions and 0 deletions
|
@ -22,6 +22,7 @@ include_once('timezone.inc.php');
|
|||
set_tz();
|
||||
|
||||
check_sid();
|
||||
check_tos();
|
||||
|
||||
/**
|
||||
* Check if a visitor is logged in
|
||||
|
@ -91,6 +92,28 @@ function check_sid() {
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect user to the Terms of Service agreement if there are updated terms.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function check_tos() {
|
||||
if (!isset($_COOKIE["AURSID"])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$path = $_SERVER['PATH_INFO'];
|
||||
$route = get_route($path);
|
||||
if (!$route || $route == "tos.php") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count(fetch_updated_terms(uid_from_sid($_COOKIE["AURSID"]))) > 0) {
|
||||
header('Location: ' . get_uri('/tos'));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the supplied CSRF token matches expected token
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue