summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-04-27 08:07:44 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2017-04-27 09:22:53 +0200
commit6892ec7791bf04361ac2973b38d0025b50fa4727 (patch)
tree2d6c60c0c33bf9eb218277efd7bab0ce84b7b691
parente4dcd913d15d813cc227df90a8129d1c3685ea07 (diff)
downloadaur-6892ec7791bf04361ac2973b38d0025b50fa4727.tar.gz
aur-6892ec7791bf04361ac2973b38d0025b50fa4727.tar.xz
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>
-rw-r--r--web/html/account.php3
-rw-r--r--web/html/addvote.php2
-rw-r--r--web/html/comaintainers.php3
-rw-r--r--web/html/commentedit.php3
-rw-r--r--web/html/home.php3
-rw-r--r--web/html/login.php2
-rw-r--r--web/html/logout.php1
-rw-r--r--web/html/packages.php2
-rw-r--r--web/html/passreset.php3
-rw-r--r--web/html/pkgbase.php2
-rw-r--r--web/html/pkgdel.php3
-rw-r--r--web/html/pkgdisown.php3
-rw-r--r--web/html/pkgflag.php3
-rw-r--r--web/html/pkgflagcomment.php3
-rw-r--r--web/html/pkgmerge.php3
-rw-r--r--web/html/pkgreq.php3
-rw-r--r--web/html/register.php3
-rw-r--r--web/html/tu.php2
-rw-r--r--web/lib/aur.inc.php2
19 files changed, 2 insertions, 47 deletions
diff --git a/web/html/account.php b/web/html/account.php
index 549f8524..c30a89aa 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once('aur.inc.php'); # access AUR common 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");
$need_userinfo = array(
diff --git a/web/html/addvote.php b/web/html/addvote.php
index d1529412..3672c031 100644
--- a/web/html/addvote.php
+++ b/web/html/addvote.php
@@ -3,8 +3,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
-set_lang();
-check_sid();
$title = __("Add Proposal");
diff --git a/web/html/comaintainers.php b/web/html/comaintainers.php
index 23d8d19b..9733558d 100644
--- a/web/html/comaintainers.php
+++ b/web/html/comaintainers.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.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)))) {
header('Location: /');
exit();
diff --git a/web/html/commentedit.php b/web/html/commentedit.php
index 2a0628e3..53ec2891 100644
--- a/web/html/commentedit.php
+++ b/web/html/commentedit.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgbasefuncs.inc.php");
-set_lang();
-check_sid();
-
$comment_id = intval($_REQUEST['comment_id']);
list($user_id, $comment) = comment_by_id($comment_id);
diff --git a/web/html/home.php b/web/html/home.php
index 26754916..0ce89f40 100644
--- a/web/html/home.php
+++ b/web/html/home.php
@@ -3,9 +3,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
-set_lang();
-check_sid();
-
include_once('stats.inc.php');
if (isset($_COOKIE["AURSID"])) {
diff --git a/web/html/login.php b/web/html/login.php
index 7345439d..a55ce057 100644
--- a/web/html/login.php
+++ b/web/html/login.php
@@ -2,8 +2,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
-set_lang();
-check_sid();
$disable_http_login = config_get_bool('options', 'disable_http_login');
if (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) {
diff --git a/web/html/logout.php b/web/html/logout.php
index 5e8e8f43..14022001 100644
--- a/web/html/logout.php
+++ b/web/html/logout.php
@@ -5,7 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.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
# sending any HTML output.
#
diff --git a/web/html/packages.php b/web/html/packages.php
index 7d5b2075..db9606d9 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -3,9 +3,7 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
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
-check_sid(); # see if they're still logged in
# Retrieve package ID and name, unless initialized by the routing framework
if (!isset($pkgid) || !isset($pkgname)) {
diff --git a/web/html/passreset.php b/web/html/passreset.php
index e89967d4..9e7cee88 100644
--- a/web/html/passreset.php
+++ b/web/html/passreset.php
@@ -4,9 +4,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
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"])) {
header('Location: /');
exit();
diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php
index a593af10..03b0eee4 100644
--- a/web/html/pkgbase.php
+++ b/web/html/pkgbase.php
@@ -3,9 +3,7 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
-set_lang();
include_once('pkgfuncs.inc.php');
-check_sid();
/*
* Retrieve package base ID and name, unless initialized by the routing
diff --git a/web/html/pkgdel.php b/web/html/pkgdel.php
index 591ccce8..4620beb6 100644
--- a/web/html/pkgdel.php
+++ b/web/html/pkgdel.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgfuncs.inc.php");
-set_lang();
-check_sid();
-
html_header(__("Package Deletion"));
if (has_credential(CRED_PKGBASE_DELETE)): ?>
diff --git a/web/html/pkgdisown.php b/web/html/pkgdisown.php
index 036fe6d8..4b04e85e 100644
--- a/web/html/pkgdisown.php
+++ b/web/html/pkgdisown.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgfuncs.inc.php");
-set_lang();
-check_sid();
-
html_header(__("Disown Package"));
$maintainer_uids = array(pkgbase_maintainer_uid($base_id));
diff --git a/web/html/pkgflag.php b/web/html/pkgflag.php
index 25c8ccbb..61346b90 100644
--- a/web/html/pkgflag.php
+++ b/web/html/pkgflag.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgfuncs.inc.php");
-set_lang();
-check_sid();
-
/* Grab the list of package base IDs to be operated on. */
$ids = array();
if (isset($_POST['IDs'])) {
diff --git a/web/html/pkgflagcomment.php b/web/html/pkgflagcomment.php
index 98680ef6..c0363c89 100644
--- a/web/html/pkgflagcomment.php
+++ b/web/html/pkgflagcomment.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgbasefuncs.inc.php");
-set_lang();
-check_sid();
-
if (!isset($base_id)) {
header('Location: /');
exit();
diff --git a/web/html/pkgmerge.php b/web/html/pkgmerge.php
index e8e7ca93..6ee7423d 100644
--- a/web/html/pkgmerge.php
+++ b/web/html/pkgmerge.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgfuncs.inc.php");
-set_lang();
-check_sid();
-
html_header(__("Package Merging"));
if (has_credential(CRED_PKGBASE_DELETE)): ?>
diff --git a/web/html/pkgreq.php b/web/html/pkgreq.php
index f981c25d..d2f94613 100644
--- a/web/html/pkgreq.php
+++ b/web/html/pkgreq.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
include_once("pkgfuncs.inc.php");
-set_lang();
-check_sid();
-
if (isset($base_id)) {
if (!has_credential(CRED_PKGREQ_FILE)) {
header('Location: /');
diff --git a/web/html/register.php b/web/html/register.php
index 843fea97..368999a5 100644
--- a/web/html/register.php
+++ b/web/html/register.php
@@ -5,9 +5,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once('aur.inc.php'); # access AUR common 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"])) {
header('Location: /');
exit();
diff --git a/web/html/tu.php b/web/html/tu.php
index cc77d625..34e64eae 100644
--- a/web/html/tu.php
+++ b/web/html/tu.php
@@ -3,8 +3,6 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php");
-set_lang();
-check_sid();
$title = __("Trusted User");
diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php
index d58df406..063de8fc 100644
--- a/web/lib/aur.inc.php
+++ b/web/lib/aur.inc.php
@@ -21,6 +21,8 @@ include_once("credentials.inc.php");
include_once('timezone.inc.php');
set_tz();
+check_sid();
+
/**
* Check if a visitor is logged in
*