mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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:
parent
297af28a40
commit
25725c9850
46 changed files with 723 additions and 1504 deletions
|
@ -76,7 +76,7 @@ $bots = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
$bot_ids = array();
|
$bot_ids = array();
|
||||||
user_get_id_name($bot_ids, array_keys($bots), USER_IGNORE);
|
user_get_id_name($bot_ids, array_keys($bots), phpbb::USER_IGNORE);
|
||||||
foreach($bot_ids as $bot)
|
foreach($bot_ids as $bot)
|
||||||
{
|
{
|
||||||
user_delete('remove', $bot);
|
user_delete('remove', $bot);
|
||||||
|
@ -119,7 +119,7 @@ function add_bots($bots)
|
||||||
foreach ($bots as $bot_name => $bot_ary)
|
foreach ($bots as $bot_name => $bot_ary)
|
||||||
{
|
{
|
||||||
$user_row = array(
|
$user_row = array(
|
||||||
'user_type' => USER_IGNORE,
|
'user_type' => phpbb::USER_IGNORE,
|
||||||
'group_id' => $group_id,
|
'group_id' => $group_id,
|
||||||
'username' => $bot_name,
|
'username' => $bot_name,
|
||||||
'user_regdate' => time(),
|
'user_regdate' => time(),
|
||||||
|
|
|
@ -89,7 +89,7 @@ class acm
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($this->cache_dir . 'data_global.' . PHP_EXT, CHMOD_WRITE);
|
phpbb_chmod($this->cache_dir . 'data_global.' . PHP_EXT, phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,7 @@ class acm
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($this->cache_dir . "data{$var_name}." . PHP_EXT, CHMOD_WRITE);
|
phpbb_chmod($this->cache_dir . "data{$var_name}." . PHP_EXT, phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -407,7 +407,7 @@ class acm
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($filename, CHMOD_WRITE);
|
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
$query_result = $query_id;
|
$query_result = $query_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ function login_apache(&$username, &$password)
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
// User inactive...
|
// User inactive...
|
||||||
if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
|
if ($row['user_type'] == phpbb::USER_INACTIVE || $row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'status' => LOGIN_ERROR_ACTIVE,
|
'status' => LOGIN_ERROR_ACTIVE,
|
||||||
|
@ -160,7 +160,7 @@ function autologin_apache()
|
||||||
|
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row;
|
return ($row['user_type'] == phpbb::USER_INACTIVE || $row['user_type'] == phpbb::USER_IGNORE) ? array() : $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('user_add'))
|
if (!function_exists('user_add'))
|
||||||
|
@ -213,7 +213,7 @@ function user_row_apache($username, $password)
|
||||||
'user_password' => phpbb_hash($password),
|
'user_password' => phpbb_hash($password),
|
||||||
'user_email' => '',
|
'user_email' => '',
|
||||||
'group_id' => (int) $row['group_id'],
|
'group_id' => (int) $row['group_id'],
|
||||||
'user_type' => USER_NORMAL,
|
'user_type' => phpbb::USER_NORMAL,
|
||||||
'user_ip' => $user->ip,
|
'user_ip' => $user->ip,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ function login_db(&$username, &$password)
|
||||||
}
|
}
|
||||||
|
|
||||||
// User inactive...
|
// User inactive...
|
||||||
if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
|
if ($row['user_type'] == phpbb::USER_INACTIVE || $row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'status' => LOGIN_ERROR_ACTIVE,
|
'status' => LOGIN_ERROR_ACTIVE,
|
||||||
|
|
|
@ -187,7 +187,7 @@ function login_ldap(&$username, &$password)
|
||||||
unset($ldap_result);
|
unset($ldap_result);
|
||||||
|
|
||||||
// User inactive...
|
// User inactive...
|
||||||
if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
|
if ($row['user_type'] == phpbb::USER_INACTIVE || $row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'status' => LOGIN_ERROR_ACTIVE,
|
'status' => LOGIN_ERROR_ACTIVE,
|
||||||
|
@ -225,7 +225,7 @@ function login_ldap(&$username, &$password)
|
||||||
'user_password' => phpbb_hash($password),
|
'user_password' => phpbb_hash($password),
|
||||||
'user_email' => (!empty($config['ldap_email'])) ? $ldap_result[0][$config['ldap_email']][0] : '',
|
'user_email' => (!empty($config['ldap_email'])) ? $ldap_result[0][$config['ldap_email']][0] : '',
|
||||||
'group_id' => (int) $row['group_id'],
|
'group_id' => (int) $row['group_id'],
|
||||||
'user_type' => USER_NORMAL,
|
'user_type' => phpbb::USER_NORMAL,
|
||||||
'user_ip' => $user->ip,
|
'user_ip' => $user->ip,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -382,13 +382,13 @@ class auth
|
||||||
// Key 0 in $hold_ary are global options, all others are forum_ids
|
// 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 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)
|
foreach ($this->acl_options['global'] as $opt => $id)
|
||||||
{
|
{
|
||||||
if (strpos($opt, 'a_') === 0)
|
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
|
// 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
|
// 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
|
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']];
|
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
|
||||||
|
|
||||||
// @todo: use the ref technique to reduce opcode generation
|
// @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'];
|
$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 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);
|
$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]);
|
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)
|
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;
|
$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 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 = substr($this->acl_options['option'][$option_id], 0, strpos($this->acl_options['option'][$option_id], '_') + 1);
|
||||||
$flag = (int) $this->acl_options['id'][$flag];
|
$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]);
|
unset($hold_ary[$flag]);
|
||||||
|
|
||||||
/* This is uncommented, because i suspect this being slightly wrong due to mixed permission classes being possible
|
/* 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;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,9 @@ abstract class phpbb_session
|
||||||
// Set auth to false (only valid for an user object)
|
// Set auth to false (only valid for an user object)
|
||||||
$this->auth = false;
|
$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
|
// 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.*
|
$sql = 'SELECT u.*
|
||||||
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k
|
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k
|
||||||
WHERE u.user_id = ' . (int) $this->cookie_data['u'] . '
|
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.user_id = u.user_id
|
||||||
AND k.key_id = '" . phpbb::$db->sql_escape(md5($this->cookie_data['k'])) . "'";
|
AND k.key_id = '" . phpbb::$db->sql_escape(md5($this->cookie_data['k'])) . "'";
|
||||||
$result = phpbb::$db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
@ -240,7 +240,7 @@ abstract class phpbb_session
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_id = ' . (int) $this->cookie_data['u'] . '
|
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);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
$this->data = phpbb::$db->sql_fetchrow($result);
|
$this->data = phpbb::$db->sql_fetchrow($result);
|
||||||
phpbb::$db->sql_freeresult($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
|
// 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
|
// 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'])
|
if (!phpbb::$config['forwarded_for_check'])
|
||||||
{
|
{
|
||||||
|
@ -1092,7 +1092,7 @@ abstract class phpbb_session
|
||||||
phpbb::$db->sql_query($sql);
|
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->is_bot = (!$this->is_registered && $this->data['user_id'] != ANONYMOUS) ? true : false;
|
||||||
$this->data['user_lang'] = basename($this->data['user_lang']);
|
$this->data['user_lang'] = basename($this->data['user_lang']);
|
||||||
|
|
||||||
|
|
|
@ -833,7 +833,7 @@ class template_compile
|
||||||
@flock($destination_handle, LOCK_UN);
|
@flock($destination_handle, LOCK_UN);
|
||||||
@fclose($destination_handle);
|
@fclose($destination_handle);
|
||||||
|
|
||||||
phpbb_chmod($filename, CHMOD_WRITE);
|
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class phpbb_user extends phpbb_session
|
||||||
/**
|
/**
|
||||||
* @var array required phpBB objects
|
* @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
|
* @var array Optional phpBB objects
|
||||||
|
|
|
@ -42,21 +42,11 @@ define('AVATAR_UPLOAD', 1);
|
||||||
define('AVATAR_REMOTE', 2);
|
define('AVATAR_REMOTE', 2);
|
||||||
define('AVATAR_GALLERY', 3);
|
define('AVATAR_GALLERY', 3);
|
||||||
|
|
||||||
define('USER_NORMAL', 0);
|
|
||||||
define('USER_INACTIVE', 1);
|
|
||||||
define('USER_IGNORE', 2);
|
|
||||||
define('USER_FOUNDER', 3);
|
|
||||||
|
|
||||||
define('INACTIVE_REGISTER', 1);
|
define('INACTIVE_REGISTER', 1);
|
||||||
define('INACTIVE_PROFILE', 2);
|
define('INACTIVE_PROFILE', 2);
|
||||||
define('INACTIVE_MANUAL', 3);
|
define('INACTIVE_MANUAL', 3);
|
||||||
define('INACTIVE_REMIND', 4);
|
define('INACTIVE_REMIND', 4);
|
||||||
|
|
||||||
// ACL
|
|
||||||
define('ACL_NEVER', 0);
|
|
||||||
define('ACL_YES', 1);
|
|
||||||
define('ACL_NO', -1);
|
|
||||||
|
|
||||||
// Login error codes
|
// Login error codes
|
||||||
define('LOGIN_CONTINUE', 1);
|
define('LOGIN_CONTINUE', 1);
|
||||||
define('LOGIN_BREAK', 2);
|
define('LOGIN_BREAK', 2);
|
||||||
|
@ -179,12 +169,6 @@ define('REFERER_VALIDATE_NONE', 0);
|
||||||
define('REFERER_VALIDATE_HOST', 1);
|
define('REFERER_VALIDATE_HOST', 1);
|
||||||
define('REFERER_VALIDATE_PATH', 2);
|
define('REFERER_VALIDATE_PATH', 2);
|
||||||
|
|
||||||
// phpbb_chmod() permissions
|
|
||||||
@define('CHMOD_ALL', 7);
|
|
||||||
@define('CHMOD_READ', 4);
|
|
||||||
@define('CHMOD_WRITE', 2);
|
|
||||||
@define('CHMOD_EXECUTE', 1);
|
|
||||||
|
|
||||||
// Additional constants
|
// Additional constants
|
||||||
define('VOTE_CONVERTED', 127);
|
define('VOTE_CONVERTED', 127);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2163,8 +2163,8 @@ function cache_moderators()
|
||||||
),
|
),
|
||||||
|
|
||||||
'WHERE' => '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id)
|
'WHERE' => '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id)
|
||||||
AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL)
|
AND ((a.auth_setting = ' . phpbb::ACL_NEVER . ' AND r.auth_setting IS NULL)
|
||||||
OR r.auth_setting = ' . ACL_NEVER . ')
|
OR r.auth_setting = ' . phpbb::ACL_NEVER . ')
|
||||||
AND a.group_id = ug.group_id
|
AND a.group_id = ug.group_id
|
||||||
AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "
|
AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "
|
||||||
AND ug.user_pending = 0
|
AND ug.user_pending = 0
|
||||||
|
@ -2256,7 +2256,7 @@ function cache_moderators()
|
||||||
foreach ($auth_ary as $auth_option => $setting)
|
foreach ($auth_ary as $auth_option => $setting)
|
||||||
{
|
{
|
||||||
// Make sure at least one ACL_YES option is set...
|
// Make sure at least one ACL_YES option is set...
|
||||||
if ($setting == ACL_YES)
|
if ($setting == phpbb::ACL_YES)
|
||||||
{
|
{
|
||||||
$flag = true;
|
$flag = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2633,7 +2633,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(user_id) AS user_count
|
$sql = 'SELECT COUNT(user_id) AS user_count
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type = ' . USER_INACTIVE .
|
WHERE user_type = ' . phpbb::USER_INACTIVE .
|
||||||
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '');
|
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '');
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$user_count = (int) $db->sql_fetchfield('user_count');
|
$user_count = (int) $db->sql_fetchfield('user_count');
|
||||||
|
@ -2646,7 +2646,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
|
||||||
|
|
||||||
$sql = 'SELECT user_id, username, user_regdate, user_lastvisit, user_inactive_time, user_inactive_reason
|
$sql = 'SELECT user_id, username, user_regdate, user_lastvisit, user_inactive_time, user_inactive_reason
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type = ' . USER_INACTIVE .
|
WHERE user_type = ' . phpbb::USER_INACTIVE .
|
||||||
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . "
|
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . "
|
||||||
ORDER BY $sort_by";
|
ORDER BY $sort_by";
|
||||||
$result = $db->sql_query_limit($sql, $limit, $offset);
|
$result = $db->sql_query_limit($sql, $limit, $offset);
|
||||||
|
|
|
@ -226,7 +226,7 @@ class compress_zip extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ class compress_zip extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Couldn't create file $filename");
|
trigger_error("Couldn't create file $filename");
|
||||||
}
|
}
|
||||||
phpbb_chmod($target_filename, CHMOD_READ);
|
phpbb_chmod($target_filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
// Grab the file contents
|
// Grab the file contents
|
||||||
fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize);
|
fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize);
|
||||||
|
|
|
@ -157,7 +157,7 @@ function auto_id($pad = 0)
|
||||||
*/
|
*/
|
||||||
function set_user_type($user_active)
|
function set_user_type($user_active)
|
||||||
{
|
{
|
||||||
return ($user_active) ? USER_NORMAL : USER_INACTIVE;
|
return ($user_active) ? phpbb::USER_NORMAL : phpbb::USER_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1461,7 +1461,7 @@ function compare_table($tables, $tablename, &$prefixes)
|
||||||
* @param mixed $forum_id forum ids (array|int|0) -> 0 == all forums
|
* @param mixed $forum_id forum ids (array|int|0) -> 0 == all forums
|
||||||
* @param mixed $ug_id [int] user_id|group_id : [string] usergroup name
|
* @param mixed $ug_id [int] user_id|group_id : [string] usergroup name
|
||||||
* @param mixed $acl_list [string] acl entry : [array] acl entries : [string] role entry
|
* @param mixed $acl_list [string] acl entry : [array] acl entries : [string] role entry
|
||||||
* @param int $setting ACL_YES|ACL_NO|ACL_NEVER
|
* @param int $setting phpbb::ACL_YES|ACL_NO|ACL_NEVER
|
||||||
*/
|
*/
|
||||||
function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO)
|
function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO)
|
||||||
{
|
{
|
||||||
|
@ -1850,7 +1850,7 @@ function add_bots()
|
||||||
foreach ($bots as $bot_name => $bot_ary)
|
foreach ($bots as $bot_name => $bot_ary)
|
||||||
{
|
{
|
||||||
$user_row = array(
|
$user_row = array(
|
||||||
'user_type' => USER_IGNORE,
|
'user_type' => phpbb::USER_IGNORE,
|
||||||
'group_id' => $group_id,
|
'group_id' => $group_id,
|
||||||
'username' => $bot_name,
|
'username' => $bot_name,
|
||||||
'user_regdate' => time(),
|
'user_regdate' => time(),
|
||||||
|
@ -1890,7 +1890,7 @@ function update_dynamic_config()
|
||||||
// Get latest username
|
// Get latest username
|
||||||
$sql = 'SELECT user_id, username, user_colour
|
$sql = 'SELECT user_id, username, user_colour
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
WHERE user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||||
|
|
||||||
if (!empty($config['increment_user_id']))
|
if (!empty($config['increment_user_id']))
|
||||||
{
|
{
|
||||||
|
@ -1934,7 +1934,7 @@ function update_dynamic_config()
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(user_id) AS stat
|
$sql = 'SELECT COUNT(user_id) AS stat
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
|
WHERE user_type IN (' . phpbb::USER_NORMAL . ',' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -2056,11 +2056,11 @@ function fix_empty_primary_groups()
|
||||||
|
|
||||||
// Set group ids for users not already having it
|
// Set group ids for users not already having it
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . '
|
$sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . '
|
||||||
WHERE group_id = 0 AND user_type = ' . USER_INACTIVE;
|
WHERE group_id = 0 AND user_type = ' . phpbb::USER_INACTIVE;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . '
|
$sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . '
|
||||||
WHERE group_id = 0 AND user_type = ' . USER_NORMAL;
|
WHERE group_id = 0 AND user_type = ' . phpbb::USER_NORMAL;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS);
|
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS);
|
||||||
|
|
|
@ -706,7 +706,7 @@ class queue
|
||||||
@flock($fp, LOCK_UN);
|
@flock($fp, LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
phpbb_chmod($this->cache_file, CHMOD_WRITE);
|
phpbb_chmod($this->cache_file, phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ class queue
|
||||||
@flock($fp, LOCK_UN);
|
@flock($fp, LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
phpbb_chmod($this->cache_file, CHMOD_WRITE);
|
phpbb_chmod($this->cache_file, phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -731,7 +731,7 @@ function create_thumbnail($source, $destination, $mimetype)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod($destination, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1142,7 +1142,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||||
WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . "
|
WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . "
|
||||||
AND w.user_id NOT IN ($sql_ignore_users)
|
AND w.user_id NOT IN ($sql_ignore_users)
|
||||||
AND w.notify_status = 0
|
AND w.notify_status = 0
|
||||||
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
AND u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||||
AND u.user_id = w.user_id';
|
AND u.user_id = w.user_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
@ -1175,7 +1175,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||||
WHERE fw.forum_id = $forum_id
|
WHERE fw.forum_id = $forum_id
|
||||||
AND fw.user_id NOT IN ($sql_ignore_users)
|
AND fw.user_id NOT IN ($sql_ignore_users)
|
||||||
AND fw.notify_status = 0
|
AND fw.notify_status = 0
|
||||||
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
AND u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||||
AND u.user_id = fw.user_id';
|
AND u.user_id = fw.user_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false)
|
||||||
$sql = 'SELECT user_id, username, user_colour
|
$sql = 'SELECT user_id, username, user_colour
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE ' . $db->sql_in_set('user_id', $u) . '
|
WHERE ' . $db->sql_in_set('user_id', $u) . '
|
||||||
AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
AND user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -1348,7 +1348,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||||
WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
|
WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
|
||||||
AND ug.user_pending = 0
|
AND ug.user_pending = 0
|
||||||
AND u.user_id = ug.user_id
|
AND u.user_id = ug.user_id
|
||||||
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' .
|
AND u.user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')' .
|
||||||
$sql_allow_pm;
|
$sql_allow_pm;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ class filespec
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$chmod = ($chmod === false) ? CHMOD_READ | CHMOD_WRITE : $chmod;
|
$chmod = ($chmod === false) ? phpbb::CHMOD_READ | phpbb::CHMOD_WRITE : $chmod;
|
||||||
|
|
||||||
// We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it...
|
// We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it...
|
||||||
$this->destination_path = PHPBB_ROOT_PATH . $destination;
|
$this->destination_path = PHPBB_ROOT_PATH . $destination;
|
||||||
|
|
|
@ -91,7 +91,7 @@ function update_last_username()
|
||||||
// Get latest username
|
// Get latest username
|
||||||
$sql = 'SELECT user_id, username, user_colour
|
$sql = 'SELECT user_id, username, user_colour
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
WHERE user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||||
ORDER BY user_id DESC';
|
ORDER BY user_id DESC';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
@ -276,7 +276,7 @@ function user_add($user_row, $cp_data = false)
|
||||||
group_set_user_default($user_row['group_id'], array($user_id), false);
|
group_set_user_default($user_row['group_id'], array($user_id), false);
|
||||||
|
|
||||||
// set the newest user and adjust the user count if the user is a normal user and no activation mail is sent
|
// set the newest user and adjust the user count if the user is a normal user and no activation mail is sent
|
||||||
if ($user_row['user_type'] == USER_NORMAL)
|
if ($user_row['user_type'] == phpbb::USER_NORMAL)
|
||||||
{
|
{
|
||||||
set_config('newest_user_id', $user_id, true);
|
set_config('newest_user_id', $user_id, true);
|
||||||
set_config('newest_username', $user_row['username'], true);
|
set_config('newest_username', $user_row['username'], true);
|
||||||
|
@ -390,7 +390,7 @@ function user_delete($mode, $user_id, $post_username = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user is inactive and newly registered we assume no posts from this user being there...
|
// If the user is inactive and newly registered we assume no posts from this user being there...
|
||||||
if ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_REGISTER && !$user_row['user_posts'])
|
if ($user_row['user_type'] == phpbb::USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_REGISTER && !$user_row['user_posts'])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -566,7 +566,7 @@ function user_delete($mode, $user_id, $post_username = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrement number of users if this user is active
|
// Decrement number of users if this user is active
|
||||||
if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE)
|
if ($user_row['user_type'] != phpbb::USER_INACTIVE && $user_row['user_type'] != phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
set_config('num_users', $config['num_users'] - 1, true);
|
set_config('num_users', $config['num_users'] - 1, true);
|
||||||
}
|
}
|
||||||
|
@ -605,14 +605,14 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
|
||||||
{
|
{
|
||||||
$sql_ary = array();
|
$sql_ary = array();
|
||||||
|
|
||||||
if ($row['user_type'] == USER_IGNORE || $row['user_type'] == USER_FOUNDER ||
|
if ($row['user_type'] == phpbb::USER_IGNORE || $row['user_type'] == phpbb::USER_FOUNDER ||
|
||||||
($mode == 'activate' && $row['user_type'] != USER_INACTIVE) ||
|
($mode == 'activate' && $row['user_type'] != phpbb::USER_INACTIVE) ||
|
||||||
($mode == 'deactivate' && $row['user_type'] == USER_INACTIVE))
|
($mode == 'deactivate' && $row['user_type'] == phpbb::USER_INACTIVE))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['user_type'] == USER_INACTIVE)
|
if ($row['user_type'] == phpbb::USER_INACTIVE)
|
||||||
{
|
{
|
||||||
$activated++;
|
$activated++;
|
||||||
}
|
}
|
||||||
|
@ -625,9 +625,9 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_ary += array(
|
$sql_ary += array(
|
||||||
'user_type' => ($row['user_type'] == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL,
|
'user_type' => ($row['user_type'] == phpbb::USER_NORMAL) ? phpbb::USER_INACTIVE : phpbb::USER_NORMAL,
|
||||||
'user_inactive_time' => ($row['user_type'] == USER_NORMAL) ? time() : 0,
|
'user_inactive_time' => ($row['user_type'] == phpbb::USER_NORMAL) ? time() : 0,
|
||||||
'user_inactive_reason' => ($row['user_type'] == USER_NORMAL) ? $reason : 0,
|
'user_inactive_reason' => ($row['user_type'] == phpbb::USER_NORMAL) ? $reason : 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql_statements[$row['user_id']] = $sql_ary;
|
$sql_statements[$row['user_id']] = $sql_ary;
|
||||||
|
@ -720,7 +720,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
|
||||||
// Create a list of founder...
|
// Create a list of founder...
|
||||||
$sql = 'SELECT user_id, user_email, username_clean
|
$sql = 'SELECT user_id, user_email, username_clean
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type = ' . USER_FOUNDER;
|
WHERE user_type = ' . phpbb::USER_FOUNDER;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -3244,7 +3244,7 @@ function group_update_listings($group_id)
|
||||||
break 3;
|
break 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($setting != ACL_YES)
|
if ($setting != phpbb::ACL_YES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ if ($config['load_birthdays'] && $config['allow_birthdays'])
|
||||||
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . "
|
||||||
WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
||||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
AND user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
|
@ -232,12 +232,6 @@ include(PHPBB_ROOT_PATH . 'language/' . $language . '/posting.' . PHP_EXT);
|
||||||
|
|
||||||
// usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :(
|
// usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :(
|
||||||
|
|
||||||
// Define needed constants
|
|
||||||
define('CHMOD_ALL', 7);
|
|
||||||
define('CHMOD_READ', 4);
|
|
||||||
define('CHMOD_WRITE', 2);
|
|
||||||
define('CHMOD_EXECUTE', 1);
|
|
||||||
|
|
||||||
$mode = request_var('mode', 'overview');
|
$mode = request_var('mode', 'overview');
|
||||||
$sub = request_var('sub', '');
|
$sub = request_var('sub', '');
|
||||||
|
|
||||||
|
|
|
@ -458,13 +458,13 @@ class install_install extends module
|
||||||
if (!file_exists(PHPBB_ROOT_PATH . $dir))
|
if (!file_exists(PHPBB_ROOT_PATH . $dir))
|
||||||
{
|
{
|
||||||
@mkdir(PHPBB_ROOT_PATH . $dir, 0777);
|
@mkdir(PHPBB_ROOT_PATH . $dir, 0777);
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . $dir, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now really check
|
// Now really check
|
||||||
if (file_exists(PHPBB_ROOT_PATH . $dir) && is_dir(PHPBB_ROOT_PATH . $dir))
|
if (file_exists(PHPBB_ROOT_PATH . $dir) && is_dir(PHPBB_ROOT_PATH . $dir))
|
||||||
{
|
{
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . $dir, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
$exists = true;
|
$exists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +950,7 @@ class install_install extends module
|
||||||
if ($written)
|
if ($written)
|
||||||
{
|
{
|
||||||
// We may revert back to chmod() if we see problems with users not able to change their config.php file directly
|
// We may revert back to chmod() if we see problems with users not able to change their config.php file directly
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, CHMOD_READ);
|
phpbb_chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1871,7 +1871,7 @@ class install_install extends module
|
||||||
foreach ($this->bot_list as $bot_name => $bot_ary)
|
foreach ($this->bot_list as $bot_name => $bot_ary)
|
||||||
{
|
{
|
||||||
$user_row = array(
|
$user_row = array(
|
||||||
'user_type' => USER_IGNORE,
|
'user_type' => phpbb::USER_IGNORE,
|
||||||
'group_id' => $group_id,
|
'group_id' => $group_id,
|
||||||
'username' => $bot_name,
|
'username' => $bot_name,
|
||||||
'user_regdate' => time(),
|
'user_regdate' => time(),
|
||||||
|
|
|
@ -309,7 +309,7 @@ switch ($mode)
|
||||||
$sql = "SELECT user_id, username, user_email, user_lang, $sql_field
|
$sql = "SELECT user_id, username, user_email, user_lang, $sql_field
|
||||||
FROM " . USERS_TABLE . "
|
FROM " . USERS_TABLE . "
|
||||||
WHERE user_id = $user_id
|
WHERE user_id = $user_id
|
||||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
AND user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -416,13 +416,13 @@ switch ($mode)
|
||||||
|
|
||||||
// a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
|
// a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
|
||||||
// Normal users are able to see at least users having only changed their profile settings but not yet reactivated.
|
// Normal users are able to see at least users having only changed their profile settings but not yet reactivated.
|
||||||
if (!$auth->acl_get('a_user') && $user->data['user_type'] != USER_FOUNDER)
|
if (!$auth->acl_get('a_user') && $user->data['user_type'] != phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
if ($member['user_type'] == USER_IGNORE)
|
if ($member['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
else if ($member['user_type'] == USER_INACTIVE && $member['user_inactive_reason'] != INACTIVE_PROFILE)
|
else if ($member['user_type'] == phpbb::USER_INACTIVE && $member['user_inactive_reason'] != INACTIVE_PROFILE)
|
||||||
{
|
{
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ switch ($mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inactive reason/account?
|
// Inactive reason/account?
|
||||||
if ($member['user_type'] == USER_INACTIVE)
|
if ($member['user_type'] == phpbb::USER_INACTIVE)
|
||||||
{
|
{
|
||||||
$user->add_lang('acp/common');
|
$user->add_lang('acp/common');
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ switch ($mode)
|
||||||
$sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type
|
$sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . "
|
||||||
WHERE user_id = $user_id
|
WHERE user_id = $user_id
|
||||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
AND user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -1189,7 +1189,7 @@ switch ($mode)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(u.user_id) AS total_users
|
$sql = 'SELECT COUNT(u.user_id) AS total_users
|
||||||
FROM ' . USERS_TABLE . " u$sql_from
|
FROM ' . USERS_TABLE . " u$sql_from
|
||||||
WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
WHERE u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ")
|
||||||
$sql_where";
|
$sql_where";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$total_users = (int) $db->sql_fetchfield('total_users');
|
$total_users = (int) $db->sql_fetchfield('total_users');
|
||||||
|
@ -1352,7 +1352,7 @@ switch ($mode)
|
||||||
$sql = "SELECT u.user_id
|
$sql = "SELECT u.user_id
|
||||||
FROM " . USERS_TABLE . " u
|
FROM " . USERS_TABLE . " u
|
||||||
$sql_from
|
$sql_from
|
||||||
WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
WHERE u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ")
|
||||||
$sql_where
|
$sql_where
|
||||||
ORDER BY $order_by";
|
ORDER BY $order_by";
|
||||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||||
|
|
|
@ -1201,7 +1201,7 @@ class acp_attachments
|
||||||
if (!file_exists(PHPBB_ROOT_PATH . $upload_dir))
|
if (!file_exists(PHPBB_ROOT_PATH . $upload_dir))
|
||||||
{
|
{
|
||||||
@mkdir(PHPBB_ROOT_PATH . $upload_dir, 0777);
|
@mkdir(PHPBB_ROOT_PATH . $upload_dir, 0777);
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . $upload_dir, CHMOD_READ | CHMOD_WRITE);
|
phpbb_chmod(PHPBB_ROOT_PATH . $upload_dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ class acp_bots
|
||||||
|
|
||||||
|
|
||||||
$user_id = user_add(array(
|
$user_id = user_add(array(
|
||||||
'user_type' => (int) USER_IGNORE,
|
'user_type' => (int) phpbb::USER_IGNORE,
|
||||||
'group_id' => (int) $group_row['group_id'],
|
'group_id' => (int) $group_row['group_id'],
|
||||||
'username' => (string) $bot_row['bot_name'],
|
'username' => (string) $bot_row['bot_name'],
|
||||||
'user_regdate' => time(),
|
'user_regdate' => time(),
|
||||||
|
|
|
@ -87,7 +87,7 @@ class acp_email
|
||||||
AND ug.user_pending = 0
|
AND ug.user_pending = 0
|
||||||
AND u.user_id = ug.user_id
|
AND u.user_id = ug.user_id
|
||||||
AND u.user_allow_massemail = 1
|
AND u.user_allow_massemail = 1
|
||||||
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
AND u.user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||||
ORDER BY u.user_lang, u.user_notify_type';
|
ORDER BY u.user_lang, u.user_notify_type';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -95,7 +95,7 @@ class acp_email
|
||||||
$sql = 'SELECT username, username_clean, user_email, user_jabber, user_notify_type, user_lang
|
$sql = 'SELECT username, username_clean, user_email, user_jabber, user_notify_type, user_lang
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_allow_massemail = 1
|
WHERE user_allow_massemail = 1
|
||||||
AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
AND user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||||
ORDER BY user_lang, user_notify_type';
|
ORDER BY user_lang, user_notify_type';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class acp_groups
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user is allowed to manage this group if set to founder only.
|
// Check if the user is allowed to manage this group if set to founder only.
|
||||||
if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage'])
|
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $group_row['group_founder_manage'])
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ class acp_groups
|
||||||
'founder_manage' => 0,
|
'founder_manage' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($user->data['user_type'] == USER_FOUNDER)
|
if ($user->data['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
$submit_ary['founder_manage'] = phpbb_request::is_set('group_founder_manage') ? 1 : 0;
|
$submit_ary['founder_manage'] = phpbb_request::is_set('group_founder_manage') ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ class acp_groups
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Check the group if non-founder
|
// Check the group if non-founder
|
||||||
if ($check_row && ($user->data['user_type'] == USER_FOUNDER || $check_row['group_founder_manage'] == 0))
|
if ($check_row && ($user->data['user_type'] == phpbb::USER_FOUNDER || $check_row['group_founder_manage'] == 0))
|
||||||
{
|
{
|
||||||
// From the mysql documentation:
|
// From the mysql documentation:
|
||||||
// Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
|
// Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
|
||||||
|
@ -549,7 +549,7 @@ class acp_groups
|
||||||
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
|
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
|
||||||
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
|
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
|
||||||
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
|
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
|
||||||
'S_USER_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
'S_USER_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false,
|
||||||
|
|
||||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||||
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
|
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
|
||||||
|
@ -568,7 +568,7 @@ class acp_groups
|
||||||
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
|
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
|
||||||
|
|
||||||
'S_RANK_OPTIONS' => $rank_options,
|
'S_RANK_OPTIONS' => $rank_options,
|
||||||
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == USER_FOUNDER) ? false : 0)),
|
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0)),
|
||||||
'AVATAR' => $avatar_img,
|
'AVATAR' => $avatar_img,
|
||||||
'AVATAR_IMAGE' => $avatar_img,
|
'AVATAR_IMAGE' => $avatar_img,
|
||||||
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
|
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
|
||||||
|
|
|
@ -82,7 +82,7 @@ class acp_inactive
|
||||||
$sql = 'SELECT user_id, username, user_email, user_lang
|
$sql = 'SELECT user_id, username, user_email, user_lang
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE ' . $db->sql_in_set('user_id', $mark) . '
|
WHERE ' . $db->sql_in_set('user_id', $mark) . '
|
||||||
AND user_type = ' . USER_INACTIVE;
|
AND user_type = ' . phpbb::USER_INACTIVE;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$inactive_users = array();
|
$inactive_users = array();
|
||||||
|
|
|
@ -149,7 +149,7 @@ class acp_main
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(user_id) AS stat
|
$sql = 'SELECT COUNT(user_id) AS stat
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
|
WHERE user_type IN (' . phpbb::USER_NORMAL . ',' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
|
set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -323,7 +323,7 @@ class acp_main
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'purge_cache':
|
case 'purge_cache':
|
||||||
if ((int) $user->data['user_type'] !== USER_FOUNDER)
|
if ((int) $user->data['user_type'] !== phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ class acp_main
|
||||||
'U_INACTIVE_USERS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&mode=list'),
|
'U_INACTIVE_USERS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&mode=list'),
|
||||||
|
|
||||||
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
|
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
|
||||||
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
'S_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ class acp_permission_roles
|
||||||
$auth_options = array();
|
$auth_options = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$auth_options[$row['auth_option']] = ACL_NO;
|
$auth_options[$row['auth_option']] = phpbb::ACL_NO;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ class acp_permission_roles
|
||||||
{
|
{
|
||||||
if (!isset($auth_options[$row['auth_option']]))
|
if (!isset($auth_options[$row['auth_option']]))
|
||||||
{
|
{
|
||||||
$auth_options[$row['auth_option']] = ACL_NO;
|
$auth_options[$row['auth_option']] = phpbb::ACL_NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -482,9 +482,9 @@ class acp_permission_roles
|
||||||
foreach ($cat_array['permissions'] as $permission => $allowed)
|
foreach ($cat_array['permissions'] as $permission => $allowed)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('auth.mask', array(
|
$template->assign_block_vars('auth.mask', array(
|
||||||
'S_YES' => ($allowed == ACL_YES) ? true : false,
|
'S_YES' => ($allowed == phpbb::ACL_YES) ? true : false,
|
||||||
'S_NEVER' => ($allowed == ACL_NEVER) ? true : false,
|
'S_NEVER' => ($allowed == phpbb::ACL_NEVER) ? true : false,
|
||||||
'S_NO' => ($allowed == ACL_NO) ? true : false,
|
'S_NO' => ($allowed == phpbb::ACL_NO) ? true : false,
|
||||||
|
|
||||||
'FIELD_NAME' => $permission,
|
'FIELD_NAME' => $permission,
|
||||||
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
|
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
|
||||||
|
@ -511,7 +511,7 @@ class acp_permission_roles
|
||||||
$auth_settings = array();
|
$auth_settings = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$auth_settings[$row['auth_option']] = ACL_NO;
|
$auth_settings[$row['auth_option']] = phpbb::ACL_NO;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ class acp_permissions
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_SELECT_GROUP' => true,
|
'S_SELECT_GROUP' => true,
|
||||||
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == USER_FOUNDER) ? false : 0)))
|
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0)))
|
||||||
);
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -414,7 +414,7 @@ class acp_permissions
|
||||||
'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false,
|
'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false,
|
||||||
'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'],
|
'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'],
|
||||||
'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'],
|
'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'],
|
||||||
'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], (($user->data['user_type'] == USER_FOUNDER) ? false : 0)),
|
'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0)),
|
||||||
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=add_user&field=username&select_single=true'),
|
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=add_user&field=username&select_single=true'),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ class acp_permissions
|
||||||
'S_SETTING_PERMISSIONS' => true)
|
'S_SETTING_PERMISSIONS' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
$hold_ary = $auth_admin->get_mask('set', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO);
|
$hold_ary = $auth_admin->get_mask('set', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, phpbb::ACL_NO);
|
||||||
$auth_admin->display_mask('set', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false));
|
$auth_admin->display_mask('set', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -490,7 +490,7 @@ class acp_permissions
|
||||||
'S_VIEWING_PERMISSIONS' => true)
|
'S_VIEWING_PERMISSIONS' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
$hold_ary = $auth_admin->get_mask('view', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER);
|
$hold_ary = $auth_admin->get_mask('view', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, phpbb::ACL_NEVER);
|
||||||
$auth_admin->display_mask('view', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false));
|
$auth_admin->display_mask('view', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ class acp_permissions
|
||||||
// We need to add any ACL_NO setting from auth_settings to compare correctly
|
// We need to add any ACL_NO setting from auth_settings to compare correctly
|
||||||
foreach ($auth_settings as $option => $setting)
|
foreach ($auth_settings as $option => $setting)
|
||||||
{
|
{
|
||||||
if ($setting == ACL_NO)
|
if ($setting == phpbb::ACL_NO)
|
||||||
{
|
{
|
||||||
$test_auth_settings[$option] = $setting;
|
$test_auth_settings[$option] = $setting;
|
||||||
}
|
}
|
||||||
|
@ -949,13 +949,13 @@ class acp_permissions
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$groups[$row['group_id']] = array(
|
$groups[$row['group_id']] = array(
|
||||||
'auth_setting' => ACL_NO,
|
'auth_setting' => phpbb::ACL_NO,
|
||||||
'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']
|
'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$total = ACL_NO;
|
$total = phpbb::ACL_NO;
|
||||||
$add_key = (($forum_id) ? '_LOCAL' : '');
|
$add_key = (($forum_id) ? '_LOCAL' : '');
|
||||||
|
|
||||||
if (sizeof($groups))
|
if (sizeof($groups))
|
||||||
|
@ -973,18 +973,18 @@ class acp_permissions
|
||||||
{
|
{
|
||||||
switch ($row['auth_setting'])
|
switch ($row['auth_setting'])
|
||||||
{
|
{
|
||||||
case ACL_NO:
|
case phpbb::ACL_NO:
|
||||||
$information = $user->lang['TRACE_GROUP_NO' . $add_key];
|
$information = $user->lang['TRACE_GROUP_NO' . $add_key];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_YES:
|
case phpbb::ACL_YES:
|
||||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]);
|
$information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]);
|
||||||
$total = ($total == ACL_NO) ? ACL_YES : $total;
|
$total = ($total == phpbb::ACL_NO) ? phpbb::ACL_YES : $total;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_NEVER:
|
case phpbb::ACL_NEVER:
|
||||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]);
|
$information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]);
|
||||||
$total = ACL_NEVER;
|
$total = phpbb::ACL_NEVER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,35 +992,35 @@ class acp_permissions
|
||||||
'WHO' => $row['group_name'],
|
'WHO' => $row['group_name'],
|
||||||
'INFORMATION' => $information,
|
'INFORMATION' => $information,
|
||||||
|
|
||||||
'S_SETTING_NO' => ($row['auth_setting'] == ACL_NO) ? true : false,
|
'S_SETTING_NO' => ($row['auth_setting'] == phpbb::ACL_NO) ? true : false,
|
||||||
'S_SETTING_YES' => ($row['auth_setting'] == ACL_YES) ? true : false,
|
'S_SETTING_YES' => ($row['auth_setting'] == phpbb::ACL_YES) ? true : false,
|
||||||
'S_SETTING_NEVER' => ($row['auth_setting'] == ACL_NEVER) ? true : false,
|
'S_SETTING_NEVER' => ($row['auth_setting'] == phpbb::ACL_NEVER) ? true : false,
|
||||||
'S_TOTAL_NO' => ($total == ACL_NO) ? true : false,
|
'S_TOTAL_NO' => ($total == phpbb::ACL_NO) ? true : false,
|
||||||
'S_TOTAL_YES' => ($total == ACL_YES) ? true : false,
|
'S_TOTAL_YES' => ($total == phpbb::ACL_YES) ? true : false,
|
||||||
'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false)
|
'S_TOTAL_NEVER' => ($total == phpbb::ACL_NEVER) ? true : false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user specific permission... globally or for this forum
|
// Get user specific permission... globally or for this forum
|
||||||
$hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id);
|
$hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id);
|
||||||
$auth_setting = (!sizeof($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission];
|
$auth_setting = (!sizeof($hold_ary)) ? phpbb::ACL_NO : $hold_ary[$user_id][$forum_id][$permission];
|
||||||
|
|
||||||
switch ($auth_setting)
|
switch ($auth_setting)
|
||||||
{
|
{
|
||||||
case ACL_NO:
|
case phpbb::ACL_NO:
|
||||||
$information = ($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key];
|
$information = ($total == phpbb::ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key];
|
||||||
$total = ($total == ACL_NO) ? ACL_NEVER : $total;
|
$total = ($total == phpbb::ACL_NO) ? phpbb::ACL_NEVER : $total;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_YES:
|
case phpbb::ACL_YES:
|
||||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]);
|
$information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]);
|
||||||
$total = ($total == ACL_NO) ? ACL_YES : $total;
|
$total = ($total == phpbb::ACL_NO) ? phpbb::ACL_YES : $total;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_NEVER:
|
case phpbb::ACL_NEVER:
|
||||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]);
|
$information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]);
|
||||||
$total = ACL_NEVER;
|
$total = phpbb::ACL_NEVER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1028,12 +1028,12 @@ class acp_permissions
|
||||||
'WHO' => $userdata['username'],
|
'WHO' => $userdata['username'],
|
||||||
'INFORMATION' => $information,
|
'INFORMATION' => $information,
|
||||||
|
|
||||||
'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false,
|
'S_SETTING_NO' => ($auth_setting == phpbb::ACL_NO) ? true : false,
|
||||||
'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false,
|
'S_SETTING_YES' => ($auth_setting == phpbb::ACL_YES) ? true : false,
|
||||||
'S_SETTING_NEVER' => ($auth_setting == ACL_NEVER) ? true : false,
|
'S_SETTING_NEVER' => ($auth_setting == phpbb::ACL_NEVER) ? true : false,
|
||||||
'S_TOTAL_NO' => false,
|
'S_TOTAL_NO' => false,
|
||||||
'S_TOTAL_YES' => ($total == ACL_YES) ? true : false,
|
'S_TOTAL_YES' => ($total == phpbb::ACL_YES) ? true : false,
|
||||||
'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false)
|
'S_TOTAL_NEVER' => ($total == phpbb::ACL_NEVER) ? true : false)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($forum_id != 0 && isset($auth->acl_options['global'][$permission]))
|
if ($forum_id != 0 && isset($auth->acl_options['global'][$permission]))
|
||||||
|
@ -1051,8 +1051,8 @@ class acp_permissions
|
||||||
|
|
||||||
if ($auth_setting)
|
if ($auth_setting)
|
||||||
{
|
{
|
||||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER'];
|
$information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER'];
|
||||||
$total = ACL_YES;
|
$total = phpbb::ACL_YES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1070,35 +1070,35 @@ class acp_permissions
|
||||||
'S_SETTING_YES' => $auth_setting,
|
'S_SETTING_YES' => $auth_setting,
|
||||||
'S_SETTING_NEVER' => !$auth_setting,
|
'S_SETTING_NEVER' => !$auth_setting,
|
||||||
'S_TOTAL_NO' => false,
|
'S_TOTAL_NO' => false,
|
||||||
'S_TOTAL_YES' => ($total == ACL_YES) ? true : false,
|
'S_TOTAL_YES' => ($total == phpbb::ACL_YES) ? true : false,
|
||||||
'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false)
|
'S_TOTAL_NEVER' => ($total == phpbb::ACL_NEVER) ? true : false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take founder status into account, overwriting the default values
|
// Take founder status into account, overwriting the default values
|
||||||
if ($userdata['user_type'] == USER_FOUNDER && strpos($permission, 'a_') === 0)
|
if ($userdata['user_type'] == phpbb::USER_FOUNDER && strpos($permission, 'a_') === 0)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('trace', array(
|
$template->assign_block_vars('trace', array(
|
||||||
'WHO' => $userdata['username'],
|
'WHO' => $userdata['username'],
|
||||||
'INFORMATION' => $user->lang['TRACE_USER_FOUNDER'],
|
'INFORMATION' => $user->lang['TRACE_USER_FOUNDER'],
|
||||||
|
|
||||||
'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false,
|
'S_SETTING_NO' => ($auth_setting == phpbb::ACL_NO) ? true : false,
|
||||||
'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false,
|
'S_SETTING_YES' => ($auth_setting == phpbb::ACL_YES) ? true : false,
|
||||||
'S_SETTING_NEVER' => ($auth_setting == ACL_NEVER) ? true : false,
|
'S_SETTING_NEVER' => ($auth_setting == phpbb::ACL_NEVER) ? true : false,
|
||||||
'S_TOTAL_NO' => false,
|
'S_TOTAL_NO' => false,
|
||||||
'S_TOTAL_YES' => true,
|
'S_TOTAL_YES' => true,
|
||||||
'S_TOTAL_NEVER' => false)
|
'S_TOTAL_NEVER' => false)
|
||||||
);
|
);
|
||||||
|
|
||||||
$total = ACL_YES;
|
$total = phpbb::ACL_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total value...
|
// Total value...
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_RESULT_NO' => ($total == ACL_NO) ? true : false,
|
'S_RESULT_NO' => ($total == phpbb::ACL_NO) ? true : false,
|
||||||
'S_RESULT_YES' => ($total == ACL_YES) ? true : false,
|
'S_RESULT_YES' => ($total == phpbb::ACL_YES) ? true : false,
|
||||||
'S_RESULT_NEVER' => ($total == ACL_NEVER) ? true : false,
|
'S_RESULT_NEVER' => ($total == phpbb::ACL_NEVER) ? true : false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ class acp_prune
|
||||||
$sql = 'SELECT user_id, username
|
$sql = 'SELECT user_id, username
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_id <> ' . ANONYMOUS . '
|
WHERE user_id <> ' . ANONYMOUS . '
|
||||||
AND user_type <> ' . USER_FOUNDER . "
|
AND user_type <> ' . phpbb::USER_FOUNDER . "
|
||||||
$where_sql";
|
$where_sql";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ class acp_users
|
||||||
);
|
);
|
||||||
|
|
||||||
// Prevent normal users/admins change/view founders if they are not a founder by themselves
|
// Prevent normal users/admins change/view founders if they are not a founder by themselves
|
||||||
if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER)
|
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $user_row['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class acp_users
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
// You can't delete the founder
|
// You can't delete the founder
|
||||||
if ($delete && $user_row['user_type'] != USER_FOUNDER)
|
if ($delete && $user_row['user_type'] != phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
if (!$auth->acl_get('a_userdel'))
|
if (!$auth->acl_get('a_userdel'))
|
||||||
{
|
{
|
||||||
|
@ -223,7 +223,7 @@ class acp_users
|
||||||
trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_FOUNDER)
|
if ($user_row['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -290,12 +290,12 @@ class acp_users
|
||||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_FOUNDER)
|
if ($user_row['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_IGNORE)
|
if ($user_row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -310,9 +310,9 @@ class acp_users
|
||||||
$key_len = 54 - (strlen($server_url));
|
$key_len = 54 - (strlen($server_url));
|
||||||
$key_len = ($key_len > 6) ? $key_len : 6;
|
$key_len = ($key_len > 6) ? $key_len : 6;
|
||||||
$user_actkey = substr($user_actkey, 0, $key_len);
|
$user_actkey = substr($user_actkey, 0, $key_len);
|
||||||
$email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive';
|
$email_template = ($user_row['user_type'] == phpbb::USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive';
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_NORMAL)
|
if ($user_row['user_type'] == phpbb::USER_NORMAL)
|
||||||
{
|
{
|
||||||
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);
|
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);
|
||||||
|
|
||||||
|
@ -372,20 +372,20 @@ class acp_users
|
||||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_FOUNDER)
|
if ($user_row['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_IGNORE)
|
if ($user_row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
user_active_flip('flip', $user_id);
|
user_active_flip('flip', $user_id);
|
||||||
|
|
||||||
$message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
|
$message = ($user_row['user_type'] == phpbb::USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
|
||||||
$log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE';
|
$log = ($user_row['user_type'] == phpbb::USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE';
|
||||||
|
|
||||||
add_log('admin', $log, $user_row['username']);
|
add_log('admin', $log, $user_row['username']);
|
||||||
add_log('user', $user_id, $log . '_USER');
|
add_log('user', $user_id, $log . '_USER');
|
||||||
|
@ -654,7 +654,7 @@ class acp_users
|
||||||
// Handle registration info updates
|
// Handle registration info updates
|
||||||
$data = array(
|
$data = array(
|
||||||
'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)),
|
'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)),
|
||||||
'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0),
|
'user_founder' => request_var('user_founder', ($user_row['user_type'] == phpbb::USER_FOUNDER) ? 1 : 0),
|
||||||
'email' => strtolower(request_var('user_email', $user_row['user_email'])),
|
'email' => strtolower(request_var('user_email', $user_row['user_email'])),
|
||||||
'email_confirm' => strtolower(request_var('email_confirm', '')),
|
'email_confirm' => strtolower(request_var('email_confirm', '')),
|
||||||
'new_password' => request_var('new_password', '', true),
|
'new_password' => request_var('new_password', '', true),
|
||||||
|
@ -718,33 +718,33 @@ class acp_users
|
||||||
{
|
{
|
||||||
$sql_ary = array();
|
$sql_ary = array();
|
||||||
|
|
||||||
if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER)
|
if ($user_row['user_type'] != phpbb::USER_FOUNDER || $user->data['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
// Only allow founders updating the founder status...
|
// Only allow founders updating the founder status...
|
||||||
if ($user->data['user_type'] == USER_FOUNDER)
|
if ($user->data['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
// Setting a normal member to be a founder
|
// Setting a normal member to be a founder
|
||||||
if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER)
|
if ($data['user_founder'] && $user_row['user_type'] != phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
// Make sure the user is not setting an Inactive or ignored user to be a founder
|
// Make sure the user is not setting an Inactive or ignored user to be a founder
|
||||||
if ($user_row['user_type'] == USER_IGNORE)
|
if ($user_row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_INACTIVE)
|
if ($user_row['user_type'] == phpbb::USER_INACTIVE)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_ary['user_type'] = USER_FOUNDER;
|
$sql_ary['user_type'] = phpbb::USER_FOUNDER;
|
||||||
}
|
}
|
||||||
else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER)
|
else if (!$data['user_founder'] && $user_row['user_type'] == phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
// Check if at least one founder is present
|
// Check if at least one founder is present
|
||||||
$sql = 'SELECT user_id
|
$sql = 'SELECT user_id
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type = ' . USER_FOUNDER . '
|
WHERE user_type = ' . phpbb::USER_FOUNDER . '
|
||||||
AND user_id <> ' . $user_id;
|
AND user_id <> ' . $user_id;
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
@ -752,7 +752,7 @@ class acp_users
|
||||||
|
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
$sql_ary['user_type'] = USER_NORMAL;
|
$sql_ary['user_type'] = phpbb::USER_NORMAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -825,19 +825,19 @@ class acp_users
|
||||||
{
|
{
|
||||||
$quick_tool_ary = array();
|
$quick_tool_ary = array();
|
||||||
|
|
||||||
if ($user_row['user_type'] != USER_FOUNDER)
|
if ($user_row['user_type'] != phpbb::USER_FOUNDER)
|
||||||
{
|
{
|
||||||
$quick_tool_ary += array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP');
|
$quick_tool_ary += array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] != USER_FOUNDER && $user_row['user_type'] != USER_IGNORE)
|
if ($user_row['user_type'] != phpbb::USER_FOUNDER && $user_row['user_type'] != phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
$quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE'));
|
$quick_tool_ary += array('active' => (($user_row['user_type'] == phpbb::USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
|
$quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
|
||||||
|
|
||||||
if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE))
|
if ($config['email_enable'] && ($user_row['user_type'] == phpbb::USER_NORMAL || $user_row['user_type'] == phpbb::USER_INACTIVE))
|
||||||
{
|
{
|
||||||
$quick_tool_ary['reactivate'] = 'FORCE';
|
$quick_tool_ary['reactivate'] = 'FORCE';
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ class acp_users
|
||||||
$last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit'];
|
$last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit'];
|
||||||
|
|
||||||
$inactive_reason = '';
|
$inactive_reason = '';
|
||||||
if ($user_row['user_type'] == USER_INACTIVE)
|
if ($user_row['user_type'] == phpbb::USER_INACTIVE)
|
||||||
{
|
{
|
||||||
$inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
|
$inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
|
||||||
|
|
||||||
|
@ -903,14 +903,14 @@ class acp_users
|
||||||
'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
|
'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
|
||||||
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']),
|
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']),
|
||||||
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
'S_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false,
|
||||||
|
|
||||||
'S_OVERVIEW' => true,
|
'S_OVERVIEW' => true,
|
||||||
'S_USER_IP' => ($user_row['user_ip']) ? true : false,
|
'S_USER_IP' => ($user_row['user_ip']) ? true : false,
|
||||||
'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false,
|
'S_USER_FOUNDER' => ($user_row['user_type'] == phpbb::USER_FOUNDER) ? true : false,
|
||||||
'S_ACTION_OPTIONS' => $s_action_options,
|
'S_ACTION_OPTIONS' => $s_action_options,
|
||||||
'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false,
|
'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false,
|
||||||
'S_USER_INACTIVE' => ($user_row['user_type'] == USER_INACTIVE) ? true : false,
|
'S_USER_INACTIVE' => ($user_row['user_type'] == phpbb::USER_INACTIVE) ? true : false,
|
||||||
|
|
||||||
'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
|
'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
|
||||||
'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}",
|
'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}",
|
||||||
|
@ -1801,7 +1801,7 @@ class acp_users
|
||||||
$founder_manage = (int) $db->sql_fetchfield('group_founder_manage');
|
$founder_manage = (int) $db->sql_fetchfield('group_founder_manage');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($user->data['user_type'] != USER_FOUNDER && $founder_manage)
|
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $founder_manage)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -1921,7 +1921,7 @@ class acp_users
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not display those groups not allowed to be managed
|
// Do not display those groups not allowed to be managed
|
||||||
if ($user->data['user_type'] != USER_FOUNDER && $row['group_founder_manage'])
|
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $row['group_founder_manage'])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1992,7 +1992,7 @@ class acp_users
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER);
|
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', phpbb::ACL_NEVER);
|
||||||
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false);
|
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -2010,7 +2010,7 @@ class acp_users
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER);
|
$hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', phpbb::ACL_NEVER);
|
||||||
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false);
|
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
|
@ -69,9 +69,9 @@ class auth_admin extends auth
|
||||||
* @param mixed $forum_id forum_ids to search for. Defining a forum id also means getting local settings
|
* @param mixed $forum_id forum_ids to search for. Defining a forum id also means getting local settings
|
||||||
* @param string $auth_option the auth_option defines the permission setting to look for (a_ for example)
|
* @param string $auth_option the auth_option defines the permission setting to look for (a_ for example)
|
||||||
* @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required
|
* @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required
|
||||||
* @param ACL_NEVER|ACL_NO|ACL_YES $acl_fill defines the mode those permissions not set are getting filled with
|
* @param phpbb::ACL_NEVER|phpbb::ACL_NO|phpbb::ACL_YES $acl_fill defines the mode those permissions not set are getting filled with
|
||||||
*/
|
*/
|
||||||
public function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER)
|
public function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = phpbb::ACL_NEVER)
|
||||||
{
|
{
|
||||||
global $db, $user;
|
global $db, $user;
|
||||||
|
|
||||||
|
@ -846,9 +846,9 @@ class auth_admin extends auth
|
||||||
// Ok, include the any-flag if one or more auth options are set to yes...
|
// Ok, include the any-flag if one or more auth options are set to yes...
|
||||||
foreach ($auth as $auth_option => $setting)
|
foreach ($auth as $auth_option => $setting)
|
||||||
{
|
{
|
||||||
if ($setting == ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == ACL_NEVER))
|
if ($setting == phpbb::ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == phpbb::ACL_NEVER))
|
||||||
{
|
{
|
||||||
$auth[$flag] = ACL_YES;
|
$auth[$flag] = phpbb::ACL_YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,7 +876,7 @@ class auth_admin extends auth
|
||||||
{
|
{
|
||||||
$auth_option_id = (int) $this->acl_options['id'][$auth_option];
|
$auth_option_id = (int) $this->acl_options['id'][$auth_option];
|
||||||
|
|
||||||
if ($setting != ACL_NO)
|
if ($setting != phpbb::ACL_NO)
|
||||||
{
|
{
|
||||||
foreach ($ug_id as $id)
|
foreach ($ug_id as $id)
|
||||||
{
|
{
|
||||||
|
@ -921,9 +921,9 @@ class auth_admin extends auth
|
||||||
// Re-set any flag...
|
// Re-set any flag...
|
||||||
foreach ($auth as $auth_option => $setting)
|
foreach ($auth as $auth_option => $setting)
|
||||||
{
|
{
|
||||||
if ($setting == ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == ACL_NEVER))
|
if ($setting == phpbb::ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == phpbb::ACL_NEVER))
|
||||||
{
|
{
|
||||||
$auth[$flag] = ACL_YES;
|
$auth[$flag] = phpbb::ACL_YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ class auth_admin extends auth
|
||||||
{
|
{
|
||||||
$auth_option_id = (int) $this->acl_options['id'][$auth_option];
|
$auth_option_id = (int) $this->acl_options['id'][$auth_option];
|
||||||
|
|
||||||
if ($setting != ACL_NO)
|
if ($setting != phpbb::ACL_NO)
|
||||||
{
|
{
|
||||||
$sql_ary[] = array(
|
$sql_ary[] = array(
|
||||||
'role_id' => (int) $role_id,
|
'role_id' => (int) $role_id,
|
||||||
|
@ -948,7 +948,7 @@ class auth_admin extends auth
|
||||||
$sql_ary[] = array(
|
$sql_ary[] = array(
|
||||||
'role_id' => (int) $role_id,
|
'role_id' => (int) $role_id,
|
||||||
'auth_option_id' => (int) $this->acl_options['id'][$flag],
|
'auth_option_id' => (int) $this->acl_options['id'][$flag],
|
||||||
'auth_setting' => ACL_NEVER
|
'auth_setting' => phpbb::ACL_NEVER
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ class auth_admin extends auth
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$option_id_ary[] = $row['auth_option_id'];
|
$option_id_ary[] = $row['auth_option_id'];
|
||||||
$auth_id_ary[$row['auth_option']] = ACL_NO;
|
$auth_id_ary[$row['auth_option']] = phpbb::ACL_NO;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
@ -1110,8 +1110,8 @@ class auth_admin extends auth
|
||||||
if ($s_view)
|
if ($s_view)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array(
|
$template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array(
|
||||||
'S_YES' => ($allowed == ACL_YES) ? true : false,
|
'S_YES' => ($allowed == phpbb::ACL_YES) ? true : false,
|
||||||
'S_NEVER' => ($allowed == ACL_NEVER) ? true : false,
|
'S_NEVER' => ($allowed == phpbb::ACL_NEVER) ? true : false,
|
||||||
|
|
||||||
'UG_ID' => $ug_id,
|
'UG_ID' => $ug_id,
|
||||||
'FORUM_ID' => $forum_id,
|
'FORUM_ID' => $forum_id,
|
||||||
|
@ -1127,9 +1127,9 @@ class auth_admin extends auth
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array(
|
$template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array(
|
||||||
'S_YES' => ($allowed == ACL_YES) ? true : false,
|
'S_YES' => ($allowed == phpbb::ACL_YES) ? true : false,
|
||||||
'S_NEVER' => ($allowed == ACL_NEVER) ? true : false,
|
'S_NEVER' => ($allowed == phpbb::ACL_NEVER) ? true : false,
|
||||||
'S_NO' => ($allowed == ACL_NO) ? true : false,
|
'S_NO' => ($allowed == phpbb::ACL_NO) ? true : false,
|
||||||
|
|
||||||
'UG_ID' => $ug_id,
|
'UG_ID' => $ug_id,
|
||||||
'FORUM_ID' => $forum_id,
|
'FORUM_ID' => $forum_id,
|
||||||
|
@ -1199,9 +1199,9 @@ class auth_admin extends auth
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content_array[$forum_id][$cat]['S_YES'] |= ($auth_setting == ACL_YES) ? true : false;
|
$content_array[$forum_id][$cat]['S_YES'] |= ($auth_setting == phpbb::ACL_YES) ? true : false;
|
||||||
$content_array[$forum_id][$cat]['S_NEVER'] |= ($auth_setting == ACL_NEVER) ? true : false;
|
$content_array[$forum_id][$cat]['S_NEVER'] |= ($auth_setting == phpbb::ACL_NEVER) ? true : false;
|
||||||
$content_array[$forum_id][$cat]['S_NO'] |= ($auth_setting == ACL_NO) ? true : false;
|
$content_array[$forum_id][$cat]['S_NO'] |= ($auth_setting == phpbb::ACL_NO) ? true : false;
|
||||||
|
|
||||||
$content_array[$forum_id][$cat]['permissions'][$permission] = $auth_setting;
|
$content_array[$forum_id][$cat]['permissions'][$permission] = $auth_setting;
|
||||||
}
|
}
|
||||||
|
@ -1233,12 +1233,12 @@ class auth_admin extends auth
|
||||||
{
|
{
|
||||||
if (strpos($opt, 'a_') === 0)
|
if (strpos($opt, 'a_') === 0)
|
||||||
{
|
{
|
||||||
$hold_ary[0][$this->acl_options['id'][$opt]] = ACL_NEVER;
|
$hold_ary[0][$this->acl_options['id'][$opt]] = phpbb::ACL_NEVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force a_switchperm to be allowed
|
// Force a_switchperm to be allowed
|
||||||
$hold_ary[0][$this->acl_options['id']['a_switchperm']] = ACL_YES;
|
$hold_ary[0][$this->acl_options['id']['a_switchperm']] = phpbb::ACL_YES;
|
||||||
|
|
||||||
$user_permissions = $this->build_bitstring($hold_ary);
|
$user_permissions = $this->build_bitstring($hold_ary);
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ class mcp_warn
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no point issuing a warning to ignored users (ie anonymous and bots)
|
// There is no point issuing a warning to ignored users (ie anonymous and bots)
|
||||||
if ($user_row['user_type'] == USER_IGNORE)
|
if ($user_row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error('CANNOT_WARN_ANONYMOUS');
|
trigger_error('CANNOT_WARN_ANONYMOUS');
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ucp_activate
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] <> USER_INACTIVE && !$user_row['user_newpasswd'])
|
if ($user_row['user_type'] <> phpbb::USER_INACTIVE && !$user_row['user_newpasswd'])
|
||||||
{
|
{
|
||||||
meta_refresh(3, append_sid('index'));
|
meta_refresh(3, append_sid('index'));
|
||||||
trigger_error('ALREADY_ACTIVATED');
|
trigger_error('ALREADY_ACTIVATED');
|
||||||
|
|
|
@ -429,7 +429,7 @@ class ucp_groups
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user is allowed to manage this group if set to founder only.
|
// Check if the user is allowed to manage this group if set to founder only.
|
||||||
if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage'])
|
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $group_row['group_founder_manage'])
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
|
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1147,7 +1147,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
|
||||||
if (sizeof($usernames))
|
if (sizeof($usernames))
|
||||||
{
|
{
|
||||||
$user_id_ary = array();
|
$user_id_ary = array();
|
||||||
user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER, USER_INACTIVE));
|
user_get_id_name($user_id_ary, $usernames, array(phpbb::USER_NORMAL, phpbb::USER_FOUNDER, phpbb::USER_INACTIVE));
|
||||||
|
|
||||||
// If there are users not existing, we will at least print a notice...
|
// If there are users not existing, we will at least print a notice...
|
||||||
if (!sizeof($user_id_ary))
|
if (!sizeof($user_id_ary))
|
||||||
|
|
|
@ -133,7 +133,7 @@ class ucp_profile
|
||||||
|
|
||||||
$message = 'PROFILE_UPDATED';
|
$message = 'PROFILE_UPDATED';
|
||||||
|
|
||||||
if ($config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
|
if ($config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != phpbb::USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
|
||||||
{
|
{
|
||||||
$message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
|
$message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class ucp_profile
|
||||||
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
|
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
|
||||||
|
|
||||||
// Also include founders
|
// Also include founders
|
||||||
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
|
$where_sql = ' WHERE user_type = ' . phpbb::USER_FOUNDER;
|
||||||
|
|
||||||
if (sizeof($admin_ary))
|
if (sizeof($admin_ary))
|
||||||
{
|
{
|
||||||
|
|
|
@ -277,13 +277,13 @@ class ucp_register
|
||||||
$key_len = ($key_len < 6) ? 6 : $key_len;
|
$key_len = ($key_len < 6) ? 6 : $key_len;
|
||||||
$user_actkey = substr($user_actkey, 0, $key_len);
|
$user_actkey = substr($user_actkey, 0, $key_len);
|
||||||
|
|
||||||
$user_type = USER_INACTIVE;
|
$user_type = phpbb::USER_INACTIVE;
|
||||||
$user_inactive_reason = INACTIVE_REGISTER;
|
$user_inactive_reason = INACTIVE_REGISTER;
|
||||||
$user_inactive_time = time();
|
$user_inactive_time = time();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$user_type = USER_NORMAL;
|
$user_type = phpbb::USER_NORMAL;
|
||||||
$user_actkey = '';
|
$user_actkey = '';
|
||||||
$user_inactive_reason = 0;
|
$user_inactive_reason = 0;
|
||||||
$user_inactive_time = 0;
|
$user_inactive_time = 0;
|
||||||
|
@ -375,7 +375,7 @@ class ucp_register
|
||||||
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
|
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
|
||||||
|
|
||||||
// Also include founders
|
// Also include founders
|
||||||
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
|
$where_sql = ' WHERE user_type = ' . phpbb::USER_FOUNDER;
|
||||||
|
|
||||||
if (sizeof($admin_ary))
|
if (sizeof($admin_ary))
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,12 +48,12 @@ class ucp_remind
|
||||||
trigger_error('NO_EMAIL_USER');
|
trigger_error('NO_EMAIL_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_IGNORE)
|
if ($user_row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_INACTIVE)
|
if ($user_row['user_type'] == phpbb::USER_INACTIVE)
|
||||||
{
|
{
|
||||||
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL)
|
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,17 +55,17 @@ class ucp_resend
|
||||||
trigger_error('NO_EMAIL_USER');
|
trigger_error('NO_EMAIL_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_row['user_type'] == USER_IGNORE)
|
if ($user_row['user_type'] == phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE)
|
if (!$user_row['user_actkey'] && $user_row['user_type'] != phpbb::USER_INACTIVE)
|
||||||
{
|
{
|
||||||
trigger_error('ACCOUNT_ALREADY_ACTIVATED');
|
trigger_error('ACCOUNT_ALREADY_ACTIVATED');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL))
|
if (!$user_row['user_actkey'] || ($user_row['user_type'] == phpbb::USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL))
|
||||||
{
|
{
|
||||||
trigger_error('ACCOUNT_DEACTIVATED');
|
trigger_error('ACCOUNT_DEACTIVATED');
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,13 +114,13 @@ class ucp_zebra
|
||||||
$sql = 'SELECT user_id, user_type
|
$sql = 'SELECT user_id, user_type
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE ' . $db->sql_in_set('username_clean', $data['add']) . '
|
WHERE ' . $db->sql_in_set('username_clean', $data['add']) . '
|
||||||
AND user_type <> ' . USER_INACTIVE;
|
AND user_type <> ' . phpbb::USER_INACTIVE;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$user_id_ary = array();
|
$user_id_ary = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['user_id'] != ANONYMOUS && $row['user_type'] != USER_IGNORE)
|
if ($row['user_id'] != ANONYMOUS && $row['user_type'] != phpbb::USER_IGNORE)
|
||||||
{
|
{
|
||||||
$user_id_ary[] = $row['user_id'];
|
$user_id_ary[] = $row['user_id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,249 +1,507 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package plugins
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2007 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* Class used by plugins/modules/etc. for installation/uninstallation
|
||||||
*/
|
*/
|
||||||
if (!defined('IN_PHPBB'))
|
class phpbb_install
|
||||||
{
|
{
|
||||||
exit;
|
public function install() {}
|
||||||
|
public function uninstall() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB Hook Class
|
* Main class handling plugins/hooks
|
||||||
* @package phpBB3
|
|
||||||
*/
|
*/
|
||||||
class phpbb_hook
|
class phpbb_plugins
|
||||||
{
|
{
|
||||||
/**
|
public $phpbb_required = array();
|
||||||
* Registered hooks
|
public $phpbb_optional = array();
|
||||||
*/
|
|
||||||
var $hooks = array();
|
public $plugin_path = false;
|
||||||
|
public $plugins = array();
|
||||||
|
|
||||||
|
private $hooks = array();
|
||||||
|
private $current_plugin = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Results returned by functions called
|
|
||||||
*/
|
|
||||||
var $hook_result = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* internal pointer
|
|
||||||
*/
|
|
||||||
var $current_hook = NULL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize hook class.
|
|
||||||
*
|
*
|
||||||
* @param array $valid_hooks array containing the hookable functions/methods
|
* @return
|
||||||
|
* @param string $plugin_path
|
||||||
*/
|
*/
|
||||||
function __construct($valid_hooks)
|
public function init($plugin_path)
|
||||||
{
|
{
|
||||||
foreach ($valid_hooks as $_null => $method)
|
$this->plugin_path = $plugin_path;
|
||||||
{
|
$this->plugins = array();
|
||||||
$this->add_hook($method);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function_exists('phpbb_hook_register'))
|
// search for plugin files
|
||||||
|
if ($dh = @opendir($this->plugin_path))
|
||||||
{
|
{
|
||||||
phpbb_hook_register($this);
|
while (($file = readdir($dh)) !== false)
|
||||||
|
{
|
||||||
|
// If is directory and a PHP file with the same name as the directory within this dir?
|
||||||
|
if ($file[0] != '.' && is_readable($this->plugin_path . $file) && is_dir($this->plugin_path . $file) && file_exists($this->plugin_path . $file . '/' . $file . '.' . PHP_EXT))
|
||||||
|
{
|
||||||
|
$this->add_plugin($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register function/method to be called within hook
|
|
||||||
* This function is normally called by the modification/application to attach/register the functions.
|
|
||||||
*
|
*
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
* @return
|
||||||
* @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition
|
* @param string $phpbb_name
|
||||||
* @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain.
|
|
||||||
*/
|
*/
|
||||||
function register($definition, $hook, $mode = 'normal')
|
public function add_plugin($phpbb_name)
|
||||||
{
|
{
|
||||||
$class = (!is_array($definition)) ? '__global' : $definition[0];
|
if (!file_exists($this->plugin_path . $phpbb_name . '/' . $phpbb_name . '.' . PHP_EXT))
|
||||||
$function = (!is_array($definition)) ? $definition : $definition[1];
|
|
||||||
|
|
||||||
// Method able to be hooked?
|
|
||||||
if (isset($this->hooks[$class][$function]))
|
|
||||||
{
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'standalone':
|
|
||||||
if (!isset($this->hooks[$class][$function]['standalone']))
|
|
||||||
{
|
|
||||||
$this->hooks[$class][$function] = array('standalone' => $hook);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'first':
|
|
||||||
case 'last':
|
|
||||||
$this->hooks[$class][$function][$mode][] = $hook;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'normal':
|
|
||||||
default:
|
|
||||||
$this->hooks[$class][$function]['normal'][] = $hook;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calling all functions/methods attached to a specified hook.
|
|
||||||
* Called by the function allowing hooks...
|
|
||||||
*
|
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
|
||||||
* @return bool False if no hook got executed, true otherwise
|
|
||||||
*/
|
|
||||||
function call_hook($definition)
|
|
||||||
{
|
|
||||||
$class = (!is_array($definition)) ? '__global' : $definition[0];
|
|
||||||
$function = (!is_array($definition)) ? $definition : $definition[1];
|
|
||||||
|
|
||||||
if (!empty($this->hooks[$class][$function]))
|
|
||||||
{
|
|
||||||
// Developer tries to call a hooked function within the hooked function...
|
|
||||||
if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the hook with the arguments attached and store result
|
// Include desired plugin
|
||||||
|
require_once $this->plugin_path . $phpbb_name . '/' . $phpbb_name . '.' . PHP_EXT;
|
||||||
|
|
||||||
|
// Create new setup for this plugin
|
||||||
|
$this->plugins[$phpbb_name] = new phpbb_plugin_structure($phpbb_name);
|
||||||
|
$this->current_plugin = $this->plugins[$phpbb_name];
|
||||||
|
|
||||||
|
// Setup plugin
|
||||||
|
$this->current_plugin->setup->setup_plugin($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setup()
|
||||||
|
{
|
||||||
|
if (empty($this->plugins))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->plugins as $name => $plugin)
|
||||||
|
{
|
||||||
|
// Add includes
|
||||||
|
foreach ($plugin->includes as $file)
|
||||||
|
{
|
||||||
|
include_once $this->plugin_path . $name . '/' . $file . '.' . PHP_EXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup objects
|
||||||
|
foreach ($plugin->objects as $key => $class)
|
||||||
|
{
|
||||||
|
$object = new $class();
|
||||||
|
|
||||||
|
if (!property_exists($object, 'phpbb_plugin') && !property_exists($object, 'class_plugin'))
|
||||||
|
{
|
||||||
|
trigger_error('Class ' . get_class($object) . ' does not define public $phpbb_plugin and public $class_plugin.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property_exists($object, 'phpbb_plugin') && !empty($object->phpbb_plugin))
|
||||||
|
{
|
||||||
|
// Is the plugin the mod author wants to influence pluggable?
|
||||||
|
if (!is_subclass_of(phpbb::get_instance($object->phpbb_plugin), 'phpbb_plugin_support'))
|
||||||
|
{
|
||||||
|
trigger_error('The phpBB Class ' . get_class(phpbb::get_instance($object->phpbb_plugin)) . ' defined in ' . get_class($object) . ' is not pluggable.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$instance = phpbb::get_instance($object->phpbb_plugin);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$instance = ${$object->object_plugin};
|
||||||
|
|
||||||
|
if (!is_subclass_of($instance, 'phpbb_plugin_support'))
|
||||||
|
{
|
||||||
|
trigger_error('The Class ' . get_class($instance) . ' defined in ' . get_class($object) . ' is not pluggable.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup/Register plugin...
|
||||||
|
$object->setup_plugin($instance);
|
||||||
|
// $plugin->objects[$key] = $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now setup the functions... this is a special case...
|
||||||
|
foreach ($plugin->functions as $params)
|
||||||
|
{
|
||||||
|
$function = array_shift($params);
|
||||||
|
$hook = array_shift($params);
|
||||||
|
$mode = (!empty($params)) ? array_shift($params) : phpbb::FUNCTION_INJECT;
|
||||||
|
$action = (!empty($params)) ? array_shift($params) : 'default';
|
||||||
|
|
||||||
|
// Check if the function is already overridden.
|
||||||
|
if ($mode == phpbb::FUNCTION_OVERRIDE && isset($this->hooks[$function][$mode]))
|
||||||
|
{
|
||||||
|
trigger_error('Function ' . $function . ' is already overwriten by ' . $this->hooks[$function][$mode] . '.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == phpbb::FUNCTION_OVERRIDE)
|
||||||
|
{
|
||||||
|
$this->hooks[$function][$mode] = $hook;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->hooks[$function][$mode][$action][] = $hook;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call init method?
|
||||||
|
if (method_exists($plugin->setup, 'init'))
|
||||||
|
{
|
||||||
|
$plugin->setup->init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register_includes()
|
||||||
|
{
|
||||||
$arguments = func_get_args();
|
$arguments = func_get_args();
|
||||||
$this->current_hook = array('class' => $class, 'function' => $function);
|
$this->current_plugin->includes = $arguments;
|
||||||
$arguments[0] = &$this;
|
}
|
||||||
|
|
||||||
// Call the hook chain...
|
public function register_plugins()
|
||||||
if (isset($this->hooks[$class][$function]['standalone']))
|
|
||||||
{
|
{
|
||||||
$this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments);
|
$arguments = func_get_args();
|
||||||
|
$this->current_plugin->objects = $arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register_function()
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
$this->current_plugin->functions[] = $arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function function_override($function)
|
||||||
|
{
|
||||||
|
return isset($this->hooks[$function][phpbb::FUNCTION_OVERRIDE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function function_inject($function, $action = 'default')
|
||||||
|
{
|
||||||
|
return isset($this->hooks[$function][phpbb::FUNCTION_INJECT][$action]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function call_override()
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
$function = array_shift($arguments);
|
||||||
|
|
||||||
|
return call_user_func_array($this->hooks[$function][phpbb::FUNCTION_OVERRIDE], $arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call injected function.
|
||||||
|
*
|
||||||
|
* Arguments are layed out in the following way:
|
||||||
|
* action: The action:
|
||||||
|
* 'default': If $action is default, then the hook is called in the beginning, original parameter passed by reference
|
||||||
|
* 'return': If $action is return, then the hook is called at the end and the result will be returned. The hook expects the $result as the first parameter, all other parameters passed by name
|
||||||
|
* If $action is not default and not return it could be a custom string. Please refer to the plugin documentation to determine possible combinations. Parameters are passed by reference.
|
||||||
|
*
|
||||||
|
* @param string $function Original function name this method is called from
|
||||||
|
* @param array $arguments Arguments
|
||||||
|
*/
|
||||||
|
public function call_inject($function, $arguments)
|
||||||
|
{
|
||||||
|
$result = NULL;
|
||||||
|
|
||||||
|
if (!is_array($arguments))
|
||||||
|
{
|
||||||
|
$action = $arguments;
|
||||||
|
$arguments = array();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (array('first', 'normal', 'last') as $mode)
|
$action = array_shift($arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return action... handle like override
|
||||||
|
if ($action == 'return')
|
||||||
{
|
{
|
||||||
if (!isset($this->hooks[$class][$function][$mode]))
|
$result = array_shift($arguments);
|
||||||
|
|
||||||
|
foreach ($this->hooks[$function][phpbb::FUNCTION_INJECT][$action] as $key => $hook)
|
||||||
{
|
{
|
||||||
continue;
|
$args = array_merge(array($result), $arguments);
|
||||||
|
$result = call_user_func_array($hook, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->hooks[$class][$function][$mode] as $hook)
|
|
||||||
{
|
|
||||||
$this->hook_result[$class][$function] = call_user_func_array($hook, $arguments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->current_hook = NULL;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->current_hook = NULL;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get result from previously called functions/methods for the same hook
|
|
||||||
*
|
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
|
||||||
* @return mixed False if nothing returned if there is no result, else array('result' => ... )
|
|
||||||
*/
|
|
||||||
function previous_hook_result($definition)
|
|
||||||
{
|
|
||||||
$class = (!is_array($definition)) ? '__global' : $definition[0];
|
|
||||||
$function = (!is_array($definition)) ? $definition : $definition[1];
|
|
||||||
|
|
||||||
if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function]))
|
|
||||||
{
|
|
||||||
return array('result' => $this->hook_result[$class][$function]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the called functions/methods returned something.
|
|
||||||
*
|
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
|
||||||
* @return bool True if results are there, false if not
|
|
||||||
*/
|
|
||||||
function hook_return($definition)
|
|
||||||
{
|
|
||||||
$class = (!is_array($definition)) ? '__global' : $definition[0];
|
|
||||||
$function = (!is_array($definition)) ? $definition : $definition[1];
|
|
||||||
|
|
||||||
if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function]))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Give actual result from called functions/methods back.
|
|
||||||
*
|
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
|
||||||
* @return mixed The result
|
|
||||||
*/
|
|
||||||
function hook_return_result($definition)
|
|
||||||
{
|
|
||||||
$class = (!is_array($definition)) ? '__global' : $definition[0];
|
|
||||||
$function = (!is_array($definition)) ? $definition : $definition[1];
|
|
||||||
|
|
||||||
if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function]))
|
|
||||||
{
|
|
||||||
$result = $this->hook_result[$class][$function];
|
|
||||||
unset($this->hook_result[$class][$function]);
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
foreach ($this->hooks[$function][phpbb::FUNCTION_INJECT][$action] as $key => $hook)
|
||||||
|
{
|
||||||
|
call_user_func_array($hook, $arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Object used to hold plugin information. Per plugin one instance
|
||||||
|
class phpbb_plugin_structure
|
||||||
|
{
|
||||||
|
public $phpbb_name;
|
||||||
|
public $name;
|
||||||
|
public $description;
|
||||||
|
public $author;
|
||||||
|
public $version;
|
||||||
|
|
||||||
|
public $includes = array();
|
||||||
|
public $objects = array();
|
||||||
|
public $functions = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @param string $phpbb_name
|
||||||
|
*/
|
||||||
|
public function __construct($phpbb_name)
|
||||||
|
{
|
||||||
|
$this->phpbb_name = $phpbb_name;
|
||||||
|
|
||||||
|
$class = 'phpbb_' . $phpbb_name . '_info';
|
||||||
|
$this->setup = new $class();
|
||||||
|
|
||||||
|
foreach (array('name', 'description', 'author', 'version') as $required_property)
|
||||||
|
{
|
||||||
|
$this->$required_property = $this->setup->$required_property;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface phpbb_plugin_info
|
||||||
|
{
|
||||||
|
public function setup_plugin(phpbb_plugins $object);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface phpbb_plugin_setup
|
||||||
|
{
|
||||||
|
function setup_plugin(phpbb_plugin_support $object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
abstract class phpbb_plugin_support
|
||||||
|
{
|
||||||
|
private $plugin_methods;
|
||||||
|
private $plugin_attributes;
|
||||||
|
|
||||||
|
public function register_method($name, $method, $object, $mode = phpbb::PLUGIN_ADD, $action = 'default')
|
||||||
|
{
|
||||||
|
// Method reachable by:
|
||||||
|
// For plugin_add: plugin_methods[method] = object
|
||||||
|
// For plugin_override: plugin_methods[name][mode][method] = object
|
||||||
|
// For plugin_inject: plugin_methods[name][mode][action][method] = object
|
||||||
|
|
||||||
|
// Set to PLUGIN_ADD if method does not exist
|
||||||
|
if ($name === false || !method_exists($this, $name))
|
||||||
|
{
|
||||||
|
$mode = phpbb::PLUGIN_ADD;
|
||||||
|
}
|
||||||
|
|
||||||
|
// But if it exists and we try to add one, then print out an error
|
||||||
|
if ($mode == phpbb::PLUGIN_ADD && (method_exists($this, $method) || isset($this->plugin_methods[$method])))
|
||||||
|
{
|
||||||
|
trigger_error('Method ' . $method. ' in class ' . get_class($object) . ' is not able to be added, because it conflicts with the existing method ' . $method . ' in ' . get_class($this) . '.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the same method name is already used for $name for overriding the method.
|
||||||
|
if ($mode == phpbb::PLUGIN_OVERRIDE && isset($this->plugin_methods[$name][$mode][$method]))
|
||||||
|
{
|
||||||
|
trigger_error('Method ' . $method . ' in class ' . get_class($object) . ' is not able to override . ' . $name . ' in ' . get_class($this) . ', because it is already overridden in ' . get_class($this->plugin_methods[$name][$mode][$method]) . '.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if another method is already defined...
|
||||||
|
if ($mode == phpbb::PLUGIN_INJECT && isset($this->plugin_methods[$name][$mode][$action][$method]))
|
||||||
|
{
|
||||||
|
trigger_error('Method ' . $method . ' in class ' . get_class($object) . ' for ' . $name . ' is already defined in class ' . get_class($this->plugin_methods[$name][$mode][$action][$method]), E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($function_signature = $this->valid_parameter($object, $method, $mode, $action)) !== true)
|
||||||
|
{
|
||||||
|
trigger_error('Method ' . $method . ' in class ' . get_class($object) . ' has invalid function signature. Please use: ' . $function_signature, E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == phpbb::PLUGIN_ADD)
|
||||||
|
{
|
||||||
|
$this->plugin_methods[$method] = $object;
|
||||||
|
}
|
||||||
|
else if ($mode == phpbb::PLUGIN_OVERRIDE)
|
||||||
|
{
|
||||||
|
$this->plugin_methods[$name][$mode][$method] = $object;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->plugin_methods[$name][$mode][$action][$method] = $object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register_attribute($name, $object)
|
||||||
|
{
|
||||||
|
if (property_exists($this, $name))
|
||||||
|
{
|
||||||
|
unset($this->$name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->plugin_attributes[$name]))
|
||||||
|
{
|
||||||
|
trigger_error('Attribute ' . $name . ' in class ' . get_class($object) . ' already defined in class ' . get_class($this->plugin_attributes[$name]), E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->plugin_attributes[$name] = $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function method_override($name)
|
||||||
|
{
|
||||||
|
return isset($this->plugin_methods[$name][phpbb::PLUGIN_OVERRIDE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function method_inject($name, $action = 'default')
|
||||||
|
{
|
||||||
|
return isset($this->plugin_methods[$name][phpbb::PLUGIN_INJECT][$action]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function call_override()
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
$name = array_shift($arguments);
|
||||||
|
|
||||||
|
list($method, $object) = each($this->plugin_methods[$name][phpbb::PLUGIN_OVERRIDE]);
|
||||||
|
return call_user_func_array(array($object, $method), array_merge(array($this), $arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add new function to the allowed hooks.
|
* Call injected method.
|
||||||
*
|
*
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
* Arguments are layed out in the following way:
|
||||||
*/
|
* action: The action:
|
||||||
function add_hook($definition)
|
* 'default': If $action is default, then the plugin is called in the beginning, original parameter passed by reference
|
||||||
{
|
* 'return': If $action is return, then the plugin is called at the end and the result will be returned. The plugin expects the $result as the first parameter, all other parameters passed by name
|
||||||
if (!is_array($definition))
|
* If $action is not default and not return it could be a custom string. Please refer to the plugin documentation to determine possible combinations. Parameters are passed by reference.
|
||||||
{
|
|
||||||
$definition = array('__global', $definition);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->hooks[$definition[0]][$definition[1]] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove function from the allowed hooks.
|
|
||||||
*
|
*
|
||||||
* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
|
* @param string $name Original method name this method is called from
|
||||||
|
* @param array $arguments Arguments
|
||||||
*/
|
*/
|
||||||
function remove_hook($definition)
|
public function call_inject($name, $arguments)
|
||||||
{
|
{
|
||||||
$class = (!is_array($definition)) ? '__global' : $definition[0];
|
$result = NULL;
|
||||||
$function = (!is_array($definition)) ? $definition : $definition[1];
|
|
||||||
|
|
||||||
if (isset($this->hooks[$class][$function]))
|
if (!is_array($arguments))
|
||||||
{
|
{
|
||||||
unset($this->hooks[$class][$function]);
|
$action = $arguments;
|
||||||
|
$arguments = array();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$action = array_shift($arguments);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($this->hook_result[$class][$function]))
|
// Return action... handle like override
|
||||||
|
if ($action == 'return')
|
||||||
{
|
{
|
||||||
unset($this->hook_result[$class][$function]);
|
$result = array_shift($arguments);
|
||||||
|
|
||||||
|
foreach ($this->plugin_methods[$name][phpbb::PLUGIN_INJECT][$action] as $method => $object)
|
||||||
|
{
|
||||||
|
$args = array_merge(array($this, $result), $arguments);
|
||||||
|
$result = call_user_func_array(array($object, $method), $args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->plugin_methods[$name][phpbb::PLUGIN_INJECT][$action] as $method => $object)
|
||||||
|
{
|
||||||
|
call_user_func_array(array($object, $method), array_merge(array($this), $arguments));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Getter/Setter
|
||||||
|
public function __get($name)
|
||||||
|
{
|
||||||
|
return $this->plugin_attributes[$name]->$name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __set($name, $value)
|
||||||
|
{
|
||||||
|
return $this->plugin_attributes[$name]->$name = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __isset($name)
|
||||||
|
{
|
||||||
|
return isset($this->plugin_attributes[$name]->$name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __unset($name)
|
||||||
|
{
|
||||||
|
unset($this->plugin_attributes[$name]->$name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($name, $arguments)
|
||||||
|
{
|
||||||
|
array_unshift($arguments, $this);
|
||||||
|
return call_user_func_array(array($this->plugin_methods[$name], $name), $arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function valid_parameter($object, $method, $mode, $action)
|
||||||
|
{
|
||||||
|
// We cache the results... no worry. These checks are quite resource intensive, but will hopefully educate and guide developers
|
||||||
|
|
||||||
|
// Check for correct first parameter. This must be an instance of phpbb_$phpbb_plugin
|
||||||
|
$instance_of = 'phpbb_' . $object->phpbb_plugin;
|
||||||
|
|
||||||
|
// Define the required function layout
|
||||||
|
$function_layout = 'public function ' . $method . '(' . $instance_of . ' $object';
|
||||||
|
|
||||||
|
// Result for PLUGIN_INJECT and action == 'return'
|
||||||
|
if ($mode == phpbb::PLUGIN_INJECT && $action == 'return')
|
||||||
|
{
|
||||||
|
$function_layout .= ', $result';
|
||||||
|
}
|
||||||
|
|
||||||
|
$function_layout .= ', [...]) { [...] }';
|
||||||
|
|
||||||
|
$reflection = new ReflectionMethod($object, $method);
|
||||||
|
$parameters = $reflection->getParameters();
|
||||||
|
$first_param = array_shift($parameters);
|
||||||
|
|
||||||
|
// Try to get class
|
||||||
|
if (empty($first_param))
|
||||||
|
{
|
||||||
|
return $function_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$first_param->getClass()->name;
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
return $function_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($first_param->getClass()->name !== $instance_of || $first_param->getName() !== 'object')
|
||||||
|
{
|
||||||
|
return $function_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == phpbb::PLUGIN_INJECT && $action == 'return')
|
||||||
|
{
|
||||||
|
$first_param = array_shift($parameters);
|
||||||
|
|
||||||
|
if (empty($first_param) || $first_param->getName() !== 'result' || $first_param->isOptional())
|
||||||
|
{
|
||||||
|
return $function_layout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
$sql = 'SELECT user_id
|
$sql = 'SELECT user_id
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . "
|
||||||
WHERE $sql_where
|
WHERE $sql_where
|
||||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
AND user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query_limit($sql, 100);
|
$result = $db->sql_query_limit($sql, 100);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
|
@ -139,7 +139,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
$view_online = $s_user_hidden = false;
|
$view_online = $s_user_hidden = false;
|
||||||
$user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : '';
|
$user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : '';
|
||||||
|
|
||||||
$username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '<span' . $user_colour . '>' . $row['username'] . '</span>';
|
$username_full = ($row['user_type'] != phpbb::USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '<span' . $user_colour . '>' . $row['username'] . '</span>';
|
||||||
|
|
||||||
if (!$row['session_viewonline'])
|
if (!$row['session_viewonline'])
|
||||||
{
|
{
|
||||||
|
@ -330,7 +330,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '',
|
'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '',
|
||||||
'USER_BROWSER' => ($auth->acl_get('a_user')) ? $row['session_browser'] : '',
|
'USER_BROWSER' => ($auth->acl_get('a_user')) ? $row['session_browser'] : '',
|
||||||
|
|
||||||
'U_USER_PROFILE' => ($row['user_type'] != USER_IGNORE) ? get_username_string('profile', $row['user_id'], '') : '',
|
'U_USER_PROFILE' => ($row['user_type'] != phpbb::USER_IGNORE) ? get_username_string('profile', $row['user_id'], '') : '',
|
||||||
'U_USER_IP' => append_sid('viewonline', 'mode=lookup' . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&s=' . $row['session_id'] : '') . "&sg=$show_guests&start=$start&sk=$sort_key&sd=$sort_dir"),
|
'U_USER_IP' => append_sid('viewonline', 'mode=lookup' . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&s=' . $row['session_id'] : '') . "&sg=$show_guests&start=$start&sk=$sort_key&sd=$sort_dir"),
|
||||||
'U_WHOIS' => append_sid('viewonline', 'mode=whois&s=' . $row['session_id']),
|
'U_WHOIS' => append_sid('viewonline', 'mode=whois&s=' . $row['session_id']),
|
||||||
'U_FORUM_LOCATION' => $location_url,
|
'U_FORUM_LOCATION' => $location_url,
|
||||||
|
|
Loading…
Add table
Reference in a new issue