本文整理汇总了PHP中cbRedirect函数的典型用法代码示例。如果您正苦于以下问题:PHP cbRedirect函数的具体用法?PHP cbRedirect怎么用?PHP cbRedirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cbRedirect函数的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: edituser
/**
* Outputs legacy user edit display
*
* @deprecated 2.0
*
* @param UserTable $user
* @param string $option
* @param int $newCBuser
* @param array $postdata
*/
public function edituser($user, $option, $newCBuser, &$postdata)
{
global $_CB_framework, $_CB_Backend_Title, $_PLUGINS;
$results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 2));
if ($_PLUGINS->is_errors()) {
cbRedirect($_CB_framework->backendViewUrl('showusers'), $_PLUGINS->getErrorMSG(), 'error');
}
_CBsecureAboveForm('edituser');
cbimport('cb.validator');
outputCbTemplate(2);
initToolTip(2);
outputCbJs(2);
$tabs = new cbTabs($_CB_framework->getUi() == 2 && !isset($_REQUEST['tab']) ? 1 : 0, 2);
// use cookies in backend to remember selected tab.
$tabcontent = $tabs->getEditTabs($user, $postdata, 'htmledit', 'divs');
$_CB_Backend_Title = array(0 => array('fa fa-user', $user->id ? CBTxt::T('COMMUNITY_BUILDER_EDIT_USER_USERNAME', 'Community Builder: Edit User [[username]]', array('[username]' => $user->username)) : CBTxt::T('Community Builder: New User')));
cbValidator::loadValidation();
if (is_array($results)) {
echo implode('', $results);
}
$return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" id="cbcheckedadminForm" enctype="multipart/form-data" autocomplete="off" class="cb_form form-auto cbValidation">' . $tabcontent . '<input type="hidden" name="id" value="' . (int) $user->id . '" />' . '<input type="hidden" name="newCBuser" value="' . (int) $newCBuser . '" />' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="save" />' . cbGetSpoofInputTag('user') . '<div class="cbIconsBottom">' . getFieldIcons(2, true, true, '', '', true) . '</div>' . '</form>';
echo $return;
}
示例3: returnRedirect
/**
* Redirects to the return url if available otherwise to the url specified
*
* @param string $url
* @param null|string $message
* @param string $messageType
*/
static public function returnRedirect( $url, $message = null, $messageType = 'message' )
{
$returnUrl = self::getReturn( true, true );
cbRedirect( ( $returnUrl ? $returnUrl : $url ), $message, $messageType );
}
示例4: savePluginView
//.........这里部分代码省略.........
}
$this->savePluginViewOrder($data, $viewModel);
$resultingMsg = $data->cbResultOfStore();
break;
case 'sql:multiplerows':
default:
echo 'Save error: showview data type: ' . $dataModelType . ' not implemented !';
exit;
break;
}
if ($ui == 2) {
$url = 'index.php?option=' . $options['option'] . '&view=' . $options['view'];
if ($options['view'] == 'editPlugin') {
$url .= '&cid=' . $options['pluginid'];
}
$url = $_CB_framework->backendUrl($url);
} else {
$url = 'index.php';
if (count($options) > 0) {
$fixOptions = array();
foreach ($options as $k => $v) {
$fixOptions[$k] = $k . '=' . urlencode($v);
}
$url .= '?' . implode('&', $fixOptions);
}
}
if (isset($data->title)) {
$dataItem = CBTxt::T($data->title);
} elseif (isset($data->name)) {
$dataItem = CBTxt::T($data->name);
} else {
$dataItem = null;
}
if ($errorMsg) {
if (in_array($mode, array('save', 'savenew', 'savecopy'))) {
$mode = 'apply';
}
$msg = CBTxt::T('FAILED_TO_SAVE_LABEL_ITEM_BECAUSE_ERROR', 'Failed to save [label] [item] because: [error]', array('[label]' => $viewModel->attributes('label'), '[item]' => $dataItem, '[error]' => $errorMsg));
$msgType = 'error';
} else {
$msg = CBTxt::T('SUCCESSFULLY_SAVED_LABEL_ITEM', 'Successfully saved [label] [item]', array('[label]' => $viewModel->attributes('label'), '[item]' => $dataItem));
$msgType = 'message';
}
switch ($mode) {
case 'apply':
case 'savenew':
case 'savecopy':
unset($actionPath['view']);
foreach ($actionPath as $k => $v) {
if ($v !== '') {
$url .= '&' . $k . '=' . $v;
}
}
foreach ($parametersValues as $k => $v) {
$url .= '&' . $k . '=' . $v;
}
if ($cbprevstate) {
$url .= '&cbprevstate=' . $cbprevstate;
}
break;
case 'save':
if ($cbprevstate) {
$prevUrl = base64_decode($cbprevstate);
// $parametersValues[] = "'" . base64_encode( implode( '&', $cbprevstate ) ) . "'";
if (!preg_match('$[:/]$', $prevUrl)) {
$prevUrl = str_replace('&pluginid=', '&cid=', $prevUrl);
if ($ui == 2) {
$url = $_CB_framework->backendUrl('index.php?' . $prevUrl);
} else {
$url = 'index.php?' . $prevUrl;
}
}
}
break;
}
if ($resultingMsg) {
if ($ui != 2) {
return $resultingMsg;
// in frontend, for now, don't redirect here: think this is right !
} else {
// If not an apply then change it to an apply so we can redisplay the view with the resulting message above it:
if (in_array($mode, array('save', 'savenew', 'savecopy'))) {
$mode = 'apply';
}
echo $resultingMsg;
}
} else {
if ($ui != 2) {
return null;
// in frontend, for now, don't redirect here: think this is right !
// $url = cbUnHtmlspecialchars( cbSef( $url ) );
}
if ($mode == 'apply' && $errorMsg) {
$_CB_framework->enqueueMessage($msg, $msgType);
} else {
cbRedirect($ui == 2 ? $url : cbSef(htmlspecialchars($url), false), $msg, $msgType);
}
}
return null;
}
示例5: unattendEvent
/**
* unattend event
*
* @param int $id
* @param UserTable $user
*/
private function unattendEvent( $id, $user )
{
global $_CB_framework;
$event = CBGroupJiveEvents::getEvent( (int) $id );
$returnUrl = $_CB_framework->pluginClassUrl( $this->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $event->get( 'group' ) ) );
if ( $event->get( 'id' ) ) {
if ( ! CBGroupJive::canAccessGroup( $event->group(), $user ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' );
} elseif ( ! CBGroupJive::isModerator( $user->get( 'id' ) ) ) {
if ( ( $event->get( 'published' ) != 1 ) && ( CBGroupJive::getGroupStatus( $user, $event->group() ) < 2 ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to this event.' ), 'error' );
} elseif ( CBGroupJive::getGroupStatus( $user, $event->group() ) < 1 ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to unattend this event.' ), 'error' );
} elseif ( $event->status() == 1 ) {
cbRedirect( $returnUrl, CBTxt::T( 'You can not unattend an expired event.' ), 'error' );
}
}
} else {
cbRedirect( $returnUrl, CBTxt::T( 'Event does not exist.' ), 'error' );
}
$row = new AttendanceTable();
$row->load( array( 'user_id' => (int) $user->get( 'id' ), 'event' => (int) $event->get( 'id' ) ) );
if ( ! $row->get( 'id' ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You can not unattend an event you are not attending.' ), 'error' );
}
if ( ! $row->canDelete() ) {
cbRedirect( $returnUrl, CBTxt::T( 'GROUP_EVENT_FAILED_TO_UNATTEND', 'Event failed to unattend. Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
}
if ( ! $row->delete() ) {
cbRedirect( $returnUrl, CBTxt::T( 'GROUP_EVENT_FAILED_TO_UNATTEND', 'Event failed to unattend. Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
}
$extras = array( 'event_title' => htmlspecialchars( $event->get( 'title' ) ),
'event' => '<a href="' . $_CB_framework->pluginClassUrl( $this->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $event->get( 'group' ), 'tab' => 'grouptabevents' ) ) . '">' . htmlspecialchars( CBTxt::T( $event->get( 'title' ) ) ) . '</a>' );
CBGroupJive::sendNotifications( 'event_unattend', CBTxt::T( 'User unattended your group event' ), CBTxt::T( '[user] will no longer be attending your event [event] in the group [group]!' ), $event->group(), $user, (int) $event->get( 'user_id' ), array(), 1, $extras );
cbRedirect( $returnUrl, CBTxt::T( 'Event unattended successfully!' ) );
}
示例6: saveNotifications
/**
* save notifications
*
* @param int $id
* @param UserTable $user
*/
private function saveNotifications( $id, $user )
{
global $_CB_framework;
$row = new NotificationTable();
$isModerator = CBGroupJive::isModerator( $user->get( 'id' ) );
$group = CBGroupJive::getGroup( $id );
$row->load( array( 'user_id' => (int) $user->get( 'id' ), 'group' => (int) $group->get( 'id' ) ) );
$returnUrl = $_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) );
if ( ! CBGroupJive::canAccessGroup( $group, $user ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' );
} elseif ( ! $this->params->get( 'notifications', 1 ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to notifications in this group.' ), 'error' );
} elseif ( $row->get( 'id' ) && ( $user->get( 'id' ) != $row->get( 'user_id' ) ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to edit this users notifications.' ), 'error' );
} elseif ( ! $isModerator ) {
if ( ! CBGroupJive::canCreateGroupContent( $user, $group ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to notifications in this group.' ), 'error' );
}
}
$row->set( 'user_id', $row->get( 'user_id', (int) $user->get( 'id' ) ) );
$row->set( 'group', $row->get( 'group', (int) $group->get( 'id' ) ) );
foreach ( $this->getInput()->subTree( 'params' ) as $k => $v ) {
if ( is_array( $v ) || is_object( $v ) ) {
continue;
}
$k = Get::clean( $k, GetterInterface::COMMAND );
if ( $k ) {
if ( is_numeric( $v ) ) {
$v = (int) $this->input( 'post/params.' . $k, null, GetterInterface::INT );
} else {
$v = $this->input( 'post/params.' . $k, null, GetterInterface::STRING );
}
$row->params()->set( $k, $v );
}
}
$row->set( 'params', $row->params()->asJson() );
if ( $row->getError() || ( ! $row->check() ) ) {
$_CB_framework->enqueueMessage( CBTxt::T( 'GROUP_NOTIFICATIONS_FAILED_TO_SAVE', 'Notifications failed to save! Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
$this->showGroupNotifications( $id, $user );
return;
}
if ( $row->getError() || ( ! $row->store() ) ) {
$_CB_framework->enqueueMessage( CBTxt::T( 'GROUP_NOTIFICATIONS_FAILED_TO_SAVE', 'Notifications failed to save! Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
$this->showGroupNotifications( $id, $user );
return;
}
cbRedirect( $returnUrl, CBTxt::T( 'Notifications saved successfully!' ) );
}
示例7: cbRedirectToProfile
/**
* redirects a user to a/his profile or a given task with a given tab
* @param null|int $uid
* @param null|string $message
* @param null|string $task
* @param null|string $tab
*/
function cbRedirectToProfile($uid, $message, $task = null, $tab = null)
{
global $_CB_framework;
if (!$task) {
$task = 'userprofile';
}
$redirectURL = 'index.php?option=com_comprofiler&view=' . urlencode($task);
if ($_CB_framework->myId() != $uid) {
$redirectURL .= '&user=' . urlencode($uid);
}
if ($tab) {
$redirectURL .= '&tab=' . urlencode($tab);
}
$redirectURL .= getCBprofileItemid(false, $task);
cbRedirect(cbSef($redirectURL, false), $message);
}
示例8: deleteWall
/**
* delete wall
*
* @param int $id
* @param UserTable $user
*/
private function deleteWall( $id, $user )
{
global $_CB_framework;
$row = CBGroupJiveWall::getPost( (int) $id );
$returnUrl = $_CB_framework->pluginClassUrl( $this->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $row->get( 'group' ) ) );
if ( $row->get( 'id' ) ) {
if ( ! CBGroupJive::canAccessGroup( $row->group(), $user ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' );
} elseif ( ! CBGroupJive::isModerator( $user->get( 'id' ) ) ) {
if ( ( $user->get( 'id' ) != $row->get( 'user_id' ) ) && ( CBGroupJive::getGroupStatus( $user, $row->group() ) < 2 ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to delete this post.' ), 'error' );
}
}
} else {
cbRedirect( $returnUrl, CBTxt::T( 'Post does not exist.' ), 'error' );
}
if ( ! $row->canDelete() ) {
cbRedirect( $returnUrl, CBTxt::T( 'GROUP_POST_FAILED_TO_DELETE', 'Post failed to delete. Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
}
if ( ! $row->delete() ) {
cbRedirect( $returnUrl, CBTxt::T( 'GROUP_POST_FAILED_TO_DELETE', 'Post failed to delete. Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
}
cbRedirect( $returnUrl, CBTxt::T( 'Post deleted successfully!' ) );
}
示例9: getCBpluginComponent
/**
* WARNING: UNCHECKED ACCESS! On purpose unchecked access for M2M operations
* Generates the HTML to display for a specific component-like page for the tab. WARNING: unchecked access !
* @param null $tab
* @param UserTable $user the user being displayed
* @param int $ui 1 for front-end, 2 for back-end
* @param array $postdata _POST data for saving edited tab content as generated with getEditTab
* @return mixed either string HTML for tab content, or false if ErrorMSG generated
*/
public function getCBpluginComponent($tab, &$user, $ui, &$postdata)
{
global $_CB_framework, $ueConfig, $_GET;
cbpaidErrorHandler::on();
$result = null;
$do = cbGetParam($_GET, 'do');
switch ($do) {
case null:
$return = $this->getTabComponent($tab, $user, $ui, $postdata);
cbpaidErrorHandler::keepTurnedOn();
break;
case 'display_subscriptions':
if ($user && $user->id && $_CB_framework->myId()) {
$regTitle = strip_tags(CBPTXT::T($this->params->get('regTitle', "Subscriptions")));
outputCbTemplate();
$_CB_framework->setPageTitle($regTitle);
$_CB_framework->appendPathWay($regTitle);
$pre = '<div class="cbPageOuter"><div class="cbPageInner">';
$post = '</div></div><div class="cbClr"> </div>';
$return = $pre . $this->displayUserTab($user) . $post;
} else {
if ($_CB_framework->getCfg('allowUserRegistration') == '0' && (!isset($ueConfig['reg_admin_allowcbregistration']) || $ueConfig['reg_admin_allowcbregistration'] != '1')) {
$return = _UE_NOT_AUTHORIZED . '<br />' . _UE_DO_LOGIN;
} else {
/*
$registrationUrl = cbSef( 'index.php?option=com_comprofiler&task=registers' );
$registrationLink = '<a href="' . $registrationUrl . '">' . _UE_REGISTER . '</a>';
$loginRegisterText = sprintf( CBPTXT::Th("Please login or %s"), $registrationLink );
$return = _UE_NOT_AUTHORIZED . '<br /><br />' . $loginRegisterText;
*/
$accessPlans = null;
$return = cbpaidControllerOffer::displaySpecificPlans($accessPlans, null, $user, '');
}
}
break;
case 'accessdenied':
$params = cbpaidApp::settingsParams();
$accessRedirectLink = $params->get('subscriptionNeededRedirectLink');
if ($accessRedirectLink) {
$textMessage = $params->get('subscriptionNeededText', "A membership is needed for access.");
$return = null;
cbRedirect(cbSef($accessRedirectLink, false), CBPTXT::T($textMessage), 'warning');
} else {
/** @noinspection PhpIncludeInspection */
include_once cbpaidApp::getAbsoluteFilePath('plugin/cbsubscontent/cbsubs.content_deniedview.php');
$accessDeniedView = new cbpaidContentAccessDeniedView();
$return = $accessDeniedView->display($user, $this);
}
break;
case 'displayplans':
$plansParam = cbGetParam($_GET, 'plans');
$plans = null;
$preselect = null;
if ($plansParam) {
$plansParam = explode('-', $plansParam);
foreach ($plansParam as $p) {
$pN = (int) $p;
if ($pN) {
$plans[] = $pN;
if (substr($p, -1) == 's') {
$preselect[] = $pN;
}
}
}
}
if ($user === null || $user->id == $_CB_framework->myId()) {
$introText = CBPTXT::Th($this->params->get('plansDisplayIntroText', "We suggest subscribing to following subscriptions:"));
$return = cbpaidControllerOffer::displaySpecificPlans($plans, $preselect, $user, $introText);
} else {
$return = _UE_NOT_AUTHORIZED;
}
break;
case 'massexpire':
// cron
$params = cbpaidApp::settingsParams();
$key = cbGetParam($_GET, 'key');
if ($key && $key == md5($params->get('license_number')) && $params->get('massexpirymethod', 0) >= 2) {
$limit = $params->get('massexpirynumber', 100);
// mass-expire 100 subscriptions at a time on the way if not exipring a particular user:
$plansMgr = cbpaidPlansMgr::getInstance();
$plansMgr->checkAllSubscriptions((int) $limit);
$return = null;
} else {
$return = CBPTXT::Th("Invalid mass-expiry link: link is in global CBSubs settings.");
}
break;
case 'autopayments':
// cron
$params = cbpaidApp::settingsParams();
$key = cbGetParam($_GET, 'key');
if ($key && $key == md5($params->get('license_number'))) {
//.........这里部分代码省略.........
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:101,代码来源:cbpaidControllerCBComponent.php
示例10: getPaymentBasketPaymentForm
/**
* display basket and payment buttons or redirect for payment depending if multiple payment choices or intro text present:
*
* @param UserTable $user
* @param cbpaidPaymentBasket $paymentBasket
* @param string $introText
* @param boolean $ajax TRUE if AJAX refresh inside #cbregPayMethodsChoice, FALSE: wraps in <div id="cbregPayMethodsChoice">
* @return string HTML (or DOES REDIRECT if $redirectNow = ! ( ( $nbClasses != 1 ) || $introText ) == TRUE)
*/
public function getPaymentBasketPaymentForm( &$user, &$paymentBasket, $introText, $ajax = false ) {
global $_PLUGINS;
$result = null;
$params = cbpaidApp::settingsParams();
$invoicingAddressQuery = $params->get( 'invoicing_address_query' );
$basket_requiredterms = $params->get( 'basket_requiredterms' );
$basket_requiredtermserror = $params->get( 'basket_requiredtermserror' );
$payment_method_selection_type = $params->get( 'payment_method_selection_type', 'buttons' );
$allow_select_currency = $params->get( 'allow_select_currency', '0' );
$redirectNow = null;
$payChoicesArray = $this->getPaymentMethodsParams( $user, $paymentBasket, $introText, $redirectNow );
$chosenPaymentMethod = $paymentBasket->gateway_account ? $paymentBasket->gateway_account . '-' . $paymentBasket->payment_type : ''; // cbGetParam( $_POST, 'payment_method' );
$payChoicesHtmlRadiosArray = array();
$chosenPaymentSelector = null;
$payChoicesHtmlBottomArray = $this->_renderPayChoicesArray( $payChoicesArray, $paymentBasket, $redirectNow, $chosenPaymentMethod, $payChoicesHtmlRadiosArray, $chosenPaymentSelector );
if ( $redirectNow == 'redirect' && is_string( $payChoicesHtmlBottomArray ) ) {
cbRedirect( $payChoicesHtmlBottomArray );
}
$subscriptionsGUI = new cbpaidControllerUI();
$subscriptionsGUI->addcbpaidjsplugin();
if ( ( $payment_method_selection_type == 'radios') && ( $chosenPaymentMethod != '' ) && $chosenPaymentSelector ) {
// Select button to draw:
$payChoicePayButton = $this->getPayMethodButton( $user, $paymentBasket, $paymentBasket->gateway_account, $paymentBasket->payment_type, $chosenPaymentSelector );
/** @var $chosenPaymentSelector cbpaidGatewaySelector */
$this->modifyAspectPayMethodButton( $payChoicePayButton, $chosenPaymentSelector->paymentType );
$dummy = null;
$payChoicePayButtonHtmlArray = $this->_renderPayChoicesArray( array( $payChoicePayButton ), $paymentBasket, 'buttons', $chosenPaymentMethod, $payChoicesHtmlRadiosArray, $dummy );
$payChoicesHtmlBottomArray = array_merge( $payChoicesHtmlBottomArray, $payChoicePayButtonHtmlArray );
}
if ( true ) {
// always add cancel link
cbpaidApp::import( 'processors.cancelpay.cancelpay' );
$cancelmethod = new cbpaidGatewayAccountcancelpay();
$payClass = $cancelmethod->getPayMean();
$payChoicesHtmlBottomArray[] = $payClass->getPaymentBasketProcess( $user, $paymentBasket, 'buttons' ); // never redirectNow a cancel link :D !
}
$basketHtml = $paymentBasket->displayBasket();
if ( $allow_select_currency == 2 ) {
$currencySelector = $this->displayCurrencySelector( $paymentBasket );
} else {
$currencySelector = null;
}
$txtConclusion = $params->get('conclusion_text');
$txtFinal = $params->get('final_text');
$txtTerms = null;
if ( $basket_requiredterms == 1 ) {
global $_CB_database, $_CB_framework;
$query = 'SELECT ' . $_CB_database->NameQuote( 'params' )
. "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_fields' )
. "\n WHERE " . $_CB_database->NameQuote( 'name' ) . " = " . $_CB_database->Quote( 'acceptedterms' );
$_CB_database->setQuery( $query );
$tcParams = new Registry( $_CB_database->loadResult() );
$termsOutput = $tcParams->get( 'terms_output', 'url' );
$termsDisplay = $tcParams->get( 'terms_display', 'modal' );
$termsURL = $tcParams->get( 'terms_url', null );
$termsText = $tcParams->get( 'terms_text', null );
$termsWidth = (int) $tcParams->get( 'terms_width', 400 );
$termsHeight = (int) $tcParams->get( 'terms_height', 200 );
if ( ! $termsHeight ) {
$termsHeight = 200;
}
if ( ( ( $termsOutput == 'url' ) && $termsURL ) || ( ( $termsOutput == 'text' ) && $termsText ) ) {
if ( $termsDisplay == 'iframe' ) {
if ( $termsOutput == 'url' ) {
$txtTerms .= '<iframe class="cbTermsFrameURL" height="' . $termsHeight . '" width="' . ( $termsWidth ? $termsWidth : '100%' ) . '" src="' . htmlspecialchars( $termsURL ) . '"></iframe>';
} else {
$txtTerms .= '<div class="cbTermsFrameText" style="height:' . $termsHeight . 'px;width:' . ( $termsWidth ? $termsWidth . 'px' : '100%' ) . ';overflow:auto;">' . CBPTXT::T( $termsText ) . '</div>';
}
}
if ( $termsDisplay != 'iframe' ) {
$attributes = ' class="cbTermsLink"';
if ( ( $termsOutput == 'text' ) && ( $termsDisplay == 'window' ) ) {
$termsDisplay = 'modal';
}
//.........这里部分代码省略.........
示例11: processConnectionActions
function processConnectionActions($connectionids) {
global $_CB_framework, $ueConfig, $_POST;
// simple spoof check security
cbSpoofCheck( 'manageConnections' );
if(!$ueConfig['allowConnections']) {
echo _UE_FUNCTIONALITY_DISABLED;
return;
}
if ( ! ( $_CB_framework->myId() > 0 ) ) {
cbNotAuth();
return;
}
$cbCon = new cbConnection( $_CB_framework->myId() );
if (is_array($connectionids)) {
foreach($connectionids AS $cid) {
$action = cbGetParam( $_POST, $cid . 'action' );
if ( $action== 'd' ) {
$cbCon->denyConnection( $_CB_framework->myId(), $cid );
} elseif ( $action == 'a' ) {
$cbCon->acceptConnection( $_CB_framework->myId(), $cid );
}
}
}
$error = $cbCon->getErrorMSG();
if ( $error ) {
cbRedirect( cbSef( 'index.php?option=com_comprofiler&task=manageConnections' . getCBprofileItemid(), false ), $error, 'error' );
} else {
cbRedirect( cbSef( 'index.php?option=com_comprofiler&task=manageConnections' . getCBprofileItemid(), false ),
( is_array($connectionids) ) ? _UE_CONNECTIONACTIONSSUCCESSFULL : null );
}
return;
}
示例12: _performTableActions
//.........这里部分代码省略.........
return;
}
} else {
$_CB_framework->enqueueMessage(CBTxt::T('CANNOT_TASK_ROW_ID_ID_BECAUSE_ERROR', 'Cannot [task] row id [id] because: [error]', array('[id]' => $dataModelValue, '[task]' => strtolower($taskName), '[error]' => $row->getError())), 'error');
return;
}
}
}
}
$_CB_framework->enqueueMessage(CBTxt::T('ROW_COUNT_TASK_SUCCESS', '{1} Row [task] successfully!|%%COUNT%% rows [task] successfully!', array('%%COUNT%%' => count($cid), '[task]' => strtolower($taskName))));
}
break;
case 'editrows':
if ($this->listFieldsRows) {
if (count($cid) != 1) {
$_CB_framework->enqueueMessage(CBTxt::T('SELECT_A_ROW_TO_TASK', 'Select a row to [task]', array('[task]' => 'edit')), 'error');
return;
}
if (isset($task_parsed[1])) {
$field = $task_parsed[1];
} else {
$field = 'tid';
}
if ($this->_options['view'] == 'editPlugin') {
$task = $this->_options['view'];
} else {
$task = 'editrow';
}
$baseUrl = 'index.php?option=' . $this->_options['option'] . '&view=' . $task;
if (isset($this->_options['pluginid'])) {
$baseUrl .= '&cid=' . $this->_options['pluginid'];
}
$url = $baseUrl . '&table=' . $this->_tableBrowserModel->attributes('name') . '&action=editrow&' . urlencode($field) . '=' . urlencode($cid[0]);
cbRedirect($url);
}
break;
case 'deleterows':
if ($this->listFieldsRows) {
if (count($cid) < 1) {
$_CB_framework->enqueueMessage(CBTxt::T('SELECT_A_ROW_TO_TASK', 'Select a row to [task]', array('[task]' => 'delete')), 'error');
return;
}
$dataModelClass = $this->class;
foreach ($cid as $id) {
$dataModelValue = $id;
$row = $this->createLoadClass($dataModelClass, $dataModelValue);
if (!$row) {
$_CB_framework->enqueueMessage(CBTxt::T('No row data found'), 'error');
return;
}
if ($row->canDelete($dataModelValue)) {
if (!$row->delete($dataModelValue)) {
$_CB_framework->enqueueMessage(CBTxt::T('CANNOT_DELETE_ROW_ID_BECAUSE_ERROR', 'Cannot delete row id [id] because: [error]', array('[id]' => $dataModelValue, '[error]' => $row->getError())), 'error');
return;
}
} else {
$_CB_framework->enqueueMessage(CBTxt::T('CANNOT_DELETE_ROW_ID_BECAUSE_ERROR', 'Cannot delete row id [id] because: [error]', array('[id]' => $dataModelValue, '[error]' => $row->getError())), 'error');
return;
}
}
$_CB_framework->enqueueMessage(CBTxt::T('ROW_COUNT_DELETED_SUCCESS', 'Row deleted successfully!|%%COUNT%% rows deleted successfully!', array('%%COUNT%%' => count($cid))));
}
break;
case 'batchrows':
if ($this->listFieldsRows) {
if (count($cid) < 1) {
示例13: deleteUser
/**
* @param int $userId
* @param UserTable $user
* @return mixed
*/
public function deleteUser( $userId, $user )
{
global $_CB_framework, $_PLUGINS;
if ( ! $userId ) {
$userId = $user->get( 'id' );
}
$profileUrl = $_CB_framework->userProfileUrl( $userId, false );
if ( ! $userId ) {
$profileUrl = 'index.php';
}
if ( $this->getDeleteField( $userId, $user ) ) {
$cbUser = CBuser::getInstance( $userId, false );
$deleteUser = $cbUser->getUserData();
$_PLUGINS->trigger( 'privacy_onBeforeAccountDelete', array( &$deleteUser, $user ) );
if ( $deleteUser->delete( $userId ) ) {
$closed = new cbprivacyClosedTable();
$closed->set( 'user_id', (int) $deleteUser->get( 'id' ) );
$closed->set( 'username', $deleteUser->get( 'username' ) );
$closed->set( 'name', $deleteUser->get( 'name' ) );
$closed->set( 'email', $deleteUser->get( 'email' ) );
$closed->set( 'type', 'delete' );
$closed->set( 'date', $_CB_framework->getUTCDate() );
$closed->set( 'reason', $this->input( 'reason', null, GetterInterface::STRING ) );
$closed->store();
$notification = new cbNotification();
$extra = array( 'ip_address' => cbGetIPlist(),
'reason' => $closed->get( 'reason' ),
'date' => $closed->get( 'date' )
);
$subject = $cbUser->replaceUserVars( CBTxt::T( 'User Account Deleted' ), true, false, $extra, false );
$body = $cbUser->replaceUserVars( CBTxt::T( 'Name: [name]<br />Username: [username]<br />Email: [email]<br />IP Address: [ip_address]<br />Date: [date]<br /><br />[reason]<br /><br />' ), false, false, $extra, false );
if ( $subject && $body ) {
$notification->sendToModerators( $subject, $body, false, 1 );
}
$subject = CBTxt::T( 'Your Account has been Deleted' );
$body = CBTxt::T( 'This is a notice that your account [username] on [siteurl] has been deleted.' );
if ( $subject && $body ) {
$notification->sendFromSystem( $deleteUser, $subject, $body, true, 1, null, null, null, $extra );
}
$_PLUGINS->trigger( 'privacy_onAfterAccountDelete', array( $deleteUser, $user ) );
cbRedirect( 'index.php', CBTxt::T( 'Account deleted successfully!' ) );
} else {
cbRedirect( $profileUrl, CBTxt::T( 'ACCOUNT_FAILED_TO_DELETE', 'Account failed to delete! Error: [error]', array( '[error]' => $deleteUser->getError() ) ), 'error' );
}
}
cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
}
示例14: saveField
function saveField($option, $task)
{
global $_CB_database, $_CB_framework, $_POST, $_PLUGINS;
if ($task == 'showField' || !(isset($_POST['oldtabid']) && isset($_POST['fieldid']))) {
cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task={$task}"));
return;
}
$this->_importNeeded();
$this->_importNeededSave();
$fieldOldTab = new moscomprofilerTabs($_CB_database);
if (isset($_POST['oldtabid']) && $_POST['oldtabid']) {
$fieldOldTab->load((int) $_POST['oldtabid']);
// Check if user is a super user:
if (!$_CB_framework->acl->amIaSuperAdmin()) {
// Check if user belongs to useraccessgroupid:
if (!in_array($fieldOldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) {
echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n";
exit;
}
// Check if user belongs to viewaccesslevel:
if (!in_array($fieldOldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) {
echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n";
exit;
}
}
}
$fid = (int) $_POST['fieldid'];
$row = new moscomprofilerFields($_CB_database);
if ($fid) {
// load the row from the db table
if (!$row->load((int) $fid)) {
echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Innexistant field')) . "'); window.history.go(-1);</script>\n";
exit;
}
$fieldTab = new moscomprofilerTabs($_CB_database);
// load the row from the db table
$fieldTab->load((int) $row->tabid);
// Check if user is a super user:
if (!$_CB_framework->acl->amIaSuperAdmin()) {
// Check if user belongs to useraccessgroupid:
if (!in_array($fieldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) {
echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n";
exit;
}
// Check if user belongs to viewaccesslevel:
if (!in_array($fieldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) {
echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n";
exit;
}
}
}
$oldrow = new moscomprofilerFields($_CB_database);
foreach (array_keys(get_object_vars($row)) as $k) {
if (substr($k, 0, 1) != '_') {
$oldrow->{$k} = $row->{$k};
}
}
$_PLUGINS->loadPluginGroup('user');
if (!$this->_prov_bind_CB_field($row, $fid)) {
echo "<script type=\"text/javascript\"> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
// Set defaults if nothing is found
// Also check if oldrow value to use its current value or default otherwise
// This prevents a tab from storing to database with null values when some inputs are set disabled:
if ($row->tabid == '') {
$row->tabid = $oldrow->tabid != '' ? $oldrow->tabid : 11;
}
if ($row->profile == '') {
$row->profile = $oldrow->profile != '' ? $oldrow->profile : 1;
}
if ($row->registration == '') {
$row->registration = $oldrow->registration != '' ? $oldrow->registration : 1;
}
if ($row->published == '') {
$row->published = $oldrow->published != '' ? $oldrow->published : 1;
}
if ($row->required == '') {
$row->required = $oldrow->required != '' ? $oldrow->required : 0;
}
if ($row->readonly == '') {
$row->readonly = $oldrow->readonly != '' ? $oldrow->readonly : 0;
}
if ($row->tablecolumns != '' && !in_array($row->type, array('password', 'userparams'))) {
$searchable_default = 1;
} else {
$searchable_default = 0;
}
if ($row->searchable == '') {
$row->searchable = $oldrow->searchable != '' ? $oldrow->searchable : $searchable_default;
}
// If the input is disabled we need to apply the default if the tabid isn't in POST:
if (!isset($_POST['tabid'])) {
$_POST['tabid'] = $row->tabid;
}
// Moved above check here just encase it ends up being empty:
if ($task == 'showField' || !isset($_POST['tabid'])) {
cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task={$task}"));
return;
}
//.........这里部分代码省略.........
示例15: getDisplayTab
/**
* Generates the HTML to display the user profile tab
*
* @param TabTable $tab The tab database entry
* @param UserTable $user The user being displayed
* @param int $ui 1 for front-end, 2 for back-end
* @return string|boolean Either string HTML for tab content, or false if ErrorMSG generated
*/
public function getDisplayTab($tab, $user, $ui)
{
global $_CB_framework;
$model = cbforumsClass::getModel();
if (!$model->file) {
return CBTxt::T('No supported forum model found!');
}
outputCbJs(1);
outputCbTemplate(1);
$plugin = cbforumsClass::getPlugin();
$viewer =& CBuser::getUserDataInstance($_CB_framework->myId());
$message = null;
cbforumsClass::getTemplate('tab');
if ($user->get('id') == $_CB_framework->myId()) {
$profileUrl = cbSef('index.php?option=com_comprofiler&tab=' . (int) $tab->tabid, false);
if ($this->params->get('tab_favs_display', 1)) {
$unfavorite = cbGetParam($_REQUEST, 'forums_unfav', null);
if ($unfavorite) {
if (cbforumsModel::unFavorite($unfavorite, $user, $plugin)) {
cbRedirect($profileUrl, CBTxt::T('Favorite deleted successfully!'));
} else {
cbRedirect($profileUrl, CBTxt::T('Favorite failed to delete.'), 'error');
}
}
}
if ($this->params->get('tab_subs_display', 1)) {
$unsubscribePost = cbGetParam($_REQUEST, 'forums_unsub', null);
if ($unsubscribePost) {
if (cbforumsModel::unSubscribe($unsubscribePost, $user, $plugin)) {
cbRedirect($profileUrl, CBTxt::T('Subscription deleted successfully!'));
} else {
cbRedirect($profileUrl, CBTxt::T('Subscription failed to delete.'), 'error');
}
}
$unsubscribeCat = cbGetParam($_REQUEST, 'forums_unsubcat', null);
if ($unsubscribeCat) {
if (cbforumsModel::unSubscribeCategory($unsubscribeCat, $user, $plugin)) {
cbRedirect($profileUrl, CBTxt::T('Category subscription deleted successfully!'));
} else {
cbRedirect($profileUrl, CBTxt::T('Category subscription failed to delete.'), 'error');
}
}
}
}
$tab->params = $this->params;
$class = $plugin->params->get('general_class', null);
$return = '<div id="cbForums" class="cbForums' . ($class ? ' ' . htmlspecialchars($class) : null) . '">' . '<div id="cbForumsInner" class="cbForumsInner">' . HTML_cbforumsTab::showTab($viewer, $user, $tab, $plugin) . '</div>' . '</div>';
return $return;
}