root/trunk/gregarius/author.php

Revision 1735, 2.0 kB (checked in by mbonetti, 16 months ago)

fix for author names with multiple successive escaped characters, which
would issue 404's

  • Property svn:eolstyle set to native
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
28require_once ('init.php');
29
30$a = trim(sanitize($_REQUEST['author'], RSS_SANITIZER_WORDS));
31$sql = "select distinct(author) from " .getTable('item') 
32        ." where author  like '%$a'";
33
34list ($ra) = rss_fetch_row(rss_query($sql));
35
36if (!$ra) {
37        rss_404();
38        exit;
39}
40
41$t = ucfirst(__('items')) . " " . __(' by ') . " " . $ra;
42$GLOBALS['rss']->header = new Header($t);
43$GLOBALS['rss']->feedList = new FeedList(false);
44$authorItems = new ItemList();
45$sqlWhere = " i.author like '%$a' ";
46$numItems = getConfig('rss.output.frontpage.numitems');
47$authorItems->populate($sqlWhere, "",  0, $numItems);
48$authorItems->setTitle($t);
49$authorItems->setRenderOptions(IL_NO_COLLAPSE|IL_TITLE_NO_ESCAPE);
50$GLOBALS['rss']->appendContentObject($authorItems);
51$GLOBALS['rss']->renderWithTemplate('index.php', 'items');
52
53?>
Note: See TracBrowser for help on using the browser.