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

# ------------------------------------------------------------------------------
#
# This is the configurator for the TVEz settings.
#
# ------------------------------------------------------------------------------
#
# 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 Alex Pachikov
#
# LAST MODIFIED:
# $Date: 2004/01/22 06:49:53 $
# $Revision: 1.4 $
# $Author: eheim $
#
# ---------------------------------------------------------------------

$DEMO = false;
                                                                                
if ($DEMO) {
    $config_file_perl = "../config/config_file-fake.pl";
    $config_file_php = "../config/config_file-fake.php";
} else {
    $config_file_perl = "../config/config_file.pl";
    $config_file_php = "../config/config_file.php";
}
                                                                                
																				require "admin/admin_access.php";
require $config_file_php;
require "configurator.php";
#require "html.inc";

global $config_text, $HTTP_POST_VARS;
$config_text_perl = "#TVEZ Config File for Perl.  -- DO NOT EDIT BY HAND! --\n\n";
$config_text_php = "?php \n#TVEZ Config File for PHP.  -- CAN BE CHANGED BY HAND --\n\n";

#print_html_header();

print "<form name=tvezconfig action=\"".$_SERVER["PHP_SELF"]."\" method=POST>
	<input type=hidden name=content value=admin>
	<input type=hidden name=page value=tvezconfig>
\n";
print '<table width=100% cellpadding=8 cellspacing=0 border=0 align=center>
<tr><td align=left>
<h1>TVEZ Configurator</h1>
<h2>DataBase Variables</h2>
<table width=100% cellpadding=8 cellspacing=0 border=1 align=center>
';

#
#
########################
# All confurable options

# DB vars
 config_input("Database Name:",$MYSQL{'db'},"MYSQL{'db'}","Name of the Database that you plan to use. MySQL only.");
# config_input("DB Table Name:",$MYSQL{'table'},"MYSQL{'table'}","The name of the table");
 config_input("DB User:",$MYSQL{'user'},"MYSQL{'user'}","");
 config_input("DB Password:",$MYSQL{'passwd'},"MYSQL{'passwd'}","");
 config_input("DB Host:",$MYSQL{'host'},"MYSQL{'host'}","");

# Movies vars
 config_table("Movies Variables");
 config_input("Movie Extensions:",$EXT,"EXT","Extentions for all movie types to search for");
 config_input("Image Path:",$IMG_PATH,"IMG_PATH","Path to store the downloaded images of movies. Can be speficied as relative to the tvez/html dir or absolute.");
 config_input("Image URL:",$IMG_URL,"IMG_URL","URL of the images for movies.");
 config_input("IMG Tags:",$IMG_TAGS,"IMG_TAGS","IMG tags for the pics-only view.<br>Ex: vspace=6 hspace=6 width=100");
 config_input("IMDB URL:",$IMDB_HTTP,"IMDB_HTTP","URL of the IMDb in the language you prefer (us.imdb.com,german.imdb.com,italian.imdb.com)");
 config_textarea("Movie Paths:",$MOVIE_DIRS,"MOVIE_DIRS","List all the paths to directories that contain movies. One directory per line.");

# TV vars
 config_table("TV Server Variables");
# config_input("TVEz Path:",$TV_CMD,"TV_CMD","Path to TVEz deamon or script");
 config_input("TV Server:",$TVSERVER,"TVSERVER","Hostname of the computer that acts as the TV");
 config_input("TV Port:",$TVPORT,"TVPORT","Port on the TV server");
 config_input("TV User:",$TVUSER,"TVUSER","Username of the account that controls the TV (SSH Only)");
 config_input("TV User Pwd:",$TVUSERPASS,"TVUSERPASS","Password for the account that controls the TV (SSH Only)");
# config_input("Start Movie CMD:",$startmovie_CMD,"startmovie_CMD","Command to start the movie on the tv server (SSH Only)");
# config_input("Connection",$connection,"connection","Choose the method: SSH or Localhost");
 config_input("Player Path",$PLAYERPATH,"PLAYERPATH","Path to the Player (i.e. xine)");
 config_input("Player Flags",$PLAYERFLAGS,"PLAYERFLAGS","Flags to pass the player. You must give xine the -n flag! Example: &quot;-n -B -G 800x600+0+1024 --auto-play=hq&quot;");
 config_check("Server Logging:",$LOGGING,"LOGGING","Enable/Disable TVEz server Logging. The server must be restarted after changing this value.");

# The login feature
 config_table("TVEz Login Feature");
 config_check("User Login:",$LOGIN_ENABLED,"LOGIN_ENABLED","Enable/Disable the TVEz user login feature.");
# Users
# config_table("Users");
# config_textarea("Admin Users",$adminusers,"adminusers","List of users that have administrative privileges. One per line.");
# Updates
 config_table("TVEz Updates");
 config_check("Check for updates:",$CHECK_FOR_UPDATES,"CHECK_FOR_UPDATES","Enable/Disable checking for new TVEz versions.");

# Other
 config_table("Other Variables");
 config_input("PS Path:",$PS_CMD,"PS_CMD","Path to ps");
# config_input("Language",$langu,"langu","Language: en, de (not implemented yet)");

#######################
#
#

# this is a note to remind me that the <> tags have to added on the write.
$config_text_php .= "?";
$config_text_perl .="\n1;";

print '
</table>
<p>
';

# Check if the files are writable
if (is_writable($config_file_perl)) {
   print "<span class=configgood><b>$config_file_perl is writable.</b></span><br>";
} else {
   print "<span class=configbad><b>$config_file_perl is NOT writable.</b></span>";
   $ok = no;
}

if (is_writable($config_file_php)) {
   print "<span class=configgood><b>$config_file_php is writable.</b></span><br>";
} else {
   print "<span class=configbad><b>$config_file_php is NOT writable.</b></span>";
   $ok = no;
}

# if ok - give the option to write the files.
if ($ok != no) {
   
   if ($HTTP_POST_VARS['save']) {

      # Write the files.

    if (!$handle = fopen($config_file_php, 'w')) {
	  echo "<span class=configbad><b>Unable to write to file $config_file_php</b></span><br>";
    } else {
    	if (!fwrite($handle, "<".$config_text_php.">")) {
	  echo "<span class=configbad><b>Unable to write to file $config_file_php</b></span><br>";
    	} else {
	  echo "<span class=configgood><b>Success writing to $config_file_php</b></span><br>";
        }
    	fclose($handle);
    }

    if (!$handle = fopen($config_file_perl, 'w')) {
	  echo "<span class=configbad><b>Unable to write to file $config_file_perl</b></span><br>";
    } else {
    	if (!fwrite($handle, $config_text_perl)) {
	  echo "<span class=configbad><b>Unable to write to file $config_file_perl</b></span><br>";
    	} else {
	  echo "<span class=configgood><b>Success writing to $config_file_perl</b></span><br>";
        }
    	fclose($handle);
    }

   }
   print '
   	<br>
	<input type=submit name=save value="Write the Changes" class=configform>
	<br><br>';
} else {
 
   print '<h2>PHP Config File </h2>
<pre> <blockquote>'; 
   print "&lt;".$config_text_php."&gt;";
   print '</blockquote> </pre>
<h2>Perl Config File </h2>
<pre> <blockquote>';
   print $config_text_perl;
   echo " </blockquote> </pre>";
}
print "
</form>
 </td></tr>
</table>
";

?>
Return current item: TVEz - Media Library