Exemple #1
0
function view_get()
{
    global $DB, $Core;
    if (!id(true)) {
        return to_index();
    }
    $Query = new BoardQuery();
    $View = new BoardView();
    $View->type(VIEW_THREAD);
    $View->increment_views();
    $subtitle = "";
    if (session('hidemedia')) {
        if (get('media')) {
            $subtitle .= "<a href=\"" . url() . "\">hide images</a>";
        }
        if (!get('media')) {
            $subtitle .= "<a href=\"" . url() . "&media=true\">show images</a>";
        }
    }
    if (!session('hidemedia')) {
        if (!get('media')) {
            $subtitle .= "<a href=\"" . url() . "&media=true\">hide images</a>";
        }
        if (get('media')) {
            $subtitle .= "<a href=\"" . url() . "\">show images</a>";
        }
    }
    if (session('id')) {
        if (!$Core->check_favorite(id())) {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"toggle_favorite(" . id() . ");\"><span id=\"fcmd\">add</span> favorite</a>\n";
        } else {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"toggle_favorite(" . id() . ");\"><span id=\"fcmd\">remove</span> favorite</a>\n";
        }
    }
    if (session('admin')) {
        $Admin = new BoardAdmin();
        $sticky = $Admin->check_flag("sticky", id());
        $locked = $Admin->check_flag("locked", id());
        $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"/admin/togglesticky/" . id() . "\">" . ($sticky ? "unsticky" : "sticky") . "</a>";
        $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"/admin/togglelocked/" . id() . "\">" . ($locked ? "unlock" : "lock") . "</a>";
    }
    $View->title($View->subject(id()));
    $View->subtitle($subtitle);
    $View->header();
    $DB->query($Query->view_thread(id(true), cmd(3, true), cmd(4, true)));
    $View->data($DB->load_all());
    $View->thread();
    $View->footer();
    $View->member_update();
}
Exemple #2
0
function view_get()
{
    global $DB, $Core;
    $xmldata = '';
    if (!id(true)) {
        return to_index();
    }
    $Query = new BoardQuery();
    $View = new BoardView();
    $View->type(VIEW_THREAD);
    $View->increment_views();
    $subtitle = "";
    // set flags for media link
    $flags = "";
    if (!get('media')) {
        $flags .= "&media=true";
    }
    if (get('uncollapse')) {
        $flags .= "&uncollapse=true";
    }
    if (session('hidemedia')) {
        if (get('media')) {
            $subtitle .= "<a href=\"" . url() . "{$flags}\">hide images</a>";
        }
        if (!get('media')) {
            $subtitle .= "<a href=\"" . url() . "{$flags}\">show images</a>";
        }
    }
    if (!session('hidemedia')) {
        if (!get('media')) {
            $subtitle .= "<a href=\"" . url() . "{$flags}\">hide images</a>";
        }
        if (get('media')) {
            $subtitle .= "<a href=\"" . url() . "{$flags}\">show images</a>";
        }
    }
    // set flags for collase link
    $flags = "";
    if (!get('uncollapse')) {
        $flags .= "&uncollapse=true";
    }
    if (get('media')) {
        $flags .= "&media=true";
    }
    if (!session('nocollapse')) {
        if (!get('uncollapse')) {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"" . url() . "{$flags}\">uncollapse</a>";
        }
        if (get('uncollapse')) {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"" . url() . "{$flags}\">collapse</a>";
        }
    }
    if (session('id')) {
        if (!$Core->check_favorite(id())) {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"toggle_favorite(" . id() . ");\"><span id=\"fcmd\">add</span> favorite</a>\n";
        } else {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"toggle_favorite(" . id() . ");\"><span id=\"fcmd\">remove</span> favorite</a>\n";
        }
        if (!$Core->check_ignored_thread(id())) {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"toggle_ignore_thread(" . id() . ");\"><span id=\"ignorecmd\">ignore</span></a>\n";
        } else {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"toggle_ignore_thread(" . id() . ");\"><span id=\"ignorecmd\">unignore</span></a>\n";
        }
        // undot
        if ($Core->check_dotted(id())) {
            $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"javascript:;\" onclick=\"undot(" . id() . ");\" id=\"undot\">undot</a>\n";
        }
    }
    if (session('admin')) {
        $Admin = new BoardAdmin();
        $sticky = $Admin->check_flag("thread", "sticky", id());
        $locked = $Admin->check_flag("thread", "locked", id());
        $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"/admin/togglesticky/" . id() . "/" . md5(session_id()) . "/\">" . ($sticky ? "unsticky" : "sticky") . "</a>";
        $subtitle .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"/admin/togglelocked/" . id() . "/" . md5(session_id()) . "/\">" . ($locked ? "unlock" : "lock") . "</a>";
    }
    $View->title($View->subject(id()));
    $View->subtitle($subtitle);
    $View->header();
    $DB->query($Query->view_thread(id(true), cmd(3, true), cmd(4, true)));
    $View->data($DB->load_all());
    if (get('xml')) {
        header("Content-type: text/xml");
        print "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
        print "<posts>\n";
        $View->thread_xml();
        print "</posts>";
    } else {
        if (get('uncollapse') && !session('nocollapse')) {
            $_SESSION['nocollapse'] = true;
        }
        $View->thread();
        if (get('uncollapse')) {
            unset($_SESSION['nocollapse']);
        }
    }
    $View->footer();
    $View->member_update();
}