示例#1
0
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["DELETE"])) {
    DELETE_FROM_CACHE();
    exit;
}
if (isset($_GET["list"])) {
    WEBSITES_SEARCH();
    exit;
}
if (isset($_GET["DeleteWebsiteZCached-js"])) {
    DeleteWebsiteZCached_js();
    exit;
}
page();
function DeleteWebsiteZCached_js()
{
    header("content-type: application/x-javascript");
    $page = CurrentPageName();
    $time = time();
    $html = "\nvar xDeleteWebsiteZCached{$time}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#row{$_GET["ID"]}').remove();\t\t\t\n}\t\n\nfunction DeleteWebsiteZCached{$time}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('DELETE','{$_GET["sitename"]}');\n\tXHR.appendData('hostid','{$_GET["hostid"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',xDeleteWebsiteZCached{$time});\n}\t\t\t\nDeleteWebsiteZCached{$time}();\t\t\n";
    echo $html;
}
	include_once('ressources/class.system.network.inc');
	
	
	$user=new usersMenus();
	if($user->AsSquidAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}	
	if(isset($_GET["caches-control"])){cache_control();exit;}
	if(isset($_GET["AddCachedSitelist-js"])){AddCachedSitelist_js();exit;}
	if(isset($_GET["AddCachedSitelist-popup"])){AddCachedSitelist_popup();exit;}
	if(isset($_POST["refresh_pattern_site"])){AddCachedSitelist_save();exit;}
	if(isset($_GET["AddCachedSitelist-delete"])){AddCachedSitelist_js_delete();exit;}
	if(isset($_GET["sites-list"])){WEBSITES_LIST();exit;}
	if(isset($_GET["websites-search"])){WEBSITES_SEARCH();exit;}
	if(isset($_POST["add_default_settings"])){WEBSITES_DEFAULTS();exit;}
	if(isset($_POST["delete_all"])){WEBSITES_DELETE_ALL();exit;}
	if(isset($_GET["delete-id"])){AddCachedSitelist_delete();exit;}
	if(isset($_GET["js"])){js();exit;}
	
	
function js(){
	$sock=new sockets();
	$sock->SET_INFO("SquidAsSeenCache",1);
	header("content-type: application/x-javascript");
	$page=CurrentPageName();
	$tpl=new templates();	
	$title=$tpl->_ENGINE_parse_body("{cache}::{cache_control}");
	$html="YahooWin5('860','$page?caches-control=yes&byjs=yes','$title');";
	echo $html;