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


PHP cmsPage类代码示例

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


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

示例1: mod_blogs

function mod_blogs($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $default_cfg = array('sort' => 'pubdate', 'owner' => 'user', 'shownum' => 5, 'minrate' => 0, 'blog_id' => 0, 'showrss' => 1);
    $cfg = array_merge($default_cfg, $cfg);
    cmsCore::loadClass('blog');
    $inBlog = cmsBlogs::getInstance();
    $inBlog->owner = $cfg['owner'];
    if ($cfg['owner'] == 'club') {
        cmsCore::loadModel('clubs');
        $model = new cms_model_clubs();
        $inDB->addSelect('b.user_id as bloglink');
    } else {
        cmsCore::loadModel('blogs');
        $model = new cms_model_blogs();
    }
    // получаем аватары владельцев
    $inDB->addSelect('up.imageurl');
    $inDB->addJoin('LEFT JOIN cms_user_profiles up ON up.user_id = u.id');
    $inBlog->whereOnlyPublic();
    if ($cfg['minrate']) {
        $inBlog->ratingGreaterThan($cfg['minrate']);
    }
    if ($cfg['blog_id']) {
        $inBlog->whereBlogIs($cfg['blog_id']);
    }
    $inDB->orderBy('p.' . $cfg['sort'], 'DESC');
    $inDB->limit($cfg['shownum']);
    $posts = $inBlog->getPosts(false, $model);
    if (!$posts) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_blogs')->assign('posts', $posts)->assign('cfg', $cfg)->display('mod_blogs.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:35,代码来源:module.php

示例2: mod_user_image

function mod_user_image($mod, $cfg) {
    $sql = "SELECT u.id uid, u.nickname author, u.login as login, p.imageurl, p.title, p.id, pr.gender gender
            FROM cms_user_photos p
            LEFT JOIN cms_users u ON u.id = p.user_id
            LEFT JOIN cms_user_profiles pr ON pr.user_id = u.id
            LEFT JOIN cms_user_albums a ON a.id = p.album_id
            WHERE p.allow_who = 'all' AND u.is_deleted = 0 AND u.is_locked = 0
                  AND p.album_id > 0 AND a.allow_who = 'all'
            ORDER BY RAND()
            LIMIT 1";

    $result = cmsCore::c('db')->query($sql) ;

    if (!cmsCore::c('db')->num_rows($result)) { return false; }

    while ($usr = cmsCore::c('db')->fetch_assoc($result)) {
        $usr['genderlink'] = cmsUser::getGenderLink($usr['uid'], $usr['author'], $usr['gender'], $usr['login']);
        $users[] = $usr;
    }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('users', $users)->
        assign('cfg', $cfg)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:27,代码来源:module.php

示例3: f_pages

function f_pages(&$text)
{
    if (mb_strpos($text, 'pagebreak') === false) {
        return true;
    }
    $seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    $seolink = preg_replace('/[^a-zа-я-яёіїєґА-ЯЁІЇЄҐ0-9_\\/\\-]/ui', '', $seolink);
    if (!$seolink) {
        return true;
    }
    $regex = '/{(pagebreak)\\s*(.*?)}/iu';
    $pages = preg_split($regex, $text);
    $n = count($pages);
    if ($n <= 1) {
        return true;
    } else {
        $page = cmsCore::request('page', 'int', 1);
        $text = $pages[$page - 1];
        if (!$text) {
            cmsCore::error404();
        }
        cmsCore::loadModel('content');
        $text .= cmsPage::getPagebar($n, $page, 1, cms_model_content::getArticleURL(null, $seolink, '%page%'));
        return true;
    }
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:26,代码来源:filter.php

示例4: mod_dt_newsslider

function mod_dt_newsslider($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 1;
    }
    if ($cfg['cat_id']) {
        if (!$cfg['subs']) {
            $model->whereCatIs($cfg['cat_id']);
        } else {
            $rootcat = $inDB->getNsCategory('cms_category', $cfg['cat_id']);
            if (!$rootcat) {
                return false;
            }
            $model->whereThisAndNestedCats($rootcat['NSLeft'], $rootcat['NSRight']);
        }
    }
    $inDB->orderBy('con.ordering', 'ASC');
    $inDB->limit($cfg['newscount']);
    $slider_list = $model->getArticlesList();
    if (!$slider_list) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_dt_newsslider')->assign('slider', $slider_list)->assign('cfg', $cfg)->assign('module_id', $module_id)->display('mod_dt_newsslider.tpl');
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:28,代码来源:module.php

示例5: mod_whoonline

function mod_whoonline($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    if (!isset($cfg['color_admin'])) {
        $cfg['color_admin'] = '#FF0000';
    }
    if (!isset($cfg['color_editor'])) {
        $cfg['color_editor'] = '#009900';
    }
    $online_count = cmsUser::getOnlineCount();
    $users = array();
    $today_users = array();
    if ($online_count['users']) {
        $sql = "SELECT\n                o.user_id as id,\n                u.login,\n                u.nickname,\n                p.gender as gender\n                FROM cms_online o\n                LEFT JOIN cms_users u ON  u.id = o.user_id\n                LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n                WHERE u.is_locked = 0 AND u.is_deleted = 0\n                GROUP BY o.user_id";
        $result = $inDB->query($sql);
        $users = getUsersArray($result, $cfg, $inDB);
    }
    if ($cfg['show_today']) {
        $today = date("Y-m-d");
        $sql = "SELECT u.id as id, u.nickname as nickname, u.login as login, p.gender as gender\n                FROM cms_users u\n                LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n                WHERE u.is_locked = 0 AND u.is_deleted = 0 AND DATE_FORMAT(u.logdate, '%Y-%m-%d')='{$today}'\n                ORDER BY u.logdate DESC";
        $result = $inDB->query($sql);
        if ($inDB->num_rows($result)) {
            $today_users = getUsersArray($result, $cfg, $inDB);
        }
    }
    cmsPage::initTemplate('modules', 'mod_whoonline')->assign('cfg', $cfg)->assign('users', $users)->assign('guests', $online_count['guests'])->assign('today_users', $today_users)->display('mod_whoonline.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:28,代码来源:module.php

示例6: mod_bestcontent

function mod_bestcontent($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['shownum'])) {
        $cfg['shownum'] = 5;
    }
    if (!isset($cfg['subs'])) {
        $cfg['subs'] = 1;
    }
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 1;
    }
    $inDB->where("con.canrate = 1");
    if ($cfg['cat_id']) {
        if (!$cfg['subs']) {
            //выбираем из категории
            $model->whereCatIs($cfg['cat_id']);
        } else {
            //выбираем из категории и подкатегорий
            $rootcat = $inDB->getNsCategory('cms_category', $cfg['cat_id']);
            if (!$rootcat) {
                return false;
            }
            $model->whereThisAndNestedCats($rootcat['NSLeft'], $rootcat['NSRight']);
        }
    }
    $inDB->orderBy('con.rating', 'DESC');
    $inDB->limitPage(1, $cfg['shownum']);
    $content_list = $model->getArticlesList();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('articles', $content_list)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:34,代码来源:module.php

示例7: mod_forum

function mod_forum($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $default_cfg = array('shownum' => 4, 'cat_id' => 0, 'forum_id' => 0, 'subs' => 0, 'show_hidden' => 0, 'show_pinned' => 0, 'showtext' => 1, 'showforum' => 0, 'order' => 'pubdate');
    $cfg = array_merge($default_cfg, $cfg);
    cmsCore::loadModel('forum');
    $model = new cms_model_forum();
    $inDB->addJoin('INNER JOIN cms_forums f ON f.id = t.forum_id');
    $inDB->addSelect('f.title as forum_title');
    if ($cfg['cat_id']) {
        $model->whereForumCatIs($cfg['cat_id']);
    }
    if ($cfg['forum_id']) {
        if ($cfg['subs']) {
            $forum = $model->getForum($cfg['forum_id']);
            if (!$forum) {
                return false;
            }
            $model->whereThisAndNestedForum($forum['NSLeft'], $forum['NSRight']);
        } else {
            $model->whereForumIs($cfg['forum_id']);
        }
    }
    if (!$cfg['show_hidden']) {
        $model->wherePublicThreads();
    }
    if ($cfg['show_pinned']) {
        $model->wherePinnedThreads();
    }
    $inDB->orderBy('t.' . $cfg['order'], 'DESC');
    $inDB->limit($cfg['shownum']);
    $threads = $model->getThreads();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('threads', $threads)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:35,代码来源:module.php

示例8: mod_user_friend

function mod_user_friend($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    if (!$inUser->id) {
        return false;
    }
    if ($cfg['view_type'] == 'table') {
        $sql = "SELECT\r\n                CASE\r\n                WHEN f.from_id = {$inUser->id}\r\n                THEN f.to_id\r\n                WHEN f.to_id = {$inUser->id}\r\n                THEN f.from_id\r\n                END AS user_id, u.login, u.nickname, u.is_deleted, p.imageurl\r\n                FROM cms_user_friends f\r\n                INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = {$inUser->id} THEN f.to_id WHEN f.to_id = {$inUser->id} THEN f.from_id END\r\n                LEFT JOIN cms_users u ON u.id = o.user_id\r\n                LEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n                WHERE (from_id = {$inUser->id} OR to_id = {$inUser->id}) AND is_accepted =1 LIMIT " . $cfg['limit'];
    } else {
        $sql = "SELECT\r\n                CASE\r\n                WHEN f.from_id = {$inUser->id}\r\n                THEN f.to_id\r\n                WHEN f.to_id = {$inUser->id}\r\n                THEN f.from_id\r\n                END AS user_id, u.login, u.nickname\r\n                FROM cms_user_friends f\r\n                INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = {$inUser->id} THEN f.to_id WHEN f.to_id = {$inUser->id} THEN f.from_id END\r\n                LEFT JOIN cms_users u ON u.id = o.user_id\r\n                WHERE (from_id = {$inUser->id} OR to_id = {$inUser->id}) AND is_accepted =1 LIMIT " . $cfg['limit'];
    }
    $result = $inDB->query($sql);
    $total = $inDB->num_rows($result);
    if ($total) {
        $friends = array();
        while ($friend = $inDB->fetch_assoc($result)) {
            $friend['avatar'] = $cfg['view_type'] == 'table' ? cmsUser::getUserAvatarUrl($friend['user_id'], 'small', $friend['imageurl'], $friend['is_deleted']) : false;
            $friend['user_link'] = cmsUser::getProfileLink($friend['login'], $friend['nickname']);
            $friends[$friend['user_id']] = $friend;
        }
    }
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('friends', $friends)->assign('total', $total)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:25,代码来源:module.php

示例9: insertSlider

 private function insertSlider($images, $title) {
     return cmsPage::initTemplate('plugins', 'p_content_imgs_'. $this->config['slider_name'])->
         assign('images', $images)->
         assign('title', $title)->
         assign('slider_mode', $this->config['slider_mode'])->
         fetch();
 }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:7,代码来源:plugin.php

示例10: mod_pogoda_current

function mod_pogoda_current($mod, $cfg)
{
    $inCore = cmsCore::getInstance();
    //Загрузка настроек компонента
    $component = $inCore->loadComponentConfig('pogoda');
    $component["name_en"] = $component["name_en"] ? $component["name_en"] . '_' : '';
    // Проверяем включен ли компонент и установлен ли city_id
    if (!$component['component_enabled'] || !$component['city_id']) {
        return false;
    }
    cmsCore::loadModel('pogoda');
    $model = new cms_model_pogoda();
    $model->setTable('current');
    $dbWeather = $model->getWeather();
    $xml = simplexml_load_string($dbWeather["xml"]);
    if (!$xml) {
        return true;
    }
    $current = array();
    $current["temperature"] = round($xml->temperature["value"]) . ' &#176;C';
    $current["weather"]["value"] = $xml->weather["value"];
    $current["weather"]["icon"] = $xml->weather["icon"];
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('current', $current)->display($cfg['tpl']);
    return true;
}
开发者ID:roman-burachenko,项目名称:icms1_com_pogoda,代码行数:25,代码来源:module.php

示例11: mod_actions

function mod_actions($mod, $cfg) {
    global $_LANG;
    
    if (!isset($cfg['action_types'])) {
        echo $_LANG['MODULE_NOT_CONFIGURED'];
        return true;
    }
    
    $cfg = array_merge(
        array(
            'show_target' => 1,
            'limit' => 15,
            'show_link' => 1
        ),
        $cfg
    );
    
    if (!$cfg['show_target']) {
        cmsCore::c('actions')->showTargets(false);
    }

    cmsCore::c('actions')->onlySelectedTypes($cfg['action_types']);
    cmsCore::c('db')->limitIs($cfg['limit']);
    
    $actions = cmsCore::c('actions')->getActionsLog();
    if (!$actions) { return false; }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('actions', $actions)->
        assign('cfg', $cfg)->
        assign('user_id', cmsCore::c('user')->id)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:35,代码来源:module.php

示例12: mod_actions

function mod_actions(array $mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $inActions = cmsActions::getInstance();
    global $_LANG;
    if (!isset($cfg['show_target'])) {
        $cfg['show_target'] = 1;
    }
    if (!isset($cfg['limit'])) {
        $cfg['limit'] = 15;
    }
    if (!isset($cfg['show_link'])) {
        $cfg['show_link'] = 1;
    }
    if (!isset($cfg['action_types'])) {
        echo $_LANG['MODULE_NOT_CONFIGURED'];
        return true;
    }
    if (!$cfg['show_target']) {
        $inActions->showTargets(false);
    }
    $inActions->onlySelectedTypes($cfg['action_types']);
    $inDB->limitIs($cfg['limit']);
    $actions = $inActions->getActionsLog();
    if (!$actions) {
        return false;
    }
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('actions', $actions)->assign('cfg', $cfg)->assign('user_id', cmsUser::getInstance()->id)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:30,代码来源:module.php

示例13: mod_menu

function mod_menu($mod, $cfg)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $menuid = $inCore->menuId();
    $full_menu = $inCore->getMenuStruct();
    $current_uri = '/' . $inCore->getUri();
    if (!isset($cfg['menu'])) {
        $menu = 'mainmenu';
    } else {
        $menu = $cfg['menu'];
    }
    if (!isset($cfg['show_home'])) {
        $cfg['show_home'] = 1;
    }
    if (!isset($cfg['is_sub_menu'])) {
        $cfg['is_sub_menu'] = 0;
    }
    // текущий пункт меню
    $currentmenu = isset($full_menu[$menuid]) ? $full_menu[$menuid] : array();
    // результирующий массив меню
    $items = array();
    // id корня меню если обычный вывод меню, $menuid если режим подменю
    if ($cfg['is_sub_menu']) {
        // в подменю не должно быть ссылки на главную
        $cfg['show_home'] = 0;
        // на главной или нет активного пункта меню
        if ($menuid == 1 || !$currentmenu) {
            return false;
        }
        foreach ($full_menu as $item) {
            if ($item['NSLeft'] > $currentmenu['NSLeft'] && $item['NSRight'] < $currentmenu['NSRight'] && in_array($menu, $item['menu']) && ($item['is_lax'] || cmsCore::checkContentAccess($item['access_list'], false)) && $item['published']) {
                $item['link'] = cmsUser::stringReplaceUserProperties($item['link']);
                $item['title'] = cmsUser::stringReplaceUserProperties($item['title'], true);
                $items[] = $item;
                // массивы для сортировки
                $nsl[] = $item['NSLeft'];
                $ord[] = $item['ordering'];
            }
        }
    } else {
        foreach ($full_menu as $item) {
            if (in_array($menu, $item['menu']) && ($item['is_lax'] || cmsCore::checkContentAccess($item['access_list'], false)) && $item['published']) {
                $item['link'] = cmsUser::stringReplaceUserProperties($item['link']);
                $item['title'] = cmsUser::stringReplaceUserProperties($item['title'], true);
                $items[] = $item;
                // массивы для сортировки
                $nsl[] = $item['NSLeft'];
                $ord[] = $item['ordering'];
            }
        }
    }
    if (!$items) {
        return false;
    }
    // сортируем массив
    array_multisort($nsl, SORT_ASC, $ord, SORT_ASC, $items);
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('menuid', $menuid)->assign('currentmenu', $currentmenu)->assign('current_uri', $current_uri)->assign('menu', $menu)->assign('items', $items)->assign('last_level', 0)->assign('user_id', $inUser->id)->assign('is_admin', $inUser->is_admin)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:r2git,项目名称:icms1,代码行数:60,代码来源:module.php

示例14: __construct

 public function __construct()
 {
     cmsCore::loadClass('page');
     $this->inCore = cmsCore::getInstance();
     $this->inDB = cmsDatabase::getInstance();
     $this->inPage = cmsPage::getInstance();
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:7,代码来源:plugin.class.php

示例15: mod_category

function mod_category($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['category_id'])) {
        $cfg['category_id'] = 0;
    }
    if (!isset($cfg['show_subcats'])) {
        $cfg['show_subcats'] = 1;
    }
    if (!isset($cfg['expand_all'])) {
        $cfg['expand_all'] = 1;
    }
    $rootcat = $inDB->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) {
        return false;
    }
    $subcats_list = $model->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
    if (!$subcats_list) {
        return false;
    }
    $current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->assign('current_seolink', $current_seolink)->assign('subcats_list', $subcats_list)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:26,代码来源:module.php


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