aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_groups.php11
-rw-r--r--phpBB/includes/acp/acp_modules.php2
-rw-r--r--phpBB/includes/acp/acp_users.php76
-rw-r--r--phpBB/includes/functions.php16
-rw-r--r--phpBB/includes/functions_admin.php111
-rw-r--r--phpBB/includes/functions_user.php22
6 files changed, 112 insertions, 126 deletions
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 776871825d..aee1d4346e 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -342,14 +342,11 @@ class acp_groups
$result = $db->sql_query($sql);
$rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>';
- if ($row = $db->sql_fetchrow($result))
+
+ while ($row = $db->sql_fetchrow($result))
{
- do
- {
- $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : '';
- $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
- }
- while ($row = $db->sql_fetchrow($result));
+ $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : '';
+ $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index b99d2c3824..fd50066d87 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -389,7 +389,7 @@ class acp_modules
'S_MODULE_NAMES' => $s_name_options,
'S_MODULE_MODES' => $s_mode_options,
'U_BACK' => $u_action . '&amp;parent_id=' . $parent_id,
- 'U_EDIT_ACTION' => $u_action,
+ 'U_EDIT_ACTION' => $u_action . '&amp;parent_id=' . $parent_id,
'L_TITLE' => $user->lang[strtoupper($action) . '_MODULE'],
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 1aa5e135aa..0c0360412c 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -104,10 +104,17 @@ class acp_users
// Generate overall "header" for user admin
$s_form_options = '';
- $forms_ary = array('overview', 'feedback', 'profile', 'prefs', 'avatar', 'sig', 'groups', 'perm', 'attach');
- foreach ($forms_ary as $value)
+ $module_info = new acp_users_info();
+ $forms_ary = $module_info->module();
+
+ foreach ($forms_ary['modes'] as $value => $ary)
{
+ if (!$this->is_authed($ary['auth']))
+ {
+ continue;
+ }
+
$selected = ($mode == $value) ? ' selected="selected"' : '';
$s_form_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($value)] . '</option>';
}
@@ -1348,6 +1355,42 @@ class acp_users
break;
+ case 'rank':
+
+ if ($submit)
+ {
+ $rank_id = request_var('user_rank', 0);
+
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_rank = $rank_id
+ WHERE user_id = $user_id";
+ $db->sql_query($sql);
+
+ trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($u_action));
+ }
+
+ $sql = 'SELECT *
+ FROM ' . RANKS_TABLE . '
+ WHERE rank_special = 1
+ ORDER BY rank_title';
+ $result = $db->sql_query($sql);
+
+ $s_rank_options = '<option value="0"' . ((!$user_row['user_rank']) ? ' selected="selected"' : '') . '>' . $user->lang['NO_SPECIAL_RANK'] . '</option>';
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $selected = ($user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank']) ? ' selected="selected"' : '';
+ $s_rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
+ }
+ $db->sql_freeresult($result);
+
+ $template->assign_vars(array(
+ 'S_RANK' => true,
+ 'S_RANK_OPTIONS' => $s_rank_options)
+ );
+
+ break;
+
case 'sig':
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -1707,6 +1750,9 @@ class acp_users
);
}
+ /**
+ * Optionset replacement for this module based on $user->optionset
+ */
function optionset(&$user_row, $key, $value, $data = false)
{
global $user;
@@ -1737,6 +1783,9 @@ class acp_users
}
}
+ /**
+ * Optionget replacement for this module based on $user->optionget
+ */
function optionget(&$user_row, $key, $data = false)
{
global $user;
@@ -1744,6 +1793,26 @@ class acp_users
$var = ($data) ? $data : $user_row['user_options'];
return ($var & 1 << $user->keyoptions[$key]) ? true : false;
}
+
+ /**
+ * Check if user is allowed to call this user mode
+ */
+ function is_authed($module_auth)
+ {
+ global $config, $auth;
+
+ $module_auth = trim($module_auth);
+
+ if (!$module_auth)
+ {
+ return true;
+ }
+
+ $is_auth = false;
+ eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z_]+)(,\$id)?#', '#\$id#', '#cfg_([a-z_]+)#'), array('(int) $auth->acl_get("\\1"\\2)', 'true', '(int) $config["\\1"]'), trim($module_auth)) . ');');
+
+ return $is_auth;
+ }
}
/**
@@ -1763,8 +1832,9 @@ class acp_users_info
'profile' => array('title' => 'ACP_USER_PROFILE', 'auth' => 'acl_a_user', 'display' => false),
'prefs' => array('title' => 'ACP_USER_PREFS', 'auth' => 'acl_a_user', 'display' => false),
'avatar' => array('title' => 'ACP_USER_AVATAR', 'auth' => 'acl_a_user', 'display' => false),
+ 'rank' => array('title' => 'ACP_USER_RANK', 'auth' => 'acl_a_user', 'display' => false),
'sig' => array('title' => 'ACP_USER_SIG', 'auth' => 'acl_a_user', 'display' => false),
- 'groups' => array('title' => 'ACP_USER_GROUPS', 'auth' => 'acl_a_user', 'display' => false),
+ 'groups' => array('title' => 'ACP_USER_GROUPS', 'auth' => 'acl_a_user && acl_a_group', 'display' => false),
'perm' => array('title' => 'ACP_USER_PERM', 'auth' => 'acl_a_user', 'display' => false),
'attach' => array('title' => 'ACP_USER_ATTACH', 'auth' => 'acl_a_user', 'display' => false),
),
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 80639c29b2..761c047d7f 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -589,7 +589,21 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0)
if (sizeof($sql_ary))
{
- $db->sql_query('INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
+ switch (SQL_LAYER)
+ {
+ case 'mysql':
+ case 'mysql4':
+ case 'mysqli':
+ $db->sql_query('INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
+ break;
+
+ default:
+ foreach ($sql_ary as $ary)
+ {
+ $db->sql_query('INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
+ }
+ break;
+ }
}
}
}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 4d2090d5b8..b207141b52 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2059,12 +2059,9 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
return;
}
+/*
if (class_exists('auth'))
{
- /**
- * @package phpBB3
- * Extension of auth class for changing permissions
- */
class auth_admin extends auth
{
// Set a user or group ACL record
@@ -2228,112 +2225,8 @@ if (class_exists('auth'))
$this->acl_clear_prefetch();
}
-
- // NOTE: this function is not in use atm
- // Add a new option to the list ... $options is a hash of form ->
- // $options = array(
- // 'local' => array('option1', 'option2', ...),
- // 'global' => array('optionA', 'optionB', ...)
- //);
- function acl_add_option($options)
- {
- global $db, $cache;
-
- if (!is_array($options))
- {
- trigger_error('Incorrect parameter for acl_add_option', E_USER_ERROR);
- }
-
- $cur_options = array();
-
- $sql = "SELECT auth_option, is_global, is_local
- FROM " . ACL_OPTIONS_TABLE . "
- ORDER BY auth_option_id";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- if (!empty($row['is_global']))
- {
- $cur_options['global'][] = $row['auth_option'];
- }
-
- if (!empty($row['is_local']))
- {
- $cur_options['local'][] = $row['auth_option'];
- }
- }
- $db->sql_freeresult($result);
-
- // Here we need to insert new options ... this requires discovering whether
- // an options is global, local or both and whether we need to add an option
- // type flag (x_)
- $new_options = array('local' => array(), 'global' => array());
- foreach ($options as $type => $option_ary)
- {
- $option_ary = array_unique($option_ary);
- foreach ($option_ary as $option_value)
- {
- if (!in_array($option_value, $cur_options[$type]))
- {
- $new_options[$type][] = $option_value;
- }
-
- $flag = substr($option_value, 0, strpos($option_value, '_') + 1);
- if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type]))
- {
- $new_options[$type][] = $flag;
- }
- }
- }
- unset($options);
-
- $options = array();
- $options['local'] = array_diff($new_options['local'], $new_options['global']);
- $options['global'] = array_diff($new_options['global'], $new_options['local']);
- $options['local_global'] = array_intersect($new_options['local'], $new_options['global']);
-
- $type_sql = array('local' => '0, 1', 'global' => '1, 0', 'local_global' => '1, 1');
-
- $sql = '';
- foreach ($options as $type => $option_ary)
- {
- foreach ($option_ary as $option)
- {
- switch (SQL_LAYER)
- {
- case 'mysql':
- $sql .= (($sql != '') ? ', ' : '') . "('$option', " . $type_sql[$type] . ")";
- break;
-
- case 'mysql4':
- case 'mysqli':
- case 'mssql':
- case 'mssql_odbc':
- case 'sqlite':
- $sql .= (($sql != '') ? ' UNION ALL ' : '') . " SELECT '$option', " . $type_sql[$type];
- break;
-
- default:
- $sql = 'INSERT INTO ' . ACL_OPTIONS_TABLE . " (auth_option, is_global, is_local)
- VALUES ($option, " . $type_sql[$type] . ")";
- $db->sql_query($sql);
- $sql = '';
- }
- }
- }
-
- if ($sql != '')
- {
- $sql = 'INSERT INTO ' . ACL_OPTIONS_TABLE . " (auth_option, is_global, is_local)
- VALUES $sql";
- $db->sql_query($sql);
- }
-
- $cache->destroy('acl_options');
- }
- }
}
+*/
/**
* Update Post Informations (First/Last Post in topic/forum)
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 1c6207911e..76bea9a146 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -554,12 +554,24 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
'ban_give_reason' => $ban_give_reason,
);
}
- $sql = $db->sql_build_array('MULTI_INSERT', $sql_ary);
-
- if ($sql)
+
+ if (sizeof($sql_ary))
{
- $sql = 'INSERT INTO ' . BANLIST_TABLE . ' ' . $sql;
- $db->sql_query($sql);
+ switch (SQL_LAYER)
+ {
+ case 'mysql':
+ case 'mysql4':
+ case 'mysqli':
+ $db->sql_query('INSERT INTO ' . BANLIST_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
+ break;
+
+ default:
+ foreach ($sql_ary as $ary)
+ {
+ $db->sql_query('INSERT INTO ' . BANLIST_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
+ }
+ break;
+ }
}
// If we are banning we want to logout anyone matching the ban