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


PHP UserDB::checkUser方法代码示例

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


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

示例1: init_requests

function init_requests(&$options)
{
    global $DBInfo;
    if (!empty($DBInfo->user_class)) {
        include_once 'plugin/user/' . $DBInfo->user_class . '.php';
        $class = 'User_' . $DBInfo->user_class;
        $user = new $class();
    } else {
        $user = new WikiUser();
    }
    $udb = new UserDB($DBInfo);
    $DBInfo->udb = $udb;
    if (!empty($DBInfo->trail)) {
        // read COOKIE trailer
        $options['trail'] = trim($user->trail) ? $user->trail : '';
    }
    if ($user->id != 'Anonymous') {
        $user->info = $udb->getInfo($user->id);
        // read user info
        $test = $udb->checkUser($user);
        # is it valid user ?
        if ($test == 1) {
            // fail to check ticket
            // check user group
            if ($DBInfo->login_strict > 0) {
                # auto logout
                $options['header'] = $user->unsetCookie();
            } else {
                if ($DBInfo->login_strict < 0) {
                    $options['msg'] = _("Someone logged in at another place !");
                }
            }
        } else {
            // check group
            $user->checkGroup();
        }
    } else {
        // read anonymous user IP info.
        $user->info = $udb->getInfo('Anonymous');
    }
    $options['id'] = $user->id;
    $DBInfo->user = $user;
    // check is_mobile_func
    $is_mobile_func = !empty($DBInfo->is_mobile_func) ? $DBInfo->is_mobile_func : 'is_mobile';
    if (!function_exists($is_mobile_func)) {
        $is_mobile_func = 'is_mobile';
    }
    $options['is_mobile'] = $is_mobile = $is_mobile_func();
    # MoniWiki theme
    if ((empty($DBInfo->theme) or isset($_GET['action'])) and isset($_GET['theme'])) {
        // check theme
        if (preg_match('@^[a-zA-Z0-9_-]+$@', $_GET['theme'])) {
            $theme = $_GET['theme'];
        }
    } else {
        if ($is_mobile) {
            if (isset($_GET['mobile'])) {
                if (empty($_GET['mobile'])) {
                    setcookie('desktop', 1, time() + 60 * 60 * 24 * 30, get_scriptname());
                    $_COOKIE['desktop'] = 1;
                } else {
                    setcookie('desktop', 0, time() - 60 * 60 * 24 * 30, get_scriptname());
                    unset($_COOKIE['desktop']);
                }
            }
        }
        if (isset($_COOKIE['desktop'])) {
            $DBInfo->metatags_extra = '';
            if (!empty($DBInfo->theme_css)) {
                $theme = $DBInfo->theme;
            }
        } else {
            if ($is_mobile or !empty($DBInfo->force_mobile)) {
                if (!empty($DBInfo->mobile_theme)) {
                    $theme = $DBInfo->mobile_theme;
                }
                if (!empty($DBInfo->mobile_menu)) {
                    $DBInfo->menu = $DBInfo->mobile_menu;
                }
                $DBInfo->use_wikiwyg = 0;
                # disable wikiwyg
            } else {
                if ($DBInfo->theme_css) {
                    $theme = $DBInfo->theme;
                }
            }
        }
    }
    if (!empty($theme)) {
        $options['theme'] = $theme;
    }
    if ($options['id'] != 'Anonymous') {
        $options['css_url'] = !empty($user->info['css_url']) ? $user->info['css_url'] : '';
        $options['quicklinks'] = !empty($user->info['quicklinks']) ? $user->info['quicklinks'] : '';
        $options['tz_offset'] = !empty($user->info['tz_offset']) ? $user->info['tz_offset'] : date('Z');
        if (empty($theme)) {
            $options['theme'] = $theme = !empty($user->info['theme']) ? $user->info['theme'] : '';
        }
    } else {
        $options['css_url'] = $user->css;
//.........这里部分代码省略.........
开发者ID:sedrion,项目名称:moniwiki,代码行数:101,代码来源:wiki.php


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