|
From: <ir...@us...> - 2012-12-25 09:21:56
|
Revision: 10545
http://sourceforge.net/p/xoops/svn/10545
Author: irmtfan
Date: 2012-12-25 09:21:53 +0000 (Tue, 25 Dec 2012)
Log Message:
-----------
bug fix: update regarding xoopspoll 1.33 changes - also working with prev versions
Modified Paths:
--------------
XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt
XoopsModules/newbb/branches/irmtfan/newbb/polls.php
XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php
XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php
Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt
===================================================================
--- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-25 09:14:22 UTC (rev 10544)
+++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-25 09:21:53 UTC (rev 10545)
@@ -1,3 +1,14 @@
+date 2012-12-25
+===================================
+1- bug fix: when vote in polls it should save user ip to db
+in newbb/votepolls.php
+
+2- bug fix: user is not allowed to vote when the poll is expired
+in newbb/viewtopic.php, newbb/votepolls.php
+
+3- bug fix: in edit poll page topic_id is missing in restart this poll url
+in newbb/polls.php
+
date 2012-11-19
===================================
1- bug fix: in viewforum.php?forum=XXX . moderator have all access over the forum regardless of his/her group access.
Modified: XoopsModules/newbb/branches/irmtfan/newbb/polls.php
===================================================================
--- XoopsModules/newbb/branches/irmtfan/newbb/polls.php 2012-12-25 09:14:22 UTC (rev 10544)
+++ XoopsModules/newbb/branches/irmtfan/newbb/polls.php 2012-12-25 09:21:53 UTC (rev 10545)
@@ -266,8 +266,8 @@
$expire_text = new XoopsFormText(_MD_POLL_EXPIRATION . "<br /><small>" . _MD_POLL_FORMAT . "<br />" . sprintf(_MD_POLL_CURRENTTIME, formatTimestamp(time(), "Y-m-d H:i:s")) . "</small>", "end_time", 20, 19, $date);
$poll_form->addElement($expire_text);
} else {
- // irmtfan full URL
- $restart_label = new XoopsFormLabel(_MD_POLL_EXPIRATION, sprintf(_MD_POLL_EXPIREDAT, $date) . "<br /><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/polls.php?op=restart&poll_id=" . $poll->getVar("poll_id") . "'>" . _MD_POLL_RESTART . "</a>");
+ // irmtfan full URL - add topic_id
+ $restart_label = new XoopsFormLabel(_MD_POLL_EXPIRATION, sprintf(_MD_POLL_EXPIREDAT, $date) . "<br /><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/polls.php?op=restart&poll_id=" . $poll->getVar("poll_id") . "&topic_id=" . $topic_id . "'>" . _MD_POLL_RESTART . "</a>");
$poll_form->addElement($restart_label);
}
$weight_text = new XoopsFormText(_MD_POLL_DISPLAYORDER, "weight", 6, 5, $poll->getVar("weight"));
Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php
===================================================================
--- XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-12-25 09:14:22 UTC (rev 10544)
+++ XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-12-25 09:21:53 UTC (rev 10545)
@@ -472,7 +472,8 @@
if ($pollmodul == 'xoopspoll') {
$poll = new XoopsPoll($topic_obj->getVar('poll_id'));
$renderer = new XoopsPollRenderer($poll);
- if ( XoopsPollLog::hasVoted($topic_obj->getVar('poll_id'), $_SERVER['REMOTE_ADDR'], $uid) ) {
+ // irmtfan - if the poll is expired show the result
+ if ( XoopsPollLog::hasVoted($topic_obj->getVar('poll_id'), $_SERVER['REMOTE_ADDR'], $uid) || $poll->hasExpired() ) {
$renderer->assignResults($xoopsTpl);
$xoopsTpl->assign('topic_pollresult', 1);
setcookie("bb_polls[".$topic_obj->getVar("poll_id")."]", 1);
Modified: XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php
===================================================================
--- XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php 2012-12-25 09:14:22 UTC (rev 10544)
+++ XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php 2012-12-25 09:21:53 UTC (rev 10545)
@@ -80,13 +80,17 @@
$mail_author = false;
if ( $pollmodules == 'xoopspoll') {
$poll = new XoopsPoll($poll_id);
-
+ // irmtfan - if the poll is expired redirect
+ if ( $poll->hasExpired() ) {
+ redirect_header("viewtopic.php?topic_id=$topic_id", 1, _PL_SORRYEXPIRED);
+ }
if ( is_object($xoopsUser) ) {
if ( XoopsPollLog::hasVoted($poll_id, $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar("uid")) ) {
$msg = _PL_ALREADYVOTED;
setcookie("bb_polls[$poll_id]", 1);
} else {
- $poll->vote($_POST['option_id'], '', $xoopsUser->getVar("uid"));
+ // irmtfan save ip to db
+ $poll->vote($_POST['option_id'], $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar("uid"));
$poll->updateCount();
$msg = _PL_THANKSFORVOTE;
setcookie("bb_polls[$poll_id]", 1);
@@ -109,7 +113,8 @@
$msg = _PL_ALREADYVOTED;
setcookie("bb_polls[$poll_id]", 1);
} else {
- $poll->vote($_POST['option_id'], '', $xoopsUser->getVar("uid"));
+ // irmtfan save ip to db
+ $poll->vote($_POST['option_id'], $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar("uid"));
$poll->updateCount();
$msg = _PL_THANKSFORVOTE;
setcookie("bb_polls[$poll_id]", 1);
@@ -126,9 +131,10 @@
}
}
}
- redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id=$topic_id&forum=$forum&poll_id=$poll_id&pollresult=1", 1, $msg);
+ // irmtfan - simple url
+ redirect_header("viewtopic.php?topic_id=$topic_id", 1, $msg);
exit();
}
-// irmtfan - add error message
-redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id=$topic_id&forum=$forum", 1, _MD_POLL_NOOPTION);
+// irmtfan - add error message - simple url
+redirect_header("viewtopic.php?topic_id=$topic_id", 1, _MD_POLL_NOOPTION);
?>
\ No newline at end of file
|