/*
+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
/**
 * A script to provide search results for the account switcher component.
 *
 * Currently, the script takes two GET parameters:
 *   - "q"     -- The string user typed in the seach box
 *   - "limit" -- The number of search results to be returned.
 */
if (empty($_GET["q"])) {
    $q = '';
} else {
    $q = strtolower($_GET["q"]);
}
// Require the initialisation file
require_once '../../init.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/AccountSwitch.php';
// Send header with charset info
header("Content-Type: text/html" . (isset($phpAds_CharSet) && $phpAds_CharSet != "" ? "; charset=" . $phpAds_CharSet : ""));
$oTpl = new OA_Admin_Template('account-switch-search.html');
OA_Admin_UI_AccountSwitch::assignModel($oTpl, $q);
$oTpl->display();
Example #2
0
 function _assignUserAccountInfo($oCurrentSection)
 {
     global $session;
     // Show currently logged on user and IP
     if (OA_Auth::isLoggedIn() || defined('phpAds_installing')) {
         $this->oTpl->assign('helpLink', OA_Admin_Help::getHelpLink($oCurrentSection));
         if (!defined('phpAds_installing')) {
             $this->oTpl->assign('infoUser', OA_Permission::getUsername());
             $this->oTpl->assign('buttonLogout', true);
             $this->oTpl->assign('buttonReportBugs', true);
             // Account switcher
             OA_Admin_UI_AccountSwitch::assignModel($this->oTpl);
             $this->oTpl->assign('strWorkingAs', $GLOBALS['strWorkingAs_Key']);
             $this->oTpl->assign('keyWorkingAs', $GLOBALS['keyWorkingAs']);
             $this->oTpl->assign('accountId', OA_Permission::getAccountId());
             $this->oTpl->assign('accountName', OA_Permission::getAccountName());
             $this->oTpl->assign('accountSearchUrl', MAX::constructURL(MAX_URL_ADMIN, 'account-switch-search.php'));
             $this->oTpl->assign('productUpdatesCheck', OA_Permission::isAccount(OA_ACCOUNT_ADMIN) && $GLOBALS['_MAX']['CONF']['sync']['checkForUpdates'] && !isset($session['maint_update_js']));
             if (OA_Permission::isUserLinkedToAdmin()) {
                 $this->oTpl->assign('maintenanceAlert', OA_Dal_Maintenance_UI::alertNeeded());
             }
         } else {
             $this->oTpl->assign('buttonStartOver', true);
         }
     }
 }
Example #3
0
require_once MAX_PATH . '/lib/OA/Dll.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once LIB_PATH . '/Admin/Redirect.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/AccountSwitch.php';
phpAds_registerGlobalUnslashed('return_url', 'account_id');
if (!empty($account_id)) {
    OA_Permission::enforceAccess($account_id);
    OA_Permission::switchAccount($account_id);
}
if (empty($return_url) && !empty($_SERVER['HTTP_REFERER'])) {
    $return_url = $_SERVER['HTTP_REFERER'];
}
if (empty($return_url) || preg_match('/[\\r\\n]/', $_SERVER['HTTP_REFERER'])) {
    $return_url = MAX::constructURL(MAX_URL_ADMIN, 'index.php');
} else {
    $session['accountSwitch'] = 1;
    phpAds_SessionDataStore();
}
// Ensure that we never return to this account-switch.php page, in the
// event that the session timed out, and then the user changed account
// manually...
$aUrlComponents = parse_url($return_url);
$aPathInformation = pathinfo($aUrlComponents['path']);
if ($aPathInformation['filename'] == 'account-switch') {
    $sectionID = $aPathInformation['filename'];
    OX_Admin_Redirect::redirect();
}
OA_Admin_UI_AccountSwitch::addToRecentlyUsedAccounts($account_id);
// Re-direct...
header('Location: ' . $return_url);
exit;