legionofangels |
09-25-2008 03:30 PM |
PHP Code:
<?php
//uncomment this and then change the directory if this is above your forums directory
//chdir('./forums');
require_once ('./global.php');
require_once ('./includes/functions_bigthree.php');
require_once ('./includes/functions_misc.php');
require_once ('./includes/class_bbcode.php');
$poll = mypoll();
echo $poll;
function mypoll()
{
global $vbulletin, $stylevar, $vbphrase;
$query = array();
$query['orderby'] = 'poll.dateline';
$query['sortorder'] = 'DESC';
$pollforumids1 = array(16,17,18,19,20,21,23,24,25,26,28,29,30,31,32,2,3,4,5,7,8,9,10,12,13,14,34,35,36,37,40,54,198,153,200);
$pollforumids = array();
foreach ($pollforumids1 as $key => $pollforumid)
{
$pollforumids[$key] = trim($pollforumid);
}
$mods['inforums'] = 'AND thread.forumid IN(' . implode(',', $pollforumids) . ')';
if ($vbulletin->userinfo['userid'])
{
$query['pollfields'] = ', voteoption';
$query['polljoin'] = 'LEFT JOIN ' . TABLE_PREFIX .
'pollvote AS pollvote ON (pollvote.pollid = poll.pollid AND pollvote.userid = ' .
$vbulletin->userinfo['userid'] . ')';
}
$pollinfo = $vbulletin->db->query_first("
SELECT thread.pollid, open, threadid, replycount, forumid, question, poll.dateline, options, votes, active, numberoptions, timeout, multiple, voters, public $query[pollfields]
FROM " . TABLE_PREFIX . "poll AS poll
INNER JOIN " . TABLE_PREFIX . "thread AS thread USING (pollid)
$query[polljoin]
WHERE open <> 10
AND visible = 1
AND active = 1
$mods[inforums]
ORDER BY $query[orderby] $query[sortorder]
");
if ($pollinfo['pollid'])
{
$bbcode_parser = &new vB_BbCodeParser($vbulletin, fetch_tag_list());
$pollinfo['question'] = $bbcode_parser->parse($pollinfo['question'], 'nonforum', true);
$splitoptions = explode('|||', $pollinfo['options']);
$splitvotes = explode('|||', $pollinfo['votes']);
$pollinfo['nvotes'] = iif($pollinfo['multiple'], $pollinfo['voters'], array_sum
($splitvotes));
$pollforumperms = fetch_permissions($pollinfo['forumid']);
if (!$pollinfo['active'] or !$pollinfo['open'] or ($pollinfo['dateline'] + ($pollinfo['timeout'] *
86400) < TIMENOW and $pollinfo['timeout']) or !($pollforumperms & $vbulletin->bf_ugp_forumpermissions['canvote']))
{
$pollinfo['showresults'] = 1;
$pollinfo['message'] = iif(($pollforumperms & $vbulletin->bf_ugp_forumpermissions['canvote']),
$vbphrase['this_poll_is_closed'], $vbphrase['you_may_not_vote_on_this_poll']);
}
if (fetch_bbarray_cookie('poll_voted', $pollinfo['pollid']) or $pollinfo['voteoption'])
{
$pollinfo['showresults'] = 1;
$pollinfo['message'] = $vbphrase['you_have_already_voted_on_this_poll'];
}
if (can_moderate($pollinfo['forumid'], 'caneditpoll'))
{
$show['editpoll'] = true;
}
$pollbits = '';
$option = '';
foreach ($splitvotes as $key => $value)
{
$option['question'] = $bbcode_parser->parse($splitoptions["$key"], '', $mod_options['portal_poll_allowsmilies']);
$show['voteital'] = '';
if ($pollinfo['voteoption'] == ($key + 1))
{
$show['voteital'] = 1;
}
$option['votes'] = $value;
$option['number'] = $key + 1;
if ($pollinfo['showresults'])
{
$option['percent'] = 0;
if ($value)
{
$option['percent'] = vb_number_format($value / $pollinfo['nvotes'] * 100, 2);
}
$option['graphicnumber'] = $option['number'] % 6 + 1;
$option['barnumber'] = intval($option['percent'] * 1.4);
eval('$pollbits .= "' . fetch_template('adv_portal_pollresult') . '";');
} elseif ($pollinfo['multiple'])
{
eval('$pollbits .= "' . fetch_template('adv_portal_polloption_multiple') . '";');
}
else
{
eval('$pollbits .= "' . fetch_template('adv_portal_polloption') . '";');
}
}
//eval('$polltotal .= "' . fetch_template('adv_portal_poll') . '";');
$polltotal .= "<form method=\"post\" action=\"./poll.php\">";
$polltotal .= "<table>";
$polltotal .= "<tr>";
$polltotal .= "<td class=\"thead\">" . $pollinfo['question'] . "</td>";
$polltotal .= "</tr>";
$polltotal .= $pollbits;
$polltotal .= "<tr>";
$polltotal .= "<td align=\"" . $stylevar['left'] . "\" class=\"alt1\">";
if ($pollinfo['showresults'])
{
$polltotal .= "<span class=\"smallfont\"><b>" . $vbphrase['votes'] . ": " . $pollinfo['nvotes'] .
"</b><br />" . $pollinfo['message'] . ".</span>";
}
else
{
$polltotal .= "<input name=\"s\" type=\"hidden\" value=\"" . $vbulletin->session->vars['dbsessionhash'] .
"\" />";
$polltotal .= "<input name=\"do\" type=\"hidden\" value=\"pollvote\" />";
$polltotal .= "<input type=\"hidden\" name=\"securitytoken\" value=\"" . $vbulletin->userinfo['securitytoken'] .
"\" />\n";
$polltotal .= "<input name=\"pollid\" type=\"hidden\" value=\"" . $pollinfo['pollid'] .
"\" />";
$polltotal .= "<input class=\"button\" name=\"button\" type=\"submit\" value=\"" .
$vbphrase['vote_now'] . "\" />";
}
$polltotal .= "</td>";
$polltotal .= "</tr>";
$polltotal .= "<tr>";
$polltotal .= "<td class=\"alt2\">";
$polltotal .= "<div class=\"smallfont\">» <a href=\"" . $vbulletin->options['bburl'] .
"/poll.php?" . $vbulletin->session->vars['sessionurl'] .
"do=showresults&pollid=" . $pollinfo['pollid'] . "\">" . $vbphrase['view_poll_results'] .
"</a></div>";
if ($mod_options['portal_poll_allowreplies'])
{
$polltotal .= "<div class=\"smallfont\">» <a href=\"" . $vbulletin->options['bburl'] .
"/newreply.php?" . $vbulletin->session->vars['sessionurl'] . "t=" . $pollinfo['threadid'] .
"\">" . $vbphrase['discuss_this_poll'] . "</a></div>";
$polltotal .= "<div class=\"smallfont\">» <a href=\"" . $vbulletin->options['bburl'] .
"/showthread.php?" . $vbulletin->session['sessionurl'] . "t=" . $pollinfo['threadid'] .
"\">" . $vbphrase['this_poll_has'] . " " . $pollinfo['replycount'];
if ($pollinfo['replycount'] == 1)
{
$polltotal .= $vbphrase['reply'];
}
else
{
$polltotal .= $vbphrase['replies'];
}
$polltotal .= "</a></div>";
}
if ($show['editpoll'])
{
$polltotal .= "<div class=\"smallfont\">» <a href=\"" . $vbulletin->options['bburl'] .
"/poll.php?" . $vbulletin->session->vars['sessionurl'] .
"do=polledit&pollid=" . $pollinfo['pollid'] . "\">" . $vbphrase['edit_poll'] .
"</a></div>";
}
$polltotal .= "</td>";
$polltotal .= "</tr>";
$polltotal .= "</table>";
$polltotal .= "</form>";
return $polltotal;
}
}
?>
There is the mypoll.php, what should we modify?
Thanks for your help so far, but we're still not seeing what the problem is.
|