コード例 #1
0
include_once 'ressources/class.templates.inc';
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.users.menus.inc';
include_once 'ressources/class.mysql.inc';
include_once 'ressources/class.ini.inc';
include_once 'ressources/class.squid.inc';
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($_GET["refresh_pattern_site"])) {
    AddCachedSitelist_save();
    exit;
}
if (isset($_GET["AddCachedSitelist-delete"])) {
コード例 #2
0
 * Update the cache headers for the page
 * 
 * @param int $maxAge: The number of seconds
 * @param string $privacy: The privacy of the cache
 * 
 * @return null
 *
 * @since 1.0.0
 */
function cache_control($maxAge = -1, $privacy = "public")
{
    header("Cache-Control: " . $privacy . ",max-age=" . $maxAge);
    header("Expires: " . getGMT(time() + $maxAge));
    header("Last-Modified: " . getGMT());
}
cache_control(10, "public");
/**
 * Determine which user id they are trying to access and return a JSON object of the data
 */
$user = new \StdClass();
$user->last_modified = getGMT(time());
if (isset($_GET["userid"]) && $_GET["userid"] == 1) {
    $user->userid = 1;
    $user->username = "******";
} else {
    if (isset($_GET["userid"]) && $_GET["userid"] == 2) {
        $user->userid = 2;
        $user->username = "******";
    } else {
        die("Invalid userid");
    }
コード例 #3
0
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.mysql.inc');
	include_once('ressources/class.ini.inc');
	include_once('ressources/class.squid.inc');
	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);
コード例 #4
0
<?php

// To test this page with caching, go to: http://localhost:6081/<directory>/return-data.php
// To test this page without caching, go to: http://localhost/<directory>/return-data.php
include_once "lib.php";
cache_control(10, "private");
/**
 * Determine which user id they are trying to access and return a JSON object of the data
 */
if (!isset($_GET["token"])) {
    die("Invalid token");
}
$token = $_GET["token"];
$data = encrypt_decrypt("decrypt", $token);
if (!$data) {
    die("Invalid token");
}
// TODO: Add validation
$pieces = explode("-", $data);
$userid = $pieces[0];
$expirationTime = $pieces[1];
if (time() > $expirationTime) {
    die("Token expired, please reauthenticate");
}
$user = new \StdClass();
$user->last_modified = getGMT(time());
if ($userid == 1) {
    $user->userid = 1;
    $user->username = "******";
} else {
    if ($userid == 2) {