diff options
Diffstat (limited to 'phpBB/modules')
23 files changed, 251 insertions, 168 deletions
diff --git a/phpBB/modules/acp/acp_attachments.php b/phpBB/modules/acp/acp_attachments.php index 580490d472..a6c35acdbd 100644 --- a/phpBB/modules/acp/acp_attachments.php +++ b/phpBB/modules/acp/acp_attachments.php @@ -1002,8 +1002,8 @@ class acp_attachments if ($files_added) { - set_config('upload_dir_size', phpbb::$config['upload_dir_size'] + $space_taken, true); - set_config('num_files', phpbb::$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/modules/acp/acp_captcha.php b/phpBB/modules/acp/acp_captcha.php index e4a269aaed..3ffefa85a1 100644 --- a/phpBB/modules/acp/acp_captcha.php +++ b/phpBB/modules/acp/acp_captcha.php @@ -52,6 +52,8 @@ class acp_captcha $config_vars = array( 'enable_confirm' => 'REG_ENABLE', 'enable_post_confirm' => 'POST_ENABLE', + 'confirm_refresh' => 'CONFIRM_REFRESH', + 'captcha_gd' => 'CAPTCHA_GD', ); $this->tpl_name = 'acp_captcha'; diff --git a/phpBB/modules/acp/acp_email.php b/phpBB/modules/acp/acp_email.php index 3fc3db2055..b0dbb87641 100644 --- a/phpBB/modules/acp/acp_email.php +++ b/phpBB/modules/acp/acp_email.php @@ -118,7 +118,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) { diff --git a/phpBB/modules/acp/acp_forums.php b/phpBB/modules/acp/acp_forums.php index 047636c6a1..d0581a2a68 100644 --- a/phpBB/modules/acp/acp_forums.php +++ b/phpBB/modules/acp/acp_forums.php @@ -180,7 +180,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) || (phpbb::$acl->acl_get('a_fauth') && phpbb::$acl->acl_get('a_authusers') && phpbb::$acl->acl_get('a_authgroups') && phpbb::$acl->acl_get('a_mauth')))) { // if we edit a forum delete current permissions first @@ -557,13 +557,12 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = phpbb::$db->sql_query($sql); + $result = phpbb::$db->sql_query_limit($sql, 1); + $postable_forum_exists = false; if (phpbb::$db->sql_fetchrow($result)) { - phpbb::$template->assign_vars(array( - 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false), - )); + $postable_forum_exists = true; } phpbb::$db->sql_freeresult($result); @@ -580,25 +579,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 = phpbb::$db->sql_query($sql); - - if (phpbb::$db->sql_fetchrow($result)) + if ($postable_forum_exists) { phpbb::$template->assign_vars(array( 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id), // , false, true, false??? )); } - phpbb::$db->sql_freeresult($result); phpbb::$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; @@ -711,7 +709,7 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = phpbb::$db->sql_query($sql); + $result = phpbb::$db->sql_query_limit($sql, 1); if (phpbb::$db->sql_fetchrow($result)) { @@ -804,10 +802,6 @@ class acp_forums $url = $this->u_action . "&parent_id=$this->parent_id&f={$row['forum_id']}"; - $forum_title = ($forum_type != FORUM_LINK) ? '<a href="' . $this->u_action . '&parent_id=' . $row['forum_id'] . '">' : ''; - $forum_title .= $row['forum_name']; - $forum_title .= ($forum_type != FORUM_LINK) ? '</a>' : ''; - phpbb::$template->assign_block_vars('forums', array( 'FOLDER_IMAGE' => $folder_image, 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="" />' : '', @@ -919,6 +913,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/modules/acp/acp_inactive.php b/phpBB/modules/acp/acp_inactive.php index 89583575db..d93b2146a6 100644 --- a/phpBB/modules/acp/acp_inactive.php +++ b/phpBB/modules/acp/acp_inactive.php @@ -108,6 +108,7 @@ class acp_inactive $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username'])) @@ -158,7 +159,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 ' . phpbb::$db->sql_in_set('user_id', $mark); + WHERE ' . phpbb::$db->sql_in_set('user_id', $mark) . ' + AND user_inactive_reason'; + + $sql .= (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL; + $result = phpbb::$db->sql_query($sql); if ($row = phpbb::$db->sql_fetchrow($result)) @@ -176,9 +181,14 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); + $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), - 'REGISTER_DATE' => phpbb::$user->format_date($row['user_regdate']), + 'REGISTER_DATE' => phpbb::$user->format_date($row['user_regdate'], false, true), 'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . '?mode=activate&u=' . $row['user_id'] . '&k=' . $row['user_actkey']) ); diff --git a/phpBB/modules/acp/acp_jabber.php b/phpBB/modules/acp/acp_jabber.php index d9c192601c..875998a00c 100644 --- a/phpBB/modules/acp/acp_jabber.php +++ b/phpBB/modules/acp/acp_jabber.php @@ -85,7 +85,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/modules/acp/acp_main.php b/phpBB/modules/acp/acp_main.php index fb66f5dc15..a7d3dbf0cf 100644 --- a/phpBB/modules/acp/acp_main.php +++ b/phpBB/modules/acp/acp_main.php @@ -503,6 +503,12 @@ class acp_main phpbb::$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) & 0x0002)); } + // Fill dbms version if not yet filled + if (empty(phpbb::$config['dbms_version'])) + { + set_config('dbms_version', phpbb::$db->sql_server_info(true)); + } + $this->tpl_name = 'acp_main'; $this->page_title = 'ACP_MAIN'; } diff --git a/phpBB/modules/acp/acp_permissions.php b/phpBB/modules/acp/acp_permissions.php index d9db7b1bf0..85b2cda164 100644 --- a/phpBB/modules/acp/acp_permissions.php +++ b/phpBB/modules/acp/acp_permissions.php @@ -1121,7 +1121,11 @@ class acp_permissions { $sql_where = 'AND (' . phpbb::$db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . phpbb::$db->sql_in_set('a.auth_role_id', $role_ids) . ')'; } - else + else if (sizeof($role_ids)) + { + $sql_where = 'AND ' . phpbb::$db->sql_in_set('a.auth_role_id', $role_ids); + } + else if (sizeof($option_ids)) { $sql_where = 'AND ' . phpbb::$db->sql_in_set('a.auth_option_id', $option_ids); } diff --git a/phpBB/modules/acp/acp_styles.php b/phpBB/modules/acp/acp_styles.php index 4f21a44e1d..a087348b36 100644 --- a/phpBB/modules/acp/acp_styles.php +++ b/phpBB/modules/acp/acp_styles.php @@ -1101,139 +1101,142 @@ parse_css_file = {PARSE_CSS_FILE} { $this->page_title = 'EDIT_IMAGESET'; + if (!$imageset_id) + { + trigger_error(phpbb::$user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $update = phpbb_request::is_set_post('update'); + $imgname = request_var('imgname', 'site_logo'); + $imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname); + $sql_extra = $imgnamelang = ''; - $imgname = request_var('imgname', ''); - $imgpath = request_var('imgpath', ''); - $imgsize = request_var('imgsize', false); - $imgwidth = request_var('imgwidth', 0); - $imgheight = request_var('imgheight', 0); + $sql = 'SELECT imageset_path, imageset_name + FROM ' . STYLES_IMAGESET_TABLE . " + WHERE imageset_id = $imageset_id"; + $result = phpbb::$db->sql_query($sql); + $imageset_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); - $imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname); - $imgpath = str_replace('..', '.', $imgpath); + if (!$imageset_row) + { + trigger_error(phpbb::$user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + } - if ($imageset_id) + $imageset_path = $imageset_row['imageset_path']; + $imageset_name = $imageset_row['imageset_name']; + + if (strpos($imgname, '-') !== false) { - $sql = 'SELECT imageset_path, imageset_name - FROM ' . STYLES_IMAGESET_TABLE . " - WHERE imageset_id = $imageset_id"; - $result = phpbb::$db->sql_query($sql); - $imageset_row = phpbb::$db->sql_fetchrow($result); - phpbb::$db->sql_freeresult($result); + list($imgname, $imgnamelang) = explode('-', $imgname); + $sql_extra = " AND image_lang IN ('" . phpbb::$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 = '" . phpbb::$db->sql_escape($imgname) . "'$sql_extra"; + $result = phpbb::$db->sql_query($sql); + $imageset_data_row = phpbb::$db->sql_fetchrow($result); + phpbb::$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; - $imageset_path = $imageset_row['imageset_path']; - $imageset_name = $imageset_row['imageset_name']; + // Check to see whether the selected image exists in the table + $valid_name = ($update) ? false : true; - $sql_extra = ''; - if (strpos($imgname, '-') !== false) + 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 ('" . phpbb::$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 = '" . phpbb::$db->sql_escape($imgname) . "'$sql_extra"; - $result = phpbb::$db->sql_query($sql); - $imageset_data_row = phpbb::$db->sql_fetchrow($result); - phpbb::$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 && phpbb_request::is_set_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(phpbb::$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(phpbb::$user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } - if ($update && phpbb_request::is_set_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(phpbb::$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 ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " - WHERE image_id = $image_id"; - phpbb::$db->sql_query($sql); - } - // does not exist - else if (!$imageset_data_row) - { - $sql_ary['image_name'] = $imgname; - $sql_ary['imageset_id'] = (int) $imageset_id; - phpbb::$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); - } + // already exists + if ($imageset_data_row) + { + $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " + WHERE image_id = $image_id"; + phpbb::$db->sql_query($sql); + } + // does not exist + else if (!$imageset_data_row) + { + $sql_ary['image_name'] = $imgname; + $sql_ary['imageset_id'] = (int) $imageset_id; + phpbb::$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); + } - phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); + phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); - add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name); + add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name); - phpbb::$template->assign_var('SUCCESS', true); + phpbb::$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 = ''; @@ -1355,6 +1358,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, diff --git a/phpBB/modules/acp/acp_users.php b/phpBB/modules/acp/acp_users.php index c012612a24..54296c386c 100644 --- a/phpBB/modules/acp/acp_users.php +++ b/phpBB/modules/acp/acp_users.php @@ -971,6 +971,7 @@ class acp_users { $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id $where_sql"; phpbb::$db->sql_query($sql); diff --git a/phpBB/modules/acp/auth.php b/phpBB/modules/acp/auth.php index 396b66c76f..b1dae06cea 100644 --- a/phpBB/modules/acp/auth.php +++ b/phpBB/modules/acp/auth.php @@ -679,6 +679,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'; @@ -686,15 +687,7 @@ class auth_admin extends auth while ($row = phpbb::$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'); } phpbb::$db->sql_freeresult($result); @@ -709,14 +702,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; } @@ -727,23 +717,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; } } - phpbb::$db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary); + if (!empty($add_options)) + { + phpbb::$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 ' . phpbb::$db->sql_in_set('auth_option', $update_options); + phpbb::$db->sql_query($sql); + } phpbb::$acm->destroy('acl_options'); $this->acl_clear_prefetch(); diff --git a/phpBB/modules/mcp/mcp_main.php b/phpBB/modules/mcp/mcp_main.php index 8a9a930678..b2b71722e2 100644 --- a/phpBB/modules/mcp/mcp_main.php +++ b/phpBB/modules/mcp/mcp_main.php @@ -909,6 +909,11 @@ function mcp_delete_post($post_ids) } else { + if ($affected_topics != 1 || $deleted_topics || !$topic_id) + { + $redirect = append_sid('mcp', "f=$forum_id&i=main&mode=forum_view", false); + } + meta_refresh(3, $redirect); trigger_error($success_msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link)); } @@ -1160,8 +1165,8 @@ function mcp_fork_topic($topic_ids) } sync('forum', 'forum_id', $to_forum_id); - set_config('num_topics', phpbb::$config['num_topics'] + sizeof($new_topic_id_list), true); - set_config('num_posts', phpbb::$config['num_posts'] + $total_posts, true); + set_config_count('num_topics', sizeof($new_topic_id_list), true); + set_config_count('num_posts', $total_posts, true); foreach ($new_topic_id_list as $topic_id => $new_topic_id) { diff --git a/phpBB/modules/mcp/mcp_notes.php b/phpBB/modules/mcp/mcp_notes.php index b39f10428c..ed0bf373bf 100644 --- a/phpBB/modules/mcp/mcp_notes.php +++ b/phpBB/modules/mcp/mcp_notes.php @@ -220,13 +220,16 @@ class mcp_notes 'PAGINATION' => generate_pagination($this->u_action . "&st=$st&sk=$sk&sd=$sd", $log_count, phpbb::$config['posts_per_page'], $start), 'TOTAL_REPORTS' => ($log_count == 1) ? phpbb::$user->lang['LIST_REPORT'] : sprintf(phpbb::$user->lang['LIST_REPORTS'], $log_count), - 'USERNAME' => $userrow['username'], - 'USER_COLOR' => (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => phpbb::$user->format_date($userrow['user_regdate']), 'POSTS' => ($userrow['user_posts']) ? $userrow['user_posts'] : 0, 'WARNINGS' => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0, + 'USERNAME_FULL' => get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME' => get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'U_PROFILE' => get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, )); diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php index 147a63cf59..ff4698b117 100644 --- a/phpBB/modules/mcp/mcp_queue.php +++ b/phpBB/modules/mcp/mcp_queue.php @@ -488,12 +488,18 @@ function approve_post($post_id_list, $id, $mode) $total_topics = $total_posts = 0; $forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); - $user_posts_sql = array(); + $user_posts_sql = $post_approved_list = array(); $update_forum_information = false; foreach ($post_info as $post_id => $post_data) { + if ($post_data['post_approved']) + { + $post_approved_list[] = $post_id; + continue; + } + $topic_id_list[$post_data['topic_id']] = 1; if ($post_data['forum_id']) @@ -579,6 +585,11 @@ function approve_post($post_id_list, $id, $mode) $update_forum_information = true; } } + $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); + for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) + { + unset($post_info[$post_approved_list[$i]]); + } if (sizeof($topic_approve_sql)) { @@ -648,12 +659,12 @@ function approve_post($post_id_list, $id, $mode) if ($total_topics) { - set_config('num_topics', phpbb::$config['num_topics'] + $total_topics, true); + set_config_count('num_topics', $total_topics, true); } if ($total_posts) { - set_config('num_posts', phpbb::$config['num_posts'] + $total_posts, true); + set_config_count('num_posts', $total_posts, true); } unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql); @@ -729,7 +740,7 @@ function approve_post($post_id_list, $id, $mode) } else { - $success_msg = (sizeof($post_id_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS'; + $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS'; } } else diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php index c5a8a3fa88..91579b1059 100644 --- a/phpBB/modules/mcp/mcp_topic.php +++ b/phpBB/modules/mcp/mcp_topic.php @@ -496,7 +496,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Update forum statistics - set_config('num_topics', phpbb::$config['num_topics'] + 1, true); + set_config_count('num_topics', 1, true); // Link back to both topics $return_link = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); diff --git a/phpBB/modules/mcp/mcp_warn.php b/phpBB/modules/mcp/mcp_warn.php index 6b3f896ae4..734a61b8f2 100644 --- a/phpBB/modules/mcp/mcp_warn.php +++ b/phpBB/modules/mcp/mcp_warn.php @@ -407,13 +407,16 @@ class mcp_warn phpbb::$template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, - 'USERNAME' => $user_row['username'], - 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => phpbb::$user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, + 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, diff --git a/phpBB/modules/ucp/ucp_activate.php b/phpBB/modules/ucp/ucp_activate.php index 2738da4275..0f1d122a42 100644 --- a/phpBB/modules/ucp/ucp_activate.php +++ b/phpBB/modules/ucp/ucp_activate.php @@ -69,6 +69,8 @@ class ucp_activate SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; phpbb::$db->sql_query($sql); + + add_log('user', $user_row['user_id'], 'LOG_USER_NEW_PASSWORD', $user_row['username']); } if (!$update_password) diff --git a/phpBB/modules/ucp/ucp_groups.php b/phpBB/modules/ucp/ucp_groups.php index 98ca194a68..c8627802e2 100644 --- a/phpBB/modules/ucp/ucp_groups.php +++ b/phpBB/modules/ucp/ucp_groups.php @@ -336,7 +336,7 @@ class ucp_groups 'S_GROUP_DEFAULT' => ($row['group_id'] == phpbb::$user->data['group_id']) ? true : false, )); - $group_id_ary[] = $row['group_id']; + $group_id_ary[] = (int) $row['group_id']; } phpbb::$db->sql_freeresult($result); diff --git a/phpBB/modules/ucp/ucp_main.php b/phpBB/modules/ucp/ucp_main.php index 587ebe2dd9..8bd03baf49 100644 --- a/phpBB/modules/ucp/ucp_main.php +++ b/phpBB/modules/ucp/ucp_main.php @@ -634,6 +634,9 @@ class ucp_main $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; $start = request_var('start', 0); + // Grab icons + $icons = phpbb_cache::obtain_icons(); + $sql_array = array( 'SELECT' => 'COUNT(t.topic_id) as topics_count', @@ -805,6 +808,7 @@ class ucp_main 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), + 'TOPIC_FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', diff --git a/phpBB/modules/ucp/ucp_pm_compose.php b/phpBB/modules/ucp/ucp_pm_compose.php index 507ff2bdc2..122e08bc41 100644 --- a/phpBB/modules/ucp/ucp_pm_compose.php +++ b/phpBB/modules/ucp/ucp_pm_compose.php @@ -1029,6 +1029,7 @@ function compose_pm($id, $mode, $action) 'FLASH_STATUS' => ($flash_status) ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? phpbb::$user->lang['SMILIES_ARE_ON'] : phpbb::$user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => ($url_status) ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) phpbb::$config['max_post_font_size'], 'MINI_POST_IMG' => phpbb::$user->img('icon_post_target', phpbb::$user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'MAX_RECIPIENTS' => (phpbb::$config['allow_mass_pm'] && (phpbb::$acl->acl_get('u_masspm') || phpbb::$acl->acl_get('u_masspm_group'))) ? $max_recipients : 0, diff --git a/phpBB/modules/ucp/ucp_profile.php b/phpBB/modules/ucp/ucp_profile.php index 7bd748dcad..7c2edb2a80 100644 --- a/phpBB/modules/ucp/ucp_profile.php +++ b/phpBB/modules/ucp/ucp_profile.php @@ -347,11 +347,11 @@ class ucp_profile { $data['notify'] = phpbb::$user->data['user_notify_type']; - if (!phpbb::$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) + if ($data['notify'] == NOTIFY_IM && (!phpbb::$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))) { // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) // Disable notify by Jabber now for this user. - $data['notify'] = NOTIFY_BOTH; + $data['notify'] = NOTIFY_EMAIL; } $sql_ary = array( @@ -547,6 +547,7 @@ class ucp_profile 'IMG_STATUS' => (phpbb::$config['allow_sig_img']) ? phpbb::$user->lang['IMAGES_ARE_ON'] : phpbb::$user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => (phpbb::$config['allow_sig_flash']) ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], 'URL_STATUS' => (phpbb::$config['allow_sig_links']) ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) phpbb::$config['max_sig_font_size'], 'L_SIGNATURE_EXPLAIN' => sprintf(phpbb::$user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), diff --git a/phpBB/modules/ucp/ucp_register.php b/phpBB/modules/ucp/ucp_register.php index 20402883cf..ee721f4f3a 100644 --- a/phpBB/modules/ucp/ucp_register.php +++ b/phpBB/modules/ucp/ucp_register.php @@ -50,7 +50,6 @@ class ucp_register add_form_key('ucp_register_terms'); } - if (phpbb::$config['enable_confirm']) { include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); @@ -466,6 +465,7 @@ class ucp_register 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), + 'S_CONFIRM_REFRESH' => (phpbb::$config['enable_confirm'] && phpbb::$config['confirm_refresh']) ? true : false, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid('ucp', 'mode=register'), diff --git a/phpBB/modules/ucp/ucp_resend.php b/phpBB/modules/ucp/ucp_resend.php index 1ee8a976ea..56579d42ba 100644 --- a/phpBB/modules/ucp/ucp_resend.php +++ b/phpBB/modules/ucp/ucp_resend.php @@ -130,6 +130,11 @@ class ucp_resend $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); + $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_USER_DETAILS' => generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$user_row['user_id']}", |