titlebar($apx->lang->get('HEADLINE_RECENT') . ': ' . strip_tags($pollinfo['question'])); } else { headline($apx->lang->get('HEADLINE_ARCHIVE'), mklink('poll.php', 'poll.html')); titlebar($apx->lang->get('HEADLINE_ARCHIVE') . ': ' . strip_tags($pollinfo['question'])); } //KOMMENTARE if ($_REQUEST['comments'] && $_REQUEST['id']) { poll_showcomments($_REQUEST['id']); require 'lib/_end.php'; } //Verwendete Variablen auslesen $parse = $apx->tmpl->used_vars('poll'); //////////////////////////////////////////////////////////////////////////////////////////////////////// ERGEBNIS if ($_REQUEST['result'] || $_REQUEST['id'] != $recent && !$set['poll']['archvote'] || $_POST['vote'] || $_COOKIE[$set['main']['cookie_pre'] . '_voted'][$pollinfo['id']] == '1' || $ipblock || $pollinfo['starttime'] + $pollinfo['days'] * 24 * 3600 <= time()) { //Ergebnis $result = poll_format_result($pollinfo); foreach ($result as $element) { ++$ri; $percent = round($element[1] / iif($pollinfo['total'], $pollinfo['total'], 1) * 100, $set['poll']['percentdigits']); if ($set['poll']['barmaxwidth']) { $width = round($percent * $set['poll']['barmaxwidth'] / 100); } else { $width = round($percent) . '%'; } $resdata[$ri]['ANSWER'] = $element[0]; $resdata[$ri]['VOTES'] = $element[1]; $resdata[$ri]['COLOR'] = $element[2]; $resdata[$ri]['PERCENT'] = $percent . '%'; $resdata[$ri]['WIDTH'] = $width; } if ($pollinfo['starttime'] + $pollinfo['days'] * 24 * 3600 <= time()) {
function poll_small($id = false, $template = 'poll') { global $set, $db, $apx, $user; $id = (int) $id; $tmpl = new tengine(); $apx->lang->drop('poll', 'poll'); $recent = poll_recent(); if (!$id) { $id = $recent; } //Verwendete Variablen auslesen $parse = $tmpl->used_vars('functions/' . $template, 'poll'); $pollinfo = $db->first("SELECT *,a1_c+a2_c+a3_c+a4_c+a5_c+a6_c+a7_c+a8_c+a9_c+a10_c+a11_c+a12_c+a13_c+a14_c+a15_c+a16_c+a17_c+a18_c+a19_c+a20_c AS total FROM " . PRE . "_poll WHERE ( id='" . $id . "' " . section_filter() . " ) LIMIT 1"); if (!$pollinfo['id']) { return; } if ($user->info['userid']) { list($ipblock) = $db->first("SELECT ip FROM " . PRE . "_poll_iplog WHERE ( id='" . $id . "' AND userid='" . $user->info['userid'] . "' AND time>" . (time() - 24 * 3600) . " ) LIMIT 1"); } else { list($ipblock) = $db->first("SELECT ip FROM " . PRE . "_poll_iplog WHERE ( id='" . $id . "' AND ip='" . ip2integer(get_remoteaddr()) . "' AND time>" . (time() - 24 * 3600) . " ) LIMIT 1"); } //Ergebnisse zeigen if ($pollinfo['id'] != $recent && !$set['poll']['archvote'] || $_COOKIE[$set['main']['cookie_pre'] . '_voted'][$pollinfo['id']] == '1' || $ipblock || $pollinfo['starttime'] + $pollinfo['days'] * 24 * 3600 <= time()) { $result = poll_format_result($pollinfo); foreach ($result as $element) { ++$ri; $percent = round($element[1] / iif($pollinfo['total'], $pollinfo['total'], 1) * 100, $set['poll']['percentdigits']); $width = round($percent) . '%'; $resdata[$ri]['ANSWER'] = $element[0]; $resdata[$ri]['VOTES'] = $element[1]; $resdata[$ri]['COLOR'] = $element[2]; $resdata[$ri]['PERCENT'] = $percent . '%'; $resdata[$ri]['WIDTH'] = $width; } if ($pollinfo['starttime'] + $pollinfo['days'] * 24 * 3600 <= time()) { $set_end = 1; } if ($_COOKIE[$set['main']['cookie_pre'] . '_voted'][$pollinfo['id']] == '1' || $ipblock) { $set_voted = 1; } $tmpl->assign('TOTALVOTES', $pollinfo['total']); $tmpl->assign('RESULT', $resdata); $tmpl->assign('SET_END', $set_end); $tmpl->assign('SET_VOTED', $set_voted); } else { for ($i = 1; $i <= 20; $i++) { if (!$pollinfo['a' . $i]) { continue; } if ($pollinfo['multiple']) { $box = '<input type="checkbox" name="vote[' . $i . ']" value="1" />'; } else { $box = '<input type="radio" name="vote" value="' . $i . '" />'; } $optdata[$i]['ANSWER'] = $pollinfo['a' . $i]; $optdata[$i]['COLOR'] = $pollinfo['color' . $i]; $optdata[$i]['BOX'] = $box; } $postto = mklink('poll.php?id=' . $pollinfo['id'], 'poll,' . $pollinfo['id'] . urlformat($pollinfo['question']) . '.html'); $tmpl->assign('POSTTO', $postto); $tmpl->assign('OPTION', $optdata); } //Link: Ergebnis zeigen if ($pollinfo['id'] == $recent) { $resultlink = mklink('poll.php?recent=1&result=1', 'poll,recent.html?result=1'); } else { $resultlink = mklink('poll.php?id=' . $pollinfo['id'] . '&result=1', 'poll,' . $pollinfo['id'] . urlformat($pollinfo['question']) . '.html?result=1'); } //Tags if (in_array('TAG', $parse) || in_array('TAG_IDS', $parse) || in_array('KEYWORDS', $parse)) { list($tagdata, $tagids, $keywords) = poll_tags($res['id']); } //Kommentare if ($set['poll']['coms'] && $pollinfo['allowcoms'] && $apx->is_module('comments')) { require_once BASEDIR . getmodulepath('comments') . 'class.comments.php'; $coms = new comments('poll', $id); $tmpl->assign('COMMENT_LINK', $coms->link($resultlink)); $tmpl->assign('COMMENT_COUNT', $coms->count()); $tmpl->assign('DISPLAY_COMMENTS', 1); } //Link zum Poll $pollink = mklink('poll.php?id=' . $pollinfo['id'], 'poll,' . $pollinfo['id'] . urlformat($pollinfo['question']) . '.html'); //Ausgabe $tmpl->assign('LINK', $pollink); $tmpl->assign('LINK_RESULT', $resultlink); $tmpl->assign('ID', $pollinfo['id']); $tmpl->assign('QUESTION', $pollinfo['question']); $tmpl->assign('STARTTIME', $pollinfo['starttime']); $tmpl->assign('ENDTIME', $pollinfo['starttime'] + $pollinfo['days'] * 24 * 3600); //Tags $tmpl->assign('TAG_IDS', $tagids); $tmpl->assign('TAG', $tagdata); $tmpl->assign('KEYWORDS', $keywords); $tmpl->parse('functions/' . $template, 'poll'); }