<?php
//////////////////////////////////////////////////////////////
//===========================================================
// adddomain_theme.php
//===========================================================
// SOFTACULOUS
// Version : 1.1
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date: 10th Jan 2009
// Time: 21:00 hrs
// Site: http://www.softaculous.com/ (SOFTACULOUS)
// ----------------------------------------------------------
// Please Read the Terms of use at http://www.softaculous.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Inc.
//===========================================================
//////////////////////////////////////////////////////////////
if(!defined('SOFTACULOUS')){
die('Hacking Attempt');
}
function adddomain_theme(){
global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error;
global $saved , $aefer ;
softheader(__('$0 - Add a Domain', array($globals['sn'])));
echo '<div class="bg"><br />';
echo '<form accept-charset="'.$globals['charset'].'" name="addadomain" method="post" action="" class="form-horizontal">
<div class="sai_main_head" style="width:100%;" align="center"><span class="form-title">'.__('Add Domain').'</span></div>';
error_handle($error, '100%');
if(!empty($saved)){
echo '<div class="alert alert-success mt-4">
<a href="#close" class="close" data-dismiss="alert" aria-label="close">×</a>
<center><img src="'.$theme['images'].'message_success.gif" /> '.__('Your Domain was saved successfully').'</center>
</div>';
}
echo '<div class="card m-3 p-3">
<div class="row">
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="domain" class="sai_head">'.__('Domain Name').'</label><br />
<span class="sai_exp2">'.__('Enter a valid domain name (without http://) e.g. mydomain.com').'</span>
<input type="text" name="domain" id="domain" class="form-control" value="'.POSTval('domain', '').'" />
</div>
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="server_host" class="sai_head">'.__('Server Host (Optional)').'</label><br />
<span class="sai_exp2">'.__('Enter your server host name').'
<span class="sai_exp">'.__('<b>IF</b> your domain name and server host are not the same enter the server host e.g. ftp.mydomain.com').'</span>
</span>
<input type="text" name="server_host" id="server_host" class="form-control" value="'.POSTval('server_host', '').'" />
</div>
</div><br />
<div class="row">';
if(empty($globals['custom_handler'])){
echo '
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="protocol" class="sai_head">'.__('Protocol').'</label><br />
<span class="sai_exp2">'.__('Select the protocol by which Softaculous will communicate').'</span>
<select name="protocol" class="form-control" id="protocol">
<option value="ftp" '.(isset($_POST['protocol']) && $_POST['protocol'] == 'ftp' ? 'selected="selected"' : '').'>FTP</option>
<option value="ftps" '.(isset($_POST['protocol']) && $_POST['protocol'] == 'ftps' ? 'selected="selected"' : '').'>FTPS</option>
<option value="sftp" '.(isset($_POST['protocol']) && $_POST['protocol'] == 'sftp' ? 'selected="selected"' : '').'>SFTP</option>
</select>
</div>';
}
echo '
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="port" class="sai_head">'.__('Port').'</label><br />
<span class="sai_exp2">'.__('Enter the port to connect').'</span>
<input type="text" name="port" id="port" class="form-control" value="'.POSTval('port', '').'" />
</div>
</div><br />
<div class="row">
<div class="col-12 col-md-6 col-xl-6 mb-2" id="trauthpass">
<label for="auth_password" class="sai_head">'.__('Authentication method').'</label><br/>
<span class="sai_exp2">'.__('Select the authentication method').'</span>
<input type="radio" name="auth_password" id="auth_password" value="1" onchange="check_auth_password();" '.POSTradio('auth_password', 1, 1).' /> '.__('Password').'
<input type="radio" name="auth_password" id="auth_password" value="" onchange="check_auth_password();" '.POSTradio('auth_password', '').' /> '.__('SSH Key').'<br />
</div><br/>
</div><br/>
<div class="row">
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="ftp_user" class="sai_head" id="ftp_user_head">'.__('Username').'</label><br />
<span class="sai_exp2">'.__('The username of your FTP Account').'</span>
<input type="text" name="ftp_user" id="ftp_user" class="form-control" value="'.POSTval('ftp_user', '').'" />
</div>
<div class="col-12 col-md-6 col-xl-6 mb-2" id="ftp_pass">
<label for="ftp_passwd" class="sai_head" id="ftp_pass_head">'.__('Password').'</label><br />
<span class="sai_exp2">'.__('The Password of your FTP account').'</span>
<div class="row">
<div class="col-sm-11">
<input type="password" name="ftp_pass" id="ftp_passwd" class="form-control" value="'.POSTval('ftp_pass', '').'" autocomplete="off" />
</div>
<div class="col-sm-1" style="margin-left:-20px;">
<input id="toggle_passwd" type="checkbox" style="display:none;" onclick="toggle_pass(\'show_hide\', \'ftp_passwd\');" /><label for="toggle_passwd" style="margin-top:6px;"><span id="show_hide">'.__('Show').'</span></label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6 col-xl-6 mb-2" id="pri">
<label for="private_key" class="sai_head">'.__('Private Key').'</label><br/>
<span class="sai_exp2">'.__('Paste the private key here').'</span>
<textarea name="private_key" id="private_key" rows="15" cols="70" class="form-control">'.aPOSTval('private_key').'</textarea><br />
</div>
<div class="col-12 col-md-6 col-xl-6 mb-2" id="passphrase_div">
<label for="passphrase" class="sai_head">'.__('Passphrase').'</label><br/>
<span class="sai_exp2">'.__('Passphrase for encrypted private key(optional)').'</span>
<input type="text" name="passphrase" id="passphrase" class="form-control" value="'.POSTval('passphrase', '').'" /><br />
</div>
</div>
<div class="row">
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="ftp_path" class="sai_head" id="ftp_path_head">'.__('Path').'</label><br />
<span class="sai_exp2" id="ftp_path_exp">'.__('Relative path to web accessible directory of user. e.g. /public_html').'</span>
<input type="text" name="ftp_path" id="ftp_path" class="form-control" value="'.POSTval('ftp_path', '').'" />
</div>';
if(empty($softpanel->dont_show_backup_dir) && empty($globals['disable_backup_restore'])){
echo '<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="backup_path" class="sai_head">'.__('Backup Path').'</label><br />
<span class="sai_exp2" id="backup_path_exp">'.__('Relative path from Home directory of user. e.g. /backups').'</span>
<input type="text" name="backup_path" id="backup_path" class="form-control" value="'.POSTval('backup_path', '').'" />
</div>';
}
echo '</div><br />';
if(empty($softpanel->dont_show_datadir)){
echo '<div class="row">
<div class="col-12 col-md-6 col-xl-6 mb-2">
<label for="data_dir" class="sai_head">'.__('Data Directory').'</label><br />
<span class="sai_exp2">'.__('Full Path to Data Directory e.g. /home/USER/datadir<br/>Some scripts like Elgg, Moodle, etc need a non web accessible folder.<br/>This will be used for that purpose.').'</span>
<input type="text" name="data_dir" id="data_dir" class="form-control" value="'.POSTval('data_dir', '').'" />
</div>
</div><br />';
}
echo '
<p align="center">
<br /><br />
'.csrf_display().'
<input class="btn sai-button" type="submit" name="add_domain" value="'.__('Test and Save Domain').'" />
<br /><br />
<b><a class="sai_head" href="'.$globals['ind'].'act=domains">'.__('Show all domains').'</a></b>
</p>
</div>
</form>
</div>';
echo ' <br /><br />
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
$(document).ready(function(){
check_auth_password();
checkprotocol();
$(\'#auth_password\').change(function(){
if($(this).is(":checked")) {
hide_sshkey();
}else{
show_sshkey();
}
});
$(\'#protocol\').change(function(){
checkprotocol();
});
});
function checkprotocol(){
$(\'#ftp_user_head\').html($(\'#protocol\').val().toUpperCase()+" "+"'.__js('Username').'");
$(\'#ftp_pass_head\').html($(\'#protocol\').val().toUpperCase()+" "+"'.__js('Password').'");
$(\'#ftp_path_head\').html($(\'#protocol\').val().toUpperCase()+" "+"'.__js('Path').'");
if($(\'#protocol\').val() == \'ftp\'){
if($(\'#port\').val() == ""){
$(\'#port\').val(\'21\');
}
$(\'#trauthpass\').hide();
hide_sshkey();
ftppath();
}
if($(\'#protocol\').val() == \'ftps\'){
if($(\'#port\').val() == ""){
$(\'#port\').val(\'21\');
}
$(\'#trauthpass\').hide();
hide_sshkey();
ftppath();
}
if($(\'#protocol\').val() == \'sftp\'){
if($(\'#port\').val() == ""){
$(\'#port\').val(\'22\');
}
$(\'#trauthpass\').show();
if($(\'#auth_password\').is(":checked")){
hide_sshkey();
}else{
show_sshkey();
}
sftppath();
}
}
function ftppath(){
$(\'#ftp_path\').html("'.__js('Path').'");
$(\'#ftp_path_exp\').html("'.__js('Relative path to web accessible directory of user. e.g. /public_html').'");
$(\'#backup_path_exp\').html("'.__js('Relative path from Home directory of user. e.g. /backups').'");
}
function sftppath(){
$(\'#ftp_path\').html("'.__js('Web Directory').'");
$(\'#ftp_path_exp\').html("'.__js('Absolute path to web directory of user. e.g. /home/USERNAME/public_html').'");
$(\'#backup_path_exp\').html("'.__js('Absolute path to Backup Directory e.g /home/USERNAME/backups').'");
}
function check_auth_password(){
if($("#auth_password").is(":checked")){
hide_sshkey();
}else{
show_sshkey();
}
}
function hide_sshkey(){
$("#private_key").prop("disabled", true);
$("#pri").hide();
$("#passphrase_div").hide();
$("#ftp_pass").show();
}
function show_sshkey(){
$("#private_key").prop("disabled", false);
$("#pri").show();
$("#passphrase_div").show();
$("#ftp_pass").hide();
}
// ]]></script>
<!--<center>
<h2>How to Add a Domain</h2>
<object width="450" height="345" align="center">
<param name="movie" value="Add Domain">
<embed src="../theme/videos/add_domain/video.swf" width="450" height="345">
</embed>
</object>
</center>-->';
softfooter();
}
?> |