1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

replace constants with class constants.

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

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

View File

@@ -89,7 +89,7 @@ class acm
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
{
@@ -192,7 +192,7 @@ class acm
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
@@ -407,7 +407,7 @@ class acm
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
}
phpbb_chmod($filename, CHMOD_WRITE);
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
$query_result = $query_id;
}

View File

@@ -96,7 +96,7 @@ function login_apache(&$username, &$password)
if ($row)
{
// 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(
'status' => LOGIN_ERROR_ACTIVE,
@@ -104,7 +104,7 @@ function login_apache(&$username, &$password)
'user_row' => $row,
);
}
// Successful login...
return array(
'status' => LOGIN_SUCCESS,
@@ -160,7 +160,7 @@ function autologin_apache()
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'))
@@ -213,7 +213,7 @@ function user_row_apache($username, $password)
'user_password' => phpbb_hash($password),
'user_email' => '',
'group_id' => (int) $row['group_id'],
'user_type' => USER_NORMAL,
'user_type' => phpbb::USER_NORMAL,
'user_ip' => $user->ip,
);
}

View File

@@ -180,7 +180,7 @@ function login_db(&$username, &$password)
}
// 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(
'status' => LOGIN_ERROR_ACTIVE,

View File

@@ -187,7 +187,7 @@ function login_ldap(&$username, &$password)
unset($ldap_result);
// 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(
'status' => LOGIN_ERROR_ACTIVE,
@@ -225,7 +225,7 @@ function login_ldap(&$username, &$password)
'user_password' => phpbb_hash($password),
'user_email' => (!empty($config['ldap_email'])) ? $ldap_result[0][$config['ldap_email']][0] : '',
'group_id' => (int) $row['group_id'],
'user_type' => USER_NORMAL,
'user_type' => phpbb::USER_NORMAL,
'user_ip' => $user->ip,
);

View File

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

View File

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

View File

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

View File

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

View File

@@ -42,21 +42,11 @@ define('AVATAR_UPLOAD', 1);
define('AVATAR_REMOTE', 2);
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_PROFILE', 2);
define('INACTIVE_MANUAL', 3);
define('INACTIVE_REMIND', 4);
// ACL
define('ACL_NEVER', 0);
define('ACL_YES', 1);
define('ACL_NO', -1);
// Login error codes
define('LOGIN_CONTINUE', 1);
define('LOGIN_BREAK', 2);
@@ -179,12 +169,6 @@ define('REFERER_VALIDATE_NONE', 0);
define('REFERER_VALIDATE_HOST', 1);
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
define('VOTE_CONVERTED', 127);

File diff suppressed because it is too large Load Diff

View File

@@ -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)
AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL)
OR r.auth_setting = ' . ACL_NEVER . ')
AND ((a.auth_setting = ' . phpbb::ACL_NEVER . ' AND r.auth_setting IS NULL)
OR r.auth_setting = ' . phpbb::ACL_NEVER . ')
AND a.group_id = ug.group_id
AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "
AND ug.user_pending = 0
@@ -2256,7 +2256,7 @@ function cache_moderators()
foreach ($auth_ary as $auth_option => $setting)
{
// Make sure at least one ACL_YES option is set...
if ($setting == ACL_YES)
if ($setting == phpbb::ACL_YES)
{
$flag = true;
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
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_INACTIVE .
WHERE user_type = ' . phpbb::USER_INACTIVE .
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '');
$result = $db->sql_query($sql);
$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
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_INACTIVE .
WHERE user_type = ' . phpbb::USER_INACTIVE .
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . "
ORDER BY $sort_by";
$result = $db->sql_query_limit($sql, $limit, $offset);

View File

@@ -226,7 +226,7 @@ class compress_zip extends compress
{
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");
}
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");
}
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");
}
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");
}
phpbb_chmod($target_filename, CHMOD_READ);
phpbb_chmod($target_filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
// Grab the file contents
fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize);

View File

@@ -157,7 +157,7 @@ function auto_id($pad = 0)
*/
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 $ug_id [int] user_id|group_id : [string] usergroup name
* @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)
{
@@ -1850,7 +1850,7 @@ function add_bots()
foreach ($bots as $bot_name => $bot_ary)
{
$user_row = array(
'user_type' => USER_IGNORE,
'user_type' => phpbb::USER_IGNORE,
'group_id' => $group_id,
'username' => $bot_name,
'user_regdate' => time(),
@@ -1890,7 +1890,7 @@ function update_dynamic_config()
// Get latest username
$sql = 'SELECT user_id, username, user_colour
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']))
{
@@ -1934,7 +1934,7 @@ function update_dynamic_config()
$sql = 'SELECT COUNT(user_id) AS stat
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);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -2056,11 +2056,11 @@ function fix_empty_primary_groups()
// Set group ids for users not already having it
$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);
$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('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS);

View File

@@ -706,7 +706,7 @@ class queue
@flock($fp, LOCK_UN);
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);
fclose($fp);
phpbb_chmod($this->cache_file, CHMOD_WRITE);
phpbb_chmod($this->cache_file, phpbb::CHMOD_WRITE);
}
}
}

View File

@@ -731,7 +731,7 @@ function create_thumbnail($source, $destination, $mimetype)
return false;
}
phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE);
phpbb_chmod($destination, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
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) . "
AND w.user_id NOT IN ($sql_ignore_users)
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';
$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
AND fw.user_id NOT IN ($sql_ignore_users)
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';
$result = $db->sql_query($sql);

View File

@@ -1144,7 +1144,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false)
$sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . '
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);
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'])) . '
AND ug.user_pending = 0
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;
$result = $db->sql_query($sql);

View File

@@ -121,9 +121,9 @@ class filespec
case 'avatar':
$this->extension = strtolower($this->extension);
$this->realname = $prefix . $user_id . '.' . $this->extension;
break;
case 'unique_ext':
default:
$this->realname = $prefix . md5(unique_id()) . '.' . $this->extension;
@@ -228,8 +228,8 @@ class filespec
{
return @filesize($filename);
}
/**
* Check the first 256 bytes for forbidden content
*/
@@ -239,7 +239,7 @@ class filespec
{
return true;
}
$fp = @fopen($this->filename, 'rb');
if ($fp !== false)
@@ -276,7 +276,7 @@ class filespec
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...
$this->destination_path = PHPBB_ROOT_PATH . $destination;
@@ -419,7 +419,7 @@ class filespec
{
$size_lang = ($this->upload->max_filesize >= 1048576) ? $user->lang['MIB'] : (($this->upload->max_filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES'] );
$max_filesize = get_formatted_filesize($this->upload->max_filesize, false);
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang);
return false;
@@ -531,7 +531,7 @@ class fileupload
$this->max_filesize = (int) $max_filesize;
}
}
/**
* Set disallowed strings
*/
@@ -875,7 +875,7 @@ class fileupload
{
$file->error[] = sprintf($user->lang[$this->error_prefix . 'DISALLOWED_EXTENSION'], $file->get('extension'));
}
// MIME Sniffing
if (!$this->valid_content($file))
{

View File

@@ -91,7 +91,7 @@ function update_last_username()
// Get latest username
$sql = 'SELECT user_id, username, user_colour
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';
$result = $db->sql_query_limit($sql, 1);
$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);
// 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_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 ($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
@@ -566,7 +566,7 @@ function user_delete($mode, $user_id, $post_username = false)
}
// 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);
}
@@ -605,14 +605,14 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
{
$sql_ary = array();
if ($row['user_type'] == USER_IGNORE || $row['user_type'] == USER_FOUNDER ||
($mode == 'activate' && $row['user_type'] != USER_INACTIVE) ||
($mode == 'deactivate' && $row['user_type'] == USER_INACTIVE))
if ($row['user_type'] == phpbb::USER_IGNORE || $row['user_type'] == phpbb::USER_FOUNDER ||
($mode == 'activate' && $row['user_type'] != phpbb::USER_INACTIVE) ||
($mode == 'deactivate' && $row['user_type'] == phpbb::USER_INACTIVE))
{
continue;
}
if ($row['user_type'] == USER_INACTIVE)
if ($row['user_type'] == phpbb::USER_INACTIVE)
{
$activated++;
}
@@ -625,9 +625,9 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
}
$sql_ary += array(
'user_type' => ($row['user_type'] == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL,
'user_inactive_time' => ($row['user_type'] == USER_NORMAL) ? time() : 0,
'user_inactive_reason' => ($row['user_type'] == USER_NORMAL) ? $reason : 0,
'user_type' => ($row['user_type'] == phpbb::USER_NORMAL) ? phpbb::USER_INACTIVE : phpbb::USER_NORMAL,
'user_inactive_time' => ($row['user_type'] == phpbb::USER_NORMAL) ? time() : 0,
'user_inactive_reason' => ($row['user_type'] == phpbb::USER_NORMAL) ? $reason : 0,
);
$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...
$sql = 'SELECT user_id, user_email, username_clean
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_FOUNDER;
WHERE user_type = ' . phpbb::USER_FOUNDER;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -3244,7 +3244,7 @@ function group_update_listings($group_id)
break 3;
}
if ($setting != ACL_YES)
if ($setting != phpbb::ACL_YES)
{
continue;
}