function buildAgencyForm($aAgency)
{
    $form = new OA_Admin_UI_Component_Form("agencyform", "POST", $_SERVER['SCRIPT_NAME']);
    $form->forceClientValidation(true);
    $form->addElement('hidden', 'agencyid', $aAgency['agencyid']);
    $form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']);
    $form->addElement('text', 'name', $GLOBALS['strName']);
    $form->addElement('text', 'contact', $GLOBALS['strContact']);
    $form->addElement('text', 'email', $GLOBALS['strEMail']);
    //we want submit to be the last element in its own separate section
    $form->addElement('controls', 'form-controls');
    $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']);
    //Form validation rules
    $translation = new OX_Translation();
    $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName']));
    $form->addRule('name', $nameRequiredMsg, 'required');
    $contactRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strContact']));
    $form->addRule('contact', $contactRequiredMsg, 'required');
    $emailRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strEMail']));
    $form->addRule('email', $emailRequiredMsg, 'required');
    $form->addRule('email', $GLOBALS['strEmailField'], 'email');
    //set form  values
    $form->setDefaults($aAgency);
    return $form;
}
 /**
  * Append type-specific form elements to the base form
  *
  * @param object form
  * @param integer banner id
  */
 function buildForm(&$form, &$row)
 {
     $form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)");
     $header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner'] . " -  banner code");
     $header->setAttribute('icon', 'icon-banner-html.gif');
     $form->addElement($header);
     $adPlugins = OX_Component::getComponents('3rdPartyServers');
     $adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName');
     $adPluginsList = array();
     $adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric'];
     $adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml'];
     foreach ($adPluginsNames as $adPluginKey => $adPluginName) {
         $adPluginsList[$adPluginKey] = $adPluginName;
     }
     $htmlG['textarea'] = $form->createElement('textarea', 'htmltemplate', null, array('class' => 'code', 'cols' => '45', 'rows' => '10', 'wrap' => 'off', 'dir' => 'ltr', 'style' => 'width:550px;'));
     $aSelectAttributes = array('id' => 'adserver', 'style' => 'margin-left: 15px;width:230px');
     $htmlG['select'] = HTML_QuickForm::createElement('select', 'adserver', $GLOBALS['strAlterHTML'], $adPluginsList, $aSelectAttributes);
     $form->addGroup($htmlG, 'html_banner_g', null, array("<br>", ""), false);
     $form->addElement('header', 'header_b_links', "Banner link");
     $form->addElement('text', 'url', $GLOBALS['strURL']);
     $form->addElement('text', 'target', $GLOBALS['strTarget']);
     $form->addElement('header', 'header_b_display', 'Banner display');
     $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":");
     $sizeG['width']->setSize(5);
     $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":");
     $sizeG['height']->setSize(5);
     if (!empty($row['bannerid'])) {
         $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
         $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
     }
     $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], "&nbsp;", false);
     $form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier());
     //validation rules
     $translation = new OX_Translation();
     $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required');
     $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required');
     $numericRule = array($GLOBALS['strNumericField'], 'numeric');
     $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule), 'height' => array($heightRequiredRule, $numericRule)));
 }
 function testPluginTranslationByPlainString()
 {
     $transPath = '/tests/data/_lang';
     $GLOBALS['_MAX']['PREF']['language'] = 'en';
     $oTrans = new OX_Translation($transPath);
     // Make sure the translation resource loaded correctly
     $this->assertNotNull($oTrans->zTrans);
     // Translation by "key"
     $result = $oTrans->translate('TestString');
     $expected = 'This is a test string';
     $this->assertEqual($expected, $result);
     // Translation by "string"
     $expected = 'This is the translation of "another string"';
     $result = $oTrans->translate('This is another test string');
     $this->assertEqual($expected, $result);
     // Translation of not-present "string/key"
     $expected = 'This string doesn\'t exist in the source po file';
     $result = $oTrans->translate('This string doesn\'t exist in the source po file');
     $this->assertEqual($expected, $result);
     // Translation of a translated string that contains substitutions
     $expected = 'This is a test frog with a 3 number in it';
     $result = $oTrans->translate('This is a test %s with a %d number in it', array('frog', 3));
     $this->assertEqual($expected, $result);
 }
    } else {
        $aPublisherList = Admin_DA::getPublishers(array('agency_id' => $agencyId));
    }
    $aPublisher[0] = $GLOBALS['strSelectPublisher'];
    foreach ($aPublisherList as $key => $aValue) {
        $aPublisher[$aValue['publisher_id']] = $aValue['name'];
    }
    if (!empty($publisherId)) {
        $zone = Admin_DA::getZones(array('publisher_id' => $publisherId));
        $aZone[0] = $GLOBALS['strSelectZone'];
        foreach ($zone as $key => $aValue) {
            $aZone[$aValue['zone_id']] = $aValue['name'];
        }
    }
}
$oTrans = new OX_Translation();
$aParams = array('order' => $orderdirection, 'listorder' => $listorder, 'start_date' => $startDate, 'end_date' => $endDate, 'prevImg' => '<< ' . $oTrans->translate('Back'), 'nextImg' => $oTrans->translate('Next') . ' >>');
// Only pass advertiser or website props if we show related checkboxes
if ($showAdvertisers) {
    $aParams['advertiser_id'] = $advertiserId;
    $aParams['campaign_id'] = $campaignId;
}
if ($showPublishers) {
    $aParams['publisher_id'] = $publisherId;
    $aParams['zone_id'] = $zoneId;
}
// Account security
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
    $aParams['account_id'] = OA_Permission::getAccountId();
}
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
 /**
  * Returns a translated name of this section
  *
  * @return unknown
  */
 function getName()
 {
     return $this->oTranslation->translate($this->nameKey);
 }
 function handlePost($vars)
 {
     $codes = array();
     if (isset($vars['tag']) && is_array($vars['tag'])) {
         foreach ($vars['tag'] as $k => $v) {
             $codes[$k] = array('tagcode' => stripslashes($v), 'paused' => false);
             $codes[$k]['autotrack'] = isset($vars['autotrack'][$k]);
         }
     }
     if (isset($vars['t_paused'])) {
         foreach (explode(',', $vars['t_paused']) as $k) {
             if (isset($codes[$k])) {
                 $codes[$k]['paused'] = true;
             }
         }
     }
     if (isset($vars['t_action'])) {
         switch ($vars['t_action']) {
             case 'new':
                 $codes[] = array('tagcode' => '', 'paused' => false);
                 break;
             case 'del':
                 if (isset($vars['t_id']) && isset($codes[$vars['t_id']])) {
                     unset($codes[$vars['t_id']]);
                 }
                 break;
             case 'up':
                 if (isset($vars['t_id']) && isset($codes[$vars['t_id']]) && isset($codes[$vars['t_id'] - 1])) {
                     $tmp = $codes[$vars['t_id']];
                     $codes[$vars['t_id']] = $codes[$vars['t_id'] - 1];
                     $codes[$vars['t_id'] - 1] = $tmp;
                 }
                 break;
             case 'down':
                 if (isset($vars['t_id']) && isset($codes[$vars['t_id']]) && isset($codes[$vars['t_id'] + 1])) {
                     $tmp = $codes[$vars['t_id']];
                     $codes[$vars['t_id']] = $codes[$vars['t_id'] + 1];
                     $codes[$vars['t_id'] + 1] = $tmp;
                 }
                 break;
             case 'pause':
             case 'restart':
                 if (isset($vars['t_id']) && isset($codes[$vars['t_id']])) {
                     $codes[$vars['t_id']]['paused'] = $vars['t_action'] == 'pause';
                 }
                 break;
         }
     }
     if (isset($vars['save'])) {
         $this->_dal->setAppendCodes($this->tracker_id, $codes);
         // Queue confirmation message
         $doTrackers = OA_Dal::factoryDO('trackers');
         $doTrackers->get($this->tracker_id);
         $translation = new OX_Translation();
         $translated_message = $translation->translate($GLOBALS['strTrackerAppendHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $this->advertiser_id . "&trackerid=" . $this->tracker_id), htmlspecialchars($doTrackers->trackername)));
         OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
         OX_Admin_Redirect::redirect("tracker-append.php?clientid={$this->advertiser_id}&trackerid={$this->tracker_id}");
     } else {
         $this->codes = $codes;
         $this->showReminder = true;
     }
 }
Exemple #7
0
            $doTrackers->update();
            // Queue confirmation message
            $trackerName = $doTrackers->trackername;
            $doClients = OA_Dal::factoryDO('clients');
            if ($doClients->get($moveto)) {
                $advertiserName = $doClients->clientname;
            }
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strTrackerHasBeenMoved'], array(htmlspecialchars($trackerName), htmlspecialchars($advertiserName)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        }
        Header("Location: " . $returnurl . "?clientid=" . $moveto . "&trackerid=" . $trackerid);
        exit;
    } elseif (isset($duplicate) && $duplicate == 'true') {
        $doTrackers = OA_Dal::factoryDO('trackers');
        if ($doTrackers->get($trackerid)) {
            $oldName = $doTrackers->trackername;
            $new_trackerid = $doTrackers->duplicate();
            if ($doTrackers->get($new_trackerid)) {
                $newName = $doTrackers->trackername;
            }
            // Queue confirmation message
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strTrackerHasBeenDuplicated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid={$clientid}&trackerid={$trackerid}"), htmlspecialchars($oldName), MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid={$clientid}&trackerid={$new_trackerid}"), htmlspecialchars($newName)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            Header("Location: " . $returnurl . "?clientid=" . $clientid . "&trackerid=" . $new_trackerid);
            exit;
        }
    }
}
Header("Location: " . $returnurl . "?clientid=" . $clientid . "&trackerid=" . $trackerid);
 function _function_ox_tracker_type($aParams, &$smarty)
 {
     if (isset($aParams['type'])) {
         $type = $aParams['type'];
         $type = $GLOBALS['_MAX']['CONN_TYPES'][$type];
         // Warning: $type contains the id of translation string... remove 'str' to be able to pass it on to OX_Translation
         $type = substr($type, 3);
         $translation = new OX_Translation();
         return $translation->translate($type);
     } else {
         $smarty->trigger_error("t: missing 'type' parameter");
     }
 }
function processForm($form)
{
    $aFields = $form->exportValues();
    // If ID is not set, it should be a null-value for the auto_increment
    if (empty($aFields['trackerid'])) {
        $aFields['trackerid'] = "null";
    }
    $doTrackers = OA_Dal::factoryDO('trackers');
    $doTrackers->trackername = $aFields['trackername'];
    $doTrackers->description = $aFields['description'];
    $doTrackers->status = $aFields['status'];
    $doTrackers->type = $aFields['type'];
    $doTrackers->linkcampaigns = $aFields['linkcampaigns'] == "t" ? "t" : "f";
    $doTrackers->clientid = $aFields['clientid'];
    if (empty($aFields['trackerid']) || $aFields['trackerid'] == "null") {
        $aFields['trackerid'] = $doTrackers->insert();
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strTrackerHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $aFields['clientid'] . "&trackerid=" . $aFields['trackerid']), htmlspecialchars($aFields['trackername'])));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        OX_Admin_Redirect::redirect('advertiser-trackers.php?clientid=' . $aFields['clientid']);
    } else {
        $doTrackers->trackerid = $aFields['trackerid'];
        $doTrackers->update();
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strTrackerHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $aFields['clientid'] . "&trackerid=" . $aFields['trackerid']), htmlspecialchars($aFields['trackername'])));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        OX_Admin_Redirect::redirect("tracker-edit.php?clientid=" . $aFields['clientid'] . "&trackerid=" . $aFields['trackerid']);
    }
    exit;
}
        $doCampaigns_trackers->delete();
        if (isset($trackerids) && is_array($trackerids)) {
            for ($i = 0; $i < sizeof($trackerids); $i++) {
                $aFields = array('campaignid', 'trackerid', 'status');
                $values = array($campaignid, $trackerids[$i], $statusids[$i]);
                $fieldsSize = count($aFields);
                $doCampaigns_trackers = OA_Dal::factoryDO('campaigns_trackers');
                for ($k = 0; $k < $fieldsSize; $k++) {
                    $field = $aFields[$k];
                    $doCampaigns_trackers->{$field} = $values[$k];
                }
                $doCampaigns_trackers->insert();
            }
        }
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strCampaignTrackersHaveBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "campaign-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid), htmlspecialchars($doCampaigns->campaignname)));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        OX_Admin_Redirect::redirect("campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $campaignid);
    }
}
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
if (!isset($listorder)) {
    if (isset($session['prefs']['campaign-trackers.php']['listorder'])) {
        $listorder = $session['prefs']['campaign-trackers.php']['listorder'];
    } else {
        $listorder = '';
    }
}
/* Main code                                             */
/*-------------------------------------------------------*/
if (!empty($campaignid)) {
    $ids = explode(',', $campaignid);
    while (list(, $campaignid) = each($ids)) {
        // Security check
        OA_Permission::enforceAccessToObject('campaigns', $campaignid);
        $doCampaigns = OA_Dal::factoryDO('campaigns');
        $doCampaigns->campaignid = $campaignid;
        if ($doCampaigns->get($campaignid)) {
            $aCampaign = $doCampaigns->toArray();
        }
        $doCampaigns->delete();
    }
    // Queue confirmation message
    $translation = new OX_Translation();
    if (count($ids) == 1) {
        $translated_message = $translation->translate($GLOBALS['strCampaignHasBeenDeleted'], array(htmlspecialchars($aCampaign['campaignname'])));
    } else {
        $translated_message = $translation->translate($GLOBALS['strCampaignsHaveBeenDeleted']);
    }
    OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
}
// Run the Maintenance Priority Engine process
OA_Maintenance_Priority::scheduleRun();
// Rebuild cache
// include_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
// phpAds_cacheDelete();
/*-------------------------------------------------------*/
/* Return to the index page                              */
/*-------------------------------------------------------*/
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;
}
Exemple #13
0
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
if (!empty($bannerid)) {
    $ids = explode(',', $bannerid);
    while (list(, $bannerid) = each($ids)) {
        $doBanners = OA_Dal::factoryDO('banners');
        $doBanners->bannerid = $bannerid;
        if ($doBanners->get($bannerid)) {
            $aBanner = $doBanners->toArray();
        }
        $doBanners->delete();
    }
    // Queue confirmation message
    $translation = new OX_Translation();
    if (count($ids) == 1) {
        $translated_message = $translation->translate($GLOBALS['strBannerHasBeenDeleted'], array(htmlspecialchars($aBanner['description'])));
    } else {
        $translated_message = $translation->translate($GLOBALS['strBannersHaveBeenDeleted']);
    }
    OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
}
// Run the Maintenance Priority Engine process
OA_Maintenance_Priority::scheduleRun();
// Rebuild cache
// include_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
// phpAds_cacheDelete();
if (empty($returnurl)) {
    $returnurl = 'campaign-banners.php';
}
    $value = OA_ENTITY_STATUS_RUNNING;
}
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
OA_Permission::enforceAccessToObject('banners', $bannerid, true);
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
    if ($value == OA_ENTITY_STATUS_RUNNING) {
        OA_Permission::enforceAllowed(OA_PERM_BANNER_ACTIVATE);
    } else {
        OA_Permission::enforceAllowed(OA_PERM_BANNER_DEACTIVATE);
    }
}
if (!empty($bannerid)) {
    $doBanners = OA_Dal::factoryDO('banners');
    $doBanners->get($bannerid);
    $bannerName = $doBanners->description;
    $translation = new OX_Translation();
    $message = $value == OA_ENTITY_STATUS_PAUSED ? $GLOBALS['strBannerHasBeenDeactivated'] : $GLOBALS['strBannerHasBeenActivated'];
    $translated_message = $translation->translate($message, array("banner-edit.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}", htmlspecialchars($bannerName)));
    OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
    $doBanners->status = $value;
    $doBanners->update();
} elseif (!empty($campaignid)) {
    $doBanners = OA_Dal::factoryDO('banners');
    $doBanners->status = $value;
    $doBanners->whereAdd('campaignid = ' . $campaignid);
    $doBanners->update(DB_DATAOBJECT_WHEREADD_ONLY);
}
OA_Maintenance_Priority::scheduleRun();
header("Location: oxMarkedTextAdvertiser-index.php?clientid=" . $clientid . "&campaignid=" . $campaignid);
function checkIfCampaignTypeSpecified($submitValues)
{
    if (empty($submitValues['campaign_type'])) {
        $translation = new OX_Translation();
        return array('g_ctype' => $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strCampaignType'])));
    }
    return true;
}
Exemple #16
0
/**
 * Builds Pear pager object, preconfigured with items per page. Pager links are
 * processed to make them more readable. Also items name in summary can be added.
 *
 * @param unknown_type $items
 * @param unknown_type $itemsPerPage
 * @param unknown_type $withNumbers
 * @param unknown_type $itemsName
 * @return unknown
 */
function OX_buildPager($items, $itemsPerPage, $withNumbers = true, $itemsName = '', $delta = 4, $currentPage = null, $fileName = null, $params = null)
{
    require_once MAX_PATH . '/lib/pear/Pager/Pager.php';
    $oTrans = new OX_Translation();
    /** prepare paging **/
    $count = count($items);
    $delta = $withNumbers ? $delta : 0;
    $pagerOptions = array('mode' => 'Sliding', 'perPage' => $itemsPerPage, 'delta' => $delta, 'totalItems' => $count, 'prevImg' => '&lt; ' . $oTrans->translate('Back'), 'nextImg' => $oTrans->translate('Next') . ' &gt;', 'urlVar' => 'p', 'linkClass' => 'page', 'curPageLinkClassName' => 'current', 'spacesBeforeSeparator' => 0, 'httpMethod' => 'GET', 'spacesAfterSeparator' => 0);
    if (!empty($fileName)) {
        $pagerOptions['fileName'] = $fileName;
        $pagerOptions['fixFileName'] = false;
    }
    if (!empty($params)) {
        $pagerOptions['extraVars'] = $params;
    }
    if (!empty($currentPage)) {
        $pagerOptions['currentPage'] = $currentPage;
    }
    $pager = Pager::factory($pagerOptions);
    list($from, $to) = $pager->getOffsetByPageId();
    $summary = "<em>{$from}</em>-<em>{$to}</em> of <em>" . $pager->numItems() . " {$itemsName}</em>";
    $pager->summary = $summary;
    //override links with shorter pager controls
    if (!$withNumbers) {
        $links = $pager->links;
        $shortLinks = preg_replace("/<span class=\"current\">\\d+<\\/span>/i", "<span class='summary'>{$summary}</span>", $links);
        $shortLinks = preg_replace("/\\[\\d+\\]/", "", $shortLinks);
        $pager->links = $shortLinks;
    }
    return $pager;
}
        $doUsers->language = $language;
    }
    if (!count($aErrormessage)) {
        if ($doUsers->update() === false) {
            // Unable to update the preferences
            $aErrormessage[0][] = $strUnableToWritePrefs;
        } else {
            //Add the new username to the session
            $oUser =& OA_Permission::getCurrentUser();
            $oUser->aUser['contact_name'] = $contact_name;
            $oUser->aUser['language'] = $language;
            phpAds_SessionDataStore();
            // Queue confirmation message
            $setPref = $oOptions->getSettingsPreferences($prefSection);
            $title = $setPref[$prefSection]['name'];
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strUserPreferencesUpdated'], array(htmlspecialchars($title)));
            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
$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);
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
 /**
  * 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');
 }
    $result = $oSettings->processSettingsFromForm($aElements);
    if ($result) {
        // Delete all the sessions if the UI is disabled
        // to force all the users to be logged out
        if (!$GLOBALS['ui_enabled']) {
            $doSession = OA_Dal::factoryDO('session');
            $doSession->whereAdd('1=1');
            $doSession->delete(DB_DATAOBJECT_WHEREADD_ONLY);
        }
        // Rebuild the menu because the Enable Dashboard setting could been changed
        OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADMIN);
        OA_Admin_Menu::_clearCache(OA_ACCOUNT_MANAGER);
        // Queue confirmation message
        $setPref = $oOptions->getSettingsPreferences($prefSection);
        $title = $setPref[$prefSection]['name'];
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strXSettingsHaveBeenUpdated'], array(htmlspecialchars($title)));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        // The settings configuration file was written correctly,
        OX_Admin_Redirect::redirect(basename($_SERVER['SCRIPT_NAME']));
    }
    // Could not write the settings configuration file, store this
    // error message and continue
    $aErrormessage[0][] = $strUnableToWriteConfig;
}
// Set the correct section of the settings pages and display the drop-down menu
$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-settings-index', $oHeaderModel);
/*-------------------------------------------------------*/
if (!empty($trackerid)) {
    $ids = explode(',', $trackerid);
    while (list(, $trackerid) = each($ids)) {
        $doTrackers = OA_Dal::factoryDO('trackers');
        $doTrackers->trackerid = $trackerid;
        if ($doTrackers->find()) {
            // Clone the found DB_DataObject, as cannot delete() once
            // it has been fetch()ed
            $doTrackersClone = clone $doTrackers;
            // Fetch the tracker so that we can get the name of the
            // tracker for the delete message
            $doTrackers->fetch();
            $aTracker = $doTrackers->toArray();
            // Delete the cloned DB_DataObejct
            $doTrackersClone->delete();
        }
    }
    // Queue confirmation message
    $translation = new OX_Translation();
    if (count($ids) == 1) {
        $translated_message = $translation->translate($GLOBALS['strTrackerHasBeenDeleted'], array(htmlspecialchars($aTracker['trackername'])));
    } else {
        $translated_message = $translation->translate($GLOBALS['strTrackersHaveBeenDeleted']);
    }
    OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
}
if (empty($returnurl)) {
    $returnurl = 'advertiser-trackers.php';
}
header("Location: " . $returnurl . "?clientid=" . $clientid);
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']);
}
Exemple #22
0
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");
        }
    }
}
 protected function getRequiredFieldMessage($fieldLabel)
 {
     return $this->oTranslation->translate('XRequiredField', array($fieldLabel));
 }
Exemple #24
0
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;
phpAds_SessionDataStore();
/*-------------------------------------------------------*/
/* Process submitted form                                */
/*-------------------------------------------------------*/
if (isset($submitbutton)) {
    if (isset($bannerid) && $bannerid != '') {
        // Update banner
        $doBanners = OA_Dal::factoryDO('banners');
        $doBanners->get($bannerid);
        $doBanners->append = $append;
        $doBanners->appendtype = phpAds_ZoneAppendRaw;
        $doBanners->update();
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strBannerAdvancedHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid), htmlspecialchars($doBanners->description)));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
    }
    header("Location: banner-advanced.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $bannerid);
}
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
// Initialise some parameters
$pageName = basename($_SERVER['PHP_SELF']);
$tabindex = 1;
$agencyId = OA_Permission::getAgencyId();
$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);
// Display navigation
$aOtherCampaigns = Admin_DA::getPlacements(array('agency_id' => $agencyId));
function processForm($affiliateid, $form, $oComponent)
{
    $aFields = $form->exportValues();
    $newWebsite = empty($aFields['affiliateid']);
    // Setup a new publisher object and set the fields passed in from the form:
    $oPublisher = new OA_Dll_PublisherInfo();
    $oPublisher->agencyId = $aFields['agencyid'];
    $oPublisher->contactName = $aFields['contact'];
    $oPublisher->emailAddress = $aFields['email'];
    $oPublisher->publisherId = $aFields['affiliateid'];
    $oPublisher->publisherName = $aFields['name'];
    $oPublisher->website = $aFields['website'];
    // process form data for oxThorium if this is edit existing website
    if (!$newWebsite && $oComponent) {
        $aFields['affiliateid'] = $oPublisher->publisherId;
        $oComponent->processAffiliateForm($aFields);
    }
    $oPublisherDll = new OA_Dll_Publisher();
    if ($oPublisherDll->modify($oPublisher) && !$oPublisherDll->_noticeMessage) {
        // Queue confirmation message
        $translation = new OX_Translation();
        if ($newWebsite) {
            //process form data for oxThorium for new website
            if ($oComponent) {
                $aFields['affiliateid'] = $oPublisher->publisherId;
                $oComponent->processAffiliateForm($aFields);
            }
            $translated_message = $translation->translate($GLOBALS['strWebsiteHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'affiliate-edit.php?affiliateid=' . $oPublisher->publisherId), htmlspecialchars($oPublisher->publisherName), MAX::constructURL(MAX_URL_ADMIN, 'zone-edit.php?affiliateid=' . $oPublisher->publisherId)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            $redirectURL = "website-index.php";
        } else {
            $translated_message = $translation->translate($GLOBALS['strWebsiteHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'affiliate-edit.php?affiliateid=' . $oPublisher->publisherId), htmlspecialchars($oPublisher->publisherName)));
            $redirectURL = "affiliate-edit.php?affiliateid={$oPublisher->publisherId}";
        }
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        OX_Admin_Redirect::redirect($redirectURL);
    }
    return $oPublisherDll;
}
    if (!count($aErrormessage) && $changeEmail) {
        $result = $oPlugin->changeEmail($doUsers, $email_address, $pw);
        if (PEAR::isError($result)) {
            $aErrormessage[0][] = $result->getMessage();
        }
    }
    if (!count($aErrormessage)) {
        if ($doUsers->update() === false) {
            // Unable to update the preferences
            $aErrormessage[0][] = $strUnableToWritePrefs;
        } else {
            //Add the new username to the session
            $oUser =& OA_Permission::getCurrentUser();
            $oUser->aUser['email_address'] = $email_address;
            phpAds_SessionDataStore();
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strEmailChanged']);
            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 = "email";
$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);
            }
            if (is_array($v['publisher_hidden'])) {
                foreach ($v['publisher_hidden'] as $p) {
                    $variable_publisher[$p] = 0;
                }
            }
            foreach ($variable_publisher as $publisher_id => $visible) {
                $doVariable_publisher = OA_Dal::factoryDO('variable_publisher');
                $doVariable_publisher->variable_id = $v['variableid'];
                $doVariable_publisher->publisher_id = $publisher_id;
                $doVariable_publisher->visible = $visible;
                $doVariable_publisher->insert();
            }
        }
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strTrackerVarsHaveBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $clientid . "&trackerid=" . $trackerid), htmlspecialchars($doTrackers->trackername)));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        // unset variables!
        unset($session['prefs']['tracker-variables.php']);
        phpAds_SessionDataStore();
        // Rebuild cache
        // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
        // phpAds_CacheDelete('what=tracker:' . $trackerid);
        // redirect to the next page
        header("Location: tracker-variables.php?clientid=" . $clientid . "&trackerid=" . $trackerid);
        exit;
    }
}
$doClients = OA_Dal::factoryDO('clients');
$doClients->whereAdd('clientid <>' . $trackerid);
/* Process submitted form                                */
/*-------------------------------------------------------*/
if (!empty($action)) {
    if (empty($acl)) {
        $acl = array();
    }
    $acl = MAX_AclAdjust($acl, $action);
} elseif (!empty($submit)) {
    $acl = isset($acl) ? $acl : array();
    // Only save when inputs are valid
    if (OX_AclCheckInputsFields($acl, $pageName) === true) {
        if (MAX_AclSave($acl, $aEntities)) {
            // Queue confirmation message
            $doChannel = OA_Dal::factoryDO('channel');
            $doChannel->get($channelid);
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strChannelAclHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "channel-edit.php?" . (!empty($affiliateid) ? "affiliateid={$affiliateid}&" : "") . "channelid={$channelid}"), htmlspecialchars($doChannel->name)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            // Redirect
            if (!empty($affiliateid)) {
                header("Location: channel-acl.php?affiliateid={$affiliateid}&channelid={$channelid}");
            } else {
                header("Location: channel-acl.php?channelid={$channelid}");
            }
            exit;
        }
    }
}
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
        } else {
            $changePassword = true;
        }
    }
    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);
            if (isset($node_array['clients'])) {
                foreach ($node_array['clients'] as $key => $val) {
                    if (isset($node_array['clients'][$key]['campaigns'])) {
                        unset($node_array['clients'][$key]['campaigns'][$campaignid]);
                    }
                }
            }
            // Rebuild cache
            // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
            // phpAds_cacheDelete();
            /*-------------------------------------------------------*/
            /* Save the $node_array, if necessary                    */
            /*-------------------------------------------------------*/
            if (isset($node_array)) {
                $session['prefs']['advertiser-index.php']['nodes'] = $node_array;
                phpAds_SessionDataStore();
            }
            /*-------------------------------------------------------*/
            // Queue confirmation message
            $campaignName = $doCampaigns->campaignname;
            $doClients = OA_Dal::factoryDO('clients');
            if ($doClients->get($newclientid)) {
                $advertiserName = $doClients->clientname;
            }
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strCampaignHasBeenMoved'], array(htmlspecialchars($campaignName), htmlspecialchars($advertiserName)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        }
    }
}
Header("Location: " . $returnurl . "?clientid=" . (isset($newclientid) ? $newclientid : $clientid) . "&campaignid=" . $campaignid);