| 1 | <?php |
|---|
| 2 | ############################################################################### |
|---|
| 3 | # Gregarius - A PHP based RSS aggregator. |
|---|
| 4 | # Copyright (C) 2003 - 2006 Marco Bonetti |
|---|
| 5 | # |
|---|
| 6 | ############################################################################## |
|---|
| 7 | # This program is free software and open source software; you can redistribute |
|---|
| 8 | # it and/or modify it under the terms of the GNU General Public License as |
|---|
| 9 | # published by the Free Software Foundation; either version 2 of the License, |
|---|
| 10 | # or (at your option) any later version. |
|---|
| 11 | # |
|---|
| 12 | # This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 14 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 15 | # more details. |
|---|
| 16 | # |
|---|
| 17 | # You should have received a copy of the GNU General Public License along |
|---|
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit |
|---|
| 20 | # http://www.gnu.org/licenses/gpl.html |
|---|
| 21 | # |
|---|
| 22 | ############################################################################### |
|---|
| 23 | # E-mail: mbonetti at gmail dot com |
|---|
| 24 | # Web page: http://gregarius.net/ |
|---|
| 25 | # |
|---|
| 26 | ############################################################################### |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | require_once("init.php"); |
|---|
| 30 | rss_require('cls/search.php'); |
|---|
| 31 | rss_require('cls/wrappers/searchform.php'); |
|---|
| 32 | rss_require('cls/wrappers/toolkit.php'); |
|---|
| 33 | |
|---|
| 34 | $GLOBALS['rss'] -> feedList = new FeedList(false); |
|---|
| 35 | $items = new SearchItemList(); |
|---|
| 36 | $items->setRenderOptions(IL_NONE | IL_NO_COLLAPSE); |
|---|
| 37 | |
|---|
| 38 | if (array_key_exists(QUERY_PRM,$_REQUEST) && strlen($_REQUEST[QUERY_PRM]) > 1) { |
|---|
| 39 | $GLOBALS['rss'] -> header = new Header("Search",LOCATION_SEARCH,null); |
|---|
| 40 | $cnt = $items->itemCount; |
|---|
| 41 | $humanReadableQuery = $items->humanReadableQuery; |
|---|
| 42 | $title = sprintf((($cnt > 1 || $cnt == 0) ? |
|---|
| 43 | __('%d matches for %s') : __('%d match for %s')), $cnt, "'".$humanReadableQuery."'"); |
|---|
| 44 | |
|---|
| 45 | $items->setTitle($title); |
|---|
| 46 | } else { |
|---|
| 47 | list($cnt) = rss_fetch_row(rss_query('select count(*) from ' . getTable("item") . " i" |
|---|
| 48 | . " inner join " . getTable('item2user') . " i2u" |
|---|
| 49 | . " on i.id = i2u.fkiid" |
|---|
| 50 | . " where not(i2u.flgdeleted) " |
|---|
| 51 | )); |
|---|
| 52 | $items->setTitle(sprintf(__('Search %d items'), $cnt)); |
|---|
| 53 | $GLOBALS['rss'] -> header = new Header(__('Search'),LOCATION_SEARCH,null,"document.getElementById('".QUERY_PRM."').focus()"); |
|---|
| 54 | } |
|---|
| 55 | $GLOBALS['rss'] -> appendContentObject($items); |
|---|
| 56 | $GLOBALS['rss'] -> renderWithTemplate('index.php'); |
|---|
| 57 | |
|---|
| 58 | ?> |
|---|