/** * index * * @param int $words * @param int $pageID * @access public * @return void */ public function index($words = '', $pageID = 1) { if (empty($words)) { $words = $this->get->words; } $words = strip_tags(strtolower($words)); if (isset($this->config->cn2tw) and $this->config->cn2tw and $this->app->getClientLang() == 'zh-tw') { $this->app->loadClass('cn2tw', true); $words = cn2tw::reverse($words); } $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal = 0, $this->config->search->recPerPage, $pageID); $this->session->set('serachIngWord', $words); $begin = time(); $this->view->results = $this->search->getList($words, $pager); /* Record post number. */ $this->loadModel('guarder')->logOperation('ip', 'search'); $this->loadModel('guarder')->logOperation('account', 'search'); $this->view->consumed = time() - $begin; $this->view->title = $this->lang->search->index; $this->view->pager = $pager; $this->view->words = $words; $this->view->mobileURL = helper::createLink('search', 'index', "words={$words}&pageID={$pageID}", '', 'mhtml'); $this->view->desktopURL = helper::createLink('search', 'index', "words={$words}&pageID={$pageID}", '', 'html'); $this->display(); }
/** * Print the content of the view. * * @param string $moduleName module name * @param string $methodName method name * @access public * @return void */ public function display($moduleName = '', $methodName = '') { if (empty($this->output)) { $this->parse($moduleName, $methodName); } if (isset($this->config->cn2tw) and $this->config->cn2tw and $this->app->getClientLang() == 'zh-tw') { $this->app->loadClass('cn2tw', true); $this->output = cn2tw::translate($this->output); } //if(isset($this->config->site->cdn)) //{ // $cdn = rtrim($this->config->site->cdn, '/'); // $this->output = str_replace('src="/data/upload', 'src="' . $cdn . '/data/upload', $this->output); // $this->output = str_replace("src='/data/upload", "src='" . $cdn . "/data/upload", $this->output); // $this->output = str_replace("url(/data/upload", "url(" . $cdn . "/data/upload", $this->output); //} echo $this->output; }