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


PHP cmsCore::isAjax方法代码示例

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


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

示例1: polls

function polls()
{
    $model = new cms_model_polls();
    global $_LANG;
    $do = cmsCore::getInstance()->do;
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view') {
        $answer = cmsCore::request('answer', 'str', '');
        $poll_id = cmsCore::request('poll_id', 'int');
        if (!$answer || !$poll_id) {
            if (cmsCore::isAjax()) {
                cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['SELECT_THE_OPTION']));
            } else {
                cmsCore::error404();
            }
        }
        $poll = $model->getPoll($poll_id);
        if (!$poll) {
            cmsCore::jsonOutput(array('error' => true, 'text' => ''));
        }
        if ($model->isUserVoted($poll_id)) {
            cmsCore::jsonOutput(array('error' => true, 'text' => ''));
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::halt();
        }
        $model->votePoll($poll, $answer);
        cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['VOTE_ACCEPTED']));
    }
}
开发者ID:4uva4ek,项目名称:svato,代码行数:31,代码来源:frontend.php

示例2: subscribes

function subscribes(){

    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();

    $do = $inCore->do;

//========================================================================================================================//
//========================================================================================================================//
    if ($do=='view'){

        $subscribe  = cmsCore::request('subscribe', 'int', 0);
        $target     = cmsCore::request('target', 'str', '');
        $target_id  = cmsCore::request('target_id', 'int', 0);

        if (!$target_id || !$target){
            cmsCore::error404();
        }

        if ($inUser->id){
            cmsUser::subscribe($inUser->id,  $target, $target_id, $subscribe);
        }

        if(cmsCore::isAjax()){
            cmsCore::jsonOutput(array('subscribe'=>$subscribe));
        } else {
            cmsCore::redirectBack();
        }

    }

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

示例3: __construct

 public function __construct(array $options = array())
 {
     parent::__construct($options);
     $this->assign('is_admin', cmsCore::c('user')->is_admin);
     $this->assign('user_id', cmsCore::c('user')->id);
     $this->assign('is_ajax', cmsCore::isAjax());
     $this->assign('is_auth', cmsCore::c('user')->id);
     $this->compile_dir = PATH . '/cache';
 }
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:9,代码来源:smartyTpl.php

示例4: display

    /**
     * Показывает файл шаблона
     * параметр $tpl_file оставлен для совместимости
     */
    public function display($tpl_file=false){
        global $_LANG;
        
        $is_ajax = cmsCore::isAjax();
        $user_id = cmsCore::c('user')->id;
        $is_admin = cmsCore::c('user')->is_admin;
        
        extract($this->tpl_vars);

        include($this->tpl_folder .'/'. $this->tpl_file);
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:15,代码来源:phpTpl.php

示例5: loadSmarty

 private function loadSmarty()
 {
     if (isset(self::$i_smarty)) {
         return self::$i_smarty;
     }
     cmsCore::includeFile('/includes/smarty/libs/Smarty.class.php');
     $smarty = new Smarty();
     $smarty->setCompileDir(PATH . '/cache/');
     $smarty->setCacheDir(PATH . '/cache/');
     $smarty->assign('is_ajax', cmsCore::isAjax());
     $smarty->assign('is_auth', cmsUser::getInstance()->id);
     self::$i_smarty = $smarty;
     return $smarty;
 }
开发者ID:r2git,项目名称:icms1,代码行数:14,代码来源:smartyTpl.php

示例6: loadSmarty

 private function loadSmarty()
 {
     if (isset(self::$i_smarty)) {
         return self::$i_smarty;
     }
     cmsCore::includeFile('/includes/smarty/libs/Smarty.class.php');
     $smarty = new Smarty();
     $smarty->compile_dir = PATH . '/cache';
     $smarty->register_function('wysiwyg', 'cmsSmartyWysiwyg');
     $smarty->register_function('profile_url', 'cmsSmartyProfileURL');
     $smarty->register_function('component', 'cmsSmartyCurrentComponent');
     $smarty->register_function('template', 'cmsSmartyCurrentTemplate');
     $smarty->register_function('add_js', 'cmsSmartyAddJS');
     $smarty->register_function('add_css', 'cmsSmartyAddCSS');
     $smarty->register_function('comments', 'cmsSmartyComments');
     $smarty->assign('is_ajax', cmsCore::isAjax());
     self::$i_smarty = $smarty;
     return $smarty;
 }
开发者ID:vicktorwork,项目名称:cms1,代码行数:19,代码来源:smartyTpl.php

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

示例8: clubs

function clubs() {
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB   = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();

    global $_LANG;

    $model = new cms_model_clubs();

    $inPhoto = $model->initPhoto();

    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) { cmsCore::loadClass('billing'); }

	// js только авторизованным
	if($inUser->id){
		$inPage->addHeadJS('components/clubs/js/clubs.js');
	}

	$pagetitle = $inCore->getComponentTitle();

	$id   = cmsCore::request('id', 'int', 0);
	$do   = $inCore->do;
	$page = cmsCore::request('page', 'int', 1);

	$inPage->setTitle($pagetitle);
        $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $pagetitle);
        $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $pagetitle);
	$inPage->addPathway($pagetitle, '/clubs');
    $inPage->addHeadJsLang(array('NO_PUBLISH','EDIT_PHOTO','YOU_REALLY_DELETE_PHOTO','YOU_REALLY_DELETE_ALBUM','RENAME_ALBUM','ALBUM_TITLE','ADD_PHOTOALBUM','REALY_EXIT_FROM_CLUB','JOINING_CLUB','SEND_MESSAGE','CREATE','CREATE_CLUB','SEND_INVITE_CLUB','YOU_NO_SELECT_USER'));

//////////////////////// КЛУБЫ ПОЛЬЗОВАТЕЛЯ/////////////////////////////////////
if ($do == 'user_clubs') {
    if (!cmsCore::isAjax()) { return false; }

    $inPage->displayLangJS(array('CREATE','CREATE_CLUB'));

    $user_id = cmsCore::request('user_id', 'int', $inUser->id);

    $user = cmsUser::getShortUserData($user_id);
    if (!$user) { return false; }

    // получаем клубы, в которых пользователь админ
    $model->whereAdminIs($user['id']);
   	$inDB->orderBy('c.pubdate', 'DESC');
    $clubs = $model->getClubs();

    // получаем клубы, в которых состоит пользователь
    $inDB->addSelect('uc.role');
    $inDB->addJoin("INNER JOIN cms_user_clubs uc ON uc.club_id = c.id AND uc.user_id = '{$user['id']}'");
   	$inDB->orderBy('uc.role', 'DESC, uc.pubdate DESC');
    $inclubs = $model->getClubs();

	cmsPage::initTemplate('components', 'com_clubs_user')->
            assign('can_create', (($inUser->id == $user['id']) && ($model->config['cancreate'] || $inUser->is_admin)))->
            assign('clubs', array_merge($clubs, $inclubs))->
            assign('user', $user)->
            assign('my_profile', $user['id'] == $inUser->id)->
            display();

}
//////////////////////// ВСЕ КЛУБЫ /////////////////////////////////////////////
if ($do=='view'){

	$inDB->orderBy('is_vip', 'DESC, rating DESC');
	$inDB->limitPage($page, $model->config['perpage']);

	$total = $model->getClubsCount();

        $clubs = $model->getClubs();
	if (!$clubs && $page > 1) { return false; }
        
        if ($page > 1) {
            foreach ($clubs as $c) {
                $keys[] = $c['title'];
            }
            $inPage->setKeywords(implode(',', $keys));
        }

	cmsPage::initTemplate('components', 'com_clubs_view')->
            assign('pagetitle', $pagetitle)->
            assign('can_create', ($inUser->id && $model->config['cancreate'] || $inUser->is_admin))->
            assign('clubs', $clubs)->
            assign('total', $total)->
            assign('pagination', cmsPage::getPagebar($total, $page, $model->config['perpage'], '/clubs/page-%page%'))->
            display();

}
/////////////////////// ПРОСМОТР КЛУБА /////////////////////////////////////////
if ($do=='club'){
    $club = $model->getClub($id);
    if (!$club) { return false; }

    if (!$club['published'] && !$inUser->is_admin) { return false; }

    $inPage->setTitle($club['pagetitle'] ? $club['pagetitle'] : $club['title']);
    $inPage->setKeywords($club['meta_keys'] ? $club['meta_keys'] : $club['title']);
    if (!$club['meta_desc']) {
        if ($club['description']) {
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:frontend.php

示例9: insert_captcha

 private function insert_captcha() {
     if (!cmsCore::isAjax()) {
         cmsCore::c('page')->addHeadJS('https://www.google.com/recaptcha/api.js?hl='. $this->config['rpc_lang']);
     } else {
         cmsCore::c('page')->addHead('<script type="text/javascript">if (!document.getElementById("rescript")) { var rescript = document.createElement("script"); rescript.src = "https://www.google.com/recaptcha/api.js?hl='. $this->config['rpc_lang'] .'"; rescript.id = "rescript"; document.documentElement.children[0].appendChild(rescript); }</script>');
     }
     
     return cmsPage::initTemplate('plugins', 'p_recaptcha')->
             assign('config', $this->config)->
             assign('captcha_id', $this->getCaptchaId())->
             fetch();
 }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:12,代码来源:plugin.php

示例10: header

<?php

header('Content-Type: text/html; charset=utf-8');
header('X-Frame-Options: DENY');
session_start();
define("VALID_CMS", 1);
define("VALID_CMS_ADMIN", 1);
define('PATH', $_SERVER['DOCUMENT_ROOT']);
require PATH . '/core/cms.php';
require PATH . '/admin/includes/cp.php';
$inCore = cmsCore::getInstance(false, true);
cmsCore::loadClass('page');
cmsCore::loadClass('user');
cmsCore::loadClass('actions');
if (!cmsCore::c('user')->update() || !cmsCore::isAjax()) {
    cmsCore::error404();
}
if (!cmsCore::c('user')->is_admin) {
    cmsCore::halt($_LANG['ACCESS_DENIED']);
}
cmsCore::c('actions')->showTargets(true);
$total = cmsCore::c('actions')->getCountActions();
$page = cmsCore::request('page', 'int', 1);
cmsCore::c('db')->limitPage($page, 10);
cmsCore::c('page')->initTemplate('components', 'actions_list')->assign('actions', cmsCore::c('actions')->getActionsLog())->assign('pagebar', cmsPage::getPagebar($total, $page, 10, '#" onclick="$.post(\'/admin/ajax/getActions.php\', \'page=%page%\', function(m){ $(\'#actions\').html(m); }); return false'))->display();
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:25,代码来源:getActions.php

示例11:

    $is_admin  = $inUser->is_admin || ($inUser->id == $club['admin_id']);
    $is_moder  = $model->checkUserRightsInClub('moderator');

    if (!$is_admin && !$is_moder) { cmsCore::halt(); }

	if(!cmsUser::checkCsrfToken()) { cmsCore::halt(); }

	$inBlog->deleteBlogCategory($cat['id']);

	cmsCore::addSessionMessage($_LANG['CAT_IS_DELETED'], 'success');

    cmsCore::jsonOutput(array('error' => false, 'redirect'  => $model->getBlogURL($club['id'])));
}
///////////////////////// ПУБЛИКАЦИЯ ПОСТА /////////////////////////////////////
if ($bdo == 'publishpost'){
	if (!cmsCore::isAjax() || !$inUser->id) { return false; }

	$post = $inBlog->getPost($post_id);
	if (!$post){ cmsCore::halt(); }

	$blog = $inBlog->getBlog($post['blog_id']);
	if (!$blog) { cmsCore::halt(); }

	$club = $model->getClub($blog['user_id']);
	if(!$club) { cmsCore::halt(); }

	if(!$club['enabled_blogs']){ cmsCore::halt(); }

	$model->initClubMembers($club['id']);

    $is_admin  = $inUser->is_admin || ($inUser->id == $club['admin_id']);
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:31,代码来源:club_blogs.php

示例12:

    $model->initClubMembers($club['id']);
    $is_admin = $inUser->is_admin || $inUser->id == $club['admin_id'];
    $is_moder = $model->checkUserRightsInClub('moderator');
    if (!$is_admin && !$is_moder) {
        cmsCore::halt();
    }
    if (!cmsUser::checkCsrfToken()) {
        cmsCore::halt();
    }
    $inBlog->deleteBlogCategory($cat['id']);
    cmsCore::addSessionMessage($_LANG['CAT_IS_DELETED'], 'success');
    cmsCore::jsonOutput(array('error' => false, 'redirect' => $model->getBlogURL($club['id'])));
}
///////////////////////// ПУБЛИКАЦИЯ ПОСТА /////////////////////////////////////
if ($bdo == 'publishpost') {
    if (!cmsCore::isAjax() || !$inUser->id) {
        return false;
    }
    $post = $inBlog->getPost($post_id);
    if (!$post) {
        cmsCore::halt();
    }
    $blog = $inBlog->getBlog($post['blog_id']);
    if (!$blog) {
        cmsCore::halt();
    }
    $club = $model->getClub($blog['user_id']);
    if (!$club) {
        cmsCore::halt();
    }
    if (!$club['enabled_blogs']) {
开发者ID:deltas1,项目名称:icms1,代码行数:31,代码来源:club_blogs.php

示例13: actions

function actions()
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inActions = cmsActions::getInstance();
    $model = new cms_model_actions();
    global $_LANG;
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $user_id = cmsCore::request('user_id', 'int', 0);
    $perpage = 6;
    $pagetitle = $inCore->getComponentTitle();
    $inPage->setTitle($pagetitle);
    $inPage->addPathway($pagetitle, '/actions');
    $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $pagetitle);
    $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $pagetitle);
    //============================================================================//
    if ($do == 'delete') {
        if (!$inUser->is_admin) {
            cmsCore::error404();
        }
        $id = cmsCore::request('id', 'int', 0);
        if (!$id) {
            cmsCore::error404();
        }
        $model->deleteAction($id);
        cmsCore::redirectBack();
    }
    //============================================================================//
    if ($do == 'view') {
        $inActions->showTargets($model->config['show_target']);
        if ($model->config['act_type'] && !$model->config['is_all']) {
            $inActions->onlySelectedTypes($model->config['act_type']);
        }
        $total = $inActions->getCountActions();
        $inDB->limitPage($page, $model->config['perpage']);
        $actions = $inActions->getActionsLog();
        if (!$actions && $page > 1) {
            cmsCore::error404();
        }
        cmsPage::initTemplate('components', 'com_actions_view')->assign('actions', $actions)->assign('pagetitle', $pagetitle)->assign('total', $total)->assign('user_id', $inUser->id)->assign('pagebar', cmsPage::getPagebar($total, $page, $model->config['perpage'], '/actions/page-%page%'))->display('com_actions_view.tpl');
    }
    //============================================================================//
    if ($do == 'view_user_feed') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        // Получаем друзей
        $friends = cmsUser::getFriends($inUser->id);
        $friends_total = count($friends);
        // нам нужно только определенное количество друзей
        $friends = array_slice($friends, ($page - 1) * $perpage, $perpage, true);
        if ($friends) {
            $inActions->onlyMyFriends();
            $inActions->showTargets($model->config['show_target']);
            $inDB->limitIs($model->config['perpage_tab']);
            $actions = $inActions->getActionsLog();
        } else {
            $actions = array();
        }
        cmsPage::initTemplate('components', 'com_actions_view_tab')->assign('actions', $actions)->assign('friends', $friends)->assign('user_id', $user_id)->assign('page', $page)->assign('cfg', $model->config)->assign('total_pages', ceil($friends_total / $perpage))->assign('friends_total', $friends_total)->display('com_actions_view_tab.tpl');
    }
    //============================================================================//
    if ($do == 'view_user_feed_only') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        if ($user_id) {
            if (!cmsUser::isFriend($user_id)) {
                cmsCore::error404();
            }
            $inActions->whereUserIs($user_id);
        } else {
            $inActions->onlyMyFriends();
        }
        $inActions->showTargets($model->config['show_target']);
        $inDB->limitIs($model->config['perpage_tab']);
        $actions = $inActions->getActionsLog();
        // получаем последний элемент массива для выборки имя пользователя и ссылки на профиль.
        if ($actions) {
            $user = end($actions);
        } else {
            $user = cmsUser::getShortUserData($user_id);
        }
        cmsPage::initTemplate('components', 'com_actions_tab')->assign('actions', $actions)->assign('user_id', $user_id)->assign('user', $user)->assign('cfg', $model->config)->display('com_actions_tab.tpl');
    }
    //============================================================================//
    if ($do == 'view_user_friends_only') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!cmsCore::isAjax()) {
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例14: geo

function geo($do=null) {
    // Определяем местоположение пользователя
    cmsCore::c('user')->loadUserGeo();
    
    $do = isset($do) ? $do : cmsCore::getInstance()->do;

    $field_id = cmsCore::request('field_id', 'int', 0);
    $city_id  = cmsCore::strClear(urldecode(cmsCore::request('city_id', 'html', 0))); // можно передавать как id города, так и название

//========================================================================================================================//
    if ($do == 'view'){
        if (!cmsCore::isAjax()) { cmsCore::error404(); }

        $countries = cmsCore::m('geo')->getCountries();
        $regions   = array();
        $cities    = array();

        $region_id  = false;
        
        // определяем страну
        if (isset(cmsCore::c('user')->geo['country'])) {
            $country_id = cmsCore::c('db')->get_field('cms_geo_countries', "alpha2 = '". cmsCore::c('user')->geo['country'] ."'", 'id');
        } else {
            $country_id = false;
        } 

        if (!$city_id && cmsCore::c('user')->city) {
            $city_id = cmsCore::c('user')->city;
        }

        if ($city_id){

            $city_parents = cmsCore::m('geo')->getCityParents($city_id);

            if($city_parents){

                $region_id  = $city_parents['region_id'];
                $country_id = $city_parents['country_id'];

                $regions = cmsCore::m('geo')->getRegions($country_id);
                $cities  = cmsCore::m('geo')->getCities($region_id);

                $city_id = $city_parents['id'];

            } else {
                $city_id = 0;
            }

        }

        cmsPage::initTemplate('components', 'com_geo_view')->
                assign('field_id', $field_id)->
                assign('city_id', $city_id)->
                assign('country_id', $country_id)->
                assign('region_id', $region_id)->
                assign('countries', $countries)->
                assign('regions', $regions)->
                assign('cities', $cities)->
                display();

    }

//========================================================================================================================//
    if ($do == 'get'){

        if (!cmsCore::isAjax()) { cmsCore::error404(); }

        $type      = cmsCore::request('type', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);

        if (!in_array($type, array('regions', 'cities'))) { cmsCore::error404(); }
        if (!$parent_id) { cmsCore::error404(); }

        switch ( $type ){

            case 'regions': $items = cmsCore::m('geo')->getRegions( $parent_id );
                            break;

            case 'cities':  $items = cmsCore::m('geo')->getCities( $parent_id );
                            break;

            default: $items = array();

        }

        cmsCore::jsonOutput(array(
           'error' => $items ? false : true,
           'items' => $items
        ));

    }

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

示例15: blogs


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

                // если коллективный блог
                if ($ownertype=='multi' && (cmsCore::c('user')->karma < cmsCore::m('blogs')->config['min_karma_public'])){
                    cmsCore::addSessionMessage($_LANG['BLOG_YOU_NEED'].' <a href="/users/'.cmsCore::c('user')->id.'/karma.html">'.$_LANG['BLOG_KARMS'].'</a> '.$_LANG['FOR_CREATE_TEAM_BLOG'].' &mdash; '.cmsCore::m('blogs')->config['min_karma_public'].', '.$_LANG['BLOG_HEAVING'].' &mdash; '.cmsCore::c('user')->karma, 'error');
                    cmsCore::redirect('/blogs/createblog.html');
                }
            }

            //Добавляем блог в базу
            $blog_id   = cmsCore::c('blog')->addBlog(array('user_id'=>cmsCore::c('user')->id, 'title'=>$title, 'allow_who'=>$allow_who, 'ownertype'=>$ownertype, 'forall'=>1));
            $blog_link = cmsCore::c('db')->get_field('cms_blogs', "id='{$blog_id}'", 'seolink');
            //регистрируем событие
            cmsActions::log('add_blog', array(
                'object' => $title,
                'object_url' => cmsCore::m('blogs')->getBlogURL($blog_link),
                'object_id' => $blog_id,
                'target' => '',
                'target_url' => '',
                'target_id' => 0,
                'description' => ''
            ));

            if (IS_BILLING){ cmsBilling::process('blogs', 'add_blog'); }

            cmsCore::addSessionMessage($_LANG['BLOG_CREATED_TEXT'], 'info');
            cmsCore::redirect(cmsCore::m('blogs')->getBlogURL($blog_link));
        }
    }
    
    ////////// НАСТРОЙКИ БЛОГА /////////////////////////////////////////////////
    if ($inCore->do=='config'){
        if(!cmsCore::c('user')->id) { cmsCore::error404(); }

        if(!cmsCore::isAjax()) { cmsCore::error404(); }

        // получаем блог
        $blog = cmsCore::c('blog')->getBlog($id);
        if (!$blog) { cmsCore::error404(); }

        //Проверяем является пользователь хозяином блога или админом
        if ($blog['user_id'] != cmsCore::c('user')->id && !cmsCore::c('user')->is_admin ) { cmsCore::halt(); }

        //Если нет запроса на сохранение, показываем форму настроек блога
        if (!cmsCore::inRequest('goadd')){
            //Получаем список авторов блога
            $authors = cmsCore::c('blog')->getBlogAuthors($blog['id']);

            cmsPage::initTemplate('components', 'com_blog_config')->
                assign('blog', $blog)->
                assign('form_action', '/blogs/'.$blog['id'].'/editblog.html')->
                assign('authors_list', cmsUser::getAuthorsList($authors))->
                assign('users_list', cmsUser::getUsersList(false, $authors))->
                assign('is_restrictions', (!cmsCore::c('user')->is_admin && cmsCore::m('blogs')->config['min_karma']))->
                assign('cfg', cmsCore::m('blogs')->config)->
                assign('is_admin', cmsCore::c('user')->is_admin)->
                display();

            cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
        }

        //Если пришел запрос на сохранение
        if (cmsCore::inRequest('goadd')){
            //Получаем настройки
            $title     = cmsCore::request('title', 'str');
            $allow_who = cmsCore::request('allow_who', 'str', 'all');
            $ownertype = cmsCore::request('ownertype', 'str', 'single');
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php


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