本文整理汇总了PHP中OA_Dal_ApplicationVariables类的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_ApplicationVariables类的具体用法?PHP OA_Dal_ApplicationVariables怎么用?PHP OA_Dal_ApplicationVariables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_ApplicationVariables类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _getId
/**
* A method to generate a lock id.
*
* @access protected
*
* @param string The lock name.
* @return string The lock id.
*/
function _getId($sName)
{
$platformHash = OA_Dal_ApplicationVariables::get('platform_hash');
// PostgreSQL needs two int4, we generate them using crc32
$sId = array(crc32($platformHash) & 0x7fffffff, crc32($sName) & 0x7fffffff);
return serialize($sId);
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:15,代码来源:pgsql.php
示例2: getPlatformHash
/**
* Try to get platform hash.
* If it's upgrade it try to read database (searches old config/preference tables)
* If this fails it returns 'OXP_upgrade-unknown_platform_hash'
* If it's fresh install then it checks if there is already generated
* platformHash by previous call of this method, or use suggested one, or generate new one.
* New platform hash is stored as already generated.
*
* @param string $suggestedPlatformHash
* @param boolean $forceCheck should check be done once again (or we can use cached results)
* @return string platform Hash
*/
public function getPlatformHash($suggestedPlatformHash = null, $forceCheck = false)
{
if (!$forceCheck && isset(self::$foundPlatformHash)) {
return self::$foundPlatformHash;
}
// is it upgrade?
$oUpgrader = new OA_Upgrade();
if (!$oUpgrader->isFreshInstall()) {
// YES:
// prepare database connection data
$oUpgrader->canUpgradeOrInstall();
$oUpgrader->initDatabaseConnection();
// try read platform hash from database (3 possible locations)
$platformHash = $this->readPlatformHashFromDatabase();
// if can't find platformHash - set 'OXP_upgrade-unknown_platform_hash'
$platformHash = $platformHash ? $platformHash : self::$UNKNOWN_PLATFORM_HASH;
} else {
// NO:
// is already set generatedPlatformHash
if (isset(self::$generatedPlatformHash)) {
$platformHash = self::$generatedPlatformHash;
} else {
// use sugested or generate new one (and remember)
if (isset($suggestedPlatformHash)) {
$platformHash = $suggestedPlatformHash;
} else {
$platformHash = OA_Dal_ApplicationVariables::generatePlatformHash();
}
// remember genereted platform hash
self::$generatedPlatformHash = $platformHash;
}
}
self::$foundPlatformHash = $platformHash;
return $platformHash;
}
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:47,代码来源:PlatformHashManager.php
示例3: getOwningAccountIds
/**
* A method to return an array of account IDs of the account(s) that
* should "own" any audit trail entries for this entity type; these
* are NOT related to the account ID of the currently active account
* (which is performing some kind of action on the entity), but is
* instead related to the type of entity, and where in the account
* heirrachy the entity is located.
*
* @return array An array containing up to three indexes:
* - "OA_ACCOUNT_ADMIN" or "OA_ACCOUNT_MANAGER":
* Contains the account ID of the manager account
* that needs to be able to see the audit trail
* entry, or, the admin account, if the entity
* is a special case where only the admin account
* should see the entry.
* - "OA_ACCOUNT_ADVERTISER":
* Contains the account ID of the advertiser account
* that needs to be able to see the audit trail
* entry, if such an account exists.
* - "OA_ACCOUNT_TRAFFICKER":
* Contains the account ID of the trafficker account
* that needs to be able to see the audit trail
* entry, if such an account exists.
*/
function getOwningAccountIds()
{
// Special case - return the admin account ID only,
// as changes to the types of preferences in the
// system need only be viewed by the admin
$aAccountIds = array(OA_ACCOUNT_ADMIN => OA_Dal_ApplicationVariables::get('admin_account_id'));
return $aAccountIds;
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:32,代码来源:Preferences.php
示例4: getPluginVersion
function getPluginVersion()
{
$version = OA_Dal_ApplicationVariables::get('apStatsGraphsUI_version');
if (class_exists('RV_Sync') || @(include MAX_PATH . '/lib/RV/Sync.php')) {
return RV_Sync::getConfigVersion($version);
}
require_once MAX_PATH . '/lib/OA/Sync.php';
return OA_Sync::getConfigVersion($version);
}
开发者ID:SamWinchester,项目名称:revive-adserver,代码行数:9,代码来源:index.php
示例5: setVariables
/**
* A helper method to set applicationvariables
*
* @param Date $oScheduledDate
* @param Date $oDate
*/
function setVariables($oScheduledDate, $oDate)
{
if (isset($oScheduledDate)) {
OA_Dal_ApplicationVariables::set('maintenance_cron_timestamp', $oScheduledDate->getDate(DATE_FORMAT_UNIXTIME));
} else {
OA_Dal_ApplicationVariables::delete('maintenance_cron_timestamp');
}
if (isset($oDate)) {
OA_Dal_ApplicationVariables::set('maintenance_timestamp', $oDate->getDate(DATE_FORMAT_UNIXTIME));
} else {
OA_Dal_ApplicationVariables::delete('maintenance_timestamp');
}
}
开发者ID:hostinger,项目名称:revive-adserver,代码行数:19,代码来源:Status.mtc.test.php
示例6: autoLogin
function autoLogin()
{
$oPlugin =& OA_Auth::staticGetAuthPlugin();
phpAds_SessionStart();
// No auto-login if auth is external
if (empty($oPlugin) || get_class($oPlugin) != 'Plugins_Authentication') {
phpAds_SessionDataDestroy();
return;
}
$adminAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
if (isset($adminAccountId)) {
// Fetch the user linked to the admin account
$doUser = OA_Dal::factoryDO('users');
$doAUA = OA_Dal::factoryDO('account_user_assoc');
$doAUA->account_id = $adminAccountId;
$doUser->joinAdd($doAUA);
$doUser->find();
if ($doUser->fetch()) {
phpAds_SessionDataRegister(OA_Auth::getSessionData($doUser));
phpAds_SessionDataStore();
}
}
}
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:23,代码来源:Login.php
示例7: call
/**
* A method to perform a call to the OAC XML-RPC server
*
* @param string $methodName The RPC method name
* @param int $authType Type of required authentication, see constants
* @param array $aParams Array of XML_RPC_Values
* @return mixed The returned value or PEAR_Error on error
*/
function call($methodName, $authType, $aParams = null, $recursionLevel = 0)
{
$aPref = $GLOBALS['_MAX']['PREF'];
$oMsg = new XML_RPC_Message('oac.' . $methodName);
$oMsg->remove_extra_lines = $this->remove_extra_lines;
$aHeader = array('protocolVersion' => OA_DAL_CENTRAL_PROTOCOL_VERSION, 'ph' => OA_Dal_ApplicationVariables::get('platform_hash'));
if ($authType & OA_DAL_CENTRAL_AUTH_M2M) {
if (empty($this->oCentral)) {
MAX::raiseError('M2M authentication used with a non M2M-enabled OA_Central object');
}
$aHeader['accountId'] = (int) $this->oCentral->accountId;
$aHeader['m2mPassword'] = OA_Dal_Central_M2M::getM2MPassword($this->oCentral->accountId);
if (empty($aHeader['m2mPassword']) || isset($GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId]) && $GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId] == true) {
// No password stored, connect!
$result = $this->oCentral->connectM2M();
if (PEAR::isError($result)) {
return $result;
}
$aHeader['m2mPassword'] = $result;
}
}
if ($authType & OA_DAL_CENTRAL_AUTH_SSO) {
$aHeader['ssoUsername'] = $this->ssoUsername;
$aHeader['ssoPassword'] = $this->ssoPassword;
}
if ($authType & OA_DAL_CENTRAL_AUTH_CAPTCHA) {
$aHeader['ssoCaptcha'] = isset($_REQUEST['captcha-value']) ? $_REQUEST['captcha-value'] : '';
$aHeader['ssoCaptchaRandom'] = isset($_REQUEST['captcha-random']) ? $_REQUEST['captcha-random'] : '';
}
$oMsg->addParam(XML_RPC_encode($aHeader));
if (is_array($aParams)) {
foreach ($aParams as $oParam) {
$oMsg->addParam($oParam);
}
}
OA::disableErrorHandling();
$oResponse = $this->oXml->send($oMsg, OAC_RPC_TIMEOUT);
OA::enableErrorHandling();
if (!$oResponse) {
return new PEAR_Error('XML-RPC connection error', OA_CENTRAL_ERROR_XML_RPC_CONNECTION_ERROR);
}
if ($oResponse->faultCode() || $oResponse->faultString()) {
// Deal with particular response codes at Rpc level, avoiding endless recursion
if (!$recursionLevel) {
switch ($oResponse->faultCode()) {
case OA_CENTRAL_ERROR_PLATFORM_DOES_NOT_EXIST:
OA::disableErrorHandling();
$oSync = new OA_Sync();
$oSync->checkForUpdates();
OA::enableErrorHandling();
return $this->call($methodName, $authType, $aParams, ++$recursionLevel);
case OA_CENTRAL_ERROR_ERROR_NOT_AUTHORIZED:
if (!($authType & OA_DAL_CENTRAL_AUTH_M2M)) {
break;
} else {
// Go with OA_CENTRAL_ERROR_M2M_PASSWORD_INVALID
}
case OA_CENTRAL_ERROR_M2M_PASSWORD_INVALID:
// OAP was asked to connect the account to get a password
// Set clear the password and retry (old password is in DB in case of problems with receiving new one)
$GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId] = true;
return $this->call($methodName, $authType, $aParams, ++$recursionLevel, true);
case OA_CENTRAL_ERROR_M2M_PASSWORD_EXPIRED:
$result = $this->_reconnectM2M();
if (PEAR::isError($result)) {
return $result;
}
return $this->call($methodName, $authType, $aParams, ++$recursionLevel);
}
}
return new PEAR_Error($oResponse->faultString(), $oResponse->faultCode());
}
$ret = XML_RPC_decode($oResponse->value());
// handling unknown server errors
// this may happen due to difference in Java/PHP XML-RPC handling errors
if (is_array($ret) && (isset($ret['faultCode']) || isset($ret['faultCode']))) {
return new PEAR_Error('Unknown server error', OA_CENTRAL_ERROR_SERVER_ERROR);
}
return $ret;
}
开发者ID:villos,项目名称:tree_admin,代码行数:88,代码来源:Rpc.php
示例8: 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;
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:55,代码来源:InstallController.php
示例9: updateLastRun
/**
* A method to update maintenance last run information for
* old maintenance code.
*/
function updateLastRun($bScheduled = false)
{
$sField = $bScheduled ? 'maintenance_cron_timestamp' : 'maintenance_timestamp';
OA_Dal_ApplicationVariables::set($sField, OA::getNow('U'));
// Make sure that the maintenance delivery cache is regenerated
MAX_cacheCheckIfMaintenanceShouldRun(false);
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:11,代码来源:Maintenance.php
示例10: getOwningManagerId
/**
* A method to return the ID of the manager account
* that "owns" this advertiser account.
*
* @return integer The account ID of the "owning"
* manager account. Returns the
* admin account ID if no owning
* manager account can be found.
*/
function getOwningManagerId()
{
$doAgency = OA_Dal::factoryDO('agency');
$doAgency->agencyid = $this->agencyid;
$doAgency->find();
if ($doAgency->getRowCount() == 1) {
$doAgency->fetch();
return $doAgency->account_id;
} else {
// Could not find the owning manager
// account ID, return the ID of the
// admin account instead
return OA_Dal_ApplicationVariables::get('admin_account_id');
}
}
开发者ID:hostinger,项目名称:revive-adserver,代码行数:24,代码来源:Affiliates.php
示例11: _getOwningAccountIdsByAccountId
/**
* A private method to return the owning account IDs in a format suitable
* for use by the DB_DataObjectCommon::getOwningAccountIds() method as a
* return parameter, given the account ID of the account that is the owner
* of the entity being audited.
*
* @access private
* @param integer $accountId The account ID that "owns" the entity being
* audited.
* @return array An array with the same format as the return array of the
* DB_DataObjectCommon::getOwningAccountIds() method.
*/
protected function _getOwningAccountIdsByAccountId($accountId)
{
// Get the type of the "owning" account
$accountType = OA_Permission::getAccountTypeByAccountId($accountId);
if ($accountType == OA_ACCOUNT_ADMIN) {
// Simply return the admin account ID
$aAccountIds = array(OA_ACCOUNT_ADMIN => $accountId);
} else {
if ($accountType == OA_ACCOUNT_MANAGER) {
// Simply return the manager account ID
$aAccountIds = array(OA_ACCOUNT_MANAGER => $accountId);
} else {
if ($accountType == OA_ACCOUNT_ADVERTISER) {
// Set the owning manager account ID to the admin
// account ID, in case something goes wrong
$managerAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
// This is an advertiser account, so find the
// "owning" manager account ID
$doClients = OA_Dal::factoryDO('clients');
$doClients->account_id = $accountId;
$doClients->find();
if ($doClients->getRowCount() == 1) {
$doClients->fetch();
$managerAccountId = $doClients->getOwningManagerId();
}
// Return the manager and advertiser account IDs
$aAccountIds = array(OA_ACCOUNT_MANAGER => $managerAccountId, OA_ACCOUNT_ADVERTISER => $accountId);
} else {
if ($accountType == OA_ACCOUNT_TRAFFICKER) {
// Set the owning manager account ID to the admin
// account ID, in case something goes wrong
$managerAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
// This is a trafficker account, so find the
// "owning" manager account ID
$doAffiliates = OA_Dal::factoryDO('affiliates');
$doAffiliates->account_id = $accountId;
$doAffiliates->find();
if ($doAffiliates->getRowCount() == 1) {
$doAffiliates->fetch();
$managerAccountId = $doAffiliates->getOwningManagerId();
}
// Return the manager and trafficker account IDs
$aAccountIds = array(OA_ACCOUNT_MANAGER => $managerAccountId, OA_ACCOUNT_TRAFFICKER => $accountId);
}
}
}
}
return $aAccountIds;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:61,代码来源:DB_DataObjectCommon.php
示例12: getOwningAccountIds
/**
* A method to return an array of account IDs of the account(s) that
* should "own" any audit trail entries for this entity type; these
* are NOT related to the account ID of the currently active account
* (which is performing some kind of action on the entity), but is
* instead related to the type of entity, and where in the account
* heirrachy the entity is located.
*
* @return array An array containing up to three indexes:
* - "OA_ACCOUNT_ADMIN" or "OA_ACCOUNT_MANAGER":
* Contains the account ID of the manager account
* that needs to be able to see the audit trail
* entry, or, the admin account, if the entity
* is a special case where only the admin account
* should see the entry.
* - "OA_ACCOUNT_ADVERTISER":
* Contains the account ID of the advertiser account
* that needs to be able to see the audit trail
* entry, if such an account exists.
* - "OA_ACCOUNT_TRAFFICKER":
* Contains the account ID of the trafficker account
* that needs to be able to see the audit trail
* entry, if such an account exists.
*/
public function getOwningAccountIds($resetCache = false)
{
// Special case - return the admin account ID only.
// This is because we can only store one account ID for each
// type of account, however, it's possible for a user to be
// linked to (for example) multiple accounts, which are in turn
// owned by multiple manager accounts, so it's simply not possible
// to record all possible manager account IDs; so, we restrict
// auditing of user entities to be only visible to the admin
// account
$aAccountIds = array(OA_ACCOUNT_ADMIN => OA_Dal_ApplicationVariables::get('admin_account_id'));
return $aAccountIds;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:37,代码来源:Users.php
示例13: _checkStatsAccuracy
/**
* A private method to check if the returned stats may be inaccurate
* becuase of an upgrade from a non TZ-enabled version
*
*/
function _checkStatsAccuracy()
{
$utcUpdate = OA_Dal_ApplicationVariables::get('utc_update');
if (!empty($utcUpdate)) {
$oUpdate = new Date($utcUpdate);
$oUpdate->setTZbyID('UTC');
// Add 12 hours
$oUpdate->addSeconds(3600 * 12);
if (!empty($this->aDates['day_begin']) && !empty($this->aDates['day_end'])) {
$startDate = new Date($this->aDates['day_begin']);
$endDate = new Date($this->aDates['day_end']);
if ($oUpdate->after($endDate) || $oUpdate->after($startDate)) {
$this->displayInaccurateStatsWarning = true;
}
} else {
// All statistics
$this->displayInaccurateStatsWarning = true;
}
}
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:25,代码来源:Common.php
示例14: _isAdmin
/**
* A private method to check if the current user is linked to the admin account
*
* @return bool True if the user is linked to the admin account
*/
function _isAdmin()
{
$doUsers = OA_Dal::factoryDO('users');
$doUsers->user_id = $this->aUser['user_id'];
$doAUA = OA_Dal::factoryDO('account_user_assoc');
$doAUA->account_id = OA_Dal_ApplicationVariables::get('admin_account_id');
$doUsers->joinAdd($doAUA);
return (bool) $doUsers->count();
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:14,代码来源:User.php
示例15: checkForUpdates
/**
* Connect to OpenX Sync to check for updates
*
* @param float $already_seen Only check for updates newer than this value.
* @return array An array of two items:
*
* Item 0 is the XML-RPC error code. Meanings:
* -2 => The admin user has disabled update checking
* -1 => No response from the server
* 0 - 799 => XML-RPC library error codes
* 0 => No error
* 800 => No updates
* 801+ => Error codes from the remote XML-RPC server
*
* Item 1 is either the error message (item 1 != 0), or an array containing update info
*/
function checkForUpdates($already_seen = 0)
{
global $XML_RPC_erruser;
if (!$this->aConf['sync']['checkForUpdates']) {
// Checking for updates has been disabled by the admin user,
// so do not communicate with the server that provides the
// details of what upgrades are available - just return an
// 800 "error"
$aReturn = array(-2, 'Check for updates has been disabled by the administrator.');
return $aReturn;
}
// Create the XML-RPC client object
$client = OA_Central::getXmlRpcClient($this->_conf);
// Prepare the installation's platform hash
$platform_hash = OA_Dal_ApplicationVariables::get('platform_hash');
if (!$platform_hash) {
// The installation does not have a platform hash; generate one,
// and save it to the database for later use
OA::debug("Generating a new platform_hash for the installation", PEAR_LOG_INFO);
$platform_hash = OA_Dal_ApplicationVariables::generatePlatformHash();
if (!OA_Dal_ApplicationVariables::set('platform_hash', $platform_hash)) {
OA::debug("Could not save the new platform_hash to the database", PEAR_LOG_ERR);
unset($platform_hash);
OA::debug("Sync process proceeding without a platform_hash", PEAR_LOG_INFO);
}
}
// Prepare the parameters required for the XML-RPC call to
// obtain if an update is available for this installation
$params = array(new XML_RPC_Value(PRODUCT_NAME, 'string'), new XML_RPC_Value($this->getConfigVersion(OA_Dal_ApplicationVariables::get('oa_version')), 'string'), new XML_RPC_Value($already_seen, 'string'), new XML_RPC_Value($platform_hash, 'string'));
// Has the Revive Adserver admin user kindly agreed to share the
// technology stack that it is running on, to help the community?
$aTechStack = array('data' => false);
if ($this->aConf['sync']['shareStack']) {
// Thanks, admin user! You're a star! Prepare the technology stack
// data and add it to the XML-RPC call
if ($this->oDbh->dbsyntax == 'mysql') {
$dbms = 'MySQL';
} else {
if ($this->oDbh->dbsyntax == 'pgsql') {
$dbms = 'PostgreSQL';
} else {
$dbms = 'UnknownSQL';
}
}
$aTechStack = array('os_type' => php_uname('s'), 'os_version' => php_uname('r'), 'webserver_type' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^(.*?)/.*$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'webserver_version' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^.*?/(.*?)(?: .*)?$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'db_type' => $dbms, 'db_version' => $this->oDbh->queryOne("SELECT VERSION()"), 'php_version' => phpversion(), 'php_sapi' => ucfirst(php_sapi_name()), 'php_extensions' => get_loaded_extensions(), 'php_register_globals' => (bool) ini_get('register_globals'), 'php_magic_quotes_gpc' => (bool) ini_get('magic_quotes_gpc'), 'php_safe_mode' => (bool) ini_get('safe_mode'), 'php_open_basedir' => (bool) strlen(ini_get('open_basedir')), 'php_upload_tmp_readable' => (bool) is_readable(ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR));
}
$params[] = XML_RPC_Encode($aTechStack);
// Add the registered email address
$params[] = new XML_RPC_Value(OA_Dal_ApplicationVariables::get('sync_registered_email'), 'string');
// Create the XML-RPC request message
$msg = new XML_RPC_Message("Revive.Sync", $params);
// Send the XML-RPC request message
if ($response = $client->send($msg, 10)) {
// XML-RPC server found, now checking for errors
if (!$response->faultCode()) {
// No fault! Woo! Get the response and return it!
$aReturn = array(0, XML_RPC_Decode($response->value()));
// Prepare cache
$cache = $aReturn[1];
// Update last run
OA_Dal_ApplicationVariables::set('sync_last_run', date('Y-m-d H:i:s'));
// Also write to the debug log
OA::debug("Sync: updates found!", PEAR_LOG_INFO);
} else {
// Boo! An error! (Well, maybe - if it's 800, yay!)
$aReturn = array($response->faultCode(), $response->faultString());
// Prepare cache
$cache = false;
// Update last run
if ($response->faultCode() == 800) {
// Update last run
OA_Dal_ApplicationVariables::set('sync_last_run', date('Y-m-d H:i:s'));
// Also write to the debug log
OA::debug("Sync: {$aReturn[1]}", PEAR_LOG_INFO);
} else {
// Write to the debug log
OA::debug("Sync: {$aReturn[1]} (code: {$aReturn[0]}", PEAR_LOG_ERR);
// Return immediately without writing to cache
return $aReturn;
}
}
OA_Dal_ApplicationVariables::set('sync_cache', serialize($cache));
OA_Dal_ApplicationVariables::set('sync_timestamp', time());
return $aReturn;
//.........这里部分代码省略.........
开发者ID:indyshao,项目名称:revive-adserver,代码行数:101,代码来源:Sync.php
示例16: autoLogin
function autoLogin()
{
$oPlugin =& OA_Auth::staticGetAuthPlugin();
phpAds_SessionStart();
// No auto-login if auth is external
if (empty($oPlugin) || get_class($oPlugin) != 'Plugins_Authentication') {
phpAds_SessionDataDestroy();
return;
}
$doUser = OA_Dal::factoryDO('users');
if (!empty($_COOKIE['oat']) && $_COOKIE['oat'] == OA_UPGRADE_UPGRADE) {
// Upgrading, fetch the record using the username of the logged in user
$doUser->username = OA_Permission::getUsername();
} else {
// Installing, fetch the user linked to the admin account
$doAUA = OA_Dal::factoryDO('account_user_assoc');
$doAUA->account_id = OA_Dal_ApplicationVariables::get('admin_account_id');
$doUser->joinAdd($doAUA);
}
$doUser->find();
if ($doUser->fetch()) {
phpAds_SessionDataRegister(OA_Auth::getSessionData($doUser));
phpAds_SessionDataStore();
}
}
开发者ID:villos,项目名称:tree_admin,代码行数:25,代码来源:Login.php
示例17: updateLastRun
/**
* A static method to update the last run
*
*/
function updateLastRun()
{
OA_Dal_ApplicationVariables::set('maintenance_timestamp', time());
}
开发者ID:akirsch,项目名称:revive-adserver,代码行数:8,代码来源:UI.php
示例18: testGetLastRun
function testGetLastRun()
{
$oMaintenance = new OX_Maintenance();
$this->assertNull($oMaintenance->getLastRun());
$iLastRun = strtotime('2002-01-01');
OA_Dal_ApplicationVariables::set('maintenance_timestamp', $iLastRun);
$oDate = new Date((int) $iLastRun);
$this->assertTrue($oDate->equals($oMaintenance->getLastRun()));
OA_Dal_ApplicationVariables::delete('maintenance_timestamp');
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:10,代码来源:Maintenance.mtc.test.php
示例19: unserialize
if ($aVars['sync_cache']) {
$update_check = unserialize($aVars['sync_cache']);
}
// If cache timestamp not set or older than 24hrs, re-sync
if (isset($aVars['sync_timestamp']) && $aVars['sync_timestamp'] + 86400 < time()) {
$oSync = new OA_Sync();
$res = $oSync->checkForUpdates();
if ($res[0] == 0) {
$update_check = $res[1];
}
}
if (!is_array($update_check) || $update_check['config_version'] <= $aVars['sync_last_seen']) {
$update_check = false;
} else {
// Make sure that the alert doesn't display everytime
OA_Dal_ApplicationVariables::set('sync_last_seen', $update_check['config_version']);
// Format like the XML-RPC response
$update_check = array(0, $update_check);
}
}
phpAds_SessionDataRegister('maint_update_js', true);
phpAds_SessionDataStore();
// Add Product Update redirector
if (isset($update_check[0]) && $update_check[0] == 0) {
header("Content-Type: application/x-javascript");
if ($update_check[1]['security_fix']) {
echo "alert('" . $strUpdateAlertSecurity . "');\n";
} else {
echo "if (confirm('" . $strUpdateAlert . "'))\n\t";
}
echo "document.location.replace('updates-product.php');\n";
开发者ID:villos,项目名称:tree_admin,代码行数:31,代码来源:maintenance-updates-js.php
示例20: sendCampaignImpendingExpiryEmail
/**
* @param $oDate
* @param $campaignId
* @return int Number of emails sent
*/
function sendCampaignImpendingExpiryEmail($oDate, $campaignId)
{
$aConf = $GLOBALS['_MAX']['CONF'];
global $date_format;
$oPreference = new OA_Preferences();
if (!isset($this->aAdminCache)) {
// Get admin account ID
$adminAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
// Get admin prefs
$adminPrefsNames = $this->_createPrefsListPerAccount(OA_ACCOUNT_ADMIN);
$aAdminPrefs = $oPreference->loadAccountPreferences($adminAccountId, $adminPrefsNames, OA_ACCOUNT_ADMIN);
// Get admin users
$aAdminUsers = $this->getAdminUsersLinkedToAccount();
// Store admin cache
$this->aAdminCache = array($aAdminPrefs, $aAdminUsers);
} else {
// Retrieve admin cache
list($aAdminPrefs, $aAdminUsers) = $this->aAdminCache;
}
$aPreviousOIDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oDate);
$aPreviousOIDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($aPreviousOIDates['start']);
$doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignId);
if (!$doCampaigns) {
return 0;
}
$aCampaign = $doCampaigns->toArray();
if (!isset($this->aClientCache[$aCampaign['clientid']])) {
$doClients = OA_Dal::staticGetDO('clients', $aCampaign['clientid']);
// Add advertiser linked users
$aLinkedUsers['advertiser'] = $this->getUsersLinkedToAccount('clients', $aCampaign['clientid']);
// Add advertiser prefs
$advertiserPrefsNames = $this->_createPrefsListPerAccount(OA_ACCOUNT_ADVERTISER);
$aPrefs['advertiser'] = $oPreference->loadAccountPreferences($doClients->account_id, $advertiserPrefsNames, OA_ACCOUNT_ADVERTISER);
if (!isset($aAgencyCache[$doClients->agencyid])) {
// Add manager linked users
$doAgency = OA_Dal::staticGetDO('agency', $doClients->agencyid);
$aLinkedUsers['manager'] = $this->getUsersLinkedToAccount('agency', $doClients->agencyid);
// Add manager preferences
$managerPrefsNames = $this->_createPrefsListPerAccount(OA_ACCOUNT_MANAGER);
$aPrefs['manager'] = $oPreference->loadAccountPreferences($doAgency->account_id, $managerPrefsNames, OA_ACCOUNT_MANAGER);
// Get agency "From" details
$aAgencyFromDetails = $this->_getAgencyFromDetails($doAgency->agencyid);
// Store in the agency cache
$this->aAgencyCache = array($doClients->agencyid => array($aLinkedUsers['manager'], $aPrefs['manager'], $aAgencyFromDetails));
} else {
// Retrieve agency cache
list($aLinkedUsers['manager'], $aPrefs['manager'], $aAgencyFromDetails) = $this->aAgencyCache[$doClients->agencyid];
}
// Add admin linked users and preferences
$aLinkedUsers['admin'] = $aAdminUsers;
$aPrefs['admin'] = $aAdminPrefs;
// Create a linked user 'special' for the advertiser that will take the admin preferences for advertiser
$aLinkedUsers['special']['advertiser'] = $doClients->toArray();
$aLinkedUsers['special']['advertiser']['contact_name'] = $aLinkedUsers['special']['advertiser']['contact'];
$aLinkedUsers['special']['advertiser']['email_address'] = $aLinkedUsers['special']['advertiser']['email'];
$aLinkedUsers['special']['advertiser']['language'] = '';
$aLinkedUsers['special']['advertiser']['user_id'] = 0;
// Check that every user is not going to receive more than one email if they
// are linked to more than one account
$aLinkedUsers = $this->_deleteDuplicatedUser($aLinkedUsers);
// Create the linked special user preferences from the admin preferences
// the special user is the client that doesn't have preferences in the database
$aPrefs['special'] = $aPrefs['admin'];
$aPrefs['special']['warn_email_special'] = $aPrefs['special']['warn_email_advertiser'];
$aPrefs['special']['warn_email_special_day_limit'] = $aPrefs['special']['warn_email_advertiser_day_limit'];
$aPrefs['special']['warn_email_special_impression_limit'] = $aPrefs['special']['warn_email_advertiser_impression_limit'];
// Store in the client cache
$this->aClientCache = array($aCampaign['clientid'] => array($aLinkedUsers, $aPrefs, $aAgencyFromDetails));
} else {
// Retrieve client cache
list($aLinkedUsers, $aPrefs, $aAgencyFromDetails) = $this->aClientCache[$aCampaign['clientid']];
}
$copiesSent = 0;
foreach ($aLinkedUsers as $accountType => $aUsers) {
if ($accountType == 'special' || $accountType == 'advertiser') {
// Get the agency details and use them for emailing advertisers
$aFromDetails = $aAgencyFromDetails;
} else {
// Use the Admin details
$aFromDetails = '';
}
if ($aPrefs[$accountType]['warn_email_' . $accountType]) {
// Does the account type want warnings when the impressions are low?
if ($aPrefs[$accountType]['warn_email_' . $accountType . '_impression_limit'] > 0 && $aCampaign['views'] > 0) {
// Test to see if the placements impressions remaining are less than the limit
$dalCampaigns = OA_Dal::factoryDAL('campaigns');
$remainingImpressions = $dalCampaigns->getAdImpressionsLeft($aCampaign['campaignid']);
if ($remainingImpressions < $aPrefs[$accountType]['warn_email_' . $accountType . '_impression_limit']) {
// Yes, the placement will expire soon! But did the placement just reach
// the point where it is about to expire, or did it happen a while ago?
$previousRemainingImpressions = $dalCampaigns->getAdImpressionsLeft($aCampaign['campaignid'], $aPreviousOIDates['end']);
if ($previousRemainingImpressions >= $aPrefs[$accountType]['warn_email_' . $accountType . '_impression_limit']) {
|
请发表评论