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


PHP cmsUser::isSubscribed方法代码示例

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


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

示例1: comments

function comments($target = '', $target_id = 0, $labels = array())
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    cmsCore::loadModel('comments');
    $model = new cms_model_comments($labels);
    // Проверяем включени ли компонент
    if (!$inCore->isComponentEnable('comments')) {
        return false;
    }
    // Инициализируем права доступа для группы текущего пользователя
    $model->initAccess();
    global $_LANG;
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $id = cmsCore::request('id', 'int', 0);
    $login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
    $inPage->addHeadJS('components/comments/js/comments.js');
    $inPage->addHeadJsLang(array('EDIT_COMMENT', 'CONFIRM_DEL_COMMENT', 'COMMENT_IN_LINK'));
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view' && !$target && !$target_id) {
        if (!$login) {
            $myprofile = false;
            $page_title = $inCore->getComponentTitle();
            $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . $_LANG['COMMENTS'] . '" href="' . HOST . '/rss/comments/all/feed.rss">');
        } else {
            // проверяем что пользователь есть
            $user = cmsUser::getShortUserData($login);
            if (!$user) {
                cmsCore::error404();
            }
            // Мои комментарии
            $myprofile = $inUser->id == $user['id'];
            $page_title = $_LANG['COMMENTS'] . ' - ' . $user['nickname'];
            $inPage->addPathway($user['nickname'], cmsUser::getProfileURL($user['login']));
            // Добавляем условие в выборку
            $model->whereUserIs($user['id']);
        }
        $inPage->setTitle($page_title);
        $inPage->addPathway($page_title);
        $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $page_title);
        $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $page_title);
        // флаг модератора
        $is_moder = $inUser->is_admin || $model->is_can_moderate;
        // Не админам только открытые комментарии
        if (!($is_moder || $myprofile)) {
            $model->whereIsShow();
        }
        // Общее количество комментариев
        $total = $model->getCommentsCount(!($is_moder || $myprofile));
        // Сортировка и разбивка на страницы
        $inDB->orderBy('c.pubdate', 'DESC');
        $inDB->limitPage($page, $model->config['perpage']);
        // Сами комментарии
        $comments = $total ? $model->getComments(!($is_moder || $myprofile)) : array();
        $inDB->resetConditions();
        if (!$comments && $page > 1) {
            cmsCore::error404();
        }
        // пагинация
        if (!$login) {
            $pagebar = cmsPage::getPagebar($total, $page, $model->config['perpage'], '/comments/page-%page%');
        } else {
            $pagebar = cmsPage::getPagebar($total, $page, $model->config['perpage'], 'javascript:centerLink(\'/comments/by_user_' . $user['login'] . '/page-%page%\')');
        }
        // Отдаем в шаблон
        cmsPage::initTemplate('components', 'com_comments_list_all')->assign('comments_count', $total)->assign('comments', $comments)->assign('pagebar', $pagebar)->assign('is_user', $inUser->id)->assign('page_title', $page_title)->assign('cfg', $model->config)->assign('is_admin', $is_moder)->display('com_comments_list_all.tpl');
    }
    //========================================================================================================================//
    //========================================================================================================================//
    if (!in_array($do, array('add', 'edit', 'delete')) && $target && $target_id) {
        if (!$model->config['cmm_ajax']) {
            $model->whereTargetIs($target, $target_id);
            $inDB->orderBy('c.pubdate', 'ASC');
            $comments = cmsCore::callEvent('BEFORE_SHOW_COMMENTS', $model->getComments(!($inUser->is_admin || $model->is_can_moderate), true));
            $total = count($comments);
            ob_start();
            cmsPage::initTemplate('components', 'com_comments_list')->assign('comments_count', $total)->assign('comments', $comments)->assign('user_can_moderate', $model->is_can_moderate)->assign('user_can_delete', $model->is_can_delete)->assign('user_can_add', $model->is_can_add)->assign('is_admin', $inUser->is_admin)->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('labels', $model->labels)->assign('target', $target)->assign('target_id', $target_id)->display('com_comments_list.tpl');
            $html = ob_get_clean();
        } else {
            $model->whereTargetIs($target, $target_id);
            $total = $model->getCommentsCount(!($inUser->is_admin || $model->is_can_moderate));
            $inDB->resetConditions();
        }
        cmsPage::initTemplate('components', 'com_comments_view')->assign('comments_count', $total)->assign('target', $target)->assign('target_id', $target_id)->assign('is_admin', $inUser->is_admin)->assign('labels', $model->labels)->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('user_can_add', $model->is_can_add)->assign('html', isset($html) ? $html : '')->assign('add_comment_js', "addComment('" . $target . "', '" . $target_id . "', 0)")->assign('user_subscribed', cmsUser::isSubscribed($inUser->id, $target, $target_id))->display('com_comments_view.tpl');
    }
    //========================================================================================================================//
    //========================================================================================================================//
    // Добавление комментария, форма добавления в addform.php
    if ($do == 'add') {
        // Только аякс
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        // Очищаем буфер
        ob_end_clean();
        // Добавлять могут только админы и те, кому разрешено в настройках группы
//.........这里部分代码省略.........
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:frontend.php

示例2: assign

/* ==================================================================================================== */
/* ==================================================================================================== */

	$karma_need     = $model->config['min_karma_add'];
	$can_by_karma   = (($model->config['min_karma'] && $inUser->karma>=$karma_need) || $inUser->is_admin);
	$need_captcha   = $model->config['regcap'] ? true : ($inUser->id ? false : true);

	cmsPage::initTemplate('components', 'com_comments_add')->
            assign('user_can_add', $model->is_can_add)->
            assign('is_can_bbcode', $model->is_can_bbcode)->
            assign('do', $do)->
            assign('comment', isset($comment) ? $comment : array())->
            assign('is_user', $inUser->id)->
            assign('cfg', $model->config)->
            assign('target', $target)->
            assign('target_id', $target_id)->
            assign('parent_id', $parent_id)->
            assign('user_subscribed', cmsUser::isSubscribed($inUser->id, $target, $target_id))->
            assign('can_by_karma', $can_by_karma)->
            assign('karma_need', $karma_need)->
            assign('karma_has', $inUser->karma)->
            assign('need_captcha', $need_captcha)->
            assign('bb_toolbar', isset($bb_toolbar) ? $bb_toolbar :'')->
            assign('smilies', isset($smilies) ? $smilies : '')->
            assign('notice', isset($notice) ? $notice : '')->
            display();

	cmsCore::halt();

?>
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:30,代码来源:addform.php

示例3: str_replace

$inPage->addHeadJS('includes/jquery/jquery.form.js');
/* ==================================================================================================== */
/* ==================================================================================================== */
if ($do == 'edit') {
    // получаем комментарий
    $comment = $model->getComment($comment_id);
    if (!$comment) {
        cmsCore::halt();
    }
    $is_author = $comment['user_id'] == $inUser->id;
    // редактировать могут авторы (если время редактирования есть)
    // модераторы и администраторы
    if (!$model->is_can_moderate && !$inUser->is_admin && !($is_author && $comment['is_editable'])) {
        cmsCore::halt();
    }
    // Для авторов показываем сколько осталось для редактирования
    if ($is_author && $comment['is_editable'] && !$inUser->is_admin && !$model->is_can_moderate) {
        $notice = str_replace('{min}', cmsCore::spellCount($comment['is_editable'], $_LANG['MINUTE1'], $_LANG['MINUTE2'], $_LANG['MINUTE10']), $_LANG['EDIT_INFO']);
    }
}
if ($model->is_can_bbcode) {
    $bb_toolbar = cmsPage::getBBCodeToolbar('content', true, 'comments', 'comment', $comment_id);
    $smilies = cmsPage::getSmilesPanel('content');
}
/* ==================================================================================================== */
/* ==================================================================================================== */
$karma_need = $model->config['min_karma_add'];
$can_by_karma = $model->config['min_karma'] && $inUser->karma >= $karma_need || $inUser->is_admin;
$need_captcha = $model->config['regcap'] ? true : ($inUser->id ? false : true);
cmsPage::initTemplate('components', 'com_comments_add')->assign('user_can_add', $model->is_can_add)->assign('is_can_bbcode', $model->is_can_bbcode)->assign('do', $do)->assign('comment', isset($comment) ? $comment : array())->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('target', $target)->assign('target_id', $target_id)->assign('parent_id', $parent_id)->assign('user_subscribed', cmsUser::isSubscribed($inUser->id, $target, $target_id))->assign('can_by_karma', $can_by_karma)->assign('karma_need', $karma_need)->assign('karma_has', $inUser->karma)->assign('need_captcha', $need_captcha)->assign('bb_toolbar', isset($bb_toolbar) ? $bb_toolbar : '')->assign('smilies', isset($smilies) ? $smilies : '')->assign('notice', isset($notice) ? $notice : '')->display('com_comments_add.tpl');
cmsCore::halt();
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:addform.php

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


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