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
checkEmail  [line 371]

void checkEmail( $email, [ $antispam = false]  )
Parameters:
   $email: 
   $antispam: 


[ Top ]
CloseWaitBox  [line 361]

void CloseWaitBox( )


[ Top ]
div  [line 1929]

void div( $a, $b  )

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:
   $a: 
   $b: 

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

[ Top ]
ext_date  [line 2220]

void ext_date( $type, [ $maket = &quot;now&quot;]  )

This function is to convert date() function outputs into local values

Parameters:
   $type: 
   $maket: 

Information Tags:
Author:  Sina Asghari (aka stranger) <pesian_stranger@users.sourceforge.net>
Copyright:  http://www.impresscms.org/ The ImpressCMS Project
Since:  1.1.1

[ Top ]
formatTimestamp  [line 139]

void formatTimestamp( $time, [ $format = &quot;l&quot;], [ $timeoffset = null]  )
Parameters:
   $time: 
   $format: 
   $timeoffset: 


[ Top ]
formatURL  [line 382]

void formatURL( $url  )
Parameters:
   $url: 


[ Top ]
getcss  [line 547]

void getcss( [ $theme = '']  )
Parameters:
   $theme: 


[ Top ]
getDbValue  [line 1749]

void getDbValue( &$db, $table, $field, [ $condition = '']  )

Function to get a query from DB

Parameters:
   &$db: 
   $table: 
   $field: 
   $condition: 


[ Top ]
getMailer  [line 585]

void &getMailer( )


[ Top ]
getTheme  [line 541]

void getTheme( )


[ Top ]
gregorian_to_jalali  [line 1932]

void gregorian_to_jalali( $g_y, $g_m, $g_d  )
Parameters:
   $g_y: 
   $g_m: 
   $g_d: 


[ Top ]
icms_chmod  [line 928]

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

[ Top ]
icms_cleaning_write_folders  [line 1789]

void icms_cleaning_write_folders( )


[ Top ]
icms_cleanTags  [line 1363]

void icms_cleanTags( $sSource, [ $aAllowedTags = array('&lt;h1&gt;','&lt;b&gt;','&lt;u&gt;','&lt;a&gt;','&lt;ul&gt;','&lt;li&gt;')], [ $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: 


[ Top ]
icms_convert_size  [line 2341]

void icms_convert_size( $size  )
Parameters:
   $size: 


[ Top ]
icms_conv_local2nr  [line 1819]

void icms_conv_local2nr( $string  )
Parameters:
   $string: 


[ Top ]
icms_conv_nr2local  [line 1809]

void icms_conv_nr2local( $string  )
Parameters:
   $string: 


[ Top ]
icms_copyr  [line 872]

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:
Author:  Aidan Lister <aidan@php.net>

[ Top ]
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

[ Top ]
icms_currency  [line 1123]

void icms_currency( $var, [ $currencyObj = false]  )
Parameters:
   $var: 
   $currencyObj: 


[ Top ]
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

[ Top ]
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.


[ Top ]
icms_float  [line 1141]

void icms_float( $var  )
Parameters:
   $var: 


[ Top ]
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: 


[ Top ]
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


[ Top ]
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


[ Top ]
icms_getfloat  [line 1096]

void icms_getfloat( $str, [ $set = FALSE]  )
Parameters:
   $str: 
   $set: 

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.


[ Top ]
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


[ Top ]
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:
Return:  of configs


[ Top ]
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


[ Top ]
Icms_getMonthNameById  [line 1831]

void Icms_getMonthNameById( $month_id  )
Parameters:
   $month_id: 


[ Top ]
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


[ Top ]
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

[ Top ]
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

[ Top ]
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.


[ Top ]
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



[ Top ]
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.


[ Top ]
icms_html2text  [line 1177]

void icms_html2text( $document  )
Parameters:
   $document: 


[ Top ]
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 ?


[ Top ]
icms_mkdir  [line 900]

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

[ Top ]
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

[ Top ]
icms_purifyText  [line 1143]

void icms_purifyText( $text, [ $keyword = false]  )
Parameters:
   $text: 
   $keyword: 


[ Top ]
icms_random_str  [line 2354]

void icms_random_str( $numchar  )
Parameters:
   $numchar: 


[ Top ]
icms_sanitizeContentCss  [line 1551]

void icms_sanitizeContentCss( $text  )
Parameters:
   $text: 


[ Top ]
icms_sanitizeCustomtags  [line 1420]

void icms_sanitizeCustomtags( $text  )
Parameters:
   $text: 


[ Top ]
icms_sanitizeCustomtags_callback  [line 1408]

void icms_sanitizeCustomtags_callback( $matches  )
Parameters:
   $matches: 


[ Top ]
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


[ Top ]
icms_substr  [line 698]

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: 


[ Top ]
icms_userIsAdmin  [line 1047]

boolean icms_userIsAdmin( [ $module = false]  )

Checks if a user is admin of $module

Parameters:
   $module: 

API Tags:
Return:  : true if user is admin


[ Top ]
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


[ Top ]
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..


[ Top ]
jalali_to_gregorian  [line 1976]

void jalali_to_gregorian( $j_y, $j_m, $j_d  )
Parameters:
   $j_y: 
   $j_m: 
   $j_d: 


[ Top ]
jdate  [line 2081]

void jdate( $type, [ $maket = &quot;now&quot;]  )
Parameters:
   $type: 
   $maket: 


[ Top ]
jmaketime  [line 2067]

void jmaketime( $hour, $minute, $second, $jmonth, $jday, $jyear  )
Parameters:
   $hour: 
   $minute: 
   $second: 
   $jmonth: 
   $jday: 
   $jyear: 


[ Top ]
lastday  [line 2039]

void lastday( $month, $day, $year  )
Parameters:
   $month: 
   $day: 
   $year: 


[ Top ]
mstart  [line 2030]

void mstart( $month, $day, $year  )
Parameters:
   $month: 
   $day: 
   $year: 


[ Top ]
OpenWaitBox  [line 322]

void OpenWaitBox( )


[ Top ]
redirect_header  [line 449]

void redirect_header( $url, [ $time = 3], [ $message = ''], [ $addredirect = true], [ $allowExternalLink = false]  )
Parameters:
   $url: 
   $time: 
   $message: 
   $addredirect: 
   $allowExternalLink: 


[ Top ]
showbanner  [line 395]

void showbanner( )


[ Top ]
showNav  [line 1503]

string showNav( [integer $id = null], [string $separador = '/'], [string $style = &quot;style='font-weight:bold'&quot;]  )

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: 


[ Top ]
StopXSS  [line 1526]

void StopXSS( $text  )
Parameters:
   $text: 


[ Top ]
userTimeToServerTime  [line 299]

void userTimeToServerTime( $timestamp, [ $userTZ = null]  )
Parameters:
   $timestamp: 
   $userTZ: 


[ Top ]
xoops_comment_count  [line 780]

void xoops_comment_count( $module_id, [ $item_id = null]  )
Parameters:
   $module_id: 
   $item_id: 


[ Top ]
xoops_comment_delete  [line 788]

void xoops_comment_delete( $module_id, $item_id  )
Parameters:
   $module_id: 
   $item_id: 


[ Top ]
xoops_confirm  [line 99]

void xoops_confirm( $hiddens, $action, $msg, [ $submit = ''], [ $addtoken = true]  )
Parameters:
   $hiddens: 
   $action: 
   $msg: 
   $submit: 
   $addtoken: 


[ Top ]
xoops_convert_encoding  [line 840]

void xoops_convert_encoding( &$text  )
Parameters:
   &$text: 


[ Top ]
xoops_error  [line 63]

void xoops_error( $msg, [ $title = '']  )
Parameters:
   $msg: 
   $title: 


[ Top ]
xoops_footer  [line 56]

void xoops_footer( )


[ Top ]
xoops_getbanner  [line 400]

void xoops_getbanner( )


[ Top ]
xoops_getcss  [line 552]

void xoops_getcss( [ $theme = '']  )
Parameters:
   $theme: 


[ Top ]
xoops_getenv  [line 522]

void xoops_getenv( $key  )
Parameters:
   $key: 


[ Top ]
xoops_gethandler  [line 599]

void &xoops_gethandler( $name, [ $optional = false]  )
Parameters:
   $name: 
   $optional: 


[ Top ]
xoops_getLinkedUnameFromId  [line 842]

void xoops_getLinkedUnameFromId( $userid  )
Parameters:
   $userid: 


[ Top ]
xoops_getmodulehandler  [line 624]

void &xoops_getmodulehandler( [ $name = null], [ $module_dir = null], [ $optional = false]  )
Parameters:
   $name: 
   $module_dir: 
   $optional: 


[ Top ]
xoops_getrank  [line 653]

void xoops_getrank( [ $rank_id = 0], [ $posts = 0]  )
Parameters:
   $rank_id: 
   $posts: 


[ Top ]
xoops_getUserTimestamp  [line 124]

void xoops_getUserTimestamp( $time, [ $timeoffset = &quot;&quot;]  )
Parameters:
   $time: 
   $timeoffset: 


[ Top ]
xoops_groupperm_deletebymoditem  [line 822]

void xoops_groupperm_deletebymoditem( $module_id, $perm_name, [ $item_id = null]  )
Parameters:
   $module_id: 
   $perm_name: 
   $item_id: 


[ Top ]
xoops_header  [line 16]

void xoops_header( [ $closehead = true]  )

Helper functions available in the ImpressCMS process

Parameters:
   $closehead: 

API Tags:
Filesource:  Source Code for this file

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)

[ Top ]
xoops_makepass  [line 307]

void xoops_makepass( )


[ Top ]
xoops_notification_deletebyitem  [line 772]<