123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR . '/lib/search/searchgroupnav.php';
- class SearchAction extends Action
- {
-
- function isReadOnly($args)
- {
- return true;
- }
- function handle()
- {
- parent::handle();
- $this->showPage();
- }
- function showTop($arr=null)
- {
- $error = null;
- if ($arr) {
- $error = $arr[1];
- }
- if (!empty($error)) {
- $this->element('p', 'error', $error);
- } else {
- $instr = $this->getInstructions();
- $output = common_markup_to_html($instr);
- $this->elementStart('div', 'instructions');
- $this->raw($output);
- $this->elementEnd('div');
- }
- }
- function title()
- {
- return null;
- }
- function showContent() {
- $this->showTop();
- $this->showForm();
- }
- function showForm($error=null)
- {
- $q = $this->trimmed('q');
- $page = $this->trimmed('page', 1);
- $this->elementStart('form', array('method' => 'get',
- 'id' => 'form_search',
- 'class' => 'form_settings',
- 'action' => common_local_url($this->trimmed('action'))));
- $this->elementStart('fieldset');
-
- $this->element('legend', null, _('Search site'));
- $this->elementStart('ul', 'form_data');
- $this->elementStart('li');
- if (!common_config('site', 'fancy')) {
- $this->hidden('action', $this->trimmed('action'));
- }
-
-
- $this->input('q', _('Keyword(s)'), $q);
-
- $this->element('input', array('type'=>'submit', 'class'=>'submit', 'value'=>_m('BUTTON','Search')));
- $this->elementEnd('li');
- $this->elementEnd('ul');
- $this->elementEnd('fieldset');
- $this->elementEnd('form');
- if ($q) {
- $this->showResults($q, $page);
- }
- }
- function searchSuggestions($q) {
-
-
- $message = _("* Make sure all words are spelled correctly.
- * Try different keywords.
- * Try more general keywords.
- * Try fewer keywords.");
- $message .= "\n";
- if (!common_config('site', 'private')) {
- $qe = urlencode($q);
- $message .= "\n";
-
-
- $message .= sprintf(_("You can also try your search on other engines:
- * [DuckDuckGo](https://duckduckgo.com/?q=site%%3A%%%%site.server%%%%+%s)
- * [Ixquick](https://ixquick.com/do/search?query=site%%3A%%%%site.server%%%%+%s)
- * [Searx](https://searx.laquadrature.net/?q=site%%3A%%%%site.server%%%%+%s)
- * [Yahoo!](https://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
- "), $qe, $qe, $qe, $qe);
- $message .= "\n";
- }
- $this->elementStart('div', 'help instructions');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
- }
|