public function actionShow($id) { $id = (int) $id; if ($id <= 0) { throw new CHttpException(404, t('post_is_not_found')); } $cacheID = sprintf(param('cache_post_id'), $id); $cachePostId = app()->cache->get($cacheID); if ($cachePostId === false && !user()->checkAccess('enter_admin_system')) { $post = Post::model()->published()->findByPk($id); } else { $post = Post::model()->findByPk($id); } if (null === $post) { throw new CHttpException(403, t('post_is_not_found')); } $comments = Comment::fetchList($id); $hotComments = Comment::fetchHotList($id); $comment = new CommentForm(); $comment->post_id = $id; $this->channel = $post->category_id; $this->setSiteTitle($post->title); $this->setPageDescription($post->summary); $this->setPageKeyWords($post->tagText); if ($post->getContainCode()) { cs()->registerScriptFile(sbu('libs/prettify/prettify.js'), CClientScript::POS_END); cs()->registerCssFile(sbu('libs/prettify/prettify.css'), 'screen'); } cs()->registerMetaTag('all', 'robots'); $this->render('show', array('post' => $post, 'comment' => $comment, 'comments' => $comments, 'hotComments' => $hotComments)); }
/** * this is the shortcut to Yii::app()->theme->baseUrl * @param string $url * @return string Yii::app()->theme->baseUrl */ function tbu($url = null, $useDefault = true) { if (empty(Yii::app()->theme)) { return sbu($url); } static $themeBasePath; static $themeBaseUrl; $themeBasePath = rtrim(param('themeResourceBasePath'), DS) . DS . Yii::app()->theme->name . DS; $filename = realpath($themeBasePath . $url); if (file_exists($filename)) { $themeBaseUrl = rtrim(Yii::app()->theme->baseUrl, '/') . '/'; return $url === null ? $themeBaseUrl : $themeBaseUrl . ltrim($url, '/'); } elseif ($useDefault) { return sbu($url); } else { return 'javascript:void(0);'; } }
/** * 处理内容中的img标签 * @param string $html html内容 * @return string */ public static function processImgTag($html) { $html = str_replace('/>', ' />', $html); $pattern = '/<img.*?src="?(.+?)["\\s]{1}?.*?>/is'; if (param('enable_lazyload_img')) { $img = '<img src="' . sbu('images/grey.gif') . '" data-original="${1}" class="lazy" />'; } else { $img = '<img src="${1}" class="lazy" />'; } $html = preg_replace($pattern, $img, $html); return $html; }
?> " /></li> <?php } ?> </ul> </div> <?php } ?> </div> <div class="clear"></div> <?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];
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); ?>
li.addClass('active'); }); $('.dropdown-menu').on('click', 'li a', function(event){ var li = $(this).parent(); $(this).parents('.dropdown').removeClass('open'); if (li.hasClass('active')) return true; $('li').removeClass('active'); li.addClass('active'); $(this).parents('.dropdown').addClass('active'); }); $(document).on('mouseenter', '#admin-iframe', function(){ $('li.dropdown').removeClass('open'); $(this).focus(); }); }); </script> <script type="text/javascript" src="<?php echo sbu('libs/bootstrap/js/bootstrap.min.js'); ?> "></script> <script type="text/javascript" src="<?php echo sbu('scripts/beta-admin.js'); ?> "></script> </body> </html>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo app()->charset; ?> " /> <title><?php echo app()->name . t('control_center', 'admin'); ?> </title> <link rel="stylesheet" type="text/css" href="<?php echo sbu('libs/bootstrap/bootstrap.min.css'); ?> " /> <link rel="stylesheet" type="text/css" href="<?php echo sbu('styles/beta-admin.css'); ?> " /> <script type="text/javascript" src="<?php echo sbu('libs/jquery-1.7.1.min.js'); ?> "></script> </head> <body> <div class="beta-container"> <?php echo $content; ?> </div> </body> </html>
echo t('site_announce'); ?> </p> <p><?php echo t('site_content_share_announce'); ?> ©2012 <?php echo app()->name; ?> <?php echo param('beian_code'); ?> </p> <p>Powered by <a href="http://www.24beta.com/" target="_blank">24beta.com</a></p> </div> </div> <a class="beta-backtop" href="#top"><?php echo t('return_top'); ?> </a> <?php echo param('footer_after_html'); echo param('tongji_code'); ?> </body> </html> <?php cs()->registerCoreScript('jquery'); cs()->registerScriptFile(sbu('libs/bootstrap/js/bootstrap.min.js'), CClientScript::POS_END); cs()->registerScriptFile(tbu('scripts/beta-main.js'), CClientScript::POS_END);
</dd> <dd class="beta-post-toolbar"> <?php echo l(t('view_detail'), $model->url, array('target' => '_blank')); ?> <?php echo t('post_toolbar_text', 'main', $model->postToolbar); ?> </dd> </dl> <?php } if ($pages->pageCount > 1) { ?> <div class="beta-pages"><?php $this->widget('CLinkPager', array('pages' => $pages)); ?> </div> <?php } ?> <?php cs()->registerScriptFile(sbu('libs/jquery.lazyload.min.js'), CClientScript::POS_END); ?> <script type="text/javascript"> $(function(){ Beta24.imageLazyLoad($('img.lazy')); }); </script>
<script type="text/javascript"> /*<![CDATA[*/ var BETA_YES = <?php echo BETA_YES; ?> ; var BETA_NO = <?php echo BETA_NO; ?> ; var confirmAlertText = '<?php echo t('delete_confirm', 'admin'); ?> '; /*]]>*/ </script> </head> <body> <div class="beta-container"> <?php echo $content; ?> </div> </body> </html> <?php cs()->registerCoreScript('jquery'); cs()->registerScriptFile(sbu('libs/bootstrap/js/bootstrap.min.js'), CClientScript::POS_END); cs()->registerScriptFile(sbu('scripts/beta-admin.js'), CClientScript::POS_END);