/** * Replaces [fieldname] by the content of the user row (except for [password]) * * @param string $msg * @param boolean|array $htmlspecialchars on replaced values only: FALSE : no htmlspecialchars, TRUE: do htmlspecialchars, ARRAY: callback method * @param boolean $menuStats * @param array $extraStrings * @param boolean|int $translateLanguage on $msg only * @return string */ public function replaceUserVars($msg, $htmlspecialchars = true, $menuStats = true, $extraStrings = null, $translateLanguage = true) { if ($extraStrings === null) { $extraStrings = array(); } if ($translateLanguage === true) { $msg = $htmlspecialchars ? CBTxt::Th($msg) : CBTxt::T($msg); } if (strpos($msg, '[') === false) { return $msg; } $msg = $this->_evaluateIfs($msg, $extraStrings); $msg = $this->_evaluateCbTags($msg); $msg = $this->_evaluateCbFields($msg, $htmlspecialchars); foreach ($extraStrings as $k => $v) { if (!is_object($v) && !is_array($v)) { if (is_array($htmlspecialchars)) { $v = call_user_func_array($htmlspecialchars, array($v)); } $msg = cbstr_ireplace("[" . $k . "]", $htmlspecialchars === true ? htmlspecialchars($v) : $v, $msg); } } if ($menuStats) { // find [menu .... : path1:path2:path3 /] and replace with HTML code if menu active, otherwise remove it all $msg = $this->_replacePragma($msg, 'menu', 'menuBar'); // no more [status ] as they are standard fields ! $msg = $this->_replacePragma( $msg, $row, 'status', 'menuList' ); } $msg = str_replace(array("&91;", "&93;"), array("[", "]"), $msg); return $msg; }
function _replaceVariables($msg, $row, $mode = 0, $extraStrings = null) { global $_CB_framework, $ueConfig; if ($extraStrings === null) { $extraStrings = array(); } if ($ueConfig['reg_confirmation'] == 1) { if ($row->confirmed) { $confirmLink = "\n" . _UE_USER_EMAIL_CONFIRMED . ".\n"; } else { if ($row->cbactivation) { $confirmCode = $row->cbactivation; } else { $confirmCode = ''; } // no sef here ! space added after link for dumb emailers (Ms Entourage) $confirmLink = " \n" . $_CB_framework->getCfg('live_site') . "/index.php?option=com_comprofiler&task=confirm&confirmcode=" . $confirmCode . getCBprofileItemid(false, 'confirm') . " \n"; // not implemented in viewUrl yet: $confirmLink = " \n". $_CB_framework->viewUrl( 'confirm', array( 'confirmcode' => $confirmCode ) ) ." \n"; } } else { $confirmLink = ' '; } $msg = str_replace(array('\\n'), array("\n"), $msg); // was eval ("\$msg = \"$msg\";"); // compensate for wrong language definitions (using '\n' instaed of "\n") $msg = cbstr_ireplace("[EMAILADDRESS]", $row->email, $msg); $msg = cbstr_ireplace("[SITEURL]", $_CB_framework->getCfg('live_site'), $msg); $msg = cbstr_ireplace("[DETAILS]", $this->_getUserDetails($row, isset($ueConfig['emailpass']) ? $ueConfig['emailpass'] : 0), $msg); $msg = cbstr_ireplace("[CONFIRM]", $confirmLink, $msg); $msg = cbReplaceVars($msg, $row, $mode, true, $extraStrings); // this is for plaintext emails, no htmlspecialchars needed here. return $msg; }
/** * Replaces [fieldname] by the content of the user row (except for [password]) * * @param string $msg * @param boolean|array $htmlspecialchars on replaced values only: FALSE : no htmlspecialchars, TRUE: do htmlspecialchars, ARRAY: callback method * @param boolean $menuStats * @param array $extraStrings * @param boolean $translateLanguage on $msg only * @return string */ function replaceUserVars( $msg, $htmlspecialchars = true, $menuStats = true, $extraStrings = null, $translateLanguage = true ){ if ( $extraStrings === null ) { $extraStrings = array(); } if ( $translateLanguage ) { $msg = getLangDefinition( $msg ); } if ( strpos( $msg, '[' ) === false ) { return $msg; } $row =& $this->_cbuser; $msg = $this->_evaluateIfs( $msg ); $msg = $this->_evaluateCbTags( $msg ); if ( is_object( $row ) ) { // old legacy modes: $array = get_object_vars( $row ); foreach( $array AS $k => $v ) { if( ( ! is_object( $v ) ) && ( ! is_array( $v ) ) ) { if ( ! ( ( strtolower( $k ) == "password" ) && ( strlen($v) >= 32 ) ) ) { /* do not translate content ! : $vTranslated = ( $translateLanguage ? getLangDefinition( $v ) : $v ); if ( is_array( $htmlspecialchars ) ) { $vTranslated = call_user_func_array( $htmlspecialchars, array( $vTranslated ) ); } $msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $vTranslated ) : $vTranslated, $msg ); */ if ( is_array( $htmlspecialchars ) ) { $v = call_user_func_array( $htmlspecialchars, array( $v ) ); } $msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $v ) : $v, $msg ); } } } } foreach( $extraStrings AS $k => $v) { if( ( ! is_object( $v ) ) && ( ! is_array( $v ) ) ) { /* do not translate content ! : $vTranslated = ( $translateLanguage ? getLangDefinition( $v ) : $v ); if ( is_array( $htmlspecialchars ) ) { $vTranslated = call_user_func_array( $htmlspecialchars, array( $vTranslated ) ); } $msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $vTranslated ) : $vTranslated, $msg ); */ if ( is_array( $htmlspecialchars ) ) { $v = call_user_func_array( $htmlspecialchars, array( $v ) ); } $msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $v ) : $v, $msg ); } } if ( $menuStats ) { // find [menu .... : path1:path2:path3 /] and replace with HTML code if menu active, otherwise remove it all $msg = $this->_replacePragma( $msg, $row, 'menu', 'menuBar' ); // no more [status ] as they are standard fields ! $msg = $this->_replacePragma( $msg, $row, 'status', 'menuList' ); } $msg = str_replace( array( "&91;", "&93;" ), array( "[", "]" ), $msg ); return $msg; }