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


PHP cmsUser::isUserCan方法代码示例

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


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

示例1: initAccess

 public function initAccess()
 {
     $this->is_can_delete = cmsUser::isUserCan('comments/delete');
     $this->is_can_moderate = cmsUser::isUserCan('comments/moderate');
     $this->is_can_bbcode = cmsUser::isUserCan('comments/bbcode');
     $this->is_can_add = cmsUser::isUserCan('comments/add');
     $this->is_add_published = cmsUser::isUserCan('comments/add_published');
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:8,代码来源:model.php

示例2: mod_usermenu

function mod_usermenu($module_id, $cfg)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $is_billing = $inCore->isComponentInstalled('billing');
    $is_audio = $inCore->isComponentInstalled('audio');
    $is_video = $inCore->isComponentInstalled('video');
    cmsPage::initTemplate('modules', 'mod_usermenu')->assign('avatar', $inUser->imageurl)->assign('nickname', $inUser->nickname)->assign('login', $inUser->login)->assign('id', $inUser->id)->assign('newmsg', cmsUser::getNewMessages($inUser->id))->assign('is_can_add', cmsUser::isUserCan('content/add'))->assign('is_admin', $inUser->is_admin)->assign('is_editor', cmsUser::userIsEditor())->assign('cfg', $inCore->loadModuleConfig($module_id))->assign('users_cfg', $inCore->loadComponentConfig('users'))->assign('is_billing', $is_billing)->assign('is_audio', $is_audio)->assign('is_video', $is_video)->assign('audio_count', $is_audio ? $inUser->audio_count : 0)->assign('video_count', $is_video ? $inUser->video_count : 0)->assign('balance', $is_billing ? $inUser->balance : 0)->display('mod_usermenu.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:10,代码来源:module.php

示例3: isForumModerator

    public function isForumModerator($moder_list){

        if(cmsUser::isUserCan('forum/moderate')) { return true; }

        if (!$moder_list) { return false; }

        $moder_list = cmsCore::yamlToArray($moder_list);

		if (!is_array($moder_list)) { return false; }

		return in_array(cmsUser::getInstance()->id, $moder_list);

    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:13,代码来源:model.php

示例4:

// Если пользователь не администратор проверяем имеет ли он право на добавление
// материала а соответственно и прикреплять видео материалы
if (!cmsCore::c('user')->is_admin) {
    if ($target == 'content') {
        if ($target_id == 0) {
            if (!cmsUser::isUserCan('content/add')) { cmsCore::halt(); }
        } else {
            $item = cmsCore::m($target)->getArticle($target_id);
            
            if (empty($item)) { cmsCore::halt(); }
            
            if(!cmsCore::c('user')->is_admin &&
                ($item['user_id'] != cmsCore::c('user')->id) &&
                !($item['modgrp_id'] == cmsCore::c('user')->group_id &&
                cmsUser::isUserCan('content/autoadd')))
            {
                cmsCore::error404();
            }
        }
    }
}

if ($do == 'delete') {
    cmsCore::c('db')->delete('cms_content_videos', "`id` = '". cmsCore::request('video_id', 'int', 0) ."'", 1);
    cmsCore::halt('OK');
}

if ($do == 'insert') {
    cmsCore::loadLanguage('plugins/p_inser_video');
    $cfg = $inCore->loadPluginConfig('p_insert_video');
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:30,代码来源:ajax.php

示例5: blogs


//.........这里部分代码省略.........
                }
            }

            //для редактирования поста
            if ($inCore->do=='editpost'){
                cmsCore::c('page')->addPathway($post['title'], cmsCore::m('blogs')->getPostURL($blog['seolink'], $post['seolink']));
                cmsCore::c('page')->addPathway($_LANG['EDIT_POST']);
                cmsCore::c('page')->setTitle($_LANG['EDIT_POST']);
            }

            cmsCore::c('page')->initAutocomplete();
            $autocomplete_js = cmsCore::c('page')->getAutocompleteJS('tagsearch', 'tags');

            //получаем рубрики блога
            $cat_list = cmsCore::getListItems('cms_blog_cats', $post['cat_id'], 'id', 'ASC', "blog_id = '{$blog['id']}'");

            //получаем код панелей bbcode и смайлов
            $bb_toolbar = cmsPage::getBBCodeToolbar('message',cmsCore::m('blogs')->config['img_on'], 'blogs', 'blog_post', $post_id);
            $smilies    = cmsPage::getSmilesPanel('message');

            $inCore->initAutoGrowText('#message');

            //показываем форму
            cmsPage::initTemplate('components', 'com_blog_edit_post')->
                assign('blog', $blog)->
                assign('pagetitle', ($inCore->do=='editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST']))->
                assign('mod', $post)->
                assign('cat_list', $cat_list)->
                assign('bb_toolbar', $bb_toolbar)->
                assign('smilies', $smilies)->
                assign('is_admin', cmsCore::c('user')->is_admin)->
                assign('cfg', cmsCore::m('blogs')->config)->
                assign('myblog', $myblog)->
                assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'))->
                assign('autocomplete_js', $autocomplete_js)->
                display();
        }

        //Если есть запрос на сохранение
        if (cmsCore::inRequest('goadd')) {
            $errors = false;

            //Получаем параметры
            $mod['title']    = cmsCore::request('title', 'str');
            $mod['content']  = cmsCore::request('content', 'html');
            $mod['feel']     = cmsCore::request('feel', 'str', '');
            $mod['music']    = cmsCore::request('music', 'str', '');
            $mod['cat_id']   = cmsCore::request('cat_id', 'int');
            $mod['allow_who']= cmsCore::request('allow_who', 'str', $blog['allow_who']);
            $mod['tags']     = cmsCore::request('tags', 'str', '');
            $mod['comments'] = cmsCore::request('comments', 'int', 1);
            
            if (cmsCore::m('blogs')->config['seo_user_access'] || cmsCore::c('user')->is_admin) {
                $mod['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
                $mod['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
                $mod['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
            }
            
            $mod['published']= ($myblog || !$blog['premod']) ? 1 : 0;
            $mod['blog_id']  = $blog['id'];

            //Проверяем их
            if (mb_strlen($mod['title'])<2) {  cmsCore::addSessionMessage($_LANG['POST_ERR_TITLE'], 'error'); $errors = true; }
            if (mb_strlen($mod['content'])<5) { cmsCore::addSessionMessage($_LANG['POST_ERR_TEXT'], 'error'); $errors = true; }

            // Если есть ошибки, возвращаемся назад
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例6: content

function content()
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    $model = new cms_model_content();
    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) {
        cmsCore::loadClass('billing');
    }
    global $_LANG;
    $id = cmsCore::request('id', 'int', 0);
    $do = $inCore->do;
    $seolink = cmsCore::strClear(urldecode(cmsCore::request('seolink', 'html', '')));
    if (is_numeric($seolink)) {
        cmsCore::error404();
    }
    $page = cmsCore::request('page', 'int', 1);
    ///////////////////////////////////// VIEW CATEGORY ////////////////////////////////////////////////////////////////////////////////
    if ($do == 'view') {
        $cat = $inDB->getNsCategory('cms_category', $seolink);
        // если не найдена категория и мы не на главной, 404
        if (!$cat && $inCore->menuId() !== 1) {
            cmsCore::error404();
        }
        // языки
        $cat = translations::process(cmsConfig::getConfig('lang'), 'content_category', $cat);
        // Плагины
        $cat = cmsCore::callEvent('GET_CONTENT_CAT', $cat);
        // Неопубликованные показываем только админам
        if (!$cat['published'] && !$inUser->is_admin) {
            cmsCore::error404();
        }
        // Проверяем доступ к категории
        if (!$inCore->checkUserAccess('category', $cat['id'])) {
            cmsCore::addSessionMessage($_LANG['NO_PERM_FOR_VIEW_TEXT'] . '<br>' . $_LANG['NO_PERM_FOR_VIEW_RULES'], 'error');
            cmsCore::redirect('/content');
        }
        // если не корень категорий
        if ($cat['NSLevel'] > 0) {
            $inPage->setTitle($cat['pagetitle'] ? $cat['pagetitle'] : $cat['title']);
            $pagetitle = $cat['title'];
            $showdate = $cat['showdate'];
            $showcomm = $cat['showcomm'];
            $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . htmlspecialchars($cat['title']) . '" href="' . HOST . '/rss/content/' . $cat['id'] . '/feed.rss">');
        }
        // Если корневая категория
        if ($cat['NSLevel'] == 0) {
            if ($model->config['hide_root']) {
                cmsCore::error404();
            }
            $inPage->setTitle($_LANG['CATALOG_ARTICLES']);
            $pagetitle = $_LANG['CATALOG_ARTICLES'];
            $showdate = 1;
            $showcomm = 1;
        }
        // Получаем дерево категорий
        $path_list = $inDB->getNsCategoryPath('cms_category', $cat['NSLeft'], $cat['NSRight'], 'id, title, NSLevel, seolink, url');
        if ($path_list) {
            $path_list = translations::process(cmsConfig::getConfig('lang'), 'content_category', $path_list);
            foreach ($path_list as $pcat) {
                if (!$inCore->checkUserAccess('category', $pcat['id'])) {
                    cmsCore::addSessionMessage($_LANG['NO_PERM_FOR_VIEW_TEXT'] . '<br>' . $_LANG['NO_PERM_FOR_VIEW_RULES'], 'error');
                    cmsCore::redirect('/content');
                }
                $inPage->addPathway($pcat['title'], $model->getCategoryURL(null, $pcat['seolink']));
            }
        }
        // Получаем подкатегории
        $subcats_list = $model->getSubCats($cat['id']);
        // Привязанный фотоальбом
        $cat_photos = $model->getCatPhotoAlbum($cat['photoalbum']);
        // Получаем статьи
        // Редактор/администратор
        $is_editor = $cat['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd') || $inUser->is_admin;
        // Условия
        $model->whereCatIs($cat['id']);
        // Общее количество статей
        $total = $model->getArticlesCount($is_editor);
        // Сортировка и разбивка на страницы
        $inDB->orderBy($cat['orderby'], $cat['orderto']);
        $inDB->limitPage($page, $model->config['perpage']);
        // Получаем статьи
        $content_list = $total ? $model->getArticlesList(!$is_editor) : array();
        $inDB->resetConditions();
        if (!$content_list && $page > 1) {
            cmsCore::error404();
        }
        $pagebar = cmsPage::getPagebar($total, $page, $model->config['perpage'], $model->getCategoryURL(null, $cat['seolink'], 0, true));
        $template = $cat['tpl'] ? $cat['tpl'] : 'com_content_view.tpl';
        if ($cat['NSLevel'] > 0) {
            // meta description
            if ($cat['meta_desc']) {
                $meta_desc = $cat['meta_desc'];
            } elseif (mb_strlen(strip_tags($cat['description'])) >= 250) {
                $meta_desc = crop($cat['description']);
            } else {
                $meta_desc = $cat['title'];
            }
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例7: assign

        $bb_toolbar = cmsPage::getBBCodeToolbar('message', true, 'clubs', 'blog_post', $post_id);
        $smilies    = cmsPage::getSmilesPanel('message');

        $inCore->initAutoGrowText('#message');

        //показываем форму
        cmsPage::initTemplate('components', 'com_blog_edit_post')->
                assign('blog', $blog)->
                assign('pagetitle', ($do=='editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST']))->
                assign('mod', $post)->
                assign('cat_list', $cat_list)->
                assign('bb_toolbar', $bb_toolbar)->
                assign('smilies', $smilies)->
                assign('is_admin', $inUser->is_admin)->
                assign('myblog', ($is_admin || $is_moder))->
                assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'))->
                assign('autocomplete_js', $autocomplete_js)->
                display();

    }

    //Если есть запрос на сохранение
    if (cmsCore::inRequest('goadd')) {

        $error = false;

        //Получаем параметры
        $mod['title'] 	  = cmsCore::request('title', 'str');
        $mod['content']   = cmsCore::request('content', 'html');
        $mod['feel'] 	  = cmsCore::request('feel', 'str', '');
        $mod['music'] 	  = cmsCore::request('music', 'str', '');
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:31,代码来源:club_blogs.php

示例8:

     //для редактирования поста
     if ($bdo == 'editpost') {
         $inPage->addPathway($post['title'], $model->getPostURL($club['id'], $post['seolink']));
         $inPage->addPathway($_LANG['EDIT_POST']);
         $inPage->setTitle($_LANG['EDIT_POST']);
     }
     $inPage->initAutocomplete();
     $autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
     //получаем рубрики блога
     $cat_list = cmsCore::getListItems('cms_blog_cats', $post['cat_id'], 'id', 'ASC', "blog_id = '{$blog['id']}'");
     //получаем код панелей bbcode и смайлов
     $bb_toolbar = cmsPage::getBBCodeToolbar('message', true, 'clubs', 'blog_post', $post_id);
     $smilies = cmsPage::getSmilesPanel('message');
     $inCore->initAutoGrowText('#message');
     //показываем форму
     cmsPage::initTemplate('components', 'com_blog_edit_post')->assign('blog', $blog)->assign('pagetitle', $do == 'editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST'])->assign('mod', $post)->assign('cat_list', $cat_list)->assign('bb_toolbar', $bb_toolbar)->assign('smilies', $smilies)->assign('is_admin', $inUser->is_admin)->assign('myblog', $is_admin || $is_moder)->assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'))->assign('autocomplete_js', $autocomplete_js)->display('com_blog_edit_post.tpl');
 }
 //Если есть запрос на сохранение
 if (cmsCore::inRequest('goadd')) {
     $error = false;
     //Получаем параметры
     $mod['title'] = cmsCore::request('title', 'str');
     $mod['content'] = cmsCore::request('content', 'html');
     $mod['feel'] = cmsCore::request('feel', 'str', '');
     $mod['music'] = cmsCore::request('music', 'str', '');
     $mod['cat_id'] = cmsCore::request('cat_id', 'int');
     $mod['allow_who'] = cmsCore::request('allow_who', 'str', $blog['allow_who']);
     $mod['tags'] = cmsCore::request('tags', 'str', '');
     $mod['comments'] = cmsCore::request('comments', 'int', 1);
     $mod['blog_id'] = $blog['id'];
     if ($model->config['seo_user_access'] || $inUser->is_admin) {
开发者ID:deltas1,项目名称:icms1,代码行数:31,代码来源:club_blogs.php

示例9: getPublicCats

 /**
  * Возвращает категории, доступные для публикования в них
  * @return array
  */
 public function getPublicCats()
 {
     $inCore = cmsCore::getInstance();
     $inUser = cmsUser::getInstance();
     $nested_sets = $inCore->nestedSetsInit('cms_category');
     $rootid = $this->inDB->getNsRootCatId('cms_category');
     $rs_rows = $nested_sets->SelectSubNodes($rootid);
     if ($rs_rows) {
         while ($node = $this->inDB->fetch_assoc($rs_rows)) {
             if ($inUser->is_admin || cmsCore::checkUserAccess('category', $node['id']) && ($node['is_public'] || $node['modgrp_id'] && $node['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd'))) {
                 $subcats[] = $node;
             }
         }
     }
     $subcats = cmsCore::callEvent('GET_CONTENT_PUBCATS', $subcats);
     return translations::process(cmsConfig::getConfig('lang'), 'content_category', $subcats);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:21,代码来源:model.php

示例10: forum


//.........这里部分代码省略.........
        if (!$thread['is_mythread']) {
            $inDB->setFlag('cms_forum_threads', $thread['id'], 'hits', $thread['hits'] + 1);
        }
        // получаем посты
        $model->whereThreadIs($thread['id']);
        $inDB->orderBy('p.pinned', 'DESC, p.pubdate ASC');
        $inDB->limitPage($page, $model->config['pp_thread']);
        $posts = $model->getPosts();
        if (!$posts) {
            cmsCore::error404();
        }
        // SEO
        $inPage->setTitle($thread['title']);
        // meta description
        if (!$thread['description']) {
            $first_post = current($posts);
            $first_post_content = strip_tags($first_post['content_html']);
            if (mb_strlen($first_post_content) >= 100) {
                $inPage->setDescription(crop($first_post_content));
            } else {
                $inPage->setDescription($thread['title']);
            }
        } else {
            $inPage->setDescription(crop($thread['description']));
        }
        // meta keywords
        $all_post_content = '';
        foreach ($posts as $p) {
            $all_post_content .= ' ' . strip_tags($p['content_html']);
        }
        $meta_keys = cmsCore::getKeywords($all_post_content);
        $inPage->setKeywords($meta_keys ? $meta_keys : $thread['title']);
        cmsCore::initAutoGrowText('#message');
        cmsPage::initTemplate('components', 'com_forum_view_thread')->assign('forum', $pcat)->assign('forums', $model->getForums())->assign('is_subscribed', cmsUser::isSubscribed($inUser->id, 'forum', $thread['id']))->assign('thread', $thread)->assign('prev_thread', $inDB->get_fields('cms_forum_threads', "id < '{$thread['id']}' AND forum_id = '{$thread['forum_id']}'", 'id, title', 'id DESC'))->assign('next_thread', $inDB->get_fields('cms_forum_threads', "id > '{$thread['id']}' AND forum_id = '{$thread['forum_id']}'", 'id, title', 'id ASC'))->assign('posts', $posts)->assign('thread_poll', $model->getThreadPoll($thread['id']))->assign('page', $page)->assign('num', ($page - 1) * $model->config['pp_thread'] + 1)->assign('lastpage', ceil($thread['post_count'] / $model->config['pp_thread']))->assign('pagebar', cmsPage::getPagebar($thread['post_count'], $page, $model->config['pp_thread'], '/forum/thread' . $thread['id'] . '-%page%.html'))->assign('user_id', $inUser->id)->assign('do', $do)->assign('is_moder', $is_forum_moder)->assign('is_admin', $inUser->is_admin)->assign('is_can_add_post', cmsUser::isUserCan('forum/add_post'))->assign('cfg', $model->config)->assign('bb_toolbar', $inUser->id && $model->config['fast_on'] && $model->config['fast_bb'] ? cmsPage::getBBCodeToolbar('message', $model->config['img_on']) : '')->assign('smilies', $inUser->id && $model->config['fast_on'] && $model->config['fast_bb'] ? cmsPage::getSmilesPanel('message') : '')->display('com_forum_view_thread.tpl');
    }
    //============================================================================//
    //================ Новая тема, написать/редактировать пост ===================//
    //============================================================================//
    if (in_array($do, array('newthread', 'newpost', 'editpost'))) {
        if (!$inUser->id) {
            cmsUser::goToLogin();
        }
        // id первого поста в теме
        $first_post_id = false;
        // опросов по умолчанию нет
        $thread_poll = array();
        // применяется при редактировании поста
        $is_allow_attach = true;
        // ограничение по карме
        if (in_array($do, array('newthread', 'newpost'))) {
            if ($inUser->karma < $model->config['min_karma_add'] && !$inUser->is_admin) {
                cmsCore::addSessionMessage(sprintf($_LANG['ADD_KARMA_LIMIT'], cmsCore::spellCount($model->config['min_karma_add'], $_LANG['KPOINT1'], $_LANG['KPOINT2'], $_LANG['KPOINT10']), $inUser->karma), 'error');
                cmsCore::redirectBack();
            }
        }
        // новая тема
        if ($do == 'newthread') {
            // права доступа
            if (!cmsUser::isUserCan('forum/add_thread') && !$inUser->is_admin) {
                cmsPage::includeTemplateFile('special/accessdenied.php');
                return;
            }
            $forum = $model->getForum($id);
            if (!$forum) {
                cmsCore::error404();
            }
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例11: insertInlineEditor

    private function insertInlineEditor($item) {
        $this->info['type'] = 'plugin';
        
        if (!$this->config['inline']) { return $item; }
        
        if (cmsCore::c('user')->is_admin || ($item['user_id'] == cmsCore::c('user')->id) || ($item['modgrp_id'] == cmsCore::c('user')->group_id && cmsUser::isUserCan('content/autoadd')))
        {
            global $_LANG;
            
            cmsCore::c('page')->addHead('<script type="text/javascript">function ajaxSaveArticle(id){ $.post("/plugins/p_ckeditor/ajax.php", "item_id="+ id +"&content="+encodeURIComponent(CKEDITOR.instances.conEditable.getData()), function (msg){ core.alert(msg); }); }</script>');
            
            $opt = $this->getToolbarAndRPlugins();

            $item['content'] = '<div id="conEditable" contenteditable="true">'. $item['content'] .'</div><div style="text-align:right"><input type="button" onclick="ajaxSaveArticle('. $item['id'] .');" value="'. $_LANG['SAVE'] .'" class="button" /></div>';
            
            $item['content'] .= '<script type="text/javascript">$(function(){ CKEDITOR.disableAutoInline = true; CKEDITOR.config.language = "'. cmsCore::c('config')->lang .'"; CKEDITOR.config.skin = "'. $opt['skin'] .'";'. (!empty($opt['rplugins']) ? ' CKEDITOR.config.removePlugins="'. $opt['rplugins'] .'";' : '') .'  CKEDITOR.config.allowedContent=true;  CKEDITOR.config.toolbarGroups = '. $opt['tbar'] .'; CKEDITOR.inline("conEditable"); });</script>';
            
            $item['content'] .= '<style type="text/css">.cke_editable.cke_editable_inline{cursor: pointer;}.cke_editable.cke_editable_inline.cke_focus{box-shadow: inset 0px 0px 20px 3px #ddd, inset 0 0 1px #000;outline: none;cursor: text;}</style>';
        }
        
        return $item;
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:22,代码来源:plugin.php

示例12: checkAccessAddImage

 /**
  * Проверяет имеет ли пользователь право на прикрепление/удаление к статье фотографий
  * @param integer $target_id
  * @param string $target
  * @return boolean
  */
 public function checkAccessAddImage($target_id, $target) {
     if (!cmsUser::isUserCan('content/add')) {
         return false;
     }
         
     if ($target_id > 0) {
         $item = $this->getArticle($target_id);
         
         if (empty($item)) {
             return false;
         }
         
         if (!cmsCore::c('user')->is_admin && ($item['user_id'] != cmsCore::c('user')->id) && !($item['modgrp_id'] == cmsCore::c('user')->group_id)) {
             return false;
         }
     }
     
     return true;
 }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:25,代码来源:model.php

示例13: checkPublished

 public function checkPublished($cat, $is_edit = false)
 {
     // админы и модераторы добавляют всегда без модерации
     if (cmsUser::getInstance()->is_admin || $this->is_moderator_by_group) {
         return 1;
     }
     // при редактировании объявления смотрим опцию publish_after_edit
     if ($is_edit) {
         if ($this->config['publish_after_edit']) {
             return 1;
         }
     }
     // наследование от настроек компонента
     if ($cat['public'] == -1) {
         $cat['public'] = $this->config['public'];
     }
     if ($cat['public'] == 2 && cmsUser::isUserCan('board/autoadd')) {
         return 1;
     }
     return 0;
 }
开发者ID:deltas1,项目名称:icms1,代码行数:21,代码来源:model.php

示例14: define

<?php
define('PATH', $_SERVER['DOCUMENT_ROOT']);
include(PATH .'/core/ajax/ajax_core.php');

if (!$inUser->id) { cmsCore::error404(); }

$item = $inCore->m('content')->getArticle(cmsCore::request('item_id', 'int', 0));
$config = $inCore->loadPluginConfig('p_ckeditor');

if ($config['inline'] != 1) { cmsCore::error404(); }

if (!empty($item) && ($inUser->is_admin || ($item['user_id'] == $inUser->id) || ($item['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd'))))
{
    $content = cmsCore::badTagClear(cmsCore::request('content', 'html', ''));
    
    if (mb_strlen(strip_tags($content)) < 10) {
        cmsCore::halt($_LANG['REQ_CONTENT']);
    } else {
        $inDB->query("UPDATE cms_content SET content='". $inDB->escape_string($content) ."' WHERE id=". $item['id']);
    }
    
    cmsCore::halt($_LANG['ARTICLE_SAVE']);
} else {
    cmsCore::halt($_LANG['404']);
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:25,代码来源:ajax.php

示例15: blog


//.........这里部分代码省略.........
                $inPage->setTitle($_LANG['NEW_POST']);
                $post = cmsUser::sessionGet('mod');
                if ($post) {
                    cmsUser::sessionDel('mod');
                } else {
                    $post['cat_id'] = $cat_id;
                    $post['comments'] = 1;
                }
            }
            //для редактирования поста
            if ($do == 'editpost') {
                $inPage->addPathway($post['title'], $model->getPostURL('', $post['seolink']));
                $inPage->addPathway($_LANG['EDIT_POST']);
                $inPage->setTitle($_LANG['EDIT_POST']);
            }
            $inPage->initAutocomplete();
            $autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
            //получаем рубрики блога
            $cat_list = cmsCore::getListItems('cms_blog_cats', $post['cat_id'], 'id', 'ASC', "blog_id = '{$blog['id']}'");
            //получаем код панелей bbcode и смайлов
            $bb_toolbar = cmsPage::getBBCodeToolbar('message', $model->config['img_on'], 'blogs', 'post', $post_id);
            $smilies = cmsPage::getSmilesPanel('message');
            $inCore->initAutoGrowText('#message');
            //показываем форму
            $smarty = $inCore->initSmarty('components', 'com_blog_edit_post.tpl');
            $smarty->assign('blog', $blog);
            $smarty->assign('pagetitle', $do == 'editpost' ? $_LANG['EDIT_POST'] : $_LANG['NEW_POST']);
            $smarty->assign('mod', $post);
            $smarty->assign('cat_list', $cat_list);
            $smarty->assign('bb_toolbar', $bb_toolbar);
            $smarty->assign('smilies', $smilies);
            $smarty->assign('is_admin', $inUser->is_admin);
            $smarty->assign('myblog', $myblog);
            $smarty->assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'));
            $smarty->assign('autocomplete_js', $autocomplete_js);
            $smarty->display('com_blog_edit_post.tpl');
        }
        //Если есть запрос на сохранение
        if (cmsCore::inRequest('goadd')) {
            $error = false;
            //Получаем параметры
            $mod['title'] = cmsCore::request('title', 'str');
            $mod['content'] = cmsCore::request('content', 'html');
            $mod['feel'] = cmsCore::request('feel', 'str', '');
            $mod['music'] = cmsCore::request('music', 'str', '');
            $mod['cat_id'] = cmsCore::request('cat_id', 'int');
            $mod['allow_who'] = cmsCore::request('allow_who', 'str', $blog['allow_who']);
            $mod['tags'] = cmsCore::request('tags', 'str', '');
            $mod['comments'] = cmsCore::request('comments', 'int', 1);
            $mod['published'] = $myblog || !$blog['premod'] ? 1 : 0;
            $mod['blog_id'] = $blog['id'];
            //Проверяем их
            if (mb_strlen($mod['title']) < 2) {
                cmsCore::addSessionMessage($_LANG['POST_ERR_TITLE'], 'error');
                $errors = true;
            }
            if (mb_strlen($mod['content']) < 5) {
                cmsCore::addSessionMessage($_LANG['POST_ERR_TEXT'], 'error');
                $errors = true;
            }
            // Если есть ошибки, возвращаемся назад
            if ($errors) {
                cmsUser::sessionPut('mod', $mod);
                cmsCore::redirectBack();
            }
            //Если нет ошибок
开发者ID:4uva4ek,项目名称:svato,代码行数:67,代码来源:frontend.php


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