aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/common.inc.php2
-rw-r--r--include/functions.inc.php2
-rw-r--r--include/functions_notification.inc.php2
-rw-r--r--include/functions_user.inc.php15
4 files changed, 16 insertions, 5 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index e0c564033..e2204cc8e 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -208,7 +208,7 @@ if ($conf['gallery_locked'])
echo '</div>';
if ( basename($_SERVER["PHP_SELF"]) != 'identification.php'
- and $user['status'] != 'admin' )
+ and !is_admin() )
{
exit();
}
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 5dc764193..205b61a70 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -355,7 +355,7 @@ function pwg_log( $file, $category, $picture = '' )
if ($conf['log'])
{
- if ( ($conf['history_admin'] ) or ( (! $conf['history_admin']) and ($user['status'] != 'admin') ) )
+ if ( ($conf['history_admin'] ) or ( (! $conf['history_admin']) and (!is_admin()) ) )
{
$login = ($user['id'] == $conf['guest_id'])
? 'guest' : addslashes($user['username']);
diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php
index 819dd3517..6ac995bb8 100644
--- a/include/functions_notification.inc.php
+++ b/include/functions_notification.inc.php
@@ -192,7 +192,7 @@ function news($start, $end)
$nb_updated_categories));
}
- if ('admin' == $user['status'])
+ if (is_admin())
{
$nb_unvalidated_comments = count(unvalidated_comments($end));
if ($nb_unvalidated_comments > 0)
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index af695718a..64b12dfab 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -292,7 +292,7 @@ SELECT id
}
// if user is not an admin, locked categories can be considered as private$
- if ($user_status != 'admin')
+ if (!is_admin())
{
$query = '
SELECT id
@@ -439,7 +439,7 @@ function create_user_infos($user_id)
$insert =
array(
'user_id' => $user_id,
- 'status' => $user_id == $conf['webmaster_id'] ? 'admin' : 'guest',
+ 'status' => $user_id == $conf['webmaster_id'] ? 'admin' : 'normal',
'template' => $conf['default_template'],
'nb_image_line' => $conf['nb_image_line'],
'nb_line_page' => $conf['nb_line_page'],
@@ -536,4 +536,15 @@ function log_user($user_id, $remember_me)
$_SESSION['id'] = $user_id;
}
+/*
+ * Return if current is an administrator
+ * @return bool
+*/
+function is_admin()
+{
+ global $user;
+
+ return ($user['status'] == 'webmaster' or $user['status'] == 'admin') ? true : false;
+}
+
?> \ No newline at end of file