Re: module qui ne fonctionne pas sans le mode debug actif | Titre du sujet : Re: module qui ne fonctionne pas sans le mode debug actif par br_750 sur 15/11/2011 14:01:35
stl JJDai
d’après mes investigations il semble que le bout de code qui pose soucis soit :
header ("location: ".$redirect );
je post d’ailleurs le code de l'index.php du module (pas très long j'ai épuré pour chercher le bug)
<?php
// ------------------------------------------------------------------------
// XOOPS - PHP Content Management System
// Copyright (c) 2004 XOOPS.org
// <http://www.xoops.org/> ... ;
//
// Authors :
// - solo (www.wolfpackclan.com)
// myHome v1.0
// ------------------------------------------------------------------------
// General settings
include_once("header.php");
$xoopsOption['template_main'] = 'myhome_index.html';
include_once(XOOPS_ROOT_PATH."/header.php");
global $xoops,$xoopsUser;
//$this->_tpl_vars["xoops_uname"];
// Check groups
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
if ( array_intersect( $xoopsModuleConfig['groups'], $groups ) )
{
// Rediriger l'index vers une url spécifique
// + Vérification anti-bouclage (module qui pointe sur lui-même)
if ( $xoopsModuleConfig['myhome_index'] AND
!preg_match("/".$xoopsModule -> getVar('dirname'), $xoopsModuleConfig['myhome_index']) ) {
if ( preg_match("http://", $xoopsModuleConfig['myhome_index']) OR
preg_match("https://", $xoopsModuleConfig['myhome_index']) )
{
$redirect = $xoopsModuleConfig['myhome_index'];
} else {
$redirect = XOOPS_URL.'/'.$xoopsModuleConfig['myhome_index'];
}
redirect_header($redirect);
// header ("location: ".$redirect );
exit();
}
} else {
// Rediriger l'index vers une autre url spécifique
// + Vérification anti-bouclage (module qui pointe sur lui-même)
if ( $xoopsModuleConfig['myhome_index_02'] AND
!preg_match("/".$xoopsModule -> getVar('dirname'), $xoopsModuleConfig['myhome_index_02'])
) {
if ( preg_match("http://", $xoopsModuleConfig['myhome_index_02']) ||
preg_match("https://", $xoopsModuleConfig['myhome_index_02'])
) {
$redirect = $xoopsModuleConfig['myhome_index_02'];
} else {
$redirect = XOOPS_URL.'/'.$xoopsModuleConfig['myhome_index_02'];
}
redirect_header($redirect);
// header ("location: ".$redirect );
exit();
}
}
include_once(XOOPS_ROOT_PATH."/footer.php");
?>
en replaçant par redirect_header($url) le probleme semble etre résolu.
si qq1 a l'explication , elle est la bien venue....
ps : le code du module que j'ai posté(myHome) a était modifié , j'ai remplacé les commandes php obsolètes ou dépréciées et je l'ai simplifié pour cerner le bug paix a son auteur ;-)
merci A+
|
|