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


PHP Path::admin方法代码示例

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


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

示例1: __construct

 protected function __construct()
 {
     if (Path::IsAdminPage()) {
         $this->path = Path::admin();
     } else {
         $this->path = Path::manager();
     }
     $menu = array();
     $dir = dir($this->path);
     while ($file = $dir->read()) {
         if (strrpos($file, 'menu_') !== false) {
             $name = substr($file, 0, strrpos($file, '.'));
             $div = explode('_', $name);
             if (sizeof($div) == 2) {
                 $contents = implode('', file($this->path($file)));
                 preg_match("/title=[\\S ]+/", $contents, $matches);
                 $title = explode('"', $matches[0]);
                 $menu[$div[1]]['title'] = $title[1];
             } else {
                 if (sizeof($div) == 3) {
                     $contents = implode('', file($this->path($file)));
                     preg_match("/title=[\\S ]+/", $contents, $matches);
                     $title = explode('"', $matches[0]);
                     if (!isset($menu[$div[1]])) {
                         $menu[$div[1]] = array();
                     }
                     if (!isset($menu[$div[1]['child']])) {
                         $menu[$div[1]]['child'] = array();
                     }
                     $menu[$div[1]]['child'][$div[2]] = $title[1];
                     ksort($menu[$div[1]]['child']);
                 }
             }
         }
     }
     ksort($menu);
     $this->menu = $menu;
     // 현재 관리자페이지 위치 분석
     $urls = explode('?', Url::This());
     $url = substr($urls[0], 0, strrpos($urls[0], '.'));
     $url = substr($url, strrpos($url, '/'));
     $position = explode('_', $url);
     $this->position[0] = $position[1];
     if (isset($position[2])) {
         $this->position[1] = $position[2];
     }
 }
开发者ID:nclco,项目名称:magicboard3,代码行数:47,代码来源:AdminMenu.class.php

示例2: signin

function signin()
{
    // user already logged in
    if (isLogged()) {
        header('Location: ' . Path::admin());
        exit;
    }
    global $tpl;
    global $_CONFIG;
    if (!canLogin()) {
        global $tpl;
        $tpl->assign('page_title', 'Error');
        $tpl->assign('menu_links', Path::menu('error'));
        $tpl->assign('error_title', 'You’re in jail');
        $tpl->assign('error_content', 'You have been banned after too many bad attemps. <div class="espace-top">Please try later.</div>');
        $tpl->draw('error');
        exit;
    }
    if (!empty($_POST['login']) && !empty($_POST['password'])) {
        if (!empty($_POST['token']) && acceptToken($_POST['token'])) {
            if (check_auth(htmlspecialchars($_POST['login']), $_POST['password'])) {
                loginSucceeded();
                $cookiedir = '';
                if (dirname($_SERVER['SCRIPT_NAME']) != '/') {
                    $cookiedir = dirname($_SERVER["SCRIPT_NAME"]) . '/';
                }
                session_set_cookie_params(0, $cookiedir, $_SERVER['HTTP_HOST']);
                session_regenerate_id(TRUE);
                // check if we need to redirect the user
                $target = isset($_GET['target']) && targetIsAllowed($_GET['target']) ? Path::$_GET['target']() : './';
                header('Location: ' . $target);
                exit;
            }
            loginFailed();
            errorPage('The given username or password was wrong. <br />If you do not remberer your login informations, just delete the file <code>' . basename($_CONFIG['settings']) . '</code>.', 'Invalid username or password');
        }
        loginFailed();
        errorPage('The received token was empty or invalid.', 'Invalid security token');
    }
    $tpl->assign('page_title', 'Sign in');
    $tpl->assign('menu_links', Path::menu('signin'));
    $tpl->assign('target', isset($_GET['target']) && targetIsAllowed($_GET['target']) ? htmlspecialchars($_GET['target']) : NULL);
    $tpl->assign('token', getToken());
    $tpl->draw('form.signin');
    exit;
}
开发者ID:Devenet,项目名称:MyBooks,代码行数:46,代码来源:index.php

示例3: array

<?php

if (!defined("__MAGIC__")) {
    exit;
}
$m = Member::Inst();
$top_btns = array();
if ($m->Action('is_login')) {
    $top_btns[10] = array();
    $top_btns[10]['title'] = '회원페이지';
    $top_btns[10]['link'] = $m->Link('view');
    if ($m->Action('is_admin')) {
        $top_btns[20]['title'] = '관리자';
        $top_btns[20]['link'] = Path::admin();
        if (Widget::Inst()->Config('is_page')) {
            $top_btns[21]['title'] = '페이지[ON]';
        } else {
            $top_btns[21]['title'] = '페이지[OFF]';
        }
        $top_btns[21]['link'] = Widget::Inst()->Config('link_page');
        if (Widget::Inst()->Config('is_design')) {
            $top_btns[22]['title'] = '디자인[ON]';
        } else {
            $top_btns[22]['title'] = '디자인[OFF]';
        }
        $top_btns[22]['link'] = Widget::Inst()->Config('link_design');
    }
    $top_btns[30] = array();
    $top_btns[30]['title'] = '로그아웃';
    $top_btns[30]['link'] = $m->Link('logout');
} else {
开发者ID:nclco,项目名称:magicboard3,代码行数:31,代码来源:init.php


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