From b621bb66c50e534086226df89e5c0764535f5832 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 10 Jan 2007 16:47:16 +0000 Subject: [PATCH] fix some general bugs and some convertor related git-svn-id: file:///svn/phpbb/trunk@6872 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_convert.html | 197 +++++++++--------- phpBB/adm/style/install_install.html | 4 +- phpBB/adm/style/install_main.html | 2 +- phpBB/docs/coding-guidelines.html | 2 +- phpBB/includes/acp/acp_language.php | 9 +- phpBB/includes/acp/acp_search.php | 4 +- phpBB/includes/functions_convert.php | 8 +- phpBB/includes/ucp/ucp_groups.php | 1 + .../install/convertors/functions_phpbb20.php | 6 +- phpBB/install/install_convert.php | 65 +++--- phpBB/install/install_install.php | 1 - phpBB/language/en/install.php | 8 +- phpBB/memberlist.php | 4 +- 13 files changed, 170 insertions(+), 141 deletions(-) diff --git a/phpBB/adm/style/install_convert.html b/phpBB/adm/style/install_convert.html index 39d31cd538..18b81ed3e6 100755 --- a/phpBB/adm/style/install_convert.html +++ b/phpBB/adm/style/install_convert.html @@ -1,116 +1,125 @@ -
+ -

{TITLE}

-

{BODY}

+

{TITLE}

- - - - - - - - - - - - - - - +

{BODY}

+ + + + + +

{TITLE}

+

{BODY}

+ + +
{L_AVAILABLE_CONVERTORS}
{L_SOFTWARE}{L_VERSION}{L_AUTHOR}{L_OPTIONS}
+ + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +
{L_AVAILABLE_CONVERTORS}
{convertors.SOFTWARE}{convertors.VERSION}{convertors.AUTHOR}{L_CONVERT}
{L_NO_CONVERTORS}---{L_SOFTWARE}{L_VERSION}{L_AUTHOR}{L_OPTIONS}
{convertors.SOFTWARE}{convertors.VERSION}{convertors.AUTHOR}{L_CONVERT}
{L_NO_CONVERTORS}---
- - - - -
- -
-
- +
-
-
- -
-
-
- +
+ + + +
+
+ +
+
- -
+
+ - - - -
+ +
-
- - {checks.LEGEND} -

{checks.LEGEND_EXPLAIN}

- - -
-
{checks.TITLE}:
{checks.TITLE_EXPLAIN}
-
{checks.RESULT}
-
- - - -
- - - -
- - - - + + +
- +
+ + {checks.LEGEND} +

{checks.LEGEND_EXPLAIN}

+ + +
+
{checks.TITLE}:
{checks.TITLE_EXPLAIN}
+
{checks.RESULT}
+
- {options.LEGEND} - + -
-

{options.TITLE_EXPLAIN}
-
{options.CONTENT}
-
+
+ - - + +
-
+ + + +
+ +
+ + {options.LEGEND} + + +
+

{options.TITLE_EXPLAIN}
+
{options.CONTENT}
+
+ + + + +
+ + + +
+

{L_MESSAGE}

+ {S_HIDDEN} + +
+ + + - -
-

{L_MESSAGE}

- {S_HIDDEN} - -
- - - - \ No newline at end of file diff --git a/phpBB/adm/style/install_install.html b/phpBB/adm/style/install_install.html index 91a7f25480..fb8c1bdf0c 100755 --- a/phpBB/adm/style/install_install.html +++ b/phpBB/adm/style/install_install.html @@ -2,7 +2,7 @@
-

{TITLE}

+

{TITLE}

{BODY}

@@ -54,7 +54,7 @@ -

{L_DL_CONFIG}

+

{L_DL_CONFIG}

{L_DL_CONFIG_EXPLAIN}

diff --git a/phpBB/adm/style/install_main.html b/phpBB/adm/style/install_main.html index 9d125a42eb..2c318bfd65 100755 --- a/phpBB/adm/style/install_main.html +++ b/phpBB/adm/style/install_main.html @@ -1,6 +1,6 @@ -

{TITLE}

+

{TITLE}

{BODY}

\ No newline at end of file diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 33b2bb6b8d..0549671b95 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -862,7 +862,7 @@ $sql_array = array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' ) - ); + ), 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . ' AND f.forum_id = fw.forum_id', diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 16f75d9c92..e83445eeed 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -241,6 +241,9 @@ class acp_language $entry .= "\t),\n"; fwrite($fp, $entry); } + + $footer = ");\n\n?>"; + fwrite($fp, $footer); } else { @@ -253,10 +256,10 @@ class acp_language $entry = $this->format_lang_array($key, $value); fwrite($fp, $entry); } - } - $footer = "));\n\n?>"; - fwrite($fp, $footer); + $footer = "));\n\n?>"; + fwrite($fp, $footer); + } } fclose($fp); diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 342ec34e29..ad3e770fbb 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -338,7 +338,9 @@ class acp_search while ($row = $db->sql_fetchrow($result)) { - if ($forums[$row['forum_id']]) + // Indexing enabled for this forum or global announcement? + // Global announcements get indexed by default. + if (!$row['forum_id'] || (isset($forums[$row['forum_id']]) && $forums[$row['forum_id']])) { $this->search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']); } diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 1d78b29968..499d62de3d 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -985,7 +985,7 @@ function set_user_options() foreach ($keyoptions as $key => $key_ary) { - $value = (isset($row[$key])) ? (int) $row[$key] : $key_ary['default']; + $value = (isset($convert_row[$key])) ? (int) $convert_row[$key] : $key_ary['default']; if ($value && !($option_field & 1 << $key_ary['bit'])) { @@ -1158,7 +1158,7 @@ function get_config() } else if ($convert->config_schema['table_format'] == 'file') { - $filename = $convert->convertor_status['forum_path'] . '/' . $convert->config_schema['filename']; + $filename = $convert->options['forum_path'] . '/' . $convert->config_schema['filename']; if (!file_exists($filename)) { $convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__); @@ -2278,7 +2278,7 @@ function relative_base($path, $is_relative = true, $line = false, $file = false) return $path; } - if (empty($convert->convertor_status['forum_path']) && $is_relative) + if (empty($convert->options['forum_path']) && $is_relative) { $line = $line ? $line : __LINE__; $file = $file ? $file : __FILE__; @@ -2286,7 +2286,7 @@ function relative_base($path, $is_relative = true, $line = false, $file = false) $convert->p_master->error($user->lang['CONV_ERROR_NO_FORUM_PATH'], $line, $file); } - return $convert->convertor_status['forum_path'] . '/' . $path; + return $convert->options['forum_path'] . '/' . $path; } ?> \ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 119f496d21..c97fc99652 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -799,6 +799,7 @@ class ucp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); } + group_update_listings($group_id); $user->add_lang('acp/groups'); trigger_error($user->lang['GROUP_DEFS_UPDATED'] . $return_page); diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index b827c113b0..5923c92ac1 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -341,7 +341,7 @@ function phpbb_set_encoding($text, $grab_user_lang = true) if (!isset($lang_enc_array[$get_lang])) { - $filename = $convert->convertor_status['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . $phpEx; + $filename = $convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . $phpEx; if (!file_exists($filename)) { @@ -350,7 +350,7 @@ function phpbb_set_encoding($text, $grab_user_lang = true) if (!isset($lang_enc_array[$get_lang])) { - include($convert->convertor_status['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . $phpEx); + include($convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . $phpEx); $lang_enc_array[$get_lang] = $lang['ENCODING']; unset($lang); } @@ -1150,7 +1150,7 @@ function phpbb_copy_thumbnails() { global $db, $convert, $user, $config, $cache, $phpbb_root_path; - $src_path = $convert->convertor_status['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/'; + $src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/'; if ($handle = @opendir($src_path)) { diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index a4b5629596..242e6b9ff5 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -32,7 +32,7 @@ if (!empty($setmodules)) class convert { - var $convertor_status = array(); + var $options = array(); var $convertor_tag = ''; var $src_table_prefix = ''; @@ -96,7 +96,15 @@ class install_convert extends module if (!defined('PHPBB_INSTALLED')) { - $this->p_master->redirect("index.$phpEx?mode=install"); + $config['load_tplcompile'] = true; + + $template->assign_vars(array( + 'S_NOT_INSTALLED' => true, + 'TITLE' => $lang['BOARD_NOT_INSTALLED'], + 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=install')), + )); + + return; } require($phpbb_root_path . 'config.' . $phpEx); @@ -132,16 +140,15 @@ class install_convert extends module } // Let's see if there is a conversion in the works... - $convertor_status = array(); + $options = array(); if (isset($config['convert_progress'])) { - $convertor_status = unserialize($config['convert_progress']); - // $convertor_status['forum_address'] = $config['conv_forum_address']; - $convertor_status['forum_path'] = $config['conv_forum_path']; + $options = unserialize($config['convert_progress']); + $options = array_merge($options, unserialize($config['convert_options'])); } // This information should have already been checked once, but do it again for safety - if (!empty($convertor_status) && !empty($convertor_status['tag']) && isset($convertor_status['table_prefix'])) + if (!empty($options) && !empty($options['tag']) && isset($options['table_prefix'])) { $this->page_title = $lang['CONTINUE_CONVERT']; @@ -153,7 +160,7 @@ class install_convert extends module 'S_CONTINUE' => true, 'U_NEW_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=intro&new_conv=1", - 'U_CONTINUE_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$convertor_status['tag']}{$convertor_status['step']}", + 'U_CONTINUE_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$options['tag']}{$options['step']}", )); return; @@ -302,7 +309,8 @@ class install_convert extends module $submit = (isset($_POST['submit'])) ? true : false; $src_table_prefix = request_var('src_table_prefix', $convertor_data['table_prefix']); - $src_path = request_var('src_path', $convertor_data['forum_path']); + $forum_path = request_var('forum_path', $convertor_data['forum_path']); + $refresh = request_var('refresh', 1); // Default URL of the old board // @todo Are we going to use this for attempting to convert URL references in posts, or should we remove it? @@ -312,9 +320,9 @@ class install_convert extends module $error = array(); if ($submit) { - if (!file_exists('./../' . $src_path . '/' . $test_file)) + if (!file_exists('./../' . $forum_path . '/' . $test_file)) { - $error[] = sprintf($lang['COULD_NOT_FIND_PATH'], $src_path); + $error[] = sprintf($lang['COULD_NOT_FIND_PATH'], $forum_path); } // The forum prefix of the old and the new forum can't be the same because the @@ -384,8 +392,9 @@ class install_convert extends module { // Save convertor Status set_config('convert_progress', serialize(array('step' => '', 'table_prefix' => $src_table_prefix, 'tag' => $convertor_tag)), true); - // set_config('conv_forum_address', $src_url, true); // @todo See note above about this variable - set_config('conv_forum_path', './../' . $src_path, true); + + // Save options + set_config('convert_options', serialize(array('forum_path' => './../' . $forum_path, 'refresh' => $refresh)), true); $template->assign_block_vars('checks', array( 'TITLE' => $lang['SPECIFY_OPTIONS'], @@ -508,23 +517,22 @@ class install_convert extends module $this->page_title = $user->lang['STAGE_IN_PROGRESS']; - $convert->convertor_status = array(); + $convert->options = array(); if (isset($config['convert_progress'])) { - $convert->convertor_status = unserialize($config['convert_progress']); - // $convert->convertor_status['forum_address'] = $config['conv_forum_address']; - $convert->convertor_status['forum_path'] = $config['conv_forum_path']; + $convert->options = unserialize($config['convert_progress']); + $convert->options = array_merge($convert->options, unserialize($config['convert_options'])); } // This information should have already been checked once, but do it again for safety - if (empty($convert->convertor_status) || empty($convert->convertor_status['tag']) || !isset($convert->convertor_status['table_prefix'])) + if (empty($convert->options) || empty($convert->options['tag']) || !isset($convert->options['table_prefix'])) { $this->p_master->error($user->lang['NO_CONVERT_SPECIFIED'], __LINE__, __FILE__); } // Make some short variables accessible, for easier referencing - $convert->convertor_tag = basename($convert->convertor_status['tag']); - $convert->src_table_prefix = $convert->convertor_status['table_prefix']; + $convert->convertor_tag = basename($convert->options['tag']); + $convert->src_table_prefix = $convert->options['table_prefix']; $convert->truncate_statement = ($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM '; $get_info = false; @@ -558,9 +566,9 @@ class install_convert extends module $convert->convertor = $convertor; // The test_file is a file that should be present in the location of the old board. - if (!file_exists($convert->convertor_status['forum_path'] . '/' . $test_file)) + if (!file_exists($convert->options['forum_path'] . '/' . $test_file)) { - $this->p_master->error(sprintf($user->lang['COULD_NOT_FIND_PATH'], $convert->convertor_status['forum_path']), __LINE__, __FILE__); + $this->p_master->error(sprintf($user->lang['COULD_NOT_FIND_PATH'], $convert->options['forum_path']), __LINE__, __FILE__); } $search_type = $config['search_type']; @@ -1177,7 +1185,7 @@ class install_convert extends module $sync_batch = -1; $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " - WHERE config_name = 'convert_progress' OR config_name = 'conv_forum_path' OR config_name = 'conv_forum_address'"); + WHERE config_name = 'convert_progress' OR config_name = 'convert_options'"); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); @unlink($phpbb_root_path . 'cache/data_global.php'); @@ -1204,7 +1212,7 @@ class install_convert extends module $step = '&sync_batch=' . $sync_batch; // Save convertor Status - set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->convertor_status['table_prefix'], 'tag' => $convert->convertor_tag)), true); + set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->options['table_prefix'], 'tag' => $convert->convertor_tag)), true); $url = $this->p_master->module_url . "?mode=$this->mode&sub=in_progress&tag={$convert->convertor_tag}$step"; @@ -1692,9 +1700,11 @@ class install_convert extends module */ function meta_refresh($url) { - if (!defined('DEBUG_EXTRA')) + global $convert; + + if ($convert->options['refresh']) { - // meta_refresh(5, $url); + meta_refresh(5, $url); } } @@ -1705,7 +1715,8 @@ class install_convert extends module 'legend1' => 'SPECIFY_OPTIONS', 'src_table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => false), //'src_url' => array('lang' => 'FORUM_ADDRESS', 'type' => 'text:50:100', 'explain' => true), - 'src_path' => array('lang' => 'FORUM_PATH', 'type' => 'text:25:100', 'explain' => true), + 'forum_path' => array('lang' => 'FORUM_PATH', 'type' => 'text:25:100', 'explain' => true), + 'refresh' => array('lang' => 'REFRESH_PAGE', 'type' => 'radio:yes_no', 'explain' => true), ); } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 38dc491665..829c21d29a 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -515,7 +515,6 @@ class install_install extends module } $dbpasswd = htmlspecialchars_decode($dbpasswd); - $connect_test = $this->connect_check_db(true, $error, $dbms, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport); $template->assign_block_vars('checks', array( diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index c8546325a8..846334a65b 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -43,8 +43,10 @@ $lang = array_merge($lang, array( 'AVAILABLE' => 'Available', 'AVAILABLE_CONVERTORS' => 'Available convertors', - 'BEGIN_CONVERT' => 'Begin conversion', - 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', + 'BEGIN_CONVERT' => 'Begin conversion', + 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', + 'BOARD_NOT_INSTALLED' => 'No installation found', + 'BOARD_NOT_INSTALLED_EXPLAIN' => 'To perform a conversion you need to have a default installation of phpBB3. Please note that for a conversion the new installation and the old installation need to reside within the same database. You may now want to perform an installation.', 'CATEGORY' => 'Category', 'CACHE_STORE' => 'Cache type', @@ -258,6 +260,8 @@ $lang = array_merge($lang, array( 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process.', 'PROCESS_LAST' => 'Processing last statements', + 'REFRESH_PAGE' => 'Refresh page to continue conversion', + 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', // 'REQUIRED' => 'Required', 'REQUIREMENTS_TITLE' => 'Installation compatibility', 'REQUIREMENTS_EXPLAIN' => 'Before proceeding with full installation phpBB will carry out some tests on your server configuration and files to ensure that you are able to install and run phpBB. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed. If you wish to enable any of the functionality listed by the optional tests, you should ensure that these tests are passed also.', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index dad73d8a64..340fc1e02c 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -515,8 +515,8 @@ switch ($mode) 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}") : '', 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, - 'U_ADD_FRIEND' => (!$friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode($member['username'])) : '', - 'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode($member['username'])) : '', + 'U_ADD_FRIEND' => (!$friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_REMOVE_FRIEND' => ($friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', 'U_REMOVE_FOE' => ($foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', ));