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


PHP cmsCore::getCommentsCount方法代码示例

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


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

示例1: updateCommentsCount

 public static function updateCommentsCount($target, $target_id)
 {
     $inDB = cmsDatabase::getInstance();
     // получаем данные о записи
     $post = $inDB->get_fields('cms_blog_posts', "id='{$target_id}'", 'id, blog_id');
     if (!$post) {
         return false;
     }
     // обновляем количество комментов для поста
     $pc_count = cmsCore::getCommentsCount($target, $post['id']);
     $inDB->query("UPDATE cms_blog_posts SET comments_count = '{$pc_count}' WHERE id = '{$post['id']}'");
     // обновляем общее количество комментов к постам в блоге
     $sql = "SELECT IFNULL(SUM(comments_count), 0) AS blog_comments_count\r\n\t\t\t\tFROM cms_blog_posts\r\n\t\t\t\tWHERE blog_id = '{$post['blog_id']}' GROUP BY blog_id";
     $result = $inDB->query($sql);
     if ($inDB->num_rows($result)) {
         $com = $inDB->fetch_assoc($result);
         $inDB->query("UPDATE cms_blogs SET comments_count = '{$com['blog_comments_count']}' WHERE id = '{$post['blog_id']}'");
     }
     return true;
 }
开发者ID:deltas1,项目名称:icms1,代码行数:20,代码来源:blog.class.php

示例2: getArticlesList

 /**
  * Получаем статьи по заданным параметрам
  * @return array
  */
 public function getArticlesList($only_published = true)
 {
     $today = date("Y-m-d H:i:s");
     if ($only_published) {
         $this->inDB->where("con.published = 1 AND con.pubdate <= '{$today}' AND (con.is_end=0 OR (con.is_end=1 AND con.enddate >= '{$today}'))");
     }
     $sql = "SELECT con.*,\r\n\t\t\t\t\t   cat.title as cat_title, cat.seolink as catseolink,\r\n\t\t\t\t\t   cat.showdesc,\r\n                       u.nickname as author,\r\n                       u.login as user_login\r\n                FROM cms_content con\r\n\t\t\t\tINNER JOIN cms_category cat ON cat.id = con.category_id\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = con.user_id\r\n                WHERE con.is_arhive = 0\r\n                      {$this->inDB->where}\r\n\r\n                {$this->inDB->group_by}\r\n\r\n                {$this->inDB->order_by}\n";
     if ($this->inDB->limit) {
         $sql .= "LIMIT {$this->inDB->limit}";
     }
     $result = $this->inDB->query($sql);
     $this->inDB->resetConditions();
     if (!$this->inDB->num_rows($result)) {
         return false;
     }
     while ($article = $this->inDB->fetch_assoc($result)) {
         $article['fpubdate'] = cmsCore::dateFormat($article['pubdate']);
         $article['ffpubdate'] = date('c', strtotime($article['pubdate']));
         $article['tagline'] = cmsTagLine('content', $article['id'], true);
         $article['comments'] = cmsCore::getCommentsCount('article', $article['id']);
         $article['url'] = $this->getArticleURL(null, $article['seolink']);
         $article['cat_url'] = $this->getCategoryURL(null, $article['catseolink']);
         $article['image'] = file_exists(PATH . '/images/photos/small/article' . $article['id'] . '.jpg') ? 'article' . $article['id'] . '.jpg' : '';
         $articles[] = $article;
     }
     $articles = cmsCore::callEvent('GET_ARTICLES', $articles);
     return translations::process(cmsConfig::getConfig('lang'), 'content_content', $articles);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:32,代码来源:model.php

示例3: getPhotos

    /**
     * Возвращает массив фотографий по заданным условиям
     * @param bool $show_all
     * @param bool $is_rating
     * @return array $photos
     */
    public function getPhotos($show_all = false, $is_comments_count = false){
        $pub_where = ($show_all ? '1=1' : 'f.published = 1');

        $sql = "SELECT f.* ". cmsCore::c('db')->select ."
                        FROM cms_photo_files f
                        ". cmsCore::c('db')->join ."
                        WHERE ". $pub_where ."
                        ". cmsCore::c('db')->where ."
                        ". cmsCore::c('db')->group_by ."
                        ". cmsCore::c('db')->order_by ."\n";

        if (cmsCore::c('db')->limit){
            $sql .= "LIMIT ". cmsCore::c('db')->limit;
        }

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

        cmsCore::c('db')->resetConditions();

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

        $photos = array();

        while ($photo = cmsCore::c('db')->fetch_assoc($result)){
            if($is_comments_count){
                $photo['comments'] = cmsCore::getCommentsCount(($photo['owner']=='photos' ? 'photo' : 'club_photo'), $photo['id']);
            }
            $photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], false, false, false);
            $photos[] = $photo;
        }

        return cmsCore::callEvent('GET_PHOTOS', $photos);
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:39,代码来源:photo.class.php

示例4: getArticlesList

    /**
     * Получаем статьи по заданным параметрам
     * @return array
     */
    public function getArticlesList($only_published=true) {
        $today = date("Y-m-d H:i:s");

        if ($only_published) {
            cmsCore::c('db')->where("con.published = 1 AND con.pubdate <= '". $today ."'");
        }

        $sql = "SELECT con.*,
                    con.pubdate as fpubdate,
                    cat.title as cat_title, cat.seolink as catseolink,
                    cat.showdesc,
                    u.nickname as author,
                    u.login as user_login
                FROM cms_content con
                INNER JOIN cms_category cat ON cat.id = con.category_id
                LEFT JOIN cms_users u ON u.id = con.user_id
                WHERE con.is_arhive = 0
                ". cmsCore::c('db')->where ."
                ". cmsCore::c('db')->group_by ."
                ". cmsCore::c('db')->order_by. "\n";

        if (cmsCore::c('db')->limit) {
            $sql .= "LIMIT ". cmsCore::c('db')->limit;
        }

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

        cmsCore::c('db')->resetConditions();

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

        while ($article = cmsCore::c('db')->fetch_assoc($result)) {
            $article['fpubdate'] = cmsCore::dateFormat($article['fpubdate']);
            $article['tagline']  = cmsTagLine('content', $article['id'], true);
            $article['comments'] = cmsCore::getCommentsCount('article', $article['id']);
            $article['url']      = $this->getArticleURL(null, $article['seolink']);
            $article['cat_url']  = $this->getCategoryURL(null, $article['catseolink']);
            
            if (file_exists(PATH .'/images/content/medium/'. ceil($article['id']/100) .'/article'. $article['id' ] .'.jpg')) {
                $article['image'] = '/images/content/medium/'. ceil($article['id']/100) .'/article'. $article['id' ] .'.jpg';
                $article['image_small'] = '/images/content/small/'. ceil($article['id']/100) .'/article'. $article['id' ] .'.jpg';
            }
            
            if (!empty($article['images'])) { $article['images'] = json_decode($article['images'], true); }
            
            $articles[] = $article;
        }

        $articles = cmsCore::callEvent('GET_ARTICLES', $articles);

        return $articles;
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:56,代码来源:model.php

示例5: getPhotos

 /**
  * Возвращает массив фотографий по заданным условиям
  * @param bool $show_all
  * @param bool $is_rating
  * @return array $photos
  */
 public function getPhotos($show_all = false, $is_comments_count = false)
 {
     $pub_where = $show_all ? '1=1' : 'f.published = 1';
     $sql = "SELECT f.* {$this->inDB->select}\r\n\r\n                FROM cms_photo_files f\r\n\t\t\t\t{$this->inDB->join}\r\n                WHERE {$pub_where}\r\n                      {$this->inDB->where}\r\n\r\n                {$this->inDB->group_by}\r\n\r\n                {$this->inDB->order_by}\n";
     if ($this->inDB->limit) {
         $sql .= "LIMIT {$this->inDB->limit}";
     }
     $result = $this->inDB->query($sql);
     $this->inDB->resetConditions();
     if (!$this->inDB->num_rows($result)) {
         return false;
     }
     $photos = array();
     while ($photo = $this->inDB->fetch_assoc($result)) {
         if ($is_comments_count) {
             $photo['comments'] = cmsCore::getCommentsCount($photo['owner'] == 'photos' ? 'photo' : 'club_photo', $photo['id']);
         }
         $photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], false, false, false);
         $photos[] = $photo;
     }
     return cmsCore::callEvent('GET_PHOTOS', $photos);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:28,代码来源:photo.class.php

示例6: getAdverts

 public function getAdverts($show_all = false, $is_users = false, $is_coments = false, $is_cats = false)
 {
     $this->deleteOldRecords();
     $this->clearOldVips();
     //подготовим условия
     $pub_where = $show_all ? '1=1' : 'i.published = 1';
     $r_join = $is_users ? " LEFT JOIN cms_users u ON u.id = i.user_id \n" : '';
     $r_join .= $is_cats ? " INNER JOIN cms_board_cats cat ON cat.id = i.category_id" : '';
     $r_select = $is_users ? ', u.login, u.nickname' : '';
     $r_select .= $is_cats ? ', cat.title as cat_title, cat.obtypes' : '';
     $sql = "SELECT i.*{$r_select}\r\n\r\n                FROM cms_board_items i\r\n\t\t\t\t{$r_join}\r\n                WHERE {$pub_where}\r\n                      {$this->inDB->where}\r\n\r\n                {$this->inDB->group_by}\r\n\r\n                {$this->inDB->order_by}\n";
     if ($this->inDB->limit) {
         $sql .= "LIMIT {$this->inDB->limit}";
     }
     $result = $this->inDB->query($sql);
     $this->inDB->resetConditions();
     if (!$this->inDB->num_rows($result)) {
         return false;
     }
     $records = array();
     while ($item = $this->inDB->fetch_assoc($result)) {
         if ($is_coments) {
             $item['comments'] = cmsCore::getCommentsCount('boarditem', $item['id']);
         }
         $item['content'] = nl2br($item['content']);
         $item['content'] = $this->config['auto_link'] ? $this->inCore->parseSmiles($item['content']) : $item['content'];
         $item['title'] = $item['obtype'] . ' ' . $item['title'];
         $item['fpubdate'] = cmsCore::dateFormat($item['pubdate']);
         $item['enc_city'] = urlencode($item['city']);
         if (!$item['file'] || !file_exists(PATH . '/images/board/small/' . $item['file'])) {
             $item['file'] = 'nopic.jpg';
         }
         // Права доступа
         $item['moderator'] = $this->checkAccess($item['user_id']);
         $timedifference = strtotime("now") - strtotime($item['pubdate']);
         $item['is_overdue'] = round($timedifference / 86400) > $item['pubdays'] && $item['pubdays'] > 0;
         $records[] = $item;
     }
     return cmsCore::callEvent('GET_BOARD_RECORDS', $records);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:40,代码来源:model.php

示例7: getArticlesList2

 /**
  * Получаем статьи по id категориям
  * @return array
  */
 public function getArticlesList2($only_published = true, $cat_id = '1')
 {
     $today = date("Y-m-d H:i:s");
     if ($only_published) {
         $this->inDB->where("con.published = 1 AND con.pubdate <= '{$today}' AND (con.is_end=0 OR (con.is_end=1 AND con.enddate >= '{$today}')) AND con.category_id = '{$cat_id}'");
     }
     $sql = "SELECT con.*,\n                       con.pubdate as fpubdate,\n\t\t\t\t\t   cat.title as cat_title, cat.seolink as catseolink,\n\t\t\t\t\t   cat.showdesc, cat.description as catdescription,\n                       u.nickname as author,\n                       u.login as user_login\n                FROM cms_content con\n\t\t\t\tINNER JOIN cms_category cat ON cat.id = con.category_id\n\t\t\t\tLEFT JOIN cms_users u ON u.id = con.user_id\n                WHERE con.is_arhive = 0\n                      {$this->inDB->where}\n\n                {$this->inDB->group_by}\n\n                ORDER BY con.ordering\n";
     if ($this->inDB->limit) {
         $sql .= "LIMIT {$this->inDB->limit}";
     }
     $result = $this->inDB->query($sql);
     $this->inDB->resetConditions();
     if (!$this->inDB->num_rows($result)) {
         return false;
     }
     while ($article = $this->inDB->fetch_assoc($result)) {
         $article['fpubdate'] = cmsCore::dateFormat($article['fpubdate']);
         $article['tagline'] = cmsTagLine('content', $article['id'], true);
         $article['comments'] = cmsCore::getCommentsCount('article', $article['id']);
         $article['url'] = $this->getArticleURL(null, $article['seolink']);
         $article['cat_url'] = $this->getCategoryURL(null, $article['catseolink']);
         if (isset($_SESSION['lang']) && $_SESSION['lang'] != 'ru') {
             $article['image'] = file_exists(PATH . '/images/photos/small/article' . $article['id'] . '_' . $_SESSION['lang'] . '.jpg') ? 'article' . $article['id'] . '_' . $_SESSION['lang'] . '.jpg' : '';
         } else {
             $article['image'] = file_exists(PATH . '/images/photos/small/article' . $article['id'] . '.jpg') ? 'article' . $article['id'] . '.jpg' : '';
         }
         $articles[] = $article;
     }
     $articles = cmsCore::callEvent('GET_ARTICLES', $articles);
     return $articles;
 }
开发者ID:vicktorwork,项目名称:cms1,代码行数:35,代码来源:model.php

示例8: mod_photo

function mod_photo($mod, $cfg) {
    $cfg = array_merge(array(
        'user_photos' => 0,
        'is_full'     => 1,
        'showmore'    => 1,
        'album_id'    => 0,
        'whatphoto'   => 'all',
        'shownum'     => 5,
        'maxcols'     => 2,
        'sort'        => 'pubdate',
        'showclubs'   => 0,
        'is_subs'     => 1,
        'is_lightbox' => 1
    ), $cfg);

    // Задаем период
    cmsCore::c('photo')->wherePeriodIs($cfg['whatphoto']);
    
    //устанавливаем номер текущей страницы и кол-во фото на странице
    cmsCore::c('db')->limit($cfg['shownum']);
    
    if (!$cfg['user_photos']) {
        // выбираем категории фото
        cmsCore::c('db')->addJoin('INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.published = 1');
        cmsCore::c('db')->addSelect('a.title as cat_title, a.NSDiffer');

        // если категория задана, выбираем из нее
        if ($cfg['album_id']) {
            // Если выбирать нужно включая вложенные
            if ($cfg['is_subs']) {
                // получаем категорию
                $album = cmsCore::c('db')->getNsCategory('cms_photo_albums', $cfg['album_id']);
                if (!$album) { return false; }

                cmsCore::c('photo')->whereThisAndNestedCats($album['NSLeft'], $album['NSRight']);
            } else {
                cmsCore::c('photo')->whereAlbumIs($cfg['album_id']);
            }
        }

        // если фото клубов не нужны
        if (!$cfg['showclubs']) {
            cmsCore::c('db')->where("f.owner = 'photos'");
        }

        //устанавливаем сортировку
        cmsCore::c('db')->orderBy('f.'.$cfg['sort'], 'DESC');

        // получаем фото
        $photos = cmsCore::c('photo')->getPhotos(false, $cfg['is_full']);
        
        if (empty($photos)) { return false; }
        
        $tpl = $cfg['tpl'];
    } else {
        if ($cfg['sort'] == 'rating') { $cfg['sort'] = 'hits'; }
        
        $sql = "SELECT u.id uid, u.nickname author, u.login as login, f.title, f.id, f.album_id, pr.gender gender, f.imageurl as file, f.pubdate, a.title as album_title FROM cms_user_photos f
		INNER JOIN cms_user_albums a ON a.id = f.album_id
                LEFT JOIN cms_users u ON u.id = f.user_id
                LEFT JOIN cms_user_profiles pr ON pr.user_id = u.id
                WHERE f.allow_who='all' AND u.is_deleted = 0 AND u.is_locked = 0
                      AND f.album_id > 0 AND a.allow_who = 'all'
                      ". cmsCore::c('db')->where ."
                ORDER BY f.". $cfg['sort'] ." DESC \n";

        if (cmsCore::c('db')->limit) {
            $sql .= "LIMIT ". cmsCore::c('db')->limit;
        }

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

        cmsCore::c('db')->resetConditions();

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

        $photos = array();

        while ($photo = cmsCore::c('db')->fetch_assoc($result)) {
            if ($cfg['is_full']) {
                $photo['comments'] = cmsCore::getCommentsCount('userphoto', $photo['id']);
            }

            $photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], false, false, false);
            $photos[] = $photo;
        }
        
        cmsCore::callEvent('GET_PHOTOS', $photos);
        
        $tpl = 'mod_user_photo';
    }
    
    cmsPage::initTemplate('modules', $tpl)->
        assign('photos', $photos)->
        assign('cfg', $cfg)->
        display();

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


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