本文整理汇总了PHP中cbGetParam函数的典型用法代码示例。如果您正苦于以下问题:PHP cbGetParam函数的具体用法?PHP cbGetParam怎么用?PHP cbGetParam使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cbGetParam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initNotification
/**
* Fills object with all standard items of a Notification record
*
* @param cbpaidPayHandler $payHandler
* @param int $test_ipn
* @param string $log_type
* @param string $paymentStatus
* @param string $paymentType
* @param string $reasonCode
* @param int $paymentTime
* @param string $charset
*/
public function initNotification($payHandler, $test_ipn, $log_type, $paymentStatus, $paymentType, $reasonCode, $paymentTime, $charset = 'utf-8')
{
$this->payment_method = $payHandler->getPayName();
$this->gateway_account = $payHandler->getAccountParam('id');
$this->log_type = $log_type;
$this->time_received = Application::Database()->getUtcDateTime();
$this->ip_addresses = cbpaidRequest::getIPlist();
$this->geo_ip_country_code = cbpaidRequest::getGeoIpCountryCode();
$this->notify_version = '2.1';
$this->user_id = (int) cbGetParam($_GET, 'user', 0);
$this->charset = $charset;
$this->test_ipn = $test_ipn;
$this->payer_status = 'unverified';
$this->payment_status = $paymentStatus;
if (in_array($paymentStatus, array('Completed', 'Pending', 'Processed', 'Failed', 'Reversed', 'Refunded', 'Partially-Refunded', 'Canceled_Reversal'))) {
if (in_array($paymentStatus, array('Completed', 'Reversed', 'Refunded', 'Partially-Refunded', 'Canceled_Reversal'))) {
$this->payment_date = gmdate('H:i:s M d, Y T', $paymentTime);
// paypal-style
}
$this->payment_type = $paymentType;
}
if ($reasonCode) {
$this->reason_code = $reasonCode;
}
}
示例2: resultNotification
/**
* Handles the gateway-specific result of payments (redirects back to this site and gateway notifications). WARNING: unchecked access !
*
* @param cbpaidPaymentBasket $paymentBasket New empty object. returning: includes the id of the payment basket of this callback (strictly verified, otherwise untouched)
* @param array $postdata _POST data for saving edited tab content as generated with getEditTab
* @param boolean $allowHumanHtmlOutput Input+Output: set to FALSE if it's an IPN, and if it is already false, keep quiet
* @return string HTML to display if frontend, text to return to gateway if notification, FALSE if registration cancelled and ErrorMSG generated, or NULL if nothing to display
*/
public function resultNotification( $paymentBasket, $postdata, &$allowHumanHtmlOutput )
{
$ret = null;
// $privateVarsList = 'id payment_method gateway_account user_id time_initiated time_completed ip_addresses mc_gross mc_currency quantity item_number item_name shared_secret payment_status';
if ( cbGetParam( $_GET, 'result' ) == 'cancel') {
// The user cancelled his payment (and registration):
/* this check is done in cbpaidsubscription AFTER we return, as well as the updatePayment() call:
$paymentBasketId = (int) $this->_getReqParam( 'basket' );
if ( $paymentBasket->load( (int) $paymentBasketId ) ) {
if ( $paymentBasket->payment_status == 'NotInitiated') {
*/
if ( $this->hashPdtBackCheck( $this->_getReqParam( 'pdtback', '' ) ) ) {
$paymentBasketId = (int) $this->_getReqParam( 'basket' );
$paymentBasket->id = $paymentBasketId;
$paymentBasket->payment_status = 'RegistrationCancelled';
$this->_setErrorMSG(CBPTXT::T("Payment cancelled."));
$ret = false;
}
}
return $ret;
}
示例3: elseif
case 'fixcbdb':
case 'fixacldb':
case 'fixcbmiscdb':
case 'fixcbdeprecdb':
TOOLBAR_usersextras::_TOOLS();
break;
case 'editPlugin':
if (isset($_CB_Backend_Menu->mode)) {
if (isset($_CB_Backend_Menu->menuItems) && $_CB_Backend_Menu->menuItems) {
// Done above: TOOLBAR_usersextras::_PLUGIN_MENU( $_CB_Backend_Menu->menuItems );
} elseif ($_CB_Backend_Menu->mode == 'show') {
TOOLBAR_usersextras::_PLUGIN_ACTION_SHOW();
} elseif ($_CB_Backend_Menu->mode == 'edit') {
TOOLBAR_usersextras::_PLUGIN_ACTION_EDIT();
}
}
break;
case 'pluginmenu':
$plugin = new PluginTable();
$result = $plugin->load((int) cbGetParam($_REQUEST, 'pluginid', -1));
if ($result) {
$pluginMenuToolbarFile = $_CB_framework->getCfg('absolute_path') . '/' . $_PLUGINS->getPluginRelPath($plugin) . '/toolbar.' . $plugin->element . '.php';
if (file_exists($pluginMenuToolbarFile)) {
/** @noinspection PhpIncludeInspection */
include_once $pluginMenuToolbarFile;
break;
}
}
TOOLBAR_usersextras::_DEFAULT_PLUGIN_MENU();
break;
}
示例4: saveTab
function saveTab( $option ) {
global $_CB_database, $_CB_framework, $_POST;
$this->_importNeeded();
$this->_importNeededSave();
if ( isset( $_POST['params'] ) ) {
$_POST['params'] = cbParamsEditorController::getRawParamsMagicgpcEscaped( $_POST['params'] );
} else {
$_POST['params'] = '';
}
if ( ! isset( $_POST['tabid'] ) || ( count( $_POST ) == 0 ) ) {
echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Missing post values') ) . "'); window.history.go(-2); </script>\n";
exit();
}
if ( $_POST['tabid'] ) {
$oldrow = new moscomprofilerTabs( $_CB_database );
if ( $oldrow->load( (int) $_POST['tabid'] )
&& ( ! in_array( $oldrow->useraccessgroupid, getChildGIDS( userGID( $_CB_framework->myId() ) ) ) ) ) {
echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Unauthorized Access') ) . "'); window.history.go(-1);</script>\n";
exit;
}
}
$row = new moscomprofilerTabs( $_CB_database );
if (!$row->bind( $_POST )) {
echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
exit();
}
if ( ! $row->ordering_register ) {
$row->ordering_register = 10;
}
$row->description = cleanEditorsTranslationJunk( trim( $row->description ) );
if (!$row->check()) {
echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-2); </script>\n";
exit();
}
$row->tabid = (int) cbGetParam( $_POST, 'tabid', 0 );
if ( ! $row->store() ) {
echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-2); </script>\n";
exit();
}
$row->checkin();
cbRedirect( $_CB_framework->backendUrl( "index.php?option=$option&task=showTab" ), CBTxt::T('Successfully Saved Tab') . ": ". $row->title );
}
示例5: _getAbsURLwithParam
/**
* Gives the URL of a link with plugin parameters.
*
* @param array $paramArray array of string with key name of parameters
* @param string $task cb task to link to (default: userProfile)
* @param boolean $sefed TRUE to call cbSef (default), FALSE to leave URL unsefed
* @param array $excludeParamList of string with keys of parameters to not include
* @param string $format 'html', 'raw' (added in CB 1.2.3)
* @return string value of the parameter (htmlspecialchared)
*/
function _getAbsURLwithParam($paramArray, $task = 'userProfile', $sefed = true, $excludeParamList = null, $format = 'html')
{
global $_POST, $_GET;
if ($excludeParamList === null) {
$excludeParamList = array();
}
$prefix = $this->_getPrefix();
if ($task == 'userProfile') {
$Itemid = (int) getCBprofileItemid(0);
unset($paramArray['Itemid']);
} elseif (isset($paramArray['Itemid'])) {
$Itemid = (int) $paramArray['Itemid'];
unset($paramArray['Itemid']);
} elseif (isset($_POST['Itemid'])) {
$Itemid = (int) cbGetParam($_POST, 'Itemid', 0);
} elseif (isset($_GET['Itemid'])) {
$Itemid = (int) cbGetParam($_GET, 'Itemid', 0);
} else {
$Itemid = (int) getCBprofileItemid(0);
}
if ($task == 'userProfile' && !isset($paramArray['user'])) {
if (isset($_POST['user'])) {
$paramArray['user'] = urldecode(cbGetParam($_POST, 'user', null));
} else {
$paramArray['user'] = urldecode(cbGetParam($_GET, 'user', null));
}
}
if ($task == 'pluginclass') {
$plugin = $this->getPluginObject();
$unsecureChars = array('/', '\\', ':', ';', '{', '}', '(', ')', "\"", "'", '.', ',', "", ' ', "\t", "\n", "\r", "\v");
$paramArray['plugin'] = substr(str_replace($unsecureChars, '', $plugin->element), 0, 32);
$paramArray['tab'] = null;
} elseif (strtolower($task) == 'manageconnections') {
$paramArray['plugin'] = null;
$paramArray['tab'] = null;
} else {
$paramArray['plugin'] = null;
if (!isset($paramArray['tab'])) {
$paramArray['tab'] = strtolower(get_class($this));
}
}
$uri = 'index.php?option=com_comprofiler&task=' . $task . (isset($paramArray['user']) && $paramArray['user'] ? '&user=' . htmlspecialchars(stripslashes($paramArray['user'])) : '') . ($Itemid ? '&Itemid=' . $Itemid : '') . ($paramArray['tab'] ? '&tab=' . htmlspecialchars(stripslashes($paramArray['tab'])) : '') . ($paramArray['plugin'] ? '&plugin=' . htmlspecialchars(stripslashes($paramArray['plugin'])) : '');
reset($paramArray);
while (list($key, $val) = each($paramArray)) {
if (!in_array($key, array('Itemid', 'user', 'tab', 'plugin')) && !in_array($key, $excludeParamList)) {
if ($val) {
$uri .= '&' . htmlspecialchars($prefix . $key) . '=' . htmlspecialchars(stripslashes($val));
}
}
}
if ($sefed) {
return cbSef($uri, true, $format);
} else {
return $uri;
}
}
示例6: renderInvoice
/**
* USED by XML interface ONLY !!! Renders invoice
*
* @param string $value
* @param ParamsInterface $params
* @return string HTML to display
*/
public function renderInvoice( $value, &$params ) {
global $_CB_framework;
if ( ( $_CB_framework->getUi() == 2 ) && ( $_CB_framework->myId() != 0 ) ) {
if ( cbpaidApp::getBaseClass() === null ) {
//TODO: check if this is even needed:
$pseudoPlugin = new getcbpaidsubscriptionsTab();
$pseudoPlugin->params =& $params;
cbpaidApp::getBaseClass( $pseudoPlugin );
}
$baseClass =& cbpaidApp::getBaseClass();
$itsmyself = true; // simulate user's view of invoice.
$baseClass->outputRegTemplate();
if ( strpos( cbGetParam( $_GET, 'invoice' ), ',') === false ) {
if ( $this->load( (int) $value ) ) {
$user = CBuser::getUserDataInstance( (int) $this->user_id );
}
return $this->displayInvoice( $user, $itsmyself, true );
} else {
$html = '<div class="cbregmultipage">';
foreach ( explode( ',', cbGetParam( $_GET, 'invoice' ) ) as $basketId ) {
$paymentBasket = new self();
if ( $paymentBasket->load( (int) $basketId ) ) {
$user = CBuser::getUserDataInstance( (int) $paymentBasket->user_id );
}
$html .= $paymentBasket->displayInvoice( $user, $itsmyself, false )
. '<hr class="cbregpagebreak" />';
if ( is_callable( array( 'CBuser', 'unsetUsersNotNeeded' ) ) ) {
// CB 1.8+:
CBuser::unsetUsersNotNeeded( array( (int) $paymentBasket->user_id ) );
}
unset( $paymentBasket, $user );
}
$html .= '</div>';
}
return $html;
}
return null;
}
示例7: _logNotification
/**
* Logs notification
*
* @param string $log_type
* @param int $now
* @param cbpaidPaymentBasket $paymentBasket
* @return cbpaidPaymentNotification
*/
private function _logNotification( $log_type, $now, $paymentBasket )
{
global $_CB_database;
$ipn = new cbpaidPaymentNotification($_CB_database);
$ipn->payment_method = $this->getPayName();
$ipn->gateway_account = $this->getAccountParam( 'id' );
$ipn->log_type = $log_type;
$ipn->time_received = date( 'Y-m-d H:i:s', $now );
$ipn->payment_basket_id = $paymentBasket->id;
$ipn->raw_data = '$_POST=' . var_export( $_POST, true ) . ';\n';
$ipn->raw_result = 'FREE_TRIAL';
$ipn->ip_addresses = cbpaidRequest::getIPlist();
$ipn->notify_version = '2.1';
$ipn->user_id = (int) cbGetParam( $_GET, 'user', 0 );
$ipn->charset = 'utf-8';
$ipn->test_ipn = 0;
$ipn->first_name = $paymentBasket->first_name;
$ipn->last_name = $paymentBasket->last_name;
$ipn->payer_status = 'unverified';
$ipn->item_name = $paymentBasket->item_name;
$ipn->item_number = $paymentBasket->item_number;
$ipn->quantity = $paymentBasket->quantity;
$ipn->custom = $paymentBasket->id;
$ipn->invoice = $paymentBasket->invoice;
$ipn->mc_currency = $paymentBasket->mc_currency;
$ipn->tax = '0.00';
$ipn->mc_gross = '0.00';
$ipn->payment_status = 'Completed';
$ipn->payment_date = date( 'H:i:s M d, Y T', $now ); // paypal-style
$ipn->payment_type = 'Free trial';
$ipn->txn_id = null;
$ipn->txn_type = 'web_accept';
$ipn->recurring = 0;
$_CB_database->insertObject( $ipn->getTableName(), $ipn, $ipn->getKeyName() );
return $ipn;
}
示例8: getGroups
private function getGroups( $field, $postdata ) {
$value = cbGetParam( $postdata, $field->name, null, _CB_ALLOWRAW );
if ( is_array( $value ) ) {
if ( $value ) foreach ( $value as $k => $v ) {
if ( ( $v === null ) || ( $v === '' ) ) {
unset( $value[$k] );
}
}
if ( count( $value ) > 0 ) {
cbArrayToInts( $value );
$value = $this->_implodeCBvalues( $value );
} else {
$value = '';
}
} elseif ( ( $value === null ) || ( $value === '' ) ) {
$value = '';
} else {
$value = (int) $value;
}
return $value;
}
示例9: getAjaxResponse
/**
* Direct access to field for custom operations, like for Ajax
*
* WARNING: direct unchecked access, except if $user is set, then check well for the $reason ...
*
* @param FieldTable $field
* @param UserTable $user
* @param array $postdata
* @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'search' for searches
* @return string Expected output.
*/
public function getAjaxResponse( &$field, &$user, &$postdata, $reason )
{
global $_CB_framework, $_CB_database, $_PLUGINS, $ueConfig;
if ( ( cbGetParam( $_GET, 'function', null ) == 'savevalue' ) && $this->canAjax( $field, $user, 'html', $reason, true ) ) {
$field->set( '_noAjax', true );
if ( in_array( $field->get( 'name' ), array ( 'firstname', 'middlename', 'lastname' ) ) ) {
if ( $field->get( 'name' ) != 'firstname' ) {
$postdata['firstname'] = $user->get( 'firstname' );
}
if ( $field->get( 'name' ) != 'middlename' ) {
$postdata['middlename'] = $user->get( 'middlename' );
}
if ( $field->get( 'name' ) != 'lastname' ) {
$postdata['lastname'] = $user->get( 'lastname' );
}
}
$_PLUGINS->callField( $field->get( 'type' ), 'fieldClass', array( &$field, &$user, &$postdata, $reason ), $field );
$oldUserComplete = new UserTable( $_CB_database );
foreach ( array_keys( get_object_vars( $user ) ) as $k ) {
if ( substr( $k, 0, 1 ) != '_' ) {
$oldUserComplete->set( $k, $user->get( $k ) );
}
}
$orgValue = $user->get( $field->get( 'name' ) );
$_PLUGINS->callField( $field->get( 'type' ), 'prepareFieldDataSave', array( &$field, &$user, &$postdata, $reason ), $field );
$store = false;
if ( ! count( $_PLUGINS->getErrorMSG( false ) ) ) {
$_PLUGINS->callField( $field->get( 'type' ), 'commitFieldDataSave', array( &$field, &$user, &$postdata, $reason ), $field );
if ( ! count( $_PLUGINS->getErrorMSG( false ) ) ) {
if ( $_CB_framework->myId() == $user->get( 'id' ) ) {
$user->set( 'lastupdatedate', $_CB_framework->getUTCDate() );
}
$_PLUGINS->trigger( 'onBeforeUserUpdate', array( &$user, &$user, &$oldUserComplete, &$oldUserComplete ) );
$clearTextPassword = null;
if ( $field->get( 'name' ) == 'password' ) {
$clearTextPassword = $user->get( 'password' );
$user->set( 'password', $user->hashAndSaltPassword( $clearTextPassword ) );
}
$store = $user->store();
if ( $clearTextPassword ) {
$user->set( 'password', $clearTextPassword );
}
$_PLUGINS->trigger( 'onAfterUserUpdate', array( &$user, &$user, $oldUserComplete ) );
} else {
$_PLUGINS->callField( $field->get( 'type' ), 'rollbackFieldDataSave', array( &$field, &$user, &$postdata, $reason ), $field );
$_PLUGINS->trigger( 'onSaveUserError', array( &$user, $user->getError(), $reason ) );
}
}
if ( ! $store ) {
if ( $orgValue != $user->get( $field->get( 'name' ) ) ) {
$user->set( $field->get( 'name' ), $orgValue );
}
}
$return = null;
switch ( $field->get( 'type' ) ) {
case 'emailaddress';
$value = $user->get( $field->get( 'name' ) );
if ( $value ) {
if ( $ueConfig['allow_email'] == 1 ) {
$return .= '<a href="mailto:' . htmlspecialchars( $value ) . '" target="_blank">' . htmlspecialchars( $value ) . '</a>';
} else {
$return .= htmlspecialchars( $value );
}
}
break;
case 'primaryemailaddress';
//.........这里部分代码省略.........
示例10: getcookie
/**
* gets cookie set by cbSetcookie ! WARNING: always unescaped
* //TBD: add domain info in cookie-name
*
* @param string $name
* @param string|array $defaultValue
* @return string|array|null
*/
function getcookie( $name, $defaultValue = null ) {
global $_COOKIE;
return cbStripslashes( cbGetParam( $_COOKIE, $name, $defaultValue ) );
}
示例11: fieldClass
/**
* Direct access to field for custom operations, like for Ajax
*
* WARNING: direct unchecked access, except if $user is set, then check well for the $reason ...
*
* @param FieldTable $field
* @param UserTable $user
* @param array $postdata
* @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'search' for searches
* @return string Expected output.
*/
public function fieldClass(&$field, &$user, &$postdata, $reason)
{
global $_CB_framework, $_CB_database, $_PLUGINS;
parent::fieldClass($field, $user, $postdata, $reason);
// Performs spoof check
$myId = (int) $_CB_framework->myId();
$userId = (int) $user->get('id');
$fieldId = (int) $field->get('fieldid');
$ipAddresses = cbGetIParray();
$ipAddress = trim(array_shift($ipAddresses));
$fieldName = $field->get('name');
$readOnly = $this->_isReadOnly($field, $user, $reason);
if (cbGetParam($_GET, 'function', null) == 'savevalue' && (!$readOnly && $this->getIncrementAccess($field, $user)) && $userId) {
$oldUserComplete = new UserTable($field->getDbo());
foreach (array_keys(get_object_vars($user)) as $k) {
if (substr($k, 0, 1) != '_') {
$oldUserComplete->set($k, $user->get($k));
}
}
$direction = stripslashes(cbGetParam($postdata, 'value'));
$value = (int) $user->get($fieldName);
if ($direction == 'plus') {
$increment = (int) $field->params->get('points_inc_plus', 1);
$value += $increment && $increment > 0 ? $increment : 0;
} elseif ($direction == 'minus') {
$increment = (int) $field->params->get('points_inc_minus', 1);
$value -= $increment && $increment > 0 ? $increment : 0;
$increment = $increment ? -$increment : 0;
} else {
$increment = 0;
}
$postdata[$fieldName] = $value;
if ($this->validate($field, $user, $fieldName, $value, $postdata, $reason) && $increment && (int) $user->get($fieldName) != $value) {
$query = 'INSERT INTO ' . $_CB_database->NameQuote('#__comprofiler_ratings') . "\n (" . $_CB_database->NameQuote('user_id') . ', ' . $_CB_database->NameQuote('type') . ', ' . $_CB_database->NameQuote('item') . ', ' . $_CB_database->NameQuote('target') . ', ' . $_CB_database->NameQuote('rating') . ', ' . $_CB_database->NameQuote('ip_address') . ', ' . $_CB_database->NameQuote('date') . ')' . "\n VALUES (" . $myId . ', ' . $_CB_database->Quote('field') . ', ' . $fieldId . ', ' . $userId . ', ' . (double) $increment . ', ' . $_CB_database->Quote($ipAddress) . ', ' . $_CB_database->Quote($_CB_framework->getUTCDate()) . ')';
$_CB_database->setQuery($query);
$_CB_database->query();
$user->set($fieldName, (int) $value);
$_PLUGINS->trigger('onBeforeUserUpdate', array(&$user, &$user, &$oldUserComplete, &$oldUserComplete));
$query = 'UPDATE ' . $_CB_database->NameQuote('#__comprofiler') . "\n SET " . $_CB_database->NameQuote($fieldName) . " = " . (int) $user->get($fieldName) . "\n WHERE " . $_CB_database->NameQuote('id') . " = " . $userId;
$_CB_database->setQuery($query);
if ($_CB_database->query()) {
$_PLUGINS->trigger('onAfterUserUpdate', array(&$user, &$user, $oldUserComplete));
}
}
}
return $this->getPointsHTML($field, $user, $reason, true);
}
示例12: validateAndBindPost
/**
* Validates saving permissions of $postArray depending on $params
* Temporary hack!
*
* @param RegistryEditController $params The params editor
* @param array $postArray The array received from a POST of the form
* @return boolean|string
*/
public static function validateAndBindPost( $params, &$postArray ) {
if ( count( $postArray ) ) {
// Special handling for <param type="permissions"> fields:
$xmls = $params->_xml->xpath( 'descendant::param[@type="permissions"]' );
if ( count( $xmls ) > 0 ) {
/** @var $node SimpleXMLElement */
foreach ( $xmls as $node ) {
if ( isset( $postArray[$node->attributes( 'name' )] ) ) {
$rules = self::_save_permissions( $node->attributes( 'name' ), $postArray[$node->attributes( 'name' )], $node, '' );
if ( is_object( $rules ) ) {
// let's save the JSON string for future use:
$postArray[$node->attributes( 'name' )] = (string) $rules;
} elseif ( is_string( $rules ) ) {
return $rules;
}
}
}
}
// Special handling for <param onsave="class::method" key="firstparam" nosave="true"
$xmls = $params->_xml->xpath( 'descendant::param[@onsave]' );
if ( count( $xmls ) > 0 ) {
foreach ( $xmls as $node ) {
if ( isset( $postArray[$node->attributes( 'name' )] ) ) {
// Call static method of class with first attribute key, and second the value:
$classFunction = explode( '::', $node->attributes( 'onsave' ) );
$key = $node->attributes( 'key' );
if ( $classFunction && $key ) {
call_user_func_array( $classFunction, array( $key, cbGetParam( $postArray, $node->attributes( 'name' ) ) ) );
}
// Unset the posted variable if nosave="true":
if ( $node->attributes( 'nosave' ) == 'true' ) {
unset( $postArray[$node->attributes( 'name' )] );
}
}
}
}
}
return true;
}
示例13: 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";
}
示例14: _payflowPayment
//.........这里部分代码省略.........
if ( $subscription ) {
$request['RECURRING'] = 'Y';
}
if ( $this->getAccountParam( 'givehiddenbillemail' ) && ( strlen( $paymentBasket->payer_email ) <= 127 ) ) {
$request['EMAIL'] = $paymentBasket->payer_email;
}
if ( $this->getAccountParam( 'givehiddenbilladdress' ) ) {
cbimport( 'cb.tabs' );
$addressFields = array( 'BILLTOFIRSTNAME' => array( $paymentBasket->first_name, 30 ),
'BILLTOLASTNAME' => array( $paymentBasket->last_name, 30 ),
'BILLTOSTREET' => array( $paymentBasket->address_street, 150 ),
'BILLTOZIP' => array( $paymentBasket->address_zip, 9 ),
'BILLTOCITY' => array( $paymentBasket->address_city, 45 ),
'BILLTOCOUNTRY' => array( $countries->countryToTwoLetters( $paymentBasket->address_country ), 2 )
);
if ( $paymentBasket->address_state != 'other' ) {
$addressFields['BILLTOSTATE'] = array( substr( $paymentBasket->address_state, -2 ), 2 );
}
foreach ( $addressFields as $k => $valueMaxlength ) {
$adrField = cbIsoUtf_substr( $valueMaxlength[0], 0, $valueMaxlength[1] );
if ( $adrField ) {
$request[$k] = $adrField;
}
}
}
if ( $this->getAccountParam( 'givehiddenbilltelno' ) && ( strlen( $paymentBasket->contact_phone ) <= 50 ) ) {
$request['BILLTOPHONENUM'] = $paymentBasket->contact_phone;
}
if ( $this->getAccountParam( 'givehiddenshipemail' ) && ( strlen( $paymentBasket->payer_email ) <= 127 ) ) {
$request['SHIPTOEMAIL'] = $paymentBasket->payer_email;
}
if ( $this->getAccountParam( 'givehiddenshipaddress' ) ) {
cbimport( 'cb.tabs' );
$addressFields = array( 'SHIPTOFIRSTNAME' => array( $paymentBasket->first_name, 30 ),
'SHIPTOLASTNAME' => array( $paymentBasket->last_name, 30 ),
'SHIPTOSTREET' => array( $paymentBasket->address_street, 150 ),
'SHIPTOZIP' => array( $paymentBasket->address_zip, 9 ),
'SHIPTOCITY' => array( $paymentBasket->address_city, 45 ),
'SHIPTOCOUNTRY' => array( $countries->countryToThreeLetters( $paymentBasket->address_country ), 3 )
);
if ( $paymentBasket->address_state != 'other' ) {
$addressFields['SHIPTOSTATE'] = array( substr( $paymentBasket->address_state, -2 ), 2 );
}
foreach ( $addressFields as $k => $valueMaxlength ) {
$adrField = cbIsoUtf_substr( $valueMaxlength[0], 0, $valueMaxlength[1] );
if ( $adrField ) {
$request[$k] = $adrField;
}
}
}
if ( $this->getAccountParam( 'givehiddenshiptelno' ) && ( strlen( $paymentBasket->contact_phone ) <= 50 ) ) {
$request['SHIPTOPHONENUM'] = $paymentBasket->contact_phone;
}
$formUrl = array();
foreach ( $request as $k => $v ) {
$formUrl[$k] = $k . '=' . $v;
}
$formUrl = implode( '&', $formUrl );
$results = array();
$response = null;
$status = null;
$error = $this->_httpsRequest( $this->gatewayUrl( 'psp' ), $formUrl, 105, $response, $status, 'post', 'normal' );
if ( $response ) {
parse_str( $response, $results );
}
if ( $error || ( $status != 200 ) || ( ! $response ) ) {
$this->_setLogErrorMSG( 3, null, $this->getPayName() . ' HTTPS POST request to payment gateway server failed.', CBPTXT::T( "Submitted subscription payment didn't return an error but didn't complete." ) . ' ' . CBPTXT::T( 'Please contact site administrator to check error log.' ) );
} else {
if ( cbGetParam( $results, 'RESULT' ) == '0' ) {
$requestParams['SECURETOKEN'] = cbGetParam( $results, 'SECURETOKEN' );
$requestParams['SECURETOKENID'] = cbGetParam( $results, 'SECURETOKENID' );
} else{
$this->_setLogErrorMSG( 3, null, $this->getPayName() . ' Paypal Payflow error returned. ERROR: ' . cbGetParam( $results, 'RESPMSG' ), CBPTXT::T( 'Please contact site administrator to check error log.' ) );
}
}
}
return $requestParams;
}
示例15: updateFieldValues
/**
* Update all field values for a given $fieldId to match $fieldValues[]
*
* @param int $fieldId Id of field
* @param array $fieldValues New or existing values: ordered array( array( 'fieldtitle' => 'Title of field', 'fieldlabel' => 'Label of field' ) )
* @return boolean Result
*/
public function updateFieldValues($fieldId, array $fieldValues)
{
$existingFieldValues = $this->getFieldValuesOfField($fieldId);
if ($fieldValues) {
// Remove deleted field values:
foreach ($existingFieldValues as $i => $existingFieldValue) {
$i = (int) $i;
$exists = false;
foreach ($fieldValues as $fieldValue) {
$fieldValue = (array) $fieldValue;
$id = (int) cbGetParam($fieldValue, 'fieldvalueid');
//TODO: Use new Input class
$title = trim(stripslashes(cbGetParam($fieldValue, 'fieldtitle')));
if ($id && $i == $id && $title != '') {
$exists = true;
break;
}
}
if (!$exists) {
if (!$this->delete($i)) {
return false;
}
unset($existingFieldValues[$i]);
}
}
// Insert new field values or update existing:
foreach ($fieldValues as $i => $fieldValue) {
$fieldValue = (array) $fieldValue;
$id = (int) cbGetParam($fieldValue, 'fieldvalueid');
//TODO: Use new Input class
$title = trim(stripslashes(cbGetParam($fieldValue, 'fieldtitle')));
$label = trim(stripslashes(cbGetParam($fieldValue, 'fieldlabel')));
if ($title != '') {
if (isset($existingFieldValues[$id])) {
$newFieldValue = $existingFieldValues[$id];
if ((int) $newFieldValue->get('fieldid') == (int) $fieldId && $newFieldValue->get('fieldtitle') == $title && $newFieldValue->get('fieldlabel') == $label && (int) $newFieldValue->get('ordering') == (int) ($i + 1)) {
continue;
}
} else {
$newFieldValue = new FieldValueTable($this->_db);
}
$newFieldValue->set('fieldid', (int) $fieldId);
$newFieldValue->set('fieldtitle', $title);
$newFieldValue->set('fieldlabel', $label);
$newFieldValue->set('ordering', (int) ($i + 1));
if (!$newFieldValue->store()) {
return false;
}
}
}
$this->updateOrder($this->_db->NameQuote('fieldid') . " = " . (int) $fieldId);
} else {
// Delete all current field values:
$query = 'DELETE' . "\n FROM " . $this->_db->NameQuote($this->_tbl) . "\n WHERE " . $this->_db->NameQuote('fieldid') . " = " . (int) $fieldId;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
return false;
}
}
return true;
}