Ejemplo n.º 1
0
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']);
}
 /**
  * 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;
 }
Ejemplo n.º 3
0
/**
 * 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;
}
<?php

/*
+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
/**
 * OpenX jQuery ajax functions
 */
require_once '../../../../init.php';
require_once MAX_PATH . '/lib/OA/Admin/UI.php';
/**
 since we are loading a page inside of a frame we do not have access to
 scripts defined in top frame. Thus we need to load them on our own if we want to
 use jQuery.
 Please note that scripts.html is an admin template not a plugin template
 **/
$oUI = OA_Admin_UI::getInstance();
$aScripts = $oUI->genericJavascript();
$oTpl = new OA_Admin_Template('layout/scripts.html');
$oTpl->assign('aGenericJavascript', $aScripts);
$oTpl->display();
//now display the page content
include "templates/content.html";
<?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']) {