diff --git a/.gitignore b/.gitignore index 542527e717..eb7b546445 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /phpBB/cache/*.php /phpBB/cache/queue.php.lock /phpBB/config.php +/phpBB/ext/* /phpBB/files/* /phpBB/images/avatars/gallery/* /phpBB/images/avatars/upload/* diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 9237e45daf..1f10e7f66e 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -45,10 +45,6 @@
-
-

{L_CONFIRM_EMAIL_EXPLAIN}
-
-

{L_CHANGE_PASSWORD_EXPLAIN}
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 666f4921ba..ceda824e5a 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -1007,11 +1007,11 @@ fieldset.submit-buttons legend { /* Input field styles ---------------------------------------- */ -input.radio, input.permissions-checkbox { +input.radio, input.checkbox, input.permissions-checkbox { width: auto !important; background-color: transparent; border: none; - cursor: default; + cursor: pointer; } input.full, diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index 22d21d8314..818889c89b 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -43,6 +43,11 @@

{WARNING_MSG}

+ +
+

{L_NOTICE}

+

{L_BACKUP_NOTICE}

+
diff --git a/phpBB/develop/compile_template.php b/phpBB/develop/compile_template.php index e741e909d8..32d1d321f1 100644 --- a/phpBB/develop/compile_template.php +++ b/phpBB/develop/compile_template.php @@ -20,5 +20,5 @@ include($phpbb_root_path . 'includes/template_compile.'.$phpEx); $file = $argv[1]; -$compile = new phpbb_template_compile(); +$compile = new phpbb_template_compile(false); echo $compile->compile_file($file); diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index 28001035f6..1de20f3099 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -25,7 +25,6 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); require($phpbb_root_path . 'common.' . $phpEx); require($phpbb_root_path . 'includes/acp/acp_search.' . $phpEx); -require($phpbb_root_path . 'includes/search/' . $class_name . '.' . $phpEx); $user->session_begin(); $auth->acl($user->data); diff --git a/phpBB/develop/extensions.php b/phpBB/develop/extensions.php new file mode 100644 index 0000000000..2f7c3d1167 --- /dev/null +++ b/phpBB/develop/extensions.php @@ -0,0 +1,123 @@ +load_extensions(); + + echo "Enabled:\n"; + $enabled = array_keys($phpbb_extension_manager->all_enabled()); + print_extensions($enabled); + echo "\n"; + + echo "Disabled:\n"; + $disabled = array_keys($phpbb_extension_manager->all_disabled()); + print_extensions($disabled); + echo "\n"; + + echo "Available:\n"; + $all = array_keys($phpbb_extension_manager->all_available()); + $purged = array_diff($all, $enabled, $disabled); + print_extensions($purged); +} + +function print_extensions($exts) +{ + foreach ($exts as $ext) + { + echo "- $ext\n"; + } +} + +function enable_extension($name) +{ + global $phpbb_extension_manager; + + $phpbb_extension_manager->enable($name); +} + +function disable_extension($name) +{ + global $phpbb_extension_manager; + + $phpbb_extension_manager->disable($name); +} + +function purge_extension($name) +{ + global $phpbb_extension_manager; + + $phpbb_extension_manager->purge($name); +} + +function validate_argument_count($count) +{ + global $argv; + + if (count($argv) <= $count) + { + usage(); + } +} + +validate_argument_count(1); + +$action = $argv[1]; + +switch ($action) +{ + case 'list': + list_extensions(); + break; + + case 'enable': + validate_argument_count(2); + enable_extension($argv[2]); + break; + + case 'disable': + validate_argument_count(2); + disable_extension($argv[2]); + break; + + case 'purge': + validate_argument_count(2); + purge_extension($argv[2]); + break; + + default: + usage(); +} diff --git a/phpBB/develop/imageset_to_css.php b/phpBB/develop/imageset_to_css.php index 3d55808319..d49fe9c741 100644 --- a/phpBB/develop/imageset_to_css.php +++ b/phpBB/develop/imageset_to_css.php @@ -10,21 +10,21 @@ $phpbb_root_path = '../'; $style = 'subsilver2'; $imageset_path = $phpbb_root_path . 'styles/' . $style . '/imageset'; -$theme_path = $phpbb_root_path . 'styles/' . $style . '/theme2'; +$theme_path = $phpbb_root_path . 'styles/' . $style . '/theme'; // Start output buffering ob_start(); // Get global and English images $images_global = get_imageset($imageset_path); -if($images_global === false) +if ($images_global === false) { echo 'imageset.cfg was not found.'; echo ob_get_clean(); return; } $images_en = get_imageset($imageset_path, 'en'); -if($images_en === false) +if ($images_en === false) { echo 'English imageset.cfg was not found.'; echo ob_get_clean(); @@ -32,7 +32,7 @@ if($images_en === false) } // Remove duplicate images -foreach($images_en as $key => $row) +foreach ($images_en as $key => $row) { unset($images_global[$key]); } @@ -52,13 +52,16 @@ $replace = array( // $replace = array_merge($replace, get_replacements($images_global)); $replace = array_merge($replace, get_replacements($images_global), get_replacements($images_en)); +// BIDI code +$bidi_code = css($images_global, './images/', true); + // Get all CSS files, parse them $files = list_files($theme_path, 'css'); -if($files === false || !count($files)) +if ($files === false || !count($files)) { echo 'No CSS files found in theme directory.
'; } -else for($i=0; $i'; + continue; } } - if(md5($data) == $hash) + if (basename($file) == 'bidi.css' && strpos($data, '/* Former imageset */') === false && strlen($bidi_code)) + { + // Add bidi data + $data .= "\n/* Former imageset */\n" . $bidi_code; + $bidi_code = ''; + echo 'Note: RTL imageset entries were added at the end of file below:
'; + } + if (md5($data) == $hash) { echo 'Nothing to replace in ', $file, '
'; } @@ -84,9 +95,9 @@ else for($i=0; $i $row) +foreach ($list as $key => $row) { - if($row['skip']) + if ($row['skip']) { echo 'Unable to generate code to add to CSS files because some images are missing or invalid. See errors above.'; echo ob_get_clean(); @@ -112,14 +123,22 @@ span.imageset { /* English images for fallback */ ' . css($images_en, './en/'); +if (strlen($bidi_code)) +{ + $code .= "\n/* RTL imageset entries */\n" . $bidi_code; +} echo 'Code to add to CSS file:', dump_code($code, 'imageset.css'); + $list = list_languages($imageset_path); -for($i=0; $i'; $skip = true; @@ -162,7 +190,7 @@ function get_imageset($path, $lang = '') else { $size = @getimagesize($filename); - if($size === false) + if ($size === false) { echo 'Error: file ', $filename, ' is not a valid image
'; $skip = true; @@ -188,7 +216,7 @@ function get_imageset($path, $lang = '') function get_replacements($list) { $result = array(); - foreach($list as $key => $row) + foreach ($list as $key => $row) { $key = '{' . strtoupper($key); $result[$key . '_SRC}'] = strlen($row['file']) ? ($row['lang'] ? './' . $row['lang'] : './images') . '/' . $row['file'] : ''; @@ -201,9 +229,12 @@ function get_replacements($list) function list_files($dir, $ext) { $res = @opendir($dir); - if($res === false) return false; + if ($res === false) + { + return false; + } $files = array(); - while(($file = readdir($res)) !== false) + while (($file = readdir($res)) !== false) { $list = explode('.', $file); if(count($list) > 1 && strtolower($list[count($list) - 1]) == $ext) @@ -218,13 +249,19 @@ function list_files($dir, $ext) function list_languages($dir) { $res = @opendir($dir); - if($res === false) return array(); - $files = array(); - while(($file = readdir($res)) !== false) + if ($res === false) { - if(substr($file, 0, 1) == '.') continue; + return array(); + } + $files = array(); + while (($file = readdir($res)) !== false) + { + if (substr($file, 0, 1) == '.') + { + continue; + } $filename = $dir . '/' . $file; - if(is_dir($filename) && file_exists($filename . '/imageset.cfg')) + if (is_dir($filename) && file_exists($filename . '/imageset.cfg')) { $files[] = $file; } @@ -236,7 +273,7 @@ function list_languages($dir) function dump_code($code, $filename = 'file.txt') { $hash = md5($code); - if(isset($_GET['download']) && $_GET['download'] === $hash) + if (isset($_GET['download']) && $_GET['download'] === $hash) { // Download file ob_end_clean(); @@ -256,18 +293,81 @@ function dump_code($code, $filename = 'file.txt') echo '
'; } -function css($list, $path = './') +function css($list, $path = './', $bidi = false) { $code = ''; - foreach($list as $key => $row) + // Change value to true if you want images to be grouped up by size + $group = $bidi; + if ($group) { - if(!strlen($row['file'])) continue; - $code .= '.imageset.' . substr($key, 4) . ' { + // group up images by size + $groups = array(); + foreach ($list as $key => $row) + { + if (!strlen($row['file'])) + { + continue; + } + $groups[$row['width'] . '*' . $row['height']][] = $key; + } + foreach ($groups as $size => $keys) + { + $extra = ''; + for ($i=0; $i $row) + { + if (!strlen($row['file'])) + { + continue; + } + $code .= ($bidi ? '.rtl ' : '') . '.imageset.' . substr($key, 4) . ' {'; + if ($bidi) + { + $code .= ' + padding-right: ' . $row['width'] . 'px; + padding-left: 0; +} +'; + } + else + { + $code .= ' background-image: url("' . $path . $row['file'] . '"); padding-left: ' . $row['width'] . 'px; padding-top: ' . $row['height'] . 'px; } '; + } + } } return $code; } diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 371c8c74cc..4c0b607778 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -34,13 +34,11 @@ $user->setup(); $search_type = $config['search_type']; -if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) +if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } -require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); - $error = false; $search = new $search_type($error); diff --git a/phpBB/feed.php b/phpBB/feed.php index 00247c1958..fcf42a83ae 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -1106,7 +1106,7 @@ class phpbb_feed_forums extends phpbb_feed_base global $user; $item_row['statistics'] = $user->lang('TOTAL_TOPICS', (int) $row['forum_topics']) - . ' ' . $this->separator_stats . ' ' . $user->lang('TOTAL_POSTS_OTHER', (int) $row['forum_posts']); + . ' ' . $this->separator_stats . ' ' . $user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts']); } } } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 60d5def4d1..511148baf9 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -508,11 +508,34 @@ class acp_profile } } } - /* else if ($field_type == FIELD_BOOL && $key == 'field_default_value') + else if ($field_type == FIELD_BOOL && $key == 'field_default_value') { - // Get the number of options if this key is 'field_maxlen' - $var = request_var('field_default_value', 0); - }*/ + // 'field_length' == 1 defines radio buttons. Possible values are 1 or 2 only. + // 'field_length' == 2 defines checkbox. Possible values are 0 or 1 only. + // If we switch the type on step 2, we have to adjust field value. + // 1 is a common value for the checkbox and radio buttons. + + // Adjust unchecked checkbox value. + // If we return or save settings from 2nd/3rd page + // and the checkbox is unchecked, set the value to 0. + if (isset($_REQUEST['step']) && !isset($_REQUEST[$key])) + { + $var = 0; + } + + // If we switch to the checkbox type but former radio buttons value was 2, + // which is not the case for the checkbox, set it to 0 (unchecked). + if ($cp->vars['field_length'] == 2 && $var == 2) + { + $var = 0; + } + // If we switch to the radio buttons but the former checkbox value was 0, + // which is not the case for the radio buttons, set it to 0. + else if ($cp->vars['field_length'] == 1 && $var == 0) + { + $var = 2; + } + } else if ($field_type == FIELD_INT && $key == 'field_default_value') { // Permit an empty string @@ -680,6 +703,10 @@ class acp_profile { $_new_key_ary[$key] = utf8_normalize_nfc(request_var($key, array(array('')), true)); } + else if ($field_type == FIELD_BOOL && $key == 'field_default_value') + { + $_new_key_ary[$key] = request_var($key, $cp->vars[$key]); + } else { if (!isset($_REQUEST[$key])) diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 97cfd35750..ec5a76df87 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -51,7 +51,7 @@ class acp_ranks } $rank_title = utf8_normalize_nfc(request_var('title', '', true)); $special_rank = request_var('special_rank', 0); - $min_posts = ($special_rank) ? 0 : request_var('min_posts', 0); + $min_posts = ($special_rank) ? 0 : max(0, request_var('min_posts', 0)); $rank_image = request_var('rank_image', ''); // The rank image has to be a jpg, gif or png diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index c8fe748c02..7b449d3b35 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -83,11 +83,11 @@ version = {VERSION} $this->template_cfg .= ' # Some configuration options -# -# You can use this function to inherit templates from another template. -# The template of the given name has to be installed. -# Templates cannot inherit from inheriting templates. -#'; +# Template inheritance +# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/ +# Set value to empty or this template name to ignore template inheritance. +inherit_from = {INHERIT_FROM} +'; // Execute overall actions switch ($action) @@ -1346,9 +1346,7 @@ version = {VERSION} // Export template core code if ($mode == 'template' || $inc_template) { - $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version']), $this->template_cfg); - - $use_template_name = ''; + $use_template_name = $style_row['template_name']; // Add the inherit from variable, depending on it's use... if ($style_row['template_inherits_id']) @@ -1362,7 +1360,8 @@ version = {VERSION} $db->sql_freeresult($result); } - $template_cfg .= ($use_template_name) ? "\ninherit_from = $use_template_name" : "\n#inherit_from = "; + $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}', '{INHERIT_FROM}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version'], $use_template_name), $this->template_cfg); + $template_cfg .= "\n\nbbcode_bitfield = {$style_row['bbcode_bitfield']}"; $data[] = array( diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a282ef1d7f..97f4b1b5fd 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -756,7 +756,6 @@ class acp_users 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), 'email' => strtolower(request_var('user_email', $user_row['user_email'])), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), ); @@ -788,7 +787,6 @@ class acp_users array('string', false, 6, 60), array('email', $user_row['user_email']) ), - 'email_confirm' => array('string', true, 6, 60) ); } @@ -799,11 +797,6 @@ class acp_users $error[] = 'NEW_PASSWORD_ERROR'; } - if ($data['email'] != $user_row['user_email'] && $data['email_confirm'] != $data['email']) - { - $error[] = 'NEW_EMAIL_ERROR'; - } - if (!check_form_key($form_name)) { $error[] = 'FORM_INVALID'; diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 48626af050..6da854b6e2 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -683,12 +683,7 @@ class dbal // The DEBUG_EXTRA constant is for development only! if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG_EXTRA')) { - // Print out a nice backtrace... - $backtrace = get_backtrace(); - $message .= ($sql) ? '

SQL

' . htmlspecialchars($sql) : ''; - $message .= ($backtrace) ? '

BACKTRACE
' . $backtrace : ''; - $message .= '
'; } else { @@ -925,6 +920,41 @@ class dbal return true; } + + /** + * Gets the estimated number of rows in a specified table. + * + * @param string $table_name Table name + * + * @return string Number of rows in $table_name. + * Prefixed with ~ if estimated (otherwise exact). + * + * @access public + */ + function get_estimated_row_count($table_name) + { + return $this->get_row_count($table_name); + } + + /** + * Gets the exact number of rows in a specified table. + * + * @param string $table_name Table name + * + * @return string Exact number of rows in $table_name. + * + * @access public + */ + function get_row_count($table_name) + { + $sql = 'SELECT COUNT(*) AS rows_total + FROM ' . $this->sql_escape($table_name); + $result = $this->sql_query($sql); + $rows_total = $this->sql_fetchfield('rows_total'); + $this->sql_freeresult($result); + + return $rows_total; + } } /** diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 317b8d123d..eb38e3e913 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -317,6 +317,76 @@ class dbal_mysql extends dbal return @mysql_real_escape_string($msg, $this->db_connect_id); } + /** + * Gets the estimated number of rows in a specified table. + * + * @param string $table_name Table name + * + * @return string Number of rows in $table_name. + * Prefixed with ~ if estimated (otherwise exact). + * + * @access public + */ + function get_estimated_row_count($table_name) + { + $table_status = $this->get_table_status($table_name); + + if (isset($table_status['Engine'])) + { + if ($table_status['Engine'] === 'MyISAM') + { + return $table_status['Rows']; + } + else if ($table_status['Engine'] === 'InnoDB' && $table_status['Rows'] > 100000) + { + return '~' . $table_status['Rows']; + } + } + + return parent::get_row_count($table_name); + } + + /** + * Gets the exact number of rows in a specified table. + * + * @param string $table_name Table name + * + * @return string Exact number of rows in $table_name. + * + * @access public + */ + function get_row_count($table_name) + { + $table_status = $this->get_table_status($table_name); + + if (isset($table_status['Engine']) && $table_status['Engine'] === 'MyISAM') + { + return $table_status['Rows']; + } + + return parent::get_row_count($table_name); + } + + /** + * Gets some information about the specified table. + * + * @param string $table_name Table name + * + * @return array + * + * @access protected + */ + function get_table_status($table_name) + { + $sql = "SHOW TABLE STATUS + LIKE '" . $this->sql_escape($table_name) . "'"; + $result = $this->sql_query($sql); + $table_status = $this->sql_fetchrow($result); + $this->sql_freeresult($result); + + return $table_status; + } + /** * Build LIKE expression * @access private diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index d6b64bf7c8..4210a58002 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -314,6 +314,76 @@ class dbal_mysqli extends dbal return @mysqli_real_escape_string($this->db_connect_id, $msg); } + /** + * Gets the estimated number of rows in a specified table. + * + * @param string $table_name Table name + * + * @return string Number of rows in $table_name. + * Prefixed with ~ if estimated (otherwise exact). + * + * @access public + */ + function get_estimated_row_count($table_name) + { + $table_status = $this->get_table_status($table_name); + + if (isset($table_status['Engine'])) + { + if ($table_status['Engine'] === 'MyISAM') + { + return $table_status['Rows']; + } + else if ($table_status['Engine'] === 'InnoDB' && $table_status['Rows'] > 100000) + { + return '~' . $table_status['Rows']; + } + } + + return parent::get_row_count($table_name); + } + + /** + * Gets the exact number of rows in a specified table. + * + * @param string $table_name Table name + * + * @return string Exact number of rows in $table_name. + * + * @access public + */ + function get_row_count($table_name) + { + $table_status = $this->get_table_status($table_name); + + if (isset($table_status['Engine']) && $table_status['Engine'] === 'MyISAM') + { + return $table_status['Rows']; + } + + return parent::get_row_count($table_name); + } + + /** + * Gets some information about the specified table. + * + * @param string $table_name Table name + * + * @return array + * + * @access protected + */ + function get_table_status($table_name) + { + $sql = "SHOW TABLE STATUS + LIKE '" . $this->sql_escape($table_name) . "'"; + $result = $this->sql_query($sql); + $table_status = $this->sql_fetchrow($result); + $this->sql_freeresult($result); + + return $table_status; + } + /** * Build LIKE expression * @access private diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index e5e5e4983e..23b9f1c658 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -375,6 +375,10 @@ class phpbb_extension_finder { $directory_pattern = preg_quote(DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); } + if ($is_dir) + { + $directory_pattern .= '$'; + } $directory_pattern = '#' . $directory_pattern . '#'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 438578e7e7..c38f0df32e 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -61,7 +61,7 @@ class phpbb_extension_manager * * @return null */ - protected function load_extensions() + public function load_extensions() { $sql = 'SELECT * FROM ' . $this->extension_table; @@ -167,6 +167,11 @@ class phpbb_extension_manager $this->db->sql_query($sql); } + if ($this->cache) + { + $this->cache->destroy($this->cache_name); + } + return !$active; } @@ -219,6 +224,11 @@ class phpbb_extension_manager WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + if ($this->cache) + { + $this->cache->destroy($this->cache_name); + } + return true; } @@ -234,6 +244,11 @@ class phpbb_extension_manager WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + if ($this->cache) + { + $this->cache->destroy($this->cache_name); + } + return false; } @@ -292,6 +307,11 @@ class phpbb_extension_manager WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + if ($this->cache) + { + $this->cache->destroy($this->cache_name); + } + return true; } @@ -301,6 +321,11 @@ class phpbb_extension_manager WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + if ($this->cache) + { + $this->cache->destroy($this->cache_name); + } + return false; } @@ -329,7 +354,8 @@ class phpbb_extension_manager $available = array(); $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/')); + new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'), + RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file_info) { if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->phpEx) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 45958d1a0d..024fa612f0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3091,6 +3091,11 @@ function parse_cfg_file($filename, $lines = false) $parsed_items[$key] = $value; } + + if (isset($parsed_items['inherit_from']) && isset($parsed_items['name']) && $parsed_items['inherit_from'] == $parsed_items['name']) + { + unset($parsed_items['inherit_from']); + } return $parsed_items; } @@ -3796,11 +3801,23 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } } + $log_text = $msg_text; + $backtrace = get_backtrace(); + if ($backtrace) + { + $log_text .= '

BACKTRACE
' . $backtrace; + } + + if (defined('IN_INSTALL') || defined('DEBUG_EXTRA') || isset($auth) && $auth->acl_get('a_')) + { + $msg_text = $log_text; + } + if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops $db->sql_return_on_error(true); - add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $msg_text); + add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $log_text); $db->sql_return_on_error(false); } @@ -4616,7 +4633,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 7fdf874456..9798e514c1 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -847,15 +847,13 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Remove the message from the search index - $search_type = basename($config['search_type']); + $search_type = $config['search_type']; - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx"); - $error = false; $search = new $search_type($error); @@ -2330,7 +2328,7 @@ function cache_moderators() $ug_id_ary = array_keys($hold_ary); // Remove users who have group memberships with DENY moderator permissions - $sql_ary = array( + $sql_ary_deny = array( 'SELECT' => 'a.forum_id, ug.user_id, g.group_id', 'FROM' => array( @@ -2357,7 +2355,7 @@ function cache_moderators() AND ug.user_pending = 0 AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char), ); - $sql = $db->sql_build_query('SELECT', $sql_ary); + $sql = $db->sql_build_query('SELECT', $sql_ary_deny); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index de25e390fa..1486113013 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -126,7 +126,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) if (!@file_exists($filename)) { send_status_line(404, 'Not Found'); - trigger_error($user->lang['ERROR_NO_ATTACHMENT'] . '

' . sprintf($user->lang['FILE_NOT_FOUND_404'], $filename)); + trigger_error('ERROR_NO_ATTACHMENT'); } // Correct the mime type - we force application/octetstream for all files, except images diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 13d9b6a5cb..f4e49b1b18 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1136,6 +1136,7 @@ class smtp_class { var $server_response = ''; var $socket = 0; + protected $socket_tls = false; var $responses = array(); var $commands = array(); var $numeric_response_code = 0; @@ -1286,30 +1287,29 @@ class smtp_class } } - // Try EHLO first - $this->server_send("EHLO {$local_host}"); - if ($err_msg = $this->server_parse('250', __LINE__)) + $hello_result = $this->hello($local_host); + if (!is_null($hello_result)) { - // a 503 response code means that we're already authenticated - if ($this->numeric_response_code == 503) - { - return false; - } - - // If EHLO fails, we try HELO - $this->server_send("HELO {$local_host}"); - if ($err_msg = $this->server_parse('250', __LINE__)) - { - return ($this->numeric_response_code == 503) ? false : $err_msg; - } + return $hello_result; } - foreach ($this->responses as $response) + // SMTP STARTTLS (RFC 3207) + if (!$this->socket_tls) { - $response = explode(' ', $response); - $response_code = $response[0]; - unset($response[0]); - $this->commands[$response_code] = implode(' ', $response); + $this->socket_tls = $this->starttls(); + + if ($this->socket_tls) + { + // Switched to TLS + // RFC 3207: "The client MUST discard any knowledge obtained from the server, [...]" + // So say hello again + $hello_result = $this->hello($local_host); + + if (!is_null($hello_result)) + { + return $hello_result; + } + } } // If we are not authenticated yet, something might be wrong if no username and passwd passed @@ -1355,6 +1355,79 @@ class smtp_class return $this->$method($username, $password); } + /** + * SMTP EHLO/HELO + * + * @return mixed Null if the authentication process is supposed to continue + * False if already authenticated + * Error message (string) otherwise + */ + protected function hello($hostname) + { + // Try EHLO first + $this->server_send("EHLO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + // a 503 response code means that we're already authenticated + if ($this->numeric_response_code == 503) + { + return false; + } + + // If EHLO fails, we try HELO + $this->server_send("HELO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + } + + foreach ($this->responses as $response) + { + $response = explode(' ', $response); + $response_code = $response[0]; + unset($response[0]); + $this->commands[$response_code] = implode(' ', $response); + } + } + + /** + * SMTP STARTTLS (RFC 3207) + * + * @return bool Returns true if TLS was started + * Otherwise false + */ + protected function starttls() + { + if (!function_exists('stream_socket_enable_crypto')) + { + return false; + } + + if (!isset($this->commands['STARTTLS'])) + { + return false; + } + + $this->server_send('STARTTLS'); + + if ($err_msg = $this->server_parse('220', __LINE__)) + { + return false; + } + + $result = false; + $stream_meta = stream_get_meta_data($this->socket); + + if (socket_set_blocking($this->socket, 1)); + { + $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + socket_set_blocking($this->socket, (int) $stream_meta['blocked']); + } + + return $result; + } + /** * Pop before smtp authentication */ diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index d810285313..db7defdc48 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -438,6 +438,8 @@ class p_master * Loads currently active module * * This method loads a given module, passing it the relevant id and mode. + * + * @param string $mode mode, as passed through to the module */ function load_active($mode = false, $module_url = false, $execute_module = true) { @@ -801,9 +803,22 @@ class p_master /** * Load module as the current active one without the need for registering it + * + * @param string $class module class (acp/mcp/ucp) + * @param string $name module name (class name of the module, or its basename + * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra) + * @param string $mode mode, as passed through to the module + * */ function load($class, $name, $mode = false) { + // new modules use the full class names, old ones are always called _, e.g. acp_board + // in the latter case this function may be called as load('acp', 'board') + if (!class_exists($name) && substr($name, 0, strlen($class) + 1) !== $class . '_') + { + $name = $class . '_' . $name; + } + $this->p_class = $class; $this->p_name = $name; @@ -908,6 +923,6 @@ class p_master */ protected function is_full_class($basename) { - return (substr($basename, 0, 6) === 'phpbb_' || substr($basename, 0, strlen($this->p_class) + 1) === $this->p_class . '_'); + return (preg_match('/^(phpbb|ucp|mcp|acp)_/', $basename)); } } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 104fc841b6..4e4ce5bca7 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1286,6 +1286,20 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id { $msg_users[] = $row; $update_notification[$row['notify_type']][] = $row['user_id']; + + /* + * We also update the forums watch table for this user when we are + * sending out a topic notification to prevent sending out another + * notification in case this user is also subscribed to the forum + * this topic was posted in. + * Since an UPDATE query is used, this has no effect on users only + * subscribed to the topic (i.e. no row is created) and should not + * be a performance issue. + */ + if ($row['notify_type'] === 'topic') + { + $update_notification['forum'][] = $row['user_id']; + } } } unset($notify_rows); diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 26c4283f67..34d973b3a6 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -570,7 +570,12 @@ class custom_profile $this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false); } - if ($value == $ident_ary['data']['field_novalue']) + // If a dropdown field is required, users + // cannot choose the "no value" option. + // They must choose one of the other options. + // Therefore, here we treat a value equal to + // the "no value" as a lack of value, i.e. NULL. + if ($value == $ident_ary['data']['field_novalue'] && $ident_ary['data']['field_required']) { return NULL; } @@ -625,10 +630,10 @@ class custom_profile $profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; $user_ident = $profile_row['field_ident']; - // checkbox - only testing for isset + // checkbox - set the value to "true" if it has been set to 1 if ($profile_row['field_type'] == FIELD_BOOL && $profile_row['field_length'] == 2) { - $value = (isset($_REQUEST[$profile_row['field_ident']])) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]); + $value = (isset($_REQUEST[$profile_row['field_ident']]) && request_var($profile_row['field_ident'], $default_value) == 1) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]); } else if ($profile_row['field_type'] == FIELD_INT) { diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 10e5956fc2..a21c67924d 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -907,16 +907,11 @@ function mcp_fork_topic($topic_ids) if (!isset($search_type) && $topic_row['enable_indexing']) { // Select the search method and do some additional checks to ensure it can actually be utilised - $search_type = basename($config['search_type']); - - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) - { - trigger_error('NO_SUCH_SEARCH_MODULE'); - } + $search_type = $config['search_type']; if (!class_exists($search_type)) { - include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + trigger_error('NO_SUCH_SEARCH_MODULE'); } $error = false; diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index ee79928eb1..2a52a858b3 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -464,12 +464,10 @@ function change_poster(&$post_info, $userdata) } // refresh search cache of this post - $search_type = basename($config['search_type']); + $search_type = $config['search_type']; - if (file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (class_exists($search_type)) { - require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); - // We do some additional checks in the module to ensure it can actually be utilised $error = false; $search = new $search_type($error); diff --git a/phpBB/includes/request/type_cast_helper.php b/phpBB/includes/request/type_cast_helper.php index 5aa0372328..561e8fc251 100644 --- a/phpBB/includes/request/type_cast_helper.php +++ b/phpBB/includes/request/type_cast_helper.php @@ -34,7 +34,7 @@ class phpbb_request_type_cast_helper implements phpbb_request_type_cast_helper_i */ public function __construct() { - if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) + if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) { $this->strip = false; } diff --git a/phpBB/includes/search/base.php b/phpBB/includes/search/base.php index f691bc942f..b364dead9a 100644 --- a/phpBB/includes/search/base.php +++ b/phpBB/includes/search/base.php @@ -294,7 +294,7 @@ class phpbb_search_base $sql_where = ''; foreach ($authors as $author) { - $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors LIKE \'% ' . (int) $author . ' %\''; + $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors ' . $db->sql_like_expression($db->any_char . ' ' . (int) $author . ' ' . $db->any_char); } $sql = 'SELECT search_key diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index f1e45c57cc..7c94038cc9 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -3,7 +3,7 @@ * * @package search * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 v2 +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -708,7 +708,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base */ function index_remove($post_ids, $author_ids, $forum_ids) { - $this->destroy_cache(array(), $author_ids); + $this->destroy_cache(array(), array_unique($author_ids)); } /** @@ -897,11 +897,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base } $db->sql_freeresult($result); - $sql = 'SELECT COUNT(post_id) as total_posts - FROM ' . POSTS_TABLE; - $result = $db->sql_query($sql); - $this->stats['total_posts'] = (int) $db->sql_fetchfield('total_posts'); - $db->sql_freeresult($result); + $this->stats['total_posts'] = empty($this->stats) ? 0 : $db->get_estimated_row_count(POSTS_TABLE); } /** diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index b9085695ac..3e029c86d0 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -1335,7 +1335,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $db->sql_query($sql); } - $this->destroy_cache(array_unique($word_texts), $author_ids); + $this->destroy_cache(array_unique($word_texts), array_unique($author_ids)); } /** @@ -1462,17 +1462,8 @@ class phpbb_search_fulltext_native extends phpbb_search_base { global $db; - $sql = 'SELECT COUNT(*) as total_words - FROM ' . SEARCH_WORDLIST_TABLE; - $result = $db->sql_query($sql); - $this->stats['total_words'] = (int) $db->sql_fetchfield('total_words'); - $db->sql_freeresult($result); - - $sql = 'SELECT COUNT(*) as total_matches - FROM ' . SEARCH_WORDMATCH_TABLE; - $result = $db->sql_query($sql); - $this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches'); - $db->sql_freeresult($result); + $this->stats['total_words'] = $db->get_estimated_row_count(SEARCH_WORDLIST_TABLE); + $this->stats['total_matches'] = $db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE); } /** diff --git a/phpBB/includes/template/context.php b/phpBB/includes/template/context.php index 65a3531bc5..ec09da1cf3 100644 --- a/phpBB/includes/template/context.php +++ b/phpBB/includes/template/context.php @@ -53,7 +53,9 @@ class phpbb_template_context } /** - * Assign a single variable to a single key + * Assign a single scalar value to a single key. + * + * Value can be a string, an integer or a boolean. * * @param string $varname Variable name * @param string $varval Value to assign to variable @@ -65,6 +67,21 @@ class phpbb_template_context return true; } + /** + * Append text to the string value stored in a key. + * + * Text is appended using the string concatenation operator (.). + * + * @param string $varname Variable name + * @param string $varval Value to append to variable + */ + public function append_var($varname, $varval) + { + $this->rootref[$varname] = (isset($this->rootref[$varname]) ? $this->rootref[$varname] : '') . $varval; + + return true; + } + /** * Returns a reference to template data array. * diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index 989322320b..bac5445511 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -128,7 +128,7 @@ class phpbb_template { $templates = array($template_name => $template_path); - if ($fallback_template_path !== false) + if ($fallback_template_name !== false) { $templates[$fallback_template_name] = $fallback_template_path; } @@ -306,7 +306,7 @@ class phpbb_template * * @param string $handle Handle of the template to load * @return phpbb_template_renderer Template renderer object, or null on failure - * @uses template_compile is used to compile template source + * @uses phpbb_template_compile is used to compile template source */ private function _tpl_load($handle) { @@ -378,7 +378,9 @@ class phpbb_template } /** - * Assign a single variable to a single key + * Assign a single scalar value to a single key. + * + * Value can be a string, an integer or a boolean. * * @param string $varname Variable name * @param string $varval Value to assign to variable @@ -388,6 +390,19 @@ class phpbb_template $this->context->assign_var($varname, $varval); } + /** + * Append text to the string value stored in a key. + * + * Text is appended using the string concatenation operator (.). + * + * @param string $varname Variable name + * @param string $varval Value to append to variable + */ + public function append_var($varname, $varval) + { + $this->context->append_var($varname, $varval); + } + // Docstring is copied from phpbb_template_context method with the same name. /** * Assign key variable pairs from an array to a specified block diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index d0df70d2f5..9d81503f0a 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -46,7 +46,6 @@ class ucp_profile $data = array( 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), 'email' => strtolower(request_var('email', $user->data['user_email'])), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'cur_password' => request_var('cur_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), @@ -65,7 +64,6 @@ class ucp_profile 'email' => array( array('string', false, 6, 60), array('email')), - 'email_confirm' => array('string', true, 6, 60), ); if ($auth->acl_get('u_chgname') && $config['allow_namechange']) @@ -78,11 +76,6 @@ class ucp_profile $error = validate_data($data, $check_ary); - if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) - { - $error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY'; - } - if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) { $error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index f3ce674c3a..5d85029e62 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -99,7 +99,6 @@ class ucp_register $s_hidden_fields = array_merge($s_hidden_fields, array( 'username' => utf8_normalize_nfc(request_var('username', '', true)), 'email' => strtolower(request_var('email', '')), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => $user->lang_name, 'tz' => request_var('tz', (float) $config['board_timezone']), )); @@ -164,31 +163,14 @@ class ucp_register $captcha->init(CONFIRM_REG); } - // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1 - $timezone = date('Z') / 3600; - $is_dst = date('I'); - - if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1)) - { - $timezone = ($is_dst) ? $timezone - 1 : $timezone; - - if (!isset($user->lang['tz_zones'][(string) $timezone])) - { - $timezone = $config['board_timezone']; - } - } - else - { - $is_dst = $config['board_dst']; - $timezone = $config['board_timezone']; - } + $is_dst = $config['board_dst']; + $timezone = $config['board_timezone']; $data = array( 'username' => utf8_normalize_nfc(request_var('username', '', true)), 'new_password' => request_var('new_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), 'email' => strtolower(request_var('email', '')), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => basename(request_var('lang', $user->lang_name)), 'tz' => request_var('tz', (float) $timezone), ); @@ -207,7 +189,6 @@ class ucp_register 'email' => array( array('string', false, 6, 60), array('email')), - 'email_confirm' => array('string', false, 6, 60), 'tz' => array('num', false, -14, 14), 'lang' => array('language_iso_name'), )); @@ -252,11 +233,6 @@ class ucp_register { $error[] = $user->lang['NEW_PASSWORD_ERROR']; } - - if ($data['email'] != $data['email_confirm']) - { - $error[] = $user->lang['NEW_EMAIL_ERROR']; - } } if (!sizeof($error)) @@ -471,7 +447,6 @@ class ucp_register 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'EMAIL' => $data['email'], - 'EMAIL_CONFIRM' => $data['email_confirm'], 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), diff --git a/phpBB/index.php b/phpBB/index.php index 5cd6d49ebc..f1243bb336 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -80,7 +80,7 @@ if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets(' $leap_year_birthdays = ''; if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L')) { - $leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; + $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; } $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday @@ -114,7 +114,7 @@ if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets(' // Assign index specific vars $template->assign_vars(array( - 'TOTAL_POSTS' => $user->lang('TOTAL_POSTS', (int) $config['num_posts']), + 'TOTAL_POSTS' => $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']), 'TOTAL_TOPICS' => $user->lang('TOTAL_TOPICS', (int) $config['num_topics']), 'TOTAL_USERS' => $user->lang('TOTAL_USERS', (int) $config['num_users']), 'NEWEST_USER' => $user->lang('NEWEST_USER', get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 5a868004ef..db974f9903 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -735,22 +735,20 @@ class install_convert extends module $this->p_master->error(sprintf($user->lang['COULD_NOT_FIND_PATH'], $convert->options['forum_path']), __LINE__, __FILE__); } - $search_type = basename(trim($config['search_type'])); + $search_type = $config['search_type']; // For conversions we are a bit less strict and set to a search backend we know exist... - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { - $search_type = 'fulltext_native'; + $search_type = 'phpbb_search_fulltext_native'; set_config('search_type', $search_type); } - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); - $error = false; $convert->fulltext_search = new $search_type($error); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index df9e47ddec..4663b5204e 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -689,7 +689,7 @@ class install_install extends module $error = array(); // Check the entered email address and password - if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email1'] == '' || $data['board_email2'] == '') + if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email'] == '') { $error[] = $lang['INST_ERR_MISSING_DATA']; } @@ -721,12 +721,7 @@ class install_install extends module $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG']; } - if ($data['board_email1'] != $data['board_email2'] && $data['board_email1'] != '') - { - $error[] = $lang['INST_ERR_EMAIL_MISMATCH']; - } - - if ($data['board_email1'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email1'])) + if ($data['board_email'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email'])) { $error[] = $lang['INST_ERR_EMAIL_INVALID']; } @@ -1250,11 +1245,11 @@ class install_install extends module WHERE config_name = 'server_port'", 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email1']) . "' + SET config_value = '" . $db->sql_escape($data['board_email']) . "' WHERE config_name = 'board_email'", 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email1']) . "' + SET config_value = '" . $db->sql_escape($data['board_email']) . "' WHERE config_name = 'board_contact'", 'UPDATE ' . $data['table_prefix'] . "config @@ -1314,7 +1309,7 @@ class install_install extends module WHERE config_name = 'avatar_salt'", 'UPDATE ' . $data['table_prefix'] . "users - SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' + SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' WHERE username = 'Admin'", 'UPDATE ' . $data['table_prefix'] . "moderator_cache @@ -1830,7 +1825,7 @@ class install_install extends module $messenger->template('installed', $data['language']); - $messenger->to($data['board_email1'], $data['admin_name']); + $messenger->to($data['board_email'], $data['admin_name']); $messenger->anti_abuse_headers($config, $user); @@ -1889,8 +1884,7 @@ class install_install extends module 'admin_name' => utf8_normalize_nfc(request_var('admin_name', '', true)), 'admin_pass1' => request_var('admin_pass1', '', true), 'admin_pass2' => request_var('admin_pass2', '', true), - 'board_email1' => strtolower(request_var('board_email1', '')), - 'board_email2' => strtolower(request_var('board_email2', '')), + 'board_email' => strtolower(request_var('board_email', '')), 'img_imagick' => request_var('img_imagick', ''), 'ftp_path' => request_var('ftp_path', ''), 'ftp_user' => request_var('ftp_user', ''), @@ -1929,8 +1923,7 @@ class install_install extends module 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true), 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), - 'board_email1' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false), - 'board_email2' => array('lang' => 'CONTACT_EMAIL_CONFIRM', 'type' => 'text:25:100', 'explain' => false), + 'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false), ); var $advanced_config_options = array( 'legend1' => 'ACP_EMAIL_SETTINGS', diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index bee27d3c39..7f1ecb5c01 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -418,7 +418,7 @@ $lang = array_merge($lang, array( 'INACTIVE_REASON_UNKNOWN' => 'Unknown', 'INACTIVE_USERS' => 'Inactive users', 'INACTIVE_USERS_EXPLAIN' => 'This is a list of users who have registered but whose accounts are inactive. You can activate, delete or remind (by sending an e-mail) these users if you wish.', - 'INACTIVE_USERS_EXPLAIN_INDEX' => 'This is a list of the last 10 registered users who have inactive accounts. A full list is available from the appropriate menu item or by following the link below from where you can activate, delete or remind (by sending an e-mail) these users if you wish.', + 'INACTIVE_USERS_EXPLAIN_INDEX' => 'This is a list of the last 10 registered users who have inactive accounts. Accounts are inactive either because account activation was enabled in user registration settings and these users’ accounts have not yet been activated, or because these accounts have been deactivated. A full list is available by following the link below from where you can activate, delete or remind (by sending an e-mail) these users if you wish.', 'NO_INACTIVE_USERS' => 'No inactive users', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 631805afc2..7741ff8d1f 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -613,7 +613,6 @@ $lang = array_merge($lang, array( 'TOO_LONG_USER_PASSWORD' => 'The password you entered is too long.', 'TOO_LONG_USERNAME' => 'The username you entered is too long.', 'TOO_LONG_EMAIL' => 'The e-mail address you entered is too long.', - 'TOO_LONG_EMAIL_CONFIRM' => 'The e-mail address confirmation you entered is too long.', 'TOO_LONG_WEBSITE' => 'The website address you entered is too long.', 'TOO_LONG_YIM' => 'The Yahoo! Messenger name you entered is too long.', @@ -635,7 +634,6 @@ $lang = array_merge($lang, array( 'TOO_SHORT_USER_PASSWORD' => 'The password you entered is too short.', 'TOO_SHORT_USERNAME' => 'The username you entered is too short.', 'TOO_SHORT_EMAIL' => 'The e-mail address you entered is too short.', - 'TOO_SHORT_EMAIL_CONFIRM' => 'The e-mail address confirmation you entered is too short.', 'TOO_SHORT_WEBSITE' => 'The website address you entered is too short.', 'TOO_SHORT_YIM' => 'The Yahoo! Messenger name you entered is too short.', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 858065b643..254db4a5c1 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -51,6 +51,7 @@ $lang = array_merge($lang, array( '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' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please proceed by first installing phpBB3.', + 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', 'CATEGORY' => 'Category', 'CACHE_STORE' => 'Cache type', @@ -71,14 +72,13 @@ $lang = array_merge($lang, array( 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', 'CONFIG_RETRY' => 'Retry', - 'CONTACT_EMAIL_CONFIRM' => 'Confirm contact e-mail', 'CONTINUE_CONVERT' => 'Continue conversion', 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', 'CONTINUE_LAST' => 'Continue last statements', 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', 'CONVERT' => 'Convert', 'CONVERT_COMPLETE' => 'Conversion completed', - 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.0. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', + 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', 'CONVERT_NEW_CONVERSION' => 'New conversion', @@ -155,7 +155,7 @@ $lang = array_merge($lang, array( 'DLL_XML' => 'XML support [ Jabber ]', 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', 'DL_CONFIG' => 'Download config', - 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.0 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done” to move to the next stage.', + 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.1 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done” to move to the next stage.', 'DL_DOWNLOAD' => 'Download', 'DONE' => 'Done', @@ -331,7 +331,7 @@ $lang = array_merge($lang, array( 'STAGE_ADVANCED_EXPLAIN' => 'The settings on this page are only necessary to set if you know that you require something different from the default. If you are unsure, just proceed to the next page, as these settings can be altered from the Administration Control Panel later.', 'STAGE_CONFIG_FILE' => 'Configuration file', 'STAGE_CREATE_TABLE' => 'Create database tables', - 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.0 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', + 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.1 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', 'STAGE_DATABASE' => 'Database settings', 'STAGE_FINAL' => 'Final stage', 'STAGE_INTRO' => 'Introduction', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 264b6ed4d8..aa1e9c27ce 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -122,8 +122,6 @@ $lang = array_merge($lang, array( 'CLICK_RETURN_FOLDER' => '%1$sReturn to your “%3$s” folder%2$s', 'CONFIRMATION' => 'Confirmation of registration', 'CONFIRM_CHANGES' => 'Confirm changes', - 'CONFIRM_EMAIL' => 'Confirm e-mail address', - 'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing your e-mail address.', 'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', 'VC_REFRESH' => 'Refresh confirmation code', 'VC_REFRESH_EXPLAIN' => 'If you cannot read the code you can request a new one by clicking the button.', @@ -282,8 +280,6 @@ $lang = array_merge($lang, array( 'MOVE_TO_FOLDER' => 'Move to folder', 'MOVE_UP' => 'Move up', - 'NEW_EMAIL_CONFIRM_EMPTY' => 'You did not enter a confirm e-mail address.', - 'NEW_EMAIL_ERROR' => 'The e-mail addresses you entered do not match.', 'NEW_FOLDER_NAME' => 'New folder name', 'NEW_PASSWORD' => 'New password', 'NEW_PASSWORD_CONFIRM_EMPTY' => 'You did not enter a confirm password.', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 1201aceff9..cf2cb5b06d 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -571,11 +571,11 @@ switch ($mode) $module->list_modules('ucp'); $module->list_modules('mcp'); - $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; - $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; - $zebra_enabled = ($module->loaded('zebra')) ? true : false; - $friends_enabled = ($module->loaded('zebra', 'friends')) ? true : false; - $foes_enabled = ($module->loaded('zebra', 'foes')) ? true : false; + $user_notes_enabled = ($module->loaded('mcp_notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('mcp_warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('ucp_zebra')) ? true : false; + $friends_enabled = ($module->loaded('ucp_zebra', 'friends')) ? true : false; + $foes_enabled = ($module->loaded('ucp_zebra', 'foes')) ? true : false; unset($module); } diff --git a/phpBB/search.php b/phpBB/search.php index 4f30cdc1dd..2b463aec9c 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -465,33 +465,60 @@ if ($keywords || $author || $author_id || $search_id || $submit) $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; $total_match_count = 0; + // Set limit for the $total_match_count to reduce server load + $total_matches_limit = 1000; + $found_more_search_matches = false; + if ($search_id) { if ($sql) { - // only return up to 1000 ids (the last one will be removed later) - $result = $db->sql_query_limit($sql, 1001 - $start, $start); + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $result = $db->sql_query_limit($sql, $total_matches_limit + 1); while ($row = $db->sql_fetchrow($result)) { $id_ary[] = (int) $row[$field]; } $db->sql_freeresult($result); - - $total_match_count = sizeof($id_ary) + $start; - $id_ary = array_slice($id_ary, 0, $per_page); } else if ($search_id == 'unreadposts') { - $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, 1001 - $start, $start)); - - $total_match_count = sizeof($id_ary) + $start; - $id_ary = array_slice($id_ary, 0, $per_page); + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, $total_matches_limit + 1)); } else { $search_id = ''; } + + $total_match_count = sizeof($id_ary); + if ($total_match_count) + { + // Limit the number to $total_matches_limit for pre-made searches + if ($total_match_count > $total_matches_limit) + { + $found_more_search_matches = true; + $total_match_count = $total_matches_limit; + } + + // Make sure $start is set to the last page if it exceeds the amount + if ($start < 0) + { + $start = 0; + } + else if ($start >= $total_match_count) + { + $start = floor(($total_match_count - 1) / $per_page) * $per_page; + } + + $id_ary = array_slice($id_ary, $start, $per_page); + } + else + { + // Set $start to 0 if no matches were found + $start = 0; + } } // make sure that some arrays are always in the same order @@ -539,10 +566,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $icons = $cache->obtain_icons(); // Output header - if ($search_id && ($total_match_count > 1000)) + if ($found_more_search_matches) { - // limit the number to 1000 for pre-made searches - $total_match_count--; $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); } else diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index 21431b4bc1..e9635e528c 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -10,7 +10,7 @@

{L_LATEST_UNAPPROVED}

-

{L_UNAPPROVED_TOTAL}

+

{L_UNAPPROVED_TOTAL}

    @@ -40,8 +40,6 @@
- -

{L_UNAPPROVED_POSTS_ZERO_TOTAL}

@@ -64,7 +62,7 @@

{L_LATEST_REPORTED}

-

{L_REPORTS_TOTAL}

+

{L_REPORTS_TOTAL}

    @@ -92,8 +90,6 @@
- -

{L_REPORTS_ZERO_TOTAL}

@@ -105,7 +101,7 @@

{L_LATEST_REPORTED_PMS}

-

{L_PM_REPORTS_TOTAL}

+

{L_PM_REPORTS_TOTAL}

    @@ -133,8 +129,6 @@
- -

{L_PM_REPORTS_ZERO_TOTAL}

diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index ff53e42119..504d1b80ef 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -80,7 +80,7 @@ -
+
diff --git a/phpBB/styles/prosilver/template/memberlist_leaders.html b/phpBB/styles/prosilver/template/memberlist_leaders.html index 1a63793bc3..bce1a69619 100644 --- a/phpBB/styles/prosilver/template/memberlist_leaders.html +++ b/phpBB/styles/prosilver/template/memberlist_leaders.html @@ -5,7 +5,7 @@ -
+
diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html index 6616b95a73..4b1d30d77d 100644 --- a/phpBB/styles/prosilver/template/search_body.html +++ b/phpBB/styles/prosilver/template/search_body.html @@ -98,7 +98,7 @@ -
+
diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index 8d976247bc..22ca73b487 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -23,3 +23,8 @@ version = 3.1.0-dev # Defining a different template bitfield template_bitfield = lNg= + +# Template inheritance +# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/ +# Set value to empty to ignore template inheritance +inherit_from = prosilver diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 68f89edf12..20afd119cc 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -34,8 +34,8 @@
{L_JOINED}:
{JOINED}
{L_VISITED}:
{LAST_VISIT_YOU}
{L_TOTAL_POSTS}:
{POSTS} | {L_SEARCH_YOUR_POSTS}
({POSTS_DAY} / {POSTS_PCT}){POSTS}
-
{L_ACTIVE_IN_FORUM}:
{ACTIVE_FORUM}
({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})
-
{L_ACTIVE_IN_TOPIC}:
{ACTIVE_TOPIC}
({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})
+
{L_ACTIVE_IN_FORUM}:
{ACTIVE_FORUM}
({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})
+
{L_ACTIVE_IN_TOPIC}:
{ACTIVE_TOPIC}
({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})
{L_YOUR_WARNINGS}:
{WARNING_IMG} [{WARNINGS}]
diff --git a/phpBB/styles/prosilver/template/ucp_pm_message_header.html b/phpBB/styles/prosilver/template/ucp_pm_message_header.html index fcebab0868..ae66dd0a36 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_message_header.html +++ b/phpBB/styles/prosilver/template/ucp_pm_message_header.html @@ -1,25 +1,22 @@

{L_TITLE}: {CUR_FOLDER_NAME}

-
+
+ + - - + diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index d5f1608425..dac03c3505 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -2,7 +2,6 @@ -
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 5317068d89..5411fda572 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -1,18 +1,21 @@ - + +
+
+ -
+
{L_VIEW_PREVIOUS_HISTORY} {L_VIEW_NEXT_HISTORY}
-
-
+
+
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index e72d9bba6e..bafb64dbc8 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -1,10 +1,7 @@ - - - - + @@ -16,7 +13,7 @@
- +
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 815e55b6de..5cff0a811b 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -591,6 +591,19 @@ /* PM Styles ----------------------------------------*/ +/* PM panel adjustments */ +.rtl .reply-all a.right { + background-position: 5% 60%; +} + +.rtl .reply-all a.right:hover { + background-position: 3% 60%; +} + +.rtl .reply-all { + padding-left: 5px; +} + /* Defined rules list for PM options */ .rtl ol.def-rules { padding-right: 0; @@ -755,3 +768,33 @@ .rtl #wrap, .rtl .headerbar, .rtl #site-description, .rtl .navbar { position: relative; } + +/* Former imageset */ +.rtl .imageset.site_logo { + padding-right: 139px; + padding-left: 0; +} +.rtl .imageset.forum_link, .rtl .imageset.forum_read, .rtl .imageset.forum_read_locked, .rtl .imageset.forum_read_subforum, .rtl .imageset.forum_unread, .rtl .imageset.forum_unread_locked, .rtl .imageset.forum_unread_subforum, .rtl .imageset.topic_moved, .rtl .imageset.topic_read, .rtl .imageset.topic_read_mine, .rtl .imageset.topic_read_hot, .rtl .imageset.topic_read_hot_mine, .rtl .imageset.topic_read_locked, .rtl .imageset.topic_read_locked_mine, .rtl .imageset.topic_unread, .rtl .imageset.topic_unread_mine, .rtl .imageset.topic_unread_hot, .rtl .imageset.topic_unread_hot_mine, .rtl .imageset.topic_unread_locked, .rtl .imageset.topic_unread_locked_mine, .rtl .imageset.sticky_read, .rtl .imageset.sticky_read_mine, .rtl .imageset.sticky_read_locked, .rtl .imageset.sticky_read_locked_mine, .rtl .imageset.sticky_unread, .rtl .imageset.sticky_unread_mine, .rtl .imageset.sticky_unread_locked, .rtl .imageset.sticky_unread_locked_mine, .rtl .imageset.announce_read, .rtl .imageset.announce_read_mine, .rtl .imageset.announce_read_locked, .rtl .imageset.announce_read_locked_mine, .rtl .imageset.announce_unread, .rtl .imageset.announce_unread_mine, .rtl .imageset.announce_unread_locked, .rtl .imageset.announce_unread_locked_mine, .rtl .imageset.global_read, .rtl .imageset.global_read_mine, .rtl .imageset.global_read_locked, .rtl .imageset.global_read_locked_mine, .rtl .imageset.global_unread, .rtl .imageset.global_unread_mine, .rtl .imageset.global_unread_locked, .rtl .imageset.global_unread_locked_mine, .rtl .imageset.pm_read, .rtl .imageset.pm_unread { + padding-right: 27px; + padding-left: 0; +} +.rtl .imageset.subforum_read, .rtl .imageset.subforum_unread, .rtl .imageset.icon_post_target, .rtl .imageset.icon_post_target_unread, .rtl .imageset.icon_topic_latest, .rtl .imageset.icon_topic_newest { + padding-right: 11px; + padding-left: 0; +} +.rtl .imageset.icon_back_top { + padding-right: 11px; + padding-left: 0; +} +.rtl .imageset.icon_contact_aim, .rtl .imageset.icon_contact_email, .rtl .imageset.icon_contact_icq, .rtl .imageset.icon_contact_jabber, .rtl .imageset.icon_contact_msnm, .rtl .imageset.icon_contact_www, .rtl .imageset.icon_contact_yahoo, .rtl .imageset.icon_post_delete, .rtl .imageset.icon_post_info, .rtl .imageset.icon_post_report, .rtl .imageset.icon_user_warn { + padding-right: 20px; + padding-left: 0; +} +.rtl .imageset.icon_topic_attach { + padding-right: 7px; + padding-left: 0; +} +.rtl .imageset.icon_topic_reported, .rtl .imageset.icon_topic_unapproved { + padding-right: 16px; + padding-left: 0; +} diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 7bc66f4e7d..caa85c9915 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -933,12 +933,6 @@ dl.mini dt { color: #000000 !important; } -/* PM panel adjustments */ -.pm-panel-header, -#cp-main .pm-message-nav { - border-bottom-color: #A4B3BF; -} - /* PM marking colours */ .pmlist li.pm_message_reported_colour, .pm_message_reported_colour { border-left-color: #BC2A4D; diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 8b5e09297e..7eb00bd808 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -418,7 +418,19 @@ table.info tbody th { } .forumbg table.table1 { - margin: 0 -2px -1px -1px; + margin: 0; +} + +.forumbg-table > .inner { + margin: 0 -1px; +} + +.forumbg-table > .inner > span.corners-top { + margin: 0 -4px -1px -4px; +} + +.forumbg-table > .inner > span.corners-bottom { + margin: -1px -4px 0 -4px; } /* Misc layout styles diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css index 708bfbaf83..aed88831a8 100644 --- a/phpBB/styles/prosilver/theme/cp.css +++ b/phpBB/styles/prosilver/theme/cp.css @@ -349,31 +349,17 @@ dl.mini dd { } /* PM panel adjustments */ -.pm-panel-header { - margin: 0; - padding-bottom: 10px; - border-bottom: 1px dashed #A4B3BF; +.reply-all a.left { + background-position: 3px 60%; +} + +.reply-all a.left:hover { + background-position: 0px 60%; } .reply-all { - display: block; - padding-top: 4px; - clear: both; - float: left; -} - -.pm-panel-message { - padding-top: 10px; -} - -.pm-return-to { - padding-top: 23px; -} - -#cp-main .pm-message-nav { - margin: 0; - padding: 2px 10px 5px 10px; - border-bottom: 1px dashed #A4B3BF; + font-size: 11px; + padding-top: 5px; } /* PM Message history */ diff --git a/phpBB/styles/prosilver/theme/en/stylesheet.css b/phpBB/styles/prosilver/theme/en/stylesheet.css index 62d6b86726..d17f9a5be4 100644 --- a/phpBB/styles/prosilver/theme/en/stylesheet.css +++ b/phpBB/styles/prosilver/theme/en/stylesheet.css @@ -11,6 +11,22 @@ ul.profile-icons li.pm-icon { width: 28px; height: 20px; } ul.profile-icons li.quote-icon { width: 54px; height: 20px; } ul.profile-icons li.edit-icon { width: 42px; height: 20px; } +/* Online image */ +.online { background-image: url("./icon_user_online.gif"); } + +/* Big button images */ +.reply-icon span { background-image: url("./button_topic_reply.gif"); } +.post-icon span { background-image: url("./button_topic_new.gif"); } +.locked-icon span { background-image: url("./button_topic_locked.gif"); } +.pmreply-icon span { background-image: url("./button_pm_reply.gif") ;} +.newpm-icon span { background-image: url("./button_pm_new.gif") ;} +.forwardpm-icon span { background-image: url("./button_pm_forward.gif") ;} + +/* Icon images */ +.pm-icon, .pm-icon a { background-image: url("./icon_contact_pm.gif"); } +.quote-icon, .quote-icon a { background-image: url("./icon_post_quote.gif"); } +.edit-icon, .edit-icon a { background-image: url("./icon_post_edit.gif"); } + /* EN Language Pack */ .imageset.icon_contact_pm { background-image: url("./icon_contact_pm.gif"); diff --git a/phpBB/styles/prosilver/theme/imageset.css b/phpBB/styles/prosilver/theme/imageset.css index cebab7845d..cb99e9e715 100644 --- a/phpBB/styles/prosilver/theme/imageset.css +++ b/phpBB/styles/prosilver/theme/imageset.css @@ -4,7 +4,6 @@ span.imageset { background: transparent none 0 0 no-repeat; margin: 0; padding: 0; - padding-right: 0 !important; width: 0; height: 0; overflow: hidden; diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css index 089bc6f764..ae724e1419 100644 --- a/phpBB/styles/prosilver/theme/tweaks.css +++ b/phpBB/styles/prosilver/theme/tweaks.css @@ -87,10 +87,6 @@ dl.icon { float: none; } -* html .forumbg table.table1 { - margin: 0 -2px 0px -1px; -} - /* Headerbar height fix for IE7 and below */ * html #site-description p { margin-bottom: 1.0em; diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html index 4c65f81643..e2edf0b810 100644 --- a/phpBB/styles/subsilver2/template/captcha_default.html +++ b/phpBB/styles/subsilver2/template/captcha_default.html @@ -12,6 +12,6 @@ - diff --git a/phpBB/styles/subsilver2/template/captcha_qa.html b/phpBB/styles/subsilver2/template/captcha_qa.html index 23d2a92f68..acc9cdcdfb 100644 --- a/phpBB/styles/subsilver2/template/captcha_qa.html +++ b/phpBB/styles/subsilver2/template/captcha_qa.html @@ -3,6 +3,6 @@ - + diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html index 262341e0c0..ba316517a9 100644 --- a/phpBB/styles/subsilver2/template/login_body.html +++ b/phpBB/styles/subsilver2/template/login_body.html @@ -68,7 +68,7 @@
{L_CONFIRM_CODE}:
{L_CONFIRM_CODE_EXPLAIN}
+ tabindex="{$CAPTCHA_TAB_INDEX}" />
{QA_CONFIRM_QUESTION}:
{L_CONFIRM_QUESTION_EXPLAIN}
tabindex="{$CAPTCHA_TAB_INDEX}" />
- + diff --git a/phpBB/styles/subsilver2/template/mcp_front.html b/phpBB/styles/subsilver2/template/mcp_front.html index f4b146f4c5..7c17e13c52 100644 --- a/phpBB/styles/subsilver2/template/mcp_front.html +++ b/phpBB/styles/subsilver2/template/mcp_front.html @@ -24,16 +24,10 @@ - - - - - - @@ -70,16 +64,10 @@ - - - - - -
{unapproved.POST_TIME}
{L_UNAPPROVED_POSTS_ZERO_TOTAL}
{L_UNAPPROVED_TOTAL}
{S_HIDDEN_FIELDS}  
{report.REPORTER_FULL} {report.REPORT_TIME}
{L_REPORTS_ZERO_TOTAL}
{L_REPORTS_TOTAL}


@@ -107,16 +95,10 @@ {pm_report.REPORTER_FULL} {pm_report.REPORT_TIME} - - - {L_PM_REPORTS_ZERO_TOTAL} - - {L_PM_REPORTS_TOTAL} -

diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index 67ef1443ab..0b44446abd 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -333,6 +333,7 @@ + diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index 82d3d2681b..cf5562a8a4 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -21,3 +21,7 @@ name = subsilver2 copyright = © phpBB Group, 2003 version = 3.1.0-dev +# Template inheritance +# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/ +# Set value to empty to ignore template inheritance +inherit_from = subsilver2 diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index 2290a392e1..1445a71a1b 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -48,11 +48,11 @@ {L_ACTIVE_IN_FORUM}: - {ACTIVE_FORUM}
[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]- + {ACTIVE_FORUM}
[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]- {L_ACTIVE_IN_TOPIC}: - {ACTIVE_TOPIC}
[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]- + {ACTIVE_TOPIC}
[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]- diff --git a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html index 1b1c28fa3b..96e2e26683 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html @@ -22,12 +22,6 @@ {L_EMAIL_ADDRESS}: {EMAIL} - - - {L_CONFIRM_EMAIL}:
{L_CONFIRM_EMAIL_EXPLAIN} - - - {L_NEW_PASSWORD}:
{L_CHANGE_PASSWORD_EXPLAIN} diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index ad6fb8d056..0c3533292d 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -41,10 +41,6 @@ {L_EMAIL_ADDRESS}: - - {L_CONFIRM_EMAIL}: - - {L_PASSWORD}:
{L_PASSWORD_EXPLAIN} diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index ee1a8f44dc..18d15a8d41 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -1094,3 +1094,41 @@ a.imageset { padding-left: 97px; padding-top: 27px; } + +/* RTL imageset entries */ +.rtl .imageset.site_logo { + padding-right: 170px; + padding-left: 0; +} +.rtl .imageset.upload_bar { + padding-right: 280px; + padding-left: 0; +} +.rtl .imageset.poll_left, .rtl .imageset.poll_right { + padding-right: 4px; + padding-left: 0; +} +.rtl .imageset.poll_center { + padding-right: 1px; + padding-left: 0; +} +.rtl .imageset.forum_link, .rtl .imageset.forum_read, .rtl .imageset.forum_read_locked, .rtl .imageset.forum_read_subforum, .rtl .imageset.forum_unread, .rtl .imageset.forum_unread_locked, .rtl .imageset.forum_unread_subforum { + padding-right: 46px; + padding-left: 0; +} +.rtl .imageset.topic_moved, .rtl .imageset.topic_read, .rtl .imageset.topic_read_mine, .rtl .imageset.topic_read_hot, .rtl .imageset.topic_read_hot_mine, .rtl .imageset.topic_read_locked, .rtl .imageset.topic_read_locked_mine, .rtl .imageset.topic_unread, .rtl .imageset.topic_unread_mine, .rtl .imageset.topic_unread_hot, .rtl .imageset.topic_unread_hot_mine, .rtl .imageset.topic_unread_locked, .rtl .imageset.topic_unread_locked_mine, .rtl .imageset.sticky_read, .rtl .imageset.sticky_read_mine, .rtl .imageset.sticky_read_locked, .rtl .imageset.sticky_read_locked_mine, .rtl .imageset.sticky_unread, .rtl .imageset.sticky_unread_mine, .rtl .imageset.sticky_unread_locked, .rtl .imageset.sticky_unread_locked_mine, .rtl .imageset.announce_read, .rtl .imageset.announce_read_mine, .rtl .imageset.announce_read_locked, .rtl .imageset.announce_read_locked_mine, .rtl .imageset.announce_unread, .rtl .imageset.announce_unread_mine, .rtl .imageset.announce_unread_locked, .rtl .imageset.announce_unread_locked_mine, .rtl .imageset.global_read, .rtl .imageset.global_read_mine, .rtl .imageset.global_read_locked, .rtl .imageset.global_read_locked_mine, .rtl .imageset.global_unread, .rtl .imageset.global_unread_mine, .rtl .imageset.global_unread_locked, .rtl .imageset.global_unread_locked_mine, .rtl .imageset.pm_read, .rtl .imageset.pm_unread, .rtl .imageset.icon_topic_reported, .rtl .imageset.icon_topic_unapproved { + padding-right: 19px; + padding-left: 0; +} +.rtl .imageset.icon_post_target, .rtl .imageset.icon_post_target_unread { + padding-right: 12px; + padding-left: 0; +} +.rtl .imageset.icon_topic_attach { + padding-right: 14px; + padding-left: 0; +} +.rtl .imageset.icon_topic_latest, .rtl .imageset.icon_topic_newest { + padding-right: 18px; + padding-left: 0; +} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 76dcfe22a3..2d91581cf4 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -282,7 +282,7 @@ if (!empty($_EXTRA_URL)) foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cb6edf8423..7cb6df3660 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -567,7 +567,7 @@ if (!empty($_EXTRA_URL)) foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 63e6f4b280..3544c66c3d 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,27 +10,11 @@ define('IN_PHPBB', true); $phpbb_root_path = 'phpBB/'; $phpEx = 'php'; -$table_prefix = 'phpbb_'; - -if (!defined('E_DEPRECATED')) -{ - define('E_DEPRECATED', 8192); -} -error_reporting(E_ALL & ~E_DEPRECATED); - -// If we are on PHP >= 6.0.0 we do not need some code -if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) -{ - define('STRIP', false); -} -else -{ - @set_magic_quotes_runtime(0); - define('STRIP', (get_magic_quotes_gpc()) ? true : false); -} +require_once $phpbb_root_path . 'includes/startup.php'; require_once $phpbb_root_path . 'vendor/.composer/autoload.php'; +$table_prefix = 'phpbb_'; require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx; diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 05b0e68e29..21b12777dc 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -357,4 +357,29 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertSame(false, $row); } + + public function test_get_row_count() + { + $this->assertSame( + 3, + (int) $this->new_dbal()->get_row_count('phpbb_users'), + "Failed asserting that user table has exactly 3 rows." + ); + } + + public function test_get_estimated_row_count() + { + $actual = $this->new_dbal()->get_estimated_row_count('phpbb_users'); + + if (is_string($actual) && isset($actual[0]) && $actual[0] === '~') + { + $actual = substr($actual, 1); + } + + $this->assertGreaterThan( + 1, + $actual, + "Failed asserting that estimated row count of user table is greater than 1." + ); + } } diff --git a/tests/extension/ext/foo/type/dummy/empty.txt b/tests/extension/ext/foo/type/dummy/empty.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/extension/fixtures/extensions.xml b/tests/extension/fixtures/extensions.xml index 65cb71c7a4..6eb6fd11a5 100644 --- a/tests/extension/fixtures/extensions.xml +++ b/tests/extension/fixtures/extensions.xml @@ -3,13 +3,16 @@ ext_nameext_active + ext_state foo 1 + vendor/moo 0 +
diff --git a/tests/group_positions/fixtures/group_positions.xml b/tests/group_positions/fixtures/group_positions.xml index 55b1c2e08d..00ea18fe4f 100644 --- a/tests/group_positions/fixtures/group_positions.xml +++ b/tests/group_positions/fixtures/group_positions.xml @@ -4,20 +4,24 @@ group_id group_teampage group_legend + group_desc 1 0 0 + 2 1 0 + 3 2 1 + diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index 3a03de6427..6987ae6c73 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -62,15 +62,18 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); } - protected function setup_engine() + protected function setup_engine(array $new_config = array()) { - global $phpbb_root_path, $phpEx, $config, $user; + global $phpbb_root_path, $phpEx, $user; + + $defaults = $this->config_defaults(); + $config = new phpbb_config(array_merge($defaults, $new_config)); $this->template_path = dirname(__FILE__) . '/templates'; $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; $this->template_locator = new phpbb_template_locator(); $this->template_provider = new phpbb_template_path_provider(); $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->template_locator, $this->template_provider); - $this->template->set_custom_template($this->template_path, 'tests', $this->parent_template_path); + $this->template->set_custom_template($this->template_path, 'tests', $this->parent_template_path, 'parent'); } } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 419c90bd2a..76b1af68d8 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -347,6 +347,42 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); } + public function test_append_var_without_assign_var() + { + $this->template->set_filenames(array( + 'append_var' => 'variable.html' + )); + + $items = array('This ', 'is ', 'a ', 'test'); + $expecting = implode('', $items); + + foreach ($items as $word) + { + $this->template->append_var('VARIABLE', $word); + } + + $this->assertEquals($expecting, $this->display('append_var')); + } + + public function test_append_var_with_assign_var() + { + $this->template->set_filenames(array( + 'append_var' => 'variable.html' + )); + + $start = 'This '; + $items = array('is ', 'a ', 'test'); + $expecting = $start . implode('', $items); + + $this->template->assign_var('VARIABLE', $start); + foreach ($items as $word) + { + $this->template->append_var('VARIABLE', $word); + } + + $this->assertEquals($expecting, $this->display('append_var')); + } + public function test_php() { $this->setup_engine(array('tpl_allow_php' => true)); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index a78837516b..5b60785fee 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -46,15 +46,20 @@ class phpbb_template_template_test_case extends phpbb_test_case return str_replace("\n\n", "\n", implode("\n", array_map('trim', explode("\n", trim($result))))); } - protected function setup_engine(array $new_config = array()) + protected function config_defaults() { - global $phpbb_root_path, $phpEx, $user; - $defaults = array( 'load_tplcompile' => true, 'tpl_allow_php' => false, ); + return $defaults; + } + protected function setup_engine(array $new_config = array()) + { + global $phpbb_root_path, $phpEx, $user; + + $defaults = $this->config_defaults(); $config = new phpbb_config(array_merge($defaults, $new_config)); $this->template_path = dirname(__FILE__) . '/templates'; diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index ca52d24b7e..b5e6f7e377 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -102,8 +102,7 @@ class phpbb_functional_test_case extends phpbb_test_case 'admin_name' => 'admin', 'admin_pass1' => 'admin', 'admin_pass2' => 'admin', - 'board_email1' => 'nobody@example.com', - 'board_email2' => 'nobody@example.com', + 'board_email' => 'nobody@example.com', )); $parseURL = parse_url(self::$config['phpbb_functional_url']);