diff options
-rw-r--r-- | phpBB/includes/acp/acp_captcha.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 7 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 20 | ||||
-rw-r--r-- | phpBB/style.php | 10 | ||||
-rw-r--r-- | tests/dbal/fixtures/styles.xml | 39 | ||||
-rw-r--r-- | tests/dbal/order_lower_test.php | 62 |
6 files changed, 123 insertions, 17 deletions
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 1893eed14f..469a367bba 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -96,7 +96,7 @@ class acp_captcha } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link(), E_USER_WARNING); + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } else { diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5300265686..e25061d6f0 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -540,6 +540,7 @@ parse_css_file = {PARSE_CSS_FILE} global $user, $template, $db, $config, $phpbb_root_path, $phpEx; $sql_from = ''; + $sql_sort = 'LOWER(' . $mode . '_name)'; $style_count = array(); switch ($mode) @@ -571,6 +572,9 @@ parse_css_file = {PARSE_CSS_FILE} case 'imageset': $sql_from = STYLES_IMAGESET_TABLE; break; + + default: + trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); } $l_prefix = strtoupper($mode); @@ -594,7 +598,8 @@ parse_css_file = {PARSE_CSS_FILE} ); $sql = "SELECT * - FROM $sql_from"; + FROM $sql_from + ORDER BY $sql_sort ASC"; $result = $db->sql_query($sql); $installed = array(); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 01b3ca92a9..852fc683f2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4631,11 +4631,11 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), - 'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme', - 'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template', - 'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template', - 'T_IMAGESET_PATH' => "{$web_path}styles/" . $user->theme['imageset_path'] . '/imageset', - 'T_IMAGESET_LANG_PATH' => "{$web_path}styles/" . $user->theme['imageset_path'] . '/imageset/' . $user->lang_name, + 'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme', + 'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['template_path']) . '/template', + 'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . rawurlencode($user->theme['template_inherit_path']) . '/template' : "{$web_path}styles/" . rawurlencode($user->theme['template_path']) . '/template', + 'T_IMAGESET_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['imageset_path']) . '/imageset', + 'T_IMAGESET_LANG_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['imageset_path']) . '/imageset/' . $user->lang_name, 'T_IMAGES_PATH' => "{$web_path}images/", 'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/", 'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/", @@ -4643,13 +4643,13 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/", 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", - 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&lang=' . $user->lang_name), + 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&lang=' . $user->lang_name), 'T_STYLESHEET_NAME' => $user->theme['theme_name'], - 'T_THEME_NAME' => $user->theme['theme_path'], - 'T_TEMPLATE_NAME' => $user->theme['template_path'], - 'T_SUPER_TEMPLATE_NAME' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? $user->theme['template_inherit_path'] : $user->theme['template_path'], - 'T_IMAGESET_NAME' => $user->theme['imageset_path'], + 'T_THEME_NAME' => rawurlencode($user->theme['theme_path']), + 'T_TEMPLATE_NAME' => rawurlencode($user->theme['template_path']), + 'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? $user->theme['template_inherit_path'] : $user->theme['template_path']), + 'T_IMAGESET_NAME' => rawurlencode($user->theme['imageset_path']), 'T_IMAGESET_LANG_NAME' => $user->data['user_lang'], 'T_IMAGES' => 'images', 'T_SMILIES' => $config['smilies_path'], diff --git a/phpBB/style.php b/phpBB/style.php index 916aa8ce5c..f1b41c6a85 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -216,10 +216,10 @@ if ($id) // Parse Theme Data $replace = array( - '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme', - '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $theme['template_path'] . '/template', - '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset', - '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user_image_lang, + '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['theme_path']) . '/theme', + '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['template_path']) . '/template', + '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['imageset_path']) . '/imageset', + '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['imageset_path']) . '/imageset/' . $user_image_lang, '{T_STYLESHEET_NAME}' => $theme['theme_name'], '{S_USER_LANG}' => $user['user_lang'] ); @@ -248,7 +248,7 @@ if ($id) $img_data = &$img_array[$img]; $imgsrc = ($img_data['image_lang'] ? $img_data['image_lang'] . '/' : '') . $img_data['image_filename']; $imgs[$img] = array( - 'src' => $phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $imgsrc, + 'src' => $phpbb_root_path . 'styles/' . rawurlencode($theme['imageset_path']) . '/imageset/' . $imgsrc, 'width' => $img_data['image_width'], 'height' => $img_data['image_height'], ); diff --git a/tests/dbal/fixtures/styles.xml b/tests/dbal/fixtures/styles.xml new file mode 100644 index 0000000000..47b384c47f --- /dev/null +++ b/tests/dbal/fixtures/styles.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>template_id</column> + <column>theme_id</column> + <column>imageset_id</column> + <row> + <value>1</value> + <value>prosilver</value> + <value>&copy; phpBB Group</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>prosilver2</value> + <value>&copy; phpBB Group</value> + <value>0</value> + <value>2</value> + <value>2</value> + <value>2</value> + </row> + <row> + <value>3</value> + <value>Prosilver1</value> + <value>&copy; phpBB Group</value> + <value>0</value> + <value>3</value> + <value>3</value> + <value>3</value> + </row> + </table> +</dataset> diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php new file mode 100644 index 0000000000..fd1c950252 --- /dev/null +++ b/tests/dbal/order_lower_test.php @@ -0,0 +1,62 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +class phpbb_dbal_order_lower_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/styles.xml'); + } + + public function test_cross_join() + { + $db = $this->new_dbal(); + + // http://tracker.phpbb.com/browse/PHPBB3-10507 + // Test ORDER BY LOWER(style_name) + $db->sql_return_on_error(true); + + $sql = 'SELECT * FROM phpbb_styles ORDER BY LOWER(style_name)'; + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array( + 'style_id' => 1, + 'style_name' => 'prosilver', + 'style_copyright' => '© phpBB Group', + 'style_active' => 1, + 'template_id' => 1, + 'theme_id' => 1, + 'imageset_id' => 1 + ), + array( + 'style_id' => 3, + 'style_name' => 'Prosilver1', + 'style_copyright' => '© phpBB Group', + 'style_active' => 0, + 'template_id' => 3, + 'theme_id' => 3, + 'imageset_id' => 3 + ), + array( + 'style_id' => 2, + 'style_name' => 'prosilver2', + 'style_copyright' => '© phpBB Group', + 'style_active' => 0, + 'template_id' => 2, + 'theme_id' => 2, + 'imageset_id' => 2 + ) + ), + $db->sql_fetchrowset($result) + ); + } +} |