diff --git a/phpBB/common.php b/phpBB/common.php index 93e7fde673..725bc05adf 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -141,7 +141,7 @@ if (!empty($load_extensions)) // Include files require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); -require($phpbb_root_path . 'includes/acm/acm_main.' . $phpEx); +require($phpbb_root_path . 'includes/cache.' . $phpEx); require($phpbb_root_path . 'includes/template.' . $phpEx); require($phpbb_root_path . 'includes/session.' . $phpEx); require($phpbb_root_path . 'includes/auth.' . $phpEx); diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index cd93de4deb..a46f160a10 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1383,7 +1383,7 @@ pagination_sep = \'{PAGINATION_SEP}\' $imgsize_bool = (!empty($imgname) && ($imgsize || preg_match('#\*\d+#', $$imgname))) ? true : false; - $img_info = explode('*', $$imgname); + $img_info = explode('*', $imgname); $template->assign_vars(array( 'S_EDIT_IMAGESET' => true, @@ -1791,7 +1791,7 @@ pagination_sep = \'{PAGINATION_SEP}\' { include($phpbb_root_path . 'includes/functions_compress.' . $phpEx); - $path = str_replace(' ', '_', $style_row[$mode . '_name']); + $path = $style_row[$mode . '_path']; if ($format == 'zip') { @@ -1947,12 +1947,6 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!sizeof($error)) { - // Check if the character set is allowed - if (!preg_match('/^[a-z0-9_\-\+ ]+$/i', $name)) - { - $error[] = $user->lang[$l_type . '_ERR_NAME_CHARS']; - } - // Check length settings if (strlen($name) > 30) { @@ -2216,21 +2210,21 @@ pagination_sep = \'{PAGINATION_SEP}\' /** * Store template files into db */ - function store_templates($mode, $style_id, $name, $filelist) + function store_templates($mode, $style_id, $template_path, $filelist) { global $phpbb_root_path, $phpEx, $db; - $path = str_replace(' ', '_', $name) . '/template/'; + $template_path = $template_path . '/template/'; $includes = array(); foreach ($filelist as $pathfile => $file_ary) { foreach ($file_ary as $file) { - if (!($fp = fopen("{$phpbb_root_path}styles/$path$pathfile$file", 'r'))) + if (!($fp = fopen("{$phpbb_root_path}styles/$template_path$pathfile$file", 'r'))) { - trigger_error("Could not open {$phpbb_root_path}styles/$path$pathfile$file"); + trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file"); } - $template_data = fread($fp, filesize("{$phpbb_root_path}styles/$path$pathfile$file")); + $template_data = fread($fp, filesize("{$phpbb_root_path}styles/$template_path$pathfile$file")); fclose($fp); if (preg_match_all('##is', $template_data, $matches)) @@ -2257,10 +2251,10 @@ pagination_sep = \'{PAGINATION_SEP}\' // heck of a lot of data ... $sql_ary = array( 'template_id' => $style_id, - 'template_filename' => "$pathfile$file", + 'template_filename' => "$template_pathfile$file", 'template_included' => (isset($includes[$file])) ? implode(':', $includes[$file]) . ':' : '', - 'template_mtime' => filemtime("{$phpbb_root_path}styles/$path$pathfile$file"), - 'template_data' => file_get_contents("{$phpbb_root_path}styles/$path$pathfile$file"), + 'template_mtime' => filemtime("{$phpbb_root_path}styles/$template_path$pathfile$file"), + 'template_data' => file_get_contents("{$phpbb_root_path}styles/$template_path$pathfile$file"), ); if ($mode == 'insert') @@ -2447,11 +2441,11 @@ pagination_sep = \'{PAGINATION_SEP}\' { if ($mode == 'style') { - $this->install_style($error, 'install', $root_path, $style_row['style_id'], $style_row['style_name'], $style_row['style_copyright'], $style_row['style_active'], $style_row['style_default'], $style_row); + $this->install_style($error, 'install', $root_path, $style_row['style_id'], $style_row['style_name'], $install_path, $style_row['style_copyright'], $style_row['style_active'], $style_row['style_default'], $style_row); } else { - $style_row['store_db'] = $this->install_element($mode, $error, 'install', $root_path, $style_row[$mode . '_id'], $style_row[$mode . '_name'], $style_row[$mode . '_copyright'], $style_row['store_db']); + $style_row['store_db'] = $this->install_element($mode, $error, 'install', $root_path, $style_row[$mode . '_id'], $style_row[$mode . '_name'], $install_path, $style_row[$mode . '_copyright'], $style_row['store_db']); } if (!sizeof($error)) @@ -2707,7 +2701,7 @@ pagination_sep = \'{PAGINATION_SEP}\' /** * Install/Add style */ - function install_style(&$error, $action, $root_path, &$id, $name, $copyright, $active, $default, &$style_row) + function install_style(&$error, $action, $root_path, &$id, $name, $path, $copyright, $active, $default, &$style_row) { global $config, $db, $user; @@ -2718,12 +2712,6 @@ pagination_sep = \'{PAGINATION_SEP}\' $error[] = $user->lang['STYLE_ERR_STYLE_NAME']; } - // Check if the character set is allowed - if (!preg_match('/^[a-z0-9_\-\+ ]+$/i', $name)) - { - $error[] = $user->lang['STYLE_ERR_NAME_CHARS']; - } - // Check length settings if (strlen($name) > 30) { @@ -2759,7 +2747,7 @@ pagination_sep = \'{PAGINATION_SEP}\' // and do the install if necessary if (!$style_row[$element . '_id']) { - $this->install_element($element, $error, $action, $root_path, $style_row[$element . '_id'], $style_row[$element . '_name'], $style_row[$element . '_copyright']); + $this->install_element($element, $error, $action, $root_path, $style_row[$element . '_id'], $style_row[$element . '_name'], $path, $style_row[$element . '_copyright']); } } @@ -2808,7 +2796,7 @@ pagination_sep = \'{PAGINATION_SEP}\' /** * Install/add an element, doing various checks as we go */ - function install_element($mode, &$error, $action, $root_path, &$id, $name, $copyright, $store_db = 0) + function install_element($mode, &$error, $action, $root_path, &$id, $name, $path, $copyright, $store_db = 0) { global $phpbb_root_path, $db, $user; @@ -2828,19 +2816,12 @@ pagination_sep = \'{PAGINATION_SEP}\' } $l_type = strtoupper($mode); - $path = str_replace(' ', '_', $name); if (!$name) { $error[] = $user->lang[$l_type . '_ERR_STYLE_NAME']; } - // Check if the character set is allowed - if (!preg_match('/^[a-z0-9_\-\+ ]+$/i', $name)) - { - $error[] = $user->lang[$l_type . '_ERR_NAME_CHARS']; - } - // Check length settings if (strlen($name) > 30) { @@ -2930,7 +2911,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if ($mode == 'template' && $store_db) { $filelist = filelist("{$root_path}template", '', 'html'); - $this->store_templates('insert', $id, $name, $filelist); + $this->store_templates('insert', $id, $path, $filelist); } $db->sql_transaction('commit'); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 88edddad50..f655cf9ae0 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1157,7 +1157,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sql = 'SELECT DISTINCT(post_id) FROM ' . REPORTS_TABLE . ' - WHERE post_id IN (' . implode(', ', $post_ids) . ')'; + WHERE post_id IN (' . implode(', ', $post_ids) . ') + AND report_closed = 0'; $result = $db->sql_query($sql); $post_ids = array(); diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index f35f84497b..d98293dd0f 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -18,10 +18,8 @@ * http://phpjabber.g-blog.net (not many doc comments in here, sorry) * * last modified: 27.04.2003 13:01:53 CET -* * -* Modified by psoTFX, phpBB Group, 2003. -* Removed functions/support not critical to integration with phpBB +* Modified by members of the phpBB Group * * @package phpBB3 */ diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 85a89a3aa9..ff9867d11c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1139,7 +1139,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) if (!delete_posts('post_id', array($post_id), false, false)) { // Try to delete topic, we may had an previous error causing inconsistency - if ($post_mode = 'delete_topic') + if ($post_mode == 'delete_topic') { delete_topics('topic_id', array($topic_id), false); } @@ -1148,7 +1148,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $db->sql_transaction('commit'); - // Collect the necessary informations for updating the tables + // Collect the necessary information for updating the tables $sql_data[FORUMS_TABLE] = ''; switch ($post_mode) { @@ -1168,8 +1168,6 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); } - - $sql_data[TOPICS_TABLE] = 'topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : ''); break; case 'delete_first_post': @@ -1291,6 +1289,11 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) } } + if ($data['post_reported'] && ($post_mode != 'delete_topic')) + { + sync('topic_reported', 'topic_id', array($topic_id)); + } + return $next_post_id; } diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 9b484e4327..f9e0494fc8 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -57,10 +57,16 @@ function mcp_post_details($id, $mode, $action) case 'chgposter': case 'chgposter_ip': - $username = request_var('username', '', true); - $new_user_id = request_var('u', 0); - - $sql_where = ($new_user_id) ? 'user_id = ' . $new_user_id : "username = '" . $db->sql_escape($username) . "'"; + if ($action == 'chgposter') + { + $username = request_var('username', '', true); + $sql_where = "username = '" . $db->sql_escape($username) . "'"; + } + else + { + $new_user_id = request_var('u', 0); + $sql_where = 'user_id = ' . $new_user_id; + } $sql = 'SELECT * FROM ' . USERS_TABLE . ' diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index be5669b702..8c9ecf6754 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1113,7 +1113,7 @@ class parse_message extends bbcode_firstpass if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $upload_file) { - if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_')) + if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) { $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message); $error = $filedata['error']; diff --git a/phpBB/posting.php b/phpBB/posting.php index 1ad35959e4..a5a5558adf 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1256,6 +1256,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], + 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'] ); diff --git a/phpBB/report.php b/phpBB/report.php index 3a0ad3e82d..5e5a9870d8 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -59,6 +59,17 @@ if (!$report_data) $forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id; $topic_id = (int) $report_data['topic_id']; +$sql = 'SELECT * + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; +$result = $db->sql_query($sql); +$forum_data = $db->sql_fetchrow($result); + +if (!$forum_data) +{ + trigger_error('FORUM_NOT_EXIST'); +} + // Check required permissions $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); @@ -140,7 +151,7 @@ $template->assign_vars(array( 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false) ); -generate_forum_nav($report_data); +generate_forum_nav($forum_data); // Start output of page page_header($user->lang['REPORT_POST']); diff --git a/phpBB/styles/subSilver/template/editor.js b/phpBB/styles/subSilver/template/editor.js index ef52b65998..3fd5c6b8ad 100644 --- a/phpBB/styles/subSilver/template/editor.js +++ b/phpBB/styles/subSilver/template/editor.js @@ -147,12 +147,12 @@ function bbfontstyle(bbopen, bbclose) */ function insert_text(text) { - if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) + if (document.forms[form_name].elements[text_name].createTextRange && !isNaN(document.forms[form_name].elements[text_name].caretPos)) { var caretPos = document.forms[form_name].elements[text_name].caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text; } - else if (document.forms[form_name].elements[text_name].selectionStart) + else if (!isNaN(document.forms[form_name].elements[text_name].selectionStart)) { var selStart = document.forms[form_name].elements[text_name].selectionStart; var selEnd = document.forms[form_name].elements[text_name].selectionEnd;