当前位置: 首页>>代码示例>>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;未经允许,请勿转载。