diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/classes/session.php | 73 | ||||
-rw-r--r-- | phpBB/includes/classes/user.php | 101 |
2 files changed, 101 insertions, 73 deletions
diff --git a/phpBB/includes/classes/session.php b/phpBB/includes/classes/session.php index 7d780a59ed..b8f829efd5 100644 --- a/phpBB/includes/classes/session.php +++ b/phpBB/includes/classes/session.php @@ -79,6 +79,7 @@ abstract class phpbb_session /** * Init session. Empties the user data and assigns the system object (phpbb::$instances['system']) + * @access public */ public function __construct() { @@ -96,7 +97,7 @@ abstract class phpbb_session /** * Specifiy the need for a session id within the URL * - * @param bool $need_sid Specify if the session id is needed or not. Default is false. + * @param bool $need_sid Specify if the session id is needed or not. Default is false. * @access public */ public function need_sid($need_sid = false) @@ -114,8 +115,10 @@ abstract class phpbb_session * running on a system which makes such information readily available) and * halt if it's above an admin definable limit. * - * @param bool $update_session_page If true the session page gets updated. This can be set to false to circumvent certain scripts to update the users last visited page. - * @return bool True if the session exist or has been created, else False. + * @param bool $update_session_page If true the session page gets updated. + * This can be set to false to circumvent certain scripts to update the users last visited page. + * + * @return bool True if the session exist or has been created, else False. * @access public */ public function session_begin($update_session_page = true) @@ -165,11 +168,12 @@ abstract class phpbb_session * garbage collection, (search)bot checking, banned user comparison. Basically * though this method will result in a new session for a specific user. * - * @param int $user_id The user id to create the session for. - * @param bool $set_admin Set the users admin field to identify him/her as an admin? - * @param bool $persist_login Allow persistent login - * @param bool $viewonline If false then the user will be logged in as hidden - * @return bool True if session got created successfully. + * @param int $user_id The user id to create the session for. + * @param bool $set_admin Set the users admin field to identify him/her as an admin? + * @param bool $persist_login Allow persistent login + * @param bool $viewonline If false then the user will be logged in as hidden + * + * @return bool True if session got created successfully. * @access public */ public function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) @@ -484,7 +488,7 @@ abstract class phpbb_session * and update the users information from the relevant session data. It will then * grab guest user information. * - * @param bool $new_session If true a new session will be generated after the original one got killed. + * @param bool $new_session If true a new session will be generated after the original one got killed. * @access public */ public function session_kill($new_session = true) @@ -633,9 +637,10 @@ abstract class phpbb_session /** * Sets a cookie of the given name with the specified data for the given length of time. If no time is specified, a session cookie will be set. * - * @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then. - * @param string $cookiedata The data to hold within the cookie - * @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set. + * @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. Track becomes [cookie_name]_track then. + * @param string $cookiedata The data to hold within the cookie + * @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set. + * * @access public */ public function set_cookie($name, $cookiedata, $cookietime) @@ -655,11 +660,13 @@ abstract class phpbb_session * this routine does not return on finding a banned user, it outputs a relevant * message and stops execution. * - * @param int $user_id The user id to check. If false then do not check user ids - * @param string|array $user_ips Can contain a string with one IP or an array of multiple IPs. If false then no ips are checked. - * @param int $user_email The email address to check - * @param bool $return If false then the banned message is displayed and script halted - * @return bool|string True if banned and no reason given. False if not banned. A ban reason if banned and ban reason given. Check for !== false. + * @param int $user_id The user id to check. If false then do not check user ids + * @param string|array $user_ips Can contain a string with one IP or an array of multiple IPs. If false then no ips are checked. + * @param int $user_email The email address to check + * @param bool $return If false then the banned message is displayed and script halted + * + * @return bool|string True if banned and no reason given. + * False if not banned. A ban reason if banned and ban reason given. Check for !== false. * @access public */ public function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) @@ -848,10 +855,12 @@ abstract class phpbb_session * * Only IPv4 (rbldns does not support AAAA records/IPv6 lookups) * + * @param string $mode Possible modes are: register and post + * spamhaus.org is used for both modes. Spamcop.net is additionally used for register. + * @param string $ip The ip to check. If false then the current IP is used + * + * @return bool|array False if ip is not blacklisted, else an array([checked server], [lookup]) * @author satmd (from the php manual) - * @param string $mode register/post - spamcop for example is ommitted for posting - * @param string $ip The ip to check. If false then the current IP is used - * @return bool|array false if ip is not blacklisted, else an array([checked server], [lookup]) * @access public */ public function check_dnsbl($mode, $ip = false) @@ -910,9 +919,9 @@ abstract class phpbb_session * browsers or locations. As with _any_ non-secure-socket no passphrase login this * remains vulnerable to exploit. * - * @param int $user_id The user id. If false the current users user id will be used - * @param string $key A login key. If false then the current users login key stored within the cookie will be used - * @param string $user_ip The users ip. If false, then the current users IP will be used + * @param int $user_id The user id. If false the current users user id will be used + * @param string $key A login key. If false then the current users login key stored within the cookie will be used + * @param string $user_ip The users ip. If false, then the current users IP will be used * @access public */ public function set_login_key($user_id = false, $key = false, $user_ip = false) @@ -958,7 +967,7 @@ abstract class phpbb_session * This method removes all current login keys for a specified (or the current) * user. It will be called on password change to render old keys unusable * - * @param int $user_id The user id. If false then the current users user id is used. + * @param int $user_id The user id. If false then the current users user id is used. * @access public */ public function reset_login_keys($user_id = false) @@ -1002,7 +1011,7 @@ abstract class phpbb_session /** * Check if a valid, non-expired session exist. Also make sure it errors out correctly if we do not have a db-setup yet. ;) * - * @return bool true if a valid, non-expired session exist + * @return bool True if a valid, non-expired session exist * @access private */ private function session_exist() @@ -1093,8 +1102,9 @@ abstract class phpbb_session /** * Check if the request originated from the same page. * - * @param bool $check_script_path If true, the path will be checked as well - * @return bool True if the referer is valid + * @param bool $check_script_path If true, the path will be checked as well + * + * @return bool True if the referer is valid * @access private */ private function validate_referer($check_script_path = false) @@ -1135,7 +1145,7 @@ abstract class phpbb_session /** * Fill data array with a "faked" user account * - * @return array default user data array + * @return array Default user data array * @access private */ private function default_data() @@ -1153,7 +1163,7 @@ abstract class phpbb_session * see if we have any useragent and/or IP matches. If we do, this is a * bot, act accordingly * - * @return bool True if it is a bot. + * @return bool True if it is a bot. * @access private */ private function check_bot() @@ -1195,8 +1205,9 @@ abstract class phpbb_session /** * Check if session is valid by comparing ip, forwarded for, browser and referer * - * @param bool $log_failure If true then a non-match will be logged. Can cause huge logs. - * @return bool true if the session is valid + * @param bool $log_failure If true then a non-match will be logged. Can cause huge logs. + * + * @return bool True if the session is valid * @access private */ private function session_valid($log_failure = true) diff --git a/phpBB/includes/classes/user.php b/phpBB/includes/classes/user.php index 7a6124136d..22e2b5acd4 100644 --- a/phpBB/includes/classes/user.php +++ b/phpBB/includes/classes/user.php @@ -105,8 +105,9 @@ 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 $auth_method The authentication method to use, for example 'db' + * @param string $custom_lang_path An optional language pack path. + * @access public */ public function __construct($auth_method, $custom_lang_path = false) { @@ -128,7 +129,8 @@ class phpbb_user extends phpbb_session /** * Initialize user session * - * @param bool $update_session_page If true the session page gets updated. This can be set to false to circumvent certain scripts to update the users last visited page. + * @param bool $update_session_page If true the session page gets updated. + * This can be set to false to circumvent certain scripts to update the users last visited page. * @access public */ public function init($update_session_page = true) @@ -140,7 +142,7 @@ class phpbb_user extends phpbb_session /** * Function to set custom language path (able to use directory outside of phpBB) * - * @param string $lang_path New language path used. + * @param string $lang_path New language path used. * @access public */ public function set_custom_lang_path($lang_path) @@ -156,8 +158,11 @@ class phpbb_user extends phpbb_session /** * Setup basic user-specific items (style, language, ...) * - * @param string|array $lang_set Language set to setup. Can be a string or an array of language files without a path and extension. Format must match {@link add_lang() add_lang}. - * @param int $style If not set to false this specifies the style id to use. The page will then use the specified style id instead of the default one. + * @param string|array $lang_set Language set to setup. + * Can be a string or an array of language files without a path and extension. + * Format must match {@link add_lang() add_lang}. + * @param int $style If not set to false this specifies the style id to use. + * The page will then use the specified style id instead of the default one. * @access public */ public function setup($lang_set = false, $style = false) @@ -534,10 +539,10 @@ class phpbb_user extends phpbb_session * phpbb::$user->lang('NUM_POSTS_IN_QUEUE', 1); * </code> * - * @param string $key The language key to use - * @param mixed $parameter,... An unlimited number of parameter to apply. + * @param string $key The language key to use + * @param mixed $parameter,... An unlimited number of parameter to apply. * - * @return string Substituted language string + * @return string Substituted language string * @see sprintf() * @access public */ @@ -625,9 +630,9 @@ class phpbb_user extends phpbb_session * $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting')) * </code> * - * @param mixed $lang_set specifies the language entries to include - * @param bool $use_db internal variable for recursion, do not use - * @param bool $use_help internal variable for recursion, do not use + * @param mixed $lang_set specifies the language entries to include + * @param bool $use_db internal variable for recursion, do not use + * @param bool $use_help internal variable for recursion, do not use * @access public */ public function add_lang($lang_set, $use_db = false, $use_help = false) @@ -668,11 +673,11 @@ class phpbb_user extends phpbb_session /** * Set language entry (called by {@link add_lang() add_lang}) * - * @param array &$lang A reference to the language array phpbb::$user->lang - * @param array &$help A reference to the language help array phpbb::$user->help - * @param string $lang_file Language filename - * @param bool $use_db True if the database is used for obtaining the information - * @param bool $use_help True if we fetch help entries instead of language entries + * @param array &$lang A reference to the language array phpbb::$user->lang + * @param array &$help A reference to the language help array phpbb::$user->help + * @param string $lang_file Language filename + * @param bool $use_db True if the database is used for obtaining the information + * @param bool $use_help True if we fetch help entries instead of language entries * @access private */ private function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false) @@ -739,11 +744,13 @@ class phpbb_user extends phpbb_session /** * Format user date * - * @param int $gmepoch unix timestamp to format - * @param string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. - * @param bool $forcedate force non-relative date format. - * @staticvar int $midnight Midnight time offset - * @staticvar array $date_cache array to cache commonly needed structures within this function + * @param int $gmepoch Unix timestamp to format + * @param string $format Date format in date() notation. + * The character | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. + * @param bool $forcedate Force non-relative date format. + * + * @staticvar int $midnight Midnight time offset + * @staticvar array $date_cache Array to cache commonly needed structures within this function * * @return mixed translated date * @access public @@ -816,6 +823,7 @@ class phpbb_user extends phpbb_session /** * Get language id currently used by the user + * * @return int language id * @access public */ @@ -844,8 +852,9 @@ class phpbb_user extends phpbb_session /** * Get users profile fields * - * @param int $user_id user id. If not specified the current users profile fields are grabbed. - * @return array profile fields. If the current user then they are also stored as property $profile_fields. + * @param int $user_id User id. If not specified the current users profile fields are grabbed. + * + * @return array Profile fields. If the current user then they are also stored as property $profile_fields. * @access public */ public function get_profile_fields($user_id = false) @@ -875,11 +884,13 @@ class phpbb_user extends phpbb_session /** * Specify/Get image from style imageset * - * @param string $img the imageset image key name - * @param string $alt an optional alternative image attribute. If a corresponding language key exist it will be used: phpbb::$user->lang[$alt] - * @param string $type the preferred type to return. Allowed types are: full_tag, src, width, height - * @param int $width set image width - * @return mixed returns the preferred type from $type + * @param string $img The imageset image key name + * @param string $alt An optional alternative image attribute. + * If a corresponding language key exist it will be used: phpbb::$user->lang[$alt] + * @param string $type The preferred type to return. Allowed types are: full_tag, src, width, height + * @param int $width Set image width + * + * @return mixed returns the preferred type from $type * @access public */ public function img($img, $alt = '', $type = 'full_tag', $width = false) @@ -929,9 +940,11 @@ class phpbb_user extends phpbb_session /** * Get option bit field from user options. * - * @param string $key the option key from {@link $keyoptions keyoptions} - * @param int $data optional user options bitfield. If not specified then {@link $data $data['user_options']} is used. - * @return bool corresponding option value returned. Is the option enabled or disabled. + * @param string $key The option key from {@link $keyoptions keyoptions} + * @param int $data Optional user options bitfield. + * If not specified then {@link $data $data['user_options']} is used. + * + * @return bool Corresponding option value returned. Is the option enabled or disabled. * @access public */ public function optionget($key, $data = false) @@ -952,10 +965,13 @@ class phpbb_user extends phpbb_session /** * Set option bit field for user options. * - * @param string $key the option key from {@link $keyoptions keyoptions} - * @param bool $value true to enable the option, false to disable it - * @param int $data optional user options bitfield. If not specified then {@link $data $data['user_options']} is used. - * @return bool the new user options bitfield is returned if $data is specified, else: false is returned if user options not changed, true if changed. + * @param string $key The option key from {@link $keyoptions keyoptions} + * @param bool $value True to enable the option, false to disable it + * @param int $data Optional user options bitfield. + * If not specified then {@link $data $data['user_options']} is used. + * + * @return bool The new user options bitfield is returned if $data is specified. + * Else: false is returned if user options not changed, true if changed. * @access public */ public function optionset($key, $value, $data = false) @@ -987,12 +1003,13 @@ class phpbb_user extends phpbb_session /** * User login. Log the user in. * - * @param string $username the specified user name - * @param string $password the specified password - * @param bool $autologin enable/disable persistent login - * @param bool $viewonline If false then the user will be logged in as hidden - * @param bool $admin If true the user requests an admin login - * @return array login result array. This array returns results to the login script to show errors, notices, confirmations. + * @param string $username The specified user name + * @param string $password The specified password + * @param bool $autologin Enable/disable persistent login + * @param bool $viewonline If false then the user will be logged in as hidden + * @param bool $admin If true the user requests an admin login + * + * @return array Login result array. This array returns results to the login script to show errors, notices, confirmations. * @access public */ public function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) |