Example #1
0
<?php

require_once "thread.inc";
require_once "pagenav.inc.php";
require_once "page-yatt.inc.php";
if (!$user->valid()) {
    header("Location: /login.phtml?url={$url}");
}
$hdr = new Template($template_dir, "comment");
$hdr->set_file(array("forum_header" => array("forum/" . $forum['shortname'] . ".tpl", "forum/generic.tpl")));
$hdr->set_var("FORUM_NAME", $forum['name']);
$hdr->set_var("FORUM_SHORTNAME", $forum['shortname']);
$yatt = new YATT($template_dir, 'showtracking.yatt');
$yatt->set("forum_header", $hdr->parse("FORUM_HEADER", "forum_header"));
$yatt->set("user_token", $user->token());
$yatt->set("page", $tpl->get_var("PAGE"));
$yatt->set("forum", $forum);
$yatt->set("time", time());
if (!isset($curpage)) {
    $curpage = 1;
}
$tpp = $user->threadsperpage;
if ($tpp <= 0) {
    $tpp = 20;
}
$out = process_tthreads();
$numpages = ceil($out['numshown'] / $tpp);
if ($numpages && $curpage > $numpages) {
    err_not_found("Page out of range");
    exit;
}
Example #2
0
<?php

require_once "page-yatt.inc.php";
$dir = new YATT();
$dir->load("{$template_dir}/directory.yatt");
$sth = db_query("select fid,name,shortname from f_forums where options like '%Searchable%' order by name");
for ($i = 0; $row = $sth->fetch(); $i++) {
    $dir->set("r", $i & 1);
    $fid = $row['fid'];
    /* should only count active and off-topic, but its too slow */
    try {
        $row2 = db_query_first("select count(*) from f_messages{$fid}");
        $count = $row2 ? $row2[0] : NULL;
    } catch (PDOException $e) {
        $count = NULL;
    }
    $dir->set("count", $count);
    $dir->set("row", $row);
    $dir->parse("dir.row");
}
$sth->closeCursor();
$dir->parse("dir");
print generate_page('Directory', $dir->output());
Example #3
0
function generate_page($title, $contents, $skip_header = false, $meta_robots = false)
{
    global $template_dir, $domain;
    $page = new YATT($template_dir, 'page.yatt');
    $page->set('domain', $domain);
    $page->set('css_href', css_href());
    $page->set('js_href', js_href());
    $page->set('js_jquery_href', js_href($filename = "jquery-1.11.1.min.js", $cache_buster = false));
    $bch = browser_css_href();
    if ($bch) {
        $page->set('browser_css_href', $bch);
        $page->parse('page.bch');
    }
    $page->set('browser_css_href', browser_css_href());
    if ($meta_robots) {
        $page->set('robots', $meta_robots);
        $page->parse('page.meta_robots');
    }
    $page->set('title', $title);
    $page->set('contents', $contents);
    if (!$skip_header) {
        $page->parse('page.header');
    }
    $page->parse('page');
    return trim($page->output());
}
Example #4
0
<?php

require_once "lib/YATT/YATT.class.php";
require_once "message.inc";
if (isset($forum['option']['LoginToRead']) and $forum['option']['LoginToRead']) {
    $user->req();
    if ($user->status != 'Active') {
        echo "Your account isn't validated\n";
        exit;
    }
}
$raw = isset($_REQUEST['raw']);
$msg = fetch_message($user, $mid, 'message,url,urltext,video,tid');
if ($raw) {
    header("Content-type: text/plain");
    echo $msg['message'];
    exit;
}
mark_thread_read($forum['fid'], $msg, $user);
$m = postprocess($msg);
$tpl = new YATT($template_dir, "plain-message.yatt");
$tpl->set("message", $m);
$tpl->parse("page");
print $tpl->output();
Example #5
0
<?php

require_once 'YATT.class.php';
$n = new YATT();
$n->load("example.yatt");
# set a variable
$n->set('CRACK', 'eat me');
# or like this
$n->set(array("FOO" => "something else", "BAR" => "barorific!"));
# Variable substitution is recursive, see how this works in the template
$n->set('FNORK', 'baz');
$n->set('CORK_baz', 'shout off and die');
# Parse a single block of text
$n->parse('faz.test');
# Maybe build a table
foreach (array("ONE", "TWO", "THREE") as $value) {
    $n->set('ROW_NAME', $value);
    $n->parse('faz.table.row');
}
$n->parse('faz.table');
# Comment this out and look at the output.
# Notice that everything *but* what is in faz is displayed.
# Only nodes that you parse() actually display things.
$n->parse('faz');
# print the output for everything.
# You could also tell it where to start, like output('faz.table')
# to only print out stuff from table.
print "--------------------------------------------------------------\n";
print "Output of the template:\n";
print "--------------------------------------------------------------\n";
print $n->output();