本文整理汇总了PHP中OA_Admin_UI类的典型用法代码示例。如果您正苦于以下问题:PHP OA_Admin_UI类的具体用法?PHP OA_Admin_UI怎么用?PHP OA_Admin_UI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Admin_UI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
/**
* A method to perform redirects. Only suitable for use once OpenX is installed,
* as it requires the OpenX configuration file to be correctly set up.
*
* @param string $adminPage The administration interface page to redirect to
* (excluding a leading slash ("/")). Default is the
* index (i.e. login) page.
* @param boolean $manualAccountSwitch Flag to know if the user has switched account.
* @param boolean $redirectTopLevel Flag to know if the redirection should be to the top
* level, even it not a manual account switch.
*/
function redirect($adminPage = 'index.php', $manualAccountSwitch = false, $redirectTopLevel = false)
{
if ($manualAccountSwitch || $redirectTopLevel) {
// Get the page where the user was in when switched account
if (!empty($_SERVER['HTTP_REFERER'])) {
$aUrlComponents = parse_url($_SERVER['HTTP_REFERER']);
} elseif (!empty($_SERVER['REQUEST_URI'])) {
$aUrlComponents = parse_url($_SERVER['REQUEST_URI']);
}
$aPathInformation = pathinfo($aUrlComponents['path']);
$sectionID = $aPathInformation['filename'];
// Get the top level page
$adminPage = OA_Admin_UI::getTopLevelPage($sectionID);
if (!empty($adminPage)) {
header('Location: ' . MAX::constructURL(MAX_URL_ADMIN, $adminPage));
exit;
}
}
if (!$manualAccountSwitch || empty($return_url) && empty($GLOBALS['installing'])) {
if (!preg_match('/[\\r\\n]/', $adminPage)) {
header('Location: ' . MAX::constructURL(MAX_URL_ADMIN, $adminPage));
exit;
}
}
exit;
}
示例2: displayLogin
/**
* A static method to display a login screen
*
* @static
*
* @param string $sMessage
* @param string $sessionID
* @param bool $inlineLogin
*/
function displayLogin($sMessage = '', $sessionID = 0, $inLineLogin = false)
{
global $strUsername, $strPassword, $strLogin, $strWelcomeTo, $strEnterUsername, $strNoAdminInteface, $strForgotPassword;
$aConf = $GLOBALS['_MAX']['CONF'];
$aPref = $GLOBALS['_MAX']['PREF'];
@header('Cache-Control: max-age=0, no-cache, proxy-revalidate, must-revalidate');
if (!$inLineLogin) {
phpAds_PageHeader(phpAds_Login);
}
// Check environment settings
$oSystemMgr = new OA_Environment_Manager();
$aSysInfo = $oSystemMgr->checkSystem();
foreach ($aSysInfo as $env => $vals) {
$errDetails = '';
if (is_array($vals['error']) && !empty($vals['error'])) {
if ($env == 'PERMS') {
// Just note that some file/folders are unwritable and that more information can be found in the debug.log
OA_Admin_UI::queueMessage('Error: File permission errors detected.<br />These <em>may</em> impact the accurate delivery of your ads,<br />See the debug.log file for the list of unwritable files', 'global', 'error', 0);
} else {
foreach ($vals['error'] as $key => $val) {
$errDetails .= '<li>' . htmlspecialchars($key) . ' => ' . htmlspecialchars($val) . '</li>';
}
phpAds_Die(' Error: ' . $err, $errDetails);
}
}
}
$oTpl = new OA_Admin_Template('login.html');
$appName = !empty($aConf['ui']['applicationName']) ? $aConf['ui']['applicationName'] : PRODUCT_NAME;
$oTpl->assign('uiEnabled', $aConf['ui']['enabled']);
$oTpl->assign('sessionID', $sessionID);
$oTpl->assign('appName', $appName);
$oTpl->assign('message', $sMessage);
$oTpl->display();
phpAds_PageFooter();
exit;
}
示例3: processDatabaseAction
/**
* Process input from user and creates/upgrades DB etc....
*
* @param OA_Admin_UI_Component_Form $oForm
* @param OX_Admin_UI_Install_Wizard $oWizard
*/
protected function processDatabaseAction($oForm, $oWizard)
{
$oUpgrader = $this->getUpgrader();
$upgraderSuccess = false;
$aDbConfig = $oForm->populateDbConfig();
if ($oUpgrader->canUpgradeOrInstall()) {
$installStatus = $oUpgrader->existing_installation_status;
define('DISABLE_ALL_EMAILS', 1);
OA_Permission::switchToSystemProcessUser('Installer');
if ($installStatus == OA_STATUS_NOT_INSTALLED) {
if ($oUpgrader->install($aDbConfig)) {
$message = $GLOBALS['strDBInstallSuccess'];
$upgraderSuccess = true;
}
} else {
if ($oUpgrader->upgrade($oUpgrader->package_file)) {
// Timezone support - hack
if ($oUpgrader->versionInitialSchema['tables_core'] < 538 && empty($aDbConfig['noTzAlert'])) {
OA_Dal_ApplicationVariables::set('utc_update', OA::getNowUTC());
}
// Clear the menu cache to built a new one with the new settings
OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADMIN);
OA_Admin_Menu::_clearCache(OA_ACCOUNT_MANAGER);
OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADVERTISER);
OA_Admin_Menu::_clearCache(OA_ACCOUNT_TRAFFICKER);
OA_Admin_Menu::singleton();
$message = $GLOBALS['strDBUpgradeSuccess'];
$upgraderSuccess = true;
}
}
OA_Permission::switchToSystemProcessUser();
//get back to normal user previously logged in
} else {
if ($oUpgrader->existing_installation_status == OA_STATUS_CURRENT_VERSION) {
$upgraderSuccess = true;
//rare but can occur if DB has been installed and user revisits the screen
}
}
$dbSuccess = $upgraderSuccess && !$oUpgrader->oLogger->errorExists;
if ($dbSuccess) {
//show success status
OA_Admin_UI::getInstance()->queueMessage($message, 'global', 'info');
} else {
//sth went wrong, display messages from upgrader
$aMessages = OX_Admin_UI_Install_InstallUtils::getMessagesWithType($oUpgrader->getMessages());
$this->setModelProperty('aMessages', $aMessages);
}
return $dbSuccess;
}
示例4: switchAccount
/**
* A method to switch the active account to a different one
*
* @static
* @param int $accountId
* @param boolean $hasAccess Can be used for optimization - if we know that user
* has access to the account he is switching to there is
* no need to check it again
*/
public static function switchAccount($accountId, $hasAccess = false)
{
if ($hasAccess || self::hasAccess($accountId)) {
$oUser =& self::getCurrentUser();
$oUser->loadAccountData($accountId);
}
// Force session save
phpAds_SessionDataRegister('user', $oUser);
// If exists previous message related to switchAccount remove it
OA_Admin_UI::removeOneMessage('switchAccount');
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strYouAreNowWorkingAsX'], array(htmlspecialchars($oUser->aAccount['account_name'])));
OA_Admin_UI::queueMessage($translated_message, 'global', 'info', null, 'switchAccount');
}
示例5: processForm
function processForm($aAdvertiser, $form)
{
$aFields = $form->exportValues();
// Name
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$aAdvertiser['clientname'] = $aFields['clientname'];
}
// Default fields
$aAdvertiser['contact'] = $aFields['contact'];
$aAdvertiser['email'] = $aFields['email'];
$aAdvertiser['comments'] = $aFields['comments'];
// Same advertiser limitation
$aAdvertiser['advertiser_limitation'] = $aFields['advertiser_limitation'] == '1' ? 1 : 0;
// Reports
$aAdvertiser['report'] = $aFields['report'] == 't' ? 't' : 'f';
$aAdvertiser['reportdeactivate'] = $aFields['reportdeactivate'] == 't' ? 't' : 'f';
$aAdvertiser['reportinterval'] = (int) $aFields['reportinterval'];
if ($aAdvertiser['reportinterval'] == 0) {
$aAdvertiser['reportinterval'] = 1;
}
if ($aFields['reportlastdate'] == '' || $aFields['reportlastdate'] == '0000-00-00' || $aFields['reportprevious'] != $aAdvertiser['report']) {
$aAdvertiser['reportlastdate'] = date("Y-m-d");
}
if (empty($aAdvertiser['clientid'])) {
// Set agency ID
$aAdvertiser['agencyid'] = OA_Permission::getAgencyId();
$doClients = OA_Dal::factoryDO('clients');
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
// Insert
$aAdvertiser['clientid'] = $doClients->insert();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname']), MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aAdvertiser['clientid'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// Go to next page
OX_Admin_Redirect::redirect("advertiser-index.php");
} else {
$doClients = OA_Dal::factoryDO('clients');
$doClients->get($aAdvertiser['clientid']);
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
$doClients->update();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect('advertiser-edit.php?clientid=' . $aAdvertiser['clientid']);
}
exit;
}
示例6: displayLogin
/**
* A static method to display a login screen
*
* @static
*
* @param string $sMessage
* @param string $sessionID
* @param bool $inlineLogin
*/
function displayLogin($sMessage = '', $sessionID = 0, $inLineLogin = false)
{
global $strUsername, $strPassword, $strLogin, $strWelcomeTo, $strEnterUsername, $strNoAdminInteface, $strForgotPassword;
$aConf = $GLOBALS['_MAX']['CONF'];
$aPref = $GLOBALS['_MAX']['PREF'];
@header('Cache-Control: max-age=0, no-cache, proxy-revalidate, must-revalidate');
if (!$inLineLogin) {
phpAds_PageHeader(phpAds_Login);
}
// Check environment settings
$oSystemMgr = new OA_Environment_Manager();
$aSysInfo = $oSystemMgr->checkSystem();
foreach ($aSysInfo as $env => $vals) {
$errDetails = '';
if (is_array($vals['error']) && !empty($vals['error'])) {
if ($env == 'PERMS') {
// Just note that some file/folders are unwritable and that more information can be found in the debug.log
OA_Admin_UI::queueMessage('Error: File permission errors detected.<br />These <em>may</em> impact the accurate delivery of your ads,<br />See the debug.log file for the list of unwritable files', 'global', 'error', 0);
} else {
foreach ($vals['error'] as $key => $val) {
$errDetails .= '<li>' . htmlspecialchars($key) . ' => ' . htmlspecialchars($val) . '</li>';
}
phpAds_Die(' Error: ' . $err, $errDetails);
}
}
}
$oTpl = new OA_Admin_Template('login.html');
// we build the URL of the current page to use a redirect URL after login
// this code should work on all server configurations hence why it is a bit complicated
// inspired by http://dev.piwik.org/svn/trunk/core/Url.php getCurrentUrl()
$url = '';
if (!empty($_SERVER['PATH_INFO'])) {
$url = $_SERVER['PATH_INFO'];
} else {
if (!empty($_SERVER['REQUEST_URI'])) {
if (($pos = strpos($_SERVER['REQUEST_URI'], "?")) !== false) {
$url = substr($_SERVER['REQUEST_URI'], 0, $pos);
} else {
$url = $_SERVER['REQUEST_URI'];
}
}
}
if (empty($url)) {
$url = $_SERVER['SCRIPT_NAME'];
}
if (!empty($_SERVER['QUERY_STRING'])) {
$url .= '?' . $_SERVER['QUERY_STRING'];
}
if (!empty($url)) {
// remove any extra slashes that would confuse the browser (see OX-5234)
$url = '/' . ltrim($url, '/');
}
$appName = !empty($aConf['ui']['applicationName']) ? $aConf['ui']['applicationName'] : MAX_PRODUCT_NAME;
$oTpl->assign('uiEnabled', $aConf['ui']['enabled']);
$oTpl->assign('formAction', $url);
$oTpl->assign('sessionID', $sessionID);
$oTpl->assign('appName', $appName);
$oTpl->assign('message', $sMessage);
$oTpl->display();
phpAds_PageFooter();
exit;
}
示例7: OX_Translation
}
}
if (!count($aErrormessage) && $changePassword) {
$result = $oPlugin->changePassword($doUsers, $pw, $pwold);
if (PEAR::isError($result)) {
$aErrormessage[0][] = $result->getMessage();
}
}
if (!count($aErrormessage)) {
if ($doUsers->update() === false) {
// Unable to update the preferences
$aErrormessage[0][] = $strUnableToWritePrefs;
} else {
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strPasswordChanged']);
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// The "preferences" were written correctly saved to the database,
// go to the "next" preferences page from here
OX_Admin_Redirect::redirect(basename($_SERVER['SCRIPT_NAME']));
}
}
}
// Set the correct section of the preference pages and display the drop-down menu
$prefSection = "password";
$setPref = $oOptions->getSettingsPreferences($prefSection);
$title = $setPref[$prefSection]['name'];
// Display the settings page's header and sections
$oHeaderModel = new OA_Admin_UI_Model_PageHeaderModel($title);
phpAds_PageHeader('account-user-index', $oHeaderModel);
// Get the current logged in user details
$oUser = OA_Permission::getCurrentUser();
示例8: processForm
function processForm($form)
{
$aFields = $form->exportValues();
if (empty($aFields['affiliateid'])) {
$aFields['affiliateid'] = 0;
}
if ($aFields['channelid']) {
$doChannel = OA_Dal::factoryDO('channel');
$doChannel->get($aFields['channelid']);
$doChannel->name = $aFields['name'];
$doChannel->description = $aFields['description'];
$doChannel->comments = $aFields['comments'];
$ret = $doChannel->update();
// Queue confirmation message
$translation = new OX_Translation();
$channelURL = "channel-edit.php?" . (empty($aFields['affiliateid']) ? "agencyid=" . $aFields['agencyid'] . "&channelid=" . $aFields['channelid'] : "affiliateid=" . $aFields['affiliateid'] . "&channelid=" . $aFields['channelid']);
$translated_message = $translation->translate($GLOBALS['strChannelHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, $channelURL), htmlspecialchars($aFields['name'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
if (!empty($aFields['affiliateid'])) {
header("Location: channel-edit.php?affiliateid=" . $aFields['affiliateid'] . "&channelid=" . $aFields['channelid']);
} else {
header("Location: channel-edit.php?agencyid=" . $aFields['agencyid'] . "&channelid=" . $aFields['channelid']);
}
exit;
} else {
$doChannel = OA_Dal::factoryDO('channel');
$doChannel->agencyid = $aFields['agencyid'];
$doChannel->affiliateid = $aFields['affiliateid'];
$doChannel->name = $aFields['name'];
$doChannel->description = $aFields['description'];
$doChannel->comments = $aFields['comments'];
$doChannel->compiledlimitation = 'true';
$doChannel->acl_plugins = 'true';
$doChannel->active = 1;
$aFields['channelid'] = $doChannel->insert();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strChannelHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'channel-edit.php?affiliateid=' . $aFields['affiliateid'] . '&channelid=' . $aFields['channelid']), htmlspecialchars($aFields['name']), MAX::constructURL(MAX_URL_ADMIN, 'channel-acl.php?affiliateid=' . $aFields['affiliateid'] . '&channelid=' . $aFields['channelid'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
if (!empty($aFields['affiliateid'])) {
OX_Admin_Redirect::redirect("affiliate-channels.php?affiliateid=" . $aFields['affiliateid']);
} else {
OX_Admin_Redirect::redirect("channel-index.php");
}
}
}
示例9: processForm
//.........这里部分代码省略.........
// Reset append codes which called this zone
$doZones = OA_Dal::factoryDO('zones');
$doZones->appendtype = phpAds_ZoneAppendZone;
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$doZones->addReferenceFilter('agency', OA_Permission::getEntityId());
} elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$doZones->addReferenceFilter('affiliates', OA_Permission::getEntityId());
}
$doZones->find();
while ($doZones->fetch() && ($row = $doZones->toArray())) {
$append = phpAds_ZoneParseAppendCode($row['append']);
if ($append[0]['zoneid'] == $aFields['zoneid']) {
$doZonesClone = clone $doZones;
$doZonesClone->appendtype = phpAds_ZoneAppendRaw;
$doZonesClone->append = '';
$doZonesClone->update();
}
}
if ($type_changed && $aFields['delivery'] == MAX_ZoneEmail) {
// Unlink all campaigns/banners linked to this zone
$aPlacementZones = Admin_DA::getPlacementZones(array('zone_id' => $aFields['zoneid']), true, 'placement_id');
if (!empty($aPlacementZones)) {
foreach ($aPlacementZones as $placementId => $aPlacementZone) {
Admin_DA::deletePlacementZones(array('zone_id' => $aFields['zoneid'], 'placement_id' => $placementId));
}
}
$aAdZones = Admin_DA::getAdZones(array('zone_id' => $aFields['zoneid']), false, 'ad_id');
if (!empty($aAdZones)) {
foreach ($aAdZones as $adId => $aAdZone) {
Admin_DA::deleteAdZones(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId));
}
}
} else {
if ($size_changed) {
$aZone = Admin_DA::getZone($aFields['zoneid']);
// Loop through all appended banners and make sure that they still fit...
$aAds = Admin_DA::getAdZones(array('zone_id' => $aFields['zoneid']), false, 'ad_id');
if (!empty($aAds)) {
foreach ($aAds as $adId => $aAd) {
$aAd = Admin_DA::getAd($adId);
if ($aZone['type'] == phpAds_ZoneText && $aAd['type'] != 'txt' || $aAd['width'] != $aZone['width'] && $aZone['width'] > -1 || $aAd['height'] != $aZone['height'] && $aZone['height'] > -1) {
Admin_DA::deleteAdZones(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId));
}
}
}
// Check if any campaigns linked to this zone have ads that now fit.
// If so, link them to the zone.
$aPlacementZones = Admin_DA::getPlacementZones(array('zone_id' => $aFields['zoneid']), true);
if (!empty($aPlacementZones)) {
foreach ($aPlacementZones as $aPlacementZone) {
// get ads in this campaign
$aAds = Admin_DA::getAds(array('placement_id' => $aPlacementZone['placement_id']), true);
foreach ($aAds as $adId => $aAd) {
Admin_DA::addAdZone(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId));
}
}
}
}
}
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strZoneHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "zone-edit.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']), htmlspecialchars($aFields['zonename'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect("zone-edit.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']);
} else {
$doZones = OA_Dal::factoryDO('zones');
$doZones->affiliateid = $aFields['affiliateid'];
$doZones->zonename = $aFields['zonename'];
$doZones->zonetype = phpAds_ZoneCampaign;
$doZones->description = $aFields['description'];
$doZones->comments = $aFields['comments'];
$doZones->width = $aFields['width'];
$doZones->height = $aFields['height'];
$doZones->delivery = $aFields['delivery'];
$doZones->oac_category_id = $aFields['oac_category_id'];
// The following fields are NOT NULL but do not get values set in the form.
// Should these fields be changed to NULL in the schema or should they have a default value?
$doZones->category = '';
$doZones->ad_selection = '';
$doZones->chain = '';
$doZones->prepend = '';
$doZones->append = '';
$aFields['zoneid'] = $doZones->insert();
// Ad Networks
$doPublisher = OA_Dal::factoryDO('affiliates');
$doPublisher->get($aFields['affiliateid']);
$anWebsiteId = $doPublisher->as_website_id;
if ($anWebsiteId) {
$oAdNetworks = new OA_Central_AdNetworks();
$oAdNetworks->updateZone($doZones, $anWebsiteId);
}
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strZoneHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'zone-edit.php?affiliateid=' . $aFields['affiliateid'] . '&zoneid=' . $aFields['zoneid']), htmlspecialchars($aFields['zonename'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect("affiliate-zones.php?affiliateid=" . $aFields['affiliateid']);
}
}
return $errors;
}
示例10: getTopLevelPage
/**
* Method that returns the top level page of the page passed as parameter.
*
* @param string $sectionId The page that we want to know its parent page.
* @return string A string with the parent page, it will be null if the page
* doesn't have a parent page.
*/
function getTopLevelPage($sectionId = null)
{
$sectionId = OA_Admin_UI::getID($sectionId);
$oMenu = OA_Admin_Menu::singleton();
$parentSections = $oMenu->getParentSections($sectionId);
return count($parentSections) ? $parentSections[0]->link : '';
}
示例11: processForm
function processForm($bannerid, $form, &$oComponent, $formDisabled = false)
{
$aFields = $form->exportValues();
$doBanners = OA_Dal::factoryDO('banners');
if (!empty($bannerid)) {
if ($doBanners->get($bannerid)) {
$aBanner = $doBanners->toArray();
}
}
$aVariables = array();
$aVariables['campaignid'] = $aFields['campaignid'];
$aVariables['target'] = isset($aFields['target']) ? $aFields['target'] : '';
$aVariables['height'] = isset($aFields['height']) ? $aFields['height'] : 0;
$aVariables['width'] = isset($aFields['width']) ? $aFields['width'] : 0;
$aVariables['weight'] = !empty($aFields['weight']) ? $aFields['weight'] : 0;
$aVariables['adserver'] = !empty($aFields['adserver']) ? $aFields['adserver'] : '';
$aVariables['alt'] = !empty($aFields['alt']) ? $aFields['alt'] : '';
$aVariables['bannertext'] = !empty($aFields['bannertext']) ? $aFields['bannertext'] : '';
$aVariables['htmltemplate'] = !empty($aFields['htmltemplate']) ? $aFields['htmltemplate'] : '';
$aVariables['description'] = !empty($aFields['description']) ? $aFields['description'] : '';
$aVariables['imageurl'] = !empty($aFields['imageurl']) && $aFields['imageurl'] != 'http://' ? $aFields['imageurl'] : '';
$aVariables['url'] = !empty($aFields['url']) && $aFields['url'] != 'http://' ? $aFields['url'] : '';
$aVariables['status'] = $aFields['status'] != '' ? $aFields['status'] : '';
$aVariables['storagetype'] = $aFields['type'];
$aVariables['ext_bannertype'] = 'bannerTypeText:oxMarkedText:oxMarkedTextComponent';
$aVariables['comments'] = $aFields['comments'];
$aVariables['contenttype'] = 'txt';
if (isset($aFields['keyword']) && $aFields['keyword'] != '') {
$keywordArray = split('[ ,]+', $aFields['keyword']);
$aVariables['keyword'] = implode(' ', $keywordArray);
} else {
$aVariables['keyword'] = '';
}
$editSwf = false;
$parameters = null;
$aVariables['parameters'] = serialize($parameters);
$insert = empty($bannerid) ? true : false;
$doBanners->setFrom($aVariables);
if ($insert) {
$bannerid = $doBanners->insert();
OA_Maintenance_Priority::scheduleRun();
} else {
$doBanners->update();
if ($aVariables['width'] != $aBanner['width'] || $aVariables['height'] != $aBanner['height']) {
MAX_adjustAdZones($bannerid);
MAX_addDefaultPlacementZones($bannerid, $aVariables['campaignid']);
}
}
$translation = new OX_Translation();
if ($insert) {
$translated_message = $translation->translate($GLOBALS['strBannerHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid'] . '&bannerid=' . $bannerid), htmlspecialchars($aFields['description'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
$nextPage = "oxMarkedTextAdvertiser-index.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid'];
} else {
$translated_message = $translation->translate($GLOBALS['strBannerHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid'] . '&bannerid=' . $aFields['bannerid']), htmlspecialchars($aFields['description'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
$nextPage = "banner-edit.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid'] . "&bannerid={$bannerid}";
}
Header("Location: {$nextPage}");
exit;
}
示例12: phpAds_PageHeader
/**
* Show page header
*
* @todo Remove the "if stats, use numeric system" mechanism, should happen with the stats rewrite
* Also, this function seems to just be a wrapper to OA_Admin_UI::showHeader()... removing it would seem to make sense
*
* @param string ID If not passed in (or null) the page filename is used as the ID
* @param string Extra
* @param string imgPath: a relative path to Images, CSS files. Used if calling function from anything other than admin folder
* @param bool $showSidebar Set to false if you do not wish to show the sidebar navigation
* @param bool $showContentFrame Set to false if you do not wish to show the content frame
* @param bool $showMainNavigation Set to false if you do not wish to show the main navigation
*/
function phpAds_PageHeader($ID = null, $headerModel = null, $imgPath = "", $showSidebar = true, $showContentFrame = true, $showMainNavigation = true)
{
$GLOBALS['_MAX']['ADMIN_UI'] = OA_Admin_UI::getInstance();
$GLOBALS['_MAX']['ADMIN_UI']->showHeader($ID, $headerModel, $imgPath, $showSidebar, $showContentFrame, $showMainNavigation);
$GLOBALS['phpAds_GUIDone'] = true;
}
示例13: processForm
//.........这里部分代码省略.........
}
// Update existing hard-coded links if new file has not been uploaded
if ($aVariables['contenttype'] == 'swf' && empty($_FILES['upload']['tmp_name']) && isset($aFields['alink']) && is_array($aFields['alink']) && count($aFields['alink'])) {
// Prepare the parameters
$parameters_complete = array();
// Prepare targets
if (!isset($aFields['atar']) || !is_array($aFields['atar'])) {
$aFields['atar'] = array();
}
foreach ($aFields['alink'] as $key => $val) {
if (substr($val, 0, 7) == 'http://' && strlen($val) > 7) {
if (!isset($aFields['atar'][$key])) {
$aFields['atar'][$key] = '';
}
if (isset($aFields['alink_chosen']) && $aFields['alink_chosen'] == $key) {
$aVariables['url'] = $val;
$aVariables['target'] = $aFields['atar'][$key];
}
/*
if (isset($aFields['asource'][$key]) && $aFields['asource'][$key] != '') {
$val .= '|source:'.$aFields['asource'][$key];
}
*/
$parameters_complete[$key] = array('link' => $val, 'tar' => $aFields['atar'][$key]);
}
}
$parameters = array('swf' => $parameters_complete);
} else {
$parameters = null;
}
$aVariables['parameters'] = serialize($parameters);
//TODO: deleting images is not viable because they could still be in use in the delivery cache
// // Delete any old banners...
// if (!empty($aBanner['filename']) && $aBanner['filename'] != $aVariables['filename']) {
// phpAds_ImageDelete($aBanner['storagetype'], $aBanner['filename']);
// }
// if (!empty($aBanner['alt_filename']) && $aBanner['alt_filename'] != $aVariables['alt_filename']) {
// phpAds_ImageDelete($aBanner['storagetype'], $aBanner['alt_filename']);
// }
// Clients are only allowed to modify certain fields, ensure that other fields are unchanged
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$aVariables['weight'] = $aBanner['weight'];
$aVariables['description'] = $aBanner['name'];
$aVariables['comments'] = $aBanner['comments'];
}
$insert = empty($bannerid) ? true : false;
if ($oComponent) {
$result = $oComponent->preprocessForm($insert, $bannerid, $aFields, $aVariables);
if ($result === false) {
// handle error
return false;
}
}
// File the data
$doBanners->setFrom($aVariables);
if ($insert) {
$bannerid = $doBanners->insert();
// Run the Maintenance Priority Engine process
OA_Maintenance_Priority::scheduleRun();
} else {
$doBanners->update();
// check if size has changed
if ($aVariables['width'] != $aBanner['width'] || $aVariables['height'] != $aBanner['height']) {
MAX_adjustAdZones($bannerid);
MAX_addDefaultPlacementZones($bannerid, $aVariables['campaignid']);
}
}
if ($oComponent) {
$result = $oComponent->processForm($insert, $bannerid, $aFields, $aVariables);
if ($result === false) {
// handle error
// remove rec from banners table?
return false;
}
}
$translation = new OX_Translation();
if ($insert) {
// Queue confirmation message
$translated_message = $translation->translate($GLOBALS['strBannerHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid'] . '&bannerid=' . $bannerid), htmlspecialchars($aFields['description'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// Determine what the next page is
if ($editSwf) {
$nextPage = "banner-swf.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid'] . "&bannerid={$bannerid}&insert=true";
} else {
$nextPage = "campaign-banners.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid'];
}
} else {
// Determine what the next page is
if ($editSwf) {
$nextPage = "banner-swf.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid'] . "&bannerid={$bannerid}";
} else {
$translated_message = $translation->translate($GLOBALS['strBannerHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid'] . '&bannerid=' . $aFields['bannerid']), htmlspecialchars($aFields['description'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
$nextPage = "banner-edit.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid'] . "&bannerid={$bannerid}";
}
}
// Go to the next page
Header("Location: {$nextPage}");
exit;
}
示例14: elseif
<?php
require_once '../../../../init.php';
require_once '../../config.php';
require_once MAX_PATH . '/lib/OA/Admin/TemplatePlugin.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/component/Form.php';
require_once 'lib/common.php';
$admin_ui = OA_Admin_UI::getInstance();
$admin_ui->registerStylesheetFile(MAX::constructURL(MAX_URL_ADMIN, 'plugins/zpBannerDesigner/css/colorpicker.css'));
$admin_ui->registerStylesheetFile(MAX::constructURL(MAX_URL_ADMIN, 'plugins/zpBannerDesigner/css/zp-style.css'));
phpAds_registerGlobalUnslashed('bannerid', 'campaignid', 'clientid', 'ajax', 'size', 'keywords', 'qty', 'template_id', 'image_url', 'description', 'type');
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
if (isset($ajax)) {
if ($ajax === 'search') {
echo search_ajax_request($keywords, $size, $qty);
} elseif ($ajax === 'form') {
echo form_ajax_request($template_id);
} elseif ($ajax === 'preview') {
echo preview_ajax_request($template_id);
} elseif ($ajax === 'save-image') {
echo save_ajax_request($bannerid, $campaignid, $clientid, $image_url, $template_id, $description, $type);
}
return;
}
//get advertisers and set the current one
$aAdvertisers = getAdvertiserMap();
if (empty($clientid)) {
//if it's empty
$campaignid = null;
//reset campaign id, we could derive it after we have clientid
if ($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid']) {
示例15: processForm
function processForm($aZone, $form, $oComponent = null)
{
$aFields = $form->exportValues();
if (empty($aFields['zoneid'])) {
return;
}
$doZones = OA_Dal::factoryDO('zones');
$doZones->get($aFields['zoneid']);
// Determine chain
if ($aFields['chaintype'] == '1' && $aFields['chainzone'] != '') {
$chain = 'zone:' . $aFields['chainzone'];
} else {
$chain = '';
}
$doZones->chain = $chain;
if (!isset($aFields['prepend'])) {
$aFields['prepend'] = '';
}
$aFields['prepend'] = MAX_commonGetValueUnslashed('prepend');
$doZones->prepend = $aFields['prepend'];
// Do not save append until not finished with zone appending, if present
if (!empty($aFields['appendsave'])) {
if (!isset($aFields['append'])) {
$aFields['append'] = '';
}
if (!isset($aFields['appendtype'])) {
$aFields['appendtype'] = phpAds_ZoneAppendZone;
}
$aFields['append'] = MAX_commonGetValueUnslashed('append');
$doZones->append = $aFields['append'];
$doZones->appendtype = $aFields['appendtype'];
}
if (isset($aFields['forceappend'])) {
$doZones->forceappend = $aFields['forceappend'];
}
$block = _initCappingVariables($aFields['time'], $aFields['capping'], $aFields['session_capping']);
// Set adselection PCI if required
if (isset($aFields['ext_adselection'])) {
$doZones->ext_adselection = $aFields['ext_adselection'] == 'none' ? OX_DATAOBJECT_NULL : $aFields['ext_adselection'];
}
$doZones->block = $block;
$doZones->capping = $aFields['capping'];
$doZones->session_capping = $aFields['session_capping'];
if ($aFields['show_capped_no_cookie'] != 1) {
$aFields['show_capped_no_cookie'] = 0;
}
$doZones->show_capped_no_cookie = $aFields['show_capped_no_cookie'];
$doZones->update();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strZoneAdvancedHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'zone-edit.php?affiliateid=' . $aFields['affiliateid'] . '&zoneid=' . $aFields['zoneid']), htmlspecialchars($doZones->zonename)));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// Rebuild Cache
// require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
// phpAds_cacheDelete('what=zone:'.$zoneid);
$oUI = OA_Admin_UI::getInstance();
OX_Admin_Redirect::redirect("zone-advanced.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']);
}