Esempio n. 1
0
File: main.php Progetto: kawf/kawf
function find_forum($shortname)
{
    global $user, $forum, $indexes, $tthreads, $tthreads_by_tid, $down_for_maint;
    $sql = "select * from f_forums where shortname = ?";
    $forum = db_query_first($sql, array($shortname));
    if (!$forum) {
        return 0;
    }
    /* Short circuit it here */
    if ($down_for_maint || isset($forum['version']) && $forum['version'] == 1) {
        echo "This forum is currently undergoing maintenance, please try back in a couple of minutes\n";
        exit;
    }
    $indexes = build_indexes($forum['fid']);
    list($tthreads, $tthreads_by_tid) = build_tthreads($forum['fid']);
    $options = explode(",", $forum['options']);
    foreach ($options as $value) {
        $forum['option'][$value] = true;
    }
    return 1;
}
Esempio n. 2
0
$_page = $tpl->get_var("PAGE");
unset($tpl->varkeys["PAGE"]);
unset($tpl->varvals["PAGE"]);
$tpl->set_var("PAGE", $_page);
$time = time();
$tpl->set_var("TIME", $time);
$sql = "select * from f_forums order by fid";
$sth = db_query($sql);
$numshown = 0;
$first = true;
while ($forum = $sth->fetch(PDO::FETCH_ASSOC)) {
    $tpl->set_var("FORUM_NAME", $forum['name']);
    $tpl->set_var("FORUM_SHORTNAME", $forum['shortname']);
    /* rebuild caches per forum */
    $indexes = build_indexes($forum['fid']);
    list($tthreads, $tthreads_by_tid) = build_tthreads($forum['fid']);
    $forumcount = $forumupdated = 0;
    $tpl->set_var("_row", "");
    $tpl->set_var("_hr", "");
    if (count($tthreads_by_tid)) {
        foreach ($tthreads_by_tid as $tthread) {
            $iid = tid_to_iid($tthread['tid']);
            /* tstamp is LOCALTIME of SQL server, 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 (!$thread) {
                continue;
            }
            $messagestr = gen_thread($thread, true);
            if (!isset($messagestr)) {
                continue;
            }