Skip to content
Extraits de code Groupes Projets
Valider 134935bf rédigé par esj's avatar esj
Parcourir les fichiers

Initialisation du lot de variables non initialisées qui empechait d'exécuter...

Initialisation du lot de variables non initialisées qui empechait d'exécuter le squelette de login en mode error_reporting(E_ALL), car ça provquait un 302 en boucle.
parent 404eb500
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -27,7 +27,8 @@ function balise_LOGIN_PRIVE ($p) { ...@@ -27,7 +27,8 @@ function balise_LOGIN_PRIVE ($p) {
# programme une <boucle(AUTEURS)>[(#LOGIN_PRIVE{#LOGIN})] # programme une <boucle(AUTEURS)>[(#LOGIN_PRIVE{#LOGIN})]
function balise_LOGIN_PRIVE_stat ($args, $filtres) { function balise_LOGIN_PRIVE_stat ($args, $filtres) {
return array($args[1], ($filtres[0] ? $filtres[0] : $args[0])); return array(isset($args[1]) ? $args[1] : '',
($filtres[0] ? $filtres[0] : $args[0]));
} }
function balise_LOGIN_PRIVE_dyn($login, $cible) { function balise_LOGIN_PRIVE_dyn($login, $cible) {
......
...@@ -82,15 +82,17 @@ function login_pour_tous($login, $cible, $action) { ...@@ -82,15 +82,17 @@ function login_pour_tous($login, $cible, $action) {
// et pas un echec cookie. // et pas un echec cookie.
if (_request('var_echec_cookie')) if (_request('var_echec_cookie'))
$echec_cookie = ($_COOKIE['spip_session'] != 'test_echec_cookie'); $echec_cookie = ($_COOKIE['spip_session'] != 'test_echec_cookie');
else $echec_cookie = '';
$pose_cookie = generer_url_public('spip_cookie'); $pose_cookie = generer_url_public('spip_cookie');
$auth_http = '';
if ($echec_cookie AND !$ignore_auth_http) { if ($echec_cookie AND !$ignore_auth_http) {
include_spip('inc/headers'); include_spip('inc/headers');
if (php_module()) $auth_http = $pose_cookie; if (php_module()) $auth_http = $pose_cookie;
} }
// Attention dans le cas 'intranet' la proposition de se loger // Attention dans le cas 'intranet' la proposition de se loger
// par auth_http peut conduire a l'echec. // par auth_http peut conduire a l'echec.
if ($_SERVER['PHP_AUTH_USER'] AND $_SERVER['PHP_AUTH_PW']) if (isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW']))
$auth_http = ''; $auth_http = '';
// Le login est memorise dans le cookie d'admin eventuel // Le login est memorise dans le cookie d'admin eventuel
...@@ -147,7 +149,7 @@ function login_pour_tous($login, $cible, $action) { ...@@ -147,7 +149,7 @@ function login_pour_tous($login, $cible, $action) {
'auth_http' => $auth_http, 'auth_http' => $auth_http,
'echec_cookie' => ($echec_cookie ? ' ' : ''), 'echec_cookie' => ($echec_cookie ? ' ' : ''),
'login' => $login, 'login' => $login,
'login_alt' => ($login_alt ? $login_alt : $login), 'login_alt' => (isset($login_alt) ? $login_alt : $login),
'self' => str_replace('&amp;', '&', self()) 'self' => str_replace('&amp;', '&', self())
) )
) )
......
...@@ -40,7 +40,7 @@ function menu_lang_pour_tous($nom, $default) { ...@@ -40,7 +40,7 @@ function menu_lang_pour_tous($nom, $default) {
if ($GLOBALS['spip_lang'] <> $default) { if ($GLOBALS['spip_lang'] <> $default) {
lang_select($default); # et remplace lang_select($default); # et remplace
if ($GLOBALS['spip_lang'] <> $default) { if ($GLOBALS['spip_lang'] <> $default) {
unset ($default); # annule tout choix par defaut $default = ''; # annule tout choix par defaut
lang_dselect(); #annule la selection lang_dselect(); #annule la selection
} }
} }
......
...@@ -200,8 +200,8 @@ function inclure_page($fond, $contexte_inclus, $cache_incluant='') { ...@@ -200,8 +200,8 @@ function inclure_page($fond, $contexte_inclus, $cache_incluant='') {
// Si on a inclus sans fixer le critere de lang, de deux choses l'une : // Si on a inclus sans fixer le critere de lang, de deux choses l'une :
// - on est dans la langue du site, et pas besoin d'inclure inc_lang // - on est dans la langue du site, et pas besoin d'inclure inc_lang
// - on n'y est pas, et alors il faut revenir dans la langue par defaut // - on n'y est pas, et alors il faut revenir dans la langue par defaut
if (($lang = $contexte_inclus['lang']) $lang = isset($contexte_inclus['lang']) ? $contexte_inclus['lang']:'';
|| ($GLOBALS['spip_lang'] != ($lang = $GLOBALS['meta']['langue_site']))) { if ($lang || ($GLOBALS['spip_lang'] != ($lang = $GLOBALS['meta']['langue_site']))) {
include_spip('inc/lang'); include_spip('inc/lang');
lang_select($lang); lang_select($lang);
$lang_select = true; // pour lang_dselect en sortie $lang_select = true; // pour lang_dselect en sortie
...@@ -245,7 +245,8 @@ function inclure_balise_dynamique($texte, $echo=true, $ligne=0) { ...@@ -245,7 +245,8 @@ function inclure_balise_dynamique($texte, $echo=true, $ligne=0) {
($GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site'])) ($GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site']))
$contexte_inclus['lang'] = $GLOBALS['spip_lang']; $contexte_inclus['lang'] = $GLOBALS['spip_lang'];
$d = $GLOBALS['delais']; // delais a l'ancienne, c'est pratiquement mort
$d = isset($GLOBALS['delais']) ? $GLOBALS['delais'] : 0;
$GLOBALS['delais'] = $delainc; $GLOBALS['delais'] = $delainc;
$page = inclure_page($fond, $contexte_inclus); $page = inclure_page($fond, $contexte_inclus);
$GLOBALS['delais'] = $d; $GLOBALS['delais'] = $d;
......
...@@ -822,6 +822,7 @@ function balise_PARAMETRES_FORUM_dist($p) { ...@@ -822,6 +822,7 @@ function balise_PARAMETRES_FORUM_dist($p) {
case 'forums': case 'forums':
default: default:
$liste_champs = array ("id_article","id_breve","id_rubrique","id_syndic","id_forum"); $liste_champs = array ("id_article","id_breve","id_rubrique","id_syndic","id_forum");
$c = '';
foreach ($liste_champs as $champ) { foreach ($liste_champs as $champ) {
$x = champ_sql( $champ, $p); $x = champ_sql( $champ, $p);
$c .= (($c) ? ".\n" : "") . "((!$x) ? '' : ('&$champ='.$x))"; $c .= (($c) ? ".\n" : "") . "((!$x) ? '' : ('&$champ='.$x))";
......
...@@ -29,19 +29,6 @@ function public_decompter_dist() { ...@@ -29,19 +29,6 @@ function public_decompter_dist() {
return; return;
// Identification de l'element
// Attention il s'agit bien des $GLOBALS, regles (dans le cas des urls
// personnalises), par la carte d'identite de la page... ne pas utiliser
// _request() ici !
if ($log_id_num = intval($GLOBALS['id_article']))
$log_type = "article";
else if ($log_id_num = intval($GLOBALS['id_breve']))
$log_type = "breve";
else if ($log_id_num = intval($GLOBALS['id_rubrique']))
$log_type = "rubrique";
else
$log_type = "autre";
// Identification du client // Identification du client
$client_id = substr(md5( $client_id = substr(md5(
$GLOBALS['ip'] . $_SERVER['HTTP_USER_AGENT'] $GLOBALS['ip'] . $_SERVER['HTTP_USER_AGENT']
...@@ -55,7 +42,7 @@ function public_decompter_dist() { ...@@ -55,7 +42,7 @@ function public_decompter_dist() {
$GLOBALS['meta']['adresse_site']); $GLOBALS['meta']['adresse_site']);
if (($url_site_spip<>'') if (($url_site_spip<>'')
AND strpos('-'.strtolower($log_referer), strtolower($url_site_spip)) AND strpos('-'.strtolower($log_referer), strtolower($url_site_spip))
AND !$_GET['var_recherche']) AND !isset($_GET['var_recherche']))
$log_referer = ''; $log_referer = '';
else else
$referer_md5 = '0x'.substr(md5($log_referer), 0, 15); $referer_md5 = '0x'.substr(md5($log_referer), 0, 15);
...@@ -74,8 +61,29 @@ function public_decompter_dist() { ...@@ -74,8 +61,29 @@ function public_decompter_dist() {
// 2. Plafonner le nombre de hits pris en compte pour un IP (robots etc.) // 2. Plafonner le nombre de hits pris en compte pour un IP (robots etc.)
// et ecrire la session // et ecrire la session
if (count($content) < 200) { if (count($content) < 200) {
$entree = trim("$log_type\t$log_id_num\t$log_referer");
$content[$entree] ++; // Identification de l'element
// Attention il s'agit bien des $GLOBALS, regles (dans le cas des urls
// personnalises), par la carte d'identite de la page... ne pas utiliser
// _request() ici !
if (isset($GLOBALS['id_article']))
$log_type = "article";
else if (isset($GLOBALS['id_breve']))
$log_type = "breve";
else if (isset($GLOBALS['id_rubrique']))
$log_type = "rubrique";
else
$log_type = "";
if ($log_type)
$log_type .= "\t" . intval($GLOBALS["id_$log_type"]);
else $log_type = "autre\t0";
$log_type .= trim("\t$log_referer");
if (isset($content[$log_type]))
$content[$log_type]++;
else $content[$log_type] = 1; // bienvenue au club
ecrire_fichier($session, serialize($content)); ecrire_fichier($session, serialize($content));
} }
} }
......
...@@ -83,14 +83,16 @@ function recuperer_parametres_url($fond, $url) { ...@@ -83,14 +83,16 @@ function recuperer_parametres_url($fond, $url) {
*/ */
// Si on est revenu en mode html, mais c'est une ancienne url_propre // Si on est revenu en mode html, mais c'est une ancienne url_propre
// on ne redirige pas, on assume le nouveau contexte (si possible) // on ne redirige pas, on assume le nouveau contexte (si possible)
if ($url_propre = $GLOBALS['_SERVER']['REDIRECT_url_propre'] $url_propre = isset($GLOBALS['_SERVER']['REDIRECT_url_propre']) ?
OR $url_propre = $GLOBALS['HTTP_ENV_VARS']['url_propre'] $GLOBALS['_SERVER']['REDIRECT_url_propre'] :
AND preg_match(',^(article|breve|rubrique|mot|auteur|site)$,', $fond)) { (isset($GLOBALS['HTTP_ENV_VARS']['url_propre']) ?
$url_propre = (preg_replace('/^[_+-]{0,2}(.*?)[_+-]{0,2}(\.html)?$/', $GLOBALS['HTTP_ENV_VARS']['url_propre'] :
'');
if ($url_propre AND preg_match(',^(article|breve|rubrique|mot|auteur|site)$,', $fond)) {
$url_propre = (preg_replace('/^[_+-]{0,2}(.*?)[_+-]{0,2}(\.html)?$/',
'$1', $url_propre)); '$1', $url_propre));
$r = "spip_" . table_objet($fond);
$id = id_table_objet($fond); $id = id_table_objet($fond);
$r = spip_query("SELECT $id AS id FROM $r WHERE url_propre = " . spip_abstract_quote($url_propre)); $r = spip_query("SELECT $id AS id FROM spip_" . table_objet($fond) . " WHERE url_propre = " . spip_abstract_quote($url_propre));
if ($r AND $r = spip_fetch_array($r)) if ($r AND $r = spip_fetch_array($r))
$contexte[$id] = $r['id']; $contexte[$id] = $r['id'];
} }
......
...@@ -59,14 +59,16 @@ function recuperer_parametres_url(&$fond, $url) { ...@@ -59,14 +59,16 @@ function recuperer_parametres_url(&$fond, $url) {
*/ */
// Si on est revenu en mode html, mais c'est une ancienne url_propre // Si on est revenu en mode html, mais c'est une ancienne url_propre
// on ne redirige pas, on assume le nouveau contexte (si possible) // on ne redirige pas, on assume le nouveau contexte (si possible)
if ($url_propre = $GLOBALS['_SERVER']['REDIRECT_url_propre'] $url_propre = isset($GLOBALS['_SERVER']['REDIRECT_url_propre']) ?
OR $url_propre = $GLOBALS['HTTP_ENV_VARS']['url_propre'] $GLOBALS['_SERVER']['REDIRECT_url_propre'] :
AND preg_match(',^(article|breve|rubrique|mot|auteur|site)$,', $fond)) { (isset($GLOBALS['HTTP_ENV_VARS']['url_propre']) ?
$url_propre = (preg_replace('/^[_+-]{0,2}(.*?)[_+-]{0,2}(\.html)?$/', $GLOBALS['HTTP_ENV_VARS']['url_propre'] :
'');
if ($url_propre AND preg_match(',^(article|breve|rubrique|mot|auteur|site)$,', $fond)) {
$url_propre = (preg_replace('/^[_+-]{0,2}(.*?)[_+-]{0,2}(\.html)?$/',
'$1', $url_propre)); '$1', $url_propre));
$r = "spip_" . table_objet($fond);
$id = id_table_objet($fond); $id = id_table_objet($fond);
$r = spip_query("SELECT $id AS id FROM $r WHERE url_propre = " . spip_abstract_quote($url_propre)); $r = spip_query("SELECT $id AS id FROM spip_" . table_objet($fond) . " WHERE url_propre = " . spip_abstract_quote($url_propre));
if ($r AND $r = spip_fetch_array($r)) if ($r AND $r = spip_fetch_array($r))
$contexte[$id] = $r['id']; $contexte[$id] = $r['id'];
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter