private function show_mail($mail) { $message = new message($mail["message"]); $mail["message"] = $message->unescaped_output(); if ($mail["to_user_id"] == $this->user->id) { $this->title = "Inbox"; } else { $this->title = "Sentbox"; $back = "/sent"; } $actions = show_boolean($mail["to_user_id"] == $this->user->id); $this->output->record($mail, "mail", array("actions" => $actions, "back" => $back)); }
public function execute() { $this->output->title = "Posting library demo"; if ($_SERVER["REQUEST_METHOD"] == "POST") { $input = $_POST["input"]; $message = new message($input); if ($message->is_spam == false) { $message->unescaped_output(); $message->translate_bbcodes(); $message->translate_smilies(); $this->output->add_tag("output", $message->content); } else { $this->output->add_message("Message seen as spam."); } $this->output->add_tag("input", $input); } }
private function show_weblog($weblog_id) { if (($weblog = $this->model->get_weblog($weblog_id)) === false) { $this->output->add_tag("result", "Weblog not found.", $this->url); return; } $this->output->title = $weblog["title"] . " - Weblog"; $weblog["timestamp"] = date("j F Y, H:i", $weblog["timestamp"]); $this->output->open_tag("weblog", array("id" => $weblog["id"])); $this->output->add_tag("title", $weblog["title"]); $this->output->add_tag("content", $weblog["content"]); $this->output->add_tag("author", $weblog["author"]); $this->output->add_tag("timestamp", $weblog["timestamp"]); /* Tags */ $this->output->open_tag("tags"); foreach ($weblog["tags"] as $tag) { $this->output->add_tag("tag", $tag["tag"], array("id" => $tag["id"])); $this->output->keywords .= ", " . $tag["tag"]; } $this->output->close_tag(); /* Comments */ $this->output->open_tag("comments"); foreach ($weblog["comments"] as $comment) { unset($comment["weblog_id"]); unset($comment["ip_address"]); $message = new message($comment["content"]); $message->unescaped_output(); $message->translate_bbcodes(); $message->translate_smilies(); $comment["content"] = $message->content; unset($message); $comment["timestamp"] = date("j F Y, H:i", $comment["timestamp"]); $this->output->record($comment, "comment"); } $this->output->close_tag(); $this->output->close_tag(); }
public function execute() { $this->output->description = "Guestbook"; $this->output->keywords = "guestbook"; $this->output->title = "Guestbook"; $skip_sign_link = false; if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($this->model->message_oke($_POST) == false) { $this->show_guestbook_form($_POST); } else { if ($this->model->save_message($_POST) == false) { $this->output->add_message("Database errors while saving message."); $this->show_guestbook_form($_POST); } else { $skip_sign_link = true; } } } if (($message_count = $this->model->count_messages()) === false) { $this->output->add_tag("result", "Database error."); return; } $paging = new pagination($this->output, "guestbook", $this->settings->guestbook_page_size, $message_count); if (($guestbook = $this->model->get_messages($paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); } else { $this->output->open_tag("guestbook", array("skip_sign_link" => show_boolean($skip_sign_link))); foreach ($guestbook as $item) { $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]); $message = new message($item["message"]); $item["message"] = $message->unescaped_output(); unset($item["ip_address"]); $this->output->record($item, "item"); } $paging->show_browse_links(7, 3); $this->output->close_tag(); } }
private function show_topic($topic_id, $response = null) { $moderate = $this->user->access_allowed("cms/forum"); if (($topic = $this->model->get_topic($topic_id)) == false) { $this->output->add_tag("result", "Topic not found.", $this->url); } else { $this->output->add_javascript("forum.js"); $this->output->title = $topic["subject"] . " - Forum"; $this->output->open_tag("topic", array("id" => $topic["id"], "forum_id" => $topic["forum_id"])); $this->output->add_tag("subject", $topic["subject"]); if ($this->user->logged_in) { $last_view = $this->model->last_topic_view($topic["id"], true); } foreach ($topic["messages"] as $message) { if ($this->user->logged_in) { $message["unread"] = show_boolean($last_view < $message["timestamp"]); } if ($message["user_id"] == "") { $message["author"] = $message["username"]; $message["usertype"] = "unregistered"; } else { $message["usertype"] = "registered"; } $message["timestamp"] = date("j F Y, H:i", $message["timestamp"]); $message["content"] = preg_replace("/\\[(config|code|quote)\\]([\r\n]*)/", "[\$1]", $message["content"]); $post = new message($message["content"]); $post->unescaped_output(); $post->translate_bbcodes(); $post->translate_smilies(); $message["content"] = $post->content; unset($post); $this->output->record($message, "message", array("moderate" => show_boolean($moderate))); } if ($response != null) { $this->output->record($response, "response"); } $this->output->close_tag(); $this->show_smilies(); } }