Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 4 → Rev 5

/trunk/papyrus/pap_envoi.inc.php
New file
0,0 → 1,94
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: pap_envoi.inc.php,v 1.1 2004-06-16 08:11:37 jpm Exp $
/**
* Gestion de l'envoie des pages à afficher.
*
* Ce fichier envoi les données en les compressant si possible.
*
*@package Papyrus
//Auteur original :
*@author Laurent COUDOUNEAU <lc@gsite.org>
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004-06-16 08:11:37 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** <BR> Inclusion de la bibliothèque de fonctions de compression des données à envoyer.*/
include_once './bibliotheque/fonctions/GEN_compression.fonct.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$page_gzippe = GEN_compresserDonneesZLIB($_GEN_commun['sortie']);
// Nous mettons à jour le cache
if ($_GEN_commun['info_application']->cache) {
// Mise en cache de la page demandée
if ( ($page_gzippe != false) ) {
$contenu_en_cache = (empty($page_gzippe)) ? $_GEN_commun['sortie'] : $page_gzippe;
$requete = 'INSERT INTO gen_page_cache '.
'SET gpc_id_md5_url = "'.GEN_donnerMD5UriPostSession().'", '.
' gpc_ce_site = '.$_GEN_commun['site_info']->gsi_id_site.', '.
' gpc_ce_i18n = "'.$_GEN_commun['site_info']->gsi_id_i18n.'", '.
' gpc_corps = "'.mysql_escape_string($contenu_en_cache).'", '.
' gpc_date_heure = NOW(), '.
' gpc_taille = '.strlen($_GEN_commun['sortie']).', '.
' gpc_gz_taille = '.strlen($contenu_en_cache);
$resultat = $db->query($requete);
(DB::isError($resultat))
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
: '';
}
}
// Si les données sont compréssées, nous essayons de réaliser un envoi au client.
if (!empty($page_gzippe)) {
if (GEN_envoyerDonneesCompressees($page_gzippe)) {
exit();
}
}
// La compression ne fonctionne pas ou les données ne sont pas compressées,
// nous envoyons directement la page.
echo($_GEN_commun['sortie']);
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2004/04/28 12:04:31 jpm
* Changement du modèle de la base de données.
*
* Revision 1.2 2004/04/22 08:31:43 jpm
* Transformation de $GS_GLOBAL en $_GEN_commun.
*
* Revision 1.1 2004/04/09 16:19:23 jpm
* Ajout du fichier indépendant d'envoi avec gestion des tables i18n.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>