Exemple #1
0
function view_get()
{
    global $DB, $Core;
    if (!id()) {
        return to_index();
    }
    if (!$DB->check("SELECT true FROM message_member WHERE message_id=\$1 AND member_id=\$2 AND deleted IS false", array(id(), session('id')))) {
        return to_index("/message/");
    }
    $Query = new BoardQuery();
    $View = new BoardView();
    $View->type(VIEW_MESSAGE);
    $View->member_update();
    $View->increment_views();
    $subject = $View->subject(id());
    $subject .= "<span class=\"smaller\">";
    if (session('hidemedia')) {
        if (get('media')) {
            $subject .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"" . url() . "\">hide images</a>";
        }
        if (!get('media')) {
            $subject .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"" . url() . "&media=true\">show images</a>";
        }
    }
    if (!session('hidemedia')) {
        if (!get('media')) {
            $subject .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"" . url() . "&media=true\">hide images</a>";
        }
        if (get('media')) {
            $subject .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"" . url() . "\">show images</a>";
        }
    }
    $subject .= SPACE . ARROW_RIGHT . SPACE . "<a href=\"/message/delete/" . id() . "/" . md5(session_id()) . "/\">delete</a>";
    $subject .= "</span>";
    $View->title($subject);
    $DB->query("SELECT m.name,mm.deleted FROM message_member mm LEFT JOIN member m ON m.id=mm.member_id WHERE mm.message_id=\$1", array(id()));
    $subtitle = "<strong>Participating:</strong> ";
    while ($name = $DB->load_array()) {
        if ($name['deleted'] == 't') {
            $subtitle .= "<strike>" . $Core->member_link($name['name']) . "</strike>, ";
        } else {
            $subtitle .= $Core->member_link($name['name']) . ", ";
        }
    }
    $View->subtitle(substr($subtitle, 0, -2));
    $View->header();
    $DB->query($Query->view_message(id(true), cmd(3, true), cmd(4, true)));
    $View->data($DB->load_all());
    $View->message();
    $View->footer();
}