View Single Post
  #12  
Old 09-25-2008, 03:30 PM
legionofangels's Avatar
legionofangels legionofangels is offline
 
Join Date: Mar 2007
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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($vbulletinfetch_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'] * 1002);
                }

                
$option['graphicnumber'] = $option['number'] % 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\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
            
"/poll.php?" $vbulletin->session->vars['sessionurl'] .
            
"do=showresults&amp;pollid=" $pollinfo['pollid'] . "\">" $vbphrase['view_poll_results'] .
            
"</a></div>";
        if (
$mod_options['portal_poll_allowreplies'])
        {
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/newreply.php?" $vbulletin->session->vars['sessionurl'] . "t=" $pollinfo['threadid'] .
                
"\">" $vbphrase['discuss_this_poll'] . "</a></div>";
            
$polltotal .= "<div class=\"smallfont\">&raquo; <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\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/poll.php?" $vbulletin->session->vars['sessionurl'] .
                
"do=polledit&amp;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.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02651 seconds
  • Memory Usage 1,936KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete