========================================================
MOD NAME: Poll with comments & results v1.02 alpha
PHP-FUSION VERSION: v6.00
========================================================

========================================================
MOD AUTHOR: baskata
AUTOR EMAIL: baskata@abv.bg
DATE: 19.11.2006
========================================================

========================================================
LICENSE: GNU/GPL
========================================================

========================================================
QUESTIONS?
http://beta.phpfusion-mods.com
========================================================

========================================================
FILE CHANGES
- member_poll_panel/member_poll_panel.php
- member_poll_panel/polls_archive.php
========================================================

========================================================
CHANGELOG
 - v1.02
Fixed count of comments.
 - v1.01
Fixet some bugs by wlodekp.
New languages added : Hungarian by dtommy79 & Polish by wlodekp!
 - v1.00
First mod version.
========================================================

========================================================
BACKUP YOUR WEBSITE BEFORE UPLOADING OR MODIFYING ANY FILES!!!
========================================================

========================================================
INSTALLATION

Upload the member_poll_panel folder to your Infusions folder on your web-server.

/member_poll_panel/member_poll_panel.php
/member_poll_panel/polls_archive.php
/member_poll_panel/polls_comments.php
/member_poll_panel/locale/English.php
/member_poll_panel/locale/Bulgarian.php
========================================================

========================================================
MANUAL INSTALLATION
========================================================

========================================================
Step 1 :
--------------------------------------------------------
Make folder named locale in member_poll_panel
========================================================

========================================================
Step 2 :
--------------------------------------------------------
Make file named English.php and open it in an editor and add :

<?php
$locale['999'] = "Comments : ";
$locale['998'] = "Results";
$locale['997'] = "Archives";
$locale['996'] = "ID ";
?>
--------------------------------------------------------
========================================================

========================================================
SAVE AND CLOSE
========================================================

========================================================
Step 3 :
--------------------------------------------------------
Make a copy of polls_archive.php and rename it to polls_comments.php
--------------------------------------------------------
========================================================

========================================================
Step 4 :
--------------------------------------------------------
Open the polls_comments.php in an editor and...
========Find :
require_once BASEDIR."side_left.php";
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
require_once BASEDIR."side_left.php";
require_once INCLUDES."comments_include.php";
if (file_exists(INFUSIONS."member_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."member_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."member_poll_panel/locale/English.php";
}
--------------------------------------------------------
========================================================

========================================================
Step 5 :
--------------------------------------------------------
========Find :
$result = dbquery("SELECT * FROM ".$db_prefix."polls WHERE poll_ended!='0' ORDER BY poll_id DESC");
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
$result = dbquery("SELECT * FROM ".$db_prefix."polls WHERE poll_ended!='1' ORDER BY poll_id DESC");
--------------------------------------------------------
========================================================

========================================================
Step 6 :
--------------------------------------------------------
========Find :
		$view_list .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
	}
	opentable($locale['108']);
	echo "<form name='pollsform' method='post' action='".FUSION_SELF."'>
<center>
".$locale['109']."<br>
<select name='viewpoll_id' class='textbox'>
$view_list</select>
<input type='submit' name='view' value='".$locale['110']."' class='button'>
</center>
</form>\n";
	closetable();
}
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
		$view_list .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
	}
}
--------------------------------------------------------
========================================================

========================================================
Step 7 :
--------------------------------------------------------
========Find :
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."polls WHERE poll_id='$viewpoll_id' AND poll_ended!='0'"));
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."polls WHERE poll_id='$viewpoll_id' AND poll_ended!='1'"));
--------------------------------------------------------
========================================================

========================================================
Step 8 :
--------------------------------------------------------
========Find :
".$locale['105'].$viewpoll_votes."<br>
".$locale['106'].showdate("shortdate", $data['poll_started'])."<br>
".$locale['107'].showdate("shortdate", $data['poll_ended'])."
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
".$locale['105'].$viewpoll_votes."<br>
".$locale['106'].showdate("shortdate", $data['poll_started'])."<br>
--------------------------------------------------------
========================================================

========================================================
Step 9 :
--------------------------------------------------------
========Find :
	closetable();
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
$poll_info = array(
"poll_comments" => dbcount("(comment_id)", "comments", "comment_type='O' AND comment_item_id='".$data['poll_id']."'"),
);
echo "".$locale['999'].$poll_info['poll_comments']."";
closetable();
showcomments("O","polls","poll_id",$viewpoll_id,FUSION_SELF."?viewpoll_id=$viewpoll_id");
--------------------------------------------------------
========================================================

========================================================
SAVE AND CLOSE
========================================================

########################################################

========================================================
Step 10 :
--------------------------------------------------------
Open the polls_archive.php in an editor and...
========Find :
require_once BASEDIR."side_left.php";
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
require_once BASEDIR."side_left.php";
require_once INCLUDES."comments_include.php";
if (file_exists(INFUSIONS."member_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."member_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."member_poll_panel/locale/English.php";
}
--------------------------------------------------------
========================================================

========================================================
Step 11 :
--------------------------------------------------------
========Find :
		$view_list .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
	}
	opentable($locale['108']);
	echo "<form name='pollsform' method='post' action='".FUSION_SELF."'>
<center>
".$locale['109']."<br>
<select name='viewpoll_id' class='textbox'>
$view_list</select>
<input type='submit' name='view' value='".$locale['110']."' class='button'>
</center>
</form>\n";
	closetable();
}
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
$poll_info = array(
"poll_comments" => dbcount("(comment_id)", "comments", "comment_type='O' AND comment_item_id='".$data['poll_id']."'"),
);
$view_list .= "".$locale['996'].$data['poll_id']." - <a href='".INFUSIONS."member_poll_panel/polls_archive.php?viewpoll_id=".$data['poll_id']."'>".$data['poll_title']."</a> - ".$locale['999'].$poll_info['poll_comments']."<br>\n";
	}
opentable($locale['108']);
echo "<center>
".$locale['109']."<br>
</center>
<left>
$view_list
</left>\n";
	closetable();
}
--------------------------------------------------------
========================================================

========================================================
Step 12 :
--------------------------------------------------------
========Find :
	closetable();
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
$poll_info = array(
"poll_comments" => dbcount("(comment_id)", "comments", "comment_type='O' AND comment_item_id='".$data['poll_id']."'"),
);
echo "".$locale['999'].$poll_info['poll_comments']."";
closetable();
showcomments("O","polls","poll_id",$viewpoll_id,FUSION_SELF."?viewpoll_id=$viewpoll_id");
--------------------------------------------------------
========================================================

========================================================
SAVE AND CLOSE
========================================================

########################################################

========================================================
Step 13 :
--------------------------------------------------------
Open the member_poll_panel.php in an editor and...
========Find :
if (isset($poll_id) && !isNum($poll_id)) fallback("index.php");
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
if (isset($poll_id) && !isNum($poll_id)) fallback("index.php");
if (file_exists(INFUSIONS."member_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."member_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."member_poll_panel/locale/English.php";
}
--------------------------------------------------------
========================================================

========================================================
Step 14 :
--------------------------------------------------------
========Find :
if (dbrows($result) > 1) {
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
if (dbrows($result) < 0) {
--------------------------------------------------------
========================================================

========================================================
Step 15 :
--------------------------------------------------------
========Find :
closeside();
--------------------------------------------------------

--------------------------------------------------------
========Replace directly with this Code :
$poll_info = array(
"poll_comments" => dbcount("(comment_id)", "comments", "comment_type='O' AND comment_item_id='".$data['poll_id']."'"),
);
echo "<center><br><img src='".THEME."images/bullet.gif' alt=''> <a href='".INFUSIONS."member_poll_panel/polls_comments.php?viewpoll_id=".$data['poll_id']."' class='side'>".$locale['998']."</a> <img src='".THEME."images/bulletb.gif' alt=''></center>";
echo "<center><img src='".THEME."images/bullet.gif' alt=''> <a href='".INFUSIONS."member_poll_panel/polls_comments.php?viewpoll_id=".$data['poll_id']."' class='side'>".$locale['999'].$poll_info['poll_comments']."</a> <img src='".THEME."images/bulletb.gif' alt=''></center>";
		if ($data['poll_ended'] > 0) {
			echo "<br>\n".$locale['107'].showdate("shortdate", $data['poll_ended'])."\n";
		}
		$result = dbquery("SELECT * FROM ".$db_prefix."polls");
		if (dbrows($result) > 1) {
			echo "<center><img src='".THEME."images/bullet.gif' alt=''> <a href='".INFUSIONS."member_poll_panel/polls_archive.php' class='side'>".$locale['997']."</a> <img src='".THEME."images/bulletb.gif' alt=''></center>\n";
		echo "\n";
} else {
	echo "\n";
}
closeside();
--------------------------------------------------------
========================================================

========================================================
SAVE AND CLOSE
========================================================

========================================================
MOD COMPLETE
========================================================