From fbaf2baa8d683a2afdd3cf98ea1e7c035369f1a3 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 28 Dec 2008 10:53:28 +0000 Subject: [PATCH] document plugin-support move language path declaration to object instantiation git-svn-id: file:///svn/phpbb/trunk@9239 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 +- phpBB/includes/classes/user.php | 28 ++++++++---------------- phpBB/includes/core/system_info.php | 3 ++- phpBB/includes/functions.php | 34 +++++++++++++++++++++++++++++ phpBB/language/en/common.php | 2 +- phpBB/language/en/ucp.php | 2 +- 6 files changed, 48 insertions(+), 23 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index c954df414d..328125999c 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -91,7 +91,7 @@ phpbb::register('template'); phpbb::register('acl'); // Register user object -phpbb::register('user', false, false, phpbb::$config['auth_method']); +phpbb::register('user', false, false, phpbb::$config['auth_method'], PHPBB_ROOT_PATH . 'languages/'); // Register API phpbb::register('api'); diff --git a/phpBB/includes/classes/user.php b/phpBB/includes/classes/user.php index af425f2299..85a2ee012f 100644 --- a/phpBB/includes/classes/user.php +++ b/phpBB/includes/classes/user.php @@ -106,10 +106,10 @@ class phpbb_user extends phpbb_session * Constructor to set the lang path. Calls parrent::__construct() * * @param string $auth_method The authentication method to use, for example 'db' - * @param string $custom_lang_path An optional language pack path. + * @param string $lang_path Language pack path * @access public */ - public function __construct($auth_method, $custom_lang_path = false) + public function __construct($auth_method, $lang_path) { parent::__construct(); @@ -123,7 +123,13 @@ class phpbb_user extends phpbb_session } // Set language path - $this->lang_path = ($custom_lang_path === false) ? PHPBB_ROOT_PATH . 'language/' : $this->set_custom_lang_path($custom_lang_path); + $this->lang_path = $lang_path; + + // Make sure last character is a directory separator + if (substr($this->lang_path, -1) != DIRECTORY_SEPARATOR) + { + $this->lang_path .= DIRECTORY_SEPARATOR; + } } /** @@ -139,22 +145,6 @@ class phpbb_user extends phpbb_session phpbb::$acl->init($this->data); } - /** - * Function to set custom language path (able to use directory outside of phpBB) - * - * @param string $lang_path New language path used. - * @access public - */ - public function set_custom_lang_path($lang_path) - { - $this->lang_path = $lang_path; - - if (substr($this->lang_path, -1) != '/') - { - $this->lang_path .= '/'; - } - } - /** * Setup basic user-specific items (style, language, ...) * diff --git a/phpBB/includes/core/system_info.php b/phpBB/includes/core/system_info.php index 0069daf826..870ee7895b 100644 --- a/phpBB/includes/core/system_info.php +++ b/phpBB/includes/core/system_info.php @@ -151,7 +151,8 @@ class phpbb_system_info extends phpbb_plugin_support implements ArrayAccess * page: Current page from phpBB root, for example: adm/index.php?i=10&b=2 * forum: Current forum id (determined by {@link request_var() request_var('f', 0)}) * - * @return array Array containing page information. + * @return array Array containing page information. + * @plugin-support return * @access protected */ protected function get_page() diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b1379cdd60..f6ded04431 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -273,6 +273,39 @@ function phpbb_chmod($filename, $perms = phpbb::CHMOD_READ) return $result; } + /** + * Add a secret hash for use in links/GET requests + * @param string $link_name The name of the link; has to match the name used in check_link_hash, otherwise no restrictions apply + * @return string the hash + */ +/* + should use our hashing instead of a "custom" one + + function generate_link_hash($link_name) + { + global $user; + + if (!isset($user->data["hash_$link_name"])) + { + $user->data["hash_$link_name"] = substr(sha1($user->data['user_form_salt'] . $link_name), 0, 8); + } + + return $user->data["hash_$link_name"]; + } +*/ + + /** + * checks a link hash - for GET requests + * @param string $token the submitted token + * @param string $link_name The name of the link + * @return boolean true if all is fine + */ +/* + function check_link_hash($token, $link_name) + { + return $token === generate_link_hash($link_name); + } +*/ // functions used for building option fields /** @@ -2248,6 +2281,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) /** * Generate page header +* @plugin-support override, default, return */ function page_header($page_title = '', $display_online_list = true) { diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 78948e8858..36b6c048df 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -873,4 +873,4 @@ $lang = array_merge($lang, array( )); -?> +?> \ No newline at end of file diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 4f393c2108..4ece142031 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -541,4 +541,4 @@ $lang = array_merge($lang, array( 'NO_NONMEMBER' => 'No non-member groups', )); -?> +?> \ No newline at end of file