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


PHP cmsUser::isAdmin方法代码示例

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


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

示例1: before

 public function before($action_name)
 {
     if (!cmsUser::isAdmin()) {
         cmsCore::error404();
     }
     parent::before($action_name);
     $template = cmsTemplate::getInstance();
     $template->setLayout('admin');
     $template->setMenuItems('cp_main', $this->getAdminMenu());
 }
开发者ID:asphix,项目名称:icms2,代码行数:10,代码来源:frontend.php

示例2: before

 public function before($action_name)
 {
     if (!cmsUser::isAdmin()) {
         cmsCore::error404();
     }
     if (!$this->isAllowByIp()) {
         cmsCore::error404();
     }
     parent::before($action_name);
     $this->cms_template->setLayout('admin');
     $this->cms_template->setMenuItems('cp_main', $this->getAdminMenu());
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:12,代码来源:frontend.php

示例3: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!cmsUser::isAdmin()) {
         cmsCore::error404();
     }
     $ctype_id = $this->request->get('value', 0);
     if (!$ctype_id) {
         cmsCore::error404();
     }
     $datasets = $this->model->getContentDatasets($ctype_id);
     $list = array();
     if ($datasets) {
         $list = array('0' => '') + array_collection_to_list($datasets, 'id', 'title');
     }
     cmsTemplate::getInstance()->renderJSON($list);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:19,代码来源:widget_datasets_ajax.php

示例4: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!cmsUser::isAdmin()) {
         cmsCore::error404();
     }
     $ctype_id = $this->request->get('value', 0);
     if (!$ctype_id) {
         cmsCore::error404();
     }
     $ctype = $this->model->getContentType($ctype_id);
     if (!$ctype) {
         cmsCore::error404();
     }
     $fields = $this->model->getContentFields($ctype['name']);
     $list = array();
     if ($fields) {
         $list = array('' => '') + array_collection_to_list($fields, 'name', 'title');
     }
     cmsTemplate::getInstance()->renderJSON($list);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:23,代码来源:widget_fields_ajax.php

示例5: empty

<?php

$user = cmsUser::getInstance();
$list_header = empty($ctype['labels']['profile']) ? $ctype['title'] : $ctype['labels']['profile'];
$this->setPageTitle($list_header, $profile['nickname']);
$this->addBreadcrumb(LANG_USERS, href_to('users'));
$this->addBreadcrumb($profile['nickname'], href_to('users', $profile['id']));
$this->addBreadcrumb($list_header);
if (cmsUser::isAllowed($ctype['name'], 'add')) {
    $this->addToolButton(array('class' => 'add', 'title' => sprintf(LANG_CONTENT_ADD_ITEM, $ctype['labels']['create']), 'href' => href_to($ctype['name'], 'add')));
}
if ($folder_id && ($user->id == $profile['id'] || $user->is_admin)) {
    $this->addToolButton(array('class' => 'folder_edit', 'title' => LANG_EDIT_FOLDER, 'href' => href_to($ctype['name'], 'editfolder', $folder_id)));
    $this->addToolButton(array('class' => 'folder_delete', 'title' => LANG_DELETE_FOLDER, 'href' => href_to($ctype['name'], 'delfolder', $folder_id), 'onclick' => "if(!confirm('" . LANG_DELETE_FOLDER_CONFIRM . "')){ return false; }"));
}
if (cmsUser::isAdmin()) {
    $this->addToolButton(array('class' => 'page_gear', 'title' => sprintf(LANG_CONTENT_TYPE_SETTINGS, mb_strtolower($ctype['title'])), 'href' => href_to('admin', 'ctypes', array('edit', $ctype['id']))));
}
$rss_query = "?user={$profile['id']}";
?>

<h1 id="user_profile_title">

    <?php 
if (!empty($ctype['options']['is_rss']) && $this->controller->isControllerEnabled('rss')) {
    ?>
        <div class="content_list_rss_icon">
            <a href="<?php 
    echo href_to('rss', 'feed', $ctype['name']) . $rss_query;
    ?>
">RSS</a>
开发者ID:pin-git,项目名称:icms2,代码行数:31,代码来源:profile_content.tpl.php

示例6: run

 public function run()
 {
     if (cmsUser::isLogged() && !cmsUser::isAdmin()) {
         $this->redirectToHome();
     }
     $users_model = cmsCore::getModel('users');
     $form = $this->getForm('registration');
     //
     // Добавляем поле для кода приглашения,
     // если регистрация доступна только по приглашениям
     //
     if ($this->options['is_reg_invites']) {
         $fieldset_id = $form->addFieldsetToBeginning(LANG_REG_INVITED_ONLY);
         $form->addField($fieldset_id, new fieldString('inv', array('title' => LANG_REG_INVITE_CODE, 'rules' => array(array('required'), array('min_length', 10), array('max_length', 10)))));
     }
     //
     // Добавляем поле выбора группы,
     // при наличии публичных групп
     //
     $public_groups = $users_model->getPublicGroups();
     if ($public_groups) {
         $pb_items = array();
         foreach ($public_groups as $pb) {
             $pb_items[$pb['id']] = $pb['title'];
         }
         $form->addFieldToBeginning('basic', new fieldList('group_id', array('title' => LANG_USER_GROUP, 'items' => $pb_items)));
     }
     //
     // Добавляем в форму обязательные поля профилей
     //
     $content_model = cmsCore::getModel('content');
     $content_model->setTablePrefix('');
     $content_model->orderBy('ordering');
     $fields = $content_model->getRequiredContentFields('users');
     // Разбиваем поля по группам
     $fieldsets = cmsForm::mapFieldsToFieldsets($fields);
     // Добавляем поля в форму
     foreach ($fieldsets as $fieldset) {
         $fieldset_id = $form->addFieldset($fieldset['title']);
         foreach ($fieldset['fields'] as $field) {
             if ($field['is_system']) {
                 continue;
             }
             $form->addField($fieldset_id, $field['handler']);
         }
     }
     $user = array();
     if ($this->request->hasInQuery('inv')) {
         $user['inv'] = $this->request->get('inv');
     }
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         if (!$this->options['is_reg_enabled']) {
             cmsCore::error404();
         }
         $errors = false;
         $is_captcha_valid = true;
         //
         // Проверяем капчу
         //
         if ($this->options['reg_captcha']) {
             $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
             if (!$is_captcha_valid) {
                 $errors = true;
                 cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
             }
         }
         //
         // Парсим и валидируем форму
         //
         if (!$errors) {
             $user = $form->parse($this->request, $is_submitted);
             $user['groups'] = array();
             if (!empty($this->options['def_groups'])) {
                 $user['groups'] = $this->options['def_groups'];
             }
             if (isset($user['group_id'])) {
                 if (!in_array($user['group_id'], $user['groups'])) {
                     $user['groups'][] = $user['group_id'];
                 }
             }
             //
             // убираем поля которые не относятся к выбранной пользователем группе
             //
             foreach ($fieldsets as $fieldset) {
                 foreach ($fieldset['fields'] as $field) {
                     if (!$field['groups_edit']) {
                         continue;
                     }
                     if (in_array(0, $field['groups_edit'])) {
                         continue;
                     }
                     if (!in_array($user['group_id'], $field['groups_edit'])) {
                         $form->disableField($field['name']);
                         unset($user[$field['name']]);
                     }
                 }
             }
             $errors = $form->validate($this, $user);
         }
//.........这里部分代码省略.........
开发者ID:pin-git,项目名称:icms2,代码行数:101,代码来源:register.php

示例7: date

echo $this->options['owner_year'] ? $this->options['owner_year'] : date('Y');
?>
                </li>
                <li id="info">
                    <span class="item">
                        <?php 
echo LANG_POWERED_BY_INSTANTCMS;
?>
                    </span>
                    <span class="item">
                        <?php 
echo LANG_ICONS_BY_FATCOW;
?>
                    </span>
                    <?php 
if ($config->debug && cmsUser::isAdmin()) {
    ?>
                        <span class="item">
                            SQL: <a href="#sql_debug" class="ajax-modal"><?php 
    echo $core->db->query_count;
    ?>
</a>
                        </span>
                        <?php 
    if ($config->cache_enabled) {
        ?>
                            <span class="item">
                                Cache: <?php 
        echo cmsCache::getInstance()->query_count;
        ?>
                            </span>
开发者ID:pin-git,项目名称:icms2,代码行数:31,代码来源:main.tpl.php

示例8: session_start

//                        http://instantcms.ru/                               //
//                   produced by InstantSoft, instantsoft.ru                  //
//                        LICENSED BY GNU/GPL v2                              //
//                                                                            //
/******************************************************************************/
session_start();
define('VALID_RUN', true);
// Устанавливаем кодировку
header('Content-type:text/html; charset=utf-8');
header('X-Powered-By: InstantCMS');
require_once 'bootstrap.php';
if (cmsConfig::get('emulate_lag')) {
    usleep(350000);
}
// Инициализируем шаблонизатор
$template = cmsTemplate::getInstance();
if (href_to('auth', 'login') != $_SERVER['REQUEST_URI']) {
    if (!cmsConfig::get('is_site_on') && !cmsUser::isAdmin()) {
        cmsCore::errorMaintenance();
    }
}
cmsEventsManager::hook('engine_start');
//Запускаем роутинг и контроллер
$core->route($_SERVER['REQUEST_URI']);
$core->runController();
$core->runWidgets();
//Выводим готовую страницу
$template->renderPage();
cmsEventsManager::hook('engine_stop');
// Останавливаем кеш
cmsCache::getInstance()->stop();
开发者ID:uralmax89,项目名称:icms2,代码行数:31,代码来源:index.php

示例9: session_start

//                   produced by InstantSoft, instantsoft.ru                  //
//                        LICENSED BY GNU/GPL v2                              //
//                                                                            //
/******************************************************************************/
session_start();
define('VALID_RUN', true);
// Устанавливаем кодировку
header('Content-type:text/html; charset=utf-8');
header('X-Powered-By: InstantCMS 2');
require_once 'bootstrap.php';
if ($config->emulate_lag) {
    usleep(350000);
}
//Запускаем роутинг
$core->route($_SERVER['REQUEST_URI']);
// Инициализируем шаблонизатор
$template = cmsTemplate::getInstance();
if (href_to('auth', 'login') != $_SERVER['REQUEST_URI']) {
    if (!$config->is_site_on && !cmsUser::isAdmin()) {
        cmsCore::errorMaintenance();
    }
}
cmsEventsManager::hook('engine_start');
//Запускаем контроллер
$core->runController();
$core->runWidgets();
//Выводим готовую страницу
$template->renderPage();
cmsEventsManager::hook('engine_stop');
// Останавливаем кеш
cmsCache::getInstance()->stop();
开发者ID:Val-Git,项目名称:icms2,代码行数:31,代码来源:index.php

示例10: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!cmsUser::isAdmin()) {
         cmsCore::error404();
     }
     $ctype_id = $this->request->get('value');
     if (!$ctype_id) {
         cmsCore::error404();
     }
     $ctype = $this->model->getContentType($ctype_id);
     if (!$ctype) {
         cmsCore::error404();
     }
     $cats = $this->model->getCategoriesTree($ctype['name']);
     $cats_list = array();
     if ($cats) {
         foreach ($cats as $cat) {
             if ($cat['ns_level'] > 1) {
                 $cat['title'] = str_repeat('-', $cat['ns_level']) . ' ' . $cat['title'];
             }
             $cats_list[$cat['id']] = $cat['title'];
         }
     }
     cmsTemplate::getInstance()->renderJSON($cats_list);
 }
开发者ID:asphix,项目名称:icms2,代码行数:28,代码来源:widget_cats_ajax.php


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