thread_debate.php
2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: thread_debate.php 24551 2011-09-26 03:05:44Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$debate = $_G['forum_thread'];
$debate = C::t('forum_debate')->fetch($_G['tid']);
$debate['dbendtime'] = $debate['endtime'];
if($debate['dbendtime']) {
$debate['endtime'] = dgmdate($debate['dbendtime']);
}
if($debate['dbendtime'] > TIMESTAMP) {
$debate['remaintime'] = remaintime($debate['dbendtime'] - TIMESTAMP);
}
$debate['starttime'] = dgmdate($debate['starttime'], 'u');
$debate['affirmpoint'] = discuzcode($debate['affirmpoint'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);
$debate['negapoint'] = discuzcode($debate['negapoint'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);
if($debate['affirmvotes'] || $debate['negavotes']) {
if($debate['affirmvotes'] && $debate['affirmvotes'] > $debate['negavotes']) {
$debate['affirmvoteswidth'] = 100;
$debate['negavoteswidth'] = intval($debate['negavotes'] / $debate['affirmvotes'] * 100);
$debate['negavoteswidth'] = $debate['negavoteswidth'] > 0 ? $debate['negavoteswidth'] : 5;
} elseif($debate['negavotes'] && $debate['negavotes'] > $debate['affirmvotes']) {
$debate['negavoteswidth'] = 100;
$debate['affirmvoteswidth'] = intval($debate['affirmvotes'] / $debate['negavotes'] * 100);
$debate['affirmvoteswidth'] = $debate['affirmvoteswidth'] > 0 ? $debate['affirmvoteswidth'] : 5;
} else {
$debate['affirmvoteswidth'] = $debate['negavoteswidth'] = 100;
}
} else {
$debate['negavoteswidth'] = $debate['affirmvoteswidth'] = 5;
}
if($debate['umpirepoint']) {
$debate['umpirepoint'] = discuzcode($debate['umpirepoint'], 0, 0, 0, 1, 1, 1, 0, 0, 0, 0);
}
$debate['umpireurl'] = rawurlencode($debate['umpire']);
list($debate['bestdebater'], $debate['bestdebateruid'], $debate['bestdebaterstand'], $debate['bestdebatervoters'], $debate['bestdebaterreplies']) = explode("\t", $debate['bestdebater']);
$debate['bestdebaterurl'] = rawurlencode($debate['bestdebater']);
foreach(C::t('forum_post')->fetch_all_debatepost_by_tid_stand($_G['tid'], 1, 0, 16) as $affirmavatar) {
if(!isset($debate['affirmavatars'][$affirmavatar['authorid']])) {
$affirmavatar['avatar'] = avatar($affirmavatar['authorid'], 'small');
$debate['affirmavatars'][$affirmavatar['authorid']] = $affirmavatar;
}
}
foreach(C::t('forum_post')->fetch_all_debatepost_by_tid_stand($_G['tid'], 2, 0, 16) as $negaavatar) {
if(!isset($debate['negaavatars'][$negaavatar['authorid']])) {
$negaavatar['avatar'] = avatar($negaavatar['authorid'], 'small');
$debate['negaavatars'][$negaavatar['authorid']] = $negaavatar;
}
}
if($_G['setting']['fastpost'] && $allowpostreply && $_G['forum_thread']['closed'] == 0) {
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
}
?>