<?php

//////////////////////////////////////////////////////////////
//===========================================================
// software_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 software_theme(){

global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts, $allcatwise, $acl;
global $software, $soft, $info, $settings, $init_tab, $dbtype, $dbs, $installed, $__settings, $setupcontinue, $installations, $notes, $cron, $datadir, $ajaxdb, $ajaxdbexists, $overwrite_option, $protocols, $nopackage, $can_publish, $not_default, $child, $install_option, $multi_ver, $child_sids, $installation_keys, $no_autoupgrade, $ajaxhttpsexists, $ajaxhttps, $new_insid, $pfx_error, $owned_themes, $no_autoupgrade_acl, $ins_count_per_script, $plans;

if(optGET('notify')){	
	
	get_softaculous_file('http://www.softaculous.com/notifyversion.php?softid="'.$soft.'"');
	echo 1;
	return true;

}

if(optGET('ajaxdownload') && !empty($nopackage)){
		
	if(!csrf_validate()){
		return false;
	}
	
	// Try to download the package
	if(method_exists($softpanel, 'updatesoftwares')){
		_updatesoftwares($soft, 0, 0, 1);
		echo 1;
		return true;
	}
	
	// False call
	echo 0;
	return false;

}

// Give the staus
if(optGET('ajaxstatus')){
	
	$_status = soft_progress(optGET('ajaxstatus'));
	
	$tmp_status = unserialize($_status[1]);
	$_status[1] = $tmp_status['current_status'];
	
	if(!empty($_status)){
		echo implode('|', $_status);
		return true;
	}
	
	// False call
	echo 0;
	return false;

}

if(!empty($ajaxdb)){
	echo $ajaxdbexists;
	return true;
}

if(!empty($ajaxhttps)){
	echo $ajaxhttpsexists;
	return true;
}

// Auto Installation responses
if(isset($_GET['autoinstall'])){
	
	// Installed successfully
	if(!empty($installed)){
		echo 'installed';
		return true;
	}
	
	// Are there errors
	if(!empty($error)){
		echo serialize($error);
		return false;
	}
}

$multi_ver = optGET('multi_ver');

$outdated_script = is_outdated_script($soft);

if(is_wordpress($soft)){
	$all_sets = load_wp_sets(1);
}

if(!empty($multi_ver)){
	$init_tab = "install";
}

//First add the installation info
if(empty($installed)){
	
	$random_username = true;
	
	// This is to see if a script has predefined username and cannot be changed
	foreach($settings as $ik => $iv){		
		if($ik == 'hidden') continue;
		foreach($iv as $ikk => $ivv){
			if($ikk == 'admin_username' && preg_match('/disabled=\"disabled\"/is', $ivv['tag'])){
				$random_username = false;
			}
			
			if($ikk == 'admin_pass' && !empty($ivv['minlen'])){
				$random_pass_len = (int) $ivv['minlen'];
			}
		}
	}
	
	if(empty($random_pass_len) || $random_pass_len < 10){
		$random_pass_len = 10;
	}
	
	$info['install'] = '<div id="fadeout_div">
	<form accept-charset="'.$globals['charset'].'" name="installsoftware" method="post" action="" onsubmit="return checkform();" id="installsoftware" class="form-horizontal">';

if(ampps() && !is_ampps_premium() && count($user['ins']) >= 3){
	$info['install'] .= '<center class="alert alert-warning">'.__('This feature is available in the premium version of AMPPS. Please purchase <b><a href="https://ampps.com/clients">AMPPS Premium</a></b>').'</center>';
}

if(!can_use_soft($soft, $use_msg)){
	$info['install'] .= '<center class="alert alert-warning">'.$use_msg.'</center>';
}

if(!can_install_soft($soft, $use_msg)){
	$info['install'] .= '<center class="alert alert-warning">'.$use_msg.'</center>';
}

$info['install'] .= error_handle($error, "100%", 0, 1).'<script language="javascript" type="text/javascript"><!-- // --><![CDATA[';


//If domain has SSL installed then select protocol https:// by default on page load.
if((empty($globals['default_protocol']) || $globals['default_protocol'] <= 1) && empty($globals['off_checkhttps'])){
	$info['install'] .= '

	$(document).ready(function(){
		
		$("#install, #install_now").click(function(){
			check_https();
		});

		if($("#install_win").is(":visible")){
			check_https();
		}
		shift_check_all("shift_select_ins");
		
	});
		
	function check_https(){
		
		//we need to stop the ajax call when protocol https or https://www.
		var protoval = $("#softproto").val();
		if(protoval == 3 || protoval == 4){
			return false;
		}
						
		$.ajax({
			type: "POST",
			url: "'.$globals['index'].'act=software&soft='.$soft.'&checkhttps="+encodeURIComponent($("#softdomain").val()),
			timeout:10000,
			// Checking for success
			success: function(data){
				if(data == "true"){
					$("#softproto").val(3);
					update_ins_url();
				}
			}
		});
	}';
}

$info['install'] .= '

$("#quick_install_btn, #show_less_form").click(function(){
	quick_install();
});

//Handling if user clicked on quick install and come back to custom install.
$("#custom_install_btn, #show_full_form").click(function(){
	custom_install();
});

';

// This is because we do not want to overwrite the value in case of AJAX calls
if(empty($_GET['jsnohf'])){
	$info['install'] .= 'var is_quick_install = '.((!empty($globals['quick_install_default']) || !empty($globals['off_custom_install'])) ? '1' : '0').';
	
	$("#show_install_option").click(function(){
		$("#quick_install_dropdown").slideToggle("fast");
	});';
}

$info['install'] .= '
$(document).ready(function(){
	
	//Get width of install tab to show the dropdown with correct width
	var installwidth = $("#install").width();
	var caretwidth = $("#show_install_option").width();
	var total_instab_width = installwidth+caretwidth;
	
	$("#quick_install_dropdown").css("width",total_instab_width);
	
	if($("#install_win").is(":visible")){
		post_install_but();
	}
	
	if(location.hash.match("quick")){
		quick_install();
	}
	
	$(".plugins-list").each(function(e){
		select_plugin(this);
	});
	
	update_ins_url();
	
});

$("#install, #install_now").click(function(){
	post_install_but();
});
	
function update_ins_url(){
	
	var ins_url = "";
	
	if($("#softproto").length > 0){
		ins_url = ins_url + $("#softproto").find(":selected").text();
	}
	
	ins_url = ins_url + $("#softdomain").val();
	
	if($("#softdirectory").length > 0){
		if($("#softdirectory").val().length > 0){
			ins_url = ins_url + "/" + $("#softdirectory").val();
		}
	}
	
	$("#ins_url").text(ins_url)
}

function selectversion(){
	var v = 0;
	v = $_("softbranch").value;
	
	$("#multiver_wait").css("display","");
	
	 $.ajax({
		type: "POST",
		url: "'.$globals['index'].'act=software&soft="+v+"&tab=install&multi_ver=1&jsnohf=1",
		// Checking for error
		success: function(data){
			$("#multiver_wait").css("display","none");
			var $response=$(data);
			//query the jq object for the values
			var output = $response.find("#install_win").html();
			$("#install_win").html(output);
			
			//Quick install? this is because now the newhtml has been filled in win_div
			post_install_but();
			
			softmail();
			show_backup();
			rand_dbprefix();
			check_pass_strength();
			new_theme_funcs_init();
			'.(!empty($globals['random_pass']) ? '$("#admin_pass").val(randstr('.$random_pass_len.', 1, '.(!empty($globals['pass_strength']) ? $globals['pass_strength'] : 0).'));check_pass_strength();' : '').
			(!empty($globals['random_username']) && !empty($random_username) ? '$("#admin_username").val(randstr(5));' : '').
			(!empty($globals['empty_username']) && !empty($random_username) ? '$("#admin_username").val("");' : '').
			((!empty($globals['admin_prefix']) && !empty($random_username) && empty($globals['random_username']) && empty($globals['empty_username'])) ? 'prepend_prefix(\''.$globals['admin_prefix'].'\');' : '').
			(!empty($globals['empty_pass']) ? '$("#admin_pass").val("");check_pass_strength();' : '').
			(!empty($globals['empty_email']) ? '$("#admin_email").val("");' : '').'
		},
		error: function(data) {
			//alert(data.description);
			return false;
		}
	}); 
}

function toggle_advoptions(ele){
	//alert("#"+ele);
	if ($("#"+ele).is(":hidden")){
		$("#"+ele).slideDown("slow");
		$("#"+ele+"_toggle_plus").attr("class", "fas fa-minus-square");
	}
	else{
		$("#"+ele).slideUp("slow");
		$("#"+ele+"_toggle_plus").attr("class", "fas fa-plus-square");
	}
}

function plus_onmouseover(ele){
	$("#"+ele.id+"_plus").attr("src", "'.$theme['images'].'plus_hover.gif");
}

function plus_onmouseout(ele){
	$("#"+ele.id+"_plus").attr("src", "'.$theme['images'].'plus.gif");
}

function display_pass_strength(score, per){
	
	var lang;
	//disp_per = $("#pass-strength-hidden").val();
	
	if(typeof per == "undefined") per = 0;
	
	if(score == "bad") lang = "'.__js('Bad').'";
	if(score == "good") lang = "'.__js('Good').'";
	if(score == "strong") lang = "'.__js('Strong').'";
	if(score == "short") lang = "'.__js('Short').'";
	if(score == "strength_indicator") lang = "'.__js('Strength Indicator').'";
	
	$("#pass-strength-result").addClass(score).html( lang+" ("+per+"/100)" );
}

function checkform(dosubmit){
	
	// If admin has set the password strength than only we will check for it.
	'.(!empty($globals['pass_strength']) ? '
	//alert($("#pass-strength-hidden").val());
	if(parseInt($("#pass-strength-hidden").val()) < '.$globals['pass_strength'].'){
		alert("'.__js('Password strength must be greater than ').'"+'.$globals['pass_strength'].');
		return false;
	}' : '').'
	
	try{
		if(!formcheck()){
			return false;
		}
	}catch(e){
		//Do nothing
	}
	$_("softsubmitbut").disabled = true;	
	
	if(!get_package()){
		return false;
	}
	
	if(useprog){
		
		// Send a request to check the status
		progressbar.start();
		
		// Return false so that the form is not submitted
		return false;
	
	// This is OLD School !
	}else{		
		if(dosubmit == 1){			
			$_("installsoftware").submit();	
		}
		show_msg("'.__js('Installing Script').'");
	}
	
	return true;
	
};

var progressbar = {
	timer: 0,
	total_width: 0,	
	status_key: "",
	synctimer: 0,
	fadeout_div: "#fadeout_div",
	win_div: "#install_win",
	progress_div: "#progress_bar",
	formid: "#installsoftware",
	frequency: 8000,
	
	current: function(){
		try{
			var tmp_cur = Math.round(parseInt($_("progress_color").width)/parseInt($_("table_progress").width)*100);
			if(tmp_cur > 100){
				tmp_cur = 99;
			}
			return tmp_cur;
		}catch(e){
			return -1;	
		}
	},
	
	reset: function(){ try{
		clearTimeout(this.timer);
		$_("progress_color").width = 1;
	}catch(e){ }},
	
	move: function(dest, speed, todo){ try{
		var cur = this.current();
		if(cur < 0){
			clearTimeout(this.timer);
			return false;
		}
		var cent = cur + 1;
		var new_width = cent/100*this.total_width;
		if(new_width < 1){
			new_width = 1;
		}
		//alert(new_width+" "+dest+" "+cent);
		$_("progress_color").width = new_width;
		$_("progress_percent").innerHTML = "("+cent+" %)";
		
		if(cent < dest){
			this.timer = setTimeout("progressbar.move("+dest+", "+speed+")", speed);
		}else{
			eval(todo);	
		}
	}catch(e){ }},
	
	text: function(txt){ try{
		$_("progress_txt").innerHTML = txt;
	}catch(e){ }},
	
	sync: function(){
		if(progressbar.status_key.length < 2){
			return false;
		}
		$.ajax({
			url: window.location+"&ajaxstatus="+progressbar.status_key+"&random="+Math.random(),
			type: "GET",
			success: function(data){
				if(data == 0) return false;
				var tmp = data.split("|");
				var cur = progressbar.current();
				tmp[2] = (3000/(tmp[0]-cur));
				//alert(tmp);
				if(tmp[0] > cur){
					if(parseInt(tmp[2]) == 0){
						tmp[2] = 800;
					}
					progressbar.move(tmp[0], tmp[2]);
				}
				progressbar.text(tmp[1]);
				progressbar.synctimer = setTimeout("progressbar.sync()", progressbar.frequency);
			}
		});
	},
	
	sync_abort: function(){
		clearTimeout(this.synctimer);
	},
	
	start: function(){ try{
		this.post();
		this.reset();
		this.total_width = parseInt($_("table_progress").width);
		this.move(95, 800);
		this.status_key = $("#soft_status_key").attr("value");
		this.sync();
	}catch(e){ }},
	
	post: function(){
		
		// Scroll to the Top and show the progress bar
		goto_top();
		$(progressbar.fadeout_div).fadeOut(500, 
			function(){
				$(progressbar.progress_div).fadeOut(1);
				$(progressbar.progress_div).fadeIn(500);
			}
		);
		
		try{
			var sid = $_("softbranch").value;
		}catch(e){
			var sid = '.$soft.'
		}
		
		$.ajax({
			url: window.location+"&jsnohf=1&soft="+sid+"&multi_ver=1",
			type: "POST",
			data: $(progressbar.formid).serialize(),
			complete: function( jqXHR, status, responseText ) {
				
				progressbar.sync_abort();
				
				// Store the response as specified by the jqXHR object
				responseText = jqXHR.responseText;
				
				try{
					//alert(responseText);
					if(responseText.match(/\<\!\-\-PROC_DONE\-\-\>/gi)){
						progressbar.text("'.__js('Finishing Installation').'");
						progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
					}else{
						progressbar.reset();
					}
				}catch(e){ }
				
				if ( jqXHR.state() == "resolved" ) {
				
					// #4825: Get the actual response in case
					// a dataFilter is present in ajaxSettings
					jqXHR.done(function( r ) {
						responseText = r;
					});
			
					// Create a dummy div to hold the results
					// inject the contents of the document in, removing the scripts
					// to avoid any "Permission Denied" errors in IE
					var newhtml = jQuery("<div>").append(responseText).find(progressbar.win_div).html();
					
					$(progressbar.win_div).animate({opacity: 0}, 1000, "", function(){
						$(progressbar.win_div).html(newhtml);
						
						//quick install? this is because now the newhtml has been filled in win_div(for error and selectversion)
						post_install_but();
						
						show_backup();
						check_pass_strength();
						new_theme_funcs_init();
						$(document).trigger("reinit_install_window");
					}).delay(50).animate({opacity: 1}, 500);
					//alert(newhtml);
					
				}else{
					alert("Oops ... the connection was lost");
				}
			}
		});
	}
};

function show_msg(msg){	
	$_("show_txt").innerHTML = "<br /><br /> &nbsp; "+msg+" &nbsp; <img src=\"'.$theme['images'].'progress.gif\" />";
	$_("show_txt").style.display = "";
}

// Is the package there ?
var nopackage = '.(empty($nopackage) ? 0 : 1).';

// Use the Progress Bar ?
var useprog = 1; 
try{
	if(BrowserDetect.browser.toLowerCase() == "safari" && BrowserDetect.version.toString().substr(0, 1) == "3"){
		useprog = 0;
	}
}catch(e){ }

function get_package(){	
	if(nopackage){
		
		show_msg("'.__js('Downloading Package').'");
		var csrf_token = $("#csrf_token").val(); 
		try{
			$.ajax({
				type: "POST",
				data: "csrf_token="+csrf_token,
				url: "'.$globals['index'].'act=software&soft='.$soft.'&ajaxdownload=1&random="+Math.random(),
				// Checking for error
				success: function(data){
					get_package_handle(data);
				}
			});	
		}catch(e){ }
		
		return false;
	}else{
		$_("show_txt").style.display = "none";
		return true;
	}
};

function get_package_handle(resp){
	nopackage = 0;
	show_msg("'.__js('Installing Script').'");
	checkform(1);
};

softemail = new Object();
function softmail(){
	try{
		var use_eu_email = "'.(!empty($globals['use_eu_email']) ? $globals['use_eu_email'] : 0).'";
		if(use_eu_email > 0){
			return true;
		}
		
		var sofdom = "softdomain";
		for(x in softemail){
			if(softemail[x] == true) continue;
			var temp = $_(x).value.split("@");
			if($_(sofdom).value.indexOf("/") > 0){
				var dom_value = $_(sofdom).value.substring(0, $_(sofdom).value.indexOf("/"));
			}else{
				var dom_value = $_(sofdom).value;
			}
			$_(x).value = temp[0] + "@" + dom_value;
		}
	}catch(e){
		return false;
	}
};

function checkhttps(proto_id, softdomain_id, alrt){
	try{
		var id = $_(proto_id);
		var proto = id.options[id.selectedIndex].text;
		var no_proto = proto.replace("https://", "");
	
		$("#checkhttps_wait").css("display","inline-block");
		if(proto.indexOf("https") !== -1){
		
			 $.ajax({
				type: "POST",
				url: "'.$globals['index'].'act=software&soft='.$soft.'&checkhttps="+encodeURIComponent(no_proto+$_(softdomain_id).value),
				timeout:10000,
				// Checking for error
				success: function(data){
					$("#checkhttps_wait").css("display","none");
					is_https(trim(data));
				},
				error: function(jqXHR, status, e) {
					$("#checkhttps_wait").css("display","none");
					is_https(e);
					return false;
				}
			}); 
			
			//AJAX("'.$globals['index'].'act=software&soft='.$soft.'&checkhttps="+id.options[id.selectedIndex].text+$_(softdomain_id).value, "is_https(re)");
		}else{
			$("#checkhttps_wait").css("display","none");
			is_https("true");
		}
		if(alrt == true){
			alert(proto+$_(softdomain_id).value);
		}
	}catch(e){
		//
	}
	return true;
};

function is_https(re){
	try{
		httpserror = "";
		
		//Check if it exists
		if(re !== "true"){
			httpserror = "'.__js('A trusted SSL Certificate was not found').'";
		}
		if(httpserror != ""){
			$_("httpserror").style.display = "block";
			$_("httpserror").innerHTML = httpserror;
			return false;
		}else{
			$_("httpserror").style.display = "none";
		}
		
	}catch(e){
		//
	}
	return true;
};

function prepend_prefix(prefix){
	
	// Decide prefix USERNAME, DOMAIN OR USER DEFINED
	if(prefix != "" && prefix == "username") prefix = "'.$softpanel->user['name'].'";
	if(prefix != "" && prefix == "domain") prefix = "'.current(array_keys($softpanel->domainroots)).'";
	if(prefix != "" && prefix != "domain" && prefix != "username");
	
	// APPEND OLD USERNAME OR DEFAULT USERNAME
	var old = $_("admin_username").value
	temp = $_("admin_username").value.split("-");
	if (typeof temp[1] == \'string\' || temp[1] instanceof String){
		$_("admin_username").value = prefix+"-"+temp[1];
	}else{
		$_("admin_username").value = prefix+"-"+old;
	}
}

function change_admin_prefix(domain){
	var admin_prefix = \''.$globals['admin_prefix'].'\';
	var random_username = \''.(!empty($random_username) ? 'true' : '').'\';
	var empty_username = \''.(empty($globals['empty_username']) ? 'true' : '').'\';
	var gl_random_username = \''.(empty($globals['random_username']) ? 'true' : '').'\';
	if(admin_prefix == "domain" && random_username == "true" && empty_username == "true" && gl_random_username == "true"){
		prepend_prefix(domain);
	}
}
  
// show/hide backup options
function show_backup(){

	var auto_backup = $("#auto_backup").val();
	
	if(auto_backup == 0){
		$("#auto_backup_rotation").attr("disabled", true);
		$("#custom_autobackup_cron").css("display", "none");
	}else{
		if(auto_backup == "custom"){
			$("#custom_autobackup_cron").css("display", "block");
		}else{
			$("#custom_autobackup_cron").css("display", "none");
		}
		$("#auto_backup_rotation").attr("disabled", false);
	}
	
	return true;
}

//List plugins/themes in sets
function list_set_items(setname){

	var sets_list = '.json_encode($all_sets).';
	var set_plugins;
	var set_themes;
	var plugins_data;
	var themes_data;
	
	$(".modal-title").text(setname.replace("_admin", ""));
	
	$("#list_plugins_themes").empty();
	
	var set_plugins = new Array();
	var set_themes = new Array();
	
	if(sets_list[setname]["plugins"]){
		set_plugins = sets_list[setname]["plugins"];
	}
	
	if(sets_list[setname]["themes"]){
		set_themes = sets_list[setname]["themes"];
	}
	
	if(sets_list[setname]["custom_plugins"]){
		for(var x in sets_list[setname]["custom_plugins"]){
			set_plugins[sets_list[setname]["custom_plugins"][x].slug] = sets_list[setname]["custom_plugins"][x].name;
		}
	}
	
	if(sets_list[setname]["custom_themes"]){
		for(var x in sets_list[setname]["custom_themes"]){
			set_themes[sets_list[setname]["custom_themes"][x].slug] = sets_list[setname]["custom_themes"][x].name;
		}
	}
	
	if((set_plugins === undefined || (set_plugins.length <= 0 && Object.keys(set_plugins) <= 0)) && (set_themes === undefined || (set_themes.length <= 0 && Object.keys(set_themes) <= 0))){
		$("#list_plugins_themes").append("'.__js('There are currently no items in the set!!').'");
	}
	
	//Plugins
	if(set_plugins !== undefined){
		plugins_data = "<h4>'.__js('Plugins').'</h4><ul class=\"softlist\">";
		for(var pl in set_plugins){
			plugins_data += "<li>"+set_plugins[pl]+"</li>";
		}
		$("#list_plugins_themes").append("</ul>" + plugins_data);
	}
	
	//Themes
	if(set_themes !== undefined){
		themes_data = "<br /><h4>'.__js('Themes').'</h4><ul class=\"softlist\">";
		for(var th in set_themes){
			themes_data += "<li>"+set_themes[th]+"</li>";
		}
		$("#list_plugins_themes").append("</ul>" + themes_data);
	}
}

//randomize DB Prefix
function rand_dbprefix(){
	var pre = $_("dbprefix").value; 
	var use_prefix = (pre.substr(-1 , 1) == "_" ? 1 : 0);
	var random = randstr(2);
	$_("dbprefix").value = (use_prefix ? pre.substr(0 , pre.length - 1) + random + "_" :  pre + random);
};

'.(!empty($_POST) ? '' : 'addonload(\'softmail();show_backup();\');');

if(!empty($dbtype)){

$info['install'] .= 'function checkdbname(id, alrt){
	try{		
		AJAX("'.$globals['index'].'act=software&soft='.$soft.'&checkdbexists="+$_(id).value, "dbexists(\'"+id+"\', "+alrt+", re)");	
	}catch(e){
		//
	}
	return true;
};

function dbexists(id, alrt, re){
	try{
		
		dberror = "";
		
		//Is the length fine
		if($_(id).value.length > '.(empty($softpanel->maxdblen) ? 7 : $softpanel->maxdblen).'){
			dberror = "'.__js('The database name cannot be greater than $0 characters. Please choose a shorter database name.', array(empty($softpanel->maxdblen) ? 7 : $softpanel->maxdblen)).'";
		}
		
		//There should be only alphanumeric characters
		if(/[^a-zA-Z0-9'.(!empty($softpanel->allowed_db_special_char) ? implode('\\', $softpanel->allowed_db_special_char) : '').']/.test($_(id).value) && !'.aefer().'0){
			dberror = "'.__js('Only alpha numeric characters are allowed for the Database name.').'";
		}
		
		//Check if it exists
		if(re == "true"){
			dberror = "'.__js('The database already exists. Please choose a different name.').'";
		}
		
		if(dberror != ""){
			$_(id+"error").style.display = "block";
			$_(id+"error").innerHTML = dberror;
			if(alrt == true){
				alert(dberror);
			}
			return false;
		}else{
			$_(id+"error").style.display = "none";
		}
		
	}catch(e){
		//
	}
	return true;
};

function select_plugin(e){
	
	var inputElement = e.querySelector("input[type=\"checkbox\"]");
	inputElement.style.display = "none";
	
	var check_icon = e.querySelector("i.fas.fa-check-square");
	
	if(inputElement.checked){
		e.style.backgroundColor = "#edfffd";
		e.style.border = "1px solid green";
		check_icon.style.display = "block";
	}else{
		e.style.backgroundColor = "";
		e.style.border = "1px solid #9d989878";
		check_icon.style.display = "none";
	}
	
	if(inputElement.disabled){
		e.style.backgroundColor = "#f0f0f0";
		e.style.color = "#6c757d";
	}
	
}

';

}//End of if($dbtype)

$info['install'] .= '// ]]></script>';

$info['install'] .= '<div class="row">
	<div class="col-12 mb-4">
		<div class="bg">
			'.(!empty($globals['off_custom_install']) ? '' : '
				<button type="button" class="btn pull-right btn sai-button quick_form_toggle_btn" id="show_full_form" style="display:none;" onclick="custom_install();return false;">'.__('Custom Install').'</button>
				<button type="button" class="btn pull-right btn sai-button quick_form_toggle_btn" id="show_less_form" style="display:none;" onclick="quick_install();return false;">'.__('Quick Install').'</button>
			').'
			<div class="sai_sub_head">'.__('Software Setup').'</div>
			<hr class="sai_main_head_hr" />';
			
			$sret = apply_filters('pre_software_setup_theme', $soft);
			
			if(!empty($sret) && $sret != $soft){
				$info['install'] .= $sret;
			}
			
			$info['install'] .= '
			<div class="row">
			<div class="col-sm-7">
				<label class="form-label d-block mb-0" for="softdirectory">'.__('Choose Installation URL').'</label>
				<span class="sai_exp2">'.__('Please choose the URL to install the software').'</span>
				<div class="row mt-2" style="margin-left:0px; margin-right:0px;">';
				if(empty($softpanel->noprotocol) && empty($globals['hide_protocol'])){
					$info['install'] .= '
					<div class="col-sm-3 custom_install" style="padding-left:0px; padding-right:1px; width:24%;">
					<select name="softproto" class="form-control" id="softproto" onblur="checkhttps(\'softproto\', \'softdomain\', false);" onchange="update_ins_url();">';
					foreach($protocols as $k => $v){
						$info['install'] .= '<option value="'.$k.'" '.(optPOST('softproto') == $k || ($globals['default_protocol'] == $k && empty($_POST['softproto'])) ? 'selected="selected"' : '').'>'.$v.'</option>';
					}
				$info['install'] .= '</select>
						<span class="sai_exp2 ml-1">'.__('Choose Protocol').'
							<span class="sai_exp">'.__('If your site has SSL, then please choose the HTTPS protocol.').'</span>
						</span>
					</div>
					<div class="col-sm-6" style="padding-left:0px; padding-right:0px;">						
						<select name="softdomain" class="form-control" id="softdomain" onchange="softmail();change_admin_prefix(this.value);update_ins_url();" onblur="checkhttps(\'softproto\', \'softdomain\', false);">';
						if(!empty($globals['blank_domain'])){
							$info['install'] .= '<option value="" '.(empty($_POST['softdomain']) ? 'selected="selected"' : '').'>('.__('Select Domain').')</option>';
						}
						foreach($softpanel->domainroots as $domain => $dompath){
							$info['install'] .= '<option value="'.$domain.'" '.((!empty($_POST['softdomain']) && $_POST['softdomain'] == $domain) ? 'selected="selected"' : '').'>'.$domain.'</option>';
						}
					$info['install'] .= '
						</select>
						<span class="sai_exp2 ml-1">'.__('Choose Domain').'
							<span class="sai_exp">'.__('Please choose the domain to install the software.').'</span>
						</span>';
					}
			$info['install'] .= '
					</div>
					<div class="col-sm-3" style="padding-left:1px;padding-right:0px;">';
					
					if(empty($globals['no_indir'])){
						$info['install'] .= '
							<input type="text" name="softdirectory" class="form-control" id="softdirectory" size="30" value="'.POSTval('softdirectory', (!empty($globals['no_prefill']) ? '' : $software['softname'])).'" oninput="update_ins_url();" />
							<span class="sai_exp2" style="margin-left:4px;">'.__('In Directory').'
								<span class="sai_exp">'.__('The directory is relative to your domain and <b>should not exist</b>. e.g. To install at http://mydomain/dir/ just type <b>dir</b>. To install only in http://mydomain/ leave this empty.').'</span>
							</span>';
					}
			$info['install'] .= '
					</div>
					
					<div class="row col-sm-12">
						<div style="display:none;" id="checkhttps_wait">
							<img src="'.$theme['images'].'progress.gif" alt="Please wait..">
						</div>
						<span id="httpserror" style="display:none; padding:10px; margin-bottom:0px;" class="alert alert-warning"></span>
					</div>
				
				</div><! -- row mt-2 -->
				</div><! -- col-7 -->
				
				<div class="col-sm-5">';
					if(count($software['branch']) > 1){
						$info['install'] .= '
						<label for="softbranch" class="form-label d-block mb-0">'.__('Choose the version you want to install').'</label>
						<span class="sai_exp2">'.__('Please select the version to install.').'</span><br />
						<select name="softbranch" class="form-control d-inline-block softbranch mt-2" id="softbranch" onchange="selectversion()" style="width:25%;">';
						foreach($software['branch'] as $ck => $cv){
							$info['install'] .= '<option value='.$ck.' '.($cv['ver'] == $software['ver'] ? 'selected="selected"' : '').'>'.$cv['ver'].'</option>';
						}
						$info['install'] .= '
						</select>
						<div style="display:none;" id="multiver_wait"><img src="'.$theme['images'].'progress.gif" alt="please wait.."></div>
						<br />';
					}
				$info['install'] .= '
				</div><! -- col-5 -->
	
			<div class="col-12 col-md-12 mt-2 mb-2">
				<span class="sai_exp2">'.__('Your installation URL').' : </span><label for="softdirectory" class="form-label"><span id="ins_url"></span></label>
			</div>';

	if(!empty($datadir)){
		$info['install'] .= '
			<div class="col-12 col-md-6 mt-2 mb-2">
				<label for="datadir" class="form-label">'.__('Data Directory').'</label>
				<span class="sai_exp">'.__('This script requires to store its data in a folder not accessible via the web. It will be created in your home folder. i.e. if you specify <b>datadir</b> the following will be created - /home/username/<b>datadir</b>').'</span>
				<input type="text" name="datadir" class="form-control" id="datadir" size="30" value="'.POSTval('datadir', $datadir).'" />
			</div>';
	}

if(!empty($dbtype)){
	
	$dbdetails = array();
	$dbdetails['dbname'] = '';
	$dbdetails['dbhost'] = '';
	$dbdetails['dbusername'] = '';
	$dbdetails['dbuserpass'] = '';
	
	$dbdetails['dbname'] = mysqldbname($software['softname']);
	
	if(method_exists($softpanel, 'mysqldbname')){
		$dbdetails['dbname'] = $softpanel->mysqldbname();
	}
	
	// This is default
	$dbdetails['dbhost'] = 'localhost';
	// Don't prefill database details
	if(!empty($globals['no_prefill_db'])){
		$dbdetails['dbname'] = '';
		$dbdetails['dbhost'] = '';
	}
	
	$dbdetails = apply_filters('post_load_dbdetails', $dbdetails);
	
	if(aefer() && empty($softpanel->auto_managedb)){
		$info['install'] .= '
		<div class="col-12 col-md-6 mt-2 mb-2 custom_install">
			<label for="softdb" class="form-label">'.__('Database Name').'</label>
			<span class="sai_exp">'.__('Type the name of the database to be used for the installation').'</span>
			
			<input type="text" name="softdb" class="form-control" id="softdb" size="30" value="'.POSTval('softdb', $dbdetails['dbname']).'" onblur="checkdbname(\'softdb\', false)" autocomplete="false" />
				<span id="softdberror" style="background: #FDB3B3; display:none; width:200px;"></span>
		
		</div>';
	}
	
	if(!empty($softpanel->no_db_create)){
	
		// Database Username
		$info['install'] .= '
		<div class="col-12 col-md-6 mt-2 mb-2">
			<label class="form-label" for="dbusername">'.__('Database Username').'</label>
			<span class="sai_exp">'.__('The MySQL username').'</span>
			
			<input type="text" name="dbusername" class="form-control" id="dbusername" size="30" value="'.POSTval('dbusername', $dbdetails['dbusername']).'" />
		
		</div>';

		// Database Password
		$info['install'] .= '
		<div class="col-12 col-md-6 mt-2 mb-2">
			<label class="form-label" for="dbuserpass">'.__('Database Password').'</label>
			<span class="sai_exp">'.__('The password of the MySQL user').'</span>
			<div class="row">
				<div class="col-sm-11">
					<input type="password" name="dbuserpass" class="form-control" id="dbuserpass" size="30" value="'.POSTval('dbuserpass', $dbdetails['dbuserpass']).'" />
				</div>
				<div class="col-sm-1" style="margin-left:-20px;">
					<input id="toggle_pass_db_pass" type="checkbox" style="display:none;" onclick="toggle_pass(\'show_hide_db_pass\', \'dbuserpass\');"/><label for="toggle_pass_db_pass" style="margin-top:6px;"><span id="show_hide_db_pass">'.__('Show').'</span></label>
				</div>
			</div>
		</div>';

		//Database Host Name
		$info['install'] .= '
		<div class="col-12 col-md-6 mt-2 mb-2">
			<label for="hostname" class="form-label">'.__('Database Hostname').'</label>
			<span class="sai_exp">'.__('The MySQL hostname (mainly <b>localhost</b>)').'</span>
			
			<input type="text" name="hostname" class="form-control" id="hostname" size="30" value="'.POSTval('hostname', $dbdetails['dbhost']).'" />
		
		</div>';
	}

}
	
	// Are there any cron jobs
	if(!empty($cron)){
	
		$info['install'] .= '
		<div class="col-12 col-md-6 mt-2 mb-2 custom_install">
			<label class="form-label" for="cron_min">'.__('CRON Job').'</label>
			<span class="sai_exp">'.__('This script requires a CRON to work. Please specify the CRON timings. If you are unaware of it, leave it as it is!').'</span>
			<div class="row">
				<div class="col-sm-2">
					<label for="cron_min">'.__('Min').'</label>	
					<input type="text" class="form-control" name="cron_min" id="cron_min" size="2" value="'.POSTval('cron_min', $cron['min']).'" />
				</div>
				<div class="col-sm-2">
					<label for="cron_hour">'.__('Hour').'</label>
					<input type="text" class="form-control" name="cron_hour" id="cron_hour" size="2" value="'.POSTval('cron_hour', $cron['hour']).'" />
				</div>
				<div class="col-sm-2">
					<label for="cron_day">'.__('Day').'</label>
					<input type="text" class="form-control" name="cron_day" id="cron_day" size="2" value="'.POSTval('cron_day', $cron['day']).'" />
				</div>
				<div class="col-sm-2">
					<label for="cron_month">'.__('Month').'</label>
					<input type="text" class="form-control" name="cron_month" id="cron_month" size="2" value="'.POSTval('cron_month', $cron['month']).'" />
				</div>
				<div class="col-sm-2">
					<label for="cron_weekday">'.__('Weekday').'</label>
					<input type="text" class="form-control" name="cron_weekday" id="cron_weekday" size="2" value="'.POSTval('cron_weekday', $cron['weekday']).'" />
				</div>
			</div>
		
		</div>';
	}
	
	// Do we need to load any additional fields required by server admin ?
	if(!empty($GLOBALS['install_fields'])){
		
		foreach($GLOBALS['install_fields'] as $ifk => $ifv){
			
			if(empty($ifv['input'])) continue;
			
			//Adding class to input
			if(preg_match('/type="text"/is', $ifv['input']) && !preg_match('/class="form-control"/is', $ifv['input'])){
				$ifv['input'] = preg_replace('/>/is', ' class="form-control">',$ifv['input']);
			}
			
			if(preg_match('/<select/is', $ifv['input']) && !preg_match('/class="form-control"/is', $ifv['input'])){
				$ifv['input'] = preg_replace('/<select/is', '<select class="form-control"',$ifv['input']);
			}
			
			$info['install'] .= '
			<div class="col-12 col-md-6 mt-2 mb-2 custom_install">
				<label class="sai_head">'.$ifv['head'].'</label><br />
				<span class="sai_exp2">'.$ifv['exp'].'</span>
				'.$ifv['input'].'
			</div>';
			
		}
	}
	
	$info['install'] .= '
			</div><! -- row -->
		</div><! -- bg -->
	</div><! -- col-12 -->';
	
	if(!empty($settings)){
		
		if(file_exists($software['path'].'/install.js')){
			$info['install'] .= '<script language="javascript" type="text/javascript"><!--// --><![CDATA[';
			$info['install'] .= @parselanguages(str_replace('$(', '$_(', file_get_contents($software['path'].'/install.js')));
			$info['install'] .= '// ]]></script>';
		}
		
		foreach($settings as $group => $sets){
			
			// Do we have anything in the set ? 
			if($group == 'hidden' || empty($sets)){
				
				// Dont continue for plugin sets
				if($group == $l['ss']['select_plugins'] && !empty($all_sets[$is_plugin_theme[0]])){
					// Do nothing, just dont continue
				}else{
					continue;
				}
			}
		
			
			// We will show dbprefix under advanced options
			if(count($sets) == 1 && array_key_exists('dbprefix', $sets)){
				$dbprefix = $sets;
				continue;
			}
			
			$is_plugins_group = 0;
			if($group == $l['ss']['select_plugins']){
				$is_plugins_group = 1;
			}
			
			if($group == $l['ss']['select_plugins']){
				$col_class = 'col-12';
			}else{
				$col_class = 'col-sm-6 col-md-6 col-xs-12';
			}
			
			$info['install'] .= '<div class="'.$col_class.' '.($group != $l['ss']['ext_settings'] ? 'script_blocks' : '').' mb-4">
				<div class="bg h-100 ">';
				
					// Show Manage Plugin sets button
					if(is_wordpress($soft) && empty($globals['disable_manage_sets'])){
						if(!empty($is_plugins_group)){
							$info['install'] .= '<a href="'.$globals['ind'].'act=manage_sets" target="_blank"><button type="button" class="btn pull-right sai-button quick_form_toggle_btn" style="color:#fff !important;">'.__('Manage Plugin Sets').'</button></a>';
						}
					}
					
					$info['install'] .= '
					<div class="sai_sub_head">'.$group.'</div>
					<hr class="sai_main_head_hr"><br/>';
				
					//If any plugin/theme exist in sets then only show
					$is_plugin_theme = is_array($all_sets) ? array_keys(array_filter($all_sets)) : array();
					if($group == $l['ss']['ext_settings'] && !empty($all_sets[$is_plugin_theme[0]])){
						$info['install'] .= '
						<div class="row mb-3">
							<div class="col-12">
								<label class="form-label" id="sai_head">'.$l['ss']['wp_sets'].'</label>
								<div class="row mt-2">'; 
								foreach($all_sets as $sk=> $av){
									if(!empty($av['plugins']) || !empty($av['custom_plugins']) || !empty($av['themes']) || !empty($av['custom_themes'])){
									$info['install'] .= '
									<div class="col-md-6 col-xs-12 col-lg-6">
										<input type="checkbox" name="sets_name[]" id="'.str_replace(' ', '_', $sk).'" '.POSTchecked_Array('sets_name', $sk, (!empty($av['default_value']) ? true : false)).' value="'.$sk.'" />
										<label for="'.str_replace(' ', '_', $sk).'" class="form-label ml-1">'.str_replace('_admin', '', $sk).'</label>
										<span data-toggle="modal" data-target="#list_set_items_modal" onclick="list_set_items(\''.$sk.'\');">
											<span class="sai_exp">'.__('List Items in Set').'</span>
										</span>
									</div>';
									}
								}
								$info['install'] .= '
								</div>
							</div>
						</div>
						<!-- List Set Items Modal -->
						<div class="modal fade soft-modal modal-effect" id="list_set_items_modal" role="dialog">
							<div class="modal-dialog">
							  <div class="modal-content">
								<div class="modal-header">
									<h4 class="modal-title d-inline-block"></h4>
									<button type="button" class="close" data-dismiss="modal">&times;</button>
								</div>
								<div class="modal-body" id="list_plugins_themes">
								</div>
								<div class="modal-footer">
								  <button type="button" class="btn sai-button" data-dismiss="modal">'.__('OK').'</button>
								</div>
							  </div>
							</div>
						</div>';
					}
					
					if(!empty($is_plugins_group)){
						$info['install'] .= ((softaculous_is_pro() && (empty($globals['wp_fp_pref']) || $globals['wp_fp_pref'] != 2)) ? '<span class="">'.$l['featured_plugins_pro'].'</span>' : '').'
						<div class="row">';
					}
					
					foreach($sets as $sk => $sv){
						
						if(!empty($globals['wp_fp_pref']) && $globals['wp_fp_pref'] == 2 && !empty($sv['featured'])){
							continue;
						}
						
						if(!empty($is_plugins_group)){
							
							$info['install'] .= '
								<div class="col-md-3 col-xs-12">
								<label class="my-2 plugins-list" style="" onclick="select_plugin(this)" data-toggle="tooltip" data-placement="bottom" data-html="true" title="'.strip_tags(!empty($sv['exp']) ? $sv['exp'] : $sv['head']).'">
									'.$sv['tag'].'
									<span style="display: block;" class="m-2">
										<div class="row">
										<i class="sai_checkbox_tick fas fa-check-square fa-1x" style="display:none"></i>
										<div class="col-2">
										<img src="'.(!empty($sv['plugin_img']) ? $sv['plugin_img'] : $theme['images'].'plugin128.png').'" style="width:30px;margin-left: auto;margin-right: auto;vertical-align:middle;display:inline;">
										</div>
										<div class="col-10">
										<span style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;">
										'.$sv['head'].'
										</span>
										'.(!empty($sv['plugin_name']) ? '
										<span style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;line-height:1.3;" class="sai_exp2">
										'.$sv['plugin_name'].(!empty($sv['featured']) && softaculous_is_pro() ? ' - <span style="color:green;">Pro</span>' : '').'
										</span>' : '').'
										</div>
										</div>
									</span>
								</label>
								</div>
							';
						}else{
						
							if(preg_match('/dbprefix/is', $sv['tag'])){
								$dbprefix[$sk] = $sv;
								continue;
							}
							
							//Adding class to input
							if(preg_match('/type="text"/is', $sv['tag'])){
								$sv['tag'] = preg_replace('/>/is', ' class="form-control">',$sv['tag']);
							}
							
							if(preg_match('/<select/is', $sv['tag'])){
								$sv['tag'] = preg_replace('/<select/is', '<select class="form-control"',$sv['tag']);
							}
							
							$info['install'] .= '
							<div class="script_fields" '.(!empty($sv['quick_install']) ? 'quick_install="1"' : '').'>
							
								<label for='.$sk.' class="form-label" id="sai_head">'.$sv['head'].'</label>
								'.(empty($sv['exp']) ? '' : '<span class="sai_exp">'.$sv['exp'].'</span>').'	
								
								'.(preg_match('/admin_pass|softpass/is', $sv['tag']) ? preg_replace('/>|\/>/is',' onkeyup="check_pass_strength();">', '
								
								'.$sv['tag'].'
								<div class="strength-indicator w-90 d-inline-block"><div id="pass-strength-result" class="d-inline-block pass-strength-result">'.__('Strength Indicator').'</div></div>') : $sv['tag']).'
								
								'.(preg_match('/softmail/is', $sv['tag']) ? '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
										softemail["'.$sk.'"] = false;
										//Add an event handler
										$_("'.$sk.'").onkeydown = function(){
											softemail["'.$sk.'"] = true;
										}
										// ]]></script>
										' : '').'
								'.(preg_match('/admin_pass|softpass/is', $sv['tag']) ? '
								
								<input id="toggle_pass_admin" type="checkbox" style="display:none;" onclick="toggle_pass(\'show_hide_admin\', \'admin_pass\');"/>
								<label  for="toggle_pass_admin"  style="margin-top:6px;">
									<span class="sai_toggle-pass mt-1 mr-1" id="show_hide_admin">'.__('Hide').'</span>
								</label>
								
								<a class="generate-password" href="javascript: void(0);" onclick="$_(\''.$sk.'\').value=randstr('.$random_pass_len.', 1, '.(!empty($globals['pass_strength']) ? $globals['pass_strength'] : 0).');check_pass_strength();return false;" title="'.__('Generate a Random Password').'"><i class="fas fa-key"></i></a>' : '').'
										
								'.(preg_match('/admin_pass|softpass/is', $sv['tag']) && (!empty($softpanel->securepass) || !empty($globals['random_pass'])) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'$_("'.$sk.'").value=randstr('.$random_pass_len.', 1, '.(!empty($globals['pass_strength']) ? $globals['pass_strength'] : 0).');check_pass_strength();\');
								// ]]></script>
								' : '').'

								'.(preg_match('/admin_pass|softpass/is', $sv['tag']) && !empty($globals['empty_pass']) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'$_("'.$sk.'").value="";check_pass_strength();\');
								// ]]></script>
								' : '').'

								'.(preg_match('/dbprefix/is', $sv['tag']) && !empty($globals['random_dbprefix']) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'$_("'.$sk.'").value=randstr(3)+"_";\');
								// ]]></script>
								' : '').'

								'.(preg_match('/admin_username/is', $sv['tag']) && !empty($globals['random_username']) && !empty($random_username) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'$_("'.$sk.'").value=randstr(5);\');
								// ]]></script>
								' : '').'

								'.(preg_match('/admin_username/is', $sv['tag']) && !empty($globals['empty_username']) && !empty($random_username) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'$_("'.$sk.'").value="";\');
								// ]]></script>
								' : '').'
								
								'.(preg_match('/admin_email/is', $sv['tag']) && !empty($globals['empty_email'])  ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'$_("'.$sk.'").value="";\');
								// ]]></script>
								' : '').'

								'.(preg_match('/admin_username/is', $sv['tag']) && !empty($globals['admin_prefix']) && empty($globals['empty_username']) && empty($globals['random_username']) && !empty($random_username) ? '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								addonload(\'prepend_prefix("'.$globals['admin_prefix'].'");\');
									// ]]></script>
								' : '').'<!--//Code for admin setting for admin email and admin username-->

								'.(preg_match('/admin_username/is', $sv['tag']) && !empty($globals['use_eu_username']) && empty($globals['empty_username']) && !empty($random_username) && empty($globals['random_username']) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								$(document).ready(function(){$_("'.$sk.'").value="'.$softpanel->user['name'].'";});
								// ]]></script>
								' : '').'

								'.(preg_match('/admin_email|board_email|site_email|bug_email|noreply_email|feedback_email|wiki_mail/is', $sv['tag']) && !empty($globals['use_eu_email']) ? '
								<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								$(document).ready(function(){$_("'.$sk.'").value="'.$user['email'].'";});
								// ]]></script>
								' : '').'	
							<br />
							</div>';
							
						}
					}
					
					if(!empty($is_plugins_group)){
						$info['install'] .= '
						</div>';
					}
				
				$info['install'] .= '
					</div><!--end of script_blocks-->
			</div><!--end of bg class-->';
		}

		$info['install'] .= '</div><!-- row ended -->';
	
		//The Hidden groups 
		if(!empty($settings['hidden'])){
		
			foreach($settings['hidden'] as $sk => $sv){
		
				$info['install'] .= $sv['tag'].'
				'.(preg_match('/softmail/is', $sv['tag']) ? '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
				softemail["'.$sk.'"] = false;
				//Add an event handler
				$_("'.$sk.'").onkeydown = function(){
					softemail["'.$sk.'"] = true;
				}
				// ]]></script>
				' : '');
			}
		}
	}//End of if($settings)

	//Is it a SOFTCOPY, then Leave a NOTE
	if(!empty($setupcontinue)){
		$info['install'] .= '
		'.__('<b>NOTE</b>: This software requires that it be installed using its own installation utility. Please visit the URL that will be shown once the files have been copied to complete the installation process.').'
		';				
	}

// Advance option 

$info['install'] .= '
	<div class="bg custom_install">
		<div class="sai_sub_head" id="advoptions_toggle" onclick="toggle_advoptions(\'advoptions\');" style="cursor:pointer">
			<i id="advoptions_toggle_plus" class="fas fa-plus-square" class="mr-2"></i>
			<span class="">'.__('Advanced Options').'</span>
			<hr class="sai_main_head_hr d-block mt-3 ml-4 m-0">
		</div>
			<div id="advoptions" class="mt-4" style="display:none;">
			';
			
				if(empty($dbtype) || aefer() || !empty($softpanel->auto_managedb)){
					// Do nothing
					$info['install'] .= '<div class="row">';
				}else{
					$info['install'] .= '<div class="row">
						<div class="col-12 col-md-6 mb-2">
							<label for="softdb" class="sai_head ">'.__('Database Name').'</label><br />
							<span class="sai_exp2 mb-2">'.__('Type the name of the database to be created for the installation').'</span>';
						
						$dbfield = '<input type="text" name="softdb" class="form-control" id="softdb" size="30" value="'.POSTval('softdb', $dbdetails['dbname']).'" onblur="checkdbname(\'softdb\', false)" autocomplete="false" />';
						
						$soft_dbprefix = $softpanel->dbname('');
						if(!empty($soft_dbprefix) && $soft_dbprefix != '_'){
							$dbfield = '
							<div class="input-group">
								<div class="input-group-addon">
									<span class="input-group-text">'.$soft_dbprefix.'</span>
								</div>
								'.$dbfield.'
							</div>';
						}
						$info['install'] .= $dbfield.'
							<span id="softdberror" style="background: #FDB3B3; display:none; width:auto;"></span><br />
						</div>';
				}
			
				if(isset($dbprefix)){
					foreach($dbprefix as $sk => $sv){
						//Adding class to input tag
						if(preg_match('/type="text"/is', $sv['tag'])){
							$sv['tag'] = preg_replace('/>/is', ' class="form-control">',$sv['tag']);
						}
						
						$info['install'] .= '
						<div class="col-12 col-md-6 mb-2">
								<label for="'.$sk.'" class="sai_head mb-4" id="sai_head">'.$sv['head'].'</label>
									'.(empty($sv['exp']) ? '' : '<span class="sai_exp">'.$sv['exp'].'</span>').'	
							'.$sv['tag'].'
							<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								
								addonload(\'rand_dbprefix();\');
							// ]]></script><br />
						</div>
						';
					}
				}
				
				$info['install'] .= '
				<div class="col-12 col-md-6 mb-2">';
				//Do not show 'disable update notifications' option if both 'Turn off all Emails sent to endusers' and 'Disable End User Update E-Mails' or either is enabled in Admin Panel
				if(empty($globals['off_email_link']) && empty($globals['eu_email_off'])){
					$info['install'] .= '
						<div>
						<label class="sai_head mb-2" for="disable_notify_update">'.__('Disable Update Notifications Emails').'</label>
						<span class="sai_exp">'.__('If checked you will not receive an email notification for updates available for this installation.').'</span>
						<input type="checkbox" name="disable_notify_update" id="disable_notify_update" '.POSTchecked('disable_notify_update').' /><br />
						</div>';
				}
							
				// Auto upgrade plugins
				if(empty($globals['off_upgrade_plugins']) && !empty($software['update_plugins'])){
					$info['install'] .= '<div>
						<label class="sai_head mb-2" for="auto_upgrade_plugins">'.__('Auto Upgrade $0 Plugins', array($software['name'])).'</label>
						<span class="sai_exp">'.__('If checked, all $0 plugins installed for this installation will be automatically upgraded to the latest version (every 24 hours).', array($software['name'])).'</span>
						<input type="checkbox" name="auto_upgrade_plugins" id="auto_upgrade_plugins" '.POSTchecked('auto_upgrade_plugins', (!empty($globals['force_upgrade_plugins']) ? $globals['force_upgrade_plugins'] : $globals['preselect_autoupgrade_plugins'])).(!empty($globals['force_upgrade_plugins']) ? 'disabled' : '').'/><br />
					</div>';
				}
				
				// Auto upgrade themes
				if(empty($globals['off_upgrade_themes']) && !empty($software['update_themes'])){
					$info['install'] .= '<div>
						<label class="sai_head mb-2" for="auto_upgrade_themes">'.__('Auto Upgrade $0 Themes', array($software['name'])).'</label>
						<span class="sai_exp">'.__('If checked, all $0 themes for this installation will be automatically upgraded to the latest version (every 24 hours).', array($software['name'])).'</span>
						<input type="checkbox" name="auto_upgrade_themes" id="auto_upgrade_themes" '.POSTchecked('auto_upgrade_themes', (!empty($globals['force_upgrade_themes']) ? $globals['force_upgrade_themes'] : $globals['preselect_autoupgrade_themes'])).(!empty($globals['force_upgrade_themes']) ? 'disabled' : '').'/><br />
					</div>';
				}
					
				$info['install'] .= '
				</div>';

				// Auto upgrade is not available in AMPPS
				if($globals['softpanel'] != 'ampps' && !empty($scripts[$soft]['auto_upgrade']) && empty($no_autoupgrade['disable_autoupgrade']) && empty($no_autoupgrade['scripts'][$soft]) && empty($no_autoupgrade_acl)){
					$info['install'] .= '
					<div class="col-12 col-md-6 mb-3">
						<label class="sai_head mb-2">'.__('Auto Upgrade').'</label>
						<span class="sai_exp">'.__('Select the automatic upgrade preference for this installation when a new version is available').'</span><br />
						<input class="mr-1" type="radio" name="eu_auto_upgrade" id="eu_auto_upgrade_0" value="0" '.POSTradio('eu_auto_upgrade', 0, (!empty($globals['force_auto_upgrade']) ? $globals['force_auto_upgrade'] : $globals['enable_auto_upgrade'])).(!empty($globals['force_auto_upgrade']) ? 'disabled' : '').' /><label for="eu_auto_upgrade_0" class="radio-title mb-1">'.__('Do not Auto Upgrade').'</label> <br />
						'.(!empty($software['has_minor']) ? '<input class="mr-1" type="radio" name="eu_auto_upgrade" id="eu_auto_upgrade_2" value="2" '.POSTradio('eu_auto_upgrade', 2, (!empty($globals['force_auto_upgrade']) ? $globals['force_auto_upgrade'] : $globals['enable_auto_upgrade'])).(!empty($globals['force_auto_upgrade']) ? 'disabled' : '').' /><label for="eu_auto_upgrade_2" class="radio-title mb-1"> '.__('Upgrade to <b>Minor</b> versions only').'</label> <br />' : '').'
						<input class="mr-1" type="radio" name="eu_auto_upgrade" id="eu_auto_upgrade_1" value="1" '.POSTradio('eu_auto_upgrade', 1, (!empty($globals['force_auto_upgrade']) ? $globals['force_auto_upgrade'] : $globals['enable_auto_upgrade'])).(!empty($globals['force_auto_upgrade']) ? 'disabled' : '').' /><label for="eu_auto_upgrade_1" class="radio-title mb-1">'.__('Upgrade to any latest version available (<b>Major</b> as well as <b>Minor</b>)').'</label><br />						
					</div>';
				}
				
				if(empty($globals['off_rbackup']) && empty($globals['disable_backup_restore'])){
					$info['install'] .= '
					<div class="col-12 col-md-6 mb-2">
						<label for="backup_location" class="sai_head mb-2">'.__('Backup Location').'</label>
						<span class="sai_exp">'.__('Choose the backup location to be used while backing up this installation').'</span>
					
						<select name="backup_location" class="form-control" id="backup_location">
							<option value="0"'.POSTselect('backup_location', 0).'>'.__('Default').'</option>';
							
							if(empty($globals['disable_local_backup'])){
								$info['install'] .= '<option value="-1"'.POSTselect('backup_location', -1).'>'.__('Local Folder').'</option>';
							}
							if(!empty($user['remote_backup_locs'])){
								foreach($user['remote_backup_locs'] as $ck => $cv){
									$info['install'] .= '<option value="'.$ck.'" '.POSTselect('backup_location', $ck, (@$user['default_backup_location'] == $ck ? '1' : '0')).'>'.$cv['name'].'</option>';
								}
							}
						$info['install'] .= '</select><br />
					</div>';
				}
				
				// Auto backups option only if backups is not disabled and panel is not remote
				if(empty($globals['disable_backup_restore']) && empty($globals['disable_auto_backup']) && empty($softpanel->disable_auto_backup)){
					$info['install'] .= '
					<div class="col-12 col-md-6 mb-2">						
						<label for="auto_backup" class="sai_head mb-2">'.__('Automated backups').'</label>
						<span class="sai_exp">'.__('$0 will take automated backups via CRON as per the frequency you select', array(APP)).'</span>
						<select name="auto_backup" class="form-control" id="auto_backup" onchange="show_backup();">
							<option value="0" '.POSTselect('auto_backup', '0', 1).'>'.__("Don't backup").'</option>'.
							(empty($globals['disable_auto_backup_daily']) ? '<option value="daily" '.POSTselect('auto_backup', 'daily', ($globals['auto_backup'] == 'daily' ? 1 : '')).'>'.__('Once a day').'</option>' : '').
							(empty($globals['disable_auto_backup_weekly']) ? '<option value="weekly" '.POSTselect('auto_backup', 'weekly', ($globals['auto_backup'] == 'weekly' ? 1 : '')).'>'.__('Once a week').'</option>' : '').
							(empty($globals['disable_auto_backup_monthly']) ? '<option value="monthly" '.POSTselect('auto_backup', 'monthly', ($globals['auto_backup'] == 'monthly' ? 1 : '')).'>'.__('Once a month').'</option>' : '').
							(empty($globals['disable_auto_backup_custom']) ? '<option value="custom" '.POSTselect('auto_backup', 'custom').'>'.__('Custom').'</option>' : '').'
						</select><br />
					</div>
					
					<div class="col-12 col-md-6 mb-2" id="custom_autobackup_cron" style="display:none;">						
						<label for="autobackup_cron_min" class="sai_head">'.__('Automated Backups Cron time').'</label>
						<span class="sai_exp">'.__('Please specify the CRON timings for automated backups').'</span>
						<div class="row">
							<div class="col-sm-2">
								<label for="autobackup_cron_min">'.__('Min').'</label>	
								<input type="text" class="form-control" name="autobackup_cron_min" id="autobackup_cron_min" size="2" value="'.POSTval('autobackup_cron_min', '').'" />
							</div>
							<div class="col-sm-2">
								<label for="autobackup_cron_hour">'.__('Hour').'</label>
								<input type="text" class="form-control" name="autobackup_cron_hour" id="autobackup_cron_hour" size="2" value="'.POSTval('autobackup_cron_hour', '').'" />
							</div>
							<div class="col-sm-2">
								<label for="autobackup_cron_day">'.__('Day').'</label>
								<input type="text" class="form-control" name="autobackup_cron_day" id="autobackup_cron_day" size="2" value="'.POSTval('autobackup_cron_day', '').'" />
							</div>
							<div class="col-sm-2">
								<label for="autobackup_cron_month">'.__('Month').'</label>
								<input type="text" class="form-control" name="autobackup_cron_month" id="autobackup_cron_month" size="2" value="'.POSTval('autobackup_cron_month', '').'" />
							</div>
							<div class="col-sm-2">
								<label for="autobackup_cron_weekday">'.__('Weekday').'</label>
								<input type="text" class="form-control" name="autobackup_cron_weekday" id="autobackup_cron_weekday" size="2" value="'.POSTval('autobackup_cron_weekday', '').'" />
							</div>
						</div><br />
					</div>
					
					<div class="col-12 col-md-6 mb-2">						
						<label class="sai_head mb-2" for="auto_backup_rotation">'.__('Backup Rotation').'</label>
						<span class="sai_exp">'.__('If the backup rotation limit is reached $0 will delete the oldest backup for this installation and create a new backup. The backups will utilize your space so choose the backup rotation as per the space available on your server', array(APP)).'</span>
						<select name="auto_backup_rotation" class="form-control" id="auto_backup_rotation">';    
							for($i=0; $i<=10; $i++){
								// Do we have a limit from admin ?
								if(!empty($globals['auto_backup_limit']) && ($i > $globals['auto_backup_limit'] || $i == 0) || !empty($globals['max_backups']) && ($i > $globals['max_backups'] || $i == 0)) continue;
								$info['install'] .= '<option value="'.$i.'" '.POSTselect('auto_backup_rotation', $i, (!empty($globals['auto_backup_rotation']) ? $i == $globals['auto_backup_rotation'] : $i == 4) ? '1' : '0').'>'.(empty($i) ? __('Unlimited') : $i).'</option>';
							}
						$info['install'] .= '</select><br />	
					</div>';
				}
		$info['install'] .= '</div>
			</div><br />
	</div><!--end of bg-->';
	
// Do we have to display the theme 
if((!empty($globals['eu_enable_themes']))){
		
	if(function_exists('__'.$software['softname'].'_theme_show_options')){
		$info['install'] .= call_user_func('__'.$software['softname'].'_theme_show_options');
	}
	
}

$info['install'] .= '
	<div class="text-center mt-4">
		<input type="hidden" name="softsubmit" id="softsubmit" value="'.__('Install').'" />
		<input type="hidden" name="pass-strength-hidden" id="pass-strength-hidden" value="" />
		<input type="submit" name="softsubmitbut" id="softsubmitbut" class="btn sai-button" value="'.__('Install').'"/><span id="show_txt" style="display:none;"></span>
		<br /><br /><br />
		'.(empty($globals['off_email_link']) && empty($globals['off_install_mail']) ? '<span class="sai_head">'.__('Email installation details to').'</span> : <input type="text" name="emailto" id="emailto" size="20" value="'.POSTval('emailto', '').'" />' : '').'
	</div>
	<input type="hidden" name="soft_status_key" id="soft_status_key" value="'.POSTval('soft_status_key', generateRandStr(32)).'" />
	'.csrf_display().'
	</form></div>
';

$info['install'] .= '
	<div id="progress_bar" style="height:125px; width:100%; display: none;">
		<br />
		<center>
		<font size="4" id="progress_txt" style="width:100%;">'.__('Checking the submitted data').'</font>
		<font style="font-size: 18px;font-weight: 400; width:100%;" id="progress_percent">(0 %)</font><br /><br />
		</center>
		<table width="500" cellpadding="0" cellspacing="0" id="table_progress" border="0" align="center" height="28" style="border:1px solid #CCC; -moz-border-radius: 5px;
		-webkit-border-radius: 5px; border-radius: 5px; width:50%">
			<tr>
				<td id="progress_color" width="1" style="background-image: url('.$theme['images'].'bar.gif); -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;"></td>
				<td id="progress_nocolor">&nbsp;</td>
			</tr>
		</table><br />
		<center>'.__('<b>NOTE:</b> This may take 3-4 minutes. Please do not leave this page until the progress bar reaches 100%').'</center>
	</div>
	<br /><br /><br />';

}elseif(!empty($installed)){
	
	// Check if the script supports Sign On
	$has_sign_on = has_sign_on($soft);

	$return = '';
	$role = '';

	if(can_wordpress_manager($soft)){
		$return .= '<a role="button" href="'.$globals['ind'].'act=wordpress&insid='.$new_insid.'"><span class="btn btn-outline-primary">'.__('Return to WordPress Management').'</span></a>&nbsp';
		
		$role = 'role="button"';
	}

	$return .= '<a '.$role.' href="'.script_link($soft).'&highlight='.$new_insid.'&postact=install"><span class="btn btn-outline-primary">'.__('Return to Overview').'</span></a>';
	
	//Filter to customize the return to link
	$return = apply_filters('return_link', $return, $act);
	
	$info['install'] = '
	<div class="bg2">
	<h5>'.__('Congratulations, the software was installed successfully').'</h5>
	<hr class="sai_main_head_hr" style="width:20%;">
	<p style="font-size:13px;">
	'.$software['name'].' '.__('has been successfully installed at').' : <br />
	<a href="'.$__settings['softurl'].'" target="_blank">'.$__settings['softurl'].'</a>
	'.(!empty($software['adminurl']) ? '<br />'.__('Administrative URL').' : <a href="'.(empty($globals['disable_sign_on']) && !empty($has_sign_on) ? $globals['ind'].'act=sign_on&insid='.$new_insid.'&autoid='.srandstr(32) : $__settings['softurl'].'/'.$software['adminurl']).'" target="_blank" id="adminurl">'.$__settings['softurl'].'/'.$software['adminurl'].'</a>' : '').'<br /><br />
	'.(!empty($setupcontinue) ? __('However, setup will be completed by the software itself. To complete setup, please visit the following URL').' : <br />
	<a href="'.$__settings['softurl'].'/'.$setupcontinue.'" target="_blank">'.$__settings['softurl'].'/'.$setupcontinue.'</a><br /><br />' : '').'
	'.__('We hope the installation process was easy.').'<br /><br />
	'.(!empty($pfx_error) ? error_handle($pfx_error, "100%", 0, 1) : '')
	.(!empty($notes) ? __('The following are some important notes. It is highly recommended that you read them ').' : <br />
	<div class="sai_notes">'.softparse($notes, $soft).'</div><br /><br />' : '').'
	'.__("<b>NOTE</b>: $0 is just an automatic software installer and does not provide any support for the individual software packages. Please visit the software vendor's web site for support!", array(APP)).'<br /><br />
	'.(!empty($globals['ampps_enabled']) && empty($globals['no_ampps']) && $globals['softpanel'] != 'ampps' ? __('You can develop <b>$0</b> on your <b>desktop</b> using our Free developer tool Softaculous AMPPS. Click <a href="https://www.ampps.com/downloads" target="_blank"><b>here</b></a> to download <a href="https://www.ampps.com/downloads" target="_blank"><img src="https://images.softaculous.com/ampps.gif" height="25" /></a>', array($software['name'])).'<br /><br />' : '').'
	'.__('Regards').',<br />
	'.__('$0 Auto Installer', array(APP)).'
	</p><br /><br /><center>'.$return.'</center>
	<br /><br />';

	if(empty($globals['install_tweet_off']) || empty($globals['lictype'])){
		$info['install'] .= '<form method="get" action="https://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
			<div class="row justify-content-center">
			<div class="col-sm-7">
			<div class="card">
				<div class="card-header" style="font-size:14px;">
					<font><b>'.__('Tell your friends about your new site').' :</b></font>
				</div>
				<div class="card-body">
					<div class="row">
						<div class="col-sm-12">
							<textarea id="txttweet" name="text" cols="80" row="3" style="resize:none; width:100%;">'.loadtweetdata('install_tweet', __('I just installed #[[SCRIPTNAME]] on [[softurl]] via #[[APP]] #[[TYPE]]')).'</textarea>
						</div>
					</div>
					<br />
					<div class="row">
						<div class="col-sm-12">
							<input type="submit" value="Tweet!" class="btn btn-info pull-right" onsubmit="return false;" id="twitter-btn" />
						</div>
					</div>
				</div>
			</div>
			</div>
			</div>
		</form>';
	}
	
	$info['install'] .= '<br /></div><!--end of bg2 class--><!--PROC_DONE-->
	<br /><br />';

}
			

softheader($globals['sn'].' - '.$software['name']);

//Added the show_text & hide_text variable for when the header is not loaded (Iframe)
echo '
<script>
	var show_text = "'.__js('Show').'";
	var hide_text = "'.__js('Hide').'";
</script>';
	
$loadedinfo = array('install', 'overview', 'features', 'reviews', 'screenshots', 'ratings');

?>
<script language="JavaScript" src="<?php echo $theme['url'].'/js/tabber.js';?>" type="text/javascript">
</script>
<script language="JavaScript" id="ratings_js_file" type="text/javascript"></script>
<script language="JavaScript" id="review_js_file"  type="text/javascript"></script>
<script language="JavaScript" id="reviews_js_file"  type="text/javascript"></script>
<script type="text/javascript">
tabs = new tabber;
tabs.tabs = new Array('<?php echo implode('\', \'', $loadedinfo);?>');
tabs.tabwindows = new Array('<?php echo implode('_win\', \'', $loadedinfo);?>_win');
tabs.inittab = <?php echo '\''.$init_tab.'\';';?>
addonload('tabs.init();loadraterev();check_pass_strength();');

function loadraterev(){
<?php 
	if(empty($globals['off_rating_link']) && $soft < 10000){
		echo '$_(\'ratings_js_file\').src = "'.fastestmirror().'/ratingsjs.php?soft='.$soft.'&user='.$softpanel->user['name'].'&ip='.$_SERVER['SERVER_ADDR'].'";';

	}
	
	if(empty($globals['off_review_link']) && $soft < 10000){
		echo '$_(\'review_js_file\').src =  "'.fastestmirror().'/reviewjs.php?soft='.$soft.'&user='.$softpanel->user['name'].'&ip='.$_SERVER['SERVER_ADDR'].'";';
		echo '$_(\'reviews_js_file\').src =  "'.fastestmirror().'/reviewsjs.php?soft='.$soft.'&user='.$softpanel->user['name'].'&ip='.$_SERVER['SERVER_ADDR'].'";';	
	} 
?>
};

function notifyversion(){
	if(AJAX(window.location+"&notify=true", "notified(re)")){
		return false;
	}else{
		return true;	
	}
};

function notified(re){
	if(re == 1){
		alert('<?php echo __js('Thank you for informing about the new version. We will look into it as soon as possible') ?>');
	}
};

function loadScreenshots(){
	$_('screenshots_iframe').src = '<?php echo fastestmirror().'/screenshots/screenshots1.php?sid='.$soft;?>';
};

</script>
<?php

$tmp_ver1 = array();
// Just to show the multiple versions if a script have any branch.
if(!empty($software['branch'])){
	foreach($software['branch'] as $kver => $vver){
		
		// If the package is not yet downloaded do not show empty commas
		if(empty($vver['ver'])){
			continue;
		}
		$tmp_ver1[] = $vver['ver'];
	}
	
	$tmp_ver = implode(', ', $tmp_ver1);
	
	if(count($tmp_ver1) > 3){
		$top_versions = array_slice($tmp_ver1, 0, 3);
		$tmp_ver = implode(', ', $top_versions).' 
		<a data-toggle="tooltip" data-html="true" title="" data-original-title="'.$tmp_ver.'" class="details-label" style="text-decoration:none;cursor: pointer;">('.__('More versions').')</a>';
	}
}

$url = $theme['images'];
$ratings = array();
$deduct = 1;
$r = $scripts[$soft]['ratings'];
for($i_r=1; $i_r<=5; $i_r++){		
	if($r >= 1){
		$ratings[$i_r] = '<i class="fas fa-star" alt="('.number_format($scripts[$soft]['ratings'], 2).' out of 5)"></i>';
	}elseif($r > 0){
		$ratings[$i_r] = '<i class="fas fa-star-half-alt" alt="('.number_format($scripts[$soft]['ratings'], 2).' out of 5)"></i>';
	}else{
		$ratings[$i_r] = '<i class="far fa-star" alt="('.number_format($scripts[$soft]['ratings'], 2).' out of 5)"></i>';
	}
	$r = $r - $deduct;
}	
	
	
	
// For custom themes
if($soft > 10000){
	if(file_exists($globals['euthemes'].'/'.$globals['theme_folder'].'/images/topscripts/48/'.$iscripts[$soft]['softname'].'.png')){
		$custom_48 = $theme['images'].'topscripts/48/'.$iscripts[$soft]['softname'].'.png';
	}else{
		$custom_48 = $theme['images'].'/custom.png';
	}
}

echo '<div class="bg">
	<div id="currentrating" style="display:none"></div>
	<div class="row">
		<div class="col-md-1 col-sm-2 col-2 logo_style">
			'.(!empty($custom_48) ? '<img src="'.$custom_48.'" alt="">' : '<img src="'.$globals['softimages'].'top15/48/'.$scripts[$soft]['softname'].'.png" >').'
		</div>
		<div class="col-md-11 col-sm-10 col-10 details_style" style="padding-left:0px;">
			<span class="sai_process_heading mr-1">'.$software['name'].'</span>'.($soft > 10000 ? '' : '
			<span class="someclass sai_coverstars" title="'.$scripts[$soft]['ratings'].'">'.implode('', $ratings).'</span><br/>').'

			<p class="details pl-2">
				<span class="details-label">'.__('Version').'</span> : '.(!empty($tmp_ver) ? $tmp_ver : $software['ver']).'
				<a href="javascript" onclick="notifyversion(); return false;" class="someclass" title="'.__('Notify Softaculous of a new Version').'">
					<i class="fas fa-comment-alt px-1 sai_icons" style="color:#4099FF;"></i>
				</a>
			</p>

			<p class="details pl-2">
				<span class="details-label">'.(!empty($info['release_date']) ? __('Release Date').'</span> : '.$info['release_date'] : '').'
				'.(!empty($info['changelog']) ? '
				<a href="" data-toggle="modal" data-target="#changelog_div" class="sai_changelogbut">'.__('Changelog').'</a>' : '').'
			</p>
		</div>
	</div><br />
	
	<style>
	
		.logo_style{
			padding-left: 25px !important;
			padding-top: 12px !important;
		}
		
		@media screen and (min-width: 360px) and (max-width: 767px){
			.logo_style{
				padding: 18px 0px 10px 8px !important;
			}
			.related_scripts{
				padding-left: 0px !important;
			}
		}
		@media screen and (min-width: 768px) and (max-width: 799px){
			.logo_style{
				padding: 18px 0px 10px 8px !important;
			}
		}
	</style>
	
	<script type=text/javascript>';
	if(!empty($softpanel->pheader)){
		if(is_cp_theme('x3')){
			echo '
			$(document).ready(function(){
				
				// This is as per new method. Required
				$(".details_style").css("padding-left","40px");
				
				$(".ver_style").css("margin-left","0px");
				$(".release_style").css("margin-left","0px");
				$(".change_style").css({"margin-left":"0px", "margin-top":"-15px"});
			});';
		}else{
			echo '
			$(document).ready(function(){
				$(".ver_style").css("margin-left","0px");
				$(".release_style").css("margin-left","0px");
				$(".change_style").css({"margin-left":"0px", "margin-top":"-10px"});
			});';
		}
	}
	
	
	
	echo '
	</script>
	
	<div class="old_tab">
		<div class="sai_tabs row">
			<div class="sai_single-tab">
				<a href="javascript:tabs.tab(\'install\')" class="sai_tab" id="install">'.__('Install').'</a>
			</div>
			<div style="'.(!empty($globals['off_custom_install']) ? 'display:none;' : '').'">
				<a class="sai_insbut" id="show_install_option"><span class="caret" style="cursor:pointer; padding:6px;"></span></a>
			</div>
			<div class="sai_single-tab">
				<a href="javascript:tabs.tab(\'overview\')" class="sai_tab" id="overview">'.__('Overview').'</a>
			</div>
			<div class="sai_single-tab">
				<a href="javascript:tabs.tab(\'features\')" class="sai_tab" id="features">'.__('Features').'</a>
			</div>
			'.(empty($globals['off_screenshot_link']) ? '<div class="sai_single-tab"><a href="javascript:tabs.tab(\'screenshots\'); loadScreenshots();" class="sai_tab" id="screenshots">'.__('Screenshots').'</a></div>' : '').'
			'.(empty($globals['off_demo_link']) ? '<div class="sai_single-tab"><a href="'.($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'].'act=demos&soft='.$soft).'" class="sai_tab" id="demo" target="_blank">'.__('Demo').'</a></div>' : '').'
			'.(empty($globals['off_rating_link']) && $soft < 10000 ? '<div class="sai_single-tab"><a href="javascript:tabs.tab(\'ratings\')" class="sai_tab" id="ratings">'.__('Ratings').'</a></div>' : '').'
			'.(empty($globals['off_review_link']) && $soft < 10000 ? '<div class="sai_single-tab"><a href="javascript:tabs.tab(\'reviews\')" class="sai_tab" id="reviews">'.__('Reviews').'</a></div>' : '').'
			'.((empty($info['import']) || !empty($globals['disable_import'])) ? '' : '<div class="sai_single-tab"><a href="'.$globals['ind'].'act=import&soft='.$soft.'" class="sai_tab" id="import">'.__('Import').'</a></div>').'
		</div>
		<div class="quick_install_dropdown sai_single-tab" id="quick_install_dropdown" style="display:none;">
			<div id="quick_install_btn" class="quick_install_dropdown_btn">
				<a href="javascript:tabs.tab(\'install\')">'.__('Quick Install').'</a>
			</div>
			<div id="custom_install_btn" class="quick_install_dropdown_btn">
				<a href="javascript:tabs.tab(\'install\')">'.__('Custom Install').'</a>
			</div>
		</div>
	</div><br />

	<div class="new_tab">
		<nav class="navbar navbar-default p-0">
			<div class="navbar-header w-100 p-3">
				<button type="button" class="navbar-toggle d-inline-block pull-right" data-toggle="collapse" data-target="#myNavbar">
					<i class="fas fa-bars"></i>
				</button>
				<ul class="nav">
					<li class="active">
						<a href="javascript:tabs.tab(\'install\')" id="install" class="sai_tab2 text text-decoration-none" style="height:40px; top:5px;">'.__('Install').'</a>
					</li>
					<li class="nav-item dropdown" style="'.(!empty($globals['off_custom_install']) ? 'display:none;' : '').'">
						<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="font-size:16px;">

						</a>
						<div class="dropdown-menu" aria-labelledby="navbarDropdown">
							<a href="javascript:tabs.tab(\'install\')" id="quick_install_btn" class="dropdown-item sai_tab2 text-decoration-none">'.__('Quick Install').'</a>
							<div class="dropdown-divider"></div>
							<a href="javascript:tabs.tab(\'install\')" id="custom_install_btn" class="dropdown-item sai_tab2 text-decoration-none">'.__('Custom Install').'</a>
						</div>
				  </li>
				</ul>
			</div>
			<div class="collapse navbar-collapse soft-options p-2 px-3" id="myNavbar" data-toggle="collapse" data-target=".navbar-collapse">
				<ul class="nav navbar-nav">
					<a href="javascript:tabs.tab(\'overview\')" id="overview" class="sai_tab2 text-decoration-none">
					<li>
						'.__('Overview').'
					</li>
					</a>
					<div class="dropdown-divider"></div>
					<a href="javascript:tabs.tab(\'features\')" id="features" class="sai_tab2 text-decoration-none">
					<li>
						'.__('Features').'
					</li>
					</a>
					<div class="dropdown-divider"></div>
					'.(empty($globals['off_screenshot_link']) ? '
						<a href="javascript:tabs.tab(\'screenshots\'); loadScreenshots();" class="sai_tab2 text-decoration-none" id="screenshots">
					<li>
					'.__('Screenshots').'
					</li>
					</a>' : '').'
					<div class="dropdown-divider"></div>
					'.(empty($globals['off_demo_link']) ? '
						<a href="'.($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'].'act=demos&soft='.$soft).'" class="sai_tab2 text-decoration-none" id="demo" target="_blank">
					<li>
					'.__('Demo').'
					</li>
					</a>' : '').'
					<div class="dropdown-divider"></div>
					'.(empty($globals['off_rating_link']) && $soft < 10000 ? '
						<a href="javascript:tabs.tab(\'ratings\')" class="sai_tab2 text-decoration-none" id="ratings">
					<li>
					'.__('Ratings').'
					</li>
					</a>' : '').'
					<div class="dropdown-divider"></div>
					'.(empty($globals['off_review_link']) && $soft < 10000 ? '
						<a href="javascript:tabs.tab(\'reviews\')" class="sai_tab2 text-decoration-none" id="reviews">
					<li>
					'.__('Reviews').'
					</li>
					</a>' : '').'
					<div class="dropdown-divider"></div>
					'.((empty($info['import']) || !empty($globals['disable_import'])) ? '' : '
						<a href="'.$globals['ind'].'act=import&soft='.$soft.'" class="sai_tab2 text-decoration-none" id="import">
					<li>
					'.__('Import').'
					</li>
					</a>').'
				</ul>
			</div>
		</nav>
	</div>';
	
	apply_filters('pre_software_overview_theme', $soft);

	//Maximum Installation Limit per script
	if(!empty($globals['max_ins_script']) && $ins_count_per_script >= $globals['max_ins_script']){
		echo '<br />
		<div class="alert alert-danger">
			<a href="#close" class="close" data-dismiss="alert" aria-label="close">&times;</a>
			<center>'.__('You have reached the maximum number of (<b>$0</b>) Installations allowed per script', array($globals['max_ins_script'])).'</center>
		</div>';	
	}
	
	if(!empty($outdated_script)){
		echo '<div class="alert alert-warning text-center mt-2">'.__('<b>$0</b> has not been updated for more than two years and may no longer be maintained or supported by the script vendor', array($software['name'])).'</div>';
	}
	
	echo '

<script type="text/javascript">
$_(tabs.inittab).className = tabs.tabbedclass;
var softid = '.$soft.'

tabs.override = function(id){
	if(id == \'install\'){
		$_(\'install\').className = \'sai_insbutclicked\';
	}else{
		$_(\'install\').className = \'sai_insbut\';
	}
};
</script>';

if(!empty($scripts[$soft]['screenshots'])){
	$screenshot_src = $globals['mirror_images'].'softimages/screenshots/'.$soft.'_screenshot1.gif';
}elseif($soft >= 10000){
	if(file_exists($theme['images'].'topscripts/screenshots/'.$soft.'_screenshot1.gif')){
		$screenshot_src = $theme['images'].'topscripts/screenshots/'.$soft.'_screenshot1.gif';
	}
}

//Parse and take care of images
$info['overview'] = (!empty($info['changelog']) ? '
<div class="modal fade" id="changelog_div" role="dialog">
    <div class="modal-dialog modal-lg">
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
		<h4 class="modal-title">Changelog</h4>
          	<button type="button" class="close" data-dismiss="modal">&times;</button>          
        </div>
        <div class="modal-body">
          '.$info['changelog'].'
        </div>
        <!--<div class="modal-footer">
          <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
        </div>-->
      </div>
    </div>
</div>' : '').'
<div class="bg2">
	<div class="row">
		'.(!empty($screenshot_src) && (empty($softpanel->pheader) || (!empty($softpanel->pheader) && is_cp_theme('paper_lantern'))) ? '
		<div class="col-12 col-sm-6 col-md-6 col-xl-6">
			<div id="overview_img" class="overview-img"> 
				<img src="'.$screenshot_src.'" class="img-fluid" alt=""> 
			</div>
			<div class="row mt-4 text-center">
				<div class="offset-0 offset-lg-2 col-6 col-lg-4">
					<a href="javascript:tabs.tab(\'install\')" id="install_now">
						<span class="btn sai-button">'.__('Install Now').'</span>
					</a>
				</div>
				<div class="col-6 col-lg-4">
					<a href="javascript:tabs.tab(\'overview\')" id="my_app">
						<span class="btn sai-button">'.__('My Apps').'</span>
					</a>
				</div>
			</div>	
		</div>
		<div class="col-sm-6 col-md-6 col-12">': '<div class="col-sm-12 col-12">').'
			<p class="softphrase-overview">'.softparse($info['overview'], $soft).'</p>
			<div class="row">
				<div class="col-sm-12 col-md-6 col-xs-12">					
					<span class="sai-icon-style">
						<i class="fas fa-inbox"></i>
					</span>					
					<span class="sai_head">'.__('Space Required').'</span>
					<span class="sai_exp2 mt-2 d-block">'.
						(!empty($globals['off_available_space']) ? '' : __('Available Space').' : '.(is_numeric($softpanel->spaceremain) ? number_format($softpanel->spaceremain/1024/1024, 2) : $softpanel->spaceremain).' '.__('MB').'<br />')
						.__('Required Space').' : '.number_format($software['spacereq']/1024/1024, 2).' '.__('MB')
					.'</span>
				</div>
				<div class="col-sm-12 col-md-6 col-xs-12">					
					<a href="'.$info['support'].'" class="text-decoration-none">
						<span class="sai-icon-style">
							<i class="fas fa-question-circle"></i>
						</span>
					</a>					
					<span class="sai_head">'.__('Software Support').'</span><br/>
					<a class="mt-2 d-block support-link" href="'.$info['support'].'" target="_blank">'.__('Visit Support Site').'</a>
					<span class="sai_exp2">'.__('Note: Softaculous does not provide support for any software.').'</span>
				</div>
			</div>';
			if(is_wordpress($soft) && empty($globals['disable_manage_sets'])){
				$info['overview'] .='
				<div class="row mt-3">
					<div class="col-12">
						<a href="'.$globals['ind'].'act=manage_sets" target="_blank" id="manage_sets">
						<span class="btn sai-button w-100">
							'.__('Manage Plugin / Theme Sets').'
						</span>
						</a>
					</div>
				</div>';
			}
			$info['overview'] .='
		</div>
	</div>
</div><!--end of bg2 class-->';

if((!empty($installations[$soft]) || array_intersect(array_keys($installations), array_keys($software['branch']))) && empty($globals['disable_current_ins'])){

	$info['overview'] .= '
	<div class="row mt-5">
		<div class="col-12">
			<div class="text-center">
				<span class="sai_newhead d-block" id="current_ins">'.__('Current Installations').'</span>
				<hr class="sai_main_head_hr">
			</div>
			<div class="table-responsive">';
	$info['overview'] .= '
		<table class="table table-hover installation-list-table">			
			<thead class="sai_head2">
				<tr>
					<th>'.__('Link').'</th>
					<th style="width:5%;">'.__('Admin').'</th>
					<th style="width:19%;">'.__('Installation Time').'</th>
					<th style="width:5%;">'.__('Version').'</th>
					<th width=1>'.__('Options').'</th>
					<th width=1><input type="checkbox" id="check_all"></th>
				</tr>
			</thead>';
		$i=1;
		
		$highlight = optGET('highlight');
		$action = optGET('postact');
		$ins_tr = array();
		
		//r_print($software['branch']);
		//r_print($no_autoupgrade);
		foreach($software['branch'] as $csid => $cver){
			
			//Child List of Installations
			foreach($installations[$csid] as $ik => $iv){
	
				$iv['sid'] = get_sid_by_version($iv['ver'], $iv['sid']);
				
				$is_cloneable = is_cloneable($iv['sid']);
			
				// Check if the script supports Sign On
				$sign_on = has_sign_on($iv['sid']);
				$can_staging = can_staging($iv['sid']);
				$can_template = can_template_ins($iv['sid']);
				
				$ins_row = '';
				$is_upgradable = is_upgradable($ik);
		
				$ins_row = '<tr id="trid' . $ik . '">
					<td class="endurl" ><a href="'.$iv['softurl'].'" target="_blank" id="insurl'.$ik.'">'.$iv['softurl'].'</a>'.(($highlight == $ik && !empty($action)) ? '<span id="highlight" class="ml-1"><b class="sai_highlight">'.$l['act_'.$action].'</b></span>' : '').'</td>
					
					<td>
						<a href="'.(empty($globals['disable_sign_on']) && !empty($sign_on) ? $globals['ind'].'act=sign_on&insid='.$ik.'&autoid='.srandstr(32) : $iv['softurl'].'/'.(!empty($iv['admin_folder']) ? $iv['admin_folder'] : admin_folder($iv['sid']))).'" target="_blank" title="'.__('Login as admin').'" class="someclass"><i class="fas fa-user px-1 sai_icons"></i></a>					
					</td>
					<td>
						<p style="font-size:11px;">'.datify($iv['itime']).'</p>
					</td>
					<td width="10%">
						'.$iv['ver'].(!empty($is_upgradable) ? ' <a href="'.$globals['ind'].'act=upgrade&insid='.$ik.'" title="'.__('Upgrade to Version').' '.implode(' or ', $is_upgradable).'" class="someclass"><i class="fas fa-sync-alt px-1 sai_icons" style="color:#1565C0; font-size:1.2em;"></i></a>' : '').
								(!empty($iv['eu_auto_upgrade']) && empty($no_autoupgrade['disable_autoupgrade']) &&  empty($no_autoupgrade['scripts'][$csid]) && !empty($scripts[$iv['sid']]['auto_upgrade']) && empty($no_autoupgrade_acl)? '<i class="fas fa-check-circle px-1 sai_icons" style="color:green; cursor:pointer;" title="'.__('Auto Upgrade Enabled').' '.($iv['eu_auto_upgrade'] == 1 ? __('(Major and Minor)') : __('(Minor)')).'" class="someclass"></i>' : '').'
					</td>
					<td align="right">
					
					<table class="table table-borderless icon-table" style="margin:0;" width="20">
					<tbody>
					<tr>
					
					'.(can_wordpress_manager($iv['sid']) ? '<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=wordpress&insid='.$ik.'" title="'.__('Manage your installation with WordPress Manager').'" class="someclass"><img src="'.$theme['images'].'wp-gray.png" height="23" width="23"/></a></td>' : '').'
					'.(!empty($can_publish) && ampps() ? '<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=ampps_publish&insid='.$ik.'" title="'.__('Publish').'" class="someclass" ><i class="fas fa-cloud-upload-alt px-1 sai_icons" style="color:#00A0D2;"></i></a></td>' : '' ).
					(!empty($can_template) ? '<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=create_template&insid='.$ik.'" title="'.__('Create Template').'" class="someclass"><i class="fas fa-box px-1 sai_icons" style="color:#00A0D2;"></i></a></td>' : '').'
					'.(!empty($can_staging) ? (!empty($iv['is_staging']) ? '<td style="padding:0; vertical-align:middle;"><a title="'.__('Push to Live').'" href="'.$globals['ind'].'act=pushtolive&insid='.$ik.'" class="someclass"><i class="fas fa-code-branch px-1 sai_icons" style="color:#1565C0;"></i></a></td>' : '').
					'<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=staging&insid='.$ik.'" title="'.__('Create Staging').'" class="someclass"><i class="fas fa-network-wired px-1 sai_icons" style="color:#1565C0;"></i></a></td>' : '').
					(!empty($is_cloneable) ? '<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=sclone&insid='.$ik.'" title="'.__('Clone').'" class="someclass"><i class="fas fa-copy px-1 sai_icons" style="color:#1565C0;"></i></a></td>' : '').
					(empty($globals['disable_backup_restore']) ? '<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=backup&insid='.$ik.'" title="'.__('Backup').'" class="someclass"><i class="fas fa-file-archive px-1 sai_icons" style="color:#119768;"></i></a></td>' : '').
					'<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=editdetail&insid='.$ik.'" title="'.__('Edit Details').'" class="someclass"><i class="fas fa-pencil-alt px-1 sai_icons" style="color:#FF5D00;"></i></a></td>
					'.(asperapp(0, 0, 1) && !empty($can_publish) ? '<td style="padding:0; vertical-align:middle;"><a href="'.$globals['ind'].'act=publish&insid='.$ik.'" title="'.__('Publish on the Web').'" class="someclass"><i class="fas fa-cloud-upload-alt px-1 sai_icons" style="color:#00A0D2;"></i></a></td>' : '').'
					<td style="padding:0; vertical-align:middle;"> 
					<a href="'.$globals['ind'].'act=remove&insid='.$ik.'" title="'.__('Remove').'" class="someclass"><i class="fas fa-trash-alt sai_icons" style="color:red;"></i></a>
					</td>
					
					</tr>
					</tbody>
					</table>
					
					</td>
					<td>
						<input type="checkbox" name="insids[]" id="'.$iv['softurl'].'" value="'.$ik.'" class="shift_select_ins soft_inslist">
					</td>
				</tr>';
				$i++;
				
				if(array_key_exists('is_staging', $iv)){
					$ins_tr[$iv['is_staging']] .= $ins_row;
				}else{
					if(!empty($ins_tr[$ik])){
						$ins_tr[$ik] = $ins_row.$ins_tr[$ik];
					}else{
						$ins_tr[$ik] .= $ins_row;
					}	
				}
			}
		}
		
		$info['overview'] .= implode('', $ins_tr);
		
		$info['overview'] .= '</table>
						</div>
					</div>		
				</div>
		<p class="text-right">
			<span class="sai_head">'.__('With Selected').':</span>
			<select name="multi_options" id="multi_options" class="mr-1">
				<option name="todo" id="todo" value="0">---</option>
				<option name="todo" id="todo" value="mult_rem">'.__('Remove Completely').'</option>
				<option name="todo" id="todo" value="mult_rem_info">'.__('Remove from $0', array(APP)).'</option>
			</select>

			<input type="button" value="'.__('Go').'" onclick="show_confirm()" class="btn sai-button">
		</p>
		<div id="rem_div"></div>
	
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
insids = new Array();
removed = new Object();

function show_confirm(){
	
	insids = new Array();
	removed = new Object();
	
	$sel_opt = $_("multi_options").value;
	
	if($sel_opt != "mult_rem" && $sel_opt != "mult_rem_info"){
		return false;
	}

	// Build the list of Installations to remove
	var field = document.getElementsByName(\'insids[]\');
		insids = new Array();
		var c = 0;
		for(i = 0; i < field.length; i++){
			if(field[i].checked == true){
				insids[c] = field[i].value;
				c++;
			}
		
	}
	//alert(insids);
	
	if(c == 0){
		alert("'.__js('No installation(s) selected to remove.').'");
		return false;
	}
	
	var r = confirm("'.__js('Are you sure you wish to remove the selected installations ? The action will be irreversible. No further confirmations will be asked.').'");
	if(r != true){
		return false;
	}
	
	if($sel_opt == "mult_rem_info"){
		remove_by_id(insids[0], "", 0, 1);
	}else{
		remove_by_id(insids[0], "", 0);
	}
}

function remove_by_id(insid, re, oldinsid, info_only){

	removed[insid] = false;
	info_only = info_only || 0;
	
	if(re.length > 0 && oldinsid > 0){
		if(re == "removed"){
			removed[insid] = true;
		}
	}
	
	nextinsid = 0;
	
	// Find the next INSTALLATION to remove
	for(i = 0; i < insids.length; i++){
		if(typeof(removed[insids[i]]) != "undefined"){
			continue;
		}
		nextinsid = insids[i];
		break;
	}
	
	// If there is something left to be removed
	if(insid != 0){
		var csrf_token = $("#csrf_token").val(); 
		
		try{

			$.ajax({
				type: "POST",
				data: "csrf_token="+csrf_token,
				url: "'.$globals['index'].'act=remove&insid="+insid+"&ajax=1&ssk="+randomstring(32)+"&random="+Math.random()+"&info_only="+info_only,
				// Checking for error
				success: function(data){
					remove_by_id(nextinsid, data, insid, info_only);
				}
			});
			
			$_("rem_div").innerHTML = "<br /><br /><p align=\"center\"><img src=\"' . $theme['images'] . 'ajax_remove.gif\"> <br />'.__js('Removing Installation - '). ' ID: " +insid+ ", URL: " + $_("insurl"+insid)+"<br /></p>";
			return true;
		}catch(e){
			return false;
		}
	}
	$_("rem_div").innerHTML = "";
	alert("'.__js('The selected installation(s) have been removed. The page will now be reloaded !').'");
	location.reload(true);
	return true;
}

$(document).ready(function(){
	$("#check_all").on("click", function(event){
		if(this.checked == true){
			$(".soft_inslist").prop("checked", true);
		}else{
			$(".soft_inslist").prop("checked", false);
		}
	});
	
	$(".sai_altrowstable tr").mouseover(function(){
		var old_class = $(this).attr("class");
		
		if(old_class == "nohover") return;
		
		//alert(old_class);
		$(this).attr("class", "sai_tr_bgcolor");
		
		$(this).mouseout(function(){
			$(this).attr("class", old_class);
		});
		
	});
	
	$("#my_app").click(function(){
		goto_id("current_ins");
	});';
	
// If we get anything in $highlight than only we have to call this JS function other wise it will cause the JS error.
if(!empty($highlight)){
	$info['overview'] .= 'goto_id("insurl'.$highlight.'");
	$("#highlight").fadeOut(10000);';
}
	
$info['overview'] .= '});

// ]]></script>';
	
}

if(count($allcatwise[$software['type']][$software['cat']]) > 2 && $software['cat'] != 'others' && empty($globals['disable_related_scripts'])){

	$info['overview'] .= '
	<div class="bg2">
		<div class="row mt-2">
			<div class="col-12 ">
				<span class="sai_newhead d-block" id="current_ins">'.__('Related Scripts').'</span>
				<hr class="sai_main_head_hr">
			</div>		
		</div>
		
		<div class="row related_scripts">';
		
		$i = 0;
	
		foreach($allcatwise[$software['type']][$software['cat']] as $k => $v){
			
			

			if(($k == $soft) || (!empty($scripts[$k]['parent']) && !empty($iscripts[$scripts[$k]['parent']]))){
				continue;
			}
			
			// Show only 5 scripts
			if($i == 5){
				break;
			}
			
			$custom_48 = '';
			
			if($k > 10000){
				if(file_exists($globals['euthemes'].'/'.$globals['theme_folder'].'/images/topscripts/48/'.$v['softname'].'.png')){
					$custom_48 = $theme['images'].'topscripts/48/'.$v['softname'].'.png';
				}else{
					$custom_48 = $theme['images'].'custom.png';
				}
			}
			
			$info['overview'] .='
			<div class="col-sm-3 col-md-2 col-6">
				<a href="'.script_link($k).'" title="'.$v['desc'].'" alt="" class="someclass softtooltip related-scripts">
					<div class="sai_blog_script">
						<div class="sai_demo_script_logo">
							<img src="'. (!empty($custom_48) ? $custom_48 : $globals['softimages'].'top15/48/'.$v['softname'].'.png').'" >	
						</div>
						<div class="sai_script_name">'.$v['name'].'</div>
					</div>
				</a>
			</div>';
			
			$i++;
			
		}
	$info['overview'] .='</div><!--end of row-->
	</div><!--end of bg2 class-->';
}

//Parse and take care of images
$info['features'] = '<div class="bg2"><br />'.softparse($info['features'], $soft).'</div><!--end of bg2 class-->';
$info['ratings'] = '';
$info['screenshots'] = '<div class="row">
		<div class="col-12 mx-auto">
			<iframe src="" id="screenshots_iframe" class="screenshots_iframe" frameborder="0" scrolling="no"></iframe>
		</div>	
	</div>';

$info['reviews'] = '<div class="bg2"><div id="allreviews"></div></div><!--end of bg2 class-->';

foreach($info as $k => $v){
	
	if(in_array($k, array('demo', 'support', 'import', 'changelog'))) continue;
		echo '<div id="'.$k.'_win" style="display: '.($init_tab == $k ? "block" : "none").'; width:100%;"><br />
				'.$v.'
			</div>';

}
echo '</div>';
	
// Is there a UI Controller ?
if(function_exists('__'.$software['softname'].'_theme_html')){
	call_user_func('__'.$software['softname'].'_theme_html');
}

softfooter();

}
?>