/**
  * @brief showSearch 显示搜索结果
  *
  * @param $params 传入参数
  *
  * @return void
  */
 public function showSearch($params)
 {
     if (!isset($params['word'])) {
         if (!($word = Request::P('word', 'string'))) {
             Response::back();
         } else {
             Response::redirect(Router::patch('SearchWord', array('word' => urlencode(trim($word)))));
         }
         return;
     }
     // 获取文章数据
     Widget::initWidget('Post');
     Widget::getWidget('Post')->setPerPage(8);
     Widget::getWidget('Post')->setCurrentPage(isset($params['page']) ? $params['page'] : 1);
     // 未来支持分类内搜索
     // Widget::getWidget('Post')->setCurrentMeta( $m[0]['mid'] );
     Widget::getWidget('Post')->setSearchWord(urldecode(trim($params['word'])));
     Widget::getWidget('Post')->query();
     // 设置标题、描述、关键词
     Widget::getWidget('Global')->title = urldecode($params['word']);
     // Widget::getWidget('Global')->description = $m[0]['description'];
     Widget::getWidget('Global')->keywords = urldecode($params['word']);
     $this->display('index.php');
 }
<div class="box box-small">
	<div class="box-title">
		<h3><?php 
_e('Latest Comments');
?>
</h3>
		<span></span>
	</div>
	<div class="box-content">
		<ol>
		<?php 
$comments = Database::fetchAll('SELECT * FROM `' . DB_PREFIX . 'comments` ORDER BY `cid` DESC limit 0,15');
foreach ($comments as $c) {
    ?>
			<li><a href="<?php 
    echo Router::patch('Post', array('pid' => $c['pid']));
    ?>
#comment-<?php 
    echo $c['cid'];
    ?>
"><?php 
    echo $c['author'];
    ?>
</a>: <?php 
    echo str_replace(array('<br>', '<br />', '<br/>'), '', $c['content']);
    ?>
</li>
		<?php 
}
?>
		</ol>
 /**
  * @brief postPath 输出文章路径
  *
  * @return void
  */
 public function postPath()
 {
     // 检查是否有文章
     if (!$this->postHave()) {
         return;
     }
     $path = $this->postTitle(0, FALSE);
     $meta = new MetaLibrary();
     $meta->setType(1);
     $meta->setPID($this->postID(FALSE));
     $metas = $meta->getMeta();
     $me = isset($metas[0]['mid']) ? $metas[0]['mid'] : 0;
     $m = isset($metas[0]) ? $metas[0] : array();
     $meta->setPID(0);
     while ($me) {
         $path = '<a href="' . Router::patch('Category', array('alias' => $m['alias'])) . '">' . $m['name'] . '</a> &raquo; ' . $path;
         if ($m['parent'] == 0) {
             break;
         }
         $meta->setMID($m['parent']);
         $metas = $meta->getMeta();
         $me = isset($metas[0]['mid']) ? $metas[0]['mid'] : 0;
         $m = isset($metas[0]) ? $metas[0] : array();
     }
     $path = '<a href="' . LOGX_PATH . '">' . OptionLibrary::get('title') . '</a> &raquo; ' . $path;
     echo $path;
 }
 /**
  * @brief uploadDo 上传文件
  *
  * @return void
  */
 private function uploadDo()
 {
     $upload = new UploadLibrary('jpg|png|jpeg|gif|bmp|zip|rar|gz|tar', '2048', 'Filedata');
     $upload->set_dir(LOGX_FILE, '{y}{m}');
     // $upload->set_watermark( LOGX_THEME.'admin/images/watermark.gif', 6, 50 );
     // $upload->set_thumb( 150, 150 );
     // $upload->set_resize(500, 500);
     $files = $upload->execute();
     $r = array('success' => FALSE);
     if (!$files) {
         $r['message'] = _t('您没有选择任何文件,或者文件大小超出 post_max_size 限定!');
     } else {
         if ($files['status'] == 1) {
             $r['success'] = TRUE;
             $r['message'] = '<li class="multiline" id="attach-' . $files['mid'] . '"><label for="attach-' . $files['mid'] . '">' . $files['ogname'] . '</label><a href="#" onclick="insertToEditor(' . "'" . Router::patch('Attachment', array('mid' => $files['mid'])) . "','" . $files['type'] . "','" . $files['ogname'] . "'" . ');return false;">[' . _t('Insert') . ']</a>&nbsp;&nbsp;<a href="#" onclick="deleteAttachment(' . $files['mid'] . ');return false;">[' . _t('Delete') . ']</a></li>';
         } elseif ($files['status'] == -1) {
             $r['message'] = _t('文件类型不允许!');
         } elseif ($files['status'] == -2) {
             $r['message'] = _t('文件大小超出程序限定的 2M!');
         } elseif ($files['status'] == -3) {
             $r['message'] = _t('文件大小超出 upload_max_filesize 限定!');
         } else {
             $r['message'] = _t('未知错误!');
         }
     }
     Response::ajaxReturn($r);
 }
 /**
  * @brief pageLink 输出页面地址
  *
  * @return void
  */
 public function pageLink()
 {
     echo Router::patch('Page', array('alias' => $this->pages[$this->currentPage - 1]['alias']));
 }
 /**
  * @brief path 输出路径信息
  *
  * @param $path 相对路径
  * @param $base 基路径
  *
  * @return void
  */
 public function path($path = '', $base = 'base')
 {
     if ($base == 'theme') {
         $themePath = str_replace(LOGX_ROOT, '', LOGX_THEME);
         echo LOGX_PATH . $themePath . $this->theme . '/' . $path;
     } elseif ($base == 'base') {
         echo LOGX_PATH . $path;
     } else {
         echo Router::patch($base, $path);
     }
 }