本文整理汇总了PHP中cbUnHtmlspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP cbUnHtmlspecialchars函数的具体用法?PHP cbUnHtmlspecialchars怎么用?PHP cbUnHtmlspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cbUnHtmlspecialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
$params = $trigger->getParams()->subTree( 'loginlogout' );
cbimport( 'cb.authentication' );
$cbAuthenticate = new CBAuthentication();
$isHttps = ( isset( $_SERVER['HTTPS'] ) && ( ! empty( $_SERVER['HTTPS'] ) ) && ( $_SERVER['HTTPS'] != 'off' ) );
$returnUrl = 'http' . ( $isHttps ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'];
if ( ( ! empty( $_SERVER['PHP_SELF'] ) ) && ( ! empty( $_SERVER['REQUEST_URI'] ) ) ) {
$returnUrl .= $_SERVER['REQUEST_URI'];
} else {
$returnUrl .= $_SERVER['SCRIPT_NAME'];
if ( isset( $_SERVER['QUERY_STRING'] ) && ( ! empty( $_SERVER['QUERY_STRING'] ) ) ) {
$returnUrl .= '?' . $_SERVER['QUERY_STRING'];
}
}
$returnUrl = cbUnHtmlspecialchars( preg_replace( '/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', preg_replace( '/eval\((.*)\)/', '', htmlspecialchars( urldecode( $returnUrl ) ) ) ) );
if ( preg_match( '/index.php\?option=com_comprofiler&task=confirm&confirmCode=|index.php\?option=com_comprofiler&view=confirm&confirmCode=|index.php\?option=com_comprofiler&task=login|index.php\?option=com_comprofiler&view=login/', $returnUrl ) ) {
$returnUrl = 'index.php';
}
$redirect = $trigger->getSubstituteString( $params->get( 'redirect', null, GetterInterface::STRING ), array( 'cbautoactionsClass', 'escapeURL' ) );
if ( $redirect ) {
$returnUrl = $redirect;
}
$message = $trigger->getSubstituteString( CBTxt::T( $params->get( 'message', null, GetterInterface::RAW ) ), false );
if ( $params->get( 'mode', 1, GetterInterface::BOOLEAN ) ) {
$messagesToUser = array();
$alertMessages = array();
if ( $params->get( 'method', 1, GetterInterface::BOOLEAN ) ) {
$credentials = $trigger->getSubstituteString( $params->get( 'username', null, GetterInterface::STRING ) );
$method = 0;
} else {
$credentials = $trigger->getSubstituteString( $params->get( 'email', null, GetterInterface::STRING ) );
$method = 1;
}
$resultError = $cbAuthenticate->login( $credentials, false, 0, 1, $returnUrl, $messagesToUser, $alertMessages, $method );
if ( $redirect ) {
cbRedirect( $redirect, ( $resultError ? $resultError : ( $message ? $message : ( $alertMessages ? stripslashes( implode( '<br />', $alertMessages ) ) : null ) ) ), ( $resultError ? 'error' : 'message' ) );
}
} else {
$resultError = $cbAuthenticate->logout( $returnUrl );
if ( $redirect ) {
cbRedirect( $redirect, ( $resultError ? $resultError : ( $message ? $message : CBTxt::T( 'LOGOUT_SUCCESS', 'You have successfully logged out' ) ) ), ( $resultError ? 'error' : 'message' ) );
}
}
}
示例2: getReturnURL
static function getReturnURL($params, $type)
{
global $cbSpecialReturnAfterLogin, $cbSpecialReturnAfterLogout;
static $returnUrl = null;
if (!isset($returnUrl)) {
$returnUrl = Application::Input()->get('get/return', '', GetterInterface::BASE64);
if ($returnUrl) {
$returnUrl = base64_decode($returnUrl);
if (!JUri::isInternal($returnUrl)) {
// The URL isn't internal to the site; reset it to index to be safe:
$returnUrl = 'index.php';
}
} else {
$isHttps = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
$returnUrl = 'http' . ($isHttps ? 's' : '') . '://' . $_SERVER['HTTP_HOST'];
if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
$returnUrl .= $_SERVER['REQUEST_URI'];
} else {
$returnUrl .= $_SERVER['SCRIPT_NAME'];
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
$returnUrl .= '?' . $_SERVER['QUERY_STRING'];
}
}
}
$returnUrl = cbUnHtmlspecialchars(preg_replace('/[\\\\"\\\'][\\s]*javascript:(.*)[\\\\"\\\']/', '""', preg_replace('/eval\\((.*)\\)/', '', htmlspecialchars(urldecode($returnUrl)))));
if (preg_match('/index.php\\?option=com_comprofiler&task=confirm&confirmCode=|index.php\\?option=com_comprofiler&view=confirm&confirmCode=|index.php\\?option=com_comprofiler&task=login|index.php\\?option=com_comprofiler&view=login/', $returnUrl)) {
$returnUrl = 'index.php';
}
}
$secureForm = (int) $params->get('https_post', 0);
if ($type == 'login') {
$loginReturnUrl = $params->get('login', $returnUrl);
if (isset($cbSpecialReturnAfterLogin)) {
$loginReturnUrl = $cbSpecialReturnAfterLogin;
}
$url = cbSef($loginReturnUrl, true, 'html', $secureForm);
} elseif ($type == 'logout') {
$logoutReturnUrl = $params->get('logout', 'index.php');
if ($logoutReturnUrl == '#') {
$logoutReturnUrl = $returnUrl;
}
if (isset($cbSpecialReturnAfterLogout)) {
$logoutReturnUrl = $cbSpecialReturnAfterLogout;
}
$url = cbSef($logoutReturnUrl, true, 'html', $secureForm);
} else {
$url = $returnUrl;
}
return base64_encode($url);
}
示例3: getEditTab
/**
* Generates the HTML to display the user edit tab
* @param moscomprofilerTab $tab the tab database entry
* @param moscomprofilerUser $user the user being displayed
* @param int $ui 1 for front-end, 2 for back-end
* @return mixed either string HTML for tab content, or false if ErrorMSG generated
*/
function getEditTab( $tab, $user, $ui) {
global $my, $_CB_framework, $_POST, $mainframe; // $mainframe needed by the require
if( intval( $_CB_framework->myId() ) < 1 ) {
cbNotAuth();
return false;
}
if(!$this->_CheckYancInstalled()) {
return _UE_NEWSLETTERNOTINSTALLED;
}
require_once( $_CB_framework->getCfg('absolute_path') . _NEWSLETTERFILE );
$newslettersSubscriptions = new YancSubscription();
$return="";
if ($user->id) {
$rows = $newslettersSubscriptions->getSubscriberLists($user);
if (isset($_POST['newsLhtml'])) {
$postedLists = cbGetParam($_POST, 'newsLitems', array(0));
$postedHtml = cbGetParam($_POST, 'newsLhtml', 1);
for ($i = 0, $n=count($rows); $i < $n; $i++) {
$rows[$i]->subscribed = in_array($rows[$i]->id,$postedLists);
$rows[$i]->receive_html = $postedHtml;
}
}
} else {
$params=$this->params;
$newslettersRegList=$params->get('newslettersRegList');
$listsArray = (isset($newslettersRegList)) ? explode("|*|", $newslettersRegList) : null;
$rows = $newslettersSubscriptions->getLists($my, $listsArray);
$postedLists = cbGetParam($_POST, 'newsLitems', array(0));
$postedHtml = cbGetParam($_POST, 'newsLhtml', 1);
for ($i = 0, $n=count($rows); $i < $n; $i++) {
$rows[$i]->subscribed = in_array($rows[$i]->id,$postedLists);
$rows[$i]->receive_html = $postedHtml;
}
}
if(count($rows)==0) {
$return = _UE_NONEWSLETTERS;
} else {
if($tab->description != null) $return .= "\t\t<div class=\"tab_Description\">".cbUnHtmlspecialchars(getLangDefinition($tab->description))."</div>\n";
$return .= $this->_getFormattedNewsletters($rows, false, _UE_NEWSLETTER_NAME, _UE_NEWSLETTER_DESCRIPTION);
}
return $return;
}
示例4: drawTab
/**
* Draws the user profile tab "Subscriptions" (if enabled, user is the profile owner, and something to display.
*
* @param string $htmlSubscriptionsAndUpgrades
* @param string $htmlInvoicesLink
* @param string $tabTitleText
* @param string $htmlTabDescription
* @return string
*/
public function drawTab($htmlSubscriptionsAndUpgrades, $htmlInvoicesLink, $tabTitleText, $htmlTabDescription)
{
global $ueConfig;
$this->htmlSubscriptionsAndUpgrades = $htmlSubscriptionsAndUpgrades;
$this->htmlInvoicesLink = $htmlInvoicesLink;
$this->htmlTabDescription = $htmlTabDescription;
$user = $this->_model;
$title = cbReplaceVars(CBPTXT::Th(cbUnHtmlspecialchars($tabTitleText)), $user);
if ($title) {
$name = getNameFormat($user->name, $user->username, $ueConfig['name_format']);
$title = sprintf($title, $name);
}
$this->htmlTabTitle = $title;
return $this->display();
}
示例5: getField
/**
* Returns a DELIMITER field in specified format
*
* @param FieldTable $field
* @param UserTable $user
* @param string $output 'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
* @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
* @param int $list_compare_types IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
* @return mixed
*/
public function getField(&$field, &$user, $output, $reason, $list_compare_types)
{
$value = cbReplaceVars(cbUnHtmlspecialchars($field->description), $user);
//TBD: unhtml is kept for backwards database compatibility until CB 2.0
if ($field->params->get('field_content_plugins', 0)) {
$value = Application::Cms()->prepareHtmlContentPlugins($value);
}
$return = $this->_formatFieldOutput($field->name, $value, $output, false);
if ($output == 'htmledit') {
$return .= $this->_fieldIconsHtml($field, $user, $output, $reason, null, null, $value, null, null, false, false);
}
return $return;
}
示例6: saveRegistrationNOCHECKSLOL
/**
* @param string $option
*/
function saveRegistrationNOCHECKSLOL($option)
{
global $_CB_framework, $_CB_database, $ueConfig, $_POST, $_PLUGINS;
// Check rights to access:
if ($_CB_framework->getCfg('allowUserRegistration') == '0' && (!isset($ueConfig['reg_admin_allowcbregistration']) || $ueConfig['reg_admin_allowcbregistration'] != '1') || $_CB_framework->myId()) {
cbNotAuth();
return;
}
if (!isset($ueConfig['emailpass'])) {
$ueConfig['emailpass'] = '0';
}
$userComplete = new moscomprofilerUser($_CB_database);
// Pre-registration trigger:
$_PLUGINS->loadPluginGroup('user');
$_PLUGINS->trigger('onStartSaveUserRegistration', array());
if ($_PLUGINS->is_errors()) {
echo "<script type=\"text/javascript\">alert('" . addslashes($_PLUGINS->getErrorMSG()) . "'); </script>\n";
$oldUserComplete = new moscomprofilerUser($_CB_database);
$userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete);
HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $_PLUGINS->getErrorMSG("<br />"));
return;
}
// Check if this user already registered with exactly this username and password:
$username = cbGetParam($_POST, 'username', '');
$usernameExists = $userComplete->loadByUsername($username);
if ($usernameExists) {
$password = cbGetParam($_POST, 'password', '', _CB_ALLOWRAW);
if ($userComplete->verifyPassword($password)) {
$pwd_md5 = $userComplete->password;
$userComplete->password = $password;
$messagesToUser = activateUser($userComplete, 1, 'SameUserRegistrationAgain');
$userComplete->password = $pwd_md5;
echo "\n<div>" . implode("</div>\n<div>", $messagesToUser) . "</div>\n";
return;
} else {
$msg = sprintf(_UE_USERNAME_ALREADY_EXISTS, $username);
echo "<script type=\"text/javascript\">alert('" . addslashes($msg) . "'); </script>\n";
$oldUserComplete = new moscomprofilerUser($_CB_database);
$userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete);
HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, htmlspecialchars($msg));
return;
}
}
// Store and check terms and conditions accepted (not a field yet !!!!):
if (isset($_POST['acceptedterms'])) {
$userComplete->acceptedterms = (int) cbGetParam($_POST, 'acceptedterms', 0) == 1 ? 1 : 0;
} else {
$userComplete->acceptedterms = null;
}
if ($ueConfig['reg_enable_toc']) {
if ($userComplete->acceptedterms != 1) {
echo "<script type=\"text/javascript\">alert('" . addslashes(cbUnHtmlspecialchars(_UE_TOC_REQUIRED)) . "'); </script>\n";
$oldUserComplete = new moscomprofilerUser($_CB_database);
$userComplete->bindSafely($_POST, $_CB_framework->getUi(), 'register', $oldUserComplete);
HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, _UE_TOC_REQUIRED . '<br />');
return;
}
}
// Set id to 0 for autoincrement and store IP address used for registration:
$userComplete->id = 0;
$userComplete->registeripaddr = cbGetIPlist();
// Store new user state:
$saveResult = $userComplete->saveSafely($_POST, $_CB_framework->getUi(), 'register');
if ($saveResult === false) {
echo "<script type=\"text/javascript\">alert('" . str_replace('\\\\n', '\\n', addslashes(strip_tags(str_replace('<br />', '\\n', $userComplete->getError())))) . "'); </script>\n";
HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $userComplete->getError());
return;
}
if ($saveResult['ok'] === true) {
$messagesToUser = activateUser($userComplete, 1, "UserRegistration");
}
foreach ($saveResult['tabs'] as $res) {
if ($res) {
$messagesToUser[] = $res;
}
}
if ($saveResult['ok'] === false) {
echo "<script type=\"text/javascript\">alert('" . str_replace('\\\\n', '\\n', addslashes(strip_tags(str_replace('<br />', '\\n', $userComplete->getError())))) . "'); </script>\n";
HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $userComplete->getError());
return;
}
$_PLUGINS->trigger('onAfterUserRegistrationMailsSent', array(&$userComplete, &$userComplete, &$messagesToUser, $ueConfig['reg_confirmation'], $ueConfig['reg_admin_approval'], true));
foreach ($saveResult['after'] as $res) {
if ($res) {
echo "\n<div>" . $res . "</div>\n";
}
}
if ($_PLUGINS->is_errors()) {
echo $_PLUGINS->getErrorMSG();
HTML_comprofiler::registerForm($option, $ueConfig['emailpass'], $userComplete, $_POST, $_PLUGINS->getErrorMSG());
return;
}
echo "\n<div>" . implode("</div>\n<div>", $messagesToUser) . "</div>\n";
}
示例7: _form_firstwords
/**
* Implements a form firstwords field
*
* @param string $name The name of the form element
* @param string $value The value of the element
* @param SimpleXMLElement $node The xml element for the parameter
* @param string $control_name The control name
* @return string The html for the element
*/
function _form_firstwords( $name, $value, &$node, $control_name ) {
if ( $this->_view ) {
$size = $node->attributes( 'size' );
if ( ! $size ) {
$size = 45;
}
$strippedContent = trim( strip_tags( cbUnHtmlspecialchars( $value ) ) );
if ( cbIsoUtf_strlen( $strippedContent ) > $size ) {
$content = '<span title="' . htmlspecialchars($strippedContent ) . '">' . htmlspecialchars( cbIsoUtf_substr( $strippedContent, 0, $size ) . '...' ) . '</span>';
} else {
$content = htmlspecialchars( $strippedContent );
}
return $content;
} else {
return $this->_form_textarea($name, $value, $node, $control_name );
}
}
示例8: _notifyConnectionChange
/**
* Notifies connection changes
*
* @param int $userId
* @param int $connectionId
* @param string $msg
* @param string $subject
* @param string $messageHTML
* @param string $messageText
* @param string $userMessage
* @return boolean
*/
protected function _notifyConnectionChange( $userId, $connectionId, $msg, $subject, $messageHTML, $messageText, $userMessage = null )
{
global $_CB_framework, $ueConfig;
$rowFrom = new UserTable();
$rowFrom->load( (int) $userId );
$fromName = getNameFormat( $rowFrom->name, $rowFrom->username, $ueConfig['name_format'] );
$fromURL = 'index.php?option=com_comprofiler&view=userprofile&user=' . $userId . '&tab=1' . getCBprofileItemid(true);
$fromURL = cbSef( $fromURL );
if ( strncasecmp( 'http', $fromURL, 4 ) != 0 ) {
$fromURL = $_CB_framework->getCfg( 'live_site' ) . '/' . $fromURL;
}
$subject = sprintf( $subject, $fromName );
if ( $userMessage != null ) {
$messageHTML .= sprintf( str_replace( "\n", "\n<br />", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', " %s included the following personal message:\n\n%s" ) ),
htmlspecialchars( $fromName ),
'<strong>' . htmlspecialchars( $userMessage ) . '</strong>' );
$messageText .= sprintf( str_replace( "\n", "\r\n", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', " %s included the following personal message:\n\n%s" ) ),
$fromName,
$userMessage );
}
$notificationMsgHTML = sprintf( $messageHTML, '<strong><a href="' . $fromURL . '">' . htmlspecialchars( $fromName ) . '</a></strong>' );
$notificationMsgText = sprintf( $messageText, $fromName );
$manageURL = 'index.php?option=com_comprofiler&view=manageconnections' . getCBprofileItemid( true );
$manageURL = cbSef( $manageURL );
if ( strncasecmp( 'http', $manageURL, 4 ) != 0 ) {
$manageURL = $_CB_framework->getCfg( 'live_site' ) . '/' . $manageURL;
}
$notificationMsgHTML = $notificationMsgHTML
. "\n<br /><br /><a href=\"" . $manageURL . '">'
. CBTxt::T( 'UE_MANAGECONNECTIONS_LINK UE_MANAGECONNECTIONS', 'Manage Connections' )
. "</a>\n";
$notificationMsgText = $notificationMsgText
. "\r\n\r\n\r\n" . $fromName . ' '
. CBTxt::T( 'CONNECTION_PROFILE UE_PROFILE', 'Profile' )
. ': '
. cbUnHtmlspecialchars( $fromURL );
$notificationMsgText = $notificationMsgText
. "\r\n\r\n"
. CBTxt::T( 'UE_MANAGECONNECTIONS_URL_LABEL UE_MANAGECONNECTIONS', 'Manage Connections' )
. ': '
. cbUnHtmlspecialchars( $manageURL )
. "\r\n";
$notificationMsgHTML = '<div style="padding: 4px; margin: 4px 3px 6px 0px; background: #C44; font-weight: bold;" class="cbNotice">'
. CBTxt::T( 'UE_SENDPMSNOTICE', 'NOTE: This is a message generated automatically by the Connections system. It has the connecting user\'s address, so you can conveniently reply if you wish to.' )
. "</div>\n\n"
. $notificationMsgHTML;
$cbNotification = new cbNotification();
$cbNotification->sendFromUser( $connectionId, $userId, $subject, $notificationMsgHTML, $notificationMsgText );
$this->_setUserMSG( $msg );
return true;
}
示例9: cbSef
/**
* Converts an URL to an absolute URI with or without SEF format
*
* @param string $string The relative URL
* @param bool $htmlSpecials TRUE (default): apply htmlspecialchars to sefed URL, FALSE: don't.
* @param string $format 'html', 'component', 'raw', 'rawrel' (added in CB 1.2.3)
* @param int $ssl 1 force HTTPS, 0 leave as is, -1 for HTTP (added in CB 1.10.0)
* @param bool $sef TRUE (default): apply SEF if possible, FALSE: don't SEF (added in CB 1.10.0)
* @return string The absolute URL (relative if rawrel)
*/
function cbSef($string, $htmlSpecials = true, $format = 'html', $ssl = 0, $sef = true)
{
if ($format == 'html') {
if ($string == 'index.php' || $string == '') {
$uri = $this->getCfg('live_site') . '/';
} else {
if ($sef) {
if ($this->getUi() == 1 && (substr($string, 0, 9) == 'index.php' || $string[0] == '?') && is_callable($this->_cmsSefFunction) && !(checkJversion() == 0 && strpos($string, '[') !== false)) {
if ($string == 'index.php?option=com_comprofiler') {
$string .= '&view=userprofile';
}
$uri = call_user_func_array($this->_cmsSefFunction, array(cbUnHtmlspecialchars($string)));
} else {
$uri = $string;
}
} else {
$uri = $string;
}
if (!in_array(substr($uri, 0, 4), array('http', 'java'))) {
if (strlen($uri) > 1 && $uri[0] == '/') {
// we got special case of an absolute link without live_site, but an eventual subdirectory of live_site is included...need to strip live_site:
$matches = array();
if (preg_match('!^([^:]+://)([^/]+)(/.*)$!', $this->getCfg('live_site'), $matches) && $matches[3] == substr($uri, 0, strlen($matches[3]))) {
$uri = $matches[1] . $matches[2] . $uri;
// 'http://' . 'site.com' . '/......
} else {
$uri = $this->getCfg('live_site') . $uri;
}
} else {
$uri = $this->getCfg('live_site') . '/' . $uri;
}
}
}
} else {
if (substr($string, 0, 9) == 'index.php') {
if ($format == 'rawrel') {
$format = 'raw';
$uri = '';
} else {
$uri = $this->getCfg('live_site') . '/';
}
if (checkJversion() >= 1) {
// Joomla 1.5, 1.6:
if ($format == 'component') {
$uri .= $string . '&tmpl=' . $format;
} else {
$uri .= $string . '&format=' . $format;
}
} else {
// Mambo 4.5, 4.6, Joomla 1.0:
$uri .= 'index2.php' . substr($string, 9);
if ($format == 'component') {
$uri .= '&tmpl=' . $format;
} else {
$uri .= '&no_html=1&format=' . $format;
}
}
} else {
$uri = $string;
}
}
if (!$htmlSpecials) {
$uri = cbUnHtmlspecialchars($uri);
} else {
$uri = htmlspecialchars(cbUnHtmlspecialchars($uri));
// quite a few sefs, including Mambo and Joomla's non-sef are buggy.
}
if ((int) $ssl === 1) {
$uri = str_replace('http://', 'https://', $uri);
} elseif ((int) $ssl === -1) {
$uri = str_replace('https://', 'http://', $uri);
}
return $uri;
}
示例10: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
global $_CB_framework;
$params = $trigger->getParams()->subTree( 'redirect' );
$redirect = $trigger->getSubstituteString( $params->get( 'url', null, GetterInterface::STRING ), array( 'cbautoactionsClass', 'escapeURL' ) );
if ( ! $redirect ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_REDIRECT_NO_URL', ':: Action [action] :: Redirect skipped due to missing url', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
return;
}
$message = $trigger->getSubstituteString( CBTxt::T( $params->get( 'message', null, GetterInterface::RAW ) ), false );
$messageType = $params->get( 'type', 'message', GetterInterface::STRING );
if ( $messageType == 'custom' ) {
$messageType = $trigger->getSubstituteString( $params->get( 'custom_type', null, GetterInterface::STRING ) );
}
if ( substr( strtolower( $redirect ), 0, 6 ) == 'goback' ) {
$back = (int) substr( strtolower( $redirect ), 6 );
if ( $message ) {
$_CB_framework->enqueueMessage( $message, ( $messageType ? $messageType : null ) );
}
$_CB_framework->document->addHeadScriptDeclaration( ( $back && ( $back > 0 ) ? "window.history.go( -$back );" : "window.history.back();" ) );
} elseif ( strtolower( $redirect ) == 'reload' ) {
if ( $message ) {
$_CB_framework->enqueueMessage( $message, ( $messageType ? $messageType : null ) );
}
$_CB_framework->document->addHeadScriptDeclaration( "window.location.reload();" );
} else {
if ( strtolower( $redirect ) == 'return' ) {
$isHttps = ( isset( $_SERVER['HTTPS'] ) && ( ! empty( $_SERVER['HTTPS'] ) ) && ( $_SERVER['HTTPS'] != 'off' ) );
$redirect = 'http' . ( $isHttps ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'];
if ( ( ! empty( $_SERVER['PHP_SELF'] ) ) && ( ! empty( $_SERVER['REQUEST_URI'] ) ) ) {
$redirect .= $_SERVER['REQUEST_URI'];
} else {
$redirect .= $_SERVER['SCRIPT_NAME'];
if ( isset( $_SERVER['QUERY_STRING'] ) && ( ! empty( $_SERVER['QUERY_STRING'] ) ) ) {
$redirect .= '?' . $_SERVER['QUERY_STRING'];
}
}
$redirect = cbUnHtmlspecialchars( preg_replace( '/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', preg_replace( '/eval\((.*)\)/', '', htmlspecialchars( urldecode( $redirect ) ) ) ) );
if ( preg_match( '/index.php\?option=com_comprofiler&task=confirm&confirmCode=|index.php\?option=com_comprofiler&view=confirm&confirmCode=|index.php\?option=com_comprofiler&task=login|index.php\?option=com_comprofiler&view=login/', $redirect ) ) {
$redirect = 'index.php';
}
}
cbRedirect( $redirect, $message, ( $message ? ( $messageType ? $messageType : null ) : null ) );
}
}
示例11: _writeTabDescription
/**
* Returns the tab description with all replacements of variables and of language strings made.
*
* @param moscomprofilerTabs $tab
* @param moscomprofilerUser $user
* @param string $htmlId div id tag for the description html div
* @return string
*/
function _writeTabDescription($tab, $user, $htmlId = null)
{
if ($tab->description != null) {
$return = "\t\t<div class=\"tab_Description\"" . ($htmlId ? " id=\"" . $htmlId . "\"" : "") . ">" . cbReplaceVars(cbUnHtmlspecialchars($tab->description), $user) . "</div>\n";
} else {
$return = null;
}
return $return;
}
示例12: _notifyConnectionChange
function _notifyConnectionChange($userid, $connectionid, $msg, $subject, $messageHTML, $messageText, $userMessage = null)
{
global $_CB_framework, $_CB_database, $ueConfig;
$rowFrom = new moscomprofilerUser($_CB_database);
$rowFrom->load((int) $userid);
$fromname = getNameFormat($rowFrom->name, $rowFrom->username, $ueConfig['name_format']);
$fromURL = "index.php?option=com_comprofiler&task=userProfile&user=" . $userid . "&tab=1" . getCBprofileItemid(true);
$fromURL = cbSef($fromURL);
if (strncasecmp("http", $fromURL, 4) != 0) {
$fromURL = $_CB_framework->getCfg('live_site') . "/" . $fromURL;
}
$subject = sprintf($subject, $fromname);
if ($userMessage != null) {
$messageHTML .= sprintf(str_replace("\n", "\n<br />", _UE_CONNECTIONMSGPREFIX), $fromname, "<strong>" . htmlspecialchars($userMessage) . "</strong>");
$messageText .= sprintf(str_replace("\n", "\r\n", _UE_CONNECTIONMSGPREFIX), $fromname, $userMessage);
}
$nmsgHTML = sprintf($messageHTML, '<strong><a href="' . $fromURL . '">' . $fromname . '</a></strong>');
$nmsgText = sprintf($messageText, $fromname);
$manageURL = 'index.php?option=com_comprofiler&task=manageConnections' . getCBprofileItemid(true);
$manageURL = cbSef($manageURL);
if (strncasecmp("http", $manageURL, 4) != 0) {
$manageURL = $_CB_framework->getCfg('live_site') . "/" . $manageURL;
}
$nmsgHTML = $nmsgHTML . "\n<br /><br /><a href=\"" . $manageURL . "\">" . _UE_MANAGECONNECTIONS . "</a>\n";
$nmsgText = $nmsgText . "\r\n\r\n\r\n" . $fromname . " " . _UE_PROFILE . ": " . cbUnHtmlspecialchars($fromURL);
$nmsgText = $nmsgText . "\r\n\r\n" . _UE_MANAGECONNECTIONS . ": " . cbUnHtmlspecialchars($manageURL) . "\r\n";
$nmsgHTML = '<div style="padding: 4px; margin: 4px 3px 6px 0px; background: #C44; font-weight: bold;" class="cbNotice">' . _UE_SENDPMSNOTICE . "</div>\n\n" . $nmsgHTML;
$cbNotification = new cbNotification();
$cbNotification->sendFromUser($connectionid, $userid, $subject, $nmsgHTML, $nmsgText);
$this->_setUserMSG($msg);
return true;
}
示例13: cbsubsGatewayUrl
/**
* Returns an URL for the gateway depending on parameters
*
* @param string $result
* @param UserTable|null $user
* @param cbpaidPaymentBasket|null $paymentBasket
* @param string[string] $additionalUrlVars
* @param boolean $htmlspecialchars
* @param boolean $noAccount
* @param boolean $sefed
* @param string[] $additionalNotPrefixedVars
* @return string
*/
protected function cbsubsGatewayUrl($result, $user, $paymentBasket, $additionalUrlVars = null, $htmlspecialchars = true, $noAccount = false, $sefed = true, $additionalNotPrefixedVars = null)
{
if ($additionalUrlVars === null) {
$additionalUrlVars = array();
}
$basegetarray = $this->_baseUrlArray($user, $paymentBasket ? $paymentBasket->id : null, $additionalUrlVars, $noAccount);
$uri = $this->_getAbsURLwithParam($basegetarray, 'pluginclass', false) . '&result=' . urlencode($result) . ($paymentBasket ? '&cbpid=' . urlencode($paymentBasket->shared_secret) : '');
if ($additionalNotPrefixedVars) {
foreach ($additionalNotPrefixedVars as $k => $v) {
$uri .= '&' . $k . '=' . urlencode($v);
}
}
if ($sefed) {
return cbSef($uri, $htmlspecialchars);
} else {
return $htmlspecialchars ? $uri : cbUnHtmlspecialchars($uri);
}
}
示例14: _writeTabDescription
/**
* Returns the tab description with all replacements of variables and of language strings made.
*
* @param cbTabHandler $tab
* @param moscomprofilerUser $user
* @param string $htmlId div id tag for the description html div
* @return string
*/
function _writeTabDescription( $tab, $user, $htmlId = null ) {
if ( $tab->description != null ) {
$return = "\t\t<div class=\"tab_Description\""
. ( $htmlId ? " id=\"" . $htmlId . "\"" : "" )
. ">"
. cbReplaceVars( cbUnHtmlspecialchars( $tab->description ), $user ) //TBD later: remove cbUnHtmlSpecialchars, as from CB 1.2 on the row is stored fine.
."</div>\n";
} else {
$return = null;
}
return $return;
}
示例15: cbSef
/**
* Converts an URL to an absolute URI with SEF format
*
* @param string $string The relative URL
* @param string $htmlSpecials TRUE (default): apply htmlspecialchars to sefed URL, FALSE: don't.
* @param string $format 'html', 'component', 'raw', 'rawrel' (added in CB 1.2.3)
* @return string The absolute URL (relative if rawrel)
*/
function cbSef( $string, $htmlSpecials = true, $format = 'html' ) {
if ( $format == 'html' ) {
if ( ( $string == 'index.php' ) || ( $string == '' ) ) {
$uri = $this->getCfg( 'live_site' ) . '/';
} else {
if ( ( $this->getUi() == 1 )
&& ( ( substr( $string, 0, 9 ) == 'index.php' ) || ( $string[0] == '?' ) )
&& is_callable( $this->_cmsSefFunction )
&& ( ! ( ( checkJversion() == 0 ) && ( strpos( $string, '[' ) !== false ) ) ) ) // this is due to a bug in joomla 1.0 includes/sef.php line 426 and 501 not handling arrays at all.
{
$uri = call_user_func_array( $this->_cmsSefFunction, array( $this->_sefFuncHtmlEnt ? $string : cbUnHtmlspecialchars( $string ) ) );
} else {
$uri = $string;
}
if ( ! in_array( substr( $uri, 0, 4 ), array( 'http', 'java' ) ) ) {
if ( ( strlen( $uri ) > 1 ) && ( $uri[0] == '/' ) ) {
// we got special case of an absolute link without live_site, but an eventual subdirectory of live_site is included...need to strip live_site:
$matches = array();
if ( ( preg_match( '!^([^:]+://)([^/]+)(/.*)$!', $this->getCfg( 'live_site' ), $matches ) )
&& ( $matches[3] == substr( $uri, 0, strlen( $matches[3] ) ) ) )
{
$uri = $matches[1] . $matches[2] . $uri; // 'http://' . 'site.com' . '/......
} else {
$uri = $this->getCfg( 'live_site' ) . $uri;
}
} else {
$uri = $this->getCfg( 'live_site' ) . '/' . $uri;
}
}
}
} else /* if ( $format == 'raw' || $format == 'rawrel' || $format == 'component' ) */ {
if ( substr( $string, 0, 9 ) == 'index.php' ) {
if ( $format == 'rawrel' ) {
$format = 'raw';
$uri = '';
} else {
$uri = $this->getCfg( 'live_site' ) . '/';
}
if ( checkJversion() >= 1 ) {
// Joomla 1.5, 1.6:
if ( $format == 'component' ) {
$uri .= $string . '&tmpl=' . $format;
} else {
$uri .= $string . '&format=' . $format;
}
} else {
// Mambo 4.5, 4.6, Joomla 1.0:
$uri .= 'index2.php' . substr( $string, 9 );
if ( $format == 'component' ) {
$uri .= '&tmpl=' . $format;
} else {
$uri .= '&no_html=1&format=' . $format;
}
}
} else {
$uri = $string;
}
}
if ( ! $htmlSpecials ) {
$uri = cbUnHtmlspecialchars( $uri );
} else {
$uri = htmlspecialchars( cbUnHtmlspecialchars( $uri ) ); // quite a few sefs, including Mambo and Joomla's non-sef are buggy.
}
return $uri;
}