本文整理汇总了PHP中OA_Dal_ApplicationVariables::get方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_ApplicationVariables::get方法的具体用法?PHP OA_Dal_ApplicationVariables::get怎么用?PHP OA_Dal_ApplicationVariables::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Dal_ApplicationVariables
的用法示例。
在下文中一共展示了OA_Dal_ApplicationVariables::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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;
}
示例3: 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);
}
示例4: alertNeeded
/**
* A static method to check if an alert needs to be shown to the user
*
* @return bool
*/
function alertNeeded()
{
$aPref = $GLOBALS['_MAX']['PREF'];
$iLastRun = (int) OA_Dal_ApplicationVariables::get('maintenance_timestamp');
if ($iLastRun > 0 && !$aPref['maintenance']['autoMaintenance']) {
if ($iLastRun < time() - 86400) {
// Update the timestamp to make sure the warning
// is shown only once every 24 hours
OA_Dal_Maintenance_UI::updateLastRun();
return true;
}
}
return false;
}
示例5: 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();
}
}
}
示例6: testSetGetDelete
/**
* Test set, get and delete
*
*/
function testSetGetDelete()
{
// Force cache clean-up
OA_Dal_ApplicationVariables::cleanCache();
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertNull($result);
$result = OA_Dal_ApplicationVariables::set('foo', 'bar');
$this->assertTrue($result);
// Check cached values
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertEqual($result, 'bar');
// Force cache clean-up
OA_Dal_ApplicationVariables::cleanCache();
// Check DB-stored values
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertEqual($result, 'bar');
$result = OA_Dal_ApplicationVariables::set('foo', 'foobar');
$this->assertTrue($result);
// Check cached values
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertEqual($result, 'foobar');
// Force cache clean-up
OA_Dal_ApplicationVariables::cleanCache();
// Check DB-stored values
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertEqual($result, 'foobar');
$result = OA_Dal_ApplicationVariables::delete('foo');
$this->assertTrue($result);
// Check cached values
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertNull($result);
// Force cache clean-up
OA_Dal_ApplicationVariables::cleanCache();
// Check DB-stored values
$result = OA_Dal_ApplicationVariables::get('foo');
$this->assertNull($result);
}
示例7: array
}
break;
case OA_ACCOUNT_MANAGER:
// Check that they have the super account permission
if (!OA_Permission::hasPermission(OA_PERM_SUPER_ACCOUNT)) {
break;
}
// A manager account can only "see" those users that are already linked to the
// current account, and to the advertiser and trafficker accounts that are in the
// current account's realm -- display only these users -- but also exclude any
// user that is also linked to the admin account
$aAdminUserIds = array();
$aUserIds = array();
$oDbh =& OA_DB::singleton();
// Get the ID of all users linked to the admin account
$adminAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
$doAccount_user_assoc = OA_Dal::factoryDO('account_user_assoc');
$doAccount_user_assoc->account_id = $adminAccountId;
$doAccount_user_assoc->find();
while ($doAccount_user_assoc->fetch() > 0) {
// Store the user info for later
$aInfo = $doAccount_user_assoc->toArray();
$aAdminUserIds[] = $aInfo['user_id'];
}
// Get the current manager account ID
$currentAccountId = OA_Permission::getAccountId();
// Select all of the users that are linked with the current manager account
$doAccount_user_assoc = OA_Dal::factoryDO('account_user_assoc');
$doAccount_user_assoc->account_id = $currentAccountId;
$doAccount_user_assoc->find();
while ($doAccount_user_assoc->fetch() > 0) {
示例8: 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();
}
}
示例9: getCaptchaUrl
/**
* A method to retrieve the URL of the captcha image
*
* @see R-AN-20: Captcha Validation
*
* @return string
*/
function getCaptchaUrl()
{
$platformHash = OA_Dal_ApplicationVariables::get('platform_hash');
$url = OA_Central::buildUrl($GLOBALS['_MAX']['CONF']['oacXmlRpc'], 'captcha');
$url .= '?ph=' . urlencode($platformHash);
return $url;
}
示例10: loadPreferences
/**
* A static method to load the current account's preferences from the
* database and store them in the global array $GLOBALS['_MAX']['PREF'].
*
* @static
* @param boolean $loadExtraInfo An optional parameter, when set to true,
* the array of preferences is loaded as
* an array of arrays, indexed by preference
* key, containing the preference "value" and
* "account_type" information. When not set,
* the preferences are loaded as a
* one-dimensional array of values, indexed
* by preference key.
* @param boolean $return An optional parameter, when set to true,
* returns the preferences instead of setting
* them into $GLOBALS['_MAX']['PREF'].
* @param boolean $parentOnly An optional parameter, when set to true,
* only loads those preferences that are
* inherited from parent accounts, not preferences
* at the current account level. If the current
* account is the admin account, and this option
* is true, no preferences will be loaded!
* @param boolean $loadAdminOnly An optional parameter, when set to true, loads
* the admin preferences only, EVEN IF NO ACCUONT
* IS LOGGED IN. If set to true, REQUIRES that the
* $parentOnly parameter is false. Should only
* ever be set when called from
* OA_Preferences::loadAdminAccountPreferences().
* @param integer $accountId An optional account ID, when set, the preferences
* for this account will be loaded, provided there
* is no currently logged in account.
* @return mixed The array of preferences if $return is true, otherwise null.
*/
function loadPreferences($loadExtraInfo = false, $return = false, $parentOnly = false, $loadAdminOnly = false, $accountId = null)
{
$aConf = $GLOBALS['_MAX']['CONF'];
// Ensure $parentOnly and $loadAdminOnly are correctly set
if ($parentOnly && $loadAdminOnly) {
// Cannot both be true!
OA_Preferences::_unsetPreferences();
return;
}
// Only worry about the current account type and if a user is logged
// in if $loadAdminOnly == false
if ($loadAdminOnly == false) {
// Get the type of the current accout
$currentAccountType = OA_Permission::getAccountType();
// If no user logged in, and we are supposed to load a specific account's
// preferences, load the account type of that specific account
if (empty($currentAccountType) && is_numeric($accountId)) {
// Get the account type for the specified account
$doAccounts = OA_Dal::factoryDO('accounts');
$doAccounts->account_id = $accountId;
$doAccounts->find();
if ($doAccounts->getRowCount() > 0) {
$aCurrentAccountType = $doAccounts->getAll(array('account_type'), false, true);
$currentAccountType = $aCurrentAccountType[0];
}
}
// If (still) no user logged in or invalid specific account, return
if (is_null($currentAccountType) || $currentAccountType == false) {
OA_Preferences::_unsetPreferences();
return;
}
}
// Get all of the preference types that exist
$doPreferences = OA_Dal::factoryDO('preferences');
$aPreferenceTypes = $doPreferences->getAll(array(), true);
// Are there any preference types in the system?
if (empty($aPreferenceTypes)) {
OA_Preferences::_unsetPreferences();
return;
}
// Get the admin account's ID, as this will be required
$adminAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
// Get the admin account's preferences, as these are always required
$aAdminPreferenceValues = OA_Preferences::_getPreferenceValues($adminAccountId);
if (empty($aAdminPreferenceValues)) {
OA_Preferences::_unsetPreferences();
return;
}
// Prepare an array to store the preferences that should
// eventually be set in the global array
$aPreferences = array();
// Put the admin account's preferences into the temporary
// storage array for preferences
if ($loadAdminOnly == true || !($currentAccountType == OA_ACCOUNT_ADMIN && $parentOnly)) {
OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aAdminPreferenceValues, $loadExtraInfo);
}
// Is the current account NOT the admin account?
if ($loadAdminOnly == false && $currentAccountType != OA_ACCOUNT_ADMIN) {
// Is the current account not a manager account?
if ($currentAccountType == OA_ACCOUNT_MANAGER) {
// This is a manager account
if (!$parentOnly) {
// Locate the owning manager account ID
if (!is_numeric($accountId)) {
$managerAccountId = OA_Permission::getAccountId();
} else {
$managerAccountId = $accountId;
//.........这里部分代码省略.........
示例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;
}
示例12: getAdminAccountId
/**
* Returns ADMIN account ID
*
*/
function getAdminAccountId()
{
return OA_Dal_ApplicationVariables::get('admin_account_id');
}
示例13: _runOpenadsCentral
/**
* A private method to run OpenX Central related tasks.
*
* @access private
*/
function _runOpenadsCentral()
{
OA::debug(' Starting OpenX Central process.', PEAR_LOG_DEBUG);
if ($this->aConf['sync']['checkForUpdates'] && OA_Dal_ApplicationVariables::get('sso_admin')) {
require_once MAX_PATH . '/lib/OA/Central/AdNetworks.php';
$oAdNetworks = new OA_Central_AdNetworks();
$result = $oAdNetworks->getRevenue();
if (PEAR::isError($result)) {
OA::debug(" - OpenX Central error (" . $result->getCode() . "): " . $result->getMessage(), PEAR_LOG_INFO);
}
}
OA::debug(' Finished OpenX Central process.', PEAR_LOG_DEBUG);
}
示例14: _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;
}
}
}
示例15: 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;
}