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


PHP cmsCore::getSearchVar方法代码示例

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


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

示例1: __construct

 public function __construct(){
     $this->inCore      = cmsCore::getInstance();
     $this->config      = $this->inCore->loadComponentConfig('board');
     $this->root_cat    = cmsCore::c('db')->get_fields('cms_board_cats', 'parent_id=0', '*');
     $this->category_id = cmsCore::request('category_id', 'int', $this->root_cat['id']);
     $this->item_id     = cmsCore::request('id', 'int', 0);
     $this->page        = cmsCore::request('page', 'int', 1);
     $this->city        = cmsCore::getSearchVar('city');
     $this->obtype      = cmsCore::getSearchVar('obtype');
     $this->is_can_add_by_group   = cmsUser::isUserCan('board/add');
     $this->is_moderator_by_group = cmsUser::isUserCan('board/moderate');
     cmsCore::loadClass('form');
 }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:13,代码来源:model.php

示例2: round

//                                                                            //
/******************************************************************************/
if ($fdo == 'view') {
    $usr = cmsUser::getShortUserData($id);
    if (!$usr) {
        cmsCore::error404();
    }
    if ($inUser->id) {
        $inPage->addHeadJS('components/users/js/pageselfiles.js');
    }
    $inPage->setTitle($usr['nickname'] . ' - ' . $_LANG['FILES']);
    $inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
    $inPage->addPathway($_LANG['FILES_ARCHIVE'], '/users/' . $id . '/files.html');
    $inPage->addHeadJsLang(array('NO_SELECT_FILE'));
    $orderby = cmsCore::getSearchVar('orderby', 'pubdate');
    $orderto = cmsCore::getSearchVar('orderto', 'desc');
    if (!in_array($orderby, array('pubdate', 'filename', 'filesize', 'hits'))) {
        $orderby = 'pubdate';
    }
    if (!in_array($orderto, array('asc', 'desc'))) {
        $orderto = 'desc';
    }
    $perpage = 20;
    $myprofile = $inUser->id == $usr['id'];
    $inDB->where("user_id = '{$usr['id']}'");
    $total_files = $model->getUserFilesCount($myprofile || $inUser->is_admin);
    $inDB->orderBy($orderby, $orderto);
    $inDB->limitPage($page, $perpage);
    $files = $model->getUserFiles($myprofile || $inUser->is_admin);
    $free_mb = $model->config['filessize'] ? round($model->config['filessize'] - round($model->getUserFilesSize($usr['id']) / 1024 / 1024, 2), 2) : '';
    cmsPage::initTemplate('components', 'com_users_file_view')->assign('usr', $usr)->assign('orderby', $orderby)->assign('orderto', $orderto)->assign('cfg', $model->config)->assign('total_files', $total_files)->assign('free_mb', $free_mb)->assign('pagination', cmsPage::getPagebar($total_files, $page, $perpage, '/users/' . $id . '/files%page%.html'))->assign('myprofile', $myprofile)->assign('is_admin', $inUser->is_admin)->assign('files', $files)->display('com_users_file_view.tpl');
开发者ID:deltas1,项目名称:icms1,代码行数:31,代码来源:files.php

示例3: users

function users()
{
    header('X-Frame-Options: DENY');
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    global $_LANG;
    $model = new cms_model_users();
    // id пользователя
    $id = cmsCore::request('id', 'int', 0);
    // логин пользователя
    $login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $pagetitle = $inCore->getComponentTitle();
    if ($model->config['sw_search'] != 2) {
        $inPage->addPathway($pagetitle, '/users');
    }
    $inPage->setTitle($pagetitle);
    $inPage->setDescription($pagetitle);
    // js только авторизованным
    if ($inUser->id) {
        $inPage->addHeadJS('components/users/js/profile.js');
        $inPage->addHeadJsLang(array('CONFIRM_CLEAN_CAT', 'CHOOSE_RECIPIENT', 'SEND_TO_USER', 'FRIENDSHIP_OFFER', 'STOP_FRIENDLY', 'REALY_STOP_FRIENDLY', 'ENTER_STATUS', 'HAVE_JUST'));
    }
    //============================================================================//
    //========================= Список пользователей  ============================//
    //============================================================================//
    if ($do == 'view') {
        // если запрещен просмотр всех пользователей, 404
        if ($model->config['sw_search'] == 2) {
            cmsCore::error404();
        }
        //очищаем поисковые запросы если пришли со другой страницы
        if (!strstr(cmsCore::getBackURL(), '/users')) {
            cmsUser::sessionClearAll();
        }
        $stext = array();
        // Возможные входные переменные
        $name = cmsCore::getSearchVar('name');
        $city = cmsCore::getSearchVar('city');
        $hobby = cmsCore::getSearchVar('hobby');
        $gender = cmsCore::getSearchVar('gender');
        $orderby = cmsCore::request('orderby', array('karma', 'rating', 'regdate'), 'regdate');
        $orderto = cmsCore::request('orderto', array('asc', 'desc'), 'desc');
        $age_to = (int) cmsCore::getSearchVar('ageto', 'all');
        $age_fr = (int) cmsCore::getSearchVar('agefrom', 'all');
        $group_id = cmsCore::request('group_id', 'int', 0);
        // Флаг о показе только онлайн пользователей
        if (cmsCore::inRequest('online')) {
            cmsUser::sessionPut('usr_online', (bool) cmsCore::request('online', 'int'));
            $page = 1;
        }
        $only_online = cmsUser::sessionGet('usr_online');
        if ($only_online) {
            $stext[] = $_LANG['SHOWING_ONLY_ONLINE'];
        }
        ///////////////////////////////////////
        //////////Условия выборки//////////////
        ///////////////////////////////////////
        // группа
        if ($group_id) {
            $model->whereUserGroupIs($group_id);
            $link['group'] = '/users/group/' . $group_id;
            $_LANG['GROUP_SEARCH_NAME'] = cmsUser::getGroupTitle($group_id);
        }
        // Добавляем в выборку имя, если оно есть
        if ($name) {
            $model->whereNameIs($name);
            $stext[] = $_LANG['NAME'] . " — " . htmlspecialchars(stripslashes($name));
        }
        // Добавляем в выборку город, если он есть
        if ($city) {
            $model->whereCityIs($city);
            $stext[] = $_LANG['CITY'] . " — " . htmlspecialchars(stripslashes($city));
        }
        // Добавляем в выборку хобби, если есть
        if ($hobby) {
            $model->whereHobbyIs($hobby);
            $stext[] = $_LANG['HOBBY'] . " — " . htmlspecialchars(stripslashes($hobby));
        }
        // Добавляем в выборку пол, если есть
        if ($gender) {
            $model->whereGenderIs($gender);
            if ($gender == 'm') {
                $stext[] = $_LANG['MALE'];
            } else {
                $stext[] = $_LANG['FEMALE'];
            }
        }
        // Добавляем в выборку возраст, более
        if ($age_fr) {
            $model->whereAgeFrom($age_fr);
            $stext[] = $_LANG['NOT_YOUNG'] . " {$age_fr} " . $_LANG['YEARS'];
        }
        // Добавляем в выборку возраст, менее
        if ($age_to) {
            $model->whereAgeTo($age_to);
            $stext[] = $_LANG['NOT_OLD'] . " {$age_fr} " . $_LANG['YEARS'];
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例4: photos

function photos()
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    cmsCore::loadClass('photo');
    $inPhoto = cmsPhoto::getInstance();
    global $_LANG;
    $model = new cms_model_photos();
    $pagetitle = $inCore->menuTitle();
    $root_album_id = $inDB->getNsRootCatId('cms_photo_albums');
    $id = cmsCore::request('id', 'int', $root_album_id);
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $inPage->addPathway($inCore->getComponentTitle(), '/photos');
    // только авторизованные пользуются js
    if ($inUser->id) {
        $inPage->addHeadJS('components/photos/js/photos.js');
        $inPage->addHeadJsLang(array('NO_PUBLISH', 'EDIT_PHOTO', 'YOU_REALLY_DELETE_PHOTO', 'MOVE_PHOTO'));
    }
    $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $pagetitle);
    $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $pagetitle);
    /////////////////////////////// Просмотр альбома ///////////////////////////////////////////////////////////////////////////////////////////
    if ($do == 'view') {
        $album = $inDB->getNsCategory('cms_photo_albums', $id, null);
        if (!$album && $inCore->menuId() !== 1) {
            cmsCore::error404();
        }
        // Неопубликованные альбомы показываем только админам
        if (!$album['published'] && !$inUser->is_admin) {
            cmsCore::error404();
        }
        $album = cmsCore::callEvent('GET_PHOTO_ALBUM', $album);
        // если не корневой альбом
        if ($album['id'] != $root_album_id) {
            $path_list = $inDB->getNsCategoryPath('cms_photo_albums', $album['NSLeft'], $album['NSRight'], 'id, title, NSLevel');
            if ($path_list) {
                foreach ($path_list as $pcat) {
                    $inPage->addPathway($pcat['title'], '/photos/' . $pcat['id']);
                }
            }
            $pagetitle = $pagetitle && $inCore->isMenuIdStrict() ? $pagetitle : $album['title'] . ' - ' . $_LANG['PHOTOGALLERY'];
            $inPage->setTitle($album['pagetitle'] ? $album['pagetitle'] : $pagetitle);
        } else {
            $pagetitle = $pagetitle && $inCore->isMenuIdStrict() ? $pagetitle : $_LANG['PHOTOGALLERY'];
            $inPage->setTitle($pagetitle);
            $album['title'] = $pagetitle;
        }
        //Формируем подкатегории альбома
        $inDB->orderBy('f.' . $model->config['orderby'], $model->config['orderto']);
        $subcats = $inPhoto->getAlbums($album['id']);
        // Сортировка фотографий
        $orderby = cmsCore::getSearchVar('orderby', $album['orderby']);
        $orderto = cmsCore::getSearchVar('orderto', $album['orderto']);
        if (!in_array($orderby, array('title', 'pubdate', 'rating', 'hits'))) {
            $orderby = $album['orderby'];
        }
        if (!in_array($orderto, array('desc', 'asc'))) {
            $orderto = $album['orderto'];
        }
        // Устанавливаем альбом
        $inPhoto->whereAlbumIs($album['id']);
        // Общее количество фото по заданным выше условиям
        $total = $inPhoto->getPhotosCount($inUser->is_admin);
        //устанавливаем сортировку
        $inDB->orderBy('f.' . $orderby, $orderto);
        //устанавливаем номер текущей страницы и кол-во фото на странице
        $inDB->limitPage($page, $album['perpage']);
        $photos = $inPhoto->getPhotos($inUser->is_admin, $album['showdate']);
        if (!$photos && $page > 1) {
            cmsCore::error404();
        }
        if ($album['id'] != $root_album_id) {
            // meta description
            if ($album['meta_desc']) {
                $meta_desc = $album['meta_desc'];
            } elseif (mb_strlen(strip_tags($album['description'])) >= 250) {
                $meta_desc = crop($album['description']);
            } else {
                $meta_desc = $album['title'];
            }
            $inPage->setDescription($meta_desc);
            // meta keywords
            if ($album['meta_keys']) {
                $meta_keys = $album['meta_keys'];
            } elseif ($photos) {
                foreach ($photos as $p) {
                    $k[] = $p['title'];
                }
                $meta_keys = implode(', ', $k);
            } else {
                $meta_keys = $album['title'];
            }
            $inPage->setKeywords($meta_keys);
        }
        cmsPage::initTemplate('components', 'com_photos_view')->assign('root_album_id', $root_album_id)->assign('cfg', $model->config)->assign('album', $album)->assign('can_add_photo', $album['public'] && $inUser->id || $inUser->is_admin)->assign('subcats', $subcats)->assign('photos', $photos)->assign('pagebar', cmsPage::getPagebar($total, $page, $album['perpage'], '/photos/' . $album['id'] . '-%page%'))->assign('total', $total)->assign('orderby', $orderby)->assign('orderto', $orderto)->display('com_photos_view.tpl');
        // если есть фотограйии в альбоме и включены комментарии в альбоме, то показываем их
        if ($album['is_comments'] && $photos && $inCore->isComponentInstalled('comments')) {
            cmsCore::includeComments();
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例5: forum

function forum()
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    $model = new cms_model_forum();
    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) {
        cmsCore::loadClass('billing');
    }
    global $_LANG;
    $pagetitle = $inCore->getComponentTitle();
    $inPage->addPathway($pagetitle, '/forum');
    $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);
    $id = cmsCore::request('id', 'int', 0);
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $inPage->addHeadJS('components/forum/js/common.js');
    $inPage->addHeadJsLang(array('CONFIRM_DELETE_POLL', 'CONFIRM_DEL_POST', 'CONFIRM_DEL_THREAD', 'MOVE_THREAD', 'MOVE_POST', 'RENAME_THREAD', 'CONFIRM_DELETE_FILE', 'SELECT_NEW_FILE_UPLOAD', 'SELECT_TEXT_QUOTE', 'CONFIRM_DELETE_ALL_USER_POSTS'));
    //============================================================================//
    //=============================== Список Форумов  ============================//
    //============================================================================//
    if ($do == 'view') {
        $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . $_LANG['FORUMS'] . '" href="' . HOST . '/rss/forum/all/feed.rss">');
        $forums = $model->getForums();
        cmsPage::initTemplate('components', 'com_forum_list')->assign('pagetitle', $pagetitle)->assign('forums', $forums)->assign('forum', array())->assign('user_id', $inUser->id)->assign('cfg', $model->config)->display('com_forum_list.tpl');
    }
    //============================================================================//
    //================ Список тем форума + список подфорумов  ====================//
    //============================================================================//
    if ($do == 'forum') {
        $forum = $model->getForum($id);
        if (!$forum) {
            cmsCore::error404();
        }
        $forum = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $forum);
        $moderators = $model->getForumModerators($forum['moder_list']);
        // опции просмотра
        $order_by = cmsCore::getSearchVar('order_by', 'pubdate');
        $order_to = cmsCore::getSearchVar('order_to', 'desc');
        if (!in_array($order_by, array('pubdate', 'title', 'post_count', 'hits'))) {
            $order_by = 'pubdate';
        }
        if (!in_array($order_to, array('asc', 'desc'))) {
            $order_to = 'desc';
        }
        $daysprune = (int) cmsCore::getSearchVar('daysprune');
        if (!cmsCore::checkContentAccess($forum['access_list'])) {
            cmsPage::includeTemplateFile('special/accessdenied.php');
            return;
        }
        $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . htmlspecialchars($forum['title']) . '" href="' . HOST . '/rss/forum/' . $forum['id'] . '/feed.rss">');
        $inPage->setTitle($forum['pagetitle'] ? $forum['pagetitle'] : $forum['title']);
        $inPage->setDescription($forum['meta_desc'] ? $forum['meta_desc'] : crop($forum['description'] ? $forum['description'] : $forum['title']));
        $inPage->setKeywords($forum['meta_keys'] ? $forum['meta_keys'] : $forum['title']);
        // Получаем дерево форумов
        $path_list = $inDB->getNsCategoryPath('cms_forums', $forum['NSLeft'], $forum['NSRight'], 'id, title, access_list, moder_list');
        // Строим глубиномер
        if ($path_list) {
            $path_list = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $path_list);
            foreach ($path_list as $pcat) {
                if (!cmsCore::checkContentAccess($pcat['access_list'])) {
                    cmsPage::includeTemplateFile('special/accessdenied.php');
                    return;
                }
                $inPage->addPathway($pcat['title'], '/forum/' . $pcat['id']);
            }
        }
        // Получим подфорумы
        $model->whereNestedForum($forum['NSLeft'], $forum['NSRight']);
        $sub_forums = $model->getForums();
        cmsPage::initTemplate('components', 'com_forum_list')->assign('pagetitle', $forum['title'])->assign('forums', $sub_forums)->assign('forum', $forum)->assign('cfg', $model->config)->assign('user_id', $inUser->id)->display('com_forum_list.tpl');
        // Получим темы
        if ($daysprune) {
            $model->whereDayIntervalIs($daysprune);
        }
        $model->whereForumIs($forum['id']);
        $inDB->orderBy('t.pinned', 'DESC, t.' . $order_by . ' ' . $order_to);
        $inDB->limitPage($page, $model->config['pp_forum']);
        $threads = $model->getThreads();
        if (!$threads && $page > 1) {
            cmsCore::error404();
        }
        cmsPage::initTemplate('components', 'com_forum_view')->assign('threads', $threads)->assign('show_panel', true)->assign('order_by', $order_by)->assign('order_to', $order_to)->assign('daysprune', $daysprune)->assign('moderators', $moderators)->assign('pagination', cmsPage::getPagebar($forum['thread_count'], $page, $model->config['pp_forum'], '/forum/' . $forum['id'] . '-%page%'))->display('com_forum_view.tpl');
    }
    //============================================================================//
    //======================== Просмотр темы форума  =============================//
    //============================================================================//
    if ($do == 'thread') {
        $thread = $model->getThread($id);
        if (!$thread) {
            cmsCore::error404();
        }
        // Строим глубиномер
        $path_list = $inDB->getNsCategoryPath('cms_forums', $thread['NSLeft'], $thread['NSRight'], 'id, title, access_list, moder_list');
        if ($path_list) {
            $path_list = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $path_list);
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php


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