source: trunk/qsearch.php @ 2135

Last change on this file since 2135 was 2135, checked in by rvelices, 17 years ago
  • fix plugin menu link broken with xamp (realpath behaves differently)
  • complete quick search rewriting
    • now we can quote phrases as in google "New York" is not the same as New York
    • user comments not searched anymore (faster)
    • the big full text query does not use joins anymore (faster)
    • related tags not shown on the index page, but now you can see the matching tags and matching categories
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
5// +-----------------------------------------------------------------------+
6// | file          : $Id: qsearch.php 2135 2007-10-12 03:27:34Z rvelices $
7// | last update   : $Date: 2007-10-12 03:27:34 +0000 (Fri, 12 Oct 2007) $
8// | last modifier : $Author: rvelices $
9// | revision      : $Revision: 2135 $
10// +-----------------------------------------------------------------------+
11// | This program is free software; you can redistribute it and/or modify  |
12// | it under the terms of the GNU General Public License as published by  |
13// | the Free Software Foundation                                          |
14// |                                                                       |
15// | This program is distributed in the hope that it will be useful, but   |
16// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
17// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
18// | General Public License for more details.                              |
19// |                                                                       |
20// | You should have received a copy of the GNU General Public License     |
21// | along with this program; if not, write to the Free Software           |
22// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
23// | USA.                                                                  |
24// +-----------------------------------------------------------------------+
25
26define('PHPWG_ROOT_PATH','./');
27include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
28
29// +-----------------------------------------------------------------------+
30// | Check Access and exit when user status is not ok                      |
31// +-----------------------------------------------------------------------+
32check_status(ACCESS_GUEST);
33
34if (empty($_GET['q']))
35{
36  redirect( make_index_url() );
37}
38
39$search = array();
40$search['q']=$_GET['q'];
41
42$query = '
43SElECT id FROM '.SEARCH_TABLE.'
44  WHERE rules = \''.addslashes(serialize($search)).'\'
45;';
46$search_id = array_from_query( $query, 'id');
47if ( !empty($search_id) )
48{
49  $search_id = $search_id[0];
50  $query = '
51UPDATE '.SEARCH_TABLE.'
52  SET last_seen=NOW()
53  WHERE id='.$search_id;
54  pwg_query($query);
55}
56else
57{
58  $query ='
59INSERT INTO '.SEARCH_TABLE.'
60  (rules, last_seen)
61  VALUES
62  (\''.addslashes(serialize($search)).'\', NOW() )
63;';
64  pwg_query($query);
65  $search_id = mysql_insert_id();
66}
67
68redirect(
69  make_index_url(
70    array(
71      'section' => 'search',
72      'search'  => $search_id,
73      )
74    )
75  );
76?>
Note: See TracBrowser for help on using the repository browser.