<?php
/**
 * 
 * sftp
 * passv
 * ftp_port
 * ftp_user
 * ftp_pass
 * ftp_path
 * 
 * 
 * mysql_host
 * mysql_port
 * mysql_db
 * mysql_user
 * mysql_pass
 * 
 * 
 * tesae_user
 * tesae_pass
 * 
 * apppath
 * 
 * islocl
 * cpfile
 * 
 */
	ini_set('display_errors', 1);
	ini_set('display_startup_errors', 1);
	error_reporting(E_ALL);
	

	require_once('../install/functions.php');
	
	if(isset($_REQUEST['step'])){
		$step=$_REQUEST['step'];
	}
	if(empty($step)){
		$step=0;
	}	
	// empty ftp port
	if(!isset($_REQUEST['ftp_port']) || empty($_REQUEST['ftp_port'])){
		$_REQUEST['ftp_port'] = '21';
	}
	
	//empty mysql_host
	if(!isset($_REQUEST['mysql_host']) || empty($_REQUEST['mysql_host'])){
		$_REQUEST['mysql_host'] = 'localhost';
	}
	
	//empty mysql_host
	if(!isset($_REQUEST['mysql_port']) || empty($_REQUEST['mysql_port'])){
		$_REQUEST['mysql_port'] = '3306';
	}
	
	if(!isset($_REQUEST['sftp']) ){
	    $_REQUEST['sftp'] = 1;
	    if($islocl){
	        $_REQUEST['sftp'] = 0;
	    } 
	} 
	if(!isset($_REQUEST['upd_rcopy']) ){
	    $_REQUEST['upd_rcopy'] = 1;
// 	    if($islocl){
// 	        $_REQUEST['upd_rcopy'] = 1;
// 	    }
	} 
	
	$next_step = $step+1;
?>
<form name="installtion" method="post" action="../install/index.php">
<div id="form">	
<?php
	
		echo '<dl id="head_title">Διαδικάσια εγκατάστασης Pegasus Web Application</dl>';
		
		
		if(!empty($prob_message00)){
			echo '<dl id="problem">' .$prob_message00. '</dl>';
		}
		
		//Ftp Connection
		echo '<dl id="title"> Στοιχεία σύνδεσης FTP </dl>';
		
		if(!empty($prob_message_ftp)){
			echo '<dl id="problem">' .$prob_message_ftp. '</dl>';
		}
	
		
		
		echo '<dl>';
		echo '<label for="ftp_user">FTP Username:</label>';
		echo '<input type="text" id="ftp_user" name="ftp_user"  value="' .(isset($_REQUEST['ftp_user'])?$_REQUEST['ftp_user']:''). '" value="" size="50">';
		echo '</dl>';
		
		echo '<dl>';
		echo '<label for="ftp_pass">FTP Password:</label>';
		echo '<input type="text" id="ftp_pass" name="ftp_pass"  value="' .(isset($_REQUEST['ftp_pass'])?$_REQUEST['ftp_pass']:''). '" value="" size="20">';
		echo '</dl>';
		
		echo '<dl>';
		echo '<label for="ftp_port">FTP Port:</label>';
		echo '<input type="text" id="ftp_port" name="ftp_port"  value="' .(isset($_REQUEST['ftp_port'])?$_REQUEST['ftp_port']:''). '" size="5">';	
		echo '</dl>';

		echo '<dl>';
		echo '<label for="sftp">Check for Secure connection</label>';
		echo '<input type="checkbox" id="sftp" name="sftp"  value="1" ';
		  echo (isset($_REQUEST['sftp']) && $_REQUEST['sftp']==1 )?'checked':'';
		echo ' >';	
		echo '<label for="passv">Enable Passive ftp mode</label>';
		echo '<input type="checkbox" id="passv" name="passv" ';
		  
        echo ' value="1" >';	
		
		echo '<label for="upd_rcopy">Copy Files</label>';
		echo '<input type="checkbox" id="upd_rcopy" name="upd_rcopy" ';
		echo (isset($_REQUEST['upd_rcopy']) && $_REQUEST['upd_rcopy']==1 )?'checked':''; 
		echo ' value="1" >';	
		
		echo '</dl>';
		
		echo '<dl>';
		echo '<label for="ftp_path">FTP Root Path:</label>';
		echo '<input type="text" id="ftp_path" name="ftp_path"  value="' .(isset($_REQUEST['ftp_path'])?$_REQUEST['ftp_path']:''). '" size="50">';
		echo '</dl>';
		echo '<br><span><b>Εφόσον επιλέξετε Copy Files δεν χρειάζεται να συμπληρώσεται FTP! </span>';
		echo '<br><span><b>FTP Root Path:</b>είναι το μονοπάτι όπου η εφαρμογή θα εγκαταστήσει τα αρχεία της εφόσον συνδεθεί με τα ftp στοιχεία που δώσατε παραπάνω.</span>';
		echo '<br><br><span><b>Σημείωση:</b> Επιλέξτε Secure Connection εάν ο server σας υποστηρίζει Secure SSL-FTP Σύνδεση</span>';
		//MySQL Connect
		echo '<dl id="title"> Στοιχεία σύνδεσης στην MySQL βάση </dl>';		
		
		if(!empty($prob_message_mysql)){
			echo '<dl id="problem">' .$prob_message_mysql. '</dl>';
		}

		

		echo '<dl>';
		echo '<label for="mysql_host">(*) MySQL DataBase Host:</label>';
		echo '<input type="text" id="mysql_host" name="mysql_host"  value="' .(isset($_REQUEST['mysql_host'])?$_REQUEST['mysql_host']:''). '" size="50">';
		echo '</dl>';

		echo '<dl>';
		echo '<label for="mysql_db">(*) MySQL Database Name:</label>';
		echo '<input type="text" id="mysql_db" name="mysql_db"  value="' .(isset($_REQUEST['mysql_db'])?$_REQUEST['mysql_db']:''). '" value="" size="20">';
		echo '</dl>';
	
		echo '<dl>';
		echo '<label for="mysql_user">(*) MySQL Username:</label>';
		echo '<input type="text" id="mysql_user" name="mysql_user"  value="' .(isset($_REQUEST['mysql_user'])?$_REQUEST['mysql_user']:''). '" value="" size="50">';
		echo '</dl>';
		
		echo '<dl>';
		echo '<label for="mysql_pass">(*) MySQL Password:</label>';
		echo '<input type="text" id="mysql_pass" name="mysql_pass"  value="' .(isset($_REQUEST['mysql_pass'])?$_REQUEST['mysql_pass']:''). '" value="" size="20">';
		echo '</dl>';
		
		echo '<dl>';
		echo '<label for="mysql_port">(*) MySQL Port:</label>';
		echo '<input type="text" id="mysql_port" name="mysql_port"  value="' .(isset($_REQUEST['mysql_port'])?$_REQUEST['mysql_port']:''). '" size="5">';	
		echo '</dl>';
		
		
		
		//MySQL Connect
		echo '<dl id="title"> Στοιχεία σύνδεσης στo tesae.gr </dl>';
	
		if(!empty($prob_message_tesae)){
			echo '<dl id="problem">' .$prob_message_tesae. '</dl>';
		}
		echo '<dl>';
		echo '<label for="tesae_user">tesae.gr Username:</label>';
		echo '<input type="text" id="tesae_user" name="tesae_user"  value="' .(isset($_REQUEST['tesae_user'])?$_REQUEST['tesae_user']:''). '" value="" size="35">';
		echo '</dl>';
		
		echo '<dl>';
		echo '<label for="tesae_pass">tesae.gr Password:</label>';
		echo '<input type="text" id="tesae_pass" name="tesae_pass"  value="' .(isset($_REQUEST['tesae_pass'])?$_REQUEST['tesae_pass']:''). '" value="" size="35">';
		echo '</dl>';
 
	
?>
	<dl>
		<input type="hidden" name="install" value="1"/>
		<input type="hidden" value="<?php echo $islocl;?>" name="islocl"/>
		<input type="hidden" value="<?php echo (isset($_REQUEST['apppath'])?$_REQUEST['apppath']:'');?>" name="apppath"/>
		<input type="submit" value="Eγκατάσταση Pegasus Web Application">
	</dl>
	
</div>
</form>