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


PHP cmsCore::checkUserAccess方法代码示例

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


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

示例1: rss_content

function rss_content($item_id, $cfg) {
    if (!cmsCore::getInstance()->isComponentEnable('content')) { return false; }
    
    global $_LANG;

    $channel = array();
    $items   = array();

    if ($item_id) {
        $cat = cmsCore::c('db')->getNsCategory('cms_category', (int)$item_id);
        if (!$cat) { return false; }

        $cat = cmsCore::callEvent('GET_CONTENT_CAT', $cat);

        if (!$cat['published']) { return false; }

        if (!cmsCore::checkUserAccess('category', $cat['id']) ) {
            return false;
        }

        cmsCore::m('content')->whereThisAndNestedCats($cat['NSLeft'], $cat['NSRight']);

        $channel['title'] = $cat['title'] ;
        $channel['description'] = $cat['description'];
        $channel['link'] = HOST . cmsCore::m('content')->getCategoryURL(0, $cat['seolink']);
    } else {
        $channel['title'] = $_LANG['NEW_MATERIALS'];
        $channel['description'] = $_LANG['LAST_ARTICLES_NEWS'];
        $channel['link'] = HOST .'/content';
    }

    cmsCore::c('db')->where('con.showlatest = 1');

    cmsCore::c('db')->orderBy('con.pubdate', 'DESC');
    cmsCore::c('db')->limit($cfg['maxitems']);

    $content = cmsCore::m('content')->getArticlesList();

    if ($content) {
        foreach($content as $con){
            $con['link']     = HOST . $con['url'];
            $con['comments'] = $con['link'].'#c';
            $con['category'] = $con['cat_title'];

            if ($con['image']) {
                $con['size']  = round(filesize(PATH . $con['image']));
                $con['image'] = HOST . $con['image'];
            }

            $items[] = $con;
        }
    }

    return array(
        'channel' => $channel,
        'items' => $items
    );
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:58,代码来源:prss.php

示例2: 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

示例3: content

function content() {
    $inCore = cmsCore::getInstance();

    if (!defined('IS_BILLING')) {
        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 = cmsCore::c('db')->getNsCategory('cms_category', $seolink);

    // если не найдена категория и мы не на главной, 404
    if (!$cat && $inCore->menuId() !== 1) { cmsCore::error404(); }

    // Плагины
    $cat = cmsCore::callEvent('GET_CONTENT_CAT', $cat);

    // Неопубликованные показываем только админам
    if (!$cat['published'] && !cmsCore::c('user')->is_admin) { cmsCore::error404(); }

    // Проверяем доступ к категории
    if (!cmsCore::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) {
        cmsCore::c('page')->setTitle(empty($cat['pagetitle']) ? $cat['title'] : $cat['pagetitle']);
        
        // meta description
        if (!empty($cat['meta_desc'])) {
            $meta_desc = $cat['meta_desc'];
        } else if (mb_strlen(strip_tags($cat['description']))>=250) {
            $meta_desc = crop($cat['description']);
        } else {
            $meta_desc = $cat['title'];
        }
        
        cmsCore::c('page')->setDescription($meta_desc);

        // meta keywords
        if (!empty($cat['meta_keys'])) {
            $meta_keys = $cat['meta_keys'];
        } else if ($content_list) {
            foreach($content_list as $c) {
                $k[] = $c['title'];
            }
            $meta_keys = implode(', ', $k);
        } else {
            $meta_keys = $cat['title'];
        }
        
        cmsCore::c('page')->setKeywords($meta_keys);
        
        $pagetitle = $cat['title'];
        $showdate  = $cat['showdate'];
        $showcomm  = $cat['showcomm'];
        cmsCore::c('page')->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(); }
        
        cmsCore::c('page')->setTitle(empty(cmsCore::m('content')->config['pagetitle']) ? $_LANG['CATALOG_ARTICLES'] : cmsCore::m('content')->config['pagetitle']);
        if (!empty(cmsCore::m('content')->config['meta_keys'])) {
            cmsCore::c('page')->setKeywords(cmsCore::m('content')->config['meta_keys']);
        }
        if (!empty(cmsCore::m('content')->config['meta_desc'])) {
            cmsCore::c('page')->setDescription(cmsCore::m('content')->config['meta_keys']);
        }

        $pagetitle = $_LANG['CATALOG_ARTICLES'];
        $showdate  = 1;
        $showcomm  = 1;
    }

    // Получаем дерево категорий
    $path_list = cmsCore::c('db')->getNsCategoryPath('cms_category', $cat['NSLeft'], $cat['NSRight'], 'id, title, NSLevel, seolink, url');

    if ($path_list) {
        foreach ($path_list as $pcat) {
            if (!cmsCore::checkUserAccess('category', $pcat['id'])) {
                cmsCore::addSessionMessage($_LANG['NO_PERM_FOR_VIEW_TEXT'].'<br>'.$_LANG['NO_PERM_FOR_VIEW_RULES'], 'error');
                cmsCore::redirect('/content');
            }
            cmsCore::c('page')->addPathway($pcat['title'], cmsCore::m('content')->getCategoryURL(null, $pcat['seolink']));
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:frontend.php

示例4: getPublicCats

    /**
     * Возвращает категории, доступные для публикования в них
     * @return array
     */
    public function getPublicCats() {
        $inCore = cmsCore::getInstance();

        $nested_sets = $inCore->nestedSetsInit('cms_category');
        $rootid      = cmsCore::c('db')->getNsRootCatId('cms_category');

        $rs_rows = $nested_sets->SelectSubNodes($rootid);

        if ($rs_rows) {
            while ($node = cmsCore::c('db')->fetch_assoc($rs_rows)) {
                if (cmsCore::c('user')->is_admin || (cmsCore::checkUserAccess('afisha_category', $node['id']) &&
                  ($node['is_public'] ||
                  ($node['modgrp_id'] && $node['modgrp_id'] == cmsCore::c('user')->group_id && cmsUser::isUserCan('content/autoadd'))))) {
                    $subcats[] = $node;
                }
            }
        }

        $subcats = cmsCore::callEvent('GET_CONTENT_PUBCATS', $subcats);

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

示例5: generateMap

    public function generateMap() {
        $gen_map = parent::generateMap();
        
        if ($gen_map === false) { return; }
        
        $today = date('Y-m-d H:i:s');
        $is_end = false;
        
        // Заносим в карту категории
        $results = cmsCore::c('db')->query("SELECT * FROM cms_category WHERE parent_id != 0 AND NSDiffer = '' AND published = 1");

        if (cmsCore::c('db')->num_rows($results)) {
            while ($cat = cmsCore::c('db')->fetch_assoc($results)) {
                if (!cmsCore::checkUserAccess('category', $cat['id'])) {
                    continue;
                }
                
                $last_date = cmsCore::c('db')->get_field('cms_content', "category_id='". $cat['id'] ."' ORDER BY pubdate DESC", 'pubdate');
                $last_date = explode(' ', !empty($last_date) ? $last_date : $cat['pubdate']);

                $this->writeMapItem(array(
                    'loc' => cmsCore::c('config')->host .'/'. (cmsCore::c('config')->com_without_name_in_url != 'content' ? 'content/' : '') . $cat['seolink'],
                    'changefreq' => 'daily',
                    'priority' => '0.8',
                    'lastmod' => $last_date[0]
                ));
            }
        }
        
        $article_nums = 0;
        
        // Заносим в карту статьи
        while($is_end === false) {
            $results = cmsCore::c('db')->query("SELECT id, seolink, pubdate FROM cms_content WHERE published = 1 AND pubdate <= '". $today ."' ORDER BY pubdate ASC LIMIT ". $article_nums .', 1000');
            
            if (cmsCore::c('db')->num_rows($results)) {
                while ($article = cmsCore::c('db')->fetch_assoc($results)) {
                    if (cmsCore::checkUserAccess('material', $article['id'])) {
                        $last_date = explode(' ', $article['pubdate']);

                        $this->writeMapItem(array(
                            'loc' => cmsCore::c('config')->host .'/'. (cmsCore::c('config')->com_without_name_in_url != 'content' ? 'content/' : '') . $article['seolink'] .'.html',
                            'changefreq' => 'weekly',
                            'priority' => '0.7',
                            'lastmod' => $last_date[0]
                        ));
                    }
                    
                    $article_nums++;
                }
                
            } else {
                $is_end = true;
            }
        }
        
        $this->closeFile();
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:58,代码来源:sitemap.php

示例6: generateMap

    public function generateMap() {
        $gen_map = parent::generateMap();
        
        if ($gen_map === false) {
            return false;
        } else {
            $this->gOpenFile();
        }

        $is_end = false;
        $access_cats = array();
        
        // Заносим в карту категории
        $results = cmsCore::c('db')->query("SELECT * FROM cms_video_category WHERE parent_id != 0 AND published = 1 ORDER BY id ASC");

        if (cmsCore::c('db')->num_rows($results)) {
            while ($cat = cmsCore::c('db')->fetch_assoc($results)) {
                if (!cmsCore::checkUserAccess('video', $cat['id'])) {
                    $access_cats[] = $cat['id'];
                    continue;
                }
                
                $last_date = cmsCore::c('db')->get_field('cms_video_movie', "cat_id='". $cat['id'] ."' ORDER BY pubdate DESC", 'pubdate');
                $last_date = explode(' ', !empty($last_date) ? $last_date : $cat['pubdate']);

                $this->writeMapItem(array(
                    'target' => 'video-cat',
                    'loc' => HOST .'/video/'. ($this->cfg['is_seo_url'] ? $cat['seolink'] : $cat['id']),
                    'changefreq' => 'daily',
                    'priority' => '0.8',
                    'lastmod' => $last_date[0]
                ));
            }
        }
        
        // Заносим в карту рубрики
        $results = cmsCore::c('db')->query("SELECT * FROM cms_video_rubric WHERE published = 1 ORDER BY id ASC");

        if (cmsCore::c('db')->num_rows($results)) {
            while ($cat = cmsCore::c('db')->fetch_assoc($results)) {
                $last_date = cmsCore::c('db')->get_field('cms_video_movie', "rubric_id='". $cat['id'] ."' ORDER BY pubdate DESC", 'pubdate');
                $last_date = explode(' ', !empty($last_date) ? $last_date : $cat['pubdate']);

                $this->writeMapItem(array(
                    'target' => 'video-rubric',
                    'loc' => HOST .'/video/rubrics/'. ($this->cfg['is_seo_url'] ? $cat['seolink'] : 'view'. $cat['id']) .'.html',
                    'changefreq' => 'daily',
                    'priority' => '0.8',
                    'lastmod' => $last_date[0]
                ));
            }
        }
        
        $item_nums = 0;
        
        // Заносим в карту видео материалы
        while($is_end === false) {
            $results = cmsCore::c('db')->query("SELECT m.*, cat.title as cat_title, cat.seolink as cat_seolink FROM cms_video_movie m INNER JOIN cms_video_category cat ON cat.id=m.cat_id WHERE m.published=1 AND cat.published=1 ORDER BY id ASC LIMIT ". $item_nums .', 1000');
            
            if (cmsCore::c('db')->num_rows($results)) {
                while ($item = cmsCore::c('db')->fetch_assoc($results)) {
                    if (in_array($cat['id'], $access_cats)) {
                        continue;
                    }
                    
                    if ($this->cfg['is_seo_url']) {
                        if ($this->cfg['short_seo_url']) {
                            $item['seolink'] = $item['seolink'];
                        } else {
                            $item['seolink'] = $item['cat_seolink'] .'/'. $item['seolink'];
                        }
                    } else {
                        $item['seolink'] = 'movie'. $item['id'];
                    }
                    
                    $last_date = explode(' ', $item['pubdate']);
                    
                    $item['loc'] = HOST .'/video/'. $item['seolink'] .'.html';
                    $item['changefreq'] = 'weekly';
                    $item['priority']   = '0.7';
                    $item['lastmod'] = $last_date[0];
                    $item['cat_link'] = HOST .'/video/'. ($this->cfg['is_seo_url'] ? $item['cat_seolink'] : $item['cat_id']);

                    $this->writeMapItem($item);
                    
                    $item_nums++;
                }
            } else {
                $is_end = true;
            }
        }
        
        $this->closeFile();
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:94,代码来源:video.sitemap.php


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