Functions

Helper function to load up a GET/POST parameter.

__param(array $array, string $name, \?mixed $default, boolean $integer, \?boolean $posted) : string

Parameters

$array

array

The array we're extracting parameters from

$name

string

The name of the parameter

$default

\?mixed

The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)

$integer

boolean

Whether the parameter has to be an integer

$posted

\?boolean

Whether the parameter is a POST parameter (NULL: undetermined)

Returns

stringThe value of the parameter

Show a helpful access-denied page.

_access_denied(\ID_TEXT $class, string $param, boolean $force_login) 

Has a login ability if it senses that logging in could curtail the error.

Parameters

$class

\ID_TEXT

The class of error (e.g. PRIVILEGE)

$param

string

The parameter given to the error message

$force_login

boolean

Force the user to login (even if perhaps they are logged in already)

Convert an integer permission to the string version.

_access_string(integer $access_int) : string

Parameters

$access_int

integer

The integer permission.

Returns

stringThe string version.

Take a search string and find boolean search parameters from it.

_boolean_search_prepare(string $search_filter) : array

Parameters

$search_filter

string

The search string

Returns

arrayWords to search under the boolean operator, words that must be included, words that must not be included.

Make boxes readable.

_box_callback(array $matches) : string

Callback for preg_replace_callback.

Parameters

$matches

array

Matches

Returns

stringReplacement

Get hidden fields for a form representing 'keep_x'.

_build_keep_form_fields(\ID_TEXT $page, boolean $keep_all, \?array $exclude) : \tempcode

If we are having a GET form instead of a POST form, we need to do this. This function also encodes the page name, as we'll always want that.

Parameters

$page

\ID_TEXT

The page for the form to go to (blank: don't attach)

$keep_all

boolean

Whether to keep all elements of the current URL represented in this form (rather than just the keep_ fields, and page)

$exclude

\?array

A list of parameters to exclude (NULL: don't exclude any)

Returns

\tempcodeThe builtup hidden form fields

Relay all POST variables for this URL, to the URL embedded in the form.

_build_keep_post_fields(\?array $exclude) : \tempcode

Parameters

$exclude

\?array

A list of parameters to exclude (NULL: exclude none)

Returns

\tempcodeThe builtup hidden form fields

Build and return a proper URL, from the $vars array.

_build_url(array $vars, \ID_TEXT $zone_name, \?array $skip, boolean $keep_all, boolean $avoid_remap, boolean $skip_keep, string $hash) : string

Note: URL parameters should always be in lower case (one of the coding standards)

Parameters

$vars

array

A map of parameter names to parameter values. Values may be strings or integers, or NULL. NULL indicates "skip this". 'page' cannot be NULL.

$zone_name

\ID_TEXT

The zone the URL is pointing to. YOU SHOULD NEVER HARD CODE THIS- USE '_SEARCH', '_SELF' (if you're self-referencing your own page) or the output of get_module_zone.

$skip

\?array

Variables to explicitly not put in the URL (perhaps because we have $keep_all set, or we are blocking certain keep_ values). The format is of a map where the keys are the names, and the values are 1. (NULL: don't skip any)

$keep_all

boolean

Whether to keep all non-skipped parameters that were in the current URL, in this URL

$avoid_remap

boolean

Whether to avoid mod_rewrite (sometimes essential so we can assume the standard URL parameter addition scheme in templates)

$skip_keep

boolean

Whether to skip actually putting on keep_ parameters (rarely will this skipping be desirable)

$hash

string

Hash portion of the URL (blank: none).

Returns

stringThe URL in string format.

Ensures a given filename is of the right file extension for the desired file type.

_check_enforcement_of_type(string $file, integer $enforce_type, boolean $accept_errors) 

Parameters

$file

string

The filename.

$enforce_type

integer

The type of upload it is (from an OCP_UPLOAD_* constant)

$accept_errors

boolean

Whether to accept upload errors

Check a set of fields aren't going to exceed key limits.

_check_sizes(boolean $primary_key, array $fields, \ID_TEXT $id_name, boolean $skip_size_check, boolean $skip_null_check) 

Parameters

$primary_key

boolean

Whether this will be in a primary key

$fields

array

The fields (a map between field name and field type [field type must start '*' if it is to be counted])

$id_name

\ID_TEXT

The name of what we are checking (only used to generate clear error messages)

$skip_size_check

boolean

Whether to skip the size check for the table (only do this for addon modules that don't need to support anything other than mySQL)

$skip_null_check

boolean

Whether to skip the check for NULL string fields

Check the stopforumspam service to see if we need to block this user (lower level, doesn't handle result).

_check_stopforumspam(string $user_ip, \?string $username, \?string $email) : array

Parameters

$user_ip

string

Check this IP address

$username

\?string

Check this particular username that has just been supplied (NULL: none)

$email

\?string

Check this particular email address that has just been supplied (NULL: none)

Returns

arrayPair: Listed for potential blocking as a ANTISPAM_RESPONSE_* constant, confidence level if attainable (0.0 to 1.0) (else NULL)

Delete an old moniker, and place a new one.

_choose_moniker(\ID_TEXT $page, \ID_TEXT $type, \ID_TEXT $id, string $moniker_src, \?string $no_exists_check_for) : string

Parameters

$page

\ID_TEXT

Page name.

$type

\ID_TEXT

Screen type code.

$id

\ID_TEXT

Resource ID.

$moniker_src

string

String from which a moniker will be chosen (may not be blank).

$no_exists_check_for

\?string

Whether to skip the exists check for a certain moniker (will be used to pass "existing self" for edits) (NULL: nothing existing to check against).

Returns

stringChosen moniker.

Convert a language string that is Comcode to tempcode, with potential cacheing in the db.

_comcode_lang_string(\ID_TEXT $lang_code) : \tempcode

Parameters

$lang_code

\ID_TEXT

The language string ID

Returns

\tempcodeThe parsed Comcode

Convert a URL to a local file path.

_convert_url_to_path(\URLPATH $url) : \?PATH

Parameters

$url

\URLPATH

The value to convert

Returns

\?PATHFile path (NULL: is not local)

Return a specific compiled CSS file.

_css_compile(\ID_TEXT $active_theme, string $theme, string $c, \PATH $fullpath, boolean $minify) : array

Parameters

$active_theme

\ID_TEXT

The theme the file is being loaded for

$theme

string

Theme name

$c

string

The CSS file required

$fullpath

\PATH

Full path to CSS file (file is in uncompiled Tempcode format)

$minify

boolean

Whether to also do minification

Returns

arrayA pair: success status, The text of the compiled file

preg_replace callback, to handle CSS file inclusion.

_css_ocp_include(array $matches) : array

Parameters

$matches

array

Matched variables

Returns

arrayA pair: success status, The text of the compiled file

Make sure we are doing necessary join to be able to access the given field

_default_conv_func(object $db, array $info, \?ID_TEXT $unused, array $extra_join, array $extra_select, \ID_TEXT $filter_key, string $filter_val, array $db_fields) : \?array

Parameters

$db

object

Database connection

$info

array

Content type info

$unused

\?ID_TEXT

Name of the catalogue (NULL: unknown; reduces performance)

$extra_join

array

List of joins (passed as reference)

$extra_select

array

List of selects (passed as reference)

$filter_key

\ID_TEXT

The field to get

$filter_val

string

The field value for this

$db_fields

array

Database field data

Returns

\?arrayA triple: Proper database field name to access with, The fields API table type (blank: no special table), The new filter value (NULL: error)

Delete all the contents of a directory, and any subdirectories of that specified directory (recursively).

_deldir_contents(\PATH $dir, boolean $default_preserve, boolean $just_files) 

Parameters

$dir

\PATH

The pathname to the directory to delete

$default_preserve

boolean

Whether to preserve files there by default

$just_files

boolean

Whether to just delete files

Get the human-readable form of a language id, or a language entry from a language INI file.

_do_lang(\ID_TEXT $codename, \?mixed $token1, \?mixed $token2, \?mixed $token3, \?LANGUAGE_NAME $lang, boolean $require_result) : \?mixed

Parameters

$codename

\ID_TEXT

The language id

$token1

\?mixed

The first token [string or tempcode] (replaces {1}) (NULL: none)

$token2

\?mixed

The second token [string or tempcode] (replaces {2}) (NULL: none)

$token3

\?mixed

The third token (replaces {3}). May be an array of [of string], to allow any number of additional args (NULL: none)

$lang

\?LANGUAGE_NAME

The language to use (NULL: users language)

$require_result

boolean

Whether to cause ocPortal to exit if the lookup does not succeed

Returns

\?mixedThe human-readable content (NULL: not found). String normally. Tempcode if tempcode parameters.

A template has not been structurally cached, so compile it and store in the cache.

_do_template(\ID_TEXT $theme, \PATH $path, \ID_TEXT $codename, \ID_TEXT $_codename, \LANGUAGE_NAME $lang, string $suffix, \?ID_TEXT $theme_orig) : \tempcode

Parameters

$theme

\ID_TEXT

The theme the template is in the context of

$path

\PATH

The path to the template file

$codename

\ID_TEXT

The codename of the template (e.g. foo)

$_codename

\ID_TEXT

The actual codename to use for the template (e.g. foo_mobile)

$lang

\LANGUAGE_NAME

The language the template is in the context of

$suffix

string

File type suffix of template file (e.g. .tpl)

$theme_orig

\?ID_TEXT

The theme to cache in (NULL: main theme)

Returns

\tempcodeThe compiled tempcode

A template has not been structurally cached, so compile it and store in the cache.

_do_template(\ID_TEXT $theme, \PATH $path, \ID_TEXT $codename, \ID_TEXT $_codename, \LANGUAGE_NAME $lang, string $suffix, \?ID_TEXT $theme_orig) : \tempcode

Parameters

$theme

\ID_TEXT

The theme the template is in the context of

$path

\PATH

The path to the template file

$codename

\ID_TEXT

The codename of the template (e.g. foo)

$_codename

\ID_TEXT

The actual codename to use for the template (e.g. thin_foo)

$lang

\LANGUAGE_NAME

The language the template is in the context of

$suffix

string

File type suffix of template file

$theme_orig

\?ID_TEXT

The theme to cache in (NULL: main theme)

Returns

\tempcodeThe compiled tempcode

Make sure that the given URL contains a session if cookies are disabled.

_enforce_sessioned_url(\URLPATH $url) : \URLPATH

NB: This is used for login redirection. It had to add the session id into the redirect url.

Parameters

$url

\URLPATH

The URL to enforce results in session persistence for the user

Returns

\URLPATHThe fixed URL

Export a table by tree recursion.

_export_recurse_for_children(\ID_TEXT $table, array $row, array $db_fields, \ID_TEXT $seo_type_code, \ID_TEXT $permissions_type_code, \ID_TEXT $id_field, boolean $comcode_xml, \ID_TEXT $parent_field) : string

Parameters

$table

\ID_TEXT

Table to export

$row

array

The row we're at

$db_fields

array

List of field definitions for the row

$seo_type_code

\ID_TEXT

SEO type code

$permissions_type_code

\ID_TEXT

Permission type code

$id_field

\ID_TEXT

ID field name

$comcode_xml

boolean

Whether to export Comcode as Comcode XML

$parent_field

\ID_TEXT

Parent ID field name

Returns

stringExported data in XML format

Export an ocPortal database table to an equivalent XML format.

_export_table_to_xml(\ID_TEXT $table, boolean $comcode_xml) : string

Parameters

$table

\ID_TEXT

Table to export

$comcode_xml

boolean

Whether to export Comcode as Comcode XML

Returns

stringExported data in XML format

Export an ocPortal database row to an equivalent XML format.

_export_xml_row(\ID_TEXT $table, array $row, array $db_fields, \?ID_TEXT $seo_type_code, \?ID_TEXT $permissions_type_code, \?ID_TEXT $id_field, boolean $comcode_xml, boolean $include_end) : string

Parameters

$table

\ID_TEXT

Table to export

$row

array

DB row

$db_fields

array

List of field definitions for the row

$seo_type_code

\?ID_TEXT

SEO type code (NULL: N/A)

$permissions_type_code

\?ID_TEXT

Permission type code (NULL: N/A)

$id_field

\?ID_TEXT

ID field name (NULL: N/A)

$comcode_xml

boolean

Whether to export Comcode as Comcode XML

$include_end

boolean

Whether to include the end tag for the row

Returns

stringExported data in XML format

Do a fatal exit, echo the header (if possible) and an error message, followed by a debugging back-trace.

_fatal_exit(mixed $text, boolean $return) 

It also adds an entry to the error log, for reference.

Parameters

$text

mixed

The error message (string or tempcode)

$return

boolean

Whether to return

Make sure we are doing necessary join to be able to access the given field

_fields_api_ocselect(object $db, array $info, \?ID_TEXT $catalogue_name, array $extra_join, array $extra_select, \ID_TEXT $filter_key, string $filter_val, array $db_fields) : \?array

Parameters

$db

object

Database connection

$info

array

Content type info

$catalogue_name

\?ID_TEXT

Name of the catalogue (NULL: unknown; reduces performance)

$extra_join

array

List of joins (passed as reference)

$extra_select

array

List of selects (passed as reference)

$filter_key

\ID_TEXT

The field to get

$filter_val

string

The field value for this

$db_fields

array

Database field data

Returns

\?arrayA triple: Proper database field name to access with, The fields API table type (blank: no special table), The new filter value (NULL: error)

Get an array of all the installed languages that can be found in root/lang/ and root/lang_custom/

_find_all_langs(boolean $even_empty_langs) : array

Parameters

$even_empty_langs

boolean

Whether to even find empty languages

Returns

arrayThe installed languages (map, lang=>type)

Get an array of all the modules.

_find_all_modules(\ID_TEXT $zone) : array

Parameters

$zone

\ID_TEXT

The zone name

Returns

arrayA map of page name to type (modules_custom, etc)

Get an array of all the pages of the specified type (module, etc) and extension (for small sites everything will be returned, for larger ones it depends on the show method).

_find_all_pages(\ID_TEXT $zone, \ID_TEXT $type, string $ext, boolean $keep_ext_on, \?TIME $cutoff_time, integer $show_method, \?boolean $custom) : array

set modules modules_custom comcode/EN comcode_custom/EN html/EN html_custom/EN
set 0 1 2

Parameters

$zone

\ID_TEXT

The zone name

$type

\ID_TEXT

The type (including language, if appropriate)

$ext

string

The file extension to limit us to (without a dot)

$keep_ext_on

boolean

Whether to leave file extensions on the page name

$cutoff_time

\?TIME

Only show pages newer than (NULL: no restriction)

$show_method

integer

Selection algorithm constant

$custom

\?boolean

Whether to search under the custom-file-base (NULL: auto-decide)

Returns

arrayA map of page name to type (modules_custom, etc)

Get an array of all the pages everywhere in the zone (for small sites everything will be returned, for larger ones it depends on the show method).

_find_all_pages_wrap(\ID_TEXT $zone, boolean $keep_ext_on, boolean $consider_redirects, integer $show_method, \?ID_TEXT $page_type) : array

set 0 1 2

Parameters

$zone

\ID_TEXT

The zone name

$keep_ext_on

boolean

Whether to leave file extensions on the page name

$consider_redirects

boolean

Whether to take redirects into account

$show_method

integer

Selection algorithm constant

$page_type

\?ID_TEXT

Page type to show (NULL: all)

Returns

arrayA map of page name to type (modules_custom, etc)

Helper function for *_text_file

_find_text_file_path(string $codename, \?LANGUAGE_NAME $lang) : string

Parameters

$codename

string

The file name (without .txt)

$lang

\?LANGUAGE_NAME

The language to load from (NULL: none) (blank: search)

Returns

stringThe path to the file

Recurser helper function for _build_keep_post_fields.

_fixed_post_parser(\ID_TEXT $key, mixed $value) : string

Parameters

$key

\ID_TEXT

Key name to put value under

$value

mixed

Value (string or array)

Returns

stringThe builtup hidden form fields

Sometimes users don't enter full URLs but do intend for them to be absolute.

_fixup_protocolless_urls(\URLPATH $in) : \URLPATH

This code tries to see what relative URLs are actually absolute ones, via an algorithm. It then fixes the URL.

Parameters

$in

\URLPATH

The URL to fix

Returns

\URLPATHThe fixed URL (or original one if no fix was needed)

Return the FTP connection, from stored/posted details.

_ftp_info(boolean $light_fail) : \~resource

Parameters

$light_fail

boolean

Whether to simply echo-out errors.

Returns

\~resourceThe FTP connection (false: not connecting via FTP).

Called once our DB connection becomes active.

_general_db_init() 

Do a terminal execution on a defined page type

_generic_exit(mixed $text, \ID_TEXT $template) 

Parameters

$text

mixed

The error message (string or tempcode)

$template

\ID_TEXT

Name of the terminal page template

Gets the path to a block code file for a block code name

_get_block_path(\ID_TEXT $block) : \PATH

Parameters

$block

\ID_TEXT

The name of the block

Returns

\PATHThe path to the block

Get a list of files under a directory.

_get_dir_tree(\PATH $base, \PATH $at) : array

Parameters

$base

\PATH

The base directory for the search.

$at

\PATH

The directory where we are searching under.

Returns

arrayAn array of directories found under this recursive level.

Check a POST inputted date for validity, and get the Unix timestamp for the inputted date.

_get_input_date(\ID_TEXT $stub, boolean $get_also) : \?TIME

Parameters

$stub

\ID_TEXT

The stub of the parameter name (stub_year, stub_month, stub_day, stub_hour, stub_minute)

$get_also

boolean

Whether to allow over get parameters also

Returns

\?TIMEThe timestamp of the date (NULL: no input date was chosen)

Extend a language map from strings in a given language file.

_get_lang_file_map(\PATH $b, array $entries, \?boolean $descriptions, boolean $given_whole_file) 

Parameters

$b

\PATH

The path to the language file

$entries

array

The currently loaded language map

$descriptions

\?boolean

Whether to get descriptions rather than strings (NULL: no, but we might pick up some descriptions accidently)

$given_whole_file

boolean

Whether $b is infact not a path, but the actual file contents

Get the path to a module known to be in a certain zone.

_get_module_path(\ID_TEXT $zone, \ID_TEXT $module) : \PATH

Parameters

$zone

\ID_TEXT

The zone name

$module

\ID_TEXT

The module name

Returns

\PATHThe module path

Work out canonical Latitude/Longitude details from complex EXIF bits.

_get_simple_gps(array $exif) : array

Parameters

$exif

array

EXIF data

Returns

arrayExtra derived EXIF data

Filters specified URLs to make sure we're really allowed to access them.

_get_specify_url(\ID_TEXT $specify_name, \ID_TEXT $upload_folder, integer $enforce_type, boolean $accept_errors) : array

Parameters

$specify_name

\ID_TEXT

The name of the POST parameter storing the URL (if '', then no POST parameter). Parameter value may be blank.

$upload_folder

\ID_TEXT

The folder name in uploads/ where we will put this upload

$enforce_type

integer

The type of upload it is (from an OCP_UPLOAD_* constant)

$accept_errors

boolean

Whether to accept upload errors

Returns

arrayA pair: the URL and the filename

Converts an uploaded file into a URL, by moving it to an appropriate place.

_get_upload_url(\ID_TEXT $attach_name, \ID_TEXT $upload_folder, integer $enforce_type, integer $obfuscate, boolean $accept_errors) : array

set 0 1 2

Parameters

$attach_name

\ID_TEXT

The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this.

$upload_folder

\ID_TEXT

The folder name in uploads/ where we will put this upload

$enforce_type

integer

The type of upload it is (from an OCP_UPLOAD_* constant)

$obfuscate

integer

Whether to obfuscate file names so the URLs can not be guessed/derived (0=do not, 1=do, 2=make extension .dat as well)

$accept_errors

boolean

Whether to accept upload errors

Returns

arrayA pair: the URL and the filename

Get the SQL WHERE clause to select for any the given member is in (gets combined with some condition, to check against every).

_get_where_clause_groups(\MEMBER $member, boolean $consider_clubs) : \?string

Parameters

$member

\MEMBER

The member who's usergroups will be OR'd

$consider_clubs

boolean

Whether to consider clubs (pass this false if considering page permissions, which work via explicit-denys across all groups, which could not happen for clubs as those denys could not have been set in the UI)

Returns

\?stringThe SQL query fragment (NULL: admin, so permission regardless)

Take a moniker and it's page link details, and make a full path from it.

_give_moniker_scope(\ID_TEXT $page, \ID_TEXT $type, \ID_TEXT $id, string $main) : string

Parameters

$page

\ID_TEXT

Page name.

$type

\ID_TEXT

Screen type code.

$id

\ID_TEXT

Resource ID.

$main

string

Pathless moniker.

Returns

stringThe fully qualified moniker.

Log permission checks to the permission_checks.log file

_handle_permission_check_logging(\MEMBER $member, \ID_TEXT $op, array $params, boolean $result) 

Parameters

$member

\MEMBER

The user checking against

$op

\ID_TEXT

The function that was called to check a permission

$params

array

Parameters to this permission-checking function

$result

boolean

Whether the permission was held

Adds a field to an existing table.

_helper_add_table_field(object $this_ref, \ID_TEXT $table_name, \ID_TEXT $name, \ID_TEXT $_type, \?mixed $default) 

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$name

\ID_TEXT

The field name

$_type

\ID_TEXT

The field type

$default

\?mixed

The default value (NULL: no default)

Change the type of a DB field in a table.

_helper_alter_table_field(object $this_ref, \ID_TEXT $table_name, \ID_TEXT $name, \ID_TEXT $_type, \?ID_TEXT $new_name) 

Note: this function does not support ascession/decession of translatability

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$name

\ID_TEXT

The field name

$_type

\ID_TEXT

The new field type

$new_name

\?ID_TEXT

The new field name (NULL: leave name)

Change the primary key of a table.

_helper_change_primary_key(object $this_ref, \ID_TEXT $table_name, array $new_key) 

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The name of the table to create the index on

$new_key

array

A list of fields to put in the new key

Add an index to a table without disturbing the contents, after the table has been created.

_helper_create_index(object $this_ref, \ID_TEXT $table_name, \ID_TEXT $index_name, array $fields, \ID_TEXT $unique_key_field) 

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$index_name

\ID_TEXT

The index name

$fields

array

The fields

$unique_key_field

\ID_TEXT

The name of the unique key field for the table

Create a table with the given name and the given array of field name to type mappings.

_helper_create_table(object $this_ref, \ID_TEXT $table_name, array $fields, boolean $skip_size_check, boolean $skip_null_check) 

If a field type starts '*', then it is part of that field's key. If it starts '?', then it is an optional field.

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$fields

array

The fields

$skip_size_check

boolean

Whether to skip the size check for the table (only do this for addon modules that don't need to support anything other than mySQL)

$skip_null_check

boolean

Whether to skip the check for NULL string fields

Delete an index from a table.

_helper_delete_index_if_exists(object $this_ref, \ID_TEXT $table_name, \ID_TEXT $index_name) 

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$index_name

\ID_TEXT

The index name

Delete the specified field from the specified table.

_helper_delete_table_field(object $this_ref, \ID_TEXT $table_name, \ID_TEXT $name) 

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$name

\ID_TEXT

The field name

Drop the given table, or if it doesn't exist, silently return.

_helper_drop_if_exists(object $this_ref, \ID_TEXT $table) 

Parameters

$this_ref

object

Link to the real database object

$table

\ID_TEXT

The table name

If a text field has picked up Comcode support, we will need to run this.

_helper_promote_text_field_to_comcode(object $this_ref, \ID_TEXT $table_name, \ID_TEXT $name, \ID_TEXT $key, integer $level, boolean $in_assembly) 

set 1 2 3 4

Parameters

$this_ref

object

Link to the real database object

$table_name

\ID_TEXT

The table name

$name

\ID_TEXT

The field name

$key

\ID_TEXT

The tables key field name

$level

integer

The translation level to use

$in_assembly

boolean

Whether our data is already stored in Tempcode assembly format

If we've changed what $type is stored as, this function will need to be called to change the typing in the DB.

_helper_refresh_field_definition(object $this_ref, \ID_TEXT $type) 

Parameters

$this_ref

object

Link to the real database object

$type

\ID_TEXT

The field type

Rename the given table.

_helper_rename_table(object $this_ref, \ID_TEXT $old, \ID_TEXT $new) 

Parameters

$this_ref

object

Link to the real database object

$old

\ID_TEXT

The old table name

$new

\ID_TEXT

The new table name

Return the file in the URL by downloading it over HTTP.

_http_download_file(\URLPATH $url, \?integer $byte_limit, boolean $trigger_error, boolean $no_redirect, string $ua, \?array $post_params, \?array $cookies, \?string $accept, \?string $accept_charset, \?string $accept_language, \?resource $write_to_file, \?string $referer, \?array $auth, float $timeout, boolean $is_xml, \?array $files) : \?string

If a byte limit is given, it will only download that many bytes. It outputs warnings, returning NULL, on error.

range 1 max

Parameters

$url

\URLPATH

The URL to download

$byte_limit

\?integer

The number of bytes to download. This is not a guarantee, it is a minimum (NULL: all bytes)

$trigger_error

boolean

Whether to throw an ocPortal error, on error

$no_redirect

boolean

Whether to block redirects (returns NULL when found)

$ua

string

The user-agent to identify as

$post_params

\?array

An optional array of POST parameters to send; if this is NULL, a GET request is used (NULL: none)

$cookies

\?array

An optional array of cookies to send (NULL: none)

$accept

\?string

'accept' header value (NULL: don't pass one)

$accept_charset

\?string

'accept-charset' header value (NULL: don't pass one)

$accept_language

\?string

'accept-language' header value (NULL: don't pass one)

$write_to_file

\?resource

File handle to write to (NULL: do not do that)

$referer

\?string

The HTTP referer (NULL: none)

$auth

\?array

A pair: authentication username and password (NULL: none)

$timeout

float

The timeout

$is_xml

boolean

Whether to treat the POST parameters as a raw POST (rather than using MIME)

$files

\?array

Files to send. Map between field to file path (NULL: none)

Returns

\?stringThe data downloaded (NULL: error)

Import to ocPortal database table from an XML row (possibly having descendant rows, via tree structure).

_import_xml_row(object $parsed, array $all_existing_data, array $all_fields, array $all_id_fields, array $table, array $insert_ids, \?AUTO_LINK $last_parent_id) : array

Parameters

$parsed

object

The XML parser object

$all_existing_data

array

Existing data in table

$all_fields

array

Field meta data for all fields

$all_id_fields

array

Meta data about table IDs

$table

array

The record details being imported

$insert_ids

array

The insert IDs thus far

$last_parent_id

\?AUTO_LINK

The ID of the auto-inserted parent to this row (NULL: N/A)

Returns

arrayList of operations performed

Indent text lines.

_indent_callback(array $matches) : string

Callback for preg_replace_callback.

Parameters

$matches

array

Matches

Returns

stringReplacement

Insert a language entry into the translation table, and returns the id.

_insert_lang(string $text, integer $level, \?object $connection, boolean $comcode, \?integer $id, \?LANGUAGE_NAME $lang, boolean $insert_as_admin, \?string $pass_id, \?string $text2, integer $wrap_pos, boolean $preparse_mode, boolean $save_as_volatile) : integer

set 1 2 3 4

Parameters

$text

string

The text

$level

integer

The level of importance this language string holds

$connection

\?object

The database connection to use (NULL: standard site connection)

$comcode

boolean

Whether it is to be parsed as comcode

$id

\?integer

The id to use for the language entry (NULL: work out next available)

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$insert_as_admin

boolean

Whether to insert it as an admin (any comcode parsing will be carried out with admin privileges)

$pass_id

\?string

The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)

$text2

\?string

Assembled Tempcode portion (NULL: work it out)

$wrap_pos

integer

Comcode parser wrap position

$preparse_mode

boolean

Whether to generate a fatal error if there is invalid Comcode

$save_as_volatile

boolean

Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to subversion)

Returns

integerThe id of the newly added language entry

Output whatever arguments are given for debugging.

_inspect(array $args, boolean $force_plain) 

If possible it'll output with plain text, but if output has already started it will attach messages.

Parameters

$args

array

Arguments to output

$force_plain

boolean

Whether to force text output

Remap the specified language id, and return the id again - the id isn't changed.

_lang_remap(integer $id, string $text, \?object $connection, boolean $comcode, \?string $pass_id, \?MEMBER $source_member, boolean $as_admin, boolean $backup_string) : integer

Parameters

$id

integer

The language entries id

$text

string

The text to remap to

$connection

\?object

The database connection to use (NULL: standard site connection)

$comcode

boolean

Whether it is to be parsed as comcode

$pass_id

\?string

The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)

$source_member

\?MEMBER

The member performing the change (NULL: current member)

$as_admin

boolean

Whether to generate Comcode as arbitrary admin

$backup_string

boolean

Whether to backup the language string before changing it

Returns

integerThe language entries id

Helper function or use getting line numbers.

_length_so_far(array $bits, integer $i) : integer

Parameters

$bits

array

Compiler tokens

$i

integer

How far we are through the token list

Returns

integerThe sum length of tokens passed

Load Comcode page from disk.

_load_comcode_page_cache_off(\PATH $string, \ID_TEXT $zone, \ID_TEXT $codename, \PATH $file_base, array $new_comcode_page_row, boolean $being_included) : array

Parameters

$string

\PATH

The relative (to ocPortal's base directory) path to the page (e.g. pages/comcode/EN/start.txt)

$zone

\ID_TEXT

The zone the page is being loaded from

$codename

\ID_TEXT

The codename of the page

$file_base

\PATH

The file base to load from

$new_comcode_page_row

array

New row for database, used if nesessary (holds submitter etc)

$being_included

boolean

Whether the page is being included from another

Returns

arrayA tuple: The page, New Comcode page row, Title

Load Comcode page from disk, then cache it.

_load_comcode_page_not_cached(\PATH $string, \ID_TEXT $zone, \ID_TEXT $codename, \PATH $file_base, \?array $comcode_page_row, array $new_comcode_page_row, boolean $being_included) : array

Parameters

$string

\PATH

The relative (to ocPortal's base directory) path to the page (e.g. pages/comcode/EN/start.txt)

$zone

\ID_TEXT

The zone the page is being loaded from

$codename

\ID_TEXT

The codename of the page

$file_base

\PATH

The file base to load from

$comcode_page_row

\?array

Row from database (holds submitter etc) (NULL: no row, originated first from disk)

$new_comcode_page_row

array

New row for database, used if necessary (holds submitter etc)

$being_included

boolean

Whether the page is being included from another

Returns

arrayA triple: The page, Title to use, New Comcode page row

Log a hackattack, then displays an error message.

_log_hack_attack_and_exit(\ID_TEXT $reason, \SHORT_TEXT $reason_param_a, \SHORT_TEXT $reason_param_b) 

It also attempts to send an e-mail to the staff alerting them of the hackattack.

Parameters

$reason

\ID_TEXT

The reason for the hack attack. This has to be a language string codename

$reason_param_a

\SHORT_TEXT

A parameter for the hack attack language string (this should be based on a unique ID, preferably)

$reason_param_b

\SHORT_TEXT

A more illustrative parameter, which may be anything (e.g. a title)

Log an action

_log_it(\ID_TEXT $type, \?SHORT_TEXT $a, \?SHORT_TEXT $b) 

Parameters

$type

\ID_TEXT

The type of activity just carried out (a lang string)

$a

\?SHORT_TEXT

The most important parameter of the activity (e.g. id) (NULL: none)

$b

\?SHORT_TEXT

A secondary (perhaps, human readable) parameter of the activity (e.g. caption) (NULL: none)

Make a path relative.

_m_zip_RelPath(\PATH $base_path, \PATH $path) : \PATH

Parameters

$base_path

\PATH

The base path (path to make relative to)

$path

\PATH

The path to make relative

Returns

\PATHThe relative path

Replace CSS image references such that it is cid'd.

_mail_css_rep_callback(array $matches) : string

Callback for preg_replace_callback.

Parameters

$matches

array

Matches

Returns

stringReplacement

Replace an HTML img tag such that it is cid'd.

_mail_img_rep_callback(array $matches) : string

Callback for preg_replace_callback.

Parameters

$matches

array

Matches

Returns

stringReplacement

Get a nice formatted XHTML listed language selector.

_nice_get_langs(\?LANGUAGE_NAME $select_lang, boolean $show_unset) : \tempcode

Parameters

$select_lang

\?LANGUAGE_NAME

The language to have selected by default (NULL: uses the current language)

$show_unset

boolean

Whether to show languages that have no language details currently defined for them

Returns

\tempcodeThe language selector

Helper function to generate an SQL "equal to" fragment.

_ocfilter_eq(string $field_name, string $var, boolean $numeric) : string

Parameters

$field_name

string

The field name

$var

string

The string value (may actually hold an integer, if $numeric)

$numeric

boolean

Whether the value is numeric

Returns

stringSQL fragment

Helper function to fetch a subtree from the database.

_ocfilter_find_ids_and_parents(string $field_name, string $table_name, \?string $parent_field_name, object $db) : array

Parameters

$field_name

string

The ID field name in the record-set

$table_name

string

The table name of the record-set

$parent_field_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches)

$db

object

Database connection to use

Returns

arrayA map between record-set IDs and record-set parent-category-IDs

Helper function to generate an SQL "not equal to" fragment.

_ocfilter_neq(string $field_name, string $var, boolean $numeric) : string

Parameters

$field_name

string

The field name

$var

string

The string value (may actually hold an integer, if $numeric)

$numeric

boolean

Whether the value is numeric

Returns

stringSQL fragment

Helper function to fetch a subtree from the database.

_ocfilter_subtree_fetch(string $look_under, \?string $table_name, \?string $parent_name, string $field_name, boolean $numeric_ids, object $db, array $cached_mappings, boolean $first) : array

Parameters

$look_under

string

The category-ID we are searching under

$table_name

\?string

The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (NULL: don't support subtree [*-style] searches)

$parent_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$field_name

string

The database's field name for the category-set's category-ID

$numeric_ids

boolean

Whether the category-set IDs are numeric

$db

object

Database connection to use

$cached_mappings

array

A place to store cached data we've already loaded once in this function. Pass in an NULL variable (not a NULL literal)

$first

boolean

Whether this is the base call to this recursive function (just leave it as the default, true)

Returns

arraySubtree: list of IDs in category-set

Turn an ocFilter (a filter specifying which records to match) into a list of ID numbers, relying on the database to extract the record-set.

_ocfilter_to_generic(string $filter, \?string $field_name, \?string $table_name, \?array $ids_and_parents, \?mixed $ids_and_parents_callback, \?string $parent_spec__table_name, \?string $parent_spec__parent_name, \?string $parent_field_name, \?string $parent_spec__field_name, boolean $numeric_record_set_ids, boolean $numeric_category_set_ids, \?object $db) : array

Parameters

$filter

string

The filter

$field_name

\?string

The database's ID field for the record-set we're matching (NULL: use a different lookup method)

$table_name

\?string

The database's table for the record-set we're matching (NULL: use a different lookup method)

$ids_and_parents

\?array

A map between record-set IDs and record-set parent-category-IDs (NULL: use a different lookup method)

$ids_and_parents_callback

\?mixed

A call_user_func_array specifier to a function that will give a map between record-set IDs and record-set parent-category-IDs. We pass a call_user_func_array specifier because we don't want to have to generate it unless we need to (if we need to do 'avoiding' matches or 'subtree' matches) (NULL: use a different lookup method)

$parent_spec__table_name

\?string

The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (NULL: don't support subtree [*-style] searches)

$parent_spec__parent_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$parent_field_name

\?string

The database's field name for the record-set's container-category specifier (NULL: don't support subtree [*-style] searches)

$parent_spec__field_name

\?string

The database's field name for the category-set's category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$numeric_record_set_ids

boolean

Whether the record-set IDs are numeric

$numeric_category_set_ids

boolean

Whether the category-set IDs are numeric

$db

\?object

Database connection to use (NULL: website)

Returns

arrayA list of ID numbers

Function to do an actual data lookup sourced via the database, used as a kind of a callback function (it's name gets passed into the generic API).

_ocfilter_to_generic_callback(\?string $table_name, \?string $field_name, \?string $parent_field_name, boolean $has_no_parents, \?object $db) : array

Parameters

$table_name

\?string

The database's table for the record-set we're matching (NULL: use a different lookup method)

$field_name

\?string

The database's ID field for the record-set we're matching (NULL: use a different lookup method)

$parent_field_name

\?string

The database's field name for the record-set's container-category specifier (NULL: don't support subtree [*-style] searches)

$has_no_parents

boolean

Whether there are parents in the filter

$db

\?object

Database connection to use (NULL: website)

Returns

arrayA list of ID numbers

Called by 'ocportal_error_handler'.

_ocportal_error_handler(\ID_TEXT $type, integer $errno, \PATH $errstr, string $errfile, integer $errline) 

ocPortal error handler (hooked into PHP error system).

Parameters

$type

\ID_TEXT

Error type indicator (tiny human-readable text string)

$errno

integer

The error code-number

$errstr

\PATH

The error message

$errfile

string

The file the error occurred in

$errline

integer

The line the error occurred on

Handle invalid parameter values.

_param_invalid(string $name, \?string $ret, boolean $posted) : string

Parameters

$name

string

The parameter deemed to have an invalid value somehow

$ret

\?string

The value of the parameter deemed invalid (NULL: we known we can't recover)

$posted

boolean

Whether the parameter is a POST parameter

Returns

stringFixed parameter (usually the function won't return [instead will give an error], but in special cases, it can filter an invalid return)

Take a URL and base-URL, and fully qualify the URL according to it.

_qualify_url(\URLPATH $url, \URLPATH $url_base) : \URLPATH

Parameters

$url

\URLPATH

The URL to fully qualified

$url_base

\URLPATH

The base-URL

Returns

\URLPATHFully qualified URL

Take the specified parameters, and try to find the corresponding page

_request_page(\ID_TEXT $codename, \ID_TEXT $zone, \?ID_TEXT $page_type, \?LANGUAGE_NAME $lang, boolean $no_redirect_check) : \~array

Parameters

$codename

\ID_TEXT

The codename of the page to load

$zone

\ID_TEXT

The zone the page is being loaded in

$page_type

\?ID_TEXT

The type of page - for if you know it (NULL: don't know it)

$lang

\?LANGUAGE_NAME

Language name (NULL: users language)

$no_redirect_check

boolean

Whether to not check for redirects (normally you would)

Returns

\~arrayA list of details (false: page not found)

Rescope an ocPortal path to a path suitable for the AFM connection.

_rescope_path(\PATH $path) : \PATH

Parameters

$path

\PATH

Original path.

Returns

\PATHRescoped path.

Search for a specified image file within a theme for a specified language.

_search_img_file(\ID_TEXT $theme, \?LANGUAGE_NAME $lang, \ID_TEXT $id, \ID_TEXT $dir) : \?string

Parameters

$theme

\ID_TEXT

The theme

$lang

\?LANGUAGE_NAME

The language (NULL: try generally, under no specific language)

$id

\ID_TEXT

The theme image ID

$dir

\ID_TEXT

Directory to search

Returns

\?stringThe path to the image (NULL: was not found)

XHTML-aware helper function to try and get to a nice grammatical point to call our substring termius.

_smart_grammar_says_continue(integer $nieve_end_pos, float $grammar_completeness_tolerance, integer $real_offset, string $html, integer $desired_length, boolean $testing_ahead) : boolean

Parameters

$nieve_end_pos

integer

The nieve position where we'd end on.

$grammar_completeness_tolerance

float

A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing).

$real_offset

integer

Current offset in the text.

$html

string

The text to perform on.

$desired_length

integer

Desired (nieve) substring length.

$testing_ahead

boolean

Whether this is a cursory look-ahead rather than a byte-by-byte callback (therefore skip fine-grained checks which would interfere with a cursory result).

Returns

booleanWhether to keep continuing.

XHTML-aware helper function to try and get to a nice grammatical point to call our substring termius.

_smart_grammar_says_futile(integer $nieve_end_pos, float $grammar_completeness_tolerance, integer $real_offset, string $html, integer $desired_length) : boolean

Parameters

$nieve_end_pos

integer

The nieve position where we'd end on.

$grammar_completeness_tolerance

float

A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing).

$real_offset

integer

Current offset in the text.

$html

string

The text to perform on.

$desired_length

integer

Desired (nieve) substring length.

Returns

booleanWhether to keep continuing.

Build up the splurgh nodes recursively for given details.

_splurgh_do_node(array $map, \AUTO_LINK $node, string $chain, array $fulltable, integer $nest) : string

Parameters

$map

array

A row of maps for data we are splurghing; this is probably just the result of $GLOBALS['SITE_DB']->query_select

$node

\AUTO_LINK

The node we are examining

$chain

string

The chain we have built up during our recursion

$fulltable

array

Nodes marked as done (so we don't repeat them in other hierarchy positions if it they get repeated)

$nest

integer

The level of recursion

Returns

stringA specially encoded string that represents our splurghing

Render an 'IMAGE_WIDTH'/'IMAGE_HEIGHT' symbol.

_symbol_image_dims(array $param) : array

Parameters

$param

array

Symbol parameters

Returns

arrayA pair: Image dimensions

Render a 'THUMBNAIL' symbol.

_symbol_thumbnail(array $param) : string

Parameters

$param

array

Symbol parameters

Returns

stringRendered symbol

Provides a hook for file-move synchronisation between mirrored servers.

_sync_file_move(\PATH $old, \PATH $new) 

Called after any rename or move action.

Parameters

$old

\PATH

File/directory name to move from (may be full or relative path)

$new

\PATH

File/directory name to move to (may be full or relative path)

Add layer(s) of tabbing to some XML.

_tab(string $in, integer $depth) : string

Parameters

$in

string

XML in

$depth

integer

The tab depth

Returns

stringXML out

Make titles readable.

_title_callback(array $matches) : string

Callback for preg_replace_callback.

Parameters

$matches

array

Matches

Returns

stringReplacement

Translate truth about needing world write access to a directory to absolute permissions.

_translate_dir_access(boolean $world_access) : integer

Parameters

$world_access

boolean

Whether world directory access is required.

Returns

integerThe absolute permission.

Translate truth about needing world write access to a file to absolute permissions.

_translate_file_access(boolean $world_access, \ID_TEXT $file_type) : integer

Parameters

$world_access

boolean

Whether world file access is required.

$file_type

\ID_TEXT

The file type (blank: don't care).

Returns

integerThe absolute permission.

Attempt to use mod_rewrite to improve this URL.

_url_rewrite_params(\ID_TEXT $zone_name, array $vars, boolean $force_index_php) : \?URLPATH

Parameters

$zone_name

\ID_TEXT

The name of the zone for this

$vars

array

A map of variables to include in our URL

$force_index_php

boolean

Force inclusion of the index.php name into a short URL, so something may tack on extra parameters to the result here

Returns

\?URLPATHThe improved URL (NULL: couldn't do anything)

Takes a URL, and converts it into a file system storable filename.

_url_to_filename(\URLPATH $url_full) : string

This is used to cache URL contents to the servers filesystem.

Parameters

$url_full

\URLPATH

The URL to convert to an encoded filename

Returns

stringA usable filename based on the URL

URL'ise specially encoded text-acceptance language strings.

_urlise_lang(string $string, mixed $url, string $title, boolean $new_window) : \tempcode

Parameters

$string

string

The language string

$url

mixed

The URL (either tempcode or string)

$title

string

The title of the hyperlink

$new_window

boolean

Whether to use a new window

Returns

\tempcodeThe encoded version

Convert some data to XML-RPC format.

_xml_rpc_type_convert(mixed $_value) : string

Parameters

$_value

mixed

Data

Returns

stringXML-RPC format version

Show a helpful access-denied page.

access_denied(\ID_TEXT $class, string $param, boolean $force_login) 

Has a login ability if it senses that logging in could curtail the error.

Parameters

$class

\ID_TEXT

The class of error (e.g. PRIVILEGE). This is a language string.

$param

string

The parameteter given to the error message

$force_login

boolean

Force the user to login (even if perhaps they are logged in already)

Try and make an action log entry into a proper link.

actionlog_linkage(\ID_TEXT $type, string $a, string $b, \tempcode $_a, \tempcode $_b) : \?array

Parameters

$type

\ID_TEXT

Action type

$a

string

First parameter

$b

string

Second parameter

$_a

\tempcode

First parameter (cropped)

$_b

\tempcode

Second parameter (cropped)

Returns

\?arrayPair: first parameter as possible link, second parameter as possible link (NULL: could not construct a nice link)

Add a zone.

actual_add_zone(\ID_TEXT $zone, \SHORT_TEXT $title, \ID_TEXT $default_page, \SHORT_TEXT $header_text, \ID_TEXT $theme, \BINARY $wide, \BINARY $require_session, \BINARY $displayed_in_menu) 

Parameters

$zone

\ID_TEXT

Name of the zone

$title

\SHORT_TEXT

The zone title

$default_page

\ID_TEXT

The zones default page

$header_text

\SHORT_TEXT

The header text

$theme

\ID_TEXT

The theme

$wide

\BINARY

Whether the zone is wide

$require_session

\BINARY

Whether the zone requires a session for pages to be used

$displayed_in_menu

\BINARY

Whether the zone in displayed in the menu coded into some themes

Delete a zone.

actual_delete_zone(\ID_TEXT $zone) 

Parameters

$zone

\ID_TEXT

The name of the zone

Delete a zones database stuff.

actual_delete_zone_lite(\ID_TEXT $zone) 

Parameters

$zone

\ID_TEXT

The name of the zone

Edit a zone.

actual_edit_zone(\ID_TEXT $zone, \SHORT_TEXT $title, \ID_TEXT $default_page, \SHORT_TEXT $header_text, \ID_TEXT $theme, \BINARY $wide, \BINARY $require_session, \BINARY $displayed_in_menu, \ID_TEXT $new_zone) 

Parameters

$zone

\ID_TEXT

The current name of the zone

$title

\SHORT_TEXT

The zone title

$default_page

\ID_TEXT

The zones default page

$header_text

\SHORT_TEXT

The header text

$theme

\ID_TEXT

The theme

$wide

\BINARY

Whether the zone is wide

$require_session

\BINARY

Whether the zone requires a session for pages to be used

$displayed_in_menu

\BINARY

Whether the zone in displayed in the menu coded into some themes

$new_zone

\ID_TEXT

The new name of the zone

Rename a zone in the database.

actual_rename_zone_lite(\ID_TEXT $zone, \ID_TEXT $new_zone, boolean $dont_bother_with_main_row) 

Parameters

$zone

\ID_TEXT

The old name of the zone

$new_zone

\ID_TEXT

The new name of the zone

$dont_bother_with_main_row

boolean

Whether to assume the main zone row has already been renamed as part of a wider editing operation

Add a configuration option into the database, and initialise it with a specified value.

add_config_option(\ID_TEXT $human_name, \ID_TEXT $name, \ID_TEXT $type, \SHORT_TEXT $eval, \ID_TEXT $category, \ID_TEXT $group, \BINARY $shared_hosting_restricted, \SHORT_TEXT $data) 

set float integer tick line text transline transtext list date forum category usergroup colour

Parameters

$human_name

\ID_TEXT

The language code to the human name of the config option

$name

\ID_TEXT

The codename for the config option

$type

\ID_TEXT

The type of the config option

$eval

\SHORT_TEXT

The PHP code to execute to get the default value for this option. Be careful not to make a get_option loop.

$category

\ID_TEXT

The language code for the option category to store the option in

$group

\ID_TEXT

The language code for the option group to store the option in

$shared_hosting_restricted

\BINARY

Whether the option is not settable when on a shared ocportal-hosting environment

$data

\SHORT_TEXT

Extra data for the option

Add an IP-ban.

add_ip_ban(\IP $ip, \LONG_TEXT $descrip, \?TIME $ban_until, boolean $ban_positive) : boolean

Parameters

$ip

\IP

The IP address to ban

$descrip

\LONG_TEXT

Explanation for ban

$ban_until

\?TIME

When to ban until (NULL: no limit)

$ban_positive

boolean

Whether this is a positive ban (as opposed to a cached negative)

Returns

booleanWhether a change actually happened

Add a privilege, and apply it to every usergroup.

add_specific_permission(\ID_TEXT $section, \ID_TEXT $name, boolean $default, boolean $not_even_mods) 

Parameters

$section

\ID_TEXT

The section the privilege is filled under

$name

\ID_TEXT

The codename for the privilege

$default

boolean

Whether this permission is granted to all usergroups by default

$not_even_mods

boolean

Whether this permission is not granted to supermoderators by default (something very sensitive)

Check to see if an addon is installed.

addon_installed(\ID_TEXT $addon, boolean $non_bundled_too) : boolean

Parameters

$addon

\ID_TEXT

The module name

$non_bundled_too

boolean

Whether to check non-bundled addons (ones without an addon_registry hook)

Returns

booleanWhether it is

Extend breadcrumbs for the Admin Zone (called by breadcrumbs_get_default_stub).

adminzone_extend_breadcrumbs(\tempcode $stub) 

Parameters

$stub

\tempcode

Reference to the breadcrumbs stub we're assembling

Special code to render Admin Zone Comcode pages with special significances.

adminzone_special_cases(\ID_TEXT $codename) 

Parameters

$codename

\ID_TEXT

The page being loaded

Copies a file (NOT a directory) on the open AFM connection.

afm_copy(\PATH $old_path, \PATH $new_path, boolean $world_access) 

Parameters

$old_path

\PATH

The path to the file we are copying.

$new_path

\PATH

The target path.

$world_access

boolean

Whether world access is required for the copy.

Delete a directory over the open AFM connection.

afm_delete_directory(\PATH $basic_path, boolean $recursive) 

Parameters

$basic_path

\PATH

The path to and of the directory we are deleting.

$recursive

boolean

Whether we should recursively delete any child files and directories.

Deletes a file (NOT a directory) on the open AFM connection.

afm_delete_file(\PATH $basic_path) 

Parameters

$basic_path

\PATH

The path to the file we are deleting.

Make a directory over the open AFM connection.

afm_make_directory(\PATH $basic_path, boolean $world_access, boolean $recursive) 

Parameters

$basic_path

\PATH

The path to and of the directory we are making.

$world_access

boolean

Whether world access is required.

$recursive

boolean

Whether we should recursively make any directories that are missing in the given path, until we can make the final directory.

Make a new file over the open AFM connection.

afm_make_file(\PATH $basic_path, string $contents, boolean $world_access) 

Will overwrite if already exists (assuming has access).

Parameters

$basic_path

\PATH

The path to the file we are making.

$contents

string

The desired file contents.

$world_access

boolean

Whether world access is required.

Moves a file on the open AFM connection.

afm_move(\PATH $basic_old_path, \PATH $basic_new_path) 

Parameters

$basic_old_path

\PATH

The path to the file we are moving from.

$basic_new_path

\PATH

The target path.

Read a file (not actually over the open AFM connection, but same result: we can do this directly).

afm_read_file(\PATH $path) : string

Parameters

$path

\PATH

The path to the file we are reading.

Returns

stringThe contents of the file.

Sets permissions over the open AFM connection.

afm_set_perms(\PATH $basic_path, boolean $world_access) 

Parameters

$basic_path

\PATH

The path of the file/directory we are setting permissions of.

$world_access

boolean

Whether world access is required.

AJAX script for dynamically extended selection tree.

ajax_tree_script() 

Apply hashing to some input.

apply_forum_driver_md5_variant(string $data, string $key) : string

To this date, all forum drivers use md5, but some use it differently. This function will pass through the parameters to an equivalent forum_md5 function if it is defined.

Parameters

$data

string

The data to hash (the password in actuality)

$key

string

The string converted member-ID in actuality, although this function is more general

Returns

stringThe hashed data

Apply whatever escaping is requested to the given value.

apply_tempcode_escaping(array $escaped, string $value) : string

Parameters

$escaped

array

A list of escaping to do

$value

string

The string to apply the escapings to

Returns

stringOutput string (you do not need to collect this, as $value is pass-by-reference -- but this is useful for chaining)

Apply whatever escaping is requested to the given value.

apply_tempcode_escaping(array $escaped, string $value) : string

Parameters

$escaped

array

A list of escaping to do

$value

string

The string to apply the escapings to

Returns

stringOutput string (you do not need to collect this, as $value is pass-by-reference -- but this is useful for chaining)

Apply whatever escaping is requested to the given value.

apply_tempcode_escaping_inline(array $escaped, string $value) : string

Parameters

$escaped

array

A list of escaping to do

$value

string

The string to apply the escapings to

Returns

stringOutput string

Apply whatever escaping is requested to the given value.

apply_tempcode_escaping_inline(array $escaped, string $value) : string

Parameters

$escaped

array

A list of escaping to do

$value

string

The string to apply the escapings to

Returns

stringOutput string

Peek at a stack element.

array_peek(array $array, integer $depth_down) : mixed

Parameters

$array

array

The stack to peek in

$depth_down

integer

The depth into the stack we are peaking

Returns

mixedThe result of the peeking

Assign a page refresh to the specified URL.

assign_refresh(mixed $url, float $multiplier) 

Parameters

$url

mixed

Refresh to this URL (URLPATH or Tempcode URL)

$multiplier

float

Take this many times longer than a 'standard ocPortal refresh'

Attach a message to the page output.

attach_message(mixed $message, \ID_TEXT $type) : string

set inform warn

Parameters

$message

mixed

The type of special message

$type

\ID_TEXT

The template to use

Returns

stringBlank string so it can be chained in the Tempcode compiler. You will rarely want to use this return value. It's kind of a failsafe.

Called from 'find_id_moniker'.

autogenerate_new_url_moniker(array $ob_info, array $url_parts) : \?string

We tried to lookup a moniker, found a hook, but found no stored moniker. So we'll try and autogenerate one.

Parameters

$ob_info

array

The hooks info profile.

$url_parts

array

The URL component map (must contain 'page', 'type', and 'id' if this function is to do anything).

Returns

\?stringThe moniker ID (NULL: error generating it somehow, can not do it)

Ban the specified IP address.

ban_ip(\IP $ip, \LONG_TEXT $descrip) 

Parameters

$ip

\IP

The IP address to ban

$descrip

\LONG_TEXT

Explanation for ban

Hash something as well as possible.

best_hash(\SHORT_TEXT $to_hash, \SHORT_TEXT $salt) : \SHORT_TEXT

Only use this function if the hash is for short-term use, because long-term we don't know if the best hash function will change or not.

Parameters

$to_hash

\SHORT_TEXT

What to hash

$salt

\SHORT_TEXT

Salt

Returns

\SHORT_TEXTHashed result

Parse the specified INI file, and get an array of what it found.

better_parse_ini_file(\?PATH $filename, \?string $file) : array

Parameters

$filename

\?PATH

The path to the ini file to open (NULL: given contents in $file instead)

$file

\?string

The contents of the file (NULL: the file needs opening)

Returns

arrayA map of the contents of the ini files

Find the default caching setting for a block.

block_cache_default(\ID_TEXT $codename) : \ID_TEXT

Parameters

$codename

\ID_TEXT

The block name

Returns

\ID_TEXTThe default caching setting

Shows an HTML page for making block Comcode.

block_helper_script() 

Check to see if a block is installed.

block_installed(\ID_TEXT $block) : boolean

Parameters

$block

\ID_TEXT

The module name

Returns

booleanWhether it is

Convert a parameter set from a an array (for PHP code) to a string (for templates).

block_params_arr_to_str(array $map) : string

Parameters

$map

array

The parameters / acceptable parameter pattern

Returns

stringThe parameters / acceptable parameter pattern, as template safe parameter

Find the base URL for documentation.

brand_base_url() : \URLPATH

Returns

\URLPATHThe base URL for documentation

See's if the current browser matches some special property code.

browser_matches(string $code) : boolean

Assumes users are keeping up on newish browsers (except for IE users, who are 6+)

set android ios wysiwyg windows mac linux odd_os mobile opera ie ie8 ie8+ ie9 ie9+ gecko konqueror safari odd_browser chrome bot

Parameters

$code

string

The property code

Returns

booleanWhether there is a match

Build a closure function for a compiled template.

build_closure_function(string $myfunc, array $parts) : string

Parameters

$myfunc

string

The function name

$parts

array

An array of lines to be output, each one in PHP format

Returns

stringFinished PHP code

Build a conventional tempcode object

build_closure_tempcode(integer $type, \ID_TEXT $name, \?array $parameters, \?array $escaping) : \tempcode

set 0 2

Parameters

$type

integer

The type of symbol this is (TC_SYMBOL, TC_LANGUAGE_REFERENCE)

$name

\ID_TEXT

The name of the symbol

$parameters

\?array

Parameters to the symbol (NULL: none). In same format as expected by ecv.

$escaping

\?array

Escaping for the symbol (NULL: none)

Returns

\tempcodeTempcode object.

Build a fulltext query WHERE clause from given content.

build_content_where(string $content, boolean $boolean_search, string $boolean_operator, boolean $full_coverage) : string

set AND OR

Parameters

$content

string

The search content

$boolean_search

boolean

Whether it's a boolean search

$boolean_operator

string

Boolean operation to use

$full_coverage

boolean

Whether we can assume we require full coverage

Returns

stringWHERE clause

Get hidden fields for a form representing 'keep_x'.

build_keep_form_fields(\ID_TEXT $page, boolean $keep_all, \?array $exclude) : \tempcode

If we are having a GET form instead of a POST form, we need to do this. This function also encodes the page name, as we'll always want that.

Parameters

$page

\ID_TEXT

The page for the form to go to (blank: don't attach)

$keep_all

boolean

Whether to keep all elements of the current URL represented in this form (rather than just the keep_ fields, and page)

$exclude

\?array

A list of parameters to exclude (NULL: don't exclude any)

Returns

\tempcodeThe builtup hidden form fields

Relay all POST variables for this URL, to the URL embedded in the form.

build_keep_post_fields(\?array $exclude) : \tempcode

Parameters

$exclude

\?array

A list of parameters to exclude (NULL: exclude none)

Returns

\tempcodeThe builtup hidden form fields

Build a templated list of the given search results, for viewing.

build_search_results_interface(array $results, integer $start, integer $max, string $direction, boolean $general_search) : \tempcode

set ASC DESC

Parameters

$results

array

Search results

$start

integer

Start index

$max

integer

Maximum index

$direction

string

Sort direction

$general_search

boolean

Whether this is a general search, rather than a search for a specific result-type (such as all members)

Returns

\tempcodeInterface

Build up a submitter search clause, taking into account members, authors, usernames, and usergroups.

build_search_submitter_clauses(\?ID_TEXT $member_field_name, \?MEMBER $member_id, \ID_TEXT $author, \?ID_TEXT $author_field_name) : \?string

Parameters

$member_field_name

\?ID_TEXT

The field name for member IDs (NULL: Cannot match against member IDs)

$member_id

\?MEMBER

Member ID (NULL: Unknown, so cannot search)

$author

\ID_TEXT

Author

$author_field_name

\?ID_TEXT

The field name for authors (NULL: Cannot match against member IDs)

Returns

\?stringAn SQL fragment (NULL: block query)

Build and return a proper URL, from the $vars array.

build_url(array $vars, \ID_TEXT $zone_name, \?array $skip, boolean $keep_all, boolean $avoid_remap, boolean $skip_keep, string $hash) : \tempcode

Note: URL parameters should always be in lower case (one of the coding standards)

Parameters

$vars

array

A map of parameter names to parameter values. E.g. array('page'=>'example','type'=>'foo','id'=>2). Values may be strings or integers, or Tempcode, or NULL. NULL indicates "skip this". 'page' cannot be NULL.

$zone_name

\ID_TEXT

The zone the URL is pointing to. YOU SHOULD NEVER HARD CODE THIS- USE '_SEARCH', '_SELF' (if you're self-referencing your own page) or the output of get_module_zone.

$skip

\?array

Variables to explicitly not put in the URL (perhaps because we have $keep_all set, or we are blocking certain keep_ values). The format is of a map where the keys are the names, and the values are 1. (NULL: don't skip any)

$keep_all

boolean

Whether to keep all non-skipped parameters that were in the current URL, in this URL

$avoid_remap

boolean

Whether to avoid mod_rewrite (sometimes essential so we can assume the standard URL parameter addition scheme in templates)

$skip_keep

boolean

Whether to skip actually putting on keep_ parameters (rarely will this skipping be desirable)

$hash

string

Hash portion of the URL (blank: none). May or may not start '#' - code will put it on if needed

Returns

\tempcodeThe URL in tempcode format.

Put a member into a usergroup temporarily / extend such a temporary usergroup membership.

bump_member_group_timeout(\MEMBER $member_id, \GROUP $group_id, integer $num_minutes, boolean $prefer_for_primary_group) 

Note that if people are subsequently removed from the usergroup they won't be put back in; this allows the admin to essentially cancel the subscription - however, if it is then extended, they do keep the time they had before too.

Parameters

$member_id

\MEMBER

The member going in the usergroup.

$group_id

\GROUP

The usergroup.

$num_minutes

integer

The number of minutes (may be negative to take time away).

$prefer_for_primary_group

boolean

Whether to put the member into as a primary group if this is a new temporary membership (it is recommended to NOT use this, since we don't track the source group and hence on expiry the member is put back to the first default group - but also generally you probably don't want to box yourself in with moving people's primary group, it ties your future flexibility down a lot).

Look up and remember what modules are installed.

cache_module_installed_status() 

Find whether the database may run GROUP BY unfettered with restrictions on the SELECT'd fields having to be represented in it or aggregate functions

can_arbitrary_groupby() : boolean

Returns

booleanWhether it can

Find if we can use the fast spider cache.

can_fast_spider_cache() : boolean

Returns

booleanWhether we can

Find if mod_rewrite is in use

can_try_mod_rewrite(boolean $avoid_remap) : boolean

Parameters

$avoid_remap

boolean

Whether to explicitly avoid using mod_rewrite. Whilst it might seem weird to put this in as a function parameter, it removes duplicated logic checks in the code.

Returns

booleanWhether mod_rewrite is in use

ocPortal error catcher for fatal versions.

catch_fatal_errors() 

This is hooked in only on PHP5.2 as error_get_last() only works on these versions.

Filter a path so it runs through a CDN.

cdn_filter(\URLPATH $path) : \URLPATH

Parameters

$path

\URLPATH

Input URL

Returns

\URLPATHOutput URL

AJAX script to tell if data has been changed.

change_detection_script() 

Check if a member's has permission to delete a specific resource.

check_delete_permission(string $range, \?MEMBER $resource_owner, \?array $cats, \?ID_TEXT $page) 

If it doesn't, an error message is outputted.

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$resource_owner

\?MEMBER

The member that owns this resource (NULL: no-one)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

Check to see if a member's has permission to edit an item.

check_edit_permission(string $range, \?MEMBER $resource_owner, \?array $cats, \?ID_TEXT $page) 

If it doesn't, an error message is outputted.

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$resource_owner

\?MEMBER

The member that owns this resource (NULL: no-one)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

Check uploaded file extensions for possible malicious intent, and if some is found, an error is put out, and the hackattack logged.

check_extension(string $name, boolean $skip_server_side_security_check, \?string $file_to_delete, boolean $accept_errors) : boolean

Parameters

$name

string

The filename

$skip_server_side_security_check

boolean

Whether to skip the server side security check

$file_to_delete

\?string

Delete this file if we have to exit (NULL: no file to delete)

$accept_errors

boolean

Whether to allow errors without dying

Returns

booleanSuccess status

Check an input field isn't 'evil'.

check_input_field(string $name, string $val) 

Parameters

$name

string

The name of the parameter

$val

string

The value retrieved

Check the given master password is valid.

check_master_password(\SHORT_TEXT $password_given) : boolean

Parameters

$password_given

\SHORT_TEXT

Given master password

Returns

booleanWhether it is valid

Check we can load the given file, given our memory limit.

check_memory_limit_for(\PATH $file_path, boolean $exit_on_error) : boolean

Parameters

$file_path

\PATH

The file path we are trying to load

$exit_on_error

boolean

Whether to exit ocPortal if an error occurs

Returns

booleanSuccess status

Check a posted field isn't 'evil'.

check_posted_field(string $name, string $val) : string

Parameters

$name

string

The name of the parameter

$val

string

The value retrieved

Returns

stringThe filtered value

Do an RBL check on an IP address.

check_rbl(\ID_TEXT $rbl, \IP $user_ip, boolean $we_have_a_result_already, boolean $page_level) : array

Parameters

$rbl

\ID_TEXT

The RBL domain name/IP (HTTP:BL has a special syntax)

$user_ip

\IP

The IP address to lookup

$we_have_a_result_already

boolean

If true, then no RBL check will happen if the RBL has no scoring, because it can't provide a superior result to what is already known (performance)

$page_level

boolean

Whether this is a page level check (i.e. we won't consider blocks or approval, just ban setting)

Returns

arrayPair: Listed for potential blocking as a ANTISPAM_RESPONSE_* constant, confidence level if attainable (0.0 to 1.0) (else NULL)

Check RBLs to see if we need to block this user.

check_rbls(boolean $page_level, \?IP $user_ip) 

Parameters

$page_level

boolean

Whether this is a page level check (i.e. we won't consider blocks or approval, just ban setting)

$user_ip

\?IP

IP address (NULL: current user's)

Check bandwidth usage against page view ratio for shared hosting.

check_shared_bandwidth_usage(integer $extra) 

Parameters

$extra

integer

The extra bandwidth requested

Check disk space usage against page view ratio for shared hosting.

check_shared_space_usage(integer $extra) 

Parameters

$extra

integer

The extra space in bytes requested

Check to see if a member's has permission to edit an item.

check_some_edit_permission(string $range, \?array $cats) 

If it doesn't, an error message is outputted.

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

Require presence of a permission for the current member; otherwise exit.

check_specific_permission(\ID_TEXT $permission, \?array $cats, \?MEMBER $member_id) 

Parameters

$permission

\ID_TEXT

The permission to require

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

$member_id

\?MEMBER

Member to check for (NULL: current user)

Check the stopforumspam service to see if we need to block this user.

check_stopforumspam(\?string $username, \?string $email) 

Parameters

$username

\?string

Check this particular username that has just been supplied (NULL: none)

$email

\?string

Check this particular email address that has just been supplied (NULL: none)

Check to see if a member's has permission to submit an item.

check_submit_permission(string $range, \?array $cats, \?ID_TEXT $page) 

If it doesn't, an error message is outputted.

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

Check the specified text ($a) for banned words.

check_word_filter(string $a, \?ID_TEXT $name, boolean $no_die, boolean $try_patterns, boolean $perm_check) : string

If any are found, and the member cannot bypass the word filter, an error message is displayed.

Parameters

$a

string

The sentence to check

$name

\?ID_TEXT

The name of the parameter this is coming from. Certain parameters are not checked, for reasons of efficiency (avoiding loading whole word check list if not needed) (NULL: don't know param, do not check to avoid)

$no_die

boolean

Whether to avoid dying on fully blocked words (useful if importing, for instance)

$try_patterns

boolean

Whether to try pattern matching (this takes more resources)

$perm_check

boolean

Whether to allow permission-based skipping, and length-based skipping

Returns

string"Fixed" version

UI to choose a language.

choose_language(\tempcode $title, boolean $tip, boolean $allow_all_selection) : mixed

Parameters

$title

\tempcode

Title for the form

$tip

boolean

Whether to give a tip about edit order

$allow_all_selection

boolean

Whether to add an 'all' entry to the list

Returns

mixedThe UI (tempcode) or the language to use (string/LANGUAGE_NAME)

Format the specified filesize.

clean_file_size(integer $bytes) : string

Parameters

$bytes

integer

The number of bytes the file has

Returns

stringThe formatted-string file size

Turn an HTML title, which could be complex with images, into a nice simple string we can use in <title> and ;.

clean_html_title(string $title) : string

Parameters

$title

string

The relative (to ocPortal's base directory) path to the page (e.g. pages/comcode/EN/start.txt)

Returns

stringFixed

Make a block codename look nice

cleanup_block_name(\ID_TEXT $block) : string

Parameters

$block

\ID_TEXT

The raw block codename

Returns

stringA nice human readable version of the name

Convert an ISO date into a timestamp.

cleanup_date(string $date) : array

Parameters

$date

string

The ISO date

Returns

arrayIf only one element, it contains the timestamp. Otherwise it is a pair: (string format, timestamp)

Cleanup some EXIF, to the correct character set.

cleanup_exif(array $meta_data) : array

Parameters

$meta_data

array

The EXIF data

Returns

arrayCleaned up EXIF data

Handle auto-removal of timed-out members.

cleanup_member_timeouts() 

Declare that an action succeeded - delete safety autosave cookies.

clear_ocp_autosave() 

Function to clear old uploads, that are older then 2 days

clear_old_uploads() 

Render the site as closed.

closed_site() 

Evaluate some PHP code to put the result into an expression (code is allowed to have side effects).

closure_eval(string $code, array $parameters) : string

Parameters

$code

string

The code

$parameters

array

Template parameters

Returns

stringResult

Perform a simple loop, that can be inlined in an expression.

closure_loop(array $param, array $args, array $main_function) : string

Parameters

$param

array

The template bound parameters

$args

array

The loop directive parameters

$main_function

array

The loop execution function

Returns

stringResult

Perform a simple loop, that can be inlined in an expression.

closure_while_loop(array $args, array $control_function, array $main_function) : string

Parameters

$args

array

The template bound parameters

$control_function

array

The loop control function

$main_function

array

The loop execution function

Returns

stringResult

Take a list of maps of just one element, and make it into a single map

collapse_1d_complexity(string $key, array $list) : array

Parameters

$key

string

The key of our maps that reside in our map

$list

array

The map of maps

Returns

arrayThe collapsed map

Take a list of maps of just two elements, and make it into a single map

collapse_2d_complexity(string $key, string $value, array $list) : array

Parameters

$key

string

The key key of our maps that reside in our map

$value

string

The value key of our maps that reside in our map

$list

array

The map of maps

Returns

arrayThe collapsed map

Get a UI element of a route from a known Comcode page back to the declared root of the tree.

comcode_breadcrumbs(\ID_TEXT $the_page, \ID_TEXT $the_zone, \ID_TEXT $root, boolean $no_link_for_me_sir, integer $jumps) : \tempcode

Parameters

$the_page

\ID_TEXT

The Comcode page name

$the_zone

\ID_TEXT

The Comcode page zone

$root

\ID_TEXT

The virtual root

$no_link_for_me_sir

boolean

Whether not to put a link at this point in the navigation tree (usually, because the viewer is already at it)

$jumps

integer

The number of jumps we have gone through so far (cuts out after 10 as a failsafe)

Returns

\tempcodeThe navigation element

AJAX script for HTML<>Comcode conversion (and Comcode-Text>Comcode-XML).

comcode_convert_script() 

Convert a language string that is Comcode to tempcode, with potential cacheing in the db.

comcode_lang_string(\ID_TEXT $lang_code) : \tempcode

Parameters

$lang_code

\ID_TEXT

The language string ID

Returns

\tempcodeThe parsed Comcode

Make some Comcode more readable.

comcode_to_clean_text(string $message_plain) : string

Parameters

$message_plain

string

Comcode text to change

Returns

stringClean text

Compare two IP addresses for potential correlation.

compare_ip_address(string $wild, \IP $full) : boolean

Not as simple as equality due to '*' syntax.

Parameters

$wild

string

The general IP address that is potentially wildcarded

$full

\IP

The specific IP address we are checking

Returns

booleanWhether the IP addresses correlate

Compare two IP addresses for potential correlation.

compare_ip_address_ip4(string $wild, array $full_parts) : boolean

Not as simple as equality due to '*' syntax. IP4-only variant

Parameters

$wild

string

The general IP address that is potentially wildcarded

$full_parts

array

The exploded parts of the specific IP address we are checking

Returns

booleanWhether the IP addresses correlate

Compare two IP addresses for potential correlation.

compare_ip_address_ip6(string $wild, array $full_parts) : boolean

Not as simple as equality due to '*' syntax. IP6-only variant

Parameters

$wild

string

The general IP address that is potentially wildcarded

$full_parts

array

The exploded parts of the specific IP address we are checking

Returns

booleanWhether the IP addresses correlate

Compile a template into a list of appendable outputs, for the closure-style Tempcode implementation.

compile_template(string $data, \ID_TEXT $template_name, \ID_TEXT $theme, \ID_TEXT $lang, boolean $tolerate_errors) : array

Parameters

$data

string

The template file contents

$template_name

\ID_TEXT

The name of the template

$theme

\ID_TEXT

The name of the theme

$lang

\ID_TEXT

The language it is for

$tolerate_errors

boolean

Whether to tolerate errors

Returns

arrayA pair: array Compiled result structure, array preprocessable bits (special stuff needing attention that is referenced within the template)

Check if a config option exists.

config_option_exists(\ID_TEXT $name) : boolean

Parameters

$name

\ID_TEXT

The name of the option

Returns

booleanWhether it exists

AJAX script for confirming a session is active.

confirm_session_script() 

Get meta details of a content item

content_get_details(\ID_TEXT $content_type, \ID_TEXT $content_id) : array

Parameters

$content_type

\ID_TEXT

Content type

$content_id

\ID_TEXT

Content ID

Returns

arrayTuple: title, submitter, content hook info, URL (for use within current browser session), URL (for use in emails / sharing)

Get the content row of a content item.

content_get_row(\ID_TEXT $content_id, array $cma_info) : \?array

Parameters

$content_id

\ID_TEXT

The content ID

$cma_info

array

The info array for the content type

Returns

\?arrayThe row (NULL: not found)

Find whether some content is validated.

content_validated(\ID_TEXT $content_type, \ID_TEXT $content_id) : boolean

Parameters

$content_type

\ID_TEXT

Content type

$content_id

\ID_TEXT

Content ID

Returns

booleanWhether it is validated

Performs lots of magic to make sure data encodings are converted correctly.

convert_data_encodings(boolean $known_utf8) 

Input, and output too (as often stores internally in UTF or performs automatic dynamic conversions from internal to external charsets). Roll on PHP6 that has a true internal UTF string model. For now, anyone who uses UTF will get some (albeit minor) imperfections from PHP's manipulations of the strings.

Parameters

$known_utf8

boolean

Whether we know we are working in UTF-8. This is the case for AJAX calls.

Resize an image to the specified size, but retain the aspect ratio.

convert_image(\URLPATH $from, \PATH $to, integer $width, integer $height, integer $box_width, boolean $exit_on_error, \?string $ext2, boolean $using_path, boolean $only_make_smaller, \?array $thumb_options) : boolean

Parameters

$from

\URLPATH

The URL to the image to resize

$to

\PATH

The file path (including filename) to where the resized image will be saved

$width

integer

The maximum width we want our new image to be (-1 means "don't factor this in")

$height

integer

The maximum height we want our new image to be (-1 means "don't factor this in")

$box_width

integer

This is only considered if both $width and $height are -1. If set, it will fit the image to a box of this dimension (suited for resizing both landscape and portraits fairly)

$exit_on_error

boolean

Whether to exit ocPortal if an error occurs

$ext2

\?string

The file extension to save with (NULL: same as our input file)

$using_path

boolean

Whether $from was in fact a path, not a URL

$only_make_smaller

boolean

Whether to apply a 'never make the image bigger' rule for thumbnail creation (would affect very small images)

$thumb_options

\?array

This optional parameter allows us to specify cropping or padding for the image. See comments in the function. (NULL: no details passed)

Returns

booleanSuccess

Find a different content type code from the one had.

convert_ocportal_type_codes(\ID_TEXT $type_has, \ID_TEXT $type_id, \ID_TEXT $type_wanted) : \ID_TEXT

In future we intend to change everything to be cma_hook internally.

set addon cma_hook award_hook search_hook table seo_type_code feedback_type_code permissions_type_code module table
set addon cma_hook search_hook table seo_type_code feedback_type_code permissions_type_code module table

Parameters

$type_has

\ID_TEXT

Content type type we know

$type_id

\ID_TEXT

Content type ID we know

$type_wanted

\ID_TEXT

Desired content type

Returns

\ID_TEXTCorrected content type type (blank: could not find)

Given a timezone offset, make it into a formal timezone.

convert_timezone_offset_to_formal_timezone(float $offset) : string

Parameters

$offset

float

Timezone offset.

Returns

stringUsers timezone in "boring" format.

Convert some data from one encoding to the internal encoding.

convert_to_internal_encoding(string $data, \?string $input_charset, \?string $internal_charset) : string

Parameters

$data

string

Data to convert.

$input_charset

\?string

Charset to convert from (NULL: that read by the last http_download_file call).

$internal_charset

\?string

Charset to convert to (NULL: current encoding).

Returns

stringConverted data.

Convert a URL to a local file path.

convert_url_to_path(\URLPATH $url) : \?PATH

Parameters

$url

\URLPATH

The value to convert

Returns

\?PATHFile path (NULL: is not local)

Calculate CRC32 for a file.

crc32_file(\PATH $filename) : \?integer

Based on a function in the PHP docs.

Parameters

$filename

\PATH

The file

Returns

\?integerThe CRC (NULL: error)

Set up a new session / Restore an existing one that was lost.

create_session(\MEMBER $member, \BINARY $session_confirmed, boolean $invisible) : \AUTO_LINK

Parameters

$member

\MEMBER

Logged in member

$session_confirmed

\BINARY

Whether the session should be considered confirmed

$invisible

boolean

Whether the session should be invisible

Returns

\AUTO_LINKNew session ID

Create a zip file.

create_zip_file(array $file_array, boolean $stream, boolean $get_offsets) : mixed

Parameters

$file_array

array

A list of maps (time,data/full_path,name) covering everything to zip up

$stream

boolean

Whether to stream the output direct to the browser

$get_offsets

boolean

Whether to return the tuple

Returns

mixedThe data for the zip file OR a tuple: data, offsets, sizes

Exit with a nicely formatted critical error.

critical_error(string $code, \?string $relay, boolean $exit) 

Parameters

$code

string

The error message code

$relay

\?string

Relayed additional details (NULL: nothing relayed)

$exit

boolean

Whether to actually exit

Script to perform ocPortal CRON jobs called by the real CRON.

cron_bridge_script(\PATH $caller) 

Parameters

$caller

\PATH

File path of the cron_bridge.php script

Find if Cron is installed

cron_installed() : boolean

Returns

booleanWhether Cron is installed

Compile a CSS file.

css_compile(\ID_TEXT $active_theme, \ID_TEXT $theme, \ID_TEXT $c, \PATH $fullpath, \PATH $css_cache_path, boolean $minify) 

Parameters

$active_theme

\ID_TEXT

The theme the file is being loaded for

$theme

\ID_TEXT

The theme the file is in

$c

\ID_TEXT

Name of the CSS file

$fullpath

\PATH

Full path to the CSS file

$css_cache_path

\PATH

Full path to where the cached CSS file will go

$minify

boolean

Whether to also do minification

Force a CSS file to be cached.

css_enforce(string $c, \?ID_TEXT $theme, \?boolean $minify) : string

Parameters

$c

string

The CSS file required

$theme

\?ID_TEXT

The name of the theme (NULL: current theme)

$minify

\?boolean

Whether to minify (NULL: read from environment)

Returns

stringThe path to the CSS file in the cache (blank: no file)

Inherit from a CSS file to create a string for a (possibly theme-gen) modified version of that file.

css_inherit(\ID_TEXT $css_file, \ID_TEXT $theme, \ID_TEXT $destination_theme, \?ID_TEXT $seed, boolean $dark, \ID_TEXT $algorithm) : string

set equations hsv

Parameters

$css_file

\ID_TEXT

Source CSS file

$theme

\ID_TEXT

Source theme

$destination_theme

\ID_TEXT

Destination theme

$seed

\?ID_TEXT

Seed (NULL: do not re-seed)

$dark

boolean

Whether it is a dark theme

$algorithm

\ID_TEXT

The algorithm to use

Returns

stringThe sheet

Minifies stylesheet definitions

css_minify(string $v) : string

Parameters

$v

string

Stylesheet definitions as string

Returns

stringMinified stylesheet definitions

Get tempcode to tie in (to the HTML, in <head>) all the CSS files that have been required.

css_tempcode(boolean $inline, boolean $only_global, \?string $context, \?ID_TEXT $theme) : \tempcode

Parameters

$inline

boolean

Force inline CSS

$only_global

boolean

Only do global CSS

$context

\?string

HTML context for which we filter (minimise) any CSS we spit out as inline (NULL: none)

$theme

\?ID_TEXT

The name of the theme (NULL: current theme)

Returns

\tempcodeThe tempcode to tie in the CSS files

Find out what script is running.

current_script() : \ID_TEXT

Returns

\ID_TEXTThe script running (usually 'index')

Find the user-ID of the current shared-site install from the accessing URL.

current_share_user() : \?ID_TEXT

This should only ever be called when it is known a shared-site is in operation

Returns

\?ID_TEXTThe shared-site install (NULL: not on one)

Encode a LIKE string comparision fragement for the database system.

db_encode_like(string $pattern) : string

The pattern is a mixture of characters and ? and % wilcard symbols.

Parameters

$pattern

string

The pattern

Returns

stringThe encoded pattern

Escape a string so it may be inserted into a query.

db_escape_string(string $string) : string

If SQL statements are being built up and passed using db_query then it is essential that this is used for security reasons. Otherwise, the abstraction layer deals with the situation.

Parameters

$string

string

The string

Returns

stringThe escaped string

Assemble part of a WHERE clause for doing full-text search

db_full_text_assemble(string $content, boolean $boolean) : string

Parameters

$content

string

Our match string (assumes "?" has been stripped already)

$boolean

boolean

Whether to do a boolean full text search

Returns

stringPart of a WHERE clause for doing full-text search

Get the ID of the first row in an auto-increment table (used whenever we need to reference the first).

db_get_first_id() : integer

Returns

integerFirst ID used

Find whether expression ordering support is present

db_has_expression_ordering(array $db) : boolean

Parameters

$db

array

A DB connection

Returns

booleanWhether it is

Find whether full-text-search is present

db_has_full_text(array $db) : boolean

Parameters

$db

array

A DB connection

Returns

booleanWhether it is

Find whether subquery support is present

db_has_subqueries(array $db) : boolean

Parameters

$db

array

A DB connection

Returns

booleanWhether it is

Generate SQL for a boolean search.

db_like_assemble(string $content, string $boolean_operator, boolean $full_coverage) : string

set AND OR

Parameters

$content

string

Boolean search string

$boolean_operator

string

Boolean operator to use

$full_coverage

boolean

Whether we can assume we require full coverage

Returns

stringThe SQL (may be blank)

Encode an SQL statement fragment for a conditional to see if two strings are equal.

db_string_equal_to(\ID_TEXT $attribute, string $compare) : string

Parameters

$attribute

\ID_TEXT

The attribute

$compare

string

The comparison

Returns

stringThe SQL

Encode an SQL statement fragment for a conditional to see if two strings are not equal.

db_string_not_equal_to(\ID_TEXT $attribute, string $compare) : string

Parameters

$attribute

\ID_TEXT

The attribute

$compare

string

The comparison

Returns

stringThe SQL

Remove an item from the general cache (most commonly used for blocks).

decache(\ID_TEXT $cached_for, \?array $identifier) 

Parameters

$cached_for

\ID_TEXT

The type of what we are cacheing (e.g. block name)

$identifier

\?array

A map of identifiying characteristics (NULL: no identifying characteristics, decache all)

Decrypt data using asymmetric encryption, and the site's private key (as unlocked by the given passphrase).

decrypt_data(string $data, string $passphrase) : string

A fatal error will occur if the passphrase is empty, the key cannot be found, or if decryption fails for whatever reason.

Parameters

$data

string

Data to be decrypted

$passphrase

string

Passphrase to unlock the site's private key

Returns

stringDecrypted data

Delete all the contents of a directory, and any subdirectories of that specified directory (recursively).

deldir_contents(\PATH $dir, boolean $default_preserve, boolean $just_files) 

Parameters

$dir

\PATH

The pathname to the directory to delete

$default_preserve

boolean

Whether to preserve files there by default

$just_files

boolean

Whether to just delete files

Delete attachments solely used by the specified hook.

delete_attachments(\ID_TEXT $type, \?object $connection) 

Parameters

$type

\ID_TEXT

The hook

$connection

\?object

The database connection to use (NULL: standard site connection)

Deletes a specified config option permanently from the database.

delete_config_option(\ID_TEXT $name) 

Parameters

$name

\ID_TEXT

The codename of the config option

Find what sessions are expired and delete them, and recover an existing one for $member if there is one.

delete_expired_sessions_or_recover(\?MEMBER $member) : \?AUTO_LINK

Parameters

$member

\?MEMBER

User to get a current session for (NULL: do not try, which guarantees a return result of NULL also)

Returns

\?AUTO_LINKThe session id we rebound to (NULL: did not rebind)

Delete the specified language entry from the translation table.

delete_lang(integer $id, \?object $connection) 

Parameters

$id

integer

The id

$connection

\?object

The database connection to use (NULL: standard site connection)

Delete a session.

delete_session(integer $session) 

Parameters

$session

integer

The new session

Delete a privilege, and every usergroup is then relaxed from the restrictions of this permission.

delete_specific_permission(\ID_TEXT $name) 

Parameters

$name

\ID_TEXT

The codename of the permission

Delete an uploaded file from disk, if it's URL has changed (i.e.

delete_upload(string $upload_path, \ID_TEXT $table, \ID_TEXT $field, mixed $id_field, mixed $id, \?string $new_url) 

it's been replaced, leaving a redundant disk file).

Parameters

$upload_path

string

The path to the upload directory

$table

\ID_TEXT

The table name

$field

\ID_TEXT

The table field name

$id_field

mixed

The table ID field name, or a map array

$id

mixed

The table ID

$new_url

\?string

The new URL to use (NULL: deleting without replacing: no change check)

Delete a situational value.

delete_value(\ID_TEXT $name) 

Parameters

$name

\ID_TEXT

The name of the value

preg_replace callback to de-shout text.

deshout_callback(array $matches) : string

Parameters

$matches

array

Matches

Returns

stringDe-shouted string

Remove ocPortal's strictness, to help integration of third-party code.

destrictify(boolean $change_content_type, boolean $mysql_too) 

Parameters

$change_content_type

boolean

Whether to also set the content type to plain-HTML

$mysql_too

boolean

Whether to destrictify MySQL commands over the ocPortal database driver

Run after-tests for debug mode, to make sure coding standards are met.

dev_mode_aftertests() 

Echo an error message, and a debug back-trace of the current execution stack.

die_html_trace(string $message) 

Use this for debugging purposes.

Parameters

$message

string

An error message

This will create a new tempcode object that is containing a single specifed directive

directive_tempcode(\ID_TEXT $directive, \tempcode $content, \?array $parameters) : \tempcode

Parameters

$directive

\ID_TEXT

The ID of the directive to use

$content

\tempcode

The contents

$parameters

\?array

Directive parameters (NULL: none)

Returns

\tempcodeA directive tempcode object

This will create a new tempcode object that is containing a single specifed directive

directive_tempcode(\ID_TEXT $directive, \tempcode $content, \?array $parameters) : \tempcode

Parameters

$directive

\ID_TEXT

The ID of the symbol to use

$content

\tempcode

The contents

$parameters

\?array

Directive parameters (NULL: none)

Returns

\tempcodeA directive tempcode object

Disable the PHP memory limit.

disable_php_memory_limit() 

Do not use this carelessly, use it if a screen is a bit fat or in an importer, don't use it assuming memory is infinite.

Display a time period of seconds in a tidy human-readable way.

display_seconds_period(integer $seconds) : string

Parameters

$seconds

integer

Number of seconds

Returns

stringHuman-readable period.

Display a time period in a tidy human-readable way.

display_time_period(integer $seconds) : string

Parameters

$seconds

integer

Number of seconds

Returns

stringHuman-readable period.

Show results of running a validation function.

display_validation_results(string $out, array $error, boolean $preview_mode, boolean $ret) : string

Parameters

$out

string

The data validated

$error

array

Error information

$preview_mode

boolean

Whether we are opening up an XHTML-fragment in a preview box

$ret

boolean

Whether to return Tempcode

Returns

stringReturned result (won't return it $ret is false)

Get the tempcode for a div.

div(\tempcode $tempcode, string $guid) : \tempcode

Similar to paragraph, but may contain more formatting (such as
's)

Parameters

$tempcode

\tempcode

The tempcode to put into a div

$guid

string

GUID for call

Returns

\tempcodeThe generated div with contents

Get the processed tempcode for the specified block.

do_block(\ID_TEXT $codename, \?array $map, \?integer $ttl) : \tempcode

Please note that you pass multiple parameters in as an array, but single parameters go in as a string or other flat variable.

Parameters

$codename

\ID_TEXT

The block name

$map

\?array

The block parameter map (NULL: no parameters)

$ttl

\?integer

The TTL to use in minutes (NULL: block default)

Returns

\tempcodeThe generated tempcode

Takes a string which is a PHP expression over $map (parameter map), and returns a derived identifier.

do_block_get_cache_identifier(mixed $cache_on, \?array $map) : \?LONG_TEXT

We see if we have something cached by looking for a matching identifier.

Parameters

$cache_on

mixed

PHP expression over $map (the parameter map of the block) OR a call_user_func specifier that will return a result (which will be used if cacheing is really very important, even for Hip Hop PHP)

$map

\?array

The block parameter map (NULL: no parameters)

Returns

\?LONG_TEXTThe derived cache identifier (NULL: the identifier is CURRENTLY null meaning cannot be cached)

Get the block object for a given block codename.

do_block_hunt_file(\ID_TEXT $codename, \?array $map) : mixed

Parameters

$codename

\ID_TEXT

The block name

$map

\?array

The block parameter map (NULL: no parameters)

Returns

mixedEither the block object, or the string output of a miniblock

Do a UTF8 conversion on the environmental GET/POST parameters.

do_environment_utf8_conversion(string $from_charset) 

Parameters

$from_charset

string

Charset that was used to encode the environmental data.

Get the tempcode for an image thumbnail.

do_image_thumb(\URLPATH $url, mixed $caption, boolean $js_tooltip, boolean $is_thumbnail_already, \?integer $width, \?integer $height) : \tempcode

Parameters

$url

\URLPATH

The URL to the image thumbnail

$caption

mixed

The caption for the thumbnail (string or Tempcode)

$js_tooltip

boolean

Whether to use a JS tooltip. Forcibly set to true if you pass Tempcode

$is_thumbnail_already

boolean

Whether already a thumbnail (if not, function will make one)

$width

\?integer

Thumbnail width to use (NULL: default)

$height

\?integer

Thumbnail height to use (NULL: default)

Returns

\tempcodeThe thumbnail

Get the human-readable form of a language id, or a language entry from a language INI file.

do_lang(\ID_TEXT $codename, \?mixed $token1, \?mixed $token2, \?mixed $token3, \?LANGUAGE_NAME $lang, boolean $require_result) : \?mixed

Parameters

$codename

\ID_TEXT

The language id

$token1

\?mixed

The first token [string or tempcode] (replaces {1}) (NULL: none)

$token2

\?mixed

The second token [string or tempcode] (replaces {2}) (NULL: none)

$token3

\?mixed

The third token (replaces {3}). May be an array of [of string], to allow any number of additional args (NULL: none)

$lang

\?LANGUAGE_NAME

The language to use (NULL: users language)

$require_result

boolean

Whether to cause ocPortal to exit if the lookup does not succeed

Returns

\?mixedThe human-readable content (NULL: not found). String normally. Tempcode if tempcode parameters.

This will create a new tempcode object that is containing a single specifed language code

do_lang_tempcode(\ID_TEXT $lang_string, \?mixed $token1, \?mixed $token2, \?mixed $token3) : \tempcode

Parameters

$lang_string

\ID_TEXT

The ID of the language string to use

$token1

\?mixed

The first token [string or tempcode] (replaces {1}) (NULL: none)

$token2

\?mixed

The second token [string or tempcode] (replaces {2}) (NULL: none)

$token3

\?mixed

The third token (replaces {3}). May be an array of [of string], to allow any number of additional args (NULL: none)

Returns

\tempcodeA language tempcode object

This will create a new tempcode object that is containing a single specifed language code

do_lang_tempcode(\ID_TEXT $symbol, \?mixed $token1, \?mixed $token2, \?mixed $token3) : \tempcode

Parameters

$symbol

\ID_TEXT

The ID of the symbol to use

$token1

\?mixed

The first token [string or tempcode] (replaces {1}) (NULL: none)

$token2

\?mixed

The second token [string or tempcode] (replaces {2}) (NULL: none)

$token3

\?mixed

The third token (replaces {3}). May be an array of [of string], to allow any number of additional args (NULL: none)

Returns

\tempcodeA language tempcode object

Do a UTF8 conversion on the environmental GET/POST parameters (ISO-8859-1 charset, which PHP supports internally).

do_simple_environment_utf8_conversion() 

This is it - the start of rendering of a website page.

do_site() 

Take in all inputs, sends them to the correct functions to process, gathers up all the outputs, sticks them together and echoes them.

Get a tempcoded version of a normal XHTML template.

do_template(\ID_TEXT $codename, \?array $parameters, \?LANGUAGE_NAME $lang, boolean $light_error, \?ID_TEXT $fallback, string $suffix, string $type, \?ID_TEXT $theme) : \tempcode

It is perhaps the most common ocPortal function to load up templates using do_template, and then attach them together either as parameters to each other, or via the tempcode attach method.

set templates css

Parameters

$codename

\ID_TEXT

The codename of the template being loaded

$parameters

\?array

A map of parameters for the template (key to value) (NULL: no parameters)

$lang

\?LANGUAGE_NAME

The language to load the template in (templates can embed language references) (NULL: users own language)

$light_error

boolean

Whether to not produce a stack dump if the template is missing

$fallback

\?ID_TEXT

Alternate template to use if the primary one does not exist (NULL: none)

$suffix

string

File type suffix of template file (e.g. .tpl)

$type

string

Subdirectory type to look in

$theme

\?ID_TEXT

Theme to use (NULL: current theme)

Returns

\tempcodeThe tempcode for this template

Get a tempcoded version of a normal XHTML template.

do_template(\ID_TEXT $codename, \?array $parameters, \?LANGUAGE_NAME $lang, boolean $light_error, \?ID_TEXT $fallback, string $suffix, string $type, \ID_TEXT $theme) : \tempcode

It is perhaps the most common ocPortal function to load up templates using do_template, and then attach them together either as parameters to each other, or via the tempcode attach method.

set templates css

Parameters

$codename

\ID_TEXT

The codename of the template being loaded

$parameters

\?array

A map of parameters for the template (key to value) (NULL: no parameters)

$lang

\?LANGUAGE_NAME

The language to load the template in (templates can embed language references) (NULL: users own language)

$light_error

boolean

Whether to not produce a stack dump if the template is missing

$fallback

\?ID_TEXT

Alternate template to use if the primary one does not exist (NULL: none)

$suffix

string

File type suffix of template file (e.g. .tpl)

$type

string

Subdirectory type to look in

$theme

\ID_TEXT

Theme to use

Returns

\tempcodeThe tempcode for this template

Takes the output from the scripts, and check the XHTML for validity, then echoes the page, plus the validation results.

do_xhtml_validation(string $out, boolean $display_regardless, integer $preview_mode, boolean $ret) : string

set 0 1 2

Parameters

$out

string

The XHTML to validate

$display_regardless

boolean

Display XHTML output regardless of whether there was an error or not

$preview_mode

integer

Whether we are opening up an XHTML-fragment in a preview box (0 means no, 1 means yes, 2 means we are asking for additional manual check information)

$ret

boolean

Whether to return Tempcode

Returns

stringReturned result (won't return it $ret is false)

Find whether the specified language exists.

does_lang_exist(\LANGUAGE_NAME $lang) : boolean

Parameters

$lang

\LANGUAGE_NAME

The language

Returns

booleanWhether the language exists

Evaluate a conventional tempcode variable, handling escaping

ecv(\LANGUAGE_NAME $lang, array $escaped, integer $type, \ID_TEXT $name, array $param) : mixed

set 0 2

Parameters

$lang

\LANGUAGE_NAME

The language to evaluate this symbol in (some symbols refer to language elements)

$escaped

array

Array of escaping operations

$type

integer

The type of symbol this is (TC_SYMBOL, TC_LANGUAGE_REFERENCE)

$name

\ID_TEXT

The name of the symbol

$param

array

Parameters to the symbol. For all but directive it is an array of strings. For directives it is an array of Tempcode objects. Actually there may be template-style parameters in here, as an influence of singular_bind and these may be Tempcode, but we ignore them.

Returns

mixedThe result. Either tempcode, or a string.

AJAX script for recording that something is currently being edited.

edit_ping_script() 

Get a value (either POST [u]or[/u] GET), or the default if neither can be found.

either_param(\ID_TEXT $name, \?mixed $default) : \?string

Parameters

$name

\ID_TEXT

The name of the parameter to get

$default

\?mixed

The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)

Returns

\?stringThe parameter value (NULL: missing)

This function is the integeric partner of either_param, as it returns the value as an integer.

either_param_integer(\ID_TEXT $name, \?mixed $default) : \?integer

You should always use integer specified versions when inputting integers, for the added security that type validation allows. If the value is of the wrong type, it indicates a hack attempt and will be logged.

Parameters

$name

\ID_TEXT

The name of the parameter to get

$default

\?mixed

The default value to give the parameter if the parameter value is not defined or the empty string (NULL: allow missing parameter) (false: give error on missing parameter)

Returns

\?integerThe parameter value (NULL: not set, and NULL given as default)

Shows an HTML page of all emoticons clickably.

emoticons_script() 

Encrypt some data using asymmetric encryption and the site's public key.

encrypt_data(string $data) : string

This will return the original data if encryption is disabled. It will add a magic marker to the start of the returned string to show it's been encrypted. A fatal error will occur if the public key cannot be found, or if encryption fails for whatever reason. Note that this will blindly re-encrypt data which has already been encrypted. You should check data with is_data_encrypted() first.

Parameters

$data

string

Data to be encrypted

Returns

stringEncrypted data, with magic marker

Only allow members here that are either the give member, admins, or have a privilege.

enforce_personal_access(\MEMBER $member_id, \?ID_TEXT $permission, \?ID_TEXT $permission2, \?MEMBER $member_viewing) 

All other members come up to an error message wall.

Parameters

$member_id

\MEMBER

The member who typically (i.e. when it's not an administrative override) we want the current member to be.

$permission

\?ID_TEXT

The override permission the current member must have (NULL: no general override).

$permission2

\?ID_TEXT

An alternative permission to the 'assume_any_member' permission (NULL: no override).

$member_viewing

\?MEMBER

The member who is doing the viewing (NULL: current member).

Make sure that the given URL contains a session if cookies are disabled.

enforce_sessioned_url(\URLPATH $url) : \URLPATH

NB: This is used for login redirection. It had to add the session id into the redirect url.

Parameters

$url

\URLPATH

The URL to enforce results in session persistence for the user

Returns

\URLPATHThe fixed URL (potentially nothing was done, depending on cookies)

Take some image/thumbnail info, and if needed make and caches a thumbnail, and return a thumb url whatever the situation.

ensure_thumbnail(\URLPATH $full_url, \URLPATH $thumb_url, \ID_TEXT $thumb_dir, \ID_TEXT $table, \AUTO_LINK $id, \ID_TEXT $thumb_field_name, \?integer $thumb_width) : \URLPATH

Parameters

$full_url

\URLPATH

The full URL to the image which will-be/is thumbnailed

$thumb_url

\URLPATH

The URL to the thumbnail (blank: no thumbnail yet)

$thumb_dir

\ID_TEXT

The directory, relative to the ocPortal install, where the thumbnails are stored. MINUS "_thumbs"

$table

\ID_TEXT

The name of the table that is storing what we are doing the thumbnail for

$id

\AUTO_LINK

The ID of the table record that is storing what we are doing the thumbnail for

$thumb_field_name

\ID_TEXT

The name of the table field where thumbnails are saved

$thumb_width

\?integer

The thumbnail width to use (NULL: default)

Returns

\URLPATHThe URL to the thumbnail

Convert some data from UTF to a character set PHP supports, using HTML entities where there's no direct match.

entity_utf8_decode(string $data, string $internal_charset) : \~string

Parameters

$data

string

Data to convert.

$internal_charset

string

Charset to convert to.

Returns

\~stringConverted data (false: could not convert).

Erase the language cache.

erase_cached_language() 

Erase all template caches (caches in all themes).

erase_cached_templates(boolean $preserve_some) 

Parameters

$preserve_some

boolean

Whether to preserve CSS and JS files that might be linked to between requests

Erase the Comcode cache.

erase_comcode_cache() 

Warning: This can take a long time on large sites, so is best to avoid.

Erase the comcode page cache

erase_comcode_page_cache() 

Erase the tempcode cache.

erase_tempcode_cache() 

Get the specified string, but with all characters escaped.

escape_html(mixed $string) : string

Parameters

$string

mixed

The input string

Returns

stringThe escaped string

Evaluate a conventional tempcode variable, handling escaping.

evaluate_conventional_variable(\LANGUAGE_NAME $lang, array $escaped, integer $type, \ID_TEXT $name, array $param) : mixed

Long named one, for compatibility (we've moved to short one for shorter compiled Tempcode). DEPRECATED.

set 0 2

Parameters

$lang

\LANGUAGE_NAME

The language to evaluate this symbol in (some symbols refer to language elements)

$escaped

array

Array of escaping operations

$type

integer

The type of symbol this is (TC_SYMBOL, TC_LANGUAGE_REFERENCE)

$name

\ID_TEXT

The name of the symbol

$param

array

Parameters to the symbol. For all but directive it is an array of strings. For directives it is an array of Tempcode objects. Actually there may be template-style parameters in here, as an influence of singular_bind and these may be Tempcode, but we ignore them.

Returns

mixedThe result. Either tempcode, or a string.

Get special SQL from POSTed parameters for a catalogue search field that is to be exact-matched.

exact_match_sql(array $row, integer $i, \ID_TEXT $type, \?string $param) : \?array

set short long

Parameters

$row

array

The row for the field to input

$i

integer

We're processing for the ith row

$type

\ID_TEXT

Table type

$param

\?string

Search term (NULL: lookup from environment)

Returns

\?arrayTuple of SQL details (array: extra trans fields to search, array: extra plain fields to search, string: an extra table segment for a join, string: the name of the field to use as a title, if this is the title, extra WHERE clause stuff) (NULL: nothing special)

Export ocPortal database tables to an equivalent XML format, automatically.

export_to_xml(\?array $tables, boolean $comcode_xml) : string

Parameters

$tables

\?array

List of tables to export (NULL: all tables except those skippable)

$comcode_xml

boolean

Whether to export Comcode as Comcode XML

Returns

stringExported data in XML format

Turn a full HTML document into an HTML fragment.

extract_html_body(string $html) : string

Parameters

$html

string

The document

Returns

stringThe fragment

Extract code to execute the requested functions with the requested parameters from the module at the given path.

extract_module_functions(\PATH $path, array $functions, \?array $params) : array

We used to actually load up the module, but it ate all our RAM when we did!

Parameters

$path

\PATH

The path to the module

$functions

array

Array of functions to be executing

$params

\?array

A list of parameters to pass to our functions (NULL: none)

Returns

arrayA list of pieces of code to do the equivalent of executing the requested functions with the requested parameters

Extract code to execute the requested functions with the requested parameters from the module requested.

extract_module_functions_page(\ID_TEXT $zone, \ID_TEXT $page, array $functions, \?array $params) : array

Parameters

$zone

\ID_TEXT

The zone it is in

$page

\ID_TEXT

The page name

$functions

array

Array of functions to be executing

$params

\?array

A list of parameters to pass to our functions (NULL: none)

Returns

arrayA list of pieces of code to do the equivalent of executing the requested functions with the requested parameters

Extract the info function from a module at a given path.

extract_module_info(\PATH $path) : \?array

Parameters

$path

\PATH

The path to the module

Returns

\?arrayA module information map (NULL: module contains no info method)

This function is called when no other language works, and it will return the original default language - 'EN'.

fallback_lang() : \LANGUAGE_NAME

You may change this to another language, but this is not advised, as ocPortal is being shipped with the EN language complete and unabridged as standard - hence you cannot go wrong if you leave it as EN. In theory, this is the only hook to English that there is.

Returns

\LANGUAGE_NAMEThe fallback language

If possible dump the user to 100% static caching.

fast_spider_cache(boolean $bot) 

Parameters

$bot

boolean

Whether to cache as a bot

The PHP uniqid function is slow on some PHP versions.

fast_uniqid() : string

This version is much faster.

Returns

stringUnique Identifier

Do a fatal exit, echo the header (if possible) and an error message, followed by a debugging back-trace.

fatal_exit(mixed $text) 

It also adds an entry to the error log, for reference.

Parameters

$text

mixed

The error message (string or tempcode)

Get the contents of a file.

file_get_contents(\SHORT_TEXT $filename) : \~LONG_TEXT

Parameters

$filename

\SHORT_TEXT

The file name.

Returns

\~LONG_TEXTThe file contents (false: error).

Return the output from the conversion between filesize and TAR block size.

file_size_to_tar_block_size(integer $size) : integer

Parameters

$size

integer

The file size of a file that would be inside the TAR archive

Returns

integerThe block size TAR would use to store this file

Filter out any CSS selector blocks from the given CSS if they definitely do not affect the given (X)HTML.

filter_css(string $css, string $context) : string

Whilst this is a clever algorithm, it isn't so clever as to actually try and match each selector against a DOM tree. If any segment of a compound selector matches, match is assumed.

Parameters

$css

string

CSS

$context

string

(X)HTML context under which CSS is filtered

Returns

stringFiltered CSS

Filter to alter form field values based on fields.xml.

filter_form_field_default(string $name, \?string $val) : string

Usually a no-op.

Parameters

$name

string

The name of the parameter

$val

\?string

The current value of the parameter (NULL: none)

Returns

stringThe filtered value of the parameter

Find which of a list of usergroups are permissive ones.

filter_group_permissivity(array $groups) : array

Parameters

$groups

array

List of groups to filter

Returns

arrayList of permissive groups, filtered from those given

Get the parameter put into it, with no changes.

filter_naughty(string $in, boolean $preg) : string

If it detects that the parameter is naughty (i.e malicious, and probably from a hacker), it will log the hack-attack and output an error message. This function is designed to be called on parameters that will be embedded in a path, and defines malicious as trying to reach a parent directory using '..'. All file paths in ocPortal should be absolute

Parameters

$in

string

String to test

$preg

boolean

Whether to just filter out the naughtyness

Returns

stringSame as input string

This function is similar to filter_naughty, except it requires the parameter to be strictly alphanumeric.

filter_naughty_harsh(string $in, boolean $preg) : string

It is intended for use on text that will be put into an eval.

Parameters

$in

string

String to test

$preg

boolean

Whether to just filter out the naughtyness

Returns

stringSame as input string

Get an array of all the blocks that are currently installed (miniblocks not included).

find_all_blocks() : array

Returns

arrayMap of all blocks (name->[sources/sources_custom])

Get an array of all the hook implementations for a hook class.

find_all_hooks(\ID_TEXT $type, \ID_TEXT $entry) : array

set blocks modules systems

Parameters

$type

\ID_TEXT

The type of hook

$entry

\ID_TEXT

The hook class to find hook implementations for (e.g. the name of a module)

Returns

arrayA map of hook implementation name to [sources|sources_custom]

Get an array of all the installed languages that can be found in root/lang/ and root/lang_custom/

find_all_langs(boolean $even_empty_langs) : array

Parameters

$even_empty_langs

boolean

Whether to even find empty languages

Returns

arrayThe installed languages (map, lang=>type)

Get an array of all the modules.

find_all_modules(\ID_TEXT $zone) : array

Parameters

$zone

\ID_TEXT

The zone name

Returns

arrayA map of page name to type (modules_custom, etc)

Get an array of all the pages of the specified type (module, etc) and extension (for small sites everything will be returned, for larger ones it depends on the show method).

find_all_pages(\ID_TEXT $zone, \ID_TEXT $type, string $ext, boolean $keep_ext_on, \?TIME $cutoff_time, integer $show_method) : array

set modules modules_custom comcode comcode_custom html html_custom
set 0 1 2

Parameters

$zone

\ID_TEXT

The zone name

$type

\ID_TEXT

The type

$ext

string

The file extension to limit us to (without a dot)

$keep_ext_on

boolean

Whether to leave file extensions on the page name

$cutoff_time

\?TIME

Only show pages newer than (NULL: no restriction)

$show_method

integer

Selection algorithm constant

Returns

arrayA map of page name to type (modules_custom, etc)

Get an array of all the pages everywhere in the zone, limited by the selection algorithm (for small sites everything will be returned, for larger ones it depends on the show method).

find_all_pages_wrap(\ID_TEXT $zone, boolean $keep_ext_on, boolean $consider_redirects, integer $show_method, \?ID_TEXT $page_type) : array

set 0 1 2

Parameters

$zone

\ID_TEXT

The zone name

$keep_ext_on

boolean

Whether to leave file extensions on the page name

$consider_redirects

boolean

Whether to take redirects into account

$show_method

integer

Selection algorithm constant

$page_type

\?ID_TEXT

Page type to show (NULL: all)

Returns

arrayA map of page name to type (modules_custom, etc)

Find a list of all the tables that can be imported/exported as XML.

find_all_xml_tables() : array

Returns

arrayList of tables

Find the installed zones, up to the first $max installed

find_all_zones(boolean $search, boolean $get_titles, boolean $force_all, integer $start, integer $max) : array

Parameters

$search

boolean

Whether to search the file system and return zones that might not be fully in the system (otherwise will just use the database)

$get_titles

boolean

Whether to get titles for the zones as well. Only if !$search

$force_all

boolean

Whether to insist on getting all zones (there could be thousands in theory...)

$start

integer

Start position to get results from

$max

integer

Maximum zones to get

Returns

arrayA list of zone names / a list of quartets (name, title, show in menu, default page)

Find the cache-on parameters for 'codename's cacheing style (prevents us needing to load up extra code to find it).

find_cache_on(\ID_TEXT $codename) : \?array

Parameters

$codename

\ID_TEXT

The codename of what will be checked for cacheing

Returns

\?arrayThe cached result (NULL: no cached result)

Find the textual moniker for a typical ocPortal URL path.

find_id_moniker(array $url_parts) : \?string

This will be called from inside build_url, based on details learned from a moniker hook (only if a hook exists to hint how to make the requested link SEO friendly).

Parameters

$url_parts

array

The URL component map (must contain 'page', 'type', and 'id' if this function is to do anything).

Returns

\?stringThe moniker ID (NULL: could not find)

Search the database to find human-readable names for language IDs.

find_lang_content_names(array $ids) : array

Parameters

$ids

array

The language IDs (array of AUTO_LINK)

Returns

arrayHuman readable names (List of string against same IDs in input array or null for orphan strings)

An option has dissappeared somehow - find it via searching our code-base for it's install code.

find_lost_option(\ID_TEXT $name) 

It doesn't get returned, just loaded up. This function will produce a fatal error if we cannot find it.

Parameters

$name

\ID_TEXT

The name of the value

AJAX script for finding out privileges for the queried resource.

find_permissions_script() 

Find path to the PHP executable.

find_php_path() : \PATH

Returns

\PATHPath to PHP

Find the URL to a certain external handler script (ocPortal allows these to be moved around between zones, to suit site .htaccess requirements).

find_script(string $name, boolean $append_keep, integer $base_url_code) : \URLPATH

set 0 1 2

Parameters

$name

string

The codename of the needed script

$append_keep

boolean

Whether to append keep variables

$base_url_code

integer

Code representing what base URL type to use (0=guess, 1=http, 2=https)

Returns

\URLPATHThe URL to the script

Get a results table showing security alerts matching WHERE constraints.

find_security_alerts(\?array $where) : \tempcode

Parameters

$where

\?array

WHERE constraints (NULL: none)

Returns

\tempcodeThe results table

Finds the path of the given template codename.

find_template_path(\ID_TEXT $name) : \?PATH

Parameters

$name

\ID_TEXT

The template codename

Returns

\?PATHA path (NULL: no such template)

Search for a template.

find_template_place(\ID_TEXT $codename, \?LANGUAGE_NAME $lang, \ID_TEXT $theme, string $suffix, string $type) : \?array

set templates css

Parameters

$codename

\ID_TEXT

The codename of the template being loaded

$lang

\?LANGUAGE_NAME

The language to load the template in (templates can embed language references) (NULL: users own language)

$theme

\ID_TEXT

The theme to use

$suffix

string

File type suffix of template file (e.g. .tpl)

$type

string

Subdirectory type to look in

Returns

\?arrayList of parameters needed for the _do_template function to be able to load the template (NULL: could not find the template)

Convert a template tree structure into a HTML representation.

find_template_tree_nice(\ID_TEXT $codename, array $children, boolean $fresh, boolean $cache_started) : string

Parameters

$codename

\ID_TEXT

The codename of the current template item in the recursion

$children

array

The template tree structure for children

$fresh

boolean

Whether the template tree came from a cache (if so, we can take some liberties with it's presentation)

$cache_started

boolean

As $fresh, except something underneath at any unknown point did come from the cache, so this must have by extension

Returns

stringHTML representation

Find the URL to the theme image of the specified ID.

find_theme_image(\ID_TEXT $id, boolean $silent_fail, boolean $leave_local, \?ID_TEXT $theme, \?LANGUAGE_NAME $lang, \?object $db, boolean $pure_only) : \URLPATH

It searches various priorities, including language and theme overrides.

Parameters

$id

\ID_TEXT

The theme image ID

$silent_fail

boolean

Whether to silently fail (i.e. not give out an error message when a theme image cannot be found)

$leave_local

boolean

Whether to leave URLs as relative local URLs

$theme

\?ID_TEXT

The theme to search in (NULL: users current theme)

$lang

\?LANGUAGE_NAME

The language to search for (NULL: users current language)

$db

\?object

The database to use (NULL: site database)

$pure_only

boolean

Whether to only search the default 'images' filesystem

Returns

\URLPATHThe URL found (blank: not found)

Make a value suitable for use in an XML ID.

fix_id(string $param) : string

Parameters

$param

string

The value to escape

Returns

stringThe escaped value

Ensure that the specified file/folder is writeable for the FTP user (so that it can be deleted by the system), and should be called whenever a file is uploaded/created, or a folder is made.

fix_permissions(\PATH $path, integer $perms) 

We call this function assuming we are giving world permissions

Parameters

$path

\PATH

The full pathname to the file/directory

$perms

integer

The permissions to make (not the permissions are reduced if the function finds that the file is owned by the web user [doesn't need world permissions then])

Sometimes users don't enter full URLs but do intend for them to be absolute.

fixup_protocolless_urls(\URLPATH $in) : \URLPATH

This code tries to see what relative URLs are actually absolute ones, via an algorithm. It then fixes the URL.

Parameters

$in

\URLPATH

The URL to fix

Returns

\URLPATHThe fixed URL (or original one if no fix was needed)

Turn an array into a humanely readable string.

flatten_slashed_array(array $array) : string

Parameters

$array

array

Array to convert

Returns

stringA humanely readable version of the array.

Format the given float number as a nicely formatted string.

float_format(float $val, integer $frac_digits) : string

Parameters

$val

float

The value to format

$frac_digits

integer

The number of fractional digits

Returns

stringNicely formatted string

Convert a float to a "technical string representation of a float".

float_to_raw_string(float $num, integer $decs_wanted, boolean $only_needed_decs) : string

Parameters

$num

float

The number

$decs_wanted

integer

The number of decimals to keep

$only_needed_decs

boolean

Whether to trim trailing zeros

Returns

stringThe string converted

Make sure that the AFM connection details have been posted.

force_have_afm_details() 

If not, get them and loop back.

Force an HTTP authentication login box / relay it as if it were a posted login.

force_httpauth() 

This function is rarely used.

Get a form for inputting unknown variables within a filter.

form_for_ocselect(string $filter, \?array $labels, \?ID_TEXT $content_type, \?array $types) : array

Parameters

$filter

string

String-based search filter (blank: make one up to cover everything, but only works if $table is known)

$labels

\?array

Labels for field names (NULL: none, use auto-generated)

$content_type

\?ID_TEXT

Content-type to auto-probe from (NULL: none, use string inputs)

$types

\?array

Field types (NULL: none, use string inputs / defaults for table)

Returns

arrayThe form fields, The modded filter, Merger links

Get the tempcode for a hidden form element.

form_input_hidden(\ID_TEXT $name, string $value) : \tempcode

Parameters

$name

\ID_TEXT

The name which this input field is for

$value

string

The value for this input field

Returns

\tempcodeThe input field

Get the tempcode for a list entry.

form_input_list_entry(string $value, boolean $selected, mixed $text, boolean $red, boolean $disabled) : \tempcode

(You would gather together the outputs of several of these functions, then put them in as the $content in a form_input_list function call).

Parameters

$value

string

The value for this entry

$selected

boolean

Whether this entry is selected by default or not

$text

mixed

The text associated with this choice (blank: just use name for text)

$red

boolean

Whether this entry will be put as red (marking it as important somehow)

$disabled

boolean

Whether this list entry is disabled (like a header in a list)

Returns

\tempcodeThe input field

Get the tempcode for a group of list entry.

form_input_list_group(mixed $title, \tempcode $entries) : \tempcode

May be attached directly to form_input_list_entry (i.e. this is a group node in a shared tree), and also fed into form_input_list.

Parameters

$title

mixed

The title for the group

$entries

\tempcode

List entries for group

Returns

\tempcodeThe group

Send the posted form over email to the staff address.

form_to_email(\?string $subject, string $intro, \?array $fields, \?string $to_email) 

Parameters

$subject

\?string

The subject of the email (NULL: from posted subject parameter).

$intro

string

The intro text to the mail.

$fields

\?array

A map of fields to field titles to transmit. (NULL: all posted fields, except subject and email)

$to_email

\?string

Email address to send to (NULL: look from post environment / staff address).

Entry script to process a form that needs to be emailed.

form_to_email_entry_script() 

Convert text to an entity format via unicode, compatible with the GD TTF functions.

foxy_utf8_to_nce(string $data) : string

Originally taken from php manual but heavily modified. Passed text is assumed to be in the get_charset() character set.

Parameters

$data

string

Input text.

Returns

stringOutput 7-bit unicode-entity-encoded ASCII text.

Find whether a fractional edit is underway.

fractional_edit() : boolean

Returns

booleanWhether a fractional edit is underway

AJAX script to make a fractional edit to some data.

fractional_edit_script() 

FTP: Change a file's permissions.

ftp_chmod(resource $conn, integer $access, \PATH $path) 

Parameters

$conn

resource

The FTP connection.

$access

integer

The permissions desired.

$path

\PATH

The file path.

Script to make a nice textual image.

gd_text_script() 

Highlight keywords in an extracted portion of a piece of text.

generate_text_summary(string $_temp_summary, array $words_searched) : string

Parameters

$_temp_summary

string

What was searched

$words_searched

array

List of words searched

Returns

stringHighlighted portion

Find the country an IP address long is located in

geolocate_ip(\?IP $ip) : \?string

Parameters

$ip

\?IP

The IP to geolocate (NULL: current user's IP)

Returns

\?stringThe country initials (NULL: unknown)

Force an AFM login.

get_afm_form() 

Get the fields that need to be filled in to know how to do an AFM connection.

get_afm_form_fields() : \tempcode

Returns

\tempcodeThe form fields.

Get the base url (the minimum fully qualified URL to our installation).

get_base_url(\?boolean $https, \?ID_TEXT $zone_for) : \URLPATH

Parameters

$https

\?boolean

Whether to get the HTTPS base URL (NULL: do so only if the current page uses the HTTPS base URL)

$zone_for

\?ID_TEXT

The zone the link is for (NULL: root zone)

Returns

\URLPATHThe base-url

Gets parameters for a block

get_block_parameters(\ID_TEXT $block) : array

Parameters

$block

\ID_TEXT

The name of the block to get parameters for

Returns

arrayA list of parameters the block takes

Get the name of a webcrawler bot, or NULL if no bot detected

get_bot_type() : \?string

Returns

\?stringWebcrawling bot name (NULL: not a bot)

Get a string of the users web browser

get_browser_string() : string

Returns

stringThe web browser string

Find the cached result of what is named by codename and the further constraints.

get_cache_entry(\ID_TEXT $codename, \LONG_TEXT $cache_identifier, integer $ttl, boolean $tempcode, boolean $caching_via_cron, \?array $map) : \?mixed

Parameters

$codename

\ID_TEXT

The codename to check for cacheing

$cache_identifier

\LONG_TEXT

The further restraints (a serialized map)

$ttl

integer

The TTL for the cache entry

$tempcode

boolean

Whether we are cacheing Tempcode (needs special care)

$caching_via_cron

boolean

Whether to defer caching to CRON. Note that this option only works if the block's defined cache signature depends only on $map (timezone and bot-type are automatically considered)

$map

\?array

Parameters to call up block with if we have to defer caching (NULL: none)

Returns

\?mixedThe cached result (NULL: no cached result)

Gather the permissions for the specified category as a form field input matrix.

get_category_permissions_for_environment(\ID_TEXT $module, \ID_TEXT $category, \?ID_TEXT $page, \?tempcode $help, boolean $new_category, \?tempcode $pinterface_view) : \tempcode

Parameters

$module

\ID_TEXT

The ID code for the module being checked for category access

$category

\ID_TEXT

The ID code for the category being checked for access (often, a number cast to a string)

$page

\?ID_TEXT

The page this is for (NULL: current page)

$help

\?tempcode

Extra help to show in interface (NULL: none)

$new_category

boolean

Whether this is a new category (don't load permissions, default to on)

$pinterface_view

\?tempcode

Label for view permissions (NULL: default)

Returns

\tempcodeThe form field matrix

Get the character set to use.

get_charset() : string

We try and be clever to allow AJAX scripts to avoid loading up language

Returns

stringThe character set

Get the list of files that need CHmodding for write access.

get_chmod_array() : array

Returns

arrayThe list of files

Find the zone a comcode page is in.

get_comcode_zone(\ID_TEXT $page_name, boolean $error) : \?ID_TEXT

Parameters

$page_name

\ID_TEXT

The comcode page name to find

$error

boolean

Whether ocPortal should bomb out if the page was not found

Returns

\?ID_TEXTThe zone the comcode page is in (NULL: missing)

Function to get a base URL for an OCF relative-URL.

get_complex_base_url(\URLPATH $at) : \URLPATH

The situation is complex as it needs to take into account OCF multi-site-network's, locally defined theme images, and shared-installs (myocp style).

Parameters

$at

\URLPATH

Short base URL we need to probe

Returns

\URLPATHThe appropriate base-url

Get the base url (the minimum fully qualified URL to our personal data installation).

get_custom_base_url(\?boolean $https) : \URLPATH

For a shared install only, this is different to the base-url.

Parameters

$https

\?boolean

Whether to get the HTTPS base URL (NULL: do so only if the current page uses the HTTPS base URL)

Returns

\URLPATHThe base-url

Get the file base for your installation of ocPortal.

get_custom_file_base() : \PATH

For a shared install only, this is different to the base-url.

Returns

\PATHThe file base, without a trailing slash

Get the name of the forum database.

get_db_forums() : string

Returns

stringThe forum database site

Get the host of the forum database ('localhost', for example).

get_db_forums_host() : string

Returns

stringThe database host

Get the forum database password.

get_db_forums_password() : string

Returns

stringThe forum database password

Get the forum database username.

get_db_forums_user() : string

Returns

stringThe forum database username

Returns a list of keywords for all databases we might some day support.

get_db_keywords() : array

Returns

arrayList of pairs

Get the name of the database.

get_db_site() : string

Returns

stringThe database site

Get the host of the database ('localhost', for example).

get_db_site_host() : string

Returns

stringThe database host

Get the database password.

get_db_site_password() : string

Returns

stringThe database password

Get the database username.

get_db_site_user() : string

Returns

stringThe database username

Get the type of database installed, such as MySQL, or Oracle.

get_db_type() : string

Returns

stringThe database type

Get the contents of a directory, recursively.

get_directory_contents(\PATH $path, \PATH $rel_path, boolean $special_too, boolean $recurse, boolean $files_wanted) : array

It is assumed that the directory exists.

Parameters

$path

\PATH

The path to search

$rel_path

\PATH

The path we prepend to everything we find (intended to be used inside the recursion)

$special_too

boolean

Whether to also get special files

$recurse

boolean

Whether to recurse (if not, will return directories as files)

$files_wanted

boolean

Whether to get files (if not, will return directories as files)

Returns

arrayThe contents of the directory

Get the size in bytes of a directory.

get_directory_size(\PATH $path, boolean $recurse) : integer

It is assumed that the directory exists.

Parameters

$path

\PATH

The path to search

$recurse

boolean

Whether to recurse (if not, will return directories as files)

Returns

integerThe extra space requested

Get the domain the website is installed on (preferably, without any www).

get_domain() : string

The domain is used for e-mail defaults amongst other things.

Returns

stringThe domain of the website

Get meta data from an image, using EXIF primarily, but also XMP and IPTC to get image descriptions.

get_exif_data(\PATH $path, \?string $filename) : array

Also gets GPS data and canonicalises in decimal as Latitude and Longitude.

Parameters

$path

\PATH

This is the path of the photo which may contain metadata

$filename

\?string

This is the original filename of the photo which may contain metadata (NULL: derive from path)

Returns

arrayMap of meta data, using standard EXIF naming

Attempt to retrieve a caption from photos seeking XMP, then EXIF, then IPTC binary last.

get_exif_image_caption(\PATH $path, string $filename) : string

Check this file is a valid image file before passing to this function as an empty string often annoys.

Parameters

$path

\PATH

This is the path of the photo which may contain metadata

$filename

string

This is the original filename of the photo which may contain metadata

Returns

stringWhichever caption is found

Returns a list of pairs, for which permissions are false by default for ordinary usergroups.

get_false_permissions() : array

Returns

arrayList of pairs

Get the file base for your installation of ocPortal

get_file_base() : \PATH

Returns

\PATHThe file base, without a trailing slash

Get the file extension of the specified file.

get_file_extension(string $name) : string

It returns without a dot.

Parameters

$name

string

The filename

Returns

stringThe filename extension (no dot)

Get a formatted-string filesize for the specified file.

get_file_size(\URLPATH $url) : string

It is formatted as such: x Mb/Kb/Bytes (or unknown). It is assumed that the file exists.

Parameters

$url

\URLPATH

The URL that the file size of is being worked out for. Should be local.

Returns

stringThe formatted-string file size

Get the XHTML for the flagrant text message.

get_flagrant() : \tempcode

Returns

\tempcodeThe flagrant text message

Get the installed forum base URL.

get_forum_base_url(boolean $forum_base) : \URLPATH

Parameters

$forum_base

boolean

Whether to get the base directory of the forum. Unless running OCF, this makes no difference - if possibly running OCF, you need to think about this parameter: are you trying to reach the MSN-central-site or just a link to the forums?

Returns

\URLPATHThe installed forum base URL

Get the type of forums installed.

get_forum_type() : string

Returns

stringThe type of forum installed

Find the MD5 hash of the space-stripped copy of function within the given code.

get_function_hash(string $code, string $function) : \MD5

Parameters

$code

string

The code.

$function

string

Name of the function.

Returns

\MD5The MD5 hash (blank: no such function).

Get information about new versions of ocPortal (or more accurately, what's wrong with this version).

get_future_version_information() : \tempcode

Returns

\tempcodeInformation about the installed ocPortal version

Get the version number of GD on the system.

get_gd_version() : float

It should only be called if GD is known to be on the system, and in use

Returns

floatThe version of GD installed

Return a debugging back-trace of the current execution stack.

get_html_trace() : \tempcode

Use this for debugging purposes.

Returns

\tempcodeDebugging backtrace

Check a POST inputted date for validity, and get the Unix timestamp for the inputted date.

get_input_date(\ID_TEXT $stub, boolean $get_also) : \?TIME

Parameters

$stub

\ID_TEXT

The stub of the parameter name (stub_year, stub_month, stub_day, stub_hour, stub_minute)

$get_also

boolean

Whether to allow over get parameters also

Returns

\?TIMEThe timestamp of the date (NULL: no input date was chosen)

Attempt to get the IP address of the current user

get_ip_address(integer $amount) : \IP

set 1 2 3 4

Parameters

$amount

integer

The number of groups to include in the IP address (rest will be replaced with *'s). For IP6, this is doubled.

Returns

\IPThe users IP address (blank: could not find a valid one)

Get the current language.

get_lang(\?MEMBER $member) : \LANGUAGE_NAME

First it tries to get the GET or POST language values, then it tries the user's language, then site default, then it resorts to EN.

Parameters

$member

\?MEMBER

The member id (NULL: site default language, although better just to call get_site_default_lang directly)

Returns

\LANGUAGE_NAMEThe current language

Get the closest fit language code to what the browser is requesting.

get_lang_browser() : \?LANGUAGE_NAME

Returns

\?LANGUAGE_NAMEThe closest-fit language to what the browser wants (NULL: browser doesn't ask)

Get an array of all the INI description entries in the specified language.

get_lang_file_descriptions(\LANGUAGE_NAME $lang, \?ID_TEXT $file) : array

Parameters

$lang

\LANGUAGE_NAME

The language

$file

\?ID_TEXT

The language file (NULL: all non-custom language files)

Returns

arrayThe language descriptions

Get an array of all the INI language entries in the specified language.

get_lang_file_map(\LANGUAGE_NAME $lang, \ID_TEXT $file, boolean $non_custom) : array

Parameters

$lang

\LANGUAGE_NAME

The language

$file

\ID_TEXT

The language file

$non_custom

boolean

Force usage of original file

Returns

arrayThe language entries

Get a list of languages files for the given language.

get_lang_files(\?LANGUAGE_NAME $lang) : array

ONLY those that are overridden.

Parameters

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

Returns

arrayThe language files

Get what language the given member uses.

get_lang_forum_user(\MEMBER $member) : \?LANGUAGE_NAME

The language is sent through a mapping to ensure it is in the right format, or dumped if it will not map.

Parameters

$member

\MEMBER

The member id

Returns

\?LANGUAGE_NAMEThe language used by the member (NULL: the language will not map)

Get the title for a language.

get_language_title(\LANGUAGE_NAME $lang) : string

Parameters

$lang

\LANGUAGE_NAME

The language to have selected by default

Returns

stringThe language title

Get Tempcode for tags, based on loaded up from SEO keywords (seo_meta_load_for).

get_loaded_tags(\?ID_TEXT $limit_to, \?array $the_tags) : \tempcode

Parameters

$limit_to

\?ID_TEXT

The search code for this tag content (e.g. downloads) (NULL: there is none)

$the_tags

\?array

Explicitly pass a list of tags instead (NULL: use loaded ones)

Returns

\tempcodeLoaded tag output (or blank if there are none)

Get the relative URL to the logo for the current zone.

get_logo_url(\?ID_TEXT $zone_name) : \URLPATH

Parameters

$zone_name

\?ID_TEXT

The zone being operated within (NULL: auto-detect)

Returns

\URLPATHThe relative URL to the logo for the current zone

Find a specified long value.

get_long_value(\ID_TEXT $name) : \?SHORT_TEXT

Long values are either really long strings, or just ones you don't want on each page load (i.e. it takes a query to read them, because you don't always need them).

Parameters

$name

\ID_TEXT

The name of the value

Returns

\?SHORT_TEXTThe value (NULL: value not found)

Find the specified configuration option if it is younger than a specified time.

get_long_value_newer_than(\ID_TEXT $name, \TIME $cutoff) : \?SHORT_TEXT

Parameters

$name

\ID_TEXT

The name of the value

$cutoff

\TIME

The cutoff time (an absolute time, not a relative "time ago")

Returns

\?SHORT_TEXTThe value (NULL: value newer than not found)

Get the maximum allowed upload filesize, as specified in the configuration

get_max_file_size(\?MEMBER $source_member, \?object $connection) : integer

Parameters

$source_member

\?MEMBER

Member we consider quota for (NULL: do not consider quota)

$connection

\?object

Database connection to get quota from (NULL: site DB)

Returns

integerThe maximum allowed upload filesize, in bytes

Get the maximum allowed image size, as set in the configuration.

get_max_image_size() : integer

Returns

integerThe maximum image size

Get the ID of the currently active member.

get_member(boolean $quick_only) : \MEMBER

It see's if the session exists / cookie is valid -- and gets the member id accordingly

Parameters

$quick_only

boolean

Whether to just do a quick check, don't establish new sessions

Returns

\MEMBERThe member requesting this web page (possibly the guest member - which strictly speaking, is not a member)

Get a map of members viewing the specified ocPortal location.

get_members_viewing(\?ID_TEXT $page, \?ID_TEXT $type, \?SHORT_TEXT $id, boolean $forum_layer) : \?array

Parameters

$page

\?ID_TEXT

The page they need to be viewing (NULL: don't care)

$type

\?ID_TEXT

The page-type they need to be viewing (NULL: don't care)

$id

\?SHORT_TEXT

The type-id they need to be viewing (NULL: don't care)

$forum_layer

boolean

Whether this has to be done over the forum driver (multi site network)

Returns

\?arrayA map of member-ids to rows about them (NULL: Too many)

Find the mime type for the given file extension.

get_mime_type(string $extension) : string

It does not take into account whether the file type has been white-listed or not, and returns a binary download mime type for any unknown extensions.

Parameters

$extension

string

The file extension (no dot)

Returns

stringThe MIME type

Get a list of overridable SP's for a module.

get_module_overridables(\ID_TEXT $zone, \ID_TEXT $page) : array

Parameters

$zone

\ID_TEXT

The zone it is in

$page

\ID_TEXT

The page name

Returns

arrayA pair: List of overridable SP's, SP-page

Find the zone a page is in.

get_module_zone(\ID_TEXT $module_name, \ID_TEXT $type, \?string $dir2, string $ftype, boolean $error) : \?ID_TEXT

Parameters

$module_name

\ID_TEXT

The page name to find

$type

\ID_TEXT

The type of the page we are looking for

$dir2

\?string

The special subcategorisation of page we are looking for (e.g. 'EN' for a comcode page) (NULL: none)

$ftype

string

The file extension for the page type

$error

boolean

Whether ocPortal should bomb out if the page was not found

Returns

\?ID_TEXTThe zone the page is in (NULL: not found)

Get the largest amount of users ever to be on the site at the same time.

get_num_users_peak() : integer

Returns

integerThe number of peak users

Get the number of users on the site in the last 5 minutes.

get_num_users_site() : integer

The function also maintains the statistic via the sessions table.

Returns

integerThe number of users on the site

Get the value of a special 'ocp_' custom profile field.

get_ocp_cpf(\ID_TEXT $cpf, \?MEMBER $member) : string

For OCF it can also do it for a pure field title, e.g. "Example Field".

Parameters

$cpf

\ID_TEXT

The CPF name stem

$member

\?MEMBER

Member to lookup for (NULL: current member)

Returns

stringThe value (blank: has a blank value, or does not exist)

Get database rows of all the online members.

get_online_members(boolean $longer_time, \?MEMBER $filter, integer $count) : \?array

Parameters

$longer_time

boolean

Whether to use a longer online-time -- the session expiry-time

$filter

\?MEMBER

We really only need to make sure we get the status for this user, although at this functions discretion more may be returned and the row won't be there if the user is not online (NULL: no filter). May not be the guest ID

$count

integer

The total online members, returned by reference

Returns

\?arrayDatabase rows (NULL: too many)

Find the value of the specified configuration option.

get_option(\ID_TEXT $name, boolean $missing_ok) : \?SHORT_TEXT

Parameters

$name

\ID_TEXT

The name of the option

$missing_ok

boolean

Where to accept a missing option (and return NULL)

Returns

\?SHORT_TEXTThe value (NULL: either null value, or no option found whilst $missing_ok set)

Get the user's operating system

get_os_string() : string

Returns

stringThe operating system string

Get the name of the current page

get_page_name() : \ID_TEXT

Returns

\ID_TEXTThe current page name

Gather the permissions for the specified page as form field inputs.

get_page_permissions_for_environment(\ID_TEXT $zone, \ID_TEXT $page, \?tempcode $help) : \tempcode

Parameters

$zone

\ID_TEXT

The ID code for the zone

$page

\ID_TEXT

The ID code for the page

$help

\?tempcode

Extra help to show in interface (NULL: none)

Returns

\tempcodeThe form fields

A page is not validated, so show a warning.

get_page_warning_details(\ID_TEXT $zone, \ID_TEXT $codename, \tempcode $edit_url) : \tempcode

Parameters

$zone

\ID_TEXT

The zone the page is being loaded from

$codename

\ID_TEXT

The codename of the page

$edit_url

\tempcode

The edit URL (blank if no edit access)

Returns

\tempcodeThe warning

Find the zone a page is in.

get_page_zone(\ID_TEXT $page_name, boolean $error) : \?ID_TEXT

Parameters

$page_name

\ID_TEXT

The page name to find

$error

boolean

Whether ocPortal should bomb out if the page was not found

Returns

\?ID_TEXTThe zone the page is in (NULL: missing)

Get the value of the specified GET key, if it is found, or the default otherwise.

get_param(\ID_TEXT $name, \?mixed $default, boolean $no_security) : \?string

Parameters

$name

\ID_TEXT

The name of the parameter to get

$default

\?mixed

The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)

$no_security

boolean

Whether to skip the security check

Returns

\?stringThe parameter value (NULL: missing)

This function is the integeric partner of get_param, as it returns the value as an integer.

get_param_integer(\ID_TEXT $name, \?mixed $default, boolean $not_string_ok) : \?integer

Parameters

$name

\ID_TEXT

The name of the parameter to get

$default

\?mixed

The default value to give the parameter if the parameter value is not defined or the empty string (NULL: allow missing parameter) (false: give error on missing parameter)

$not_string_ok

boolean

If a string is given, use the default parameter rather than giving an error (only use this if you are suffering from a parameter conflict situation between different parts of ocPortal)

Returns

\?integerThe parameter value (NULL: not set, and NULL given as default)

Create a form field input matrix for permission setting.

get_permissions_matrix(\ID_TEXT $server_id, array $access, array $overridables, array $specific_permissions, array $default_access, boolean $no_outer, \?tempcode $pinterface_view) : \tempcode

Parameters

$server_id

\ID_TEXT

Permission ID (pagelink style) for the resource being set

$access

array

An inverted list showing what view permissions are set for what we're setting permissions for

$overridables

array

List of overridable privilege codes for what we're setting permissions for

$specific_permissions

array

List of privilege settings relating to what we're setting permissions for, from the database

$default_access

array

Multi-dimensional array showing what the inherited defaults for this permission would be

$no_outer

boolean

Whether to not include the stuff to make it fit alongside other form fields in a normal form table

$pinterface_view

\?tempcode

Label for view permissions (NULL: default)

Returns

\tempcodeThe form field matrix

Get a randomised password.

get_rand_password() : string

Returns

stringThe randomised password

Find the list of URL remappings

get_remappings(boolean $old_style) : array

Parameters

$old_style

boolean

Whether to use the old URL remapping style

Returns

arrayThe list of URL remappings

Get the tempcode for a page title.

get_screen_title(mixed $title, boolean $dereference_lang, \?array $params, \?tempcode $user_online_title, \?array $awards) : \tempcode

(Ones below the page header, not in the browser title bar.)

Parameters

$title

mixed

The title to use (usually, a language string code, see below)

$dereference_lang

boolean

Whether the given title is actually a language string code, and hence gets dereferenced

$params

\?array

Parameters sent to the language string (NULL: none)

$user_online_title

\?tempcode

Separate title to put into the 'currently viewing' data (NULL: use $title)

$awards

\?array

Awards to say this has won (NULL: none)

Returns

\tempcodeThe title tempcode

Get some rows, queried from the database according to the search parameters.

get_search_rows(\?ID_TEXT $meta_type, \?ID_TEXT $meta_id_field, string $content, boolean $boolean_search, \ID_TEXT $boolean_operator, boolean $only_search_meta, \ID_TEXT $direction, integer $max, integer $start, boolean $only_titles, \ID_TEXT $table, array $fields, string $where_clause, string $content_where, \ID_TEXT $order, string $select, \?array $raw_fields, \?string $permissions_module, \?string $permissions_field, boolean $permissions_field_is_string) : array

set OR AND

Parameters

$meta_type

\?ID_TEXT

The META type used by our content (NULL: Cannot support META search)

$meta_id_field

\?ID_TEXT

The name of the field that retrieved META IDs will relate to (NULL: Cannot support META search)

$content

string

Search string

$boolean_search

boolean

Whether to do a boolean search.

$boolean_operator

\ID_TEXT

Boolean operator

$only_search_meta

boolean

Whether to only do a META (tags) search

$direction

\ID_TEXT

Order direction

$max

integer

Start position in total results

$start

integer

Maximum results to return in total

$only_titles

boolean

Whether to only search titles (as opposed to both titles and content)

$table

\ID_TEXT

The table name

$fields

array

The translateable fields to search over (or an ! which is skipped). The first of these must be the title field or an '!'; if it is '!' then the title field will be the first raw-field

$where_clause

string

The WHERE clause

$content_where

string

The WHERE clause that applies specifically for content (this will be duplicated to check against multiple fields). ? refers to the yet-unknown field name

$order

\ID_TEXT

What to order by

$select

string

What to select

$raw_fields

\?array

The non-translateable fields to search over (NULL: there are none)

$permissions_module

\?string

The permission module to check category access for (NULL: none)

$permissions_field

\?string

The field that specifies the permissions ID to check category access for (NULL: none)

$permissions_field_is_string

boolean

Whether the permissions field is a string

Returns

arrayThe rows found

Get a well formed URL equivalent to the current URL.

get_self_url(boolean $evaluate, boolean $root_if_posted, \?array $extra_params, boolean $posted_too, boolean $avoid_remap) : mixed

Parameters

$evaluate

boolean

Whether to evaluate the URL (so as we don't return tempcode)

$root_if_posted

boolean

Whether to direct to the default page if there was a POST request leading to where we are now (i.e. to avoid missing post fields when we go to this URL)

$extra_params

\?array

A map of extra parameters for the URL (NULL: none)

$posted_too

boolean

Whether to also keep POSTed data, in the GET request (useful if either_param is used to get the data instead of post_param - of course the POST data must be of the not--persistent-state-changing variety)

$avoid_remap

boolean

Whether to avoid mod_rewrite (sometimes essential so we can assume the standard URL parameter addition scheme in templates)

Returns

mixedThe URL (tempcode or string)

Get a well formed URL equivalent to the current URL.

get_self_url_easy() : \URLPATH

Reads direct from the environment and does no clever mapping at all. This function should rarely be used.

Returns

\URLPATHThe URL

Get the timezone the server is configured with.

get_server_timezone() : string

Returns

stringServer timezone in "boring" format.

Get the current session ID.

get_session_id() : integer

Returns

integerThe current session ID

Get the site's default language, with support for URL overrides.

get_site_default_lang() : \LANGUAGE_NAME

Returns

\LANGUAGE_NAMEThe site's default language

Get the site name.

get_site_name() : string

Returns

stringThe name of the site

Get the site-wide salt.

get_site_salt() : \ID_TEXT

It should be something hard for a hacker to get, so we depend on data gathered both from the database and file-system.

Returns

\ID_TEXTThe salt

Get the timezone the site is running on.

get_site_timezone() : string

Returns

stringSite timezone in "boring" format.

Get list of staff contextual actions.

get_staff_actions_list() : string

Returns

stringThe list

Get a results table showing info about the member's travels around the site.

get_stats_track(\MEMBER $member, \IP $ip, integer $start, integer $max, \?ID_TEXT $sortable, \?ID_TEXT $sort_order) : \tempcode

set ASC DESC

Parameters

$member

\MEMBER

The member we are getting travel stats for

$ip

\IP

The IP address of the member

$start

integer

The current position in the browser

$max

integer

The maximum number of rows to show per browser page

$sortable

\?ID_TEXT

The current sortable (NULL: none)

$sort_order

\?ID_TEXT

The order we are sorting in (NULL: none)

Returns

\tempcodeThe results table

Get syndication field UI.

get_syndication_option_fields() : \tempcode

Returns

\tempcodeSyndication fields (or empty)

Get the table prefixes used for all ocPortal tables, commonly used when you are installing ocPortal in the same database as your forums.

get_table_prefix() : string

The default table prefix is 'ocp4_'. Note that anything that might write to an arbitrary db, must ask that db for it's table prefix (if it needs it of course... the db abstracts away most needs for it)

Returns

stringThe table prefix

Get a list of timezones.

get_timezone_list() : array

Returns

arrayTimezone (map between boring-style and human-readable name). Sorted in offset order then likelihood orde.

Get a nice formatted date from the specified Unix timestamp.

get_timezoned_date(\TIME $timestamp, boolean $include_time, boolean $verbose, boolean $utc_time, boolean $avoid_contextual_dates, \?MEMBER $member) : string

Parameters

$timestamp

\TIME

Input timestamp

$include_time

boolean

Whether to include the time in the output

$verbose

boolean

Whether to make this a verbose date (longer than usual)

$utc_time

boolean

Whether to work in UTC time

$avoid_contextual_dates

boolean

Whether contextual dates will be avoided

$member

\?MEMBER

Member for which the date is being rendered (NULL: current member)

Returns

stringFormatted time

Get a nice formatted time from the specified Unix timestamp.

get_timezoned_time(\TIME $timestamp, boolean $avoid_contextual_dates, \?MEMBER $member, boolean $utc_time) : string

Parameters

$timestamp

\TIME

Input timestamp

$avoid_contextual_dates

boolean

Whether contextual times will be avoided. Note that we don't currently use contextual (relative) times. This parameter may be used in the future.

$member

\?MEMBER

Member for which the time is being rendered (NULL: current member)

$utc_time

boolean

Whether to work in UTC time

Returns

stringFormatted time

This function is an offshoot of get_translated_text, it instead returns parsed comcode that is linked to the specified language id.

get_translated_tempcode(integer $entry, \?object $connection, \?LANGUAGE_NAME $lang, boolean $force, boolean $as_admin, boolean $clear_away_from_cache) : \?tempcode

Parameters

$entry

integer

The id

$connection

\?object

The database connection to use (NULL: standard site connection)

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$force

boolean

Whether to force it to the specified language

$as_admin

boolean

Whether to force as_admin, even if the lang string isn't stored against an admin (designed for comcode page cacheing)

$clear_away_from_cache

boolean

Whether to remove from the Tempcode cache when we're done, for performance reasons (normally don't bother with this, but some code knows it won't be needed again -- esp Comcode cache layer -- and saves RAM by removing it)

Returns

\?tempcodeThe parsed comcode (NULL: the text couldn't be looked up)

Try to return the human-readable version of the language id, passed in as $entry.

get_translated_text(integer $entry, \?object $connection, \?LANGUAGE_NAME $lang, boolean $force) : \?string

Parameters

$entry

integer

The id

$connection

\?object

The database connection to use (NULL: standard site connection)

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$force

boolean

Whether to force it to the specified language

Returns

\?stringThe human-readable version (NULL: could not look up when $force was on)

Get the URL to the config option group for editing limits

get_upload_limit_config_url() : \?URLPATH

Returns

\?URLPATHThe URL to the config option group for editing limits (NULL: no access)

Get URLs generated according to the specified information.

get_url(\ID_TEXT $specify_name, \ID_TEXT $attach_name, \ID_TEXT $upload_folder, integer $obfuscate, integer $enforce_type, boolean $make_thumbnail, \ID_TEXT $thumb_specify_name, \ID_TEXT $thumb_attach_name, boolean $copy_to_server, boolean $accept_errors, boolean $should_get_something) : array

It can also generate a thumbnail if required. It first tries attached upload, then URL, then fails.

set 0 1 2 3

Parameters

$specify_name

\ID_TEXT

The name of the POST parameter storing the URL (if '', then no POST parameter). Parameter value may be blank.

$attach_name

\ID_TEXT

The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this.

$upload_folder

\ID_TEXT

The folder name in uploads/ where we will put this upload

$obfuscate

integer

Whether to obfuscate file names so the URLs can not be guessed/derived (0=do not, 1=do, 2=make extension .dat as well, 3=only obfuscate if we need to)

$enforce_type

integer

The type of upload it is (from an OCP_UPLOAD_* constant)

$make_thumbnail

boolean

Make a thumbnail (this only makes sense, if it is an image)

$thumb_specify_name

\ID_TEXT

The name of the POST parameter storing the thumb URL. As before

$thumb_attach_name

\ID_TEXT

The name of the HTTP file parameter storing the thumb upload. As before

$copy_to_server

boolean

Whether to copy a URL (if a URL) to the server, and return a local reference

$accept_errors

boolean

Whether to accept upload errors

$should_get_something

boolean

Whether to give a (deferred?) error if no file was given at all

Returns

arrayAn array of 4 URL bits (URL, thumb URL, URL original filename, thumb original filename)

Find ocPortal was installed to use persistent database connections or not.

get_use_persistent() : boolean

Returns

booleanWhether to use persistent database connections

Get a user's timezone.

get_users_timezone(\?MEMBER $member) : string

Parameters

$member

\?MEMBER

Member for which the date is being rendered (NULL: current user)

Returns

stringUsers timezone in "boring" format.

Find a specified value.

get_value(\ID_TEXT $name, \?ID_TEXT $default, boolean $env_also) : \?SHORT_TEXT

Parameters

$name

\ID_TEXT

The name of the value

$default

\?ID_TEXT

Value to return if value not found (NULL: return NULL)

$env_also

boolean

Whether to also check server environmental variables

Returns

\?SHORT_TEXTThe value (NULL: value not found and default is NULL)

Find the specified configuration option if it is younger than a specified time.

get_value_newer_than(\ID_TEXT $name, \TIME $cutoff) : \?SHORT_TEXT

Parameters

$name

\ID_TEXT

The name of the value

$cutoff

\TIME

The cutoff time (an absolute time, not a relative "time ago")

Returns

\?SHORT_TEXTThe value (NULL: value newer than not found)

Get branch version number for an ocPortal version.

get_version_branch(\?float $general) : string

Parameters

$general

\?float

General version number (NULL: on disk version)

Returns

stringBranch version number (NULL: on disk version)

Analyse a dotted version number into components.

get_version_components__from_dotted(string $dotted) : array

Parameters

$dotted

string

Dotted version number

Returns

arrayTuple of components: dotted basis version (i.e. with no alpha/beta/RC component and no trailing zeros), qualifier (blank, or alpha, or beta, or RC), qualifier number (NULL if not an alpha/beta/RC), dotted version number with trailing zeros to always cover 3 components

Get dotted version from given ocPortal-version-registry (version.php) supplied components.

get_version_dotted(\?integer $main, \?string $minor) : string

Parameters

$main

\?integer

Main version number (NULL: on disk version)

$minor

\?string

Minor version number (NULL: on disk version)

Returns

stringDotted version number

Gets any random way of writing a version number (in all of ocPortal's history) and makes it a dotted style like "3.2.beta2".

get_version_dotted__from_anything(string $any_format) : string

Note that the dotted format is compatible with PHP's version_compare function.

Parameters

$any_format

string

Any reasonable input

Returns

stringPretty version number

Get a pretty version number for an ocPortal version.

get_version_pretty__from_dotted(string $pretty) : string

This pretty style is not used in ocPortal code per se, but is shown to users and hence ocPortal may need to recognise it when searching news posts, download databases, etc.

Parameters

$pretty

string

Pretty version number

Returns

stringDotted version number

Lookup error on ocportal.com, to see if there is more information.

get_webservice_result(mixed $error_message) : \?string

Parameters

$error_message

mixed

The error message (string or tempcode)

Returns

\?stringThe result from the web service (NULL: no result)

Get a zone chooser interface.

get_zone_chooser(boolean $inline, \?array $no_go, \?array $reorder) : \tempcode

Parameters

$inline

boolean

Whether the zone chooser will be shown inline to something else (as opposed to providing it's own borderings)

$no_go

\?array

A list of zone to not put into the list (NULL: none to skip)

$reorder

\?array

A reordering (NULL: no reordering)

Returns

\tempcodeThe zone chooser

Get the default page for a zone.

get_zone_default_page(\ID_TEXT $zone_name) : \ID_TEXT

Parameters

$zone_name

\ID_TEXT

Zone name

Returns

\ID_TEXTDefault page

Get the name of the zone the current page request is coming from.

get_zone_name() : \ID_TEXT

Returns

\ID_TEXTThe current zone

Give points to a member for submitting something, then returns the XHTML page to say so.

give_submit_points(\ID_TEXT $type, \?MEMBER $member) : \?string

Parameters

$type

\ID_TEXT

One of this type has been submitted. By convention it is the language code of what was done, e.g. ADD_DOWNLOAD

$member

\?MEMBER

The member to give the points to (NULL: give to current member)

Returns

\?stringA message about the member being given these submit points (NULL: no message)

Turn the tempcode lump into a standalone page.

globalise(\tempcode $middle, \?mixed $message, string $type, boolean $include_header_and_footer) : \tempcode

set inform warn ""

Parameters

$middle

\tempcode

The tempcode to put into a nice frame

$message

\?mixed

'Additional' message (NULL: none)

$type

string

The type of special message

$include_header_and_footer

boolean

Whether to include the header/footer/panels

Returns

\tempcodeStandalone page

Process a logout.

handle_active_logout() 

Use the url_title_cache table (a bit of a hack but saved changed the DB structure) to see if a check-op was performed has been performed within the last 30 days.

handle_has_checked_recently(\ID_TEXT $id_code) : boolean

Parameters

$id_code

\ID_TEXT

Special check code (often a URL but does not need to be).

Returns

booleanWhether the check has happened recently.

Handles an attempted login or logout, and take care of all the sessions and cookies etc.

handle_logins() 

Deal with a perceived spammer.

handle_perceived_spammer_by_confidence(\IP $user_ip, float $confidence_level, \ID_TEXT $blocked_by, boolean $page_level) 

Parameters

$user_ip

\IP

IP address

$confidence_level

float

Confidence level (0.0 to 1.0)

$blocked_by

\ID_TEXT

Identifier for whatever did the blocking

$page_level

boolean

Whether this is a page level check (i.e. we won't consider blocks or approval, just ban setting)

Log permission checks to the permission_checks.log file, if it exists.

handle_permission_check_logging(\MEMBER $member, \ID_TEXT $op, array $params, boolean $result) 

Parameters

$member

\MEMBER

The user checking against

$op

\ID_TEXT

The function that was called to check a permission

$params

array

Parameters to this permission-checking function

$result

boolean

Whether the permission was held

Certain symbols need preprocessing, before the output stream is made.

handle_symbol_preprocessing(array $bit, array $children) 

Parameters

$bit

array

Symbol details

$children

array

Where we store children stuff

Certain symbols need preprocessing, before the output stream is made.

handle_symbol_preprocessing(array $bit, array $children) 

Parameters

$bit

array

Symbol details

$children

array

Where we store children stuff

Find if a member's has access to a specified page.

has_actual_page_access(\?MEMBER $member, \?ID_TEXT $page, \?ID_TEXT $zone, \?array $cats, \?mixed $sp) : boolean

Zone permissions are taken into account for wherever the page is found at. Also support for category access and privileges. No support for entry-point checks, which are only carried out as an extension of page permissions when actually at a page.

Parameters

$member

\?MEMBER

The member being checked whether to have the access (NULL: current member)

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$zone

\?ID_TEXT

The ID code for the zone being checked (NULL: search)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

$sp

\?mixed

Either the ID code of a privilege, an array of alternatives that are acceptable (NULL: none required)

Returns

booleanWhether the member has zone and page access

Find if a member's has access to a specified category

has_category_access(\MEMBER $member, \ID_TEXT $module, \ID_TEXT $category) : boolean

Parameters

$member

\MEMBER

The member being checked whether to have the access

$module

\ID_TEXT

The ID code for the module being checked for category access

$category

\ID_TEXT

The ID code for the category being checked for access (often, a number cast to a string)

Returns

booleanWhether the member has category access

Determine whether the user's browser supports cookies or not.

has_cookies() : boolean

Unfortunately this function will only return true once a user has been to the site more than once... ocPortal will set a cookie, and if it perseveres, that indicates cookies work.

Returns

booleanWhether the user has definitely got cookies

Check to see if a member's has permission to delete a specific resource

has_delete_permission(string $range, \MEMBER $member, \?MEMBER $resource_owner, \?ID_TEXT $page, \?array $cats) : boolean

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$member

\MEMBER

The member being checked for access

$resource_owner

\?MEMBER

The member that owns this resource (NULL: no-one)

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

Returns

booleanWhether the member may delete the resource

Find if a member's has permission to edit

has_edit_permission(string $range, \MEMBER $member, \?MEMBER $resource_owner, \?ID_TEXT $page, \?array $cats) : boolean

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$member

\MEMBER

The member being checked for access

$resource_owner

\?MEMBER

The member that owns this resource (NULL: no-one)

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

Returns

booleanWhether the member may edit the resource

Detect whether we have external site-wide syndication support somewhere.

has_external_site_wide_syndication() : boolean

Returns

booleanWhether we do

Determine whether the user's browser supports JavaScript or not.

has_js() : boolean

Unfortunately this function will only return true once a user has been to the site more than once... Javascript will set a cookie, indicating it works.

Returns

booleanWhether the user has definitely got Javascript

Find whether we have no forum on this website.

has_no_forum() : boolean

Returns

booleanWhether we have no forum on this website

Find if a member's has access to a specified page, in a specific zone.

has_page_access(\MEMBER $member, \ID_TEXT $page, \ID_TEXT $zone, boolean $at_now) : boolean

Note that page access does not imply zone access; you have access a page, but not the zone, so still couldn't see it.

Parameters

$member

\MEMBER

The member being checked whether to have the access

$page

\ID_TEXT

The ID code for the page being checked

$zone

\ID_TEXT

The ID code for the zone being checked

$at_now

boolean

Whether we want to check we have access to the CURRENT page, using any match tag permissions

Returns

booleanWhether the member has page access

Find if a member has a specified permission in any category

has_some_cat_specific_permission(\MEMBER $member, \ID_TEXT $permission, \?ID_TEXT $page, \ID_TEXT $permission_module) : boolean

Parameters

$member

\MEMBER

The member being checked whether to have the permission

$permission

\ID_TEXT

The ID code for the permission being checked for

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$permission_module

\ID_TEXT

The ID code for the permission module being checked for

Returns

booleanWhether the member has the permission

Find if a member has a specified permission

has_specific_permission(\MEMBER $member, \ID_TEXT $permission, \?ID_TEXT $page, \?array $cats) : boolean

Parameters

$member

\MEMBER

The member being checked whether to have the permission

$permission

\ID_TEXT

The ID code for the permission being checked for

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

Returns

booleanWhether the member has the permission

Find if a group has a specified permission

has_specific_permission_group(\GROUP $group_id, \ID_TEXT $permission, \?ID_TEXT $page, \?array $cats) : boolean

Parameters

$group_id

\GROUP

The being checked whether to have the permission

$permission

\ID_TEXT

The ID code for the permission being checked for

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

Returns

booleanWhether the member has the permission

Find if a member's has permission to submit

has_submit_permission(string $range, \MEMBER $member, \IP $ip, \?ID_TEXT $page, \?array $cats) : boolean

set low mid high cat_low cat_mid cat_high

Parameters

$range

string

The range of permission we are checking to see if they have; these ranges are like trust levels

$member

\MEMBER

The member being checked whether to have the access

$ip

\IP

The member's IP address

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$cats

\?array

A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...) (NULL: N/A)

Returns

booleanWhether the member can submit in this range

Find if a member's has access to a specified zone

has_zone_access(\MEMBER $member, \ID_TEXT $zone) : boolean

Parameters

$member

\MEMBER

The member being checked whether to have the access

$zone

\ID_TEXT

The ID code for the zone being checked

Returns

booleanWhether the member has zone access

Function that tucks-under-the-carpet lumps of XHTML that knowingly won't validate.

hide_the_evidence(\tempcode $html) : \tempcode

Parameters

$html

\tempcode

What to hide away

Returns

\tempcodeHidden away version

Decode the HTML entitity encoded input string.

html_entity_decode(string $input, integer $quote_style, \?string $charset) : string

Parameters

$input

string

The text to decode

$quote_style

integer

The quote style code

$charset

\?string

Character set to decode to (NULL: default)

Returns

stringThe decoded text

Return the file in the URL by downloading it over HTTP.

http_download_file(\URLPATH $url, \?integer $byte_limit, boolean $trigger_error, boolean $no_redirect, string $ua, \?array $post_params, \?array $cookies, \?string $accept, \?string $accept_charset, \?string $accept_language, \?resource $write_to_file, \?string $referer, \?array $auth, float $timeout, boolean $is_xml, \?array $files) : \?string

If a byte limit is given, it will only download that many bytes. It outputs warnings, returning NULL, on error.

range 1 max

Parameters

$url

\URLPATH

The URL to download

$byte_limit

\?integer

The number of bytes to download. This is not a guarantee, it is a minimum (NULL: all bytes)

$trigger_error

boolean

Whether to throw an ocPortal error, on error

$no_redirect

boolean

Whether to block redirects (returns NULL when found)

$ua

string

The user-agent to identify as

$post_params

\?array

An optional array of POST parameters to send; if this is NULL, a GET request is used (NULL: none)

$cookies

\?array

An optional array of cookies to send (NULL: none)

$accept

\?string

'accept' header value (NULL: don't pass one)

$accept_charset

\?string

'accept-charset' header value (NULL: don't pass one)

$accept_language

\?string

'accept-language' header value (NULL: don't pass one)

$write_to_file

\?resource

File handle to write to (NULL: do not do that)

$referer

\?string

The HTTP referer (NULL: none)

$auth

\?array

A pair: authentication username and password (NULL: none)

$timeout

float

The timeout

$is_xml

boolean

Whether to treat the POST parameters as a raw POST (rather than using MIME)

$files

\?array

Files to send. Map between field to file path (NULL: none)

Returns

\?stringThe data downloaded (NULL: error)

Script to handle iframe.

iframe_script() 

Import to ocPortal database table from the equivalent XML format.

import_from_xml(string $xml_data, boolean $delete_missing_rows) : array

Parameters

$xml_data

string

Data in XML format

$delete_missing_rows

boolean

Synchronise deletes as well as inserts/updates

Returns

arrayList of operations performed

Complain about a field being missing.

improperly_filled_in(string $name, \?boolean $posted, array $array) 

Parameters

$name

string

The name of the parameter

$posted

\?boolean

Whether the parameter is a POST parameter (NULL: undetermined)

$array

array

The array we're extracting parameters from

Complain about a POST field being missing.

improperly_filled_in_post(string $name) 

Parameters

$name

string

The name of the parameter

Perform a database-style in-memory boolean search on single item.

in_memory_search_match(array $filter, string $title, \?string $post) : boolean

Parameters

$filter

array

A map of POST data in search-form style. May contain 'only_titles', 'content' (the critical one!) and 'conjunctive_operator'

$title

string

The title to try and match

$post

\?string

The post to try and match (NULL: not used)

Returns

booleanWhether we have a match

Find whether we are running in safe mode.

in_safe_mode() : boolean

Returns

booleanWhether we are in safe mode

Function to process the file upload process

incoming_uploads_script() 

This is a intended to output an informational exit at the same time as terminating execution

inform_exit(mixed $text) 

Parameters

$text

mixed

The error message (string or tempcode)

Get the tempcode for an info page.

inform_screen(\tempcode $title, mixed $text) : \tempcode

Parameters

$title

\tempcode

The title of the info page

$text

mixed

The text to put on the info page (string, or language-tempcode)

Returns

\tempcodeThe info page

Standard code module initialisation function.

init__abstract_file_manager() 

Standard code module initialisation function.

init__antispam() 

Standard code module initialisation function.

init__caches() 

Standard code module initialisation function.

init__config() 

Standard code module initialisation function.

init__css_and_js() 

Standard code module initialisation function.

init__database() 

Standard code module initialisation function.

init__developer_tools() 

Standard code module initialisation function.

init__failure() 

Standard code module initialisation function.

init__files() 

Standard code module initialisation function.

init__files2() 

Standard code module initialisation function.

init__forum_stub() 

Standard code module initialisation function.

init__global2() 

Standard code module initialisation function.

init__lang() 

Standard code module initialisation function.

init__lang_compile() 

Standard code module initialisation function.

init__lookup() 

Standard code module initialisation function.

init__m_zip() 

Standard code module initialisation function.

init__mail() 

Standard code module initialisation function.

init__obfuscate() 

Standard code module initialisation function.

init__permissions() 

Standard code module initialisation function.

init__site() 

Standard code module initialisation function.

init__sitemap() 

Standard code module initialisation function.

init__support() 

Standard code module initialisation function.

init__symbols() 

Standard code module initialisation function.

init__tempcode() 

Standard code module initialisation function.

init__tempcode__runtime() 

Standard code module initialisation function.

init__tempcode_compiler() 

Standard code module initialisation function.

init__templates() 

Standard code module initialisation function.

init__temporal() 

Standard code module initialisation function.

init__themes() 

Standard code module initialisation function.

init__uploads() 

Standard code module initialisation function.

init__urls() 

Standard code module initialisation function.

init__urls2() 

Standard code module initialisation function.

init__users() 

Standard code module initialisation function.

init__view_modes() 

Standard code module initialisation function.

init__word_filter() 

Standard code module initialisation function.

init__zones() 

Standard code module initialisation function.

init__zones2() 

Initialise state variables for the special page type being requested.

initialise_special_page_types(\ID_TEXT $special_page_type) 

set query templates tree lang

Parameters

$special_page_type

\ID_TEXT

The special page type.

Should be called when an action happens that results in content submission.

inject_action_spamcheck(\?string $username, \?string $email) 

Does a spammer check.

Parameters

$username

\?string

Check this particular username that has just been supplied (NULL: none)

$email

\?string

Check this particular email address that has just been supplied (NULL: none)

Insert some code into a function in the given code snippet, by command (after command).

insert_code_after__by_command(string $code, string $function, string $command, string $newcode, integer $instance_of_command) : boolean

Parameters

$code

string

The code.

$function

string

Name of the function.

$command

string

The command we're searching to insert by.

$newcode

string

Code to insert.

$instance_of_command

integer

We are inserting at this instance of the line (i.e. takes into account a literal line of code may exist in other places in a function).

Returns

booleanSuccess status.

Insert some code into a function in the given code snippet, by command (before command).

insert_code_before__by_command(string $code, string $function, string $command, string $newcode, integer $instance_of_command) : boolean

Parameters

$code

string

The code.

$function

string

Name of the function.

$command

string

The command we're searching to insert by.

$newcode

string

Code to insert.

$instance_of_command

integer

We are inserting at this instance of the line (i.e. takes into account a literal line of code may exist in other places in a function).

Returns

booleanSuccess status.

Insert a language entry into the translation table, and returns the id.

insert_lang(string $text, integer $level, \?object $connection, boolean $comcode, \?integer $id, \?LANGUAGE_NAME $lang, boolean $insert_as_admin, \?string $pass_id, \?string $text2, integer $wrap_pos, boolean $preparse_mode, boolean $save_as_volatile) : integer

set 1 2 3 4

Parameters

$text

string

The text

$level

integer

The level of importance this language string holds

$connection

\?object

The database connection to use (NULL: standard site connection)

$comcode

boolean

Whether it is to be parsed as comcode

$id

\?integer

The id to use for the language entry (NULL: work out next available)

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$insert_as_admin

boolean

Whether to insert it as an admin (any comcode parsing will be carried out with admin privileges)

$pass_id

\?string

The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)

$text2

\?string

Assembled Tempcode portion (NULL: work it out)

$wrap_pos

integer

Comcode parser wrap position

$preparse_mode

boolean

Whether to generate a fatal error if there is invalid Comcode

$save_as_volatile

boolean

Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to subversion)

Returns

integerThe id of the newly added language entry

Insert a comcode language entry into the translation table, and returns the id.

insert_lang_comcode(string $text, integer $level, \?object $connection, boolean $insert_as_admin, \?string $pass_id, integer $wrap_pos, boolean $preparse_mode, boolean $save_as_volatile) : integer

set 1 2 3 4

Parameters

$text

string

The text

$level

integer

The level of importance this language string holds

$connection

\?object

The database connection to use (NULL: standard site connection)

$insert_as_admin

boolean

Whether to insert it as an admin (any comcode parsing will be carried out with admin privileges)

$pass_id

\?string

The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)

$wrap_pos

integer

Comcode parser wrap position

$preparse_mode

boolean

Whether to generate a fatal error if there is invalid Comcode

$save_as_volatile

boolean

Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to subversion)

Returns

integerThe id of the newly added language entry

Output whatever arguments are given for debugging.

inspect() 

If possible it'll output with plain text, but if output has already started it will attach messages.

Output whatever arguments are given for debugging as text and exit.

inspect_plain() 

If possible it'll output with plain text, but if output has already started it will attach messages.

Format the given integer number as a nicely formatted string.

integer_format(integer $val) : string

Parameters

$val

integer

The value to format

Returns

stringNicely formatted string

Discern the cause of a file-write error, and show an appropriate error message.

intelligent_write_error(\PATH $path) 

Parameters

$path

\PATH

File path that could not be written (full path, not relative)

Discern the cause of a file-write error, and return an appropriate error message.

intelligent_write_error_inline(\PATH $path) : \tempcode

Parameters

$path

\PATH

File path that could not be written

Returns

\tempcodeMessage

Very simple function to invert the meaning of an old hidden option.

invert_value(\ID_TEXT $old) : \ID_TEXT

We often use this when we've promoted a hidden option into a new proper option but inverted the meaning in the process - we use this in the default value generation code, as an in-line aid to preserve existing hidden option settings.

set 0 1

Parameters

$old

\ID_TEXT

The old value

Returns

\ID_TEXTThe inverted value

Check to see if an IP address is banned.

ip_banned(string $ip, boolean $force_db, boolean $handle_uncertainties) : \?boolean

Parameters

$ip

string

The IP address to check for banning (potentially encoded with *'s)

$force_db

boolean

Force check via database

$handle_uncertainties

boolean

Handle uncertainities (used for the external bans - if true, we may return NULL, showing we need to do an external check). Only works with $force_db.

Returns

\?booleanWhether the IP address is banned (NULL: unknown)

Find whether the specified string is alphanumeric or not.

is_alphanumeric(string $string) : boolean

Parameters

$string

string

The string to test

Returns

booleanWhether the string is alphanumeric or not

Find if we a string is ASCII, and hence we can use non-UTF-safe functions on it.

is_ascii_string(string $x) : boolean

Parameters

$x

string

String to test

Returns

booleanWhether it is ASCII

Find whether the browser session is set to be doing a hard cache-empty refresh.

is_browser_decacheing() : boolean

Returns

booleanWhether the browser session is set to be doing a hard cache-empty refresh

Determine if some data has already been encrypted: i.e.

is_data_encrypted(string $data) : boolean

if it has a magic encryption marker.

Parameters

$data

string

Data to check

Returns

booleanEncrypted?

Determine whether the necessary PHP extensions to support encryption are available.

is_encryption_available() : boolean

For normal use, you should probably use is_encryption_enabled() instead.

Returns

booleanEncryption available?

Determine whether encryption support is available and enabled in the site's preferences, and the keys are in place.

is_encryption_enabled() : boolean

Returns

booleanEncryption enabled?

Find whether the current member is a guest.

is_guest(\?MEMBER $member_id, boolean $quick_only) : boolean

Parameters

$member_id

\?MEMBER

Member ID to check (NULL: current user)

$quick_only

boolean

Whether to just do a quick check, don't establish new sessions

Returns

booleanWhether the current member is a guest

Find whether the image specified is actually an image, based on file extension

is_image(string $name) : boolean

Parameters

$name

string

A URL or file path to the image

Returns

booleanWhether the string pointed to a file appeared to be an image

Look at the user's browser, and decide if they are viewing on a mobile device or not.

is_mobile(\?string $user_agent, boolean $truth) : boolean

Parameters

$user_agent

\?string

The user agent (NULL: get from environment, current user's browser)

$truth

boolean

Whether to always tell the truth (even if the current page does not have mobile support)

Returns

booleanWhether the user is using a mobile device

Find whether the specified page is to use HTTPS (if not -- it will use HTTP).

is_page_https(\ID_TEXT $zone, \ID_TEXT $page) : boolean

All images (etc) on a HTTPS page should use HTTPS to avoid mixed-content browser notices.

Parameters

$zone

\ID_TEXT

The zone the page is in

$page

\ID_TEXT

The page codename

Returns

booleanWhether the page is to run across an HTTPS connection

Use the image extension to determine if the specified image is of a format (extension) saveable by ocPortal or not.

is_saveable_image(string $name) : boolean

Parameters

$name

string

A URL or file path to the image

Returns

booleanWhether the string pointed to a file that appeared to be a saveable image

Find whether we can get away with natural file access, not messing with AFMs, world-writability, etc.

is_suexec_like() : boolean

Returns

booleanWhether we have this

Find whether an swfupload upload has just happened, and optionally simulate as if it were a normal upload (although 'is_uploaded_file'/'move_uploaded_file' would not work).

is_swf_upload(boolean $fake_prepopulation) : boolean

Parameters

$fake_prepopulation

boolean

Simulate population of the $_FILES array.

Returns

booleanWhether an swfupload upload has just happened.

Find whether a phrase is too small for fulltext search.

is_under_radar(string $test) : boolean

Parameters

$test

string

The phrase

Returns

booleanWhether it is

Find whether the specified address is a valid e-mail address or not.

is_valid_email_address(string $string) : boolean

Parameters

$string

string

The string to test (Note: This is typed string, not e-mail, because it has to function on failure + we could make an infinite loop)

Returns

booleanWhether the string is an email address or not

Find whether an IP address is valid

is_valid_ip(\IP $ip) : boolean

Parameters

$ip

\IP

IP address to check.

Returns

booleanWhether the IP address is valid.

Find whether the video specified is actually a 'video', based on file extension

is_video(string $name, boolean $must_be_true_video) : boolean

Parameters

$name

string

A URL or file path to the video

$must_be_true_video

boolean

Whether it really must be an actual video/audio, not some other kind of rich media which we may render in a video spot

Returns

booleanWhether the string pointed to a file appeared to be a video

Find whether panels will be shown.

is_wide() : \BINARY

Returns

\BINARYResult.

Find whether panels and the header/footer areas won't be shown.

is_wide_high() : \BINARY

Returns

\BINARYResult.

Find whether a file/directory is writeable.

is_writable_wrap(\PATH $path) : boolean

This function is designed to get past that the PHP is_writable function does not work properly on Windows.

Parameters

$path

\PATH

The file path

Returns

booleanWhether the file is writeable

Force a Javascript file to be cached (ordinarily we can rely on this to be automated by require_javascript/javascript_tempcode).

javascript_enforce(string $j, \?ID_TEXT $theme, \?boolean $minify) : string

Parameters

$j

string

The javascript file required

$theme

\?ID_TEXT

The name of the theme (NULL: current theme)

$minify

\?boolean

Whether to minify (NULL: read from environment)

Returns

stringThe path to the javascript file in the cache (blank: no file)

Get tempcode to tie in (to the HTML, in <head>) all the Javascript files that have been required.

javascript_tempcode(\?string $position) : \tempcode

set NULL header footer

Parameters

$position

\?string

Position to get Javascript for (NULL: all positions)

Returns

\tempcodeThe tempcode to tie in the Javascript files

Compile a Javascript file.

js_compile(\ID_TEXT $j, \PATH $js_cache_path, boolean $minify) 

Parameters

$j

\ID_TEXT

Name of the JS file

$js_cache_path

\PATH

Full path to the JS file

$minify

boolean

Whether to also do minification

Minimise the given Javascript

js_minify(string $js) : string

Parameters

$js

string

Javascript to minimise

Returns

stringMinimised Javascript

String to tack onto URL to keep 'keep_' parameters

keep_symbol(array $param) : string

Parameters

$param

array

Parameters passed to the symbol (0=whether this starts off the query string, 1=force session append even if it's also available a session cookie e.g. when put into download manager)

Returns

stringThe result.

Convert the specified language codename to the default content, and return the language key.

lang_code_to_default_content(\ID_TEXT $code, boolean $comcode, integer $level) : integer

Parameters

$code

\ID_TEXT

The language codename

$comcode

boolean

Whether the given codes value is to be parsed as comcode

$level

integer

The level of importance this language string holds

Returns

integerThe language ID

Remap the specified language id, and return the id again - the id isn't changed.

lang_remap(integer $id, string $text, \?object $connection, boolean $comcode, \?string $pass_id, \?MEMBER $source_member, boolean $as_admin, boolean $backup_string) : integer

Parameters

$id

integer

The language entries id

$text

string

The text to remap to

$connection

\?object

The database connection to use (NULL: standard site connection)

$comcode

boolean

Whether it is to be parsed as comcode

$pass_id

\?string

The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)

$source_member

\?MEMBER

The member performing the change (NULL: current member)

$as_admin

boolean

Whether to generate Comcode as arbitrary admin

$backup_string

boolean

Whether to backup the language string before changing it

Returns

integerThe language entries id

Remap the specified comcode language id, and return the id again - the id isn't changed.

lang_remap_comcode(integer $id, string $text, \?object $connection, \?string $pass_id, \?MEMBER $source_member, boolean $as_admin) : integer

Parameters

$id

integer

The language entries id

$text

string

The text to remap to

$connection

\?object

The database connection to use (NULL: standard site connection)

$pass_id

\?string

The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)

$source_member

\?MEMBER

The member performing the change (NULL: current member)

$as_admin

boolean

Whether to generate Comcode as arbitrary admin

Returns

integerThe language entries id

Take a list of maps, and make one of the values of each array the index of a map to the map

list_to_map(string $map_value, array $list) : array

Parameters

$map_value

string

The key key of our maps that reside in our map

$list

array

The list of maps

Returns

arrayThe collapsed map

Get the parsed contents of a comcode page.

load_comcode_page(\PATH $string, \ID_TEXT $zone, \ID_TEXT $codename, \?PATH $file_base, boolean $being_included) : \tempcode

Parameters

$string

\PATH

The relative (to ocPortal's base directory) path to the page (e.g. pages/comcode/EN/start.txt)

$zone

\ID_TEXT

The zone the page is being loaded from

$codename

\ID_TEXT

The codename of the page

$file_base

\?PATH

The file base to load from (NULL: standard)

$being_included

boolean

Whether the page is being included from another

Returns

\tempcodeThe page

Find all restrictions that apply to our page/type.

load_field_restrictions(\?string $this_page, \?string $this_type) : array

Parameters

$this_page

\?string

The page name scoped for (NULL: current page)

$this_type

\?string

The page type scoped for (NULL: current type)

Returns

arrayList of fields, each of which is a map (restriction => attributes)

Get the contents of an HTML page.

load_html_page(\PATH $string, \?PATH $file_base) : string

HTML isn't great... no dynamicness/reconfigurability at all. We prefer comcode with [html]HTML goes here[/html] usage

Parameters

$string

\PATH

The relative (to ocPortals base directory) path to the HTML page

$file_base

\?PATH

The file base to load from (NULL: standard)

Returns

stringThe page

Runs the specified mini-module.

load_minimodule_page(\PATH $string) : \tempcode

The module result is returned.

Parameters

$string

\PATH

The relative path to the module file

Returns

\tempcodeThe result of executing the module

Runs the specified module, but also update any stats for the module, and check to see if it needs upgrading or reinstalling.

load_module_page(\PATH $string, \ID_TEXT $codename) : \tempcode

The module result is returned.

Parameters

$string

\PATH

The relative path to the module file

$codename

\ID_TEXT

The page name to load

Returns

\tempcodeThe result of executing the module

Load up hooks needed to detect how to use monikers.

load_moniker_hooks() 

Load all config options.

load_options() 

AJAX script for getting the text of a template, as used by a certain theme.

load_template_script() 

For efficiency reasons, load up loads of category permissions.

load_up_all_module_category_permissions(\MEMBER $member, \?ID_TEXT $module) 

Parameters

$member

\MEMBER

The member being checked whether to have the access

$module

\?ID_TEXT

The ID code for the module being checked for category access (NULL: all categories)

For efficiency reasons, load up loads of page permissions.

load_up_all_self_page_permissions(\MEMBER $member) 

Parameters

$member

\MEMBER

The member being checked whether to have the access

Load stuff that allows user code to work.

load_user_stuff() 

Filter locale-tainted strings through the locale filter.

locale_filter(string $ret) : string

Let's pretend a user's operating system doesn't fully support they're locale. They have a nice language pack, but whenever the O.S. is asked for dates in the chosen locale, it puts month names in English instead. The locale_filter function is used to cleanup these problems. It does a simple set of string replaces, as defined by the 'locale_subst' language string.

Parameters

$ret

string

Tainted string

Returns

stringFiltered string

Log a hackattack, then displays an error message.

log_hack_attack_and_exit(\ID_TEXT $reason, \SHORT_TEXT $reason_param_a, \SHORT_TEXT $reason_param_b) 

It also attempts to send an e-mail to the staff alerting them of the hackattack.

Parameters

$reason

\ID_TEXT

The reason for the hack attack. This has to be a language string codename

$reason_param_a

\SHORT_TEXT

A parameter for the hack attack language string (this should be based on a unique ID, preferably)

$reason_param_b

\SHORT_TEXT

A more illustrative parameter, which may be anything (e.g. a title)

Log an action

log_it(\ID_TEXT $type, \?SHORT_TEXT $a, \?SHORT_TEXT $b) 

Parameters

$type

\ID_TEXT

The type of activity just carried out (a lang string)

$a

\?SHORT_TEXT

The most important parameter of the activity (e.g. id) (NULL: none)

$b

\?SHORT_TEXT

A secondary (perhaps, human readable) parameter of the activity (e.g. caption) (NULL: none)

Log statistics for the page view.

log_stats(string $string, integer $pg_time) 

Parameters

$string

string

The string to the page file

$pg_time

integer

The time taken for page loading in milliseconds

Find if a value appears to be some kind of URL (possibly an ocPortalised Comcode one).

looks_like_url(string $value, boolean $lax) : boolean

Parameters

$value

string

The value to check

$lax

boolean

Whether to be a bit lax in the check

Returns

booleanWhether the value appears to be a URL

Get the full name of a language.

lookup_language_full_name(\LANGUAGE_NAME $code) : string

e.g. 'EN' would become 'English'

Parameters

$code

\LANGUAGE_NAME

The language

Returns

stringThe full name of the language

Get information about the specified member.

lookup_member_page(mixed $member, \?string $name, \?AUTO_LINK $id, \?string $ip) : array

Parameters

$member

mixed

The member for whom we are getting the page

$name

\?string

The member's name (by reference) (NULL: unknown)

$id

\?AUTO_LINK

The member's ID (by reference) (NULL: unknown)

$ip

\?string

The member's IP (by reference) (NULL: unknown)

Returns

arrayThe member's stats rows

Delete a directory of files.

m_deldir(\PATH $a_dir) 

From "User Contributed Notes" at http://it.php.net/manual/en/function.rmdir.php. Thanks flexer at cutephp dot com

Parameters

$a_dir

\PATH

The path to the directory

Attempt to send an e-mail to the specified recipient.

mail_wrap(string $subject_line, \LONG_TEXT $message_raw, \?array $to_email, \?mixed $to_name, \EMAIL $from_email, string $from_name, integer $priority, \?array $attachments, boolean $no_cc, \?MEMBER $as, boolean $as_admin, boolean $in_html, boolean $coming_out_of_queue, \ID_TEXT $mail_template) : \?tempcode

The mail will be forwarding to the CC address specified in the options (if there is one, and if not specified not to cc). The mail will be sent in dual HTML/text format, where the text is the unconverted comcode source: if a member does not read HTML mail, they may wish to fallback to reading that.

range 1 5

Parameters

$subject_line

string

The subject of the mail in plain text

$message_raw

\LONG_TEXT

The message, as Comcode

$to_email

\?array

The destination (recipient) e-mail addresses [array of strings] (NULL: site staff address)

$to_name

\?mixed

The recipient name. Array or string. (NULL: site name)

$from_email

\EMAIL

The from address (blank: site staff address)

$from_name

string

The from name (blank: site name)

$priority

integer

The message priority (1=urgent, 3=normal, 5=low)

$attachments

\?array

An list of attachments (each attachment being a map, path=>filename) (NULL: none)

$no_cc

boolean

Whether to NOT CC to the CC address

$as

\?MEMBER

Convert comcode->tempcode as this member (a privilege thing: we don't want people being able to use admin rights by default!) (NULL: guest)

$as_admin

boolean

Replace above with arbitrary admin

$in_html

boolean

HTML-only

$coming_out_of_queue

boolean

Whether to bypass queueing, because this code is running as a part of the queue management tools

$mail_template

\ID_TEXT

The template used to show the email

Returns

\?tempcodeA full page (not complete XHTML) piece of tempcode to output (NULL: it worked so no tempcode message)

Get obfuscate version of 'mailto:' (which'll hopefully fool e-mail scavengers to not pick up these e-mail addresses).

mailto_obfuscated() : string

Returns

stringThe obfuscated 'mailto:' string

Output data to a CSV file.

make_csv(array $data, \ID_TEXT $filename, boolean $headers, boolean $output_and_exit) : string

Parameters

$data

array

List of maps, each map representing a row

$filename

\ID_TEXT

Filename to output

$headers

boolean

Whether to output CSV headers

$output_and_exit

boolean

Whether to output/exit when we're done instead of return

Returns

stringCSV data (we might not return though, depending on $exit)

Set up the locale filter array from the terse language string specifying it.

make_locale_filter() 

Take a PHP map array, and make it look nice.

make_map_nice(array $map) : string

Parameters

$map

array

Map array

Returns

stringPretty version

Turn a boring timezone name into the pretty shortened list of ones Microsoft uses and others now use too.

make_nice_timezone_name(string $in) : string

Parameters

$in

string

Boring name

Returns

stringNice name

A custom random number seed generator.

make_seed() : integer

It returns a random number seed.

Returns

integerA random seed

preg_replace callback to apply sentence case.

make_sentence_case_callback(array $matches) : string

Parameters

$matches

array

Matches

Returns

stringDe-shouted string

Convert a string to tempcode.

make_string_tempcode(string $string) : \tempcode

Parameters

$string

string

String

Returns

\tempcodeTempcode

Convert a string to tempcode.

make_string_tempcode(string $string) : \tempcode

Parameters

$string

string

String

Returns

\tempcodeTempcode

Take a Tempcode object and run some hackerish code to make it XHTML-strict.

make_xhtml_strict(object $global) : object

Parameters

$global

object

Tempcode object

Returns

objectTempcode object (no longer cache safe)

Deletes all language codes linked to by the specified table and attribute identifiers, if they exist.

mass_delete_lang(\ID_TEXT $table, array $attrs, \?object $connection) 

Parameters

$table

\ID_TEXT

The table

$attrs

array

The attributes

$connection

\?object

The database connection to use (NULL: standard site connection)

See if the current URL matches the given ocPortal match tags.

match_key_match(string $match_tag, boolean $support_post) : boolean

Parameters

$match_tag

string

Match tags

$support_post

boolean

Check against POSTed data too

Returns

booleanWhether there is a match

Find whether the current user may see stack dumps.

may_see_stack_dumps() : boolean

Returns

booleanWhether the current user may see stack dumps

Find if a member is blocked by a member.

member_blocked(\MEMBER $member_id, \?MEMBER $member_blocker) : boolean

Parameters

$member_id

\MEMBER

The member being checked

$member_blocker

\?MEMBER

The member who may be blocking (NULL: current member)

Returns

booleanWhether the member is blocked

Find if a member is online.

member_is_online(\MEMBER $member_id) : boolean

Parameters

$member_id

\MEMBER

The member to check

Returns

booleanWhether they are online

Update the member tracker for the currently viewing user.

member_tracking_update() 

Record the memory usage at this point.

memory_trace_point(\?string $name) 

Parameters

$name

\?string

The name of the memory point (NULL: use a simple counter)

Get the time difference in microseconds between two PHP microtimes.

microtime_diff(string $a, string $b) : float

Original source: php.net

Parameters

$a

string

First microtime

$b

string

Second microtime

Returns

floatThe time difference

Assign this to explicitly declare that a variable may be of mixed type, and initialise to NULL.

mixed() : \?mixed

Returns

\?mixedOf mixed type (NULL: default)

Check to see if a module is installed.

module_installed(\ID_TEXT $module) : boolean

Parameters

$module

\ID_TEXT

The module name

Returns

booleanWhether it is

Find whether to run in multi-lang mode.

multi_lang() : boolean

Returns

booleanWhether to run in multi-lang mode.

Helper function to sort a list of maps by the value at $key in each of those maps.

multi_sort(array $a, array $b) : integer

Parameters

$a

array

The first to compare

$b

array

The second to compare

Returns

integerThe comparison result (0 for equal, -1 for less, 1 for more)

Format a local time/date according to locale settings.

my_strftime(string $format, \?TIME $timestamp) : string

Combines best features of 'strftime' and 'date'.

Parameters

$format

string

The formatting string.

$timestamp

\?TIME

The timestamp (NULL: now).

Returns

stringThe formatted string.

AJAX script for allowing username/author/search-terms home-in.

namelike_script() 

Get a nice formatted XHTML listed language file selector for the given language.

nice_get_lang_files(\?LANGUAGE_NAME $lang) : \tempcode

Parameters

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

Returns

\tempcodeThe language file selector

Get a nice formatted XHTML listed language selector.

nice_get_langs(\?LANGUAGE_NAME $select_lang, boolean $show_unset) : \tempcode

Parameters

$select_lang

\?LANGUAGE_NAME

The language to have selected by default (NULL: uses the current language)

$show_unset

boolean

Whether to show languages that have no language details currently defined for them

Returns

\tempcodeThe language selector

Get a list of zones.

nice_get_zones(\?ID_TEXT $sel, \?array $no_go, \?array $reorder) : \tempcode

Parameters

$sel

\?ID_TEXT

The zone in the list to select by default (NULL: use first)

$no_go

\?array

A list of zone to not put into the list (NULL: none to skip)

$reorder

\?array

A reordering (NULL: no reordering)

Returns

\tempcodeThe list

Get special SQL from POSTed parameters for a catalogue search field for a multi-input field that is to be exact-matched.

nl_delim_match_sql(array $row, integer $i, \ID_TEXT $type, \?string $param) : \?array

set short long

Parameters

$row

array

The row for the field to input

$i

integer

We're processing for the ith row

$type

\ID_TEXT

Table type

$param

\?string

Search term (NULL: lookup from environment)

Returns

\?arrayTuple of SQL details (array: extra trans fields to search, array: extra plain fields to search, string: an extra table segment for a join, string: the name of the field to use as a title, if this is the title, extra WHERE clause stuff) (NULL: nothing special)

Obfuscate the given e-mail address.

obfuscate_email_address(string $email) : string

This function may want to be modified on a per-site basis, to stop spammers triggering onto ocPortal's default method (possible some already do, although I think it unlikely they would go to this much effort/computation unless it was more widespread to do this).

Parameters

$email

string

The e-mail address to obfuscate

Returns

stringThe obfuscated version

Obfuscate the given text using HTML entity encoding.

obfuscate_entities(string $val) : string

Parameters

$val

string

The text to obfuscate

Returns

stringThe obfuscated version

Make an object of the given class

object_factory(string $class, boolean $null_ok) : \?object

Parameters

$class

string

The class name

$null_ok

boolean

Whether to return NULL if there is no such class

Returns

\?objectThe object (NULL: no such class)

Require all code relating to the OCF forum

ocf_require_all_forum_stuff() 

Turn an ocFilter (a filter specifying which records to match) into a list of ID numbers.

ocfilter_to_idlist_using_callback(string $filter, string $ids_and_parents_callback, \?string $parent_spec__table_name, \?string $parent_spec__parent_name, \?string $parent_field_name, \?string $parent_spec__field_name, boolean $numeric_record_set_ids, boolean $numeric_category_set_ids, \?object $db) : array

Parameters

$filter

string

The filter

$ids_and_parents_callback

string

A call_user_func_array specifier to a function that will give a map between record-set IDs and record-set parent-category-IDs. We pass a call_user_func_array specifier because we don't want to have to generate it unless we need to (if we need to do 'avoiding' matches or 'subtree' matches)

$parent_spec__table_name

\?string

The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (NULL: don't support subtree [*-style] searches)

$parent_spec__parent_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$parent_field_name

\?string

The database's field name for the record-set's container-category specifier (NULL: don't support subtree [*-style] searches)

$parent_spec__field_name

\?string

The database's field name for the category-set's category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$numeric_record_set_ids

boolean

Whether the record-set IDs are numeric

$numeric_category_set_ids

boolean

Whether the category-set IDs are numeric

$db

\?object

Database connection to use (NULL: website)

Returns

arrayA list of ID numbers

Turn an ocFilter (a filter specifying which records to match) into a list of ID numbers, relying on the database to extract the record-set.

ocfilter_to_idlist_using_db(string $filter, string $field_name, string $table_name, \?string $parent_spec__table_name, \?string $parent_spec__parent_name, \?string $parent_field_name, \?string $parent_spec__field_name, boolean $numeric_record_set_ids, boolean $numeric_category_set_ids, \?object $db) : array

Parameters

$filter

string

The filter

$field_name

string

The database's ID field for the record-set we're matching

$table_name

string

The database's table for the record-set we're matching

$parent_spec__table_name

\?string

The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (NULL: don't support subtree [*-style] searches)

$parent_spec__parent_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$parent_field_name

\?string

The database's field name for the record-set's container-category specifier (NULL: don't support subtree [*-style] searches)

$parent_spec__field_name

\?string

The database's field name for the category-set's category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$numeric_record_set_ids

boolean

Whether the record-set IDs are numeric

$numeric_category_set_ids

boolean

Whether the category-set IDs are numeric

$db

\?object

Database connection to use (NULL: website)

Returns

arrayA list of ID numbers

Turn an ocFilter (a filter specifying which records to match) into a list of ID numbers, using a prebuilt memory representation of the record-set.

ocfilter_to_idlist_using_memory(string $filter, array $ids_and_parents, \?string $parent_spec__table_name, \?string $parent_spec__parent_name, \?string $parent_field_name, \?string $parent_spec__field_name, boolean $numeric_record_set_ids, boolean $numeric_category_set_ids, \?object $db) : array

Parameters

$filter

string

The filter

$ids_and_parents

array

A map between record-set IDs and record-set parent-category-IDs

$parent_spec__table_name

\?string

The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (NULL: don't support subtree [*-style] searches)

$parent_spec__parent_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$parent_field_name

\?string

The database's field name for the record-set's container-category specifier (NULL: don't support subtree [*-style] searches)

$parent_spec__field_name

\?string

The database's field name for the category-set's category-ID (NULL: don't support subtree [*-style] searches beyond the tree base)

$numeric_record_set_ids

boolean

Whether the record-set IDs are numeric

$numeric_category_set_ids

boolean

Whether the category-set IDs are numeric

$db

\?object

Database connection to use (NULL: website)

Returns

arrayA list of ID numbers

Turn an ocFilter (a filter specifying which records to match) into an SQL query fragment.

ocfilter_to_sqlfragment(string $filter, string $field_name, \?string $parent_spec__table_name, \?string $parent_spec__parent_name, \?string $parent_field_name, \?string $parent_spec__field_name, boolean $numeric_record_set_ids, boolean $numeric_category_set_ids, \?object $db) : string

Parameters

$filter

string

The filter

$field_name

string

The database's ID field for the record-set we're matching. E.g. 'id'.

$parent_spec__table_name

\?string

The database's table that contains parent/child relationships in the record-set's category-set (the category-set is equal to the record-set if we're matching categories, but not if we're matching entries) (NULL: don't support subtree [*-style] searches). E.g. 'categories'.

$parent_spec__parent_name

\?string

The database's field name for the category-set's parent-category-ID (NULL: don't support subtree [*-style] searches beyond the tree base). E.g. 'parent_id'.

$parent_field_name

\?string

The database's field name for the record-set's container-category specifier (NULL: don't support subtree [*-style] searches). E.g. 'cat'.

$parent_spec__field_name

\?string

The database's field name for the category-set's category-ID (NULL: don't support subtree [*-style] searches beyond the tree base). E.g. 'id'.

$numeric_record_set_ids

boolean

Whether the record-set IDs are numeric

$numeric_category_set_ids

boolean

Whether the category-set IDs are numeric

$db

\?object

Database connection to use (NULL: website)

Returns

stringSQL query fragment

Get a cookie value.

ocp_admirecookie(string $name, \?string $default) : \?string

Parameters

$name

string

The name of the cookie

$default

\?string

The default value (NULL: just use the value NULL)

Returns

\?stringThe value stored in the cookie (NULL: the default default)

Deletes a cookie (if it exists), from within ocPortal's cookie environment.

ocp_eatcookie(string $name) : boolean

Parameters

$name

string

The name of the cookie

Returns

booleanThe result of the PHP setcookie command

Split a string into smaller chunks, with utf-8 awareness where possible/required.

ocp_mb_chunk_split(string $str, integer $len, string $glue) : string

Can be used to split a string into smaller chunks which is useful for e.g. converting base64_encode output to match RFC 2045 semantics. It inserts end (defaults to "\r\n") every chunklen characters.

Parameters

$str

string

The input string.

$len

integer

The maximum chunking length.

$glue

string

Split character.

Returns

stringThe chunked version of the input string.

Convert a string to an array, with utf-8 awareness where possible/required.

ocp_mb_str_split(string $str) : array

Parameters

$str

string

Input

Returns

arrayOutput

Get string length, with utf-8 awareness where possible/required.

ocp_mb_strlen(string $in) : integer

Parameters

$in

string

The string to get the length of.

Returns

integerThe string length.

Make a string lowercase, with utf-8 awareness where possible/required.

ocp_mb_strtolower(string $in) : string

Parameters

$in

string

Subject.

Returns

stringResult.

Make a string uppercase, with utf-8 awareness where possible/required.

ocp_mb_strtoupper(string $in) : string

Parameters

$in

string

Subject.

Returns

stringResult.

Return part of a string, with utf-8 awareness where possible/required.

ocp_mb_substr(string $in, integer $from, \?integer $amount, boolean $force) : \~string

Parameters

$in

string

The subject.

$from

integer

The start position.

$amount

\?integer

The length to extract (NULL: all remaining).

$force

boolean

Whether to force unicode as on.

Returns

\~stringString part (false: $start was over the end of the string).

Make a string title-case, with utf-8 awareness where possible/required.

ocp_mb_ucwords(string $in) : string

Parameters

$in

string

Subject.

Returns

stringResult.

Create a cookie, inside ocPortal's cookie environment.

ocp_setcookie(string $name, string $value, boolean $session, boolean $http_only) : boolean

Parameters

$name

string

The name of the cookie

$value

string

The value to store in the cookie

$session

boolean

Whether it is a session cookie (gets removed once the browser window closes)

$http_only

boolean

Whether the cookie should not be readable by Javascript

Returns

booleanThe result of the PHP setcookie command

Get server environment variables.

ocp_srv(string $key) : string

Parameters

$key

string

The variable name

Returns

stringThe variable value ('' means unknown)

Create file with unique file name, but works around compatibility issues between servers.

ocp_tempnam(string $prefix) : \~string

Note that the file is NOT automatically deleted. You should also delete it using "@unlink", as some servers have problems with permissions.

Parameters

$prefix

string

The prefix of the temporary file name.

Returns

\~stringThe name of the temporary file (false: error).

Decode a URL component that was encoded with hackerish_url_encode

ocp_url_decode_post_process(\URLPATH $url_part) : \URLPATH

Parameters

$url_part

\URLPATH

The URL to encode

Returns

\URLPATHThe encoded result

Encode a URL component in such a way that it won't get nuked by Apache %2F blocking security and url encoded '&' screwing.

ocp_url_encode(\URLPATH $url_part, \?boolean $consider_rewrite) : \URLPATH

The get_param function will map it back. Hackerish but necessary.

Parameters

$url_part

\URLPATH

The URL to encode

$consider_rewrite

\?boolean

Whether we have to consider mod_rewrite (NULL: don't know, look up)

Returns

\URLPATHThe encoded result

Encode a URL component, as per ocp_url_encode but without slashes being encoded.

ocp_url_encode_mini(\URLPATH $url_part, \?boolean $consider_rewrite) : \URLPATH

Parameters

$url_part

\URLPATH

The URL to encode

$consider_rewrite

\?boolean

Whether we have to consider mod_rewrite (NULL: don't know, look up)

Returns

\URLPATHThe encoded result

Get the major version of your installation.

ocp_version() : integer

Returns

integerThe major version number of your installation

Get the minor/patch version of your installation.

ocp_version_minor() : string

This changes with each release, including bug fix releases. It generally consists of 'a' or 'a.b', where 'a' increments represent major changes and 'b' increments represent tiny changes or alpha/beta/RC numbering.

Returns

stringThe minor/patch version number of your installation (e.g. 0.1 or 1.1 or RC1 or 1.RC1)

Get the general version number of your installation (incorporates major and first [numeric] component of minor version number).

ocp_version_number() : float

Returns

floatThe general version number of your installation

Get the full string version of ocPortal that you are running, in 'pretty' format.

ocp_version_pretty() : string

This is (and must be kept) equivalent to get_version_pretty__from_dotted(get_version_dotted())

Returns

stringThe string saying the full ocPortal version number

Get the timestamp at which this version was released.

ocp_version_time() : integer

Returns

integerThe timestamp at which this version was released.

Get the timestamp at which this MAJOR version was released.

ocp_version_time_major() : integer

Returns

integerThe timestamp at which this MAJOR version was released.

Rebuild the specified caches.

ocportal_cleanup(\?array $caches) : \tempcode

Parameters

$caches

\?array

The caches to rebuild (NULL: all)

Returns

\tempcodeAny messages returned

ocPortal error handler (hooked into PHP error system).

ocportal_error_handler(integer $errno, \PATH $errstr, string $errfile, integer $errline) : boolean

Parameters

$errno

integer

The error code-number

$errstr

\PATH

The error message

$errfile

string

The file the error occurred in

$errline

integer

The line the error occurred on

Returns

booleanAlways false

Convert some ocSelect filters into some SQL fragments.

ocselect_to_sql(object $db, array $filters, \ID_TEXT $content_type, string $context) : array

Parameters

$db

object

Database object to use

$filters

array

Parsed ocSelect structure

$content_type

\ID_TEXT

The content type (blank: no function needed, direct in-table mapping always works)

$context

string

First parameter to send to the conversion function, may mean whatever that function wants it to. If we have no conversion function, this is the name of a table to read field meta data from

Returns

arrayTuple: array of extra select, array of extra join, string of extra where

Open up our language cache file for appending.

open_page_cache_file() 

Server opensearch requests.

opensearch_script() 

Get a string (natural for Tempcode's stream-based processing-model) representation of a bound Tempcode variable

output_tempcode_parameter(mixed $var, \ID_TEXT $parameter, \ID_TEXT $template_name) : string

Parameters

$var

mixed

Variable (or NULL if not set)

$parameter

\ID_TEXT

The name of the parameter

$template_name

\ID_TEXT

The name of the template

Returns

stringValue

Render that the page wasn't found.

page_not_found(\ID_TEXT $codename, \ID_TEXT $zone) : \tempcode

Show alternate likely candidates based on misspellings.

Parameters

$codename

\ID_TEXT

The codename of the page to load

$zone

\ID_TEXT

The zone the page is being loaded in

Returns

\tempcodeMessage

Get the tempcode for a paragraph.

paragraph(mixed $text, string $guid, \?string $class) : \tempcode

This function should only be used with escaped text strings that need to be put into a paragraph, not with sections of HTML. Remember, paragraphs are literally that, and should only be used with templates that don't assume that they are going to put the given parameters into paragraphs themselves.

Parameters

$text

mixed

The text to put into the paragraph (string or tempcode)

$guid

string

GUID for call

$class

\?string

CSS classname (NULL: none)

Returns

\tempcodeThe generated paragraph

Parse some string based ocSelect search filters into the expected array structure.

parse_ocselect(string $filter) : array

Parameters

$filter

string

String-based search filter

Returns

arrayParsed structure

get_translated_tempcode was asked for a lang entry that had not been parsed into Tempcode yet.

parse_translated_text(integer $entry, \?object $connection, \?LANGUAGE_NAME $lang, boolean $force, boolean $as_admin) : \?tempcode

Parameters

$entry

integer

The id

$connection

\?object

The database connection to use (NULL: standard site connection)

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$force

boolean

Whether to force it to the specified language

$as_admin

boolean

Whether to force as_admin, even if the lang string isn't stored against an admin (designed for comcode page cacheing)

Returns

\?tempcodeThe parsed comcode (NULL: the text couldn't be looked up)

Check if a privilege exists.

permission_exists(\ID_TEXT $name) : boolean

Parameters

$name

\ID_TEXT

The name of the option

Returns

booleanWhether it exists

Delete data from the persistent cache.

persistent_cache_delete(mixed $key) 

Parameters

$key

mixed

Key name

Remove all data from the persistent cache.

persistent_cache_empty() 

Get data from the persistent cache.

persistent_cache_get(mixed $key, \?TIME $min_cache_date) : \?mixed

Parameters

$key

mixed

Key

$min_cache_date

\?TIME

Minimum timestamp that entries from the cache may hold (NULL: don't care)

Returns

\?mixedThe data (NULL: not found / NULL entry)

Put data into the persistent cache.

persistent_cache_set(mixed $key, mixed $data, boolean $server_wide, \?integer $expire_secs) 

Parameters

$key

mixed

Key

$data

mixed

The data

$server_wide

boolean

Whether it is server-wide data

$expire_secs

\?integer

The expiration time in seconds. (NULL: Default expiry in 60 minutes, or never if it is server-wide).

Escape a string to fit within PHP double quotes.

php_addslashes(string $in) : string

Parameters

$in

string

String in

Returns

stringResultant string

Escape a string to fit within PHP double quotes TWICE.

php_addslashes_twice(string $in) : string

Needed sometimes when generating code. This function exists for performance reasons.

Parameters

$in

string

String in

Returns

stringResultant string

Escape a string to fit within PHP double quotes TWICE.

php_addslashes_twice(string $in) : string

Needed sometimes when generating code. This function exists for performance reasons.

Parameters

$in

string

String in

Returns

stringResultant string

Get the number of bytes for a PHP config option.

php_return_bytes(string $val) : integer

Code taken from the PHP manual.

Parameters

$val

string

PHP config option value.

Returns

integerNumber of bytes.

Get the value of the specified POST key, if it is found, or the default otherwise.

post_param(\ID_TEXT $name, \?mixed $default, boolean $html, boolean $conv_from_wysiwyg) : \?string

Parameters

$name

\ID_TEXT

The name of the parameter to get

$default

\?mixed

The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)

$html

boolean

Whether we are cleaning for HTML rather than Comcode/plain-text

$conv_from_wysiwyg

boolean

Whether to convert WYSIWYG contents to Comcode automatically

Returns

\?stringThe parameter value (NULL: missing)

This function is the integeric partner of post_param, as it returns the value as an integer.

post_param_integer(\ID_TEXT $name, \?mixed $default) : \?integer

Parameters

$name

\ID_TEXT

The name of the parameter to get

$default

\?mixed

The default value to give the parameter if the parameter value is not defined or the empty string (NULL: allow missing parameter) (false: give error on missing parameter)

Returns

\?integerThe parameter value (NULL: not set, and NULL given as default)

Script to show previews of content being added/edited.

preview_script() 

Get a decent randomised salt.

produce_salt() : \ID_TEXT

Returns

\ID_TEXTThe salt

Propagate ocSelect through links.

propagate_ocselect() : array

Returns

arrayExtra URL mappings

Stop some text being escapable by the Tempcode layer.

protect_from_escaping(mixed $in) : \tempcode

Parameters

$in

mixed

Text

Returns

\tempcodeText that can't be escaped

Get the tempcode for a standard box (CSS driven), with the specified content entered.

put_in_standard_box(\tempcode $content, mixed $title, \ID_TEXT $type, string $width, string $options, string $meta, string $links, string $top_links) : \tempcode

Please rarely use this function; it is not good to assume people want anythings in one of these boxes... use templates instead

Parameters

$content

\tempcode

The content being put inside the box

$title

mixed

The title of the standard box, string or Tempcode (blank: titleless standard box)

$type

\ID_TEXT

The type of the box. Refers to a template (STANDARDBOX_type)

$width

string

The CSS width

$options

string

'|' separated list of options (meaning dependant upon templates interpretation)

$meta

string

'|' separated list of meta information (key|value|key|value|...)

$links

string

'|' separated list of link information (linkhtml|...)

$top_links

string

Link to be added to the header of the box

Returns

\tempcodeThe contents, put inside a standard box, according to the other parameters

Put a result into the cache.

put_into_cache(\ID_TEXT $codename, integer $ttl, \LONG_TEXT $cache_identifier, mixed $cache, \?array $_langs_required, \?array $_javascripts_required, \?array $_csss_required, boolean $tempcode, \?ID_TEXT $theme, \?LANGUAGE_NAME $lang) 

Parameters

$codename

\ID_TEXT

The codename to check for cacheing

$ttl

integer

The TTL of what is being cached in minutes

$cache_identifier

\LONG_TEXT

The requisite situational information (a serialized map) [-> further restraints when reading]

$cache

mixed

The result we are cacheing

$_langs_required

\?array

A list of the language files that need loading to use tempcode embedded in the cache (NULL: none required)

$_javascripts_required

\?array

A list of the javascript files that need loading to use tempcode embedded in the cache (NULL: none required)

$_csss_required

\?array

A list of the css files that need loading to use tempcode embedded in the cache (NULL: none required)

$tempcode

boolean

Whether we are cacheing Tempcode (needs special care)

$theme

\?ID_TEXT

The theme this is being cached for (NULL: current theme)

$lang

\?LANGUAGE_NAME

The language this is being cached for (NULL: current language)

Take a URL and base-URL, and fully qualify the URL according to it.

qualify_url(\URLPATH $url, \URLPATH $url_base) : \URLPATH

Parameters

$url

\URLPATH

The URL to fully qualified

$url_base

\URLPATH

The base-URL

Returns

\URLPATHFully qualified URL

Outputs a modal question dialog.

question_ui_script() 

Do an RBL lookup (low level, uninterpreted).

rbl_resolve(\IP $ip, \ID_TEXT $rbl_domain, boolean $page_level) : \?array

Parameters

$ip

\IP

The IP address to lookup

$rbl_domain

\ID_TEXT

The RBL domain

$page_level

boolean

Whether this is a page level check (i.e. we won't consider blocks or approval, just ban setting)

Returns

\?arrayReturn result (NULL: error)

Read a multi code from a named parameter stub.

read_multi_code(\ID_TEXT $param) : \SHORT_TEXT

Parameters

$param

\ID_TEXT

The parameter stub (stub of a series of POST parameters, made by ocf_get_forum_multi_code_field's field or similar).

Returns

\SHORT_TEXTThe multi code.

Read an ocSelect parameter value from GET/POST.

read_ocselect_parameter_from_env(\ID_TEXT $field_name, \?ID_TEXT $field_type) : string

Parameters

$field_name

\ID_TEXT

The field name

$field_type

\?ID_TEXT

The field type (NULL: work out what is there to read automatically)

Returns

stringThe parameter value

Read a text file, using the _custom system

read_text_file(string $codename, \?LANGUAGE_NAME $lang, boolean $missing_blank) : string

Parameters

$codename

string

The file name (without .txt)

$lang

\?LANGUAGE_NAME

The language to load from (NULL: none) (blank: search)

$missing_blank

boolean

Whether to tolerate missing files

Returns

stringThe file contents

Redirect the user - transparently, storing a message that will be shown on their destination page.

redirect_screen(\tempcode $title, mixed $url, mixed $text, boolean $intermediatory_hop, \ID_TEXT $msg_type) : \tempcode

set warn inform fatal

Parameters

$title

\tempcode

Title to display on redirect page

$url

mixed

Destination URL (may be Tempcode)

$text

mixed

Message to show (may be Tempcode)

$intermediatory_hop

boolean

For intermediatory hops, don't mark so as to read status messages - save them up for the next hop (which will not be intermediatory)

$msg_type

\ID_TEXT

Code of message type to show

Returns

\tempcodeRedirection message (likely to not actually be seen due to instant redirection)

Reinstall a block if it has become corrupted for any reason.

reinstall_block(\ID_TEXT $block) : boolean

Again, you should not need to use this function.

Parameters

$block

\ID_TEXT

The name of the block to reinstall

Returns

booleanWhether installation was required

Reinstall the specified module.

reinstall_module(\ID_TEXT $zone, \ID_TEXT $module) : boolean

Parameters

$zone

\ID_TEXT

The zone name

$module

\ID_TEXT

The module name

Returns

booleanWhether a module installer had to be run

Relay an error message, if appropriate, to e-mail listeners (sometimes ocProducts, and site staff).

relay_error_notification(string $text, boolean $ocproducts, \ID_TEXT $notification_type) 

Parameters

$text

string

A error message (in HTML)

$ocproducts

boolean

Also send to ocProducts

$notification_type

\ID_TEXT

The notification type

Remove some code from a function in the given code snippet.

remove_code(string $code, string $function, string $command, integer $instance_of_command) : boolean

Parameters

$code

string

The code.

$function

string

Name of the function.

$command

string

The command we're searching to insert by.

$instance_of_command

integer

We remove the nth instance of this command.

Returns

booleanSuccess status.

Remove any duplication inside the list of rows (each row being a map).

remove_duplicate_rows(array $rows, string $id_field) : array

Duplication is defined by rows with correspinding IDs.

Parameters

$rows

array

The rows to remove duplication of

$id_field

string

The ID field

Returns

arrayThe filtered rows

Remove an IP-ban.

remove_ip_ban(\IP $ip) 

Parameters

$ip

\IP

The IP address to unban

Remove the magic encryption marker from some data.

remove_magic_encryption_marker(string $data) : string

This should be used if the data is to be displayed or presented for editing, but not if it's to be put in the database. If the data does not have a magic encryption marker, the original string will be returned.

Parameters

$data

string

Data

Returns

stringData, without the magic marker

Map spaces to %20 and put http:// in front of URLs starting www.

remove_url_mistakes(\URLPATH $url) : \URLPATH

Parameters

$url

\URLPATH

The URL to fix

Returns

\URLPATHThe fixed result

Take a URL and process it to make a hard include.

reprocess_url(\URLPATH $url, \URLPATH $operation_base_url) : string

We'll get the HTML and we'll also load up some global stuff for 'do_header' to use.

Parameters

$url

\URLPATH

The URL that we're operating on.

$operation_base_url

\URLPATH

We open up linked URLs under this recursively.

Returns

stringThe cleaned up contents at the URL, set up for the recursive integrator usage.

Take the specified parameters, and try to find the corresponding page, then execute a function to load the page (load_html_page/load_comcode_page).

request_page(\ID_TEXT $codename, boolean $required, \?ID_TEXT $zone, \?ID_TEXT $page_type, boolean $being_included, boolean $no_redirect_check) : \?tempcode

Parameters

$codename

\ID_TEXT

The codename of the page to load

$required

boolean

Whether it is required for this page to exist (shows an error if it doesn't) -- otherwise, it will just return NULL

$zone

\?ID_TEXT

The zone the page is being loaded in (NULL: as shown by access URL)

$page_type

\?ID_TEXT

The type of page - for if you know it (NULL: don't know it)

$being_included

boolean

Whether the page is being included from another

$no_redirect_check

boolean

Whether to not check for redirects (normally you would)

Returns

\?tempcodeThe page (NULL: no page)

Request that CRON loads up a block's caching in the background.

request_via_cron(\ID_TEXT $codename, \?array $map, boolean $tempcode) 

Parameters

$codename

\ID_TEXT

The codename of the block

$map

\?array

Parameters to call up block with if we have to defer caching (NULL: none)

$tempcode

boolean

Whether we are cacheing Tempcode (needs special care)

Include all the language files for use in the script.

require_all_lang(\?LANGUAGE_NAME $lang, boolean $only_if_for_lang) 

NOTE: This may reduce performance, so you should only use it if you really have to.

Parameters

$lang

\?LANGUAGE_NAME

The language to include files from (NULL: use current users language).

$only_if_for_lang

boolean

Only load it up if it is specifically defined for our language.

Require all the open language files.

require_all_open_lang_files(\?LANGUAGE_NAME $lang) 

This doesn't hurt performance a lot.

Parameters

$lang

\?LANGUAGE_NAME

The language to require open files from (NULL: uses the current language)

This function is a very important one when coding.

require_code(string $codename, boolean $light_exit) 

It allows you to include a source code file (from root/sources/ or root/sources_custom/) through the proper channels. You should remember this function, and not substitute anything else for it, as that will likely make your code unstable. It is key to source code modularity in ocPortal.

Parameters

$codename

string

The codename for the source module to load (or a full relative path, ending with .php; if custom checking is needed, this must be the custom version)

$light_exit

boolean

Whether to cleanly fail when a source file is missing

Require code, but without looking for sources_custom overrides

require_code_no_override(string $codename) 

Parameters

$codename

string

The codename for the source module to load

Make sure that the given CSS file is loaded up.

require_css(\ID_TEXT $css) 

Parameters

$css

\ID_TEXT

The CSS file required

Make sure that the given javascript file is loaded up.

require_javascript(\ID_TEXT $javascript) 

Parameters

$javascript

\ID_TEXT

The javascript file required

Includes a language file for use in the script.

require_lang(\ID_TEXT $codename, \?LANGUAGE_NAME $lang, \?string $type, boolean $ignore_errors) 

If $type is not null, then this specifies whether to use 'lang_custom' or 'custom' (otherwise, normal priorities occur).

set lang_custom custom

Parameters

$codename

\ID_TEXT

The language file name

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$type

\?string

The language type (lang_custom, or custom) (NULL: normal priorities are used)

$ignore_errors

boolean

Whether to just return if there was a loading error

Load up a language file, compiling it (it's not cached yet).

require_lang_compile(\ID_TEXT $codename, \?LANGUAGE_NAME $lang, \?string $type, \PATH $cache_path, boolean $ignore_errors) : boolean

set lang_custom custom

Parameters

$codename

\ID_TEXT

The language file name

$lang

\?LANGUAGE_NAME

The language (NULL: uses the current language)

$type

\?string

The language type (lang_custom, or custom) (NULL: normal priorities are used)

$cache_path

\PATH

Where we are cacheing too

$ignore_errors

boolean

Whether to just return if there was a loading error

Returns

booleanWhether we FAILED to load

Backdoor handler.

restricted_manually_enabled_backdoor() : \MEMBER

Can only be activated by those with FTP write-access.

Returns

\MEMBERThe member to simulate

Add ocPortal's strictness, after finishing with third-party code.

restrictify() 

To be run optionally at some point after destrictify().

AJAX script to retrieve an autosave.

retrieve_autosave() 

Find whether a certain script is being run to get here.

running_script(string $is_this_running) : boolean

Parameters

$is_this_running

string

Script filename (canonically we want NO .php file type suffix)

Returns

booleanWhether the script is running

Send a "your content has been validated" notification out to the submitter of some content.

send_content_validated_notification(\ID_TEXT $content_type, \ID_TEXT $content_id) 

Only call if this is true ;).

Parameters

$content_type

\ID_TEXT

Content type

$content_id

\ID_TEXT

Content ID

Send (by e-mail) a validation request for a submitted item to the admin.

send_validation_request(\ID_TEXT $type, \?ID_TEXT $table, boolean $non_integer_id, \ID_TEXT $id, \tempcode $url, \?MEMBER $member_id) 

Parameters

$type

\ID_TEXT

The validation request will say one of this type has been submitted. By convention it is the language code of what was done, e.g. ADD_DOWNLOAD

$table

\?ID_TEXT

The table saved into (NULL: unknown)

$non_integer_id

boolean

Whether the ID field is not an integer

$id

\ID_TEXT

The validation request will say this ID has been submitted

$url

\tempcode

The validation request will link to this URL

$member_id

\?MEMBER

Member doing the submitting (NULL: current member)

Get template fields to insert into a form page, for manipulation of seo fields.

seo_get_fields(\ID_TEXT $type, \?ID_TEXT $id) : \tempcode

Parameters

$type

\ID_TEXT

The type of resource (e.g. download)

$id

\?ID_TEXT

The ID of the resource (NULL: adding)

Returns

\tempcodeForm page tempcode fragment

Erase a seo entry.

seo_meta_erase_storage(\ID_TEXT $type, \ID_TEXT $id) 

.. as these shouldn't be left hanging around once content is deleted.

Parameters

$type

\ID_TEXT

The type of resource (e.g. download)

$id

\ID_TEXT

The ID of the resource

Get meta information for specified resource

seo_meta_get_for(\ID_TEXT $type, \ID_TEXT $id) : array

Parameters

$type

\ID_TEXT

The type of resource (e.g. download)

$id

\ID_TEXT

The ID of the resource

Returns

arrayThe first element is the meta keyword string for the specified resource, and the other is the meta description string.

Load the specified resource's meta information into the system for use on this page.

seo_meta_load_for(\ID_TEXT $type, \ID_TEXT $id, \?string $title) 

Also, if the title is specified then this is used for the page title.

Parameters

$type

\ID_TEXT

The type of resource (e.g. download)

$id

\ID_TEXT

The ID of the resource

$title

\?string

The page-specific title to use, in Comcode or plain-text format with possible HTML entities included [Comcode will later be stripped] (NULL: none)

Explictly sets the meta information for the specified resource.

seo_meta_set_for_explicit(\ID_TEXT $type, \ID_TEXT $id, \SHORT_TEXT $keywords, \SHORT_TEXT $description) 

Parameters

$type

\ID_TEXT

The type of resource (e.g. download)

$id

\ID_TEXT

The ID of the resource

$keywords

\SHORT_TEXT

The keywords to use

$description

\SHORT_TEXT

The description to use

Sets the meta information for the specified resource, by auto-summarisation from the given parameters.

seo_meta_set_for_implicit(\ID_TEXT $type, \ID_TEXT $id, array $keyword_sources, \SHORT_TEXT $description) : \SHORT_TEXT

Parameters

$type

\ID_TEXT

The type of resource (e.g. download)

$id

\ID_TEXT

The ID of the resource

$keyword_sources

array

Array of content strings to summarise from

$description

\SHORT_TEXT

The description to use

Returns

\SHORT_TEXTKeyword string generated (it's also saved in the DB, so usually you won't want to collect this)

Assuming that permission details are POSTed, set the permissions for the specified category, in the current page

set_category_permissions_from_environment(\ID_TEXT $module, \ID_TEXT $category, \?ID_TEXT $page) 

Parameters

$module

\ID_TEXT

The ID code for the module being checked for category access

$category

\ID_TEXT

The ID code for the category being checked for access (often, a number cast to a string)

$page

\?ID_TEXT

The page this is for (NULL: current page)

Change whatever global context that is required in order to run from a different context.

set_execution_context(array $new_get, \ID_TEXT $new_zone, \ID_TEXT $new_current_script, boolean $erase_keep_also) : array

Parameters

$new_get

array

The URL component map (must contain 'page').

$new_zone

\ID_TEXT

The zone.

$new_current_script

\ID_TEXT

The running script.

$erase_keep_also

boolean

Whether to get rid of keep_ variables in current URL.

Returns

arrayA list of parameters that would be required to be passed back to reset the state.

Set the specified situational value to the specified long value.

set_long_value(\ID_TEXT $name, \?SHORT_TEXT $value) 

Long values are either really long strings, or just ones you don't want on each page load (i.e. it takes a query to read them, because you don't always need them).

Parameters

$name

\ID_TEXT

The name of the value

$value

\?SHORT_TEXT

The value (NULL: delete it)

Set a configuration option with the specified values.

set_option(\ID_TEXT $name, \LONG_TEXT $value, \?ID_TEXT $type, \?LONG_TEXT $current_value) 

set float integer tick line text transline transtext list date forum category usergroup

Parameters

$name

\ID_TEXT

The name of the value

$value

\LONG_TEXT

The value

$type

\?ID_TEXT

The type of the option. This is normally ommited, but to save a DB lookup, may be passed through (NULL: work out the type)

$current_value

\?LONG_TEXT

The current value of the config option (NULL: unknown). This is just for efficiency for remapping language config options.

Assuming that permission details are POSTed, set the permissions for the specified category, in the current page

set_page_permissions_from_environment(\ID_TEXT $zone, \ID_TEXT $page) 

Parameters

$zone

\ID_TEXT

The ID code for the zone

$page

\ID_TEXT

The ID code for the page

Set the session ID of the user.

set_session_id(integer $id, boolean $guest_session) 

Parameters

$id

integer

The session ID

$guest_session

boolean

Whether this is a guest session (guest sessions will use persistent cookies)

Sets the privilege of a usergroup

set_specific_permission(\GROUP $group_id, \ID_TEXT $permission, boolean $value, \?ID_TEXT $page, \?ID_TEXT $category_type, \?ID_TEXT $category_name) 

Parameters

$group_id

\GROUP

The usergroup having the permission set

$permission

\ID_TEXT

The codename of the permission

$value

boolean

Whether the usergroup has the permission

$page

\?ID_TEXT

The ID code for the page being checked (NULL: current page)

$category_type

\?ID_TEXT

The category-type for the permission (NULL: none required)

$category_name

\?ID_TEXT

The category-name/value for the permission (NULL: none required)

Set the specified situational value to the specified value.

set_value(\ID_TEXT $name, \SHORT_TEXT $value) 

Parameters

$name

\ID_TEXT

The name of the value

$value

\SHORT_TEXT

The value

AJAX script for dynamic inclusion of CSS.

sheet_script() 

Find whether a file is known to be something that should/could be there but isn't an ocPortal distribution file, or for some other reason should be ignored.

should_ignore_file(string $filepath, integer $bitmask, integer $bitmask_defaults) : boolean

Parameters

$filepath

string

File path (relative to ocPortal base directory)

$bitmask

integer

Bitmask of extra stuff to ignore (see IGNORE_* constants)

$bitmask_defaults

integer

Set this to 0 if you don't want the default IGNORE_* constants to carry through

Returns

booleanWhether it should be ignored

Output whatever memory points we collected up.

show_memory_points() 

Shuffle an array into an array of columns.

shuffle_for(integer $by, array $in) : array

Parameters

$by

integer

The number of columns

$in

array

The source array

Returns

arrayArray of columns

Script to track clicks to external sites.

simple_tracker_script() 

Do a wildcard match by converting to a regular expression.

simulated_wildcard_match(string $context, string $word, boolean $full_cover) : boolean

Parameters

$context

string

The haystack

$word

string

The needle (a wildcard expression)

$full_cover

boolean

Whether full-coverance is required

Returns

booleanWhether we have a match

The do-next manager for after content management.

site_tree_do_next_manager(\tempcode $title, \?ID_TEXT $page, \ID_TEXT $zone, \tempcode $completion_text) : \tempcode

Parameters

$title

\tempcode

The title (output of get_screen_title)

$page

\?ID_TEXT

The name of the page just handled (NULL: none)

$zone

\ID_TEXT

The name of the zone just handled (blank: none/welcome-zone)

$completion_text

\tempcode

The text to show (blank: default)

Returns

\tempcodeThe UI

AJAX script for dynamically extended sitetree.

site_tree_script() 

Top level function to (re)generate a Sitemap (xml file, Google-style).

sitemaps_build() 

Finalise the writing to a Sitemaps XML file.

sitemaps_xml_finished() 

Initialise the writing to a Sitemaps XML file.

sitemaps_xml_initialise(\PATH $file_path) 

You can only call one of these functions per time as it uses global variables for tracking.

Parameters

$file_path

\PATH

Where we will save to.

Find whether we can skip the normal preservation of a keep value, for whatever reason.

skippable_keep(string $key, string $val) : boolean

Parameters

$key

string

Parameter name

$val

string

Parameter value

Returns

booleanWhether we can skip it

AJAX script for dynamic inclusion of XHTML snippets.

snippet_script() 

Sort search results as returned by the search hook.

sort_search_results(array $hook_results, array $results, string $direction) : array

set ASC DESC

Parameters

$hook_results

array

Search results from the search hook, assumed already sorted

$results

array

Existing array of results (originally starts blank)

$direction

string

Sort direction

Returns

arraySorted results

Start up a search for page-links, writing results into the callback.

spawn_page_crawl(string $callback, \MEMBER $member_id, \?array $extra_filters, integer $depth) 

Usually we pass a callback that builds a Sitemap XML file, but we don't need to- it can be anything.

Parameters

$callback

string

Callback function to send discovered page-links to.

$member_id

\MEMBER

The member we are finding stuff for (we only find what the member can view).

$extra_filters

\?array

Page-links to skip (NULL: none). Currently this only works on pages, but may be expanded in the future.

$depth

integer

Code for how deep we are tunnelling down, in terms of what kinds of things we'll go so far as to collect. Use DEPTH__* constants for the values.

Handle special page type output.

special_page_types(\ID_TEXT $special_page_type, \tempcode $out, string $out_evaluated) 

set query templates tree lang

Parameters

$special_page_type

\ID_TEXT

The special page type.

$out

\tempcode

The normal script tempcode output

$out_evaluated

string

The normal script evaluated output

Get a splurghified version of the specified item.

splurgh_master_build(string $key_name, array $map, \URLPATH $url_stub, \ID_TEXT $_cache_file, \TIME $last_change_time, \?AUTO_LINK $first_id) : string

Parameters

$key_name

string

The name of what the key we want to reference is in our array of maps (e.g. 'id')

$map

array

A row of maps for data we are splurghing; this is probably just the result of $GLOBALS['SITE_DB']->query_select

$url_stub

\URLPATH

The stub that links will be passed through

$_cache_file

\ID_TEXT

The page name we will be saving customised HTML under

$last_change_time

\TIME

The time we did our last change to the data being splurghed (so it can see if we can simply decache instead of deriving)

$first_id

\?AUTO_LINK

The ID that is at the root of our tree (NULL: db_get_first_id)

Returns

stringA string of HTML that represents our splurghing (will desplurgh in the users browser)

Outputs the staff tips iframe.

staff_tips_script(boolean $ret) : \?object

Parameters

$ret

boolean

Whether to get the output instead of outputting it directly

Returns

\?objectOutput (NULL: outputted it already)

Simple function to evaluate some Tempcode.

static_evaluate_tempcode(\tempcode $ob) : string

Very rarely to be used, only if you can't call a method (e.g. you are copying direct into an array, such as in block cacheing).

Parameters

$ob

\tempcode

Tempcode object

Returns

stringEvaluated string

Simple function to evaluate some Tempcode.

static_evaluate_tempcode(\tempcode $ob) : string

Very rarely to be used, only if you can't call a method (e.g. you are copying direct into an array, such as in block cacheing).

Parameters

$ob

\tempcode

Tempcode object

Returns

stringEvaluated string

AJAX script to store an autosave.

store_autosave() 

Save meta data into content type's custom fields, by looking for fields named after the EXIF/EXIF-emulated meta data (specifically in English).

store_exif(\ID_TEXT $content_type, \ID_TEXT $content_id, array $exif, \?array $map) 

Spaces may be added to the names to make them prettier, but otherwise they must be the same. Designed to be used by headless-importers, e.g. bulk importing of media files, to make the process a bit smarter.

Parameters

$content_type

\ID_TEXT

The content type

$content_id

\ID_TEXT

The content ID

$exif

array

The EXIF data

$map

\?array

Extra meta data to store, against explicit field IDs (NULL: none)

Isolate the words in the input string.

str_word_count(string $input, integer $format) : mixed

set 0 1 2

Parameters

$input

string

String to count words in

$format

integer

The format

Returns

mixedTypically a list - the words of the input string

Helper function for usort to sort a list by string length.

strlen_sort(string $a, string $b) : integer

Parameters

$a

string

The first string to compare

$b

string

The second string to compare

Returns

integerThe comparison result (0 for equal, -1 for less, 1 for more)

Give the user an option to see a stack trace by adding in a link, but only if they have permission

suggest_fatalistic() 

Called when content is added, or edited/moved, based upon a new form field that specifies what moniker to use.

suggest_new_idmoniker_for(\ID_TEXT $page, \ID_TEXT $type, \ID_TEXT $id, string $moniker_src, boolean $is_new) : string

Parameters

$page

\ID_TEXT

Page name.

$type

\ID_TEXT

Screen type code.

$id

\ID_TEXT

Resource ID.

$moniker_src

string

String from which a moniker will be chosen (may not be blank).

$is_new

boolean

Whether we are sure this is a new moniker (makes things more efficient, saves a query).

Returns

stringThe chosen moniker.

This will create a new tempcode object that is containing a single specifed symbol

symbol_tempcode(\ID_TEXT $symbol, \?array $parameters, \?array $escape) : \tempcode

Parameters

$symbol

\ID_TEXT

The ID of the symbol to use

$parameters

\?array

Symbol parameters (NULL: none)

$escape

\?array

Escaping (NULL: none)

Returns

\tempcodeA symbol tempcode object

This will create a new tempcode object that is containing a single specifed symbol

symbol_tempcode(\ID_TEXT $symbol, \?array $parameters, \?array $escape) : \tempcode

Parameters

$symbol

\ID_TEXT

The ID of the symbol to use

$parameters

\?array

Symbol parameters (NULL: none)

$escape

\?array

Escaping (NULL: none)

Returns

\tempcodeA symbol tempcode object

Handle truncation symbols in all their complexity

symbol_truncator(array $param, string $type, \?mixed $tooltip_if_truncated) : string

set left right spread

Parameters

$param

array

Parameters passed to the symbol (0=text, 1=amount, 2=tooltip?, 3=is_html?, 4=use as grammatical length rather than HTML byte length, 5=fractional-deviation-tolerance for grammar-preservation)

$type

string

The type of truncation to do

$tooltip_if_truncated

\?mixed

Tooltip to add on, but only if we end up creating our own tooltip (NULL: none)

Returns

stringThe result.

Provides a hook for file synchronisation between mirrored servers.

sync_file(\PATH $filename) 

Called after any file creation, deletion or edit.

Parameters

$filename

\PATH

File/directory name to sync on (full path)

Provides a hook for file-move synchronisation between mirrored servers.

sync_file_move(\PATH $old, \PATH $new) 

Called after any rename or move action.

Parameters

$old

\PATH

File/directory name to move from (may be full or relative path)

$new

\PATH

File/directory name to move to (may be full or relative path)

Syndicate human-intended descriptions of activities performed to the internal wall, and external listeners.

syndicate_described_activity(string $a_language_string_code, string $a_label_1, string $a_label_2, string $a_label_3, string $a_pagelink_1, string $a_pagelink_2, string $a_pagelink_3, string $a_addon, \BINARY $a_is_public, \?MEMBER $a_member_id, boolean $sitewide_too, \?MEMBER $a_also_involving) 

Parameters

$a_language_string_code

string

Language string code

$a_label_1

string

Label 1 (given as a parameter to the language string code)

$a_label_2

string

Label 2 (given as a parameter to the language string code)

$a_label_3

string

Label 3 (given as a parameter to the language string code)

$a_pagelink_1

string

Page link 1

$a_pagelink_2

string

Page link 2

$a_pagelink_3

string

Page link 3

$a_addon

string

Addon that caused the event

$a_is_public

\BINARY

Whether this post should be public or friends-only

$a_member_id

\?MEMBER

Member being written for (NULL: current member)

$sitewide_too

boolean

Whether to push this out as a site event if user requested

$a_also_involving

\?MEMBER

Member also 'intimately' involved, such as a content submitter who is a friend (NULL: none)

Syndicate a spammer report out to wherever we can.

syndicate_spammer_report(\IP $ip_addr, \ID_TEXT $username, \EMAIL $email, string $reason, boolean $trigger_error) 

Parameters

$ip_addr

\IP

IP address to report

$username

\ID_TEXT

Username address to report

$email

\EMAIL

Email address to report

$reason

string

The reason for the report (blank: none)

$trigger_error

boolean

Whether to throw an ocPortal error, on error. Should not be 'true' for automatic spammer reports, as the spammer should not see the submission process in action!

Are we currently running HTTPS.

tacit_https() : boolean

Returns

booleanIf we are

Add a file to the specified TAR file.

tar_add_file(array $resource, \PATH $target_path, string $data, integer $_mode, \TIME $_mtime, boolean $data_is_path, boolean $return_on_errors) 

Parameters

$resource

array

The TAR file handle

$target_path

\PATH

The relative path to where we wish to add the file to the archive (including filename)

$data

string

The data of the file to add

$_mode

integer

The file mode (permissions)

$_mtime

\TIME

The modification time we wish for our file

$data_is_path

boolean

Whether the $data variable is actually a full file path

$return_on_errors

boolean

Whether to return on errors

Add a folder to the TAR archive

tar_add_folder(array $resource, \?resource $logfile, \PATH $path, \?integer $max_size, \PATH $subpath, \?array $avoid_backing_up, \?array $root_only_dirs, boolean $tick, boolean $all_files) 

Parameters

$resource

array

The TAR file handle

$logfile

\?resource

The logfile to write to (NULL: no logging)

$path

\PATH

The full path to the folder to add

$max_size

\?integer

The maximum file size to add (NULL: no limit)

$subpath

\PATH

The subpath relative to the path (should be left as the default '', as this is used for the recursion to distinguish the adding base path from where it's currently looking)

$avoid_backing_up

\?array

A map (filename=>1) of files to not back up (NULL: none)

$root_only_dirs

\?array

A list of directories ONLY to back up from the root (NULL: no restriction)

$tick

boolean

Whether to output spaces as we go to keep the connection alive

$all_files

boolean

Whether to not skip "special files" (ones not normally archive)

Add a folder to the TAR archive, however only store files modifed after a threshold time.

tar_add_folder_incremental(array $resource, \?resource $logfile, \PATH $path, \TIME $threshold, \?integer $max_size, \PATH $subpath, boolean $all_files) : array

It is incremental (incremental backup), by comparing against a threshold before adding a file (threshold being time of last backup)

Parameters

$resource

array

The TAR file handle

$logfile

\?resource

The logfile to write to (NULL: no logging)

$path

\PATH

The full path to the folder to add

$threshold

\TIME

The threshold time

$max_size

\?integer

The maximum file size to add (NULL: no limit)

$subpath

\PATH

The subpath relative to the path (should be left as the default '', as this is used for the recursion to distinguish the adding base path from where it's currently looking)

$all_files

boolean

Whether to not skip "special files" (ones not normally archive)

Returns

arrayA list of maps that stores 'path', 'mode' and 'size', for each newly added file in the archive

Close an open TAR resource.

tar_close(array $resource) 

Parameters

$resource

array

The TAR file handle to close

Find the checksum specified in a TAR header

tar_crc(string $header) : integer

Parameters

$header

string

The header from a TAR file

Returns

integerThe checksum

Extract all the files in the specified TAR file to the specified path.

tar_extract_to_folder(array $resource, \PATH $path, boolean $use_afm, \?array $files, boolean $comcode_backups) 

Parameters

$resource

array

The TAR file handle

$path

\PATH

The path to the folder to extract to, relative to the base directory

$use_afm

boolean

Whether to extract via the AFM (assumes AFM has been set up prior to this function call)

$files

\?array

The files to extract (NULL: all)

$comcode_backups

boolean

Whether to take backups of Comcode pages

Return the root directory from the specified TAR file.

tar_get_directory(array $resource, boolean $tolerate_errors) : \?array

Note that there are folders in here, and they will end '/'.

Parameters

$resource

array

The TAR file handle

$tolerate_errors

boolean

Whether to tolerate errors (returns NULL if error)

Returns

\?arrayA list of maps that stores 'path', 'mode', 'size' and 'mtime', for each file in the archive (NULL: error)

Get the contents of the specified file in the specified TAR.

tar_get_file(array $resource, \PATH $path, boolean $tolerate_errors, \?PATH $write_data_to) : \?array

Parameters

$resource

array

The TAR file handle

$path

\PATH

The full path to the file we want to get

$tolerate_errors

boolean

Whether to tolerate errors (returns NULL if error)

$write_data_to

\?PATH

Write data to here (NULL: return within array)

Returns

\?arrayA map, containing 'data' (the file), 'size' (the filesize), 'mtime' (the modification timestamp), and 'mode' (the permissions) (NULL: not found / TAR possibly corrupt if we turned tolerate errors on)

Open up a TAR archive, and return the resource.

tar_open(\?PATH $path, string $mode) : array

set rb wb w+b

Parameters

$path

\?PATH

The path to the TAR archive (NULL: write out directly to stdout)

$mode

string

The mode to open the TAR archive (rb=read, wb=write)

Returns

arrayThe TAR file handle

Convert template text into tempcode format.

template_to_tempcode(string $text, integer $symbol_pos, boolean $inside_directive, \ID_TEXT $codename, \?ID_TEXT $theme, \?ID_TEXT $lang, boolean $tolerate_errors) : mixed

Parameters

$text

string

The template text

$symbol_pos

integer

The position we are looking at in the text

$inside_directive

boolean

Whether this text is infact a directive, about to be put in the context of a wider template

$codename

\ID_TEXT

The codename of the template (e.g. foo)

$theme

\?ID_TEXT

The theme it is for (NULL: current theme)

$lang

\?ID_TEXT

The language it is for (NULL: current language)

$tolerate_errors

boolean

Whether to tolerate errors

Returns

mixedThe converted/compiled template as tempcode, OR if a directive, encoded directive information

Convert template text into tempcode format.

template_to_tempcode(string $text, integer $symbol_pos, boolean $inside_directive, \ID_TEXT $codename, \?ID_TEXT $theme, \?ID_TEXT $lang, boolean $tolerate_errors) : mixed

Parameters

$text

string

The template text

$symbol_pos

integer

The position we are looking at in the text

$inside_directive

boolean

Whether this text is infact a directive, about to be put in the context of a wider template

$codename

\ID_TEXT

The codename of the template (e.g. foo)

$theme

\?ID_TEXT

The theme it is for (NULL: current theme)

$lang

\?ID_TEXT

The language it is for (NULL: current language)

$tolerate_errors

boolean

Whether to tolerate errors

Returns

mixedThe converted/compiled template as tempcode, OR if a directive, encoded directive information

Test password strength.

test_password(string $password) : integer

Parameters

$password

string

The password to check

Returns

integerPassword strength

Allows conversion of a URL to a thumbnail via a simple script.

thumb_script() 

Turn a boring codename, into a "pretty" title.

titleify(\ID_TEXT $boring) : string

Parameters

$boring

\ID_TEXT

The codename

Returns

stringThe title

For a UTC timestamp, find the equivalent virtualised local timestamp.

tz_time(\TIME $time, string $zone) : \TIME

Parameters

$time

\TIME

UTC time

$zone

string

Timezone (boring style)

Returns

\TIMEVirtualised local time

Unban the specified IP address.

unban_ip(\IP $ip) 

Parameters

$ip

\IP

The IP address to unban

Convert a unicode character number to a HTML-entity enabled string, using lower ASCII characters where possible.

unichr(integer $c) : \~string

Parameters

$c

integer

Character number.

Returns

\~stringConverted data (false: could not convert).

Convert a unicode character number to a unicode string.

unichrm(array $matches) : \~string

Callback for preg_replace.

Parameters

$matches

array

Regular expression match array.

Returns

\~stringConverted data (false: could not convert).

Convert a unicode character number to a unicode string.

unichrm_hex(array $matches) : \~string

Callback for preg_replace.

Parameters

$matches

array

Regular expression match array.

Returns

\~stringConverted data (false: could not convert).

This function totally uninstalls a block from the system.

uninstall_block(\ID_TEXT $block) 

Yet again, you should not need to use this function.

Parameters

$block

\ID_TEXT

The name of the block to uninstall

Completely uninstall the specified module from the system.

uninstall_module(\ID_TEXT $zone, \ID_TEXT $module) 

Parameters

$zone

\ID_TEXT

The zone name

$module

\ID_TEXT

The module name

Make sure that lines are seperated by chr(10), with no chr(13)'s there at all.

unixify_line_format(string $in, \?ID_TEXT $desired_charset, boolean $html, boolean $from_disk) : string

For Mac data, this will be a flip scenario. For Linux data this will be a null operation. For windows data this will be change from chr(13).chr(10) to just chr(10). For a realistic scenario, data could have originated on all kinds of platforms, with some editors converting, some situations being inter-platform, and general confusion. Don't make blind assumptions - use this function to clean data, then write clean code that only considers chr(10)'s.

Parameters

$in

string

The data to clean

$desired_charset

\?ID_TEXT

The character set it should be in. We don't do any real conversions using this, only make sure that common problems with fed ISO-8859-1 data are resolved (NULL: output character set)

$html

boolean

Whether we are cleaning for HTML rather than Comcode/plain-text

$from_disk

boolean

Whether the file is loaded from disk (less conversion needed)

Returns

stringThe cleaned data

Take some parsed ocSelect search filters into the string format (i.e.

unparse_ocselect(array $parsed) : string

reverse of parse_ocselect).

Parameters

$parsed

array

Parsed structure

Returns

stringString-based search filter

Increment the specified stored value, by the specified amount.

update_stat(\ID_TEXT $stat, integer $increment) 

Parameters

$stat

\ID_TEXT

The codename for the stat

$increment

integer

What to increment the statistic by

Upgrades a block to the latest version available on your ocPortal installation.

upgrade_block(\ID_TEXT $block) : integer

[b]This function can only upgrade to the latest version put into the block directory.[/b] You should not need to use this function.

Parameters

$block

\ID_TEXT

The name of the block to upgrade

Returns

integer0=No upgrade. -2=Not installed, 1=Upgrade

Upgrade the specified module.

upgrade_module(\ID_TEXT $zone, \ID_TEXT $module) : integer

Parameters

$zone

\ID_TEXT

The zone name

$module

\ID_TEXT

The module name

Returns

integer0=No upgrade. -2=Not installed, 1=Upgrade

Find if the specified URL is local or not (actually, if it is relative).

url_is_local(\URLPATH $url) : boolean

This is often used by code that wishes to use file system functions on URLs (ocPortal will store such relative local URLs for uploads, etc)

Parameters

$url

\URLPATH

The URL to check

Returns

booleanWhether the URL is local

Find whether URL monikers are enabled.

url_monikers_enabled() : boolean

Returns

booleanWhether URL monikers are enabled.

Takes a URL, and converts it into a file system storable filename.

url_to_filename(\URLPATH $url_full) : string

This is used to cache URL contents to the servers filesystem.

Parameters

$url_full

\URLPATH

The URL to convert to an encoded filename

Returns

stringA usable filename based on the URL

URL'ise specially encoded text-acceptance language strings.

urlise_lang(string $string, mixed $url, string $title, boolean $new_window) : \tempcode

Parameters

$string

string

The language string

$url

mixed

The URL (either tempcode or string)

$title

string

The title of the hyperlink

$new_window

boolean

Whether to use a new window

Returns

\tempcodeThe encoded version

Get the user's currently selected language.

user_lang() : \LANGUAGE_NAME

Returns

\LANGUAGE_NAMEThe user's current language

AJAX script for checking if a new username is valid.

username_check_script() 

AJAX script for checking if a username exists.

username_exists_script() 

Convert a user timestamp to a UTC timestamp.

usertime_to_utctime(\?TIME $timestamp, \?MEMBER $member) : \TIME

This is not a function to use much- you probably want utctime_to_usertime. What complicate understanding of matters is that "user time" is not the timestamp that would exist on a user's PC, as all timestamps are meant to be stored in UTC. "user time" is offsetted to compensate, a virtual construct.

Parameters

$timestamp

\?TIME

Input timestamp (NULL: now)

$member

\?MEMBER

Member for which the date is being rendered (NULL: current member)

Returns

\TIMEOutput timestamp

Convert a UTC timestamp to a user timestamp.

utctime_to_usertime(\?TIME $timestamp, \?MEMBER $member) : \TIME

The user timestamp should not be pumped through get_timezoned_date as this already performs the conversions internally. What complicate understanding of matters is that "user time" is not the timestamp that would exist on a user's PC, as all timestamps are meant to be stored in UTC. "user time" is offsetted to compensate, a virtual construct.

Parameters

$timestamp

\?TIME

Input timestamp (NULL: now)

$member

\?MEMBER

Member for which the date is being rendered (NULL: current member)

Returns

\TIMEOutput timestamp

Turn utf-8 characters into unicode HTML entities.

utf8tohtml(string $utf8) : string

Useful as GD truetype functions need this. Based on function in PHP code comments.

Parameters

$utf8

string

Input.

Returns

stringOutput.

This is a less-revealing alternative to fatal_exit, that is used for user-errors/common-corruption-scenarios

warn_exit(mixed $text) 

Parameters

$text

mixed

The error message (string or tempcode)

Exit with a message about word-filtering.

warn_exit_wordfilter(\?ID_TEXT $name, \tempcode $message) 

Parameters

$name

\?ID_TEXT

The name of the parameter this is coming from. Certain parameters are not checked, for reasons of efficiency (avoiding loading whole word check list if not needed) (NULL: don't know param, do not check to avoid)

$message

\tempcode

Error message

Get the tempcode for a warn page.

warn_screen(\tempcode $title, mixed $text, boolean $provide_back) : \tempcode

Parameters

$title

\tempcode

The title of the warn page

$text

mixed

The text to put on the warn page (either tempcode or string)

$provide_back

boolean

Whether to provide a back button

Returns

\tempcodeThe warn page

Guard for entity_utf8_decode.

will_be_unicode_neutered(string $data) : boolean

Checks that the data can be stripped so there is no unicode left. Either the htmlentities function must convert mechanically to entity-characters or all higher ascii character codes (which are actually unicode control codes in a unicode interpretation) that are used happen to be linked to named entities.

Parameters

$data

string

Data to check.

Returns

booleanWhether we are good to execute entity_utf8_decode.

Display some raw text so that it is repeated as raw visually in HTML.

with_whitespace(string $in) : \tempcode

Parameters

$in

string

Input

Returns

\tempcodeOutput

Get a word-filtered version of the specified text.

wordfilter_text(string $text) : string

Parameters

$text

string

Text to filter

Returns

stringFiltered version of the input text

Find a member from their IP address.

wrap_probe_ip(\IP $ip) : array

Unlike plain $GLOBALS['FORUM_DRIVER']->probe_ip, it has the benefit of looking in the adminlogs table also.

Parameters

$ip

\IP

The IP address to probe

Returns

arrayThe members found

Write a text file, using the _custom system

write_text_file(string $codename, \?LANGUAGE_NAME $lang, string $out) 

Parameters

$codename

string

The file name (without .txt)

$lang

\?LANGUAGE_NAME

The language to write for (NULL: none) (blank: search)

$out

string

The data to write

XHTML-aware substring extraction.

xhtml_substr(string $html, integer $from, \?integer $length, boolean $literal_pos, boolean $ellipses, float $grammar_completeness_tolerance) : string

Note that it will strip images, linebreaks, rules, etc - it's intended really for inline XHTML.

Parameters

$html

string

The text to perform on.

$from

integer

The start position of the cut (HTML tags will be taken from before this though).

$length

\?integer

The length you want the concatenated text to be (NULL: go to end).

$literal_pos

boolean

Whether to do a substr based on literal position in XHTML, rather than based on number of visible characters.

$ellipses

boolean

Whether to add ellipses.

$grammar_completeness_tolerance

float

A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing).

Returns

stringThe result.

Function that 'fixes' HTML (or bad XHTML) enough for it to pass most basic structural validation.

xhtmlise_html(string $html, boolean $definitely_want) : string

Parameters

$html

string

The XHTML string to convert to XHTML

$definitely_want

boolean

Whether to force a repair even if we aren't enforcing XHTML strictness

Returns

stringThe converted string

Do a highly-simplified XML-RPC request (no actual calling supported - just messaging).

xml_rpc(\URLPATH $url, string $method, array $params, boolean $accept_failure) : \?string

Parameters

$url

\URLPATH

The XML-RPC call URL

$method

string

The method name to call.

$params

array

An array of parameters.

$accept_failure

boolean

Whether to accept failure.

Returns

\?stringThe result (NULL: failed).

XML escape the input string.

xmlentities(string $string, integer $quote_style) : string

Parameters

$string

string

Input string

$quote_style

integer

Quote style

Returns

stringEscaped version of input string

Close a zip file.

zip_close(array $open_zip_file) : boolean

Parameters

$open_zip_file

array

The zip file resource

Returns

booleanWhether the file closed correctly

Closes a directory entry previously opened for reading.

zip_entry_close(array $zip_entry) : boolean

Parameters

$zip_entry

array

Directory entry resource returned by m_zip_read()

Returns

booleanWhether the operation was succesful

Returns the filesize of the directory entry specified in the given entry.

zip_entry_filesize(array $zip_entry) : integer

Parameters

$zip_entry

array

Directory entry resource returned by m_zip_read()

Returns

integerThe file size

Returns the name of the directory entry specified in the given entry.

zip_entry_name(array $zip_entry) : string

Parameters

$zip_entry

array

Directory entry resource returned by m_zip_read()

Returns

stringThe entry name

Opens a directory entry in a zip file for reading.

zip_entry_open(array $zip, array $zip_entry, string $mode) : boolean

set rb

Parameters

$zip

array

The zip file resource

$zip_entry

array

Directory entry resource returned by m_zip_read()

$mode

string

The file access mode

Returns

booleanWhether the operation was succesful

Returns the file data of the directory entry specified in the given entry.

zip_entry_read(array $zip_entry, integer $zip_entry_file_size) : \~string

Parameters

$zip_entry

array

Directory entry resource returned by m_zip_read()

$zip_entry_file_size

integer

The maximum returned data size

Returns

\~stringThe data (false: failure)

Terminate with an error caused by unzipping.

zip_error(integer $errno, boolean $mzip) : \tempcode

Parameters

$errno

integer

The zip error number.

$mzip

boolean

Whether mzip was used.

Returns

\tempcodeError message.

Open a zip file for reading.

zip_open(\PATH $zip_file) : mixed

Parameters

$zip_file

\PATH

The zip file path

Returns

mixedThe zip file resource (number if error)

Reads the next entry in a zip file archive.

zip_read(array $open_zip_file) : \~array

Parameters

$open_zip_file

array

The zip file resource

Returns

\~arrayA directory entry resource for later use with the m_zip_entry_...() functions (false: if there's no more entries to read).

Find file meta information for adding to a zip file

zip_scan_folder(\PATH $path, \PATH $subpath) : array

Parameters

$path

\PATH

The full path to the folder to add

$subpath

\PATH

The subpath relative to the path (should be left as the default '', as this is used for the recursion to distinguish the adding base path from where it's currently looking)

Returns

arrayA list of maps that stores time,full_path,name, for each file

Consider virtual zone merging, where paths are not necessarily where you'd expect for pages in zones.

zone_black_magic_filterer(\PATH $path, boolean $relative) : \PATH

Parameters

$path

\PATH

The path, assuming in the obvious place.

$relative

boolean

Where the passed path is relative.

Returns

\PATHThe fixed path.

Classes and interfaces

apccache

Cache Driver.

« More »

database_driver

Database handling.

« More »

eacceleratorcache

Cache Driver.

« More »

field_restriction_loader

Field restriction loader.

« More »

filecache

Cache Driver.

« More »

forum_driver_base

Forum Driver base class.

« More »

ocp_simple_xml_reader

Simple XML reader.

« More »

ocp_tempcode

Tempcode (compiled implementation).

« More »

ocp_tempcode

Tempcode (non-compiled implementation).

« More »

rss

RSS loader.

« More »

standard_aed_module

AED module (Add/Edit/Delete), for operations on content types (aka: CRUD, create update delete).

« More »

wincache

Cache Driver.

« More »

xcache

Cache Driver.

« More »

Constants

 

ANTISPAM_RESPONSE_ACTIVE

ANTISPAM_RESPONSE_ACTIVE 

 

ANTISPAM_RESPONSE_ACTIVE_UNKNOWN_STALE

ANTISPAM_RESPONSE_ACTIVE_UNKNOWN_STALE 

 

ANTISPAM_RESPONSE_ERROR

ANTISPAM_RESPONSE_ERROR 

 

ANTISPAM_RESPONSE_SKIP

ANTISPAM_RESPONSE_SKIP 

 

ANTISPAM_RESPONSE_STALE

ANTISPAM_RESPONSE_STALE 

 

ANTISPAM_RESPONSE_UNLISTED

ANTISPAM_RESPONSE_UNLISTED 

   

CC_ESCAPED

CC_ESCAPED 

 

CC_ESCAPED

CC_ESCAPED 

 

CSS_ESCAPED

CSS_ESCAPED 

 

CSS_ESCAPED

CSS_ESCAPED 

 

DB_MAX_FIELD_IDENTIFIER_SIZE

DB_MAX_FIELD_IDENTIFIER_SIZE 

 

DB_MAX_IDENTIFIER_SIZE

DB_MAX_IDENTIFIER_SIZE 

 

DB_MAX_KEY_SIZE

DB_MAX_KEY_SIZE 

 

DB_MAX_KEY_SIZE_UNICODE

DB_MAX_KEY_SIZE_UNICODE 

 

DB_MAX_PRIMARY_KEY_SIZE

DB_MAX_PRIMARY_KEY_SIZE 

 

DB_MAX_ROW_SIZE

DB_MAX_ROW_SIZE 

 

DB_MAX_ROW_SIZE_UNICODE

DB_MAX_ROW_SIZE_UNICODE 

 

DEPTH__CATEGORIES

DEPTH__CATEGORIES 

 

DEPTH__ENTRIES

DEPTH__ENTRIES 

 

DEPTH__ENTRY_POINTS

DEPTH__ENTRY_POINTS 

 

DEPTH__PAGES

DEPTH__PAGES 

 

DQ_ESCAPED

DQ_ESCAPED 

 

DQ_ESCAPED

DQ_ESCAPED 

 

ENTITY_ESCAPED

ENTITY_ESCAPED 

 

ENTITY_ESCAPED

ENTITY_ESCAPED 

 

E_RECOVERABLE_ERROR

E_RECOVERABLE_ERROR 

 

FIND_ALL_PAGES__ALL

FIND_ALL_PAGES__ALL 

 

FIND_ALL_PAGES__NEWEST

FIND_ALL_PAGES__NEWEST 

 

FIND_ALL_PAGES__PERFORMANT

FIND_ALL_PAGES__PERFORMANT 

 

FORCIBLY_ENTITY_ESCAPED

FORCIBLY_ENTITY_ESCAPED 

 

FORCIBLY_ENTITY_ESCAPED

FORCIBLY_ENTITY_ESCAPED 

 

HIPHOP_PHP

HIPHOP_PHP 

 

ID_ESCAPED

ID_ESCAPED 

 

ID_ESCAPED

ID_ESCAPED 

 

IGNORE_ACCESS_CONTROLLERS

IGNORE_ACCESS_CONTROLLERS 

 

IGNORE_BUNDLED_UNSHIPPED_VOLATILE

IGNORE_BUNDLED_UNSHIPPED_VOLATILE 

 

IGNORE_BUNDLED_VOLATILE

IGNORE_BUNDLED_VOLATILE 

 

IGNORE_CUSTOM_DIR_CONTENTS

IGNORE_CUSTOM_DIR_CONTENTS 

 

IGNORE_CUSTOM_THEMES

IGNORE_CUSTOM_THEMES 

 

IGNORE_CUSTOM_ZONES

IGNORE_CUSTOM_ZONES 

 

IGNORE_DEFAULTS

IGNORE_DEFAULTS 

 

IGNORE_EDITFROM_FILES

IGNORE_EDITFROM_FILES 

 

IGNORE_HIDDEN_FILES

IGNORE_HIDDEN_FILES 

 

IGNORE_NONBUNDLED_SCATTERED

IGNORE_NONBUNDLED_SCATTERED 

 

IGNORE_NON_EN_SCATTERED_LANGS

IGNORE_NON_EN_SCATTERED_LANGS 

 

IGNORE_NON_REGISTERED

IGNORE_NON_REGISTERED 

 

IGNORE_REVISION_FILES

IGNORE_REVISION_FILES 

 

IGNORE_USER_CUSTOMISE

IGNORE_USER_CUSTOMISE 

 

INTEGER_MAGIC_NULL

INTEGER_MAGIC_NULL 

 

JSHTML_ESCAPED

JSHTML_ESCAPED 

 

JSHTML_ESCAPED

JSHTML_ESCAPED 

 

MAX_MONIKER_LENGTH

MAX_MONIKER_LENGTH 

 

MAX_STACK_TRACE_VALUE_LENGTH

MAX_STACK_TRACE_VALUE_LENGTH 

 

NAUGHTY_ESCAPED

NAUGHTY_ESCAPED 

 

NAUGHTY_ESCAPED

NAUGHTY_ESCAPED 

 

NL2_ESCAPED

NL2_ESCAPED 

 

NL2_ESCAPED

NL2_ESCAPED 

 

NL_ESCAPED

NL_ESCAPED 

 

NL_ESCAPED

NL_ESCAPED 

 

NULL_ESCAPED

NULL_ESCAPED 

 

NULL_ESCAPED

NULL_ESCAPED 

 

OCP_UPLOAD_ANYTHING

OCP_UPLOAD_ANYTHING 

 

OCP_UPLOAD_IMAGE

OCP_UPLOAD_IMAGE 

 

OCP_UPLOAD_IMAGE_OR_SWF

OCP_UPLOAD_IMAGE_OR_SWF 

 

OCP_UPLOAD_MP3

OCP_UPLOAD_MP3 

 

OCP_UPLOAD_VIDEO

OCP_UPLOAD_VIDEO 

 

PARSE_DIRECTIVE

PARSE_DIRECTIVE 

 

PARSE_DIRECTIVE_INNER

PARSE_DIRECTIVE_INNER 

 

PARSE_LANGUAGE_REFERENCE

PARSE_LANGUAGE_REFERENCE 

 

PARSE_NO_MANS_LAND

PARSE_NO_MANS_LAND 

 

PARSE_PARAMETER

PARSE_PARAMETER 

 

PARSE_SYMBOL

PARSE_SYMBOL 

 

SELF_REDIRECT

SELF_REDIRECT 

 

SQ_ESCAPED

SQ_ESCAPED 

 

SQ_ESCAPED

SQ_ESCAPED 

 

STRING_MAGIC_NULL

STRING_MAGIC_NULL 

 

SYMBOL_PARSE_NAME

SYMBOL_PARSE_NAME 

 

SYMBOL_PARSE_PARAM

SYMBOL_PARSE_PARAM 

 

TC_DIRECTIVE

TC_DIRECTIVE 

 

TC_DIRECTIVE

TC_DIRECTIVE 

 

TC_KNOWN

TC_KNOWN 

 

TC_KNOWN

TC_KNOWN 

 

TC_LANGUAGE_REFERENCE

TC_LANGUAGE_REFERENCE 

 

TC_LANGUAGE_REFERENCE

TC_LANGUAGE_REFERENCE 

 

TC_PARAMETER

TC_PARAMETER 

 

TC_PARAMETER

TC_PARAMETER 

 

TC_SYMBOL

TC_SYMBOL 

 

TC_SYMBOL

TC_SYMBOL 

 

UL2_ESCAPED

UL2_ESCAPED 

 

UL2_ESCAPED

UL2_ESCAPED 

 

UL_ESCAPED

UL_ESCAPED 

 

UL_ESCAPED

UL_ESCAPED 

 

UNZIP_CMD

UNZIP_CMD 

 

UNZIP_DIR

UNZIP_DIR 

Functions

Helper function to work out a results browser URL.

_build_pagination_cat_url(array $url_array, array $post_array, \?ID_TEXT $type, \?mixed $root, \?mixed $category_id, boolean $keep_all, \ID_TEXT $hash) : mixed

Parameters

$url_array

array

Map of GET array segments to use (others will be added by this function)

$post_array

array

Map of POST array segments (relayed as GET) to use

$type

\?ID_TEXT

The page type this browser is browsing through (e.g. 'category') (NULL: none)

$root

\?mixed

The virtual root category this browser uses (NULL: no such concept for our results browser)

$category_id

\?mixed

The category ID we are browsing in (NULL: not applicable)

$keep_all

boolean

Whether to keep get data when browsing through

$hash

\ID_TEXT

Hash component to URL

Returns

mixedThe URL

Get the tempcode for a do next manager.

_do_next_section(array $list, \tempcode $title) : \tempcode

A do next manager is a series of linked icons that are presented after performing an action. Modules that do