HEX
Server: LiteSpeed
System: Linux w5304130.sdnsbox.com 4.18.0-425.3.1.lve.el8.x86_64 #1 SMP Tue Nov 22 22:59:23 EST 2022 x86_64
User: makefitmeserver (1001)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //var/softaculous/apps/apache2/themes/admin/apache_modules_theme.php
<?php

//////////////////////////////////////////////////////////////
//===========================================================
// WEBUZO CONTROL PANEL
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Pulkit
// Date:       10th Jan 2009
// Time:       21:00 hrs
// Site:       https://webuzo.com/ (WEBUZO)
// ----------------------------------------------------------
// Please Read the Terms of Use at https://webuzo.com/terms
// ----------------------------------------------------------
//===========================================================
// (c) Softaculous Ltd.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('SOFTACULOUS')){
	die('Hacking Attempt');
}

function apache_modules_theme(){

	global $user, $globals, $l, $theme, $error, $done, $modules_list;
	
	// r_print($modules_list);
	echo '
<div class="soft-smbox col-12 col-md-12 mx-auto p-2">
	<div class="sai_main_head">
		<img src="'.$theme['images'].'apache_settings.png" class="me-1"/>'.__('Apache Modules').'
	</div>
</div>
	
<div class="soft-smbox col-12 col-md-12 mx-auto p-3 mt-4">';
	if(empty($modules_list['modules']) || isset($modules_list['error'])){
	
		echo '
	<div class="sai_head text-center">
		<h4>'.__('No Modules Found').'</h4>
	</div>';
	
	}else{
		echo '
	<div id="dispconf">';
	
		echo '
		<form accept-charset="'.$globals['charset'].'" name="apache_modules" method="post" action="" id="editmoduletext" onsubmit="return submitExtForm(this)">
			
			<div class="sai_sub_head text-center my-4 position-relative">
				'.__('Search Module').' :
				
				<select class="form-select my-3 make-select2" s2-placeholder="'.__('Search Module').'" style="width: 30%" name="module_search" id="module_search">
					<option value="0" selected>All</option>';
					foreach($modules_list['modules'] as $key => $val){
						echo '<option value="'.$key.'">'.$key.'</option>';
					}
					echo '
				</select>
				
				<div class="col-12 col-lg-2 float-end m-1">
					<button type="button" name="reset" class="btn btn-danger" title="If clicked modules will reset to default." onclick="reset_module(this)">Reset Module</button>
				</div>
				
			</div>
			
			<div class="alert alert-info alert-dismissible fade show alert-sm" role="alert">
				<b>'.__('Note:').'</b> '.__('Some modules depend on other modules, which means they can only be turned off (or on) when the modules they depend on are also turned off (or on).').'
				<button type="button" class="btn-close btn-sm" data-bs-dismiss="alert" aria-label="Close"></button>
			</div>
			
			<div class="alert alert-warning alert-dismissible fade show alert-sm" role="alert">
				<b>'.__('Caution: ').'</b>'.__('Toggling modules may impact Apache performance or even render it inoperable. Proceed only if you fully understand the consequences of your actions.').'
				<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
			</div>

			<table border="0" cellpadding="8" cellspacing="0" class="table webuzo-table td_font">
			<thead>
				<tr>
					<th colspan="4" class="text-start">'.__('Modules').' [ '.__('Enabled: $0, Disabled: $1', [$modules_list['enabled_count'], $modules_list['disabled_count']]).' ]</th>
					<th colspan="4" class="text-end">'.__('Select All').'&nbsp;
						<input type="checkbox" id="check_all_ext"/>
					</th>
				</tr>
			</thead>
			</table>
			<div id="modules_list" class="row">';
				
			echo '
			</div>
			
			<div class="text-center">			
				<input type="submit" value="'.__('Save').'" name="save_modules" class="btn btn-primary" id="savemodules" />
			</div>
		</form>
	</div>';
	}
	
	echo '
</div>

<script language="javascript" type="text/javascript">

$(document).ready(function(){
	var data = {modules_list:'.json_encode($modules_list['modules']).'}
	// console.log(data);
	
	var search = $("#module_search").val();
	
	f(search);
	
	$("#module_search").on("change", function(){
		var search = $(this).val();
		f(search);
	})
	
	create_ext_table(data);
	$("#check_all_ext").on("click", function(event){
		if(this.checked == true){
			$(".check_ext").prop("checked", true);
		}else{
			$(".check_ext").prop("checked", false);
		}
	});
	
	$(".module_box").on("click", function(e) {
		if(e.target==this){
				var checkbox = $(this).find("input");
				checkbox.prop("checked", !checkbox.prop("checked"));	
				$(this).toggleClass("selected");
		}else{
			$(this).toggleClass("selected");
		}
	});
});

function submitExtForm(ele){
	// console.log(ele);return false;
	var d = {};
	var modules = [];		
	$(".check_ext").each(function () {
		if ($(this).is(":checked")) {
			var ext = $(this).data("ext");
			modules.push(ext);
		}
	});
	
	if(modules.length === 0 ){
		modules = ["disableall"];
	}
	
	d.modules = modules.join(",");
	d.save_modules = 1;
	submitit(d, {done_reload : window.location.href});
	return false;
}
	
function create_ext_table(data){
	// console.log(data.modules_list);
	var tmphtml = "";
	
	$.each(data.modules_list, function(key, value){

		tmphtml += \'<div class="col-12 col-md-6  col-lg-4 td-bg" id="chk_\'+key.replace(".so", "")+\'" data-m="\' + key +\'">\';
		tmphtml += \'<label class="sai_head checkbox-inline p-2 d-flex cursor-pointer" style="width:100%;">\';
		tmphtml += \'<input type="checkbox" name="moduleslist[\'+key+\']" id="moduleslist[\'+key+\']" value="1" \'+ (value != 1 ? "" : "checked")+\' data-ext="\'+key+\'" class="check_ext mx-1"/>\';
		tmphtml += \'<span width="22%" class="td-bg" id="lbl_\'+key.replace(".so", "")+\'" data-m="\'+key+\'"><label for="moduleslist[\'+key+\']"><span class="sai_head me-1">\'+key+\'</span></label>\';
		tmphtml += \'</label>\';
		tmphtml += \'</span>\';
		tmphtml += \'</div>\';
			
	});
	
	$("#modules_list").html(tmphtml);
	
}

function reset_module(ele){
	var jEle = $(ele);
	a = show_message_r("'.__js('Warning').'", "'.__js('Are you sure you want to reset the modules ? <br> <b>NOTE : This action will reset all modules to default state.</b>').'");
	a.alert = "alert-warning";
	
	a.confirm.push(function(){
		submitit({"reset" : 1}, {done_reload: window.location.href});
	});
	
	show_message(a);
}

var f = function(selectedModule){
	
	if(empty(selectedModule)){
		return;
	}
	
	var cb = selectedModule.replace(".so", "");
	var lbl = selectedModule.replace(".so", "");

	$(".td-bg").each(function() {
	  var m = $(this).data("m");
	  var id = m.replace(".so", "");

	  if (m == selectedModule) {
		
		var offsetTop = $("#chk_" + id).offset().top - ($(window).height() / 2) + ($("#chk_" + id).outerHeight() / 2);
		$("html, body").animate({ scrollTop: offsetTop }, 10);
		
		$("#chk_" + id).css("background-color", "#cff4fc");
		$("#lbl_" + id).css("background-color", "#cff4fc");
	  } else {
		$("#chk_" + id).css("background-color", "");
		$("#lbl_" + id).css("background-color", "");
	  }
	});

	
}
</script>';

}