root/trunk/search.php

Revision 1724, 1.8 kB (checked in by vollmerk, 4 months ago)

fix search when no results are found, actually show the correct "error"

Line 
1<?php
2/*
3
4 Copyright (c) Ampache.org
5 All Rights Reserved
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License v2
9 as published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20*/
21
22require_once 'lib/init.php';
23
24show_header(); 
25
26/**
27 * action switch
28 */
29switch ($_REQUEST['action']) { 
30        case 'quick_search':
31                /* This needs to be done because we don't know what thing
32                 * they used the quick search to search on until after they've
33                 * submited it
34                 */
35                $_REQUEST['s_all'] = $_REQUEST['search_string'];
36               
37                if (strlen($_REQUEST['search_string']) < 1) { 
38                        Error::add('keyword',_('Error: No Keyword Entered'));
39                        require_once Config::get('prefix') . '/templates/show_search.inc.php'; 
40                        break;
41                }
42        case 'search':
43                require_once Config::get('prefix') . '/templates/show_search.inc.php'; 
44                require_once Config::get('prefix') . '/templates/show_search_options.inc.php'; 
45                $results = run_search($_REQUEST);
46                Browse::set_type('song'); 
47                Browse::reset(); 
48                Browse::show_objects($results); 
49        break;
50        case 'save_as_track':
51                $playlist_id = save_search($_REQUEST);
52                $playlist = new Playlist($playlist_id);
53                show_confirmation("Search Saved","Your Search has been saved as a track in $playlist->name",conf('web_path') . "/search.php");
54        break;
55        default:
56                require_once Config::get('prefix') . '/templates/show_search.inc.php'; 
57        break;
58}
59
60/* Show the Footer */
61show_footer();
62?>
Note: See TracBrowser for help on using the browser.