Esempio n. 1
0
    } else {
        $apx->tmpl->assign('LINK_RESULT', mklink('poll.php?id=' . $_REQUEST['id'] . '&result=1', 'poll,' . $_REQUEST['id'] . urlformat($pollinfo['question']) . '.html?result=1'));
    }
}
//Kommentare
if ($apx->is_module('comments') && $set['poll']['coms'] && $pollinfo['allowcoms']) {
    require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
    $coms = new comments('poll', $pollinfo['id']);
    $coms->assign_comments();
    if ($_REQUEST['id'] != $recent && !$set['poll']['archcoms']) {
        $apx->tmpl->assign('COMMENT_NOFORM', 1);
    }
}
//Tags
if (in_array('TAG', $parse) || in_array('TAG_IDS', $parse) || in_array('KEYWORDS', $parse)) {
    list($tagdata, $tagids) = poll_tags($res['id']);
}
//AUSGABE
$apx->tmpl->assign('ID', $pollinfo['id']);
$apx->tmpl->assign('QUESTION', $pollinfo['question']);
$apx->tmpl->assign_static('META_DESCRIPTION', replace($pollinfo['meta_description']));
$apx->tmpl->assign('STARTTIME', $pollinfo['starttime']);
$apx->tmpl->assign('ENDTIME', $pollinfo['starttime'] + $pollinfo['days'] * 24 * 3600);
//Tags
$apx->tmpl->assign('TAG_IDS', $tagids);
$apx->tmpl->assign('TAG', $tagdata);
$apx->tmpl->assign('KEYWORDS', $keywords);
$apx->tmpl->parse('poll');
////////////////////////////////////////////////////////////////////////////////////////////////////////
require 'lib/_end.php';
/////////////////////////////////////////////////////////// SCRIPT BEENDEN ///
Esempio n. 2
0
function poll_similar($tagids = array(), $count = 5, $start = 0, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    $tmpl = new tengine();
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars('functions/' . $template, 'poll');
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = poll_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND id IN (" . implode(', ', $ids) . ") ";
    $data = $db->fetch("SELECT id,question,addtime,starttime,days,allowcoms FROM " . PRE . "_poll WHERE ( '" . time() . "' BETWEEN starttime AND endtime " . $tagfilter . " " . section_filter() . " ) ORDER BY starttime DESC LIMIT " . $count);
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Tags
            if (in_array('POLL.TAG', $parse) || in_array('POLL.TAG_IDS', $parse) || in_array('POLL.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = poll_tags($res['id']);
            }
            $tabledata[$i]['QUESTION'] = $res['question'];
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['STARTTIME'] = $res['starttime'];
            $tabledata[$i]['ENDTIME'] = $res['starttime'] + $res['days'] * 24 * 3600;
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            $tabledata[$i]['LINK'] = mklink('poll.php?id=' . $res['id'], 'poll,' . $res['id'] . urlformat($res['question']) . '.html');
            //Kommentare
            if ($apx->is_module('comments') && $set['poll']['coms'] && $res['allowcoms']) {
                require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
                if (!isset($coms)) {
                    $coms = new comments('poll', $res['id']);
                } else {
                    $coms->mid = $res['id'];
                }
                $link = mklink('poll.php?id=' . $res['id'], 'poll,' . $res['id'] . urlformat($res['question']) . '.html');
                $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
                $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
                $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
                if (in_template(array('POLL.COMMENT_LAST_USERID', 'POLL.COMMENT_LAST_NAME', 'POLL.COMMENT_LAST_TIME'), $parse)) {
                    $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
                    $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
                    $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
                }
            }
        }
    }
    $tmpl->assign('POLL', $tabledata);
    $tmpl->parse('functions/' . $template, 'poll');
}