/**
  * The local implementation of the saveDefaults() method to save the
  * values used for the report by the user to the user's session
  * preferences, so that they can be re-used in other reports.
  */
 function saveDefaults()
 {
     global $session;
     if (isset($_REQUEST['period_preset'])) {
         $session['prefs']['GLOBALS']['report_period_preset'] = $_REQUEST['period_preset'];
     }
     phpAds_SessionDataStore();
 }
Example #2
0
 /**
  * Retreives information from session
  *
  * @return string
  * @static
  */
 function getMessage()
 {
     global $session;
     $message = isset($session['message']) ? $session['message'] : null;
     unset($session['message']);
     phpAds_SessionDataStore();
     return $message;
 }
 private function clearEntitiesInSession()
 {
     global $session;
     $clientid = $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'];
     unset($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid']);
     if ($clientid) {
         unset($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid]);
     }
     phpAds_SessionDataStore();
 }
 public static function addToRecentlyUsedAccounts($accountId)
 {
     global $session;
     if (empty($session['recentlyUsedAccounts'])) {
         $session['recentlyUsedAccounts']['a' . $accountId] = $accountId;
     } else {
         $session['recentlyUsedAccounts'] = array_merge(array('a' . $accountId => $accountId), $session['recentlyUsedAccounts']);
     }
     phpAds_SessionDataStore();
 }
function phpAds_SessionDataRegister($key, $value = '')
{
    global $Session;
    if (!defined('phpAds_installing')) {
        phpAds_SessionStart();
    }
    if (is_array($key) && $value == '') {
        foreach (array_keys($key) as $name) {
            $Session[$name] = $key[$name];
        }
    } else {
        $Session[$key] = $value;
    }
    phpAds_SessionDataStore();
    // This function has been disabled because of incompatibility
    // problem with ZendOptimizer 1.00. Call sessionDataStore
    // manually if have modified the session array.
    // register_shutdown_function("phpAds_SessionDataStore");
}
+---------------------------------------------------------------------------+
*/
// Require the initialisation file
require_once '../../init.php';
// Include required files
require_once MAX_PATH . '/lib/max/language/Loader.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/OA/Admin/Reports/Generate.php';
global $session;
if (isset($_REQUEST['submit_type']) && $_REQUEST['submit_type'] == 'change') {
    // Store any values we need to pass to the next page
    switch ($_REQUEST['changed_field']) {
        case 'publisher':
            if (isset($_REQUEST['publisherId'])) {
                $session['prefs']['GLOBALS']['report_publisher'] = $_REQUEST['publisherId'];
                phpAds_SessionDataStore();
            }
        default:
            break;
    }
    echo "<script type='text/javascript'>window.location='" . $_REQUEST['refresh_page'] . "'</script>";
}
// If the report is for a "specific" period, store the period for later user
if (!is_null($_GET['period_preset']) && $_GET['period_preset'] == 'specific') {
    if (!is_null($_GET['period_start'])) {
        $session['prefs']['GLOBALS']['startDate'] = $_GET['period_start'] = date('Y-m-d', strtotime($_GET['period_start']));
    }
    if (!is_null($_GET['period_end'])) {
        $session['prefs']['GLOBALS']['endDate'] = $_GET['period_end'] = date('Y-m-d', strtotime($_GET['period_end']));
    }
}
Example #7
0
function phpAds_SessionDataRegister($key, $value = '')
{
    $conf = $GLOBALS['_MAX']['CONF'];
    global $session;
    //if ($conf['openads']['installed'])
    if (OA_INSTALLATION_STATUS == OA_INSTALLATION_STATUS_INSTALLED) {
        phpAds_SessionStart();
    }
    if (is_array($key) && $value == '') {
        foreach (array_keys($key) as $name) {
            $session[$name] = $key[$name];
        }
    } else {
        $session[$key] = $value;
    }
    //if ($conf['openads']['installed'])
    if (OA_INSTALLATION_STATUS == OA_INSTALLATION_STATUS_INSTALLED) {
        phpAds_SessionDataStore();
    }
}
Example #8
0
 /**
  * Save the new password in the user properties
  *
  * @param string recovery ID
  * @param string new password
  * @return bool Ttrue the new password was correctly saved
  */
 function saveNewPasswordAndLogin($recoveryId, $password)
 {
     $doPwdRecovery = OA_Dal::factoryDO('password_recovery');
     $doPwdRecovery->recovery_id = $recoveryId;
     $doPwdRecoveryClone = clone $doPwdRecovery;
     $doPwdRecovery->find();
     if ($doPwdRecovery->fetch()) {
         $userId = $doPwdRecovery->user_id;
         $doPlugin =& OA_Auth::staticGetAuthPlugin();
         $doPlugin->setNewPassword($userId, $password);
         $doPwdRecoveryClone->delete();
         phpAds_SessionStart();
         $doUser = OA_Dal::staticGetDO('users', $userId);
         phpAds_SessionDataRegister(OA_Auth::getSessionData($doUser));
         phpAds_SessionDataStore();
         return true;
     }
     return false;
 }
Example #9
0
 function _checkLoginOld($tableName, $agencySupport)
 {
     if (!isset($_COOKIE['sessionID'])) {
         return new PEAR_Error($GLOBALS['strEnableCookies']);
     }
     $prefix = $GLOBALS['_MAX']['CONF']['table']['prefix'];
     $oDbh = OA_DB::singleton();
     if (!PEAR::isError($oDbh)) {
         $tblPreferences = $oDbh->quoteIdentifier($prefix . $tableName, true);
         $query = "SELECT admin, admin_pw FROM {$tblPreferences}";
         if ($agencySupport) {
             $query .= " WHERE agencyid = 0";
         }
         $aPref = $oDbh->queryRow($query, null, MDB2_FETCHMODE_ASSOC);
         if (is_array($aPref)) {
             $oPlugin =& OA_Auth::staticGetAuthPlugin('internal');
             $aCredentials = $oPlugin->_getCredentials(false);
             if (!PEAR::isError($aCredentials)) {
                 if (strtolower($aPref['admin']) == strtolower($aCredentials['username']) && $aPref['admin_pw'] == md5($aCredentials['password'])) {
                     $doUser = OA_Dal::factoryDO('users');
                     $doUser->username = $aPref['admin'];
                     $aSession = OA_Auth::getSessionData($doUser, true);
                     $aSession['user']->aAccount['account_type'] = OA_ACCOUNT_ADMIN;
                     phpAds_SessionDataRegister($aSession);
                 }
             }
         }
         // Openads for PostgreSQL 2.0 session.last_used field is a
         // timestamp with timezone, which gives troubles reading back
         // session data if TZ offset is > 0
         if ($tableName == 'config' && $oDbh->dbsyntax == 'pgsql') {
             // Make sure that session time is loaded as UTC
             $oDbh->exec("SET TIMEZONE TO 'UTC'");
             phpAds_SessionDataStore();
             $oDbh->exec("SET TIMEZONE TO DEFAULT");
             return;
         }
         phpAds_SessionDataStore();
     }
 }
Example #10
0
 function scheduleRun()
 {
     global $session;
     if ($GLOBALS['_MAX']['CONF']['priority']['instantUpdate']) {
         $session['RUN_MPE'] = true;
         phpAds_SessionDataStore();
         return true;
     }
     return false;
 }
Example #11
0
 /**
  * Removes from queue the latest message related to a given action. Please
  * make sure that if you intend to remove messages you queue them with 'relatedAction'
  * parameter set properly.
  *
  * @param string $relatedAction name of the action which messages should be removed
  * @return true if there was any message removed, false otherwise
  */
 function removeOneMessage($relatedAction)
 {
     global $session;
     if (empty($relatedAction) || !isset($session['messageQueue']) || !is_array($session['messageQueue']) || !count($session['messageQueue'])) {
         return false;
     }
     $aMessages = $session['messageQueue'];
     //filter messages out, if any
     $count = count($aMessages);
     for ($i = 0; $i < $count; $i++) {
         if ($relatedAction == $aMessages[$i]['relatedAction']) {
             unset($aMessages[$i]);
             $aMessages = array_slice($aMessages, 0);
             //a hack to reorder indices after elem was removed
             break;
         }
     }
     //if sth was filtered save new queue
     if ($count > count($aMessages)) {
         $session['messageQueue'] = $aMessages;
         // Force session storage
         phpAds_SessionDataStore();
     }
     return $count - count($aMessages);
 }
Example #12
0
/**
 * Starts or continue existing session
 *
 * @param unknown_type $checkRedirectFunc
 */
function OA_Start($checkRedirectFunc = null)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    global $session;
    // XXX: Why not try loading session data when OpenX is not installed?
    //if ($conf['openads']['installed'])
    if (OA_INSTALLATION_STATUS == OA_INSTALLATION_STATUS_INSTALLED) {
        phpAds_SessionDataFetch();
    }
    if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) {
        // Required files
        include_once MAX_PATH . '/lib/max/language/Loader.php';
        // Load the required language files
        Language_Loader::load('default');
        phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc));
        $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin');
        foreach ($aPlugins as $i => $id) {
            if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
                $obj->afterLogin();
            }
        }
    }
    // Overwrite certain preset preferences
    if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) {
        $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language'];
    }
    // Check if manual account switch has happened and migrate to new global variable
    if (isset($session['accountSwitch'])) {
        $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch'];
        unset($session['accountSwitch']);
        phpAds_SessionDataStore();
    }
}
function phpAds_SessionGetToken()
{
    if (OA_INSTALLATION_STATUS != OA_INSTALLATION_STATUS_INSTALLED) {
        return false;
    }
    global $session;
    phpAds_SessionStart();
    if (empty($session['token'])) {
        $session['token'] = md5(uniqid('phpads', 1));
        phpAds_SessionDataStore();
    }
    return $session['token'];
}
Example #14
0
/**
 * Starts or continue existing session
 *
 * @param unknown_type $checkRedirectFunc
 */
function OA_Start($checkRedirectFunc = null)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    global $session;
    // Send no cache headers
    MAX_header('Pragma: no-cache');
    MAX_header('Cache-Control: no-cache, no-store, must-revalidate');
    MAX_header('Expires: 0');
    if (RV_INSTALLATION_STATUS == RV_INSTALLATION_STATUS_INSTALLED) {
        phpAds_SessionDataFetch();
    }
    if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) {
        // Required files
        include_once MAX_PATH . '/lib/max/language/Loader.php';
        // Load the required language files
        Language_Loader::load('default');
        phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc));
        $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin');
        foreach ($aPlugins as $i => $id) {
            if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
                $obj->afterLogin();
            }
        }
    }
    // Overwrite certain preset preferences
    if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) {
        $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language'];
    }
    // Check if manual account switch has happened and migrate to new global variable
    if (isset($session['accountSwitch'])) {
        $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch'];
        unset($session['accountSwitch']);
        phpAds_SessionDataStore();
    }
}
Example #15
0
 function clearNotifications()
 {
     global $session;
     $session['notificationQueue'] = array();
     phpAds_SessionDataStore();
 }