mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
- removed db cache (might re-appear, but for now we do not see the need for it)
- all changes to styles/subsilver/template are purely cosmetic (no functional changes) - cosmetics - bugfixes - add index to modules table - use modules ordering code for forums too git-svn-id: file:///svn/phpbb/trunk@6073 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -256,7 +256,6 @@ class acp_attachments
|
||||
{
|
||||
if ($submit)
|
||||
{
|
||||
|
||||
// Change Extensions ?
|
||||
$extension_change_list = (isset($_POST['extension_change_list'])) ? array_map('intval', $_POST['extension_change_list']) : array();
|
||||
$group_select_list = (isset($_POST['group_select'])) ? array_map('intval', $_POST['group_select']) : array();
|
||||
@@ -282,6 +281,7 @@ class acp_attachments
|
||||
SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . '
|
||||
WHERE extension_id = ' . $row['extension_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']);
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ class acp_attachments
|
||||
add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add Extension?
|
||||
$add_extension = strtolower(request_var('add_extension', ''));
|
||||
$add_extension_group = request_var('add_group_select', 0);
|
||||
@@ -400,7 +400,7 @@ class acp_attachments
|
||||
{
|
||||
$action = request_var('action', '');
|
||||
$group_id = request_var('g', 0);
|
||||
|
||||
|
||||
if ($action != 'add' && $action != 'edit')
|
||||
{
|
||||
trigger_error('WRONG_MODE');
|
||||
@@ -439,6 +439,7 @@ class acp_attachments
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE LOWER(group_name) = '" . $db->sql_escape(strtolower($new_group_name)) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($db->sql_fetchrow($result))
|
||||
{
|
||||
$error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name);
|
||||
@@ -461,7 +462,7 @@ class acp_attachments
|
||||
if ($max_filesize == $config['max_filesize'])
|
||||
{
|
||||
$max_filesize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($allowed_forums))
|
||||
{
|
||||
@@ -484,7 +485,7 @@ class acp_attachments
|
||||
$sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : '';
|
||||
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$group_id = $db->sql_nextid();
|
||||
@@ -580,7 +581,8 @@ class acp_attachments
|
||||
trigger_error($user->lang['NO_EXTENSION_GROUP'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . "
|
||||
$sql = 'SELECT *
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE group_id = $group_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$ext_group_row = $db->sql_fetchrow($result);
|
||||
@@ -588,6 +590,8 @@ class acp_attachments
|
||||
|
||||
$forum_ids = (!$ext_group_row['allowed_forums']) ? array() : unserialize(trim($ext_group_row['allowed_forums']));
|
||||
|
||||
// no break;
|
||||
|
||||
case 'add':
|
||||
|
||||
if ($action == 'add')
|
||||
@@ -607,8 +611,10 @@ class acp_attachments
|
||||
|
||||
$extensions = array();
|
||||
|
||||
$sql = 'SELECT * FROM ' . EXTENSIONS_TABLE . "
|
||||
WHERE group_id = $group_id OR group_id = 0
|
||||
$sql = 'SELECT *
|
||||
FROM ' . EXTENSIONS_TABLE . "
|
||||
WHERE group_id = $group_id
|
||||
OR group_id = 0
|
||||
ORDER BY extension";
|
||||
$result = $db->sql_query($sql);
|
||||
$extensions = $db->sql_fetchrowset($result);
|
||||
@@ -674,7 +680,7 @@ class acp_attachments
|
||||
'UPLOAD_ICON_SRC' => $phpbb_root_path . $img_path . '/' . $ext_group_row['upload_icon'],
|
||||
'EXTGROUP_FILESIZE' => $ext_group_row['max_filesize'],
|
||||
'ASSIGNED_EXTENSIONS' => $assigned_extensions,
|
||||
|
||||
|
||||
'S_CATEGORY_SELECT' => $this->category_select('special_category', $group_id, 'category'),
|
||||
'S_DOWNLOAD_SELECT' => $this->download_select('download_mode', $group_id, 'download_mode'),
|
||||
'S_EXT_GROUP_SIZE_OPTIONS' => size_select_options($size_format),
|
||||
@@ -756,7 +762,7 @@ class acp_attachments
|
||||
|
||||
case 'deactivate':
|
||||
case 'activate':
|
||||
|
||||
|
||||
if (!$group_id)
|
||||
{
|
||||
trigger_error($user->lang['NO_EXTENSION_GROUP'] . adm_back_link($this->u_action));
|
||||
@@ -781,9 +787,9 @@ class acp_attachments
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$s_add_spacer = ($row['allow_group'] == 0 && $act_deact == 'deactivate') ? true : false;
|
||||
|
||||
|
||||
$act_deact = ($row['allow_group']) ? 'deactivate' : 'activate';
|
||||
|
||||
|
||||
$template->assign_block_vars('groups', array(
|
||||
'S_ADD_SPACER' => $s_add_spacer,
|
||||
'S_ALLOWED_IN_PM' => ($row['allow_in_pm']) ? true : false,
|
||||
@@ -792,7 +798,7 @@ class acp_attachments
|
||||
'U_EDIT' => $this->u_action . "&action=edit&g={$row['group_id']}",
|
||||
'U_DELETE' => $this->u_action . "&action=delete&g={$row['group_id']}",
|
||||
'U_ACT_DEACT' => $this->u_action . "&action=$act_deact&g={$row['group_id']}",
|
||||
|
||||
|
||||
'L_ACT_DEACT' => $user->lang[strtoupper($act_deact)],
|
||||
'GROUP_NAME' => $row['group_name'],
|
||||
'CATEGORY' => $cat_lang[$row['cat_id']],
|
||||
@@ -808,7 +814,6 @@ class acp_attachments
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
|
||||
$delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array();
|
||||
$add_files = (isset($_POST['add'])) ? array_keys(request_var('add', array('' => 0))) : array();
|
||||
$post_ids = request_var('post_id', array('' => 0));
|
||||
@@ -862,15 +867,15 @@ class acp_attachments
|
||||
{
|
||||
$return = true;
|
||||
|
||||
if ($auth->acl_gets('f_attach', 'u_attach', $row['forum_id']))
|
||||
if ($auth->acl_get('f_attach', $row['forum_id']))
|
||||
{
|
||||
$return = $this->upload_file($row['post_id'], $row['topic_id'], $row['forum_id'], $config['upload_path'], $upload_list[$row['post_id']]);
|
||||
}
|
||||
|
||||
|
||||
$template->assign_block_vars('upload', array(
|
||||
'FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $upload_list[$row['post_id']], $row['post_id']),
|
||||
'S_DENIED' => (!$auth->acl_gets('f_attach', 'u_attach', $row['forum_id'])) ? true : false,
|
||||
'L_DENIED' => (!$auth->acl_gets('f_attach', 'u_attach', $row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '',
|
||||
'S_DENIED' => (!$auth->acl_get('f_attach', $row['forum_id'])) ? true : false,
|
||||
'L_DENIED' => (!$auth->acl_get('f_attach', $row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '',
|
||||
'ERROR_MSG' => ($return === true) ? false : $return)
|
||||
);
|
||||
}
|
||||
@@ -883,7 +888,7 @@ class acp_attachments
|
||||
$template->assign_vars(array(
|
||||
'S_ORPHAN' => true)
|
||||
);
|
||||
|
||||
|
||||
$attach_filelist = array();
|
||||
|
||||
$dir = @opendir($phpbb_root_path . $config['upload_path']);
|
||||
@@ -939,7 +944,6 @@ class acp_attachments
|
||||
'NOTIFY_MSG' => implode('<br />', $notify))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -962,7 +966,7 @@ class acp_attachments
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . '
|
||||
WHERE group_id = ' . (int) $group_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
||||
$cat_type = (!($row = $db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id'];
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
@@ -1037,8 +1041,8 @@ class acp_attachments
|
||||
global $db, $user;
|
||||
|
||||
$types = array(
|
||||
INLINE_LINK => $user->lang['MODE_INLINE'],
|
||||
PHYSICAL_LINK => $user->lang['MODE_PHYSICAL']
|
||||
INLINE_LINK => $user->lang['MODE_INLINE'],
|
||||
PHYSICAL_LINK => $user->lang['MODE_PHYSICAL']
|
||||
);
|
||||
|
||||
if ($group_id)
|
||||
@@ -1047,7 +1051,7 @@ class acp_attachments
|
||||
FROM " . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE group_id = " . (int) $group_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
||||
$download_mode = (!($row = $db->sql_fetchrow($result))) ? INLINE_LINK : $row['download_mode'];
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
@@ -1072,7 +1076,6 @@ class acp_attachments
|
||||
|
||||
/**
|
||||
* Upload already uploaded file... huh? are you kidding?
|
||||
* @todo integrate into upload class
|
||||
*/
|
||||
function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename)
|
||||
{
|
||||
@@ -1141,7 +1144,7 @@ class acp_attachments
|
||||
function search_imagemagick()
|
||||
{
|
||||
$imagick = '';
|
||||
|
||||
|
||||
$exe = ((defined('PHP_OS')) && (preg_match('#win#i', PHP_OS))) ? '.exe' : '';
|
||||
|
||||
$magic_home = getenv('MAGICK_HOME');
|
||||
@@ -1150,7 +1153,7 @@ class acp_attachments
|
||||
{
|
||||
$locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/');
|
||||
$path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH'))));
|
||||
|
||||
|
||||
$locations = array_merge($path_locations, $locations);
|
||||
|
||||
foreach ($locations as $location)
|
||||
@@ -1198,13 +1201,13 @@ class acp_attachments
|
||||
$error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_dir($phpbb_root_path . $upload_dir))
|
||||
{
|
||||
$error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_writable($phpbb_root_path . $upload_dir))
|
||||
{
|
||||
$error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir);
|
||||
@@ -1332,6 +1335,7 @@ class acp_attachments
|
||||
unset($iplist_tmp);
|
||||
unset($hostlist_tmp);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($iplist))
|
||||
{
|
||||
@@ -1380,6 +1384,7 @@ class acp_attachments
|
||||
{
|
||||
$l_unip_list .= (($l_unip_list != '') ? ', ' : '') . (($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'DELETE FROM ' . SITELIST_TABLE . "
|
||||
WHERE site_id IN ($unip_sql)";
|
||||
@@ -1416,12 +1421,12 @@ class acp_attachments
|
||||
$extensions[$extension]['max_filesize'] = (int) $row['max_filesize'];
|
||||
|
||||
$allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array();
|
||||
|
||||
|
||||
if ($row['allow_in_pm'])
|
||||
{
|
||||
$allowed_forums = array_merge($allowed_forums, array(0));
|
||||
}
|
||||
|
||||
|
||||
// Store allowed extensions forum wise
|
||||
$extensions['_allowed_'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums;
|
||||
}
|
||||
|
@@ -96,6 +96,9 @@ class acp_ban
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display ban options
|
||||
*/
|
||||
function display_ban_options($mode)
|
||||
{
|
||||
global $user, $db, $template;
|
||||
|
@@ -42,12 +42,13 @@ class acp_bbcodes
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE bbcode_id = ' . $bbcode_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$row = $db->sql_fetchrow($result))
|
||||
if (!$row)
|
||||
{
|
||||
trigger_error('BBCODE_NOT_EXIST');
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$bbcode_match = $row['bbcode_match'];
|
||||
$bbcode_tpl = htmlspecialchars($row['bbcode_tpl']);
|
||||
@@ -59,14 +60,15 @@ class acp_bbcodes
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE bbcode_id = ' . $bbcode_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$row = $db->sql_fetchrow($result))
|
||||
if (!$row)
|
||||
{
|
||||
trigger_error('BBCODE_NOT_EXIST');
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// No break here
|
||||
// No break here
|
||||
|
||||
case 'create':
|
||||
$display_on_posting = request_var('display_on_posting', 0);
|
||||
@@ -151,12 +153,17 @@ class acp_bbcodes
|
||||
$sql_ary['bbcode_id'] = (int) $bbcode_id;
|
||||
|
||||
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
|
||||
|
||||
$lang = 'BBCODE_ADDED';
|
||||
$log_action = 'LOG_BBCODE_ADD';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->sql_query('UPDATE ' . BBCODES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE bbcode_id = ' . $bbcode_id);
|
||||
$sql = 'UPDATE ' . BBCODES_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE bbcode_id = ' . $bbcode_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
$lang = 'BBCODE_EDITED';
|
||||
$log_action = 'LOG_BBCODE_EDIT';
|
||||
}
|
||||
@@ -173,13 +180,14 @@ class acp_bbcodes
|
||||
FROM ' . BBCODES_TABLE . "
|
||||
WHERE bbcode_id = $bbcode_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
|
||||
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@@ -498,7 +498,6 @@ class acp_board
|
||||
// Output relevant page
|
||||
foreach ($display_vars['vars'] as $config_key => $vars)
|
||||
{
|
||||
|
||||
if (!is_array($vars) && strpos($config_key, 'legend') === false)
|
||||
{
|
||||
continue;
|
||||
@@ -564,6 +563,9 @@ class acp_board
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select auth method
|
||||
*/
|
||||
function select_auth_method($selected_method, $key = '')
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
@@ -591,6 +593,9 @@ class acp_board
|
||||
return $auth_select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select mail authentication method
|
||||
*/
|
||||
function mail_auth_select($selected_method, $key = '')
|
||||
{
|
||||
global $user;
|
||||
@@ -606,6 +611,9 @@ class acp_board
|
||||
return $s_smtp_auth_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select full folder action
|
||||
*/
|
||||
function full_folder_select($value, $key = '')
|
||||
{
|
||||
global $user;
|
||||
@@ -613,6 +621,9 @@ class acp_board
|
||||
return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES_SHORT'] . '</option>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Select captcha pixel noise
|
||||
*/
|
||||
function captcha_pixel_noise_select($value, $key = '')
|
||||
{
|
||||
global $user;
|
||||
@@ -620,6 +631,9 @@ class acp_board
|
||||
return '<option value="0"' . (($value == 0) ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option><option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['LIGHT'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['MEDIUM'] . '</option><option value="3"' . (($value == 3) ? ' selected="selected"' : '') . '>' . $user->lang['HEAVY'] . '</option>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Select ip validation
|
||||
*/
|
||||
function select_ip_check($value, $key = '')
|
||||
{
|
||||
$radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NONE');
|
||||
@@ -627,6 +641,9 @@ class acp_board
|
||||
return h_radio('config[ip_check]', $radio_ary, $value, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select account activation method
|
||||
*/
|
||||
function select_acc_activation($value, $key = '')
|
||||
{
|
||||
global $user, $config;
|
||||
@@ -640,6 +657,9 @@ class acp_board
|
||||
return h_radio('config[require_activation]', $radio_ary, $value, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum/Minimum username length
|
||||
*/
|
||||
function username_length($value, $key = '')
|
||||
{
|
||||
global $user;
|
||||
@@ -647,6 +667,9 @@ class acp_board
|
||||
return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Allowed chars in usernames
|
||||
*/
|
||||
function select_username_chars($selected_value, $key)
|
||||
{
|
||||
global $user;
|
||||
@@ -662,6 +685,9 @@ class acp_board
|
||||
return $user_char_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum/Minimum password length
|
||||
*/
|
||||
function password_length($value, $key)
|
||||
{
|
||||
global $user;
|
||||
@@ -669,6 +695,9 @@ class acp_board
|
||||
return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Required chars in passwords
|
||||
*/
|
||||
function select_password_chars($selected_value, $key)
|
||||
{
|
||||
global $user;
|
||||
@@ -684,6 +713,9 @@ class acp_board
|
||||
return $pass_char_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select bump interval
|
||||
*/
|
||||
function bump_interval($value, $key)
|
||||
{
|
||||
global $user;
|
||||
@@ -699,6 +731,9 @@ class acp_board
|
||||
return '<input id="' . $key . '" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Board disable option and message
|
||||
*/
|
||||
function board_disable($value, $key)
|
||||
{
|
||||
global $user;
|
||||
@@ -708,6 +743,9 @@ class acp_board
|
||||
return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Select default dateformat
|
||||
*/
|
||||
function dateformat_select($value, $key)
|
||||
{
|
||||
global $user;
|
||||
|
@@ -111,6 +111,8 @@ class acp_bots
|
||||
|
||||
case 'edit':
|
||||
case 'add':
|
||||
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
$bot_row = array(
|
||||
'bot_name' => request_var('bot_name', '', true),
|
||||
'bot_agent' => request_var('bot_agent', ''),
|
||||
@@ -160,25 +162,18 @@ class acp_bots
|
||||
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"));
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
$user_id = user_add(array(
|
||||
'user_type' => (int) USER_IGNORE,
|
||||
'group_id' => (int) $group_row['group_id'],
|
||||
'username' => (string) $bot_row['bot_name'],
|
||||
'user_type' => (int) USER_IGNORE,
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_colour' => (string) $group_row['group_colour'],
|
||||
'user_email' => '',
|
||||
'user_lang' => (string) $bot_row['bot_lang'],
|
||||
'user_style' => (int) $bot_row['bot_style'],
|
||||
'user_options' => 0)
|
||||
);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$user_id = $db->sql_nextid();
|
||||
|
||||
// Add to Bots usergroup
|
||||
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'user_id' => $user_id,
|
||||
'group_id' => $group_row['group_id'])
|
||||
);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'user_id' => (int) $user_id,
|
||||
@@ -225,7 +220,7 @@ class acp_bots
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
$cache->destroy('bots');
|
||||
|
||||
|
||||
add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
|
||||
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"));
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ class acp_disallow
|
||||
|
||||
if ($disallow)
|
||||
{
|
||||
$disallowed_user = str_replace('*', '%', request_var('disallowed_user', ''));
|
||||
$disallowed_user = str_replace('*', '%', request_var('disallowed_user', '', true));
|
||||
|
||||
if (!$disallowed_user)
|
||||
{
|
||||
|
@@ -84,14 +84,16 @@ class acp_email
|
||||
}
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
if (!$row)
|
||||
{
|
||||
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$i = $j = 0;
|
||||
|
||||
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
|
||||
$max_chunk_size = 50;
|
||||
$email_list = array();
|
||||
@@ -175,8 +177,7 @@ class acp_email
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not great but the logging routine doesn't cope well with localising
|
||||
// on the fly
|
||||
// Not great but the logging routine doesn't cope well with localising on the fly
|
||||
$group_name = $user->lang['ALL_USERS'];
|
||||
}
|
||||
|
||||
|
@@ -253,7 +253,7 @@ class acp_forums
|
||||
trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
|
||||
}
|
||||
|
||||
$sql = 'SELECT parent_id, left_id, right_id
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -265,91 +265,14 @@ class acp_forums
|
||||
trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
|
||||
}
|
||||
|
||||
$forum_info = array($forum_id => $row);
|
||||
$move_forum_name = $this->move_forum_by($row, $action, 1);
|
||||
|
||||
// Get the adjacent forum
|
||||
$sql = 'SELECT forum_id, forum_name, left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE parent_id = $this->parent_id
|
||||
AND " . (($action == 'move_up') ? "right_id < {$row['right_id']} ORDER BY right_id DESC" : "left_id > {$row['left_id']} ORDER BY left_id ASC");
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$row)
|
||||
if ($move_forum_name !== false)
|
||||
{
|
||||
// already on top or at bottom
|
||||
break;
|
||||
add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name);
|
||||
$cache->destroy('sql', FORUMS_TABLE);
|
||||
}
|
||||
|
||||
if ($action == 'move_up')
|
||||
{
|
||||
$log_action = 'LOG_FORUM_MOVE_UP';
|
||||
$up_id = $forum_id;
|
||||
$down_id = $row['forum_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$log_action = 'LOG_FORUM_MOVE_DOWN';
|
||||
$up_id = $row['forum_id'];
|
||||
$down_id = $forum_id;
|
||||
}
|
||||
|
||||
$move_forum_name = $row['forum_name'];
|
||||
$forum_info[$row['forum_id']] = $row;
|
||||
$diff_up = $forum_info[$up_id]['right_id'] - $forum_info[$up_id]['left_id'];
|
||||
$diff_down = $forum_info[$down_id]['right_id'] - $forum_info[$down_id]['left_id'];
|
||||
|
||||
$forum_ids = array();
|
||||
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE left_id > ' . $forum_info[$up_id]['left_id'] . '
|
||||
AND right_id < ' . $forum_info[$up_id]['right_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$forum_ids[] = $row['forum_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Start transaction
|
||||
$db->sql_transaction('begin');
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET left_id = left_id + ' . ($diff_up + 1) . ', right_id = right_id + ' . ($diff_up + 1) . '
|
||||
WHERE left_id > ' . $forum_info[$down_id]['left_id'] . '
|
||||
AND right_id < ' . $forum_info[$down_id]['right_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (sizeof($forum_ids))
|
||||
{
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET left_id = left_id - ' . ($diff_down + 1) . ', right_id = right_id - ' . ($diff_down + 1) . '
|
||||
WHERE forum_id IN (' . implode(', ', $forum_ids) . ')';
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET left_id = ' . $forum_info[$down_id]['left_id'] . ', right_id = ' . ($forum_info[$down_id]['left_id'] + $diff_up) . '
|
||||
WHERE forum_id = ' . $up_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET left_id = ' . ($forum_info[$up_id]['right_id'] - $diff_down) . ', right_id = ' . $forum_info[$up_id]['right_id'] . '
|
||||
WHERE forum_id = ' . $down_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
$forum_data = $this->get_forum_info($forum_id);
|
||||
|
||||
add_log('admin', $log_action, $forum_data['forum_name'], $move_forum_name);
|
||||
unset($forum_data);
|
||||
|
||||
$cache->destroy('sql', FORUMS_TABLE);
|
||||
|
||||
break;
|
||||
|
||||
case 'sync':
|
||||
@@ -1439,15 +1362,91 @@ class acp_forums
|
||||
$db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo run cron for optimize table or redirect to database management screen
|
||||
*/
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Move forum position by $steps up/down
|
||||
*/
|
||||
function move_forum_by($forum_row, $action = 'move_up', $steps = 1)
|
||||
{
|
||||
global $db;
|
||||
|
||||
/**
|
||||
* Fetch all the siblings between the module's current spot
|
||||
* and where we want to move it to. If there are less than $steps
|
||||
* siblings between the current spot and the target then the
|
||||
* module will move as far as possible
|
||||
*/
|
||||
$sql = 'SELECT forum_id, forum_name, left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE parent_id = {$forum_row['parent_id']}
|
||||
AND " . (($action == 'move_up') ? "right_id < {$forum_row['right_id']} ORDER BY right_id DESC" : "left_id > {$forum_row['left_id']} ORDER BY left_id ASC");
|
||||
$result = $db->sql_query_limit($sql, $steps);
|
||||
|
||||
$target = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$target = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($target))
|
||||
{
|
||||
// The forum is already on top or bottom
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* $left_id and $right_id define the scope of the nodes that are affected by the move.
|
||||
* $diff_up and $diff_down are the values to substract or add to each node's left_id
|
||||
* and right_id in order to move them up or down.
|
||||
* $move_up_left and $move_up_right define the scope of the nodes that are moving
|
||||
* up. Other nodes in the scope of ($left_id, $right_id) are considered to move down.
|
||||
*/
|
||||
if ($action == 'move_up')
|
||||
{
|
||||
$left_id = $target['left_id'];
|
||||
$right_id = $forum_row['right_id'];
|
||||
|
||||
$diff_up = $forum_row['left_id'] - $target['left_id'];
|
||||
$diff_down = $forum_row['right_id'] + 1 - $forum_row['left_id'];
|
||||
|
||||
$move_up_left = $forum_row['left_id'];
|
||||
$move_up_right = $forum_row['right_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$left_id = $forum_row['left_id'];
|
||||
$right_id = $target['right_id'];
|
||||
|
||||
$diff_up = $forum_row['right_id'] + 1 - $forum_row['left_id'];
|
||||
$diff_down = $target['right_id'] - $forum_row['right_id'];
|
||||
|
||||
$move_up_left = $forum_row['right_id'] + 1;
|
||||
$move_up_right = $target['right_id'];
|
||||
}
|
||||
|
||||
// Now do the dirty job
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . "
|
||||
SET left_id = left_id + CASE
|
||||
WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
|
||||
ELSE {$diff_down}
|
||||
END,
|
||||
right_id = right_id + CASE
|
||||
WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
|
||||
ELSE {$diff_down}
|
||||
END,
|
||||
forum_parents = ''
|
||||
WHERE
|
||||
left_id BETWEEN {$left_id} AND {$right_id}
|
||||
AND right_id BETWEEN {$left_id} AND {$right_id}";
|
||||
$db->sql_query($sql);
|
||||
|
||||
return $target['forum_name'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -66,7 +66,7 @@ class acp_groups
|
||||
{
|
||||
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
|
||||
// Approve, demote or promote
|
||||
group_user_attributes($action, $group_id, $mark_ary, false, ($group_id) ? $group_row['group_name'] : false);
|
||||
|
||||
@@ -75,11 +75,11 @@ class acp_groups
|
||||
case 'demote':
|
||||
$message = 'GROUP_MODS_DEMOTED';
|
||||
break;
|
||||
|
||||
|
||||
case 'promote':
|
||||
$message = 'GROUP_MODS_PROMOTED';
|
||||
break;
|
||||
|
||||
|
||||
case 'approve':
|
||||
$message = 'USERS_APPROVED';
|
||||
break;
|
||||
@@ -99,7 +99,7 @@ class acp_groups
|
||||
if (!sizeof($mark_ary))
|
||||
{
|
||||
$start = 0;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
$sql = 'SELECT user_id
|
||||
@@ -320,7 +320,7 @@ class acp_groups
|
||||
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
||||
// group. This prevents existing group members being updated if no changes
|
||||
// were made.
|
||||
|
||||
|
||||
$group_attributes = array();
|
||||
$test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit');
|
||||
foreach ($test_variables as $test)
|
||||
@@ -449,10 +449,11 @@ class acp_groups
|
||||
{
|
||||
case AVATAR_UPLOAD:
|
||||
$avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
|
||||
break;
|
||||
break;
|
||||
|
||||
case AVATAR_GALLERY:
|
||||
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$avatar_img .= $group_row['group_avatar'];
|
||||
|
||||
@@ -505,7 +506,7 @@ class acp_groups
|
||||
'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'],
|
||||
'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'],
|
||||
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
|
||||
|
||||
|
||||
'S_RANK_OPTIONS' => $rank_options,
|
||||
'S_GROUP_OPTIONS' => group_select_options(0),
|
||||
'AVATAR_IMAGE' => $avatar_img,
|
||||
|
@@ -97,6 +97,8 @@ class acp_icons
|
||||
unset($_images);
|
||||
$_images = array();
|
||||
|
||||
// no break;
|
||||
|
||||
case 'add':
|
||||
|
||||
$order_list = '';
|
||||
@@ -269,9 +271,10 @@ class acp_icons
|
||||
{
|
||||
$update = true;
|
||||
|
||||
$result = $db->sql_query("SELECT {$fields}_order
|
||||
$sql = "SELECT {$fields}_order
|
||||
FROM $table
|
||||
WHERE {$fields}_id = " . $image_id[$image]);
|
||||
WHERE {$fields}_id = " . $image_id[$image];
|
||||
$result = $db->sql_query($sql);
|
||||
$order_old = (int) $db->sql_fetchfield($fields . '_order');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@@ -403,8 +406,9 @@ class acp_icons
|
||||
));
|
||||
}
|
||||
|
||||
$db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . "
|
||||
WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'");
|
||||
$sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . "
|
||||
WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -638,7 +642,6 @@ class acp_icons
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -65,11 +65,10 @@ class acp_jabber
|
||||
{
|
||||
if (!$jabber->connect())
|
||||
{
|
||||
trigger_error('Could not connect to Jabber server' . adm_back_link($this->u_action));
|
||||
trigger_error($user->lang['ERR_JAB_CONNECT'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
// First we'll try to authorise using this account, if that fails we'll
|
||||
// try to create it.
|
||||
// First we'll try to authorise using this account, if that fails we'll try to create it.
|
||||
if (!($result = $jabber->send_auth()))
|
||||
{
|
||||
if (($result = $jabber->account_registration($config['board_email'], $config['sitename'])) <> 2)
|
||||
@@ -95,12 +94,12 @@ class acp_jabber
|
||||
{
|
||||
if (!$jabber->connect())
|
||||
{
|
||||
trigger_error('Could not connect to Jabber server' . adm_back_link($this->u_action));
|
||||
trigger_error($user->lang['ERR_JAB_CONNECT'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
if (!$jabber->send_auth())
|
||||
{
|
||||
trigger_error('Could not authorise on Jabber server' . adm_back_link($this->u_action));
|
||||
trigger_error($user->lang['ERR_JAB_AUTH'] . adm_back_link($this->u_action));
|
||||
}
|
||||
$jabber->send_presence(NULL, NULL, 'online');
|
||||
|
||||
|
@@ -60,9 +60,7 @@ class acp_language
|
||||
if ($action == 'upload_data' && request_var('test_connection', ''))
|
||||
{
|
||||
$test_connection = false;
|
||||
|
||||
$action = 'upload_file';
|
||||
|
||||
$method = request_var('method', '');
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx);
|
||||
@@ -72,6 +70,7 @@ class acp_language
|
||||
case 'ftp':
|
||||
$transfer = new ftp(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
|
||||
break;
|
||||
|
||||
default:
|
||||
trigger_error($user->lang['INVALID_UPLOAD_METHOD']);
|
||||
}
|
||||
|
@@ -109,7 +109,6 @@ class acp_logs
|
||||
'S_SORT_KEY' => $s_sort_key,
|
||||
'S_SORT_DIR' => $s_sort_dir,
|
||||
'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -31,11 +31,10 @@ class acp_modules
|
||||
global $db, $user, $auth, $template;
|
||||
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
||||
|
||||
// Set a global define for modules we might include (the author is able to prevent executing of code with this)
|
||||
// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
|
||||
define('MODULE_INCLUDE', true);
|
||||
|
||||
$user->add_lang('acp/modules');
|
||||
|
||||
$this->tpl_name = 'acp_modules';
|
||||
|
||||
// module class
|
||||
@@ -560,6 +559,7 @@ class acp_modules
|
||||
WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
|
||||
ORDER BY left_id ASC";
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql = 'SELECT module_id, module_enabled, module_name, parent_id, module_langname, left_id, right_id, module_auth
|
||||
FROM ' . MODULES_TABLE . "
|
||||
@@ -649,6 +649,7 @@ class acp_modules
|
||||
|
||||
default:
|
||||
$condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id OR m1.left_id BETWEEN m2.left_id AND m2.right_id';
|
||||
break;
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
@@ -934,14 +935,11 @@ class acp_modules
|
||||
|
||||
/**
|
||||
* Move module position by $steps up/down
|
||||
* @todo support more than one step up/down (at the moment $steps needs to be 1)!
|
||||
*/
|
||||
function move_module_by($module_row, $action = 'move_up', $steps = 1)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$module_id = $module_row['module_id'];
|
||||
|
||||
/**
|
||||
* Fetch all the siblings between the module's current spot
|
||||
* and where we want to move it to. If there are less than $steps
|
||||
@@ -955,14 +953,14 @@ class acp_modules
|
||||
AND " . (($action == 'move_up') ? "right_id < {$module_row['right_id']} ORDER BY right_id DESC" : "left_id > {$module_row['left_id']} ORDER BY left_id ASC");
|
||||
$result = $db->sql_query_limit($sql, $steps);
|
||||
|
||||
$target_module = array();
|
||||
$target = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$target_module = $row;
|
||||
$target = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($target_module))
|
||||
if (!sizeof($target))
|
||||
{
|
||||
// The module is already on top or bottom
|
||||
return false;
|
||||
@@ -977,10 +975,10 @@ class acp_modules
|
||||
*/
|
||||
if ($action == 'move_up')
|
||||
{
|
||||
$left_id = $target_module['left_id'];
|
||||
$left_id = $target['left_id'];
|
||||
$right_id = $module_row['right_id'];
|
||||
|
||||
$diff_up = $module_row['left_id'] - $target_module['left_id'];
|
||||
$diff_up = $module_row['left_id'] - $target['left_id'];
|
||||
$diff_down = $module_row['right_id'] + 1 - $module_row['left_id'];
|
||||
|
||||
$move_up_left = $module_row['left_id'];
|
||||
@@ -989,13 +987,13 @@ class acp_modules
|
||||
else
|
||||
{
|
||||
$left_id = $module_row['left_id'];
|
||||
$right_id = $target_module['right_id'];
|
||||
$right_id = $target['right_id'];
|
||||
|
||||
$diff_up = $module_row['right_id'] + 1 - $module_row['left_id'];
|
||||
$diff_down = $target_module['right_id'] - $module_row['right_id'];
|
||||
$diff_down = $target['right_id'] - $module_row['right_id'];
|
||||
|
||||
$move_up_left = $module_row['right_id'] + 1;
|
||||
$move_up_right = $target_module['right_id'];
|
||||
$move_up_right = $target['right_id'];
|
||||
}
|
||||
|
||||
// Now do the dirty job
|
||||
@@ -1015,7 +1013,7 @@ class acp_modules
|
||||
|
||||
$this->remove_cache_file();
|
||||
|
||||
return $this->lang_name($target_module['module_langname']);
|
||||
return $this->lang_name($target['module_langname']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -128,6 +128,8 @@ class acp_permission_roles
|
||||
trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
// no break;
|
||||
|
||||
case 'add':
|
||||
|
||||
$role_name = request_var('role_name', '', true);
|
||||
@@ -178,7 +180,7 @@ class acp_permission_roles
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql_ary['role_order'] = $max_order + 1;
|
||||
|
||||
|
||||
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
@@ -193,7 +195,6 @@ class acp_permission_roles
|
||||
trigger_error($user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action));
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +244,8 @@ class acp_permission_roles
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// no break;
|
||||
|
||||
case 'edit':
|
||||
|
||||
if ($action == 'edit')
|
||||
@@ -284,13 +287,13 @@ class acp_permission_roles
|
||||
|
||||
'U_ACTION' => $this->u_action . "&action={$action}&role_id={$role_id}",
|
||||
'U_BACK' => $this->u_action,
|
||||
|
||||
|
||||
'ROLE_NAME' => $role_row['role_name'],
|
||||
'ROLE_DESCRIPTION' => $role_row['role_description'],
|
||||
'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 . "
|
||||
@@ -348,7 +351,7 @@ class acp_permission_roles
|
||||
break;
|
||||
}
|
||||
|
||||
// By default, check that image_order is valid and fix it if necessary
|
||||
// By default, check that role_order is valid and fix it if necessary
|
||||
$sql = 'SELECT role_id, role_order
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
WHERE role_type = '" . $db->sql_escape($permission_type) . "'
|
||||
@@ -430,12 +433,12 @@ class acp_permission_roles
|
||||
$content_array = $categories = array();
|
||||
$key_sort_array = array(0);
|
||||
$auth_options = array(0 => $auth_options);
|
||||
|
||||
|
||||
// Making use of auth_admin method here (we do not really want to change two similar code fragments)
|
||||
auth_admin::build_permission_array($auth_options, $content_array, $categories, $key_sort_array);
|
||||
|
||||
$content_array = $content_array[0];
|
||||
|
||||
|
||||
$template->assign_var('S_NUM_PERM_COLS', sizeof($categories));
|
||||
|
||||
// Assign to template
|
||||
@@ -448,7 +451,7 @@ class acp_permission_roles
|
||||
'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_YES'] && !$cat_array['S_UNSET']) ? true : false,
|
||||
'S_UNSET' => ($cat_array['S_UNSET'] && !$cat_array['S_NO'] && !$cat_array['S_YES']) ? true : false)
|
||||
);
|
||||
|
||||
|
||||
foreach ($cat_array['permissions'] as $permission => $allowed)
|
||||
{
|
||||
$template->assign_block_vars('auth.mask', array(
|
||||
@@ -471,7 +474,7 @@ class acp_permission_roles
|
||||
global $db;
|
||||
|
||||
$auth_admin = new auth_admin();
|
||||
|
||||
|
||||
// Get complete auth array
|
||||
$sql = 'SELECT auth_option, auth_option_id
|
||||
FROM ' . ACL_OPTIONS_TABLE . "
|
||||
|
@@ -129,13 +129,14 @@ class acp_permissions
|
||||
|
||||
// Define some common variables for every mode
|
||||
$error = array();
|
||||
|
||||
|
||||
$permission_scope = (strpos($mode, '_global') !== false) ? 'global' : 'local';
|
||||
|
||||
// Showing introductionary page?
|
||||
if ($mode == 'intro')
|
||||
{
|
||||
$this->page_title = 'ACP_PERMISSIONS';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_INTRO' => true)
|
||||
);
|
||||
@@ -263,7 +264,7 @@ class acp_permissions
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'forums':
|
||||
|
||||
if (sizeof($forum_id))
|
||||
@@ -362,9 +363,9 @@ class acp_permissions
|
||||
),
|
||||
|
||||
'WHERE' => "(a.auth_option_id = o.auth_option_id OR r.auth_option_id = o.auth_option_id)
|
||||
$sql_permission_option
|
||||
$sql_forum_id
|
||||
AND u.user_id = a.user_id",
|
||||
$sql_permission_option
|
||||
$sql_forum_id
|
||||
AND u.user_id = a.user_id",
|
||||
|
||||
'ORDER_BY' => 'u.username, u.user_regdate ASC'
|
||||
));
|
||||
@@ -599,7 +600,7 @@ class acp_permissions
|
||||
FROM $table
|
||||
WHERE $sql_id IN (" . implode(', ', $ids) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
||||
$ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
@@ -709,7 +710,7 @@ class acp_permissions
|
||||
{
|
||||
trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
|
||||
$auth_settings = (isset($_POST['setting'])) ? $_POST['setting'] : array();
|
||||
$auth_roles = (isset($_POST['role'])) ? $_POST['role'] : array();
|
||||
$ug_ids = $forum_ids = array();
|
||||
@@ -719,7 +720,7 @@ class acp_permissions
|
||||
{
|
||||
$ug_id = (int) $ug_id;
|
||||
$ug_ids[] = $ug_id;
|
||||
|
||||
|
||||
foreach ($forum_auth_row as $forum_id => $auth_options)
|
||||
{
|
||||
$forum_id = (int) $forum_id;
|
||||
@@ -824,7 +825,7 @@ class acp_permissions
|
||||
}
|
||||
|
||||
$this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0)));
|
||||
|
||||
|
||||
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
@@ -942,7 +943,7 @@ class acp_permissions
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$forum_name = $db->sql_fetchfield('forum_name', false, $result);
|
||||
$forum_name = $db->sql_fetchfield('forum_name');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
@@ -142,7 +142,7 @@ class acp_prune
|
||||
'U_ACTION' => $this->u_action,
|
||||
'S_SELECT_FORUM' => true,
|
||||
'S_FORUM_OPTIONS' => make_forum_select(false, false, false))
|
||||
);
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -150,9 +150,11 @@ class acp_prune
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id IN (' . implode(', ', $forum_id) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
if (!$row)
|
||||
{
|
||||
$db->sql_freeresult($result);
|
||||
trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
@@ -175,9 +177,7 @@ class acp_prune
|
||||
'FORUM_LIST' => $forum_list,
|
||||
'S_HIDDEN_FIELDS' => $s_hidden_fields)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +361,6 @@ class acp_prune
|
||||
'S_COUNT_OPTIONS' => $s_find_count,
|
||||
'U_FIND_USER' => append_sid($phpbb_root_path . "memberlist.$phpEx", 'mode=searchuser&form=acp_prune&field=users'))
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,6 @@ class acp_reasons
|
||||
$this->tpl_name = 'acp_reasons';
|
||||
$this->page_title = 'ACP_REASONS';
|
||||
|
||||
// dumdidum... do i really need to do something mom?
|
||||
$error = array();
|
||||
|
||||
switch ($action)
|
||||
|
@@ -31,7 +31,7 @@ class acp_users
|
||||
$username = request_var('username', '', true);
|
||||
$user_id = request_var('u', 0);
|
||||
$action = request_var('action', '');
|
||||
|
||||
|
||||
$submit = (isset($_POST['update'])) ? true : false;
|
||||
|
||||
// Whois (special case)
|
||||
@@ -57,7 +57,7 @@ class acp_users
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Show user selection mask
|
||||
if (!$username && !$user_id)
|
||||
{
|
||||
@@ -130,6 +130,12 @@ class acp_users
|
||||
'S_FORM_OPTIONS' => $s_form_options)
|
||||
);
|
||||
|
||||
// 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)
|
||||
{
|
||||
trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'overview':
|
||||
@@ -1502,9 +1508,9 @@ class acp_users
|
||||
'SIGNATURE' => $signature,
|
||||
'SIGNATURE_PREVIEW' => $signature_preview,
|
||||
|
||||
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? 'checked="checked"' : '',
|
||||
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
|
||||
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
|
||||
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? 'checked="checked"' : '',
|
||||
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
|
||||
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
|
||||
|
||||
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>'),
|
||||
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
||||
|
@@ -124,6 +124,7 @@ class auth_admin extends auth
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id IN (' . implode(',', $ug_id) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($userdata = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($user->data['user_id'] != $user_id)
|
||||
@@ -148,6 +149,7 @@ class auth_admin extends auth
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
unset($userdata);
|
||||
unset($auth2);
|
||||
}
|
||||
@@ -393,9 +395,9 @@ class auth_admin extends auth
|
||||
$groups[$row['group_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
$memberships = group_memberships(false, array_keys($hold_ary), false);
|
||||
|
||||
|
||||
// User is not a member of any group? Bad admin, bad bad admin...
|
||||
if ($memberships)
|
||||
{
|
||||
@@ -546,6 +548,7 @@ class auth_admin extends auth
|
||||
|
||||
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'] . '" />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,7 +599,7 @@ class auth_admin extends auth
|
||||
'NAME' => ($forum_id == 0) ? $user->lang['GLOBAL_MASK'] : $forum_names[$forum_id],
|
||||
'FORUM_ID' => $forum_id)
|
||||
);
|
||||
|
||||
|
||||
if (isset($auth_ary['users']) && sizeof($auth_ary['users']))
|
||||
{
|
||||
$sql = 'SELECT user_id, username
|
||||
@@ -740,6 +743,7 @@ class auth_admin extends auth
|
||||
}
|
||||
|
||||
$cache->destroy('acl_options');
|
||||
$this->acl_clear_prefetch();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -762,7 +766,7 @@ class auth_admin extends auth
|
||||
{
|
||||
$ug_id = array($ug_id);
|
||||
}
|
||||
|
||||
|
||||
$ug_id_sql = 'IN (' . implode(', ', array_map('intval', $ug_id)) . ')';
|
||||
$forum_sql = 'IN (' . implode(', ', array_map('intval', $forum_id)) . ') ';
|
||||
|
||||
@@ -1181,7 +1185,7 @@ class auth_admin extends auth
|
||||
* The other user is always able to revert back to his permission set.
|
||||
* This function does not check for lower/higher permissions, it is possible for the user to gain
|
||||
* "more" permissions by this.
|
||||
*
|
||||
* Admin permissions will not be copied.
|
||||
*/
|
||||
function ghost_permissions($from_user_id, $to_user_id)
|
||||
{
|
||||
|
Reference in New Issue
Block a user