public function run() { $rows = $this->fetchCategories(); if (empty($rows)) { return; } $html = ''; foreach ($rows as $row) { $id = (int) $row['id']; $url = aurl('category/posts', array('id' => $id)); $htmlOptions = $id == $this->channel ? array('class' => 'active') : array(); $html .= '<li>' . l($row['name'], $url, $htmlOptions) . '</li>'; } echo $html; }
public function actionSignup() { if (!user()->getIsGuest()) { // @todo 如果有了用户中心,这里应该跳转到用户中心 // $this->redirect(aurl('user/default')); $this->redirect(aurl('site/index')); exit(0); } $model = new LoginForm('signup'); if (request()->getIsPostRequest() && isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; if ($model->validate() && $model->signup()) { } else { $model->captcha = ''; } } cs()->registerMetaTag('noindex, follow', 'robots'); $this->setSiteTitle(t('site_signup')); $this->render('signup', array('form' => $model)); }
public function actionPosts($id) { $id = (int) $id; $category = Category::model()->findByPk($id); if ($category === null) { throw new CHttpException(403, t('category_is_not_found')); } $data = self::fetchCategoryPosts($id); $this->setSiteTitle(t('category_posts', 'main', array('{name}' => $category->name))); $this->setPageKeyWords($category->name); $this->setPageDescription(t('category_posts_page_description', 'main', array('{name}' => $category->name))); $this->channel = $id; cs()->registerMetaTag('all', 'robots'); $listType = param('post_list_type'); $view = $listType == POST_LIST_TYPE_SUMMARY ? '/post/_summary_list' : '/post/_title_list'; $data['blockTitle'] = t('category_posts', 'main', array('{name}' => $category->name)); $postListHtml = $this->renderPartial($view, $data, true); $feedTitle = $category->name . t('category_feed'); cs()->registerLinkTag('alternate', 'application/rss+xml', aurl('feed/category', array('id' => $id)), null, array('title' => $feedTitle)); $this->render('posts', array('category' => $category, 'postListHtml' => $postListHtml)); }
public function getTagLinks($operator = ',', $target = '_blank', $class = 'beta-tag') { $tags = $this->getTagArray(); if (empty($tags)) { return ''; } foreach ($tags as $tag) { $data[] = l($tag, aurl('tag/posts', array('name' => urlencode($tag))), array('target' => $target, 'class' => $class)); } return join($operator, $data); }
<?php cs()->registerScriptFile(sbu('libs/kindeditor/kindeditor-min.js'), CClientScript::POS_END); cs()->registerScriptFile(sbu('libs/kindeditor/config.js'), CClientScript::POS_END); ?> <script type="text/javascript"> $(function(){ $('#post-title').focus(); KindEditor.ready(function(K) { var cssurl = '<?php echo tbu('styles/beta-all.css'); ?> '; var imageUploadUrl = '<?php echo aurl('upload/image'); ?> '; KEConfig.mini.cssPath = [cssurl]; KEConfig.mini.uploadJson = imageUploadUrl; KEConfig.common.cssPath = [cssurl]; KEConfig.common.uploadJson = imageUploadUrl; var betaSummary = K.create('#beta-summary', KEConfig.mini); var betaContent = K.create('#beta-content', KEConfig.common); $('#post-form').on('submit', {content:betaContent}, BetaPost.create); $(document).on('click', '.temp-pictures li', function(event){ var html = $(this).html(); betaContent.insertHtml(html); }); });
echo t('you_have_joined'); ?> </span> </div> <script type="text/javascript"> $(function(){ <?php if ($post->getContainCode()) { echo 'prettyPrint();'; } ?> BetaPost.increaseVisitNums(<?php echo $post->id; ?> , '<?php echo aurl('post/visit'); ?> '); $(document).one('click', '#beta-digg-button', BetaPost.digg); $(document).on('click', '.beta-comment-rating', BetaComment.rating); $(document).on('click', '.beta-comment-reply', BetaComment.reply); }); </script> <?php cs()->registerCoreScript('cookie'); cs()->registerScriptFile(sbu('libs/json.js'), CClientScript::POS_END); ?>
?> <dl class="beta-comment-item"> <dt class="beta-post-extra"><span><?php echo t('comment_extra', 'main', array('{floor}' => $key + 1, '{author}' => $comment->authorName, '{time}' => $comment->createTime)); ?> </span></dt> <dd class="beta-comment-content"><?php echo $comment->filterContent; ?> </dd> <dd class="beta-comment-toolbar"> <?php if (!$post->disable_comment) { ?> <a class="beta-comment-reply" href="javascript:void(0);" data-url="<?php echo aurl('post/comment', array('id' => $comment->id)); ?> " rel="nofollow"><?php echo t('reply_comment'); ?> </a> <?php } ?> <a class="beta-comment-rating" href="javascript:void(0);" data-url="<?php echo $comment->supportUrl; ?> " rel="nofollow"><?php echo t('support_comment', 'main', array($comment->up_nums)); ?> </a>
} ?> </div> <div class="clear"></div> </div> <div class="beta-control-group <?php echo $form->hasErrors('agreement') ? 'error' : ''; ?> "> <label class="beta-control-label"> </label> <div class="beta-controls beta-agreement"> <?php echo CHtml::activeCheckBox($form, 'agreement', array('id' => 'agreement', 'tabindex' => 5)); ?> <label for="agreement"><?php echo t('agreement', 'main', array('{policyurl}' => aurl('static/policy'))); ?> </label> <?php if ($form->hasErrors('agreement')) { ?> <span class="beta-help-inline"><?php echo $form->getError('agreement'); ?> </span><?php } ?> </div> <div class="clear"></div> </div> <div class="action-buttons">
public function getUrl($absolute = false) { return $absolute ? aurl('post/show', array('id' => $this->id)) : url('post/show', array('id' => $this->id)); }
public function getUrl() { return aurl('special/show', array('id' => $this->id)); }
public function getPostsUrl() { return aurl('category/posts', array('id' => $this->id)); }
"><?php echo t('site_home'); ?> </a></li> <?php $this->widget('BetaCategoryMenu', array('channel' => $this->channel)); ?> <li class="separator"></li> <li><?php echo l(t('nav_topic'), aurl('topic/list'), array('class' => $this->channel == 'topic' ? 'active' : 'gray')); ?> </li> </ul> <ul class="user-mini-bar fright"> <li><?php echo l(t('nav_contribute'), aurl('post/create'), array('class' => $this->channel == 'contribute' ? 'active' : 'green')); ?> </li> <?php $this->renderDynamic('userMiniToolbar'); ?> </ul> <div class="clear"></div> </div> <div class="beta-entry"> <?php echo $content; ?> </div> </div> <?php
<div class="alert beta-alert beta-alert-message hide" id="beta-create-message" data-dismiss="alert"><a class="close" href="javascript:void(0);">×</a><span class="text">您的大名会显示在评论处</span></div> <?php echo CHtml::form(aurl('post/comment'), 'post', array('class' => 'beta-form-horizontal beta-comment-form', 'id' => 'comment-form')); echo CHtml::activeHiddenField($comment, 'post_id'); ?> <div class="beta-control-group stacked"> <div class="beta-controls comment-input"> <p class="beta-help-info beta-help-block"><?php echo t('comment_content_min_length', 'main', array('{minlength}' => param('commentMinLength'))); ?> </p> <?php echo CHtml::activeTextArea($comment, 'content', array('class' => 'comment-content mini', 'rows' => 4, 'minlen' => param('commentMinLength'))); ?> </div> <div class="clear"></div> </div> <div class="beta-control-group comment-captcha hide"> <label class="beta-control-label"><?php echo t('captcha'); ?> </label> <div class="beta-controls comment-input"> <?php echo CHtml::activeTextField($comment, 'captcha', array('class' => 'beta-text beta-captcha')); ?> <?php $this->widget('BetaCaptcha', array('skin' => 'comment')); ?> <a href="<?php echo url('post/captcha', array('refresh' => 1));
public function getPostsUrl() { return aurl('topic/posts', array('id' => $this->id)); }
public function afterLogin() { $returnUrl = urldecode($this->returnUrl); if (empty($returnUrl)) { $returnUrl = strip_tags(trim($_GET['url'])); } if (empty($returnUrl)) { $returnUrl = aurl('user/default'); } request()->redirect($returnUrl); exit(0); }
public function getReportUrl() { return aurl('comment/report', array('id' => $this->id)); }