本文整理汇总了PHP中cbStartOfStringMatch函数的典型用法代码示例。如果您正苦于以下问题:PHP cbStartOfStringMatch函数的具体用法?PHP cbStartOfStringMatch怎么用?PHP cbStartOfStringMatch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cbStartOfStringMatch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeUrlRelative
/**
* Removes live_site from the URL making it relative
*
* @param string $url The URL to make relative
* @return string
*/
public function makeUrlRelative($url)
{
global $_CB_framework;
$liveSite = $_CB_framework->getCfg('live_site');
if (cbStartOfStringMatch($url, $liveSite)) {
$url = substr($url, strlen($liveSite));
}
return $url;
}
示例2: linkAction
/**
* displays $action toolbar button
*
* @param string $action
* @param string $link
* @param string $alt
* @param string $class
*/
public static function linkAction($action = 'new', $link = null, $alt = 'New', $class = null)
{
if (cbStartOfStringMatch($link, 'javascript:')) {
$href = '#';
$onClickJs = substr($link, 11);
} else {
$href = $link;
$onClickJs = null;
}
CBtoolmenuBar::_output($onClickJs, $action, $alt, $href, $class);
}
示例3: gatewayUrl
/**
* Utility for gateways to get the payment gateway URL without https:// out of $this->serverUrls array
* - depends on $case
* - depends on 'normal_gateway' account-param: 0 = test, 1 = normal, 2 = special url in 'gateway_$case_url' account-param
*
* @param string $case Must be safe ! 'single', 'recurring' or any other case, from constant, not request
* @return string URL with HTTPS://
*/
protected function gatewayUrl( $case = 'single' ) {
$serverType = $this->getAccountParam( 'normal_gateway', 1 );
if ( $serverType == 0 ) {
$url = 'https://' . $this->_gatewayUrls[$case . '+test'];
} elseif ( $serverType == 2 ) {
$url = $this->getAccountParam( 'gateway_' . $case . '_url', '' );
if ( ! cbStartOfStringMatch( $url, 'https://' ) ) {
$url = 'https://' . $url;
}
} else {
$url = 'https://' . $this->_gatewayUrls[$case . '+normal'];
}
return $url;
}
示例4: _form_httprequest
/**
* Implements a form http request render of its result (read-only)
*
* @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_httprequest( /** @noinspection PhpUnusedParameterInspection */ $name, $value, &$node, $control_name ) {
$link = $node->attributes( 'link' );
if ( ! $link ) {
return null;
}
$this->substituteName( $link, false );
// TODO: Improve drawUrl or here directly to handle local raw URLs (e.g. test.html should prefix with live_site)
$url = $this->_controllerView->drawUrl( $link, $node, $this->_modelOfData[0], $this->_modelOfData[0]->get( 'id' ) );
if ( ( ! $url ) || cbStartOfStringMatch( $url, 'javascript:' ) ) {
return null;
}
$client = new GuzzleHttp\Client();
try {
$result = $client->get( $url );
// TODO: Implement handling of <data and sending as post instead of get when present
if ( $result->getStatusCode() != 200 ) {
$result = false;
}
} catch ( Exception $e ) {
$result = false;
}
$return = null;
if ( $result !== false ) {
switch( $result->getHeader( 'Content-Type' ) ) {
case 'application/xml':
// TODO: Implement parsing of XML responses through params if it's a CB xml file otherwise parse to array then into fields output
$return = CBTxt::T( 'HTTP Request XML response handling is not yet implemented.' );
break;
case 'application/json':
$return = $this->_json_render( $result->json(), $node );
break;
default:
$return = $result->getBody();
break;
}
} else {
$return = $value;
}
return $return;
}
示例5: getFieldRow
/**
* Formatter:
* Returns a field in specified format
*
* @param FieldTable $field
* @param UserTable $user
* @param string $output 'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
* @param string $formatting 'tr', 'td', 'div', 'span', 'none', 'table'??
* @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'search' for searches
* @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 getFieldRow(&$field, &$user, $output, $formatting, $reason, $list_compare_types)
{
global $ueConfig;
$results = null;
$oValue = $this->getField($field, $user, $output, $reason, $list_compare_types);
if ($reason == 'edit') {
$displayMode = $field->get('edit', 1);
} elseif ($reason == 'register') {
$displayMode = $field->get('registration', 1);
} elseif ($reason == 'search') {
$displayMode = 1;
} else {
$displayMode = $field->get('profile', 1);
}
$displayTitle = in_array($displayMode, array(3, 4)) ? false : true;
if (!($oValue != null || trim($oValue) != '') && $output == 'html' && isset($ueConfig['showEmptyFields']) && $ueConfig['showEmptyFields'] == 1 && $reason != 'search' && $displayTitle) {
$oValue = cbReplaceVars($ueConfig['emptyFieldsText'], $user);
}
if ($oValue != null || trim($oValue) != '') {
if (cbStartOfStringMatch($output, 'html')) {
$results = $this->renderFieldHtml($field, $user, $oValue, $output, $formatting, $reason, array());
} else {
$results = $oValue;
}
}
return $results;
}
示例6: reduceSqlFormula
//.........这里部分代码省略.........
break;
case 'joinkeys':
if (count($subFormulas) > 0) {
$condition = '(' . implode(') ' . $this->attributes('operator') . ' (', $subFormulas) . ')';
}
break;
case 'column':
case 'where':
switch ($this->attributes('type')) {
case 'sql:operator':
if (count($subFormulas) > 0) {
$condition = '(' . implode(') ' . $this->attributes('operator') . ' (', $subFormulas) . ')';
}
break;
case 'sql:function':
$condition = $this->attributes('operator') . '( ' . implode(', ', $subFormulas) . ' )';
break;
case 'sql:field':
if (isset($tableReferences[$this->attributes('table')])) {
$operator = $this->attributes('operator');
$value = $this->attributes('value');
$valuetype = $this->attributes('valuetype');
$searchmode = $this->attributes('searchmode');
if (in_array($operator, array('=', '<>', '!=')) && $valuetype == 'const:string') {
switch ($searchmode) {
case 'all':
case 'any':
case 'anyis':
case 'phrase':
case 'allnot':
case 'anynot':
case 'anyisnot':
case 'phrasenot':
$precise = in_array($searchmode, array('anyis', 'anyisnot'));
if ($replaceWildcards && !$precise) {
$this->_replaceWildCards($operator, $value);
// changes $operator and $value !
}
if (is_array($value)) {
$eachValues = $value;
} else {
if (cbStartOfStringMatch($searchmode, 'phrase')) {
$eachValues = array($value);
} else {
global $_CB_framework;
if ($_CB_framework->outputCharset() == 'UTF-8') {
$eachValues = @preg_split('/\\p{Z}+/u', $value);
if (preg_last_error() == PREG_INTERNAL_ERROR) {
// PCRE has not been compiled with utf-8 support, do our best:
$eachValues = preg_split('/\\W+/', $value);
}
} else {
$eachValues = preg_split('/\\W+/', $value);
}
}
}
$conditions = array();
foreach ($eachValues as $v) {
if ($v != '') {
if (!($precise || in_array($operator, array('LIKE', 'NOT LIKE')))) {
$operator = $this->_operatorToLike($operator);
}
$conditions[] = $this->_buildop($operator, $precise ? $v : $this->_prepostfixPercent($v), $valuetype, $tableReferences);
}
}
if (count($conditions) > 1) {
$op = in_array($searchmode, array('all', 'allnot')) ? ') AND (' : ') OR (';
$condition = '(' . implode($op, $conditions) . ')';
} elseif (count($conditions) == 1) {
$condition = implode('', $conditions);
} else {
$condition = null;
}
if (in_array($searchmode, array('allnot', 'anynot', 'anyisnot', 'phrasenot')) && $condition) {
$condition = 'NOT(' . $condition . ')';
}
break;
case 'isnot':
$operator = $operator == '=' ? '<>' : '=';
$condition = $this->_buildop($operator, $value, $valuetype, $tableReferences);
break;
case 'is':
default:
$condition = $this->_buildop($operator, $value, $valuetype, $tableReferences);
break;
}
} else {
$condition = $this->_buildop($operator, $value, $valuetype, $tableReferences);
}
}
break;
default:
break;
}
break;
default:
break;
}
return $condition;
}
示例7: checkifexecutable
/**
* View for <param type="private" class="cbpaidParamsExt" method="checkifexecutable">...
*
* @param string $value Stored Data of Model Value associated with the element
* @param ParamsInterface $pluginParams Main settigns parameters of the plugin
* @param string $name Name attribute
* @param CBSimpleXMLElement $param This XML node
* @param string $control_name Name of the control
* @param string $control_name_name css id-encode of the names of the controls surrounding this node
* @param boolean $view TRUE: view, FALSE: edit
* @param cbpaidTable $modelOfData Data of the Model corresponding to this View
* @param cbpaidTable[] $modelOfDataRows Displayed Rows if it is a table
* @param int $modelOfDataRowsNumber Total Number of rows
* @return null|string
*/
public function checkifexecutable($value, &$pluginParams, $name, &$param, $control_name, $control_name_name, $view, &$modelOfData, &$modelOfDataRows, &$modelOfDataRowsNumber)
{
$default = $param->attributes('default');
$return = '';
$filePath = isset($modelOfData->{$default}) ? $modelOfData->{$default} : null;
//->get( 'default' );
if ($filePath) {
if (function_exists('is_executable')) {
$executable = @is_executable($filePath);
$return .= $this->_outputGreenRed($filePath, $executable, "is executable", "is not found or not executable");
} else {
$return .= $this->_outputGreenRed($filePath, false, '', "can not be checked because of SafeMode enabled or is_executable function disabled.");
}
} else {
$return .= $this->_outputGreenRed('', false, '', "No path defined yet. Please define then apply setting to get result of check.");
}
// $openSSLloaded = extension_loaded( 'openssl' );
// $return .= $this->_outputGreenRed( "openSSL library", $openSSLloaded );
if (!cbStartOfStringMatch($return, '<div class="cbEnabled">')) {
if ($default == 'openssl_exec_path') {
$resultOpenssl = $this->opensslstatus($value, $pluginParams, $name, $param, $control_name, $control_name_name, $view, $modelOfData, $modelOfDataRows, $modelOfDataRowsNumber);
if (cbStartOfStringMatch($resultOpenssl, '<div class="cbEnabled">')) {
$return = '<div class="cbEnabled">' . CBPTXT::Th("Not needed, as OpenSSL PHP module is loaded") . '</div>';
return $return;
}
}
}
return $return;
}
示例8: fullColumnType
/**
* Converts a XML description of a SQL column into a full SQL type
*
* <column name="_rate" nametype="namesuffix" type="sql:decimal(16,8)" unsigned="true" null="true" default="NULL" auto_increment="100" />
*
* Returns: $fulltype: 'decimal(16,8) unsigned NULL DEFAULT NULL'
*
* @param SimpleXMLElement $column Column to determine type
* @param string $tableName Name of table (for determining engine for preferred type)
* @param string $tableEngine Engine of table (if $tableName is not yet created, for preferred type)
* @return string|boolean Full SQL creation type or FALSE in case of error
*/
protected function fullColumnType(SimpleXMLElement $column, $tableName, $tableEngine = null)
{
$fullType = false;
if ($column->getName() == 'column') {
// $colName = $column->attributes( 'name' );
// $colNameType = $column->attributes( 'nametype' );
// if ( $colNameType == 'namesuffix' ) {
// $colName = $colNamePrefix . $colName;
// }
$type = $this->getPreferredColumnType($column, $tableName, $tableEngine);
$unsigned = $column->attributes('unsigned');
$null = $column->attributes('null');
$default = $column->attributes('default');
$auto_increment = $column->attributes('auto_increment');
if (cbStartOfStringMatch($type, 'sql:')) {
$type = trim(substr($type, 4));
// remove 'sql:'
if ($type) {
$notQuoted = array('int', 'float', 'tinyint', 'bigint', 'decimal', 'boolean', 'bit', 'serial', 'smallint', 'mediumint', 'double', 'year');
$isInt = false;
foreach ($notQuoted as $n) {
if (cbStartOfStringMatch($type, $n)) {
$isInt = true;
break;
}
}
$fullType = $type;
if ($unsigned == 'true') {
$fullType .= ' unsigned';
}
if ($null !== 'true') {
$fullType .= ' NOT NULL';
}
if (!in_array($type, array('text', 'blob', 'tinytext', 'mediumtext', 'longtext', 'tinyblob', 'mediumblob', 'longblob'))) {
// BLOB and TEXT columns cannot have DEFAULT values. http://dev.mysql.com/doc/refman/5.0/en/blob.html
if ($default !== null) {
$fullType .= ' DEFAULT ' . ($isInt || $default === 'NULL' ? $default : $this->_db->Quote($default));
} elseif (!$auto_increment) {
// MySQL 5.0.51a and b have a bug: they need a default value always to be able to return it correctly in SHOW COLUMNS FROM ...:
if ($null === 'true') {
$default = 'NULL';
} elseif ($isInt) {
$default = 0;
} elseif (in_array($type, array('datetime', 'date', 'time'))) {
$default = $this->_db->getNullDate($type);
} else {
$default = '';
}
$fullType .= ' DEFAULT ' . ($isInt || $default === 'NULL' ? $default : $this->_db->Quote($default));
}
}
if ($auto_increment) {
$fullType .= ' auto_increment';
}
}
}
}
return $fullType;
}
示例9: drawUrl
function drawUrl( $cbUri, &$sourceElem, &$data, $id, $htmlspecialchars = true, $inPage = true ) {
global $_CB_framework;
$ui = $_CB_framework->getUi();
if ( substr( $cbUri, 0, 4 ) == 'cbo:' ) {
$subTaskValue = substr( $cbUri, 4 );
switch ( $subTaskValue ) {
case 'newrow':
$id = 0;
// fallthrough: no break on purpose.
case 'rowedit': //TBD this is duplicate of below
$baseUrl = 'index.php';
$baseUrl .= '?option=' . $this->_options['option'] . '&task=' . $this->_options['task'] . '&cid=' . $this->_options['pluginid'];
$url = $baseUrl . '&table=' . $this->_tableBrowserModel->attributes( 'name' ) . '&action=editrow'; // below: . '&tid=' . $id;
break;
case 'saveorder':
case 'editrows':
case 'deleterows':
case 'copyrows':
case 'updaterows':
case 'publish':
case 'unpublish':
case 'enable':
case 'disable':
default:
$url = 'javascript:cbDoListTask(this, ' // cb //TBD: this is duplicate of pager.
. "'" . $this->taskName( false ). "','" // task
. $this->subtaskName( false ). "','" // subtaskName
. $this->subtaskValue( $subTaskValue, false ) . "','" // subtaskValue
. $this->fieldId( 'id', null, false ) . "'" // fldName
. ");";
break;
}
} elseif ( substr( $cbUri, 0, 10 ) == 'cb_action:' ) {
$actionName = substr( $cbUri, 10 );
$action =& $this->_actions->getChildByNameAttr( 'action', 'name', $actionName );
if ( $action ) {
$requestNames = explode( ' ', $action->attributes( 'request' ) );
$requestValues = explode( ' ', $action->attributes( 'action' ) );
$parametersValues = explode( ' ', $action->attributes( 'parameters' ) );
$baseUrl = 'index.php';
$baseUrl .= '?';
$baseRequests = array( 'option' => 'option', 'task' => 'task', 'cid' => 'pluginid' );
$urlParams = array();
foreach ( $baseRequests as $breq => $breqOptionsValue ) {
if ( ( ! ( in_array( $breq, $requestNames ) || in_array( $breq, $parametersValues ) ) ) && isset( $this->_options[$breqOptionsValue] ) ) {
$urlParams[$breq] = $breq . '=' . $this->_options[$breqOptionsValue];
}
}
$url = $baseUrl;
for ( $i = 0, $n = count( $requestNames ); $i < $n; $i++ ) {
$urlParams[$requestNames[$i]] = $requestNames[$i] . '=' . $requestValues[$i]; // other parameters = paramvalues added below
}
$url = $baseUrl . implode( '&', $urlParams );
} else {
$url = "#action_not_defined:" . $actionName;
}
} else {
$url = $cbUri;
}
if ( ! cbStartOfStringMatch( $url, 'javascript:' ) ) {
// get the parameters of action/link from XML :
$parametersNames = explode( ' ', $sourceElem->attributes( 'parameters' ) );
$parametersValues = explode( ' ', $sourceElem->attributes( 'paramvalues' ) );
$parametersValuesTypes = explode( ' ', $sourceElem->attributes( 'paramvaluestypes' ) );
// add currently activated filters to the parameters:
if ( count( $this->_filters ) > 0 ) {
foreach ( $this->_filters as $k => $v ) {
$filterName = $this->fieldName( $k );
if ( ( $v['value'] != $v['default'] ) && ( ! in_array( $filterName, $parametersNames ) ) ) {
$parametersNames[] = $filterName;
$parametersValues[] = "'" . $v['value'] . "'"; //TBD: check this.
}
}
}
// add current search string, if any:
$searchName = $this->fieldName( 'search' );
$searchValue = $this->fieldValue( 'search' );
if ( $searchValue && ( ! in_array( $searchName, $parametersNames ) ) ) {
$parametersNames[] = $searchName;
$parametersValues[] = "'" . $searchValue . "'";
}
// generate current action (and parameters ?) as cbprevstate
$cbprevstate = array();
foreach ( $this->_options as $req => $act ) {
if ( $req && $act && ! in_array( $req, array( 'cbprevstate' ) ) ) {
$cbprevstate[] = $req . '=' . $act;
}
}
//.........这里部分代码省略.........
示例10: checkPluginGetXml
/**
* Checks that plugin is properly installed and sets, if returned true:
* $this->i_elementdir To the directory of the plugin (with final / )
* $this->i_xmldocument To a SimpleXMLElement of the XML file
*
* @param int $pluginId
* @param string $option
* @param string $action
* @return boolean
*/
function checkPluginGetXml($pluginId, $option, $action = 'Uninstall')
{
global $_CB_framework;
$row = new PluginTable();
try {
$loadResult = $row->load((int) $pluginId);
} catch (\RuntimeException $e) {
self::renderInstallMessage($e->getMessage(), $action . ' - error', $this->returnTo($option, 'showPlugins'));
return false;
}
if (!$loadResult) {
self::renderInstallMessage('Invalid plugin id', $action . ' - error', $this->returnTo($option, 'showPlugins'));
return false;
}
if (trim($row->folder) == '') {
self::renderInstallMessage('Folder field empty, cannot remove files', $action . ' - error', $this->returnTo($option, 'showPlugins'));
return false;
}
if ($row->iscore) {
self::renderInstallMessage($row->name . ' ' . "is a core element, and cannot be uninstalled.<br />You need to unpublish it if you don't want to use it", 'Uninstall - error', $this->returnTo($option, 'showPlugins'));
return false;
}
if (trim($row->folder) == '') {
return 'Folder field empty';
} elseif (cbStartOfStringMatch($row->folder, '/')) {
$this->elementDir($_CB_framework->getCfg('absolute_path') . $row->folder . '/');
} else {
$this->elementDir($_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' . $row->type . '/' . $row->folder . '/');
}
$this->installFilename($this->elementDir() . $row->element . '.xml');
if (!(file_exists($this->i_installfilename) && is_readable($this->i_installfilename))) {
self::renderInstallMessage($row->name . ' ' . "has no readable xml file " . $this->i_installfilename . ", and might not be uninstalled completely.", $action . ' - warning', $this->returnTo($option, 'showPlugins'));
}
// see if there is an xml install file, must be same name as element
if (file_exists($this->i_installfilename) && is_readable($this->i_installfilename)) {
$this->i_xmldocument = new SimpleXMLElement(trim(file_get_contents($this->i_installfilename)));
} else {
$this->i_xmldocument = null;
}
return true;
}
示例11: linkAction
/**
* Writes the common $action icon for the button bar
* @param string url link
* @param string action (for displaying correct icon))
* @param string An override for the alt text
*/
public static function linkAction($action = 'new', $link = '', $alt = 'New')
{
if (cbStartOfStringMatch($link, 'javascript:')) {
$href = '#';
$onClickJs = substr($link, 11);
} else {
$href = $link;
$onClickJs = null;
}
echo CBtoolmenuBar::_output($onClickJs, $action, $alt, $href);
// CBTxt::T("....") done in _output
}
示例12: getImageUrl
/**
* Returns URL of logo image to pass to paypal for checkout page
*
* @return string
*/
private function getImageUrl( )
{
global $_CB_framework;
$image_url = trim( $this->getAccountParam( 'paypal_regLogoImage' ) );
if ( $image_url && ! cbStartOfStringMatch( $image_url, 'http' ) ) {
$image_url = $_CB_framework->getCfg( 'live_site' ) . '/' . $image_url;
}
return $image_url;
}
示例13: saveField
function saveField( $option, $task ) {
global $_CB_database, $_CB_framework, $_POST, $_PLUGINS;
if ( ( $task == 'showField' ) || ! ( isset( $_POST['oldtabid'] ) && isset( $_POST['tabid'] ) && isset( $_POST['fieldid'] ) ) ) {
cbRedirect( $_CB_framework->backendUrl( "index.php?option=$option&task=$task" ) );
return;
}
$this->_importNeeded();
$this->_importNeededSave();
$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 );
if ( ! in_array( $fieldTab->useraccessgroupid, getChildGIDS( userGID( $_CB_framework->myId() ) ) ) ) {
echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Unauthorized Access') ) ."'); window.history.go(-1);</script>\n";
exit;
}
}
$_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();
}
// in case the above changed perms.... really ?
$fieldTab = new moscomprofilerTabs( $_CB_database );
$fieldTab->load( (int) $row->tabid );
if ( ! in_array( $fieldTab->useraccessgroupid, getChildGIDS( userGID( $_CB_framework->myId() ) ) ) ) {
echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Unauthorized Access') ) . "'); window.history.go(-1);</script>\n";
exit;
}
if ($row->type == 'webaddress') {
$row->rows = $_POST['webaddresstypes'];
if ( !(($row->rows == 0) || ($row->rows == 2)) ) {
$row->rows = 0;
}
}
if ( $_POST['oldtabid'] != $_POST['tabid'] ) {
if ( $_POST['oldtabid'] !== '' ) {
//Re-order old tab
$sql = "UPDATE #__comprofiler_fields SET ordering = ordering-1 WHERE ordering > ".(int) $_POST['ordering']." AND tabid = ".(int) $_POST['oldtabid'];
$_CB_database->setQuery($sql);
$_CB_database->query();
}
//Select Last Order in New Tab
$sql = "SELECT MAX(ordering) FROM #__comprofiler_fields WHERE tabid=".(int) $_POST['tabid'];
$_CB_database->SetQuery($sql);
$max = $_CB_database->LoadResult();
$row->ordering = max( $max + 1, 1 );
}
if ( cbStartOfStringMatch( $row->name, 'cb_' ) ) {
$row->name = str_replace(" ", "", strtolower($row->name));
}
if ( ! $row->check() ) {
echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-2); </script>\n";
exit();
}
if ( ! $row->store( (int) $fid ) ) {
echo "<script type=\"text/javascript\"> alert('".$row->getError()."'); window.history.go(-2); </script>\n";
exit();
}
$fieldNames = $_POST['vNames'];
$j = 1;
if( $row->fieldid > 0 ) {
$_CB_database->setQuery( "DELETE FROM #__comprofiler_field_values"
. " WHERE fieldid = " . (int) $row->fieldid );
if( $_CB_database->query() === false ) {
echo $_CB_database->getErrorMsg();
}
} else {
$_CB_database->setQuery( "SELECT MAX(fieldid) FROM #__comprofiler_fields");
$maxID = $_CB_database->loadResult();
$row->fieldid = $maxID;
echo $_CB_database->getErrorMsg();
}
//for($i=0, $n=count( $fieldNames ); $i < $n; $i++) {
foreach ($fieldNames as $fieldName) {
if(trim($fieldName)!=null || trim($fieldName)!='') {
$_CB_database->setQuery( "INSERT INTO #__comprofiler_field_values (fieldid,fieldtitle,ordering)"
. " VALUES( " . (int) $row->fieldid . ",'".cbGetEscaped(trim($fieldName))."', " . (int) $j . ")"
);
if ( $_CB_database->query() === false ) {
echo $_CB_database->getErrorMsg();
//.........这里部分代码省略.........
示例14: foreach
* @subpackage Template for Paid Subscriptions
* @copyright (C) 2007-2014 and Trademark of Lightning MultiCom SA, Switzerland - www.joomlapolis.com - and its licensors, all rights reserved
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
*/
/** ensure this file is being included by a parent file */
if ( ! ( defined( '_VALID_CB' ) || defined( '_JEXEC' ) || defined( '_VALID_MOS' ) ) ) { die( 'Direct Access to this location is not allowed.' ); }
$tmplVersion = 1; // This is the template version that needs to match
$cssId = 'paym' . $this->radioValue;
$images = array();
foreach ( $this->cardtypes as $cardtype ) {
if ( $cardtype[0] == '/' ) {
$url = cbpaidApp::getLiveSiteFilePath( substr( $cardtype, 1 ) );
} elseif ( cbStartOfStringMatch( $cardtype, 'http' ) ) {
$url = $cardtype;
} else {
$url = $this->getMediaUrl( 'icons/cards/cc_' . $cardtype . '.png' );
if ( $url == null ) {
$url = cbpaidApp::getLiveSiteFilePath( 'icons/cards/cc_' . $cardtype . '.gif' );
}
}
if ( $url ) {
$images[$cardtype] = $url;
}
}
$cssClass = 'cbregCCselInput';
if ( $this->payNameForCssClass ) {
$cssClass .= ' ' . $this->payNameForCssClass;
示例15: logout
function logout()
{
global $_CB_framework, $_POST, $_PLUGINS;
$return = trim(stripslashes(cbGetParam($_POST, 'return', null)));
if (cbStartOfStringMatch($return, 'B:')) {
$return = base64_decode(substr($return, 2));
$arrToClean = array('B' => get_magic_quotes_gpc() ? addslashes($return) : $return);
$return = cbGetParam($arrToClean, 'B', '');
}
$message = trim(cbGetParam($_POST, 'message', 0));
if ($return || $message) {
$spoofCheckOk = false;
if (cbSpoofCheck('logout', 'POST', 2)) {
$spoofCheckOk = true;
}
if (!$spoofCheckOk) {
$_CB_framework->enqueueMessage(CBTxt::Th('UE_SESSION_EXPIRED', 'Session expired or cookies are not enabled in your browser. Please press "reload page" in your browser, and enable cookies in your browser.') . ' ' . CBTxt::Th('UE_PLEASE_REFRESH', 'Please refresh/reload page before filling-in.'), 'error');
return;
}
}
$_PLUGINS->loadPluginGroup('user');
// Do the logout including all authentications and event firing:
cbimport('cb.authentication');
$cbAuthenticate = new CBAuthentication();
$resultError = $cbAuthenticate->logout($return);
if ($resultError) {
$resultError = $_PLUGINS->getErrorMSG();
$_PLUGINS->trigger('onAfterUserLogoutFailed', array(&$resultError));
$_CB_framework->enqueueMessage($resultError);
return;
}
$messageToUser = stripslashes(CBTxt::Th('LOGOUT_SUCCESS', 'You have successfully logged out'));
$_PLUGINS->trigger('onAfterUserLogoutSuccess', array(&$return, &$message, &$messageToUser));
cbRedirect(cbSef($return ? $return : 'index.php', false), $message ? $messageToUser : '');
}