Forum Polls v1.23
Author: xandra

PHP-Fusion Copyright © 2002 - 2005 Nick Jones
Released under the terms & conditions of v2 of the GNU General Public License. For details refer to the included gpl.txt file or visit http://gnu.org


Description:
This allows users to add polls in the forum.


Questions?
Post them at http://beta.phpfusion-mods.com or http://phpfusion-mods.com.


Installation Instructions:


Instructions are provided for the following:


New Installation:
Backup your website before uploading or modifying any files.

Step 1: Upload the contents of the php-files folder to the appropriate directory.

Step 2: If you have not modified any of the above core files on your site, you should be able to use the included files without any problems. Check the 'mod' folder to see if there is a folder that corresponds with your php-fusion version number. If so, upload the contents of that folder to the appropriate directories on your site. If there are no files included for your specific php-fusion version or you have modified any of the above files on your site, you will need to modify your existing files using the mod instructions below.

Step 3: Go to infusions admin and infuse Forum Polls.


Upgrade - v1.20 or greater:
Backup your website before uploading or modifying any files.

Step 1: Upload the contents of the 'php-files' folder to the appropriate directory.

Step 2: If you have not modified any of the above core files on your site, you should be able to use the included files without any problems. Check the 'mod' folder to see if there is a folder that corresponds with your php-fusion version number. If so, upload the contents of that folder to the appropriate directories on your site. If there are no files included for your specific php-fusion version or you have modified any of the above files on your site, you will need to modify your existing files using the mod instructions below.

Step 3: Go to infusions admin and infuse Forum Polls - Do Not defuse it, infuse only.


Upgrade - v1.12 or less:
Backup your website before uploading or modifying any files.

Note: This new version contains changes to the forum polls table structure and it's very important to backup your database before attempting to upgrade.

Step 1: Backup your database. DO NOT skip this step!

Step 2: In admin, add the following to a custom page and preview it. Don't save it... preview only.

<?php

$result = dbquery("ALTER TABLE ".$db_prefix."forum_polls RENAME TO ".$db_prefix."forum_polls_old");
if ($result) {
	echo "<center><b>Forum Polls</b> table has been renamed.<br><br>";
	$result = dbquery("ALTER TABLE ".$db_prefix."forum_votes RENAME TO ".$db_prefix."forum_votes_old");
	if ($result) {
		echo "<b>Forum Votes</b> table has been renamed.</center>";
	} else {
		echo "<font color='red'>ERROR: <b>Forum Votes</b> table was not renamed.<br><br>Report the error on the <a href='http://beta.phpfusion-mods.com'>beta site</a></font></center>";
	}
} else {
	echo "<center><font color='red'>ERROR: <b>Forum Polls</b> table was not renamed.<br><br>Report the error on the <a href='http://beta.phpfusion-mods.com'>beta site</a>.</font></center>";
}

?>

If the tables were renamed and you didn't receive an error, move onto the next step.

Step 3: Go to infusions admin and defuse Forum Polls.

Step 4: Upload the contents of the 'php-files' and 'upgrade' folders to the appropriate directory.

Step 5: If you have not modified any of the above core files on your site, you should be able to use the included files without any problems. Check the 'mod' folder to see if there is a folder that corresponds with your php-fusion version number. If so, upload the contents of that folder to the appropriate directories on your site. If there are no files included for your specific php-fusion version or you have modified any of the above files on your site, you will need to modify your existing files using the mod instructions below.

Step 6: Go to infusions admin and infuse Forum Polls.

Step 7: Go to infusions/forum_polls/upgrade.php and click the Upgrade button. The script will convert all of the old forum polls to the new table structure. If you don't receive any errors, click the delete tables button to drop the old forum poll tables from the database.

Step 8: Delete the upgrade file (infusions/forum_polls/upgrade.php) from your website.


Mod Instructions:
The instructions below are for PHP-Fusion v6.01.500, but may work on other versions.

Open forum/postedit.php

Find...

if (!defined("IN_FUSION")) { header("Location: ../index.php"); exit; }

ADD below it...

include INFUSIONS."forum_polls/includes/post.php"; // Forum Polls Mod

Find...

echo "<table cellspacing='0' cellpadding='0' border='0' width='100%' class='tbl-border'>

ADD above it...

fpm_preview(); // Forum Polls Mod

Find...

if (isset($_POST['delete'])) {

ADD below it...

fpm_delete(); // Forum Poll Mod

Find...

$attach = $_FILES['attach'];

ADD above it...

fpm_save($post_id); // Forum Polls Mod

Find...

if (!isset($_POST['previewchanges'])) {

REPLACE with...

if (!isset($_POST['previewchanges']) && !isset($_POST['fpm']['add_options'])) {

Find...

</table>
<table cellpadding='0' cellspacing='0' width='100%'>

REPLACE with...

</table>";
	fpm_form(); // Forum Polls Mod
	echo "<table cellpadding='0' cellspacing='0' width='100%'>

Find...

<td align='center' colspan='2' class='tbl1'>
<input type='submit' name='previewchanges' value='".$locale['405']."' class='button'>

REPLACE with...

<td align='center' colspan='2' class='tbl1'>";
	fpm_add(); // Forum Polls Mod
	echo "<input type='submit' name='previewchanges' value='".$locale['405']."' class='button'>

Save and close.

To The Top

Open forum/postnewthread.php

Find...

if (!defined("IN_FUSION")) { header("Location: ../index.php"); exit; }

ADD below it...

include INFUSIONS."forum_polls/includes/post.php"; // Forum Polls Mod

Find...

echo "<table cellspacing='0' cellpadding='0' border='0' width='100%' class='tbl-border'>

ADD above it...

fpm_preview(); // Forum Polls Mod

Find...

$attach = $_FILES['attach'];

ADD above it...

fpm_save($post_id); // Forum Polls Mod

Find...

if (!isset($_POST['previewpost'])) {

REPLACE with...

if (!isset($_POST['previewpost']) && !isset($_POST['fpm']['add_options'])) {

Find...

</table>
<table cellpadding='0' cellspacing='0' width='100%'>

REPLACE with...

</table>";
	fpm_form(); // Forum Polls Mod
	echo "<table cellpadding='0' cellspacing='0' width='100%'>

Find...

<td align='center' colspan='2' class='tbl1'>
<input type='submit' name='previewpost' value='".$locale['400']."' class='button'>

REPLACE with...

<td align='center' colspan='2' class='tbl1'>";
	fpm_add(); // Forum Polls Mod
	echo "<input type='submit' name='previewpost' value='".$locale['400']."' class='button'>

Save and close.

To The Top

Open forum/postreply.php

Find...

if (!defined("IN_FUSION")) { header("Location: ../index.php"); exit; }

ADD below it...

include INFUSIONS."forum_polls/includes/post.php"; // Forum Polls Mod

Find...

echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl-border'>

ADD above it...

fpm_preview(); // Forum Polls Mod

Find...

$attach = $_FILES['attach'];

ADD above it...

fpm_save($newpost_id); // Forum Polls Mod

Find...

if (!isset($_POST['previewreply'])) {

REPLACE with...

if (!isset($_POST['previewreply']) && !isset($_POST['fpm']['add_options'])) {

Find...

</table>
<table cellpadding='0' cellspacing='0' width='100%'>

REPLACE with...

</table>";
	fpm_form(); // Forum Polls Mod
	echo "<table cellpadding='0' cellspacing='0' width='100%'>

Find...

<td align='center' colspan='2' class='tbl1'>
<input type='submit' name='previewreply' value='".$locale['402']."' class='button'>

REPLACE with...

<td align='center' colspan='2' class='tbl1'>";
	fpm_add(); // Forum Polls Mod
	echo "<input type='submit' name='previewreply' value='".$locale['402']."' class='button'>

Save and close.

To The Top

Open forum/viewforum.php

Find...

opentable($locale['450']);

ADD above it...

include INFUSIONS."forum_polls/includes/view.php"; // Forum Polls Mod

Find...

echo "<td class='tbl1'><img src='".THEME."forum/stickythread.gif' alt='".$locale['560']."' style='vertical-align:middle;'>

ADD above it...

$threadsubject .= fpm_poll_exists();

Find...

echo "<td class='tbl1'>$threadsubject</td>

ADD above it...

$threadsubject .= fpm_poll_exists();

Save and close.

To The Top

Open forum/viewthread.php

Find...

opentable($locale['500']);

ADD above it...

include INFUSIONS."forum_polls/includes/view.php"; // Forum Polls Mod
fpm_vote(); // Forum Polls Mod

Find...

echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n";

ADD above it...

fpm_view(); // Forum Polls Mod

Save and close.

To The Top

Open infusions/forum_threads_list_panel/forum_threads_list_panel.php

Find...

if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }

ADD below it...

include_once INFUSIONS."forum_polls/includes/panels.php";

Find...

if ($theme_width == "100%") {

ADD above it...

$fpm_append = fpm_panels_poll_exists($data['forum_id'], $data['thread_id']);

Find... (this appears four times, so find and replace all)

$data['thread_subject']

REPLACE with...

$data['thread_subject'].$fpm_append

Save and close.

To The Top

Open infusions/forum_threads_list_panel/my_posts.php

Find...

if (!iMEMBER) fallback("../../index.php");

ADD below it...

include_once INFUSIONS."forum_polls/includes/panels.php";

Find...

while ($data = dbarray($result)) {

ADD below it...

$fpm_append = fpm_panels_poll_exists($data['forum_id'], $data['thread_id']);

Find... (this appears twice, so find and replace both)

$data['post_subject']

REPLACE with...

$data['post_subject'].$fpm_append

Save and close.

To The Top

Open infusions/forum_threads_list_panel/my_threads.php

Find...

if (!iMEMBER) fallback("../../index.php");

ADD below it...

include_once INFUSIONS."forum_polls/includes/panels.php";

Find...

while ($data = dbarray($result)) {

ADD below it...

$fpm_append = fpm_panels_poll_exists($data['forum_id'], $data['thread_id']);

Find... (this appears four times, so find and replace all)

$data['thread_subject']

REPLACE with...

$data['thread_subject'].$fpm_append

Save and close.

Open infusions/forum_threads_list_panel/new_posts.php

Find...

if (!iMEMBER) fallback("../../index.php");

ADD below it...

include_once INFUSIONS."forum_polls/includes/panels.php";

Find...

while ($data = dbarray($result)) {

ADD below it...

$fpm_append = fpm_panels_poll_exists($data['forum_id'], $data['thread_id']);

Find...

$data['post_subject']

REPLACE with...

$data['post_subject'].$fpm_append

Save and close.

To The Top

To The Top

Open infusions/forum_threads_panel/forum_threads_panel.php

Find...

if (!defined("IN_FUSION")) { header("Location: ../../index.php"); exit; }

ADD below it...

include_once INFUSIONS."forum_polls/includes/panels.php";

Find... (this appears twice, so find and add twice)

while ($data = dbarray($result)) {

ADD below it...

$fpm_append = fpm_panels_poll_exists($data['forum_id'], $data['thread_id']);

Find... (this appears four times, so find and replace all)

$data['thread_subject']

REPLACE with...

$data['thread_subject'].$fpm_append

Save and close.

To The Top

Change Log:

To The Top