<?php
/*
 **************************************************************************************************
 *    Copyright (c) 2010-2012 Just Another Video script
 *
 * 	  This file is part of Just Another Video Script.
 *    Version 1.4.3
 *    info@justanothervideoscript.com
 **************************************************************************************************
 *    Come to website for support or buying additional plugins/modules.
 *    http://justanothervideoscript.com/
 **************************************************************************************************
 *    By using this software you agree that you have read and acknowledged our End-User License
 *    Agreement available at http://justanothervideoscript.com/license and can be bound by it.
 **********************************************************************************
 */
include_once("adminfunctions.inc");
 
	if (isset($_POST['submit'])) { 
		$autoacceptvideo = $_POST['autoacceptvideo'] == 'on' ? 1 : 0 ;
		$db->query("UPDATE `setting` SET `value` = '".$autoacceptvideo."' WHERE `setting` = 'autoacceptvideo'") ;
		$captchaformembers = $_POST['captchaformembers'] == 'on' ? 1 : 0 ;
		$db->query("UPDATE `setting` SET `value` = '".$captchaformembers."' WHERE `setting` = 'captchaformembers'") ;		
		$comment_length = $_POST['comment_length'] ;
		$db->query("UPDATE `setting` SET `value` = '".$comment_length."' WHERE `setting` = 'comment_length'") ;	
$downnormalmembers = $_POST['downnormalmembers'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$downnormalmembers."' WHERE `setting` = 'downnormalmembers'") ;	
$downhdmember = $_POST['downhdmember'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$downhdmember."' WHERE `setting` = 'downhdmember'") ;	
$downmobilemember = $_POST['downmobilemember'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$downmobilemember."' WHERE `setting` = 'downmobilemember'") ;	
$downGuest = $_POST['downGuest'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$downGuest."' WHERE `setting` = 'downGuest'") ;
$downmobileGuest = $_POST['downmobileGuest'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$downmobileGuest."' WHERE `setting` = 'downmobileGuest'") ;
$downhdguest = $_POST['downhdguest'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$downhdguest."' WHERE `setting` = 'downhdguest'") ;

$membervideodelete = $_POST['membervideodelete'] == 'on' ? 1 : 0 ;
$db->query("UPDATE `setting` SET `value` = '".$membervideodelete."' WHERE `setting` = 'membervideodelete'") ;


		$maxsizememberavatar = $_POST['maxsizememberavatar'] ;
		$db->query("UPDATE `setting` SET `value` = '".$maxsizememberavatar."' WHERE `setting` = 'maxsizememberavatar'") ;	
		$mediamaxsize = $_POST['mediamaxsize'] ;
		$db->query("UPDATE `setting` SET `value` = '".$mediamaxsize."' WHERE `setting` = 'mediamaxsize'") ;		
		$player = $_POST['player'] ;
		$db->query("UPDATE `setting` SET `value` = '".$player."' WHERE `setting` = 'player'") ;
		$player = $_POST['player'] == 'flow' ? flow : jwplayer ;
		$db->query("UPDATE `setting` SET `value` = '".$player."' WHERE `setting` = 'player'") ;
		$avatar_h = $_POST['avatar_h'] ;
		$db->query("UPDATE `setting` SET `value` = '".$avatar_h."' WHERE `setting` = 'avatar_h'") ;
		$avatar_w = $_POST['avatar_w'] ;
		$db->query("UPDATE `setting` SET `value` = '".$avatar_w."' WHERE `setting` = 'avatar_w'") ;
		$restrictpc = $_POST['restrictpc'] == 'on' ? 0 : 1 ;
		$db->query("UPDATE `setting` SET `value` = '".$restrictpc."' WHERE `setting` = 'restrictpc'") ;
		$skinjw = $_POST['skinjw'] ;
		$db->query("UPDATE `setting` SET `value` = '".$skinjw."' WHERE `setting` = 'skinjw'") ;
		$submitmsg = "Everything has been updated now." ;

	}
	$autoacceptvideo = getSetting(autoacceptvideo, $db) == 1 ? 'CHECKED' : '' ;
	$captchaformembers = getSetting(captchaformembers, $db) == 1 ? 'CHECKED' : '' ;
	$comment_length = getSetting(comment_length, $db) ;
	$maxsizememberavatar = getSetting(maxsizememberavatar, $db) ;
	$mediamaxsize = getSetting(mediamaxsize, $db) ;
	$downnormalmembers = getSetting(downnormalmembers, $db) == 1 ? 'CHECKED' : '' ;
	$downhdmember = getSetting(downhdmember, $db) == 1 ? 'CHECKED' : '' ;
	$downmobilemember = getSetting(downmobilemember, $db) == 1 ? 'CHECKED' : '' ;
	$downGuest = getSetting(downGuest, $db) == 1 ? 'CHECKED' : '' ;
	$downhdguest = getSetting(downhdguest, $db) == 1 ? 'CHECKED' : '' ;
	$downmobileGuest = getSetting(downmobileGuest, $db) == 1 ? 'CHECKED' : '' ;
	$membervideodelete = getSetting(membervideodelete, $db) == 1 ? 'CHECKED' : '' ;
	$player = getSetting(player, $db) ;
	$flowcheck = getSetting(player, $db) == flow ? 'CHECKED' : '' ;
	$jwplayercheck = getSetting(player, $db) == jwplayer ? 'CHECKED' : '' ;
	$avatar_h = getSetting(avatar_h, $db) ;
	$avatar_w = getSetting(avatar_w, $db) ;
	$restrictpc = getSetting(restrictpc, $db)  == 0 ? 'CHECKED' : '' ;
	$skinjw = getSetting(skinjw, $db) ;
?>


<h2>Media Settings</h2>
<div class="settings">

	<fieldset>
		<form action="" method="post" enctype="multipart/form-data">
		<table>
			<tr>
				<h3><?=$submitmsg?><h3>
			</tr>

		<tr>
				<td>Flash Player:</td>
				<td>FlowPlayer<input type="radio" name="player" value="flow"<?= $flowcheck?>/> &nbsp;Jwplayer&nbsp;<input type="radio" name="player" value="jwplayer"<?= $jwplayercheck?>/></td> 
		</tr>
		<tr>
				<td>Jwplayer skin:</td>
				<td>
				<select name="skinjw" class="select">
					<? 
						foreach (skinList() as $skin) {
							echo "<option" ;
							if ($skin == $skinjw)
									echo " selected" ;
							echo ">".$skin."</option>" ;
						}
					?>
				</select>
				</td>
		</tr>
		<tr>
				<td>Auto accept videos:</td>
				<td><input type="checkbox" name="autoacceptvideo" <?=$autoacceptvideo?>></td>
		</tr>
		<tr>
				<td>Members can delete there own videos:</td>
				<td><input type="checkbox" name="membervideodelete" <?=$membervideodelete?>></td>
		</tr>		
		<tr>
				<td>Captcha for members:</td>
				<td><input type="checkbox" name="captchaformembers" <?=$captchaformembers?>></td>
		</tr>
		<tr>
				<td>Comment length:</td>
				<td><input type="text" size="10" name="comment_length" value="<?=$comment_length?>"></td>
		</tr>	
		<tr>
				<td>Guest can download normal videos(flv):</td>
				<td><input type="checkbox" name="downGuest" <?=$downGuest?>></td>
		</tr>
		<tr>
				<td>Guest can download HD videos(mp4):</td>
				<td><input type="checkbox" name="downhdguest" <?=$downhdguest?>></td>
		</tr>		
		<tr>
				<td>Guest can download mobile videos(mp4):</td>
				<td><input type="checkbox" name="downmobileGuest" <?=$downmobileGuest?>></td>
		</tr>
		<tr>
				<td>Members can download normal videos(flv):</td>
				<td><input type="checkbox" name="downnormalmembers" <?=$downnormalmembers?>></td>
		</tr>
		<tr>
				<td>Members can download HD videos(flv):</td>
				<td><input type="checkbox" name="downhdmember" <?=$downhdmember?>></td>
		</tr>		
		<tr>
				<td>Members can download normal videos(flv):</td>
				<td><input type="checkbox" name="downmobilemember" <?=$downmobilemember?>></td>
		</tr>
		<tr>
				<td>Guest can comment videos(always with captcha):</td>
				<td><input type="checkbox" name="restrictpc" <?=$restrictpc?>></td>
		</tr>
		<tr>
				<td>Max Video size (bytes):</td>
				<td><input type="text" size="15" name="mediamaxsize" value="<?=$mediamaxsize?>"></td>
		</tr>
		<tr>
				<td>Max size member avatar (bytes):</td>
				<td><input type="text" size="10" name="maxsizememberavatar" value="<?=$maxsizememberavatar?>"></td>
		</tr>							
		<tr>
				<td>Member avatar width:</td>
				<td><input type="text" size="5" name="avatar_w" value="<?=$avatar_w?>"></td>
		</tr>				
		<tr>
				<td>Member avatar height:</td>
				<td><input type="text" size="5" name="avatar_h" value="<?=$avatar_h?>"></td>
		</tr>					
		<tr>	
				<td><input class="submitbutton" type="submit" name="submit" value="Submit" /></td>
		</tr>
		</table>
		</form>

	</fieldset>
</div>	