<?php 
/*
 *    Copyright (c) 2010 Just Another Video script
 *
 *    This file is part of Just Another Video script.
 *    Come to website for support or buying additional plugins/modules.
 *    http://justanothervideoscript.com/	
 */
include_once("./modules/adminfunctions.inc");
$red = "<img src='./images/red.png' border=0>" ;
$green = "<img src='./images/green.png' border=0>" ;


$ffmpegpath = getSetting(ffmpegpath, $db) ;
$curlpath = getSetting(curlpath, $db) ;
$flvtool2path = getSetting(flvtool2path, $db) ;
$mp4box = getSetting(mp4box, $db) ;

if (file_exists($ffmpegpath)) {
	$ffmpegfail = $green ;
	$ffmpegpath = $ffmpegpath;
} else {
	$ffmpegfail = $red;
	$ffmpegpath = 'FFmpeg not found...Set correct path in settings';
}
if (file_exists($curlpath)) {
	$curlfail = $green ;
	$curlpath = $curlpath;
} else {
	$curlfail = $red;
	$curlpath = 'Curl not found...Set correct path in settings';
}
if (file_exists($flvtool2path)) {
	$flvtool2fail = $green ;
	$flvtool2path = $flvtool2path;
} else {
	$flvtool2fail = $red;
	$flvtool2path = 'flvtool2 not found...Set correct path in settings';
}
if (file_exists($mp4box)) {
	$MP4Boxfail = $green ;
	$MP4Boxpath = $mp4box;
} else {
	$MP4Boxfail = $red;
	$MP4Boxpath = 'MP4Box not found...Set correct path in settings';
}
?>


<script type="text/javascript" src="./plugins/servertest/servertest.js"></script>
<link rel="stylesheet" type="text/css" href="./plugins/servertest/servertest.css" />

<h2>Server tester</h2>
<div id="servertest">	
	
	<div class="servertest-left">
	<fieldset>
		<table>
			<p class="statustop">Encoding program paths</p>
			<tr>
				<td>FFmpeg:</td>
				<td><?=$ffmpegpath?></td>
				<td><?=$ffmpegfail?></td>
			</tr>	
			<tr>
				<td>flvtool2:</td>
				<td><?=$flvtool2path?></td>
				<td><?=$flvtool2fail?></td>
			</tr>			
			<tr>
				<td>Curl:</td>
				<td><?=$curlpath?></td>
				<td><?=$curlfail?></td>
			</tr>			
			<tr>
				<td>MP4Box:</td>
				<td><?=$MP4Boxpath?></td>
				<td><?=$MP4Boxfail?></td>
			</tr>	
		
		</table>
	</fieldset>		
	<fieldset>
		<table>
			<p class="statustop">Test to find paths</p>
			<tr>	
				<td><input class="submitbutton" type="submit" id="find_ffmpeg" value="Find FFmpeg path" /></td>
			</tr>
			<tr>	
				<td><input class="submitbutton" type="submit" id="find_flvtool2" value="Find Flvtool2 path" /></td>
			</tr>			
			<tr>	
				<td><input class="submitbutton" type="submit" id="find_curl" value="Find Curl path" /></td>
			</tr>			
			<tr>	
				<td><input class="submitbutton" type="submit" id="find_MP4box" value="Find MP4Box path" /></td>
			</tr>			
			<tr>	
				<td><input class="submitbutton" type="submit" id="find_php" value="Find php path" /></td>
			</tr>										
			<tr>	
				<td><input class="submitbutton" type="submit" id="find_wget" value="Find wget path" /></td>
			</tr>
		</table>
	</fieldset>			
	<fieldset>
		<table>
			<p class="statustop">Test to see version of programs</p>
			<tr>	
				<td><input class="submitbutton" type="submit" id="version_ffmpeg" value="Find FFmpeg version" /></td>
			</tr>
			<tr>	
				<td><input class="submitbutton" type="submit" id="version_flvtool2" value="Find Flvtool2 version" /></td>
			</tr>			
			<tr>	
				<td><input class="submitbutton" type="submit" id="version_curl" value="Find Curl version" /></td>
			</tr>			
			<tr>	
				<td><input class="submitbutton" type="submit" id="version_MP4box" value="Find MP4Box version" /></td>
			</tr>			
			<tr>	
				<td><input class="submitbutton" type="submit" id="version_php" value="Find php version" /></td>
			</tr>												
		</table>
	</fieldset>	
	</div>

	<div class="statusoutput">
	<fieldset>
		<table>
			<p class="statustop">Test Output</p>
			<tr>	
				<td><input class="submitbutton" type="submit" id="clearoutput" value="Clear output" /></td>
			</tr>	
			
			<div id="outputtest"></div>
		</table>
	</fieldset>	
	</div>



</div>
