Subversion Repositories Applications.papyrus

Rev

Rev 656 | Rev 841 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 656 Rev 693
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: pap_envoi.inc.php,v 1.6 2005-12-09 16:01:53 ddelon Exp $
22
// CVS : $Id: pap_envoi.inc.php,v 1.7 2006-01-12 16:37:01 ddelon Exp $
23
/**
23
/**
24
* Gestion de l'envoie des pages à afficher.
24
* Gestion de l'envoie des pages à afficher.
25
*
25
*
26
* Ce fichier envoi les données en les compressant si possible.
26
* Ce fichier envoi les données en les compressant si possible.
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
30
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Laurent COUDOUNEAU <lc@gsite.org>
32
*@author        Laurent COUDOUNEAU <lc@gsite.org>
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.6 $ $Date: 2005-12-09 16:01:53 $
34
*@version       $Revision: 1.7 $ $Date: 2006-01-12 16:37:01 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTÊTE du PROGRAMME                                       |
39
// |                                            ENTÊTE du PROGRAMME                                       |
Line 40... Line 40...
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
-
 
41
 
41
 
42
function pap_compress_output($output)
-
 
43
{
Line 42... Line 44...
42
/** <BR> Inclusion de la bibliothèque de fonctions de compression des données à envoyer.*/
44
            return gzencode($output);
43
include_once GEN_CHEMIN_BIBLIO.'pap_compression.fonct.php';
45
}
-
 
46
 
44
 
47
// Check if the browser supports gzip encoding, HTTP_ACCEPT_ENCODING
-
 
48
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') )
-
 
49
{
Line 45... Line -...
45
// +------------------------------------------------------------------------------------------------------+
-
 
46
// |                                            CORPS du PROGRAMME                                        |
-
 
47
// +------------------------------------------------------------------------------------------------------+
-
 
48
 
-
 
49
$page_gzippe = GEN_compresserDonneesZLIB($_GEN_commun['sortie']);
-
 
50
// Nous mettons à jour le cache
-
 
51
if (!empty($_GEN_commun['info_application']) && $_GEN_commun['info_application']->cache) {
-
 
52
    // Mise en cache de la page demandée
50
            // Start output buffering, and register compress_output() (see
53
    if ( ($page_gzippe != false) ) {
-
 
54
        $contenu_en_cache = (empty($page_gzippe)) ? $_GEN_commun['sortie'] : $page_gzippe;
-
 
55
        $requete =  'INSERT INTO gen_page_cache '.
-
 
56
                    'SET    gpc_id_md5_url = "'.GEN_donnerMD5UriPostSession().'", '.
51
            // below)
57
                    '       gpc_ce_site = '.$_GEN_commun['site_info']->gsi_id_site.', '.
-
 
58
                    '       gpc_ce_i18n = "'.$_GEN_commun['site_info']->gsi_id_i18n.'", '.
-
 
59
                    '       gpc_corps = "'.mysql_escape_string($contenu_en_cache).'", '.
-
 
60
                    '       gpc_date_heure = NOW(), '.
-
 
61
                    '       gpc_taille = '.strlen($_GEN_commun['sortie']).', '.
-
 
62
                    '       gpc_gz_taille = '.strlen($contenu_en_cache);
-
 
63
 
-
 
64
        $resultat = $db->query($requete);
-
 
65
        (DB::isError($resultat))
-
 
66
            ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
-
 
67
            : '';
-
 
68
    }
-
 
69
}
-
 
70
// Si les données sont compréssées, nous essayons de réaliser un envoi au client.
-
 
71
if (!empty($page_gzippe)) {
52
            ob_start ("pap_compress_output");
Line 72... Line -...
72
    if (GEN_envoyerDonneesCompressees($page_gzippe)) {
-
 
73
        exit();
-
 
74
    }
53
 
Line 75... Line 54...
75
}
54
                    // Tell the browser the content is compressed with gzip
76
 
55
                    header ("Content-Encoding: gzip");
77
// La compression ne fonctionne pas ou les données ne sont pas compressées,
56
}
-
 
57
 
-
 
58
echo($_GEN_commun['sortie']);
-
 
59
 
78
// nous envoyons directement la page.
60
/* +--Fin du code ----------------------------------------------------------------------------------------+
79
echo($_GEN_commun['sortie']);
61
*
80
 
62
* $Log: not supported by cvs2svn $
81
/* +--Fin du code ----------------------------------------------------------------------------------------+
63
* Revision 1.6  2005/12/09 16:01:53  ddelon
82
*
64
* retablissement compression