[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/inc/ -> functions.php (summary)

MyBB 1.8 Copyright 2014 MyBB Group, All Rights Reserved Website: http://www.mybb.com License: http://www.mybb.com/about/license

File Size: 9525 lines (227 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 15 files
 inc/settings.php
 inc/class_datacache.php
 inc/class_plugins.php
 inc/class_core.php
 inc/mailhandlers/php.php
 inc/class_moderation.php
 inc/mailhandlers/smtp.php
 inc/class_xmlparser.php
 inc/class_xml.php
 inc/datahandlers/warnings.php
 inc/class_mailhandler.php
 inc/AbstractPdoDbDriver.php
 inc/functions_image.php
 inc/datahandlers/pm.php
 inc/db_base.php

Defines 175 functions

  output_page()
  add_shutdown()
  run_shutdown()
  send_mail_queue()
  parse_page()
  my_date()
  get_my_mailhandler()
  my_mail()
  generate_post_check()
  verify_post_check()
  get_parent_list()
  build_parent_list()
  cache_forums()
  get_child_list()
  error()
  inline_error()
  error_no_permission()
  redirect()
  multipage()
  fetch_page_url()
  user_permissions()
  usergroup_permissions()
  usergroup_displaygroup()
  forum_permissions()
  fetch_forum_permissions()
  forum_password_validated()
  check_forum_password()
  get_moderator_permissions()
  is_moderator()
  get_moderated_fids()
  get_post_icons()
  my_setcookie()
  my_unsetcookie()
  my_get_array_cookie()
  my_set_array_cookie()
  _safe_unserialize()
  my_unserialize()
  native_unserialize()
  _safe_serialize()
  my_serialize()
  get_server_load()
  get_memory_usage()
  update_stats()
  update_forum_counters()
  update_forum_lastpost()
  update_thread_counters()
  update_thread_data()
  update_user_counters()
  delete_thread()
  delete_post()
  build_forum_jump()
  get_extension()
  random_str()
  format_name()
  format_avatar()
  build_mycode_inserter()
  get_subscription_method()
  build_clickable_smilies()
  build_prefixes()
  build_prefix_select()
  build_forum_prefix_select()
  gzip_encode()
  log_moderator_action()
  get_reputation()
  get_colored_warning_level()
  get_ip()
  get_friendly_size()
  format_time_duration()
  get_attachment_icon()
  get_unviewable_forums()
  fix_mktime()
  build_breadcrumb()
  add_breadcrumb()
  build_forum_breadcrumb()
  reset_breadcrumb()
  build_archive_link()
  debug_page()
  send_page_headers()
  mark_reports()
  nice_time()
  alt_trow()
  join_usergroup()
  leave_usergroup()
  get_current_location()
  build_theme_select()
  get_theme()
  htmlspecialchars_uni()
  my_number_format()
  convert_through_utf8()
  my_wordwrap()
  get_weekday()
  get_bdays()
  format_bdays()
  get_age()
  update_first_post()
  update_last_post()
  my_strlen()
  my_substr()
  my_strtolower()
  my_stripos()
  my_strpos()
  my_strtoupper()
  unhtmlentities()
  unichr()
  unichr_callback1()
  unichr_callback2()
  get_event_poster()
  get_event_date()
  get_profile_link()
  get_announcement_link()
  build_profile_link()
  get_forum_link()
  get_thread_link()
  get_post_link()
  get_event_link()
  get_calendar_link()
  get_calendar_week_link()
  get_user()
  get_user_by_username()
  get_forum()
  get_thread()
  get_post()
  get_inactive_forums()
  login_attempt_check()
  validate_email_format()
  email_already_in_use()
  rebuild_settings()
  build_highlight_array()
  build_highlight_array_sort()
  dec_to_utf8()
  is_banned_username()
  is_banned_email()
  is_banned_ip()
  get_supported_timezones()
  build_timezone_select()
  fetch_remote_file()
  get_ip_by_hostname()
  get_ca_bundle_path()
  is_super_admin()
  is_member()
  escaped_explode()
  escaped_explode_escape()
  fetch_longipv4_range()
  fetch_ban_times()
  ban_date2timestamp()
  expire_warnings()
  my_chmod()
  my_rmdir_recursive()
  subforums_count()
  my_ip2long()
  my_long2ip()
  my_inet_pton()
  my_inet_ntop()
  fetch_ip_range()
  get_execution_time()
  verify_files()
  signed()
  secure_binary_seed_rng()
  secure_seed_rng()
  my_rand()
  trim_blank_chrs()
  match_sequence()
  gd_version()
  validate_utf8_string()
  send_pm()
  log_spam_block()
  copy_file_to_cdn()
  my_validate_url()
  my_strip_tags()
  my_escape_csv()
  array_column()
  my_hash_equals()
  get_user_referrals()
  create_xml_parser()
  mk_path_abs()

Functions
Functions that are not part of a class:

output_page($contents)   X-Ref
Outputs a page directly to the browser, parsing anything which needs to be parsed.
param: string $contents The contents of the page.

add_shutdown($name, $arguments=array()   X-Ref
Adds a function or class to the list of code to run on shutdown.
return: boolean True if function exists, otherwise false.
param: string|array $name The name of the function.
param: mixed $arguments Either an array of arguments for the function or one argument

run_shutdown()   X-Ref
Runs the shutdown items after the page has been sent to the browser.

send_mail_queue($count=10)   X-Ref
Sends a specified amount of messages from the mail queue
param: int $count The number of messages to send (Defaults to 10)

parse_page($contents)   X-Ref
Parses the contents of a page before outputting it.
return: string The parsed page.
param: string $contents The contents of the page.

my_date($format, $stamp=0, $offset="", $ty=1, $adodb=false)   X-Ref
Turn a unix timestamp in to a "friendly" date/time format for the user.
return: string The formatted timestamp.
param: string $format A date format (either relative, normal or PHP's date() structure).
param: int $stamp The unix timestamp the date should be generated for.
param: int|string $offset The offset in hours that should be applied to times. (timezones) Or an empty string to determine that automatically
param: int $ty Whether or not to use today/yesterday formatting.
param: boolean $adodb Whether or not to use the adodb time class for < 1970 or > 2038 times

get_my_mailhandler($use_buitlin = false)   X-Ref
Get a mail handler instance, a MyBB's built-in SMTP / PHP mail hander or one created by a plugin.
return: object A MyBB built-in mail handler or one created by plugin(s).
param: bool $use_buitlin Whether to use MyBB's built-in mail handler.

my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")   X-Ref
Sends an email using PHP's mail function, formatting it appropriately.
return: bool True if the mail is sent, false otherwise.
param: string $to Address the email should be addressed to.
param: string $subject The subject of the email being sent.
param: string $message The message being sent.
param: string $from The from address of the email, if blank, the board name will be used.
param: string $charset The chracter set being used to send this email.
param: string $headers
param: boolean $keep_alive Do we wish to keep the connection to the mail server alive to send more than one message (SMTP only)
param: string $format The format of the email to be sent (text or html). text is default
param: string $message_text The text message of the email if being sent in html format, for email clients that don't support html
param: string $return_email The email address to return to. Defaults to admin return email address.

generate_post_check($rotation_shift=0)   X-Ref
Generates a code for POST requests to prevent XSS/CSRF attacks.
Unique for each user or guest session and rotated every 6 hours.

return: string The generated code
param: int $rotation_shift Adjustment of the rotation number to generate a past/future code

verify_post_check($code, $silent=false)   X-Ref
Verifies a POST check code is valid (i.e. generated using a rotation number from the past 24 hours)
return: bool|void Result boolean if $silent is true, otherwise shows an error to the user
param: string $code The incoming POST check code
param: boolean $silent Don't show an error to the user

get_parent_list($fid)   X-Ref
Return a parent list for the specified forum.
return: string The comma-separated parent list.
param: int $fid The forum id to get the parent list for.

build_parent_list($fid, $column="fid", $joiner="OR", $parentlist="")   X-Ref
Build a parent list of a specific forum, suitable for querying
return: string The query string generated
param: int $fid The forum ID
param: string $column The column name to add to the query
param: string $joiner The joiner for each forum for querying (OR | AND | etc)
param: string $parentlist The parent list of the forum - if you have it

cache_forums($force=false)   X-Ref
Load the forum cache in to memory
return: array The forum cache
param: boolean $force True to force a reload of the cache

get_child_list($fid)   X-Ref
Generate an array of all child and descendant forums for a specific forum.
return: Array of descendants
param: int $fid The forum ID

error($error="", $title="")   X-Ref
Produce a friendly error message page
param: string $error The error message to be shown
param: string $title The title of the message shown in the title of the page and the error table

inline_error($errors, $title="", $json_data=array()   X-Ref
Produce an error message for displaying inline on a page
return: string The inline error HTML
param: array $errors Array of errors to be shown
param: string $title The title of the error message
param: array $json_data JSON data to be encoded (we may want to send more data; e.g. newreply.php uses this for CAPTCHA)

error_no_permission()   X-Ref
Presents the user with a "no permission" page

redirect($url, $message="", $title="", $force_redirect=false)   X-Ref
Redirect the user to a given URL with a given message
param: string $url The URL to redirect the user to
param: string $message The redirection message to be shown
param: string $title The title of the redirection page
param: boolean $force_redirect Force the redirect page regardless of settings

multipage($count, $perpage, $page, $url, $breadcrumb=false)   X-Ref
Generate a listing of page - pagination
return: string The generated pagination
param: int $count The number of items
param: int $perpage The number of items to be shown per page
param: int $page The current page number
param: string $url The URL to have page numbers tacked on to (If {page} is specified, the value will be replaced with the page #)
param: boolean $breadcrumb Whether or not the multipage is being shown in the navigation breadcrumb

fetch_page_url($url, $page)   X-Ref
Generate a page URL for use by the multipage function
return: string
param: string $url The URL being passed
param: int $page The page number

user_permissions($uid=null)   X-Ref
Fetch the permissions for a specific user
return: array Array of user permissions for the specified user
param: int $uid The user ID, if no user ID is provided then current user's ID will be considered.

usergroup_permissions($gid=0)   X-Ref
Fetch the usergroup permissions for a specific group or series of groups combined
return: array Array of permissions generated for the groups, containing also a list of comma-separated checked groups under 'all_usergroups' index
param: int|string $gid A list of groups (Can be a single integer, or a list of groups separated by a comma)

usergroup_displaygroup($gid)   X-Ref
Fetch the display group properties for a specific display group
return: array Array of display properties for the group
param: int $gid The group ID to fetch the display properties for

forum_permissions($fid=0, $uid=0, $gid=0)   X-Ref
Build the forum permissions for a specific forum, user or group
return: array Forum permissions for the specific forum or forums
param: int $fid The forum ID to build permissions for (0 builds for all forums)
param: int $uid The user to build the permissions for (0 will select the uid automatically)
param: int $gid The group of the user to build permissions for (0 will fetch it)

fetch_forum_permissions($fid, $gid, $groupperms)   X-Ref
Fetches the permissions for a specific forum/group applying the inheritance scheme.
Called by forum_permissions()

return: array Permissions for this forum
param: int $fid The forum ID
param: string $gid A comma separated list of usergroups
param: array $groupperms Group permissions

forum_password_validated($forum, $ignore_empty=false, $check_parents=false)   X-Ref
Check whether password for given forum was validated for the current user
return: bool
param: array $forum The forum data
param: bool $ignore_empty Whether to treat forum password configured as an empty string as validated
param: bool $check_parents Whether to check parent forums using `parentlist`

check_forum_password($fid, $pid=0, $return=false)   X-Ref
Check the password given on a certain forum for validity
return: bool
param: int $fid The forum ID
param: int $pid The Parent ID
param: bool $return

get_moderator_permissions($fid, $uid=0, $parentslist="")   X-Ref
Return the permissions for a moderator in a specific forum
return: array Array of moderator permissions for the specific forum
param: int $fid The forum ID
param: int $uid The user ID to fetch permissions for (0 assumes current logged in user)
param: string $parentslist The parent list for the forum (if blank, will be fetched)

is_moderator($fid=0, $action="", $uid=0)   X-Ref
Checks if a moderator has permissions to perform an action in a specific forum
return: bool Returns true if the user has permission, false if they do not
param: int $fid The forum ID (0 assumes global)
param: string $action The action tyring to be performed. (blank assumes any action at all)
param: int $uid The user ID (0 assumes current user)

get_moderated_fids($uid=0)   X-Ref
Get an array of fids that the forum moderator has access to.
Do not use for administraotrs or global moderators as they moderate any forum and the function will return false.

return: array|bool an array of the fids the user has moderator access to or bool if called incorrectly.
param: int $uid The user ID (0 assumes current user)

get_post_icons()   X-Ref
Generate a list of the posticons.
return: string The template of posticons.

my_setcookie($name, $value="", $expires="", $httponly=false, $samesite="")   X-Ref
MyBB setcookie() wrapper.
param: string $name The cookie identifier.
param: string $value The cookie value.
param: int|string $expires The timestamp of the expiry date.
param: boolean $httponly True if setting a HttpOnly cookie (supported by the majority of web browsers)
param: string $samesite The samesite attribute to prevent CSRF.

my_unsetcookie($name)   X-Ref
Unset a cookie set by MyBB.
param: string $name The cookie identifier.

my_get_array_cookie($name, $id)   X-Ref
Get the contents from a serialised cookie array.
return: array|boolean The cookie id's content array or false when non-existent.
param: string $name The cookie identifier.
param: int $id The cookie content id.

my_set_array_cookie($name, $id, $value, $expires="")   X-Ref
Set a serialised cookie array.
param: string $name The cookie identifier.
param: int $id The cookie content id.
param: string $value The value to set the cookie to.
param: int|string $expires The timestamp of the expiry date.

_safe_unserialize($str, $unlimited = true)   X-Ref
Credits go to https://github.com/piwik
Safe unserialize() replacement
- accepts a strict subset of PHP's native my_serialized representation
- does not unserialize objects

return: mixed
param: string $str
param: bool $unlimited Whether to apply limits defined in MAX_SERIALIZED_* constants

my_unserialize($str, $unlimited = true)   X-Ref
Credits go to https://github.com/piwik
Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue

return: mixed
param: string $str
param: bool $unlimited

native_unserialize($str)   X-Ref
Unserializes data using PHP's `unserialize()`, and its safety options if possible.
This function should only be used for values from trusted sources.

return: mixed
param: string $str

_safe_serialize( $value )   X-Ref
Credits go to https://github.com/piwik
Safe serialize() replacement
- output a strict subset of PHP's native serialized representation
- does not my_serialize objects

return: string
param: mixed $value

my_serialize($value)   X-Ref
Credits go to https://github.com/piwik
Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue

return: string
param: mixed $value

get_server_load()   X-Ref
Returns the serverload of the system.
return: int The serverload of the system.

get_memory_usage()   X-Ref
Returns the amount of memory allocated to the script.
return: int The amount of memory allocated to the script.

update_stats($changes=array()   X-Ref
Updates the forum statistics with specific values (or addition/subtraction of the previous value)
param: array $changes Array of items being updated (numthreads,numposts,numusers,numunapprovedthreads,numunapprovedposts,numdeletedposts,numdeletedthreads)
param: boolean $force Force stats update?

update_forum_counters($fid, $changes=array()   X-Ref
Updates the forum counters with a specific value (or addition/subtraction of the previous value)
param: int $fid The forum ID
param: array $changes Array of items being updated (threads, posts, unapprovedthreads, unapprovedposts, deletedposts, deletedthreads) and their value (ex, 1, +1, -1)

update_forum_lastpost($fid)   X-Ref
Update the last post information for a specific forum
param: int $fid The forum ID

update_thread_counters($tid, $changes=array()   X-Ref
Updates the thread counters with a specific value (or addition/subtraction of the previous value)
param: int $tid The thread ID
param: array $changes Array of items being updated (replies, unapprovedposts, deletedposts, attachmentcount) and their value (ex, 1, +1, -1)

update_thread_data($tid)   X-Ref
Update the first post and lastpost data for a specific thread
param: int $tid The thread ID

update_user_counters($uid, $changes=array()   X-Ref
Updates the user counters with a specific value (or addition/subtraction of the previous value)
param: int $uid The user ID
param: array $changes Array of items being updated (postnum, threadnum) and their value (ex, 1, +1, -1)

delete_thread($tid)   X-Ref
Deletes a thread from the database
return: bool
param: int $tid The thread ID

delete_post($pid)   X-Ref
Deletes a post from the database
return: bool
param: int $pid The thread ID

build_forum_jump($pid=0, $selitem=0, $addselect=1, $depth="", $showextras=1, $showall=false, $permissions="", $name="fid")   X-Ref
Builds a forum jump menu
return: string Forum jump items
param: int $pid The parent forum to start with
param: int $selitem The selected item ID
param: int $addselect If we need to add select boxes to this cal or not
param: string $depth The current depth of forums we're at
param: int $showextras Whether or not to show extra items such as User CP, Forum home
param: boolean $showall Ignore the showinjump setting and show all forums (for moderation pages)
param: mixed $permissions deprecated
param: string $name The name of the forum jump

get_extension($file)   X-Ref
Returns the extension of a file.
return: string The extension of the file.
param: string $file The filename.

random_str($length=8, $complex=false)   X-Ref
Generates a random string.
return: string The random string.
param: int $length The length of the string to generate.
param: bool $complex Whether to return complex string. Defaults to false

format_name($username, $usergroup, $displaygroup=0)   X-Ref
Formats a username based on their display group
return: string The formatted username
param: string $username The username
param: int $usergroup The usergroup for the user
param: int $displaygroup The display group for the user

format_avatar($avatar, $dimensions = '', $max_dimensions = '')   X-Ref
Formats an avatar to a certain dimension
return: array Information for the formatted avatar
param: string $avatar The avatar file name
param: string $dimensions Dimensions of the avatar, width x height (e.g. 44|44)
param: string $max_dimensions The maximum dimensions of the formatted avatar

build_mycode_inserter($bind="message", $smilies = true)   X-Ref
Build the javascript based MyCode inserter.
return: string The MyCode inserter
param: string $bind The ID of the textarea to bind to. Defaults to "message".
param: bool $smilies Whether to include smilies. Defaults to true.

get_subscription_method($tid = 0, $postoptions = array()   X-Ref

return: string Predefined / updated subscription method of the thread for the user
param: int $tid
param: array $postoptions The options carried with form submit

build_clickable_smilies()   X-Ref
Build the javascript clickable smilie inserter
return: string The clickable smilies list

build_prefixes($pid=0)   X-Ref
Builds thread prefixes and returns a selected prefix (or all)
return: array The thread prefix's values (or all thread prefixes)
param: int $pid The prefix ID (0 to return all)

build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)   X-Ref
Build the thread prefix selection menu for the current user
return: string The thread prefix selection menu
param: int|string $fid The forum ID (integer ID or string all)
param: int|string $selected_pid The selected prefix ID (integer ID or string any)
param: int $multiple Allow multiple prefix selection
param: int $previous_pid The previously selected prefix ID

build_forum_prefix_select($fid, $selected_pid=0)   X-Ref
Build the thread prefix selection menu for a forum without group permission checks
return: string The thread prefix selection menu
param: int $fid The forum ID (integer ID)
param: int $selected_pid The selected prefix ID (integer ID)

gzip_encode($contents, $level=1)   X-Ref
Gzip encodes text to a specified level
return: string The encoded string
param: string $contents The string to encode
param: int $level The level (1-9) to encode at

log_moderator_action($data, $action="")   X-Ref
Log the actions of a moderator.
param: array $data The data of the moderator's action.
param: string $action The message to enter for the action the moderator performed.

get_reputation($reputation, $uid=0)   X-Ref
Get the formatted reputation for a user.
return: string The formatted repuation
param: int $reputation The reputation value
param: int $uid The user ID (if not specified, the generated reputation will not be a link)

get_colored_warning_level($level)   X-Ref
Fetch a color coded version of a warning level (based on it's percentage)
return: string Formatted warning level
param: int $level The warning level (percentage of 100)

get_ip()   X-Ref
Fetch the IP address of the current user.
return: string The IP address.

get_friendly_size($size)   X-Ref
Fetch the friendly size (GB, MB, KB, B) for a specified file size.
return: string The friendly file size
param: int $size The size in bytes

format_time_duration($time)   X-Ref
Format a decimal number in to microseconds, milliseconds, or seconds.
return: string The friendly time duration
param: int $time The time in microseconds

get_attachment_icon($ext)   X-Ref
Get the attachment icon for a specific file extension
return: string The attachment icon
param: string $ext The file extension

get_unviewable_forums($only_readable_threads=false)   X-Ref
Get a list of the unviewable forums for the current user
return: string Comma separated values list of the forum IDs which the user cannot view
param: boolean $only_readable_threads Set to true to only fetch those forums for which users can actually read a thread in.

fix_mktime($format, $year)   X-Ref
Fixes mktime for dates earlier than 1970
return: string The correct date format
param: string $format The date format to use
param: int $year The year of the date

build_breadcrumb()   X-Ref
Build the breadcrumb navigation trail from the specified items
return: string The formatted breadcrumb navigation trail

add_breadcrumb($name, $url="")   X-Ref
Add a breadcrumb menu item to the list.
param: string $name The name of the item to add
param: string $url The URL of the item to add

build_forum_breadcrumb($fid, $multipage=array()   X-Ref
Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums)
return: int Returns 1 in every case. Kept for compatibility
param: int $fid The forum ID to build the navigation for
param: array $multipage The multipage drop down array of information

reset_breadcrumb()   X-Ref
Resets the breadcrumb navigation to the first item, and clears the rest

build_archive_link($type="", $id=0)   X-Ref
Builds a URL to an archive mode page
return: string The URL
param: string $type The type of page (thread|announcement|forum)
param: int $id The ID of the item

debug_page()   X-Ref
Prints a debug information page

send_page_headers()   X-Ref
Outputs the correct page headers.

mark_reports($id, $type="post")   X-Ref
Mark specific reported posts of a certain type as dealt with
param: array|int $id An array or int of the ID numbers you're marking as dealt with
param: string $type The type of item the above IDs are for - post, posts, thread, threads, forum, all

nice_time($stamp, $options=array()   X-Ref
Fetch a friendly x days, y months etc date stamp from a timestamp
return: string The friendly formatted timestamp
param: int $stamp The timestamp
param: array $options Array of options

alt_trow($reset=0)   X-Ref
Select an alternating row colour based on the previous call to this function
return: string trow1 or trow2 depending on the previous call
param: int $reset 1 to reset the row to trow1.

join_usergroup($uid, $joingroup)   X-Ref
Add a user to a specific additional user group.
return: bool
param: int $uid The user ID
param: int $joingroup The user group ID to join

leave_usergroup($uid, $leavegroup)   X-Ref
Remove a user from a specific additional user group
param: int $uid The user ID
param: int $leavegroup The user group ID

get_current_location($fields=false, $ignore=array()   X-Ref
Get the current location taking in to account different web serves and systems
return: string|array The current URL being accessed or form data if $fields is true
param: boolean $fields True to return as "hidden" fields
param: array $ignore Array of fields to ignore for returning "hidden" fields or URL being accessed
param: boolean $quick True to skip all inputs and return only the file path part of the URL

build_theme_select($name, $selected=-1, $tid=0, $depth="", $usergroup_override=false, $footer=false, $count_override=false)   X-Ref
Build a theme selection menu
return: string The theme selection list
param: string $name The name of the menu
param: int $selected The ID of the selected theme
param: int $tid The ID of the parent theme to select from
param: string $depth The current selection depth
param: boolean $usergroup_override Whether or not to override usergroup permissions (true to override)
param: boolean $footer Whether or not theme select is in the footer (true if it is)
param: boolean $count_override Whether or not to override output based on theme count (true to override)

get_theme($tid)   X-Ref
Get the theme data of a theme id.
return: boolean|array False if no valid theme, Array with the theme data otherwise
param: int $tid The theme id of the theme.

htmlspecialchars_uni($message)   X-Ref
Custom function for htmlspecialchars which takes in to account unicode
return: string The string with htmlspecialchars applied
param: string $message The string to format

my_number_format($number)   X-Ref
Custom function for formatting numbers.
return: int The formatted number.
param: int $number The number to format.

convert_through_utf8($str, $to=true)   X-Ref
Converts a string of text to or from UTF-8.
return: string The converted string
param: string $str The string of text to convert
param: boolean $to Whether or not the string is being converted to or from UTF-8 (true if converting to)

my_wordwrap($message)   X-Ref
DEPRECATED! Please use other alternatives.
return: string
param: string $message

get_weekday($month, $day, $year)   X-Ref
Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme)
return: int The numeric day of the week for the birthday
param: int $month The month of the birthday
param: int $day The day of the birthday
param: int $year The year of the bithday

get_bdays($in)   X-Ref
Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme)
return: array The number of days in each month of that year
param: int $in The year.

format_bdays($display, $bm, $bd, $by, $wd)   X-Ref
DEPRECATED! Please use mktime()!
Formats a birthday appropriately

return: string The formatted birthday
param: string $display The PHP date format string
param: int $bm The month of the birthday
param: int $bd The day of the birthday
param: int $by The year of the birthday
param: int $wd The weekday of the birthday

get_age($birthday)   X-Ref
Returns the age of a user with specified birthday.
return: int The age of a user with that birthday.
param: string $birthday The birthday of a user.

update_first_post($tid)   X-Ref
Updates the first posts in a thread.
param: int $tid The thread id for which to update the first post id.

update_last_post($tid)   X-Ref
Updates the last posts in a thread.
param: int $tid The thread id for which to update the last post id.

my_strlen($string)   X-Ref
Checks for the length of a string, mb strings accounted for
return: int The length of the string.
param: string $string The string to check the length of.

my_substr($string, $start, $length=null, $handle_entities = false)   X-Ref
Cuts a string at a specified point, mb strings accounted for
return: string The cut part of the string.
param: string $string The string to cut.
param: int $start Where to cut
param: int $length (optional) How much to cut
param: bool $handle_entities (optional) Properly handle HTML entities?

my_strtolower($string)   X-Ref
Lowers the case of a string, mb strings accounted for
return: string The lowered string.
param: string $string The string to lower.

my_stripos($haystack, $needle, $offset=0)   X-Ref
Finds a needle in a haystack and returns it position, mb strings accounted for, case insensitive
return: int|bool false on needle not found, integer position if found
param: string $haystack String to look in (haystack)
param: string $needle What to look for (needle)
param: int $offset (optional) How much to offset

my_strpos($haystack, $needle, $offset=0)   X-Ref
Finds a needle in a haystack and returns it position, mb strings accounted for
return: int|bool false on needle not found, integer position if found
param: string $haystack String to look in (haystack)
param: string $needle What to look for (needle)
param: int $offset (optional) How much to offset

my_strtoupper($string)   X-Ref
Ups the case of a string, mb strings accounted for
return: string The uped string.
param: string $string The string to up.

unhtmlentities($string)   X-Ref
Returns any html entities to their original character
return: string The un-htmlentitied' string.
param: string $string The string to un-htmlentitize.

unichr($c)   X-Ref
Returns any ascii to it's character (utf-8 safe).
return: string|bool The characterized ascii. False on failure
param: int $c The ascii to characterize.

unichr_callback1($matches)   X-Ref
Returns any ascii to it's character (utf-8 safe).
return: string|bool The characterized ascii. False on failure
param: array $matches Matches.

unichr_callback2($matches)   X-Ref
Returns any ascii to it's character (utf-8 safe).
return: string|bool The characterized ascii. False on failure
param: array $matches Matches.

get_event_poster($event)   X-Ref
Get the event poster.
return: string The link to the event poster.
param: array $event The event data array.

get_event_date($event)   X-Ref
Get the event date.
return: string The event date.
param: array $event The event data array.

get_profile_link($uid=0)   X-Ref
Get the profile link.
return: string The url to the profile.
param: int $uid The user id of the profile.

get_announcement_link($aid=0)   X-Ref
Get the announcement link.
return: string The url to the announcement.
param: int $aid The announement id of the announcement.

build_profile_link($username="", $uid=0, $target="", $onclick="")   X-Ref
Build the profile link.
return: string The complete profile link.
param: string $username The Username of the profile.
param: int $uid The user id of the profile.
param: string $target The target frame
param: string $onclick Any onclick javascript.

get_forum_link($fid, $page=0)   X-Ref
Build the forum link.
return: string The url to the forum.
param: int $fid The forum id of the forum.
param: int $page (Optional) The page number of the forum.

get_thread_link($tid, $page=0, $action='')   X-Ref
Build the thread link.
return: string The url to the thread.
param: int $tid The thread id of the thread.
param: int $page (Optional) The page number of the thread.
param: string $action (Optional) The action we're performing (ex, lastpost, newpost, etc)

get_post_link($pid, $tid=0)   X-Ref
Build the post link.
return: string The url to the post.
param: int $pid The post ID of the post
param: int $tid The thread id of the post.

get_event_link($eid)   X-Ref
Build the event link.
return: string The URL of the event
param: int $eid The event ID of the event

get_calendar_link($calendar, $year=0, $month=0, $day=0)   X-Ref
Build the link to a specified date on the calendar
return: string The URL of the calendar
param: int $calendar The ID of the calendar
param: int $year The year
param: int $month The month
param: int $day The day (optional)

get_calendar_week_link($calendar, $week)   X-Ref
Build the link to a specified week on the calendar
return: string The URL of the calendar
param: int $calendar The ID of the calendar
param: int $week The week

get_user($uid)   X-Ref
Get the user data of an user id.
return: array The users data
param: int $uid The user id of the user.

get_user_by_username($username, $options=array()   X-Ref
Get the user data of an user username.
return: array The users data
param: string $username The user username of the user.
param: array $options

get_forum($fid, $active_override=0)   X-Ref
Get the forum of a specific forum id.
return: array|bool The database row of a forum. False on failure
param: int $fid The forum id of the forum.
param: int $active_override (Optional) If set to 1, will override the active forum status

get_thread($tid, $recache = false)   X-Ref
Get the thread of a thread id.
return: array|bool The database row of the thread. False on failure
param: int $tid The thread id of the thread.
param: boolean $recache Whether or not to recache the thread.

get_post($pid)   X-Ref
Get the post of a post id.
return: array|bool The database row of the post. False on failure
param: int $pid The post id of the post.

get_inactive_forums()   X-Ref
Get inactivate forums.
return: string The comma separated values of the inactivate forum.

login_attempt_check($uid = 0, $fatal = true)   X-Ref
Checks to make sure a user has not tried to login more times than permitted
return: bool|int Number of logins when success, false if failed.
param: bool $fatal (Optional) Stop execution if it finds an error with the login. Default is True

validate_email_format($email)   X-Ref
Validates the format of an email address.
return: boolean True when valid, false when invalid.
param: string $email The string to check.

email_already_in_use($email, $uid=0)   X-Ref
Checks to see if the email is already in use by another
return: boolean True when in use, false when not.
param: string $email The email to check.
param: int $uid User ID of the user (updating only)

rebuild_settings()   X-Ref
Rebuilds settings.php

build_highlight_array($terms)   X-Ref
Build a PREG compatible array of search highlight terms to replace in posts.
return: array PREG compatible array of terms
param: string $terms Incoming terms to highlight

build_highlight_array_sort($a, $b)   X-Ref
Sort the word array by length. Largest terms go first and work their way down to the smallest term.
return: integer Result of comparison function.
param: string $a First word.
param: string $b Second word.

dec_to_utf8($src)   X-Ref
Converts a decimal reference of a character to its UTF-8 equivalent
(Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references)

return: string|bool
param: int $src Decimal value of a character reference

is_banned_username($username, $update_lastuse=false)   X-Ref
Checks if a username has been disallowed for registration/use.
return: boolean True if banned, false if not banned
param: string $username The username
param: boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.

is_banned_email($email, $update_lastuse=false)   X-Ref
Check if a specific email address has been banned.
return: boolean True if banned, false if not banned
param: string $email The email address.
param: boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.

is_banned_ip($ip_address, $update_lastuse=false)   X-Ref
Checks if a specific IP address has been banned.
return: boolean True if banned, false if not banned.
param: string $ip_address The IP address.
param: boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.

get_supported_timezones()   X-Ref
Returns an array of supported timezones
return: string[] Key is timezone offset, Value the language description

build_timezone_select($name, $selected=0, $short=false)   X-Ref
Build a time zone selection list.
return: string
param: string $name The name of the select
param: int $selected The selected time zone (defaults to GMT)
param: boolean $short True to generate a "short" list with just timezone and current time

fetch_remote_file($url, $post_data=array()   X-Ref
Fetch the contents of a remote file.
return: string|bool The remote file contents. False on failure
param: string $url The URL of the remote file
param: array $post_data The array of post data
param: int $max_redirects Number of maximum redirects

get_ip_by_hostname($hostname)   X-Ref
Resolves a hostname into a set of IP addresses.
return: array|bool The resulting IP addresses. False on failure
param: string $hostname The hostname to be resolved

get_ca_bundle_path()   X-Ref
Returns the location of the CA bundle defined in the PHP configuration.
return: string|bool The location of the CA bundle, false if not set

is_super_admin($uid)   X-Ref
Checks if a particular user is a super administrator.
return: boolean True if a super admin, false if not
param: int $uid The user ID to check against the list of super admins

is_member($groups, $user = false)   X-Ref
Checks if a user is a member of a particular group
Originates from frostschutz's PluginLibrary
github.com/frostschutz

return: array Array of groups specified in the first param to which the user belongs
param: array|int|string A selection of groups (as array or comma seperated) to check or -1 for any group
param: bool|array|int False assumes the current user. Otherwise an user array or an id can be passed

escaped_explode($delimeter, $string, $escape="")   X-Ref
Split a string based on the specified delimeter, ignoring said delimeter in escaped strings.
Ex: the "quick brown fox" jumped, could return 1 => the, 2 => quick brown fox, 3 => jumped

return: array Array of split string
param: string $delimeter The delimeter to split by
param: string $string The string to split
param: string $escape The escape character or string if we have one.

escaped_explode_escape($string)   X-Ref
No description

fetch_longipv4_range($ip)   X-Ref
DEPRECATED! Please use IPv6 compatible fetch_ip_range!
Fetch an IPv4 long formatted range for searching IPv4 IP addresses.

return: string|array If a full IP address is provided, the ip2long equivalent, otherwise an array of the upper & lower extremities of the IP
param: string $ip The IP address to convert to a range based LONG

fetch_ban_times()   X-Ref
Fetch a list of ban times for a user account.
return: array Array of ban times

ban_date2timestamp($date, $stamp=0)   X-Ref
Format a ban length in to a UNIX timestamp.
return: int The UNIX timestamp when the ban will be lifted
param: string $date The ban length string
param: int $stamp The optional UNIX timestamp, if 0, current time is used.

expire_warnings()   X-Ref
Expire old warnings in the database.
return: bool

my_chmod($file, $mode)   X-Ref
Custom chmod function to fix problems with hosts who's server configurations screw up umasks
return: bool
param: string $file The file to chmod
param: string $mode The mode to chmod(i.e. 0666)

my_rmdir_recursive($path, $ignore=array()   X-Ref
Custom rmdir function to loop through an entire directory and delete all files/folders within
return: bool
param: string $path The path to the directory
param: array $ignore Any files you wish to ignore (optional)

subforums_count($array=array()   X-Ref
Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid
return: integer The number of sub forums
param: array $array The array of forums

my_ip2long($ip)   X-Ref
DEPRECATED! Please use IPv6 compatible my_inet_pton!
Fix for PHP's ip2long to guarantee a 32-bit signed integer value is produced (this is aimed
at 64-bit versions of PHP)

return: integer IP in 32-bit signed format
param: string $ip The IP to convert

my_long2ip($long)   X-Ref
DEPRECATED! Please use IPv6 compatible my_inet_ntop!
As above, fix for PHP's long2ip on 64-bit versions

return: string IP in IPv4 format
param: integer $long The IP to convert (will accept 64-bit IPs as well)

my_inet_pton($ip)   X-Ref
Converts a human readable IP address to its packed in_addr representation
return: string IP in 32bit or 128bit binary format
param: string $ip The IP to convert

my_inet_ntop($ip)   X-Ref
Converts a packed internet address to a human readable representation
return: string IP in human readable format
param: string $ip IP in 32bit or 128bit binary format

fetch_ip_range($ipaddress)   X-Ref
Fetch an binary formatted range for searching IPv4 and IPv6 IP addresses.
return: string|array|bool If a full IP address is provided, the in_addr representation, otherwise an array of the upper & lower extremities of the IP. False on failure
param: string $ipaddress The IP address to convert to a range

get_execution_time()   X-Ref
Time how long it takes for a particular piece of code to run. Place calls above & below the block of code.
return: float The time taken

verify_files($path=MYBB_ROOT, $count=0)   X-Ref
Processes a checksum list on MyBB files and returns a result set
return: array The bad files
param: string $path The base path
param: int $count The count of files

signed($int)   X-Ref
Returns a signed value equal to an integer
return: string The signed equivalent
param: int $int The integer

secure_binary_seed_rng($bytes)   X-Ref
Returns a securely generated seed
return: string A secure binary seed

secure_seed_rng()   X-Ref
Returns a securely generated seed integer
return: int An integer equivalent of a secure hexadecimal seed

my_rand($min=0, $max=PHP_INT_MAX)   X-Ref
Generates a cryptographically secure random number.
param: int $min Optional lowest value to be returned (default: 0)
param: int $max Optional highest value to be returned (default: PHP_INT_MAX)

trim_blank_chrs($string, $charlist="")   X-Ref
More robust version of PHP's trim() function. It includes a list of UTF-8 blank characters
from http://kb.mozillazine.org/Network.IDN.blacklist_chars

return: string The trimmed string
param: string $string The string to trim from
param: string $charlist Optional. The stripped characters can also be specified using the charlist parameter

match_sequence($string, $array, $i=0, $n=0)   X-Ref
Match a sequence
return: int The number matched
param: string $string The string to match from
param: array $array The array to match from
param: int $i Number in the string
param: int $n Number of matches

gd_version()   X-Ref
Obtain the version of GD installed.
return: float|null Version of GD

validate_utf8_string($input, $allow_mb4=true, $return=true)   X-Ref
No description

send_pm($pm, $fromid = 0, $admin_override=false)   X-Ref
Send a Private Message to a user.
return: bool True if PM sent
param: array $pm Array containing: 'subject', 'message', 'touid' and 'receivepms' (the latter should reflect the value found in the users table: receivepms and receivefrombuddy)
param: int $fromid Sender UID (0 if you want to use $mybb->user['uid'] or -1 to use MyBB Engine)
param: bool $admin_override Whether or not do override user defined options for receiving PMs

log_spam_block($username = '', $email = '', $ip_address = '', $data = array()   X-Ref
Log a user spam block from StopForumSpam (or other spam service providers...)
return: bool Whether the action was logged successfully.
param: string $username The username that the user was using.
param: string $email    The email address the user was using.
param: string $ip_address The IP addres of the user.
param: array  $data     An array of extra data to go with the block (eg: confidence rating).

copy_file_to_cdn($file_path = '', &$uploaded_path = null)   X-Ref
Copy a file to the CDN.
return: bool Whether the file was copied successfully.
param: string $file_path     The path to the file to upload to the CDN.
param: string $uploaded_path The path the file was uploaded to, reference parameter for when this may be needed.

my_validate_url($url, $relative_path=false, $allow_local=false)   X-Ref
Validate an url
return: bool Whether this is a valid url.
param: string $url The url to validate.
param: bool $relative_path Whether or not the url could be a relative path.
param: bool $allow_local Whether or not the url could be pointing to local networks.

my_strip_tags($string, $allowable_tags = '')   X-Ref
Strip html tags from string, also removes <script> and <style> contents.
return: string                 Striped string
param: string $string         String to stripe
param: string $allowable_tags Allowed html tags

my_escape_csv($string, $escape_active_content=true)   X-Ref
Escapes a RFC 4180-compliant CSV string.
Based on https://github.com/Automattic/camptix/blob/f80725094440bf09861383b8f11e96c177c45789/camptix.php#L2867

return: string The escaped string
param: string $string The string to be escaped
param: boolean $escape_active_content Whether or not to escape active content trigger characters

array_column($input, $column_key)   X-Ref
No description

my_hash_equals($known_string, $user_string)   X-Ref
Performs a timing attack safe string comparison.
return: bool Result of the comparison.
param: string $known_string The first string to be compared.
param: string $user_string The second, user-supplied string to be compared.

get_user_referrals($uid, $start=0, $limit=0, $full=false)   X-Ref
Retrieves all referrals for a specified user
return: array
param: int uid
param: int start position
param: int total entries
param: bool false (default) only return display info, true for all info

create_xml_parser($data)   X-Ref
Initialize the parser and store the XML data to be parsed.
return: MyBBXMLParser The constructed XML parser.
param: string $data

mk_path_abs($path, $base = MYBB_ROOT)   X-Ref
Make a filesystem path absolute.
Returns as-is paths which are already absolute.return: string An absolute filesystem path corresponding to the input path.
param: string $path The input path. Can be either absolute or relative.
param: string $base The absolute base to which to append $path if $path is



2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref