Manifest usage is useless for a dynamic application like dolibarr.

This commit is contained in:
Laurent Destailleur 2013-05-21 14:41:11 +02:00
parent 12681994ea
commit 8fe45b1af6
4 changed files with 71 additions and 22 deletions

View File

@ -1,30 +1,41 @@
# version 1
# Files listed under CACHE will be cached after they are loaded;
# while the ones under NETWORK are said to be white-listed.
# What this means is that they require a live connection to the server.
# If the user isn't connected to the server, the browser should not use the cached version instead.
CACHE MANIFEST
# version 2013-05-21 13:30:21
# Note: If this file is dynamic, it must return MIME text/cache-manifest
# Note: Order of CACHE, NETWORK and FALLBACK section does not change behaviour
" Note:
# Files listed under CACHE will be ALWAYS cached after they are loaded.
# And they will be always used from Cache after (even after refresh).
CACHE:
index.php
main.inc.php
master.inc.php
filefunc.inc.php
core/lib/functions.lib.php
theme/dolibarr_logo.png
support/
support/index.php
support/online.php
support/background.png
support/default.css
support/dolibarr_logo2.png
support/headbg.jpg
support/helpcenter.png
support/internet.png
support/mail.png
support/pagemaster.png
support/redstar.png
support/sparkangels.png
support/star.png
support/who.png
# The NETWORK section contains the path to a folder to ensure that requests
# to load resources contained under /api will bypass the cache and always fetch the resource from the server.
# to load resources will use internet.
# CACHE has priority on NETWORK, so usage is useless
NETWORK:
# search.php
# login.php
# /api
/
# The FALLBACK section contains entries that provide a backup strategy.
# If the browser is unable to retrieve the original content, the fallback resource will be used.
# In the example above, we display a static image in case the dynamic one is unavailable.
FALLBACK:
# images/dynamic.php static_image.png
#/ public/offline.php
#theme/amarok/img/* theme/eldy/img/

View File

@ -360,7 +360,7 @@ if (! defined('NOLOGIN'))
// If in demo mode, we check we go to home page through the public/demo/index.php page
if (! empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_URL_ROOT.'/index.php') // We ask index page
{
if (! preg_match('/public/',$_SERVER['HTTP_REFERER']))
if (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/public/',$_SERVER['HTTP_REFERER']))
{
dol_syslog("Call index page from another url than demo page");
$url='';
@ -925,7 +925,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
//print '<!DOCTYPE HTML>';
print "\n";
if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print '<html manifest="cache.manifest">'."\n";
if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print '<html manifest="'.DOL_URL_ROOT.'/cache.manifest">'."\n";
else print '<html>'."\n";
//print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
if (empty($disablehead))

38
htdocs/public/offline.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/public/offline.php
* \brief Dolibarr offline page
*/
define('NOCSRFCHECK',1);
define('NOLOGIN',1);
require '../main.inc.php';
/**
* View
*/
print 'Sorry, it seems your internet connexion is off.<br>';
print 'You need to be connected to network to use this software.<br>';
?>

View File

@ -216,7 +216,7 @@ function pHeader($soutitre,$next,$action='none')
header("Content-type: text/html; charset=".$conf->file->character_set_client);
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
print '<html>'."\n";
print '<html manifest="'.DOL_URL_ROOT.'/cache.manifest">'."\n";
print '<head>'."\n";
print '<meta http-equiv="content-type" content="text/html; charset='.$conf->file->character_set_client.'">'."\n";
print '<meta name="robots" content="index,follow">'."\n";