本文整理汇总了PHP中cmsDatabase类的典型用法代码示例。如果您正苦于以下问题:PHP cmsDatabase类的具体用法?PHP cmsDatabase怎么用?PHP cmsDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cmsDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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
示例3: mod_latest_faq
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;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:30,代码来源:module.php
示例4: 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
示例5: 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
示例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_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
示例8: __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
示例9: __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
示例10: 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
示例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: __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
示例13: 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
示例14: 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
示例15: 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'] . ' «' . $item['cat_title'] . '»';
$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
示例16: 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
示例17: __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
示例18: __construct
public function __construct($labels = array())
{
$this->inDB = cmsDatabase::getInstance();
$this->config = cmsCore::getInstance()->loadComponentConfig('comments');
cmsCore::loadLanguage('components/comments');
$this->labels = array_merge(self::getDefaultLabels(), $labels);
}
开发者ID:deltas1,项目名称:icms1,代码行数:7,代码来源:model.php
示例19: 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
示例20: rss_blogs
function rss_blogs($item_id, $cfg) {
if (!cmsCore::getInstance()->isComponentEnable('blogs')) { return false; }
$inDB = cmsDatabase::getInstance();
global $_LANG;
cmsCore::loadModel('blogs');
$model = new cms_model_blogs();
cmsCore::loadClass('blog');
$inBlog = cmsBlogs::getInstance();
$inBlog->owner = 'user';
$channel = array();
$items = array();
// Формируем канал
if ($item_id) {
$blog = $inBlog->getBlog($item_id);
if (!$blog) { return false; }
//Если доступа к блогу нет, возвращаемся
if (!cmsUser::checkUserContentAccess($blog['allow_who'], $blog['user_id'])) {
return false;
}
$inBlog->whereBlogIs($blog['id']);
$channel['title'] = $blog['title'];
$channel['description'] = $_LANG['NEW_POSTS_IN_BLOGS'];
$channel['link'] = HOST . $model->getBlogURL($blog['seolink']);
} else {
$channel['title'] = $_LANG['NEW_POSTS_IN_BLOGS'];
$channel['description'] = $_LANG['NEW_POSTS_IN_BLOGS'];
$channel['link'] = HOST .'/blogs';
}
// В RSS всегда только публичные посты
$inBlog->whereOnlyPublic();
$inDB->orderBy('p.pubdate', 'DESC');
$inDB->limit($cfg['maxitems']);
$posts = $inBlog->getPosts(false, $model, true);
if ($posts) {
foreach($posts as $post){
$post['link'] = HOST . $post['url'];
$post['description'] = mb_substr(strip_tags($post['content_html']), 0, 350). '...';
$post['comments'] = $post['link'].'#c';
$post['category'] = $post['blog_title'];
$items[] = $post;
}
}
return array('channel' => $channel, 'items' => $items);
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:59,代码来源:prss.php
注:本文中的cmsDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论