R?SubjectFromDateAction "; foreach ($pms as $pm) { $h_subject = html_escape($pm->subject); if (strlen(trim($h_subject)) == 0) { $h_subject = "(No subject)"; } if (!array_key_exists($pm->from_id, $user_cache)) { $from = User::by_id($pm->from_id); $user_cache[$pm->from_id] = $from; } else { $from = $user_cache[$pm->from_id]; } $from_name = $from->name; $h_from = html_escape($from_name); $from_url = make_link("user/".url_escape($from_name)); $pm_url = make_link("pm/read/".$pm->id); $del_url = make_link("pm/delete"); $h_date = substr(html_escape($pm->sent_date), 0, 16); $readYN = "Y"; if (!$pm->is_read) { $h_subject = "$h_subject"; $readYN = "N"; } $hb = $from->can(Permissions::HELLBANNED) ? "hb" : ""; $html .= " $readYN $h_subject $h_from $h_date ".make_form($del_url)." "; } $html .= " "; $page->add_block(new Block("Private Messages", $html, "main", 40, "private-messages")); } public function display_composer(Page $page, User $from, User $to, string $subject = ""): void { global $user; $post_url = make_link("pm/send"); $h_subject = html_escape($subject); $to_id = $to->id; $form = make_form($post_url); $html = <<
Subject:
EOD; $page->add_block(new Block("Write a PM", $html, "main", 50)); } public function display_message(Page $page, User $from, User $to, PM $pm): void { $page->set_title("Private Message"); $page->set_heading(html_escape($pm->subject)); $page->add_block(new NavBlock()); $page->add_block(new Block("Message from {$from->name}", format_text($pm->message), "main", 10)); } }