Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
    }
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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;
}
Exemplo n.º 6
0
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;
}
Exemplo n.º 7
0
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;
}
Exemplo n.º 8
0
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;
}
Exemplo n.º 9
0
 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();
 }
Exemplo n.º 10
0
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;
}
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
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;
}
Exemplo n.º 13
0
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;
}
Exemplo n.º 14
0
 public function __construct()
 {
     cmsCore::loadClass('page');
     $this->inCore = cmsCore::getInstance();
     $this->inDB = cmsDatabase::getInstance();
     $this->inPage = cmsPage::getInstance();
 }
Exemplo n.º 15
0
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;
}
Exemplo n.º 16
0
function mod_cart($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    cmsCore::includeFile('components/catalog/includes/shopcore.php');
    $sid = session_id();
    $items = array();
    $total_summ = 0;
    $user_sql = $inUser->id ? "c.user_id='{$inUser->id}'" : "c.session_id='{$sid}'";
    $sql = "SELECT i.title, i.price, i.category_id, i.id, c.itemscount\n            FROM cms_uc_cart c\n            INNER JOIN cms_uc_items i ON i.id = c.item_id\n            WHERE {$user_sql}";
    $result = $inDB->query($sql);
    $items_count = $inDB->num_rows($result);
    if ($items_count) {
        while ($con = $inDB->fetch_assoc($result)) {
            $price = shopDiscountPrice($con['id'], $con['category_id'], $con['price']);
            $totalcost = $con['itemscount'] * $price;
            $total_summ += $totalcost;
            $con['price'] = number_format($price, 2, '.', ' ');
            $con['totalcost'] = number_format($totalcost, 2, '.', ' ');
            $items[] = $con;
        }
    }
    cmsPage::initTemplate('modules', 'mod_cart')->assign('cfg', $cfg)->assign('items_count', $items_count)->assign('total_summ', number_format($total_summ, 2, '.', ' '))->assign('items', $items)->display('mod_cart.tpl');
    return true;
}
Exemplo n.º 17
0
function mod_category($mod, $cfg) {
    $cfg = array_merge(
        array(
            'category_id'  => 0,
            'show_subcats' => 1,
            'expand_all'   => 1
        ),
        $cfg
    );
    
    $rootcat = cmsCore::c('db')->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) { return false; }

    $subcats_list = cmsCore::m('content')->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();

    return true;
}
Exemplo n.º 18
0
function mod_clubs($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    if (!isset($cfg['count'])) {
        $cfg['count'] = 5;
    }
    if (!isset($cfg['type'])) {
        $cfg['type'] = 'id';
    }
    if (!isset($cfg['vip_on_top'])) {
        $cfg['vip_on_top'] = 1;
    }
    cmsCore::loadModel('clubs');
    $model = new cms_model_clubs();
    if ($cfg['vip_on_top']) {
        $inDB->orderBy('is_vip', 'DESC, c.' . $cfg['type'] . ' DESC');
    } else {
        $inDB->orderBy('c.' . $cfg['type'], 'DESC');
    }
    $inDB->limit($cfg['count']);
    $clubs = $model->getClubs();
    if (!$clubs) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_clubs')->assign('clubs', $clubs)->display('mod_clubs.tpl');
    return true;
}
Exemplo n.º 19
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 20
0
function mod_latest_faq($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    if (!isset($cfg['newscount'])) {
        $cfg['newscount'] = 2;
    }
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 0;
    }
    if (!isset($cfg['maxlen'])) {
        $cfg['maxlen'] = 120;
    }
    if ($cfg['cat_id']) {
        $catsql = 'AND category_id = ' . $cfg['cat_id'];
    } else {
        $catsql = '';
    }
    $sql = "SELECT *\n            FROM cms_faq_quests\n            WHERE published = 1 " . $catsql . "\n            ORDER BY pubdate DESC\n            LIMIT " . $cfg['newscount'];
    $result = $inDB->query($sql);
    $faq = array();
    if ($inDB->num_rows($result)) {
        while ($con = $inDB->fetch_assoc($result)) {
            $con['date'] = cmsCore::dateFormat($con['pubdate']);
            $con['href'] = '/faq/quest' . $con['id'] . '.html';
            $faq[] = $con;
        }
    }
    cmsPage::initTemplate('modules', 'mod_latest_faq')->assign('faq', $faq)->assign('cfg', $cfg)->display('mod_latest_faq.tpl');
    return true;
}
Exemplo n.º 21
0
function mod_clubs($mod, $cfg) {
    $cfg = array_merge(array(
        'count'      => 5,
        'type'       => 'id',
        'vip_on_top' => 1
    ), $cfg);

    if ($cfg['vip_on_top']) {
        cmsCore::c('db')->orderBy('is_vip', 'DESC, c.'. $cfg['type'] .' DESC');
    } else {
        cmsCore::c('db')->orderBy('c.'. $cfg['type'], 'DESC');
    }
    
    cmsCore::c('db')->limit($cfg['count']);

    $clubs = cmsCore::m('clubs')->getClubs();
    
    if (!$clubs) { return false; }

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

    return true;
}
Exemplo n.º 22
0
 public function __construct()
 {
     cmsCore::loadClass('page');
     $this->inCore = cmsCore::getInstance();
     $this->inDB = cmsDatabase::getInstance();
     $this->inPage = cmsPage::getInstance();
     $this->config = array_merge($this->config, $this->inCore->loadPluginConfig(get_called_class()));
 }
Exemplo n.º 23
0
function mod_search($module_id, $cfg)
{
    cmsCore::loadModel('search');
    cmsCore::loadLanguage('components/search');
    $model = cms_model_search::initModel();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('enable_components', $model->getEnableComponentsWithSupportSearch())->display($cfg['tpl']);
    return true;
}
Exemplo n.º 24
0
function mod_template($mod, $cfg){
    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('current_template', (isset($_SESSION['template']) ? $_SESSION['template'] : ''))->
        assign('templates', cmsCore::getDirsList('/templates'))->
        display();

    return true;
}
Exemplo n.º 25
0
 function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     $this->inCore = cmsCore::getInstance();
     $this->inPage = cmsPage::getInstance();
     $this->inUser = cmsUser::getInstance();
     $this->root = $_SERVER['DOCUMENT_ROOT'];
 }
Exemplo n.º 26
0
function mod_about($module_id, $cfg)
{
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $articles = $model->getArticlesList3(true, '47');
    cmsPage::initTemplate('modules', 'module_about.tpl')->assign('articles', $articles)->display('module_about.tpl');
    return true;
}
Exemplo n.º 27
0
function mod_usersearch($mod, $cfg) {
    cmsCore::loadLanguage('components/users');

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

    return true;
}
Exemplo n.º 28
0
function mod_menu($module_id, $cfg)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $menuid = $inCore->menuId();
    $full_menu = $inCore->getMenuStruct();
    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 = $full_menu[$menuid];
    // результирующий массив меню
    $items = array();
    // id корня меню если обычный вывод меню, $menuid если режим подменю
    if ($cfg['is_sub_menu']) {
        // в подменю не должно быть ссылки на главную
        $cfg['show_home'] = 0;
        // на главной подменю не можт быть
        if ($menuid == 1) {
            return false;
        }
        foreach ($full_menu as $item) {
            if ($item['NSLeft'] > $currentmenu['NSLeft'] && $item['NSRight'] < $currentmenu['NSRight'] && $item['menu'] == $menu && cmsCore::checkContentAccess($item['access_list']) && $item['published']) {
                $items[] = $item;
                // массивы для сортировки
                $nsl[] = $item['NSLeft'];
                $ord[] = $item['ordering'];
            }
        }
    } else {
        foreach ($full_menu as $item) {
            if ($item['menu'] == $menu && cmsCore::checkContentAccess($item['access_list']) && $item['published']) {
                $items[] = $item;
                // массивы для сортировки
                $nsl[] = $item['NSLeft'];
                $ord[] = $item['ordering'];
            }
        }
    }
    if (!$items) {
        return false;
    }
    // сортируем массив
    array_multisort($nsl, SORT_ASC, $ord, SORT_ASC, $items);
    $template = $cfg['tpl'] ? $cfg['tpl'] : 'mod_menu.tpl';
    cmsPage::initTemplate('modules', $template)->assign('menuid', $menuid)->assign('currentmenu', $currentmenu)->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($template);
    return true;
}
Exemplo n.º 29
0
function mod_auth($mod, $cfg)
{
    $inUser = cmsUser::getInstance();
    if ($inUser->id) {
        return false;
    }
    cmsUser::sessionPut('auth_back_url', cmsCore::getBackURL());
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
Exemplo n.º 30
0
function mod_usermenu($module_id, $cfg)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $is_billing = $inCore->isComponentInstalled('billing');
    $is_audio = $inCore->isComponentInstalled('audio');
    $is_video = $inCore->isComponentInstalled('video');
    cmsPage::initTemplate('modules', 'mod_usermenu')->assign('avatar', $inUser->imageurl)->assign('nickname', $inUser->nickname)->assign('login', $inUser->login)->assign('id', $inUser->id)->assign('newmsg', cmsUser::getNewMessages($inUser->id))->assign('is_can_add', cmsUser::isUserCan('content/add'))->assign('is_admin', $inUser->is_admin)->assign('is_editor', cmsUser::userIsEditor())->assign('cfg', $inCore->loadModuleConfig($module_id))->assign('users_cfg', $inCore->loadComponentConfig('users'))->assign('is_billing', $is_billing)->assign('is_audio', $is_audio)->assign('is_video', $is_video)->assign('audio_count', $is_audio ? $inUser->audio_count : 0)->assign('video_count', $is_video ? $inUser->video_count : 0)->assign('balance', $is_billing ? $inUser->balance : 0)->display('mod_usermenu.tpl');
    return true;
}