<?php
include("postget.php");
include_once("common.php");
$pagetitle = _URL;

checklevel(4,$_REQUEST['clientid']);
if ($config[56][1]==1){
	$disabled=" disabled ";
	$mensaje= " "._CHANGE_NOT_ALLOWED_IN_DEMO_MODE;
}else{
	$disabled=" ";
	$mensaje= "";
}



//////////////////////////////////////////////////////////////// si se envi� el formulario, cargar los errores
if ($_REQUEST[sendclick]==""._SEND."") {
	$estiloerror = "class='formfielderror'";
	$errors = '';
	if ($_POST['Xserverurl']=='') {$errors.= "<br>".ucfirst(_URL).": "._NOT_SPECIFIED.""; $estilourl=$estiloerror;}
	if ($_POST['Xserverpath']=='') {$errors.= "<br>".ucfirst(_SERVER_PATH).": "._NOT_SPECIFIED.""; $estiloserverpath=$estiloerror;}
//	if ($_POST['Xdirectory4backups']=='') {$errors.= "<br>".ucfirst(_DIRECTORY_FOR_BACKUPS).": "._NOT_SPECIFIED.""; $estilobackup=$estiloerror;}
//	if ($_POST['Xdirectory4docs']=='') {$errors.= "<br>".ucfirst(_DIRECTORY_FOR_DOCUMENTS).": "._NOT_SPECIFIED.""; $estilodocs=$estiloerror;}
}

//////////////////////////////////////////////////////////////// si no hay errores y se presion� SEND
if($errors=='' AND $_REQUEST[sendclick] ==""._SEND."") {
	if($new84=="on"){$new84=1;}else{$new84=0;}
	if (substr($license,0,4)=='FREE') {
		$new84=0;
	}

	mysql_query("UPDATE hd_config SET valor='$Xserverurl' WHERE ref='1'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$Xserverpath' WHERE ref='40'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new84' WHERE ref='84'",$db_link);
	
	messagetop(_THE_CHANGES_WHERE_MADE_SUCCESSFULLY,'','preferences.php',1);

}else{


	$query="SELECT * FROM hd_config ORDER BY ref";
	$result=mysql_query($query,$db_link);
	$fila=0;
	while($row=mysql_fetch_array($result))
	{
		$Config[$fila][0]=$row["variable"] ;
		$Config[$fila][1]="'".$row["valor"]."'";
		//	$Config[$fila][1]=$row["valor"];
		$fila++ ;
	}


	print errors($errors); $errors = '';


	print("<form method='POST'>");
	echo '<table class="table table-striped">';


	echo '<tr>';
	print("<td><b>"._URL.":</b> <i>(http://www.".strtolower(_DOMAIN)."/".strtolower(_FOLDER).")</i></td><td>");
	print("".tip(46)."<input $estilourl name=Xserverurl value=".$Config[1][1]." class='input-xlarge'></td></tr>");

	echo '<tr>';
	print("<td>".ucfirst(_USE_SSL_FOR_ADMIN_AND_CLIENT_AREA).": </td><td>");
	print("".tip(47)."<input type='checkbox' name=new84");
	if ($config[84][1]=='1'){print(" checked");};
	if (substr($license,0,4)=='FREE') {
		$onlypremium = "<font size='3' color='red'><b> ".lang('_AVAILABLE_ONLY_IN_THE_PREMIUM_VERSION')."</b></font>";
	}else{
		$onlypremium = '';
	}
	print("> (".str_replace('http://','https://',$config[1][1]).")  ".$onlypremium." </td></tr>");

	echo '<tr>';
	print("<td><b>"._SERVER_PATH.":</b> </td><td>");
	print("".tip(48)."<input $estiloserverpath name=Xserverpath value=".$Config[40][1]." class='input-xlarge'></td></tr>");


	print("</table>");
	print("<input type=submit name=sendclick value="._SEND." $disabled>$mensaje</form>");

}
?>