Author |
Message |
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Fri Nov 25, 2005 11:46 pm |
|
There have been many posts concerning the Survey block not working in 7.6 (and possibly other versions). I am making this replacement block available that Chatserv provided me (Thanks again Chat!) and it solved my problems. This may well work on other versions too. Note that depending on which Patch Level you are using, you may need to replaceCode:if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
| withCode:if (stristr($_SERVER['SCRIPT_NAME'], "block-Survey.php")) {
Header("Location: index.php");
die();
}
|
Replacement Block
Code:<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
global $prefix, $multilingual, $currentlang, $db, $boxTitle, $content, $pollcomm, $user, $cookie, $userinfo;
if ($multilingual == 1) {
$querylang = "WHERE planguage='$currentlang' AND artid='0'";
} else {
$querylang = "WHERE artid='0'";
}
list($pollID) = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1"));
$pollID = intval($pollID);
if ($pollID == 0 || empty($pollID)) {
$content = "";
} else {
if (!isset($url)) {
$url = "modules.php?name=Surveys&op=results&pollID=".$pollID."";
}
$content .= "<form action=\"surveys.html\" method=\"post\">";
$content .= "<input type=\"hidden\" name=\"pollID\" value=\"".$pollID."\">";
$content .= "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\">";
list($pollTitle, $voters) = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'"));
$pollTitle = check_html($pollTitle, "nohtml");
$voters = intval($voters);
$boxTitle = _SURVEY;
$content .= "<span class=\"content\"><strong>$pollTitle</strong></span><br><br>\n";
$content .= "<table border=\"0\" width=\"100%\">";
for($i = 1; $i <= 12; $i++) {
$sql = "SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
$query = $db->sql_query($sql);
list($pollID, $optionText, $optionCount, $voteID) = $db->sql_fetchrow($query);
$pollID = intval($pollID);
$voteID = intval($voteID);
$optionCount = intval($optionCount);
if (!empty($optionText)) {
$content .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><span class=\"content\">$optionText</span></td></tr>\n";
}
}
$content .= "</table><br><center><span class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></span><br>";
if (is_user($user)) {
cookiedecode($user);
getusrinfo($user);
}
$sum = 0;
for($i = 0; $i < 12; $i++) {
$sql = "SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
$query = $db->sql_query($sql);
list($optionCount) = $db->sql_fetchrow($query);
$optionCount = intval($optionCount);
$sum = (int)$sum+$optionCount;
}
if (!isset($mode) OR empty($mode)) {
if(isset($userinfo['umode'])) {
$mode = $userinfo['umode'];
} else {
$mode = "thread";
}
}
if (!isset($order) OR empty($order)) {
if(isset($userinfo['uorder'])) {
$order = $userinfo['uorder'];
} else {
$order = 0;
}
}
if (!isset($thold) OR empty($thold)) {
if(isset($userinfo['thold'])) {
$thold = $userinfo['thold'];
} else {
$thold = 0;
}
}
$r_options = "";
$r_options .= "&mode=".$mode;
$r_options .= "&order=".$order;
$r_options .= "&thold=".$thold;
$content .= "<br><span class=\"content\"><a href=\"modules.php?name=Surveys&op=results&pollID=".$pollID.$r_options."\"><strong>"._RESULTS."</strong></a><br><a href=\"surveys.html\"><strong>"._POLLS."</strong></a><br>";
if ($pollcomm) {
$sql = "SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'";
$query = $db->sql_query($sql);
$numcom = $db->sql_numrows($query);
$content .= "<br>"._VOTES.": <strong>".intval($sum)."</strong> <br> "._PCOMMENTS." <strong>".intval($numcom)."</strong>\n\n";
} else {
$content .= "<br>"._VOTES." <strong>".intval($sum)."</strong>\n\n";
}
$content .= "</span></center></form>\n\n";
}
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
sting
Involved
![Involved Involved](modules/Forums/images/ranks/4stars.gif)
![](modules/Forums/images/avatars/4100a278409c42c9a6050.jpg)
Joined: Sep 23, 2003
Posts: 456
Location: Somewhere out there...
|
Posted:
Fri Jan 27, 2006 12:47 pm |
|
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](themes/RavenIce/forums/images/spacer.gif) |
Dacubz
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Apr 27, 2004
Posts: 156
Location: Homer Glen, Illinois
|
Posted:
Sat Jan 28, 2006 5:47 pm |
|
Multiple voting still can happen on my site. Is there a way to fix it besides the poll collector fix that uses the IP? I have some members that are from the same IP address, so once one votes, the other can't when I use the poll collector IP fix. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jan 28, 2006 6:40 pm |
|
Just expand the fix to look at username along with IP |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Jun 01, 2005
Posts: 178
|
Posted:
Wed Jul 26, 2006 2:50 pm |
|
I pasted the code into the block file, and my donations block is still bleeding into the survey block. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
The Mouse Is Extension Of Arm
![](modules/Forums/images/avatars/458c161744a70db912a6e.jpg)
Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol
|
Posted:
Wed Jul 26, 2006 4:43 pm |
|
Bleeding, Post a link to your site please. |
_________________ For those who stand shall NEVER fall and those who fall shall RISE once more!! |
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Jul 26, 2006 6:19 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Jul 26, 2006 6:33 pm |
|
What are the first 2 blocks active on the right? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Jul 26, 2006 9:40 pm |
|
Well, thats my problem.......Its the survey block, but the donations block is also being displayed in it. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Jul 26, 2006 10:34 pm |
|
is the donations block activated??
Thats what im asking, Is the first 2 blocks set to the right donations then surveys?
If not, then that means that the survey block has the code for donations built into the block, You dont want this.
If (all this is true){
paste the block code
}else{
correct me where wrong
}
Forgive me but I'm in a laughing mood and that just made me laugh. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Jul 26, 2006 10:38 pm |
|
Code:<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
global $prefix, $multilingual, $currentlang, $db, $boxTitle, $content, $pollcomm, $user, $cookie, $userinfo;
if ($multilingual == 1) {
$querylang = "WHERE planguage='$currentlang' AND artid='0'";
} else {
$querylang = "WHERE artid='0'";
}
list($pollID) = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1"));
$pollID = intval($pollID);
if ($pollID == 0 || empty($pollID)) {
$content = "";
} else {
if (!isset($url)) {
$url = "modules.php?name=Surveys&op=results&pollID=".$pollID."";
}
$content .= "<form action=\"surveys.html\" method=\"post\">";
$content .= "<input type=\"hidden\" name=\"pollID\" value=\"".$pollID."\">";
$content .= "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\">";
list($pollTitle, $voters) = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'"));
$pollTitle = check_html($pollTitle, "nohtml");
$voters = intval($voters);
$boxTitle = _SURVEY;
$content .= "<span class=\"content\"><strong>$pollTitle</strong></span><br><br>\n";
$content .= "<table border=\"0\" width=\"100%\">";
for($i = 1; $i <= 12; $i++) {
$sql = "SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
$query = $db->sql_query($sql);
list($pollID, $optionText, $optionCount, $voteID) = $db->sql_fetchrow($query);
$pollID = intval($pollID);
$voteID = intval($voteID);
$optionCount = intval($optionCount);
if (!empty($optionText)) {
$content .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><span class=\"content\">$optionText</span></td></tr>\n";
}
}
$content .= "</table><br><center><span class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></span><br>";
if (is_user($user)) {
cookiedecode($user);
getusrinfo($user);
}
$sum = 0;
for($i = 0; $i < 12; $i++) {
$sql = "SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
$query = $db->sql_query($sql);
list($optionCount) = $db->sql_fetchrow($query);
$optionCount = intval($optionCount);
$sum = (int)$sum+$optionCount;
}
if (!isset($mode) OR empty($mode)) {
if(isset($userinfo['umode'])) {
$mode = $userinfo['umode'];
} else {
$mode = "thread";
}
}
if (!isset($order) OR empty($order)) {
if(isset($userinfo['uorder'])) {
$order = $userinfo['uorder'];
} else {
$order = 0;
}
}
if (!isset($thold) OR empty($thold)) {
if(isset($userinfo['thold'])) {
$thold = $userinfo['thold'];
} else {
$thold = 0;
}
}
$r_options = "";
$r_options .= "&mode=".$mode;
$r_options .= "&order=".$order;
$r_options .= "&thold=".$thold;
$content .= "<br><span class=\"content\"><a href=\"modules.php?name=Surveys&op=results&pollID=".$pollID.$r_options."\"><strong>"._RESULTS."</strong></a><br><a href=\"surveys.html\"><strong>"._POLLS."</strong></a><br>";
if ($pollcomm) {
$sql = "SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'";
$query = $db->sql_query($sql);
$numcom = $db->sql_numrows($query);
$content .= "<br>"._VOTES.": <strong>".intval($sum)."</strong> <br> "._PCOMMENTS." <strong>".intval($numcom)."</strong>\n\n";
} else {
$content .= "<br>"._VOTES." <strong>".intval($sum)."</strong>\n\n";
}
$content .= "</span></center></form>\n\n";
}
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Jul 26, 2006 10:45 pm |
|
ok that makes no sense.
Are you positive that you do not have something active above this block? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jul 27, 2006 12:16 am |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jul 27, 2006 6:55 am |
|
funny, try removing the $content variable from the globals. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jul 28, 2006 2:11 pm |
|
darklord wrote: | funny, try removing the $content variable from the globals. |
WTF is funny?
I removed the variable, and it got rid of the problem.....but seriously.
Are you here to help, or be a smart elic? Why is that variable in this post, which is supposed to be the fix.....if the variable is not supposed to be there?
As you can see, its apparently a common problem.
Only registered users can see links on this board! Get registered or login! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
Site Admin
![](modules/Forums/images/avatars/125904890252d880f79f312.png)
Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Fri Jul 28, 2006 2:43 pm |
|
I think darklord meant funny (thats peculiar) not funny (hahaha), perhaps you should keep that in mind when using forums with multiple nationalities, language and try not to read a 'tone'.
I have done it myself many times. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jul 28, 2006 3:28 pm |
|
Ahh, understood, my apologies.
Thx for your response.
Also, has anyone else noticed the bug when you run IPN Reconsile?
The script seems to run right, but the table is cutoff at the bottom once you run it. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jul 28, 2006 6:13 pm |
|
Just to respond, I did mean peculiar and I asked you to remove that from the globals because I believed it was calling content from another block and causing your error, It was a shot in the dark and I had not seen it before myself.
My apologies if I was misunderstood but I had no intension of giving you the idea I was laughing, It actually had me baffled for a minute but now that you have verified my thinking, Thank you.
To answer your question, $content is a variable blocks use to varify there is something within the block, It is in almost ALL blocks and therefore globalizing it may cause it to "merge" 2 blocks. I stated that with a theory, I was not positive of the outcome of my sudjested fix.
Thank you for verifying that and now, Glad to see you are up and running correctly. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jul 28, 2006 6:36 pm |
|
ahh, nicely put.
Thx dude. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sat Jul 29, 2006 8:52 am |
|
Just to expound upon the "knowledge base" here, I want to mention that every block needs to initialize the $content variable right up front! Either the first "assignment" needs to be of the form:
$content = "whatever first sting is being set";
(i.e., NOT $content .= ) <- see the "."?
or, it needs to be:
$content = '';
or
$content = "";
That is the only proper way of starting off each block "on the right track" so to speak and to ensure that NO prior string in the $content variable carries forward into another block. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ciph3r
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jul 29, 2006 12:00 pm |
|
but $content SHOULD NOT be in the globals right? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jul 29, 2006 12:28 pm |
|
Does not matter if it is used properly as I have mentioned in the previous post. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jul 29, 2006 9:06 pm |
|
Ahh true. $content will be redeclared if used properly like montego stated.
if ($pollID == 0 || empty($pollID)) {
$content = "";
Id almost bet that is the root of the problem. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|