當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CProfile::init方法代碼示例

本文整理匯總了PHP中CProfile::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP CProfile::init方法的具體用法?PHP CProfile::init怎麽用?PHP CProfile::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CProfile的用法示例。


在下文中一共展示了CProfile::init方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: login

 public static function login($login, $password)
 {
     try {
         self::setDefault();
         self::$data = API::User()->login(array('user' => $login, 'password' => $password, 'userData' => true));
         if (!self::$data) {
             throw new Exception();
         }
         if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) {
             error(_('GUI access disabled.'));
             throw new Exception();
         }
         if (empty(self::$data['url'])) {
             self::$data['url'] = CProfile::get('web.menu.view.last', 'index.php');
         }
         if (isset(self::$data['attempt_failed']) && self::$data['attempt_failed']) {
             CProfile::init();
             CProfile::update('web.login.attempt.failed', self::$data['attempt_failed'], PROFILE_TYPE_INT);
             CProfile::update('web.login.attempt.ip', self::$data['attempt_ip'], PROFILE_TYPE_STR);
             CProfile::update('web.login.attempt.clock', self::$data['attempt_clock'], PROFILE_TYPE_INT);
             CProfile::flush();
         }
         // remove guest session after successful login
         DBexecute('DELETE FROM sessions WHERE sessionid=' . zbx_dbstr(get_cookie('zbx_sessionid')));
         zbx_setcookie('zbx_sessionid', self::$data['sessionid'], self::$data['autologin'] ? time() + SEC_PER_DAY * 31 : 0);
         return true;
     } catch (Exception $e) {
         self::setDefault();
         return false;
     }
 }
開發者ID:itnihao,項目名稱:zatree-2.2,代碼行數:31,代碼來源:class.cwebuser.php

示例2: login

 /**
  * Tries to login a user and populates self::$data on success.
  *
  * @param string $login			user login
  * @param string $password		user password
  *
  * @throws Exception if user cannot be logged in
  *
  * @return bool
  */
 public static function login($login, $password)
 {
     try {
         self::setDefault();
         self::$data = API::User()->login(array('user' => $login, 'password' => $password, 'userData' => true));
         if (!self::$data) {
             throw new Exception();
         }
         if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) {
             error(_('GUI access disabled.'));
             throw new Exception();
         }
         if (empty(self::$data['url'])) {
             self::$data['url'] = CProfile::get('web.menu.view.last', 'index.php');
         }
         $result = (bool) self::$data;
         if (isset(self::$data['attempt_failed']) && self::$data['attempt_failed']) {
             CProfile::init();
             CProfile::update('web.login.attempt.failed', self::$data['attempt_failed'], PROFILE_TYPE_INT);
             CProfile::update('web.login.attempt.ip', self::$data['attempt_ip'], PROFILE_TYPE_STR);
             CProfile::update('web.login.attempt.clock', self::$data['attempt_clock'], PROFILE_TYPE_INT);
             $result &= CProfile::flush();
         }
         // remove guest session after successful login
         $result &= DBexecute('DELETE FROM sessions WHERE sessionid=' . zbx_dbstr(get_cookie('zbx_sessionid')));
         if ($result) {
             self::setSessionCookie(self::$data['sessionid']);
             add_audit_ext(AUDIT_ACTION_LOGIN, AUDIT_RESOURCE_USER, self::$data['userid'], '', null, null, null);
         }
         return $result;
     } catch (Exception $e) {
         self::setDefault();
         return false;
     }
 }
開發者ID:TonywalkerCN,項目名稱:Zabbix,代碼行數:45,代碼來源:CWebUser.php

示例3: init_nodes

function init_nodes()
{
    // init current node id
    if (defined('ZBX_NODES_INITIALIZED')) {
        return null;
    }
    global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID, $ZBX_CURRENT_NODEID, $ZBX_CURMASTERID, $ZBX_NODES, $ZBX_NODES_IDS, $ZBX_AVAILABLE_NODES, $ZBX_VIEWED_NODES, $ZBX_WITH_ALL_NODES;
    $ZBX_AVAILABLE_NODES = array();
    $ZBX_NODES_IDS = array();
    $ZBX_NODES = array();
    $ZBX_CURRENT_NODEID = $ZBX_LOCALNODEID;
    $ZBX_WITH_ALL_NODES = !defined('ZBX_NOT_ALLOW_ALL_NODES');
    if (!defined('ZBX_PAGE_NO_AUTHORIZATION') && ZBX_DISTRIBUTED) {
        if (CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN) {
            $sql = 'SELECT DISTINCT n.nodeid,n.name,n.masterid FROM nodes n';
        } else {
            $sql = 'SELECT DISTINCT n.nodeid,n.name,n.masterid' . ' FROM nodes n,groups hg,rights r,users_groups g' . ' WHERE r.id=hg.groupid' . ' AND r.groupid=g.usrgrpid' . ' AND g.userid=' . CWebUser::$data['userid'] . ' AND n.nodeid=' . DBid2nodeid('hg.groupid');
        }
        $db_nodes = DBselect($sql);
        while ($node = DBfetch($db_nodes)) {
            $ZBX_NODES[$node['nodeid']] = $node;
            $ZBX_NODES_IDS[$node['nodeid']] = $node['nodeid'];
        }
        $ZBX_AVAILABLE_NODES = get_accessible_nodes_by_user(CWebUser::$data, PERM_READ_LIST, PERM_RES_IDS_ARRAY, $ZBX_NODES_IDS);
        $ZBX_VIEWED_NODES = get_viewed_nodes();
        $ZBX_CURRENT_NODEID = $ZBX_VIEWED_NODES['selected'];
        if ($node_data = DBfetch(DBselect('SELECT n.masterid FROM nodes n WHERE n.nodeid=' . $ZBX_CURRENT_NODEID))) {
            $ZBX_CURMASTERID = $node_data['masterid'];
        }
        if (!isset($ZBX_NODES[$ZBX_CURRENT_NODEID])) {
            $ZBX_CURRENT_NODEID = $ZBX_LOCALNODEID;
            $ZBX_CURMASTERID = $ZBX_LOCMASTERID;
        }
        if (isset($_REQUEST['select_nodes'])) {
            update_node_profile($ZBX_VIEWED_NODES['nodeids']);
        }
        if (isset($_REQUEST['switch_node'])) {
            CProfile::update('web.nodes.switch_node', $ZBX_VIEWED_NODES['selected'], PROFILE_TYPE_ID);
        }
    } else {
        $ZBX_CURRENT_NODEID = $ZBX_LOCALNODEID;
        $ZBX_CURMASTERID = $ZBX_LOCMASTERID;
    }
    define('ZBX_NODES_INITIALIZED', 1);
    // reset profiles if node is different than local
    if ($ZBX_CURRENT_NODEID != $ZBX_LOCALNODEID) {
        CProfile::init();
    }
}
開發者ID:quanta-computing,項目名稱:debian-packages,代碼行數:49,代碼來源:nodes.inc.php


注:本文中的CProfile::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。