diff options
24 files changed, 425 insertions, 327 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 4d03359773..03babe47cd 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -12,8 +12,17 @@ # ln -s ../../git-tools/hooks/pre-commit \\ # .git/hooks/pre-commit -# NOTE: this is run through /usr/bin/env -PHP_BIN=php +if [ -z "$PHP_BIN" ] +then + PHP_BIN=php +fi + +if [ "$(echo -e test)" = test ] +then + echo_e="echo -e" +else + echo_e="echo" +fi # necessary check for initial commit if git rev-parse --verify HEAD >/dev/null 2>&1 @@ -27,7 +36,7 @@ fi error=0 errors="" -if ! which $PHP_BIN >/dev/null 2>&1 +if ! which "$PHP_BIN" >/dev/null 2>&1 then echo "PHP Syntax check failed:" echo "PHP binary does not exist or is not in path: $PHP_BIN" @@ -64,7 +73,13 @@ do # check the staged file content for syntax errors # using php -l (lint) - result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l 2>/dev/null) + # note: if display_errors=stderr in php.ini, + # parse errors are printed on stderr; otherwise + # they are printed on stdout. + # we filter everything other than parse errors + # with a grep below, therefore it should be safe + # to combine stdout and stderr in all circumstances + result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1) if [ $? -ne 0 ] then error=1 @@ -76,7 +91,45 @@ unset IFS if [ $error -eq 1 ] then - echo -e "PHP Syntax check failed:"; - echo -e "$errors" | grep "^Parse error:" + echo "PHP Syntax check failed:" + # php "display errors" (display_errors php.ini value) + # and "log errors" (log_errors php.ini value). + # these are independent settings - see main/main.c in php source. + # the "log errors" setting produces output which + # starts with "PHP Parse error:"; the "display errors" + # setting produces output starting with "Parse error:". + # if both are turned on php dumps the parse error twice. + # therefore here we try to grep for one version and + # if that yields no results grep for the other version. + # + # other fun php facts: + # + # 1. in cli, display_errors and log_errors have different + # destinations by default. display_errors prints to + # standard output and log_errors prints to standard error. + # whether these destinations make sense is left + # as an exercise for the reader. + # 2. as mentioned above, with all output turned on + # php will print parse errors twice, one time on stdout + # and one time on stderr. + # 3. it is possible to set both display_errors and log_errors + # to off. if this is done php will print the text + # "Errors parsing <file>" but will not say what + # the errors are. useful behavior, this. + # 4. on my system display_errors defaults to on and + # log_errors defaults to off, therefore providing + # by default one copy of messages. your mileage may vary. + # 5. by setting display_errors=stderr and log_errors=on, + # both sets of messages will be printed on stderr. + # 6. php-cgi binary, given display_errors=stderr and + # log_errors=on, still prints both sets of messages + # on stderr, but formats one set as an html fragment. + # 7. your entry here? ;) + $echo_e "$errors" | grep "^Parse error:" + if [ $? -ne 0 ] + then + # match failed + $echo_e "$errors" | grep "^PHP Parse error:" + fi exit 1 fi diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index a486a69514..0d88c8bcc5 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -9,7 +9,7 @@ <div id="page-footer"> <!-- IF S_COPYRIGHT_HTML --> - Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group + {CREDIT_LINE} <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- ENDIF --> diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html index 0d697aec1d..b6d7ee2f5c 100644 --- a/phpBB/adm/style/simple_footer.html +++ b/phpBB/adm/style/simple_footer.html @@ -5,7 +5,7 @@ <div id="page-footer"> <!-- IF S_COPYRIGHT_HTML --> - <br />Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group + <br />{CREDIT_LINE} <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- ENDIF --> diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 2772fb2217..d33be274b4 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -20,31 +20,53 @@ if (!defined('IN_PHPBB')) */ class acp_styles { - var $u_action; - var $u_base_action; - var $s_hidden_fields; - var $mode; - var $styles_path; - var $styles_path_absolute = 'styles'; - - function main($id, $mode) + public $u_action; + + protected $u_base_action; + protected $s_hidden_fields; + protected $mode; + protected $styles_path; + protected $styles_path_absolute = 'styles'; + protected $default_style = 0; + + protected $db; + protected $user; + protected $template; + protected $request; + protected $cache; + protected $auth; + protected $phpbb_root_path; + protected $phpEx; + + public function main($id, $mode) { - global $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request; + global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config; + + $this->db = $db; + $this->user = $user; + $this->template = $template; + $this->request = $request; + $this->cache = $cache; + $this->auth = $auth; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; - $this->styles_path = $phpbb_root_path . $this->styles_path_absolute . '/'; + $this->default_style = $config['default_style']; + $this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/'; $this->u_base_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$id}"); $this->s_hidden_fields = array( 'mode' => $mode, ); - $user->add_lang('acp/styles'); + $this->user->add_lang('acp/styles'); $this->tpl_name = 'acp_styles'; $this->page_title = 'ACP_CAT_STYLES'; $this->mode = $mode; - $action = $request->variable('action', ''); + $action = $this->request->variable('action', ''); $post_actions = array('install', 'activate', 'deactivate', 'uninstall'); foreach ($post_actions as $key) { @@ -58,12 +80,12 @@ class acp_styles $this->s_hidden_fields['action'] = $action; } - $template->assign_vars(array( + $this->template->assign_vars(array( 'U_ACTION' => $this->u_base_action, 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields) ) ); - + // Execute actions switch ($action) { @@ -86,11 +108,11 @@ class acp_styles $this->frontend(); } } - + /** * Main page */ - function frontend() + protected function frontend() { // Check mode switch ($this->mode) @@ -107,41 +129,36 @@ class acp_styles $this->action_cache(); return; } - global $user; - trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); } - + /** * Purge cache */ - function action_cache() + protected function action_cache() { - global $cache, $auth, $user; - - $cache->purge(); + $this->cache->purge(); // Clear permissions - $auth->acl_clear_prefetch(); + $this->auth->acl_clear_prefetch(); cache_moderators(); add_log('admin', 'LOG_PURGE_CACHE'); - - trigger_error($user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); + + trigger_error($this->user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); } - + /** * Install style(s) */ - function action_install() + protected function action_install() { - global $user; - // Get list of styles to install $dirs = $this->request_vars('dir', '', true); - + // Get list of styles that can be installed $styles = $this->find_available(false); - + // Install each style $messages = array(); $installed_names = array(); @@ -166,52 +183,50 @@ class acp_styles $last_installed = $style['style_id']; $installed_names[] = $style['style_name']; $installed_dirs[] = $style['style_path']; - $messages[] = sprintf($user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name'])); + $messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name'])); } } if (!$found) { - $messages[] = sprintf($user->lang['STYLE_NOT_INSTALLED'], htmlspecialchars($dir)); + $messages[] = sprintf($this->user->lang['STYLE_NOT_INSTALLED'], htmlspecialchars($dir)); } } - + // Show message if (!count($messages)) { - trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $message = implode('<br />', $messages); - $message .= '<br /><br />' . sprintf($user->lang['STYLE_INSTALLED_RETURN_STYLES'], $this->u_base_action . '&mode=style'); - $message .= '<br /><br />' . sprintf($user->lang['STYLE_INSTALLED_RETURN_UNINSTALLED'], $this->u_base_action . '&mode=install'); + $message .= '<br /><br />' . sprintf($this->user->lang['STYLE_INSTALLED_RETURN_STYLES'], $this->u_base_action . '&mode=style'); + $message .= '<br /><br />' . sprintf($this->user->lang['STYLE_INSTALLED_RETURN_UNINSTALLED'], $this->u_base_action . '&mode=install'); trigger_error($message, E_USER_NOTICE); } - + /** * Confirm styles removal */ - function action_uninstall() + protected function action_uninstall() { - global $user, $config, $template, $request; - // Get list of styles to uninstall $ids = $this->request_vars('id', 0, true); - + // Check if confirmation box was submitted if (confirm_box(true)) { // Uninstall - $this->action_uninstall_confirmed($ids, $request->variable('confirm_delete_files', false)); + $this->action_uninstall_confirmed($ids, $this->request->variable('confirm_delete_files', false)); return; } - + // Confirm box $s_hidden = build_hidden_fields(array( 'action' => 'uninstall', 'ids' => $ids )); - $template->assign_var('S_CONFIRM_DELETE', true); - confirm_box(false, $user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html'); - + $this->template->assign_var('S_CONFIRM_DELETE', true); + confirm_box(false, $this->user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html'); + // Canceled - show styles list $this->frontend(); } @@ -222,11 +237,9 @@ class acp_styles * @param array $ids List of style IDs * @param bool $delete_files If true, script will attempt to remove files for selected styles */ - function action_uninstall_confirmed($ids, $delete_files) + protected function action_uninstall_confirmed($ids, $delete_files) { - global $db, $user, $cache, $config; - - $default = $config['default_style']; + $default = $this->default_style; $uninstalled = array(); $messages = array(); @@ -235,11 +248,11 @@ class acp_styles { if (!$id) { - trigger_error($user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($id == $default) { - trigger_error($user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); } $uninstalled[$id] = false; } @@ -250,10 +263,10 @@ class acp_styles FROM ' . STYLES_TABLE . ' WHERE style_id IN (' . implode(', ', $ids) . ') ORDER BY style_id DESC'; - $result = $db->sql_query($sql); + $result = $this->db->sql_query($sql); - $rows = $db->sql_fetchrowset($result); - $db->sql_freeresult($result); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); // Uinstall each style $uninstalled = array(); @@ -266,20 +279,20 @@ class acp_styles $messages[] = $result; continue; } - $messages[] = sprintf($user->lang['STYLE_UNINSTALLED'], $style['style_name']); + $messages[] = sprintf($this->user->lang['STYLE_UNINSTALLED'], $style['style_name']); $uninstalled[] = $style['style_name']; // Attempt to delete files if ($delete_files) { - $messages[] = sprintf($user->lang[$this->delete_style_files($style['style_path']) ? 'DELETE_STYLE_FILES_SUCCESS' : 'DELETE_STYLE_FILES_FAILED'], $style['style_name']); + $messages[] = sprintf($this->user->lang[$this->delete_style_files($style['style_path']) ? 'DELETE_STYLE_FILES_SUCCESS' : 'DELETE_STYLE_FILES_FAILED'], $style['style_name']); } } if (empty($messages)) { // Nothing to uninstall? - trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } // Log action @@ -289,7 +302,7 @@ class acp_styles } // Clear cache - $cache->purge(); + $this->cache->purge(); // Show message trigger_error(implode('<br />', $messages) . adm_back_link($this->u_action), E_USER_NOTICE); @@ -298,22 +311,20 @@ class acp_styles /** * Activate styles */ - function action_activate() + protected function action_activate() { - global $user, $config, $cache, $db; - // Get list of styles to activate $ids = $this->request_vars('id', 0, true); - + // Activate styles $sql = 'UPDATE ' . STYLES_TABLE . ' SET style_active = 1 WHERE style_id IN (' . implode(', ', $ids) . ')'; - $db->sql_query($sql); + $this->db->sql_query($sql); // Purge cache - $cache->destroy('sql', STYLES_TABLE); - + $this->cache->destroy('sql', STYLES_TABLE); + // Show styles list $this->frontend(); } @@ -321,19 +332,17 @@ class acp_styles /** * Deactivate styles */ - function action_deactivate() + protected function action_deactivate() { - global $user, $config, $cache, $db; - // Get list of styles to deactivate $ids = $this->request_vars('id', 0, true); // Check for default style foreach ($ids as $id) { - if ($id == $config['default_style']) + if ($id == $this->default_style) { - trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -341,38 +350,36 @@ class acp_styles $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0 WHERE user_style IN (' . implode(', ', $ids) . ')'; - $db->sql_query($sql); + $this->db->sql_query($sql); // Deactivate styles $sql = 'UPDATE ' . STYLES_TABLE . ' SET style_active = 0 WHERE style_id IN (' . implode(', ', $ids) . ')'; - $db->sql_query($sql); + $this->db->sql_query($sql); // Purge cache - $cache->destroy('sql', STYLES_TABLE); + $this->cache->destroy('sql', STYLES_TABLE); // Show styles list $this->frontend(); } - + /** * Show style details */ - function action_details() + protected function action_details() { - global $user, $config, $db, $request, $template, $cache; - - $id = $request->variable('id', 0); + $id = $this->request->variable('id', 0); if (!$id) { - trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } - + // Get all styles $styles = $this->get_styles(); - usort($styles, 'acp_styles::sort_styles'); - + usort($styles, array($this, 'sort_styles')); + // Find current style $style = false; foreach ($styles as $row) @@ -386,34 +393,43 @@ class acp_styles if ($style === false) { - trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } - + // Find all available parent styles $list = $this->find_possible_parents($styles, $id); - + + // Add form key + $form_key = 'acp_styles'; + add_form_key($form_key); + // Change data - if ($request->variable('update', false)) + if ($this->request->variable('update', false)) { + if (!check_form_key($form_key)) + { + trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $update = array( - 'style_name' => trim($request->variable('style_name', $style['style_name'])), - 'style_parent_id' => $request->variable('style_parent', (int) $style['style_parent_id']), - 'style_active' => $request->variable('style_active', (int) $style['style_active']), + 'style_name' => trim($this->request->variable('style_name', $style['style_name'])), + 'style_parent_id' => $this->request->variable('style_parent', (int) $style['style_parent_id']), + 'style_active' => $this->request->variable('style_active', (int) $style['style_active']), ); $update_action = $this->u_action . '&action=details&id=' . $id; - + // Check style name if ($update['style_name'] != $style['style_name']) { if (!strlen($update['style_name'])) { - trigger_error($user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING); + trigger_error($this->user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING); } foreach ($styles as $row) { if ($row['style_name'] == $update['style_name']) { - trigger_error($user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING); + trigger_error($this->user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING); } } } @@ -421,7 +437,7 @@ class acp_styles { unset($update['style_name']); } - + // Check parent style id if ($update['style_parent_id'] != $style['style_parent_id']) { @@ -439,7 +455,7 @@ class acp_styles } if (!$found) { - trigger_error($user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING); + trigger_error($this->user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING); } } else @@ -451,64 +467,64 @@ class acp_styles { unset($update['style_parent_id']); } - + // Check style_active if ($update['style_active'] != $style['style_active']) { - if (!$update['style_active'] && $config['default_style'] == $style['style_id']) + if (!$update['style_active'] && $this->default_style == $style['style_id']) { - trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING); + trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING); } } else { unset($update['style_active']); } - + // Update data if (count($update)) { $sql = 'UPDATE ' . STYLES_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $update) . " + SET ' . $this->db->sql_build_array('UPDATE', $update) . " WHERE style_id = $id"; - $db->sql_query($sql); - + $this->db->sql_query($sql); + $style = array_merge($style, $update); - + if (isset($update['style_parent_id'])) { // Update styles tree $styles = $this->get_styles(); - if ($this->update_styles_tree(&$styles, $style)) + if ($this->update_styles_tree($styles, $style)) { // Something was changed in styles tree, purge all cache - $cache->purge(); + $this->cache->purge(); } } add_log('admin', 'LOG_STYLE_EDIT_DETAILS', $style['style_name']); } - + // Update default style - $default = $request->variable('style_default', 0); + $default = $this->request->variable('style_default', 0); if ($default) { if (!$style['style_active']) { - trigger_error($user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING); + trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING); } set_config('default_style', $id); - $cache->purge(); + $this->cache->purge(); } - + // Show styles list $this->frontend(); return; } - + // Show parent styles foreach ($list as $row) { - $template->assign_block_vars('parent_styles', array( + $this->template->assign_block_vars('parent_styles', array( 'STYLE_ID' => $row['style_id'], 'STYLE_NAME' => htmlspecialchars($row['style_name']), 'LEVEL' => $row['level'], @@ -516,9 +532,9 @@ class acp_styles ) ); } - + // Show style details - $template->assign_vars(array( + $this->template->assign_vars(array( 'S_STYLE_DETAILS' => true, 'STYLE_ID' => $style['style_id'], 'STYLE_NAME' => htmlspecialchars($style['style_name']), @@ -526,7 +542,7 @@ class acp_styles 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), 'STYLE_PARENT' => $style['style_parent_id'], 'S_STYLE_ACTIVE' => $style['style_active'], - 'S_STYLE_DEFAULT' => ($style['style_id'] == $config['default_style']) + 'S_STYLE_DEFAULT' => ($style['style_id'] == $this->default_style) ) ); } @@ -534,65 +550,63 @@ class acp_styles /** * List installed styles */ - function show_installed() + protected function show_installed() { - global $user, $template; - // Get all installed styles $styles = $this->get_styles(); if (!count($styles)) { - trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } - - usort($styles, 'acp_styles::sort_styles'); + + usort($styles, array($this, 'sort_styles')); // Get users $users = $this->get_users(); - + // Add users counter to rows foreach ($styles as &$style) { $style['_users'] = isset($users[$style['style_id']]) ? $users[$style['style_id']] : 0; } - + // Set up styles list variables // Addons should increase this number and update template variable $this->styles_list_cols = 4; - $template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols); + $this->template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols); // Show styles list - $this->show_styles_list(&$styles, 0, 0); - + $this->show_styles_list($styles, 0, 0); + // Show styles with invalid inherits_id foreach ($styles as $style) { if (empty($style['_shown'])) { - $style['_note'] = sprintf($user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree'])); + $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree'])); $this->list_style($style, 0); } } // Add buttons - $template->assign_block_vars('extra_actions', array( + $this->template->assign_block_vars('extra_actions', array( 'ACTION_NAME' => 'activate', - 'L_ACTION' => $user->lang['STYLE_ACTIVATE'], + 'L_ACTION' => $this->user->lang['STYLE_ACTIVATE'], ) ); - $template->assign_block_vars('extra_actions', array( + $this->template->assign_block_vars('extra_actions', array( 'ACTION_NAME' => 'deactivate', - 'L_ACTION' => $user->lang['STYLE_DEACTIVATE'], + 'L_ACTION' => $this->user->lang['STYLE_DEACTIVATE'], ) ); if (isset($this->style_counters) && $this->style_counters['total'] > 1) { - $template->assign_block_vars('extra_actions', array( + $this->template->assign_block_vars('extra_actions', array( 'ACTION_NAME' => 'uninstall', - 'L_ACTION' => $user->lang['STYLE_UNINSTALL'], + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'], ) ); } @@ -601,28 +615,26 @@ class acp_styles /** * Show list of styles that can be installed */ - function show_available() + protected function show_available() { - global $user, $template; - // Get list of styles $styles = $this->find_available(true); - + // Show styles if (empty($styles)) { - trigger_error($user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); + trigger_error($this->user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); } - - usort($styles, 'acp_styles::sort_styles'); + + usort($styles, array($this, 'sort_styles')); $this->styles_list_cols = 3; - $template->assign_vars(array( + $this->template->assign_vars(array( 'STYLES_LIST_COLS' => $this->styles_list_cols, 'STYLES_LIST_HIDE_COUNT' => true ) ); - + // Show styles foreach ($styles as &$style) { @@ -641,41 +653,39 @@ class acp_styles } if (!$has_parent) { - $this->list_style(&$style, 0); - $this->show_available_child_styles(&$styles, $style['style_name'], 1); + $this->list_style($style, 0); + $this->show_available_child_styles($styles, $style['style_name'], 1); } } - + // Show styles that do not have parent style in styles list foreach ($styles as $style) { if (empty($style['_shown'])) { - $this->list_style(&$style, 0); + $this->list_style($style, 0); } } - + // Add button if (isset($this->style_counters) && $this->style_counters['caninstall'] > 0) { - $template->assign_block_vars('extra_actions', array( + $this->template->assign_block_vars('extra_actions', array( 'ACTION_NAME' => 'install', - 'L_ACTION' => $user->lang['INSTALL_STYLES'], + 'L_ACTION' => $this->user->lang['INSTALL_STYLES'], ) ); } } - + /** * Find styles available for installation * * @param bool $all if true, function will return all installable styles. if false, function will return only styles that can be installed - * @returns array list of styles + * @return array List of styles */ - function find_available($all) + protected function find_available($all) { - global $user; - // Get list of installed styles $installed = $this->get_styles(); @@ -691,10 +701,10 @@ class acp_styles 'tree' => (strlen($style['style_parent_tree']) ? $style['style_parent_tree'] . '/' : '') . $style['style_path'], ); } - + // Get list of directories $dirs = $this->find_style_dirs(); - + // Find styles that can be installed $styles = array(); foreach ($dirs as $dir) @@ -743,10 +753,10 @@ class acp_styles { // Parent style is not installed yet $style['_available'] = false; - $style['_note'] = sprintf($user->lang['REQUIRES_STYLE'], htmlspecialchars($parent)); + $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($parent)); } } - + if ($all || $style['_available']) { $styles[] = $style; @@ -755,7 +765,7 @@ class acp_styles return $styles; } - + /** * Show styles list * @@ -763,18 +773,18 @@ class acp_styles * @param int $parent parent style id * @param int $level style inheritance level */ - function show_styles_list($styles, $parent, $level) + protected function show_styles_list(&$styles, $parent, $level) { foreach ($styles as &$style) { if (empty($style['_shown']) && $style['style_parent_id'] == $parent) { - $this->list_style(&$style, $level); - $this->show_styles_list(&$styles, $style['style_id'], $level + 1); + $this->list_style($style, $level); + $this->show_styles_list($styles, $style['style_id'], $level + 1); } } } - + /** * Show available styles tree * @@ -782,26 +792,26 @@ class acp_styles * @param string $name Name of parent style * @param string $level Styles tree level */ - function show_available_child_styles($styles, $name, $level) + protected function show_available_child_styles(&$styles, $name, $level) { foreach ($styles as &$style) { if (empty($style['_shown']) && $style['_inherit_name'] == $name) { - $this->list_style(&$style, $level); - $this->show_available_child_styles(&$styles, $style['style_name'], $level + 1); + $this->list_style($style, $level); + $this->show_available_child_styles($styles, $style['style_name'], $level + 1); } } } - + /** * Update styles tree * * @param array $styles Styles list, passed as reference * @param array $style Current style, false if root - * @returns true if something was updated, false if not + * @return bool True if something was updated, false if not */ - function update_styles_tree($styles, $style = false) + protected function update_styles_tree(&$styles, $style = false) { $parent_id = ($style === false) ? 0 : $style['style_id']; $parent_tree = ($style === false) ? '' : ($style['style_parent_tree'] == '' ? '' : $style['style_parent_tree']) . $style['style_path']; @@ -816,21 +826,20 @@ class acp_styles $row['style_parent_tree'] = $parent_tree; $update = true; } - $updated |= $this->update_styles_tree(&$styles, $row); + $updated |= $this->update_styles_tree($styles, $row); } } if ($update) { - global $db; $sql = 'UPDATE ' . STYLES_TABLE . " - SET style_parent_tree = '" . $db->sql_escape($parent_tree) . "' + SET style_parent_tree = '" . $this->db->sql_escape($parent_tree) . "' WHERE style_parent_id = {$parent_id}"; - $db->sql_query($sql); + $this->db->sql_query($sql); $updated = true; } return $updated; } - + /** * Find all possible parent styles for style * @@ -838,9 +847,9 @@ class acp_styles * @param int $id id of style * @param int $parent current parent style id * @param int $level current tree level - * @returns array of style ids, names and levels + * @return array Style ids, names and levels */ - function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0) + protected function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0) { $results = array(); foreach ($styles as $style) @@ -860,21 +869,19 @@ class acp_styles } return $results; } - + /** * Show item in styles list * * @param array $style style row * @param array $level style inheritance level */ - function list_style($style, $level) + protected function list_style(&$style, $level) { - global $template, $config, $db, $user, $phpbb_root_path, $phpEx; - // Mark row as shown if (!empty($style['_shown'])) return; $style['_shown'] = true; - + // Generate template variables $actions = array(); $row = array( @@ -884,56 +891,56 @@ class acp_styles 'STYLE_PATH' => htmlspecialchars($style['style_path']), 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), 'STYLE_ACTIVE' => $style['style_active'], - + // Additional data - 'DEFAULT' => ($style['style_id'] && $style['style_id'] == $config['default_style']), + 'DEFAULT' => ($style['style_id'] && $style['style_id'] == $this->default_style), 'USERS' => (isset($style['_users'])) ? $style['_users'] : '', 'LEVEL' => $level, 'PADDING' => (4 + 16 * $level), 'SHOW_COPYRIGHT' => ($style['style_id']) ? false : true, 'STYLE_PATH_FULL' => htmlspecialchars($this->styles_path_absolute . '/' . $style['style_path']) . '/', - + // Comment to show below style 'COMMENT' => (isset($style['_note'])) ? $style['_note'] : '', - + // The following variables should be used by hooks to add custom HTML code 'EXTRA' => '', 'EXTRA_OPTIONS' => '' ); - + // Status specific data if ($style['style_id']) { // Style is installed - + // Details $actions[] = array( 'U_ACTION' => $this->u_action . '&action=details&id=' . $style['style_id'], - 'L_ACTION' => $user->lang['DETAILS'] + 'L_ACTION' => $this->user->lang['DETAILS'] ); // Activate $actions[] = array( 'U_ACTION' => $this->u_action . '&action=' . ($style['style_active'] ? 'de' : '') . 'activate&id=' . $style['style_id'], - 'L_ACTION' => $user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE'] + 'L_ACTION' => $this->user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE'] ); /* // Export $actions[] = array( 'U_ACTION' => $this->u_action . '&action=export&id=' . $style['style_id'], - 'L_ACTION' => $user->lang['EXPORT'] + 'L_ACTION' => $this->user->lang['EXPORT'] ); */ // Uninstall $actions[] = array( 'U_ACTION' => $this->u_action . '&action=uninstall&id=' . $style['style_id'], - 'L_ACTION' => $user->lang['STYLE_UNINSTALL'] + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'] ); - + // Preview $actions[] = array( - 'U_ACTION' => append_sid("{$phpbb_root_path}index.$phpEx", 'style=' . $style['style_id']), - 'L_ACTION' => $user->lang['PREVIEW'] + 'U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->phpEx, 'style=' . $style['style_id']), + 'L_ACTION' => $this->user->lang['PREVIEW'] ); } else @@ -942,27 +949,27 @@ class acp_styles if (empty($style['_available'])) { $actions[] = array( - 'HTML' => $user->lang['CANNOT_BE_INSTALLED'] + 'HTML' => $this->user->lang['CANNOT_BE_INSTALLED'] ); } else { $actions[] = array( 'U_ACTION' => $this->u_action . '&action=install&dir=' . urlencode($style['style_path']), - 'L_ACTION' => $user->lang['INSTALL_STYLE'] + 'L_ACTION' => $this->user->lang['INSTALL_STYLE'] ); } } - + // todo: add hook - + // Assign template variables - $template->assign_block_vars('styles_list', $row); + $this->template->assign_block_vars('styles_list', $row); foreach($actions as $action) { - $template->assign_block_vars('styles_list.actions', $action); + $this->template->assign_block_vars('styles_list.actions', $action); } - + // Increase counters $counter = ($style['style_id']) ? ($style['style_active'] ? 'active' : 'inactive') : (empty($style['_available']) ? 'cannotinstall' : 'caninstall'); if (!isset($this->style_counters)) @@ -975,32 +982,31 @@ class acp_styles 'cannotinstall' => 0 ); } - $this->style_counters[$counter] ++; - $this->style_counters['total'] ++; + $this->style_counters[$counter]++; + $this->style_counters['total']++; } - + /** * Show welcome message * * @param string $title main title * @param string $description page description */ - function welcome_message($title, $description) + protected function welcome_message($title, $description) { - global $user, $template; - $template->assign_vars(array( - 'L_TITLE' => (isset($user->lang[$title])) ? $user->lang[$title] : $title, - 'L_EXPLAIN' => (isset($user->lang[$description])) ? $user->lang[$description] : $description + $this->template->assign_vars(array( + 'L_TITLE' => $this->user->lang[$title], + 'L_EXPLAIN' => (isset($this->user->lang[$description])) ? $this->user->lang[$description] : '' ) ); } - + /** * Find all directories that have styles * - * @returns array of directory names + * @return array Directory names */ - function find_style_dirs() + protected function find_style_dirs() { $styles = array(); @@ -1025,11 +1031,11 @@ class acp_styles return $styles; } - + /** * Sort styles */ - function sort_styles($style1, $style2) + public function sort_styles($style1, $style2) { if ($style1['style_active'] != $style2['style_active']) { @@ -1041,19 +1047,18 @@ class acp_styles } return strcasecmp(isset($style1['style_name']) ? $style1['style_name'] : $style1['name'], isset($style2['style_name']) ? $style2['style_name'] : $style2['name']); } - + /** * Read style configuration file * * @param string $dir style directory - * @returns array of style data - * @returns false on error + * @return array|bool Style data, false on error */ - function read_style_cfg($dir) + protected function read_style_cfg($dir) { static $required = array('name', 'version', 'copyright'); $cfg = parse_cfg_file($this->styles_path . $dir . '/style.cfg'); - + // Check if it is a valid file foreach ($required as $key) { @@ -1062,7 +1067,7 @@ class acp_styles return false; } } - + // Check data if (!isset($cfg['parent']) || !is_string($cfg['parent']) || $cfg['parent'] == $cfg['name']) { @@ -1072,20 +1077,18 @@ class acp_styles { $cfg['template_bitfield'] = $this->default_bitfield(); } - + return $cfg; } - + /** * Install style * * @param $style style data - * @returns int style id + * @return int Style id */ - function install_style($style) + protected function install_style($style) { - global $db; - // Generate row $sql_ary = array(); foreach ($style as $key => $value) @@ -1095,38 +1098,36 @@ class acp_styles $sql_ary[$key] = $value; } } - + // Add to database - $db->sql_transaction('begin'); + $this->db->sql_transaction('begin'); $sql = 'INSERT INTO ' . STYLES_TABLE . ' - ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); + ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); - $id = $db->sql_nextid(); + $id = $this->db->sql_nextid(); - $db->sql_transaction('commit'); + $this->db->sql_transaction('commit'); add_log('admin', 'LOG_STYLE_ADD', $sql_ary['style_name']); - + return $id; } /** * Lists all styles * - * @returns array of rows with styles data + * @return array Rows with styles data */ - function get_styles() + protected function get_styles() { - global $db; - - $sql = 'SELECT * + $sql = 'SELECT * FROM ' . STYLES_TABLE; - $result = $db->sql_query($sql); + $result = $this->db->sql_query($sql); - $rows = $db->sql_fetchrowset($result); - $db->sql_freeresult($result); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); return $rows; } @@ -1134,64 +1135,60 @@ class acp_styles /** * Count users for each style * - * @returns array of styles in following format: [style_id] = number of users + * @return array Styles in following format: [style_id] = number of users */ - function get_users() + protected function get_users() { - global $db; - $sql = 'SELECT user_style, COUNT(user_style) AS style_count FROM ' . USERS_TABLE . ' GROUP BY user_style'; - $result = $db->sql_query($sql); + $result = $this->db->sql_query($sql); - $style_count = array(); - while ($row = $db->sql_fetchrow($result)) + $style_count = array(); + while ($row = $this->db->sql_fetchrow($result)) { $style_count[$row['user_style']] = $row['style_count']; } - $db->sql_freeresult($result); - + $this->db->sql_freeresult($result); + return $style_count; } - + /** * Uninstall style * * @param array $style Style data - * @returns true on success, error message on error + * @return bool|string True on success, error message on error */ - function uninstall_style($style) + protected function uninstall_style($style) { - global $db, $user; - $id = $style['style_id']; $path = $style['style_path']; - + // Check if style has child styles - $sql = 'SELECT style_id + $sql = 'SELECT style_id FROM ' . STYLES_TABLE . ' - WHERE style_parent_id = ' . $id . " OR style_parent_tree = '" . $db->sql_escape($path) . "'"; - $result = $db->sql_query($sql); - - $conflict = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE style_parent_id = ' . (int) $id . " OR style_parent_tree = '" . $this->db->sql_escape($path) . "'"; + $result = $this->db->sql_query($sql); + + $conflict = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); if ($conflict !== false) { - return sprintf($user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']); + return sprintf($this->user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']); } - + // Change default style for users $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0 WHERE user_style = ' . $id; - $db->sql_query($sql); - + $this->db->sql_query($sql); + // Uninstall style $sql = 'DELETE FROM ' . STYLES_TABLE . ' WHERE style_id = ' . $id; - $db->sql_query($sql); + $this->db->sql_query($sql); return true; } @@ -1200,13 +1197,13 @@ class acp_styles * * @param string $path Style directory * @param string $dir Directory to remove inside style's directory - * @returns true on success, false on error + * @return bool True on success, false on error */ - function delete_style_files($path, $dir = '') + protected function delete_style_files($path, $dir = '') { $dirname = $this->styles_path . $path . $dir; $result = true; - + $dp = @opendir($dirname); if ($dp) @@ -1239,24 +1236,22 @@ class acp_styles { return false; } - + return $result; } - + /** * Get list of items from posted data * * @param string $name Variable name - * @param $default Default value for array: string or number + * @param string|int $default Default value for array * @param bool $error If true, error will be triggered if list is empty - * @returns array of items + * @return array Items */ - function request_vars($name, $default, $error = false) + protected function request_vars($name, $default, $error = false) { - global $request, $user; - - $item = $request->variable($name, $default); - $items = $request->variable($name . 's', array($default)); + $item = $this->request->variable($name, $default); + $items = $this->request->variable($name . 's', array($default)); if (count($items) == 1 && $items[0] == $default) { @@ -1267,28 +1262,30 @@ class acp_styles { $items[] = $item; } - + if ($error && !count($items)) { - trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } return $items; } /** - * Generates hardcoded bitfield + * Generates default bitfield + * + * This bitfield decides which bbcodes are defined in a template. * - * @returns bitfield string + * @return string Bitfield */ - function default_bitfield() + protected function default_bitfield() { static $value; if (isset($value)) { return $value; } - + // Hardcoded template bitfield to add for new templates $bitfield = new bitfield(); $bitfield->set(0); diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index 62fb90d3c5..d57b333c69 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -25,7 +25,7 @@ class phpbb_captcha_factory /** * return an instance of class $name in file $name_plugin.php */ - function get_instance($name) + public static function get_instance($name) { global $phpbb_root_path, $phpEx; diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index a63b0e448f..6c1f3bf00b 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -49,7 +49,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha } } - function get_instance() + public static function get_instance() { $instance = new phpbb_captcha_gd(); return $instance; diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php index f523cae191..a5588178bb 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -39,7 +39,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha } } - function get_instance() + public static function get_instance() { return new phpbb_captcha_gd_wave(); } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php index 4a0418146d..96f13fbe1b 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -39,7 +39,7 @@ class phpbb_captcha_nogd extends phpbb_default_captcha } } - function get_instance() + public static function get_instance() { $instance = new phpbb_captcha_nogd(); return $instance; diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index e12ad00d25..99813189d7 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -98,7 +98,7 @@ class phpbb_captcha_qa /** * API function */ - function get_instance() + public static function get_instance() { $instance = new phpbb_captcha_qa(); diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 0ea8b9c6e7..70c24a8c30 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -54,7 +54,7 @@ class phpbb_recaptcha extends phpbb_default_captcha $this->response = request_var('recaptcha_response_field', ''); } - function get_instance() + public static function get_instance() { $instance = new phpbb_recaptcha(); return $instance; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a44ebb04e8..9a6af29d69 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4860,6 +4860,7 @@ function page_footer($run_cron = true) $template->assign_vars(array( 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', + 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'), 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '') ); diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 03dec1787a..dc61859363 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -131,6 +131,7 @@ function adm_page_footer($copyright_html = true) 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, + 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'), 'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js", 'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false, 'VERSION' => $config['version']) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 18452c27e9..5b05c3a78d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1948,6 +1948,27 @@ function validate_jabber($jid) } /** +* Verifies whether a style ID corresponds to an active style. +* +* @param int $style_id The style_id of a style which should be checked if activated or not. +* @return boolean +*/ +function phpbb_style_is_active($style_id) +{ + global $db; + + $sql = 'SELECT style_active + FROM ' . STYLES_TABLE . ' + WHERE style_id = '. (int) $style_id; + $result = $db->sql_query($sql); + + $style_is_active = (bool) $db->sql_fetchfield('style_active'); + $db->sql_freeresult($result); + + return $style_is_active; +} + +/** * Remove avatar */ function avatar_delete($mode, $row, $clean_db = false) diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 11f2d231fe..0c9f20f266 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -60,7 +60,14 @@ class ucp_prefs if ($submit) { - $data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style']; + if ($config['override_user_style']) + { + $data['style'] = (int) $config['default_style']; + } + else if (!phpbb_style_is_active($data['style'])) + { + $data['style'] = (int) $user->data['user_style']; + } $error = validate_data($data, array( 'dateformat' => array('string', false, 1, 30), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index a84136388c..be39b12d12 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1063,6 +1063,8 @@ function database_update_info() '3.0.10-RC2' => array(), // No changes from 3.0.10-RC3 to 3.0.10 '3.0.10-RC3' => array(), + // No changes from 3.0.10 to 3.0.11-RC1 + '3.0.10' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ @@ -2147,6 +2149,32 @@ function change_database_data(&$no_updates, $version) case '3.0.10-RC3': break; + // Changes from 3.0.10 to 3.0.11-RC1 + case '3.0.10': + // Updates users having current style a deactivated one + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_active = 0'; + $result = $db->sql_query($sql); + + $deactivated_style_ids = array(); + while ($style_id = $db->sql_fetchfield('style_id', false, $result)) + { + $deactivated_style_ids[] = (int) $style_id; + } + $db->sql_freeresult($result); + + if (!empty($deactivated_style_ids)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $config['default_style'] .' + WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids); + _sql($sql, $errored, $error_ary); + } + + $no_updates = false; + break; + // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 361376763d..7558fde944 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1804,6 +1804,9 @@ class install_install extends module $this->page_title = $lang['STAGE_FINAL']; + // Obtain any submitted data + $data = $this->get_submitted_data(); + // We need to fill the config to let internal functions correctly work $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); set_config(null, null, null, $config); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index b92b915623..12f8edad9e 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -207,7 +207,7 @@ $lang = array_merge($lang, array( 'FORM_INVALID' => 'The submitted form was invalid. Try submitting again.', 'FORUM' => 'Forum', 'FORUMS' => 'Forums', - 'FORUMS_MARKED' => 'The selected forums have been marked read.', + 'FORUMS_MARKED' => 'Forums have been marked read.', 'FORUM_CAT' => 'Forum category', 'FORUM_INDEX' => 'Board index', 'FORUM_LINK' => 'Forum link', @@ -482,6 +482,7 @@ $lang = array_merge($lang, array( 'POST_TIME' => 'Post time', 'POST_TOPIC' => 'Post a new topic', 'POST_UNAPPROVED' => 'Post awaiting approval:', + 'POWERED_BY' => 'Powered by %s', 'PREVIEW' => 'Preview', 'PREVIOUS' => 'Previous', // Used in pagination 'PREVIOUS_STEP' => 'Previous', diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index fa536e5b91..b14f155f3a 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -332,7 +332,7 @@ $help = array( ), array( 0 => 'Why isn’t X feature available?', - 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, please visit the phpbb.com website and see what phpBB Group have to say. Please do not post feature requests to the board at phpbb.com, the group uses SourceForge to handle tasking of new features. Please read through the forums and see what, if any, our position may already be for a feature and then follow the procedure given there.' + 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, or you want to report a bug, please visit the phpBB <a href="http://area51.phpbb.com/">Area51</a> website, where you will find resources to do so.' ), array( 0 => 'Who do I contact about abusive and/or legal matters related to this board?', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 741ac2f430..ed87b6c448 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -61,11 +61,6 @@ $default_key = 'c'; $sort_key = request_var('sk', $default_key); $sort_dir = request_var('sd', 'a'); - -// Grab rank information for later -$ranks = $cache->obtain_ranks(); - - // What do you want to do today? ... oops, I think that line is taken ... switch ($mode) { @@ -1222,21 +1217,16 @@ switch ($mode) // Misusing the avatar function for displaying group avatars... $avatar_img = get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR'); + // ... same for group rank $rank_title = $rank_img = $rank_img_src = ''; if ($group_row['group_rank']) { - if (isset($ranks['special'][$group_row['group_rank']])) + get_user_rank($group_row['group_rank'], false, $rank_title, $rank_img, $rank_img_src); + + if ($rank_img) { - $rank_title = $ranks['special'][$group_row['group_rank']]['rank_title']; + $rank_img .= '<br />'; } - $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] . '" alt="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" title="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" /><br />' : ''; - $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : ''; - } - else - { - $rank_title = ''; - $rank_img = ''; - $rank_img_src = ''; } $template->assign_vars(array( diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 47071ba4df..c84b327b71 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -19,7 +19,7 @@ <span class="corners-bottom"><span></span></span></div> </div> - <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group + <div class="copyright">{CREDIT_LINE} <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF --> <!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 5e095d0a0d..72fc9c89ab 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -22,10 +22,6 @@ Based on style: prosilver (this is the default phpBB3 style) Original author: Tom Beddard ( http://www.subBlue.com/ ) Modified by: - - NOTE: This page was generated by phpBB, the free open-source bulletin board package. - The phpBB Group is not responsible for the content of this page and forum. For more information - about phpBB please visit http://www.phpbb.com --> <script type="text/javascript"> diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index 549c31cfb6..64dd2ff96b 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -1,6 +1,6 @@ </div> - <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group + <div class="copyright">{CREDIT_LINE} <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF --> </div> diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 77b11034b9..4f686cf5e4 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -3,7 +3,7 @@ <div id="wrapfooter"> <!-- IF U_ACP --><span class="gensmall">[ <a href="{U_ACP}">{L_ACP}</a> ]</span><br /><br /><!-- ENDIF --> - <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group + <span class="copyright">{CREDIT_LINE} <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br /><bdo dir="ltr">[ {DEBUG_OUTPUT} ]</bdo><!-- ENDIF --></span> </div> diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html index 4a65bafd1c..771765ee12 100644 --- a/phpBB/styles/subsilver2/template/simple_footer.html +++ b/phpBB/styles/subsilver2/template/simple_footer.html @@ -2,7 +2,7 @@ </div> <div id="wrapfooter"> - <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</span> + <span class="copyright">{CREDIT_LINE} </div> <script type="text/javascript" src="{T_JQUERY_LINK}"></script> |