diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php | 31 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php | 39 | ||||
-rw-r--r-- | phpBB/phpbb/event/dispatcher.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/event/php_exporter.php | 36 | ||||
-rw-r--r-- | phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/install/module/update_filesystem/task/diff_files.php | 43 | ||||
-rw-r--r-- | phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/pagination.php | 5 | ||||
-rw-r--r-- | phpBB/phpbb/permissions.php | 1 | ||||
-rw-r--r-- | phpBB/phpbb/search/fulltext_sphinx.php | 3 | ||||
-rw-r--r-- | phpBB/phpbb/template/context.php | 88 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/factory.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/textreparser/base.php | 4 |
13 files changed, 184 insertions, 88 deletions
diff --git a/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php new file mode 100644 index 0000000000..49727e5a62 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/f_list_topics_permission_add.php @@ -0,0 +1,31 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v32x; + +class f_list_topics_permission_add extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function update_data() + { + return array( + array('permission.add', array('f_list_topics', false, 'f_read')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php b/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php new file mode 100644 index 0000000000..6e51a01834 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php @@ -0,0 +1,39 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class update_prosilver_bitfield extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_bbcode_bitfield'))), + ); + } + + public function update_bbcode_bitfield() + { + $sql = 'UPDATE ' . STYLES_TABLE . " + SET bbcode_bitfield = '//g=' + WHERE style_path = 'prosilver'"; + $this->sql_query($sql); + } +} diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 1c4abeb108..1ba2ab8987 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -57,7 +57,12 @@ class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_int return $event; } - return parent::dispatch($eventName, $event); + foreach ((array) $eventName as $name) + { + $event = parent::dispatch($name, $event); + } + + return $event; } /** diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 26d7e2b426..7b80863305 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -196,13 +196,13 @@ class php_exporter $content = file_get_contents($this->path . $this->current_file); $num_events_found = 0; - if (strpos($content, "dispatcher->trigger_event('") || strpos($content, "dispatcher->dispatch('")) + if (strpos($content, 'dispatcher->trigger_event(') || strpos($content, 'dispatcher->dispatch(')) { $this->set_content(explode("\n", $content)); for ($i = 0, $num_lines = sizeof($this->file_lines); $i < $num_lines; $i++) { $event_line = false; - $found_trigger_event = strpos($this->file_lines[$i], "dispatcher->trigger_event('"); + $found_trigger_event = strpos($this->file_lines[$i], 'dispatcher->trigger_event('); $arguments = array(); if ($found_trigger_event !== false) { @@ -216,7 +216,7 @@ class php_exporter } else { - $found_dispatch = strpos($this->file_lines[$i], "dispatcher->dispatch('"); + $found_dispatch = strpos($this->file_lines[$i], 'dispatcher->dispatch('); if ($found_dispatch !== false) { $event_line = $i; @@ -316,17 +316,17 @@ class php_exporter if ($is_dispatch) { - $regex = '#\$([a-z](?:[a-z0-9_]|->)*)'; - $regex .= '->dispatch\('; - $regex .= '\'' . $this->preg_match_event_name() . '\''; - $regex .= '\);#'; + $regex = '#\$[a-z](?:[a-z0-9_]|->)*'; + $regex .= '->dispatch\((\[)?'; + $regex .= '\'' . $this->preg_match_event_name() . '(?(1)\', \'(?2))+\''; + $regex .= '(?(1)\])\);#'; } else { - $regex = '#extract\(\$([a-z](?:[a-z0-9_]|->)*)'; - $regex .= '->trigger_event\('; - $regex .= '\'' . $this->preg_match_event_name() . '\''; - $regex .= ', compact\(\$vars\)\)\);#'; + $regex = '#extract\(\$[a-z](?:[a-z0-9_]|->)*'; + $regex .= '->trigger_event\((\[)?'; + $regex .= '\'' . $this->preg_match_event_name() . '(?(1)\', \'(?2))+\''; + $regex .= '(?(1)\]), compact\(\$vars\)\)\);#'; } $match = array(); @@ -359,7 +359,7 @@ class php_exporter public function get_vars_from_array() { $line = ltrim($this->file_lines[$this->current_event_line - 1], "\t"); - if ($line === ');') + if ($line === ');' || $line === '];') { $vars_array = $this->get_vars_from_multi_line_array(); } @@ -370,7 +370,7 @@ class php_exporter foreach ($vars_array as $var) { - if (!preg_match('#^([a-zA-Z_][a-zA-Z0-9_]*)$#', $var)) + if (!preg_match('#^[a-z_][a-z0-9_]*$#i', $var)) { throw new \LogicException("Found invalid var '{$var}' in array for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 3); } @@ -392,11 +392,11 @@ class php_exporter public function get_vars_from_single_line_array($line, $throw_multiline = true) { $match = array(); - preg_match('#^\$vars = (?:\[|array\()\'([a-zA-Z0-9_\' ,]+)\'[\)\]];$#', $line, $match); + preg_match('#^\$vars = (?:(\[)|array\()\'([a-z0-9_\' ,]+)\'(?(1)\]|\));$#i', $line, $match); - if (isset($match[1])) + if (isset($match[2])) { - $vars_array = explode("', '", $match[1]); + $vars_array = explode("', '", $match[2]); if ($throw_multiline && sizeof($vars_array) > 6) { throw new \LogicException('Should use multiple lines for $vars definition ' @@ -420,7 +420,7 @@ class php_exporter { $current_vars_line = 2; $var_lines = array(); - while (ltrim($this->file_lines[$this->current_event_line - $current_vars_line], "\t") !== '$vars = array(') + while (!in_array(ltrim($this->file_lines[$this->current_event_line - $current_vars_line], "\t"), ['$vars = array(', '$vars = ['])) { $var_lines[] = substr(trim($this->file_lines[$this->current_event_line - $current_vars_line]), 0, -1); @@ -485,7 +485,7 @@ class php_exporter foreach ($doc_vars as $var) { - if (!preg_match('#^([a-zA-Z_][a-zA-Z0-9_]*)$#', $var)) + if (!preg_match('#^[a-z_][a-z0-9_]*$#i', $var)) { throw new \LogicException("Found invalid @var '{$var}' in docblock for event " . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 4); diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index bce0149890..dd584eff30 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -187,6 +187,7 @@ class ajax_iohandler extends iohandler_base $tpl_ary['KEY'] = $input_name; $tpl_ary['S_EXPLAIN'] = false; $tpl_ary['DISABLED'] = isset($input_options['disabled']) ? $input_options['disabled'] : false; + $tpl_ary['IS_SECONDARY'] = isset($input_options['is_secondary']) ? $input_options['is_secondary'] : false; if (isset($input_options['default'])) { @@ -218,6 +219,11 @@ class ajax_iohandler extends iohandler_base $this->template->assign_block_vars($block_name, $tpl_ary); } + if (isset($form['database_update_submit']) && !$form['database_update_submit']['disabled']) + { + $this->template->assign_var('FORM_TITLE', $this->language->lang('UPDATE_CONTINUE_UPDATE_PROCESS')); + } + $this->template->assign_var('S_NOT_ONLY_BUTTON_FORM', $not_button_form); if (!$not_button_form) diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index 1792a3b723..8151a24f2d 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -103,8 +103,8 @@ class diff_files extends task_base $old_path = $this->update_helper->get_path_to_old_update_files(); $new_path = $this->update_helper->get_path_to_new_update_files(); - $files_to_diff = $this->installer_config->get('update_files', array()); - $files_to_diff = $files_to_diff['update_with_diff']; + $update_files = $this->installer_config->get('update_files', array()); + $files_to_diff = $update_files['update_with_diff']; // Set progress bar $this->iohandler->set_task_count(count($files_to_diff), true); @@ -154,7 +154,6 @@ class diff_files extends task_base } $diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]); - unset($file_contents); // Handle conflicts if ($diff->get_num_conflicts() !== 0) @@ -162,12 +161,20 @@ class diff_files extends task_base $merge_conflicts[] = $filename; } - // Save merged output - $this->cache->put( - '_file_' . md5($filename), - base64_encode(implode("\n", $diff->merged_output())) - ); + if ($diff->merged_output() !== $file_contents[1]) + { + // Save merged output + $this->cache->put( + '_file_' . md5($filename), + base64_encode(implode("\n", $diff->merged_output())) + ); + } + else + { + unset($update_files['update_with_diff'][$key]); + } + unset($file_contents); unset($diff); } else @@ -199,6 +206,16 @@ class diff_files extends task_base $this->installer_config->set('merge_conflict_list', $merge_conflicts); $this->installer_config->set('file_diff_update_count', $progress_count); + foreach ($update_files as $type => $files) + { + if (empty($files)) + { + unset($update_files[$type]); + } + } + + $this->installer_config->set('update_files', $update_files); + // Request refresh throw new resource_limit_reached_exception(); } @@ -206,6 +223,16 @@ class diff_files extends task_base $this->iohandler->finish_progress('ALL_FILES_DIFFED'); $this->installer_config->set('merge_conflict_list', $merge_conflicts); + + foreach ($update_files as $type => $files) + { + if (empty($files)) + { + unset($update_files[$type]); + } + } + + $this->installer_config->set('update_files', $update_files); } /** diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php index 21aa93b7ea..0b83e9a79d 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php @@ -99,13 +99,14 @@ class download_updated_files extends task_base // Add form to continue update $this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array( 'update_recheck_files_submit' => array( - 'label' => 'UPDATE_RECHECK_UPDATE_FILES', - 'type' => 'submit', + 'label' => 'UPDATE_RECHECK_UPDATE_FILES', + 'type' => 'submit', + 'is_secondary' => empty($file_update_info), ), 'database_update_submit' => array( 'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS', 'type' => 'submit', - 'disabled' => count($file_update_info) > 0, + 'disabled' => !empty($file_update_info), ), )); diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php index a5a95b096d..40af5eda6b 100644 --- a/phpBB/phpbb/pagination.php +++ b/phpBB/phpbb/pagination.php @@ -136,6 +136,11 @@ class pagination */ public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false) { + if (empty($base_url)) + { + return; + } + $total_pages = ceil($num_items / $per_page); $on_page = $this->get_on_page($per_page, $start); $u_previous_page = $u_next_page = ''; diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index c9181e6202..7697884b6a 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -260,6 +260,7 @@ class permissions // Forum Permissions 'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), + 'f_list_topics' => array('lang' => 'ACL_F_LIST_TOPICS', 'cat' => 'actions'), 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), 'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), 'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 59c3d55076..a20e3ad4b5 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -304,7 +304,7 @@ class fulltext_sphinx array('sql_attr_string', 'post_subject'), ), 'source source_phpbb_' . $this->id . '_delta : source_phpbb_' . $this->id . '_main' => array( - array('sql_query_pre', ''), + array('sql_query_pre', 'SET NAMES \'utf8\''), array('sql_query_range', ''), array('sql_range_step', ''), array('sql_query', 'SELECT @@ -324,6 +324,7 @@ class fulltext_sphinx WHERE p.topic_id = t.topic_id AND p.post_id >= ( SELECT max_doc_id FROM ' . SPHINX_TABLE . ' WHERE counter_id=1 )'), + array('sql_query_post_index', ''), ), 'index index_phpbb_' . $this->id . '_main' => array( array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_main'), diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 392efd5933..c1e971c148 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -190,70 +190,50 @@ class context public function assign_block_vars($blockname, array $vararray) { $this->num_rows_is_set = false; - if (strpos($blockname, '.') !== false) - { - // Nested block. - $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; - $str = &$this->tpldata; - for ($i = 0; $i < $blockcount; $i++) - { - $str = &$str[$blocks[$i]]; - $str = &$str[sizeof($str) - 1]; - } - - $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0; - $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; - // Assign S_FIRST_ROW - if (!$s_row_count) - { - $vararray['S_FIRST_ROW'] = true; - } + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; + $block = &$block[$name]; + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block) - 1)); + $block = &$block[$index]; + } - // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blocks[$blockcount]; + // $block = &$block[$blocks[$i]]; // Do not traverse the last block as it might be empty + $name = $blocks[$i]; - // Now the tricky part, we always assign S_LAST_ROW and remove the entry before - // This is much more clever than going through the complete template data on display (phew) - $vararray['S_LAST_ROW'] = true; - if ($s_row_count > 0) - { - unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']); - } + // Assign S_ROW_COUNT and S_ROW_NUM + $s_row_count = isset($block[$name]) ? count($block[$name]) : 0; + $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; - // Now we add the block that we're actually assigning to. - // We're adding a new iteration to this block with the given - // variable assignments. - $str[$blocks[$blockcount]][] = $vararray; - } - else + // Assign S_FIRST_ROW + if (!$s_row_count) { - // Top-level block. - $s_row_count = (isset($this->tpldata[$blockname])) ? sizeof($this->tpldata[$blockname]) : 0; - $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; - - // Assign S_FIRST_ROW - if (!$s_row_count) - { - $vararray['S_FIRST_ROW'] = true; - } - - // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blockname; + $vararray['S_FIRST_ROW'] = true; + } - // We always assign S_LAST_ROW and remove the entry before - $vararray['S_LAST_ROW'] = true; - if ($s_row_count > 0) - { - unset($this->tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); - } + // Assign S_BLOCK_NAME + $vararray['S_BLOCK_NAME'] = $name; - // Add a new iteration to this block with the variable assignments we were given. - $this->tpldata[$blockname][] = $vararray; + // Now the tricky part, we always assign S_LAST_ROW and remove the entry before + // This is much more clever than going through the complete template data on display (phew) + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + { + unset($block[$name][($s_row_count - 1)]['S_LAST_ROW']); } + // Now we add the block that we're actually assigning to. + // We're adding a new iteration to this block with the given + // variable assignments. + $block[$name][] = $vararray; + return true; } diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index d5ad8283d9..15d0a5e3e5 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -78,7 +78,7 @@ class factory implements \phpbb\textformatter\cache_interface 'b' => '[B]{TEXT}[/B]', 'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]', 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', - 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT;optional;postFilter=rawurlencode} body={TEXT;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', + 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT1;optional;postFilter=rawurlencode} body={TEXT2;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', 'i' => '[I]{TEXT}[/I]', 'img' => '[IMG src={IMAGEURL;useContent}]', diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php index 27d7bc1f27..2ee6ea2cb3 100644 --- a/phpBB/phpbb/textreparser/base.php +++ b/phpBB/phpbb/textreparser/base.php @@ -153,8 +153,8 @@ abstract class base implements reparser_interface { // Look for the closing tag inside of a e element, in an element of the same name, e.g. // <e>[/url]</e></URL> - $match = '<e>[/' . $bbcode . ']</e></' . strtoupper($bbcode) . '>'; - if (strpos($record['text'], $match) !== false) + $match = '<e>[/' . $bbcode . ']</e></' . $bbcode . '>'; + if (stripos($record['text'], $match) !== false) { return true; } |