Functions


Functions Summary
void

cot_admin_other_cmp(mixed pl_a, mixed pl_b)

mixed

cot_apply_patches(string directory, string from_ver, string sql_pattern, string php_pattern)

Applies custom SQL and PHP patches in a directory.

void

cot_apply_rwr()

Applies Handly URLs rewrite to current script parameters

bool

cot_auth_add_group(int group_id, int base_group_id)

Registers a user group in auth table

bool

cot_bbcode_add(string name, string mode, string pattern, string replacement, bool container, int priority, string plug, bool postrender)

Registers a new bbcode in database.

string

cot_bbcode_cdata(string text)

Neutralizes bbcodes in text

void

cot_bbcode_clearcache()

Clears bbcode cache

void

cot_bbcode_load()

Loads bbcodes from database if they havent been already loaded.

string

cot_bbcode_parse_pre(array m)

Supplimentary br stripper callback

bool

cot_bbcode_remove(int id, string plug)

Removes a bbcode from parser database.

bool

cot_bbcode_update(int id, bool enabled, string name, string mode, string pattern, string replacement, bool container, int priority, bool postrender)

Updates bbcode data in parser database.

string

cot_build_pfs(int id, string c1, string c2, string title, string parser)

Generates a link to PFS

void

cot_build_recentpages(mixed template, str mode, int maxperpage, int d, int titlelength, int textlength, bool rightprescan, str cat)

void

cot_captcha_validate(int verify, int func_index)

string

cot_checkbox(bool chosen, string name, string title, mixed attrs, string value, string custom_rc)

Generates a checkbox output

int

cot_comments_count(string ext_name, string code, array row)

Returns number of comments for item

string

cot_config_type_int(array cfg_var, string min, string max)

Generates a form input for Integer

string

cot_cut_more(string html)

Cuts the page after 'more' tag or after the first page (if multipage)

void

cot_disable_mqgpc(mixed value, mixed key)

array

cot_diskcache_calc(string dir, bool do_subdirs)

Calculates directory size It's helper function for cot_diskcache_list()

bool

cot_diskcache_clear(string dir, bool do_subdirs, bool rm_dir)

Clears disk cache directory

bool

cot_diskcache_clearall()

Clears disk cache completely

array

cot_diskcache_list()

Returns list of non-empty subdirectories in disk cache directory

array

cot_forums_buildpath(string cat, bool forumslink)

Builds forum category path

void

cot_get_config(mixed file)

string

cot_i18n_build_catpath(string area, string cat, string locale)

Builds internationalized category path

bool

cot_i18n_enabled(string cat)

Checks if internationalization is enabled in a selected category

static mixed

cot_i18n_get_cat(string cat, string locale)

Fetches translation row for a specific category

mixed

cot_i18n_get_page(int page_id, string locale)

Fetches translation row for a specific page

array

cot_i18n_list_cat_locales(string cat)

Returns a list of all locales available for a category

array

cot_i18n_list_page_locales(int page_id)

Returns a list of all locales available for a specific page

void

cot_i18n_load_locales()

Loads registered locales

void

cot_i18n_load_structure()

Loads structure internationalization data

bool

cot_i18n_save(string table_name, string field, int item, string locale, string text, bool riched)

Saves a translation for an item

string

cot_install_config_replace(string file_contents, string config_name, string config_value)

Replaces a sample config with its actual value

string

cot_linkif(string url, string text, bool cond)

Returns $url as an HTML link if $cond is TRUE or just plain $text otherwise

string

cot_parse_bbcode(string text)

Parses bbcodes in text.

void

cot_parse_page_text(mixed pag_text, mixed pag_pageurl, mixed pag_parser)

bool

cot_poll_edit_form(int id, XTemplate t, string block, string type)

Adds form for create/edit Poll

array

cot_ratings_display(string ext_name, string code, string cat, bool readonly)

Generates ratings display for a given item

void

cot_rights_parseline(mixed row, mixed title, mixed link)

void

cot_send_translated_mail(string rlang, string remail, string rusername)

Send an email in the recipient's language

string

cot_smilies(string res)

Parses smiles in text

void

cot_smilies_load()

Load smilies from current pack

void

cot_stat_create(string name)

Creates new stats parameter

int

cot_stat_get(string name)

Returns statistics parameter

void

cot_stat_inc(string name, int value)

Increments stats

void

cot_stat_update(string name, int value)

Inserts new stat or increments value if it already exists

bool

cot_tag(string tag, int item, string area, mixed extra)

Tags a given item from a specific area with a keyword

void

cot_tag_search_forums(string query)

Search by tag in forums

void

cot_tag_search_pages(string query)

Search by tag in pages

bool

cot_trash_delete(int id)

Deletes a trash item with subitems

bool

cot_trash_forumpost_check(array data)

Check forumpost action

bool

cot_trash_page_sync(array data)

Sync page action

int

cot_trash_put(string type, string title, int itemid, mixed datas, int parentid)

Sends item to trash

bool

cot_trash_restore(int id)

Restores a trash item

string

cot_userimages_build(string src, string code)

Returns user image html code

bool

cot_userimages_config_add(string code, int width, int height, string crop, bool force)

Add a user image type

Entries

cot_userimages_config_edit(string code, int width, int height, string crop)

Edit a user image type

array

cot_userimages_config_get(bool ignorecache)

Get configuration for user image types

DB

cot_userimages_config_remove(string code, bool dropcolumn)

Remove a user image type

boolean|number

cot_userimages_process_uploads(number uid)

Process uploaded user images files for certain User

array

cot_userimages_tags(array user_data, string tag_prefix)

Returns UserImages tags for coTemplate

bool

cot_userisonline(int id)

Checks whether user is online

void

cursort(mixed trigger, mixed way)

void

rev(mixed sway)

Function Detail

system\admin\admin.other.php at line 61

cot_admin_other_cmp

public void cot_admin_other_cmp(mixed pl_a, mixed pl_b)

system\extensions.php at line 46

cot_apply_patches

public mixed cot_apply_patches(string directory, string from_ver, string sql_pattern, string php_pattern)
Applies custom SQL and PHP patches in a directory. Error and success messages are emitted via standard messaging API during execution.
Parameters:
directory - Directory path
from_ver - Current version, to patch starting from
sql_pattern - SQL patch file name pattern (PCRE)
php_pattern - PHP patch file name pattern (PCRE)
Returns:
The function returns TRUE if there are not patches to apply, FALSE if an error occurred while patching or a string containing version number of the latest applied patch if patching was successful.

plugins\urleditor\inc\urleditor.functions.php at line 24

cot_apply_rwr

public void cot_apply_rwr()
Applies Handly URLs rewrite to current script parameters

system\auth.php at line 47

cot_auth_add_group

public bool cot_auth_add_group(int group_id, int base_group_id)
Registers a user group in auth table
Parameters:
group_id - Group ID
base_group_id - ID of the group to copy permissions from
Returns:
Operation status
Global:
CotDB $db

plugins\bbcode\inc\bbcode.functions.php at line 39

cot_bbcode_add

public bool cot_bbcode_add(string name, string mode, string pattern, string replacement, bool container, int priority, string plug, bool postrender)
Registers a new bbcode in database. In 'callback' mode $replacement is normal PHP function body (without declaration) which takes $input array of matches as parameter and must return a replacement string. These variables are also imported as globals in callback function: $cfg, $sys, $usr, $L, $theme, $cot_groups
Global:
$db, $db_bbcode;
CotDB $db
Parameters:
name - BBcode name
mode - Parsing mode, on of the following: 'str' (str_replace), 'pcre' (preg_replace) and 'callback' (preg_replace_callback)
pattern - Bbcode string or entire regular expression
replacement - Replacement string or regular substitution or callback body
container - Whether bbcode is container (like [bbcode]Something here[/bbcode])
priority - BBcode priority from 0 to 255. Smaller priority bbcodes are parsed first, 128 is default medium priority.
plug - Plugin/part name this bbcode belongs to.
postrender - Whether this bbcode must be applied on a pre-rendered HTML cache.
Returns:

plugins\bbcode\inc\bbcode.functions.php at line 335

cot_bbcode_cdata

public string cot_bbcode_cdata(string text)
Neutralizes bbcodes in text
Parameters:
text - Source text
Returns:

plugins\bbcode\inc\bbcode.functions.php at line 192

cot_bbcode_clearcache

public void cot_bbcode_clearcache()
Clears bbcode cache
Global:
Cache $cache

plugins\bbcode\inc\bbcode.functions.php at line 138

cot_bbcode_load

public void cot_bbcode_load()
Loads bbcodes from database if they havent been already loaded.
Global:
$cot_bbcodes
$db_bbcode
CotDB $db

plugins\bbcode\inc\bbcode.functions.php at line 324

cot_bbcode_parse_pre

public string cot_bbcode_parse_pre(array m)
Supplimentary br stripper callback
Parameters:
m - PCRE entries
Returns:

plugins\bbcode\inc\bbcode.functions.php at line 68

cot_bbcode_remove

public bool cot_bbcode_remove(int id, string plug)
Removes a bbcode from parser database.
Global:
$db_bbcode
CotDB $db
Parameters:
id - BBCode ID or 0 to remove all (use carefully)
plug - Remove all bbcodes that belong to this plug
Returns:

plugins\bbcode\inc\bbcode.functions.php at line 101

cot_bbcode_update

public bool cot_bbcode_update(int id, bool enabled, string name, string mode, string pattern, string replacement, bool container, int priority, bool postrender)
Updates bbcode data in parser database.
Global:
$db, $db_bbcode;
CotDB $db
Parameters:
id - BBCode ID
enabled - Enable the bbcode
name - BBcode name
mode - Parsing mode, on of the following: 'str' (str_replace), 'pcre' (preg_replace) and 'callback' (preg_replace_callback)
pattern - Bbcode string or entire regular expression
replacement - Replacement string or regular substitution or callback body
container - Whether bbcode is container (like [bbcode]Something here[/bbcode])
priority - BBcode preority from 0 to 255. Smaller priority bbcodes are parsed first, 128 is default medium priority.
postrender - Whether this bbcode must be applied on a pre-rendered HTML cache.
Returns:

modules\pfs\inc\pfs.functions.php at line 36

cot_build_pfs

public string cot_build_pfs(int id, string c1, string c2, string title, string parser)
Generates a link to PFS
Global:
array $L
array $cfg
array $usr
array $cot_groups
Parameters:
id - User ID
c1 - Form name
c2 - Input name
title - Link title
parser - Custom parser (otional)
Returns:

plugins\recentitems\inc\recentitems.functions.php at line 167

cot_build_recentpages

public void cot_build_recentpages(mixed template, str mode, int maxperpage, int d, int titlelength, int textlength, bool rightprescan, str cat)

plugins\contact\contact.php at line 31

cot_captcha_validate

public void cot_captcha_validate(int verify, int func_index)

system\forms.php at line 27

cot_checkbox

public string cot_checkbox(bool chosen, string name, string title, mixed attrs, string value, string custom_rc)
Generates a checkbox output
Parameters:
chosen - Checkbox state
name - Input name
title - Option caption
attrs - Additional attributes as an associative array or a string
value - Input value (passed), defaults to 'on' or '1'
custom_rc - Custom resource string name
Returns:

plugins\comments\inc\comments.functions.php at line 32

cot_comments_count

public int cot_comments_count(string ext_name, string code, array row)
Returns number of comments for item
Parameters:
ext_name - Target extension name
code - Item code
row - Database row entry (optional)
Returns:
Global:
CotDB $db

system\configuration.php at line 59

cot_config_type_int

public string cot_config_type_int(array cfg_var, string min, string max)
Generates a form input for Integer
Parameters:
cfg_var - Config Variable data
min - Minimum allowed value as get from callback parameters
max - Maximum allowed value as get from callback parameters
Returns:
Code of input field

modules\page\inc\page.functions.php at line 31

cot_cut_more

public string cot_cut_more(string html)
Cuts the page after 'more' tag or after the first page (if multipage)
Parameters:
html - Page body
Returns:

system\common.php at line 16

cot_disable_mqgpc

public void cot_disable_mqgpc(mixed value, mixed key)
Copyright:
(c) Cotonti Team
License:
https://github.com/Cotonti/Cotonti/blob/master/License.txt

system\admin\admin.cache.disk.php at line 89

cot_diskcache_calc

public array cot_diskcache_calc(string dir, bool do_subdirs)
Calculates directory size It's helper function for cot_diskcache_list()
Parameters:
dir - Directory name
do_subdirs - true when enter subdirectories, otherwise false
Returns:

system\admin\admin.cache.disk.php at line 158

cot_diskcache_clear

public bool cot_diskcache_clear(string dir, bool do_subdirs, bool rm_dir)
Clears disk cache directory
Parameters:
dir - Directory name
do_subdirs - true when enter subdirectories, otherwise false
rm_dir - true when remove directory, otherwise false
Returns:

system\admin\admin.cache.disk.php at line 195

cot_diskcache_clearall

public bool cot_diskcache_clearall()
Clears disk cache completely
Global:
$cfg
Returns:

system\admin\admin.cache.disk.php at line 121

cot_diskcache_list

public array cot_diskcache_list()
Returns list of non-empty subdirectories in disk cache directory
Global:
$cfg
Returns:

modules\forums\inc\forums.functions.php at line 33

cot_forums_buildpath

public array cot_forums_buildpath(string cat, bool forumslink)
Builds forum category path
Parameters:
cat - Category code
forumslink - Include forums main link
Returns:
See Also:
cot_breadcrumbs()

modules\install\inc\install.update.php at line 253

cot_get_config

public void cot_get_config(mixed file)

plugins\i18n\inc\i18n.functions.php at line 27

cot_i18n_build_catpath

public string cot_i18n_build_catpath(string area, string cat, string locale)
Builds internationalized category path
Parameters:
area - Area code
cat - Category code
locale - Locale code
Returns:

plugins\i18n\inc\i18n.functions.php at line 58

cot_i18n_enabled

public bool cot_i18n_enabled(string cat)
Checks if internationalization is enabled in a selected category
Parameters:
cat - Category code
Returns:
TRUE if enabled, FALSE if not

plugins\i18n\inc\i18n.functions.php at line 82

cot_i18n_get_cat

public static mixed cot_i18n_get_cat(string cat, string locale)
Fetches translation row for a specific category
Parameters:
cat - Category code
locale - Locale code
Returns:
Category translation row or FALSE if not found

plugins\i18n\inc\i18n.functions.php at line 97

cot_i18n_get_page

public mixed cot_i18n_get_page(int page_id, string locale)
Fetches translation row for a specific page
Parameters:
page_id - Page ID
locale - Locale code
Returns:
Page translation row (array) on success or FALSE on error
Global:
CotDB $db

plugins\i18n\inc\i18n.functions.php at line 112

cot_i18n_list_cat_locales

public array cot_i18n_list_cat_locales(string cat)
Returns a list of all locales available for a category
Parameters:
cat - Category code
Returns:
List of locale codes

plugins\i18n\inc\i18n.functions.php at line 128

cot_i18n_list_page_locales

public array cot_i18n_list_page_locales(int page_id)
Returns a list of all locales available for a specific page
Parameters:
page_id - Page ID
Returns:
List of locale codes
Global:
CotDB $db

plugins\i18n\inc\i18n.functions.php at line 142

cot_i18n_load_locales

public void cot_i18n_load_locales()
Loads registered locales
Global:
array $i18n_locales Available locale data
CotDB $db

plugins\i18n\inc\i18n.functions.php at line 164

cot_i18n_load_structure

public void cot_i18n_load_structure()
Loads structure internationalization data
Global:
array $i18n_structure Structure localizations
CotDB $db

plugins\i18n\inc\i18n.functions.php at line 191

cot_i18n_save

public bool cot_i18n_save(string table_name, string field, int item, string locale, string text, bool riched)
Saves a translation for an item
Parameters:
table_name - Table name
field - Column name
item - Item ID
locale - Locale code
text - Translated text
riched - A flag that indicates that a field requires rich text editor
Returns:
Global:
CotDB $db

modules\install\inc\install.install.php at line 418

cot_install_config_replace

public string cot_install_config_replace(string file_contents, string config_name, string config_value)
Replaces a sample config with its actual value
Parameters:
file_contents - Config file contents
config_name - Config option name
config_value - Config value to set
Returns:
Modified file contents

system\admin\admin.functions.php at line 28

cot_linkif

public string cot_linkif(string url, string text, bool cond)
Returns $url as an HTML link if $cond is TRUE or just plain $text otherwise
Parameters:
url - Link URL
text - Link text
cond - Condition
Returns:

plugins\bbcode\inc\bbcode.functions.php at line 209

cot_parse_bbcode

public string cot_parse_bbcode(string text)
Parses bbcodes in text.
Global:
$cot_bbcodes
Parameters:
text - Text body
Returns:

modules\rss\rss.php at line 218

cot_parse_page_text

public void cot_parse_page_text(mixed pag_text, mixed pag_pageurl, mixed pag_parser)

modules\polls\inc\polls.functions.php at line 30

cot_poll_edit_form

public bool cot_poll_edit_form(int id, XTemplate t, string block, string type)
Adds form for create/edit Poll
Parameters:
id - Poll ID or Poll Code if $type is not epmty or new for new Poll
t - Template
block - Poll block in Template
type - Poll type
Returns:
Global:
CotDB $db

plugins\ratings\inc\ratings.functions.php at line 31

cot_ratings_display

public array cot_ratings_display(string ext_name, string code, string cat, bool readonly)
Generates ratings display for a given item
Parameters:
ext_name - Module or plugin code
code - Item identifier
cat - Item category code (optional)
readonly - Display as read-only
Returns:
Rendered HTML output for ratings and average integer value as an array with 2 elements
Global:
CotDB $db

system\admin\admin.rightsbyitem.php at line 123

cot_rights_parseline

public void cot_rights_parseline(mixed row, mixed title, mixed link)

modules\pm\inc\pm.functions.php at line 30

cot_send_translated_mail

public void cot_send_translated_mail(string rlang, string remail, string rusername)
Send an email in the recipient's language
Parameters:
rlang - Recipient language
remail - Recipient email
rusername - Recipient name

plugins\bbcode\inc\bbcode.functions.php at line 350

cot_smilies

public string cot_smilies(string res)
Parses smiles in text
Parameters:
res - Source text
Returns:

plugins\bbcode\inc\bbcode.functions.php at line 369

cot_smilies_load

public void cot_smilies_load()
Load smilies from current pack
Global:
Cache $cache

plugins\hits\inc\hits.functions.php at line 24

cot_stat_create

public void cot_stat_create(string name)
Creates new stats parameter
Parameters:
name - Parameter name
Global:
CotDB $db

plugins\hits\inc\hits.functions.php at line 37

cot_stat_get

public int cot_stat_get(string name)
Returns statistics parameter
Parameters:
name - Parameter name
Returns:
Global:
CotDB $db

plugins\hits\inc\hits.functions.php at line 52

cot_stat_inc

public void cot_stat_inc(string name, int value)
Increments stats
Parameters:
name - Parameter name
value - Increment step
Global:
CotDB $db

plugins\hits\inc\hits.functions.php at line 65

cot_stat_update

public void cot_stat_update(string name, int value)
Inserts new stat or increments value if it already exists
Parameters:
name - Parameter name
value - Increment step
Global:
CotDB $db

plugins\tags\inc\tags.functions.php at line 30

cot_tag

public bool cot_tag(string tag, int item, string area, mixed extra)
Tags a given item from a specific area with a keyword
Parameters:
tag - The tag (keyword)
item - Item ID
area - Site area code (e.g. 'pages', 'forums', 'blog')
extra - Extra condition (name => value) for plugins
Returns:
Global:
CotDB $db

plugins\tags\tags.php at line 246

cot_tag_search_forums

public void cot_tag_search_forums(string query)
Search by tag in forums
Parameters:
query - User-entered query string
Global:
CotDB $db

plugins\tags\tags.php at line 121

cot_tag_search_pages

public void cot_tag_search_pages(string query)
Search by tag in pages
Parameters:
query - User-entered query string
Global:
CotDB $db

plugins\trashcan\inc\trashcan.functions.php at line 157

cot_trash_delete

public bool cot_trash_delete(int id)
Deletes a trash item with subitems
Parameters:
id - Trash item ID
Returns:
Operation success or failure
Global:
CotDB $db

modules\forums\forums.trashcan.php at line 31

cot_trash_forumpost_check

public bool cot_trash_forumpost_check(array data)
Check forumpost action
Parameters:
data - trashcan item data
Returns:
Global:
CotDB $db

modules\page\page.trashcan.php at line 30

cot_trash_page_sync

public bool cot_trash_page_sync(array data)
Sync page action
Parameters:
data - trashcan item data
Returns:
Global:
Cache $cache

plugins\trashcan\inc\trashcan.functions.php at line 28

cot_trash_put

public int cot_trash_put(string type, string title, int itemid, mixed datas, int parentid)
Sends item to trash
Parameters:
type - Item type
title - Title
itemid - Item ID
datas - Item contents
parentid - trashcan parent id
Returns:
Trash insert id
Global:
CotDB $db

plugins\trashcan\inc\trashcan.functions.php at line 81

cot_trash_restore

public bool cot_trash_restore(int id)
Restores a trash item
Parameters:
id - Trash item ID
Returns:
Operation success or failure

plugins\userimages\inc\userimages.functions.php at line 135

cot_userimages_build

public string cot_userimages_build(string src, string code)
Returns user image html code
Parameters:
src - File path
code - Userimage code
Returns:

plugins\userimages\inc\userimages.functions.php at line 49

cot_userimages_config_add

public bool cot_userimages_config_add(string code, int width, int height, string crop, bool force)
Add a user image type
Parameters:
code - Code for image, also used for tpl tags
width - Image maximum width
height - Image maximum height
crop - Crop ratio, or 'fit' to use width/height to calculate ratio
Returns:
Global:
CotDB $db
Cache $cache

plugins\userimages\inc\userimages.functions.php at line 89

cot_userimages_config_edit

public Entries cot_userimages_config_edit(string code, int width, int height, string crop)
Edit a user image type
Parameters:
code - Code for image, also used for tpl tags
width - Image maximum width
height - Image maximum height
crop - Crop ratio, or 'fit' to use width/height to calculate ratio
Returns:
modified
Global:
Cache $cache

plugins\userimages\inc\userimages.functions.php at line 13

cot_userimages_config_get

public array cot_userimages_config_get(bool ignorecache)
Get configuration for user image types
Returns:
Global:
Cache $cache

plugins\userimages\inc\userimages.functions.php at line 112

cot_userimages_config_remove

public DB cot_userimages_config_remove(string code, bool dropcolumn)
Remove a user image type
Parameters:
code - User image code
Returns:
query result
Global:
CotDB $db
Cache $cache

plugins\userimages\inc\userimages.functions.php at line 215

cot_userimages_process_uploads

public boolean|number cot_userimages_process_uploads(number uid)
Process uploaded user images files for certain User
Parameters:
uid - User ID for uploads to be attached
Returns:
Number of uploaded images or false for incorrect $uid

plugins\userimages\inc\userimages.functions.php at line 165

cot_userimages_tags

public array cot_userimages_tags(array user_data, string tag_prefix)
Returns UserImages tags for coTemplate
Parameters:
user_data - User info array
tag_prefix - Prefix for tags
Returns:

plugins\whosonline\inc\whosonline.functions.php at line 22

cot_userisonline

public bool cot_userisonline(int id)
Checks whether user is online
Parameters:
id - User ID
Returns:

modules\forums\inc\forums.topics.php at line 270

cursort

public void cursort(mixed trigger, mixed way)

modules\forums\inc\forums.topics.php at line 265

rev

public void rev(mixed sway)