aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r--phpBB/includes/acp/acp_attachments.php4
-rw-r--r--phpBB/includes/acp/acp_captcha.php27
-rw-r--r--phpBB/includes/acp/acp_database.php96
-rw-r--r--phpBB/includes/acp/acp_email.php10
-rw-r--r--phpBB/includes/acp/acp_forums.php37
-rw-r--r--phpBB/includes/acp/acp_inactive.php14
-rw-r--r--phpBB/includes/acp/acp_jabber.php3
-rw-r--r--phpBB/includes/acp/acp_main.php6
-rw-r--r--phpBB/includes/acp/acp_permissions.php40
-rw-r--r--phpBB/includes/acp/acp_profile.php2
-rw-r--r--phpBB/includes/acp/acp_search.php4
-rw-r--r--phpBB/includes/acp/acp_styles.php240
-rw-r--r--phpBB/includes/acp/acp_users.php14
-rw-r--r--phpBB/includes/acp/auth.php82
14 files changed, 348 insertions, 231 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 15e9e6ab62..ef20b48cec 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -1003,8 +1003,8 @@ class acp_attachments
if ($files_added)
{
- set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
- set_config('num_files', $config['num_files'] + $files_added, true);
+ set_config_count('upload_dir_size', $space_taken, true);
+ set_config_count('num_files', $files_added, true);
}
}
}
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php
index 90aa4e8683..93505e1590 100644
--- a/phpBB/includes/acp/acp_captcha.php
+++ b/phpBB/includes/acp/acp_captcha.php
@@ -28,22 +28,26 @@ class acp_captcha
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/board');
-
-
$captcha_vars = array(
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE',
- 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED'
+ 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED',
+ 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE',
+ 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE',
+ 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS',
+
);
if (isset($_GET['demo']))
{
$captcha_vars = array_keys($captcha_vars);
+
foreach ($captcha_vars as $captcha_var)
{
$config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
}
+
if ($config['captcha_gd'])
{
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
@@ -52,14 +56,16 @@ class acp_captcha
{
include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
}
+
$captcha = new captcha();
- $captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
+ $captcha->execute(gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)), time());
exit;
}
$config_vars = array(
'enable_confirm' => 'REG_ENABLE',
'enable_post_confirm' => 'POST_ENABLE',
+ 'confirm_refresh' => 'CONFIRM_REFRESH',
'captcha_gd' => 'CAPTCHA_GD',
);
@@ -73,11 +79,14 @@ class acp_captcha
if ($submit && check_form_key($form_key))
{
$config_vars = array_keys($config_vars);
+
foreach ($config_vars as $config_var)
{
set_config($config_var, request_var($config_var, ''));
}
+
$captcha_vars = array_keys($captcha_vars);
+
foreach ($captcha_vars as $captcha_var)
{
$value = request_var($captcha_var, 0);
@@ -86,35 +95,39 @@ class acp_captcha
set_config($captcha_var, $value);
}
}
+
+ add_log('admin', 'LOG_CONFIG_VISUAL');
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
else if ($submit)
{
- trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
+ trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
}
else
{
-
$preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&demo=demo"));
+
if (@extension_loaded('gd'))
{
$template->assign_var('GD', true);
}
+
foreach ($config_vars as $config_var => $template_var)
{
$template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
}
+
foreach ($captcha_vars as $captcha_var => $template_var)
{
$var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
$template->assign_var($template_var, $var);
$preview_image_src .= "&$captcha_var=" . $var;
}
+
$template->assign_vars(array(
'CAPTCHA_PREVIEW' => $preview_image_src,
'PREVIEW' => isset($_POST['preview']),
));
-
}
}
}
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index e2ca66b2f3..856b867c9a 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -27,7 +27,7 @@ class acp_database
{
global $cache, $db, $user, $auth, $template, $table_prefix;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
-
+
$user->add_lang('acp/database');
$this->tpl_name = 'acp_database';
@@ -82,6 +82,7 @@ class acp_database
}
@set_time_limit(1200);
+ @set_time_limit(0);
$time = time();
@@ -187,7 +188,7 @@ class acp_database
$template->assign_vars(array(
'U_ACTION' => $this->u_action . '&action=download'
));
-
+
$available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2');
foreach ($available_methods as $type => $module)
@@ -424,27 +425,37 @@ class acp_database
$dir = $phpbb_root_path . 'store/';
$dh = @opendir($dir);
+ $backup_files = array();
+
if ($dh)
{
while (($file = readdir($dh)) !== false)
{
if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
{
- $supported = in_array($matches[2], $methods);
-
- if ($supported == 'true')
+ if (in_array($matches[2], $methods))
{
- $template->assign_block_vars('files', array(
- 'FILE' => $file,
- 'NAME' => gmdate("d-m-Y H:i:s", $matches[1]),
- 'SUPPORTED' => $supported
- ));
+ $backup_files[gmdate("d-m-Y H:i:s", $matches[1])] = $file;
}
}
}
closedir($dh);
}
+ if (!empty($backup_files))
+ {
+ krsort($backup_files);
+
+ foreach ($backup_files as $name => $file)
+ {
+ $template->assign_block_vars('files', array(
+ 'FILE' => $file,
+ 'NAME' => $name,
+ 'SUPPORTED' => true,
+ ));
+ }
+ }
+
$template->assign_vars(array(
'U_ACTION' => $this->u_action . '&action=submit'
));
@@ -508,7 +519,7 @@ class base_extractor
header('Pragma: no-cache');
header("Content-Type: $mimetype; name=\"$name\"");
header("Content-disposition: attachment; filename=$name");
-
+
switch ($format)
{
case 'bzip2':
@@ -527,14 +538,14 @@ class base_extractor
break;
}
}
-
+
if ($store == true)
{
global $phpbb_root_path;
$file = $phpbb_root_path . 'store/' . $filename . $ext;
-
+
$this->fp = $open($file, 'w');
-
+
if (!$this->fp)
{
trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
@@ -545,6 +556,7 @@ class base_extractor
function write_end()
{
static $close;
+
if ($this->store)
{
if ($close === null)
@@ -662,11 +674,11 @@ class mysql_extractor extends base_extractor
if ($result != false)
{
$fields_cnt = mysqli_num_fields($result);
-
+
// Get field information
$field = mysqli_fetch_fields($result);
$field_set = array();
-
+
for ($j = 0; $j < $fields_cnt; $j++)
{
$field_set[] = $field[$j]->name;
@@ -679,7 +691,7 @@ class mysql_extractor extends base_extractor
$first_set = true;
$query_len = 0;
$max_len = get_usable_memory();
-
+
while ($row = mysqli_fetch_row($result))
{
$values = array();
@@ -750,7 +762,7 @@ class mysql_extractor extends base_extractor
$field[] = mysql_fetch_field($result, $i);
}
$field_set = array();
-
+
for ($j = 0; $j < $fields_cnt; $j++)
{
$field_set[] = $field[$j]->name;
@@ -966,7 +978,7 @@ class sqlite_extractor extends base_extractor
$ar[] = $row;
}
$db->sql_freeresult($result);
-
+
foreach ($ar as $value)
{
if (strpos($value['name'], 'autoindex') !== false)
@@ -1124,7 +1136,7 @@ class postgres_extractor extends base_extractor
$sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n";
}
$db->sql_freeresult($result);
-
+
$field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relname = '" . $db->sql_escape($table_name) . "'
@@ -1188,7 +1200,7 @@ class postgres_extractor extends base_extractor
{
$line .= ' NOT NULL';
}
-
+
$lines[] = $line;
}
$db->sql_freeresult($result);
@@ -1388,33 +1400,33 @@ class mssql_extractor extends base_extractor
$sql_data .= "GO\n";
$sql_data .= "\nCREATE TABLE [$table_name] (\n";
$rows = array();
-
+
$text_flag = false;
-
+
$sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '$table_name'";
$result = $db->sql_query($sql);
-
+
while ($row = $db->sql_fetchrow($result))
{
$line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
-
+
if ($row['DATA_TYPE'] == 'text')
{
$text_flag = true;
}
-
+
if ($row['IS_IDENTITY'])
{
$line .= ' IDENTITY (1 , 1)';
}
-
+
if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
{
$line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
}
-
+
if ($row['IS_NULLABLE'] == 'YES')
{
$line .= ' NULL';
@@ -1423,27 +1435,27 @@ class mssql_extractor extends base_extractor
{
$line .= ' NOT NULL';
}
-
+
if ($row['COLUMN_DEFAULT'])
{
$line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
}
-
+
$rows[] = $line;
}
$db->sql_freeresult($result);
-
+
$sql_data .= implode(",\n", $rows);
$sql_data .= "\n) ON [PRIMARY]";
-
+
if ($text_flag)
{
$sql_data .= " TEXTIMAGE_ON [PRIMARY]";
}
-
+
$sql_data .= "\nGO\n\n";
$rows = array();
-
+
$sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_NAME = '$table_name'";
@@ -1463,7 +1475,7 @@ class mssql_extractor extends base_extractor
$sql_data .= "\n\t) ON [PRIMARY] \nGO\n";
}
$db->sql_freeresult($result);
-
+
$index = array();
$sql = "EXEC sp_statistics '$table_name'";
$result = $db->sql_query($sql);
@@ -1475,12 +1487,12 @@ class mssql_extractor extends base_extractor
}
}
$db->sql_freeresult($result);
-
+
foreach ($index as $index_name => $column_name)
{
$index[$index_name] = implode(', ', $column_name);
}
-
+
foreach ($index as $index_name => $columns)
{
$sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n";
@@ -1508,7 +1520,7 @@ class mssql_extractor extends base_extractor
$ary_type = $ary_name = array();
$ident_set = false;
$sql_data = '';
-
+
// Grab all of the data from current table.
$sql = "SELECT *
FROM $table_name";
@@ -1602,7 +1614,7 @@ class mssql_extractor extends base_extractor
$ary_type = $ary_name = array();
$ident_set = false;
$sql_data = '';
-
+
// Grab all of the data from current table.
$sql = "SELECT *
FROM $table_name";
@@ -1819,7 +1831,7 @@ class oracle_extractor extends base_extractor
{
global $db;
$ary_type = $ary_name = array();
-
+
// Grab all of the data from current table.
$sql = "SELECT *
FROM $table_name";
@@ -1915,7 +1927,7 @@ class firebird_extractor extends base_extractor
{
global $db;
$ary_type = $ary_name = array();
-
+
// Grab all of the data from current table.
$sql = "SELECT *
FROM $table_name";
@@ -2244,7 +2256,7 @@ function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
{
$record = '';
$delim_len = strlen($delim);
-
+
while (!$eof($fp))
{
$pos = strpos($record, $delim);
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index 125908c296..350693a630 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -108,7 +108,7 @@ class acp_email
$db->sql_freeresult($result);
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
$i = $j = 0;
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
@@ -121,7 +121,7 @@ class acp_email
{
if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) ||
($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) ||
- ($row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']))
+ ($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])))
{
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
{
@@ -173,7 +173,7 @@ class acp_email
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
-
+
$messenger->subject(htmlspecialchars_decode($subject));
$messenger->set_mail_priority($priority);
@@ -181,7 +181,7 @@ class acp_email
'CONTACT_EMAIL' => $config['board_contact'],
'MESSAGE' => htmlspecialchars_decode($message))
);
-
+
if (!($messenger->send($used_method)))
{
$errored = true;
@@ -239,7 +239,7 @@ class acp_email
$select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
$select_list .= group_select_options($group_id, $exclude);
-
+
$s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
$s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
$s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 6095fdd48b..bf5242ace6 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -183,7 +183,7 @@ class acp_forums
$forum_perm_from = request_var('forum_perm_from', 0);
// Copy permissions?
- if ($forum_perm_from && !empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] &&
+ if (!empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] &&
(($action != 'edit') || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
{
// if we edit a forum delete current permissions first
@@ -560,13 +560,12 @@ class acp_forums
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . "
AND forum_id <> $forum_id";
- $result = $db->sql_query($sql);
+ $result = $db->sql_query_limit($sql, 1);
+ $postable_forum_exists = false;
if ($db->sql_fetchrow($result))
{
- $template->assign_vars(array(
- 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
- );
+ $postable_forum_exists = true;
}
$db->sql_freeresult($result);
@@ -583,25 +582,24 @@ class acp_forums
$forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
- $sql = 'SELECT forum_id
- FROM ' . FORUMS_TABLE . '
- WHERE forum_type = ' . FORUM_POST . "
- AND forum_id <> $forum_id";
- $result = $db->sql_query($sql);
-
- if ($db->sql_fetchrow($result))
+ if ($postable_forum_exists)
{
$template->assign_vars(array(
'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false???
);
}
- $db->sql_freeresult($result);
$template->assign_vars(array(
'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
'S_FORUMS_LIST' => $forums_list)
);
}
+ else if ($postable_forum_exists)
+ {
+ $template->assign_vars(array(
+ 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
+ );
+ }
$s_show_display_on_index = false;
@@ -714,7 +712,7 @@ class acp_forums
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . "
AND forum_id <> $forum_id";
- $result = $db->sql_query($sql);
+ $result = $db->sql_query_limit($sql, 1);
if ($db->sql_fetchrow($result))
{
@@ -807,10 +805,6 @@ class acp_forums
$url = $this->u_action . "&amp;parent_id=$this->parent_id&amp;f={$row['forum_id']}";
- $forum_title = ($forum_type != FORUM_LINK) ? '<a href="' . $this->u_action . '&amp;parent_id=' . $row['forum_id'] . '">' : '';
- $forum_title .= $row['forum_name'];
- $forum_title .= ($forum_type != FORUM_LINK) ? '</a>' : '';
-
$template->assign_block_vars('forums', array(
'FOLDER_IMAGE' => $folder_image,
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="" />' : '',
@@ -888,7 +882,7 @@ class acp_forums
*/
function update_forum_data(&$forum_data)
{
- global $db, $user, $cache;
+ global $db, $user, $cache, $phpbb_root_path;
$errors = array();
@@ -926,6 +920,11 @@ class acp_forums
array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'),
);
+ if (!file_exists($phpbb_root_path . $forum_data['forum_image']))
+ {
+ $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST'];
+ }
+
validate_range($range_test_ary, $errors);
// Set forum flags
diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php
index 5683ae5dab..a38b47a704 100644
--- a/phpBB/includes/acp/acp_inactive.php
+++ b/phpBB/includes/acp/acp_inactive.php
@@ -111,6 +111,7 @@ class acp_inactive
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
+ $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']))
@@ -161,7 +162,11 @@ class acp_inactive
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
FROM ' . USERS_TABLE . '
- WHERE ' . $db->sql_in_set('user_id', $mark);
+ WHERE ' . $db->sql_in_set('user_id', $mark) . '
+ AND user_inactive_reason';
+
+ $sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL;
+
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
@@ -179,9 +184,14 @@ class acp_inactive
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
+ $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
+ $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
+ $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
+ $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
+
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']),
- 'REGISTER_DATE' => $user->format_date($row['user_regdate']),
+ 'REGISTER_DATE' => $user->format_date($row['user_regdate'], false, true),
'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
);
diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php
index 499543cc6c..3ab6eb64ed 100644
--- a/phpBB/includes/acp/acp_jabber.php
+++ b/phpBB/includes/acp/acp_jabber.php
@@ -88,7 +88,8 @@ class acp_jabber
else
{
// This feature is disabled.
- // We update the user table to be sure all users that have IM as notify type are set to both as notify type
+ // We update the user table to be sure all users that have IM as notify type are set to both as notify type
+ // We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled.
$sql_ary = array(
'user_notify_type' => NOTIFY_BOTH,
);
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index a558fe6712..8a92c06e04 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -510,6 +510,12 @@ class acp_main
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
}
+ // Fill dbms version if not yet filled
+ if (empty($config['dbms_version']))
+ {
+ set_config('dbms_version', $db->sql_server_info(true));
+ }
+
$this->tpl_name = 'acp_main';
$this->page_title = 'ACP_MAIN';
}
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index 727aa0d25d..164970b5d5 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -23,7 +23,7 @@ class acp_permissions
{
var $u_action;
var $permission_dropdown;
-
+
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
@@ -94,7 +94,7 @@ class acp_permissions
}
$db->sql_freeresult($result);
}
-
+
// Map usernames to ids and vice versa
if ($usernames)
{
@@ -112,7 +112,7 @@ class acp_permissions
}
}
unset($username);
-
+
// Build forum ids (of all forums are checked or subforum listing used)
if ($all_forums)
{
@@ -528,7 +528,7 @@ class acp_permissions
}
continue;
}
-
+
if ($branch_there)
{
$s_options .= ' [' . $user->lang['PLUS_SUBFORUMS'] . ']';
@@ -539,14 +539,14 @@ class acp_permissions
return $s_options;
}
-
+
/**
* Build dropdown field for changing permission types
*/
function build_permission_dropdown($options, $default_option, $permission_scope)
{
global $user, $auth;
-
+
$s_dropdown_options = '';
foreach ($options as $setting)
{
@@ -626,7 +626,7 @@ class acp_permissions
{
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
$ug_id = $forum_id = 0;
// We loop through the auth settings defined in our submit
@@ -762,7 +762,14 @@ class acp_permissions
$this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids);
- trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+ if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
+ {
+ trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_ids)));
+ }
+ else
+ {
+ trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+ }
}
/**
@@ -809,7 +816,7 @@ class acp_permissions
function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id)
{
global $user, $db, $auth;
-
+
// User or group to be set?
$ug_type = (sizeof($user_id)) ? 'user' : 'group';
@@ -829,7 +836,14 @@ 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));
+ if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
+ {
+ trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_id)));
+ }
+ else
+ {
+ trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+ }
}
/**
@@ -1150,7 +1164,11 @@ class acp_permissions
{
$sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')';
}
- else
+ else if (sizeof($role_ids))
+ {
+ $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids);
+ }
+ else if (sizeof($option_ids))
{
$sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids);
}
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 7ab6ff7cd6..2b5ec88e5b 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -1539,7 +1539,7 @@ class acp_profile
case 'firebird':
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
- $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
+ $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" ';
switch ($field_type)
{
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php
index dc6f3d1c44..930c8d2a26 100644
--- a/phpBB/includes/acp/acp_search.php
+++ b/phpBB/includes/acp/acp_search.php
@@ -63,6 +63,7 @@ class acp_search
'load_search' => 'bool',
'limit_search_load' => 'float',
'min_search_author_chars' => 'integer',
+ 'max_num_search_keywords' => 'integer',
'search_store_results' => 'integer',
);
@@ -216,6 +217,7 @@ class acp_search
'SEARCH_INTERVAL' => (float) $config['search_interval'],
'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'],
'SEARCH_STORE_RESULTS' => (int) $config['search_store_results'],
+ 'MAX_NUM_SEARCH_KEYWORDS' => (int) $config['max_num_search_keywords'],
'S_SEARCH_TYPES' => $search_options,
'S_YES_SEARCH' => (bool) $config['load_search'],
@@ -591,7 +593,7 @@ class acp_search
ksort($this->state);
- set_config('search_indexing_state', implode(',', $this->state));
+ set_config('search_indexing_state', implode(',', $this->state), true);
}
/**
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 3a021bb4cf..184b71cec3 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -37,7 +37,10 @@ class acp_styles
// Hardcoded template bitfield to add for new templates
$bitfield = new bitfield();
$bitfield->set(0);
+ $bitfield->set(1);
+ $bitfield->set(2);
$bitfield->set(3);
+ $bitfield->set(4);
$bitfield->set(8);
$bitfield->set(9);
$bitfield->set(11);
@@ -743,7 +746,7 @@ parse_css_file = {PARSE_CSS_FILE}
// If it's not stored in the db yet, then update the template setting and store all template files in the db
if (!$template_info['template_storedb'])
{
- if ($this->get_super('template', $template_id))
+ if ($super = $this->get_super('template', $template_id))
{
$this->store_in_db('template', $super['template_id']);
}
@@ -1275,139 +1278,143 @@ parse_css_file = {PARSE_CSS_FILE}
$this->page_title = 'EDIT_IMAGESET';
- $update = (isset($_POST['update'])) ? true : false;
+ if (!$imageset_id)
+ {
+ trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
- $imgname = request_var('imgname', '');
- $imgpath = request_var('imgpath', '');
- $imgsize = request_var('imgsize', false);
- $imgwidth = request_var('imgwidth', 0);
- $imgheight = request_var('imgheight', 0);
+ $update = (isset($_POST['update'])) ? true : false;
+ $imgname = request_var('imgname', 'site_logo');
$imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname);
- $imgpath = str_replace('..', '.', $imgpath);
+ $sql_extra = $imgnamelang = '';
+
+ $sql = 'SELECT imageset_path, imageset_name
+ FROM ' . STYLES_IMAGESET_TABLE . "
+ WHERE imageset_id = $imageset_id";
+ $result = $db->sql_query($sql);
+ $imageset_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- if ($imageset_id)
+ if (!$imageset_row)
{
- $sql = 'SELECT imageset_path, imageset_name
- FROM ' . STYLES_IMAGESET_TABLE . "
- WHERE imageset_id = $imageset_id";
- $result = $db->sql_query($sql);
- $imageset_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
- $imageset_path = $imageset_row['imageset_path'];
- $imageset_name = $imageset_row['imageset_name'];
+ $imageset_path = $imageset_row['imageset_path'];
+ $imageset_name = $imageset_row['imageset_name'];
- $sql_extra = '';
- if (strpos($imgname, '-') !== false)
+ if (strpos($imgname, '-') !== false)
+ {
+ list($imgname, $imgnamelang) = explode('-', $imgname);
+ $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')";
+ }
+
+ $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id
+ FROM ' . STYLES_IMAGESET_DATA_TABLE . "
+ WHERE imageset_id = $imageset_id
+ AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra";
+ $result = $db->sql_query($sql);
+ $imageset_data_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $image_filename = $imageset_data_row['image_filename'];
+ $image_width = $imageset_data_row['image_width'];
+ $image_height = $imageset_data_row['image_height'];
+ $image_lang = $imageset_data_row['image_lang'];
+ $image_id = $imageset_data_row['image_id'];
+ $imgsize = ($imageset_data_row['image_width'] && $imageset_data_row['image_height']) ? 1 : 0;
+
+ // Check to see whether the selected image exists in the table
+ $valid_name = ($update) ? false : true;
+
+ foreach ($this->imageset_keys as $category => $img_ary)
+ {
+ if (in_array($imgname, $img_ary))
{
- list($imgname, $imgnamelang) = explode('-', $imgname);
- $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')";
+ $valid_name = true;
+ break;
}
+ }
- $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id
- FROM ' . STYLES_IMAGESET_DATA_TABLE . "
- WHERE imageset_id = $imageset_id
- AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra";
- $result = $db->sql_query($sql);
- $imageset_data_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $image_filename = $imageset_data_row['image_filename'];
- $image_width = $imageset_data_row['image_width'];
- $image_height = $imageset_data_row['image_height'];
- $image_lang = $imageset_data_row['image_lang'];
- $image_id = $imageset_data_row['image_id'];
+ if ($update && isset($_POST['imgpath']) && $valid_name)
+ {
+ // If imgwidth and imgheight are non-zero grab the actual size
+ // from the image itself ... we ignore width settings for the poll center image
+ $imgwidth = request_var('imgwidth', 0);
+ $imgheight = request_var('imgheight', 0);
+ $imgsize = request_var('imgsize', 0);
+ $imgpath = request_var('imgpath', '');
+ $imgpath = str_replace('..', '.', $imgpath);
- if (!$imageset_row)
+ // If no dimensions selected, we reset width and height to 0 ;)
+ if (!$imgsize)
{
- trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $imgwidth = $imgheight = 0;
}
- // Check to see whether the selected image exists in the table
- $valid_name = ($update) ? false : true;
+ $imglang = '';
- foreach ($this->imageset_keys as $category => $img_ary)
+ if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
{
- if (in_array($imgname, $img_ary))
- {
- $valid_name = true;
- break;
- }
+ trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
}
- if ($update && isset($_POST['imgpath']))
+ // Determine width/height. If dimensions included and no width/height given, we detect them automatically...
+ if ($imgsize && $imgpath)
{
- if ($valid_name)
+ if (!$imgwidth || !$imgheight)
{
- // If imgwidth and imgheight are non-zero grab the actual size
- // from the image itself ... we ignore width settings for the poll center image
- $imgwidth = request_var('imgwidth', 0);
- $imgheight = request_var('imgheight', 0);
- $imglang = '';
-
- if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
- {
- trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
- if ($imgsize && $imgpath)
- {
- if (!$imgwidth || !$imgheight)
- {
- list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath");
- $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file;
- $imgheight = ($imgheight) ? $imgheight : $imgheight_file;
- }
- $imgwidth = ($imgname != 'poll_center') ? (int) $imgwidth : 0;
- $imgheight = (int) $imgheight;
- }
-
+ list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath");
+ $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file;
+ $imgheight = ($imgheight) ? $imgheight : $imgheight_file;
+ }
+ $imgwidth = ($imgname != 'poll_center') ? (int) $imgwidth : 0;
+ $imgheight = (int) $imgheight;
+ }
- if (strpos($imgpath, '/') !== false)
- {
- list($imglang, $imgfilename) = explode('/', $imgpath);
- }
- else
- {
- $imgfilename = $imgpath;
- }
+ if (strpos($imgpath, '/') !== false)
+ {
+ list($imglang, $imgfilename) = explode('/', $imgpath);
+ }
+ else
+ {
+ $imgfilename = $imgpath;
+ }
- $sql_ary = array(
- 'image_filename' => (string) $imgfilename,
- 'image_width' => (int) $imgwidth,
- 'image_height' => (int) $imgheight,
- 'image_lang' => (string) $imglang,
- );
+ $sql_ary = array(
+ 'image_filename' => (string) $imgfilename,
+ 'image_width' => (int) $imgwidth,
+ 'image_height' => (int) $imgheight,
+ 'image_lang' => (string) $imglang,
+ );
- // already exists
- if ($imageset_data_row)
- {
- $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE image_id = $image_id";
- $db->sql_query($sql);
- }
- // does not exist
- else if (!$imageset_data_row)
- {
- $sql_ary['image_name'] = $imgname;
- $sql_ary['imageset_id'] = (int) $imageset_id;
- $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
- }
+ // already exists
+ if ($imageset_data_row)
+ {
+ $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . '
+ SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE image_id = $image_id";
+ $db->sql_query($sql);
+ }
+ // does not exist
+ else if (!$imageset_data_row)
+ {
+ $sql_ary['image_name'] = $imgname;
+ $sql_ary['imageset_id'] = (int) $imageset_id;
+ $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
+ }
- $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
+ $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
- add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
+ add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
- $template->assign_var('SUCCESS', true);
+ $template->assign_var('SUCCESS', true);
- $image_filename = $imgfilename;
- $image_width = $imgwidth;
- $image_height = $imgheight;
- $image_lang = $imglang;
- }
- }
+ $image_filename = $imgfilename;
+ $image_width = $imgwidth;
+ $image_height = $imgheight;
+ $image_lang = $imglang;
}
$imglang = '';
@@ -1529,6 +1536,8 @@ parse_css_file = {PARSE_CSS_FILE}
'U_BACK' => $this->u_action,
'NAME' => $imageset_name,
'A_NAME' => addslashes($imageset_name),
+ 'PATH' => $imageset_path,
+ 'A_PATH' => addslashes($imageset_path),
'ERROR' => !$valid_name,
'IMG_SRC' => ($image_found) ? '../styles/' . $imageset_path . '/imageset/' . $img_val : 'images/no_image.png',
'IMAGE_SELECT' => $image_found
@@ -3210,7 +3219,16 @@ parse_css_file = {PARSE_CSS_FILE}
if (isset($cfg_data['inherit_from']) && $cfg_data['inherit_from'])
{
- $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb
+ if ($mode === 'template')
+ {
+ $select_bf = ', template_bitfield';
+ }
+ else
+ {
+ $select_bf = '';
+ }
+
+ $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb $select_bf
FROM $sql_from
WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "'
AND {$mode}_inherits_id = 0";
@@ -3225,6 +3243,7 @@ parse_css_file = {PARSE_CSS_FILE}
{
$inherit_id = $row["{$mode}_id"];
$inherit_path = $row["{$mode}_path"];
+ $inherit_bf = ($mode === 'template') ? $row["{$mode}_bitfield"] : false;
$cfg_data['store_db'] = $row["{$mode}_storedb"];
$store_db = $row["{$mode}_storedb"];
}
@@ -3233,6 +3252,7 @@ parse_css_file = {PARSE_CSS_FILE}
{
$inherit_id = 0;
$inherit_path = '';
+ $inherit_bf = false;
}
@@ -3255,6 +3275,10 @@ parse_css_file = {PARSE_CSS_FILE}
{
$sql_ary['bbcode_bitfield'] = $cfg_data['template_bitfield'];
}
+ else if ($inherit_bf)
+ {
+ $sql_ary['bbcode_bitfield'] = $inherit_bf;
+ }
else
{
$sql_ary['bbcode_bitfield'] = TEMPLATE_BITFIELD;
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 05a087f4c3..e5f83faec3 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -972,6 +972,7 @@ class acp_users
{
$sql = 'DELETE FROM ' . LOG_TABLE . '
WHERE log_type = ' . LOG_USERS . "
+ AND reportee_id = $user_id
$where_sql";
$db->sql_query($sql);
@@ -1161,7 +1162,8 @@ class acp_users
foreach ($cp_data as $key => $value)
{
- $cp_data[$left_delim . $key . $right_delim] = $value;
+ // Firebird is case sensitive with delimiter
+ $cp_data[$left_delim . (($db->sql_layer == 'firebird') ? strtoupper($key) : $key) . $right_delim] = $value;
unset($cp_data[$key]);
}
@@ -1846,6 +1848,16 @@ class acp_users
}
$error = array();
+
+ // The delete action was successful - therefore update the user row...
+ $sql = 'SELECT u.*, s.*
+ FROM ' . USERS_TABLE . ' u
+ LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
+ WHERE u.user_id = ' . $user_id . '
+ ORDER BY s.session_time DESC';
+ $result = $db->sql_query($sql);
+ $user_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
}
else
{
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 6943f5ada1..10d7973da6 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -58,7 +58,7 @@ class auth_admin extends auth
$cache->put('_acl_options', $this->acl_options);
}
}
-
+
/**
* Get permission mask
* This function only supports getting permissions of one type (for example a_)
@@ -140,7 +140,7 @@ class auth_admin extends auth
$auth2 = &$auth;
}
-
+
$hold_ary[$userdata['user_id']] = array();
foreach ($forum_ids as $f_id)
{
@@ -345,7 +345,7 @@ class auth_admin extends auth
// Build js roles array (role data assignments)
$s_role_js_array = '';
-
+
if (sizeof($roles))
{
$s_role_js_array = array();
@@ -696,6 +696,7 @@ class auth_admin extends auth
$cur_options = array();
+ // Determine current options
$sql = 'SELECT auth_option, is_global, is_local
FROM ' . ACL_OPTIONS_TABLE . '
ORDER BY auth_option_id';
@@ -703,15 +704,7 @@ class auth_admin extends auth
while ($row = $db->sql_fetchrow($result))
{
- if ($row['is_global'])
- {
- $cur_options['global'][] = $row['auth_option'];
- }
-
- if ($row['is_local'])
- {
- $cur_options['local'][] = $row['auth_option'];
- }
+ $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local');
}
$db->sql_freeresult($result);
@@ -726,14 +719,11 @@ class auth_admin extends auth
foreach ($option_ary as $option_value)
{
- if (!in_array($option_value, $cur_options[$type]))
- {
- $new_options[$type][] = $option_value;
- }
+ $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]))
+ if (!in_array($flag, $new_options[$type]))
{
$new_options[$type][] = $flag;
}
@@ -744,23 +734,53 @@ class auth_admin extends auth
$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']);
+ $options['both'] = array_intersect($new_options['local'], $new_options['global']);
- $sql_ary = array();
+ // Now check which options to add/update
+ $add_options = $update_options = array();
+ // First local ones...
foreach ($options as $type => $option_ary)
{
foreach ($option_ary as $option)
{
- $sql_ary[] = array(
- 'auth_option' => (string) $option,
- 'is_global' => ($type == 'global' || $type == 'local_global') ? 1 : 0,
- 'is_local' => ($type == 'local' || $type == 'local_global') ? 1 : 0
- );
+ if (!isset($cur_options[$option]))
+ {
+ $add_options[] = array(
+ 'auth_option' => (string) $option,
+ 'is_global' => ($type == 'global' || $type == 'both') ? 1 : 0,
+ 'is_local' => ($type == 'local' || $type == 'both') ? 1 : 0
+ );
+
+ continue;
+ }
+
+ // Else, update existing entry if it is changed...
+ if ($type === $cur_options[$option])
+ {
+ continue;
+ }
+
+ // New type is always both:
+ // If is now both, we set both.
+ // If it was global the new one is local and we need to set it to both
+ // If it was local the new one is global and we need to set it to both
+ $update_options[] = $option;
}
}
- $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
+ if (!empty($add_options))
+ {
+ $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options);
+ }
+
+ if (!empty($update_options))
+ {
+ $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
+ SET is_global = 1, is_local = 1
+ WHERE ' . $db->sql_in_set('auth_option', $update_options);
+ $db->sql_query($sql);
+ }
$cache->destroy('_acl_options');
$this->acl_clear_prefetch();
@@ -802,7 +822,7 @@ class auth_admin extends auth
reset($auth);
$flag = key($auth);
$flag = substr($flag, 0, strpos($flag, '_') + 1);
-
+
// This ID (the any-flag) is set if one or more permissions are true...
$any_option_id = (int) $this->acl_options['id'][$flag];
@@ -916,7 +936,7 @@ class auth_admin extends auth
reset($auth);
$flag = key($auth);
$flag = substr($flag, 0, strpos($flag, '_') + 1);
-
+
// Remove any-flag from auth ary
if (isset($auth[$flag]))
{
@@ -1067,7 +1087,7 @@ class auth_admin extends auth
{
$where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary));
}
-
+
$sql = "DELETE FROM $table
WHERE " . implode(' AND ', $where_sql);
$db->sql_query($sql);
@@ -1090,7 +1110,7 @@ class auth_admin extends auth
'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false,
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
-
+
'CAT_NAME' => $user->lang['permission_cat'][$cat])
);
@@ -1179,9 +1199,9 @@ class auth_admin extends auth
'lang' => '{ acl_' . $permission . ' }'
);
}
-
+
$cat = $user->lang['acl_' . $permission]['cat'];
-
+
// Build our categories array
if (!isset($categories[$cat]))
{