xref: /dokuwiki/inc/Action/Search.php (revision 21fcef82b754bee0920be30454d93aca097b5b00)
164ab5140SAndreas Gohr<?php
264ab5140SAndreas Gohr
364ab5140SAndreas Gohrnamespace dokuwiki\Action;
464ab5140SAndreas Gohr
564ab5140SAndreas Gohruse dokuwiki\Action\Exception\ActionAbort;
664ab5140SAndreas Gohr
7ab583a1bSAndreas Gohr/**
8ab583a1bSAndreas Gohr * Class Search
9ab583a1bSAndreas Gohr *
10ab583a1bSAndreas Gohr * Search for pages and content
11ab583a1bSAndreas Gohr *
12ab583a1bSAndreas Gohr * @package dokuwiki\Action
13ab583a1bSAndreas Gohr */
1464ab5140SAndreas Gohrclass Search extends AbstractAction {
1564ab5140SAndreas Gohr
1664ab5140SAndreas Gohr    /** @inheritdoc */
17ec701221SAndreas Gohr    public function minimumPermission() {
1864ab5140SAndreas Gohr        return AUTH_NONE;
1964ab5140SAndreas Gohr    }
2064ab5140SAndreas Gohr
2164ab5140SAndreas Gohr    /**
2264ab5140SAndreas Gohr     * we only search if a search word was given
2364ab5140SAndreas Gohr     *
2464ab5140SAndreas Gohr     * @inheritdoc
2564ab5140SAndreas Gohr     */
2664ab5140SAndreas Gohr    public function checkPermissions() {
2764ab5140SAndreas Gohr        parent::checkPermissions();
2864ab5140SAndreas Gohr        global $QUERY;
2964ab5140SAndreas Gohr        $s = cleanID($QUERY);
3064ab5140SAndreas Gohr        if($s === '') throw new ActionAbort();
3164ab5140SAndreas Gohr    }
3264ab5140SAndreas Gohr
3364ab5140SAndreas Gohr    /** @inheritdoc */
3464ab5140SAndreas Gohr    public function tplContent() {
35*21fcef82SMichael Große        global $QUERY;
36*21fcef82SMichael Große        $search = new \dokuwiki\Ui\Search($QUERY);
37*21fcef82SMichael Große        $search->execute();
38*21fcef82SMichael Große        $search->show();
3964ab5140SAndreas Gohr    }
4064ab5140SAndreas Gohr}
41