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

# ------------------------------------------------------------------------------
#
# This file contains the tv control funcionality for the movie player
#
# ------------------------------------------------------------------------------
#
# 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 11/02/2003 by Christian Eheim
#
# LAST MODIFIED:
# $Date: 2004/01/25 02:11:34 $
# $Revision: 1.2 $
# $Author: eheim $
#
# ------------------------------------------------------------------------------

require "../../config/config_file.php";
require "socket.php";
require "../shared/session.php";

if ( !isset($_SESSION['tvezAccess']) && $LOGIN_ENABLED )
	exit;

	if (isset($_REQUEST['action'])) {
		if ($_REQUEST['action'] == 'Delete') $action = "Delete";
		elseif ($_REQUEST['action'] == 'Delete all') $action = "Delete all";
		elseif ($_REQUEST['action'] == 'Play now') $action = "Play now";
		else $action = "";
	}

	switch ($action) {
		case "Delete all":
			list($errno,$ans) = send_command("clear\r\n");
			break;
		case "Delete":
			$list = get_list();
			if ($list != "")
				list($errno,$ans) = send_command("delete $list\r\n");
			break;
		case "Play now":
			if (isset($_REQUEST['pl'])) {
				list($errno,$ans) = send_command("select ".$_REQUEST['pl'][0]."\r\n");
			}
			break;
		default:
			$tvst = $HTTP_GET_VARS["tvst"]."\r\n";
			list($errno,$ans) = send_command($tvst);
			break;
	}

	function get_list() {
		if (isset($_REQUEST['pl'])) {
			$list = "";
			foreach ($_REQUEST['pl'] as $item) {
				$list .= $item.",";
			}
			$list = substr($list,0,-1);
		}
		return $list;
	}
	// HTTP/1.0
#	header("Pragma: no-cache");
	$tvst = urlencode($tvst);
	header("Location: playlist.php?cmd=$tvst\n\n");
	exit();

?>
Return current item: TVEz - Media Library