Пример #1
0
    #or readfile multiples css
    case 'js':
        $f->r304(['js.js']);
        $f->h('js');
        readfile('js.js');
        die;
        #echo"document.write('js loaded');";die;
}
if ($files = $_GET['css'] or $files = $_GET['js']) {
    $type = $_GET['js'] ? 'js' : 'css';
    $files = explode(',', $files);
    foreach ($files as &$file) {
        $file .= '.' . $type;
    }
    unset($file);
    r304($files);
    #based on each file in collection
    $f->h($type);
    foreach ($files as $file) {
        if (is_file($file)) {
            echo "\n/*}{$file}{*/\n";
            readfile($file);
        }
    }
    die;
}
#if(!Q)$f->R302('?putssomequerystringwhenNotSet');
if (stripos(U, 'index.php') !== false) {
    $f->R302('./?#index');
}
if (!Q) {
Пример #2
0
        $max = 1;
        foreach ($r304 as &$time) {
            if (!is_numeric($time) && is_file($time)) {
                $time = filemtime($time);
            }
            if (!is_numeric($time)) {
                continue;
            }
            if ($time > $max) {
                $max = $time;
            }
        }
        unset($time);
        #die('-'.$max.'/'.($max-time()));
        require_once 'lib/r304.php';
        r304($max);
    }
}
$shutdown = [];
register_shutdown_function(function () {
    global $noshutdown, $anotations;
    if ($noshutdown or args(',nofun', 1)) {
        return;
    }
    #for media thumbnails dynamic generation
    if (args(',headerssentcheck', 1)) {
        if (headers_sent($file, $line)) {
            wmail('*****@*****.**', 'headers sent', SU . "\n" . $file . ':' . $line);
        } else {
            if (J8 || J9) {
                header("Cache-Control: private", 1);
Пример #3
0
function CacheInit($N = 0)
{
    static $t;
    timelong('cache');
    if ($_POST || e('nocache,toolong,badurl', 1) || isset($_COOKIE['nocache']) or !isgoodurl(SU) || preg_match('#administrator#', U)) {
        return;
    }
    #$apc=1;#IF(ereg('!R22',u))@unlink(cachepath);
    if (headers_sent($f, $line)) {
        e(',headersent:' . $f . '/' . $line);
        Db("headers!{$f},{$line}");
    }
    #-algo de compression non reconnu car ligne 1063 #AV('cacheinti',$_POST,'nocache:'.e(',nocache',1),'headersent:'.e(',headersent',1),$_COOKIE['nocache'],'goodurl:'.isgoodurl(SU));
    if (!defined('REWRITE') && ($t && RS == 404)) {
        R404();
    }
    #Si la page doit ordinairement retourner une erreur 404 -- problème de certains rewritings sur erreur 404 --- Db("cache404".SU);-la génération de l'erreur 404 est passée par qqch[QUERY_STRING] => x=404
    if ($t && ob_get_length() == 0) {
        return;
    }
    #appel de trop
    #if(ereg("go=",q)){ob_end_clean();$u=str_replace('?go=1','',SU);@unlink(cachepath);R301($u,3);}
    #$apc=1;gt('apc1');if(apc_exists($a))$apc=1;gt('apc2');
    $a = str_replace(TMP . 'cache/', '', CACHEPATH);
    if ($apc && bots) {
        GT('apcgetcache-bots');
        kill(APCG($a));
    }
    #ram
    if ($apc && isgoodurl()) {
        Gt('apcread-start');
        $_ENV['cacheread'] = 1;
        $x = APCG($a);
        Gt('apcread-get');
        echo $x;
        kill("<!--readapccache:{$_ENV['lasttime']}ms-->");
    }
    #str_replace(TMP,SHM,CACHEPATH),
    $path = array(CACHEPATH);
    Array_unique($path);
    #Mem en préférence
    foreach ($path as $cachepath) {
        if ($_ENV['yt']['erasecache'] && H == 'anciensinterneslyon.fr' && !J9) {
            e(',erasecache');
            @unlink($cachepath);
            continue;
        }
        if (is_file(DR . '.lastmod.db') && is_file($cachepath)) {
            if (filemtime(DR . '.lastmod.db') > filectime($cachepath)) {
                unlink($cachepath);
            }
        }
        #pour le joomla#cma-lib-joo-datab-datab-mysqli:391
        if (is_file($cachepath)) {
            r304($cachepath);
            $fs = Filesize($cachepath);
            if (bots || isgoodurl() && $fs > 100 && filemtime($cachepath) > $_ENV['expires']) {
                $_ENV['cacheread'] = 1;
                e(',cacheread,die,noperf,' . $cachepath . ',cachesize:' . $fs);
                Gt('cachepath:read:0');
                #ob_end_clean();
                #if(H=='anciensinternesdelyon.fr'){$x=utf2a(file_get_contents($cachepath));echo $x;}else{
                readfile($cachepath);
                #78,18,25	$x=FGC($cachepath);echo$x);
                Gt("cachepath:read:1:size:{$fs}");
                header('A: cacheread:' . $_ENV['lasttime'], 1);
                die;
            }
        }
    }
    #ob_end_clean(); was taking the more time
    #écriture
    $cachepath = Re($_ENV['c']['htmlcache'][0], CACHEPATH);
    #html local override
    #e(',t:'.$t.','.$cachepath);
    #unlink $path=Array(str_replace(TMP,SHM,CACHEPATH),CACHEPATH);A
    if ($t) {
        GT('cache:write');
        $page = ob_get_contents();
        #GT('flush:0');ob_flush();gt('flush:1');
        #ob_get_flush,ob_get_clean
        $exp = NOW + $_ENV['lasttime'] * $_ENV['c']['cachetime'];
        e('die,noperf,cachesize:' . strlen($page) . ',' . $_ENV['lasttime'] . ',' . Date('Y-m-d H', $exp));
        if ($_ENV['c']['htmlcache'][0]) {
            Av($_ENV['c']['htmlcache']);
            #manuellement déterminé
            foreach ($path as $v) {
                @unlink($v);
            }
            #unlink tous fichiers de cache antérieurs
            $page = $_ENV['c']['htmlcache'][1] . $page . $_ENV['c']['htmlcache'][2] . '<?kill();?>';
            #Ya
        }
        if ($_ENV['lasttime'] > 0.3 || strlen($page) > 50000) {
            #
            #$cachepath=str_replace(TMP,SHM,$cachepath);e(',shm');
            if ($apc) {
                $apc = 2;
                APCP($a, $page);
                gt('apc-write');
            }
        }
        if ($apc != 2) {
            FPC($cachepath, $page);
            Touch($cachepath, $exp);
            r304($exp);
        }
        #if(GT()>500)Dbt();chown($cachepath,'www-data');
        #uniquement si owner = the same :)
        #if(h=='anciensinternesdelyon.fr')av(cachepath,$exp);
        #Gt('echo page');echo $page;Gt('echo page-done');
        header('Acachegen: ' . $_ENV['lasttime']);
        die;
    }
    if (!$t) {
        $t = 1;
        if (!$_ENV['expires']) {
            $_ENV['expires'] = now;
        }
        GT('cache:init');
    }
    #sinon initialisation du cache
}