diff options
51 files changed, 394 insertions, 275 deletions
diff --git a/build/package.php b/build/package.php index 48f42b3572..eef6765af6 100755 --- a/build/package.php +++ b/build/package.php @@ -121,6 +121,7 @@ if (sizeof($package->old_packages)) $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $dest_filename_dir); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $dest_filename_dir); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $dest_filename_dir); $package->run_command('mkdir ' . $dest_filename_dir . '/install/update'); $package->run_command('mkdir ' . $dest_filename_dir . '/install/update/old'); @@ -256,6 +257,7 @@ $update_info = array( // Copy the install files to their respective locations $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('patch_directory')); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('patch_directory')); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('patch_directory')); // Remove some files chdir($package->get('patch_directory') . '/install'); diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index b5fa46dbf6..57e2c8ffea 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -109,27 +109,14 @@ <!-- ENDIF --> </fieldset> - <!-- IF not S_UP_TO_DATE --> - - <form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}"> - - <fieldset class="submit-buttons"> - <p>{L_UPDATE_DATABASE_EXPLAIN}</p> - <input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" /> - </fieldset> - - </form> - - <!-- ELSE --> - <form id="install_update" method="post" action="{U_ACTION}"> + <form id="install_update" method="post" action="{U_ACTION}"> - <fieldset class="submit-buttons"> - <p>{L_CHECK_FILES_UP_TO_DATE}</p> - <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> - </fieldset> + <fieldset class="submit-buttons"> + <p>{L_CHECK_FILES_EXPLAIN}</p> + <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> + </fieldset> - </form> - <!-- ENDIF --> + </form> <!-- ELSEIF S_DB_UPDATE --> @@ -155,29 +142,29 @@ <!-- ELSE --> - <h1>{L_UPDATE_DB_SUCCESS}</h1> + <div class="successbox"> + <h3>{L_UPDATE_SUCCESS}</h3> + <p>{L_EVERYTHING_UP_TO_DATE}</p> + </div> - <br /><br /> + <!-- ENDIF --> - <form id="install_update" method="post" action="{U_ACTION}"> +<!-- ELSEIF S_FILE_CHECK --> - <fieldset class="submit-buttons"> - <p>{L_CHECK_FILES_EXPLAIN}</p> - <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> - </fieldset> + <!-- IF S_ALL_UP_TO_DATE --> - </form> + <h1>{L_UPDATE_FILE_SUCCESS}</h1> + <p>{L_ALL_FILES_UP_TO_DATE}</p> - <!-- ENDIF --> + <p>{L_UPDATE_DATABASE_EXPLAIN}</p> -<!-- ELSEIF S_FILE_CHECK --> + <form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}"> - <!-- IF S_ALL_UP_TO_DATE --> + <fieldset class="submit-buttons"> + <input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" /> + </fieldset> - <div class="successbox"> - <h3>{L_UPDATE_SUCCESS}</h3> - <p>{L_ALL_FILES_UP_TO_DATE}</p> - </div> + </form> <!-- ELSE --> <h1>{L_COLLECTED_INFORMATION}</h1> diff --git a/phpBB/develop/blank.gif b/phpBB/develop/blank.gif new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/phpBB/develop/blank.gif diff --git a/phpBB/develop/blank.jpg b/phpBB/develop/blank.jpg new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/phpBB/develop/blank.jpg diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index f63dde0614..7cbfa17a0e 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -118,7 +118,10 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) */ function phpbb_create_install_container($phpbb_root_path, $php_ext) { - $core = new phpbb_di_extension_core($phpbb_root_path); + $other_config_path = $phpbb_root_path . 'install/update/new/config/'; + $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; + + $core = new phpbb_di_extension_core($config_path); $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); $container->setParameter('core.root_path', $phpbb_root_path); @@ -136,6 +139,32 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) } /** +* Create updater container +* +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @param array $config_path Path to config directory +* @return ContainerBuilder object (compiled) +*/ +function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) +{ + $config_file = $phpbb_root_path . 'config.' . $php_ext; + return phpbb_create_compiled_container( + $config_file, + array( + new phpbb_di_extension_config($config_file), + new phpbb_di_extension_core($config_path), + ), + array( + new phpbb_di_pass_collection_pass(), + new phpbb_di_pass_kernel_pass(), + ), + $phpbb_root_path, + $php_ext + ); +} + +/** * Create a compiled ContainerBuilder object * * @param array $extensions Array of Container extension objects @@ -146,11 +175,6 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) */ function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) { - $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); - - // Now pass the enabled extension paths into the ext compiler extension - $extensions[] = new phpbb_di_extension_ext($installed_exts); - // Create the final container to be compiled and cached $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); @@ -231,11 +255,14 @@ function phpbb_create_dumped_container_unless_debug($config_file, array $extensi function phpbb_create_default_container($phpbb_root_path, $php_ext) { $config_file = $phpbb_root_path . 'config.' . $php_ext; + $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); + return phpbb_create_dumped_container_unless_debug( $config_file, array( new phpbb_di_extension_config($config_file), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), + new phpbb_di_extension_ext($installed_exts), ), array( new phpbb_di_pass_collection_pass(), diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 72400ce623..3f48c58073 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -187,7 +187,7 @@ class mcp_reports 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == POST_UNAPPROVED), + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED), 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index b282258c08..9c294b96c8 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -669,10 +669,10 @@ function merge_posts($topic_id, $to_topic_id) } // If the topic no longer exist, we will update the topic watch table. - phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id); + phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', array($topic_id), $to_topic_id); // If the topic no longer exist, we will update the bookmarks table. - phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id); + phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id); } // Link to the new topic diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index cd6fb7931b..3be5ea659c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -21,26 +21,6 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (!function_exists('phpbb_require_updated')) -{ - function phpbb_require_updated($path, $optional = false) - { - global $phpbb_root_path; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - require($new_path); - } - else if (!$optional || file_exists($old_path)) - { - require($old_path); - } - } -} - function phpbb_end_update($cache, $config) { $cache->purge(); @@ -69,7 +49,7 @@ function phpbb_end_update($cache, $config) exit_handler(); } -phpbb_require_updated('includes/startup.' . $phpEx); +require($phpbb_root_path . 'includes/startup.' . $phpEx); include($phpbb_root_path . 'config.' . $phpEx); if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) @@ -88,7 +68,9 @@ require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); require($phpbb_root_path . 'includes/functions_container.' . $phpEx); +require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); +include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours @@ -101,11 +83,10 @@ $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) $container_extensions = array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config/'), ); $container_passes = array( new phpbb_di_pass_collection_pass(), - //new phpbb_di_pass_kernel_pass(), ); $phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx); @@ -263,8 +244,8 @@ while (!$migrator->finished()) // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $update_start_time) >= $safe_time_limit) { - echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br />'; - echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&language=' . $user->lang['USER_LANG']) . '">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>'; + echo '<br />' . $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br /><br />'; + echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>'; phpbb_end_update($cache, $config); } @@ -280,7 +261,7 @@ echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />'; if ($request->variable('type', 0)) { echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />'; - echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&sub=file_check&language=' . $user->lang['USER_LANG']) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>'; + echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&sub=update_db&language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>'; } else { diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 45e5777e36..bd39e231f4 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -28,7 +28,7 @@ if (version_compare(PHP_VERSION, '5.3.3') < 0) function phpbb_require_updated($path, $optional = false) { - global $phpbb_root_path; + global $phpbb_root_path, $table_prefix; $new_path = $phpbb_root_path . 'install/update/new/' . $path; $old_path = $phpbb_root_path . $path; @@ -43,6 +43,23 @@ function phpbb_require_updated($path, $optional = false) } } +function phpbb_include_updated($path, $optional = false) +{ + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + include($new_path); + } + else if (!$optional || file_exists($old_path)) + { + include($old_path); + } +} + phpbb_require_updated('includes/startup.' . $phpEx); // Try to override some limits - maybe it helps some... @@ -78,18 +95,21 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include essential scripts -require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); +phpbb_require_updated('phpbb/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); +phpbb_require_updated('includes/functions.' . $phpEx); +phpbb_require_updated('includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); -include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); -require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +phpbb_include_updated('includes/functions_admin.' . $phpEx); +phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx); +phpbb_include_updated('includes/utf/utf_tools.' . $phpEx); +phpbb_require_updated('includes/functions_install.' . $phpEx); // Setup class loader first +$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx); +$phpbb_class_loader_new->register(); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); @@ -108,7 +128,7 @@ $request = $phpbb_container->get('request'); request_var('', 0, false, false, $request); // "dependency injection" for a function // Try and load an appropriate language if required -$language = basename(request_var('language', '')); +$language = basename($request->variable('language', '')); if ($request->header('Accept-Language') && !$language) { @@ -167,11 +187,23 @@ if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_r } // And finally, load the relevant language files -include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx); +$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting'); +$new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/'; +$old_path = $phpbb_root_path . 'language/' . $language . '/'; + +// NOTE: we can not use "phpbb_include_updated" as the files uses vars which would be required +// to be global while loading. +foreach ($load_lang_files as $lang_file) +{ + if (file_exists($new_path . $lang_file . '.' . $phpEx)) + { + include($new_path . $lang_file . '.' . $phpEx); + } + else + { + include($old_path . $lang_file . '.' . $phpEx); + } +} // usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :( @@ -181,8 +213,8 @@ define('CHMOD_READ', 4); define('CHMOD_WRITE', 2); define('CHMOD_EXECUTE', 1); -$mode = request_var('mode', 'overview'); -$sub = request_var('sub', ''); +$mode = $request->variable('mode', 'overview'); +$sub = $request->variable('sub', ''); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); @@ -217,7 +249,11 @@ $phpbb_style_path_provider = new phpbb_style_path_provider(); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + +$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); +$paths = array_filter($paths, 'is_dir'); +$phpbb_style->set_custom_style('admin', $paths, array(), ''); + $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 0cd203eda8..4ae39f202f 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -39,7 +39,7 @@ if (!empty($setmodules)) 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), 'module_order' => 30, 'module_subs' => '', - 'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'), + 'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'), 'module_reqs' => '' ); } @@ -73,8 +73,13 @@ class install_update extends module global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; + // We must enable super globals, otherwise creating a new instance of the request class, + // using the new container with a dbal connection will fail with the following PHP Notice: + // Object of class phpbb_request_deactivated_super_global could not be converted to int + $request->enable_super_globals(); + // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); + $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); // Writes into global $cache $cache = $phpbb_container->get('cache'); @@ -123,7 +128,7 @@ class install_update extends module $config['default_lang'] = $language; $user->data['user_lang'] = $language; - $user->setup(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + $user->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); // Reset the default_lang $config['default_lang'] = $config_default_lang; @@ -136,7 +141,9 @@ class install_update extends module } // Set custom template again. ;) - $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); + $paths = array_filter($paths, 'is_dir'); + $phpbb_style->set_custom_style('admin', $paths, array(), ''); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], @@ -216,12 +223,6 @@ class install_update extends module if ($this->test_update === false) { - // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present - if (in_array($phpbb_adm_relative_path . 'style/install_update.html', $this->update_info['files'])) - { - $this->tpl_name = '../../install/update/new/adm/style/install_update'; - } - // What about the language file? Got it updated? if (in_array('language/' . $language . '/install.' . $phpEx, $this->update_info['files'])) { @@ -274,15 +275,14 @@ class install_update extends module $this->page_title = 'STAGE_VERSION_CHECK'; $template->assign_vars(array( - 'S_UP_TO_DATE' => $up_to_date, 'S_VERSION_CHECK' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'S_UP_TO_DATE' => $up_to_date, 'LATEST_VERSION' => $this->latest_version, - 'CURRENT_VERSION' => $this->current_version) - ); + 'CURRENT_VERSION' => $this->current_version, + )); // Print out version the update package updates to if ($this->latest_version != $this->update_info['version']['to']) @@ -303,30 +303,6 @@ class install_update extends module break; case 'update_db': - - // Make sure the database update is valid for the latest version - $valid = false; - $updates_to_version = ''; - - if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx)) - { - include_once($phpbb_root_path . 'install/database_update.' . $phpEx); - - if ($updates_to_version === $this->update_info['version']['to']) - { - $valid = true; - } - } - - // Should not happen at all - if (!$valid) - { - trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR); - } - - // Just a precaution - $cache->purge(); - // Redirect the user to the database update script with some explanations... $template->assign_vars(array( 'S_DB_UPDATE' => true, @@ -334,8 +310,14 @@ class install_update extends module 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), )); + // Do not display incompatible package note after successful update + if ($config['version'] == $this->update_info['version']['to']) + { + $template->assign_var('S_ERROR', false); + } break; case 'file_check': @@ -501,17 +483,30 @@ class install_update extends module $template->assign_vars(array( 'S_FILE_CHECK' => true, 'S_ALL_UP_TO_DATE' => $all_up_to_date, - 'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), 'S_VERSION_UP_TO_DATE' => $up_to_date, + 'S_UP_TO_DATE' => $up_to_date, 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), )); + // Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run + // we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less + // We now try to cope with this by triggering the update process + if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<')) + { + $template->assign_vars(array( + 'S_UP_TO_DATE' => false, + )); + } + if ($all_up_to_date) { + global $phpbb_container; + $phpbb_log = $phpbb_container->get('log'); + // Add database update to log - add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_PHPBB', time(), array($this->current_version, $this->update_to_version)); $db->sql_return_on_error(true); $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); @@ -1090,12 +1085,6 @@ class install_update extends module $this->tpl_name = 'install_update_diff'; - // Got the diff template itself updated? If so, we are able to directly use it - if (in_array($phpbb_adm_relative_path . 'style/install_update_diff.html', $this->update_info['files'])) - { - $this->tpl_name = '../../install/update/new/adm/style/install_update_diff'; - } - $this->page_title = 'VIEWING_FILE_DIFF'; $status = request_var('status', ''); diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index be45047861..03c9562983 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -374,7 +374,7 @@ $lang = array_merge($lang, array( // Updater $lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.', + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', 'ARCHIVE_FILE' => 'Source file within archive', 'BACK' => 'Back', @@ -398,7 +398,7 @@ $lang = array_merge($lang, array( 'DATABASE_TYPE' => 'Database type', 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', - 'DATABASE_UPDATE_CONTINUE' => 'Continue database update.', + 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', 'DELETE_USER_REMOVE' => 'Delete user and remove posts', @@ -419,8 +419,9 @@ $lang = array_merge($lang, array( 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', - 'ERROR' => 'Error', 'EDIT_USERNAME' => 'Edit username', + 'ERROR' => 'Error', + 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.', 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', @@ -570,6 +571,7 @@ $lang = array_merge($lang, array( 'UPLOAD_METHOD' => 'Upload method', 'UPDATE_DB_SUCCESS' => 'Database update was successful.', + 'UPDATE_FILE_SUCCESS' => 'File update was successful.', 'USER_ACTIVE' => 'Active user', 'USER_INACTIVE' => 'Inactive user', diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 4ad5f6793e..fb8ece0e8c 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -360,6 +360,11 @@ class phpbb_content_visibility // Sync the first/last topic information if needed if (!$is_starter && $is_latest) { + if (!function_exists('update_post_information')) + { + include($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext); + } + // update_post_information can only update the last post info ... if ($topic_id) { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php index 97331e9bb2..1338d48006 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php @@ -108,7 +108,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration WHERE user_id = $bot_user_id"; $this->sql_query($sql); - user_delete('remove', $bot_user_id); + user_delete('retain', $bot_user_id); } else { diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php new file mode 100644 index 0000000000..f80f55d19a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php @@ -0,0 +1,55 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +class phpbb_db_migration_data_310_softdelete_mcp_modules extends phpbb_db_migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'mcp' + AND module_basename = 'mcp_queue' + AND module_mode = 'deleted_topics'"; + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return $module_id !== false; + } + + static public function depends_on() + { + return array( + 'phpbb_db_migration_data_310_dev', + 'phpbb_db_migration_data_310_softdelete_p2', + ); + } + + public function update_data() + { + return array( + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_topics'), + ), + )), + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_posts'), + ), + )), + ); + } +} diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 9c36ba2fc4..9d59a24b7e 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -26,19 +26,19 @@ use Symfony\Component\Config\FileLocator; class phpbb_di_extension_core extends Extension { /** - * phpBB Root path + * Config path * @var string */ - protected $root_path; + protected $config_path; /** * Constructor * - * @param string $root_path Root path + * @param string $config_path Config path */ - public function __construct($root_path) + public function __construct($config_path) { - $this->root_path = $root_path; + $this->config_path = $config_path; } /** @@ -51,7 +51,7 @@ class phpbb_di_extension_core extends Extension */ public function load(array $config, ContainerBuilder $container) { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path))); $loader->load('services.yml'); } diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 4f88147542..3534311b7a 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -191,20 +191,18 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Recursive...fix any child nodes $body = $parent_class->fix_begin_tokens($body, $parent_nodes); - // Rename loopname vars (to prevent collisions, loop children are named (loop name)_loop_element) - $body = str_replace($name . '.', $name . '_loop_element.', $body); - // Need the parent variable name array_pop($parent_nodes); - $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '_loop_element.' : ''; + $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; if ($subset !== '') { $subset = '|subset(' . $subset . ')'; } - // Turn into a Twig for loop, using (loop name)_loop_element for each child - return "{% for {$name}_loop_element in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; + $parent = ($parent) ?: 'loops.'; + // Turn into a Twig for loop + return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; // Replace <!-- BEGINELSE --> correctly, only needs to be done once @@ -227,8 +225,11 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace $TEST with definition.TEST $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); - // Replace .test with test|length - $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner); + // Replace .foo with loops.foo|length + $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', ' loops.$1|length$2', $inner); + + // Replace .foo.bar with foo.bar|length + $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', ' $1|length$2', $inner); return "<!-- {$matches[1]}IF{$inner}-->"; }; diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 971dea14fa..4533151d05 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -18,6 +18,12 @@ if (!defined('IN_PHPBB')) class phpbb_template_twig_node_event extends Twig_Node { + /** + * The subdirectory in which all template listener files must be placed + * @var string + */ + protected $listener_directory = 'event/'; + /** @var Twig_Environment */ protected $environment; @@ -37,7 +43,7 @@ class phpbb_template_twig_node_event extends Twig_Node { $compiler->addDebugInfo($this); - $location = $this->getNode('expr')->getAttribute('name'); + $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name') . '_listener'; foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) { diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 92a37d1634..6cff1bb8e4 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -429,15 +429,15 @@ class phpbb_template_twig implements phpbb_template $vars = array_merge( $context_vars['.'][0], // To get normal vars - $context_vars, // To get loops array( 'definition' => new phpbb_template_twig_definition(), 'user' => $this->user, + 'loops' => $context_vars, // To get loops ) ); // cleanup - unset($vars['.']); + unset($vars['loops']['.']); return $vars; } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 5530fe3f03..b39438e315 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -590,6 +590,13 @@ class phpbb_user extends phpbb_session $language_filename = $lang_path . $this->lang_name . '/' . $filename . '.' . $phpEx; } + // If we are in install, try to use the updated version, when available + $install_language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); + if (defined('IN_INSTALL') && file_exists($install_language_filename)) + { + $language_filename = $install_language_filename; + } + if (!file_exists($language_filename)) { global $config; diff --git a/phpBB/styles/prosilver/theme/en/button_pm_forward.gif b/phpBB/styles/prosilver/theme/en/button_pm_forward.gif Binary files differdeleted file mode 100644 index 3384df34be..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_pm_forward.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_pm_new.gif b/phpBB/styles/prosilver/theme/en/button_pm_new.gif Binary files differdeleted file mode 100644 index cc0381c6b2..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_pm_new.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_pm_reply.gif b/phpBB/styles/prosilver/theme/en/button_pm_reply.gif Binary files differdeleted file mode 100644 index 3275b06d52..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_pm_reply.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_topic_locked.gif b/phpBB/styles/prosilver/theme/en/button_topic_locked.gif Binary files differdeleted file mode 100644 index b08918a24f..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_topic_locked.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_topic_new.gif b/phpBB/styles/prosilver/theme/en/button_topic_new.gif Binary files differdeleted file mode 100644 index 5b7b1e0e60..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_topic_new.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_topic_reply.gif b/phpBB/styles/prosilver/theme/en/button_topic_reply.gif Binary files differdeleted file mode 100644 index e900c80c70..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_topic_reply.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/stylesheet.css b/phpBB/styles/prosilver/theme/en/stylesheet.css index 1a3d0acb4b..82b7df0830 100644 --- a/phpBB/styles/prosilver/theme/en/stylesheet.css +++ b/phpBB/styles/prosilver/theme/en/stylesheet.css @@ -32,33 +32,3 @@ ul.profile-icons li.edit-icon { width: 42px; height: 20px; } padding-left: 58px; padding-top: 58px; } -.imageset.button_pm_forward { - background-image: url("./button_pm_forward.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_pm_new { - background-image: url("./button_pm_new.gif"); - padding-left: 84px; - padding-top: 25px; -} -.imageset.button_pm_reply { - background-image: url("./button_pm_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_locked { - background-image: url("./button_topic_locked.gif"); - padding-left: 88px; - padding-top: 25px; -} -.imageset.button_topic_new { - background-image: url("./button_topic_new.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_reply { - background-image: url("./button_topic_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} diff --git a/phpBB/styles/prosilver/theme/imageset.css b/phpBB/styles/prosilver/theme/imageset.css index 296c617f17..7aa19df06e 100644 --- a/phpBB/styles/prosilver/theme/imageset.css +++ b/phpBB/styles/prosilver/theme/imageset.css @@ -378,33 +378,3 @@ span.imageset { padding-left: 58px; padding-top: 58px; } -.imageset.button_pm_forward { - background-image: url("./en/button_pm_forward.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_pm_new { - background-image: url("./en/button_pm_new.gif"); - padding-left: 84px; - padding-top: 25px; -} -.imageset.button_pm_reply { - background-image: url("./en/button_pm_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_locked { - background-image: url("./en/button_topic_locked.gif"); - padding-left: 88px; - padding-top: 25px; -} -.imageset.button_topic_new { - background-image: url("./en/button_topic_new.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_reply { - background-image: url("./en/button_topic_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index b3992dbd80..c570f19ebd 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -17,7 +17,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); @@ -29,7 +29,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_install_container($phpbb_root_path, 'php'); @@ -43,7 +43,7 @@ class phpbb_di_container_test extends phpbb_test_case $config_file = __DIR__ . '/fixtures/config.php'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php'); diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 8e361ab77b..65c4b6b7c4 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -44,14 +44,14 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_invalid_extension() { $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload('http://example.com/image.gif'); + $file = $upload->remote_upload(self::$root_url . 'develop/blank.gif'); $this->assertEquals('URL_INVALID', $file->error[0]); } - public function test_non_existant() + public function test_empty_file() { $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload('http://example.com/image.jpg'); + $file = $upload->remote_upload(self::$root_url . 'develop/blank.jpg'); $this->assertEquals('EMPTY_REMOTE_DATA', $file->error[0]); } diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php new file mode 100644 index 0000000000..f65a7d0784 --- /dev/null +++ b/tests/functional/mcp_test.php @@ -0,0 +1,67 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_mcp_test extends phpbb_functional_test_case +{ + public function test_post_new_topic() + { + $this->login(); + + // Test creating topic + $post = $this->create_topic(2, 'Test Topic 2', 'Testing move post with "Move posts" option from Quick-Moderator Tools.'); + + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains('Testing move post with "Move posts" option from Quick-Moderator Tools.', $crawler->filter('html')->text()); + + return $crawler; + } + + /** + * @depends test_post_new_topic + */ + public function test_handle_quickmod($crawler) + { + // Test moving a post + $form = $crawler->selectButton('Go')->eq(1)->form(); + $form['action']->select('merge'); + $crawler = self::submit($form); + + return $crawler; + } + + /** + * @depends test_handle_quickmod + */ + public function test_move_post_to_topic($crawler) + { + // Select the post in MCP + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(array( + 'to_topic_id' => 1, + )); + $form['post_id_list'][0]->tick(); + $crawler = self::submit($form); + $this->assertContains($this->lang('MERGE_POSTS'), $crawler->filter('html')->text()); + + return $crawler; + } + + /** + * @depends test_move_post_to_topic + */ + public function test_confirm_result($crawler) + { + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); + } +} diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test_listener.html index 3eb906a09e..3eb906a09e 100644 --- a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test_listener.html index 3b65d80a6d..3b65d80a6d 100644 --- a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test_listener.html index 26826d59e3..26826d59e3 100644 --- a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test_listener.html index 003d193dc3..003d193dc3 100644 --- a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test_listener.html index 6bf06f5457..6bf06f5457 100644 --- a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two_listener.html index 7f8058f4e4..7f8058f4e4 100644 --- a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html +++ b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test_listener.html index 5fc7e5ac12..5fc7e5ac12 100644 --- a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test_listener.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing_listener.html index 028f8aa0d1..028f8aa0d1 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing_listener.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html new file mode 100644 index 0000000000..235e129f85 --- /dev/null +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html @@ -0,0 +1 @@ +{event_loop.S_ROW_COUNT}<!-- IF not event_loop.S_LAST_ROW -->|<!-- ENDIF --> diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal_listener.html index f2c5762ade..f2c5762ade 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal_listener.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple_listener.html index fe32a1ed3f..fe32a1ed3f 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple_listener.html diff --git a/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html b/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html new file mode 100644 index 0000000000..c70d8f86d7 --- /dev/null +++ b/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html @@ -0,0 +1,3 @@ +<!-- BEGIN event_loop --> +event_loop<!-- EVENT test_event_loop --> +<!-- END event_loop --> diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index f7bcd2dcc6..d3b65e763a 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -80,6 +80,16 @@ Zeta test event in all', array(), 'two in silver in omega', ), + array( + 'EVENT in loop', + 'ext_trivial', + array('silver'), + 'event_loop.html', + array(), + array('event_loop' => array(array(), array(), array())), + array(), + 'event_loop0|event_loop1|event_loop2', + ), ); } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index dd9ba21c26..0a6b680100 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -93,49 +93,49 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop.html', array(), - array('loop' => array(array())), + array('test_loop' => array(array())), array(), "loop\nloop", ), array( 'loop.html', array(), - array('loop' => array(array(), array()), 'loop.block' => array(array())), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array())), array(), "loop\nloop\nloop\nloop", ), array( 'loop.html', array(), - array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array()), 'block' => array(array(), array())), array(), "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'))), + array('test_loop' => array(array('VARIABLE' => 'x'))), array(), "first\n0 - a\nx - b\nset\nlast", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), array(), "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), array(), "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner", ), array( 'loop_advanced.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array())), array(), "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", ), @@ -149,14 +149,14 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'define.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), "xyz\nabc\n\$VALUE == 'abc'abc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?", ), array( 'define_advanced.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), "abc\nzxc\ncde\nbcd", ), @@ -200,7 +200,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'include_loop.html', array(), - array('loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))), + array('test_loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'test_loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))), array(), "1\n_1\n_02\n_3", ), @@ -221,8 +221,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), - array('loop'), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop'), '', ), array( @@ -235,7 +235,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'include_loop_define.html', array('VARIABLE' => 'value'), - array('loop' => array(array('NESTED_FILE' => 'variable.html'))), + array('test_loop' => array(array('NESTED_FILE' => 'variable.html'))), array(), 'value', ), @@ -243,8 +243,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), - array('loop.inner'), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop.inner'), "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast", ),*/ array( @@ -295,7 +295,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_size.html', array(), - array('loop' => array(array()), 'empty_loop' => array()), + array('test_loop' => array(array()), 'empty_loop' => array()), array(), "nonexistent = 0\n! nonexistent\n\nempty = 0\n! empty\nloop\n\nin loop", ), diff --git a/tests/template/templates/include_loop.html b/tests/template/templates/include_loop.html index d5c3d9bc82..5cad34b363 100644 --- a/tests/template/templates/include_loop.html +++ b/tests/template/templates/include_loop.html @@ -1,4 +1,4 @@ -<!-- BEGIN loop --> -<!-- INCLUDE {loop.NESTED_FILE} --> -<!-- BEGIN inner -->_<!-- INCLUDE {inner.NESTED_FILE} --><!-- END inner --> -<!-- END loop --> +<!-- BEGIN test_loop --> +<!-- INCLUDE {test_loop.NESTED_FILE} --> +<!-- BEGIN inner -->_<!-- INCLUDE {test_loop.inner.NESTED_FILE} --><!-- END inner --> +<!-- END test_loop --> diff --git a/tests/template/templates/include_loop_define.html b/tests/template/templates/include_loop_define.html index f539b21396..4bab09422e 100644 --- a/tests/template/templates/include_loop_define.html +++ b/tests/template/templates/include_loop_define.html @@ -1,4 +1,4 @@ -<!-- BEGIN loop --> -<!-- DEFINE $DEF = '{loop.NESTED_FILE}' --> +<!-- BEGIN test_loop --> +<!-- DEFINE $DEF = '{test_loop.NESTED_FILE}' --> <!-- INCLUDE {$DEF} --> -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop.html b/tests/template/templates/loop.html index de1a10004d..f541e934df 100644 --- a/tests/template/templates/loop.html +++ b/tests/template/templates/loop.html @@ -1,21 +1,21 @@ -<!-- BEGIN loop --> +<!-- BEGIN test_loop --> loop <!-- BEGINELSE --> noloop -<!-- END loop --> +<!-- END test_loop --> -<!-- IF .loop --> +<!-- IF .test_loop --> loop <!-- ELSE --> noloop <!-- ENDIF --> -<!-- IF .loop == 2 --> +<!-- IF .test_loop == 2 --> loop <!-- ENDIF --> -<!-- BEGIN loop --> +<!-- BEGIN test_loop --> <!-- BEGIN !block --> -loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} +loop#{test_loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} <!-- END !block --> -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop_advanced.html b/tests/template/templates/loop_advanced.html index c75fe55f03..1f56686eaa 100644 --- a/tests/template/templates/loop_advanced.html +++ b/tests/template/templates/loop_advanced.html @@ -1,19 +1,19 @@ -<!-- BEGIN loop -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0,-1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(1,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(1,1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0,1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(2,4) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(2,4) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0,-7) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0,-7) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(-2,6) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(-2,6) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(-2,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(-2,-1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> diff --git a/tests/template/templates/loop_size.html b/tests/template/templates/loop_size.html index 8f581cef10..2b1fcd2dd4 100644 --- a/tests/template/templates/loop_size.html +++ b/tests/template/templates/loop_size.html @@ -22,18 +22,18 @@ ! empty <!-- ENDIF --> -<!-- IF .loop --> +<!-- IF .test_loop --> loop <!-- ENDIF --> -<!-- IF .loop == 0 --> +<!-- IF .test_loop == 0 --> loop = 0 <!-- ENDIF --> -<!-- IF ! .loop --> +<!-- IF ! .test_loop --> ! loop <!-- ENDIF --> -<!-- BEGIN loop --> +<!-- BEGIN test_loop --> in loop -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html index 7d86d4b7b6..70a3eb2cec 100644 --- a/tests/template/templates/loop_vars.html +++ b/tests/template/templates/loop_vars.html @@ -1,13 +1,13 @@ -<!-- BEGIN loop --> -<!-- IF loop.S_FIRST_ROW -->first<!-- ENDIF --> -{loop.S_ROW_NUM} - a -{loop.VARIABLE} - b -<!-- IF loop.VARIABLE -->set<!-- ENDIF --> -<!-- IF loop.S_LAST_ROW --> +<!-- BEGIN test_loop --> +<!-- IF test_loop.S_FIRST_ROW -->first<!-- ENDIF --> +{test_loop.S_ROW_NUM} - a +{test_loop.VARIABLE} - b +<!-- IF test_loop.VARIABLE -->set<!-- ENDIF --> +<!-- IF test_loop.S_LAST_ROW --> last <!-- ENDIF --> <!-- BEGIN inner --> -{inner.S_ROW_NUM} - c -<!-- IF inner.S_LAST_ROW and inner.S_ROW_COUNT and inner.S_NUM_ROWS -->last inner<!-- ENDIF --> +{test_loop.inner.S_ROW_NUM} - c +<!-- IF test_loop.inner.S_LAST_ROW and test_loop.inner.S_ROW_COUNT and test_loop.inner.S_NUM_ROWS -->last inner<!-- ENDIF --> <!-- END inner --> -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index de3611c4cc..ce748bb9cf 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -957,7 +957,7 @@ class phpbb_functional_test_case extends phpbb_test_case ); } - /* + /** * Returns the requested parameter from a URL * * @param string $url |