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


PHP cmsCore::dateFormat方法代码示例

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


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

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

示例2: mod_calendar_eventview

function mod_calendar_eventview($module_id, $cfg)
{
    $inCore = cmsCore::getInstance();
    $inCore->loadModel('calendar');
    $c_cfg = $inCore->loadComponentConfig('calendar');
    $model = new cms_model_calendar();
    if (!$cfg['event_rate']) {
        $cfg['event_rate'] = 7;
    }
    $start = time();
    $end = $start + $cfg['event_rate'] * 24 * 60 * 60;
    $events = $model->getCalendar($start, $end);
    $smarty = cmsPage::initTemplate('modules', 'mod_calendar_eventview.tpl');
    $smarty->assign('events', $events);
    $smarty->assign('start', $start);
    $smarty->assign('end', $end);
    $smarty->assign('f_start', cmsCore::dateFormat(date('Y-m-d H:i:s', $start), 0, 0, 0));
    $smarty->assign('f_end', cmsCore::dateFormat(date('Y-m-d H:i:s', $end), 0, 0, 0));
    $smarty->display('mod_calendar_eventview.tpl');
    return true;
}
开发者ID:roman-burachenko,项目名称:icms-calendar,代码行数:21,代码来源:module.php

示例3: mod_latest_faq

function mod_latest_faq($mod, $cfg) {
    $cfg = array_merge(array(
        'newscount' => 2,
        'cat_id'    => 0,
        'maxlen'    => 120
    ), $cfg);

    if ($cfg['cat_id']) {
        $catsql = 'AND category_id = '. $cfg['cat_id'];
    } else {
        $catsql = '';
    }

    $sql = "SELECT *
            FROM cms_faq_quests
            WHERE published = 1 ". $catsql ."
            ORDER BY pubdate DESC
            LIMIT ". $cfg['newscount'];

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

    $faq = array();

    if (cmsCore::c('db')->num_rows($result)) {
        while($con = cmsCore::c('db')->fetch_assoc($result)) {
            $con['date'] = cmsCore::dateFormat($con['pubdate']);
            $con['href'] = '/faq/quest'.$con['id'].'.html';
            $faq[] = $con;
        }
    }

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

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

示例4: applet_tickets


//.........这里部分代码省略.........
                    'cms_ticket',
                    array('status' => 1, 'secret_key' => $result['secret_key']),
                    $item['id']
                );

                cmsCore::addSessionMessage($_LANG['AD_TICKET_SENDED'], 'success');
            } else {
                cmsCore::addSessionMessage($_LANG['AD_TICKET_UNKNOWN_ERROR'], 'error');
                cmsCore::c('db')->delete('cms_ticket', 'id='. $item['id']);
            }
        } else {
            cmsCore::addSessionMessage($_LANG['AD_TICKET_ERROR'], 'error');
        }
        
        cmsCore::redirect('index.php?view=tickets');
    }
    
    if ($do == 'view') {
        $id = cmsCore::request('id', 'int', 0);
        $item = cmsCore::c('db')->get_fields('cms_ticket', 'id='. $id, '*');
        
        if (empty($item) || ($item['user_id'] != cmsCore::c('user')->id && !$super_user)) {
            cmsCore::addSessionMessage($_LANG['AD_TICKET_ERROR'], 'error');
            cmsCore::redirect('index.php?view=tickets');
        }
        
        cpAddPathway($item['title'], 'index.php?view=tickets&do=view&id='. $item['id']);
        
        if ($item['msg_count'] > 1) {
            $item['msgs'] = array();
            $results = cmsCore::c('db')->query("SELECT * FROM cms_ticket_msg WHERE ticket_id=". $item['id'] ." ORDER BY pubdate ASC");
            if (cmsCore::c('db')->num_rows($results)) {
                while($msg = cmsCore::c('db')->fetch_assoc($results)) {
                    $msg['pubdate'] = cmsCore::dateFormat($msg['pubdate']);
                    $item['msgs'][] = $msg;
                }
            }
        }
        
        if ($item['status'] != 3) {
            switch($item['priority']) {
                case 0: $class = 'info'; break;
                case 1: $class = 'success'; break;
                case 2: $class = 'primary'; break;
                case 3: $class = 'danger'; break;
            }
        }else {
            $class = 'default';
        }
?>
<div class="panel panel-<?php echo $class; ?>" style="width:650px;">
    <div class="panel-heading">
        <h4>Тема: <?php echo $item['title']; ?></h4>
        <div><?php echo $item['msg']; ?></div>
    </div>
    
    <div class="panel-body">
        <?php if (!empty($item['msgs'])) {
            foreach ($item['msgs'] as $msg) {
        ?>
            <div style="text-align: <?php if (!empty($msg['support'])) { echo 'right'; } else { echo 'left'; } ?>;">
                <span>
                    <i class="fa fa-calendar-o"></i>
                    <?php echo $msg['pubdate']; ?>
                </span>
                <?php if (!empty($msg['support'])) { ?>
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:tickets.php

示例5: getUserFiles

	public function getUserFiles($for_all=false){

        if (!$for_all){
            $allowsql = "allow_who='all'";
        } else {
            $allowsql = '1=1';
        }

        $sql = "SELECT *
                FROM cms_user_files
                WHERE {$allowsql}
                {$this->inDB->where}
                {$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 array(); }

        $rownum = 0;

		while($file = $this->inDB->fetch_assoc($result)){

			$file['pubdate']  = cmsCore::dateFormat($file['pubdate']);
            $file['filelink'] = HOST.'/users/files/download'.$file['id'].'.html';
            $file['fileicon'] = cmsCore::fileIcon($file['filename']);
            $file['mb'] 	  = round(($file['filesize']/1024)/1024, 2); if ($file['mb'] == '0') { $file['mb'] = '~ 0'; }
            $file['rownum']   = $rownum; $rownum++;

			$files[] = $file;
		}

		return $files;

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

示例6: getPoll

 /**
  * Возвращает опрос
  * @param str $where условия запроса
  * @return int
  */
 public function getPoll($where)
 {
     $poll = $this->inDB->get_fields('cms_forum_polls', $where, '*');
     if (!$poll) {
         return false;
     }
     global $_LANG;
     $poll['answers'] = cmsCore::yamlToArray($poll['answers']);
     $num = 1;
     foreach ($poll['answers'] as $key => $value) {
         $poll['answers_key'][$num] = $key;
         $num++;
     }
     $poll['options'] = cmsCore::yamlToArray($poll['options']);
     switch ($poll['options']['result']) {
         case 0:
             $poll['options']['result_text'] = $_LANG['AVAILABLE_FOR_ALL'];
             break;
         case 1:
             $poll['options']['result_text'] = $_LANG['AVAILABLE_FOR_VOTERS'];
             break;
         case 2:
             $poll['options']['result_text'] = $_LANG['AVAILABLE_AFTER_VOTE'];
             break;
     }
     switch ($poll['options']['change']) {
         case 0:
             $poll['options']['change_text'] = $_LANG['PROHIBITED'];
             break;
         case 1:
             $poll['options']['change_text'] = $_LANG['ALLOW'];
             break;
     }
     $poll['days_left'] = round((strtotime($poll['enddate']) - time()) / 86400);
     $poll['days_left'] = $poll['days_left'] < 0 ? 0 : $poll['days_left'];
     $poll['is_closed'] = $poll['days_left'] <= 0;
     $poll['is_user_vote'] = $this->isUserVoted($poll['id']);
     // совместимость старых типов ответов, по id
     // если пользователь проголосовал
     if (!is_bool($poll['is_user_vote'])) {
         if (is_numeric($poll['is_user_vote'])) {
             $poll['is_user_vote'] = $poll['answers_key'][$poll['is_user_vote']];
         }
     }
     $poll['vote_count'] = $this->getVoteCount($poll['answers']);
     $poll['fenddate'] = cmsCore::dateFormat($poll['enddate']);
     $poll['show_result'] = false;
     return cmsCore::callEvent('GET_THREAD_POLL', $poll);
 }
开发者ID:r2git,项目名称:icms1,代码行数:54,代码来源:model.php

示例7: calendar

function calendar()
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inUser = cmsUser::getInstance();
    $inCore->loadModel('calendar');
    $model = new cms_model_calendar();
    $do = $inCore->request('do', 'str', 'view');
    $cfg = $inCore->loadComponentConfig('calendar');
    if ($do == 'view') {
        $inPage->setTitle("Календарь событий");
        $inPage->addPathway("Календарь", "/calendar");
        $smarty = $inPage->initTemplate('components', 'com_calendar_view.tpl');
        $category_id = $inCore->request('category_id', 'int', 0);
        $can_add = FALSE;
        $moderated = TRUE;
        if ($cfg['group_' . $inUser->group_id]) {
            $can_add = TRUE;
            $moderated = FALSE;
        } elseif ($cfg['m_group_' . $inUser->group_id]) {
            $can_add = TRUE;
            $moderated = TRUE;
        }
        if ($inUser->is_admin) {
            $can_add = TRUE;
        }
        $catigories = $model->getAllCategories();
        if ($category_id) {
            $category = $category_id;
            $cat = $model->getCategory($category);
            $inPage->addPathway($cat['name']);
        } else {
            $category = "all";
        }
        if ($cfg['calendar_view'] == 'afisha') {
            $inCore->redirect('/calendar/list.html');
        }
        $smarty->assign('can_add', $can_add);
        $smarty->assign('cfg', $cfg);
        $smarty->assign('catigories', $catigories);
        $smarty->assign('category', $category);
        $smarty->display('com_calendar_view.tpl');
        return;
    }
    if ($do == "list") {
        $inPage->addPathway("Календарь", "/calendar");
        $inPage->addPathway("Афиша");
        $per_day = 10;
        //Количество сообытий в дне максимум
        $display_days = 5;
        //количество дней которые показывается на странице
        $dayt = 60 * 60 * 24;
        //Продолжительность дня в секундах
        $start_time = strtotime(date('Y-m-d', time()) . " 00:00:00") - $dayt;
        //Определяем утро сегодняшнего дня
        $output = array();
        for ($i = 0; $i < $display_days; $i++) {
            $start = strtotime(date('Y-m-d', $start_time + $dayt * $i));
            $n = date("N", $start + 1);
            //Определяем заголовок блока дня
            if ($i == 0) {
                $day['title'] = "Сегодня";
            } elseif ($i == 1) {
                $day['title'] = "Завтра";
            } else {
                $day['title'] = $inCore->dateFormat(date('Y-m-d H:i:s', $start_time + $dayt * ($i + 1)));
            }
            $day['events'] = $model->getCalendar($start, $start + 86400);
            //Определяем активные встречи за временной период
            $output[] = $day;
        }
        $inPage->setTitle("Календарь событий");
        $smarty = $inPage->initTemplate('components', 'com_calendar_list.tpl');
        $smarty->assign('events', $output);
        $smarty->assign('cfg', $cfg);
        $smarty->display('com_calendar_list.tpl');
    }
    if ($do == "view_event") {
        $event_id = $inCore->request('event_id', 'int', 0);
        $event = $model->getEvent($event_id);
        /*FOTOLIB*/
        include 'fotolib.class.php';
        $foto = new FotoLib();
        //Проверяем можем ли добавлять фото
        $allow_add_foto = $foto->addAcces("calendar", $event);
        if ($_FILES) {
            $foto->uploadFoto($_FILES, "calendar", $event_id);
        }
        $images = $foto->loadImages("calendar", $event_id);
        /*FOTOLIB*/
        if (!$event) {
            cmsCore::addSessionMessage('Ошибка запроса', 'error');
            $inCore->redirect('/calendar');
            exit;
        } elseif ($event['hide'] == 1 and !$inUser->is_admin) {
            cmsCore::addSessionMessage('Ошибка доступа', 'error');
            $inCore->redirect('/calendar');
            exit;
        } else {
            if ($event['type'] == 'private' and $event['author_id'] != $inUser->id) {
//.........这里部分代码省略.........
开发者ID:roman-burachenko,项目名称:icms-calendar,代码行数:101,代码来源:frontend.php

示例8: getPost

 /**
  * Возвращает блог по ссылке или по id
  * @param int or string $id_or_link
  * @return array $blog
  */
 public function getPost($id_or_link = 0)
 {
     if (is_numeric($id_or_link)) {
         $where = "p.id = '{$id_or_link}'";
     } else {
         $where = "p.seolink = '{$id_or_link}'";
     }
     $sql = "SELECT p.*,\r\n\t\t\t\t\t   u.nickname as author_nickname,\r\n\t\t\t\t\t   u.login as author_login,\r\n\t\t\t\t\t   up.imageurl as author_image,\r\n\t\t\t\t\t   u.is_deleted as author_deleted\r\n\t\t\t\tFROM cms_blog_posts p\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = p.user_id\r\n\t\t\t\tLEFT JOIN cms_user_profiles up ON up.user_id = u.id\r\n\t\t\t\tWHERE {$where} LIMIT 1";
     $result = $this->inDB->query($sql);
     if (!$this->inDB->num_rows($result)) {
         return false;
     }
     global $_LANG;
     $post = $this->inDB->fetch_assoc($result);
     $post['feditdate'] = cmsCore::dateFormat($post['edit_date']);
     $post['fpubdate'] = cmsCore::dateDiffNow($post['pubdate']) . ' ' . $_LANG['BACK'] . ' (' . cmsCore::dateFormat($post['pubdate']) . ')';
     //Убираем тег [cut]
     $post['content_html'] = preg_replace('/\\[(cut=)\\s*(.*?)\\]/ui', '', $post['content_html']);
     $post['author_avatar'] = cmsUser::getUserAvatarUrl($post['user_id'], 'small', $post['author_image'], $post['author_deleted']);
     return cmsCore::callEvent('GET_POST', $post);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:26,代码来源:blog.class.php

示例9: round

 if (!$usr) {
     cmsCore::error404();
 }
 cmsCore::loadLib('tags');
 $sql = "SELECT p.*, a.title as album, pr.gender\n            FROM cms_user_photos p\n\t\t\tINNER JOIN cms_user_albums a ON a.id = p.album_id\n\t\t\tINNER JOIN cms_user_profiles pr ON pr.user_id = p.user_id\n            WHERE p.id = '{$photoid}' AND p.user_id = '{$id}' LIMIT 1";
 $result = $inDB->query($sql);
 if (!$inDB->num_rows($result)) {
     cmsCore::error404();
 }
 $photo = $inDB->fetch_assoc($result);
 $inPage->setTitle($photo['title']);
 $inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
 $inPage->addPathway($_LANG['PHOTOALBUMS'], '/users/' . $usr['id'] . '/photoalbum.html');
 $inPage->addPathway($photo['album'], '/users/' . $usr['login'] . '/photos/private' . $photo['album_id'] . '.html');
 $inPage->addPathway($photo['title']);
 $photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], true, false, false);
 $photo['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $photo['gender'], $usr['login']);
 $photo['filesize'] = round(filesize(PATH . '/images/users/photos/medium/' . $photo['imageurl']) / 1024, 2);
 //ссылки на предыдущую и следующую фотографии
 $previd = $inDB->get_fields('cms_user_photos', "id>'{$photo['id']}' AND user_id = '{$usr['id']}' AND album_id='{$photo['album_id']}'", 'id, title, pubdate', 'id ASC');
 $nextid = $inDB->get_fields('cms_user_photos', "id<'{$photo['id']}' AND user_id = '{$usr['id']}' AND album_id='{$photo['album_id']}'", 'id, title, pubdate', 'id DESC');
 // Проверяем права доступа
 $is_allow = cmsUser::checkUserContentAccess($photo['allow_who'], $id);
 // Если видим фото, обновляем просмотры
 if ($is_allow) {
     $inDB->query("UPDATE cms_user_photos SET hits = hits + 1 WHERE id = " . $photo['id']);
 }
 cmsPage::initTemplate('components', 'com_users_photos_view')->assign('photo', $photo)->assign('bbcode', '[IMG]' . HOST . '/images/users/photos/medium/' . $photo['imageurl'] . '[/IMG]')->assign('previd', $previd)->assign('nextid', $nextid)->assign('usr', $usr)->assign('myprofile', $myprofile)->assign('is_admin', cmsUser::userIsAdmin($inUser->id))->assign('is_allow', $is_allow)->assign('tagbar', $is_allow ? cmsTagBar('userphoto', $photo['id']) : '')->display('com_users_photos_view.tpl');
 if ($inCore->isComponentInstalled('comments') && $is_allow) {
     cmsCore::includeComments();
     comments('userphoto', $photo['id']);
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:photos.php

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

示例11: getUserWall

 /**
  * Возвращает html стены пользователя
  * @param int $selected
  * @param array $exclude
  * @return html
  */
 public static function getUserWall($target_id, $component = 'users', $my_profile = 0, $is_admin = 0)
 {
     $inDB = cmsDatabase::getInstance();
     $inUser = self::getInstance();
     cmsCore::loadLanguage('components/' . $component);
     if (!$my_profile && !$is_admin) {
         $my_profile = $inUser->is_admin;
     }
     $records = array();
     //получаем общее число записей на стене этого пользователя
     $total = $inDB->rows_count('cms_user_wall', "user_id = '{$target_id}' AND usertype = '{$component}'");
     if ($total) {
         $sql = "SELECT w.*, g.gender, g.imageurl, u.nickname as author, u.login as author_login, u.is_deleted, w.pubdate\n                    FROM cms_user_wall w\n\t\t\t\t\tINNER JOIN cms_users u ON u.id = w.author_id\n\t\t\t\t\tINNER JOIN cms_user_profiles g ON g.user_id = u.id\n                    WHERE w.user_id = '{$target_id}' AND w.usertype = '{$component}'\n                    ORDER BY w.pubdate DESC\n";
         if ($inDB->limit) {
             $sql .= "LIMIT {$inDB->limit}";
         }
         $result = $inDB->query($sql);
         $inDB->resetConditions();
         while ($record = $inDB->fetch_assoc($result)) {
             $record['is_today'] = time() - strtotime($record['pubdate']) < 86400;
             $record['fpubdate'] = $record['is_today'] ? cmsCore::dateDiffNow($record['pubdate']) : cmsCore::dateFormat($record['pubdate']);
             $record['avatar'] = cmsUser::getUserAvatarUrl($record['author_id'], 'small', $record['imageurl'], $record['is_deleted']);
             $records[] = $record;
         }
         $records = cmsCore::callEvent('GET_WALL_POSTS', $records);
     }
     ob_start();
     cmsPage::initTemplate('components', 'com_users_wall')->assign('records', $records)->assign('user_id', $inUser->id)->assign('target_id', $target_id)->assign('my_profile', $my_profile)->assign('is_admin', $is_admin)->assign('component', $component)->assign('total', $total)->assign('pagebar', cmsPage::getPagebar($total, $inDB->page, $inDB->perpage, 'javascript:wallPage(%page%)'))->display('com_users_wall.tpl');
     return ob_get_clean();
 }
开发者ID:vicktorwork,项目名称:cms1,代码行数:36,代码来源:user.class.php

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

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

示例14: getRecord

 public function getRecord($item_id)
 {
     $this->deleteOldRecords();
     $this->clearOldVips();
     $sql = "SELECT i.*,\r\n                       a.id as cat_id,\r\n\t\t\t\t\t   a.form_id,\r\n                       a.NSLeft as NSLeft,\r\n                       a.NSRight as NSRight,\r\n                       a.title as cat_title,\r\n                       a.title as category,\r\n                       a.public as public,\r\n                       a.thumb1 as thumb1,\r\n                       a.thumb2 as thumb2,\r\n                       a.thumbsqr as thumbsqr,\r\n                       u.nickname as user,\r\n                       u.is_deleted as user_is_deleted,\r\n                       u.login as user_login\r\n                FROM cms_board_items i\r\n\t\t\t\tINNER JOIN cms_board_cats a ON a.id = i.category_id\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = i.user_id\r\n                WHERE i.id = '{$item_id}'";
     $result = $this->inDB->query($sql);
     if (!$this->inDB->num_rows($result)) {
         return false;
     }
     $record = $this->inDB->fetch_assoc($result);
     $timedifference = strtotime("now") - strtotime($record['pubdate']);
     $record['is_overdue'] = round($timedifference / 86400) > $record['pubdays'] && $record['pubdays'] > 0;
     $record['fpubdate'] = $record['pubdate'];
     $record['pubdate'] = cmsCore::dateFormat($record['pubdate']);
     $record['vipdate'] = cmsCore::dateFormat($record['vipdate']);
     $record['enc_city'] = urlencode($record['city']);
     $record['moderator'] = $this->checkAccess($record['user_id']);
     if (!$record['file'] || !file_exists(PATH . '/images/board/small/' . $record['file'])) {
         $record['file'] = '';
     }
     if (!$record['formsdata']) {
         $record['form_array'] = array();
     } else {
         $record['form_array'] = cmsCore::yamlToArray($record['formsdata']);
     }
     return cmsCore::callEvent('GET_BOARD_RECORD', $record);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:27,代码来源:model.php

示例15: getComments

 /**
  * Получаем комментарии по заданным параметрам
  * @return array
  */
 public function getComments($only_published = true, $is_tree = false, $from_module = false)
 {
     $inUser = cmsUser::getInstance();
     $comments = array();
     global $_LANG;
     $published = $only_published ? 'c.published = 1' : '1=1';
     $sql = "SELECT c.*,\r\n\t\t\t\t\t   IFNULL(u.nickname, 0) as nickname,\r\n\t\t\t\t\t   IFNULL(u.login, 0) as login,\r\n\t\t\t\t\t   IFNULL(u.is_deleted, 0) as is_deleted,\r\n\t\t\t\t\t   IFNULL(p.imageurl, 0) as imageurl,\r\n\t\t\t\t\t   IFNULL(p.gender, 0) as gender\r\n                FROM cms_comments c\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = c.user_id\r\n\t\t\t\tLEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n                WHERE {$published}\r\n\t\t\t\t\t{$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 array();
     }
     while ($comment = $this->inDB->fetch_assoc($result)) {
         $comment['level'] = 0;
         $comment['is_editable'] = $this->isEditable($comment['pubdate']);
         $comment['fpubdate'] = cmsCore::dateFormat($comment['pubdate'], true, true);
         if ($comment['guestname']) {
             $comment['author'] = $comment['guestname'];
             $comment['is_profile'] = false;
             $comment['ip'] = in_array($this->config['cmm_ip'], array(1, 2)) ? $comment['ip'] : '';
         } else {
             $comment['author']['nickname'] = $comment['nickname'];
             $comment['author']['login'] = $comment['login'];
             $comment['is_profile'] = true;
             $comment['user_image'] = cmsUser::getUserAvatarUrl($comment['user_id'], 'small', $comment['imageurl'], $comment['is_deleted']);
             $comment['ip'] = $this->config['cmm_ip'] == 2 && $comment['ip'] ? $comment['ip'] : '';
         }
         switch ($comment['gender']) {
             case 'm':
                 $comment['gender'] = $_LANG['COMMENTS_MALE'];
                 break;
             case 'f':
                 $comment['gender'] = $_LANG['COMMENTS_FEMALE'];
                 break;
             default:
                 $comment['gender'] = $_LANG['COMMENTS_GENDER'];
         }
         $comment['show'] = !$this->config['min_karma'] || $comment['rating'] >= $this->config['min_karma_show'] || cmsUser::userIsAdmin($comment['user_id']);
         $comment['is_my'] = $inUser->id == $comment['user_id'];
         if ($inUser->id) {
             $comment['is_voted'] = $comment['is_my'] ? true : cmsUser::isRateUser('comment', $inUser->id, $comment['id']);
         } else {
             $comment['is_voted'] = true;
         }
         $comments[] = $comment;
     }
     if ($is_tree) {
         $comments = $this->buildTree(0, 0, $comments);
     }
     return $from_module ? cmsCore::callEvent('GET_COMMENTS_MODULE', $comments) : cmsCore::callEvent('GET_COMMENTS', $comments);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:58,代码来源:model.php


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