From 0b4f71b204e16ab8809b471fc22e78ee35641609 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Fri, 12 Sep 2008 06:59:41 +0000 Subject: [PATCH] =?UTF-8?q?D=C3=A9sactiver=20l'AJAX=20en=20mode=20oo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/inc/utils.php | 35 +++++++++++++++++++++++------------ ecrire/oo/index.php | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index f6681becd8..c460a2fc0b 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -1184,18 +1184,6 @@ function spip_initialisation($pi=NULL, $pa=NULL, $ti=NULL, $ta=NULL) { recuperer_cookies_spip($GLOBALS['cookie_prefix']); } - // Le navigateur accepte-t-il l'ajax ? - define('_SPIP_AJAX', (!isset($_COOKIE['spip_accepte_ajax'])) - ? 1 - : (($_COOKIE['spip_accepte_ajax'] != -1) ? 1 : 0)); - - // La requete est-elle en ajax ? - define('_AJAX', - isset($_SERVER['HTTP_X_REQUESTED_WITH']) # ajax jQuery - OR @$_REQUEST['var_ajax_redir'] # redirection 302 apres ajax jQuery - OR @$_REQUEST['var_ajaxcharset'] # compat ascendante pour plugins - ); - // // Capacites php (en fonction de la version) // @@ -1264,6 +1252,29 @@ function spip_initialisation($pi=NULL, $pa=NULL, $ti=NULL, $ta=NULL) { // s'il y a un cookie ou PHP_AUTH, initialiser visiteur_session if (_FILE_CONNECT) verifier_visiteur(); + // Gestion AJAX sauf pour le mode oo espace prive + + if (isset($GLOBALS['visiteur_session']['prefs'])AND !_DIR_RESTREINT) { + $x = unserialize($GLOBALS['visiteur_session']['prefs']); + if ($x['display'] == 4) { + define('_SPIP_AJAX', -1); + if (isset($_COOKIE['spip_accepte_ajax'])) + spip_setcookie('spip_accepte_ajax', -1, 0); + } + } + + if (!defined('_SPIP_AJAX')) + define('_SPIP_AJAX', ((!isset($_COOKIE['spip_accepte_ajax'])) + ? 1 + : (($_COOKIE['spip_accepte_ajax'] != -1) ? 1 : 0))); + + // La requete est-elle en ajax ? + define('_AJAX', + isset($_SERVER['HTTP_X_REQUESTED_WITH']) # ajax jQuery + OR @$_REQUEST['var_ajax_redir'] # redirection 302 apres ajax jQuery + OR @$_REQUEST['var_ajaxcharset'] # compat ascendante pour plugins + ); + # nombre de pixels maxi pour calcul de la vignette avec gd # au dela de 5500000 on considere que php n'est pas limite en memoire pour cette operation # les configurations limitees en memoire ont un seuil plutot vers 1MPixel diff --git a/ecrire/oo/index.php b/ecrire/oo/index.php index 2d243d9606..cde596cea3 100644 --- a/ecrire/oo/index.php +++ b/ecrire/oo/index.php @@ -3,6 +3,6 @@ // ACCESSIBILITE // la page /oo offre une lecture en mode "texte seul" -header("Location: ../?action=preferer&arg=display:4"); +header("Location: ../?action=preferer&arg=display:4&redirect=" . urlencode(str_replace('/oo','', $_SERVER['REQUEST_URI']))); ?> -- GitLab