Пример #1
0
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: thread_debate.php 16706 2010-09-13 06:37:44Z wangjinbo $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$debate = $_G['forum_thread'];
$debate = DB::fetch_first("SELECT * FROM " . DB::table('forum_debate') . " WHERE tid='{$_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;
Пример #2
0
    $voterids = '';
    while ($options = $db->fetch_array($query)) {
        $viewvoteruid[] = $options['voterids'];
        $voterids .= "\t" . $options['voterids'];
        $polloptions[] = array('polloptionid' => $options['polloptionid'], 'polloption' => preg_replace("/\\[url=(https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\\/\\/([^\\[\"']+?)\\](.+?)\\[\\/url\\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $options['polloption']), 'votes' => $options['votes'], 'width' => @round($options['votes'] * 300 / $count['max']) + 2, 'percent' => @sprintf("%01.2f", $options['votes'] * 100 / $count['total']));
    }
    $voterids = explode("\t", $voterids);
    $voters = array_unique($voterids);
    $voterscount = count($voters) - 1;
    array_shift($voters);
    if (!$expiration) {
        $expirations = $timestamp + 86400;
    } else {
        $expirations = $expiration;
        if ($expirations > $timestamp) {
            $thread['remaintime'] = remaintime($expirations - $timestamp);
        }
    }
    $allowvote = $allowvote && (empty($thread['closed']) || $alloweditpoll) && !in_array($discuz_uid ? $discuz_uid : $onlineip, $voters) && $timestamp < $expirations && $expirations > 0;
    $optiontype = $multiple ? 'checkbox' : 'radio';
    $visiblepoll = $visible || $forum['ismoderator'] || $discuz_uid && $discuz_uid == $thread['authorid'] || $expirations >= $timestamp && in_array($discuz_uid ? $discuz_uid : $onlineip, $voters) ? 0 : 1;
} else {
    $db->query("UPDATE {$tablepre}threads SET special='0' WHERE tid='{$tid}'", 'UNBUFFERED');
}
$post = $db->fetch_first("SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,\r\n\tm.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,\r\n\tm.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, m.xspacestatus, mf.nickname, mf.site,\r\n\tmf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals, mf.avatar, mf.avatarwidth,\r\n\tmf.avatarheight, mf.customstatus, mf.spacename {$fieldsadd}\r\n\tFROM {$tablepre}posts p\r\n\tLEFT JOIN {$tablepre}members m ON m.uid=p.authorid\r\n\tLEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid\r\n\tWHERE p.tid='{$tid}' AND first=1 LIMIT 1");
$pid = $post['pid'];
$postlist[$post['pid']] = viewthread_procpost($post);
if ($attachpids) {
    require_once DISCUZ_ROOT . './include/attachment.func.php';
    parseattach($attachpids, $attachtags, $postlist, $showimages);
}
Пример #3
0
$prg_total = $prg_total = count($process['tables']) + count($process['start']) + count($process['steps']);
foreach (array('start', 'tables', 'steps') as $program) {
    if (!empty($process[$program]) && !$process[$program . '_is_end']) {
        foreach ($process[$program] as $k => $v) {
            if ($v) {
                $prg_done++;
            } elseif ($prg_next == '') {
                $prg_next = $k;
            }
        }
        if ($prg_next) {
            if (empty($prg) || !file_exists($prg_dir[$program] . $prg)) {
                $prg = $prg_next;
            }
            $prg_done++;
            list($rday, $rhour, $rmin, $rsec) = remaintime(time() - $process['timestart']);
            $stime = gmdate('Y-m-d H:i:s', $process['timestart'] + 3600 * 8);
            $timetodo = "升级开始时间:<strong>{$stime}</strong>, 升级程序已经执行了 <strong>{$rday}</strong>天 <strong>{$rhour}</strong>小时 <strong>{$rmin}</strong>分 <strong>{$rsec}</strong>秒";
            $timetodo .= "<br><br>目前正在执行转换程序( {$prg_done} / {$prg_total} ) <strong>{$prg}</strong>,转换过程中需要多次跳转,请勿关闭浏览器。";
            $timetodo .= "<br><br>如果程序中断或者需要重新开始当前程序,请点击 (<a href=\"index.php?a=convert&source={$source}&prg={$prg}\">重新开始</a>)";
            showtips($timetodo);
            if (file_exists($prg_dir[$program] . $prg)) {
                define('PROGRAM_TYPE', $program);
                require $prg_dir[$program] . $prg;
                save_process_main($prg);
                showmessage("转换程序 {$prg} 执行完毕, 现在跳转到下一个程序", "index.php?a=convert&source={$source}", null, 500);
            } else {
                showmessage('数据转换中断! 无法找到转换程序 ' . $prg);
            }
        } else {
            $process[$program . '_is_end'] = 1;
Пример #4
0
    foreach ($query as $options) {
        $viewvoteruid[] = $options['voterids'];
        $voterids .= "\t" . $options['voterids'];
        $option = preg_replace("/\\[url=(https?){1}:\\/\\/([^\\[\"']+?)\\](.+?)\\[\\/url\\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $options['polloption']);
        $polloptions[$opts++] = array('polloptionid' => $options['polloptionid'], 'polloption' => $option, 'votes' => $options['votes'], 'width' => $options['votes'] > 0 ? @round($options['votes'] * 100 / $count['total']) . '%' : '8px', 'percent' => @sprintf("%01.2f", $options['votes'] * 100 / $count['total']), 'color' => $colors[$ci]);
        if ($ci < 2) {
            $polloptionpreview .= $option . "\t";
        }
        $ci++;
        if ($ci == count($colors)) {
            $ci = 0;
        }
    }
    $voterids = explode("\t", $voterids);
    $voters = array_unique($voterids);
    array_shift($voters);
    if (!$expiration) {
        $expirations = TIMESTAMP + 86400;
    } else {
        $expirations = $expiration;
        if ($expirations > TIMESTAMP) {
            $_G['forum_thread']['remaintime'] = remaintime($expirations - TIMESTAMP);
        }
    }
    $allwvoteusergroup = $_G['group']['allowvote'];
    $allowvotepolled = !in_array($_G['uid'] ? $_G['uid'] : $_G['clientip'], $voters);
    $allowvotethread = ($_G['forum_thread']['isgroup'] || !$_G['forum_thread']['closed'] && !checkautoclose($_G['forum_thread']) || $_G['group']['alloweditpoll']) && TIMESTAMP < $expirations && $expirations > 0;
    $_G['group']['allowvote'] = $allwvoteusergroup && $allowvotepolled && $allowvotethread;
    $optiontype = $multiple ? 'checkbox' : 'radio';
    $visiblepoll = $visible || $_G['forum']['ismoderator'] || $_G['uid'] && $_G['uid'] == $_G['forum_thread']['authorid'] || $expirations >= TIMESTAMP && in_array($_G['uid'] ? $_G['uid'] : $_G['clientip'], $voters) || $expirations < TIMESTAMP ? 0 : 1;
}
Пример #5
0
	[Discuz!] (C)2001-2009 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: viewthread_debate.inc.php 21214 2009-11-20 07:17:05Z liulanbo $
*/
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$debate = $thread;
$debate = $sdb->fetch_first("SELECT * FROM {$tablepre}debates WHERE tid='{$tid}'");
$debate['dbendtime'] = $debate['endtime'];
if ($debate['dbendtime']) {
    $debate['endtime'] = gmdate("{$dateformat} {$timeformat}", $debate['dbendtime'] + $timeoffset * 3600);
}
if ($debate['dbendtime'] > $timestamp) {
    $debate['remaintime'] = remaintime($debate['dbendtime'] - $timestamp);
}
$debate['starttime'] = dgmdate("{$dateformat} {$timeformat}", $debate['starttime'] + $timeoffset * 3600);
$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);
    } elseif ($debate['negavotes'] && $debate['negavotes'] > $debate['affirmvotes']) {
        $debate['negavoteswidth'] = 100;
        $debate['affirmvoteswidth'] = intval($debate['affirmvotes'] / $debate['negavotes'] * 100);
    } else {
        $debate['affirmvoteswidth'] = $debate['negavoteswidth'] = 100;
    }
} else {