add_form_key (line
2244)
Add a secret token to the form (requires the S_FORM_TOKEN template variable)
void
add_form_key
(string $form_name)
-
string
$form_name: The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply
add_log (line
2831)
Add log event
void
add_log
()
append_sid (line
1809)
Append session id to url.
This function supports hooks.
void
append_sid
(string $url, [mixed $params = false], [bool $is_amp = true], [string $session_id = false])
-
string
$url: The url the session id needs to be appended to (can have params)
-
mixed
$params: String or array of additional url parameters
-
bool
$is_amp: Is url using & (true) or & (false)
-
string
$session_id:
Possibility to use a custom session id instead of the global one
Examples:
append_sid("{
$phpbb_root_path}viewtopic.$phpEx?t=1&f=2");
append_sid("{
$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2');
append_sid("{
$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2', false);
append_sid("{
$phpbb_root_path}viewtopic.$phpEx", array('t' =>
1, 'f' =>
2));
array_combine (line
611)
A wrapper for the PHP5 function array_combine()
Returns
array_combine
(array $keys, array $values)
-
array
$keys: contains keys for the resulting array
-
array
$values: contains values for the resulting array
build_hidden_fields (line
2765)
Build simple hidden fields from array
string
build_hidden_fields
(array $field_ary, [bool $specialchar = false], [bool $stripslashes = false])
-
array
$field_ary: an array of values to build the hidden field from
-
bool
$specialchar: if true, keys and values get specialchared
-
bool
$stripslashes: if true, keys and values get stripslashed
build_url (line
2133)
Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url
void
build_url
([ $strip_vars = false])
check_form_key (line
2267)
Check the form key. Required for all altering actions not secured by confirm_box
void
check_form_key
(string $form_name, [int $timespan = false], [string $return_page = ''], [bool $trigger = false])
-
string
$form_name: The name of the form; has to match the name used in add_form_key, otherwise no restrictions apply
-
int
$timespan: The maximum acceptable age for a submitted form in seconds. Defaults to the config setting.
-
string
$return_page: The address for the return link
-
bool
$trigger: If true, the function will triger an error when encountering an invalid form
check_link_hash (line
2235)
checks a link hash - for GET requests
boolean
check_link_hash
(string $token, string $link_name)
-
string
$token: the submitted token
-
string
$link_name: The name of the link
confirm_box (line
2315)
Build Confirm box
void
confirm_box
(boolean $check, [string $title = ''], [string $hidden = ''], [string $html_body = 'confirm_body.html'], [string $u_action = ''])
-
boolean
$check: True for checking if confirmed (without any additional parameters) and false for displaying the confirm box
-
string
$title: Title/Message used for confirm box. message text is _CONFIRM appended to title. If title cannot be found in user->lang a default one is displayed If title_CONFIRM cannot be found in user->lang the text given is used.
-
string
$hidden: Hidden variables
-
string
$html_body: Template used for confirm box
-
string
$u_action: Custom form action
exit_handler (line
3844)
Handler for exit calls in phpBB.
This function supports hooks.
Note: This function is called after the template has been outputted.
void
exit_handler
()
garbage_collection (line
3821)
Closing the cache object and the database
Cool function name, eh? We might want to add operations to it later
void
garbage_collection
()
generate_board_url (line
1894)
Generate board url (example: http://www.example.com/phpBB)
void
generate_board_url
([bool $without_script_path = false])
-
bool
$without_script_path: if set to true the script path gets not appended (example: http://www.example.com)
generate_link_hash (line
2218)
Add a secret hash for use in links/GET requests
string
generate_link_hash
(string $link_name)
-
string
$link_name: The name of the link; has to match the name used in check_link_hash, otherwise no restrictions apply
generate_pagination (line
1690)
Pagination routine, generates page number sequence
tpl_prefix is for using different pagination blocks at one page
void
generate_pagination
( $base_url, $num_items, $per_page, $start_item, [ $add_prevnext_text = false], [ $tpl_prefix = ''])
-
$base_url
-
$num_items
-
$per_page
-
$start_item
-
$add_prevnext_text
-
$tpl_prefix
gen_rand_string (line
170)
Generates an alphanumeric random string of given length
void
gen_rand_string
([ $num_chars = 8])
get_backtrace (line
2889)
Return a nicely formatted backtrace (parts from the php manual by diz at ysagoon dot com)
void
get_backtrace
()
get_complete_topic_tracking (line
1330)
Get topic tracking info from db (for cookie based tracking only this function is used)
void
get_complete_topic_tracking
( $forum_id, $topic_ids, [ $global_announce_list = false])
-
$forum_id
-
$topic_ids
-
$global_announce_list
get_formatted_filesize (line
204)
Return formatted string for filesizes
void
get_formatted_filesize
( $bytes, [ $add_size_lang = true])
get_preg_expression (line
2952)
This function returns a regular expression pattern for commonly used expressions
Use with / as delimiter for email mode and # for url modes mode can be: email|bbcode_htm|url|url_inline|www_url|www_url_inline|relative_url|relative_url_inline|ipv4|ipv6
void
get_preg_expression
( $mode)
get_topic_tracking (line
1250)
Get topic tracking info by using already fetched info
void
get_topic_tracking
( $forum_id, $topic_ids, &$rowset, $forum_mark_time, [ $global_announce_list = false])
-
$forum_id
-
$topic_ids
-
&$rowset
-
$forum_mark_time
-
$global_announce_list
is_absolute (line
693)
Checks if a path ($path) is absolute or relative
boolean
is_absolute
(string $path)
-
string
$path: Path to check absoluteness of
language_select (line
909)
Pick a language, any language ...
void
language_select
([ $default = ''])
login_box (line
2418)
Generate login box or verify password
void
login_box
([ $redirect = ''], [ $l_explain = ''], [ $l_success = ''], [ $admin = false], [ $s_display = true])
-
$redirect
-
$l_explain
-
$l_success
-
$admin
-
$s_display
login_forum_box (line
2652)
Generate forum login box
void
login_forum_box
( $forum_data)
markread (line
991)
Marks a topic/forum as read Marks a topic as posted to
void
markread
( $mode, [ $forum_id = false], [ $topic_id = false], [ $post_time = 0], [int $user_id = 0])
-
int
$user_id: can only be used with $mode == 'post'
-
$mode
-
$forum_id
-
$topic_id
-
$post_time
meta_refresh (line
2194)
Meta refresh assignment
void
meta_refresh
( $time, $url)
msg_handler (line
3096)
Error and message handler, call with trigger_error if reqd
void
msg_handler
( $errno, $msg_text, $errfile, $errline)
-
$errno
-
$msg_text
-
$errfile
-
$errline
obtain_guest_count (line
3296)
Queries the session table to get information about online guests
int
obtain_guest_count
([int $forum_id = 0])
-
int
$forum_id: Limits the search to the forum with this id
obtain_users_online (line
3343)
Queries the session table to get information about online users
array
obtain_users_online
([int $forum_id = 0])
-
int
$forum_id: Limits the search to the forum with this id
obtain_users_online_string (line
3406)
Uses the result of obtain_users_online to generate a localized, readable representation.
array
obtain_users_online_string
(mixed $online_users, [int $forum_id = 0])
-
mixed
$online_users: result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics
-
int
$forum_id: Indicate that the data is limited to one forum and not global.
on_page (line
1773)
Return current page (pagination)
void
on_page
( $num_items, $per_page, $start)
-
$num_items
-
$per_page
-
$start
page_footer (line
3729)
Generate page footer
void
page_footer
([ $run_cron = true])
page_header (line
3514)
Generate page header
void
page_header
([ $page_title = ''], [ $display_online_list = true])
-
$page_title
-
$display_online_list
parse_cfg_file (line
2783)
Parse cfg file
void
parse_cfg_file
( $filename, [ $lines = false])
phpbb_checkdnsrr (line
3046)
Wrapper for php's checkdnsrr function.
The windows failover is from the php manual Please make sure to check the return value for === true and === false, since NULL could be returned too.
true
phpbb_checkdnsrr
( $host, [ $type = ''])
phpbb_check_hash (line
329)
Check for correct password
bool
phpbb_check_hash
(string $password, string $hash)
-
string
$password: The password in plain text
-
string
$hash: The stored password hash
phpbb_chmod (line
484)
Global function for chmodding directories and files for internal use This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions.
The function determines owner and group from common.php file and sets the same to the provided file. The function uses bit fields to build the permissions. The function sets the appropiate execute bit on directories.
Supported constants representing bit fields are:
CHMOD_ALL - all permissions (7) CHMOD_READ - read permission (4) CHMOD_WRITE - write permission (2) CHMOD_EXECUTE - execute permission (1)
NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions.
true
phpbb_chmod
($filename $filename, [$perms $perms = CHMOD_READ])
-
$filename
$filename: The file/directory to be chmodded
-
$perms
$perms: Permissions to set
phpbb_hash (line
285)
void
phpbb_hash
( $password)
phpbb_own_realpath (line
704)
mixed
phpbb_own_realpath
(string $path)
-
string
$path: The path which we should attempt to resolve.
phpbb_realpath (line
871)
A wrapper for realpath
void
phpbb_realpath
( $path)
phpbb_user_session_handler (line
3866)
Handler for init calls in phpBB. This function is called in user::setup(); This function supports hooks.
void
phpbb_user_session_handler
()
reapply_sid (line
2100)
Re-Apply session id after page reloads
void
reapply_sid
( $url)
redirect (line
1952)
Redirects the user to another page then exits the script nicely This function is intended for urls within the board. It's not meant to redirect to cross-domains.
void
redirect
(string $url, [bool $return = false], [bool $disable_cd_check = false])
-
string
$url: The url to redirect to
-
bool
$return: If true, do not redirect but return the sanitized URL. Default is no return.
-
bool
$disable_cd_check: If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false.
request_var (line
63)
request_var
Used to get passed variable
void
request_var
( $var_name, $default, [ $multibyte = false], [ $cookie = false])
-
$var_name
-
$default
-
$multibyte
-
$cookie
set_config (line
141)
Set config value. Creates missing config entry.
void
set_config
( $config_name, $config_value, [ $is_dynamic = false])
-
$config_name
-
$config_value
-
$is_dynamic
set_var (line
28)
set_var
Set variable, used by the request_var function
void
set_var
( &$result, $var, $type, [ $multibyte = false])
-
&$result
-
$var
-
$type
-
$multibyte
short_ipv6 (line
3012)
Returns the first block of the specified IPv6 address and as many additional ones as specified in the length paramater.
If length is zero, then an empty string is returned. If length is greater than 3 the complete IP will be returned
void
short_ipv6
( $ip, $length)
still_on_time (line
227)
Determine whether we are approaching the maximum execution time. Should be called once at the beginning of the script in which it's used.
bool
still_on_time
([ $extra_time = 15])
stripos (line
676)
A wrapper for the PHP5 function stripos Find position of first occurrence of a case-insensitive string
mixed
stripos
(string $haystack, string $needle)
-
string
$haystack: is the string to search in
-
string
$needle: is the string to search for
str_split (line
645)
A wrapper for the PHP5 function str_split()
Converts
str_split
(array $string, [array $split_length = 1])
-
array
$string: contains the string to be converted
-
array
$split_length: contains the length of each chunk
style_select (line
932)
Pick a template/theme combo,
void
style_select
([ $default = ''], [ $all = false])
tracking_serialize (line
1566)
Transform an array into a serialized format
void
tracking_serialize
( $input)
tracking_unserialize (line
1586)
Transform a serialized array into an actual array
void
tracking_unserialize
( $string, [ $max_depth = 3])
tz_select (line
957)
Pick a timezone
void
tz_select
([ $default = ''], [ $truncate = false])
unique_id (line
182)
Return unique id
void
unique_id
([string $extra = 'c'])
-
string
$extra: additional entropy
update_forum_tracking_info (line
1466)
Check for read forums and update topic tracking info accordingly
true
update_forum_tracking_info
(int $forum_id, int $forum_last_post_time, [int $f_mark_time = false], [int $mark_time_forum = false])
-
int
$forum_id: the forum id to check
-
int
$forum_last_post_time: the forums last post time
-
int
$f_mark_time: the forums last mark time if user is registered and load_db_lastread enabled
-
int
$mark_time_forum: false if the mark time needs to be obtained, else the last users forum mark time
_build_hidden_fields (line
2731)
Little helper for the build_hidden_fields function
void
_build_hidden_fields
( $key, $value, $specialchar, $stripslashes)
-
$key
-
$value
-
$specialchar
-
$stripslashes
_hash_crypt_private (line
404)
The crypt function/replacement
void
_hash_crypt_private
( $password, $setting, &$itoa64)
-
$password
-
$setting
-
&$itoa64
_hash_encode64 (line
360)
Encode hash
void
_hash_encode64
( $input, $count, &$itoa64)
_hash_gensalt_private (line
343)
Generate salt for hash generation
void
_hash_gensalt_private
( $input, &$itoa64, [ $iteration_count_log2 = 6])
-
$input
-
&$itoa64
-
$iteration_count_log2