当前位置: 首页>>代码示例>>PHP>>正文


PHP OA_Permission::getUserId方法代码示例

本文整理汇总了PHP中OA_Permission::getUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Permission::getUserId方法的具体用法?PHP OA_Permission::getUserId怎么用?PHP OA_Permission::getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OA_Permission的用法示例。


在下文中一共展示了OA_Permission::getUserId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_zp_user_id

function get_zp_user_id()
{
    $zp_users = OA_Dal::factoryDO('Zpusers');
    $zp_user_id = $zp_users->get_zp_user_id(OA_Permission::getUserId());
    if (!$zp_user_id) {
        $zp_user_id = zp_api_common_uuid();
        $zp_users->set_zp_user_id($zp_user_id);
    }
    return $zp_user_id;
}
开发者ID:TheProjecter,项目名称:openx-banner-creator,代码行数:10,代码来源:common.php

示例2: OA_Admin_Option

require_once MAX_PATH . '/lib/max/Admin/Languages.php';
require_once MAX_PATH . '/lib/max/Plugin/Translation.php';
require_once MAX_PATH . '/www/admin/config.php';
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER);
// Create a new option object for displaying the setting's page's HTML form
$oOptions = new OA_Admin_Option('user');
// Prepare an array for storing error messages
$aErrormessage = array();
// If the settings page is a submission, deal with the form data
if (isset($_POST['submitok']) && $_POST['submitok'] == 'true') {
    // Register input variables
    phpAds_registerGlobalUnslashed('pwold', 'pw', 'pw2');
    // Get the DB_DataObject for the current user
    $doUsers = OA_Dal::factoryDO('users');
    $doUsers->get(OA_Permission::getUserId());
    // Set defaults
    $changePassword = false;
    // Get the current authentication plugin instance
    $oPlugin = OA_Auth::staticGetAuthPlugin();
    // Check password
    if (!isset($pwold) || !$oPlugin->checkPassword(OA_Permission::getUsername(), $pwold)) {
        $aErrormessage[0][] = $GLOBALS['strPasswordWrong'];
    }
    if (isset($pw) && strlen($pw) || isset($pw2) && strlen($pw2)) {
        if (!strlen($pw) || strstr("\\", $pw)) {
            $aErrormessage[0][] = $GLOBALS['strInvalidPassword'];
        } elseif (strcmp($pw, $pw2)) {
            $aErrormessage[0][] = $GLOBALS['strNotSamePasswords'];
        } else {
            $changePassword = true;
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:31,代码来源:account-user-password.php

示例3: loadPreferences


//.........这里部分代码省略.........
             // This is a manager account
             if (!$parentOnly) {
                 // Locate the owning manager account ID
                 if (!is_numeric($accountId)) {
                     $managerAccountId = OA_Permission::getAccountId();
                 } else {
                     $managerAccountId = $accountId;
                 }
                 if ($managerAccountId == 0) {
                     OA_Preferences::_unsetPreferences();
                     return;
                 }
                 // Get the manager account's preference values
                 $aManagerPreferenceValues = OA_Preferences::_getPreferenceValues($managerAccountId);
                 // Merge the preference values into the temporary
                 // storage array for preferences
                 OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aManagerPreferenceValues, $loadExtraInfo);
             }
         } else {
             // This must be an advertiser or trafficker account, so
             // need to locate the manager account that "owns" this account
             if (!is_numeric($accountId)) {
                 $owningAgencyId = OA_Permission::getAgencyId();
             } else {
                 $owningAgencyId = 0;
                 if ($currentAccountType == OA_ACCOUNT_ADVERTISER) {
                     $doClients = OA_Dal::factoryDO('clients');
                     $doClients->account_id = $accountId;
                     $doClients->find();
                     if ($doClients->getRowCount() == 1) {
                         $aOwningAgencyId = $doClients->getAll(array('agencyid'), false, true);
                         $owningAgencyId = $aOwningAgencyId[0];
                     }
                 } else {
                     if ($currentAccountType == OA_ACCOUNT_TRAFFICKER) {
                         $doAffiliates = OA_Dal::factoryDO('affiliates');
                         $doAffiliates->account_id = $accountId;
                         $doAffiliates->find();
                         if ($doAffiliates->getRowCount() == 1) {
                             $aOwningAgencyId = $doAffiliates->getAll(array('agencyid'), false, true);
                             $owningAgencyId = $aOwningAgencyId[0];
                         }
                     }
                 }
             }
             if ($owningAgencyId == 0) {
                 OA_Preferences::_unsetPreferences();
                 return;
             }
             $doAgency = OA_Dal::factoryDO('agency');
             $doAgency->agencyid = $owningAgencyId;
             $doAgency->find();
             if ($doAgency->getRowCount() == 1) {
                 // The manager account "owning" the advertiser or
                 // trafficker account has some preferences that
                 // override the admin account preferences
                 $aManagerAccountId = $doAgency->getAll(array('account_id'), false, true);
                 $managerAccountId = $aManagerAccountId[0];
                 // Get the manager account's preference values
                 $aManagerPreferenceValues = OA_Preferences::_getPreferenceValues($managerAccountId);
                 // Merge the preference values into the temporary
                 // storage array for preferences
                 OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aManagerPreferenceValues, $loadExtraInfo);
             }
             if (!$parentOnly) {
                 // Get the current account's ID
                 if (!is_numeric($accountId)) {
                     $currentAccountId = OA_Permission::getAccountId();
                 } else {
                     $currentAccountId = $accountId;
                 }
                 if ($currentAccountId <= 0) {
                     OA_Preferences::_unsetPreferences();
                     return;
                 }
                 // Get the current account's preference values
                 $aCurrentPreferenceValues = OA_Preferences::_getPreferenceValues($currentAccountId);
                 // Merge the preference values into the temporary
                 // storage array for preferences
                 OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aCurrentPreferenceValues, $loadExtraInfo);
             }
         }
     }
     // Set the initial (default) language to conf value or english
     $aPreferences['language'] = !empty($aConf['max']['language']) ? $aConf['max']['language'] : 'en';
     // Add user preferences (currently language) to the prefs array
     if ($userId = OA_Permission::getUserId()) {
         $doUser = OA_Dal::factoryDO('users');
         $doUser->get('user_id', $userId);
         if (!empty($doUser->language)) {
             $aPreferences['language'] = $doUser->language;
         }
     }
     // Return or store the preferences
     if ($return) {
         return $aPreferences;
     } else {
         $GLOBALS['_MAX']['PREF'] = $aPreferences;
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:101,代码来源:Preferences.php

示例4: audit

 /**
  * Enter description here...
  *
  * @param integer $actionid One of the following:
  *                              - 1 for INSERT
  *                              - 2 for UPDATE
  *                              - 3 for DELETE
  * @param unknown_type $oDataObject
  * @param unknown_type $parentid
  * @return unknown
  */
 function audit($actionid, $oDataObject = null, $parentid = null)
 {
     if (OA::getConfigOption('audit', 'enabled', false)) {
         if ($this->_auditEnabled()) {
             if (is_null($this->doAudit)) {
                 $this->doAudit = $this->factory('audit');
             }
             $this->doAudit->actionid = $actionid;
             $this->doAudit->context = $this->getTableWithoutPrefix();
             $this->doAudit->contextid = $this->_getContextId();
             $this->doAudit->parentid = $parentid;
             $this->doAudit->username = OA_Permission::getUsername();
             $this->doAudit->userid = OA_Permission::getUserId();
             if (!isset($this->doAudit->usertype)) {
                 $this->doAudit->usertype = 0;
             }
             // Set the account IDs that need to be used in auditing
             // this type of entity record
             $aAccountIds = $this->getOwningAccountIds();
             // Set the primary account ID
             if (isset($aAccountIds[OA_ACCOUNT_MANAGER])) {
                 $this->doAudit->account_id = $aAccountIds[OA_ACCOUNT_MANAGER];
             } else {
                 $this->doAudit->account_id = $aAccountIds[OA_ACCOUNT_ADMIN];
             }
             // Set the advertiser account ID, if required
             if (isset($aAccountIds[OA_ACCOUNT_ADVERTISER])) {
                 $this->doAudit->advertiser_account_id = $aAccountIds[OA_ACCOUNT_ADVERTISER];
             }
             // Set the trafficker account ID, if required
             if (isset($aAccountIds[OA_ACCOUNT_TRAFFICKER])) {
                 $this->doAudit->website_account_id = $aAccountIds[OA_ACCOUNT_TRAFFICKER];
             }
             // Prepare a generic array of data to be stored in the audit record
             $aAuditFields = $this->_prepAuditArray($actionid, $oDataObject);
             // Individual objects can customise this data (add, remove, format...)
             $this->_buildAuditArray($actionid, $aAuditFields);
             // Do not audit if nothing has changed
             if (count($aAuditFields)) {
                 // Serialise the data
                 $this->doAudit->details = serialize($aAuditFields);
                 $this->doAudit->updated = OA::getNowUTC();
                 // Finally, insert the audit record
                 $id = $this->doAudit->insert();
                 // Perform post-audit actions
                 $this->_postAuditTrigger($actionid, $oDataObject, $id);
                 return $id;
             }
         }
     }
     return false;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:63,代码来源:DB_DataObjectCommon.php

示例5: storeUserAccountsPermissions

 /**
  * Store user rights per account
  *
  * @param array $aPermissions  Array of permission IDs
  * @param integer $accountId  account ID
  * @param integer $userId  user ID
  * @param array $aAllowedPermissions  Array of allowed permissions - keys of array are permissions IDs
  * @return true on success else false
  */
 function storeUserAccountsPermissions($aPermissions, $accountId = null, $userId = null, $aAllowedPermissions = null)
 {
     if (empty($userId)) {
         $userId = OA_Permission::getUserId();
     }
     if (empty($accountId)) {
         $accountId = OA_Permission::getAccountId();
     }
     OA_Permission::deleteExistingPermissions($accountId, $userId, $aAllowedPermissions);
     // add new permissions
     foreach ($aPermissions as $permissionId) {
         if (!is_null($aAllowedPermissions) && !isset($aAllowedPermissions[$permissionId])) {
             // check if permission is on the list of allowed permissions
             continue;
         }
         $doAccount_user_permission_assoc = OA_Dal::factoryDO('account_user_permission_assoc');
         $doAccount_user_permission_assoc->account_id = $accountId;
         $doAccount_user_permission_assoc->user_id = $userId;
         $doAccount_user_permission_assoc->permission_id = $permissionId;
         $doAccount_user_permission_assoc->is_allowed = 1;
         if (!$doAccount_user_permission_assoc->insert()) {
             return false;
         }
     }
     return true;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:35,代码来源:Permission.php


注:本文中的OA_Permission::getUserId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。