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


PHP cmsDatabase::getInstance方法代码示例

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


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

示例1: __construct

 function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     $inCore = cmsCore::getInstance();
     $cfg = $inCore->loadComponentConfig('pogoda');
     $this->city_id = $cfg['city_id'];
 }
开发者ID:roman-burachenko,项目名称:icms1_com_pogoda,代码行数:7,代码来源:model.php

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

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

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

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

示例6: __construct

	function __construct(){
        $this->inDB   = cmsDatabase::getInstance();
		$this->inCore = cmsCore::getInstance();
		$this->config = $this->inCore->loadComponentConfig('users');
		cmsCore::loadLanguage('components/users');
        cmsCore::loadClass('form');
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:7,代码来源:model.php

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

示例8: mod_cart

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;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:25,代码来源:module.php

示例9: mod_calendar_eventview

function mod_calendar_eventview($module_id)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $DB = cmsDatabase::getInstance();
    $cfg = $inCore->loadComponentConfig('calendar');
    if ($inUser->id != 0 and $cfg['calendar_module'] == "user") {
        //Запрос к БД
        $sql = "\r\n\tSELECT cms_events.* ,\r\n\tcms_events_category.tx,\r\n\tcms_events_category.bg\r\n\tFROM cms_events \r\n\tLEFT JOIN cms_events_signup ON cms_events.id=cms_events_signup.event_id \r\n\tLEFT JOIN cms_events_category ON cms_events.category_id = cms_events_category.id\r\n\tWHERE \r\n\tcms_events.start_time > " . time() . " AND \r\n\tcms_events.author_id = " . $inUser->id . " OR \r\n\tcms_events_signup.user_id = " . $inUser->id . " AND \r\n\tcms_events.author_id <> " . $inUser->id . " AND \r\n\tcms_events.start_time > " . time() . " \r\n\tGROUP BY cms_events.id ORDER BY cms_events.start_time ASC LIMIT " . $cfg['calendar_module_count'];
    } else {
        $sql = "SELECT cms_events.*,\r\n\t    cms_events_category.tx,\r\n\t    cms_events_category.bg\r\n\t    FROM cms_events\r\n\t    LEFT JOIN cms_events_category ON cms_events.category_id = cms_events_category.id\t    \r\n\t    WHERE cms_events.`type` = 'public' \r\n\t    AND cms_events.start_time > " . time() . " \r\n\t    ORDER BY cms_events.start_time ASC LIMIT " . $cfg['calendar_module_count'];
    }
    $result = $DB->query($sql);
    if ($DB->error()) {
        return false;
    }
    $events = array();
    while ($event = $DB->fetch_assoc($result)) {
        if ($event['author_id'] == $inUser->id) {
            $event['time'] == "";
        }
        if ($event['category_id'] == 0) {
            $event['bg'] = '#C3BCB9';
            $event['tx'] = '#000000';
        }
        $events[] = $event;
    }
    $smarty = $inCore->initSmarty('modules', 'mod_calendar_eventview.tpl');
    $smarty->assign('events', $events);
    $smarty->display('mod_calendar_eventview.tpl');
    return true;
}
开发者ID:ratmir-by,项目名称:icms-calendar,代码行数:32,代码来源:module.php

示例10: mod_clubs

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;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:27,代码来源:module.php

示例11: upgrade_component_calendar

function upgrade_component_calendar()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inDB->query("ALTER TABLE  `cms_events` ADD  `hide` INT NOT NULL ;");
    return true;
}
开发者ID:roman-burachenko,项目名称:icms-calendar,代码行数:7,代码来源:install.php

示例12: search_blogs

function search_blogs($query, $look)
{
    $inDB = cmsDatabase::getInstance();
    $searchModel = cms_model_search::initModel();
    global $_LANG;
    $sql = "SELECT con.*, cat.title cat_title, cat.id cat_id, cat.owner owner, cat.user_id user_id, cat.seolink as bloglink\n\t\t\tFROM cms_blog_posts con\n\t\t\tINNER JOIN cms_blogs cat ON cat.id = con.blog_id AND cat.allow_who = 'all' AND cat.owner = 'user'\n\t\t\tWHERE MATCH(con.title, con.content) AGAINST ('{$query}' IN BOOLEAN MODE) AND con.published = 1 LIMIT 100";
    $result = $inDB->query($sql);
    if ($inDB->num_rows($result)) {
        cmsCore::loadLanguage('components/blogs');
        cmsCore::loadModel('blogs');
        $model = new cms_model_blogs();
        while ($item = $inDB->fetch_assoc($result)) {
            $result_array = array();
            $result_array['link'] = $model->getPostURL($item['bloglink'], $item['seolink']);
            $result_array['place'] = $_LANG['BLOG'] . ' &laquo;' . $item['cat_title'] . '&raquo;';
            $result_array['placelink'] = $model->getBlogURL($item['bloglink']);
            $result_array['description'] = $searchModel->getProposalWithSearchWord($item['content_html']);
            $result_array['title'] = $item['title'];
            $result_array['pubdate'] = $item['pubdate'];
            $result_array['session_id'] = session_id();
            $searchModel->addResult($result_array);
        }
    }
    return;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:25,代码来源:psearch.php

示例13: __construct

 public function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     $this->config = cmsCore::getInstance()->loadComponentConfig('clubs');
     cmsCore::loadLanguage('components/clubs');
     cmsCore::loadLib('karma');
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:7,代码来源:model.php

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

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


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