Procedural File: functions.php
Source Location: /include/functions.php
Page Details
Helper functions available in the ImpressCMS process
| Author: | http://www.xoops.org The XOOPS Project |
| Author: | modified by marcan <marcan@impresscms.org> |
| Version: | $Id: functions.php 1683 2008-04-19 13:50:00Z malanciault $ |
| Copyright: | http://www.impresscms.org/ The ImpressCMS Project |
| Copyright: | http://www.xoops.org/ The XOOPS Project |
| Copyright: | XOOPS_copyrights.txt |
| Since: | XOOPS |
| Filesource: | Source Code for this file |
| License: | GNU General Public License (GPL) |
Functions
void checkEmail(
$email, [ $antispam = false]
)
|
|
Parameters:
These functions are some Persian users related functions In ImpressCMS we are trying to bring different calendar type in core, so this is the place to place them If you know other calendars, plaese contact ImpressCMS developpers to add them to core ;-)
Parameters:
Information Tags:
| Author: | Roozbeh Pournader and Mohammad Toossi |
| Author: | FARSI PROJECTS GROUP |
| Author: | jalali Date function by Milad Rastian (miladmovie AT yahoo DOT com) |
| Author: | Sina Asghari (aka stranger) <pesian_stranger@users.sourceforge.net> |
| Copyright: | http://www.impresscms.org/ The ImpressCMS Project |
| Copyright: | (C) jalali Date function by Milad Rastian (miladmovie AT yahoo DOT com) |
| Copyright: | (C) 2000 Roozbeh Pournader and Mohammad Toossi |
| Copyright: | (C) 2003 FARSI PROJECTS GROUP |
| Since: | 1.1.1 |
void ext_date(
$type, [ $maket = "now"]
)
|
|
This function is to convert date() function outputs into local values
Parameters:
Information Tags:
formatTimestamp [line 139]
void formatTimestamp(
$time, [ $format = "l"], [ $timeoffset = null]
)
|
|
Parameters:
|
|
$time: |
|
|
|
$format: |
|
|
|
$timeoffset: |
|
void getcss(
[ $theme = '']
)
|
|
Parameters:
void getDbValue(
&$db, $table, $field, [ $condition = '']
)
|
|
Function to get a query from DB
Parameters:
|
|
&$db: |
|
|
|
$table: |
|
|
|
$field: |
|
|
|
$condition: |
|
gregorian_to_jalali [line 1932]
void gregorian_to_jalali(
$g_y, $g_m, $g_d
)
|
|
Parameters:
bool icms_chmod(
string $target, [int $mode = 0777]
)
|
|
Change the permission of a file or folder
Parameters:
|
string |
$target: |
target file or folder |
|
int |
$mode: |
permission |
API Tags:
| Return: | Returns true on success, false on failure |
Information Tags:
| Author: | Newbb2 developpement team |
icms_cleaning_write_folders [line 1789]
void icms_cleaning_write_folders(
)
|
|
icms_cleanTags [line 1363]
void icms_cleanTags(
$sSource, [ $aAllowedTags = array('<h1>','<b>','<u>','<a>','<ul>','<li>')], [ $aDisabledAttributes = array('onabort', 'onblue', 'onchange', 'onclick', 'ondblclick', 'onerror', 'onfocus', 'onkeydown', 'onkeyup', 'onload', 'onmousedown', 'onmousemove', 'onmouseover', 'onmouseup', 'onreset', 'onresize', 'onselect', 'onsubmit', 'onunload')]
)
|
|
Function to keeps the code clean while removing unwanted attributes and tags.
This function was got from http://www.php.net/manual/en/function.strip-tags.php#81553
Parameters:
|
|
$sSource: |
|
|
|
$aAllowedTags: |
|
|
|
$aDisabledAttributes: |
|
icms_convert_size [line 2341]
void icms_convert_size(
$size
)
|
|
Parameters:
icms_conv_local2nr [line 1819]
void icms_conv_local2nr(
$string
)
|
|
Parameters:
icms_conv_nr2local [line 1809]
void icms_conv_nr2local(
$string
)
|
|
Parameters:
bool icms_copyr(
string $source, string $dest
)
|
|
Copy a file, or a folder and its contents
Parameters:
|
string |
$source: |
The source |
|
string |
$dest: |
The destination |
API Tags:
| Return: | Returns true on success, false on failure |
Information Tags:
icms_createSalt [line 1253]
string icms_createSalt(
[string $slength = 64]
)
|
|
This Function creates a unique random Salt Key for use with password encryptions It can also be used to generate a random AlphaNumeric key sequence of any given length.
Parameters:
|
string |
$slength: |
The length of the key to produce |
API Tags:
| Return: | returns the generated random key. |
Information Tags:
| Copyright: | (c) 2007-2008 The ImpressCMS Project - www.impresscms.org |
| Since: | 1.1 |
icms_currency [line 1123]
void icms_currency(
$var, [ $currencyObj = false]
)
|
|
Parameters:
icms_encryptPass [line 1320]
string icms_encryptPass(
string $pass, string $salt, [int $enc_type = 0], [int $reset = 0]
)
|
|
This Function is used to Encrypt User Passwords
Parameters:
|
string |
$pass: |
plaintext password to be encrypted |
|
string |
$salt: |
unique user salt key used in encryption process |
|
int |
$enc_type: |
encryption type to use (this is required & only used when passwords are expired) |
|
int |
$reset: |
set to 1 if we have determined that the user password has been expired use in conjunction only with $enc_type above. |
API Tags:
| Return: | returns the final encrypted hash of users password. |
Information Tags:
| Copyright: | (c) 2007-2008 The ImpressCMS Project - www.impresscms.org |
| Since: | 1.1 |
icms_escapeValue [line 1770]
string icms_escapeValue(
string $value, [string $quotes = true]
)
|
|
Function to escape $value makes safe for DB Queries.
Parameters:
|
string |
$quotes: |
- true/false - determines whether to add quotes to the value or not. |
|
string |
$value: |
- $variable that is being escaped for query. |
icms_getConfig [line 1018]
mixed icms_getConfig(
string $key, [string $moduleName = false], [mixed $default = 'default_is_undefined']
)
|
|
Get a specific module config value
Parameters:
|
string |
$key: |
|
|
string |
$moduleName: |
|
|
mixed |
$default: |
|
icms_getCookieVar [line 1390]
string icms_getCookieVar(
string $name, [string $default = '']
)
|
|
Get a cookie value
Parameters:
|
string |
$name: |
name of the cookie |
|
string |
$default: |
value to return if cookie not found |
API Tags:
| Return: | value of the cookie or default value |
icms_getCurrentModuleName [line 1035]
mixed icms_getCurrentModuleName(
)
|
|
Get the dirname of the current module
API Tags:
| Return: | dirname of the current module or false if no module loaded |
icms_getfloat [line 1096]
void icms_getfloat(
$str, [ $set = FALSE]
)
|
|
Parameters:
Information Tags:
| Author: | pillepop2003 at yahoo dot de Use this snippet to extract any float out of a string. You can choose how a single dot is treated with the (bool) 'single_dot_as_decimal' directive. This function should be able to cover almost all floats that appear in an european environment. |
icms_getLinkedUnameFromId [line 1441]
string icms_getLinkedUnameFromId(
integer $userid, [bool $name = false], [array $users = array ()], [bool $withContact = false]
)
|
|
Return a linked username or full name for a specific $userid
Parameters:
|
integer |
$userid: |
uid of the related user |
|
bool |
$name: |
true to return the fullname, false to use the username; if true and the user does not have fullname, username will be used instead |
|
array |
$users: |
array already containing XoopsUser objects in which case we will save a query |
|
bool |
$withContact: |
true if we want contact details to be added in the value returned (PM and email links) |
API Tags:
| Return: | name of user with a link on his profile |
icms_getModuleConfig [line 972]
array &icms_getModuleConfig(
[string $moduleName = false]
)
|
|
Get the config array of a specified module
Parameters:
|
string |
$moduleName: |
dirname of the module |
API Tags:
icms_getModuleInfo [line 936]
object XoopsModule &icms_getModuleInfo(
[string $moduleName = false]
)
|
|
Get the XoopsModule object of a specified module
Parameters:
|
string |
$moduleName: |
dirname of the module |
API Tags:
| Return: | object of the specified module |
Icms_getMonthNameById [line 1831]
void Icms_getMonthNameById(
$month_id
)
|
|
Parameters:
icms_getTablesArray [line 1487]
array icms_getTablesArray(
string $moduleName, $items $items
)
|
|
Get an array of the table used in a module
Parameters:
|
string |
$moduleName: |
name of the module |
|
$items |
$items: |
array of items managed by the module |
API Tags:
| Return: | of tables used in the module |
icms_getUnameFromUserEmail [line 1294]
string icms_getUnameFromUserEmail(
[string $email = '']
)
|
|
This Function returns the Username of the account linked to the inputted email address
Parameters:
|
string |
$email: |
Email address to find username for. |
API Tags:
| Return: | returns the username of the account linked to supplied email. |
Information Tags:
| Copyright: | (c) 2007-2008 The ImpressCMS Project - www.impresscms.org |
| Since: | 1.1 |
icms_getUserSaltFromUname [line 1273]
string icms_getUserSaltFromUname(
[string $uname = '']
)
|
|
This Function returns the User Salt key belonging to username.
Parameters:
|
string |
$uname: |
Username to find User Salt key for.. |
API Tags:
| Return: | returns the Salt key of the user. |
Information Tags:
| Copyright: | (c) 2007-2008 The ImpressCMS Project - www.impresscms.org |
| Since: | 1.1 |
icms_get_base_domain [line 1574]
string icms_get_base_domain(
string $url
)
|
|
Function to get the base domain name from a URL.
credit for this function should goto Phosphorus and Lime, it is released under LGPL.
Parameters:
|
string |
$url: |
the URL to be stripped. |
icms_get_page_before_form [line 1402]
void icms_get_page_before_form(
)
|
|
Get URL of the page before the form to be able to redirect their after the form has been posted
return string url before form
icms_get_url_domain [line 1645]
string icms_get_url_domain(
string $url
)
|
|
Function to get the domain from a URL.
credit for this function should goto Phosphorus and Lime, it is released under LGPL.
Parameters:
|
string |
$url: |
the URL to be stripped. |
icms_html2text [line 1177]
void icms_html2text(
$document
)
|
|
Parameters:
icms_loadLanguageFile [line 1079]
void icms_loadLanguageFile(
string $module, string $file, [bool $admin = false]
)
|
|
Load a module language file
If $module = core, file will be loaded from ICMS_ROOT_PATH/language/
Parameters:
|
string |
$module: |
dirname of the module |
|
string |
$file: |
name of the file without ".php" |
|
bool |
$admin: |
is this for a core admin side feature ? |
bool icms_mkdir(
string $target
)
|
|
Create a folder
Parameters:
|
string |
$target: |
folder being created |
API Tags:
| Return: | Returns true on success, false on failure |
Information Tags:
| Author: | Newbb2 developpement team |
icms_passExpired [line 1231]
int icms_passExpired(
[string $uname = '']
)
|
|
This Function checks whether a users password has been expired
Parameters:
|
string |
$uname: |
The username of the account to be checked |
API Tags:
| Return: | returns 1 if password is expired, 0 if password is ot expired. |
Information Tags:
| Copyright: | (c) 2007-2008 The ImpressCMS Project - www.impresscms.org |
| Since: | 1.1 |
icms_purifyText [line 1143]
void icms_purifyText(
$text, [ $keyword = false]
)
|
|
Parameters:
icms_random_str [line 2354]
void icms_random_str(
$numchar
)
|
|
Parameters:
icms_sanitizeContentCss [line 1551]
void icms_sanitizeContentCss(
$text
)
|
|
Parameters:
icms_sanitizeCustomtags [line 1420]
void icms_sanitizeCustomtags(
$text
)
|
|
Parameters:
icms_sanitizeCustomtags_callback [line 1408]
void icms_sanitizeCustomtags_callback(
$matches
)
|
|
Parameters:
icms_setCookieVar [line 1376]
void icms_setCookieVar(
string $name, string $value, [int $time = 0]
)
|
|
Store a cookie
Parameters:
|
string |
$name: |
name of the cookie |
|
string |
$value: |
value of the cookie |
|
int |
$time: |
duration of the cookie |
string icms_substr(
string $str, int $start, int $length, [string $trimmarker = '...']
)
|
|
Returns the portion of string specified by the start and length parameters.
If $trimmarker is supplied, it is appended to the return string. This function works fine with multi-byte characters if mb_* functions exist on the server.
Parameters:
|
string |
$str: |
|
|
int |
$start: |
|
|
int |
$length: |
|
|
string |
$trimmarker: |
|
icms_userIsAdmin [line 1047]
boolean icms_userIsAdmin(
[ $module = false]
)
|
|
Checks if a user is admin of $module
Parameters:
API Tags:
| Return: | : true if user is admin |
icms_utf8_strrev [line 1721]
string icms_utf8_strrev(
string $str, [string $reverse = false]
)
|
|
Function to reverse given text with utf-8 character sets
credit for this function should goto lwc courtesy of php.net.
Parameters:
|
string |
$str: |
The text to be reversed. |
|
string |
$reverse: |
true will reverse everything including numbers, false will reverse text only but numbers will be left intact. example: when true: impresscms 2008 > 8002 smcsserpmi, false: impresscms 2008 > 2008 smcsserpmi |
icms_wordwrap [line 1665]
string icms_wordwrap(
string $str, string $width, [string $break = '/n'], [string $cut = false]
)
|
|
Function to wordwrap given text.
Parameters:
|
string |
$str: |
The text to be wrapped. |
|
string |
$width: |
The column width - text will be wrapped when longer than $width. |
|
string |
$break: |
The line is broken using the optional break parameter. can be '/n' or ' ' |
|
string |
$cut: |
If cut is set to TRUE, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart.. |
jalali_to_gregorian [line 1976]
void jalali_to_gregorian(
$j_y, $j_m, $j_d
)
|
|
Parameters:
void jdate(
$type, [ $maket = "now"]
)
|
|
Parameters:
void jmaketime(
$hour, $minute, $second, $jmonth, $jday, $jyear
)
|
|
Parameters:
|
|
$hour: |
|
|
|
$minute: |
|
|
|
$second: |
|
|
|
$jmonth: |
|
|
|
$jday: |
|
|
|
$jyear: |
|
void lastday(
$month, $day, $year
)
|
|
Parameters:
void mstart(
$month, $day, $year
)
|
|
Parameters:
redirect_header [line 449]
void redirect_header(
$url, [ $time = 3], [ $message = ''], [ $addredirect = true], [ $allowExternalLink = false]
)
|
|
Parameters:
|
|
$url: |
|
|
|
$time: |
|
|
|
$message: |
|
|
|
$addredirect: |
|
|
|
$allowExternalLink: |
|
string showNav(
[integer $id = null], [string $separador = '/'], [string $style = "style='font-weight:bold'"]
)
|
|
Function to create a navigation menu in content pages.
This function was based on the function that do the same in mastop publish module
Parameters:
|
integer |
$id: |
|
|
string |
$separador: |
|
|
string |
$style: |
|
userTimeToServerTime [line 299]
void userTimeToServerTime(
$timestamp, [ $userTZ = null]
)
|
|
Parameters:
xoops_comment_count [line 780]
void xoops_comment_count(
$module_id, [ $item_id = null]
)
|
|
Parameters:
xoops_comment_delete [line 788]
void xoops_comment_delete(
$module_id, $item_id
)
|
|
Parameters:
void xoops_confirm(
$hiddens, $action, $msg, [ $submit = ''], [ $addtoken = true]
)
|
|
Parameters:
|
|
$hiddens: |
|
|
|
$action: |
|
|
|
$msg: |
|
|
|
$submit: |
|
|
|
$addtoken: |
|
xoops_convert_encoding [line 840]
void xoops_convert_encoding(
&$text
)
|
|
Parameters:
void xoops_error(
$msg, [ $title = '']
)
|
|
Parameters:
xoops_getbanner [line 400]
void xoops_getcss(
[ $theme = '']
)
|
|
Parameters:
void xoops_getenv(
$key
)
|
|
Parameters:
xoops_gethandler [line 599]
void &xoops_gethandler(
$name, [ $optional = false]
)
|
|
Parameters:
xoops_getLinkedUnameFromId [line 842]
void xoops_getLinkedUnameFromId(
$userid
)
|
|
Parameters:
xoops_getmodulehandler [line 624]
void &xoops_getmodulehandler(
[ $name = null], [ $module_dir = null], [ $optional = false]
)
|
|
Parameters:
|
|
$name: |
|
|
|
$module_dir: |
|
|
|
$optional: |
|
void xoops_getrank(
[ $rank_id = 0], [ $posts = 0]
)
|
|
Parameters:
xoops_getUserTimestamp [line 124]
void xoops_getUserTimestamp(
$time, [ $timeoffset = ""]
)
|
|
Parameters:
xoops_groupperm_deletebymoditem [line 822]
void xoops_groupperm_deletebymoditem(
$module_id, $perm_name, [ $item_id = null]
)
|
|
Parameters:
|
|
$module_id: |
|
|
|
$perm_name: |
|
|
|
$item_id: |
|
void xoops_header(
[ $closehead = true]
)
|
|
Helper functions available in the ImpressCMS process
Parameters:
API Tags:
Information Tags:
| Author: | http://www.xoops.org The XOOPS Project |
| Author: | modified by marcan <marcan@impresscms.org> |
| Version: | $Id: functions.php 1683 2008-04-19 13:50:00Z malanciault $ |
| Copyright: | http://www.impresscms.org/ The ImpressCMS Project |
| Copyright: | http://www.xoops.org/ The XOOPS Project |
| Copyright: | XOOPS_copyrights.txt |
| Since: | XOOPS |
| License: | GNU General Public License (GPL) |
xoops_makepass [line 307]
xoops_notification_deletebyitem [line 772]< |
|