Call check_sid() from a central location

Instead of calling check_sid() from every single PHP script representing
a web page, add the call to aur.inc.php which is sourced by all of them.

Also, remove set_lang() calls from the scripts since these are also
already included in aur.inc.php.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-04-27 08:07:44 +02:00
parent e4dcd913d1
commit 6892ec7791
19 changed files with 2 additions and 47 deletions

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once('aur.inc.php'); # access AUR common functions include_once('aur.inc.php'); # access AUR common functions
include_once('acctfuncs.inc.php'); # access Account specific functions include_once('acctfuncs.inc.php'); # access Account specific functions
set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in
$action = in_request("Action"); $action = in_request("Action");
$need_userinfo = array( $need_userinfo = array(

View file

@ -3,8 +3,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
set_lang();
check_sid();
$title = __("Add Proposal"); $title = __("Add Proposal");

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgbasefuncs.inc.php"); include_once("pkgbasefuncs.inc.php");
set_lang();
check_sid();
if (!isset($base_id) || !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) { if (!isset($base_id) || !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) {
header('Location: /'); header('Location: /');
exit(); exit();

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgbasefuncs.inc.php"); include_once("pkgbasefuncs.inc.php");
set_lang();
check_sid();
$comment_id = intval($_REQUEST['comment_id']); $comment_id = intval($_REQUEST['comment_id']);
list($user_id, $comment) = comment_by_id($comment_id); list($user_id, $comment) = comment_by_id($comment_id);

View file

@ -3,9 +3,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
set_lang();
check_sid();
include_once('stats.inc.php'); include_once('stats.inc.php');
if (isset($_COOKIE["AURSID"])) { if (isset($_COOKIE["AURSID"])) {

View file

@ -2,8 +2,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
set_lang();
check_sid();
$disable_http_login = config_get_bool('options', 'disable_http_login'); $disable_http_login = config_get_bool('options', 'disable_http_login');
if (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) { if (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) {

View file

@ -5,7 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); # access AUR common functions include_once("aur.inc.php"); # access AUR common functions
include_once("acctfuncs.inc.php"); # access AUR common functions include_once("acctfuncs.inc.php"); # access AUR common functions
# if they've got a cookie, log them out - need to do this before # if they've got a cookie, log them out - need to do this before
# sending any HTML output. # sending any HTML output.
# #

View file

@ -3,9 +3,7 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); # access AUR common functions include_once("aur.inc.php"); # access AUR common functions
set_lang(); # this sets up the visitor's language
include_once('pkgfuncs.inc.php'); # package specific functions include_once('pkgfuncs.inc.php'); # package specific functions
check_sid(); # see if they're still logged in
# Retrieve package ID and name, unless initialized by the routing framework # Retrieve package ID and name, unless initialized by the routing framework
if (!isset($pkgid) || !isset($pkgname)) { if (!isset($pkgid) || !isset($pkgname)) {

View file

@ -4,9 +4,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); # access AUR common functions include_once("aur.inc.php"); # access AUR common functions
set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in
if (isset($_COOKIE["AURSID"])) { if (isset($_COOKIE["AURSID"])) {
header('Location: /'); header('Location: /');
exit(); exit();

View file

@ -3,9 +3,7 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
set_lang();
include_once('pkgfuncs.inc.php'); include_once('pkgfuncs.inc.php');
check_sid();
/* /*
* Retrieve package base ID and name, unless initialized by the routing * Retrieve package base ID and name, unless initialized by the routing

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgfuncs.inc.php"); include_once("pkgfuncs.inc.php");
set_lang();
check_sid();
html_header(__("Package Deletion")); html_header(__("Package Deletion"));
if (has_credential(CRED_PKGBASE_DELETE)): ?> if (has_credential(CRED_PKGBASE_DELETE)): ?>

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgfuncs.inc.php"); include_once("pkgfuncs.inc.php");
set_lang();
check_sid();
html_header(__("Disown Package")); html_header(__("Disown Package"));
$maintainer_uids = array(pkgbase_maintainer_uid($base_id)); $maintainer_uids = array(pkgbase_maintainer_uid($base_id));

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgfuncs.inc.php"); include_once("pkgfuncs.inc.php");
set_lang();
check_sid();
/* Grab the list of package base IDs to be operated on. */ /* Grab the list of package base IDs to be operated on. */
$ids = array(); $ids = array();
if (isset($_POST['IDs'])) { if (isset($_POST['IDs'])) {

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgbasefuncs.inc.php"); include_once("pkgbasefuncs.inc.php");
set_lang();
check_sid();
if (!isset($base_id)) { if (!isset($base_id)) {
header('Location: /'); header('Location: /');
exit(); exit();

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgfuncs.inc.php"); include_once("pkgfuncs.inc.php");
set_lang();
check_sid();
html_header(__("Package Merging")); html_header(__("Package Merging"));
if (has_credential(CRED_PKGBASE_DELETE)): ?> if (has_credential(CRED_PKGBASE_DELETE)): ?>

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgfuncs.inc.php"); include_once("pkgfuncs.inc.php");
set_lang();
check_sid();
if (isset($base_id)) { if (isset($base_id)) {
if (!has_credential(CRED_PKGREQ_FILE)) { if (!has_credential(CRED_PKGREQ_FILE)) {
header('Location: /'); header('Location: /');

View file

@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once('aur.inc.php'); # access AUR common functions include_once('aur.inc.php'); # access AUR common functions
include_once('acctfuncs.inc.php'); # access Account specific functions include_once('acctfuncs.inc.php'); # access Account specific functions
set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in
if (isset($_COOKIE["AURSID"])) { if (isset($_COOKIE["AURSID"])) {
header('Location: /'); header('Location: /');
exit(); exit();

View file

@ -3,8 +3,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
set_lang();
check_sid();
$title = __("Trusted User"); $title = __("Trusted User");

View file

@ -21,6 +21,8 @@ include_once("credentials.inc.php");
include_once('timezone.inc.php'); include_once('timezone.inc.php');
set_tz(); set_tz();
check_sid();
/** /**
* Check if a visitor is logged in * Check if a visitor is logged in
* *