1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 09:46:46 +02:00

replace constants with class constants.

ACL_YES, ACL_NO, ACL_NEVER, USER_NORMAL, USER_IGNORE, USER_INACTIVE, USER_FOUNDER

git-svn-id: file:///svn/phpbb/trunk@9233 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2008-12-27 12:18:04 +00:00
parent 297af28a40
commit 25725c9850
46 changed files with 723 additions and 1504 deletions

View File

@@ -382,13 +382,13 @@ class auth
// Key 0 in $hold_ary are global options, all others are forum_ids
// If this user is founder we're going to force fill the admin options ...
if ($userdata['user_type'] == USER_FOUNDER)
if ($userdata['user_type'] == phpbb::USER_FOUNDER)
{
foreach ($this->acl_options['global'] as $opt => $id)
{
if (strpos($opt, 'a_') === 0)
{
$hold_ary[0][$this->acl_options['id'][$opt]] = ACL_YES;
$hold_ary[0][$this->acl_options['id'][$opt]] = phpbb::ACL_YES;
}
}
}
@@ -437,14 +437,14 @@ class auth
// If one option is allowed, the global permission for this option has to be allowed too
// example: if the user has the a_ permission this means he has one or more a_* permissions
if ($auth_ary[$this->acl_options['id'][$opt]] == ACL_YES && (!isset($bitstring[$this->acl_options[$ary_key][$option_key]]) || $bitstring[$this->acl_options[$ary_key][$option_key]] == ACL_NEVER))
if ($auth_ary[$this->acl_options['id'][$opt]] == phpbb::ACL_YES && (!isset($bitstring[$this->acl_options[$ary_key][$option_key]]) || $bitstring[$this->acl_options[$ary_key][$option_key]] == phpbb::ACL_NEVER))
{
$bitstring[$this->acl_options[$ary_key][$option_key]] = ACL_YES;
$bitstring[$this->acl_options[$ary_key][$option_key]] = phpbb::ACL_YES;
}
}
else
{
$bitstring[$id] = ACL_NEVER;
$bitstring[$id] = phpbb::ACL_NEVER;
}
}
@@ -637,22 +637,22 @@ class auth
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
// @todo: use the ref technique to reduce opcode generation
if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$option]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$option]) && $hold_ary[$row['user_id']][$row['forum_id']][$option] != ACL_NEVER))
if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$option]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$option]) && $hold_ary[$row['user_id']][$row['forum_id']][$option] != phpbb::ACL_NEVER))
{
$hold_ary[$row['user_id']][$row['forum_id']][$option] = $row['auth_setting'];
// If we detect ACL_NEVER, we will unset the flag option (within building the bitstring it is correctly set again)
if ($row['auth_setting'] == ACL_NEVER)
if ($row['auth_setting'] == phpbb::ACL_NEVER)
{
$flag = substr($option, 0, strpos($option, '_') + 1);
if (isset($hold_ary[$row['user_id']][$row['forum_id']][$flag]) && $hold_ary[$row['user_id']][$row['forum_id']][$flag] == ACL_YES)
if (isset($hold_ary[$row['user_id']][$row['forum_id']][$flag]) && $hold_ary[$row['user_id']][$row['forum_id']][$flag] == phpbb::ACL_YES)
{
unset($hold_ary[$row['user_id']][$row['forum_id']][$flag]);
/* if (in_array(ACL_YES, $hold_ary[$row['user_id']][$row['forum_id']]))
/* if (in_array(phpbb::ACL_YES, $hold_ary[$row['user_id']][$row['forum_id']]))
{
$hold_ary[$row['user_id']][$row['forum_id']][$flag] = ACL_YES;
$hold_ary[$row['user_id']][$row['forum_id']][$flag] = phpbb::ACL_YES;
}
*/
}
@@ -856,24 +856,24 @@ class auth
*/
private function _set_group_hold_ary(&$hold_ary, $option_id, $setting)
{
if (!isset($hold_ary[$option_id]) || (isset($hold_ary[$option_id]) && $hold_ary[$option_id] != ACL_NEVER))
if (!isset($hold_ary[$option_id]) || (isset($hold_ary[$option_id]) && $hold_ary[$option_id] != phpbb::ACL_NEVER))
{
$hold_ary[$option_id] = $setting;
// If we detect ACL_NEVER, we will unset the flag option (within building the bitstring it is correctly set again)
if ($setting == ACL_NEVER)
if ($setting == phpbb::ACL_NEVER)
{
$flag = substr($this->acl_options['option'][$option_id], 0, strpos($this->acl_options['option'][$option_id], '_') + 1);
$flag = (int) $this->acl_options['id'][$flag];
if (isset($hold_ary[$flag]) && $hold_ary[$flag] == ACL_YES)
if (isset($hold_ary[$flag]) && $hold_ary[$flag] == phpbb::ACL_YES)
{
unset($hold_ary[$flag]);
/* This is uncommented, because i suspect this being slightly wrong due to mixed permission classes being possible
if (in_array(ACL_YES, $hold_ary))
if (in_array(phpbb::ACL_YES, $hold_ary))
{
$hold_ary[$flag] = ACL_YES;
$hold_ary[$flag] = phpbb::ACL_YES;
}*/
}
}

View File

@@ -89,9 +89,9 @@ abstract class phpbb_session
// Set auth to false (only valid for an user object)
$this->auth = false;
// Some system/server variables, directly generated by phpbb_system methods. Used like an array.
// Some system/server variables, directly generated by phpbb_system_info methods. Used like an array.
// We use the phpbb:: one, because it could've been modified and being a completely different class
$this->system = &phpbb::$instances['system'];
$this->system =& phpbb::$instances['server-vars'];
}
/**
@@ -223,7 +223,7 @@ abstract class phpbb_session
$sql = 'SELECT u.*
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k
WHERE u.user_id = ' . (int) $this->cookie_data['u'] . '
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ")
AND u.user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ")
AND k.user_id = u.user_id
AND k.key_id = '" . phpbb::$db->sql_escape(md5($this->cookie_data['k'])) . "'";
$result = phpbb::$db->sql_query($sql);
@@ -240,7 +240,7 @@ abstract class phpbb_session
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . (int) $this->cookie_data['u'] . '
AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
AND user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
$result = phpbb::$db->sql_query($sql);
$this->data = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
@@ -351,7 +351,7 @@ abstract class phpbb_session
// session exists in which case session_id will also be set
// Is user banned? Are they excluded? Won't return on ban, exists within method
if ($this->data['user_type'] != USER_FOUNDER)
if ($this->data['user_type'] != phpbb::USER_FOUNDER)
{
if (!phpbb::$config['forwarded_for_check'])
{
@@ -1092,7 +1092,7 @@ abstract class phpbb_session
phpbb::$db->sql_query($sql);
}
$this->is_registered = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false;
$this->is_registered = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == phpbb::USER_NORMAL || $this->data['user_type'] == phpbb::USER_FOUNDER)) ? true : false;
$this->is_bot = (!$this->is_registered && $this->data['user_id'] != ANONYMOUS) ? true : false;
$this->data['user_lang'] = basename($this->data['user_lang']);

View File

@@ -833,7 +833,7 @@ class template_compile
@flock($destination_handle, LOCK_UN);
@fclose($destination_handle);
phpbb_chmod($filename, CHMOD_WRITE);
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
clearstatcache();

View File

@@ -29,7 +29,7 @@ class phpbb_user extends phpbb_session
/**
* @var array required phpBB objects
*/
public $phpbb_required = array('config', 'acl', 'db', 'template', 'security', 'system', 'acm', 'api:user');
public $phpbb_required = array('config', 'acl', 'db', 'template', 'security', 'server-vars', 'acm', 'api:user');
/**
* @var array Optional phpBB objects