Exemple #1
0
function js_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts, $allcatwise;
    global $software, $soft, $info, $settings, $init_tab, $overwrite_option, $dbs, $installed, $__settings, $setupcontinue, $installations, $notes, $show_installtype, $protocols, $nopackage, $ajaxhttpsexists, $ajaxhttps, $new_insid;
    if (optGET('ajaxdownload') && !empty($nopackage)) {
        // Try to download the package
        if (method_exists($softpanel, 'updatesoftwares')) {
            $softpanel->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($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;
        }
    }
    //First add the installation info
    if (empty($installed)) {
        $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 (empty($globals['lictype']) && !empty($scripts[$soft]['force_scripts'])) {
            $info['install'] .= '
	<div class="alert alert-warning">
		<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
		<center>' . lang_vars($l['not_in_free'], array($software['name'])) . (!webuzo() ? '&nbsp;&nbsp;' . $l['notify_admin'] : '') . '</center>
	</div>';
        }
        $info['install'] .= error_handle($error, "100%", 0, 1) . '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

function checkform(dosubmit){
	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("' . $l['installing'] . '");
	}
	
	return true;
	
};

function toggle_advoptions(){
	if ($("#advoptions").is(":hidden")){
		$("#advoptions").slideDown("slow");
		$("#plus").attr("src", "' . $theme['images'] . 'minus_new.gif");
	}
	else{
		$("#advoptions").slideUp("slow");
		$("#plus").attr("src", "' . $theme['images'] . 'plus_new.gif");
	}
}

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

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

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);
			}
		);
		
		$.ajax({
			url: window.location+"&jsnohf=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("' . addslashes($l['finishing_process']) . '");
						progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
					}else{
						progressbar.reset();
					}
				}catch(e){ }
				
				if ( jqXHR.isResolved() ) {
				
					// #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);
						show_backup();
						new_theme_funcs_init();
					}).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("' . $l['downloading'] . '");
		
		try{		
			AJAX("' . $globals['index'] . 'act=js&soft=' . $soft . '&ajaxdownload=1&random="+Math.random(), "get_package_handle(re)");
		}catch(e){ }
		
		return false;
	}else{
		$_("show_txt").style.display = "none";
		return true;
	}
};

function get_package_handle(resp){
	nopackage = 0;
	show_msg("' . $l['installing'] . '");
	checkform(1);
};

softemail = new Object();
function softmail(){
	try{
		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;
	
		$("#checkhttps_wait").css("display","inline-block");
		if(proto.indexOf("https") !== -1){
		
			 $.ajax({
				type: "POST",
				url: "' . $globals['index'] . 'act=js&soft=' . $soft . '&checkhttps="+encodeURIComponent(proto+$_(softdomain_id).value),
				timeout:10000,
				// Checking for error
				success: function(data){
					$("#checkhttps_wait").css("display","none");
					is_https(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 = "' . $l['no_https'] . '";
		}
		if(httpserror != ""){
			$_("httpserror").style.display = "block";
			$_("httpserror").innerHTML = httpserror;
			return false;
		}else{
			$_("httpserror").style.display = "none";
		}
		
	}catch(e){
		//
	}
	return true;
};
  
// show/hide backup options
function show_backup(){

	var auto_backup = $("#auto_backup").val();
	
	if(auto_backup == 0){
		$("#auto_backup_rotation").attr("disabled", true);
	}else{
		$("#auto_backup_rotation").attr("disabled", false);
	}
	
	return true;
};

' . (!empty($_POST) ? '' : 'addonload(\'softmail();show_backup();\');');
        $info['install'] .= '// ]]></script>';
        $info['install'] .= '

<div class="bg">
	<div class="sai_sub_head">' . $l['setup'] . '</div><hr>';
        if (empty($globals['hide_protocol'])) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="softproto" class="sai_head">' . $l['choose_protocol'] . '</label><br />
				<span class="sai_exp2">' . $l['choose_protocol_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<select name="softproto" class="form-control" id="softproto" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
            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><div style="display:none;" id="checkhttps_wait">&nbsp;&nbsp;<img src="' . $theme['images'] . 'progress.gif" alt="please wait.."></div><br />
				<div class="row">
					<span id="httpserror" style="display:none; padding:10px;" class="alert alert-danger"></span>
				</div>
			</div>
		</div>';
        }
        $info['install'] .= '
	<div class="row">
		<div class="col-sm-5">';
        $info['install'] .= '
			<label for="softdomain" class="sai_head">' . $l['choose_domain'] . '</label><br />
			<span class="sai_exp2">' . $l['choose_domain_exp'] . '</span>
		</div>
		<div class="col-sm-7">
			<select name="softdomain" class="form-control" id="softdomain" onchange="softmail();" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
        if (!empty($globals['blank_domain'])) {
            $info['install'] .= '<option value="" ' . (empty($_POST['softdomain']) ? 'selected="selected"' : '') . '>(' . $l['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>
		</div>
	</div><br />
	
	<div class="row">
		<div class="col-sm-5">
			<label for="softdirectory" class="sai_head">' . $l['in_directory'] . '</label><br />
			<span class="sai_exp2">' . $l['in_directory_exp'] . '</span>
		</div>
		<div class="col-sm-7">	
			<input type="text" name="softdirectory" class="form-control" id="softdirectory" size="30" value="' . POSTval('softdirectory', $software['softname']) . '" />
		</div>
	</div><br />';
        if (!empty($show_installtype)) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="jsinstalltype" class="sai_head">' . $l['ins_type'] . '</label><br />
				<span class="sai_exp2">' . $l['ins_type_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<select name="jsinstalltype" id="jsinstalltype" class="form-control">
					<option value="0" ' . POSTselect('jsinstalltype', 0) . '>' . $l['ori_pack'] . '</option>
					<option value="1" ' . POSTselect('jsinstalltype', 1, 1) . '>' . $l['just_lib'] . '</option>
				</select>
			</div>
		</div><br />';
        }
        if (!empty($overwrite_option)) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<span class="sai_head">' . $l['overwrite'] . '</span>
			</div>
			<div class="col-sm-7">
				<input type="checkbox" name="overwrite_existing" id="overwrite_existing" />
			</div>
		</div>';
        }
        $info['install'] .= '
</div><br /><!--end of bg class-->';
        if (!empty($settings)) {
            if (file_exists($software['path'] . '/install.js')) {
                $info['install'] .= '<script language="javascript" type="text/javascript"><!--// --><![CDATA[';
                $info['install'] .= @parselanguages(str_replace('$(', '$_(', implode('', file($software['path'] . '/install.js'))));
                $info['install'] .= '// ]]></script>';
            }
            foreach ($settings as $group => $sets) {
                if ($group == 'hidden' || empty($sets)) {
                    continue;
                }
                $info['install'] .= '
		<div class="bg">
			<div class="sai_sub_head">' . $group . '</div><hr>';
                foreach ($sets as $sk => $sv) {
                    //Adding class form-control 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="row">
				<div class="col-sm-5">
					<label for=' . $sk . ' class="sai_head" id="sai_head">' . $sv['head'] . '</label>
						' . (empty($sv['exp']) ? '' : '<span class="sai_exp">' . $sv['exp'] . '</span>') . '	
				</div>
					<div class="col-sm-7 ">' . $sv['tag'] . '</div>
						' . (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']) ? '
						<div class="col-sm-1">
							<a href="javascript: void(0);"  onclick="$_(\'' . $sk . '\').value=randstr(10, 1, ' . (!empty($globals['pass_strength']) ? $globals['pass_strength'] : 0) . ');return false;" title="' . $l['randpass'] . '"><img src="' . $theme['images'] . 'randpass.gif" /></a>
						</div>
						' : '') . '							
			</div><br />';
                }
                $info['install'] .= '</div><br /><!--end of bg class-->';
            }
            //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)
        // Advance option
        $info['install'] .= '
	<div class="bg">
		<div class="sai_sub_head" id="advoptions_toggle" onclick="toggle_advoptions(\'advoptions\');" style="cursor:pointer"><img id="advoptions_toggle_plus"  src="' . $theme['images'] . 'plus_new.gif" style="margin-top:-4px;"/>&nbsp;&nbsp;' . $l['adv_option'] . '</div>
			<div id="advoptions" style="display:none;"><hr>
				<div class="row">
					<div class="col-sm-5">
						<label class="sai_head">' . $l['disable_notify_update'] . '</label>
						<span class="sai_exp">' . $l['exp_disable_notify_update'] . '</span>
					</div>
					<div class="col-sm-7">
						<input type="checkbox" name="disable_notify_update" id="disable_notify_update" ' . POSTchecked('disable_notify_update') . ' />
					</div>	
				</div><br />';
        // 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']) && !aefer() && empty($softpanel->disable_auto_backup)) {
            $info['install'] .= '
					<div class="row">
						<div class="col-sm-5">
							<label for="auto_backup" class="sai_head">' . $l['auto_backup'] . '</label>
							<span class="sai_exp">' . $l['exp_auto_backup'] . '</span>
						</div>
						<div class="col-sm-7">
							<select name="auto_backup" class="form-control" id="auto_backup" onchange="show_backup();">
								<option value="0" ' . POSTselect('auto_backup', '0', 1) . '>' . $l['no_backup'] . '</option>' . (empty($globals['disable_auto_backup_daily']) ? '<option value="daily" ' . POSTselect('auto_backup', 'daily') . '>' . $l['daily'] . '</option>' : '') . (empty($globals['disable_auto_backup_weekly']) ? '<option value="weekly" ' . POSTselect('auto_backup', 'weekly') . '>' . $l['weekly'] . '</option>' : '') . (empty($globals['disable_auto_backup_monthly']) ? '<option value="monthly" ' . POSTselect('auto_backup', 'monthly') . '>' . $l['monthly'] . '</option>' : '') . '
							</select>
						</div>		
					</div><br />
					
					<div class="row">
						<div class="col-sm-5">
							<label class="sai_head">' . $l['auto_backup_rotation'] . '</label>
							<span class="sai_exp">' . $l['exp_auto_backup_rotation'] . '</span>
						</div>
						<div class="col-sm-7"> 
							<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, $i == 4 ? '1' : '0') . '>' . (empty($i) ? $l['unlimited'] : $i) . '</option>';
            }
            $info['install'] .= '</select>
						</div>	
					</div><br />';
        }
        $info['install'] .= '
			</div>
	</div><br /><!--end of bg-->';
        $info['install'] .= '
<p align="center">
	<input type="hidden" name="softsubmit" id="softsubmit" value="' . $l['softsubmit'] . '" />
	<input type="submit" name="softsubmitbut" id="softsubmitbut" value="' . $l['softsubmit'] . '" class="flat-butt" /><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">' . $l['ins_emailto'] . '</span> : <input type="text" name="emailto" id="emailto" size="20" value="' . POSTval('emailto', '') . '" />' : '') . '
</p>
<input type="hidden" name="soft_status_key" id="soft_status_key" value="' . POSTval('soft_status_key', generateRandStr(32)) . '" />
</form></div>

<div id="progress_bar" style="height:125px; width:100%; display: none;">
	<br />
	<center>
		<font size="4" color="#222222" id="progress_txt" style="width:100%;">' . $l['checking_data'] . '</font>
		<font style="font-size: 18px;font-weight: 400;color: #444444; 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>' . $l['wait_note'] . '</center>
</div>
<br /><br /><br />';
    } elseif (!empty($installed)) {
        $info['install'] = '
	<div class="bg2">
		<h4>' . $l['congrats'] . '</h4><br />
		' . $software['name'] . ' ' . $l['succesful'] . ' : <br />
		<a href="' . $__settings['softurl'] . '" target="_blank">' . $__settings['softurl'] . '</a>
		<br /><br />
		' . $l['enjoy'] . '<br /><br />
		' . (!empty($notes) ? $l['install_notes'] . ' : <br />
		<div class="sai_notes">' . softparse($notes, $soft) . '</div><br /><br />' : '') . '
		' . $l['please_note'] . '<br /><br />
		' . (!empty($globals['ampps_enabled']) && empty($globals['no_ampps']) && $globals['softpanel'] != 'ampps' ? lang_vars($l['ampps_download'], array($software['name'])) . '<br /><br />' : '') . '
		' . $l['regards'] . ',<br />
		' . $l['softinstaller'] . '<br /><br />
		<center><b><a href="' . script_link($soft) . '&highlight=' . $new_insid . '&postact=install">' . $l['return'] . '</a></b></center><br /><br />';
        if (empty($globals['install_tweet_off']) || empty($globals['lictype'])) {
            $info['install'] .= '<form method="get" action="http://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
				<div class="panel panel-info" style="width:55%; margin:0 auto;">
					<div class="panel-heading" style="padding:5px; font-size:15px;">
						<font><b>' . $l['install_tweet_sub'] . ' :</b></font>
					</div>
					<div class="panel-body">
						<div class="row">
							<div class="col-sm-10">
								<textarea name="text" cols="80" row="3" style="resize:none; width:100%;">' . loadtweetdata('install_tweet', $l['install_tweet']) . '</textarea>
							</div>
							<div class="col-sm-2">
								<input type="submit" value="Tweet!" class="btn btn-info" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/>
							</div>
						</div>
					</div>
				</div>
				</form>';
        }
        $info['install'] .= '
	</div><!--end of bg class--><!--PROC_DONE-->
	<br /><br />';
    }
    softheader($l['<title>'] . $software['name']);
    $loadedinfo = array('install', 'overview', 'features', 'reviews', 'ratings');
    $url = $theme['images'];
    $ratings = array();
    $deduct = 1;
    $r = $scripts[$k]['ratings'];
    for ($i_r = 1; $i_r <= 5; $i_r++) {
        if ($r >= 1) {
            $ratings[$i_r] = '<img src="' . $url . 'star.png' . '" alt="(' . number_format($scripts[$k]['ratings'], 2) . ' out of 5)" />';
        } elseif ($r > 0) {
            $ratings[$i_r] = '<img src="' . $url . 'halfstar.png' . '" alt="(' . number_format($scripts[$k]['ratings'], 2) . ' out of 5)" />';
        } else {
            $ratings[$i_r] = '<img src="' . $url . 'nostar.png' . '" alt="(' . number_format($scripts[$k]['ratings'], 2) . ' out of 5)" />';
        }
        $r = $r - $deduct;
    }
    ?>
<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();');

function loadraterev(){
<?php 
    if (empty($globals['off_rating_link']) && $soft < 10000) {
        echo '$_(\'ratings_js_file\').src = "https://www.softaculous.com/ratings.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
    }
    if (empty($globals['off_review_link']) && $soft < 10000) {
        echo '$_(\'review_js_file\').src =  "https://www.softaculous.com/review.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
        echo '$_(\'reviews_js_file\').src =  "https://www.softaculous.com/reviews.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
    }
    ?>
};
</script>
<?php 
    // 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" style="margin-left:10px;">
		' . (!empty($custom_48) ? '<img src="' . $custom_48 . '" alt="">' : '<img src="' . $globals['mirror_images'] . 'top15/48/' . $scripts[$soft]['softname'] . '.png" >') . '
		<span class="sai_process_heading" style="margin-left:20px;">' . $software['name'] . '</span>
	</div><br />
	<div class="row">
		<div class="col-sm-2">
			' . ($soft > 10000 ? '' : '<div class="someclass" title="' . $scripts[$soft]['ratings'] . '">' . implode('', $ratings) . '</div>') . '
		</div>
		<div class="col-sm-5 ver_style">
			' . $l['software_ver'] . ' : <font size="2"><b>' . (!empty($tmp_ver) ? $tmp_ver : $software['ver']) . '</b></font> &nbsp; &nbsp; <a href="javascript" onclick="notifyversion(); return false;" ><img src="' . $theme['images'] . 'notify.gif" name="notifyver" title="' . $l['notify_ver'] . '" alt="' . $l['notify_ver'] . '"></a>
		</div>
		<div class="col-sm-3 release_style">
			' . (!empty($info['release_date']) ? $l['release_date'] . ' : <font size="1"><b>' . $info['release_date'] . '</b></font>' : '') . '
		</div>
		<div class="col-sm-2 change_style" style="margin-top:0px;">
			' . (!empty($info['changelog']) ? '&nbsp;&nbsp;<a href="javascript" data-toggle="modal" data-target="#changelog_div" class="sai_changelogbut" style="text-decoration:none;">' . $l['changelog'] . '</a>' : '') . '
		</div>
	</div><br />
	
	<script type=text/javascript>';
    if (!empty($softpanel->pheader)) {
        if (substr_count($_SERVER['REQUEST_URI'], 'x3') > 0) {
            echo '
			$(document).ready(function(){
				$(".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">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="sai_tabs">
			<tr>
				<td><a href="javascript:tabs.tab(\'install\')" id="install" class="sai_insbut">' . $l['install'] . '</a></td>
				<td><a href="javascript:tabs.tab(\'overview\')" class="sai_tab" id="overview">' . $l['overview'] . '</a></td>
				<td><a href="javascript:tabs.tab(\'features\')" class="sai_tab" id="features">' . $l['features'] . '</a></td>
					' . (empty($globals['off_demo_link']) ? '<td><a href="' . ($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'] . 'act=demos&soft=' . $soft) . '" class="sai_tab" id="demo" target="_blank">' . $l['demo'] . '</a></td>' : '') . '
					' . (empty($globals['off_rating_link']) && $soft < 10000 ? '<td><a href="javascript:tabs.tab(\'ratings\')" class="sai_tab" id="ratings">' . $l['ratings'] . '</a></td>' : '') . '
					' . (empty($globals['off_review_link']) && $soft < 10000 ? '<td><a href="javascript:tabs.tab(\'reviews\')" class="sai_tab" id="reviews">' . $l['reviews'] . '</a></td>' : '') . '
			</tr>
		</table><br />
	</div>
	<div class="new_tab">
		<nav class="navbar navbar-default">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>                        
				</button>
				<ul class="nav">
					<li class="active" style="width:80px;"><a href="javascript:tabs.tab(\'install\')" id="install" class="sai_tab2" style="text-decoration:none; height:40px; top:5px;" data-toggle="collapse" data-target="#myNavbar">' . $l['install'] . '</a></li>
				</ul>
			</div>
			<div class="collapse navbar-collapse" id="myNavbar" style="position:absolute; z-index:1000; width:100%; background:#F8F8F8;">
				<ul class="nav navbar-nav">
					<li><a href="javascript:tabs.tab(\'overview\')"  id="overview" class="sai_tab2" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['overview'] . '</a></li>
					<li><a href="javascript:tabs.tab(\'features\')"  id="features" class="sai_tab2" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['features'] . '</a></li>
					<li>' . (empty($globals['off_demo_link']) ? '<a href="' . ($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'] . 'act=demos&soft=' . $soft) . '" class="sai_tab2" id="demo" target="_blank" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['demo'] . '</a>' : '') . '</li>
					<li>' . (empty($globals['off_rating_link']) && $soft < 10000 ? '<a href="javascript:tabs.tab(\'ratings\')" class="sai_tab2" id="ratings" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['ratings'] . '</a>' : '') . '</li>
					<li>' . (empty($globals['off_review_link']) && $soft < 10000 ? '<a href="javascript:tabs.tab(\'reviews\')" class="sai_tab2" id="reviews" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['reviews'] . '</a>' : '') . '</li>
				</ul>
			</div>
		</nav>
	</div>';
    ?>
	<script type="text/javascript">
	$_(tabs.inittab).className = tabs.tabbedclass;
	var softid = <?php 
    echo $soft;
    ?>
;

	tabs.override = function(id){
		if(id == 'install'){
			$_('install').className = 'sai_insbutclicked';
		}else{		
			$_('install').className = 'sai_insbut';
		}
	};
	</script>
	<?php 
    //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" style="margin-top:80px;">
		  <!-- Modal content-->
		  <div class="modal-content">
			<div class="modal-header" style="background:#F0F0F0;">
			  <button type="button" class="close" data-dismiss="modal">&times;</button>
			  <h4 class="modal-title">Changelog</h4>
			</div>
			<div class="modal-body" style="height: 350px; overflow-y: auto;">
			  ' . $info['changelog'] . '
			</div>
			<div class="modal-footer" style="padding-top:10px; height:50px;">
			  <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
			</div>
		  </div>
		</div>
	</div>' : '') . '
	<div class="bg2">
		<div class="row">
			<div class="col-sm-12">
				' . softparse($info['overview'], $soft) . '<br /><br />
			</div>
			<div class="col-sm-6">
				<div class="row">
					<div class="col-sm-1"><font color="#447edf"><i class="fa sai-disk fa-3x"></i></font></div>
					<div class="col-sm-5">
						<span class="sai_head">' . $l['space_req'] . '</span><br />
						<span class="sai_exp2">' . $l['available_space'] . ' : ' . (is_numeric($softpanel->spaceremain) ? number_format($softpanel->spaceremain / 1024 / 1024, 2) : $softpanel->spaceremain) . ' ' . $l['mb'] . '<br />
						' . $l['req_space'] . ' : ' . number_format($software['spacereq'] / 1024 / 1024, 2) . ' ' . $l['mb'] . '</span>
					</div>
				</div><br />
				<div class="row">
					<div class="col-sm-1"><a href="' . $info['support'] . '"><font color="#447edf"><i class="fa sai-question fa-3x"></i></font></a></div>
					<div class="col-sm-5">
						<span class="sai_head">' . $l['software_support'] . '</span><br />
						<span class="sai_exp2"><a href="' . $info['support'] . '" target="_blank">' . $l['support_link'] . '</a><br />
						' . $l['support_note'] . '</span>
					</div>
				</div>	
			</div>
		</div><br />
	</div><!--end of bg class-->';
    if (!empty($installations[$soft])) {
        $is_cloneable = is_cloneable($soft);
        $highlight = optGET('highlight');
        $action = optGET('postact');
        $info['overview'] .= '<br /><br />
		<center><span class="sai_newhead">' . $l['current_ins'] . '</span><br /></center><hr>';
        $info['overview'] .= '
		<div class="bg2">
			<table class="table table-hover">
			<thead style="background:#EFEFEF;" class="sai_head2">
			<tr>
				<th>' . $l['link'] . '</th>
				<th>' . $l['ins_time'] . '</th>
				<th>' . $l['version'] . '</th>
				<th width="130">' . $l['options'] . '</th>
				<th><input type="checkbox" id="check_all"></th>
			</tr>
			</thead>';
        foreach ($installations[$soft] as $ik => $iv) {
            $info['overview'] .= '<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">&nbsp;&nbsp;<b class="sai_highlight">' . $l['act_' . $action] . '</b></span>' : '') . '</td>
		
				<td>' . datify($iv['itime']) . '</td>
				<td>' . $iv['ver'] . ($software['ver'] != $iv['ver'] && file_exists($software['path'] . '/upgrade.xml') ? ' <a href="' . $globals['ind'] . 'act=upgrade&insid=' . $ik . '"><img src="' . $theme['images'] . 'updates.gif" alt="' . $l['upd_to'] . ' ' . $scripts[$soft]['ver'] . '" class="someclass" /></a>' : '') . '</td>
				<td>' . (!empty($is_cloneable) ? '<a href="' . $globals['ind'] . 'act=sclone&insid=' . $ik . '" title="' . $l['clone'] . '" class="someclass"><img src="' . $theme['images'] . 'clone.gif" /></a>&nbsp;' : '') . '&nbsp;<a href="' . $globals['ind'] . 'act=remove&insid=' . $ik . '" title="' . $l['remove'] . '" class="someclass"><img src="' . $theme['images'] . 'remove.gif" /></a></td>
				<td>
					<input type="checkbox" name="insids[]" id="' . $iv['softurl'] . '" value="' . $ik . '" class="soft_inslist">
				</td>
			</tr>';
        }
        $info['overview'] .= '</table><br />
			<p align="right" style="width:100%;">
				<span class="sai_head">' . $l['with_selected'] . ':</span>
				<select name="multi_options" id="multi_options">
					<option name="todo" id="todo" value="0">---</option>
					<option name="todo" id="todo" value="mult_rem">' . $l['remove'] . '</option>
				</select>
				<input type="button" value="' . $l['go'] . '" onclick="show_confirm()" class="sai_graybluebut">
				<br />
			</p>
			<div id="rem_div"></div>
		</div><!--end of bg2 class-->
		
		<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
		insids = new Array();
		removed = new Object();

		function show_confirm(){
			
			insids = new Array();
			removed = new Object();
			
			if($_("multi_options").value != "mult_rem"){
				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(c);
			
			if(c == 0){
				alert("' . $l['no_sel_inst'] . '");
				return false;
			}
			
			var r = confirm("' . $l['del_insid'] . '");
			if(r != true){
				return false;
			}
			
			remove_by_id(insids[0], "", 0);
		}
		
		function remove_by_id(insid, re, oldinsid){

			removed[insid] = false;
			
			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){
				try{		
					AJAX("' . $globals['index'] . 'act=remove&insid="+insid+"&ajax=1&ssk="+randomstring(32)+"&random="+Math.random(), "remove_by_id(\'"+nextinsid+"\', re, \'"+insid+"\')");
					$_("rem_div").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +insid+ ", URL: " + $_("insurl"+insid)+"<br /></p>";
					return true;
				}catch(e){
					return false;
				}
			}
			$_("rem_div").innerHTML = "";
			alert("' . $l['inst_remvd'] . '");
			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");
				//alert(old_class);
				$(this).attr("class", "sai_tr_bgcolor");
				
				$(this).mouseout(function(){
					$(this).attr("class", old_class);
				});
			});';
        // 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') {
        $info['overview'] .= '<br /><br /><div class="bg2">
			<table width="100%" class="table table-hover">
				<tr>
					<th style="background:#EFEFEF" class="sai_head2">' . $l['related_scripts'] . '</th>
				</tr>
			</table>';
        $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;
            }
            $info['overview'] .= '
			<div style="text-decoration:none;display:inline-block;text-align:center;margin-top:10px;">
				<a href="' . script_link($k) . '"  title="' . $v['desc'] . '"  width="80" alt="" class="someclass" style="text-decoration:none;margin-top:5px;">
					<div class="sai_blog_script" style="margin-left:11%;">
						<div class="sai_demo_script_logo">
							<img src="' . $globals['mirror_images'] . 'top15/48/' . $v['softname'] . '.png" >	
						</div>
						<div class="sai_script_name">' . $v['name'] . '</div>
					</div>
				</a>
			</div>';
            $i++;
        }
        $info['overview'] .= '</div><!--end of bg 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['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', 'changelog'))) {
            continue;
        }
        echo '<div id="' . $k . '_win" style="display: ' . ($init_tab == $k ? "block" : "none") . '; width:100%;"><br />
		' . $v . '
		</div>';
    }
    echo '</div><!--End of bg-->';
    softfooter();
}
}
if ($GLOBALS['soft'] == 295) {
    $l['ss']['ad_name'] = 'Username';
}
if ($GLOBALS['soft'] == 294) {
    $l['ss']['ad_name'] = 'Username';
}
if ($GLOBALS['soft'] == 289) {
    $l['ss']['ad_name'] = 'Username';
}
if ($GLOBALS['soft'] == 314) {
    $l['ss']['data_dir'] = 'Dolibarr Data Directory';
}
if ($GLOBALS['soft'] == 321) {
    $l['ss']['err_php'] = 'The PHP version is less than the required 5.0 version!';
}
if ($GLOBALS['soft'] == 333) {
    $l['ss']['real_name'] = 'Admin Real Name';
}
if ($GLOBALS['soft'] == 343) {
    $l['ss']['data_dir'] = 'Moodle Data Directory';
}
if (webuzo()) {
    $l['ss']['default'] = 'Default';
    $l['ss']['set-default'] = 'Set Default';
    $l['ss']['exp-set-default'] = 'Set it as a default service to be used';
    $l['ss']['exp-rem-default'] = 'This will remove the installed conflicting default service';
    $l['ss']['dep'] = 'Dependencies';
    $l['ss']['remove-dep'] = 'Remove Dependent Application(s)';
    $l['ss']['exp-remove-dep'] = 'This will recursively remove the installed dependent application(s)';
}
Exemple #3
0
function login_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error;
    global $insid, $backed, $software, $soft;
    $current_user = $softpanel->getCurrentUser();
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . $globals['charset'] . '" />
<meta name="keywords" content="softaculous, software" />
<title>' . $l['<title>'] . '</title>
<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/style.css" />
<link rel="shortcut icon" href="' . $theme['a_images'] . 'favicon.ico" />
<script language="javascript" src="' . $theme['url'] . '/js/universal.js" type="text/javascript"></script>
</head>
<body>

<div class="sai_loginmap">
<table border="0" cellpadding="0" cellspacing="0" width="100%">	
<tr>
	<td colspan="3" background="' . $theme['images'] . 'loginhead.gif">
	
		<table border="0" cellpadding="0" cellspacing="0" width="950" align="center">	
			<tr>
				<td align="left" width="100%" height="43" valign="middle">
				<a href="' . $globals['ind'] . '"><img ' . ($globals['softpanel'] == 'ampps' ? 'src="' . $theme['a_images'] . 'loginlogo.gif"' : (empty($globals['logo_url']) ? ' src="' . $theme['a_images'] . 'loginlogo.gif"' : ' src="' . $theme['images'] . 'cust_panel.gif"')) . ' alt="" /></a>
				</td>
			</tr>
		</table>
		
	</td>
</tr>

<tr>
<td>&nbsp;</td>
<td align="left" width="950" valign="top">';
    error_handle($error, 360, 1);
    echo '<form accept-charset="' . $globals['charset'] . '" action="" method="post" name="loginform">
<br /><br />
<table border="0" cellpadding="8" cellspacing="0" align="center">	
	<tr>			
		<td width="400" valign="middle">
			<center class="sai_loginhead">' . $l['sign_in'] . '</center>
			<table border="0" cellpadding="2" cellspacing="0" align="center">
				<tr>
				<td width="30">&nbsp;</td>
				<td valign="top" class="sai_login_txt">
					<br /><br />
					' . $l['log_user'] . '<br />
					<input type="text" name="username"  id="username" ' . ($globals['softpanel'] == 'ampps' || !empty($globals['webuzo_disable_username']) ? 'value="' . POSTval('username', $current_user) . '" readonly' : 'value="' . POSTval('username', '') . '"') . ' class="sai_login_input" />
					
					<br />
					
					' . $l['log_pass'] . '<br />
					<input type="password" name="password" value="" class="sai_login_input" />
					
					<center>
						<input type="submit" name="login" value="' . $l['sub_but'] . '" class="sai_graybluebut" />
					</center>
				</td>
				<td width="30">&nbsp;</td>
				</tr>
			</table>			
			<br />';
    if (webuzo()) {
        echo '
				<center>
					<a href="index.php?act=login&sa=fuser" style="color:#666666">' . $l['forgotuser'] . '</a>
				</center>			
				<br />';
    }
    echo '
			<center>
				<a href="index.php?act=login&sa=fpass" style="color:#666666">' . $l['forgot_pass'] . '</a>
			</center>
		</td>
	</tr>
</table>
</form>
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
window.onload = function(){ $_("username").focus(); }
// ]]></script>

</td>
<td>&nbsp;</td>
</tr>
</table>
</div>

<br />';
    softfooter();
    /**
    * <br />
    			<center>
    				<a href="index.php?act=login&sa=fpass" style="color:#666666">'.$l['forgot_pass'].'</a>
    			</center>
    */
}
Exemple #4
0
function upgrade_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts;
    global $software, $soft, $info, $settings, $softins, $dbtype, $dbs, $upgraded, $__settings, $setupcontinue, $installations, $notes, $upgradableto;
    // 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;
    }
    softheader($l['<title>'] . $software['name']);
    echo '
	<div id="install_win">';
    //First add the installation info
    if (empty($upgraded)) {
        if (!empty($GLOBALS['alreadyupdated'])) {
            echo '
				<form accept-charset="' . $globals['charset'] . '" method="post" name="uprec" id="uprec" action="">
					<input type="hidden" name="updaterecord" value="1" />
					
					<div class="alert alert-warning">
						<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
						<center><a href="javascript:$_(\'uprec\').submit();" style="text-decoration:none;"><img src="' . $theme['images'] . 'notice.gif" /> &nbsp;  ' . lang_vars($l['alreadyupdated'], array($GLOBALS['alreadyupdated'], $softins['ver'])) . '</a></center>
					</div>
					
				</form><br />';
        }
        // You may not need an upgrade anymore.
        if (!empty($GLOBALS['no_update_required'])) {
            echo '
				<div class="alert alert-warning">
					<center><img src="' . $theme['images'] . 'notice.gif" /> &nbsp; ' . $l['no_update_required'] . '<center>
				</div>
				<br />';
        } else {
            echo '
				<div id="fadeout_div">
					<form accept-charset="' . $globals['charset'] . '" name="installsoftware" method="post" action="" onsubmit="return checkform();" id="installsoftware">
					
						<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
						
						function checkform(dosubmit){
							try{
								if(!formcheck() || !checkdbname(\'softdb\', true)){
									return false;
								}
							}catch(e){
								//Do nothing
							}
							$_("softsubmitbut").disabled = true;
							
							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("' . $l['upgrading'] . '");
							}
							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 = 0;
									sid = $_("softbranch").value;
								}catch(e){ 
									var sid = 0;
								}
								
								$.ajax({
									url: window.location+"&jsnohf=1&softbranch="+sid,
									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("' . addslashes($l['finishing_process']) . '");
												progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
											}else{
												progressbar.reset();
											}
										}catch(e){ }
										
										if ( jqXHR.isResolved() ) {
										
											// #4825: Get the actual response in case
											// a dataFilter is present in ajaxSettings
											jqXHR.done(function( r ) {
												responseText = r;
											});
											//alert(responseText);
											// 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);
												new_theme_funcs_init();
											}).delay(50).animate({opacity: 1}, 500,function(){
												if($("#setupcontinue_url").length > 0){
													$(".third_url").css({"border": "2px solid #FBDB0C", "width":"55%", "padding":"5px"});
													alert("' . $l['setup_partial'] . '");
													$(".third_url").css({"border-color": "#fff", "transition":"60s"});
												}				
											});
											
											//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 = "";
						}
						
						// Use the Progress Bar ?
						var useprog = 1;
						
						softemail = new Array();
						function softmail(){
							try{
								var sofdom = "softdomain";
								for(x in softemail){
									if(softemail[x] == true) continue;
									var temp = $_(x).value.split("@");
									$_(x).value = temp[0] + "@" + $_(sofdom).value;
								}
							}catch(e){
								return false;
							}
						};
						
						' . (!empty($_POST) ? '' : 'addonload(\'softmail();\');');
            echo '
						// ]]></script>';
            $array_keys = array_keys($upgradableto);
            echo '
						<div class="bg"><br />
							<div class="row sai_main_head" style="width:100%;" align="center">
								<div class="col-sm-5 col-xs-5" style="padding:0 10px 0 0; text-align:right;">
									<i class="fa sai-sync fa-2x" style="color:#00A0D2;"></i>
								</div>
								<div class="col-sm-7 col-xs-7" style="padding-top:10px; padding-left:0; text-align:left;">' . $l['prog_upgrading'] . $scripts[$array_keys[0]]['name'] . '</div>
							</div><hr>';
            if (empty($globals['lictype']) && !empty($scripts[$soft]['force_scripts'])) {
                echo '<br />
								<div class="alert alert-warning">
									<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
									<center>' . lang_vars($l['not_in_free'], array($software['name'])) . (!webuzo() ? '&nbsp;&nbsp;' . $l['notify_admin'] : '') . '</center>
								</div>';
            }
            echo error_handle($error, "100%", 0, 1);
            echo '
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['softins_url'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info"><a href="' . $softins['softurl'] . '" target="_blank">' . $softins['softurl'] . '</a></span>
								</div>
							</div><br />
								
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['softins_path'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info">' . $softins['softpath'] . '</span>
								</div>
							</div><br />';
            if (!empty($scripts[$softins['sid']]['parent']) && count($array_keys) >= 2) {
                echo '
								<div class="row">
									<div class="col-sm-5">
										<label for="softbranch" class="sai_head">' . $l['select_version'] . '</label>
									</div>
									<div class="col-sm-7">
										<select name="softbranch" id="softbranch" class="form-control" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
                foreach ($upgradableto as $uk => $uv) {
                    echo '<option value=' . $uk . '>' . $uv . '</option>';
                }
                echo '
										</select>
									</div>
								</div>';
            }
            if (empty($globals['disable_backup_upgrade'])) {
                echo '
								<div class="row">
									<div class="col-sm-5">
										<label class="sai_head">' . $l['create_backup'] . '</label>
										<span class="sai_exp2">' . $l['create_backup_exp'] . '</span>
									</div>
									<div class="col-sm-7">
										<input type="checkbox" name="create_backup" id="create_backup" ' . POSTchecked('create_backup') . ' />
									</div>
								</div>';
            }
            if (!empty($settings)) {
                if (file_exists($software['path'] . '/upgrade.js')) {
                    echo '<script language="javascript" type="text/javascript"><!--// --><![CDATA[';
                    echo @parselanguages(str_replace('$(', '$_(', implode('', file($software['path'] . '/upgrade.js'))));
                    echo '// ]]></script>';
                }
                foreach ($settings as $group => $sets) {
                    if ($group == 'hidden') {
                        continue;
                    }
                    echo '<br /><br />
									<div class="bg">
										<div class="sai_sub_head">' . $group . '</div><hr>';
                    foreach ($sets as $sk => $sv) {
                        // Add class form-control
                        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']);
                        }
                        echo '
											<div class="row">
												<div class="col-sm-5">
													<label for="dbusername" class="sai_head">' . $sv['head'] . '</label>
													' . (empty($sv['exp']) ? '' : '<br /><span class="sai_exp">' . $sv['exp'] . '</span>') . '
												</div>
												<div class="col-sm-7">
													' . $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>
													' : '') . '
												</div>
											</div>';
                    }
                    echo '
									</div><br /><!---end of bg class--->';
                }
                //The Hidden groups
                if (!empty($settings['hidden'])) {
                    foreach ($settings['hidden'] as $sk => $sv) {
                        echo $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)) {
                echo '<br /><br />
								<div class="row" style="padding-left:15px;">
									<span class="sai_info">' . $l['softcopy_note'] . '</span>
								</div><br />';
            }
            echo '
							<div class="row" style="padding-left:15px;">
								<span class="sai_info">' . lang_vars($l['note_backup'], array($softins['insid'])) . '</span>
							</div><br />';
            if (count($array_keys) < 2) {
                echo '
								<div class="row" style="padding-left:15px;">
									<span class="sai_info">' . $l['upgrading_to'] . '<b>' . (!empty($scripts[$array_keys[0]]['name']) ? $scripts[$array_keys[0]]['name'] : $iscripts[$array_keys[0]]['name']) . '</b>, ' . $l['version'] . ' : <b>' . (!empty($scripts[$array_keys[0]]['version']) ? $scripts[$array_keys[0]]['version'] : $iscripts[$array_keys[0]]['ver']) . '</b></span>
								</div><br />';
            }
            echo '
							<p align="center">
								<input type="hidden" name="softsubmit" id="softsubmit" value="' . $l['softsubmit'] . '" />
								<input type="submit" name="softsubmitbut" class="flat-butt" id="softsubmitbut" value="' . $l['softsubmit'] . '" /><span id="show_txt" style="display:none;"></span>
							</p><br /><br />
									
							<input type="hidden" name="soft_status_key" id="soft_status_key" value="' . POSTval('soft_status_key', generateRandStr(32)) . '" />
							
							<center><b><a href="' . script_link($soft) . '" class="sai_head">' . $l['return'] . '</a></b></center><br /><br />
							
						</div><br /><!--end of bg class-->
					</form>
				</div>
				
				<div id="progress_bar" style="display: none; width: 100%;">
					<br />
					<div class="bg">
						<center>
							<div class="row sai_main_head" style="width:100%;" align="center">
								<div class="col-sm-5 col-xs-5" style="padding:0 10px 0 0; text-align:right;">
									<i class="fa sai-sync fa-2x" style="color:#00A0D2;"></i>
								</div>
								<div class="col-sm-7 col-xs-7" style="padding-top:10px; padding-left:0; text-align:left;">' . $l['prog_upgrading'] . $scripts[$array_keys[0]]['name'] . '</div>
							</div>
							<br />
							<font size="4" color="#222222" id="progress_txt" style="width: 100%;">' . $l['checking_data'] . '</font>
							<font style="font-size: 18px;font-weight: 400;color: #444444; 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;background-color:#efefef; 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>' . $l['wait_note'] . '</center>
						<br /><br />
					</div><!--end of bg class-->
				</div><br /><br />';
        }
    } elseif (!empty($upgraded)) {
        $tmp_admiurl = $__settings['softurl'] . '/' . (!empty($softins['admin_folder']) ? $softins['admin_folder'] : $software['adminurl']);
        echo '
			<div class="bg">
				<div class="third_url"><h4>' . (!empty($setupcontinue) ? $l['setup_partial'] . '</h4><div id="setupcontinue_url" style="display:none;"></div>
				' . $l['finish_update'] . '<br />
				<a href="' . $__settings['softurl'] . '/' . $setupcontinue . '" target="_blank">' . $__settings['softurl'] . '/' . $setupcontinue . '</a></div><br />' : $l['congrats'] . '</h4>') . '<br />
				' . (!empty($setupcontinue) ? lang_vars($l['finish_up_sucess'], array($software['name'])) : $software['name'] . ' ' . $l['succesful']) . ' : <br />
				<a href="' . $__settings['softurl'] . '" target="_blank">' . $__settings['softurl'] . '</a>
				' . (!empty($software['adminurl']) ? '<br />' . $l['admin_url'] . ' : <a href="' . $tmp_admiurl . '" target="_blank">' . $tmp_admiurl . '</a>' : '') . '<br /><br />
				' . $l['enjoy'] . '<br /><br />
				' . (!empty($notes) ? $l['upgrade_notes'] . ' : <br /> 
				<div class="sai_notes">' . softparse($notes, $soft) . '</div><br /><br />' : '') . '
				' . $l['please_note'] . '<br /><br />
				' . $l['regards'] . ',<br />
				' . $l['softinstaller'] . '<br /><br />
				<center><b><a href="' . script_link($soft) . '&highlight=' . $softins['insid'] . '&postact=upgrade">' . $l['return'] . '</a></b></center><br /><br />';
        if (empty($globals['upgrade_tweet_off']) || empty($globals['lictype'])) {
            echo '
					<form method="get" action="http://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
						<div class="panel panel-info" style="width:55%; margin:0 auto;">
							<div class="panel-heading" style="padding:5px;">
								<font size="+1"><b>' . $l['upgrade_tweet_sub'] . ' :</b></font>
							</div>
							<div class="panel-body">
								<div class="row">
									<div class="col-sm-10">
										<textarea name="text" cols="80" row="3" style="resize:none; width:100%;">' . loadtweetdata('upgrade_tweet', $l['upgrade_tweet']) . '</textarea>
									</div>
									<div class="col-sm-2 col-xs-2">
										<input type="submit" value="Tweet!" class="btn btn-info" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/>
									</div>
								</div>
							</div>
						</div>
					</form>';
        }
        echo '
			</div><!--end of bg class--><!--PROC_DONE-->
			<br /><br /><br /><br />';
    }
    echo '
	</div>';
    softfooter();
}
Exemple #5
0
function software_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts, $allcatwise;
    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;
    if (optGET('notify')) {
        get_softaculous_file('http://www.softaculous.com/notifyversion.php?softid="' . $soft . '"');
        echo 1;
        return true;
    }
    if (optGET('ajaxdownload') && !empty($nopackage)) {
        // Try to download the package
        if (method_exists($softpanel, 'updatesoftwares')) {
            $softpanel->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 generate order call
    if (optGET('generate_order')) {
        $order_id = get_softaculous_file($globals['apipfx'] . 'fetch.php?apikey=' . $user['pfxapi_key'] . '&email=' . $user['email'] . '&pid=' . optGET('theme_id') . '&giveinfo=generate_order&index=' . rawurlencode($globals['index']));
        echo json_encode($order_id);
        return true;
    }
    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');
    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\\"/ie', $ivv['tag'])) {
                    $random_username = false;
                }
            }
        }
        $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 (empty($globals['lictype']) && !empty($scripts[$soft]['force_scripts'])) {
            $info['install'] .= '<center class="alert alert-warning">' . lang_vars($l['not_in_free'], array($software['name'])) . (!webuzo() ? '&nbsp;&nbsp;' . $l['notify_admin'] : '') . '</center>';
        }
        $info['install'] .= error_handle($error, "100%", 0, 1) . '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[


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);
			softmail();
			show_backup();
			check_pass_strength();
			' . (!empty($globals['random_pass']) ? '$("#admin_pass").val(randstr(10, 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();' : '') . '
		},
		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("src", "' . $theme['images'] . 'minus_new.gif");
	}
	else{
		$("#"+ele).slideUp("slow");
		$("#"+ele+"_toggle_plus").attr("src", "' . $theme['images'] . 'plus_new.gif");
	}
}

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 = "' . $l['bad'] . '";
	if(score == "good") lang = "' . $l['good'] . '";
	if(score == "strong") lang = "' . $l['strong'] . '";
	if(score == "short") lang = "' . $l['short'] . '";
	if(score == "strength_indicator") lang = "' . $l['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("' . $l['err_pass_strength'] . '"+' . $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("' . $l['installing'] . '");
	}
	
	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("' . addslashes($l['finishing_process']) . '");
						progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
					}else{
						progressbar.reset();
					}
				}catch(e){ }
				
				if ( jqXHR.isResolved() ) {
				
					// #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);
						show_backup();
						check_pass_strength();
						new_theme_funcs_init();
						if($("#theme_div").length != 0){
							theme_init();
						}
					}).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("' . $l['downloading'] . '");
		
		try{		
			AJAX("' . $globals['index'] . 'act=software&soft=' . $soft . '&ajaxdownload=1&random="+Math.random(), "get_package_handle(re)");
		}catch(e){ }
		
		return false;
	}else{
		$_("show_txt").style.display = "none";
		return true;
	}
};

function get_package_handle(resp){
	nopackage = 0;
	show_msg("' . $l['installing'] . '");
	checkform(1);
};

softemail = new Object();
function softmail(){
	try{
		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;
	
		$("#checkhttps_wait").css("display","inline-block");
		if(proto.indexOf("https") !== -1){
		
			 $.ajax({
				type: "POST",
				url: "' . $globals['index'] . 'act=software&soft=' . $soft . '&checkhttps="+encodeURIComponent(proto+$_(softdomain_id).value),
				timeout:10000,
				// Checking for error
				success: function(data){
					$("#checkhttps_wait").css("display","none");
					is_https(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 = "' . $l['no_https'] . '";
		}
		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);
	}else{
		$("#auto_backup_rotation").attr("disabled", false);
	}
	
	return true;
};

' . (!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 = "' . $l['db_name_long'] . '";
		}
		
		//There should be only alphanumeric characters
		if(/[^a-zA-Z0-9]/.test($_(id).value) && !' . aefer() . '0){
			dberror = "' . $l['db_alpha_num'] . '";
		}
		
		//Check if it exists
		if(re == "true"){
			dberror = "' . $l['database_exists'] . '";
		}
		
		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;
};';
        }
        //End of if($dbtype)
        $info['install'] .= '// ]]></script>';
        $info['install'] .= '
<div class="bg">
	<div class="sai_sub_head">' . $l['setup'] . '</div><hr>';
        if (count($software['branch']) > 1) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="softbranch" class="sai_head">' . $l['choose_version'] . '</label><br />
				<span class="sai_exp2">' . $l['choose_version_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<select name="softbranch" class="form-control" id="softbranch" onchange="selectversion()" style="display:inline-block;">';
            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>
			</div>
		</div><br />';
        }
        if (empty($softpanel->noprotocol) && empty($globals['hide_protocol'])) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="softproto" class="sai_head">' . $l['choose_protocol'] . '</label><br />
				<span class="sai_exp2">' . $l['choose_protocol_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<select name="softproto" class="form-control" id="softproto" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
            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><div style="display:none;" id="checkhttps_wait">&nbsp;&nbsp;<img src="' . $theme['images'] . 'progress.gif" alt="please wait.."></div><br />
				<div class="row">
					<span id="httpserror" style="display:none; padding:10px;" class="alert alert-danger"></span>
				</div>
			</div>
		</div>';
        }
        $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">';
        $info['install'] .= '
				<label for="softdomain" class="sai_head">' . $l['choose_domain'] . '</label><br />
				<span class="sai_exp2">' . $l['choose_domain_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<select name="softdomain" class="form-control" id="softdomain" onchange="softmail();change_admin_prefix(this.value);" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
        if (!empty($globals['blank_domain'])) {
            $info['install'] .= '<option value="" ' . (empty($_POST['softdomain']) ? 'selected="selected"' : '') . '>(' . $l['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>
			</div>
		</div><br />
		
		<div class="row">
			<div class="col-sm-5">
				<label for="softdirectory" class="sai_head">' . $l['in_directory'] . '</label><br />
				<span class="sai_exp2">' . $l['in_directory_exp'] . '</span>
			</div>
			<div class="col-sm-7">	
				<input type="text" name="softdirectory" class="form-control" id="softdirectory" size="30" value="' . POSTval('softdirectory', !empty($globals['no_prefill']) ? '' : $software['softname']) . '" />
			</div>
		</div><br />';
        if (!empty($datadir)) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="datadir" class="sai_head">' . $l['datadir'] . '</label><br />
				<span class="sai_exp2">' . $l['datadir_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<input type="text" name="datadir" class="form-control" id="datadir" size="30" value="' . POSTval('datadir', $datadir) . '" />		
			</div>
		</div><br />';
        }
        if (!empty($dbtype)) {
            $dbname = mysqldbname($software['softname']);
            if (method_exists($softpanel, 'mysqldbname')) {
                $dbname = $softpanel->mysqldbname();
            }
            // This is default
            $dbhost = 'localhost';
            // Don't prefill database details
            if (!empty($globals['no_prefill_db'])) {
                $dbname = '';
                $dbhost = '';
            }
            if (aefer()) {
                $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="softdb" class="sai_head">' . $l['database_name'] . '</label><br />
				<span class="sai_exp2">' . $l['database_name_exp_aefer'] . '</span>
			</div>
			<div class="col-sm-7">
				<input type="text" name="softdb" class="form-control" id="softdb" size="30" value="' . POSTval('softdb', $dbname) . '" onblur="checkdbname(\'softdb\', false)" />
				<span id="softdberror" style="background: #FDB3B3; display:none; width:200px;"></span>
			</div>
		</div><br />';
            }
            if (!empty($softpanel->no_db_create)) {
                // Database Username
                $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label class="sai_head">' . $l['dbusername'] . '</label><br />
				<span class="sai_exp2">' . $l['dbusername_exp'] . '</span>
			</div>
			<div class="col-sm-7">
				<input type="text" name="dbusername" class="form-control" id="dbusername" size="30" value="' . POSTval('dbusername', '') . '" />
			</div>
		</div><br />';
                // Database Password
                $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label class="sai_head">' . $l['dbuserpass'] . '</label><br />
				<span class="sai_exp2">' . $l['dbuserpass_exp'] . '</span>
			</div>	
			<div class="col-sm-7"> 	
				<input type="text" name="dbuserpass" class="form-control" id="dbuserpass" size="30" value="' . POSTval('dbuserpass', '') . '" />
			</div>
		</div><br />';
                //Database Host Name
                $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<label for="hostname" class="sai_head">' . $l['hostname'] . '</label><br />
				<span class="sai_exp2">' . $l['hostname_exp'] . '</span>
			</div>	
			<div class="col-sm-7">	
				<input type="text" name="hostname" class="form-control" id="hostname" size="30" value="' . POSTval('hostname', $dbhost) . '" />
			</div>	
		</div><br />
		';
            }
        }
        // Are there any cron jobs
        if (!empty($cron)) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<span class="sai_head">' . $l['cron_job'] . '</span><br />
				<span class="sai_exp2">' . $l['cron_job_exp'] . '</span>
			</div>
			<div class="col-sm-7">
					<div class="row">
						<div class="col-sm-2">
							<span>' . $l['cron_min'] . '</span>	
							<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">
							<span>' . $l['cron_hour'] . '</span>
							<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">
							<span>' . $l['cron_day'] . '</span>
							<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">
							<span>' . $l['cron_month'] . '</span>
							<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">
							<span>' . $l['cron_weekday'] . '</span>
							<input type="text" class="form-control" name="cron_weekday" id="cron_weekday" size="2" value="' . POSTval('cron_weekday', $cron['weekday']) . '" />
						</div>
					</div>
			</div>
		</div><br />';
        }
        if (!empty($overwrite_option)) {
            $info['install'] .= '
		<div class="row">
			<div class="col-sm-5">
				<span class="sai_head">' . $l['overwrite'] . '</span>
			</div>
			<div class="col-sm-7">
				<input type="checkbox" name="overwrite_existing" id="overwrite_existing" />
			</div>
		</div>';
        }
        $info['install'] .= '</div><br /><!--end of bg class-->';
        if (!empty($settings)) {
            if (file_exists($software['path'] . '/install.js')) {
                $info['install'] .= '<script language="javascript" type="text/javascript"><!--// --><![CDATA[';
                $info['install'] .= @parselanguages(str_replace('$(', '$_(', implode('', file($software['path'] . '/install.js'))));
                $info['install'] .= '// ]]></script>';
            }
            foreach ($settings as $group => $sets) {
                if ($group == 'hidden' || empty($sets)) {
                    continue;
                }
                $info['install'] .= '
					<div class="bg">
						<div class="sai_sub_head">' . $group . '</div><hr>';
                foreach ($sets as $sk => $sv) {
                    //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="row">
									<div class="col-sm-5">
										<label for=' . $sk . ' class="sai_head" id="sai_head">' . $sv['head'] . '</label>
											' . (empty($sv['exp']) ? '' : '<span class="sai_exp">' . $sv['exp'] . '</span>') . '	
									</div>
									' . (preg_match('/admin_pass|softpass/is', $sv['tag']) ? preg_replace('/>|\\/>/is', ' onkeyup="check_pass_strength();" >', '
										<div class="col-sm-6">' . $sv['tag'] . '<div id="pass-strength-result" style="border-radius:3px;">' . $l['strength_indicator'] . '</div></div>') : '<div class="col-sm-7 ">' . $sv['tag'] . '</div>') . '
										' . (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']) ? '
										<div class="col-sm-1">
											<a href="javascript: void(0);"  onclick="$_(\'' . $sk . '\').value=randstr(10, 1, ' . (!empty($globals['pass_strength']) ? $globals['pass_strength'] : 0) . ');check_pass_strength();return false;" title="' . $l['randpass'] . '"><img src="' . $theme['images'] . 'randpass.gif" /></a>
										</div>
										<div class="clearfix"></div>
										' : '') . '
										
										' . (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(10, 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_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>
										' : '') . '
								</div><br />';
                }
                $info['install'] .= '
					</div><br /><!--end of bg class-->';
            }
            //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'] .= '
		' . $l['softcopy_note'] . '
		';
        }
        // Advance option
        $info['install'] .= '
	<div class="bg">
		<div class="sai_sub_head" id="advoptions_toggle" onclick="toggle_advoptions(\'advoptions\');" style="cursor:pointer"><img id="advoptions_toggle_plus"  src="' . $theme['images'] . 'plus_new.gif" style="margin-top:-4px;"/>&nbsp;&nbsp;' . $l['adv_option'] . '</div>
			<div id="advoptions" style="display:none;"><hr>
				' . (empty($dbtype) || aefer() ? "" : '<div class="row">
					<div class="col-sm-5">
						<label for="softdb" class="sai_head">' . $l['database_name'] . '</label><br />
						<span class="sai_exp2">' . $l['database_name_exp'] . '</span>
					</div>
					<div class="col-sm-7">
						<input type="text" name="softdb" class="form-control" id="softdb" size="30" value="' . POSTval('softdb', $dbname) . '" onblur="checkdbname(\'softdb\', false)" /><br />
						<span id="softdberror" style="background: #FDB3B3; display:none; width:200px;"></span>
					</div>
				</div>') . '

				<div class="row">
					<div class="col-sm-5">
						<label class="sai_head">' . $l['disable_notify_update'] . '</label>
						<span class="sai_exp">' . $l['exp_disable_notify_update'] . '</span>
					</div>
					<div class="col-sm-7">
						<input type="checkbox" name="disable_notify_update" id="disable_notify_update" ' . POSTchecked('disable_notify_update') . ' />
					</div>	
				</div><br />';
        // 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])) {
            $info['install'] .= '
					<div class="row">
						<div class="col-sm-5">
							<label class="sai_head">' . $l['eu_auto_upgrade'] . '</label>
							<span class="sai_exp">' . $l['exp_eu_auto_upgrade'] . '</span>
						</div>
						<div class="col-sm-7">
							<input type="checkbox" name="eu_auto_upgrade" id="eu_auto_upgrade" ' . POSTchecked('eu_auto_upgrade', $globals['enable_auto_upgrade']) . (!empty($globals['force_auto_upgrade']) ? ' checked="checked" disabled' : '') . '/>
						</div>	
					</div><br />';
        }
        // Auto upgrade plugins
        if (empty($globals['off_upgrade_plugins']) && !empty($software['update_plugins'])) {
            $info['install'] .= '
					<div class="row">
						<div class="col-sm-5">
							<label class="sai_head">' . lang_vars($l['auto_upgrade_plugins'], array($software['name'])) . '</label>
							<span class="sai_exp">' . lang_vars($l['exp_auto_upgrade_plugins'], array($software['name'])) . '</span>
						</div>
						<div class="col-sm-7">
							<input type="checkbox" name="auto_upgrade_plugins" id="auto_upgrade_plugins" ' . POSTchecked('auto_upgrade_plugins') . ' />
						</div>	
					</div><br />';
        }
        // Auto upgrade themes
        if (empty($globals['off_upgrade_themes']) && !empty($software['update_themes'])) {
            $info['install'] .= '
					<div class="row">
						<div class="col-sm-5">
							<label class="sai_head">' . lang_vars($l['auto_upgrade_themes'], array($software['name'])) . '</label>
							<span class="sai_exp">' . lang_vars($l['exp_auto_upgrade_themes'], array($software['name'])) . '</span>
						</div>
						<div class="col-sm-7">
							<input type="checkbox" name="auto_upgrade_themes" id="auto_upgrade_themes" ' . POSTchecked('auto_upgrade_themes') . ' />
						</div>	
					</div><br />';
        }
        // 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']) && !aefer() && empty($softpanel->disable_auto_backup)) {
            $info['install'] .= '
					<div class="row">
						<div class="col-sm-5">
							<label for="auto_backup" class="sai_head">' . $l['auto_backup'] . '</label>
							<span class="sai_exp">' . $l['exp_auto_backup'] . '</span>
						</div>
						<div class="col-sm-7">
							<select name="auto_backup" class="form-control" id="auto_backup" onchange="show_backup();">
								<option value="0" ' . POSTselect('auto_backup', '0', 1) . '>' . $l['no_backup'] . '</option>' . (empty($globals['disable_auto_backup_daily']) ? '<option value="daily" ' . POSTselect('auto_backup', 'daily') . '>' . $l['daily'] . '</option>' : '') . (empty($globals['disable_auto_backup_weekly']) ? '<option value="weekly" ' . POSTselect('auto_backup', 'weekly') . '>' . $l['weekly'] . '</option>' : '') . (empty($globals['disable_auto_backup_monthly']) ? '<option value="monthly" ' . POSTselect('auto_backup', 'monthly') . '>' . $l['monthly'] . '</option>' : '') . '
							</select>
						</div>	
					</div><br />
					
					<div class="row">
						<div class="col-sm-5">
							<label class="sai_head">' . $l['auto_backup_rotation'] . '</label>
							<span class="sai_exp">' . $l['exp_auto_backup_rotation'] . '</span>
						</div>
						<div class="col-sm-7"> 
							<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, $i == 4 ? '1' : '0') . '>' . (empty($i) ? $l['unlimited'] : $i) . '</option>';
            }
            $info['install'] .= '</select>
						</div>	
					</div><br />';
        }
        $info['install'] .= '
			</div>
	</div><br /><!--end of bg-->';
        // Do we have to display the theme
        if (!empty($globals['eu_enable_themes']) && !empty($software['has_theme'])) {
            $info['install'] .= '
		<div class="bg">
			<div id="pfx_div" style="display:none"></div>
		</div><br /><!--end of bg class-->
		<script id="paypal_js" language="javascript" type="text/javascript"></script>
		<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

		var pfx_div = \'' . str_replace(array("\n", "'"), array('', "\\'"), '<style>
		@import url(https://fonts.googleapis.com/css?family=Open+Sans:300light,400light,700light,400,400,700); 
		</style>
		<div id="themesearch" class="sai_popupc" style="display:none;">
			<div class="sai_themesearch_div sai_popuptitle" align="center" style="padding-left:20px;">
					<fieldset class="sai_inputs">
						<div class="row">
							<input type="text"  name="themesearchstring" class="col-sm-10" id="themesearchstring"  class="sai_inputs" autofocus placeholder="Search Themes" autocomplete="off">
							<div class="col-sm-6" style="text-align:right; margin-top:8px;">
								<a href="javascript:void(0);" class="sai_popupclose b-close">Close</a>
							</div>
						</div>
						<div class="row">
							<h4 id="results-text" style="display:none;">Showing results for: <b id="search-string"></b></h4>
							<ul id="results"></ul><br />
						</div>
					</fieldset>
			</div>
			<div id="searchsuggestions"></div>
		</div>
		<div class="sai_sub_head" id="theme_toggle" onclick="toggle_advoptions(\'theme\');" class="sai_heading_full" style="cursor:pointer"><img id="theme_toggle_plus" src="' . $theme['images'] . 'minus_new.gif" />&nbsp;&nbsp;' . $l['choose_theme'] . '</div>
		<div class="row">
			<div id="theme" style="display:block;" class="col-sm-12"><hr>
				<div id="theme_div" style="display:block;">
					<div class="row">
						<div class="col-sm-2">
							<a class="btn btn-default" id="search_theme">' . $l['search'] . '</a>
						</div>
						<div class="col-sm-8">		
							<center>' . $l['theme_is_optional'] . '</center>
						</div>
						<div class="col-sm-2">
							<a class="btn btn-default pull-right" id="refresh_theme">' . $l['refresh'] . '</a>
							<div id="sloading" style="display:none;">
								<center><img src="' . $theme['images'] . 'loading.gif" alt="Loading..." /></center>
							</div>
						</div>
					</div><br />
					
					<div class="row">
						<div style="height:280;">
							<div id="loading" style="display:block;z-index:99;">
								<center><img src="' . $theme['images'] . 'loading.gif" alt="Loading..." /></center>
							</div>
							<center><div id="display_theme" style="height:auto;"></div></center>
						</div>
					</div>
					
					<div class="row">
						<div class="col-sm-1">
							<span id="prevBtn"><a href="javascript:void(0);"></a></span>
						</div>
						<div class="col-sm-10">
							<center><div id="clear_theme" name="clear_theme" class="sai_searchbox_button" onclick="clear_theme();" style="display:none;">' . $l['clear_theme'] . '</div></center>
						</div>
						<div class="col-sm-1">
							<span id="nextBtn"><a href="javascript:void(0);"></a></span>
						</div>	
					</div>
				</div>
			</div>
		</div>') . '\';
			
		var length;
		var deduct;
		var payment_timer;
		var dg;

		' . (!empty($owned_themes) ? 'owned_theme = new Array("' . implode('", "', array_values($owned_themes)) . '");' : 'var owned_theme = new Array();') . '

		var screen_width = $(window).width();

		if(screen_width < 1282 && screen_width > 982){
			length = 3;
			deduct = 3;
		}else if(screen_width < 982 && screen_width >802){
			length = 2;
			deduct = 2;
		}else if(screen_width < 802 && screen_width >770){
			length = 1;
			deduct = 1;
		}else if(screen_width < 770 && screen_width > 362){
			length = 2;
			deduct = 2;
		}else if(screen_width < 363 && screen_width > 200){
			length = 1;
			deduct = 1;
		}else{
			length = 4;
			deduct = 4;
		}

		' . (!empty($softpanel->pheader) ? 'length = 2;deduct = 2;' : '') . '

		' . (empty($user['pfxapi_key']) ? 'var api_key = 0;' : 'var api_key = 1;') . '
		' . (empty($globals['eu_themes_premium']) ? 'var premium = 0;' : 'var premium = "' . $globals['eu_themes_premium'] . '";') . '

		function sleep(milliseconds) {
		  var start = new Date().getTime();
		  for (var i = 0; i < 1e7; i++) {
			if ((new Date().getTime() - start) > milliseconds){
			  break;
			}
		  }
		}

		if(api_key == 0){
		 $.ajax({
			type: "POST",
			data: "generate_apikey=1&ajax=1",
			url: "' . $globals['index'] . 'act=my_themes&jsnohf=1",
			// Checking for error
			success: function(data){
				// Do nothing :)
			}
		 });
		}

		function show_pfx_div(){
			var current_html = $("#pfx_div").html();
			if(current_html == ""){
				$("#pfx_div").html(pfx_div);
				$("#pfx_div").show();
				theme_init();
			}
		}

		function show_pay(){
			
			//alert(arguments[0] +" -- "+arguments[1]+" -- "+arguments[2]+" -- "+arguments[3]);
			//alert($("#paypal_js").attr("src"))
			
			$("#display_theme").fadeOut(100);
			$("#loading").show();
			
			// We will have to create an order now
			$.ajax({
				type: "GET",
				url: window.location+"&generate_order=1&ajax=1&jsnohf=1&theme_id="+arguments[1],
				success: function(data){
					//alert(data)
					var order_id = $.parseJSON(data);
					$("#custom").val(order_id);
					$("#loading").hide();
					$("#display_theme").fadeIn(100);
					//$("#pfxpay").bPopup();			
				}	
			});
			
			$.getScript("https://www.paypalobjects.com/js/external/dg.js", function( data, textStatus, jqxhr ) {
				//alert(data +" -- "+textStatus+" -- "+jqxhr)
				
				if(textStatus == "success"){
					dg = new PAYPAL.apps.DGFlow({
						// HTML ID of form submit buttons that call setEC
						trigger:"submit_pay",
						expType:"instant"
					});
				}
			});
			
			// Now set the variable for sending the data
			$("#item_name").val(arguments[0]);
			$("#item_number").val(arguments[1]);
			$("#amount").val(arguments[2]);
			$("#item_price").html(arguments[2]);
			select_theme(arguments[3]);
			
			$("#submit_pay").click(function(){
				
				/*var timer = setInterval(function() {   
					if(dg.isOpen() !== true) {  
						clearInterval(timer);  
						alert("closed");
					}  
				}, 30000);*/
				$("#pfxpay").bPopup().close();
			});
			
			$(".b-close").click(function(){
				
			});
		}

		function show_selected_theme(){
			
			var th_name = $("#theme_name").val();
			var th_id = $("#theme_id").val();
			
			//alert("' . $globals['s2api_pfx'] . 'theme_search.php?in=json&cversion=' . $software['ver'] . '&cat=' . (!is_int($software['has_theme']) ? $software['has_theme'] : $iscripts[$soft]['name']) . '&q="+th_name+"&start=0&length=1&premium="+premium+"&callback=?")
			
			$.getJSON("' . $globals['s2api_pfx'] . 'theme_search.php?in=json&cversion=' . $software['ver'] . '&cat=' . (!is_int($software['has_theme']) ? $software['has_theme'] : $iscripts[$soft]['name']) . '&q="+th_name+"&start=0&length=1&premium="+premium+"&callback=?",
				function (data) {
					
					var soft_themes = \'<div id="slider"><div class="row">\';
					var new_li = 0;
					$.each(data.data, function (i, item) {
						
						if(item.name != undefined){
							soft_themes += \'<div class="row"><div class="sai_image_container" id="img_\'+new_li+\'" onmouseover="onthemeover(\'+new_li+\');" onmouseout="onthemeout(\'+new_li+\');" value="\'+item.pid+\'" theme_name="\'+item.softname+\'"><div class="sai_theme_header">\'+item.name+\'</div><img src="\'+data.img_url+item.pid+\'/\'+item.pid+\'_200.png" width="100%" height="100" class="img-responsive"><div class="sai_navigation" id="nav_\'+new_li+\'" style="display:none;"><span class="sai_demo"><a href="\'+item.demo_url+\'" target="_blank">' . addslashes($l['demo']) . '</a></span></div></div></div>\';
							soft_themes += \'</div><div class="row"><input type="hidden" name="theme_id" id="theme_id" value="\'+item.pid+\'"><input type="hidden" name="theme_name" id="theme_name" value="\'+item.softname+\'"></div></div>\';
						}
						new_li += 1;
					});// end of each loop
			
					
					$("#display_theme").html(soft_themes);
					$(".sai_image_container").removeClass("sai_theme_selected");
					$(".sai_image_container").addClass("sai_theme_selected");
					$(function(){
						$(".sai_image_container, #select_this_theme").click(function(){
							$(".sai_image_container").removeClass("sai_theme_selected");
							if(this.id == "select_this_theme"){
								$("#"+$(this).attr("val")).addClass("sai_theme_selected");
								$("#theme_id").val($("#"+$(this).attr("val")).attr("value"));
								$("#theme_name").val($("#"+$(this).attr("val")).attr("theme_name"));
							}else{
								$(this).addClass("sai_theme_selected");
								$("#theme_id").val($(this).attr("value"));
								$("#theme_name").val($(this).attr("theme_name"));
							}						
						 })
					});
					
					$("#themesearch").bPopup().close();
				});
		}

		function clear_theme(){
			$(".sai_image_container").removeClass("sai_theme_selected");
			$("#theme_id").val("");
			$("#theme_name").val("");
			$("#clear_theme").hide();
			show_list($("#prevBtn").val(), length);
		}

		function onthemeover(id_no){
			$("#nav_"+id_no).show();
		}

		function onthemeout(id_no){
			$("#nav_"+id_no).hide();
		}

		var startpt;
		function search() {
			
			var query_value = $("input#themesearchstring").val();
			$("b#search-string").html(query_value);
			
			if(startpt == undefined || startpt == ""){
				startpt = 0;
			}
			var top = 0;
			if(query_value === ""){
				top = 1;
			}
			
			$.getJSON("' . $globals['s2api_pfx'] . 'theme_search.php?in=json&cversion=' . $software['ver'] . '&cat=' . (!is_int($software['has_theme']) ? $software['has_theme'] : $iscripts[$soft]['name']) . '&start="+startpt+"&length=20&q="+query_value+"&top="+top+"&premium="+premium+"&callback=?",
			function (data) {
				var search_themes = \'<div id="slider"><table border="0" width="100%" height="200" cellspacing="5" cellpadding="3">\';
				var new_li = 0;
				$.each(data.data, function (i, item) {
					var you_own = "";
					if(item.name != undefined){
					
						var params = new Array();
						params[0] = "\'"+item.name+" - "+item.desc+"\'";
						params[1] = item.pid;
						params[2] = item.price;
						params[3] = "\'simg_"+new_li+"\'";
						
						//alert(item.pid+" -- "+ owned_theme+ " -- "+ $.inArray(item.pid, owned_theme) + " -- "+val_count(owned_theme, item.pid))
						if($.inArray(item.pid, owned_theme) !== -1){
							you_own = \'<img src="' . $theme['images'] . 'success.png" class="someclass" title="' . addslashes($l['your_purchased']) . '(\'+val_count(owned_theme, item.pid)+\')' . addslashes($l['your_purchased_times']) . '" alt="" height="22" width="22">\';
						}else{
							you_own = "&nbsp;";
						}
						
						if(item.price > 0){
							var price_lable = \'<td align="center" width="200"><table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td width="30%"><div class="sai_searchbox_button" onclick="show_pay(\'+params+\');"><span style="margin-right:20px">\'+you_own+\'</span><a href="javascript:void(0);" >' . addslashes($l['purchase']) . '&nbsp;&nbsp;$\'+item.price+\'</a></div></td></tr></table></td>\';
						}else{
							var price_lable = \'<td align="center" width="20">&nbsp</td>\';
						}
						
						search_themes += \'<tr class="sai_tr_color"><td align="center" style="padding-left:10px;"><table border="0" width="100%" cellspacing="0" cellpadding="3"><tr><td width="180"><div class="sai_image_container" id="simg_\'+new_li+\'" value="\'+item.pid+\'" theme_name="\'+item.softname+\'" style="width:160px;height:175px;"><img src="\'+data.img_url+item.pid+\'/\'+item.pid+\'_200.png" width="150" height="150" ><div class="sai_navigation" id="snav_\'+new_li+\'" style="display:none;"><span class="sai_demo"><a href="\'+item.demo_url+\'" target="_blank">' . addslashes($l['demo']) . '</a></span></div></div></td><td><table border="0" cellpadding="5" cellspacing="0" width="100%"><tr><td colspan="3"><b>\'+item.name+\'</b></td></tr><tr><td colspan="3" class="sai_search_description">\'+item.desc+\'</td></tr><tr><td colspan="3" class="sai_search_description">\'+item.overview+\'</td></tr><tr><td width="200"><div class="sai_searchbox_button" id="select_this_theme" val="simg_\'+new_li+\'">' . addslashes($l['use_this_theme']) . '</div></td><td width="200"><a href="\'+item.demo_url+\'" target="_blank" style="text-decoration:none;"><div class="sai_searchbox_button">' . addslashes($l['demo']) . '</div></a></td>\'+price_lable+\'</tr></table></td><td></td></tr><br /></table></td></tr>\';
					}
					new_li += 1;
				});// end of each loop

				search_themes += \'<tr><td><input type="hidden" name="theme_id" id="theme_id"><input type="hidden" name="theme_name" id="theme_name"></td></tr></table></div>\';
				$("#searchsuggestions").animate(0, "", function(){
					$("#searchsuggestions").html(search_themes);
						$(function(){
							$(".sai_image_container, #select_this_theme").click(function(){
								$(".sai_image_container").removeClass("sai_theme_selected");
								if(this.id == "select_this_theme"){
									$("#"+$(this).attr("val")).addClass("sai_theme_selected");
									$("#theme_id").val($("#"+$(this).attr("val")).attr("value"));
									$("#theme_name").val($("#"+$(this).attr("val")).attr("theme_name"));
									show_selected_theme();
									$("#clear_theme").css("display", "block");
								}else{
									$(this).addClass("sai_theme_selected");
									$("#theme_id").val($(this).attr("value"));
									$("#theme_name").val($(this).attr("theme_name"));
								}						
							 })
						});
				}).delay(0).animate({opacity: 1}, 300);
				
			}); // End of getJSON
		}

		var search_timer;

		$("#themesearchstring").live("keyup", function(e) {
			
			//clearTimeout($.data(this, "timer"));
			var search_string = $(this).val();
			clearTimeout(search_timer);

			if (search_string == "") {
				$("ul#results").fadeOut();
				$("h4#results-text").fadeOut();
				$("#searchsuggestions").html("");
			}else{
				$("ul#results").fadeIn();
				$("h4#results-text").fadeIn();
				search_timer = setTimeout("search();", 200);
			};
		});

		function in_array(val, array){
																
			for (i=0; i <= array.length; i++){
				if (array[i] == val) {
					return true;
					// {alert(i +" -- "+ids[i]+" -- "+val);return i;}
				}
			}
			return false;
		}

		//function to display list of Themes
		function show_list(start, length){
			
			//alert("' . $globals['s2api_pfx'] . 'category.php?in=json&cversion=' . $software['ver'] . '&cat=' . (!is_int($software['has_theme']) ? $software['has_theme'] : $iscripts[$soft]['name']) . '&start="+start+"&length="+length+"&premium="+premium+"&callback=?");
			$.getJSON("' . $globals['s2api_pfx'] . 'category.php?in=json&cversion=' . $software['ver'] . '&cat=' . (!is_int($software['has_theme']) ? $software['has_theme'] : $iscripts[$soft]['name']) . '&start="+start+"&length="+length+"&premium="+premium+"&callback=?", 
			function (data) {
				
				if (typeof(data.data)!="object" || typeof data.data == "undefined"){
					$("#display_theme").html("<center><span class=\'sai_newhead\'>' . $l['classes_con_failed'] . '</span></center>");	
					$("#loading").hide();
					$("#display_theme").fadeIn(300);
					$("#nextBtn").css("display", "none");
					$("#prevBtn").css("display", "none");
				}
				$("#clear_theme").css("display", "none");
				$("#nextBtn").css("display", "block");
				$("#prevBtn").css("display", "block");
				
				var soft_themes = \'<div id="slider"><table border="0" width="100%" height="200" cellspacing="0" cellpadding="3"><tr>\';
				var new_li = 0;
				
				$.each(data.data, function (i, item) {
					
					soft_themes += \'<td align="center"><div class="sai_image_container" id="img_\'+new_li+\'" onmouseover="onthemeover(\'+new_li+\');" onmouseout="onthemeout(\'+new_li+\');" value="\'+item.pid+\'" theme_name="\'+item.softname+\'"><div class="sai_theme_header">\'+item.name+\'</div><img src="\'+data.img_url+item.pid+\'/\'+item.pid+\'_200.png" width="230" height="200" ><div class="sai_navigation" id="nav_\'+new_li+\'" style="display:none;"><span class="sai_demo"><a href="\'+item.demo_url+\'" target="_blank">' . addslashes($l['demo']) . '</a></span></div></div></td>\';
					
					new_li += 1;
					
				});// end of each loop
				
				soft_themes += \'</tr><tr>\';
				var new_li = 0;
				
				$.each(data.data, function (i, item) {
					var you_own = "";
					if(item.name != undefined){
						var params = new Array();
						params[0] = "\'"+item.name+" - "+item.desc+"\'";
						params[1] = item.pid;
						params[2] = item.price;
						params[3] = "\'img_"+new_li+"\'";
						
						//alert(item.pid+" -- "+ owned_theme+ " -- "+ $.inArray(item.pid, owned_theme) + " -- "+val_count(owned_theme, item.pid))
						
						if($.inArray(item.pid, owned_theme) !== -1){
							you_own = \'<img src="' . $theme['images'] . 'success.png" class="someclass" title="' . addslashes($l['your_purchased']) . '(\'+val_count(owned_theme, item.pid)+\')' . addslashes($l['your_purchased_times']) . '" alt="" height="24" width="24">\';
						}else{
							you_own = "&nbsp;";
						}
						
						if(item.price > 0){
							soft_themes += \'<td align="center"><div class="sai_purchased blue" onclick="show_pay(\'+params+\');" data-toggle="modal" data-target="#pfxpay"><table border="0" width="95%"><tr><td width="25%">\'+you_own+\'</td><td width="60%"><a href="javascript:void(0);" >' . addslashes($l['purchase']) . '&nbsp;&nbsp;$\'+item.price+\'</a></td></tr></table></div><br /></td>\';
						}else{
							soft_themes += \'<td align="center"><div class="sai_purchased blue"><table border="0" width="95%"><tr><td align="center" onclick="select_theme(\\\'img_\'+new_li+\'\\\');"><a href="javascript:void(0);"   id="select_theme">' . (!empty($globals['eu_themes_premium']) ? addslashes($l['free']) : addslashes($l['select'])) . '</a></td></tr></table></div><br /></td>\';
						}
					}
					new_li += 1;
				});// end of each loop

				soft_themes += \'</tr><tr><td><input type="hidden" name="theme_id" id="theme_id"><input type="hidden" name="theme_name" id="theme_name"></td></tr></table></div>\';
				
				$("#loading").hide();
				
				$("#display_theme").animate(0, "", function(){
					$("#display_theme").html(soft_themes);
					$(function(){
						$(".sai_image_container").click(function(){
							$(".sai_image_container").removeClass("sai_theme_selected");
							$(this).addClass("sai_theme_selected");
							$("#theme_id").val($(this).attr("value"));
							$("#theme_name").val($(this).attr("theme_name"));
							$("#clear_theme").css("display", "block");
						 })
					});
				}).delay(0).animate({opacity: 1}, 300);
				
				
				
				$("#prevBtn").val(start);
				start = parseInt(start) + length;
				$("#nextBtn").val(start);
				
				if($("#prevBtn").val() <= 0){
					$("#prevBtn").css("display", "none");
				}else{
					$("#prevBtn").css("display", "block");
				}
				
				if(start == (data.count)){
					$("#nextBtn").css("display", "none");
				}
				
				// If we get the last data
				if(data.is_last == 1){
					$("#nextBtn").css("display", "none");
					$("#nextBtn").hide();
				}
				
				$("#display_theme").fadeIn(300);
				
				
			}); // end of get json function
			
			// If we dont get the api key for this user we will generate one !
			if(api_key == 0){
				
				/* $.ajax({
					type: "POST",
					data: "generate_apikey=1",
					url: "' . $globals['index'] . 'act=my_themes&jsnohf=1",
					// Checking for error
					success: function(data){
						// At the moment nothing to do !
					}
				 });*/
			}
		}//end of show list

		function get_purchased(){
			
			$("#refresh_theme").hide();
			$("#sloading").show();
			
			$.ajax({
				type: "POST",
				data: "get_owned_theme=1&ajax=1",
				url: "' . $globals['index'] . 'act=my_themes&jsnohf=1",
				// Checking for error
				success: function(data){
					owned_theme = data.split(",");
					//alert(owned_theme)
					$("#sloading").hide();
					$("#refresh_theme").show();
					show_list(0, length);
				}
			 });
		}

		function select_theme(id){
			$(".sai_image_container").removeClass("sai_theme_selected");
			$("#"+id).addClass("sai_theme_selected");
			$("#theme_id").val($("#"+id).attr("value"));
			$("#theme_name").val($("#"+id).attr("theme_name"));
			$("#clear_theme").css("display", "block");
		}

		function theme_init(){
			
			//get_purchased();
			
			show_list(0, length);
			
			$("#prevBtn").click(function(){
				var tmp = parseInt($("#prevBtn").val());
				$("#nextBtn").val(tmp);
				tmp = tmp - deduct;
				$("#prevBtn").val(tmp);
				$("#display_theme").fadeOut(100);
				$("#loading").show();
				show_list($("#prevBtn").val(), length);
			});
			
			$("#nextBtn").click(function(){
				var tmp = parseInt($("#nextBtn").val());
				$("#prevBtn").val(tmp);
				tmp = tmp + deduct;
				$("#nextBtn").val(tmp);
				$("#display_theme").fadeOut(100);
				$("#loading").show();
				show_list($("#prevBtn").val(), length);
			});
			
			$("#search_theme").click(function(){
				$("#themesearch").bPopup();
				search();
			});
			$(".b-close").click(function(){
				$("#themesearchstring").val("");
			});
			
			$("#refresh_theme").click(function(){
				get_purchased();
			});
			
			$(".someclass").tipTip();
		}

		$(document).ready(function(){

			if($("#install_win").is(":visible")){
				show_pfx_div();
			}
		});

		$("#install").click(function(){
			show_pfx_div();
		});

		// ]]></script>
	';
        }
        $info['install'] .= '
	<p align="center">
		<input type="hidden" name="softsubmit" id="softsubmit" value="' . $l['softsubmit'] . '" />
		<input type="hidden" name="pass-strength-hidden" id="pass-strength-hidden" value="" />
		<input type="submit" name="softsubmitbut" id="softsubmitbut" value="' . $l['softsubmit'] . '" class="flat-butt" /><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">' . $l['ins_emailto'] . '</span> : <input type="text" name="emailto" id="emailto" size="20" value="' . POSTval('emailto', '') . '" />' : '') . '
	</p>
	<input type="hidden" name="soft_status_key" id="soft_status_key" value="' . POSTval('soft_status_key', generateRandStr(32)) . '" />
	</form></div>
';
        if (!empty($globals['eu_enable_themes']) && !empty($software['has_theme'])) {
            $info['install'] .= '
		<div class="modal fade" id="pfxpay" role="dialog">
			<div class="modal-dialog modal-sm">
				<!-- Modal content-->
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">&times;</button>
						<h4 class="modal-title">' . $l['payment_heading'] . '</h4>
					</div>
					<div class="modal-body" align="middle">
						<form action="' . $globals['paypal_url'] . '" method="post" name="pay" id="pay">
							' . $l['payment_redirect'] . '$<span id="item_price"></span><br /><br />
							<input type="hidden" name="cmd" value="_xclick">
							<input type="hidden" name="business" id="business" value="' . $globals['paypal_business'] . '">
							<input type="hidden" name="return" id="return" value="' . $globals['paypal_return'] . '">
							<input type="hidden" name="cancel_return" id="cancel_return" value="' . $globals['paypal_return'] . '">
							<input type="hidden" name="notify_url" id="notify_url" value="' . $globals['paypal_return'] . '">
							<input type="hidden" name="item_name" id="item_name" value="">
							<input type="hidden" name="item_number" id="item_number" value="">
							<input type="hidden" name="amount" id="amount" value="">
							<input type="hidden" name="custom" id="custom" value="">
							<input type="hidden" name="paymentaction" id="paymentaction" value="sale">
							<!--<input type="submit" class="tiny radius button" value="Buy now">-->
							<button type="submit" name="submit" style="border: 0; background: transparent; cursor:pointer" id="submit_pay">
								<img src="https://www.paypal.com/en_US/i/bnr/horizontal_solution_PPeCheck.gif" border="0" alt="Accepted Cards" style="width:100%;">
							</button>
						</form>
					</div>
					<div class="modal-footer">
					  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					</div>
				</div>	
			</div>
		</div>';
        }
        $info['install'] .= '
	<div id="progress_bar" style="height:125px; width:100%; display: none;">
		<br />
		<center>
		<font size="4" color="#222222" id="progress_txt" style="width:100%;">' . $l['checking_data'] . '</font>
		<font style="font-size: 18px;font-weight: 400;color: #444444; 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>' . $l['wait_note'] . '</center>
	</div>
	<br /><br /><br />';
    } elseif (!empty($installed)) {
        $info['install'] = '
	<div class="bg2">
	<h4>' . $l['congrats'] . '</h4><br />
	' . $software['name'] . ' ' . $l['succesful'] . ' : <br />
	<a href="' . $__settings['softurl'] . '" target="_blank">' . $__settings['softurl'] . '</a>
	' . (!empty($software['adminurl']) ? '<br />' . $l['admin_url'] . ' : <a href="' . $__settings['softurl'] . '/' . $software['adminurl'] . '" target="_blank">' . $__settings['softurl'] . '/' . $software['adminurl'] . '</a>' : '') . '<br /><br />
	' . (!empty($setupcontinue) ? $l['setup_continue'] . ' : <br />
	<a href="' . $__settings['softurl'] . '/' . $setupcontinue . '" target="_blank">' . $__settings['softurl'] . '/' . $setupcontinue . '</a><br /><br />' : '') . '
	' . $l['enjoy'] . '<br /><br />
	' . (!empty($pfx_error) ? error_handle($pfx_error, "100%", 0, 1) : '') . (!empty($notes) ? $l['install_notes'] . ' : <br />
	<div class="sai_notes">' . softparse($notes, $soft) . '</div><br /><br />' : '') . '
	' . $l['please_note'] . '<br /><br />
	' . (!empty($globals['ampps_enabled']) && empty($globals['no_ampps']) && $globals['softpanel'] != 'ampps' ? lang_vars($l['ampps_download'], array($software['name'])) . '<br /><br />' : '') . '
	' . $l['regards'] . ',<br />
	' . $l['softinstaller'] . '<br /><br />
	<center><b><a href="' . script_link($soft) . '&highlight=' . $new_insid . '&postact=install">' . $l['return'] . '</a></b></center><br /><br />';
        if (empty($globals['install_tweet_off']) || empty($globals['lictype'])) {
            $info['install'] .= '<form method="get" action="http://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
		<div class="panel panel-info" style="width:55%; margin:0 auto;">
			<div class="panel-heading" style="padding:5px; font-size:15px;">
				<font><b>' . $l['install_tweet_sub'] . ' :</b></font>
			</div>
			<div class="panel-body">
				<div class="row">
					<div class="col-sm-10">
						<textarea name="text" cols="80" row="3" style="resize:none; width:100%;">' . loadtweetdata('install_tweet', $l['install_tweet_classes']) . '</textarea>
					</div>
					<div class="col-sm-2">
						<input type="submit" value="Tweet!" class="btn btn-info" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/>
					</div>
				</div>
			</div>
		</div>
		</form>';
        }
        $info['install'] .= '<br /></div><!--end of bg2 class--><!--PROC_DONE-->
	<br /><br />';
    }
    softheader($l['<title>'] . $software['name']);
    $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 = "https://www.softaculous.com/ratings.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
    }
    if (empty($globals['off_review_link']) && $soft < 10000) {
        echo '$_(\'review_js_file\').src =  "https://www.softaculous.com/review.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
        echo '$_(\'reviews_js_file\').src =  "https://www.softaculous.com/reviews.js?soft=' . $soft . '&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 $l['notifyversion'];
    ?>
');
	}
};

function loadScreenshots(){
	$_('screenshots_iframe').src = '<?php 
    echo 'https://www.softaculous.com/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) {
            $tmp_ver1[] = $vver['ver'];
        }
        $tmp_ver = implode(', ', $tmp_ver1);
    }
    $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] = '<img src="' . $url . 'star.png' . '" alt="(' . number_format($scripts[$soft]['ratings'], 2) . ' out of 5)" />';
        } elseif ($r > 0) {
            $ratings[$i_r] = '<img src="' . $url . 'halfstar.png' . '" alt="(' . number_format($scripts[$soft]['ratings'], 2) . ' out of 5)" />';
        } else {
            $ratings[$i_r] = '<img src="' . $url . 'nostar.png' . '" alt="(' . number_format($scripts[$soft]['ratings'], 2) . ' out of 5)" />';
        }
        $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" style="margin-left:10px;">
		' . (!empty($custom_48) ? '<img src="' . $custom_48 . '" alt="">' : '<img src="' . $globals['mirror_images'] . 'top15/48/' . $scripts[$soft]['softname'] . '.png" >') . '
			<span class="sai_process_heading" style="margin-left:20px;">' . $software['name'] . '</span>
	</div><br />
	<div class="row">
		<div class="col-sm-2">
			' . ($soft > 10000 ? '' : '<div class="someclass" title="' . $scripts[$soft]['ratings'] . '">' . implode('', $ratings) . '</div>') . '
		</div>
		<div class="col-sm-5 ver_style">
			' . $l['software_ver'] . ' : <font size="2"><b>' . (!empty($tmp_ver) ? $tmp_ver : $software['ver']) . '</b></font> &nbsp; &nbsp; <a href="javascript" onclick="notifyversion(); return false;" ><img src="' . $theme['images'] . 'notify.gif" name="notifyver" title="' . $l['notify_ver'] . '" alt="' . $l['notify_ver'] . '"></a>
		</div>
		<div class="col-sm-3 release_style">
			' . (!empty($info['release_date']) ? $l['release_date'] . ' : <font size="1"><b>' . $info['release_date'] . '</b></font>' : '') . '
		</div>
		<div class="col-sm-2 change_style">
			' . (!empty($info['changelog']) ? '&nbsp;&nbsp;<a href="javascript" data-toggle="modal" data-target="#changelog_div" class="sai_changelogbut pull-right" style="text-decoration:none;">' . $l['changelog'] . '</a>' : '') . '
		</div>
	</div><br />
	
	<script type=text/javascript>';
    if (!empty($softpanel->pheader)) {
        if (substr_count($_SERVER['REQUEST_URI'], 'x3') > 0) {
            echo '
			$(document).ready(function(){
				$(".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">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="sai_tabs">
			<tr>
				<td><a href="javascript:tabs.tab(\'install\')" id="install" class="sai_insbut">' . $l['install'] . '</a></td>
				<td><a href="javascript:tabs.tab(\'overview\')" class="sai_tab" id="overview">' . $l['overview'] . '</a></td>
				<td><a href="javascript:tabs.tab(\'features\')" class="sai_tab" id="features">' . $l['features'] . '</a></td>
					' . (empty($globals['off_screenshot_link']) ? '<td><a href="javascript:tabs.tab(\'screenshots\'); loadScreenshots();" class="sai_tab" id="screenshots">' . $l['screenshots'] . '</a></td>' : '') . '
					' . (empty($globals['off_demo_link']) ? '<td><a href="' . ($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'] . 'act=demos&soft=' . $soft) . '" class="sai_tab" id="demo" target="_blank">' . $l['demo'] . '</a></td>' : '') . '
					' . (empty($globals['off_rating_link']) && $soft < 10000 ? '<td><a href="javascript:tabs.tab(\'ratings\')" class="sai_tab" id="ratings">' . $l['ratings'] . '</a></td>' : '') . '
					' . (empty($globals['off_review_link']) && $soft < 10000 ? '<td><a href="javascript:tabs.tab(\'reviews\')" class="sai_tab" id="reviews">' . $l['reviews'] . '</a></td>' : '') . (empty($info['import']) ? '' : '<td><a href="' . $globals['ind'] . 'act=import&soft=' . $soft . '" class="sai_tab" id="ratings">' . $l['import'] . '</a></td>') . '
			</tr>
		</table><br />
	</div>
	<div class="new_tab">
		<nav class="navbar navbar-default">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>                        
				</button>
				<ul class="nav">
					<li class="active" style="width:80px;"><a href="javascript:tabs.tab(\'install\')" id="install" class="sai_tab2" style="text-decoration:none; height:40px; top:5px;" data-toggle="collapse" data-target="#myNavbar">' . $l['install'] . '</a></li>
				</ul>
			</div>
			<div class="collapse navbar-collapse" id="myNavbar" style="position:absolute; z-index:1000; width:100%; background:#F8F8F8;">
				<ul class="nav navbar-nav">
					<li><a href="javascript:tabs.tab(\'overview\')"  id="overview" class="sai_tab2" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['overview'] . '</a></li>
					<li><a href="javascript:tabs.tab(\'features\')"  id="features" class="sai_tab2" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['features'] . '</a></li>
					<li>' . (empty($globals['off_screenshot_link']) ? '<a href="javascript:tabs.tab(\'screenshots\'); loadScreenshots();" class="sai_tab2" id="screenshots" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['screenshots'] . '</a>' : '') . '</li>
					<li>' . (empty($globals['off_demo_link']) ? '<a href="' . ($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'] . 'act=demos&soft=' . $soft) . '" class="sai_tab2" id="demo" target="_blank" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['demo'] . '</a>' : '') . '</li>
					<li>' . (empty($globals['off_rating_link']) && $soft < 10000 ? '<a href="javascript:tabs.tab(\'ratings\')" class="sai_tab2" id="ratings" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['ratings'] . '</a>' : '') . '</li>
					<li>' . (empty($globals['off_review_link']) && $soft < 10000 ? '<a href="javascript:tabs.tab(\'reviews\')" class="sai_tab2" id="reviews" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['reviews'] . '</a>' : '') . '</li>
					<li>' . (empty($info['import']) ? '' : '<a href="' . $globals['ind'] . 'act=import&soft=' . $soft . '" class="sai_tab2" id="ratings" style="text-decoration:none;" data-toggle="collapse" data-target="#myNavbar">' . $l['import'] . '</a>') . '</li>
				</ul>
			</div>
		</nav>
	</div>

<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>';
    //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" style="margin-top:80px;">
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header" style="background:#F0F0F0;">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Changelog</h4>
        </div>
        <div class="modal-body" style="height: 350px; overflow-y: auto;">
          ' . $info['changelog'] . '
        </div>
        <div class="modal-footer" style="padding-top:10px; height:50px;">
          <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($scripts[$soft]['screenshots']) && empty($globals['panel_hf']) ? '
		<div class="col-sm-6">
			<div id="overview_img" style="padding:10px;" style="width:100%;"> <img src="' . $globals['mirror_images'] . 'softimages/screenshots/' . $soft . '_screenshot1.gif" class="img-responsive" alt=""> </div>	
		</div>
		<div class="col-sm-6 col-xs-6">' : '<div class="col-sm-12 col-xs-12">') . '
			' . softparse($info['overview'], $soft) . '<br /><br />
			<div class="row">
				<div class="col-sm-1 col-xs-1"><font color="#447edf"><i class="fa sai-disk fa-3x"></i></font></div>
				<div class="col-sm-5 col-xs-5">
					<span class="sai_head">' . $l['space_req'] . '</span><br />
					<span class="sai_exp2">' . $l['available_space'] . ' : ' . (is_numeric($softpanel->spaceremain) ? number_format($softpanel->spaceremain / 1024 / 1024, 2) : $softpanel->spaceremain) . ' ' . $l['mb'] . '<br />
					' . $l['req_space'] . ' : ' . number_format($software['spacereq'] / 1024 / 1024, 2) . ' ' . $l['mb'] . '</span>
				</div>
			</div><br />
			<div class="row">
				<div class="col-sm-1 col-xs-1"><a href="' . $info['support'] . '"><font color="#447edf"><i class="fa sai-question fa-3x"></i></font></a></div>
				<div class="col-sm-5 col-xs-5">
					<span class="sai_head">' . $l['software_support'] . '</span><br />
					<span class="sai_exp2"><a href="' . $info['support'] . '" target="_blank">' . $l['support_link'] . '</a><br />
					' . $l['support_note'] . '</span>
				</div>
			</div>	
		</div>
	</div><br />
</div><!--end of bg2 class-->';
    if (!empty($installations[$soft]) || array_intersect(array_keys($installations), array_keys($software['branch']))) {
        $info['overview'] .= '<br /><br />
	<center>
		<span class="sai_newhead">' . $l['current_ins'] . '</span><br />
	</center><hr>';
        $info['overview'] .= '
	<div class="bg2">
		<table class="table table-hover">
		<thead  style="background:#EFEFEF;" class="sai_head2">
			<tr>
				<th>' . $l['link'] . '</th>
				<th>' . $l['admin'] . '</th>
				<th>' . $l['ins_time'] . '</th>
				<th>' . $l['version'] . '</th>
				<th width="50" colspan="5" style="text-align:center;">' . $l['options'] . '</th>
				<th><input type="checkbox" id="check_all"></th>
			</tr>
		</thead>';
        $i = 1;
        $highlight = optGET('highlight');
        $action = optGET('postact');
        //r_print($software['branch']);
        //r_print($no_autoupgrade);
        foreach ($software['branch'] as $csid => $cver) {
            $is_cloneable = is_cloneable($csid);
            // We use this count to create empty <td> for features not available for this app
            $ccount = 0;
            if (empty($is_cloneable)) {
                $ccount++;
            }
            if (!empty($globals['disable_backup_restore'])) {
                $ccount++;
            }
            if (!asperapp(0, 0, 1) || empty($can_publish)) {
                $ccount++;
            }
            //Child List of Installations
            foreach ($installations[$csid] as $ik => $iv) {
                $is_upgradable = is_upgradable($ik);
                $info['overview'] .= '<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">&nbsp;&nbsp;<b class="sai_highlight">' . $l['act_' . $action] . '</b></span>' : '') . '</td>
				<td><a href="' . $iv['softurl'] . '/' . (!empty($iv['admin_folder']) ? $iv['admin_folder'] : admin_folder($iv['sid'])) . '" target="_blank"><img src="' . $theme['images'] . '/admin.gif" /></a></td>
				<td>' . datify($iv['itime']) . '</td>
				<td>' . $iv['ver'] . ($software['ver'] != $iv['ver'] && $is_upgradable ? ' <a href="' . $globals['ind'] . 'act=upgrade&insid=' . $ik . '"><img src="' . $theme['images'] . 'updates.gif" alt="' . $l['upd_to'] . ' ' . implode(' or ', $is_upgradable) . '" title="' . $l['upd_to'] . ' ' . implode(' or ', $is_upgradable) . '" class="someclass"/></a>' : '') . (!empty($iv['eu_auto_upgrade']) && empty($no_autoupgrade['disable_autoupgrade']) && empty($no_autoupgrade['scripts'][$csid]) ? '<img src="' . $theme['images'] . 'auto_upgrade.png"  title="' . $l['auto_upgrade_enabled'] . '" style="cursor:pointer"/>' : '') . '</td>' . (!empty($is_cloneable) ? '<td width="25" class="someclass" title="' . $l['clone'] . '"><a href="' . $globals['ind'] . 'act=sclone&insid=' . $ik . '" ><img src="' . $theme['images'] . 'clone.gif" /></td></a>&nbsp;' : '') . (empty($globals['disable_backup_restore']) ? '<td width="25" title="' . $l['backup'] . '" class="someclass"><a href="' . $globals['ind'] . 'act=backup&insid=' . $ik . '"><img src="' . $theme['images'] . 'backup.gif" /></td></a>' : '') . '
				&nbsp;<td width="25" title="' . $l['editdetail'] . '" class="someclass"><a href="' . $globals['ind'] . 'act=editdetail&insid=' . $ik . '"><img src="' . $theme['images'] . 'editdetail.gif" /></td></a>
				' . (asperapp(0, 0, 1) && !empty($can_publish) ? ' &nbsp;<td><a href="' . $globals['ind'] . 'act=publish&insid=' . $ik . '" title="' . $l['publish'] . '"><img src="' . $theme['images'] . 'publish.gif" /></td></a>' : '') . ' 
				&nbsp;<td width="25" title="' . $l['remove'] . '" class="someclass"><a href="' . $globals['ind'] . 'act=remove&insid=' . $ik . '"><img src="' . $theme['images'] . 'remove.gif" /></a></td>' . (!empty($ccount) ? '<td colspan="' . $ccount . '"></td>' : '') . '
				<td width="25">
					<input type="checkbox" name="insids[]" id="' . $iv['softurl'] . '" value="' . $ik . '" class="soft_inslist">
				</td>
				</tr>';
                $i++;
            }
        }
        $info['overview'] .= '</table><br />
		<p align="right" style="width:100%;">
			<span class="sai_head">' . $l['with_selected'] . ':</span>
			<select name="multi_options" id="multi_options">
				<option name="todo" id="todo" value="0">---</option>
				<option name="todo" id="todo" value="mult_rem">' . $l['remove'] . '</option>
			</select>
			<input type="button" value="' . $l['go'] . '" onclick="show_confirm()" class="sai_graybluebut">
			<br />
		</p>
		<div id="rem_div"></div>
	</div><!--end of bg2 class-->
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
insids = new Array();
removed = new Object();

function show_confirm(){
	
	insids = new Array();
	removed = new Object();
	
	if($_("multi_options").value != "mult_rem"){
		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("' . $l['no_sel_inst'] . '");
		return false;
	}
	
	var r = confirm("' . $l['del_insid'] . '");
	if(r != true){
		return false;
	}
	
	remove_by_id(insids[0], "", 0);
}

function remove_by_id(insid, re, oldinsid){

	removed[insid] = false;
	
	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){
		try{		
			AJAX("' . $globals['index'] . 'act=remove&insid="+insid+"&ajax=1&ssk="+randomstring(32)+"&random="+Math.random(), "remove_by_id(\'"+nextinsid+"\', re, \'"+insid+"\')");
			$_("rem_div").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +insid+ ", URL: " + $_("insurl"+insid)+"<br /></p>";
			return true;
		}catch(e){
			return false;
		}
	}
	$_("rem_div").innerHTML = "";
	alert("' . $l['inst_remvd'] . '");
	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);
		});
		
	});';
        // 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') {
        $info['overview'] .= '<br /><br />
	<div class="bg2">
		<table width="100%" class="table table-hover">
			<tr>
				<th style="background:#EFEFEF" class="sai_head2">' . $l['related_scripts'] . '</th>
			</tr>
		</table>';
        $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;
            }
            $info['overview'] .= '
			<div style="text-decoration:none;display:inline-block;text-align:center;margin-top:10px;">
				<a href="' . script_link($k) . '"  title="' . $v['desc'] . '"  width="80" alt="" class="someclass" style="text-decoration:none;margin-top:5px;">
					<div class="sai_blog_script" style="margin-left:11%;">
						<div class="sai_demo_script_logo">
							<img src="' . $globals['mirror_images'] . 'top15/48/' . $v['softname'] . '.png" >	
						</div>
						<div class="sai_script_name">' . $v['name'] . '</div>
					</div>
				</a>
			</div>';
            $i++;
        }
        $info['overview'] .= '</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="bg2"><iframe src="" id="screenshots_iframe" style="width:100%;height:500px;" frameborder="0" scrolling="no"></iframe></div><!--end of bg class-->';
    $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>';
    softfooter();
}
Exemple #6
0
function java_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts, $allcatwise;
    global $software, $soft, $info, $settings, $init_tab, $dbtype, $dbs, $installed, $__settings, $setupcontinue, $installations, $notes, $cron, $datadir, $ajaxdb, $ajaxdbexists, $overwrite_option, $protocols, $nopackage, $www, $ajaxhttpsexists, $ajaxhttps, $new_insid;
    if (optGET('notify')) {
        get_softaculous_file('http://www.softaculous.com/notifyversion.php?softid="' . $soft . '"');
        echo 1;
        return true;
    }
    if (optGET('ajaxdownload') && !empty($nopackage)) {
        // Try to download the package
        if (method_exists($softpanel, 'updatesoftwares')) {
            $softpanel->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;
        }
    }
    //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\\"/ie', $ivv['tag'])) {
                    $random_username = false;
                }
            }
        }
        $info['install'] = '<div id="fadeout_div"><form accept-charset="' . $globals['charset'] . '" name="installsoftware" method="post" action="" onsubmit="return checkform();" id="installsoftware">

' . error_handle($error, "100%", 0, 1) . '

<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

function toggle_advoptions(){
	if ($("#advoptions").is(":hidden")){
		$("#advoptions").slideDown("slow");
		$("#advoptions_toggle_plus").attr("src", "' . $theme['images'] . 'minus_new.gif");
	}
	else{
		$("#advoptions").slideUp("slow");
		$("#advoptions_toggle_plus").attr("src", "' . $theme['images'] . 'plus_new.gif");
	}
}

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

function plus_onmouseout(){
	$("#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 = "' . $l['bad'] . '";
	if(score == "good") lang = "' . $l['good'] . '";
	if(score == "strong") lang = "' . $l['strong'] . '";
	if(score == "short") lang = "' . $l['short'] . '";
	if(score == "strength_indicator") lang = "' . $l['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("' . $l['err_pass_strength'] . '"+' . $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("' . $l['installing'] . '");
	}
	
	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);
			}
		);
		
		$.ajax({
			url: window.location+"&jsnohf=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("' . addslashes($l['finishing_process']) . '");
						progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
					}else{
						progressbar.reset();
					}
				}catch(e){ }
				
				if ( jqXHR.isResolved() ) {
				
					// #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);
						show_backup();
						check_pass_strength();
					}).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("' . $l['downloading'] . '");
		
		try{		
			AJAX("' . $globals['index'] . 'act=java&soft=' . $soft . '&ajaxdownload=1&random="+Math.random(), "get_package_handle(re)");
		}catch(e){ }
		
		return false;
	}else{
		$_("show_txt").style.display = "none";
		return true;
	}
};

function get_package_handle(resp){
	nopackage = 0;
	show_msg("' . $l['installing'] . '");
	checkform(1);
};

softemail = new Object();
function softmail(){
	try{
		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;
	
		$("#checkhttps_wait").css("display","inline-block");
		if(proto.indexOf("https") !== -1){
		
			 $.ajax({
				type: "POST",
				url: "' . $globals['index'] . 'act=java&soft=' . $soft . '&checkhttps="+encodeURIComponent(proto+$_(softdomain_id).value),
				timeout:10000,
				// Checking for error
				success: function(data){
					$("#checkhttps_wait").css("display","none");
					is_https(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 = "' . $l['no_https'] . '";
		}
		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);
	}else{
		$("#auto_backup_rotation").attr("disabled", false);
	}
	
	return true;
};

' . (!empty($_POST) ? '' : 'addonload(\'softmail();show_backup();\');');
        if (!empty($dbtype)) {
            $info['install'] .= 'function checkdbname(id, alrt){
	try{		
		AJAX("' . $globals['index'] . 'act=java&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 > 7){
			dberror = "' . $l['db_name_long'] . '";
		}
		
		//There should be only alphanumeric characters
		if(/[^a-zA-Z0-9]/.test($_(id).value)){
			dberror = "' . $l['db_alpha_num'] . '";
		}
		
		//Check if it exists
		if(re == "true"){
			dberror = "' . $l['database_exists'] . '";
		}
		
		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;
};';
        }
        //End of if($dbtype)
        $info['install'] .= '// ]]></script>';
        if (empty($globals['lictype']) && !empty($scripts[$soft]['force_scripts'])) {
            $info['install'] .= '<center class="sai_anotice">' . lang_vars($l['not_in_free'], array($software['name'])) . (!webuzo() ? '&nbsp;&nbsp;' . $l['notify_admin'] : '') . '</center><br />';
        }
        $info['install'] .= '
<table width="100%" cellpadding="8" cellspacing="0" border="0" class="sai_divroundshad">
<tr>
<td class="sai_heading_full" colspan="2">' . $l['setup'] . '</td>
</tr>';
        if (empty($softpanel->noprotocol) && empty($globals['hide_protocol'])) {
            $info['install'] .= '<tr>
<td>
<span class="sai_head">' . $l['choose_protocol'] . '</span><br />
<span class="sai_exp">' . $l['choose_protocol_exp'] . '</span>
</td>
<td valign="top">
<select name="softproto" id="softproto" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
            foreach ($protocols as $k => $v) {
                $info['install'] .= '<option value="' . $k . '" ' . (!empty($_POST['softproto']) && $_POST['softproto'] == $k ? 'selected="selected"' : '') . '>' . $v . '</option>';
            }
            $info['install'] .= '</select><div style="display:none;" id="checkhttps_wait">&nbsp;&nbsp;<img src="' . $theme['images'] . 'progress.gif" alt="please wait.."></div><br />
<span id="httpserror" style="background: #FDB3B3; display:none; width:200px;"></span>
</td>
</tr>';
        }
        $info['install'] .= '<tr>
<td width="50%">
<span class="sai_head">' . $l['choose_domain'] . '</span><br />
<span class="sai_exp">' . $l['choose_domain_exp'] . '</span>
</td>
<td>
<select name="softdomain" id="softdomain" onchange="softmail();change_admin_prefix(this.value);" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
        if (!empty($globals['blank_domain'])) {
            $info['install'] .= '<option value="" ' . (empty($_POST['softdomain']) ? 'selected="selected"' : '') . '>(' . $l['select_domain'] . ')</option>';
        }
        foreach ($softpanel->webroots as $domain => $dompath) {
            $info['install'] .= '<option value="' . $domain . '" ' . (!empty($_POST['softdomain']) && $_POST['softdomain'] == $domain ? 'selected="selected"' : '') . '>' . $domain . '</option>';
        }
        $info['install'] .= '</select>
</td>
</tr>
<tr>
<td>
<span class="sai_head">' . $l['in_directory'] . '</span><br />
<span class="sai_exp">' . $l['in_directory_exp'] . '</span>
</td>
<td valign="top">
<input type="text" name="softdirectory" id="softdirectory" size="30" value="' . POSTval('softdirectory', !empty($globals['no_prefill']) ? '' : $software['softname']) . '" />
</td>
</tr>';
        // A data Directory ?
        if (!empty($datadir)) {
            $info['install'] .= '<tr>
<td>
<span class="sai_head">' . $l['datadir'] . '</span><br />
<span class="sai_exp">' . $l['datadir_exp'] . '</span>
</td>
<td valign="top">
<input type="text" name="datadir" id="datadir" size="30" value="' . POSTval('datadir', $datadir) . '" />
</td>
</tr>';
        }
        if (!empty($dbtype)) {
            $dbname = mysqldbname($software['softname']);
            if (method_exists($softpanel, 'mysqldbname')) {
                $dbname = $softpanel->mysqldbname();
            }
            if (empty($dbtype) || aefer()) {
                $info['install'] .= '
<tr>
<td>
<span class="sai_head">' . $l['database_name'] . '</span><br />
<span class="sai_exp">' . $l['database_name_exp'] . '</span>
</td>
<td valign="top">
<input type="text" name="softdb" id="softdb" size="30" value="' . POSTval('softdb', $dbname) . '" onblur="checkdbname(\'softdb\', false)" /><br />
<span id="softdberror" style="background: #FDB3B3; display:none; width:200px;"></span>
</td>
</tr>';
            }
        }
        // Are there any cron jobs
        if (!empty($cron)) {
            $info['install'] .= '<tr>
<td>
<span class="sai_head">' . $l['cron_job'] . '</span><br />
<span class="sai_exp">' . $l['cron_job_exp'] . '</span>
</td>
<td valign="top">
	<table width="100%" cellpadding="2" cellspacing="1">
		<tr>
			<td>' . $l['cron_min'] . '</td>
			<td>' . $l['cron_hour'] . '</td>
			<td>' . $l['cron_day'] . '</td>
			<td>' . $l['cron_month'] . '</td>
			<td>' . $l['cron_weekday'] . '</td>
		</tr>
		<tr>
			<td><input type="text" name="cron_min" id="cron_min" size="2" value="' . POSTval('cron_min', $cron['min']) . '" /></td>
			<td><input type="text" name="cron_hour" id="cron_hour" size="2" value="' . POSTval('cron_hour', $cron['hour']) . '" /></td>
			<td><input type="text" name="cron_day" id="cron_day" size="2" value="' . POSTval('cron_day', $cron['day']) . '" /></td>
			<td><input type="text" name="cron_month" id="cron_month" size="2" value="' . POSTval('cron_month', $cron['month']) . '" /></td>
			<td><input type="text" name="cron_weekday" id="cron_weekday" size="2" value="' . POSTval('cron_weekday', $cron['weekday']) . '" /></td>
		</tr>
	</table>
</td>
</tr>';
        }
        if (!empty($overwrite_option)) {
            $info['install'] .= '<tr>
<td>
<span class="sai_head">' . $l['overwrite'] . '</span>
</td>
<td valign="top">
	<input type="checkbox" name="overwrite_existing" id="overwrite_existing" />
</td>
</tr>';
        }
        $info['install'] .= '</table>';
        if (!empty($settings)) {
            if (file_exists($software['path'] . '/install.js')) {
                $info['install'] .= '<script language="javascript" type="text/javascript"><!--// --><![CDATA[';
                $info['install'] .= @parselanguages(str_replace('$(', '$_(', implode('', file($software['path'] . '/install.js'))));
                $info['install'] .= '// ]]></script>';
            }
            foreach ($settings as $group => $sets) {
                if ($group == 'hidden' || empty($sets)) {
                    continue;
                }
                $info['install'] .= '<br />
<table width="100%" cellpadding="8" cellspacing="0" border="0" class="sai_divroundshad">
<tr>
<td class="sai_heading_full" colspan="2">' . $group . '</td>
</tr>';
                foreach ($sets as $sk => $sv) {
                    $info['install'] .= '<tr>
<td width="50%">
<span class="sai_head">' . $sv['head'] . '</span>
' . (empty($sv['exp']) ? '' : '<br /><span class="sai_exp">' . $sv['exp'] . '</span>') . '
</td>
<td valign="top">
' . (preg_match('/admin_pass|softpass/is', $sv['tag']) ? preg_replace('/>|\\/>/is', ' onkeyup="check_pass_strength();">', $sv['tag']) : $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']) ? '
<a href="javascript: void(0);" onclick="$_(\'' . $sk . '\').value=randstr(10, 1, ' . (!empty($globals['pass_strength']) ? $globals['pass_strength'] : 0) . ');check_pass_strength();return false;" title="' . $l['randpass'] . '"><img src="' . $theme['images'] . 'randpass.gif" /></a>
<div id="pass-strength-result" class="">' . $l['strength_indicator'] . '</div>' : '') . '
' . (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(10, 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="";\');
// ]]></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_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>
' : '') . '
</td>
</tr>';
                }
                $info['install'] .= '</table>';
            }
            //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'] .= '<br />' . $l['softcopy_note'] . '<br /><br />';
        }
        // Advance option
        $info['install'] .= '
<br /><br />
<table width="100%" cellpadding="8" cellspacing="1" border="0" class="sai_divroundshad">
	<tr class="nohover">
		<td class="sai_heading_full" colspan="5" id="advoptions_toggle" onclick="toggle_advoptions(\'advoptions\');" class="sai_heading_full" style="cursor:pointer" ><img id="advoptions_toggle_plus" src="' . $theme['images'] . 'plus_new.gif" />&nbsp;&nbsp;' . $l['adv_option'] . '</td>
	</tr>
	<tr>
		<td>
			<div id="advoptions" style="display:none;">
			<table border="0" cellpadding="5" cellspacing="0" width="100%">
			' . (aefer() ? "" : '<tr>
					<td>
						<span class="sai_head">' . $l['database_name'] . '</span><br />
						<span class="sai_exp">' . $l['database_name_exp'] . '</span>
					</td>
					<td valign="top">
						<input type="text" name="softdb" id="softdb" size="30" value="' . POSTval('softdb', $dbname) . '" onblur="checkdbname(\'softdb\', false)" /><br />
						<span id="softdberror" style="background: #FDB3B3; display:none; width:200px;"></span>
					</td>
				</tr>') . '

				<tr>
					<td width="50%">
						<span class="sai_head">' . $l['disable_notify_update'] . '</span><br />
						<span class="sai_exp">' . $l['exp_disable_notify_update'] . '</span>
					</td>
					<td>
						<input type="checkbox" name="disable_notify_update" id="disable_notify_update" ' . POSTchecked('disable_notify_update') . ' />
					</td>	
				</tr>';
        // 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']) && !aefer() && empty($softpanel->disable_auto_backup)) {
            $info['install'] .= '<tr>
		<td width="50%">
			<span class="sai_head">' . $l['auto_backup'] . '</span><br />
			<span class="sai_exp">' . $l['exp_auto_backup'] . '</span>
		</td>
		<td>
			<select name="auto_backup" id="auto_backup" onchange="show_backup();">
				<option value="0" ' . POSTselect('auto_backup', '0', 1) . '>' . $l['no_backup'] . '</option>' . (empty($globals['disable_auto_backup_daily']) ? '<option value="daily" ' . POSTselect('auto_backup', 'daily') . '>' . $l['daily'] . '</option>' : '') . (empty($globals['disable_auto_backup_weekly']) ? '<option value="weekly" ' . POSTselect('auto_backup', 'weekly') . '>' . $l['weekly'] . '</option>' : '') . (empty($globals['disable_auto_backup_monthly']) ? '<option value="monthly" ' . POSTselect('auto_backup', 'monthly') . '>' . $l['monthly'] . '</option>' : '') . '
			</select>
		</td>	
	</tr>
	<tr>
		<td width="50%">
			<span class="sai_head">' . $l['auto_backup_rotation'] . '</span><br />
			<span class="sai_exp">' . $l['exp_auto_backup_rotation'] . '</span>
		</td>
		<td>
			<select name="auto_backup_rotation" 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, $i == 4 ? '1' : '0') . '>' . (empty($i) ? $l['unlimited'] : $i) . '</option>';
            }
            $info['install'] .= '</select>
		</td>	
	</tr>';
        }
        $info['install'] .= '</table>
</div>
</td>
</tr>
</table>';
        $info['install'] .= '<p align="center">
<input type="hidden" name="softsubmit" id="softsubmit" value="' . $l['softsubmit'] . '" />
<input type="hidden" name="pass-strength-hidden" id="pass-strength-hidden" value="" />
<input type="submit" name="softsubmitbut" id="softsubmitbut" value="' . $l['softsubmit'] . '" class="sai_graybluebut" /><span id="show_txt" style="display:none;"></span>
<br /><br /><br />
' . (empty($globals['off_email_link']) && empty($globals['off_install_mail']) ? $l['ins_emailto'] . ' : <input type="text" name="emailto" id="emailto" size="20" value="' . POSTval('emailto', '') . '" />' : '') . '
</p>
<input type="hidden" name="soft_status_key" id="soft_status_key" value="' . POSTval('soft_status_key', generateRandStr(32)) . '" />
</form></div>

<div id="progress_bar" style="height:125px; display: none;">
	<br />
	<center>
	<font size="4" color="#222222" id="progress_txt">' . $l['checking_data'] . '</font>
	<font style="font-size: 18px;font-weight: 400;color: #444444;" 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;background-color:#efefef;">
		<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>' . $l['wait_note'] . '</center>
</div>
<br /><br /><br />';
    } elseif (!empty($installed)) {
        $info['install'] = '<h3>' . $l['congrats'] . '</h3><br />
' . $software['name'] . ' ' . $l['succesful'] . ' : <br />
<a href="' . $__settings['softurl'] . '" target="_blank">' . $__settings['softurl'] . '</a>
' . (!empty($software['adminurl']) ? '<br />' . $l['admin_url'] . ' : <a href="' . $__settings['softurl'] . '/' . $software['adminurl'] . '" target="_blank">' . $__settings['softurl'] . '/' . $software['adminurl'] . '</a>' : '') . '<br /><br />
' . (!empty($setupcontinue) ? $l['setup_continue'] . ' : <br />
<a href="' . $__settings['softurl'] . '/' . $setupcontinue . '" target="_blank">' . $__settings['softurl'] . '/' . $setupcontinue . '</a><br /><br />' : '') . '
' . $l['enjoy'] . '<br /><br />
' . (!empty($notes) ? $l['install_notes'] . ' : <br />
<div class="sai_notes">' . softparse($notes, $soft) . '</div><br /><br />' : '') . '
' . $l['please_note'] . '<br /><br />
' . $l['regards'] . ',<br />
' . $l['softinstaller'] . '<br /><br />
<center><b><a href="' . script_link($soft) . '&highlight=' . $new_insid . '&postact=install">' . $l['return'] . '</a></b></center><br /><br />';
        if (empty($globals['install_tweet_off']) || empty($globals['lictype'])) {
            $info['install'] .= '<form method="get" action="http://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
		<table border="0" cellpadding="5" cellspacing="1" align="center" class="sai_divroundshad">
			<tr>
				<td colspan="2">
					<font size="+1"><b>' . $l['install_tweet_sub'] . ' :</b></font>
				</td>
			</tr>
			<tr>
				<td valign="middle">
				<textarea name="text" cols="60" row="3" style="resize:none">' . loadtweetdata('install_tweet', $l['install_tweet']) . '</textarea>
				</td>
				<td valign="middle">
				<input type="submit" value="Tweet!" class="sai_twitter-btn" onsubmit="return false;" id="twitter-btn"/>
				</td>
			</tr>
		</table>
		</form>';
        }
        $info['install'] .= '<!--PROC_DONE-->
	<br /><br />';
    }
    softheader($l['<title>'] . $software['name']);
    $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 = "https://www.softaculous.com/ratings.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
    }
    if (empty($globals['off_review_link']) && $soft < 10000) {
        echo '$_(\'review_js_file\').src =  "https://www.softaculous.com/review.js?soft=' . $soft . '&user='******'name'] . '&ip=' . $_SERVER['SERVER_ADDR'] . '";';
        echo '$_(\'reviews_js_file\').src =  "https://www.softaculous.com/reviews.js?soft=' . $soft . '&user='******'name'] . '&timezone=' . $globals['timezone'] . '&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 $l['notifyversion'];
    ?>
');
	}
};

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

</script>
<?php 
    $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] = '<td><img src="' . $url . 'star.png' . '" alt="(' . number_format($scripts[$soft]['ratings'], 2) . ' out of 5)" /></td>';
        } elseif ($r > 0) {
            $ratings[$i_r] = '<td><img src="' . $url . 'halfstar.png' . '" alt="(' . number_format($scripts[$soft]['ratings'], 2) . ' out of 5)" /></td>';
        } else {
            $ratings[$i_r] = '<td><img src="' . $url . 'nostar.png' . '" alt="(' . number_format($scripts[$soft]['ratings'], 2) . ' out of 5)" /></td>';
        }
        $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 id="currentrating" style="display:none"></div>
<table width="100%" cellpadding="4" cellspacing="1" border="0">
	<tr>
		<td width="10%" align="center">' . (!empty($custom_48) ? '<img src="' . $custom_48 . '" alt="">' : '<img src="' . $globals['mirror_images'] . 'top15/48/' . $scripts[$soft]['softname'] . '.png" >') . '</td>
		<td width="90%" class="sai_process_heading" colspan="4">' . $software['name'] . '</td>
	</tr>
	<tr>
		<td align="center" width="10%">' . ($soft > 10000 ? '' : '<div class="someclass" title="' . $scripts[$soft]['ratings'] . '"><table><tr>' . implode('', $ratings) . '</tr></table></div>') . '</td>
		<td valign="top" align="left" width="20%">
			' . $l['software_ver'] . ' : <font size="2"><b>' . (!empty($tmp_ver) ? $tmp_ver : $software['ver']) . '</b></font> &nbsp; &nbsp; <a href="javascript" onclick="notifyversion(); return false;" ><img src="' . $theme['images'] . 'notify.gif" name="notifyver" title="' . $l['notify_ver'] . '" alt="' . $l['notify_ver'] . '"></a>
		</td>
		<td align="left" width="60%">
			' . (!empty($info['release_date']) ? $l['release_date'] . ' : <font size="1"><b>' . $info['release_date'] . '</b></font>' : '') . '
		</td>
		<td width="10%">
			' . (!empty($info['changelog']) ? '&nbsp;&nbsp;<a href="javascript" onclick="$(\'#changelog_div\').bPopup(); return false;" class="sai_changelogbut" style="text-decoration:none;">' . $l['changelog'] . '</a>' : '') . '
		</td>
	</tr>
</table><br />

<table width="100%" cellpadding="0" cellspacing="0" border="0" class="sai_tabs">
	<tr>
		<td><a href="javascript:tabs.tab(\'install\')" id="install" class="sai_insbut">' . $l['install'] . '</a></td>
		<td><a href="javascript:tabs.tab(\'overview\')" class="sai_tab" id="overview">' . $l['overview'] . '</a></td>
		<td><a href="javascript:tabs.tab(\'features\')" class="sai_tab" id="features">' . $l['features'] . '</a></td>
			' . (empty($globals['off_screenshot_link']) ? '<td><a href="javascript:tabs.tab(\'screenshots\'); loadScreenshots();" class="sai_tab" id="screenshots">' . $l['screenshots'] . '</a></td>' : '') . '
			' . (empty($globals['off_demo_link']) ? '<td><a href="' . ($soft >= 10000 && !empty($info['demo']) ? $info['demo'] : $globals['ind'] . 'act=demos&soft=' . $soft) . '" class="sai_tab" id="demo" target="_blank">' . $l['demo'] . '</a></td>' : '') . '
			' . (empty($globals['off_rating_link']) && $soft < 10000 ? '<td><a href="javascript:tabs.tab(\'ratings\')" class="sai_tab" id="ratings">' . $l['ratings'] . '</a></td>' : '') . '
			' . (empty($globals['off_review_link']) && $soft < 10000 ? '<td><a href="javascript:tabs.tab(\'reviews\')" class="sai_tab" id="reviews">' . $l['reviews'] . '</a></td>' : '') . (empty($info['import']) ? '' : '<td><a href="' . $globals['ind'] . 'act=import&soft=' . $soft . '" class="sai_tab" id="ratings">' . $l['import'] . '</a></td>') . '
	</tr>
</table><br />

<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>';
    //Parse and take care of images
    $info['overview'] = (!empty($info['changelog']) ? '<div id="changelog_div" class="sai_popup" style="display:none;"><span class="sai_clogbutton b-close"><span>X</span></span><div class="sai_changelog">' . $info['changelog'] . '</div></div>' : '') . '

<table width="100%" cellpadding="8" cellspacing="1" border="0">
<tr>
	' . (!empty($scripts[$soft]['screenshots']) && empty($globals['panel_hf']) ? '
	<td width="20%" valign="top">
		<div id="overview_img"> <img src="' . $globals['mirror_images'] . 'softimages/screenshots/' . $soft . '_screenshot1.gif" width="500" alt="" > </div>
	</td>' : '') . '
	
	<td valign="top" style="padding:10px;">
		' . softparse($info['overview'], $soft) . '<br /><br />
		<table width="100%" cellpadding="4" cellspacing="1" border="0">
			<tr>
				<td width="52" valign="top" align="center"><font color="#447edf"><i class="fa sai-disk fa-3x"></i></font></td>
				<td valign="top">
					<span class="sai_head">' . $l['space_req'] . '</span><br />
					<span class="sai_exp">' . $l['available_space'] . ' : ' . (is_numeric($softpanel->spaceremain) ? number_format($softpanel->spaceremain / 1024 / 1024, 2) : $softpanel->spaceremain) . ' ' . $l['mb'] . '<br />
					' . $l['req_space'] . ' : ' . number_format($software['spacereq'] / 1024 / 1024, 2) . ' ' . $l['mb'] . '</span>
				</td>
			</tr>
			<tr>
				<td valign="top" align="center"><a href="' . $info['support'] . '"><font color="#447edf"><i class="fa sai-question fa-3x"></i></font></a></td>
				<td valign="top">
					<span class="sai_head">' . $l['software_support'] . '</span><br />
					<span class="sai_exp"><a href="' . $info['support'] . '" target="_blank">' . $l['support_link'] . '</a><br />
					' . $l['support_note'] . '</span>
				</td>
			</tr>
		</table>
	</td>
</tr>
</table>';
    if (!empty($installations[$soft])) {
        $is_cloneable = is_cloneable($soft);
        $highlight = optGET('highlight');
        $action = optGET('postact');
        $info['overview'] .= '<br /><br />
<center>
	<span class="sai_newhead">' . $l['current_ins'] . '</span><br />
</center>
<img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" style="margin:8px 0px;" />';
        $info['overview'] .= '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="sai_altrowstable">
<tr>
	<th class="sai_exp">' . $l['link'] . '</th>
	<th width="50" class="sai_exp" >' . $l['admin'] . '</th>
	<th width="180" class="sai_exp">' . $l['ins_time'] . '</th>
	<th width="80" class="sai_exp">' . $l['version'] . '</th>
	<th width="145" class="sai_exp" style="text-align:center">' . $l['options'] . '</th>
</tr>';
        $i = 1;
        foreach ($installations[$soft] as $ik => $iv) {
            $info['overview'] .= '<tr id="trid' . $ik . '" class="' . ($i % 2 == 0 ? "sai_evenrowcolor" : "sai_oddrowcolor") . '">
		<td><a href="' . $iv['softurl'] . '" target="_blank" id="insurl' . $ik . '">' . $iv['softurl'] . '</a>' . ($highlight == $ik && !empty($action) ? '<span id="highlight">&nbsp;&nbsp;<b class="sai_highlight">' . $l['act_' . $action] . '</b></span>' : '') . '</td>
		<td><a href="' . $iv['softurl'] . '/' . (!empty($iv['admin_folder']) ? $iv['admin_folder'] : admin_folder($iv['sid'])) . '" target="_blank"><img src="' . $theme['images'] . '/admin.gif" /></a></td>
		<td>' . datify($iv['itime']) . '</td>
		<td>' . $iv['ver'] . ($software['ver'] != $iv['ver'] && file_exists($software['path'] . '/upgrade.xml') ? ' <a href="' . $globals['ind'] . 'act=upgrade&insid=' . $ik . '"><img src="' . $theme['images'] . 'updates.gif" alt="' . $l['upd_to'] . ' ' . $scripts[$soft]['ver'] . '" /></a>' : '') . '</td>
		<td>' . (!empty($is_cloneable) ? '<a href="' . $globals['ind'] . 'act=sclone&insid=' . $ik . '" title="' . $l['clone'] . '"><img src="' . $theme['images'] . 'clone.gif" /></a>&nbsp;' : '') . (empty($globals['disable_backup_restore']) ? '<a href="' . $globals['ind'] . 'act=backup&insid=' . $ik . '" title="' . $l['backup'] . '"><img src="' . $theme['images'] . 'backup.gif" /></a>' : '') . ' &nbsp;<a href="' . $globals['ind'] . 'act=editdetail&insid=' . $ik . '" title="' . $l['editdetail'] . '"><img src="' . $theme['images'] . 'editdetail.gif" /></a> &nbsp;<a href="' . $globals['ind'] . 'act=remove&insid=' . $ik . '"><img src="' . $theme['images'] . 'remove.gif" /></a>&nbsp;<input type="checkbox" name="insids[]" id="' . $iv['softurl'] . '" value="' . $ik . '"></td>
	</tr>';
            $i++;
        }
        $info['overview'] .= '</table>
	<p align="right">
		' . $l['with_selected'] . ': 
		<select name="multi_options" id="multi_options">
			<option name="todo" id="todo" value="0">---</option>
			<option name="todo" id="todo" value="mult_rem">' . $l['remove'] . '</option>
		</select>
		<input type="button" value="' . $l['go'] . '" onclick="show_confirm()">
		<br />
	</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();
	
	if($_("multi_options").value != "mult_rem"){
		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("' . $l['no_sel_inst'] . '");
		return false;
	}
	
	var r = confirm("' . $l['del_insid'] . '");
	if(r != true){
		return false;
	}
	
	remove_by_id(insids[0], "", 0);
}

function remove_by_id(insid, re, oldinsid){

	removed[insid] = false;
	
	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){
		try{		
			AJAX("' . $globals['index'] . 'act=remove&insid="+insid+"&ajax=1&ssk="+randomstring(32)+"&random="+Math.random(), "remove_by_id(\'"+nextinsid+"\', re, \'"+insid+"\')");
			$_("rem_div").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +insid+ ", URL: " + $_("insurl"+insid)+"<br /></p>";
			return true;
		}catch(e){
			return false;
		}
	}
	$_("rem_div").innerHTML = "";
	alert("' . $l['inst_remvd'] . '");
	location.reload(true);
	return true;
}

$(document).ready(function(){
	
	$(".sai_altrowstable tr").mouseover(function(){
		var old_class = $(this).attr("class");
		//alert(old_class);
		$(this).attr("class", "sai_tr_bgcolor");
		
		$(this).mouseout(function(){
			$(this).attr("class", old_class);
		});
	});';
        // 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') {
        $info['overview'] .= '<br /><br /><br /><br />
		<table width="100%" cellpadding="8" cellspacing="0" border="0" class="sai_divroundshad">
			<tr>
				<td class="sai_heading_full" colspan="2">' . $l['related_scripts'] . '</td>
			</tr>
		</table>';
        $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;
            }
            $info['overview'] .= '
		<div style="text-decoration:none;display:inline-block;text-align:center;margin-top:10px;">
			<a href="' . script_link($k) . '"  title="' . $v['desc'] . '"  width="80" alt="" class="someclass" style="text-decoration:none;margin-top:5px;">
				<div class="sai_blog_script" style="margin-left:11%;">
					<div class="sai_demo_script_logo">
						<img src="' . $globals['mirror_images'] . 'top15/48/' . $v['softname'] . '.png" >	
					</div>
					<div class="sai_script_name">' . $v['name'] . '</div>
				</div>
		</a></div>';
            $i++;
        }
    }
    //Parse and take care of images
    $info['features'] = softparse($info['features'], $soft);
    $info['ratings'] = '';
    $info['screenshots'] = '<iframe src="" id="screenshots_iframe" style="width:100%;height:600px;" frameborder="0" scrolling="no"></iframe>';
    $info['reviews'] = '<div id="allreviews"></div>';
    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") . ';">
	' . $v . '
	</div>';
    }
    softfooter();
}
Exemple #7
0
function softheader($title = '', $leftbody = true)
{
    global $theme, $user, $logged_in, $globals, $l, $dmenus, $onload, $newslinks, $feeds, $softpanel, $iscripts, $catwise, $allcatwise, $soft, $classes_categories, $scripts, $apps, $apps_catwise;
    if (optGET('jsnohf')) {
        return true;
    }
    /* <script language="javascript" src="'.js_url('js/jquery.js', 'js/universal.js', 'js/suggest.js', 'js/smoothscroll.js', 'js/slider.js', 'js/dock.js').'" type="text/javascript"> </script> */
    $title = empty($title) ? $globals['sn'] : $title;
    $got_cache_js = get_cache_time();
    // Is there a Panel Header ?
    if (!empty($softpanel->pheader)) {
        echo $softpanel->pheader;
    }
    //Lets echo the top headers
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=' . $globals['charset'] . '" />
	<meta name="keywords" content="softaculous, software" />
	<title>' . $title . '</title>
	<link rel="stylesheet" type="text/css" href="' . $theme['this_url'] . '/style.css?' . $GLOBALS['globals']['version'] . '" />
	<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/bootstrap/css/bootstrap.min.css?' . $GLOBALS['globals']['version'] . '" />
	<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/font-awesome.css?' . $GLOBALS['globals']['version'] . '" />
	<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/ie7.css?' . $GLOBALS['globals']['version'] . '">
	<![endif]-->
	<link rel="shortcut icon" href="' . $theme['images'] . '/' . asperapp('', 'webuzo/', 'ampps/') . 'favicon.ico" />
	<script language="javascript" src="' . $theme['url'] . '/js/jquery.js" type="text/javascript"></script>
	<script language="javascript" src="' . $theme['url'] . '/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script language="javascript" src="' . $theme['url'] . '/js/combined.js?' . $GLOBALS['globals']['version'] . '" type="text/javascript"></script>
	<script language="javascript" src="' . $theme['this_url'] . '/cache/cache.js?' . $got_cache_js . '" type="text/javascript"> </script>
	</head>
	<body onload="bodyonload();">';
    // Show the EULA Notice in Interworx panel
    if (empty($user['eula_accept']) && $globals['softpanel'] == 'interworx') {
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
	
		var message_box = function(){			
				return {
					show_message: function(title, body , image) {			
						var okbtn = \'<input  style="width:75px" class="sai_submit" type="button" onclick="message_box.close_message(this.value);" value="Agree" name="okbtn" />\';	
						var cancelbtn = \'<input  style="width:75px" class="sai_submit" type="button" onclick="message_box.close_message(this.value);" value="Decline" name="cancelbtn" />\';
											
						if(jQuery(\'.sai_message_box\').html() === null) {
							var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr><td width="100%" class ="msg_tr1" style="text-align:center">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td class ="msg_tr3">\' + okbtn + \' &nbsp; &nbsp; \' + cancelbtn + \'</td></tr></table></div>\';
							jQuery(document.body).append( message );								
							jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
							jQuery(\'.sai_message_box\').show(\'slow\');
						}else{
							var message =\' <table border="0" width="100%" cellpadding="8" height="100%"><tr ><td widt="60%" class ="msg_tr1">\' + title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td class ="msg_tr3">\' + okbtn + \'</td><td class ="msg_tr3">\' + cancelbtn + \'</td></tr></table>\';				
							jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
							jQuery(\'.sai_message_box\').show(\'slow\');
							jQuery(\'.sai_message_box\').html( message );
						}
					},
					close_message: function(action) {
						
						jQuery(\'.sai_message_box\').hide(\'fast\');
						
						if(action == "Agree"){
				
							$.ajax({
								type: "GET",
								url: window.location+"?&eula_accept=1",
								
								// Checking for error
								success: function(data){
								},
								error: function() {
								}													
							});
							
							return false;
							
						}else{
							alert("You must not use Softaculous if you do not agree to the EULA");
						}
					}
				}
			}();
	
		$(document).ready(function(){
			
			// Show the eula accept message
			var agree_msg = \'<center>You must agree to the <a href="http://www.softaculous.com/softaculous/eula" target="_blank">EULA</a> before using Softaculous</center>\';
			
			message_box.show_message("<a href=\\"http://www.softaculous.com/softaculous/eula\\" target=\\"_blank\\" style=\\"text-decoration:none\\">End User License Agreement</a>",agree_msg,1);
			
		});
		// ]]></script>';
    }
    echo '<div id="loading_soft" class="sai_loading_soft">
			<img src="' . $theme['images'] . 'fb_loader.gif" alt="Loading..." />
		</div>';
    echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="sai_docktable">	
		<tr>
			<td align="left" width="440" valign="middle">
			<a href="' . $globals['ind'] . '"><img src="' . ($globals['softpanel'] == 'ampps' ? $theme['a_images'] . 'header.jpg' : (empty($globals['logo_url']) ? $globals['softpanel'] == 'webuzo' ? $theme['a_images'] . 'header.jpg' : $theme['images'] . 'header.gif' : $globals['logo_url'])) . '" alt="" /></a>
			</td>
			<td>&nbsp;</td>
			
			<td align="right" width="280" style="padding:8px" valign="top">
			
<ul id="dock" class="sai_dock">
' . (empty($globals['off_panel_link']) ? '<li><a href="' . $softpanel->theme['panel_url'] . '"><img src="' . $theme['images'] . 'panel.gif" alt="" tooltip="' . $l['go_cpanel'] . '" /></a></li>' : '') . '
<li>' . (webuzo() && !$softpanel->is_sysapps_disable() ? '<img src="' . $theme['images'] . 'panel.gif" alt="" tooltip="' . $l['go_cpanel'] . '" onclick="goto_panel();" style="cursor:pointer" /></a>' : '<a href="' . $globals['ind'] . '"><img src="' . $theme['images'] . 'home.gif" alt="" tooltip="' . $l['go_home'] . '" /></a>') . '</li>
' . (aefer() && allow_adddomain() ? '<li><a href="' . $globals['ind'] . 'act=domains"><img src="' . $theme['images'] . 'domains.gif" alt="" tooltip="' . $l['go_domain'] . '" /></a></li>' : '') . (webuzo() ? '<li><a href="' . $globals['ind'] . 'act=domainmanage"><img src="' . $theme['images'] . 'domains.gif" alt="" tooltip="' . $l['go_domain'] . '" /></a></li>' : '') . (empty($globals['off_demo_link']) ? '<li><a href="' . $globals['ind'] . 'act=demos"><img src="' . $theme['images'] . 'demos.gif" alt="" tooltip="' . $l['go_demos'] . '" /></a></li>' : '') . (empty($globals['off_rating_link']) ? '<li><a href="' . $globals['ind'] . 'act=ratings"><img src="' . $theme['images'] . 'ratings.gif" alt="" tooltip="' . $l['go_ratings'] . '" /></a></li>' : '') . '
<li><a href="' . $globals['ind'] . 'act=installations"><img src="' . $theme['images'] . 'installations.gif" alt="" tooltip="' . $l['go_installations'] . '" /></a></li>' . (webuzo() && !$softpanel->is_sysapps_disable() ? '<li><a href="' . $globals['ind'] . 'act=apps_installations"><img src="' . $theme['images'] . 'apps_installations.gif" alt="" tooltip="' . $l['go_apps_installations'] . '" /></a></li>' : '') . '
<li><a href="' . $globals['ind'] . 'act=eu_tasklist"><img src="' . $theme['images'] . 'tasklist.png" alt="" tooltip="' . $l['go_tasklist'] . '" /></a></li>
<li><a href="' . $globals['ind'] . 'act=settings"><img src="' . $theme['images'] . 'settings.gif" alt="" tooltip="' . $l['go_settings'] . '" /></a></li>' . (empty($globals['disable_backup_restore']) ? '<li><a href="' . $globals['ind'] . 'act=backups"><img src="' . $theme['images'] . 'backups.gif" alt="" tooltip="' . $l['go_backups'] . '" /></a></li>' : '') . ' 
' . (empty($globals['off_email_link']) ? '<li><a href="' . $globals['ind'] . 'act=email"><img src="' . $theme['images'] . 'emails.gif" alt="" tooltip="' . $l['go_email_settings'] . '" /></a></li>' : '') . (empty($globals['off_sync_link']) ? '<li><a href="' . $globals['ind'] . 'act=sync"><img src="' . $theme['images'] . 'sync.gif" alt="" tooltip="' . $l['go_sync'] . '" /></a></li>' : '') . (!empty($globals['eu_themes_premium']) && !empty($globals['lictype']) ? '<li><a href="' . $globals['ind'] . 'act=my_themes"><img src="' . $theme['images'] . 'pfx_icon.png" alt="" tooltip="' . $l['go_my_themes'] . '" /></a></li>' : '') . '
<li><a href="' . $globals['ind'] . 'act=help"><img src="' . $theme['images'] . 'help.gif" alt="" tooltip="' . $l['go_support'] . '" /></a></li>
</ul>
<span id="dock_titler" style="visibility:hidden; position:absolute; top:0px; left:0px; border:1px solid #DEDCD1; background-color:#FFFFFF; text-align:left; padding: 1px; width:auto; white-space:nowrap;"></span>
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
softdock = new dock();
softdock.min = 30;
softdock.max = 50;
softdock.init();

function checksearchform(){
	if($_("inputString").value == ""){
		return false;
	}else{
		return true;
	}
};

function goto_panel(){
		
	var str = window.location; 	
	
	var port_find = str.toString().search(\'2003\'); 	

	if(port_find < 1){		
		var str_url = str.toString().replace("2002", "2004");
	}else{
		var str_url = str.toString().replace("2003", "2005");
	}
	
	var res = str_url.split("/",4);
	
	var res_out = res.join("/");	
	
	window.location = res_out+"/";
}

function set_pheader(){
	var cur_status = getcookie("pheader");
	if(cur_status == "no"){
		setcookie("pheader","yes",365);
	}else{
		removecookie("pheader");
		setcookie("pheader","no",365);
	}
	//alert(getcookie("pheader"));
	window.location.href = window.location;
}

$(document).ready(function(){
	
	$(".soft_cathead_slide").click(function(){
					
		var cat_head = $(this).attr("id");
		var tmp_img = cat_head.split("_");
		
		//$("#shift_"+tmp_img[1]).css("width", "1");
		var id = $("#leftcontent_"+tmp_img[1]);
		//alert(id.attr("id"))
		//alert(id.is(":visible"))
		
		if(id.css("display") == "none"){
			//id.show();
			id.slideDown("slow");			
			$("#icat"+tmp_img[1]).attr("src", "' . $theme['images'] . 'expanded.gif");
			setcookie(cat_head, 2, 365);
		}else{
			$("#icat"+tmp_img[1]).attr("src", "' . $theme['images'] . 'collapsed.gif");
			id.slideUp("slow");
			removecookie(cat_head);
		
			setcookie(cat_head, "", -365);
			
		}
		
	});
});

// ]]></script>

			</td>			
		</tr>	
	</table>';
    $temp_allcatwise = $allcatwise;
    // Classes are only avaialable to Premium License
    if (empty($globals['disable_classes']) && !empty($globals['lictype'])) {
        $temp_allcatwise['classes'] = 'Classes';
    }
    // Webuzo has the APPs support
    if (webuzo()) {
        $disablesysapps = $softpanel->is_sysapps_disable();
        if (empty($disablesysapps)) {
            $temp_allcatwise['apps'] = 'Apps';
            $allcatwise['apps'] = $apps_catwise;
        } else {
            if ($globals['mode'] == 'apps') {
                redirect('');
                return false;
            }
        }
    }
    echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="35">	
	<tr>
		<td width="5" align="right">&nbsp;</td>
		<td width="10" align="right"><img src="' . $theme['images'] . 'leftheader.gif" alt="" /></td>
		<td width="60" align="left" class="sai_softac_header sai_headtd">
		<a href="' . $globals['ind'] . '"><img src="' . $theme['images'] . 'home_bar.gif" alt="' . $l['go_home'] . '" /></a>
		</td>
		
		<td align="left" class="sai_softac_header">&nbsp;&nbsp;' . (!empty($globals['panel_hf']) && !empty($softpanel->can_shrink_nativeui) ? '<a href="javascript:set_pheader();" id="pheader_view" ><img src="' . $theme['this_images'] . ($_COOKIE['pheader'] == 'yes' ? 'expand.png" title="' . $l['expand_view'] . '"' : 'collapse.png" title="' . $l['collapse_view'] . '"') . '></a>' : '');
    if (empty($globals['nolabels'])) {
        echo '&nbsp; Scripts : &nbsp; <a href="' . $globals['ind'] . 'ind=' . $globals['mode'] . '" style="font-size:15px">' . ($globals['mode'] == 'js' ? 'JavaScripts' : ($globals['mode'] == 'classes' ? 'Classes' : (asperapp(0, 1, 0) ? $globals['mode'] == 'java' ? 'JAVA' : ($globals['mode'] == 'python' ? 'Python' : strtoupper($globals['mode'])) : strtoupper($globals['mode'])))) . '</a>';
        foreach ($temp_allcatwise as $k => $v) {
            echo empty($temp_allcatwise[$k]) || $globals['mode'] == $k ? '' : '&nbsp; <a href="' . $globals['ind'] . 'ind=' . $k . '" >' . ($k == 'js' ? 'JavaScripts' : ($k == 'classes' ? 'Classes' : ($k == 'java' || $k == 'apps' || $k == 'python' ? ucfirst($k) : strtoupper($k)))) . '</a>';
        }
    }
    echo '</td><td align="right" class="sai_softac_header"> ' . (webuzo() && $softpanel->getCurrentUser() == 'root' ? $l['root_login'] : '') . '&nbsp; ' . $l['welcome'] . ' ' . (empty($softpanel->user['displayname']) ? $softpanel->user['name'] : $softpanel->user['displayname']) . ' [<a href="' . $softpanel->theme['logout'] . '">' . $l['logout'] . '</a>] &nbsp; &nbsp;	
		</td>	
		
		<td width="168" align="left" class="sai_softac_header sai_search" valign="middle">
			<form accept-charset="' . $globals['charset'] . '" name="search" method="post" action="' . $globals['ind'] . 'act=search&smode=' . $globals['mode'] . '" onsubmit="return checksearchform();" id="searchform">
			<input type="text" name="inputString" id="inputString" style="border:none" class="sai_search_box" onfocus="suggestjs.show(0, this.id);" value="' . $l['search'] . '" onKeyUp="suggestjs.myKeyDownHandler(event, this.value);" autocomplete="off" onblur="suggestjs.show(1);" sugurl="' . $globals['index'] . '&act=suggest&smode=' . $globals['mode'] . '" mode="' . $globals['mode'] . '"/>
			<input type="hidden" name="hidden_cid" id="hidden_cid">
			<div id="suggestions" class="sai_suggestions" style="position:absolute;width:200px;left:0px; top:0px; display:none;"></div>
			</form>			
		</td>
		
		<td width="10" align="left"><img src="' . $theme['images'] . 'rightheader.gif" alt="" /></td>
		<td width="5" align="left">&nbsp;</td>
	</tr>	
	</table>
	<br />';
    //The Menus of softwares
    if (!empty($leftbody)) {
        $theme['leftbody'] = $leftbody;
        echo '<table border="0" cellpadding="8" cellspacing="0" width="100%" class="sai_softwares">	
	<tr>
		<td align="left" valign="top" width="' . (!empty($softpanel->leftpanel_resize) ? '192' : '220') . '" class="sai_softmenu">';
        $ind = $globals['mode'];
        //This is done for the SLIDER
        $js_cat = array();
        foreach ($allcatwise[$ind] as $cat => $softs) {
            if (empty($softs)) {
                continue;
            }
            $js_cat[] = $cat;
        }
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
			imgurl = "' . $theme['images'] . '";
			softmenu = new slider();
			if(!isIE){
				softmenu.speed = 5;
			}
			softmenu.elements = new Array(\'cat' . implode('\', \'cat', $js_cat) . '\');
			softmenu.expanded = new Array("catlibraries");
			//addonload(\'softmenu.init();\');
			
			timers = new Object();
			
			function incwidth(elid, to, inc){
				eleid = "shift_"+elid;
				clearTimeout(timers[eleid]);
				current = parseInt($_(eleid).width);
				
				tobecome = current + inc;
				if(tobecome >= to){
					tobecome = to;
				}
				
				$_(eleid).width = tobecome;
				r = parseInt(255 - current*2);
				g = parseInt(255 - current);
				
				$("#head_"+elid).css("background", "rgb("+r+", "+g+", 255)");
				
				if(tobecome < to){
					timers[eleid] = setTimeout("incwidth(\\""+elid+"\\", "+to+", "+inc+")", 20);
				}
			};
			
			function decwidth(elid, to, dec){
				eleid = "shift_"+elid;
				
				clearTimeout(timers[eleid]);
				current = parseInt($_(eleid).width);
				tobecome = current - dec;
				if(tobecome < to){
					tobecome = to;
				}
				$_(eleid).width = tobecome;
				r = parseInt(255 - current*2);
				g = parseInt(255 - current);
				$("#head_"+elid).css("background", "rgb("+r+", "+g+", 255)");
				
				if(tobecome > to){
					timers[eleid] = setTimeout("decwidth(\\""+elid+"\\", "+to+", "+dec+")", 20);
				}else{
					$("#head_"+elid).css("background", "rgb(255, 255, 255)");
				}		
			};
			
			function ajax_listsoftware(str_id){
				
				$("#softcontent").fadeOut(0);
				$_("loading_soft").style.top = (scrolledy()+250)+"px";
				$("#loading_soft").show();
				
				$("#softcontent").load("' . $globals['indexmode'] . 'act=listsoftwares&cat="+str_id+"&jsnohf=1", 
					function(){
						$("#loading_soft").hide();
						$("#softcontent").fadeIn(300);
					}
				);
				
				window.location.hash = "!act=listsoftwares&cat="+str_id;
			}
			
// ]]></script>
		
<div id="softmenu">';
        if ($ind == 'classes' || optGET('act') == 'classes') {
            echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
	
	(function($) {
		$.extend($.fx.step,{
			backgroundPosition: function(fx) {
				if (fx.state === 0 && typeof fx.end == \'string\') {
					var start = $.curCSS(fx.elem,\'backgroundPosition\');
					if(typeof(start) == "undefined"){
						start = $.css(fx.elem, "background-position-x")+\' \'+$.css(fx.elem, "background-position-y");
					}
					start = toArray(start);
					fx.start = [start[0],start[2]];
					var end = toArray(fx.end);
					fx.end = [end[0],end[2]];
					fx.unit = [end[1],end[3]];
				}
				var nowPosX = [];
				nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
				nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
				fx.elem.style.backgroundPosition = nowPosX[0]+\' \'+nowPosX[1];
	
			   function toArray(strg){
				   strg = strg.replace(/left|top/g,\'0px\');
				   strg = strg.replace(/right|bottom/g,\'100%\');
				   strg = strg.replace(/([0-9\\.]+)(\\s|\\)|$)/g,"$1px$2");
				   var res = strg.match(/(-?[0-9\\.]+)(px|\\%|em|pt)\\s(-?[0-9\\.]+)(px|\\%|em|pt)/);
				   return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
			   }
			}
		});
	})(jQuery);
	
		
	// navigation background fading effect . it will work only on loading external javascript file jquery.bgpos.js in js folder
	$(function(){
			$("#cmenu li ").css( {backgroundPosition:"0px -120px"})
			.mouseover(function()
			{
					 $(this).stop().animate({ backgroundPosition:"(0px 0px)",
					 marginLeft: "5px"}, {duration:400});
			})
			.mouseout(function()
			{
						$(this).stop().animate({backgroundPosition:"(0px -120px)",
						marginLeft: "0px"}, {duration:400, complete:function(){
						$(this).css({backgroundPosition: "0px -120px"})
						}});
			})
		});
	
	// this function will add blue arrow after clicking	
	$(function(){
		$("#cmenu li a").click(function(){
			 $("#cmenu li a ").removeClass("selected");
			 $(this).addClass("selected");
		 })
	});
	
	//function to display list of classes
	function show_list(start, length, cat){
		$("#softcontent").fadeOut(0);
		$_("loading_soft").style.top = (scrolledy()+250)+"px";
		$("#loading_soft").show();
		$("#softcontent").html("");
		goto_top();	
		$.getJSON("' . $globals['api_nuphp'] . 'category_classes.php?cat="+cat+"&in=json&start="+start+"&length="+length+"&callback=?", 
		function (data) {
			if (typeof(data.data)!="object" || typeof data.data == "undefined"){
			  $("#loading_soft").hide();//hide fb loader
			  $("#softcontent").html("<center><span class=\'sai_newhead\'>' . $l['classes_con_failed'] . '</span></center>");	
			  $("#softcontent").fadeIn(300);
			}
			var soft_classes = \'<div class="bg"><br /><div class="row row_usi_cls">\';
			var br = 1; 
			$.each(data.data, function (i, item) {
				soft_classes += \'<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12" style="padding-bottom: 20px;"><div class="sai_classes_boxgrid2" onclick=window.location=this.id; id="' . $globals['index'] . 'act=classes&cid=\'+item.cid+\'&tab=overview" ><div class="sai_classes_boxgrid"><div><h2>\'
				+item.name+
				\'</h2><p style="padding:10px;height:50px;">\'
				+item.desc+\'</p><p style="padding:10px;height:15px;"> <b>' . $l['cl_ratings'] . '</b> : \'
				+parseFloat(item.ratings)+\'/5</p> </div><div style="height:200px;"><br /><h2>\'
				+item.name+
				\'</h2><p style="margin-left:10px;margin-top:15px"><b> ' . $l['cl_author'] . '</b> : \'
				+item.author+\'</p><p style="margin-left:10px;"><b> ' . $l['cl_license'] . '</b> :\'
				+item.license+\'</p><p style="margin-left:10px;"><b> ' . $l['cl_version'] . '</b> :\'
				+item.version+\'</p><div align="center"> <a href="' . $globals['index'] . 'act=classes&cid=\'+item.cid+\'&tab=install" class="sai_cbutton"> ' . $l['cl_install_but'] . ' </a><a href="' . $globals['index'] . 'act=classes&cid=\'+item.cid+\'&tab=file" class="sai_cbutton"> ' . $l['cl_show_files'] . '</a></div></div></div></div></div>\';
				 
				 br += 1 ;
			});// end of each loop
	
			soft_classes += "</div></div>";
			
			$("#softcontent").append(soft_classes); 
			
			// Pagination Coding
			var p1 = 0; // Start variable for mysql api . length is set to 12
			
			// Find which is the current page
			var current = (start/length) + 1;
			var class_pagination = \'<center><div class="pagination"><ul>\';
			for (i=1; i<=data.pages; i++)
			{
				var page_class = "sai_cbutton";
				if(i == current){
					page_class += " selected_page";
				}			
				
				class_pagination += \'<li style="display:inline;font-size:18px;font-style:italic;margin-right:3px;cursor:pointer"><a class="\'+page_class+\'" style="background: #F5F5F5;color:#000;" onclick="show_list(\'+p1+\',12, \\\'\'+data.class_category+\'\\\');" href="javascript:void(0)" >\'+ i+\'</a></li>\';
				p1+=12;
			}
			
			class_pagination+= \'</ul></div></center>\';	
	
			$("#softcontent").append(class_pagination);
			$("#loading_soft").hide();//hide fb loader
			$("#softcontent").fadeIn(300);	
					
			window.location.hash = "!act=listclasses&cat="+data.class_category;	
			
			$(".sai_classes_boxgrid").hover(function(){$(this).stop().animate({top:"-200px"},{queue:false,duration:200});},function() 
			{$(this).stop().animate({top:"0px"},{queue:true,duration:200});});
			
			 }); // end of get json function
	
	}//end of show list
	
// ]]></script>';
            echo '<div><ul class="sai_cmenu" id="cmenu">';
            ksort($classes_categories);
            foreach ($classes_categories as $key => $value) {
                echo '<li>
					<div class ="blue_select">
						<a onclick="show_list(0, 12, \'' . $key . '\');  return false;" href="javascript:void(0)" >' . $l['classes_' . $key] . '</a>
					</div>
				</li>';
            }
            echo '</ul></div>';
        } else {
            // end of $ind == 'classes'
            echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td>
				<div id="load_leftpanel_js"></div>';
            $icat = 0;
            $str = '<script>
				var cat_lang = new Array();
				var catimg_from_site = new Array();
				';
            foreach ($allcatwise as $i_ind => $ind_type) {
                foreach ($ind_type as $cat => $softs) {
                    if (empty($softs)) {
                        continue;
                    }
                    // If we have any cat images to be load from our website
                    if (!empty($GLOBALS['catimgs'][$i_ind . '_' . $cat])) {
                        $str .= 'catimg_from_site[\'' . $i_ind . '_' . $cat . '\'] = "' . $GLOBALS['catimgs'][$i_ind . '_' . $cat] . '";';
                    }
                    $str .= 'cat_lang[\'cat_' . $i_ind . '_' . $cat . '\'] = "' . $l['cat_' . $i_ind . '_' . $cat] . '";';
                }
            }
            $str .= '
				var iscripts = new Array("' . implode('", "', array_keys($iscripts)) . '");
				var apps = new Array("' . implode('", "', array_keys($apps)) . '");
				</script>';
            echo $str;
            echo '</td>
			</tr></table>';
            echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

			function in_array(val, array){
														
				for (i=0; i <= array.length; i++){
					if (array[i] == val) {
						return true;
						// {alert(i +" -- "+ids[i]+" -- "+val);return i;}
					}
				}
				return false;
			}
			
			var ind_types_array = new Array("ind_php", "ind_perl", "ind_java", "ind_python");
			
			var all_ind_types_array = new Array("ind_php", "ind_perl", "ind_java", "ind_apps", "ind_js", "ind_python");
			
			function initiate_status(){
				var main = $("#softmain tr");
				
				main.each(function(){
					
					var cookie_id = $(this).closest("tr").attr("id");
					var if_isset = getcookie(cookie_id);
					var tmp_cookieid = String(cookie_id);
					if(if_isset == 2 && tmp_cookieid != "undefined"){
						
						//alert(if_isset+"--"+ cookie_id)
						var id = $($("#"+cookie_id).next("tr").find("div"));
						//alert(id.attr("id")+ " -- "+if_isset+"--"+ cookie_id)
						id.show();	
						var tmp_img = tmp_cookieid.split("_");
						$("#icat"+tmp_img[1]).attr("src", "' . $theme['images'] . 'expanded.gif");
					}
				});
			}
			
			function show_left_panel(combine){
				var str_html = "";
				var icat = 0;
				
				$.each(allcatwise, function (i_ind, ind_type) {
					$.each(ind_type, function (i, item) {
						
						if(catimg_from_site[i_ind+\'_\'+i] != undefined || catimg_from_site[i_ind+\'_\'+i] != null){
							var catimg = catimg_from_site[i_ind+\'_\'+i];
						}else{
							var catimg = "' . $theme['images'] . 'cats/"+i_ind+"_"+i+".gif";
						}
						
						var if_isset = getcookie("head_"+icat);
						var tmp_cookieid = String("head_"+icat);
						var display_open = "none";
						if(if_isset == 2 && tmp_cookieid != "undefined"){
							display_open = "block";
						}
						var show_combined = true;
						var isset_ind = ' . (isset($_GET['ind']) ? '"' . $_GET['ind'] . '"' : '0') . ';
						
						if(!isset_ind){
							isset_ind = ' . (isset($_GET['act']) ? '"' . $_GET['act'] . '"' : '0') . ';
						}
						
						if(!in_array("ind_"+isset_ind, all_ind_types_array)){
							isset_ind = "php";
						}
						
						if(isset_ind == "software"){
							isset_ind = "php";
						}
						
						if(isset_ind){
							var show_i_ind = isset_ind;
						}else{
							var show_i_ind = "php";
						}
						//alert("cat_"+i_ind+"_"+i);
						var cat_key = "cat_"+i_ind+"_"+i;
						
						// If all scripts in that category is disabled by Admin it was showing "undefined" so to resolve this we have written the following code.
						if(typeof cat_lang[cat_key] == "undefined"){
							for(x in ind_types_array){
								var tmp_arr = String(ind_types_array[x]).split("_");
								var tmp_cat_key = "cat_"+tmp_arr[1]+"_"+i;
								if(typeof cat_lang[tmp_cat_key] != "undefined" && typeof cat_lang[tmp_cat_key] == "string"){
									var cat_key = tmp_cat_key;
								}
								
							}
						}
						
						str_html += \'<table border="0" cellpadding="2" cellspacing="0" id="softmain" width="100%" >\';
						
						if(i_ind == "js" && i == "libraries"){
							var links_class = "softlib";
						}else{
							var links_class = "softlinks";
						}
						
						if(i_ind == show_i_ind && typeof cat_lang[cat_key] != "undefined"){
							
						str_html += \'<tr id="head_\'+icat+\'" class="soft_cathead_slide" onmouseout="decwidth(\\\'\'+icat+\'\\\', 1, 1)" onmouseover="incwidth(\\\'\'+icat+\'\\\', 12, 1)"><td width="1" id="shift_\'+icat+\'"></td><td class="soft_cathead" ><a href="' . (empty($globals['lictype']) ? '#' : $globals['indmode'] . 'act=listsoftwares&cat=\'+i+\'') . '" onclick="ajax_listsoftware(\\\'\'+i+\'\\\'); return false;"><img src="\'+catimg+\'" alt="" />&nbsp;&nbsp;\'+cat_lang[cat_key]+\'</a></td>' . (empty($globals['lictype']) ? '<td align="left" width="10"><a href="http://www.softaculous.com/softwares/\'+i+\'"><img src="' . $theme['this_images'] . 'external.gif" alt="" /></a></td>' : '') . '<td width="10"><a href="javascript:void(0);"><img src="' . $theme['images'] . 'collapsed.gif" alt="" valign="top" id="icat\'+icat+\'"/></a></td></tr><tr><td colspan="2"><div id="leftcontent_\'+icat+\'" style="display:none;" class="\'+links_class+\'">\';
						
						$.each(item, function (sid, softw) {
							var tmp_sid = sid.split("_");
							sid = tmp_sid[1];
							
							var acts = softw.type;
							if(acts == "php"){
								acts = "software";
							}
							
							var soft = "soft";
							
							if(acts == "app" || acts == "service"){
								acts = "apps";
								soft = "app";
							}
							
							var searchin = iscripts;
							
							if(soft == "app"){
								searchin = apps;
							}
							
							var li_classes = "";
							
							' . (!empty($soft) ? 'if(' . $soft . ' == sid) li_classes = "class=\\"softlinkscurrent\\"";' : '') . '
							
							if((softw.parent != undefined || softw.parent != null) && in_array(softw.parent, iscripts)){
								return;
							}
							
							if(!in_array(sid, searchin)){
								return;
							}
							
							//alert(isset_ind +"--||"+ not_selected_ind)
							if(isset_ind){
								
								for(x in ind_types_array){
									//alert(ind_types_array[x]);
									var get_ind_type = getcookie(ind_types_array[x]);
									if(get_ind_type == "yes"){
										var tmp_arr = String(ind_types_array[x]).split("_");
										removecookie(get_ind_type);
										setcookie(get_ind_type, "no", 365);
										$("#"+tmp_arr[1]).removeClass("soft_nav_selected");
										//$("#"+tmp_arr[1]).addClass("soft_nav_selected");
									}
								}
								
								show_combined = false;
							}
							
							if(combine){
								show_combined = true;
								$("#"+combine).addClass("soft_nav_selected");
							}
							
							if(acts == "apps"){
								show_combined = true;
							}
							var start_span = "";
							var end_span = "";
							if(li_classes != ""){
								var start_span = \'<span \'+li_classes+\'>\';
								var end_span = \'</span>\';
							}
							
							if(in_array(sid, searchin) && show_combined){
								
								str_html += start_span+\'<a href="' . $globals['ind'] . 'act=\'+acts+\'&\'+soft+\'=\'+sid+\'" title="\'+softw.desc+\'">\'+softw.name+\'</a>\'+end_span;
							}
							
							if(softw.type == i_ind && !show_combined){
								str_html += start_span+\'<a href="' . $globals['ind'] . 'act=\'+acts+\'&\'+soft+\'=\'+sid+\'" title="\'+softw.desc+\'">\'+softw.name+\'</a>\'+end_span;
							}
						});
						
						}
						str_html += \'</div></td></tr></table>\';
						icat = icat + 1;
						
					});	
				});
				
				$("#load_leftpanel_js").html(str_html);
				
			}
			
			var on_index_page = ' . (isset($_GET['ind']) ? '"' . $_GET['ind'] . '"' : '0') . ';
						
			if(!on_index_page){
				on_index_page = ' . (isset($_GET['act']) ? '"' . $_GET['act'] . '"' : '0') . ';
			}
			
			if(!on_index_page){
				show_left_panel(1);
			}else{
				show_left_panel(0);
			}
			
			initiate_status();			
// ]]></script>';
        }
        echo '</td>
		<td valign="top" style="padding-left:20px;">';
    }
    //Everything else will go here
    echo '<div id="softcontent" style="padding:0px; margin:0px;" >';
}
Exemple #8
0
function sclone_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts;
    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, $insid, $cloned, $new_insid;
    if (optGET('ajaxdownload') && !empty($nopackage)) {
        // Try to download the package
        if (method_exists($softpanel, 'updatesoftwares')) {
            $softpanel->updatesoftwares($soft, 0, 0, 1);
            echo 1;
            return true;
        }
        // False call
        echo 0;
        return false;
    }
    // Give the status
    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;
    }
    softheader($l['<title>']);
    if (!empty($cloned)) {
        echo '
		<div class="bg">
			<h4>' . $l['congrats'] . '</h4><br />
			' . $software['name'] . ' ' . $l['succesful'] . ' : <br />
			<a href="' . $__settings['softurl'] . '" target="_blank">' . $__settings['softurl'] . '</a>
			' . (!empty($software['adminurl']) ? '<br />' . $l['admin_url'] . ' : <a href="' . $__settings['softurl'] . '/' . $software['adminurl'] . '" target="_blank">' . $__settings['softurl'] . '/' . $software['adminurl'] . '</a>' : '') . '<br /><br />
			' . (!empty($setupcontinue) ? $l['setup_continue'] . ' : <br />
			<a href="' . $__settings['softurl'] . '/' . $setupcontinue . '" target="_blank">' . $__settings['softurl'] . '/' . $setupcontinue . '</a><br /><br />' : '') . '
			' . $l['enjoy'] . '<br /><br />
			' . (!empty($notes) ? $l['install_notes'] . ' : <br />
			<div class="sai_notes">' . softparse($notes, $soft) . '</div><br /><br />' : '') . '
			' . $l['please_note'] . '<br /><br />
			' . $l['regards'] . ',<br />
			' . $l['softinstaller'] . '<br /><br />
			<center><b><a href="' . script_link($soft) . '&highlight=' . $new_insid . '&postact=clone" class="sai_head">' . $l['return'] . '</a></b></center><br /><br />';
        if (empty($globals['clone_tweet_off']) || empty($globals['lictype'])) {
            echo '
				<form method="get" action="http://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
					<div class="panel panel-info" style="width:55%; margin:0 auto;">
						<div class="panel-heading" style="padding:5px; font-size:15px;">
							<font><b>' . $l['clone_tweet_sub'] . ' :</b></font>
						</div>
						<div class="panel-body">
							<div class="row">
								<div class="col-sm-10">
									<textarea name="text" cols="80" row="3" style="resize:none; width:100%;">' . loadtweetdata('clone_tweet', $l['clone_tweet']) . '</textarea>
								</div>
								<div class="col-sm-2 col-xs-2">
									<input type="submit" value="Tweet!" class="btn btn-info" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/>
								</div>
							</div>
						</div>
					</div>
				</form>';
        }
        echo '
		</div><!--end of bg class--><!--PROC_DONE-->
		<br /><br />';
    } else {
        echo '
		<div id="install_win">
			<div id="fadeout_div">
				<form accept-charset="' . $globals['charset'] . '" name="clonesoftware" method="post" action="" onsubmit="return checkform();" id="clonesoftware">
			
					<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
					
					function checkform(dosubmit){
						
						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){			
								$_("clonesoftware").submit();	
							}
							show_msg("' . $l['cloning'] . '");
						}
						
						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: "#clonesoftware",
						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{
										if(responseText.match(/\\<\\!\\-\\-PROC_DONE\\-\\-\\>/gi)){
											progressbar.text("' . addslashes($l['finishing_process']) . '");
											progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
										}else{
											progressbar.reset();
										}
									}catch(e){ }
									
									if ( jqXHR.isResolved() ) {
									
										// #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();
										//alert(responseText);
										$(progressbar.win_div).animate({opacity: 0}, 1000, "", function(){
											$(progressbar.win_div).html(responseText);
											new_theme_funcs_init();
										}).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("' . $l['downloading'] . '");
							
							try{		
								AJAX("' . script_link($soft) . '&ajaxdownload=1&random="+Math.random(), "get_package_handle(re)");
							}catch(e){ }
							
							return false;
						}else{
							$_("show_txt").style.display = "none";
							return true;
						}
					};
					
					function get_package_handle(resp){
						nopackage = 0;
						show_msg("' . $l['cloning'] . '");
						checkform(1);
					};
					
					function checkhttps(proto_id, softdomain_id, alrt){
						try{
							var id = $_(proto_id);
							var proto = id.options[id.selectedIndex].text;
						
							$("#checkhttps_wait").css("display","inline-block");
							if(proto.indexOf("https") !== -1){
							
								 $.ajax({
									type: "POST",
									url: "' . script_link($soft) . '&checkhttps="+encodeURIComponent(proto+$_(softdomain_id).value),
									timeout:10000,
									// Checking for error
									success: function(data){
										$("#checkhttps_wait").css("display","none");
										is_https(data);
									},
									error: function(jqXHR, status, e) {
										$("#checkhttps_wait").css("display","none");
										is_https(e);
										return false;
									}
								}); 
								
								//AJAX("' . script_link($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 = "' . $l['no_https'] . '";
							}
							if(httpserror != ""){
								$_("httpserror").style.display = "block";
								$_("httpserror").innerHTML = httpserror;
								return false;
							}else{
								$_("httpserror").style.display = "none";
							}
							
						}catch(e){
							//
						}
						return true;
					};
					';
        if (!empty($dbtype)) {
            echo 'function checkdbname(id, alrt){
							try{		
								AJAX("' . script_link($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 = "' . $l['db_name_long'] . '";
								}
								
								//There should be only alphanumeric characters
								if(/[^a-zA-Z0-9]/.test($_(id).value) && !' . aefer() . '0){
									dberror = "' . $l['db_alpha_num'] . '";
								}
								
								//Check if it exists
								if(re == "true"){
									dberror = "' . $l['database_exists'] . '";
								}
								
								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;
						};';
        }
        //End of if($dbtype)
        echo '
					// ]]></script>';
        echo '
					<div class="bg"><br />						
						<div class="row sai_main_head" style="width:100%;" align="center">
							<div class="col-sm-6 col-xs-5" style="padding:0 10px 0 0; text-align:right;">
								<i class="fa sai-copy fa-2x" style="color:#00A0D2;"></i>
							</div>
							<div class="col-sm-6 col-xs-7" style="padding-top:10px; padding-left:0; text-align:left;">' . $l['prog_cloning'] . $software['name'] . '</div>
						</div>';
        if (empty($globals['lictype']) && !empty($scripts[$soft]['force_scripts'])) {
            echo '<br />
							<div class="alert alert-warning">
								<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
								<center>' . lang_vars($l['not_in_free'], array($software['name'])) . (!webuzo() ? '&nbsp;&nbsp;' . $l['notify_admin'] : '') . '</center>
							</div>';
        }
        echo error_handle($error, "100%", 0, 1);
        echo '
						<div style="padding: 0 25px;"><br />
							<div class="sai_sub_head">' . $l['clone_ins'] . '</div><hr>';
        if (empty($softpanel->noprotocol)) {
            echo '
								<div class="row">
									<div class="col-sm-5">
										<label for="softproto" class="sai_head">' . $l['choose_protocol'] . '</label><br />
										<span class="sai_exp2">' . $l['choose_protocol_exp'] . '</span>
									</div>
									<div class="col-sm-7">
										<select name="softproto" id="softproto" class="form-control" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
            foreach ($protocols as $k => $v) {
                echo '<option value="' . $k . '" ' . (optPOST('softproto') == $k || $globals['default_protocol'] == $k && empty($_POST['softproto']) ? 'selected="selected"' : '') . '>' . $v . '</option>';
            }
            echo '
										</select>
										<div style="display:none;" id="checkhttps_wait">&nbsp;&nbsp;<img src="' . $theme['images'] . 'progress.gif" alt="please wait..">
										</div><br />
										<div class="row">
											<div class="col-sm-12">
												<span id="httpserror" style="display:none; font-size:12px; padding:10px;" class="alert alert-danger"></span>
											</div>
										</div>
									</div>
								</div>';
        }
        echo '
							<div class="row">
								<div class="col-sm-5">
									<label for="softdomain" class="sai_head">' . $l['choose_domain'] . '</label><br />
									<span class="sai_exp2">' . $l['choose_domain_exp'] . '</span>
								</div>
								<div class="col-sm-7">
									<select name="softdomain" id="softdomain" class="form-control" onchange="softmail();" onblur="checkhttps(\'softproto\', \'softdomain\', false)">';
        foreach ($softpanel->domainroots as $domain => $dompath) {
            echo '<option value="' . $domain . '" ' . (!empty($_POST['softdomain']) && $_POST['softdomain'] == $domain ? 'selected="selected"' : '') . '>' . $domain . '</option>';
        }
        echo '
									</select>
								</div>
							</div><br />
							
							<div class="row">
								<div class="col-sm-5">
									<label for="softdirectory" class="sai_head">' . $l['in_directory'] . '</label><br />
									<span class="sai_exp2">' . $l['in_directory_exp'] . '</span>
								</div>
								<div class="col-sm-7">
									<input type="text" name="softdirectory" id="softdirectory" class="form-control" size="30" value="' . POSTval('softdirectory', !empty($globals['no_prefill']) ? '' : $software['softname']) . '" />
								</div>
							</div><br />';
        // A data Directory ?
        if (!empty($datadir)) {
            echo '
								<div class="row">
									<div class="col-sm-5">
										<label for="datadir" class="sai_head">' . $l['datadir'] . '</label><br />
										<span class="sai_exp2">' . $l['datadir_exp'] . '</span>
									</div>
									<div class="col-sm-7">
										<input type="text" name="datadir" id="datadir" class="form-control" size="30" value="' . POSTval('datadir', $datadir) . '" />
									</div>
								</div><br />';
        }
        if (!empty($dbtype)) {
            $dbname = mysqldbname($software['softname']);
            if (method_exists($softpanel, 'mysqldbname')) {
                $dbname = $softpanel->mysqldbname();
            }
            echo '
								<div class="row">
									<div class="col-sm-5">
										<label for="softdb" class="sai_head">' . $l['database_name'] . '</label><br />
										<span class="sai_exp2">' . (aefer() ? $l['database_name_exp_aefer'] : $l['database_name_exp']) . '</span>
									</div>
									<div class="col-sm-7">
										<input type="text" name="softdb" id="softdb" class="form-control" size="30" value="' . POSTval('softdb', $dbname) . '" onblur="checkdbname(\'softdb\', false)" />
										<span id="softdberror" style="background: #FDB3B3; display:none; width:200px;"></span>
									</div>
								</div><br />';
            if (!empty($softpanel->no_db_create)) {
                // Database Username
                echo '
									<div class="row">
										<div class="col-sm-5">
											<label for="dbusername" class="sai_head">' . $l['dbusername'] . '</label><br />
											<span class="sai_exp2">' . $l['dbusername_exp'] . '</span>
										</div>
										<div class="col-sm-7">
											<input type="text" name="dbusername" id="dbusername" class="form-control" size="30" value="' . POSTval('dbusername', '') . '" />
										</div>
									</div><br />';
                // Database Password
                echo '
									<div class="row">
										<div class="col-sm-5">
											<label for="dbuserpass" class="sai_head">' . $l['dbuserpass'] . '</label><br />
											<span class="sai_exp2">' . $l['dbuserpass_exp'] . '</span>
										</div>
										<div class="col-sm-7">
											<input type="text" name="dbuserpass" id="dbuserpass" class="form-control" size="30" value="' . POSTval('dbuserpass', '') . '" />
										</div>
									</div><br />';
                //Database Host Name
                echo '
									<div class="row">
										<div class="col-sm-5">
											<label for="hostname" class="sai_head">' . $l['hostname'] . '</label><br />
											<span class="sai_exp2">' . $l['hostname_exp'] . '</span>
										</div>
										<div class="col-sm-7">
											<input type="text" name="hostname" id="hostname" class="form-control" size="30" value="' . POSTval('hostname', 'localhost') . '" />
										</div>
									</div><br />';
            }
        }
        if (!empty($cron)) {
            echo '
								<div class="row">
									<div class="col-sm-5">
										<span class="sai_head">' . $l['cron_job'] . '</span><br />
										<span class="sai_exp2">' . $l['cron_job_exp'] . '</span>
									</div>
									<div class="col-sm-7">
										<div class="row">
											<div class="col-sm-2">
												<span>' . $l['cron_min'] . '</span>	
												<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">
												<span>' . $l['cron_hour'] . '</span>
												<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">
												<span>' . $l['cron_day'] . '</span>
												<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">
												<span>' . $l['cron_month'] . '</span>
												<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">
												<span>' . $l['cron_weekday'] . '</span>
												<input type="text" class="form-control" name="cron_weekday" id="cron_weekday" size="2" value="' . POSTval('cron_weekday', $cron['weekday']) . '" />
											</div>
										</div>
									</div>
								</div><br />';
        }
        if (!empty($overwrite_option)) {
            echo '
								<div class="row">
									<div class="col-sm-5">
										<label class="sai_head">' . $l['overwrite'] . '</label>
									</div>
									<div class="col-sm-7">
										<input type="checkbox" name="overwrite_existing" id="overwrite_existing" />
									</div>
								</div><br />';
        }
        echo '
							<br />
						</div>';
        // The Clone details form
        echo '
						<div class="bg info_block">
						
							<div class="sai_sub_head">' . $l['info'] . '</div><hr style="border-color: #D1D2D3;">
								
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['ins_softname'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info">' . $software['name'] . '</span>
								</div>
							</div><br />
							
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['ins_num'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info">' . $user['ins'][$insid]['insid'] . '</span>
								</div>
							</div><br />
							
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['ins_ver'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info">' . $user['ins'][$insid]['ver'] . '</span>
								</div>
							</div><br />
								
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['ins_time'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info">' . datify($user['ins'][$insid]['itime']) . '</span>
								</div>
							</div><br />
								
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['ins_path'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info">' . $user['ins'][$insid]['softpath'] . '</span>
								</div>
							</div><br />
								
							<div class="row">
								<div class="col-sm-5 col-xs-5">
									<span class="sai_head">' . $l['ins_url'] . '</span>
								</div>
								<div class="col-sm-6 col-xs-6">
									<span class="sai_info"><a href="' . $user['ins'][$insid]['softurl'] . '" target="_blank">' . $user['ins'][$insid]['softurl'] . '</a></span>
								</div>
							</div><br />';
        if (!empty($user['ins'][$insid]['admin_folder']) || !empty($scripts[$soft]['admin_url'])) {
            $adminurl = $user['ins'][$insid]['softurl'] . '/' . (!empty($user['ins'][$insid]['admin_folder']) ? $user['ins'][$insid]['admin_folder'] : $scripts[$soft]['admin_url']);
            echo '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_admin_url'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info"><a href="' . $adminurl . '" target="_blank">' . $adminurl . '</a></span>
									</div>	
								</div><br />';
        }
        echo '
						
							' . (empty($user['ins'][$insid]['wwwdir']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_wwwdir'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . $user['ins'][$insid]['wwwdir'] . '</span>
									</div>
								</div><br />
							') . '
								
							' . (empty($user['ins'][$insid]['wwwurl']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_wwwurl'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . $user['ins'][$insid]['wwwurl'] . '</span>
									</div>
								</div><br />
							') . '
								
								
							' . (empty($user['ins'][$insid]['softdatadir']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_datadir'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . $user['ins'][$insid]['softdatadir'] . '</span>
									</div>
								</div><br />
							') . '	
								
							' . (empty($user['ins'][$insid]['softdb']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_db'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . $user['ins'][$insid]['softdb'] . '</span>
									</div>
								</div><br />
							') . '	
								
							' . (empty($user['ins'][$insid]['softdbuser']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_dbuser'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . $user['ins'][$insid]['softdbuser'] . '</span>
									</div>		
								</div><br />
							') . '	
								
							' . (empty($user['ins'][$insid]['softdbhost']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_dbhost'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . $user['ins'][$insid]['softdbhost'] . '</span>
									</div>		
								</div><br />
							') . '	
								
							' . (empty($user['ins'][$insid]['cron_command']) ? '' : '
								<div class="row">
									<div class="col-sm-5 col-xs-5">
										<span class="sai_head">' . $l['ins_cron_command'] . '</span>
									</div>
									<div class="col-sm-6 col-xs-6">
										<span class="sai_info">' . base64_decode($user['ins'][$insid]['cron_command']) . '</span>
									</div>			
								</div><br />
							') . '
								
						</div><br /><br /><!--end of bg class-->
								
						<p align="center">
							<input type="hidden" name="softsubmit" id="softsubmit" value="' . $l['softsubmit'] . '" />
							<input type="hidden" name="cloneins" id="cloneins" value="' . $l['cloneins'] . '" />
							<input type="submit" name="softsubmitbut" class="flat-butt" id="softsubmitbut" value="' . $l['cloneins'] . '" /><span id="show_txt" style="display:none;"></span>
						</p><br /><br />
					
						<input type="hidden" name="soft_status_key" id="soft_status_key" value="' . POSTval('soft_status_key', generateRandStr(32)) . '" />
						
						<center><b><a href="' . script_link($soft) . '" class="sai_head">' . $l['return'] . '</a></b></center><br /><br />';
        echo '
					</div><!--end of bg class-->
				</form>
			</div>
		
			<div id="progress_bar" style="display: none; width: 100%;">
				<br />
				<div class="bg">
					<center>
						<div class="row sai_main_head" style="width:100%;" align="center">
							<div class="col-sm-5 col-xs-5" style="padding:0 10px 0 0; text-align:right;">
								<i class="fa sai-copy fa-2x" style="color:#00A0D2;"></i>
							</div>
							<div class="col-sm-7 col-xs-7" style="padding-top:10px; padding-left:0; text-align:left;">' . $l['prog_cloning'] . $software['name'] . '</div>
						</div>
						<br />
						<font size="4" color="#222222" id="progress_txt" style="width: 100%;">' . $l['checking_data'] . '</font>
						<font style="font-size: 18px;font-weight: 400;color: #444444; 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;background-color:#efefef; 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>' . $l['wait_note'] . '</center><br /><br />
				</div><!--end of bg class--><br /><br />
			</div><br /><br /><br /><br />';
        echo '
		</div><br /><br />';
    }
    softfooter();
}
Exemple #9
0
function softheader($title = '', $leftbody = true)
{
    global $theme, $user, $logged_in, $globals, $l, $dmenus, $onload, $newslinks, $act, $iscripts, $catwise, $softpanel;
    // If it is reseller the title should be changed
    if (defined('SOFTRESELLER')) {
        $title = $l['reseller_title'];
    }
    $title = empty($title) ? $globals['sn'] : $title;
    //Lets echo the top headers
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=' . $globals['charset'] . '" />
	<meta name="keywords" content="softaculous, software" />
	<title>' . $title . '</title>
	<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/admin/style.css?' . $GLOBALS['globals']['version'] . '" />
	
	<link rel="shortcut icon" href="' . $theme['images'] . '/' . asperapp('', 'webuzo/', 'ampps/') . 'favicon.ico" />
	<script language="javascript" src="' . js_url('js/jquery.js', 'js/universal.js', 'js/domdrag.js', 'js/smoothscroll.js', 'js/script_select.js') . '" type="text/javascript"></script>
	</head>
	<body onload="bodyonload();">';
    echo '<table width="750" border="0" cellpadding="0" cellspacing="0" align="center" class="body" id="abody">
	<tr><td>
	
	<div class="' . asperapp('', 'w', 'a') . 'adminheader">
	<div style="height:80px">&nbsp;</div>
	<table border="0" cellpadding="2" cellspacing="0" width="100%" class="adminmenu">
		<tr>
			<td class="adminmenutd tabicons' . (empty($act) ? ' tabgrey' : '') . '" align="center" width="80">
				<a href="' . $globals['ind'] . '" style="display:block;">' . $l['tab_home'] . '</a>
			</td>
			
			<td class="adminmenutd tabicons' . (in_array($act, array('settings', 'email', 'topscripts', 'emailtemp', 'categories', 'webuzoconfigs', 'editini', 'errorlog', 'no_autoupgrade', 'import_export', 'root_pass', 'webuzo_acl')) ? ' tabgrey' : '') . '" align="center" onmouseover=" $_(\'subsettings\').style.display=\'block\';" onmouseout="$_(\'subsettings\').style.display=\'none\';" id="settings" width="80">
				<a href="' . $globals['ind'] . 'act=settings" style="display:block;">' . $l['tab_settings'] . '</a>
			</td>';
    if (!defined('SOFTRESELLER')) {
        echo '
				<td class="adminmenutd tabicons' . (in_array($act, array('softwares', 'customscripts', 'adv_software', 'script_requirement')) ? ' tabgrey' : '') . '" align="center" onmouseover=" $_(\'subsoftwares\').style.display=\'block\';" onmouseout="$_(\'subsoftwares\').style.display=\'none\';" id="softwares" width="90">
					<a href="' . $globals['ind'] . 'act=softwares" style="display:block;">' . $l['tab_softwares'] . '</a>
				</td>';
        echo '
				<td class="adminmenutd tabicons' . ($act == 'updates' ? ' tabgrey' : '') . '" align="center" width="80">
					<a href="' . $globals['ind'] . 'act=updates" style="display:block;">' . $l['tab_updates'] . '</a>
				</td>';
    }
    // Is the installations function there ?
    if (method_exists($softpanel, 'listinstallations')) {
        echo '
				
				<td class="adminmenutd tabicons' . ($act == 'installations' ? ' tabgrey' : '') . '" align="center" onmouseover=" $_(\'subinstallations\').style.display=\'block\';" onmouseout="$_(\'subinstallations\').style.display=\'none\';" id="installations" width="80">
					<a href="' . $globals['ind'] . 'act=installations" style="display:block;">' . $l['tab_installations'] . '</a>
				</td>';
    }
    if ($globals['softpanel'] != 'ampps' && $globals['softpanel'] != 'webuzo' && $globals['softpanel'] != 'aefer' && $globals['softpanel'] != 'enterprise') {
        if ($globals['softpanel'] != 'isp' && $globals['softpanel'] != 'cwp') {
            echo '			
					<td class="adminmenutd tabicons' . ($act == 'plans' ? ' tabgrey' : '') . '" align="center" width="80" onmouseover=" $_(\'subplans\').style.display=\'block\';" onmouseout="$_(\'subplans\').style.display=\'none\';" id="plans" >
						<a href="' . $globals['ind'] . 'act=plans" style="display:block;">' . $l['tab_plans'] . '</a>
					</td>';
        }
    }
    if ($globals['softpanel'] == 'aefer' || $globals['softpanel'] == 'enterprise') {
        echo '
				
				<td class="adminmenutd tabicons' . ($act == 'adduser' ? ' tabgrey' : '') . '" align="center" width="90" onmouseover=" $_(\'subuser\').style.display=\'block\';" onmouseout="$_(\'subuser\').style.display=\'none\';" id="user" >
					<a href="' . $globals['ind'] . 'act=listuser" style="display:block;">' . $l['user'] . '</a>
				</td>';
    }
    if ($globals['softpanel'] == 'enterprise') {
        echo '
				
				<td class="adminmenutd tabicons' . ($act == 'listdomains' ? ' tabgrey' : '') . '" align="center" width="90" onmouseover=" $_(\'domains\').style.display=\'block\';" onmouseout="$_(\'domains\').style.display=\'none\';" id="domain">
					<a href="' . $globals['ind'] . 'act=listdomains" style="display:block;">Domain</a>
				</td>';
    }
    if (webuzo()) {
        echo '
				
				<td class="adminmenutd tabicons" align="center" width="90">
					<a href="javascript:goto_panel()" style="display:block;">' . $l['tab_goto_enduser'] . '</a>
				</td>';
    }
    if ($globals['softpanel'] == 'webuzo' || $globals['softpanel'] == 'aefer' || $globals['softpanel'] == 'enterprise') {
        echo '
				
				<td class="adminmenutd tabicons' . ($act == 'logout' ? ' tabgrey' : '') . '" align="center" width="90">
					<a href="' . $globals['ind'] . 'act=logout" style="display:block;">' . $l['tab_logout'] . '</a>
				</td>';
    } else {
        if (!defined('SOFTRESELLER') && $globals['softpanel'] != 'ampps') {
            echo '
					
					<td class="adminmenutd tabicons' . ($act == 'import' ? ' tabgrey' : '') . '" align="center" width="90">
						<a href="' . $globals['ind'] . 'act=import" style="display:block;">' . $l['tab_import'] . '</a>
					</td>';
        }
    }
    echo '
		</tr>		
	</table>
	<br />
	<script>
	
		// For Webuzo
		function goto_panel(){
			
			var str = window.location;
			var find_port = str.toString().search(\'2005\');
			
			if(find_port < 1){
				var str_url = str.toString().replace("2004", "2002");
			}else{
				var str_url = str.toString().replace("2005", "2003");
			}
	
			var res = str_url.split("/",4);
			
			var res_out = res.join("/");	
			
			window.location = res_out+"/";
		}
		
		function dropsubmenu(element){
	
			$("#"+element).bind("mouseenter",function(e){
				var prod = findelpos($_($(this).attr("id")));
				var tabheight = 32;
				var tabwidth = 0;
		 			
				$(".subheads").css("left" , prod[0]-tabwidth);
				$(".subheads").css("top" , prod[1]+tabheight);
				$(".subheads").css("border" , "1px solid #eee");			  
		
			});
		}
		
		$(document).ready(function(){
			dropsubmenu("installations");
			dropsubmenu("settings");
			dropsubmenu("softwares");
			dropsubmenu("plans");
			dropsubmenu("user");
			dropsubmenu("domain");
		});
	</script>		
	
	<table class="subheads" id="subinstallations" onmouseover="$_(\'subinstallations\').style.display=\'block\';" onmouseout="$_(\'subinstallations\').style.display=\'none\';" cellpadding="8" width="162">
		<tr>
			<td width="100%" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=installations&show=byusers"><font class="bboxtxt">' . $l['sub_byuser'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=installations&show=byscript"><font class="bboxtxt">' . $l['sub_byscript'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td width="100%" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=installations&show=bydomains"><font class="bboxtxt">' . $l['sub_bydomain'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=installations&show=outdated"><font class="bboxtxt">' . $l['sub_outdated'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=ins_statistics"><font class="bboxtxt">' . $l['sub_ins_statistics'] . '</font></a>
			</td>
		</tr>';
    if (!defined('SOFTRESELLER') && $globals['softpanel'] != 'ampps') {
        echo '<tr>
					<td>
						<a href="' . $globals['ind'] . 'act=installations&show=upgrade"><font class="bboxtxt">' . $l['sub_upgrade'] . '</font></a>
					</td>
				</tr>';
    }
    echo '</table>
			
				
	<table class="subheads" id="subsettings" onmouseover="$_(\'subsettings\').style.display=\'block\';" onmouseout="$_(\'subsettings\').style.display=\'none\';" cellpadding="8" width="162">
		<tr>
			<td width="162" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=settings"><font class="bboxtxt">' . $l['sub_gen_set'] . '</font></a>
			</td>
		</tr>';
    if ($globals['softpanel'] == 'webuzo') {
        echo '
		<tr>				
			<td>
				<a href="' . $globals['ind'] . 'act=webuzoconfigs" style="display:block;"><font class="bboxtxt">' . $l['tab_webuzoconfigs'] . '</font></a>
			</td>
		</tr>
		<tr>				
			<td>
				<a href="' . $globals['ind'] . 'act=root_pass" style="display:block;"><font class="bboxtxt">' . $l['tab_root_pass'] . '</font></a>
			</td>
		</tr>
		<tr>				
			<td>
				<a href="' . $globals['ind'] . 'act=webuzo_acl" style="display:block;"><font class="bboxtxt">' . $l['tab_webuzo_acl'] . '</font></a>
			</td>
		</tr>';
    }
    echo '<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=email"><font class="bboxtxt">' . $l['tab_email'] . '</font></a>
			</td>
		</tr>';
    // proxy menu is availbale for ADMIN only.
    if (!defined('SOFTRESELLER') && (!empty($globals['enable_proxy']) || $globals['softpanel'] == 'ampps' || aefer() || ent())) {
        echo '<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=proxy"><font class="bboxtxt">' . $l['tab_proxy'] . '</font></a>
			</td>
		</tr>';
    }
    if (!defined('SOFTRESELLER')) {
        echo '
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=topscripts"><font class="bboxtxt">' . $l['sub_top_scripts'] . '</font></a>
			</td>
		</tr>';
    }
    if (!defined('SOFTRESELLER')) {
        echo '
			<tr>
				<td>
					<a href="' . $globals['ind'] . 'act=categories" style="display:block;"><font class="bboxtxt">' . $l['tab_categories'] . '</font></a>
				</td>
			</tr>
			<tr>
				<td>
					<a href="' . $globals['ind'] . 'act=errorlog" style="display:block;"><font class="bboxtxt">' . $l['tab_error_log'] . '</font></a>
				</td>
			</tr>
			<tr>
				<td>
					<a href="' . $globals['ind'] . 'act=no_autoupgrade" style="display:block;"><font class="bboxtxt">' . $l['tab_disable_autoupgrade'] . '</font></a>
				</td>
			</tr>
			';
    }
    if (!defined('SOFTRESELLER') && $globals['softpanel'] != 'webuzo' && $globals['softpanel'] != 'ampps') {
        echo '
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=emailtemp" style="display:block;"><font class="bboxtxt">' . $l['tab_mail_trmplate'] . '</font></a>
			</td>
		</tr>';
    }
    if (!defined('SOFTRESELLER') && in_array($globals['softpanel'], array('cpanel', 'enterprise', 'aefer', 'webuzo'))) {
        echo '
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=import_export"><font class="bboxtxt">' . $l['sub_import_export'] . '</font></a>
			</td>
		</tr>';
    }
    if (asperapp(0, 1, 1)) {
        echo '
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=licensekey"><font class="bboxtxt">' . $l['sub_license'] . '</font></a>
			</td>
		</tr>';
    }
    echo '</table>		
		
	<table class="subheads" id="subsoftwares" onmouseover="$_(\'subsoftwares\').style.display=\'block\';" onmouseout="$_(\'subsoftwares\').style.display=\'none\';" cellpadding="8" width="162">
		<tr>
			<td width="162" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=softwares"><font class="bboxtxt">' . $l['sub_general_scripts'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=customscripts"><font class="bboxtxt">' . $l['sub_custom_scripts'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=adv_software"><font class="bboxtxt">' . $l['adv_software'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=script_requirement"><font class="bboxtxt">' . $l['sub_script_req'] . '</font></a>
			</td>
		</tr>
	</table>
	
	<table class="subheads" id="subplans" onmouseover="$_(\'subplans\').style.display=\'block\';" onmouseout="$_(\'subplans\').style.display=\'none\';" cellpadding="8" width="162">
		<tr>
			<td width="100%" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=plans"><font class="bboxtxt">' . $l['list_plan'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=addplans"><font class="bboxtxt">' . $l['add_plan'] . '</font></a>
			</td>
		</tr>
	</table>
	
	<table class="subheads" id="subuser" onmouseover="$_(\'subuser\').style.display=\'block\';" onmouseout="$_(\'subuser\').style.display=\'none\';" cellpadding="8" width="162">
		<tr>
			<td width="100%" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=listuser"><font class="bboxtxt">' . $l['list_user'] . '</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=adduser"><font class="bboxtxt">' . $l['add_user'] . '</font></a>
			</td>
		</tr>
	</table>
	
	<table class="subheads" id="domains" onmouseover="$_(\'domains\').style.display=\'block\';" onmouseout="$_(\'domains\').style.display=\'none\';" cellpadding="8" width="162">
		<tr>
			<td width="100%" style="padding:8px 11px;">
				<a href="' . $globals['ind'] . 'act=listdomains"><font class="bboxtxt">List Domains</font></a>
			</td>
		</tr>
		<tr>
			<td>
				<a href="' . $globals['ind'] . 'act=adddomain"><font class="bboxtxt">Add Domain</font></a>
			</td>
		</tr>
	</table>
	
		
	</div>
	</div>';
    //Everything else will go here
}
Exemple #10
0
function installations_theme()
{
    global $theme, $globals, $user, $l, $langs, $skins, $error, $list, $scripts, $_scriptwise, $emailed, $iscripts, $autoupgrade, $ins_to_be_upgrade, $records_updated, $real_version, $_domainwise;
    if (optGET('api')) {
        _api($list, optGET('api'));
        return;
    }
    softheader($l['<title>']);
    echo '<div class="sai_heading" align="center">' . $l['searchinstallations'] . '</div>
<img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" /><br /><br /><br />';
    error_handle($error);
    //The necessary JavaScripts
    echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
var ids = [];
function show_image(){
	
	goto_top();
	$("#prog_img").fadeIn(500);
	$("#list_ins").hide();
	$("#autoupgrade_process").css("display","");
	$("#prog_img").show();

	$("#list_ins").find( "input[type=checkbox][checked]" ).each( function(){
		ids.push(this.value);
	});
	
	//alert(aArray);return;
		
	updatedids = new Object();
	for(x in ids){
		if(ids[x] != "on"){
			//alert(ids[x]);
			updatedids[ids[x]] = false;
		}
	}
	$("#upgrade_ins_div1").css("display","none");
	$("#upgrade_ins_div2").css("display","none");
	
	autoupgradeins(0, \'\');
	return false;
};

function autoupgradeins(id, resp){
	//alert(resp);
	//alert(id);
	
	
	//Update the Status with Response
	if(id != 0){
		$("<div>"+resp+"</div>").appendTo("#autoupgrade_process");
		updatedids[id] = true;
	}

	for(x in ids){
		//alert(ids[x]);
		if(updatedids[ids[x]] == false){
			var tmp_id = ids[x].split("-");
			AJAX("' . $globals['index'] . 'act=installations&show=upgrade&sact=autoupgradeins&user="******"&insid="+tmp_id[1], "autoupgradeins(\'"+ids[x]+"\', re)");
			return true;
		}
	}

	$("#prog_img").fadeOut(50);
	$("#succ_upgrad_msg").fadeIn(100);
	$("#goto_list_link").fadeIn(100);
	
};

// ]]></script>';
    echo '<script language="JavaScript" src="' . $theme['url'] . '/js/osuggest.js" type="text/javascript"></script>
<div style="width:710px; margin:0px auto;">
<form accept-charset="' . $globals['charset'] . '" name="serchinstallations" method="post" action="">
<table width="100%" cellpadding="5" cellspacing="1" border="0" class="sai_reviewform" style="margin:0px auto; padding:"20px;">
<tr>
	<td><br />
		<span class="sai_head">' . $l['search_scripts'] . '</span><br />
		<span class="sai_exp2">' . $l['search_scripts_exp'] . '</span>
	</td>
	<td><br />
		<input type="text" name="scripts" id="scripts" size="30" value="' . POSTval('scripts') . '" onkeyup="handlesuggest(event, \'scripts\')" onkeydown="handlekeys(event)" autocomplete=off  onblur="setTimeout(hidesuggest, 1000);" suggesturl="' . $globals['ind'] . 'act=suggest&sact=scripts" /> &nbsp; &nbsp;
	</td>
	<td width="250">
		<span class="sai_head">' . $l['group_by_scripts'] . '</span><br />
		<span class="sai_exp2">' . $l['group_by_scripts_exp'] . '</span>
	</td>
	<td width="50">
		<input type="checkbox" name="group_by_scripts" ' . POSTchecked('group_by_scripts') . ' />
	</td>
</tr>
<tr>';
    if (!webuzo()) {
        echo '
	<td>
		<span class="sai_head">' . $l['search_users'] . '</span><br />
		<span class="sai_exp2">' . $l['search_users_exp'] . '</span>
	</td>
	<td>
		<input type="text" name="users" id="users" size="30" value="' . POSTval('users') . '" onkeyup="handlesuggest(event, \'users\')" onkeydown="handlekeys(event)" autocomplete=off  onblur="setTimeout(hidesuggest, 1000);" suggesturl="' . $globals['ind'] . 'act=suggest&sact=users" />
	</td>';
    } else {
        echo '<td colspan="2">
		</td>';
    }
    echo '<td width="250">
		<span class="sai_head">' . $l['only_outdated'] . '</span><br />
		<span class="sai_exp2">' . $l['only_outdated_exp'] . '</span>
	</td>
	<td width="50">
		<input type="checkbox" name="only_outdated" ' . POSTchecked('only_outdated') . ' />
	</td>
</tr>
<tr>
	<td>
		<span class="sai_head">' . $l['search_domains'] . '</span><br />
		<span class="sai_exp2">' . $l['search_domains_exp'] . '</span>
	</td>
	<td>
		<input type="text" name="domains" id="domains" size="30" value="' . POSTval('domains') . '" />
	</td>
	<td>
		<span class="sai_head">' . $l['only_realversion'] . '</span><br />
		<span class="sai_exp2">' . $l['only_realversion_exp'] . '</span>
	</td>
	<td width="50">
		<input type="checkbox" name="only_realversion" ' . POSTchecked('only_realversion') . ' />
	</td>
</tr>
<tr>
	<td colspan="4">
		<p align="center"><input type="submit" name="listinstallations" value="' . $l['search_ins'] . '" class="sai_graybluebut" /></p>	
	</td>
</tr>
</table>
<br /><br />
</form>
</div>';
    if (isset($_REQUEST['listinstallations'])) {
        $upgrade_ins_button = '<table cellpadding="0" cellspacing="0" width="100%" border="0">
			<tr>
				<td width="80%">
					<p align="right" class="bboxtxt">' . $l['with_selected'] . '&nbsp;&nbsp;
				</td> 
				<td>:&nbsp;&nbsp;</td>
				<td valign="middle"><input type="submit" name="upgrade_ins" id="upgrade_ins" value="' . $l['sub_upgrade_ins'] . '" class="sai_graybluebut" onclick="return show_image();" /></td>
			</tr>
		</table>';
        // In case there is any error than just dont show the button
        if (!empty($error)) {
            $upgrade_ins_button = '';
        }
        $email_button = '<p align="right" class="bboxtxt"><table cellpadding="0" cellspacing="0" width="100%" border="0">
		<tr>
			<td width="60%" align="right" valign="middle">' . $l['with_selected'] . '&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
        if (!empty($real_version)) {
            $email_button .= '<td valign="middle"><br /><input type="submit" name="update_records" id="update_records" value="' . $l['update_records'] . '" class="sai_graybluebut"/></td></tr></table></p>';
        } else {
            $email_button .= '<td valign="middle"><br /><input type="submit" name="send_email" id="send_email" value="' . $l['sub_email_users'] . '" class="sai_graybluebut"/></td></tr></table></p>';
        }
        if (!empty($records_updated)) {
            echo '<br /><div class="sai_success"><img src="' . $theme['images'] . 'success.gif" /> ' . $l['succ_update_record'] . '</div><br />';
        }
        if (empty($list)) {
            echo '<h2 align="center">' . $l['no_results'] . '</h2>';
        } else {
            if (!empty($emailed)) {
                echo '<br /><div class="sai_success"><img src="' . $theme['images'] . 'success.gif" /> ' . $l['emailed_users'] . '</div><br />';
            }
            echo '<br /><div class="sai_notice" id="succ_upgrad_msg" style="display:none">' . $l['upgraded_ins'] . '</div><br />';
            echo '<div style="width:710px; margin:0px auto;">
		<form accept-charset="' . $globals['charset'] . '" name="email_users" method="post" action="" id="email_users">
		<link href="' . $globals['mirror_images'] . 'sprites/20.css" rel="stylesheet" type="text/css" />
		<table cellpadding="0" cellspacing="0" width="100%" border="0">
			<tr>
				<td width="50%">
				<div style="display:none;float:left" id="prog_img"><img src="' . $theme['images'] . 'admin_progress.gif" />&nbsp;&nbsp;' . $l['upgrading_ins'] . '</div>
				</td>
			</tr>
			<tr>
				<td align="right">';
            if (!isset($_REQUEST['upgrade_installation']) || !empty($real_version)) {
                echo $email_button;
            } else {
                // We are ending the table because we are not ending this in the variable.
                echo '<div id="upgrade_ins_div1">' . $upgrade_ins_button . '</div>';
            }
            echo '</td></tr>
		</table><br /><br />';
            if (!empty($real_version)) {
                echo '<div class="notebox" style="width:95%;" id="beta_notice1">
					<table width="100%" cellpadding="5" cellspacing="1" border="0">
						<tr>
							<td width="25px">
								<div class="lirealver" style="height:16px;width:16px"></div>
							</td>
							<td><font class="bboxtxt">' . $l['real_ver_notice'] . '</font></td>
						</tr>
						<tr>
							<td width="25px">
								<div class="lioutdated" style="height:16px;width:16px"></div>
							</td>
							<td><font class="bboxtxt">' . $l['latest_ver_notice'] . '</font></td>
						</tr>
					</table>
				</div>';
            }
            echo '<div class="sai_divroundshad" id="list_ins" style="display:block">
		<table width="100%" cellpadding="5" cellspacing="1" border="0">
		<tr>
			<td class="lihead" width="100">' . (empty($_scriptwise) ? empty($_domainwise) ? $l['li_user'] : $l['li_domains'] : $l['li_scripts']) . '</td>
			<td class="lihead">' . (empty($_scriptwise) ? $l['li_scripts'] : $l['li_user']) . '</td>' . (!empty($_domainwise) ? '<td class="lihead" width="5%">' . $l['li_user'] . '</td>' : '') . '
			<td class="lihead">' . $l['li_url'] . '</td>
			<td class="lihead" width="15%">' . $l['li_insver'] . '</td>' . (!empty($real_version) ? '<td class="lihead" width="15%">' . $l['li_realver'] . '</td>' : '') . '<td class="lihead" width="2%">' . $l['li_ver'] . '</td>
			<td class="lihead"><img src="' . $theme['images'] . 'auto_upgrade.png"  title="' . $l['auto_upgrade_enabled'] . '" style="cursor:pointer"/>
			<td class="lihead"><input type="checkbox" onclick="check(document.getElementsByName(\'list[]\'), this);" ' . (!empty($error) ? 'disabled=true' : '') . '/></td>
		</tr>';
            $class = '';
            foreach ($list as $lk => $lv) {
                $i = 1;
                $class = $class == 'lione' ? 'litwo' : 'lione';
                foreach ($lv as $llk => $llv) {
                    foreach ($llv as $ik => $iv) {
                        $_class = $class;
                        echo '<tr>
				<td class="' . ($i == 1 ? $class : '') . '">';
                        $isCustom = is_customscript($iv['sid']) ? 1 : 0;
                        if ($i == 1) {
                            echo '<font class="bboxtxt">' . (empty($_scriptwise) ? $lk : (!empty($scripts[$iv['sid']]) && !empty($iscripts[$iv['sid']]) ? $scripts[$iv['sid']]['name'] : (!empty($isCustom) ? $iscripts[$iv['sid']]['name'] : $l['no_info']))) . '</font>';
                        } else {
                            echo '&nbsp;';
                        }
                        if (!empty($isCustom)) {
                            if ($iscripts[$iv['sid']]['ver'] != $iv['ver']) {
                                $_class = 'lioutdated';
                            }
                        } else {
                            if ($iscripts[$iv['sid']]['ver'] != $iv['ver'] && file_exists($globals['softscripts'] . '/' . $iscripts[$iv['sid']]['softname'] . '/upgrade.xml')) {
                                $_class = 'lioutdated';
                            }
                        }
                        $real_class = 'lirealver';
                        $__user = empty($_scriptwise) ? $lk : $llk;
                        if (!empty($_domainwise)) {
                            $__user = $iv['user'];
                        }
                        echo '</td>
		<td class="' . $class . '">' . (empty($_scriptwise) ? !empty($scripts[$iv['sid']]) && !empty($iscripts[$iv['sid']]) ? $scripts[$iv['sid']]['name'] : (!empty($isCustom) ? $iscripts[$iv['sid']]['name'] : $l['no_info']) : $llk) . '</td>' . (!empty($_domainwise) ? '<td class="' . $class . '">' . $__user . '</td>' : '') . '
		<td class="' . $class . '"><a href="' . $iv['softurl'] . '" target="_blank">' . $iv['softurl'] . '</a></td>
		<td class="' . $class . '">' . $iv['ver'] . '</td>' . (!empty($iv['real_ver']) && !empty($real_version) ? '<td class="' . $real_class . '">' . $iv['real_ver'] . '</td>' : '') . '<td class="' . $_class . '">' . (empty($isCustom) ? $scripts[$iv['sid']]['ver'] : $iscripts[$iv['sid']]['ver']) . '</td>
		<td class="' . $class . '" align="center">' . (!empty($iv['eu_auto_upgrade']) ? '<img src="' . $theme['images'] . 'success.gif" hight="20px" width="20px" title="' . $l['auto_upgrade_enabled'] . '" style="cursor:pointer"/>' : '') . '
		<td class="' . $class . '">' . (empty($isCustom) ? $scripts[$iv['sid']]['ver'] != $iv['ver'] && file_exists($globals['softscripts'] . '/' . $scripts[$iv['sid']]['softname'] . '/upgrade.xml') : $iscripts[$iv['sid']]['ver'] != $iv['ver'] && file_exists($globals['softscripts'] . '/' . $iscripts[$iv['sid']]['softname'] . '/upgrade.xml') ? '<input type="checkbox" name="list[]" value="' . $__user . '-' . $ik . '" ' . (!empty($error) ? 'disabled=true' : '') . '/>' : '') . '</td>
			</tr>';
                        $i++;
                    }
                }
            }
            echo '
		</table>
		</div>
		<div id="autoupgrade_process" style="display:none"></div>
		<div id="goto_list_link" style="display:none" class="sai_heading"><center>' . $l['upgrading_completed'] . '&nbsp;&nbsp;<a href="' . $globals['ind'] . 'act=installations&show=upgrade' . '">' . $l['go_to_autoupgrade'] . '</a><center></div>
		
		<br /><br />
		<table cellpadding="0" cellspacing="0" width="100%" border="0">
		<tr>
			<td width="50%">&nbsp;</td> 
		</tr>
		<tr>
			<td align="right">';
            if (!isset($_REQUEST['upgrade_installation']) || !empty($real_version)) {
                echo $email_button;
            } else {
                echo '<div id="upgrade_ins_div2">' . $upgrade_ins_button . '</div>';
            }
            echo '</td>
		</tr>
		</table>';
            if (!empty($real_version)) {
                echo '<div class="notebox" style="width:95%;" id="beta_notice1">
					<table width="100%" cellpadding="5" cellspacing="1" border="0">
						<tr>
							<td width="25px">
								<div class="lirealver" style="height:16px;width:16px"></div>
							</td>
							<td><font class="bboxtxt">' . $l['real_ver_notice'] . '</font></td>
						</tr>
						<tr>
							<td width="25px">
								<div class="lioutdated" style="height:16px;width:16px"></div>
							</td>
							<td><font class="bboxtxt">' . $l['latest_ver_notice'] . '</font></td>
						</tr>
					</table>
				</div>';
            }
            echo '</form>';
        }
    }
    softfooter();
}
Exemple #11
0
function softheader($title = '', $leftbody = true)
{
    global $theme, $user, $logged_in, $globals, $l, $dmenus, $onload, $newslinks, $feeds, $softpanel, $iscripts, $catwise, $allcatwise, $soft, $classes_categories, $scripts, $apps, $apps_catwise;
    if (optGET('jsnohf')) {
        return true;
    }
    //r_print($user['color_theme']);
    /* <script language="javascript" src="'.js_url('js/jquery.js', 'js/universal.js', 'js/suggest.js', 'js/smoothscroll.js', 'js/slider.js', 'js/dock.js').'" type="text/javascript"> </script> */
    $title = empty($title) ? $globals['sn'] : $title;
    // Is there a Panel Header ?
    if (!empty($softpanel->pheader)) {
        echo $softpanel->pheader;
    }
    //Lets echo the top headers
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=' . $globals['charset'] . '" />
		<meta name="keywords" content="softaculous, software" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0" />
		<title>' . $title . '</title>
		<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/bootstrap/css/bootstrap.css?' . $GLOBALS['globals']['version'] . '" />
		<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/style.css?' . $GLOBALS['globals']['version'] . '" />
		<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/font-awesome.css?' . $GLOBALS['globals']['version'] . '" />
		<!--[if IE 7]>
		<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/ie7.css?' . $GLOBALS['globals']['version'] . '">
		<![endif]-->
		<link rel="shortcut icon" href="' . $theme['images'] . '/' . asperapp('', 'webuzo/', 'ampps/') . 'favicon.ico" />';
    $got_cache_js = get_cache_time();
    echo '<script language="javascript" src="' . $theme['url'] . '/js/jquery.js" type="text/javascript"> </script>
		<script language="javascript" src="' . $theme['url'] . '/bootstrap/js/bootstrap.min.js" type="text/javascript"> </script>
		<script language="javascript" src="' . $theme['url'] . '/js/combined.js" type="text/javascript"> </script>
		<script language="javascript" src="' . $theme['url'] . '/cache/cache.js?' . $got_cache_js . '" type="text/javascript"> </script>
		<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
		</script>';
    echo '
	</head>
	
	<body onload="bodyonload();">';
    $ind = $globals['mode'];
    //This is done for the SLIDER
    $js_cat = array();
    foreach ($allcatwise[$ind] as $cat => $softs) {
        if (empty($softs)) {
            continue;
        }
        $js_cat[] = $cat;
    }
    $temp_allcatwise = $allcatwise;
    // Classes are only avaialable to Premium License
    if (empty($globals['disable_classes']) && !empty($globals['lictype'])) {
        $temp_allcatwise['classes'] = 'Classes';
    }
    // Webuzo has the APPs support
    if (webuzo()) {
        $disablesysapps = $softpanel->is_sysapps_disable();
        if (empty($disablesysapps)) {
            $temp_allcatwise['apps'] = 'Apps';
            $allcatwise['apps'] = $apps_catwise;
        } else {
            if ($globals['mode'] == 'apps') {
                redirect('');
                return false;
            }
        }
    }
    // Show the EULA Notice in Interworx panel
    if (empty($user['eula_accept']) && $globals['softpanel'] == 'interworx') {
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
	
		var message_box = function(){			
				return {
					show_message: function(title, body , image) {			
						var okbtn = \'<input  style="width:75px; margin-top:10px; background:#00A0D2; color:#FFF;" class="sai_submit" type="button" onclick="message_box.close_message(this.value);" value="Agree" name="okbtn" />\';	
						var cancelbtn = \'<input  style="width:75px; margin-top:10px; background:#00A0D2; color:#FFF;" class="sai_submit" type="button" onclick="message_box.close_message(this.value);" value="Decline" name="cancelbtn" />\';
											
						if(jQuery(\'.sai_message_box\').html() === null) {
							var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr><td width="100%" class ="msg_tr1" style="text-align:center">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td class ="msg_tr3">\' + okbtn + \' &nbsp; &nbsp; \' + cancelbtn + \'</td></tr></table></div>\';
							jQuery(document.body).append( message );								
							jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
							jQuery(\'.sai_message_box\').show(\'slow\');
						}else{
							var message =\' <table border="0" width="100%" cellpadding="8" height="100%"><tr ><td widt="60%" class ="msg_tr1">\' + title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td>\' + okbtn + \'</td><td>\' + cancelbtn + \'</td></tr></table>\';				
							jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
							jQuery(\'.sai_message_box\').show(\'slow\');
							jQuery(\'.sai_message_box\').html( message );
						}
					},
					close_message: function(action) {
						
						jQuery(\'.sai_message_box\').hide(\'fast\');
						
						if(action == "Agree"){
				
							$.ajax({
								type: "GET",
								url: window.location+"?&eula_accept=1",
								
								// Checking for error
								success: function(data){
								},
								error: function() {
								}													
							});
							
							return false;
							
						}else{
							alert("You must not use Softaculous if you do not agree to the EULA");
						}
					}
				}
			}();
	
		$(document).ready(function(){
			// Show the eula accept message
			var agree_msg = \'<center>You must agree to the <a href="http://www.softaculous.com/softaculous/eula" target="_blank">EULA</a> before using Softaculous</center>\';
			
			message_box.show_message("<a href=\\"http://www.softaculous.com/softaculous/eula\\" target=\\"_blank\\" style=\\"text-decoration:none\\">End User License Agreement</a>",agree_msg,1);
			
		});
		// ]]></script>';
    }
    //For native UI support
    if (!empty($softpanel->pheader)) {
        if (substr_count($_SERVER['REQUEST_URI'], 'paper_lantern') > 0) {
            echo '
			<style>
			@media screen and (min-width: 320px) and (max-width: 360px){
				.soft_nav{
					margin-top:20px;
				}
			}
			</style>
			';
        }
    }
    echo '
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="soft_nav">								
					<tr>
						<td width="' . (!empty($softpanel->leftpanel_resize) ? '192' : '220') . '" id="header_logo">
							<a href="' . $globals['ind'] . '" style="margin:20px;"><img src="' . ($globals['softpanel'] == 'ampps' ? $theme['a_images'] . 'header.png' : (empty($globals['logo_url']) ? $globals['softpanel'] == 'webuzo' ? $theme['a_images'] . 'header.png' : $theme['images'] . 'header.png' : $globals['logo_url'])) . '" alt="" height="' . (!empty($softpanel->leftpanel_resize) ? '60' : '55') . '"/></a>
						</td>';
    $top_bar = !empty($globals['panel_hf']) && !empty($softpanel->can_shrink_nativeui) ? '<td width="40" align="center">&nbsp;&nbsp;<a href="javascript:set_pheader();" id="pheader_view" ><img src="' . $theme['images'] . ($_COOKIE['pheader'] == 'yes' ? 'expand.png" title="' . $l['expand_view'] . '"' : 'collapse.png" title="' . $l['collapse_view'] . '"') . '></a></td>' : '';
    $pre_selected_ind = array('php', 'perl', 'java', 'python');
    if (empty($globals['nolabels'])) {
        $top_bar .= '<td align="center" width="40" ' . (!empty($softpanel->pheader) ? 'height="40"' : '') . '>&nbsp;&nbsp;<a href="' . $globals['ind'] . 'ind=' . $globals['mode'] . '" id="' . $globals['mode'] . '" class="indtype soft_nav_selected">' . ($globals['mode'] == 'js' ? 'JavaScripts' : ($globals['mode'] == 'classes' ? 'Classes' : (asperapp(0, 1, 0) ? $globals['mode'] == 'java' ? 'JAVA' : ($globals['mode'] == 'python' ? 'Python' : strtoupper($globals['mode'])) : strtoupper($globals['mode'])))) . '</a></td>';
        foreach ($temp_allcatwise as $k => $v) {
            $top_bar .= empty($temp_allcatwise[$k]) || $globals['mode'] == $k ? '' : '<td  align="center" width="40">&nbsp;&nbsp;<a href="' . $globals['ind'] . 'ind=' . $k . '" class="' . ($globals['mode'] == $k || empty($_GET['act']) && empty($_GET['ind']) && in_array($k, $pre_selected_ind) ? 'indtype soft_nav_selected' : 'indtype') . '" id="' . $k . '">' . ($k == 'js' ? 'JavaScripts' : ($k == 'classes' ? 'Classes' : ($k == 'java' || $k == 'apps' || $k == 'python' ? ucfirst($k) : strtoupper($k)))) . '</a></td>';
        }
    }
    $top_bar .= '
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>';
    $top_bar1 = (empty($globals['off_panel_link']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_cpanel'] . '"><a href="' . $softpanel->theme['panel_url'] . '"><i class="fa sai-control_panel fa-2x"></i></a></td>' : '') . '

						' . (webuzo() && !$softpanel->is_sysapps_disable() ? '<td align="center" width="32" class="someclass" title="' . $l['go_cpanel'] . '"><a href="javascript:goto_panel();"><i class="fa sai-control_panel fa-2x"></i></a>' : '<td align="center" width="32" class="someclass" title="' . $l['go_home'] . '"><a href="' . $globals['ind'] . '"><i class="fa sai-home fa-2x"></i></a></td>') . '

						' . (aefer() && allow_adddomain() ? '<td align="center" width="32" class="someclass" title="' . $l['go_domain'] . '"><a href="' . $globals['ind'] . 'act=domains"><i class="fa sai-www fa-2x"></i></a></td>' : '') . (webuzo() ? '<td align="center" width="32" class="someclass" title="' . $l['go_domain'] . '"><a href="' . $globals['ind'] . 'act=domainmanage"><b><i class="fa sai-www fa-2x"></i></b></a></td>' : '') . (empty($globals['off_demo_link']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_demos'] . '"><a href="' . $globals['ind'] . 'act=demos"><i class="fa sai-demo fa-1x"></i></a></td>' : '') . (empty($globals['off_rating_link']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_ratings'] . '"><a href="' . $globals['ind'] . 'act=ratings"><i class="fa sai-fullstar fa-1x"></i></a></td>' : '') . '

						<td  align="center" width="32" class="someclass" title="' . $l['go_installations'] . '"><a href="' . $globals['ind'] . 'act=installations"><i class="fa sai-installations fa-1x"></i></a></td>' . (webuzo() && !$softpanel->is_sysapps_disable() ? '<td align="center" width="32" class="someclass" title="' . $l['go_apps_installations'] . '"><a href="' . $globals['ind'] . 'act=apps_installations"><i class="fa sai-apps fa-2x"></i></a></td>' : '') . '

						<td  align="center" width="32" class="someclass" title="' . $l['go_tasklist'] . '"><a href="' . $globals['ind'] . 'act=eu_tasklist"><i class="fa sai-list fa-1x"></i></a></td>

						<td align="center" width="32" class="someclass" title="' . $l['go_settings'] . '"><a href="' . $globals['ind'] . 'act=settings"><i class="fa sai-settings fa-1x"></i></a></td>' . (empty($globals['disable_backup_restore']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_backups'] . '"><a href="' . $globals['ind'] . 'act=backups"><i class="fa sai-backup fa-1x"></i></a></td>' : '') . '

						' . (empty($globals['off_email_link']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_email_settings'] . '"><a href="' . $globals['ind'] . 'act=email"><i class="fa sai-mail fa-1x"></i></a></td>' : '') . (!empty($globals['eu_themes_premium']) && !empty($globals['lictype']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_my_themes'] . '"><a href="' . $globals['ind'] . 'act=my_themes"><i class="fa sai-pfx_icon fa-2x"></i></a></td>' : '') . (empty($globals['off_sync_link']) ? '<td align="center" width="32" class="someclass" title="' . $l['go_sync'] . '"><a href="' . $globals['ind'] . 'act=sync"><i class="fa sai-sync fa-1x"></i></a></td>' : '') . '
						<td align="center" width="32" class="someclass" title="' . $l['go_support'] . '"><a href="' . $globals['ind'] . 'act=help"><i class="fa sai-question fa-1x"></i></a></td>
						</td>
						<td align="center" width="32" class="someclass" title="' . $l['go_logout'] . '">
							<a href="' . $softpanel->theme['logout'] . '"><i class="fa sai-logout fa-1x"></i></a>
						</td>';
    if (!empty($softpanel->pheader) && substr_count($_SERVER['REQUEST_URI'], 'paper_lantern') < 0) {
        echo $top_bar . '</tr><tr>' . $top_bar1;
    } else {
        echo $top_bar . $top_bar1;
    }
    echo '</tr>
				</table>
			</td>
		</tr>
	</table>
	<img src="' . $theme['images'] . 'menu.png" alt="Left_menu" id="header_toggle_btn" class="header_toggle_btn pull-right">			
	<div class="soft_nav_mob"><br />
		<ul style="list-style-type:none; padding-left:10px;">';
    $top_bar = !empty($globals['panel_hf']) && !empty($softpanel->can_shrink_nativeui) ? '<li style="display:inline-block;">&nbsp;&nbsp;<a href="javascript:set_pheader();" id="pheader_view" ><img src="' . $theme['images'] . ($_COOKIE['pheader'] == 'yes' ? 'expand.png" title="' . $l['expand_view'] . '"' : 'collapse.png" title="' . $l['collapse_view'] . '"') . '></a></li>' : '';
    $pre_selected_ind = array('php', 'perl', 'java', 'python');
    if (empty($globals['nolabels'])) {
        $top_bar .= '<li style="display:inline-block;">&nbsp;&nbsp;<a href="' . $globals['ind'] . 'ind=' . $globals['mode'] . '" id="' . $globals['mode'] . '" class="indtype soft_nav_selected">' . ($globals['mode'] == 'js' ? 'JavaScripts' : ($globals['mode'] == 'classes' ? 'Classes' : (asperapp(0, 1, 0) ? $globals['mode'] == 'java' ? 'JAVA' : ($globals['mode'] == 'python' ? 'Python' : strtoupper($globals['mode'])) : strtoupper($globals['mode'])))) . '</a></li>';
        foreach ($temp_allcatwise as $k => $v) {
            $top_bar .= empty($temp_allcatwise[$k]) || $globals['mode'] == $k ? '' : '<li style="display:inline-block;">&nbsp;&nbsp;<a href="' . $globals['ind'] . 'ind=' . $k . '" class="' . ($globals['mode'] == $k || empty($_GET['act']) && empty($_GET['ind']) && in_array($k, $pre_selected_ind) ? 'indtype soft_nav_selected' : 'indtype') . '" id="' . $k . '">' . ($k == 'js' ? 'JavaScripts' : ($k == 'classes' ? 'Classes' : ($k == 'java' || $k == 'apps' || $k == 'python' ? ucfirst($k) : strtoupper($k)))) . '</a></li>';
        }
    }
    $top_bar1 = (empty($globals['off_panel_link']) ? '<li><a href="' . $softpanel->theme['panel_url'] . '"><i class="fa sai-control_panel fa-2x"></i>&nbsp;&nbsp;' . $l['go_cpanel'] . '</a></li><br />' : '') . '
						<li>' . (webuzo() && !$softpanel->is_sysapps_disable() ? '<a href="javascript:goto_panel();"><i class="fa sai-control_panel fa-2x"></i>&nbsp;&nbsp;' . $l['go_cpanel'] . '</a>' : '<a href="' . $globals['ind'] . '"><i class="fa sai-home fa-2x"></i>&nbsp;&nbsp;' . $l['go_home'] . '</a>') . '</li><br />
						' . (aefer() && allow_adddomain() ? '<li><a href="' . $globals['ind'] . 'act=domains"><i class="fa sai-www fa-2x"></i>&nbsp;&nbsp;' . $l['go_domain'] . '</a></li><br />' : '') . (webuzo() ? '<li><a href="' . $globals['ind'] . 'act=domainmanage"><b><i class="fa sai-www fa-2x"></i>&nbsp;&nbsp;' . $l['go_domain'] . '</b></a></li><br />' : '') . (empty($globals['off_demo_link']) ? '<li><a href="' . $globals['ind'] . 'act=demos"><i class="fa sai-demo fa-1x"></i>&nbsp;&nbsp;' . $l['go_demos'] . '</a></li><br />' : '') . (empty($globals['off_rating_link']) ? '<li><a href="' . $globals['ind'] . 'act=ratings"><i class="fa sai-fullstar fa-1x"></i>&nbsp;&nbsp;' . $l['go_ratings'] . '</a></li><br />' : '') . '

						<li><a href="' . $globals['ind'] . 'act=installations"><i class="fa sai-installations fa-1x"></i>&nbsp;&nbsp;' . $l['go_installations'] . '</a></li><br />' . (webuzo() && !$softpanel->is_sysapps_disable() ? '<li><a href="' . $globals['ind'] . 'act=apps_installations"><i class="fa sai-apps fa-2x"></i>&nbsp;&nbsp;' . $l['go_apps_installations'] . '</a></li><br />' : '') . '

						<li><a href="' . $globals['ind'] . 'act=eu_tasklist"><i class="fa sai-list fa-1x"></i>&nbsp;&nbsp;' . $l['go_tasklist'] . '</a></li><br />

						<li><a href="' . $globals['ind'] . 'act=settings"><i class="fa sai-settings fa-1x"></i>&nbsp;&nbsp;' . $l['go_settings'] . '</a></li><br />' . (empty($globals['disable_backup_restore']) ? '<li><a href="' . $globals['ind'] . 'act=backups"><i class="fa sai-backup fa-1x"></i>&nbsp;&nbsp;' . $l['go_backups'] . '</a></li><br />' : '') . '

						' . (empty($globals['off_email_link']) ? '<li><a href="' . $globals['ind'] . 'act=email"><i class="fa sai-mail fa-1x"></i>&nbsp;&nbsp;' . $l['go_email_settings'] . '</a></li><br />' : '') . (!empty($globals['eu_themes_premium']) && !empty($globals['lictype']) ? '<li><a href="' . $globals['ind'] . 'act=my_themes"><i class="fa sai-pfx_icon fa-2x"></i>&nbsp;&nbsp;' . $l['go_my_themes'] . '</a></li><br />' : '') . (empty($globals['off_sync_link']) ? '<li><a href="' . $globals['ind'] . 'act=sync"><i class="fa sai-sync fa-1x"></i>&nbsp;&nbsp;' . $l['go_sync'] . '</a></li><br />' : '') . '
						<li><a href="' . $globals['ind'] . 'act=help"><i class="fa sai-question fa-1x"></i>&nbsp;&nbsp;' . $l['go_support'] . '</a></li><br />
						<li><a href="' . $softpanel->theme['logout'] . '"><i class="fa sai-logout fa-1x"></i>&nbsp;&nbsp;' . $l['go_logout'] . '</a></li><br />';
    echo $top_bar . '<br /><br />' . $top_bar1;
    echo '
		</ul>
	</div><!--soft_nav_mob-->
	<script type=text/javascript>
		$(document).ready(function(){
			$("#left_toggle_btn").click(function(){
				if($(".left_panel").is(":visible")){
					$("#header_logo").show();
				}else{
					$("#header_logo").hide();
				}
			});';
    if (!empty($softpanel->pheader) && substr_count($_SERVER['REQUEST_URI'], 'x3') > 0) {
        echo '$(".ver_style").css("margin-left","0px");
					$(".release_style").css("margin-left","0px");
					$(".change_style").css({"margin-left":"0px", "margin-top":"-15px"});
					$(".sai_search_left").css("width","159px")';
    }
    echo '  });
	</script>
	<!--[if IE]>
		<style>
			.left_panel{
				 margin-top:-53px;
			}
		</style>
	<![endif]-->
	<div id="loading_soft" class="sai_loading_soft">
		<img src="' . $theme['images'] . 'fb_loader.gif" alt="Loading..." />
	</div>';
    echo '<table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top:-53px;"> 
		<tr>
			<img src="' . $theme['images'] . 'menu.png" alt="Left_menu" class="left_toggle_btn" id="left_toggle_btn">
			<td width="' . (!empty($softpanel->leftpanel_resize) ? '192' : '220') . '" valign="top" class="left_panel" style="min-height:100%;">
				<!--left panel table start here-->
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td align="center">
								<center>
									<a href="' . $globals['ind'] . '"><img src="' . ($globals['softpanel'] == 'ampps' ? $theme['a_images'] . 'header.png' : (empty($globals['logo_url']) ? $globals['softpanel'] == 'webuzo' ? $theme['a_images'] . 'header.png' : $theme['images'] . 'header.png' : $globals['logo_url'])) . '" alt="" height="' . (!empty($softpanel->leftpanel_resize) ? '60' : '70') . '"/></a>
								</center>
							</td>
						</tr>';
    if ($ind != 'classes') {
        echo '<tr>
							<td>
								<table cellspacing="0" cellpadding="0" border="0" align="center">
									<tr><br />
										<td align="right">
											<form accept-charset="' . $globals['charset'] . '" name="search" method="post" action="' . $globals['ind'] . 'act=search&smode=' . $globals['mode'] . '" onsubmit="return checksearchform();" id="searchform">
												<input type="text" name="inputString" size="23" id="inputString" onfocus="this.value=\'\';" value="' . $l['search'] . '" onblur="this.value=\'' . $l['search'] . '\';init();" onKeyUp="search_scripts(this.value);" autocomplete="off"  sugurl="' . $globals['index'] . '&act=suggest&smode=' . $globals['mode'] . '" mode="' . $globals['mode'] . '" class="sai_search_left" style="margin-bottom:8px;"/>
												<img src="' . $theme['images'] . 'search.png" class="sai_search_img" />
												<input type="hidden" name="hidden_cid" id="hidden_cid" />
												<div id="suggestions" class="sai_suggestions" style="position:absolute;left:0px; top:0px; display:none;"></div>
											</form>
										</td>
									</tr>
								</table>
								<!--<div class="search_suggestion" style="display:none"></div>-->
							</td>
						</tr>';
    }
    if (!empty($leftbody)) {
        if ($ind == 'classes' || optGET('act') == 'classes') {
            echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
								
		(function($) {
			$.extend($.fx.step,{
				backgroundPosition: function(fx) {
					if (fx.state === 0 && typeof fx.end == \'string\') {
						var start = $.curCSS(fx.elem,\'backgroundPosition\');
						if(typeof(start) == "undefined"){
							start = $.css(fx.elem, "background-position-x")+\' \'+$.css(fx.elem, "background-position-y");
						}
						start = toArray(start);
						fx.start = [start[0],start[2]];
						var end = toArray(fx.end);
						fx.end = [end[0],end[2]];
						fx.unit = [end[1],end[3]];
					}
					var nowPosX = [];
					nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
					nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
					fx.elem.style.backgroundPosition = nowPosX[0]+\' \'+nowPosX[1];
		
				   function toArray(strg){
					   strg = strg.replace(/left|top/g,\'0px\');
					   strg = strg.replace(/right|bottom/g,\'100%\');
					   strg = strg.replace(/([0-9\\.]+)(\\s|\\)|$)/g,"$1px$2");
					   var res = strg.match(/(-?[0-9\\.]+)(px|\\%|em|pt)\\s(-?[0-9\\.]+)(px|\\%|em|pt)/);
					   return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
				   }
				}
			});
		})(jQuery);
		
			
		// this function will add blue arrow after clicking	
		$(function(){
			$("#cmenu li a").click(function(){
				 $(this).removeClass("softlinkscurrent");
				 $(this).addClass("softlinkscurrent");
			 })
		});
		
		//function to display list of classes
		function show_list(start, length, cat){
			$("#softcontent").fadeOut(0);
			$_("loading_soft").style.top = (scrolledy()+250)+"px";
			$("#loading_soft").show();
			$("#softcontent").html("");
			goto_top();	
			$.getJSON("' . $globals['api_nuphp'] . 'category_classes.php?cat="+cat+"&in=json&start="+start+"&length="+length+"&callback=?", 
			function (data) {
				if (typeof(data.data)!="object" || typeof data.data == "undefined"){
				  $("#loading_soft").hide();//hide fb loader
				  $("#softcontent").html("<center><span class=\'sai_newhead\'>' . $l['classes_con_failed'] . '</span></center>");	
				  $("#softcontent").fadeIn(300);
				}
				var soft_classes = \'<div class="bg"><br /><div class="row row_usi_cls">\';
				var br = 1; 
				$.each(data.data, function (i, item) {
					soft_classes += \'<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12" style="padding-bottom: 20px;"><div class="sai_classes_boxgrid2" onclick=window.location=this.id; id="' . $globals['index'] . 'act=classes&cid=\'+item.cid+\'&tab=overview" ><div class="sai_classes_boxgrid"><div><h2>\'
					+item.name+
					\'</h2><p style="padding:10px;height:50px;">\'
					+item.desc+\'</p><p style="padding:10px;height:15px;"> <b>' . $l['cl_ratings'] . '</b> : \'
					+parseFloat(item.ratings)+\'/5</p> </div><div style="height:200px;"><br /><h2>\'
					+item.name+
					\'</h2><p style="margin-left:10px;margin-top:20px"><b> ' . $l['cl_author'] . '</b> : \'
					+item.author+\'</p><p style="margin-left:10px;"><b> ' . $l['cl_license'] . '</b> :\'
					+item.license+\'</p><p style="margin-left:10px;"><b> ' . $l['cl_version'] . '</b> :\'
					+item.version+\'</p><div align="center"> <a href="' . $globals['index'] . 'act=classes&cid=\'+item.cid+\'&tab=install" style="margin:5px;" class="sai_cbutton"> ' . $l['cl_install_but'] . ' </a><a href="' . $globals['index'] . 'act=classes&cid=\'+item.cid+\'&tab=file" style="margin:5px;"class="sai_cbutton"> ' . $l['cl_show_files'] . '</a></div></div></div></div></div>\';
					 
					 br += 1 ;
				});// end of each loop
		
				soft_classes += "</div></div>";
				
				$("#softcontent").append(soft_classes); 
				
				// Pagination Coding
				var p1 = 0; // Start variable for mysql api . length is set to 12
				
				// Find which is the current page
				var current = (start/length) + 1;
				var class_pagination = \'<center><div class="pagination"><ul>\';
				for (i=1; i<=data.pages; i++)
				{
					var page_class = "sai_cbutton";
					if(i == current){
						page_class += " selected_page";
					}			
					
					class_pagination += \'<li style="display:inline;font-size:18px;font-style:italic;margin-right:3px;cursor:pointer"><a class="\'+page_class+\'" style="background: #F5F5F5;color:#000;" onclick="show_list(\'+p1+\',12, \\\'\'+data.class_category+\'\\\');" href="javascript:void(0)" >\'+ i+\'</a></li>\';
					p1+=12;
				}
				
				class_pagination+= \'</ul></div></center>\';	
		
				$("#softcontent").append(class_pagination);
				$("#loading_soft").hide();//hide fb loader
				$("#softcontent").fadeIn(300);	
						
				window.location.hash = "!act=listclasses&cat="+data.class_category;	
				
				$(".sai_classes_boxgrid").hover(function(){$(this).stop().animate({top:"-200px"},{queue:false,duration:200});},function() 
				{$(this).stop().animate({top:"0px"},{queue:true,duration:200});});
				
			}); // end of get json function
		
		}//end of show list
								
// ]]></script>';
        }
        // end of $ind == 'classes'
        $theme['leftbody'] = $leftbody;
        echo '<tr>
								<td id="load_leftpanel_js">';
        // Only for classes menu
        if ($ind == 'classes') {
            echo '<ul class="softlinks" id="cmenu">';
            ksort($classes_categories);
            foreach ($classes_categories as $key => $value) {
                echo '<li>
												<a onclick="show_list(0, 12, \'' . $key . '\');  return false;" href="javascript:void(0)" >' . $l['classes_' . $key] . '<div class="class_arrow"><img src="' . $theme['images'] . 'collapsed.png"></div></a>
											</li>';
            }
            echo '</ul>';
        } else {
            $icat = 0;
            $str = '<script>
									var cat_lang = new Array();
									var catimg_from_site = new Array();';
            foreach ($allcatwise as $i_ind => $ind_type) {
                foreach ($ind_type as $cat => $softs) {
                    if (empty($softs)) {
                        continue;
                    }
                    // If we have any cat images to be load from our website
                    if (!empty($GLOBALS['catimgs'][$i_ind . '_' . $cat])) {
                        $str .= 'catimg_from_site[\'' . $i_ind . '_' . $cat . '\'] = "' . $GLOBALS['catimgs'][$i_ind . '_' . $cat] . '";';
                    }
                    $str .= 'cat_lang[\'cat_' . $i_ind . '_' . $cat . '\'] = "' . $l['cat_' . $i_ind . '_' . $cat] . '";';
                }
            }
            $str .= '
									
									var iscripts = new Array("' . implode('", "', array_keys($iscripts)) . '");
									var apps = new Array("' . implode('", "', array_keys($apps)) . '");
									</script>';
            echo $str;
        }
        // End of ELSE (i.e for iscripts)
        echo '</td>
						</tr>';
    }
    echo '</table>
				</td>
				<td colspan="2"  valign="top">
				
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

function goto_panel(){
			
	var str = window.location; 	
	
	var port_find = str.toString().search(\'2003\'); 	

	if(port_find < 1){		
		var str_url = str.toString().replace("2002", "2004");
	}else{
		var str_url = str.toString().replace("2003", "2005");
	}
	
	var res = str_url.split("/",4);
	
	var res_out = res.join("/");	
	
	window.location = res_out+"/";	
}

function in_array(val, array){
											
	for (i=0; i <= array.length; i++){
		if (array[i] == val) {
			return true;
			// {alert(i +" -- "+ids[i]+" -- "+val);return i;}
		}
	}
	return false;
}

var ind_types_array = new Array("ind_php", "ind_perl", "ind_java", "ind_python");

var all_ind_types_array = new Array("ind_php", "ind_perl", "ind_java", "ind_apps", "ind_js", "ind_python");

$(document).ready(function(){
	var shown=false;
	
	$("#left_toggle_btn").on("click", function(e){
		shown=$(".left_panel").is(":visible");
		$(".left_panel").toggle("1000",function(){
			$(".left_panel").css({"position":"absolute", "z-index":"1000"});
		});
		if(!shown){
			$(".left_toggle_btn").animate({
				left: "' . (!empty($softpanel->leftpanel_resize) ? '192' : '220') . 'px"
			},"1000");
		}else{
			$(".left_toggle_btn").animate({
				left: "0px"
			},"1000");
		}
	});
	
	$("#header_toggle_btn").click(function(){
		$(".soft_nav_mob").slideToggle("slow");
	});
	
	$(".top").click(function(){									
		$("html, body").animate({ scrollTop: 0 }, 500);
		return false;
	});
	
	$(".someclass").tipTip({delay:0});
	
	function checksearchform(){
		if($_("inputString").value == ""){
			return false;
		}else{
			return true;
		}
	};
	
});

function set_pheader(){
	var cur_status = getcookie("pheader");
	if(cur_status == "no" || cur_status == false){
		setcookie("pheader","yes",365);
	}else{
		removecookie("pheader");
		setcookie("pheader","no",365);
	}
	//alert(getcookie("pheader"));
	window.location.href = window.location;
}';
    // If the $ind == classes than dond load unecessary stuff
    if ($ind != 'classes') {
        echo 'function initiate_status(){
		var main = $("#softmain tr");
		
		main.each(function(){
			
			var cookie_id = $(this).closest("tr").attr("id");
			var if_isset = getcookie(cookie_id);
			var tmp_cookieid = String(cookie_id);
			
			if(if_isset == 2 && tmp_cookieid != "undefined"){
				
				//alert(if_isset+"--"+ cookie_id)
				var id = $($("#"+cookie_id).next("tr").find("div"));
				//alert(id.attr("id"))
				id.show();	
				var tmp_img = tmp_cookieid.split("_");
				$("#icat"+tmp_img[1]).attr("src", "' . $theme['images'] . 'expanded.png");
			}
		});
	}
	
	function show_left_panel(combine){
		var str_html = "";
		var icat = 0;
		
		$.each(allcatwise, function (i_ind, ind_type) {
			$.each(ind_type, function (i, item) {
				
				if(catimg_from_site[i_ind+\'_\'+i] != undefined || catimg_from_site[i_ind+\'_\'+i] != null){
					var catimg = catimg_from_site[i_ind+\'_\'+i];
				}else{
					var catimg = "' . $theme['images'] . 'cats/"+i_ind+"_"+i+".png";
				}
				
				var if_isset = getcookie("head_"+icat);
				var tmp_cookieid = String("head_"+icat);
				var display_open = "none";
				if(if_isset == 2 && tmp_cookieid != "undefined"){
					display_open = "block";
				}
				var show_combined = true;
				var isset_ind = ' . (isset($_GET['ind']) ? '"' . $_GET['ind'] . '"' : '0') . ';
				
				if(!isset_ind){
					isset_ind = ' . (isset($_GET['act']) ? '"' . $_GET['act'] . '"' : '0') . ';
				}
				
				if(!in_array("ind_"+isset_ind, all_ind_types_array)){
					isset_ind = "php";
				}
				
				if(isset_ind == "software"){
					isset_ind = "php";
				}
				
				if(isset_ind){
					var show_i_ind = isset_ind;
				}else{
					var show_i_ind = "php";
				}
				
				var cat_key = "cat_"+i_ind+"_"+i;
				str_html += \'<table border="0" cellpadding="0" cellspacing="0" id="softmain" width="100%">\';
				
				if(i_ind == show_i_ind){
					
				str_html += \'<tr id="head_\'+icat+\'" class="soft_cathead_slide"><td width="80%" class="soft_cathead" height="32" valign="middle"><a href="' . (empty($globals['lictype']) ? '#' : $globals['indmode'] . 'act=listsoftwares&cat=\'+i+\'') . '" onclick="ajax_listsoftware(\\\'\'+i+\'\\\'); return false;"><i class="fa sai-\'+i+\' fa-lg"></i>&nbsp;&nbsp;\'+cat_lang[cat_key]+\'</a></td>' . (empty($globals['lictype']) ? '<td align="left" width="5%"><a href="http://www.softaculous.com/softwares/\'+i+\'"><img src="' . $theme['images'] . 'external.gif" alt="" /></a></td>' : '') . '<td width="5%"><a href="javascript:void(0);"><img src="' . $theme['images'] . 'collapsed.png" alt="" valign="top" id="icat\'+icat+\'"/></a></td></tr><tr><td><div id="leftcontent" style="display:none"><ul class="softlinks">\';
				
				$.each(item, function (sid, softw) {
					var tmp_sid = sid.split("_");
					sid = tmp_sid[1];
					var acts = softw.type;
					if(acts == "php"){
						acts = "software";
					}
					
					var soft = "soft";
					
					if(acts == "app" || acts == "service"){
						acts = "apps";
						soft = "app";
					}
					
					var searchin = iscripts;
					
					if(soft == "app"){
						searchin = apps;
					}
					
					var li_classes = "";
					
					' . (!empty($soft) ? 'if(' . $soft . ' == sid) li_classes = "class=\\"softlinkscurrent\\"";' : '') . '
					if((softw.parent != undefined || softw.parent != null) && in_array(softw.parent, iscripts)){
						return;
					}
					
					if(!in_array(sid, searchin)){
						return;
					}
					
					//alert(isset_ind +"--||"+ not_selected_ind)
					if(isset_ind){
						
						// Removed this because causing issues in paper_lantern Native UI
						/*for(x in ind_types_array){
							//alert(ind_types_array[x]);
							var get_ind_type = getcookie(ind_types_array[x]);
							if(get_ind_type == "yes"){
								var tmp_arr = String(ind_types_array[x]).split("_");
								removecookie(get_ind_type);
								setcookie(get_ind_type, "no", 365);
								$("#"+tmp_arr[1]).removeClass("soft_nav_selected");
								//$("#"+tmp_arr[1]).addClass("soft_nav_selected");
							}
						}*/
						
						show_combined = false;
					}
					
					if(combine){
						show_combined = true;
						$("#"+combine).addClass("soft_nav_selected");
					}
					
					if(acts == "apps"){
						show_combined = true;
					}
					
					if(in_array(sid, searchin) && show_combined){
						
						str_html += \'<li \'+li_classes+\'><a href="' . $globals['ind'] . 'act=\'+acts+\'&\'+soft+\'=\'+sid+\'" title="\'+softw.desc+\'">\'+softw.name+\'</a></li>\';
					}
					
					if(softw.type == i_ind && !show_combined){
						
						str_html += \'<li \'+li_classes+\'><a href="' . $globals['ind'] . 'act=\'+acts+\'&\'+soft+\'=\'+sid+\'" title="\'+softw.desc+\'">\'+softw.name+\'</a></li>\';
					}
				});
				}
				str_html += \'</ul></div></td></tr></table>\';
				icat = icat + 1;
				
			});	
		});
		$("#load_leftpanel_js").html(str_html);
		
	}
	var on_index_page = ' . (isset($_GET['ind']) ? '"' . $_GET['ind'] . '"' : '0') . ';
				
	if(!on_index_page){
		on_index_page = ' . (isset($_GET['act']) ? '"' . $_GET['act'] . '"' : '0') . ';
	}
	
	if(!on_index_page){
		show_left_panel(1);
	}else{
		show_left_panel(0);
	}
	
	
	remove_unnecessary_tables();
	initiate_status();
	
	
	$(".indtype").click(function(e) {
		var chk_ind = $(this).attr("id");
		if(chk_ind == "js" || chk_ind == "apps" || chk_ind == "classes") return true;
		if(e.shiftKey) {
		//Shift-Click
		}
		if(e.ctrlKey) {
			
			var indtype_name = "ind_"+$(this).attr("id");
			var get_ind_type = getcookie(indtype_name);
			
			if(get_ind_type == "no" || get_ind_type == false){
				setcookie(indtype_name, "yes", 365);
				$(this).addClass("soft_nav_selected");
			}else{
				removecookie(indtype_name);
				setcookie(indtype_name, "no", 365);
				$(this).removeClass("soft_nav_selected");
			}
			
			show_left_panel($(this).attr("id"));
			remove_unnecessary_tables();
			init();
			initiate_status();
			
			return false;
			//Ctrl+Click
		}
		if(e.altKey) {
		//Alt+Click
		}
	});
	
	function search_scripts(val){
		
		var q = val.toLowerCase();
		var qlen = val.length;
		
		var str_html = "";
		var icat = 0;
		var cats_array = new Array();
		$.each(allcatwise, function (i_ind, ind_type) {
			
			$.each(ind_type, function (i, item) {
				
				if(catimg_from_site[i_ind+\'_\'+i] != undefined || catimg_from_site[i_ind+\'_\'+i] != null){
					var catimg = catimg_from_site[i_ind+\'_\'+i];
				}else{
					var catimg = "' . $theme['images'] . 'cats/"+i_ind+"_"+i+".png";
				}
				
				var isset_ind = ' . (isset($_GET['ind']) ? '"' . $_GET['ind'] . '"' : '0') . ';
				
				if(isset_ind){
					var show_i_ind = "' . $_GET['ind'] . '";
				}else{
					var show_i_ind = "php";
				}
				
				var cat_key = "cat_"+i_ind+"_"+i;
				
				// If all scripts in that category is disabled by Admin it was showing "undefined" so to resolve this we have written the following code.
				if(typeof cat_lang[cat_key] == "undefined"){
					for(x in ind_types_array){
						var tmp_arr = String(ind_types_array[x]).split("_");
						var tmp_cat_key = "cat_"+tmp_arr[1]+"_"+i;
						if(typeof cat_lang[tmp_cat_key] != "undefined" && typeof cat_lang[tmp_cat_key] == "string"){
							var cat_key = tmp_cat_key;
						}
					}
				}
				
				str_html += \'<table border="0" cellpadding="0" cellspacing="0" id="softmain" width="100%">\';
				if((i_ind == show_i_ind || i_ind == "apps" || i_ind == "js") && typeof cat_lang[cat_key] != "undefined"){
					str_html += \'<tr id="head_\'+icat+\'" class="soft_cathead_slide"><td width="100%" class="soft_cathead" valign="middle" height="32"><a href="' . (empty($globals['lictype']) ? '#' : $globals['indmode'] . 'act=listsoftwares&cat=\'+i+\'') . '" onclick="ajax_listsoftware(\\\'\'+i+\'\\\'); return false;"><i class="fa sai-\'+i+\' fa-lg"></i>&nbsp;&nbsp;\'+cat_lang[cat_key]+\'</a></td>' . (empty($globals['lictype']) ? '<td align="left" width="5%"><a href="http://www.softaculous.com/softwares/\'+i+\'"><img src="' . $theme['images'] . 'external.gif" alt="" /></a></td>' : '') . '<td width="5%"><a href="javascript:void(0);"><img src="' . $theme['images'] . 'expanded.png" alt="" valign="top" id="icat\'+icat+\'"/></a></td></tr><tr><td><div id="leftcontent"><ul class="softlinks">\';
					
					$.each(item, function (sid, softw) {
						var tmp_sid = sid.split("_");
						sid = tmp_sid[1];
						
						var acts = softw.type;
						if(acts == "php"){
							acts = "software"
						}
						
						var soft = "soft";
						
						if(acts == "app" || acts == "service"){
							acts = "apps";
							soft = "app";
						}
						
						var searchin = iscripts;
						
						if(soft == "app"){
							searchin = apps;
						}
						
						var name = String(softw.name);
						var searched = name.substr(0, qlen).toLowerCase();
						
						if(searched == q){
							
							if((softw.parent != undefined || softw.parent != null) && in_array(softw.parent, iscripts)){
								return;
							}
							if(in_array(sid, searchin)){
								str_html += \'<li><a href="' . $globals['ind'] . 'act=\'+acts+\'&\'+soft+\'=\'+sid+\'" title="\'+softw.desc+\'">\'+softw.name+\'</a></li>\';
							}
						}
					});
				}
				str_html += \'</ul></div></td></tr></table>\';
				icat = icat + 1;
			});
		});
		
		
		$("#load_leftpanel_js").html(str_html);
		remove_unnecessary_tables();
		init();
	}
	
	function remove_unnecessary_tables(){
		
		var icat = 0;
		$.each(allcatwise, function (i_ind, ind_type) {
			$.each(ind_type, function (i, item) {
				var id = $($("#head_"+icat).next("tr").find("div").children());
				if(id.children().length == 0){
					$("#head_"+icat).closest("table").remove();
					//$("#head_"+icat).remove();
				}
				icat = icat + 1;
			});
		});
		
		if($("#load_leftpanel_js").children().length == 0){
			$("#load_leftpanel_js").html("<center>' . $l['no_script_found'] . '</center>");
			$("#load_leftpanel_js").css("color", "' . (!empty($user['color_theme']['left_panel_scriptname']) ? $user['color_theme']['left_panel_scriptname'] : $globals['default_scriptname_text']) . '");
		}
	}';
    }
    // End of if($ind != 'classes')
    echo '
function init(){
	
$(".soft_cathead_slide").click(function(){
	
	var cat_head = $(this).attr("id");
	var tmp_img = cat_head.split("_");
	
	var id = $($(this).next("tr").find("div"));
	//alert(id.attr("id"))
	if(id.css("display") == "none"){
		id.slideDown("slow");
		$("#icat"+tmp_img[1]).attr("src", "' . $theme['images'] . 'expanded.png");
		setcookie(cat_head, 2, 365);
	}else{
		id.slideUp("slow");
		removecookie(cat_head);
		setcookie(cat_head, "", -365);
		$("#icat"+tmp_img[1]).attr("src", "' . $theme['images'] . 'collapsed.png");
	}
});

// navigation background fading effect . it will work only on loading external javascript file jquery.bgpos.js in js folder
$(function(){
	$(".soft_cathead, .soft_cathead_slide").mouseover(function()
	{
		 $(this).animate({color:"#fff",paddingLeft: "10px"});
	})
	.mouseout(function()
	{
		$(this).stop().animate({color:"#fff",paddingLeft: "10px"});
	})
});';
    // if user has it own color scheme than we will have to change the css boy!';
    if (!empty($user['user_defined_color']) || !empty($globals['default_hf_bg']) || !empty($globals['default_cat_hover']) || !empty($globals['default_hf_text']) || !empty($globals['default_scriptname_text'])) {
        // For changing text colors of category heading hover color
        if (!empty($user['color_theme']['left_panel_cathead_hover']) || !empty($globals['default_cat_hover'])) {
            echo '
		$(".soft_cathead_slide, .soft_cathead").mouseover(function(){
			$(this).css("background-color", "' . (!empty($user['color_theme']['left_panel_cathead_hover']) ? $user['color_theme']['left_panel_cathead_hover'] : $globals['default_cat_hover']) . '");
		});
		
		$(".soft_cathead_slide, .soft_cathead").mouseout(function(){
			$(this).css("background-color", "' . (!empty($user['color_theme']['left_panel_bg']) ? $user['color_theme']['left_panel_bg'] : $globals['default_hf_bg']) . '");
		});';
        }
        // For changing background color
        if (!empty($user['color_theme']['left_panel_bg']) || !empty($globals['default_hf_bg'])) {
            echo '
		$(".soft_nav").css("background", "none");
		$(".left_toggle_btn").css("background", "none");
		$(".soft_nav_mob").css("background", "none");
		$(".soft_nav").css("filter", "none");
		$(".soft_nav").css("background-color", "' . (!empty($user['color_theme']['left_panel_bg']) ? $user['color_theme']['left_panel_bg'] : $globals['default_hf_bg']) . '");
		$(".left_panel").css("background-image", "none");
		$(".left_panel").css("background-color", "' . (!empty($user['color_theme']['left_panel_bg']) ? $user['color_theme']['left_panel_bg'] : $globals['default_hf_bg']) . '");
		$(".left_toggle_btn").css("background-color", "' . (!empty($user['color_theme']['left_panel_bg']) ? $user['color_theme']['left_panel_bg'] : $globals['default_hf_bg']) . '");
		$(".soft_nav_mob").css("background-color", "' . (!empty($user['color_theme']['left_panel_bg']) ? $user['color_theme']['left_panel_bg'] : $globals['default_hf_bg']) . '");
		$(".footer").css("background-color", "' . (!empty($user['color_theme']['left_panel_bg']) ? $user['color_theme']['left_panel_bg'] : $globals['default_hf_bg']) . '");';
        }
        // For changing text colors of script names
        if (!empty($user['color_theme']['left_panel_scriptname']) || !empty($globals['default_scriptname_text'])) {
            echo '$(".softlinks li a").css("color", "' . (!empty($user['color_theme']['left_panel_scriptname']) ? $user['color_theme']['left_panel_scriptname'] : $globals['default_scriptname_text']) . '");';
        }
        // For changing text colors of category heading
        if (!empty($user['color_theme']['left_panel_cathead']) || !empty($globals['default_hf_text'])) {
            echo '$(".soft_cathead a").css("color", "' . (!empty($user['color_theme']['left_panel_cathead']) ? $user['color_theme']['left_panel_cathead'] : $globals['default_hf_text']) . '");
		$(".soft_nav a").css("color", "' . (!empty($user['color_theme']['left_panel_cathead']) ? $user['color_theme']['left_panel_cathead'] : $globals['default_hf_text']) . '");';
        }
    }
    echo '}// End of init()

init();

function ajax_listsoftware(str_id){
				
	$("#softcontent").fadeOut(0);
	$_("loading_soft").style.top = (scrolledy()+250)+"px";
	if($(".sp-container")){
		$(".sp-container").hide();
	}
	$("#loading_soft").show();
	
	$("#softcontent").load("' . $globals['indexmode'] . 'act=listsoftwares&cat="+str_id+"&jsnohf=1", 
		function(){
			$("#loading_soft").hide();
			$("#softcontent").fadeIn(300);
		}
	);
	
	
	window.location.hash = "!act=listsoftwares&cat="+str_id;
}

// ]]></script>';
    //Everything else will go here
    echo '<div align="right" class="sai_head" style="width:100%; padding-right:25px; padding-top:53px;">
			' . (webuzo() && $softpanel->getCurrentUser() == 'root' ? $l['root_login'] : '') . '&nbsp; ' . $l['welcome'] . ' ' . (empty($softpanel->user['displayname']) ? $softpanel->user['name'] : $softpanel->user['displayname']) . '
		</div>
		<div id="softcontent">';
}