本文整理汇总了PHP中phpAds_registerGlobalUnslashed函数的典型用法代码示例。如果您正苦于以下问题:PHP phpAds_registerGlobalUnslashed函数的具体用法?PHP phpAds_registerGlobalUnslashed怎么用?PHP phpAds_registerGlobalUnslashed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phpAds_registerGlobalUnslashed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initRequest
function initRequest()
{
$this->request = phpAds_registerGlobalUnslashed('userid', 'login', 'passwd', 'passwd2', 'link', 'contact_name', 'email_address', 'permissions', 'submit', 'language');
// Sanitize userid
if (!empty($this->request['userid'])) {
$this->request['userid'] = (int) $this->request['userid'];
}
$this->userid = $this->request['userid'];
if (isset($this->request['permissions'])) {
$this->aPermissions = $this->request['permissions'];
}
}
示例2: createTemplateWithModel
public static function createTemplateWithModel($panel, $single = true)
{
$agencyId = OA_Permission::getAgencyId();
$oDalZones = OA_Dal::factoryDAL('zones');
$infix = $single ? '' : '-' . $panel;
phpAds_registerGlobalUnslashed('action', 'campaignid', 'clientid', "text{$infix}", "page{$infix}");
$campaignId = $GLOBALS['campaignid'];
$text = $GLOBALS["text{$infix}"];
$linked = $panel == 'linked';
$showStats = empty($GLOBALS['_MAX']['CONF']['ui']['zoneLinkingStatistics']) ? false : true;
$websites = $oDalZones->getWebsitesAndZonesList($agencyId, $campaignId, $linked, $text);
$matchingZones = 0;
foreach ($websites as $aWebsite) {
$matchingZones += count($aWebsite['zones']);
}
$aZonesCounts = array('all' => $oDalZones->countZones($agencyId, null, $campaignId, $linked), 'matching' => $matchingZones);
$pagerFileName = 'campaign-zone-zones.php';
$pagerParams = array('clientid' => $GLOBALS['clientid'], 'campaignid' => $GLOBALS['campaignid'], 'status' => $panel, 'text' => $text);
$currentPage = null;
if (!$single) {
$currentPage = $GLOBALS["page{$infix}"];
}
$oTpl = new OA_Admin_Template('campaign-zone-zones.html');
$oPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, true, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
$oTopPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, false, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
$websites = array_slice($websites, $itemsFrom - 1, self::WEBSITES_PER_PAGE, true);
// Add statistics for the displayed zones if required
if ($showStats) {
$oDalZones->mergeStatistics($websites, $campaignId);
}
// Count how many zone are displayed
$showingCount = 0;
foreach ($websites as $website) {
$showingCount += count($website['zones']);
}
$aZonesCounts['showing'] = $showingCount;
$oTpl->assign('pager', $oPager);
$oTpl->assign('topPager', $oTopPager);
$oTpl->assign('websites', $websites);
$oTpl->assign('zonescounts', $aZonesCounts);
$oTpl->assign('text', $text);
$oTpl->assign('status', $panel);
$oTpl->assign('page', $oTopPager->getCurrentPageID());
$oTpl->assign('showStats', $showStats);
$oTpl->assign('colspan', $showStats ? 6 : 3);
return $oTpl;
}
示例3: createTemplateWithModel
public static function createTemplateWithModel($panel, $single = true)
{
$agencyId = OA_Permission::getAgencyId();
$oDalZones = OA_Dal::factoryDAL('zones');
$infix = $single ? '' : '-' . $panel;
phpAds_registerGlobalUnslashed('action', 'campaignid', 'clientid', "category{$infix}", "category{$infix}-text", "text{$infix}", "page{$infix}");
$campaignId = $GLOBALS['campaignid'];
$category = $GLOBALS["category{$infix}"];
$categoryText = $GLOBALS["category{$infix}-text"];
$text = $GLOBALS["text{$infix}"];
$linked = $panel == 'linked';
$websites = $oDalZones->getWebsitesAndZonesListByCategory($agencyId, $category, $campaignId, $linked, $text);
$pagerFileName = 'campaign-zone-zones.php';
$pagerParams = array('clientid' => $GLOBALS['clientid'], 'campaignid' => $GLOBALS['campaignid'], 'status' => $panel, 'category' => $category, 'category-text' => $categoryText, 'text' => $text);
$currentPage = null;
if (!$single) {
$currentPage = $GLOBALS["page{$infix}"];
}
$oTpl = new OA_Admin_Template('campaign-zone-zones.html');
$oPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, true, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
$oTopPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, false, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
$websites = array_slice($websites, $itemsFrom - 1, self::WEBSITES_PER_PAGE, true);
$aZonesCounts = array('all' => $oDalZones->countZones($agencyId, null, $campaignId, $linked), 'matching' => $oDalZones->countZones($agencyId, $category, $campaignId, $linked, $text));
$showingCount = 0;
// TODO: currently we're calculating the number in PHP code. Once
// MAX_Dal_Admin_Zones::countZones() supports the limit parameter, we can remove
// the code below and use the dal.
foreach ($websites as $website) {
$showingCount += count($website['zones']);
}
$aZonesCounts['showing'] = $showingCount;
$oTpl->assign('pager', $oPager);
$oTpl->assign('topPager', $oTopPager);
$oTpl->assign('websites', $websites);
$oTpl->assign('zonescounts', $aZonesCounts);
$oTpl->assign('category', $categoryText);
$oTpl->assign('text', $text);
$oTpl->assign('status', $panel);
$oTpl->assign('page', $oTopPager->getCurrentPageID());
return $oTpl;
}
示例4: phpAds_registerGlobalUnslashed
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: channel-edit.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/max/other/html.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/component/Form.php';
// Register input variables
phpAds_registerGlobalUnslashed('name', 'description', 'comments', 'affiliateid', 'agencyid', 'channelid');
/*-------------------------------------------------------*/
/* Affiliate interface security */
/*-------------------------------------------------------*/
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
OA_Permission::enforceAccessToObject('channel', $channelid, true);
// Initalise data
$doChannel = OA_Dal::factoryDO('channel');
if (!empty($channelid)) {
$doChannel->get($channelid);
$channel = $doChannel->toArray();
} else {
//for new channels set affiliate id (if any)
if (!empty($affiliateid)) {
OA_Permission::enforceAccessToObject('affiliates', $affiliateid);
$channel['affiliateid'] = $affiliateid;
示例5: phpAds_registerGlobalUnslashed
*/
// Require the initialisation file
require_once '../../init.php';
require_once MAX_PATH . '/lib/OX/Util/Utils.php';
// Required files
require_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/lib/OA/Dll.php';
require_once MAX_PATH . '/lib/max/Dal/DataObjects/Campaigns.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-statistics.inc.php';
require_once MAX_PATH . '/lib/OA/Permission.php';
require_once MAX_PATH . '/lib/pear/Date.php';
require_once MAX_PATH . '/lib/max/other/html.php';
require_once MAX_PATH . '/lib/OX/Admin/UI/ViewHooks.php';
phpAds_registerGlobalUnslashed('hideinactive', 'listorder', 'orderdirection');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
if (!empty($clientid) && !OA_Permission::hasAccessToObject('clients', $clientid, OA_Permission::OPERATION_VIEW)) {
//check if can see given advertiser
$page = basename($_SERVER['SCRIPT_NAME']);
OX_Admin_Redirect::redirect($page);
}
/*-------------------------------------------------------*/
/* Init data */
/*-------------------------------------------------------*/
//get advertisers and set the current one
$aAdvertisers = getAdvertiserMap();
if (empty($clientid)) {
//if it's empty
if ($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid']) {
示例6: phpAds_registerGlobalUnslashed
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: affiliate-edit.php 12839 2007-11-27 16:32:39Z bernard.lange@openads.org $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/config.php';
// Register input variables
// TODO: This variable has been added to demonstrate that clicking on
// links from error messages could bring the already entered e-mail address
// to the new form. Feel free to keep it or remove, depending on the
// implementation strategy.
phpAds_registerGlobalUnslashed('email');
/*-------------------------------------------------------*/
/* HTML framework */
/*-------------------------------------------------------*/
phpAds_PageHeader("4.1.3.4.7.2");
// TODO: The path here should probably start with the advertiser's data
// Not sure if we need to include the campaign and banner in the path though.
// We'll need to clarify this with the Product team.
echo "<img src='" . OX::assetPath() . "/images/icon-affiliate.gif' align='absmiddle'> <b>Create AdSense Account</b><br /><br /><br />";
phpAds_ShowSections(array("4.1.3.4.7.2"));
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
$oTpl = new OA_Admin_Template('adsense-create.html');
$oTpl->assign('fields', array(array('title' => 'Email address for AdSense Account', 'fields' => array(array('name' => 'email', 'label' => 'Email', 'value' => '', 'id' => 'adsenseemail', 'title' => 'Provide valid email', 'clientValid' => 'required:true,email:true'))), array('title' => 'Name for the AdSense Account in Openads', 'fields' => array(array('name' => 'name', 'label' => 'Name for the AdSense Account in Openads', 'value' => '', 'id' => 'accountname', 'title' => 'Provide name in Openads', 'clientValid' => 'required:true')))));
示例7: OA_Admin_Option
require_once MAX_PATH . '/lib/OA/Admin/UI/UserAccess.php';
require_once MAX_PATH . '/lib/max/Admin/Languages.php';
require_once MAX_PATH . '/lib/max/Plugin/Translation.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/max/Admin/Languages.php';
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER);
// Create a new option object for displaying the setting's page's HTML form
$oOptions = new OA_Admin_Option('user');
$prefSection = "name-language";
// Prepare an array for storing error messages
$aErrormessage = array();
// If the settings page is a submission, deal with the form data
if (isset($_POST['submitok']) && $_POST['submitok'] == 'true') {
// Register input variables
phpAds_registerGlobalUnslashed('contact_name', 'language');
// Get the DB_DataObject for the current user
$doUsers = OA_Dal::factoryDO('users');
$doUsers->get(OA_Permission::getUserId());
// Get the current authentication plugin instance
$oPlugin = OA_Auth::staticGetAuthPlugin();
if (isset($contact_name)) {
$doUsers->contact_name = $contact_name;
}
if (isset($language)) {
$doUsers->language = $language;
}
if (!count($aErrormessage)) {
if ($doUsers->update() === false) {
// Unable to update the preferences
$aErrormessage[0][] = $strUnableToWritePrefs;
示例8: OA_Admin_Option
// Required files
require_once MAX_PATH . '/lib/OA/Admin/Option.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/UserAccess.php';
require_once MAX_PATH . '/lib/RV/Admin/Languages.php';
require_once MAX_PATH . '/lib/max/Plugin/Translation.php';
require_once MAX_PATH . '/www/admin/config.php';
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER);
// Create a new option object for displaying the setting's page's HTML form
$oOptions = new OA_Admin_Option('user');
// Prepare an array for storing error messages
$aErrormessage = array();
// If the settings page is a submission, deal with the form data
if (isset($_POST['submitok']) && $_POST['submitok'] == 'true') {
// Register input variables
phpAds_registerGlobalUnslashed('pw', 'email_address');
OA_Permission::checkSessionToken();
// Get the DB_DataObject for the current user
$doUsers = OA_Dal::factoryDO('users');
$doUsers->get(OA_Permission::getUserId());
// Set defaults
$changeEmail = isset($email_address);
// Get the current authentication plugin instance
$oPlugin = OA_Auth::staticGetAuthPlugin();
// Check password
if (!isset($pw) || !$oPlugin->checkPassword(OA_Permission::getUsername(), $pw)) {
$aErrormessage[0][] = $GLOBALS['strPasswordWrong'];
}
if (isset($pw) && strlen($pw)) {
if (!strlen($pw) || strstr("\\", $pw)) {
$aErrormessage[0][] = $GLOBALS['strInvalidPassword'];
示例9: phpAds_registerGlobalUnslashed
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: website-index.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
// Register input variables
phpAds_registerGlobalUnslashed('hideinactive', 'listorder', 'orderdirection', 'pubid', 'url', 'country', 'language', 'category', 'adnetworks', 'advsignup', 'formId');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
/*-------------------------------------------------------*/
/* HTML framework */
/*-------------------------------------------------------*/
phpAds_PageHeader(null, buildHeaderModel());
/*-------------------------------------------------------*/
/* Get preferences */
/*-------------------------------------------------------*/
if (!isset($listorder)) {
if (isset($session['prefs']['website-index.php']['listorder'])) {
$listorder = $session['prefs']['website-index.php']['listorder'];
} else {
$listorder = '';
}
示例10: phpAds_Die
phpAds_Die($GLOBALS['strErrorDatabaseConnetion'], $translated_message);
}
// First thing to do is clear the $session variable to
// prevent users from pretending to be logged in.
unset($session);
// Authorize the user
OA_Start();
// Load the account's preferences
OA_Preferences::loadPreferences();
$pref = $GLOBALS['_MAX']['PREF'];
// Set time zone to local
OA_setTimeZoneLocal();
// Load the required language files
Language_Loader::load('default');
// Register variables
phpAds_registerGlobalUnslashed('affiliateid', 'agencyid', 'bannerid', 'campaignid', 'channelid', 'clientid', 'day', 'trackerid', 'userlogid', 'zoneid');
if (!isset($affiliateid)) {
$affiliateid = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : '';
}
if (!isset($agencyid)) {
$agencyid = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? '' : OA_Permission::getAgencyId();
}
if (!isset($bannerid)) {
$bannerid = '';
}
if (!isset($campaignid)) {
$campaignid = '';
}
if (!isset($channelid)) {
$channelid = '';
}
示例11: phpAds_registerGlobalUnslashed
$Id: banner-acl.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-statistics.inc.php';
require_once MAX_PATH . '/lib/max/other/html.php';
require_once MAX_PATH . '/lib/max/Plugin.php';
require_once MAX_PATH . '/lib/max/other/lib-acl.inc.php';
require_once MAX_PATH . '/lib/max/Delivery/cache.php';
require_once MAX_PATH . '/lib/max/other/capping/lib-capping.inc.php';
// Register input variables
phpAds_registerGlobalUnslashed('acl', 'action', 'submit');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
OA_Permission::enforceAccessToObject('banners', $bannerid);
/*-------------------------------------------------------*/
/* Store preferences */
/*-------------------------------------------------------*/
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;
phpAds_SessionDataStore();
// Initialise some parameters
$pageName = basename($_SERVER['PHP_SELF']);
$tabindex = 1;
$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);
示例12: phpAds_registerGlobalUnslashed
| Revive Adserver |
| http://www.revive-adserver.com |
| |
| Copyright: See the COPYRIGHT.txt file. |
| License: GPLv2 or later, see the LICENSE.txt file. |
+---------------------------------------------------------------------------+
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/Search.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-statistics.inc.php';
require_once MAX_PATH . '/www/admin/lib-gui.inc.php';
phpAds_registerGlobalUnslashed('keyword', 'client', 'campaign', 'banner', 'zone', 'affiliate', 'compact');
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
// Check Searchselection
if (!isset($client) || $client != 't') {
$client = false;
}
if (!isset($campaign) || $campaign != 't') {
$campaign = false;
}
if (!isset($banner) || $banner != 't') {
$banner = false;
}
if (!isset($zone) || $zone != 't') {
$zone = false;
}
if (!isset($affiliate) || $affiliate != 't') {
示例13: postInitSession
/**
* Post init session
*
*/
function postInitSession()
{
global $session, $pref;
global $affiliateid, $agencyid, $bannerid, $campaignid, $channelid;
global $clientid, $day, $trackerid, $userlogid, $zoneid;
// Overwrite certain preset preferences
if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) {
$GLOBALS['_MAX']['CONF']['max']['language'] = $session['language'];
}
// Load the user preferences from the database
OA_Preferences::loadPreferences();
// Load the required language files
Language_Loader::load('default');
// Register variables
phpAds_registerGlobalUnslashed('affiliateid', 'agencyid', 'bannerid', 'campaignid', 'channelid', 'clientid', 'day', 'trackerid', 'userlogid', 'zoneid');
if (!isset($affiliateid)) {
$affiliateid = '';
}
if (!isset($agencyid)) {
$agencyid = OA_Permission::getAgencyId();
}
if (!isset($bannerid)) {
$bannerid = '';
}
if (!isset($campaignid)) {
$campaignid = '';
}
if (!isset($channelid)) {
$channelid = '';
}
if (!isset($clientid)) {
$clientid = '';
}
if (!isset($day)) {
$day = '';
}
if (!isset($trackerid)) {
$trackerid = '';
}
if (!isset($userlogid)) {
$userlogid = '';
}
if (!isset($zoneid)) {
$zoneid = '';
}
}
示例14: phpAds_registerGlobalUnslashed
+---------------------------------------------------------------------------+
$Id: banner-swf.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-statistics.inc.php';
require_once MAX_PATH . '/www/admin/lib-storage.inc.php';
require_once MAX_PATH . '/www/admin/lib-swf.inc.php';
require_once MAX_PATH . '/www/admin/lib-banner.inc.php';
require_once MAX_PATH . '/www/admin/lib-zones.inc.php';
// Register input variables
phpAds_registerGlobalUnslashed('convert', 'cancel', 'compress', 'convert_links', 'chosen_link', 'overwrite_link', 'overwrite_target', 'overwrite_source');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
OA_Permission::enforceAccessToObject('banners', $bannerid);
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
OA_Permission::enforceAllowed(OA_PERM_BANNER_EDIT);
}
/*-------------------------------------------------------*/
/* Process submitted form */
/*-------------------------------------------------------*/
if (isset($convert)) {
$doBanners = OA_Dal::factoryDO('banners');
$doBanners->get($bannerid);
$row = $doBanners->toArray();
示例15: processSettingsFromForm
/**
* A method for processing settings values from a UI form, and updating the settings
* values in the configuration file.
*
* @param array $aElements An array of arrays, indexed by the HTML form element names,
* and then the top level configuration file item, containing
* the configuration file key.
*
* The inner array can also contain the fixed keys "preg_match"
* and "preg_replace", and the values will be used as a preg
* pattern on the actual value.
*
* The inner array can also contain the fixed key "bool", in
* which case the value will be treated as a true/false
* element from the HTML form.
*
* The inner array can also contain the fixed keys "preg_split"
* and "merge", and the preg_split value will be used to split
* the actual value into an array, and then remove any empty
* values from the result, and then the resulting array will be
* merged with the merge value, and stored. The "merge_unique"
* value can also be set to true, in which case only unique
* values will be stored from the split array values.
*
* For example:
* array(
* delivery_cacheExpire => array(
* delivery => acls
* preg_match => #/$#
* preg_replace =>
* )
* )
*
* This array would store the value from the "delivery_cacheExpire" HTML form element
* in the configuration file under the [delivery] section, acls key; but the value stored
* would have the "/" character, if it existed, removed from the end of the string value
* stored.
*
* @return boolean True if the configuration file was saved correctly, false otherwise.
*/
function processSettingsFromForm($aElementNames)
{
phpAds_registerGlobalUnslashed('token');
if (!phpAds_SessionValidateToken($GLOBALS['token'])) {
return false;
}
foreach ($aElementNames as $htmlElement => $aConfigInfo) {
// Register the HTML element value
MAX_commonRegisterGlobalsArray(array($htmlElement));
// Was the HTML element value set?
if (isset($GLOBALS[$htmlElement])) {
reset($aConfigInfo);
if (isset($aConfigInfo['preg_match'])) {
$preg_match = $aConfigInfo['preg_match'];
unset($aConfigInfo['preg_match']);
}
if (isset($aConfigInfo['preg_replace'])) {
$preg_replace = $aConfigInfo['preg_replace'];
unset($aConfigInfo['preg_replace']);
}
$value = stripslashes($GLOBALS[$htmlElement]);
if (isset($preg_match) && isset($preg_replace)) {
$value = preg_replace($preg_match, $preg_replace, $value);
}
unset($preg_match);
unset($preg_replace);
if (isset($aConfigInfo['bool'])) {
$value = 'true';
}
if (!empty($aConfigInfo['trim'])) {
$value = trim($value);
}
unset($aConfigInfo['bool']);
if (isset($aConfigInfo['preg_split']) && isset($aConfigInfo['merge'])) {
$pregSplit = $aConfigInfo['preg_split'];
$merge = $aConfigInfo['merge'];
$mergeUnique = false;
if ($aConfigInfo['merge_unique']) {
$mergeUnique = true;
}
unset($aConfigInfo['preg_split']);
unset($aConfigInfo['merge']);
unset($aConfigInfo['merge_unique']);
foreach ($aConfigInfo as $levelKey => $itemKey) {
$aValues = preg_split($pregSplit, $value);
if ($mergeUnique) {
$aValues = array_unique($aValues);
}
if (!empty($aConfigInfo['trim'])) {
array_walk($aValues, 'trim');
}
$aEmptyKeys = array_keys($aValues, '');
$counter = -1;
foreach ($aEmptyKeys as $key) {
$counter++;
array_splice($aValues, $key - $counter, 1);
}
$value = implode($merge, $aValues);
$this->settingChange($levelKey, $itemKey, $value);
}
//.........这里部分代码省略.........