📄 polls.inc.php
字号:
<?php
/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: polls.inc.php,v $
$Revision: 1.6.2.2 $
$Date: 2006/07/17 07:50:18 $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$query = $db->query("SELECT p.multiple, p.visible, p.maxchoices, p.expiration, pp.polloptionid, pp.votes, pp.polloption, voterids FROM {$tablepre}polloptions pp LEFT JOIN {$tablepre}polls p ON p.tid=pp.tid WHERE pp.tid='$tid' ORDER BY displayorder");
$voterids = '';
while($options = $db->fetch_array($query)) {
$viewvoteruid[] = $options['voterids'];
$voterids .= "\t".$options['voterids'];
$polloptions[] = array
(
'polloptionid' => $options['polloptionid'],
'polloption' => stripslashes($options['polloption']),
'votes' => $options['votes'],
'width' => @round($options['votes'] * 300 / $count['max']) + 2,
'percent' => @sprintf("%01.2f", $options['votes'] * 100 / $count['total'])
);
$multiple = $options['multiple'];
$visible = $options['visible'];
$maxchoices = $options['maxchoices'];
$expiration = $options['expiration'];
}
$voterids = explode("\t", $voterids);
$voters = array_unique($voterids);
array_shift($voters);
if($showvoters) {
$voterids = implode('\',\'', $voters);
$svquery = $db->query("SELECT uid, username FROM {$tablepre}members WHERE uid IN ('$voterids')");
while($voter = $db->fetch_array($svquery)) {
$options['uid'][] = $voter['uid'];
$options['voters'][] = $voter['username'];
}
$options['voters'] = is_array($options['voters']) ? array_map('stripslashes', $options['voters']) : array();
if($adminid == 1 && $voters) {
foreach($viewvoteruid as $key => $value) {
$viewvoteruid[$key] = explode("\t", $value);
foreach($options['uid'] as $optuidkey => $optuidvalue) {
if(in_array($optuidvalue, $viewvoteruid[$key])) {
$options['viewvoters'][$key][] = $options['voters'][$optuidkey];
}
}
}
}
}
if(!$expiration) {
$expirations = $timestamp + 86400;
} else {
$expirations = $expiration;
$expiration = gmdate("$dateformat $timeformat", $expiration + $timeoffset * 3600);
}
$allowvote = $allowvote && (empty($thread['closed']) || $alloweditpoll) && !in_array(($discuz_uid ? $discuz_uid : $onlineip), $voters) && $timestamp < $expirations && $expirations > 0;
$optiontype = $multiple ? 'checkbox' : 'radio';
$visiblepoll = 0;
if(!($visible || in_array(($discuz_uid ? $discuz_uid : $onlineip), $voters) || in_array($adminid, array(1, 2)) || $ismoderator) && $expirations > $timestamp) {
$visiblepoll = 1;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -