public function actionView($id) { $id = zmf::filterInput($id); if (!$id || !is_numeric($id)) { throw new CHttpException(404, '你所查看的页面不存在.'); } $info = Naodong::model()->findByPk($id); if ($info == NULL) { throw new CHttpException(404, '你所查看的页面不存在.'); } //更新访问次数 Posts::updateCount($id, 'Naodong'); //获取评论列表 $sql = "SELECT * FROM {{comments}} WHERE logid='{$id}' AND classify='naodong' AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime ASC"; Posts::getAll(array('sql' => $sql, 'pageSize' => 2), $pages, $comLists); //获取上下篇 $preInfo = Naodong::model()->find(array('condition' => 'id>:id AND status=' . Posts::STATUS_PASSED, 'select' => 'id,title', 'params' => array(':id' => $id))); $nextInfo = Naodong::model()->find(array('condition' => 'id<:id AND status=' . Posts::STATUS_PASSED, 'select' => 'id,title', 'params' => array(':id' => $id))); $authorInfo = $recommends = array(); if ($info['uid']) { //获取作者信息 $authorInfo = Users::getUserInfo($info['uid']); //获取作者相关推荐 $recommends = Naodong::getRecommends($info['uid'], $id); } //获取是否赞过 if ($this->uid) { if (UserAction::checkAction($id, 'favorNaodong')) { $this->favored = true; } } $data = array('info' => $info, 'posts' => $comLists, 'pages' => $pages, 'userInfo' => $authorInfo, 'recommends' => $recommends, 'preInfo' => $preInfo, 'nextInfo' => $nextInfo); $this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename'); $this->pageDescription = zmf::subStr($info['content'], 140); $this->mobileTitle = $authorInfo['truename']; $this->render('/index/view', $data); }
?> <link rel="shortcut icon" href="<?php echo zmf::config('baseurl'); ?> favicon.ico" type="image/x-icon" /> <title><?php echo CHtml::encode($this->pageTitle); ?> </title> </head> <body ontouchstart> <header class="ui-header ui-header-positive ui-border-b"> <i class="ui-icon-return" onclick="history.back()"></i> <?php echo CHtml::link('<h1>' . zmf::subStr($this->mobileTitle, 16) . '</h1>', zmf::config('baseurl'), array('class' => 'text-logo')); ?> <a class="header-right" href="javascript:;"><ul><li><span></span></li><li><span></span></li><li><span></span></li></ul></a> </header> <div class="header-select-holder"> <div class="ui-scroller header-select"> <ul style="transition: 0ms cubic-bezier(0.1, 0.57, 0.1, 1); -webkit-transition: 0ms cubic-bezier(0.1, 0.57, 0.1, 1); transform: translate(0px, 0px) translateZ(0px);" class="ui-list ui-list-text ui-list-link ui-border-b"> <li class="ui-border-t" data-href="<?php echo zmf::config('baseurl'); ?> "><h4 class="ui-nowrap">首页</h4></li> <li class="ui-border-t" data-href="<?php echo Yii::app()->createUrl('index/medias'); ?> "><h4 class="ui-nowrap">媒体列表</h4></li> <?php
</h4><?php } ?> <?php if ($data['truename'] != '') { ?> <p class="author"><?php echo CHtml::link($data['truename'], array('index/media', 'id' => $data['uid']), array('target' => '_blank')); ?> </p><?php } ?> <?php echo $data['attachid'] ? '<p>' . CHtml::link(CHtml::image($data['attachid'], $data['title']), array('index/view', 'id' => $data['id']), array('target' => '_blank')) . '</p>' : ''; ?> <p><?php echo zmf::subStr($data['content'], 140, 0, '') . '...' . CHtml::link('查看详情', array('index/view', 'id' => $data['id']), array('target' => '_blank')); ?> </p> <p class="color-grey"><?php echo tools::formatTime($data['cTime']); ?> <?php echo CHtml::link($data['comments'] . '评论', array('index/view', 'id' => $data['id'], '#' => 'comments'), array('target' => '_blank')); ?> <?php echo CHtml::link($data['favors'] . '赞', array('index/view', 'id' => $data['id']), array('target' => '_blank')); ?> </p> </div> </div>
echo '<p><span class="color-bold">邮箱:</span>' . CHtml::encode($info['email']) . '</p>'; } ?> <?php if ($info['fax'] != '') { echo '<p><span class="color-bold">传真:</span>' . CHtml::encode($info['fax']) . '</p>'; } ?> <?php if ($info['traffic'] != '') { echo '<p><span class="color-bold">交通:</span>' . CHtml::encode($info['traffic']) . '</p>'; } ?> <?php if ($info['content'] != '') { echo '<p><span class="color-bold">描述</span></p><p id="poi-content-sub-' . $info['id'] . '">' . zmf::subStr($info['content'], 140, 0, '...' . CHtml::link('<span class="icon-double-angle-down"></span> 展开', 'javascript:;', array('onclick' => '$("#poi-content-sub-' . $info['id'] . '").hide();$("#poi-content-' . $info['id'] . '").show();'))) . '</p><p id="poi-content-' . $info['id'] . '" style="display:none">' . zmf::filterOutput($info['content']) . CHtml::link('<span class="icon-double-angle-up"></span> 收起', 'javascript:;', array('onclick' => '$("#poi-content-' . $info['id'] . '").hide();$("#poi-content-sub-' . $info['id'] . '").show();')) . '</p>'; } ?> </div> </div> </div> <div role="tabpanel" class="tab-pane" id="poi-posts-container"></div> <div role="tabpanel" class="tab-pane" id="poi-poipost-container"></div> <div role="tabpanel" class="tab-pane" id="poi-map-container"> <?php $this->renderPartial('/position/map', array('info' => $info, 'faceimg' => $info['faceimg'])); ?> </div> <div role="tabpanel" class="tab-pane" id="poi-images-container"></div> </div>
echo $data['title']; ?> "><img src="<?php echo $data['faceimg']; ?> " class="img-responsive"/></a> <?php } ?> <div class="module"> <h4><?php echo CHtml::link($data['title'], array('posts/view', 'id' => $data['id'])); ?> </h4> <p><?php echo zmf::subStr($data['content'], 140); ?> </p> <?php if (!empty($data['tagids'])) { ?> <p class="post-list-tags"><i class="fa fa-tags"></i><?php foreach ($data['tagids'] as $_tag) { echo CHtml::link($_tag['title'], array('index/index', 'tagid' => $_tag['id'])); } ?> </p> <?php } ?> <div class="post-item-footer">
public function actionUpdate($type) { if (!in_array($type, array('info', 'passwd'))) { $this->message(0, '您的操作有误'); } if (isset($_POST) and !empty($_POST)) { $model = new Users(); if ($type == 'info') { $intoData['username'] = zmf::filterInput($_POST['username'], 't', 1); if (!$intoData['username']) { $this->message(0, '用户名不能为空'); } //如果用户修改了用户名,则判断是否被使用 if ($intoData['username'] != $this->userInfo['username']) { $info = Users::getInfoByName($intoData['username']); if ($info) { $this->message(0, '该用户名已被使用'); } } $intoData['sex'] = tools::val('sex'); $desc = zmf::filterInput($_POST['desc'], 't', 1); $desc = zmf::subStr($desc, 32, 0, ''); } elseif ($type == 'passwd') { $old = zmf::filterInput($_POST['old_password'], 't', 1); $info = Users::model()->findByPk($this->uid); if (!$old) { $this->message(0, '请输入原始密码'); } elseif (md5($old) != $info['password']) { $this->message(0, '原始密码不正确'); } if (!$_POST['password']) { $this->message(0, '请输入密码'); } elseif (strlen($_POST['password']) < 5) { $this->message(0, '新密码过短,请重新输入'); } $intoData['password'] = md5($_POST['password']); } if ($model->updateByPk($this->uid, $intoData)) { if ($type == 'info' && $desc) { UserInfo::addAttr($this->uid, 'info', 'desc', $desc); } $this->message(1, '修改成功', Yii::app()->createUrl('users/config')); } else { if ($type == 'info' && $desc) { UserInfo::addAttr($this->uid, 'info', 'desc', $desc); } $this->message(1, '修改成功', Yii::app()->createUrl('users/config')); } } $data = array('info' => $this->userInfo, 'type' => $type); $this->render('update', $data); }
"> <img class="media-object img-circle" width="80px" height="80px" src="<?php echo zmf::avatar($data, 170, true); ?> " alt="<?php echo $data['truename']; ?> "> </a> </div> <div class="media-body"> <h4 class="media-heading"> <?php echo CHtml::link($data['truename'], array('index/media', 'id' => $data['id'])); ?> </h4> <p class="color-grey"><?php echo zmf::subStr($data['desc'], 280); ?> </p> <p> <?php echo CHtml::link($data['posts'] . '作品', array('index/media', 'id' => $data['id'])); ?> <?php echo CHtml::link($data['hits'] . '热度', array('index/media', 'id' => $data['id'])); ?> </p> </div> </div>
<?php $this->renderPartial('/comments/_mincomment', array('keyid' => $info['id'], 'type' => 'naodong')); ?> </div> <div class="aside-page"> <?php $this->renderPartial('/index/_author', array('userInfo' => $userInfo)); if (!empty($recommends)) { ?> <div class="aside-mod"> <?php foreach ($recommends as $_post) { ?> <p><?php echo CHtml::link(zmf::subStr($_post['title'], 30), array('index/view', 'id' => $_post['id']), array('target' => '_blank')); ?> </p> <?php } ?> <p class="color-grey"><?php echo CHtml::link('查看更多 <i class="icon-double-angle-right"></i>', array('index/media', 'id' => $info['uid']), array('target' => '_blank')); ?> </p> </div> <?php } ?> <div class="aside-mod"> <?php
<h3 class="ui-nowrap"><?php echo $data['title']; ?> </h3><?php } ?> <?php if ($data['truename'] != '') { ?> <p class="author"><?php echo $data['truename']; ?> </p><?php } ?> <p class="ui-nowrap-multi"><?php echo zmf::subStr($data['content'], 140, 0, ''); ?> </p> <p class="color-grey"><?php echo tools::formatTime($data['cTime']); ?> <?php echo $data['comments'] . '评论'; ?> <?php echo $data['favors'] . '赞'; ?> </p> </div> </li>
<div class="aside-page"> <div class="aside-mod"> <p><?php echo CHtml::link(zmf::avatar($this->userInfo), array('users/index')); ?> </p> <p><?php echo CHtml::link($this->userInfo['truename'], array('users/index')); ?> </p> <p class="help-block"><?php echo zmf::subStr($this->userInfo['desc'], 140); ?> </p> </div> <div class="list-group"> <?php echo CHtml::link('<i class="icon-bell-alt"></i> 提醒', array('users/notice'), array('class' => 'list-group-item')); ?> <?php echo CHtml::link('<i class="icon-cog"></i> 基本设置', array('users/config'), array('class' => 'list-group-item')); ?> <?php echo CHtml::link('<i class="icon-info-sign"></i> 更新资料', array('users/update', 'type' => 'info'), array('class' => 'list-group-item')); ?> <?php echo CHtml::link('<i class="icon-key"></i> 修改密码', array('users/update', 'type' => 'passwd'), array('class' => 'list-group-item')); ?> <?php echo CHtml::link('<i class="icon-user"></i> 上传头像', array('users/avatar'), array('class' => 'list-group-item')); ?>
public function actionView($id) { $id = zmf::filterInput($id); $info = $this->loadModel($id); if ($info['redirect'] > 0) { $this->redirect(array('position/view', 'id' => $info['redirect'])); } $_title = ''; if ($info['title_cn'] != '') { $_title = $info['title_cn']; } if ($info['title_en'] != '' && $_title != '') { $_title .= '(' . $info['title_en'] . ')'; } elseif ($info['title_local'] && $_title != '') { $_title .= '(' . $info['title_local'] . ')'; } elseif ($info['title_en'] != '') { $_title .= $info['title_en']; } else { $_title .= $info['title_local']; } $_address = ''; if ($info['address_cn'] != '') { $_address = $info['address_cn']; } elseif ($info['address_en'] != '') { $_address = $info['address_en']; } else { $_address = $info['address_local']; } if (!Yii::app()->user->isGuest) { if (Favorites::checkFavored($id, 'poi')) { $this->favorited = true; } $tipinfo = PoiPost::model()->findByAttributes(array('logid' => $id, 'uid' => Yii::app()->user->id), 'status=' . Posts::STATUS_PASSED); if ($tipinfo) { $this->tiped = $tipinfo; } } $info->faceimg = Attachments::faceImg($info, 600); //获取图片 $images = Attachments::model()->findAll(array('condition' => "logid=:id AND " . ($info['faceimg'] > 0 ? "id!=" . $info['faceimg'] . ' AND ' : '') . " classify='poi' AND status=" . Posts::STATUS_PASSED, 'select' => 'id,filePath,classify,cTime', 'limit' => 6, 'order' => 'favor DESC', 'params' => array(':id' => $id))); $breads = array(); $breads[] = CHtml::link('目的地', array('position/index')); if ($info['areaid']) { $areaInfo = Area::model()->findByPk($info['areaid']); if ($areaInfo) { $breads[] = CHtml::link($areaInfo['title'], array('position/index', 'areaid' => $areaInfo['id'])); } } //获取购买地址 $buylinks = array(); if ($info['classify'] == Position::HOTEL) { $buylinks = Buylink::getAll('poi', $info->id); } //更新访问统计 Posts::updateCount($id, 'Position'); $breads[] = $_title; $this->pageTitle = $_title . ' - ' . zmf::config('sitename'); $this->pageDescription = '【' . $_title . '】位于' . $_address . ',' . zmf::subStr($info['content'], 200); $this->render('view', array('info' => $info, 'type' => $type, 'breads' => $breads, 'buylinks' => $buylinks, 'images' => $images)); }