Source for file livesearch.php
Documentation is available at livesearch.php
* MvBlog -- An open source no-nosense blogtool
* Copyright (C) 2005-2007, Michiel van Baak
* Michiel van Baak <mvanbaak@users.sourceforge.net>
* See http://www.mvblog.org for more information on MvBlog.
* That page also provides Bugtrackers, Filereleases etc.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
* @author Michiel van Baak
* @copyright 2005-2007 Michiel van Baak
//get all the authors in an array
$res =
& $mvblog->db->query("SELECT * FROM authors");
if (PEAR::isError($res)) {
while ($row =
$res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$authors[$row["id"]]["fullname"] =
$row["fullname"];
$authors[$row["id"]]["email"] =
$row["email"];
$query =
"SELECT id,title FROM articles WHERE public=1 AND active=1 AND aside=0 AND";
$query .=
sprintf(" (upper(title) LIKE '%%%s%%' OR upper(head) LIKE '%%%s%%' OR upper(body) LIKE '%%%s%%')",
$query .=
" ORDER BY date DESC";
$mvblog->db->setLimit(5);
$res =
& $mvblog->db->query($query);
$ret =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$ret .=
"\t<title>search results</title>\n";
while ($row =
$res->fetchRow()) {
$ret .=
"\t\t<articleID>".
$row[0].
"</articleID>\n";
$ret .=
"\t\t<articleTitle>".
stripslashes($row[1]).
"</articleTitle>\n";
header("Content-Type: text/xml");
Documentation generated on Fri, 28 Dec 2007 13:17:31 +0100 by phpDocumentor 1.4.1