Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/movies/movies.php
<?php

# -----------------------------------------------------------------------------
#
# Frontend to the movie database 
#
# -----------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#                                                                               
# This file is part of TVEz (tvez.sourceforge.net).
#                                                                               
# TVEz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#                                                                               
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#                                                                               
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#                                                                               
# -----------------------------------------------------------------------------
#
# Created on 02/12/2003 by Christian Eheim (hide@address.com)
#
# LAST MODIFIED:
# $Date: 2004/09/12 00:08:48 $
# $Revision: 1.13 $
# $Author: eheim $
#
# -----------------------------------------------------------------------------

#require "movies/menu.php";
require "movies/utils.php";

# --------------------------------------------------------- 
$page = (isset($_REQUEST['page'])) ? $_REQUEST['page'] : "";
$search = (isset($_REQUEST['search'])) ? $_REQUEST['search'] : "";
$field = (isset($_REQUEST['field'])) ? $_REQUEST['field'] : "";
$order = (isset($_REQUEST['order'])) ? $_REQUEST['order'] : "";
$genres = (isset($_REQUEST['genres'])) ? $_REQUEST['genres'] : "";

# For the view, if it is set, use it
# otherwise use the user preferred view
if (isset($_REQUEST['view']) && $_REQUEST['view'] != "")
	$view = $_REQUEST['view'];
elseif (isset($_SESSION['tvezView']) && $_SESSION['tvezView'] != "")
	$view = $_SESSION['tvezView'];
else
	$view = "title";

if (isset($_REQUEST['rating']) && $_REQUEST['rating'] != "")
	$rating = $_REQUEST['rating'];
elseif (isset($_SESSION['tvezRating']) && $_SESSION['tvezRating'] != "")
	$rating = $_SESSION['tvezRating'];
else
	$rating = false;

# --------------------------------------------------------- 
# Generate the query according to user input
# and get all the matching movies
# --------------------------------------------------------- 
$search=urldecode($search);
$query = generate_query($order,$genres,$search,$field);
#
## ??? Where is the '%A0' coming from ???
## ??? And what char is it ???
#$query=urlencode($query);
#$query = preg_replace("/%A0/"," ",$query);
#$query=urldecode($query);
#
list($movie_total,$movies) = query_db($query);
# ---------------------------------------------------------

# If we show a signle movie, display the title in the title bar
if ($movie_total == 1) {
	$tstr = '- '.$movies[0]['title'];
	$tstr = preg_replace("/\"/","",$tstr);
}
else  $tstr = 'Media Library';
echo '<script language=javascript>';
echo 'if (self != top) top.document.title="TVEz '.$tstr.'"; ';
echo 'else top.document.title="TVEz '.$tstr.'"; ';
echo '</script>
';
# ---------------------------------------------------------

# --------------------------------------------------------- 
# Print the movie info
# --------------------------------------------------------- 
switch ($page) {
	case "movies":
		switch ($view) {
			case "title" : 
				require "movies/views/title_view.php";
				break;
			case "small" : 
				require "movies/views/small_view.php";
				break;
			case "large" :
				require "movies/views/large_view.php";
				break;
			case "pics" :
				require "movies/views/pics_view.php";
				break;
			default:
				require "movies/views/title_view.php";
				break;
		}
		break;
	case "asearch" :
		require "movies/advanced_search.php";
		break;
	case "stats" :
		require "movies/stats/movie_stats.php";
		break;
	default :
		require "movies/welcome.php";
		break;
}
?>
Return current item: TVEz - Media Library