Titre du sujet : Re: Laisser le bouton voter dans le bloc de sondage par francois21 sur 31/10/2007 13:29:12
Je pense que mon problème viens du fichier index.php à partir de la 76
if ( $xoopsUser ) {
if ( XoopsPollLog::hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $xoopsUser->getVar("uid")) ) {
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_ALREADYVOTED;
} else {
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'), $xoopsUser->getVar("uid"));
$poll->updateCount();
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_THANKSFORVOTE;
}
} else {
if ( XoopsPollLog::hasVoted($poll_id, xoops_getenv('REMOTE_ADDR')) ) {
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_ALREADYVOTED;
} else {
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'));
$poll->updateCount();
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_THANKSFORVOTE;
}
}
}
Je le changerais bien par ca
if ( $xoopsUser ) {
if ( XoopsPollLog::hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $xoopsUser->getVar("uid")) ) {
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_ALREADYVOTED;
} else {
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'), $xoopsUser->getVar("uid"));
$poll->updateCount();
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_THANKSFORVOTE;
}
} else {
if ( XoopsPollLog::hasVoted($poll_id, xoops_getenv('REMOTE_ADDR')) ) {
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'));
$poll->updateCount();
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_THANKSFORVOTE;
} else {
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'));
$poll->updateCount();
setcookie("voted_polls[$poll_id]", 1, 0);
$msg = _PL_THANKSFORVOTE;
}
}
}
Mais j'ai peur de faire une bétise.
|