function show_js($files, $showSettings = true)
{
    global $root;
    $hash = '';
    if ($showSettings) {
        $hash .= filemtime($root . '/local/settings.php');
    }
    foreach ($files as $file) {
        $path = $root . '/' . $file . '.js';
        if (file_exists($path)) {
            $hash .= $file . filemtime($path);
        }
    }
    $md5 = md5($hash);
    $cpath = $root . '/resources/c/' . $md5 . '.js';
    if (!file_exists($cpath)) {
        require_once 'JSMin.php';
        $text = '';
        if ($showSettings) {
            $text .= settings_js();
        }
        foreach ($files as $file) {
            $path = $root . '/' . $file . '.js';
            if (file_exists($path)) {
                $text .= file_get_contents($path) . "\n\n";
            }
        }
        if (TEST) {
            $js = $text;
        } else {
            $js = JSMin::minify($text);
        }
        file_put_contents($cpath, $js);
    }
    echo '<script type="text/javascript" src="/resources/c/' . $md5 . '.js"></script>' . "\n";
}
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.squid.inc');
	
	
$usersmenus=new usersMenus();
if(!$usersmenus->AsSquidAdministrator){
	$tpl=new templates();
	$alert=$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
	echo "alert('$alert');";
	die();	
}

if(isset($_POST["ProxyPacCacheTime"])){settings_save();exit;}
if(isset($_GET["settings-js"])){settings_js();exit;}
if(isset($_GET["settings-popup"])){settings_popup();exit;}
if(isset($_POST["EmptyCache"])){EmptyCache();exit;}
if(isset($_GET["tabs"])){tabs();exit;}
if(isset($_GET["help"])){help();exit;}

if(isset($_GET["events"])){events();exit;}
if(isset($_GET["events-search"])){events_search();exit;}
if(isset($_GET["events-script"])){events_script_js();exit;}
if(isset($_GET["events-script-popup"])){events_script_popup();exit;}
if(isset($_GET["events-script-tester-js"])){events_script_tester_js();exit;}
if(isset($_GET["events-script-tester-popup"])){events_script_tester_popup();exit;}
if(isset($_POST["TESTER-URL"])){events_script_tester_perform();exit;}


if(isset($_POST["rebuild-tables"])){rebuild_tables();exit;}
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.users.menus.inc';
include_once 'ressources/class.squid.inc';
$usersmenus = new usersMenus();
if (!$usersmenus->AsSquidAdministrator) {
    $tpl = new templates();
    $alert = $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
    echo "alert('{$alert}');";
    die;
}
if (isset($_POST["ProxyPacCacheTime"])) {
    settings_save();
    exit;
}
if (isset($_GET["settings-js"])) {
    settings_js();
    exit;
}
if (isset($_GET["settings-popup"])) {
    settings_popup();
    exit;
}
if (isset($_POST["EmptyCache"])) {
    EmptyCache();
    exit;
}
if (isset($_GET["tabs"])) {
    tabs();
    exit;
}
if (isset($_GET["help"])) {