Exemple #1
0
 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     $this->parameter->setDefault('pageSize=20');
     $select = $this->select();
     $this->_currentPage = $this->request->get('page', 1);
     /** 过滤标题 */
     if (NULL != ($keywords = $this->request->keywords)) {
         $select->where('name LIKE ? OR screenName LIKE ?', '%' . Typecho_Common::filterSearchQuery($keywords) . '%', '%' . Typecho_Common::filterSearchQuery($keywords) . '%');
     }
     $this->_countSql = clone $select;
     $select->order('table.users.uid', Typecho_Db::SORT_ASC)->page($this->_currentPage, $this->parameter->pageSize);
     $this->db->fetchAll($select, array($this, 'push'));
 }
Exemple #2
0
 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     /** 过滤状态 */
     $select = $this->select()->where('table.contents.type = ? OR (table.contents.type = ? AND table.contents.parent = ?)', 'page', 'page_draft', 0);
     /** 过滤标题 */
     if (NULL != ($keywords = $this->request->keywords)) {
         $args = array();
         $keywordsList = explode(' ', $keywords);
         $args[] = implode(' OR ', array_fill(0, count($keywordsList), 'table.contents.title LIKE ?'));
         foreach ($keywordsList as $keyword) {
             $args[] = '%' . Typecho_Common::filterSearchQuery($keyword) . '%';
         }
         call_user_func_array(array($select, 'where'), $args);
     }
     /** 提交查询 */
     $select->order('table.contents.order', Typecho_Db::SORT_ASC);
     $this->db->fetchAll($select, array($this, 'push'));
 }
Exemple #3
0
 /**
  * 获取由给定的string开头的链接组成的数组
  *
  * @param int $blogId
  * @param string $userName
  * @param string $password
  * @param string $category
  * @param int $max_results
  * @access public
  * @return array
  */
 public function wpSuggestCategories($blogId, $userName, $password, $category, $max_results)
 {
     if (!$this->checkAccess($userName, $password)) {
         return $this->error;
     }
     $meta = $this->singletonWidget('Widget_Abstract_Metas');
     /** 构造出查询语句并且查询*/
     $key = Typecho_Common::filterSearchQuery($category);
     $key = '%' . $key . '%';
     $select = $meta->select()->where('table.metas.type = ? AND (table.metas.name LIKE ? OR slug LIKE ?)', 'category', $key, $key);
     /** 不要category push到contents的容器中 */
     $categories = $this->db->fetchAll($select);
     /** 初始化categorise数组*/
     $categoryStructs = array();
     foreach ($categories as $category) {
         $categoryStructs[] = array('category_id' => $category['mid'], 'category_name' => $category['name']);
     }
     return $categoryStructs;
 }