root/branches/multiuser/search.php

Revision 1759, 2.5 kB (checked in by mdodoo, 2 years ago)

Lots of things are still not working, but I think this code is better than what was currently committed ([1639]
should have been reverted, and the person who committed should have had their SVN access pulled, for example).
Created this by grabbing the trunk code and then manually inserting the MU branch's changes in. This is probably
not usable in an actual installation (no support for creating new user accounts yet, for example), but patches are
welcome.

Not sure why I write so much here - I am not sure anyone other than my fellow devs actually read them...

  • Property svn:eol-style set to native
  • Property svn:eolstyle set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
29require_once("init.php");
30rss_require('cls/search.php');
31rss_require('cls/wrappers/searchform.php');
32rss_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
38if (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?>
Note: See TracBrowser for help on using the browser.