"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "htdocs/include/functions.php" between
impresscms-1.4.2_rc.tar.gz and impresscms-1.4.2.tar.gz

About: ImpressCMS is a Content Management System for easily building and maintaining a dynamic web site (a fork of XOOPS).

functions.php  (impresscms-1.4.2_rc):functions.php  (impresscms-1.4.2)
skipping to change at line 61 skipping to change at line 61
global $icmsConfig, $xoopsTheme, $icmsConfigPlugins, $icmsConfigMetaFoote r; global $icmsConfig, $xoopsTheme, $icmsConfigPlugins, $icmsConfigMetaFoote r;
$myts =& icms_core_Textsanitizer::getInstance(); $myts =& icms_core_Textsanitizer::getInstance();
if(!headers_sent()) if(!headers_sent())
{ {
header('Content-Type:text/html; charset='._CHARSET); header('Content-Type:text/html; charset='._CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header('Cache-Control: no-store, no-cache, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: no-store, no-cache, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0');
header("Pragma: no-cache"); header("Pragma: no-cache");
header("X-Frame-Options: SAMEORIGIN");
} }
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'htt p://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'htt p://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'._LANGCODE.'" lang="'._LANGCODE.'"> echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'._LANGCODE.'" lang="'._LANGCODE.'">
<head> <head>
<meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /> <meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />
<meta http-equiv="content-language" content="'._LANGCODE.'" /> <meta http-equiv="content-language" content="'._LANGCODE.'" />
<meta name="robots" content="'.htmlspecialchars($icmsConfigMetaFooter['me ta_robots']).'" /> <meta name="robots" content="'.htmlspecialchars($icmsConfigMetaFooter['me ta_robots']).'" />
<meta name="keywords" content="'.htmlspecialchars($icmsConfigMetaFooter[' meta_keywords']).'" /> <meta name="keywords" content="'.htmlspecialchars($icmsConfigMetaFooter[' meta_keywords']).'" />
<meta name="description" content="'.htmlspecialchars($icmsConfigMetaFoote r['meta_description']).'" /> <meta name="description" content="'.htmlspecialchars($icmsConfigMetaFoote r['meta_description']).'" />
<meta name="rating" content="'.htmlspecialchars($icmsConfigMetaFooter['me ta_rating']).'" /> <meta name="rating" content="'.htmlspecialchars($icmsConfigMetaFooter['me ta_rating']).'" />
skipping to change at line 126 skipping to change at line 127
* *
* Implements all functions that are executed in the footer * Implements all functions that are executed in the footer
*/ */
function xoops_footer() { function xoops_footer() {
global $icmsConfigMetaFooter; global $icmsConfigMetaFooter;
echo '</body></html>'; echo '</body></html>';
ob_end_flush(); ob_end_flush();
} }
/** /**
* ImpressCMS Error Message Function
*
* @param string $msg The Error Message
* @param string $title The Error message title
* @param bool $render Whether to echo (render) or return the HTML string
* @return string $ret The entire error message in a HTML string
* @deprecated Use icms_coreMessage::error, instead
* @todo Remove in version 1.4 - - all occurrences have been remo
ved from the core
*/
function icms_error_msg($msg, $title='', $render = true){
icms_core_Debug::setDeprecated('icms_core_Message::error', sprintf(_CORE_
REMOVE_IN_VERSION, '1.4'));
return icms_core_Message::error($msg, $title, $render);
}
/**
* Backwards Compatibility Function
*
* @param string $msg
* @param string $title
* @deprecated Use icms_coreMessage::error, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function xoops_error($msg, $title=''){
icms_core_Debug::setDeprecated('icms_coreMessage::error', sprintf(_CORE_R
EMOVE_IN_VERSION, '1.4'));
return icms_core_Message::error($msg, $title, true);
}
/**
* ImpressCMS Warning Message Function
*
* @param string $msg The Error Message
* @param string $title The Error Message title
* @param bool $render Whether to echo (render) or return the HTML strin
g
* @deprecated Use icms_core_Message::warning, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function icms_warning_msg($msg, $title='', $render = false){
icms_core_Debug::setDeprecated('icms_core_Message::warning', sprintf(_COR
E_REMOVE_IN_VERSION, '1.4'));
return icms_core_Message::warning($msg, $title, $render);
}
/**
* Backwards Compatibility Function
* @deprecated use icms_core_Message::warning instead
* @see icms_core_Message::warning
* @todo Remove in version 1.4 - all occurrences have been removed from the core
* @param string $msg
* @param string $title
*/
function xoops_warning($msg, $title=''){
icms_core_Debug::setDeprecated( 'icms_core_Message::warning' );
return icms_core_Message::warning($msg, $title, true); }
/**
* Render result message (echo, so no return string)
* @param string $msg
* @param string $title
*
* @deprecated Use icms_core_Message:result, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function xoops_result($msg, $title='')
{
icms_core_Debug::setDeprecated('icms_core_Message::result', sprintf(_CORE
_REMOVE_IN_VERSION, '1.4'));
return icms_core_Message::result($msg, $title);
}
/**
* Generates a confirm form
*
* Will render (echo) the form so no return in this function
*
* @param array $hiddens Array of Hidden values
* @param string $action The Form action
* @param string $msg The message in the confirm form
* @param string $submit The text on the submit button
* @param bool $addtoken Whether or not to add a security token
*
* @deprecated Use icms_core_Message::confirm, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function xoops_confirm($hiddens, $action, $msg, $submit='', $addtoken = true)
{
icms_core_Debug::setDeprecated('icms_core_Message::confirm', sprintf(_COR
E_REMOVE_IN_VERSION, '1.4'));
return icms_core_Message::confirm($hiddens, $action, $msg, $submit, $addt
oken);
}
/**
* @deprecated, use {@link icms_core_Security} class instead
* @todo Remove this in 1.4 - all occurrences have been replaced in the core
**/
function xoops_refcheck($docheck=1) {
icms_core_Debug::setDeprecated('icms_core_Security->checkReferer', sprint
f(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms::$security->checkReferer($docheck);
}
/**
* Get the timestamp based on the user settings * Get the timestamp based on the user settings
* *
* @param string $time String with time * @param string $time String with time
* @param string $timeoffset The time offset string * @param string $timeoffset The time offset string
* @return string $usertimestamp The generated user timestamp * @return string $usertimestamp The generated user timestamp
* @todo Move to a static class method - user * @todo Move to a static class method - user
*/ */
function xoops_getUserTimestamp($time, $timeoffset="") function xoops_getUserTimestamp($time, $timeoffset="")
{ {
global $icmsConfig; global $icmsConfig;
skipping to change at line 258 skipping to change at line 162
*/ */
function userTimeToServerTime($timestamp, $userTZ=null) function userTimeToServerTime($timestamp, $userTZ=null)
{ {
global $icmsConfig; global $icmsConfig;
if(!isset($userTZ)) {$userTZ = $icmsConfig['default_TZ'];} if(!isset($userTZ)) {$userTZ = $icmsConfig['default_TZ'];}
$timestamp = $timestamp - (($userTZ - $icmsConfig['server_TZ']) * 3600); $timestamp = $timestamp - (($userTZ - $icmsConfig['server_TZ']) * 3600);
return $timestamp; return $timestamp;
} }
/** /**
* Function to generate password
* @deprecated use icms_core_Password::createSalt
*
* @return string $makepass The generated password
* @todo Move to a static class method - password/user
* or why not just remove and use icms_core_Password::createSalt($length); inste
ad?
*/
function xoops_makepass() {
icms_core_Debug::setDeprecated('icms_core_Password::createSalt(10) create
s random pass of 10 characters', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Password::createSalt(10);
}
/**
* Function to display dhtml loading image box
* @deprecated Not found in the core
* @todo Remove in version 1.4
*/
function OpenWaitBox()
{
icms_core_Debug::setDeprecated('','This is very old and will be removed i
n version 1.4');
echo "<div id='waitDiv' style='position:absolute;left:40%;top:50%;visibil
ity:hidden;text-align: center;'>
<table cellpadding='6' border='2' class='bg2'>
<tr>
<td align='center'><b><big>" ._FETCHING."</big></b><br /><img src
='".ICMS_URL."/images/await.gif' alt='' /><br />" ._PLEASEWAIT."</td>
</tr>
</table>
</div>
<script type='text/javascript'>
<!--//
var DHTML = (document.getElementById || document.all || document.layers);
function ap_getObj(name) {
if (document.getElementById) {
return document.getElementById(name).style;
} else if (document.all) {
return document.all[name].style;
} else if (document.layers) {
return document.layers[name];
}
}
function ap_showWaitMessage(div,flag) {
if (!DHTML) {
return;
}
var x = ap_getObj(div);
x.visibility = (flag) ? 'visible' : 'hidden';
if (!document.getElementById) {
if (document.layers) {
x.left=280/2;
}
}
return true;
}
ap_showWaitMessage('waitDiv', 1);
//-->
</script>";
}
/**
* Function to display the finish of the dhtml wait box
*
* @deprecated Not used anywhere in the core
* @todo Remove in version 1.4
*/
function CloseWaitBox()
{
icms_core_Debug::setDeprecated('', 'This is very old and will be removed
in version 1.4');
echo "<script type='text/javascript'>
<!--//
ap_showWaitMessage('waitDiv', 0);
//-->
</script>
";
}
/**
* Checks if email is of correct formatting
*
* @deprecated use icms_core_DataFilter::checkVar
*
* @param string $email The email address
* @param string $antispam Generate an email address that is protected fro
m spammers
* @return string $email The generated email address
* @todo Move to a static class method - text validation/formatting
* new filter can use icms_core_DataFilter::checkVar($email, 'email', $antispam,
$blacklist)
*/
function checkEmail($email, $antispam = 0, $blacklist = 0)
{
icms_core_Debug::setDeprecated('icms_core_DataFilter->checkVar - type = e
mail, $options1 = true/false ($antispam),
$options2 = true/false ($blacklist)', sprintf(_CORE_REMOVE_IN_VER
SION, '1.4'));
return icms_core_DataFilter::checkVar($email, 'email', $antispam, $blackl
ist);
}
/**
* Format an URL * Format an URL
* *
* @param string $url The URL to format * @param string $url The URL to format
* @return string $url The generated URL * @return string $url The generated URL
* @todo Move to a static class method - string formatting * @todo Move to a static class method - string formatting
*/ */
function formatURL($url) function formatURL($url)
{ {
$url = trim($url); $url = trim($url);
if($url != '') if($url != '')
{ {
if((!preg_match("/^http[s]*:\/\//i", $url)) && (!preg_match("/^ft p*:\/\//i", $url)) && (!preg_match("/^ed2k*:\/\//i", $url))) {$url = 'http://'.$ url;} if((!preg_match("/^http[s]*:\/\//i", $url)) && (!preg_match("/^ft p*:\/\//i", $url)) && (!preg_match("/^ed2k*:\/\//i", $url))) {$url = 'http://'.$ url;}
} }
return $url; return $url;
} }
/** /**
* Function to display banners in all pages
* @deprecated Use xoops_getbanner instead
* @todo Remove in version 1.4 - all occurrences have been removed from the core
*/
function showbanner() {
icms_core_Debug::setDeprecated('xoops_getbanner',sprintf(_CORE_REMOVE_IN_
VERSION, '1.4'));
echo xoops_getbanner();}
/**
* Gets banner HTML for use in templates
*
* @deprecated Moving to a separate module
*
* @return object $bannerobject The generated banner HTML string
*/
function xoops_getbanner() {
global $icmsConfig;
$db = icms_db_Factory::instance();
$bresult = $db->query("SELECT * FROM ".$db->prefix('banner')." ORDER BY R
AND()", 1);
if ($db->getRowsNum($bresult) > 0) {
list($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clicku
rl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult);
if ($icmsConfig['my_ip'] != $_SERVER['REMOTE_ADDR'])
$db->queryF(sprintf("UPDATE %s SET impmade = impmade+1 WH
ERE bid = '%u'", $db->prefix('banner'), (int)($bid)));
/* Check if this impression is the last one and print the banner
*/
if ($imptotal == $impmade && $imptotal != 0) {
$newid = $db->genId($db->prefix('bannerfinish').'_bid_seq
');
$sql = sprintf("INSERT INTO %s (bid, cid, impressions, cl
icks, datestart, dateend) VALUES ('%u', '%u', '%u', '%u', '%u', '%u')", $db->pre
fix('bannerfinish'), (int) ($newid), (int) ($cid), (int) ($impmade), (int) ($cli
cks), (int) ($date), time());
$db->queryF($sql);
$db->queryF(sprintf("DELETE FROM %s WHERE bid = '%u'", $d
b->prefix('banner'), (int)($bid)));
}
if ($htmlbanner) {
$bannerobject = icms_core_DataFilter::filterHTMLdisplay($
htmlcode, 0, 0);
} else {
$bannerobject = '<div><a href="'.ICMS_URL.'/banners.php?o
p=click&amp;bid='.$bid.'" rel="external">';
if (stristr($imageurl, '.swf')) {
$bannerobject = $bannerobject
.'<object type="application/x-shockwave-flash" da
ta="'.$imageurl.'" width="468" height="60">'
.'<param name="movie" value="'.$imageurl.'"></par
am>'
.'<param name="quality" value="high"></param>'
.'</object>';
} else {
$bannerobject = $bannerobject.'<img src="'.$image
url.'" alt="" />';
}
$bannerobject = $bannerobject.'</a></div>';
}
return $bannerobject;
}
}
/**
* Function to redirect a user to certain pages * Function to redirect a user to certain pages
* *
* @param string $url The URL to redirect to * @param string $url The URL to redirect to
* @param int $time The time it takes to redirect to the URL * @param int $time The time it takes to redirect to the URL
* @param string $message The message to show while redirecting * @param string $message The message to show while redirecting
* @param bool $addredirect Add a link to the redirect URL? * @param bool $addredirect Add a link to the redirect URL?
* @param string $allowExternalLink Allow external links * @param string $allowExternalLink Allow external links
*/ */
function redirect_header($url, $time = 3, $message = '', $addredirect = true, $a llowExternalLink = false) function redirect_header($url, $time = 3, $message = '', $addredirect = true, $a llowExternalLink = false)
{ {
skipping to change at line 511 skipping to change at line 271
} }
if(array_key_exists($key, $_ENV) && isset($_ENV[$key])) if(array_key_exists($key, $_ENV) && isset($_ENV[$key]))
{ {
$ret = $_ENV[$key]; $ret = $_ENV[$key];
return $ret; return $ret;
} }
return $ret; return $ret;
} }
/** /**
* @deprecated get the theme from the global $icmsConfig instead
* @todo Remove in version 1.4 - all occurrences have been removed from the core
*/
function getTheme() {
icms_core_Debug::setDeprecated( 'get the theme from the global $icmsConfi
g' );
return $GLOBALS['icmsConfig']['theme_set'];}
/**
* Function to get css file for a certain theme
* @deprecated use xoops_getcss() instead
* @todo Remove in version 1.4 - all instances have been removed from the core
*/
function getcss($theme = '') {
icms_core_Debug::setDeprecated( 'xoops_getcss' );
return xoops_getcss($theme);}
/**
* Function to get css file for a certain themeset * Function to get css file for a certain themeset
* *
* @param string $theme The theme set from the config * @param string $theme The theme set from the config
* @return mixed The generated theme HTML string or an empty string * @return mixed The generated theme HTML string or an empty string
*/ */
function xoops_getcss($theme = '') function xoops_getcss($theme = '')
{ {
if($theme == '') {$theme = $GLOBALS['icmsConfig']['theme_set'];} if($theme == '') {$theme = $GLOBALS['icmsConfig']['theme_set'];}
$uagent = xoops_getenv('HTTP_USER_AGENT'); $uagent = xoops_getenv('HTTP_USER_AGENT');
if(stristr($uagent, 'mac')) {$str_css = 'styleMAC.css';} if(stristr($uagent, 'mac')) {$str_css = 'styleMAC.css';}
skipping to change at line 554 skipping to change at line 297
} }
if(is_dir(ICMS_THEME_PATH.'/'.$theme.'/css')) if(is_dir(ICMS_THEME_PATH.'/'.$theme.'/css'))
{ {
if(file_exists(ICMS_THEME_PATH.'/'.$theme.'/css/'.$str_css)) {ret urn ICMS_THEME_URL.'/'.$theme.'/css/'.$str_css;} if(file_exists(ICMS_THEME_PATH.'/'.$theme.'/css/'.$str_css)) {ret urn ICMS_THEME_URL.'/'.$theme.'/css/'.$str_css;}
elseif(file_exists(ICMS_THEME_PATH.'/'.$theme.'/css/style.css')) {return ICMS_THEME_URL.'/'.$theme.'/css/style.css';} elseif(file_exists(ICMS_THEME_PATH.'/'.$theme.'/css/style.css')) {return ICMS_THEME_URL.'/'.$theme.'/css/style.css';}
} }
return ''; return '';
} }
/** /**
* Gets Mailer object
*
* @return object localized email object handler
* @todo Remove in version 1.4
* @deprecated Use icms_messaging_Handler, instead
*/
function &getMailer() {
icms_core_Debug::setDeprecated('icms_messaging_Handler', sprintf(_CORE_RE
MOVE_IN_VERSION, '1.4'));
return new icms_messaging_Handler();
}
/**
* Gets the handler for a class * Gets the handler for a class
* *
* @param string $name The name of the handler to get * @param string $name The name of the handler to get
* @param bool $optional Is the handler optional? * @param bool $optional Is the handler optional?
* @return object $inst The instance of the objec t that was created * @return object $inst The instance of the objec t that was created
* @todo This will not be needed when the autoload is complete * @todo This will not be needed when the autoload is complete
*/ */
function &xoops_gethandler($name, $optional = false) { function &xoops_gethandler($name, $optional = false) {
// Lookup table: old xoops names => fully qualified refactored name // Lookup table: old xoops names => fully qualified refactored name
$lookup = array( $lookup = array(
skipping to change at line 605 skipping to change at line 336
//"privmessage" => "", //"privmessage" => "",
//"session" => "", //"session" => "",
//"tplfile" => "", //"tplfile" => "",
//"tplset" => "", //"tplset" => "",
//"icmspersistablecategory" => "", //"icmspersistablecategory" => "",
); );
$lower = strtolower($name); $lower = strtolower($name);
return icms::handler(isset($lookup[$lower]) ? $lookup[$lower] : $name); return icms::handler(isset($lookup[$lower]) ? $lookup[$lower] : $name);
} }
/**
* Gets rank
*
* @param int $rank_id The Rank ID to get
* @param int $posts The number of posts to match for the rank
* @return array $rank The fetched rank array
* @deprecated Use SystemUserrankHandler->getRank
* @todo Remove in version 1.4 - all instances have been removed from the core
*/
function xoops_getrank($rank_id =0, $posts = 0) {
icms_core_Debug::setDeprecated('SystemUserrankHandler->getRank', sprintf(
_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_getModuleHandler("userrank", "system")->getRank($rank_id, $po
sts);
}
/**
* Function maintained only for compatibility
* @deprecated Use icms_core_DataFilter::icms_substr
* @todo Remove in version 1.4 - all instances have been removed from the core
*
*/
function xoops_substr($str, $start, $length, $trimmarker = '...') {
icms_core_Debug::setDeprecated('icms_core_DataFilter::icms_substr', sprin
tf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_DataFilter::icms_substr($str, $start, $length, $trimmark
er);
}
/**
* 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 o
n the server.
*
* @deprecated use icms_core_DataFilter::icms_substr()
*
* @param string $str
* @param int $start
* @param int $length
* @param string $trimmarker
*
* @return string
* @todo Move to a static class method - String
*/
function icms_substr($str, $start, $length, $trimmarker = '...')
{
icms_core_Debug::setDeprecated('icms_core_DataFilter::icms_substr', sprin
tf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_DataFilter::icms_substr($str, $start, $length, $trimmark
er);
}
// RMV-NOTIFY // RMV-NOTIFY
// ################ Notification Helper Functions ################## // ################ Notification Helper Functions ##################
/** /**
* We want to be able to delete by module, by user, or by item. * We want to be able to delete by module, by user, or by item.
* How do we specify this?? * How do we specify this??
* *
* @param int $module_id The ID of the module to unsubscribe from * @param int $module_id The ID of the module to unsubscribe from
* @return bool Did the unsubscribing succeed? * @return bool Did the unsubscribing succeed?
* @todo Move to a static class method - Notification * @todo Move to a static class method - Notification
*/ */
skipping to change at line 795 skipping to change at line 480
} }
/** /**
* Converts text to UTF-8 encoded text * Converts text to UTF-8 encoded text
* @see xoops_utf8_encode * @see xoops_utf8_encode
* @todo Move to a static class method - String * @todo Move to a static class method - String
*/ */
function xoops_convert_encoding(&$text) {return xoops_utf8_encode($text);} function xoops_convert_encoding(&$text) {return xoops_utf8_encode($text);}
/** /**
* Gets Username from UserID and creates a link to the userinfo (!) page
* @deprecated icms_member_user_Handler::getUserLink($userid, $name, $users, $wi
thContact)
*
* @param int $userid The User ID
* @return string The linked username (from userID or "Anonymous")
* @todo Remove in next major release
*/
function xoops_getLinkedUnameFromId($userid)
{
icms_core_Debug::setDeprecated("icms_member_user_Handler::getUserLink", s
printf(_CORE_REMOVE_IN_VERSION, '2.0'));
return icms_member_user_Handler::getUserLink($userid);
}
/**
* Trims certain text
*
* @deprecated use icms_core_DataFilter::icms_trim
*
* @param string $text The Text to trim
* @return string $text The trimmed text
* @todo Move to a static class method - String
*/
function xoops_trim($text)
{
icms_core_Debug::setDeprecated('icms_core_DataFilter::icms_trim', sprintf
(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_DataFilter::icms_trim($text);
}
/**
* Copy a file, or a folder and its contents
*
* @author Aidan Lister <aidan@php.net>
* @param string $source The source
* @param string $dest The destination
* @return bool Returns true on success, false on failure
* @deprecated Use icms_core_Filesystem::copyRecursive, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function icms_copyr($source, $dest)
{
icms_core_Debug::setDeprecated('icms_core_Filesystem::copyRecursive', spr
intf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::copyRecursive($source, $dest);
}
/**
* Safely create a folder
*
* @since 1.2.1
* @copyright ImpressCMS
*
* @param string $target path to the folder to be created
* @param integer $mode permissions to set on the folder. This is affected by um
ask in effect
* @param string $base root location for the folder, ICMS_ROOT_PATH or ICMS_TRUS
T_PATH, for example
* @param array $metachars Characters to exclude from a valid path name
* @return boolean True if folder is created, False if it is not
*
* @deprecated Use icms_core_Filesystem::mkdir, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function icms_mkdir($target, $mode = 0777, $base = ICMS_ROOT_PATH, $metachars =
array() ) {
icms_core_Debug::setDeprecated('icms_core_Filesystem::mkdir', sprintf(_CO
RE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::mkdir($target, $mode, $base, $metachars);
}
/**
* Change the permission of a file or folder
*
* @author Newbb2 developpement team
* @param string $target target file or folder
* @param int $mode permission
* @return bool Returns true on success, false on failure
*
* @deprecated Use icms_core_Filesystem::chmod, instead
* @todo Remove in version 1.4 - all occurrences have been removed
from the core
*/
function icms_chmod($target, $mode = 0777) {
icms_core_Debug::setDeprecated('icms_core_Filesystem::chmod', sprintf(_CO
RE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::chmod($target, $mode);
}
/**
* Get the icmsModule object of a specified module * Get the icmsModule object of a specified module
* *
* @param string $moduleName dirname of the module * @param string $moduleName dirname of the module
* @return object icmsModule object of the specified module * @return object icmsModule object of the specified module
* @todo Move to a static class method - Module * @todo Move to a static class method - Module
*/ */
function &icms_getModuleInfo($moduleName = false) function &icms_getModuleInfo($moduleName = false)
{ {
static $icmsModules; static $icmsModules;
if(isset($icmsModules[$moduleName])) if(isset($icmsModules[$moduleName]))
skipping to change at line 1107 skipping to change at line 710
if(strlen($decimal_section) == 1) {$decimal_section = '.00';} if(strlen($decimal_section) == 1) {$decimal_section = '.00';}
elseif(strlen($decimal_section) == 2) {$decimal_section = $decima l_section . '0';} elseif(strlen($decimal_section) == 2) {$decimal_section = $decima l_section . '0';}
$ret = str_replace($decimal_section_original, $decimal_section, $ ret); $ret = str_replace($decimal_section_original, $decimal_section, $ ret);
} }
else {$ret = $ret . '.00';} else {$ret = $ret . '.00';}
if($currencyObj) {$ret = $ret.' '.$currencyObj->getCode();} if($currencyObj) {$ret = $ret.' '.$currencyObj->getCode();}
return $ret; return $ret;
} }
/** /**
* Use this snippet to extract any currency out of a string
*
* @see icms_currency
* @deprecated Use icms_currency
* @todo remove in version 1.4
*/
function icms_float($var) {return icms_currency($var);}
/**
* Strip text from unwanted text (purify) * Strip text from unwanted text (purify)
* *
* @param string $text String to purify * @param string $text String to purify
* @param mixed $keyword The keyword string or false if none was p assed * @param mixed $keyword The keyword string or false if none was p assed
* @return string $text The purified text * @return string $text The purified text
* @todo Remove this and use HTML Purifier * @todo Remove this and use HTML Purifier
*/ */
function icms_purifyText($text, $keyword = false) { function icms_purifyText($text, $keyword = false) {
$text = str_replace('&nbsp;', ' ', $text); $text = str_replace('&nbsp;', ' ', $text);
$text = str_replace('<br />', ' ', $text); $text = str_replace('<br />', ' ', $text);
skipping to change at line 1293 skipping to change at line 887
* @todo Move to a static class method - Adsense * @todo Move to a static class method - Adsense
*/ */
function icms_sanitizeAdsenses_callback($matches) { function icms_sanitizeAdsenses_callback($matches) {
$icms_adsense_handler = icms_getModuleHandler("adsense", "system"); $icms_adsense_handler = icms_getModuleHandler("adsense", "system");
$icms_adsensesObj = $icms_adsense_handler->getAdsensesByTag(); $icms_adsensesObj = $icms_adsense_handler->getAdsensesByTag();
if (!isset($icms_adsensesObj[$matches[1]])) return ''; if (!isset($icms_adsensesObj[$matches[1]])) return '';
return $icms_adsensesObj[$matches[1]]->render(); return $icms_adsensesObj[$matches[1]]->render();
} }
/** /**
* @deprecated Use icms_member_user_Handler instead
* @todo Remove this function in version 1.4
*/
function icms_getLinkedUnameFromId($userid, $name = FALSE, $users = array (), $w
ithContact = FALSE) {
icms_core_Debug::setDeprecated('icms_member_user_Handler::getUserLink', s
printf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_member_user_Handler::getUserLink($userid, $name, $users, $wit
hContact);
}
/**
* Get an array of the table used in a module * Get an array of the table used in a module
* *
* @param string $moduleName name of the module * @param string $moduleName name of the module
* @param $items array of items managed by the module * @param $items array of items managed by the module
* @return array of tables used in the module * @return array of tables used in the module
* @todo Move to a static class method - Module * @todo Move to a static class method - Module
*/ */
function icms_getTablesArray($moduleName, $items) function icms_getTablesArray($moduleName, $items)
{ {
$ret = array(); $ret = array();
skipping to change at line 1555 skipping to change at line 1140
} }
if($addNewLine) {$splitedArray[] = $lineByWords;} if($addNewLine) {$splitedArray[] = $lineByWords;}
} }
else {$splitedArray[] = $line;} else {$splitedArray[] = $line;}
} }
return implode($break, $splitedArray); return implode($break, $splitedArray);
} }
} }
/** /**
* Function to reverse given text with utf-8 character sets
*
* @deprecated use icms_core_DataFilter::utf8_strrev
*
* credit for this function should goto lwc courtesy of php.net.
*
* @param string $str The text to be reversed.
* @param string $reverse true will reverse everything including numbers, f
alse will reverse text only but numbers will be left intact.
* example: when true: impresscms 2008 > 8002 smcsse
rpmi, false: impresscms 2008 > 2008 smcsserpmi
* @return string
*/
function icms_utf8_strrev($str, $reverse = false)
{
icms_core_Debug::setDeprecated('icms_core_DataFilter::utf8_strrev', sprin
tf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_DataFilter::utf8_strrev($str, $reverse);
}
/**
* Function to get a query from DB * Function to get a query from DB
* *
* @param object $db Reference to the database object * @param object $db Reference to the database object
* @param string $table The table to get the value from * @param string $table The table to get the value from
* @param string $field The table to get the value from * @param string $field The table to get the value from
* @param string $condition The where condition (where clause) to use * @param string $condition The where condition (where clause) to use
* @return mixed * @return mixed
* @todo Move to a static class method - database * @todo Move to a static class method - database
*/ */
function getDbValue(&$db, $table, $field, $condition = '') function getDbValue(&$db, $table, $field, $condition = '')
skipping to change at line 2043 skipping to change at line 1610
} }
if (!isset($handlers[$module_dir][$name]) && !$optional) { if (!isset($handlers[$module_dir][$name]) && !$optional) {
trigger_error(sprintf(_CORE_MODULEHANDLER_NOTAVAILABLE, $module_d ir, $name), E_USER_ERROR); trigger_error(sprintf(_CORE_MODULEHANDLER_NOTAVAILABLE, $module_d ir, $name), E_USER_ERROR);
} }
if (isset($handlers[$module_dir][$name])) {return $handlers[$module_dir][ $name];} if (isset($handlers[$module_dir][$name])) {return $handlers[$module_dir][ $name];}
$inst = false; $inst = false;
return $inst; return $inst;
} }
/** /**
* Gets module handler
* For Backward Compatibility.
*
* @param string $name The name of the module
* @param string $module_dir The module directory where to get
the module class
* @return object $inst The reference to the generated object
* @deprecated Use icms_getmodulehandler instead
* @todo Remove this function in version 1.4
*/
function &xoops_getmodulehandler($name = null, $module_dir = null, $optional = f
alse)
{
icms_core_Debug::setDeprecated('icms_getModuleHandler', sprintf(_CORE_REM
OVE_IN_VERSION, '1.4'));
return icms_getModuleHandler($name, $module_dir, $module_dir, $optional);
}
/**
* Get URL of previous page
*
* @deprecated use icms::$urls['previouspage']
*
* @param string $default default page if previous page is not found
* @return string previous page URL
* @todo Move to a static class method - HTTP or URI
*/
function icms_getPreviousPage($default=false) {
if (isset(icms::$urls['previouspage'])) {
return icms::$urls['previouspage'];
} elseif($default) {
return $default;
} else {
return ICMS_URL;
}
}
/**
* Get module admin link * Get module admin link
* *
* @param string $moduleName dirname of the moodule * @param string $moduleName dirname of the moodule
* @return string URL of the admin side of the module * @return string URL of the admin side of the module
* @todo Move to a static class method - HTTP or URI * @todo Move to a static class method - HTTP or URI
*/ */
function icms_getModuleAdminLink($moduleName=false) { function icms_getModuleAdminLink($moduleName=false) {
global $icmsModule; global $icmsModule;
if (!$moduleName && (isset ($icmsModule) && is_object($icmsModule))) { if (!$moduleName && (isset ($icmsModule) && is_object($icmsModule))) {
$moduleName = $icmsModule->getVar('dirname'); $moduleName = $icmsModule->getVar('dirname');
skipping to change at line 2130 skipping to change at line 1662
$dimension[1] $dimension[1]
); );
} }
return true; return true;
} else { } else {
return true; return true;
} }
} }
/** /**
* Gets all types of urls in one array
*
* @deprecated use icms::$urls
*
* @return array The array of urls
* @todo Move to a static class method - HTTP or URI
*/
function icms_getCurrentUrls() {
return icms::$urls;
}
/**
* Deletes a file
*
* @param string $dirname path of the file
* @return The unlinked dirname
* @deprecated Use icms_core_Filesystem::deleteFile
* @todo Remove in version 1.4 - all instances have been removed f
rom the core
*/
function icms_deleteFile($dirname) {
icms_core_Debug::setDeprecated('icms_core_Filesystem::deleteFile', sprint
f(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::deleteFile($dirname);
}
/**
* Resizes an image to maxheight and maxwidth * Resizes an image to maxheight and maxwidth
* *
* @param string $src The image file to resize * @param string $src The image file to resize
* @param string $maxWidth The maximum width to resize the image to * @param string $maxWidth The maximum width to resize the image to
* @param string $maxHeight The maximum height to resize the image to * @param string $maxHeight The maximum height to resize the image to
* @return array The resized image array * @return array The resized image array
* @todo Move to a static class method - Image * @todo Move to a static class method - Image
*/ */
function icms_imageResize($src, $maxWidth, $maxHeight) { function icms_imageResize($src, $maxWidth, $maxHeight) {
$width = ''; $width = '';
skipping to change at line 2281 skipping to change at line 1788
} }
/** /**
* Loads common language file * Loads common language file
*/ */
function icms_loadCommonLanguageFile() { function icms_loadCommonLanguageFile() {
icms_loadLanguageFile('system', 'common'); icms_loadLanguageFile('system', 'common');
} }
/** /**
* Gets current page
*
* @deprecated use icms::$urls['full']
*
* @return string The URL of the current page
* @todo Move to a static class method - HTTP or URI
*/
function icms_getCurrentPage() {
return icms::$urls['full'];
}
/**
* Gets module name in SEO format * Gets module name in SEO format
* *
* @param mixed $moduleName Modulename if it is passed, otherwise false * @param mixed $moduleName Modulename if it is passed, otherwise false
* @return string The modulename in SEO format * @return string The modulename in SEO format
* @todo Move to a static class method - Module * @todo Move to a static class method - Module
*/ */
function icms_getModuleNameForSEO($moduleName = false) { function icms_getModuleNameForSEO($moduleName = false) {
$icmsModule = & icms_getModuleInfo($moduleName); $icmsModule = & icms_getModuleInfo($moduleName);
$icmsModuleConfig = & icms_getModuleConfig($moduleName); $icmsModuleConfig = & icms_getModuleConfig($moduleName);
if (isset ($icmsModuleConfig['seo_module_name'])) { if (isset ($icmsModuleConfig['seo_module_name'])) {
skipping to change at line 2386 skipping to change at line 1881
$s=explode(" ", $string); $s=explode(" ", $string);
foreach ($s as $k=>$v) { foreach ($s as $k=>$v) {
$cnt=strlen($v); $cnt=strlen($v);
if($cnt>$width) $v=icms_wordwrap($v, $width, ' ', true); if($cnt>$width) $v=icms_wordwrap($v, $width, ' ', true);
$new_string.="$v "; $new_string.="$v ";
} }
return $new_string; return $new_string;
} }
/** /**
* Removes the content of a folder.
*
* @author Steve Kenow (aka skenow) <skenow@impresscms.org>
* @author modified by Vaughan <vaughan@impresscms.org>
* @author modified by Sina Asghari (aka stranger) <pesian_stranger@users.so
urceforge.net>
* @param string $path The folder path to cleaned. Must be an array like
: array('templates_c' => ICMS_COMPILE_PATH . "/");
* @param bool $remove_admin_cache True to remove admin cache, if
required.
* @deprecated Use icms_core_Filesystem::cleanFolders
* @todo Move to static class Filesystem
*/
function icms_clean_folders($dir, $remove_admin_cache=false) {
icms_core_Debug::setDeprecated('icms_core_Filesystem::cleanFolders', spri
ntf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::cleanFolders($dir, $remove_admin_cache);
}
/**
* Clean up all the writeable folders
* @param bool
* @deprecated User icms_core_Filesystem::cleanFolders
* @todo Remove in versison 1.4 - all instances have been removed
from the core
*/
function icms_cleaning_write_folders() {
icms_core_Debug::setDeprecated('icms_core_Filesystem::cleanFolders', spri
ntf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::cleanFolders(array('templates_c' => ICMS_COM
PILE_PATH . "/", 'cache' => ICMS_CACHE_PATH . "/"));
}
/**
* Recursively delete a directory
*
* @param string $dir Directory name
* @param bool $deleteRootToo Delete specified top-level directory as well
* @deprecated Use icms_core_Filesystem::deleteRecursive
* @todo Remove in version 1.4 - all instances have been removed f
rom the core
*/
function icms_unlinkRecursive($dir, $deleteRootToo=true){
icms_core_Debug::setDeprecated('icms_core_Filesystem::deleteRecursive', s
printf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::deleteRecursive($dir, $deleteRootToo);
}
/**
* Adds required jQuery files to header for Password meter. * Adds required jQuery files to header for Password meter.
* *
* @param string $password_fieldclass element id for the password field * @param string $password_fieldclass element id for the password field
* @param string $username_fieldid element id for the username field * @param string $username_fieldid element id for the username field
* @todo Move to a static class method - Password * @todo Move to a static class method - Password
*/ */
function icms_PasswordMeter($password_fieldclass = "password_adv", $username_fie ldid = "uname"){ function icms_PasswordMeter($password_fieldclass = "password_adv", $username_fie ldid = "uname"){
global $xoTheme, $icmsConfigUser; global $xoTheme, $icmsConfigUser;
$xoTheme->addScript(ICMS_URL.'/libraries/jquery/jquery.js', array('type' => 'text/javascript')); $xoTheme->addScript(ICMS_URL.'/libraries/jquery/jquery.js', array('type' => 'text/javascript'));
$xoTheme->addScript(ICMS_URL.'/libraries/jquery/password_strength_plugin. js', array('type' => 'text/javascript')); $xoTheme->addScript(ICMS_URL.'/libraries/jquery/password_strength_plugin. js', array('type' => 'text/javascript'));
skipping to change at line 2502 skipping to change at line 1957
function icms_makeSmarty($items) { function icms_makeSmarty($items) {
global $icmsTpl; global $icmsTpl;
if (!isset($icmsTpl) || !is_array($items))return false; if (!isset($icmsTpl) || !is_array($items))return false;
foreach ($items as $item => $value){ foreach ($items as $item => $value){
$icmsTpl->assign($item, $value); $icmsTpl->assign($item, $value);
} }
return true; return true;
} }
/** /**
* Copy a file, or a folder and its contents from a website to your host
*
* @author Sina Asghari <stranger@impresscms.org>
* @author nensa at zeec dot biz
* @param string $src The source
* @param string $dest The destination
* @return bool Returns stream_copy_to_stream($src, $dest) on success, fa
lse on failure
* @deprecated Use icms_core_Filesystem::copyStream
* @todo Remove in version 1.4 - all instances have been removed f
rom the core
*/
function icms_stream_copy($src, $dest)
{
icms_core_Debug::setDeprecated('icms_core_Filesystem::copyStream', sprint
f(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_core_Filesystem::copyStream($src, $dest);
}
/**
* Is a module being installed, updated or uninstalled * Is a module being installed, updated or uninstalled
* Used for setting module configuration default values or options * Used for setting module configuration default values or options
* *
* The function should be in functions.admin.php, however it requires extra incl usion in xoops_version.php if so * The function should be in functions.admin.php, however it requires extra incl usion in xoops_version.php if so
* *
* @param string $dirname dirname of current module * @param string $dirname dirname of current module
* @return bool * @return bool
* @todo Move to a static class method - Module * @todo Move to a static class method - Module
*/ */
function icms_moduleAction($dirname = 'system') function icms_moduleAction($dirname = 'system')
skipping to change at line 2603 skipping to change at line 2042
global $icmsModule; global $icmsModule;
$onClick = "ajaxtogglecollapse('$id')"; $onClick = "ajaxtogglecollapse('$id')";
//$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')"; //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')";
echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; fo nt-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">'; echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; fo nt-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">';
echo "<img id='" . $id . "_icon' src=" . ICMS_URL . "/images/close12.gif alt='' /></a>&nbsp;" . $title . "</h3>"; echo "<img id='" . $id . "_icon' src=" . ICMS_URL . "/images/close12.gif alt='' /></a>&nbsp;" . $title . "</h3>";
echo "<div id='" . $id . "'>"; echo "<div id='" . $id . "'>";
if ($dsc != '') { if ($dsc != '') {
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . "</span>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . "</span>";
} }
} }
/**
* Ajax testing......
*/
/*
function icms_collapsableBar($id = '', $title = '', $dsc='')
{
global $icmsModule;
//echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin:
6px 0 0 0; \"><a href='javascript:;' onclick=\"toggle('" . $id . "'); toggleIco
n('" . $id . "_icon')\";>";
?>
<h3 class="icms_collapsable_title"><a href="javascript:Effect.Combo('<? echo $i
d ?>');"><? echo $title ?></a></h3>
<?
echo "<img id='" . $id . "_icon' src=" . ICMS_URL . "/images/close12.gif alt=''
/></a>&nbsp;" . $title . "</h3>";
echo "<div id='" . $id . "'>";
if ($dsc != '') {
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; displa
y: block; \">" . $dsc . "</span>";
}
}
*/
/** /**
* *
* Enter description here ... * Enter description here ...
* @param unknown_type $name * @param unknown_type $name
* @todo Move to a static class method * @todo Move to a static class method
*/ */
function icms_openclose_collapsable($name) { function icms_openclose_collapsable($name) {
$path = icms::$urls['phpself']; $path = icms::$urls['phpself'];
$cookie_name = $path . '_icms_collaps_' . $name; $cookie_name = $path . '_icms_collaps_' . $name;
$cookie_name = str_replace('.', '_', $cookie_name); $cookie_name = str_replace('.', '_', $cookie_name);
skipping to change at line 2663 skipping to change at line 2082
/** /**
* @todo Move to a static class method * @todo Move to a static class method
* Enter description here ... * Enter description here ...
* @param unknown_type $name * @param unknown_type $name
*/ */
function icms_close_collapsable($name) { function icms_close_collapsable($name) {
echo "</div>"; echo "</div>";
icms_openclose_collapsable($name); icms_openclose_collapsable($name);
echo "<br />"; echo "<br />";
} }
/**
* Enter description here ...
* @param $content
* @param $title
* @param $description
* @param $pagetitle
* @param $width
* @deprecated Use icms_view_Printerfriendly::generate, instead
* @todo Remove in versions 1.4
*/
function icms_MakePrinterFriendly($content, $title=false, $description=false, $p
agetitle=false, $width=680) {
icms_core_Debug::setDeprecated('icms_view_Printerfriendly::generate', spr
intf(_CORE_REMOVE_IN_VERSION, '1.4'));
return icms_view_Printerfriendly::generate($content, $title, $description
, $pagetitle, $width);
}
/** /**
* @todo Move to a static class method - user * @todo Move to a static class method - user
* Enter description here ... * Enter description here ...
* @param $email * @param $email
*/ */
function icms_getUnameFromUserEmail($email = '') function icms_getUnameFromUserEmail($email = '')
{ {
$db = icms_db_Factory::instance(); $db = icms_db_Factory::instance();
if($email !== '') if($email !== '')
{ {
skipping to change at line 2725 skipping to change at line 2131
$groups = icms::$user->getGroups(); $groups = icms::$user->getGroups();
$editor_default = $icmsConfig['editor_default']; $editor_default = $icmsConfig['editor_default'];
$gperm_handler = icms::handler('icms_member_groupperm'); $gperm_handler = icms::handler('icms_member_groupperm');
if (file_exists(ICMS_EDITOR_PATH . "/" . $editor_default . "/xoops_versio n.php") && $gperm_handler->checkRight('use_wysiwygeditor', $theModule->getVar('m id'), $groups)) { if (file_exists(ICMS_EDITOR_PATH . "/" . $editor_default . "/xoops_versio n.php") && $gperm_handler->checkRight('use_wysiwygeditor', $theModule->getVar('m id'), $groups)) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
?>
 End of changes. 19 change blocks. 
688 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)