Esempio n. 1
0
function forum_activity($type, $id)
{
    global $apx, $db, $set, $user;
    $db->query("\n\t\tDELETE FROM " . PRE . "_forum_activity\n\t\tWHERE userid='" . $user->info['userid'] . "' AND type='" . addslashes($type) . "' AND id='" . intval($id) . "'\n\t");
    $db->query("\n\t\tINSERT IGNORE INTO " . PRE . "_forum_activity\n\t\tVALUES ('" . $user->info['userid'] . "', '" . ip2integer(get_remoteaddr()) . "', '" . addslashes($type) . "', '" . intval($id) . "', '" . time() . "', '" . $user->info['pub_invisible'] . "')\n\t");
}
Esempio n. 2
0
    } else {
        $db->query("INSERT INTO " . PRE . "_stats_userenv VALUES ('" . $daystamp . "','country','" . addslashes($country) . "',1)");
    }
    //Besucher zählen
    if ($browser != 'SEARCHENGINE' || $set['stats']['countsearchengine']) {
        list($stats_exists) = $db->first("SELECT daystamp FROM " . PRE . "_stats WHERE daystamp='" . $daystamp . "' LIMIT 1");
        if ($stats_exists) {
            $db->query("UPDATE " . PRE . "_stats SET uniques=uniques+1,uniques_" . $hourstamp . "h=uniques_" . $hourstamp . "h+1,hits=hits+1 WHERE daystamp='" . $daystamp . "' LIMIT 1");
        } else {
            $db->quieterror = true;
            $db->query("INSERT INTO " . PRE . "_stats (daystamp,weekstamp,weekday,time,uniques,uniques_" . $hourstamp . "h,hits) VALUES ('" . $daystamp . "','" . $weekstamp . "','" . $weekday . "','" . time() . "',1,1,1)");
            $db->quieterror = false;
        }
    }
    //IP-Sperre und Cookie setzen
    $db->query("INSERT INTO " . PRE . "_stats_iplog VALUES ('" . ip2integer(get_remoteaddr()) . "','" . time() . "')");
    if ($set['stats']['cookie']) {
        setcookie($set['main']['cookie_pre'] . '_stats_count', 1, time() + $set['stats']['blockip'] * 3600, '/');
    }
} elseif (!(strpos($_SERVER['PHP_SELF'], 'misc.php') !== false && $_REQUEST['action'] == 'counter') && $_SERVER['REQUEST_URI']) {
    require_once BASEDIR . getmodulepath('stats') . 'functions.php';
    $weekstamp = stats_weekstamp($statsnow);
    //User-Info
    $browser = stats_browser($_SERVER['HTTP_USER_AGENT']);
    if ($browser != 'SEARCHENGINE' || $set['stats']['countsearchengine']) {
        if (!isset($stats_exists)) {
            list($stats_exists) = $db->first("SELECT daystamp FROM " . PRE . "_stats WHERE daystamp='" . $daystamp . "' LIMIT 1");
        }
        if ($stats_exists) {
            $db->query("UPDATE " . PRE . "_stats SET hits=hits+1 WHERE daystamp='" . $daystamp . "' LIMIT 1");
        } else {
Esempio n. 3
0
        $cset = array();
        foreach ($_POST['vote'] as $aid => $true) {
            $aid = (int) $aid;
            if (!$aid || $aid < 1 || $aid > 20 || $true != '1') {
                continue;
            }
            $cset[] = 'a' . $aid . '_c=a' . $aid . '_c+1';
        }
        if (count($cset)) {
            $db->query("UPDATE " . PRE . "_poll SET " . implode(',', $cset) . " WHERE ( id='" . $_REQUEST['id'] . "' AND ( '" . time() . "' BETWEEN starttime AND endtime ) ) LIMIT 1");
        }
    } else {
        $db->query("UPDATE " . PRE . "_poll SET a" . $_POST['vote'] . "_c=a" . $_POST['vote'] . "_c+1 WHERE ( id='" . $_REQUEST['id'] . "' AND ( '" . time() . "' BETWEEN starttime AND endtime ) ) LIMIT 1");
    }
    //Block User
    $db->query("INSERT INTO " . PRE . "_poll_iplog VALUES ('" . $_REQUEST['id'] . "','" . $user->info['userid'] . "','" . ip2integer(get_remoteaddr()) . "','" . time() . "')");
    @setcookie($set['main']['cookie_pre'] . '_voted[' . $_REQUEST['id'] . ']', '1', time() + 100 * 24 * 3600, '/');
    message($apx->lang->get('MSG_VOTE'), mklink('poll.php?id=' . $_REQUEST['id'], 'poll,' . $_REQUEST['id'] . '.html'));
    require 'lib/_end.php';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////// IMMER AUFRUFEN
//Headline + Titlebar
if ($pollinfo['id'] == $recent) {
    headline($apx->lang->get('HEADLINE_RECENT'), str_replace('&', '&amp;', $_SERVER['REQUEST_URI']));
    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']) {
Esempio n. 4
0
 function update_onlinelist()
 {
     global $db, $set;
     $db->query("DELETE FROM " . PRE . "_user_online WHERE ( time<'" . (time() - $set['user']['timeout'] * 60) . "' OR ip='" . ip2integer(get_remoteaddr()) . "' " . iif($this->info['userid'], " OR userid='" . $this->info['userid'] . "' ") . ")");
     $db->query("INSERT IGNORE INTO " . PRE . "_user_online VALUES ('" . $this->info['userid'] . "','" . ip2integer(get_remoteaddr()) . "','" . time() . "','" . $this->info['pub_invisible'] . "','" . addslashes($_SERVER['REQUEST_URI']) . "')");
 }
Esempio n. 5
0
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&amp;result=1', 'poll,recent.html?result=1');
    } else {
        $resultlink = mklink('poll.php?id=' . $pollinfo['id'] . '&amp;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');
}