Exemplo n.º 1
0
 public function actionView()
 {
     $id = zmf::val('id', 2);
     if (!$id) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $info = $this->loadModel($id);
     $pageSize = 30;
     $comments = Comments::getCommentsByPage($id, 'posts', 1, $pageSize);
     $tags = Tags::getByIds($info['tagids']);
     $relatePosts = Posts::getRelations($id, 5);
     if (!zmf::actionLimit('visit-Posts', $id, 5, 60)) {
         Posts::updateCount($id, 'Posts', 1, 'hits');
     }
     $size = '600';
     if ($this->isMobile) {
         $size = '640';
     }
     $info['content'] = zmf::text(array(), $info['content'], true, $size);
     $data = array('info' => $info, 'comments' => $comments, 'tags' => $tags, 'relatePosts' => $relatePosts, 'loadMore' => count($comments) == $pageSize ? 1 : 0);
     $this->favorited = Favorites::checkFavored($id, 'post');
     $this->pageTitle = $info['title'];
     $this->selectNav = 'posts';
     $this->render('view', $data);
 }
Exemplo n.º 2
0
<div class="main-page">
    <?php 
echo zmf::text(array(), $info['content']);
?>
</div>
<div class="aside-page">
    <?php 
if (!empty($allInfos)) {
    ?>
    <div class="list-group">
        <?php 
    foreach ($allInfos as $val) {
        ?>
        <?php 
        echo CHtml::link($val['title'], array('siteinfo/view', 'code' => $val['code']), array('class' => 'list-group-item ' . ($code == $val['code'] ? 'active' : '')));
        ?>
        <?php 
    }
    ?>
    </div>
    <?php 
}
?>
</div>
Exemplo n.º 3
0
</script>
<?php 
$cs = Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->baseUrl . '/ueditor/umeditor.js', CClientScript::POS_END);
$cs->registerScriptFile(Yii::app()->baseUrl . '/ueditor/lang/zh-cn/zh-cn.js', CClientScript::POS_END);
$cs->registerScriptFile(Yii::app()->baseUrl . '/common/uploadify/jquery.uploadify-3.1.min.js', CClientScript::POS_END);
?>
<textarea id="<?php 
echo CHtml::activeId($model, $attri);
?>
" name="<?php 
echo CHtml::activeName($model, $attri);
?>
" style="width:500px;height:200px;">
<?php 
echo zmf::text(array('action' => 'edit', 'encode' => 'yes'), $content);
?>
</textarea>
<textarea id="input_tmp" name="input_tmp" style="display: none"></textarea>
<input id="textareaid" type="hidden" value="<?php 
echo CHtml::activeId($model, $attri);
?>
"/>
<script>
var tipImgUploadUrl="<?php 
echo $upurl;
?>
";
var allowImgTypes="<?php 
echo zmf::config('imgAllowTypes');
?>
Exemplo n.º 4
0
$this->breadcrumbs = array(CHtml::link('首页', zmf::config('baseurl')), '脑洞大开' => array('index/index'), $info['title'] ? $info['title'] : '详情');
?>
<div class="main-page">
  <?php 
if ($info['title'] != '') {
    ?>
<h1 class="item-title"><?php 
    echo $info['title'];
    ?>
</h1><?php 
}
?>
  <div id="content">
    <?php 
echo zmf::text($info['content']);
?>
    
  </div>
  <p class="text-center"><?php 
echo CHtml::link($info['favors'] . ' 赞', 'javascript:;', array('class' => 'btn btn-' . ($this->favored ? 'success' : 'default'), 'action' => 'favor', 'action-data' => $info['id'], 'action-type' => 'naodong', 'id' => 'favor-naodong-' . $info['id']));
?>
</p>
  <?php 
if (!empty($preInfo)) {
    ?>
  <p>上一篇:<?php 
    echo CHtml::link($preInfo['title'], array('index/view', 'id' => $preInfo['id']));
    ?>
</p>
  <?php 
Exemplo n.º 5
0
<h1><?php 
echo $info['title'];
?>
</h1>
<div class="zmf-border-bottom">
    <?php 
echo zmf::text(array(), $info['content'], false);
?>
</div>
<?php 
if (!empty($allInfos)) {
    ?>
<h4>相关文章</h4>
<div class="list-group">
    <?php 
    foreach ($allInfos as $val) {
        ?>
    <?php 
        echo CHtml::link($val['title'], array('siteinfo/view', 'code' => $val['code']), array('class' => 'list-group-item ' . ($code == $val['code'] ? 'active' : '')));
        ?>
    <?php 
    }
    ?>
</div>
<?php 
}
Exemplo n.º 6
0
    echo $info['title'];
    ?>
</h1><?php 
}
?>
        <?php 
if (!empty($userInfo)) {
    ?>
<p class="author"><?php 
    echo CHtml::link($userInfo['truename'], array('index/media', 'id' => $userInfo['id']));
    ?>
</p><?php 
}
?>
        <?php 
echo zmf::text($info['content'], NULL, false);
?>
        
    </div>
    <?php 
if (!empty($preInfo) || !empty($nextInfo)) {
    ?>
    <ul class="ui-list ui-list-link ui-border-t preNext">
        <?php 
    if (!empty($preInfo)) {
        ?>
        <li class="ui-list-info ui-nowrap" data-href="<?php 
        echo Yii::app()->createUrl('index/view', array('id' => $preInfo['id']));
        ?>
">上一篇:<?php 
        echo $preInfo['title'];
Exemplo n.º 7
0
        <p class="title"><?php 
if ($from == 'poipost') {
} else {
    if ($data['poiTitle']) {
        echo '<span class="pull-left">' . CHtml::link($data['poiTitle'], array('position/view', 'id' => $data['logid'])) . '</span>' . zmf::starCss($data['score']);
    }
}
?>
</p>
        <p class="author"><?php 
$this->renderPartial('/common/_user', array('uid' => $data['uid'], 'uname' => $_uname, 'type' => 'l', 'lcss' => ''));
?>
</p>        
        <div class="content-detail hidden">
            <?php 
echo zmf::text(array(), $data['content']);
?>
        </div>
        <div class="content-substr">
            <div class="toggle-area">
                <?php 
echo zmf::tipSubStr($data['content'], 140, 1, '...<a href="javascript:;" class="more">查看详情</a>');
?>
            </div>            
        </div>
        <p class="color-grey"><?php 
echo $formatTime;
?>
&nbsp;<?php 
echo CHtml::link($data['comments'] . '条评论', 'javascript:;', array('action' => 'get-contents', 'action-data' => $data['id'], 'action-type' => 'comments', 'action-target' => 'comments-poipost-' . $data['id'], 'action-classify' => 'poipost'));
?>
Exemplo n.º 8
0
 /**
  * 已取消其他文章类型,默认为游记
  * @param type $classify,分类
  */
 public function actionCreate($id = '')
 {
     $id = zmf::filterInput($id);
     if (!zmf::uid()) {
         $this->redirect(array('site/login'));
     }
     if ($id) {
         $model = $this->loadModel($id);
         if ($model->uid != zmf::uid()) {
             if (!Users::checkPower('editpost', false, true)) {
                 throw new CHttpException(403, '不被允许的操作.');
             }
         }
     } else {
         $model = new Posts();
         $model->classify = Posts::CLASSIFY_WEDDING;
         //文章分类
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'posts-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['Posts'])) {
         //判断是否应被禁止
         //todo,应排除编辑
         //            $forbidInfo = Posts::isForbidden($_POST['Posts']['content'], 'post');
         //            if ($forbidInfo['status'] != Posts::STATUS_PASSED) {
         //                //todo,增加用户非法操作次数
         //                $_POST['Posts']['status'] = Posts::STATUS_STAYCHECK;
         //            }
         //处理文本
         $filter = Posts::handleContent($_POST['Posts']['content']);
         $_POST['Posts']['content'] = $filter['content'];
         foreach ($_POST['Posts'] as $k => $val) {
             $_POST['Posts'][$k] = zmf::filterInput($val, 't');
         }
         if (Yii::app()->session['checkHasBadword'] == 'yes') {
             $_POST['Posts']['status'] = Posts::STATUS_STAYCHECK;
         }
         if (!$model->isNewRecord) {
             $_POST['Posts']['updateTime'] = zmf::now();
             $isNew = false;
         } else {
             $isNew = true;
         }
         unset(Yii::app()->session['checkHasBadword']);
         if (!empty($filter['attachids'])) {
             $attkeys = array_filter(array_unique($filter['attachids']));
             if (!empty($attkeys)) {
                 $_POST['Posts']['faceimg'] = $attkeys[0];
                 //默认将文章中的第一张图作为封面图
             }
         } else {
             $_POST['Posts']['faceimg'] = '';
             //否则将封面图置为空(有可能编辑后没有图片了)
         }
         //相关标签
         $tags = $_POST['tagnames'];
         $tags = !empty($tags) ? array_unique(array_filter($tags)) : array();
         $model->attributes = $_POST['Posts'];
         if ($model->save()) {
             //将上传的图片置为通过
             Attachments::model()->updateAll(array('status' => Posts::STATUS_DELED), 'logid=:logid AND classify=:classify', array(':logid' => $model->id, ':classify' => 'posts'));
             if (!empty($attkeys)) {
                 $attstr = join(',', $attkeys);
                 if ($attstr != '') {
                     Attachments::model()->updateAll(array('status' => Posts::STATUS_PASSED, 'logid' => $model->id), 'id IN(' . $attstr . ')');
                 }
             }
             //相关标签
             $tagids = array();
             if (!empty($tags)) {
                 foreach ($tags as $str) {
                     $_tmp = explode('-', $str);
                     if ($_tmp[1] > 0) {
                         //添加对应关系
                         if (Tags::addRelation($_tmp[1], $model->id, 'posts')) {
                             $tagids[] = $_tmp[1];
                         }
                     } else {
                         //查找是否有对应话题
                         $_tagid = Tags::findAndAdd($_tmp[0], 'posts', $model->id);
                         if ($_tagid) {
                             $tagids[] = $_tagid;
                         }
                     }
                 }
                 $tagids = !empty($tagids) ? array_unique(array_filter($tagids)) : array();
                 $tagStr = join(',', $tagids);
                 if ($tagStr != '') {
                     Posts::model()->updateByPk($model->id, array('tagids' => $tagStr));
                 }
             }
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     //未认证用户不能创建团队
     if (!$this->userInfo['creditStatus']) {
         $this->message(0, '请完善资料并提交个人认证', Yii::app()->createurl('users/config', array('type' => 'info')));
     }
     //文章分类
     $cols = Column::allCols(1, 0, 1, Posts::CLASSIFY_WEDDING);
     if (!$model->isNewRecord) {
         $model->content = zmf::text(array('action' => 'edit'), $model->content, false, 600);
     }
     //获取所有受推荐地区
     $topAreas = Area::getTops(0);
     $areas = CHtml::listData($topAreas, 'id', 'title');
     //推荐的标签
     $suggestTags = Tags::getTops('posts');
     //我所加入的团队
     $groups = WeddingGroup::getUserGroup($this->uid);
     $this->pageTitle = '新增作品 - ' . zmf::config('sitename');
     $this->render('create', array('model' => $model, 'cols' => $cols, 'action' => $action, 'areas' => $areas, 'suggestTags' => $suggestTags, 'groups' => $groups));
 }
Exemplo n.º 9
0
Arquivo: view.php Projeto: ph7pal/momo
<?php

$a = Yii::app()->getController()->getAction()->id;
$this->menu = array('文章列表' => array('link' => array('siteInfo/index'), 'active' => in_array($a, array('index'))), '新增文章' => array('link' => array('siteInfo/create'), 'active' => in_array($a, array('create', 'update'))), '更新文章' => array('link' => array('siteInfo/update', 'id' => $model->id), 'active' => in_array($a, array('create', 'update'))), '文章详情' => array('link' => array('siteInfo/view', 'id' => $model->id), 'active' => in_array($a, array('view'))), '文章预览' => array('link' => array('/site/info', 'code' => $model->code)));
?>
<h1><?php 
echo $model->title;
?>
</h1>
<p class="help-block">    
    <?php 
echo zmf::formatTime($model->cTime);
?>
</p>
<?php 
echo zmf::text(array(), $model->content, false);