comment with intendation

git-svn-id: file:///svn/phpbb/trunk@9229 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-12-25 14:30:26 +00:00
parent 7396cf6dd4
commit ddfef8d832
2 changed files with 101 additions and 73 deletions

View file

@ -79,6 +79,7 @@ abstract class phpbb_session
/** /**
* Init session. Empties the user data and assigns the system object (phpbb::$instances['system']) * Init session. Empties the user data and assigns the system object (phpbb::$instances['system'])
* @access public
*/ */
public function __construct() public function __construct()
{ {
@ -96,7 +97,7 @@ abstract class phpbb_session
/** /**
* Specifiy the need for a session id within the URL * 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 * @access public
*/ */
public function need_sid($need_sid = false) 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 * running on a system which makes such information readily available) and
* halt if it's above an admin definable limit. * 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. * @param bool $update_session_page If true the session page gets updated.
* @return bool True if the session exist or has been created, else False. * 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 * @access public
*/ */
public function session_begin($update_session_page = true) 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 * garbage collection, (search)bot checking, banned user comparison. Basically
* though this method will result in a new session for a specific user. * 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 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 $set_admin Set the users admin field to identify him/her as an admin?
* @param bool $persist_login Allow persistent login * @param bool $persist_login Allow persistent login
* @param bool $viewonline If false then the user will be logged in as hidden * @param bool $viewonline If false then the user will be logged in as hidden
* @return bool True if session got created successfully. *
* @return bool True if session got created successfully.
* @access public * @access public
*/ */
public function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) 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 * and update the users information from the relevant session data. It will then
* grab guest user information. * 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 * @access public
*/ */
public function session_kill($new_session = true) 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. * 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 $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 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 int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set.
*
* @access public * @access public
*/ */
public function set_cookie($name, $cookiedata, $cookietime) 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 * this routine does not return on finding a banned user, it outputs a relevant
* message and stops execution. * message and stops execution.
* *
* @param int $user_id The user id to check. If false then do not check user ids * @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 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 int $user_email The email address to check
* @param bool $return If false then the banned message is displayed and script halted * @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. *
* @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 * @access public
*/ */
public function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) 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) * 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) * @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 * @access public
*/ */
public function check_dnsbl($mode, $ip = false) 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 * browsers or locations. As with _any_ non-secure-socket no passphrase login this
* remains vulnerable to exploit. * remains vulnerable to exploit.
* *
* @param int $user_id The user id. If false the current users user id 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 $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 string $user_ip The users ip. If false, then the current users IP will be used
* @access public * @access public
*/ */
public function set_login_key($user_id = false, $key = false, $user_ip = false) 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) * 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 * 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 * @access public
*/ */
public function reset_login_keys($user_id = false) 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. ;) * 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 * @access private
*/ */
private function session_exist() private function session_exist()
@ -1093,8 +1102,9 @@ abstract class phpbb_session
/** /**
* Check if the request originated from the same page. * Check if the request originated from the same page.
* *
* @param bool $check_script_path If true, the path will be checked as well * @param bool $check_script_path If true, the path will be checked as well
* @return bool True if the referer is valid *
* @return bool True if the referer is valid
* @access private * @access private
*/ */
private function validate_referer($check_script_path = false) private function validate_referer($check_script_path = false)
@ -1135,7 +1145,7 @@ abstract class phpbb_session
/** /**
* Fill data array with a "faked" user account * Fill data array with a "faked" user account
* *
* @return array default user data array * @return array Default user data array
* @access private * @access private
*/ */
private function default_data() 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 * see if we have any useragent and/or IP matches. If we do, this is a
* bot, act accordingly * bot, act accordingly
* *
* @return bool True if it is a bot. * @return bool True if it is a bot.
* @access private * @access private
*/ */
private function check_bot() 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 * 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. * @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 *
* @return bool True if the session is valid
* @access private * @access private
*/ */
private function session_valid($log_failure = true) private function session_valid($log_failure = true)

View file

@ -105,8 +105,9 @@ class phpbb_user extends phpbb_session
/** /**
* Constructor to set the lang path. Calls parrent::__construct() * Constructor to set the lang path. Calls parrent::__construct()
* *
* @param string $auth_method The authentication method to use, for example 'db' * @param string $auth_method The authentication method to use, for example 'db'
* @param string $custom_lang_path An optional language pack path. * @param string $custom_lang_path An optional language pack path.
* @access public
*/ */
public function __construct($auth_method, $custom_lang_path = false) public function __construct($auth_method, $custom_lang_path = false)
{ {
@ -128,7 +129,8 @@ class phpbb_user extends phpbb_session
/** /**
* Initialize user 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 * @access public
*/ */
public function init($update_session_page = true) 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) * 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 * @access public
*/ */
public function set_custom_lang_path($lang_path) 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, ...) * 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 string|array $lang_set Language set to setup.
* @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. * 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 * @access public
*/ */
public function setup($lang_set = false, $style = false) 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); * phpbb::$user->lang('NUM_POSTS_IN_QUEUE', 1);
* </code> * </code>
* *
* @param string $key The language key to use * @param string $key The language key to use
* @param mixed $parameter,... An unlimited number of parameter to apply. * @param mixed $parameter,... An unlimited number of parameter to apply.
* *
* @return string Substituted language string * @return string Substituted language string
* @see sprintf() * @see sprintf()
* @access public * @access public
*/ */
@ -625,9 +630,9 @@ class phpbb_user extends phpbb_session
* $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting')) * $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting'))
* </code> * </code>
* *
* @param mixed $lang_set specifies the language entries to include * @param mixed $lang_set specifies the language entries to include
* @param bool $use_db internal variable for recursion, do not use * @param bool $use_db internal variable for recursion, do not use
* @param bool $use_help internal variable for recursion, do not use * @param bool $use_help internal variable for recursion, do not use
* @access public * @access public
*/ */
public function add_lang($lang_set, $use_db = false, $use_help = false) 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}) * Set language entry (called by {@link add_lang() add_lang})
* *
* @param array &$lang A reference to the language array phpbb::$user->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 array &$help A reference to the language help array phpbb::$user->help
* @param string $lang_file Language filename * @param string $lang_file Language filename
* @param bool $use_db True if the database is used for obtaining the information * @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 bool $use_help True if we fetch help entries instead of language entries
* @access private * @access private
*/ */
private function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false) 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 * Format user date
* *
* @param int $gmepoch unix timestamp to format * @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 string $format Date format in date() notation.
* @param bool $forcedate force non-relative date format. * The character | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i.
* @staticvar int $midnight Midnight time offset * @param bool $forcedate Force non-relative date format.
* @staticvar array $date_cache array to cache commonly needed structures within this function *
* @staticvar int $midnight Midnight time offset
* @staticvar array $date_cache Array to cache commonly needed structures within this function
* *
* @return mixed translated date * @return mixed translated date
* @access public * @access public
@ -816,6 +823,7 @@ class phpbb_user extends phpbb_session
/** /**
* Get language id currently used by the user * Get language id currently used by the user
*
* @return int language id * @return int language id
* @access public * @access public
*/ */
@ -844,8 +852,9 @@ class phpbb_user extends phpbb_session
/** /**
* Get users profile fields * Get users profile fields
* *
* @param int $user_id user id. If not specified the current users profile fields are grabbed. * @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. *
* @return array Profile fields. If the current user then they are also stored as property $profile_fields.
* @access public * @access public
*/ */
public function get_profile_fields($user_id = false) public function get_profile_fields($user_id = false)
@ -875,11 +884,13 @@ class phpbb_user extends phpbb_session
/** /**
* Specify/Get image from style imageset * Specify/Get image from style imageset
* *
* @param string $img the imageset image key name * @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 $alt An optional alternative image attribute.
* @param string $type the preferred type to return. Allowed types are: full_tag, src, width, height * If a corresponding language key exist it will be used: phpbb::$user->lang[$alt]
* @param int $width set image width * @param string $type The preferred type to return. Allowed types are: full_tag, src, width, height
* @return mixed returns the preferred type from $type * @param int $width Set image width
*
* @return mixed returns the preferred type from $type
* @access public * @access public
*/ */
public function img($img, $alt = '', $type = 'full_tag', $width = false) 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. * Get option bit field from user options.
* *
* @param string $key the option key from {@link $keyoptions keyoptions} * @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. * @param int $data Optional user options bitfield.
* @return bool corresponding option value returned. Is the option enabled or disabled. * 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 * @access public
*/ */
public function optionget($key, $data = false) public function optionget($key, $data = false)
@ -952,10 +965,13 @@ class phpbb_user extends phpbb_session
/** /**
* Set option bit field for user options. * Set option bit field for user options.
* *
* @param string $key the option key from {@link $keyoptions keyoptions} * @param string $key The option key from {@link $keyoptions keyoptions}
* @param bool $value true to enable the option, false to disable it * @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. * @param int $data Optional user options bitfield.
* @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. * 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 * @access public
*/ */
public function optionset($key, $value, $data = false) public function optionset($key, $value, $data = false)
@ -987,12 +1003,13 @@ class phpbb_user extends phpbb_session
/** /**
* User login. Log the user in. * User login. Log the user in.
* *
* @param string $username the specified user name * @param string $username The specified user name
* @param string $password the specified password * @param string $password The specified password
* @param bool $autologin enable/disable persistent login * @param bool $autologin Enable/disable persistent login
* @param bool $viewonline If false then the user will be logged in as hidden * @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 * @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. *
* @return array Login result array. This array returns results to the login script to show errors, notices, confirmations.
* @access public * @access public
*/ */
public function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) public function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)