mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-23 08:43:02 +02:00
- removed group settings from roles
- added forum icon in front of forums in permissions acp - added trace permissions in permission masks (thanks naderman for writing the first code and for the idea... :)) - some bugfixes - PHP6 fix git-svn-id: file:///svn/phpbb/trunk@5824 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -103,7 +103,7 @@ class acp_board
|
||||
'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'type' => 'text:4:4', 'explain' => true),
|
||||
'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'type' => 'text:4:4', 'explain' => true),
|
||||
'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true),
|
||||
'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
|
||||
'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
||||
|
||||
'legend2' => 'GENERAL_OPTIONS',
|
||||
'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
@@ -138,7 +138,7 @@ class acp_board
|
||||
|
||||
'legend2' => 'POSTING',
|
||||
'bump_type' => false,
|
||||
'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
|
||||
'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
||||
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
|
||||
'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true),
|
||||
|
@@ -14,7 +14,6 @@
|
||||
class acp_permission_roles
|
||||
{
|
||||
var $u_action;
|
||||
var $pre_selection_array;
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
@@ -36,24 +35,6 @@ class acp_permission_roles
|
||||
$action = request_var('action', '');
|
||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
||||
|
||||
// Define pre-selection array
|
||||
$this->pre_selection_array = array(
|
||||
1 => array('lang' => 'PRE_ONLY_SPECIAL_GUEST', 'type' => GROUP_SPECIAL, 'name' => array('BOTS', 'GUESTS', 'INACTIVE', 'INACTIVE_COPPA'), 'negate' => false),
|
||||
2 => array('lang' => 'PRE_ONLY_SPECIAL_REGISTERED', 'type' => GROUP_SPECIAL, 'name' => array('ADMINISTRATORS', 'SUPER_MODERATORS', 'REGISTERED', 'REGISTERED_COPPA'), 'negate' => false),
|
||||
3 => array('lang' => 'PRE_NOT_SPECIAL_GUEST', 'type' => GROUP_SPECIAL, 'name' => array('BOTS', 'GUESTS', 'INACTIVE', 'INACTIVE_COPPA'), 'negate' => true),
|
||||
4 => array('lang' => 'PRE_NOT_SPECIAL_REGISTERED', 'type' => GROUP_SPECIAL, 'name' => array('ADMINISTRATORS', 'SUPER_MODERATORS', 'REGISTERED', 'REGISTERED_COPPA'), 'negate' => true),
|
||||
5 => array('lang' => 'PRE_ALL_SPECIAL', 'type' => GROUP_SPECIAL, 'negate' => false),
|
||||
6 => array('lang' => 'PRE_NOT_SPECIAL', 'type' => GROUP_SPECIAL, 'negate' => true),
|
||||
7 => array('lang' => 'PRE_ALL_FREE', 'type' => GROUP_FREE, 'negate' => false),
|
||||
8 => array('lang' => 'PRE_NOT_FREE', 'type' => GROUP_FREE, 'negate' => true),
|
||||
9 => array('lang' => 'PRE_ALL_CLOSED', 'type' => GROUP_CLOSED, 'negate' => false),
|
||||
10 => array('lang' => 'PRE_NOT_CLOSED', 'type' => GROUP_CLOSED, 'negate' => true),
|
||||
11 => array('lang' => 'PRE_ALL_HIDDEN', 'type' => GROUP_HIDDEN, 'negate' => false),
|
||||
12 => array('lang' => 'PRE_NOT_HIDDEN', 'type' => GROUP_HIDDEN, 'negate' => true),
|
||||
13 => array('lang' => 'PRE_ALL_OPEN', 'type' => GROUP_OPEN, 'negate' => false),
|
||||
14 => array('lang' => 'PRE_NOT_OPEN', 'type' => GROUP_OPEN, 'negate' => true),
|
||||
);
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'admin_roles':
|
||||
@@ -151,8 +132,6 @@ class acp_permission_roles
|
||||
|
||||
$role_name = request_var('role_name', '', true);
|
||||
$role_description = request_var('role_description', '', true);
|
||||
$role_group_ids = request_var('role_group_ids', array(0));
|
||||
$pre_select = request_var('pre_select', 'custom');
|
||||
$auth_settings = request_var('setting', array('' => 0));
|
||||
|
||||
if (!$role_name)
|
||||
@@ -160,99 +139,6 @@ class acp_permission_roles
|
||||
trigger_error($user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
// Adjust group array if we have a pre-selection
|
||||
if ($pre_select != 'custom')
|
||||
{
|
||||
$pre_select = (int) $pre_select;
|
||||
|
||||
if (!$pre_select || !isset($this->pre_selection_array[$pre_select]))
|
||||
{
|
||||
$role_group_ids = array(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT group_id, group_name, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
ORDER BY group_type DESC, group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$groups = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$groups[$row['group_type']][$row['group_id']] = $row['group_name'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Build role_group_ids
|
||||
$role_group_ids = array();
|
||||
|
||||
$row = $this->pre_selection_array[$pre_select];
|
||||
|
||||
if (!$row['negate'] && !isset($row['name']))
|
||||
{
|
||||
if (isset($groups[$row['type']]))
|
||||
{
|
||||
foreach ($groups[$row['type']] as $group_id => $group_name)
|
||||
{
|
||||
$role_group_ids[] = $group_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($row['negate'] && !isset($row['name']))
|
||||
{
|
||||
$group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE);
|
||||
unset($group_types[array_search($row['type'], $group_types)]);
|
||||
|
||||
foreach ($group_types as $type)
|
||||
{
|
||||
if (!isset($groups[$type]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($groups[$type] as $group_id => $group_name)
|
||||
{
|
||||
$role_group_ids[] = $group_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!$row['negate'] && isset($row['name']))
|
||||
{
|
||||
foreach ($groups[$row['type']] as $group_id => $group_name)
|
||||
{
|
||||
if (in_array($group_name, $row['name']))
|
||||
{
|
||||
$role_group_ids[] = $group_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($row['negate'] && isset($row['name']))
|
||||
{
|
||||
$group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE);
|
||||
|
||||
foreach ($group_types as $type)
|
||||
{
|
||||
if (!isset($groups[$type]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($groups[$type] as $group_id => $group_name)
|
||||
{
|
||||
if ($type != $row['type'])
|
||||
{
|
||||
$role_group_ids[] = $group_id;
|
||||
}
|
||||
else if (!in_array($group_name, $row['name']))
|
||||
{
|
||||
$role_group_ids[] = $group_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we add/edit a role we check the name to be unique among the settings...
|
||||
$sql = 'SELECT role_id
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
@@ -268,17 +154,10 @@ class acp_permission_roles
|
||||
trigger_error(sprintf($user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
// If role_group_ids include "every user/group" we do not need to set it...
|
||||
if (in_array(0, $role_group_ids))
|
||||
{
|
||||
$role_group_ids = array(0);
|
||||
}
|
||||
|
||||
$sql_ary = array(
|
||||
'role_name' => (string) $role_name,
|
||||
'role_description' => (string) $role_description,
|
||||
'role_type' => (string) $permission_type,
|
||||
'role_group_ids' => (string) implode(':', $role_group_ids),
|
||||
);
|
||||
|
||||
if ($action == 'edit')
|
||||
@@ -329,7 +208,6 @@ class acp_permission_roles
|
||||
'role_name' => request_var('role_name', '', true),
|
||||
'role_description' => request_var('role_description', '', true),
|
||||
'role_type' => $permission_type,
|
||||
'role_group_ids' => implode(':', request_var('role_group_ids', array(0))),
|
||||
);
|
||||
|
||||
if ($options_from)
|
||||
@@ -401,14 +279,8 @@ class acp_permission_roles
|
||||
trigger_error($user->lang['NO_PRESET_SELECTED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
// Build group options array (with pre-selection)
|
||||
$s_preselect_options = $s_group_options = array();
|
||||
$this->build_group_options($role_row['role_group_ids'], $s_preselect_options, $s_group_options);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_PRESELECT_OPTIONS' => $s_preselect_options,
|
||||
'S_GROUP_OPTIONS' => $s_group_options,
|
||||
'S_EDIT' => true,
|
||||
|
||||
'U_ACTION' => $this->u_action . "&action={$action}&role_id={$role_id}",
|
||||
'U_BACK' => $this->u_action,
|
||||
@@ -418,7 +290,7 @@ class acp_permission_roles
|
||||
'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)],
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// We need to fill the auth options array with ACL_UNSET options ;)
|
||||
$sql = 'SELECT auth_option_id, auth_option
|
||||
FROM ' . ACL_OPTIONS_TABLE . "
|
||||
@@ -480,7 +352,7 @@ class acp_permission_roles
|
||||
$sql = 'SELECT role_id, role_order
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
WHERE role_type = '" . $db->sql_escape($permission_type) . "'
|
||||
ORDER BY role_order";
|
||||
ORDER BY role_order ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
@@ -498,6 +370,9 @@ class acp_permission_roles
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Display assigned items?
|
||||
$display_item = request_var('display_item', 0);
|
||||
|
||||
// Select existing roles
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
@@ -505,47 +380,13 @@ class acp_permission_roles
|
||||
ORDER BY role_order ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$roles = $groups = $group_ids = $group_info = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$roles[] = $row;
|
||||
if ($row['role_group_ids'])
|
||||
{
|
||||
$groups[$row['role_id']] = explode(':', $row['role_group_ids']);
|
||||
$group_ids = array_merge($group_ids, $groups[$row['role_id']]);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($group_ids))
|
||||
{
|
||||
$sql = 'SELECT group_id, group_type, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_id IN (' . implode(', ', array_map('intval', $group_ids)) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$group_info[$row['group_id']] = array(
|
||||
'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'],
|
||||
'group_special' => ($row['group_type'] == GROUP_SPECIAL) ? true : false,
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Display assigned items?
|
||||
$display_item = request_var('display_item', 0);
|
||||
|
||||
$s_role_options = '';
|
||||
foreach ($roles as $row)
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('roles', array(
|
||||
'ROLE_NAME' => $row['role_name'],
|
||||
'ROLE_DESCRIPTION' => nl2br($row['role_description']),
|
||||
|
||||
'S_GROUP' => ($row['role_group_ids']) ? true : false,
|
||||
|
||||
'U_EDIT' => $this->u_action . '&action=edit&role_id=' . $row['role_id'],
|
||||
'U_REMOVE' => $this->u_action . '&action=remove&role_id=' . $row['role_id'],
|
||||
'U_MOVE_UP' => $this->u_action . '&action=move_up&order=' . $row['role_order'],
|
||||
@@ -553,18 +394,6 @@ class acp_permission_roles
|
||||
'U_DISPLAY_ITEMS' => ($row['role_id'] == $display_item) ? '' : $this->u_action . '&display_item=' . $row['role_id'] . '#assigned_to')
|
||||
);
|
||||
|
||||
if (isset($groups[$row['role_id']]) && sizeof($groups[$row['role_id']]))
|
||||
{
|
||||
foreach ($groups[$row['role_id']] as $group_id)
|
||||
{
|
||||
$template->assign_block_vars('roles.groups', array(
|
||||
'S_SPECIAL_GROUP' => $group_info[$group_id]['group_special'],
|
||||
'GROUP_NAME' => $group_info[$group_id]['group_name'],
|
||||
'U_GROUP' => $phpbb_root_path . "memberlist.$phpEx$SID&mode=group&g=$group_id")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$s_role_options .= '<option value="' . $row['role_id'] . '">' . $row['role_name'] . '</option>';
|
||||
|
||||
if ($display_item == $row['role_id'])
|
||||
@@ -574,6 +403,7 @@ class acp_permission_roles
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_ROLE_OPTIONS' => $s_role_options)
|
||||
@@ -633,146 +463,6 @@ class acp_permission_roles
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build user-friendly group options
|
||||
*/
|
||||
function build_group_options($role_group_ids, &$s_preselect_options, &$s_group_options)
|
||||
{
|
||||
global $db, $user, $template;
|
||||
|
||||
$groups = $selected_groups = array();
|
||||
|
||||
$sql = 'SELECT group_id, group_name, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
ORDER BY group_type DESC, group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$groups = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$groups[$row['group_type']][$row['group_id']] = $row['group_name'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$selected_group_ids = explode(':', $role_group_ids);
|
||||
|
||||
// First of all, build the group options for the custom interface...
|
||||
$s_group_options = '';
|
||||
foreach ($groups as $group_type => $group_row)
|
||||
{
|
||||
foreach ($group_row as $group_id => $group_name)
|
||||
{
|
||||
if (in_array($group_id, $selected_group_ids))
|
||||
{
|
||||
$selected_groups[$group_type][$group_id] = $group_name;
|
||||
}
|
||||
$s_group_options .= '<option value="' . $group_id . '"' . ((in_array($group_id, $selected_group_ids)) ? ' selected="selected"' : '') . (($group_type == GROUP_SPECIAL) ? ' class="sep"' : '') . '>' . (($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name) . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
// Build preselect array...
|
||||
$one_selected_item = false;
|
||||
|
||||
$s_preselect_options = '<option value="0"' . ((!$role_group_ids) ? ' selected="selected"' : '') . '>' . $user->lang['EVERY_USER_GROUP'] . '</option>';
|
||||
if (!$role_group_ids)
|
||||
{
|
||||
$one_selected_item = true;
|
||||
}
|
||||
|
||||
// Build pre-selection dropdown field
|
||||
foreach ($this->pre_selection_array as $option_id => $row)
|
||||
{
|
||||
if (!$row['negate'] && !isset($row['name']))
|
||||
{
|
||||
$s_selected = false;
|
||||
if (sizeof($selected_groups) == 1 && isset($selected_groups[$row['type']]) && sizeof($selected_groups[$row['type']]) == sizeof($groups[$row['type']]))
|
||||
{
|
||||
$s_selected = true;
|
||||
}
|
||||
}
|
||||
else if ($row['negate'] && !isset($row['name']))
|
||||
{
|
||||
$group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE);
|
||||
unset($group_types[array_search($row['type'], $group_types)]);
|
||||
|
||||
$s_selected = true;
|
||||
if (isset($selected_groups[$row['type']]))
|
||||
{
|
||||
$s_selected = false;
|
||||
}
|
||||
|
||||
foreach ($group_types as $type)
|
||||
{
|
||||
if (!isset($selected_groups[$type]) || sizeof($selected_groups[$type]) != sizeof($groups[$type]))
|
||||
{
|
||||
$s_selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!$row['negate'] && isset($row['name']))
|
||||
{
|
||||
$s_selected = false;
|
||||
if (sizeof($selected_groups) == 1 && isset($selected_groups[$row['type']]) && sizeof($selected_groups[$row['type']]) == sizeof($row['name']))
|
||||
{
|
||||
$s_selected = true;
|
||||
|
||||
foreach ($row['name'] as $name)
|
||||
{
|
||||
if (!in_array($name, $selected_groups[$row['type']]))
|
||||
{
|
||||
$s_selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($row['negate'] && isset($row['name']))
|
||||
{
|
||||
$group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE);
|
||||
unset($group_types[array_search($row['type'], $group_types)]);
|
||||
|
||||
$s_selected = true;
|
||||
if (isset($selected_groups[$row['type']]))
|
||||
{
|
||||
foreach ($row['name'] as $name)
|
||||
{
|
||||
if (in_array($name, $selected_groups[$row['type']]))
|
||||
{
|
||||
$s_selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($s_selected)
|
||||
{
|
||||
foreach ($group_types as $type)
|
||||
{
|
||||
if (!isset($groups[$type]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($selected_groups[$type]) || sizeof($selected_groups[$type]) != sizeof($groups[$type]))
|
||||
{
|
||||
$s_selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($s_selected)
|
||||
{
|
||||
$one_selected_item = true;
|
||||
}
|
||||
|
||||
$s_preselect_options .= '<option value="' . $option_id . '"' . (($s_selected) ? ' selected="selected"' : '') . '>' . $user->lang[$row['lang']] . '</option>';
|
||||
}
|
||||
|
||||
$s_preselect_options .= '<option value="custom"' . ((!$one_selected_item) ? ' selected="selected"' : '') . '>' . $user->lang['CUSTOM'] . '</option>';
|
||||
|
||||
$template->assign_var('S_CUSTOM_GROUP_IDS', ($one_selected_item) ? false : true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove role
|
||||
*/
|
||||
@@ -811,7 +501,7 @@ class acp_permission_roles
|
||||
// Get role assignments
|
||||
$hold_ary = $auth_admin->get_role_mask($role_id);
|
||||
|
||||
// Re-assign permisisons
|
||||
// Re-assign permissions
|
||||
foreach ($hold_ary as $forum_id => $forum_ary)
|
||||
{
|
||||
if (isset($forum_ary['users']))
|
||||
|
@@ -31,6 +31,25 @@ class acp_permissions
|
||||
|
||||
$this->tpl_name = 'acp_permissions';
|
||||
|
||||
// Trace has other vars
|
||||
if ($mode == 'trace')
|
||||
{
|
||||
$user_id = request_var('u', 0);
|
||||
$forum_id = request_var('f', 0);
|
||||
$permission = request_var('auth', '');
|
||||
|
||||
$this->tpl_name = 'permission_trace';
|
||||
|
||||
if ($user_id && isset($auth_admin->option_ids[$permission]) && $auth->acl_get('a_viewauth'))
|
||||
{
|
||||
$this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']);
|
||||
$this->permission_trace($user_id, $forum_id, $permission);
|
||||
return;
|
||||
}
|
||||
|
||||
trigger_error('NO_MODE');
|
||||
}
|
||||
|
||||
// Set some vars
|
||||
$action = request_var('action', array('' => 0));
|
||||
$action = key($action);
|
||||
@@ -854,6 +873,135 @@ class acp_permissions
|
||||
}
|
||||
unset($perms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a complete trace tree for the selected permission to determine where settings are set/unset
|
||||
*/
|
||||
function permission_trace($user_id, $forum_id, $permission)
|
||||
{
|
||||
global $db, $template, $user, $auth;
|
||||
|
||||
$sql = 'SELECT username
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id = ' . $user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$username = (string) $db->sql_fetchfield('username');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$username)
|
||||
{
|
||||
trigger_error('NO_USERS');
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PERMISSION' => $user->lang['acl_' . $permission]['lang'],
|
||||
'PERMISSION_USERNAME' => $username)
|
||||
);
|
||||
|
||||
$template->assign_block_vars('trace', array(
|
||||
'WHO' => $user->lang['DEFAULT'],
|
||||
'INFORMATION' => $user->lang['TRACE_DEFAULT'],
|
||||
|
||||
'S_SETTING_UNSET' => true,
|
||||
'S_TOTAL_UNSET' => true)
|
||||
);
|
||||
|
||||
$sql = 'SELECT DISTINCT g.group_name, g.group_id, g.group_type
|
||||
FROM ' . GROUPS_TABLE . ' g
|
||||
LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id)
|
||||
WHERE ug.user_id = ' . $user_id . '
|
||||
ORDER BY g.group_type DESC, g.group_id DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$groups = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$groups[$row['group_id']] = array(
|
||||
'auth_setting' => ACL_UNSET,
|
||||
'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($groups))
|
||||
{
|
||||
// Get group auth settings
|
||||
$hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id);
|
||||
|
||||
foreach ($hold_ary as $group_id => $forum_ary)
|
||||
{
|
||||
$groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission];
|
||||
}
|
||||
unset($hold_ary);
|
||||
|
||||
$total = ACL_UNSET;
|
||||
foreach ($groups as $id => $row)
|
||||
{
|
||||
switch ($row['auth_setting'])
|
||||
{
|
||||
case ACL_UNSET:
|
||||
$information = $user->lang['TRACE_GROUP_UNSET'];
|
||||
break;
|
||||
|
||||
case ACL_YES:
|
||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_GROUP_YES_TOTAL_NO'] : $user->lang['TRACE_GROUP_YES_TOTAL_UNSET']);
|
||||
$total = ($total == ACL_UNSET) ? ACL_YES : $total;
|
||||
break;
|
||||
|
||||
case ACL_NO:
|
||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NO_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_GROUP_NO_TOTAL_NO'] : $user->lang['TRACE_GROUP_NO_TOTAL_UNSET']);
|
||||
$total = ACL_NO;
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('trace', array(
|
||||
'WHO' => $row['group_name'],
|
||||
'INFORMATION' => $information,
|
||||
|
||||
'S_SETTING_UNSET' => ($row['auth_setting'] == ACL_UNSET) ? true : false,
|
||||
'S_SETTING_YES' => ($row['auth_setting'] == ACL_YES) ? true : false,
|
||||
'S_SETTING_NO' => ($row['auth_setting'] == ACL_NO) ? true : false,
|
||||
'S_TOTAL_UNSET' => ($total == ACL_UNSET) ? true : false,
|
||||
'S_TOTAL_YES' => ($total == ACL_YES) ? true : false,
|
||||
'S_TOTAL_NO' => ($total == ACL_NO) ? true : false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Get user specific permission...
|
||||
$hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id);
|
||||
$auth_setting = (!sizeof($hold_ary)) ? ACL_UNSET : $hold_ary[$user_id][$forum_id][$permission];
|
||||
|
||||
switch ($auth_setting)
|
||||
{
|
||||
case ACL_UNSET:
|
||||
$information = ($total == ACL_UNSET) ? $user->lang['TRACE_USER_UNSET_TOTAL_UNSET'] : $user->lang['TRACE_USER_KEPT'];
|
||||
$total = ($total == ACL_UNSET) ? ACL_NO : $total;
|
||||
break;
|
||||
|
||||
case ACL_YES:
|
||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_USER_YES_TOTAL_NO'] : $user->lang['TRACE_USER_YES_TOTAL_UNSET']);
|
||||
$total = ($total == ACL_UNSET) ? ACL_YES : $total;
|
||||
break;
|
||||
|
||||
case ACL_NO:
|
||||
$information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NO_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO'] : $user->lang['TRACE_USER_NO_TOTAL_UNSET']);
|
||||
$total = ACL_NO;
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('trace', array(
|
||||
'WHO' => $username,
|
||||
'INFORMATION' => $information,
|
||||
|
||||
'S_SETTING_UNSET' => ($auth_setting == ACL_UNSET) ? true : false,
|
||||
'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false,
|
||||
'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false,
|
||||
'S_TOTAL_UNSET' => ($total == ACL_UNSET) ? true : false,
|
||||
'S_TOTAL_YES' => ($total == ACL_YES) ? true : false,
|
||||
'S_TOTAL_NO' => ($total == ACL_NO) ? true : false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -959,35 +959,39 @@ class acp_profile
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
/**
|
||||
* @todo Adjust for every database
|
||||
*/
|
||||
|
||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||
$sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident ";
|
||||
|
||||
switch ($field_type)
|
||||
{
|
||||
case FIELD_STRING:
|
||||
$sql .= ' VARCHAR(255) DEFAULT NULL NULL';
|
||||
$sql .= ' VARCHAR(255) ';
|
||||
break;
|
||||
|
||||
case FIELD_DATE:
|
||||
$sql .= 'VARCHAR(10) DEFAULT NULL NULL';
|
||||
$sql .= 'VARCHAR(10) ';
|
||||
break;
|
||||
|
||||
case FIELD_TEXT:
|
||||
$sql .= "TEXT NULL,
|
||||
ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
||||
ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED";
|
||||
$sql .= "TEXT";
|
||||
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
||||
// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED";
|
||||
break;
|
||||
|
||||
case FIELD_BOOL:
|
||||
$sql .= 'TINYINT(2) DEFAULT NULL NULL';
|
||||
$sql .= 'TINYINT(2) ';
|
||||
break;
|
||||
|
||||
case FIELD_DROPDOWN:
|
||||
$sql .= 'MEDIUMINT(8) DEFAULT NULL NULL';
|
||||
$sql .= 'MEDIUMINT(8) ';
|
||||
break;
|
||||
|
||||
case FIELD_INT:
|
||||
$sql .= 'BIGINT(20) DEFAULT NULL NULL';
|
||||
$sql .= 'BIGINT(20) ';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -183,7 +183,15 @@ class acp_search
|
||||
global $db, $user, $auth, $template, $cache;
|
||||
global $config, $SID, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$action = (isset($_REQUEST['action']) && is_array($_REQUEST['action'])) ? key(request_var('action', array('' => false))) : request_var('action', '');
|
||||
if (isset($_REQUEST['action']) && is_array($_REQUEST['action']))
|
||||
{
|
||||
$action = request_var('action', array('' => false));
|
||||
$action = key($action);
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = request_var('action', '');
|
||||
}
|
||||
$this->state = explode(',', $config['search_indexing_state']);
|
||||
|
||||
if ($action)
|
||||
|
@@ -239,7 +239,10 @@ class auth_admin extends auth
|
||||
$tpl_mask = 'mask';
|
||||
|
||||
$l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
|
||||
|
||||
|
||||
// Allow trace for viewing permissions and in user mode
|
||||
$show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false;
|
||||
|
||||
// Get names
|
||||
if ($user_mode == 'user')
|
||||
{
|
||||
@@ -293,7 +296,6 @@ class auth_admin extends auth
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$roles[$row['role_id']] = $row;
|
||||
$roles[$row['role_id']]['groups'] = ($row['role_group_ids']) ? explode(':', $row['role_group_ids']) : array();
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@@ -412,16 +414,13 @@ class auth_admin extends auth
|
||||
$s_role_options = '';
|
||||
foreach ($roles as $role_id => $role_row)
|
||||
{
|
||||
if ($role_id == $current_role_id || !sizeof($role_row['groups']) || ($user_mode == 'group' && in_array($ug_id, $role_row['groups'])))
|
||||
{
|
||||
$title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : '';
|
||||
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>';
|
||||
}
|
||||
$title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : '';
|
||||
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>';
|
||||
}
|
||||
|
||||
if ($s_role_options)
|
||||
{
|
||||
$s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_ROLE'] . '</option>' . $s_role_options;
|
||||
$s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options;
|
||||
}
|
||||
|
||||
$template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(
|
||||
@@ -431,7 +430,7 @@ class auth_admin extends auth
|
||||
'FORUM_ID' => $forum_id)
|
||||
);
|
||||
|
||||
$this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id);
|
||||
$this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -472,10 +471,8 @@ class auth_admin extends auth
|
||||
$s_role_options = '';
|
||||
foreach ($roles as $role_id => $role_row)
|
||||
{
|
||||
if ($role_id == $current_role_id || !sizeof($role_row['groups']) || ($user_mode == 'group' && in_array($ug_id, $role_row['groups'])))
|
||||
{
|
||||
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . '>' . $role_row['role_name'] . '</option>';
|
||||
}
|
||||
$title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : '';
|
||||
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>';
|
||||
}
|
||||
|
||||
if ($s_role_options)
|
||||
@@ -483,15 +480,40 @@ class auth_admin extends auth
|
||||
$s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_ROLE'] . '</option>' . $s_role_options;
|
||||
}
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
$folder_image = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($forum_names_ary[$forum_id]['forum_status'] == ITEM_LOCKED)
|
||||
{
|
||||
$folder_image = '<img src="images/icon_folder_lock_small.gif" width="19" height="18" alt="' . $user->lang['FORUM_LOCKED'] . '" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($forum_names_ary[$forum_id]['forum_type'])
|
||||
{
|
||||
case FORUM_LINK:
|
||||
$folder_image = '<img src="images/icon_folder_link_small.gif" width="22" height="18" alt="' . $user->lang['FORUM_LINK'] . '" />';
|
||||
break;
|
||||
|
||||
default:
|
||||
$folder_image = ($forum_names_ary[$forum_id]['left_id'] + 1 != $forum_names_ary[$forum_id]['right_id']) ? '<img src="images/icon_folder_sub_small.gif" width="22" height="18" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder_small.gif" width="19" height="18" alt="' . $user->lang['FOLDER'] . '" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(
|
||||
'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],
|
||||
'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'],
|
||||
'FOLDER_IMAGE' => $folder_image,
|
||||
'S_ROLE_OPTIONS' => $s_role_options,
|
||||
'UG_ID' => $ug_id,
|
||||
'FORUM_ID' => $forum_id)
|
||||
);
|
||||
|
||||
$this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id);
|
||||
$this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -703,6 +725,7 @@ class auth_admin extends auth
|
||||
$id_field = $ug_type . '_id';
|
||||
|
||||
// Get any flags as required
|
||||
reset($auth);
|
||||
$flag = key($auth);
|
||||
$flag = substr($flag, 0, strpos($flag, '_') + 1);
|
||||
|
||||
@@ -833,6 +856,7 @@ class auth_admin extends auth
|
||||
global $db;
|
||||
|
||||
// Get any-flag as required
|
||||
reset($auth);
|
||||
$flag = key($auth);
|
||||
$flag = substr($flag, 0, strpos($flag, '_') + 1);
|
||||
|
||||
@@ -1011,9 +1035,9 @@ class auth_admin extends auth
|
||||
* Assign category to template
|
||||
* used by display_mask()
|
||||
*/
|
||||
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id)
|
||||
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false)
|
||||
{
|
||||
global $template, $user;
|
||||
global $template, $user, $phpbb_admin_path, $phpEx, $SID;
|
||||
|
||||
foreach ($category_array as $cat => $cat_array)
|
||||
{
|
||||
@@ -1024,7 +1048,7 @@ class auth_admin extends auth
|
||||
|
||||
'CAT_NAME' => $user->lang['permission_cat'][$cat])
|
||||
);
|
||||
|
||||
|
||||
foreach ($cat_array['permissions'] as $permission => $allowed)
|
||||
{
|
||||
$template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array(
|
||||
@@ -1037,6 +1061,8 @@ class auth_admin extends auth
|
||||
'FIELD_NAME' => $permission,
|
||||
'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']',
|
||||
|
||||
'U_TRACE' => ($show_trace) ? "{$phpbb_admin_path}index.$phpEx$SID&i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission" : '',
|
||||
|
||||
'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
|
||||
);
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ class acp_permissions_info
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'intro' => array('title' => 'ACP_PERMISSIONS', 'auth' => 'acl_a_authusers || acl_a_authgroups || acl_a_viewauth'),
|
||||
'trace' => array('title' => 'ACP_PERMISSION_TRACE', 'auth' => 'acl_a_viewauth', 'display' => false),
|
||||
|
||||
'setting_user_global' => array('title' => 'ACP_USERS_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_aauth || acl_a_mauth || acl_a_uauth)'),
|
||||
'setting_user_local' => array('title' => 'ACP_USERS_FORUM_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_mauth || acl_a_fauth)'),
|
||||
|
@@ -446,7 +446,7 @@ class auth
|
||||
AND r.role_type = '" . $db->sql_escape($role_type) . "'
|
||||
$sql_ug
|
||||
$sql_forum
|
||||
ORDER BY r.role_name ASC";
|
||||
ORDER BY r.role_order ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@@ -618,7 +618,7 @@ class auth
|
||||
// Grab group settings...
|
||||
$sql = 'SELECT a.group_id, ao.auth_option, a.forum_id, a.auth_setting, a.auth_role_id, r.auth_setting as role_auth_setting
|
||||
FROM (' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_GROUPS_TABLE . ' a)
|
||||
LEFT JOIN ' . ACL_ROLES_DATA_TABLE . ' r ON (a.auth_role_id = r.role_id)
|
||||
LEFT JOIN ' . ACL_ROLES_DATA_TABLE . ' r ON (a.auth_role_id = r.role_id)
|
||||
WHERE (ao.auth_option_id = a.auth_option_id OR ao.auth_option_id = r.auth_option_id)
|
||||
' . (($sql_group) ? 'AND a.' . $sql_group : '') . "
|
||||
$sql_forum
|
||||
|
@@ -205,7 +205,7 @@ class dbal
|
||||
$message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']';
|
||||
|
||||
// Show complete SQL error and path to administrators only
|
||||
if ($auth->acl_get('a_'))
|
||||
if ($auth->acl_get('a_') || defined('IN_INSTALL'))
|
||||
{
|
||||
// Print out a nice backtrace...
|
||||
$backtrace = get_backtrace();
|
||||
|
@@ -425,13 +425,15 @@ function tz_select($default = '')
|
||||
/**
|
||||
* Topic and forum watching common code
|
||||
*/
|
||||
function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $match_id, $notify_status = 'unset', $start = 0)
|
||||
function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0)
|
||||
{
|
||||
global $template, $db, $user, $phpEx, $SID, $start, $phpbb_root_path;
|
||||
|
||||
$table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE;
|
||||
$where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id';
|
||||
$u_url = ($mode == 'forum') ? 'f' : 't';
|
||||
$match_id = ($mode == 'forum') ? $forum_id : $topic_id;
|
||||
|
||||
$u_url = ($mode == 'forum') ? 'f' : 'f=' . $forum_id . '&t';
|
||||
|
||||
// Is user watching this thread?
|
||||
if ($user_id != ANONYMOUS)
|
||||
@@ -2113,6 +2115,16 @@ function get_backtrace()
|
||||
$output .= '<br />';
|
||||
$output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />';
|
||||
$output .= '<b>LINE:</b> ' . $trace['line'] . '<br />';
|
||||
|
||||
// Do not display the users password
|
||||
if (strpos($trace['function'], 'login') !== false)
|
||||
{
|
||||
if (isset($args[1]))
|
||||
{
|
||||
$args[1] = "'***'";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']) . '(' . ((sizeof($args)) ? implode(', ', $args) : '') . ')<br />';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
@@ -115,7 +115,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
|
||||
$acl = ($ignore_acl) ? '' : array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel');
|
||||
|
||||
// This query is identical to the jumpbox one
|
||||
$sql = 'SELECT forum_id, parent_id, forum_name, forum_type, left_id, right_id
|
||||
$sql = 'SELECT forum_id, parent_id, forum_name, forum_type, forum_status, left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
ORDER BY left_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -166,6 +166,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
|
||||
|
||||
if ($return_array)
|
||||
{
|
||||
// Include some more informations...
|
||||
$selected = (is_array($select_id)) ? ((in_array($row['forum_id'], $select_id)) ? true : false) : (($row['forum_id'] == $select_id) ? true : false);
|
||||
$forum_list[$row['forum_id']] = array_merge(array('padding' => $padding, 'selected' => $selected), $row);
|
||||
}
|
||||
|
@@ -169,19 +169,15 @@ class filespec
|
||||
*/
|
||||
function get_mimetype($filename)
|
||||
{
|
||||
$mimetype = '';
|
||||
|
||||
if (function_exists('mime_content_type'))
|
||||
{
|
||||
$mimetype = mime_content_type($filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mimetype = 'application/octetstream';
|
||||
}
|
||||
|
||||
// Opera adds the name to the mime type
|
||||
$mimetype = (strpos($mimetype, '; name') !== false) ? str_replace(strstr($mimetype, '; name'), '', $mimetype) : $mimetype;
|
||||
|
||||
if (!$mimetype)
|
||||
// Some browsers choke on a mimetype of application/octet-stream
|
||||
if (!$mimetype || $mimetype == 'application/octet-stream')
|
||||
{
|
||||
$mimetype = 'application/octetstream';
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ function user_get_id_name(&$user_id_ary, &$username_ary)
|
||||
|
||||
$which_ary = ($user_id_ary) ? 'user_id_ary' : 'username_ary';
|
||||
|
||||
if ($$which_ary && !is_array($$which_ary))
|
||||
if ($$which_ary && !is_array($$which_ary))
|
||||
{
|
||||
$$which_ary = array($$which_ary);
|
||||
}
|
||||
|
@@ -1064,7 +1064,8 @@ class parse_message extends bbcode_firstpass
|
||||
{
|
||||
$actual_comment_list = request_var('comment_list', array(''), true);
|
||||
|
||||
$edit_comment = key(request_var('edit_comment', array(0 => '')));
|
||||
$edit_comment = request_var('edit_comment', array(0 => ''));
|
||||
$edit_comment = key($edit_comment);
|
||||
$this->attachment_data[$edit_comment]['comment'] = $actual_comment_list[$edit_comment];
|
||||
}
|
||||
|
||||
|
@@ -141,11 +141,11 @@ class session
|
||||
// Load limit check (if applicable)
|
||||
if (@file_exists('/proc/loadavg'))
|
||||
{
|
||||
if ($load = @file('/proc/loadavg'))
|
||||
if ($load = @file_get_contents('/proc/loadavg'))
|
||||
{
|
||||
list($this->load) = explode(' ', $load[0]);
|
||||
$this->load = floatval(array_slice(explode(' ', $load), 0, 1));
|
||||
|
||||
if ($config['limit_load'] && $this->load > doubleval($config['limit_load']))
|
||||
if ($config['limit_load'] && $this->load > floatval($config['limit_load']))
|
||||
{
|
||||
trigger_error('BOARD_UNAVAILABLE');
|
||||
}
|
||||
|
@@ -551,11 +551,13 @@ class ucp_main
|
||||
$template->assign_block_vars('topicrow', array(
|
||||
'FORUM_ID' => $forum_id,
|
||||
'TOPIC_ID' => $topic_id,
|
||||
'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false,
|
||||
'TOPIC_TITLE' => censor_text($row['topic_title']),
|
||||
'TOPIC_TYPE' => $topic_type,
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
|
||||
|
||||
'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false,
|
||||
'S_GLOBAL_TOPIC' => (!$forum_id) ? true : false,
|
||||
|
||||
'TOPIC_AUTHOR' => topic_topic_author($row),
|
||||
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
||||
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
||||
|
Reference in New Issue
Block a user