Wrapper for images support a parameter cache=1 to increase speed for some pages.

This commit is contained in:
Laurent Destailleur 2011-04-10 20:42:18 +00:00
parent fba4111f44
commit 1a365a69c8

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -52,6 +52,20 @@ function llxHeader() { }
require("./main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
if (GETPOST("cache"))
{
// Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access.
if (empty($dolibarr_nocache))
{
header('Cache-Control: max-age=3600, public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
}
else header('Cache-Control: no-cache');
//print $dolibarr_nocache; exit;
}
// Define mime type
$type = 'application/octet-stream';
if (! empty($_GET["type"])) $type=$_GET["type"];
@ -276,7 +290,7 @@ if ($modulepart)
$accessallowed=1;
$original_file=$conf->scanner->dir_temp.'/'.$user->id.'/'.$original_file;
}
// Wrapping pour les images fckeditor
elseif ($modulepart == 'fckeditor')
{