Esempio n. 1
0
File: track.php Progetto: kawf/kawf
<?php

require_once 'thread.inc';
if (!isset($forum)) {
    echo "Invalid forum\n";
    exit;
}
$page = $_REQUEST['page'];
$tid = $_REQUEST['tid'];
$time = $_REQUEST['time'];
if (!$user->valid() || !is_numeric($tid)) {
    header("Location: {$page}");
    exit;
}
$iid = tid_to_iid($tid);
if (!isset($iid)) {
    echo "Invalid thread!\n";
    exit;
}
if (!$user->is_valid_token($_REQUEST['token'])) {
    err_not_found("Invalid token");
}
if (!is_numeric($time)) {
    err_not_found("Invalid timestamp");
}
track_thread($forum['fid'], $tid, '', $time);
Header("Location: {$page}");
// vim: sw=2
Esempio n. 2
0
    err_not_found("invalid token");
}
if (isset($_REQUEST['time']) && is_numeric($_REQUEST['time'])) {
    $time = $_REQUEST['time'];
} else {
    $time = time();
}
/* Unix time (seconds since epoch) */
/* Convert it to MySQL format */
/* TZ: strftime is local time of SQL server -> used for tstamp */
$time = strftime("%Y%m%d%H%M%S", $time);
if ($tid == "all") {
    require_once "thread.inc";
    /* for is_thread_bumped() */
    foreach ($tthreads as $tthread) {
        $iid = tid_to_iid($tthread['tid']);
        if (!isset($iid)) {
            continue;
        }
        /* TZ: unixtime is seconds since epoch */
        $thread = db_query_first("select *, UNIX_TIMESTAMP(tstamp) as unixtime from f_threads{$iid} where tid = ?", array($tthread['tid']));
        if (is_thread_bumped($thread)) {
            /* TZ: tstamp is sql local time */
            db_exec("update f_tracking set tstamp = ? where fid = ? and tid = ? and aid = ?", array($time, $forum['fid'], $thread['tid'], $user->aid));
        }
    }
} else {
    if (is_numeric($tid)) {
        /* TZ: tstamp is SQL server local time, NOT PHP server local time */
        db_exec("update f_tracking set tstamp = ? where fid = ? and tid = ? and aid = ?", array($time, $forum['fid'], $tid, $user->aid));
    }