示例#1
0
 private function show_message_overview()
 {
     if (($message_count = $this->model->count_messages()) === false) {
         $this->output->add_tag("result", "Database error.");
         return false;
     }
     $paging = new pagination($this->output, "admin_forum", $this->settings->admin_page_size, $message_count);
     if (($messages = $this->model->get_messages($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("overview");
     $this->output->open_tag("messages");
     foreach ($messages as $message) {
         $message["content"] = truncate_text($message["content"], 400);
         $message["timestamp"] = date("j F Y, H:i", $message["timestamp"]);
         if ($message["author"] == "") {
             $message["author"] = $message["username"];
         }
         $this->output->record($message, "message");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#2
0
 private function show_forum($forum_id)
 {
     if (($count = $this->model->count_topics($forum_id)) === false) {
         $this->output->add_tag("result", "Database error while counting topics.");
         return;
     }
     $paging = new pagination($this->output, "forum_" . $forum_id, $this->settings->forum_page_size, $count);
     if (($forum = $this->model->get_forum($forum_id, $paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Forum not found.", $this->url);
         return;
     }
     $this->output->title = $forum["title"] . " - Forum";
     $this->output->open_tag("forum", array("id" => $forum["id"]));
     $this->output->add_tag("title", $forum["title"]);
     $this->output->open_tag("topics");
     foreach ($forum["topics"] as $topic) {
         if ($this->user->logged_in) {
             $topic["unread"] = show_boolean($this->model->last_topic_view($topic["id"]) < $topic["timestamp"]);
         }
         $topic["starter"] = isset($topic["visitor"]) ? $topic["visitor"] : $topic["user"];
         $topic["timestamp"] = date("j F Y, H:i", $topic["timestamp"]);
         $this->output->record($topic, "topic");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#3
0
 private function show_album($album_id)
 {
     if (($album = $this->model->get_album_info($album_id)) == false) {
         $this->output->add_tag("result", "Database error retrieving album title.");
         return;
     }
     if (($count = $this->model->count_photos_in_album($album_id)) === false) {
         $this->output->add_tag("result", "Database error counting albums");
         return;
     }
     $paging = new pagination($this->output, "photo_album_" . $album_id, $this->settings->photo_album_size, $count);
     if (($photos = $this->model->get_photo_info($album_id, $paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error retrieving photos.");
         return;
     } else {
         if (count($photos) == 0) {
             $this->output->add_tag("result", "Photo album is empty.");
             return;
         }
     }
     $this->title = $album["name"];
     $this->output->open_tag("photos", array("info" => $album["description"]));
     foreach ($photos as $photo) {
         $this->output->record($photo, "photo");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
     $this->output->add_javascript("banshee/jquery.prettyphoto.js");
     $this->output->add_javascript("photo.js");
     $this->output->add_css("banshee/prettyphoto.css");
 }
示例#4
0
文件: events.php 项目: Wabuo/monitor
 public function execute()
 {
     if (isset($_SERVER["hide_ss"]) == false) {
         $_SERVER["hide_ss"] = true;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit_button"] == "hidess") {
         $_SERVER["hide_ss"] = is_true($_POST["hide_ss"]);
     }
     $this->output->add_css("banshee/filter.css");
     $filter = new filter($this->db, $this->output, $this->user);
     $filter->to_output($this->model->table, false);
     if (($count = $this->model->count_events($filter->webserver, $_SERVER["hide_ss"])) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "events", $this->settings->event_page_size, $count);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $paging->reset();
     }
     if (($events = $this->model->get_events($paging->offset, $paging->size, $filter->webserver, $_SERVER["hide_ss"])) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("events", array("hide_ss" => show_boolean($_SERVER["hide_ss"])));
     foreach ($events as $event) {
         $event["timestamp"] = date("j F Y, H:i:s", $event["timestamp"]);
         $event["event"] = $this->output->secure_string($event["event"], "_");
         $this->output->record($event, "event");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#5
0
文件: user.php 项目: shannara/banshee
 private function show_user_overview()
 {
     if (($user_count = $this->model->count_users()) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     handle_table_sort("adminuser_order", array("id", "username", "fullname", "email", "status"), array("username", "id"));
     $paging = new pagination($this->output, "admin_users", $this->settings->admin_page_size, $user_count);
     $users = $this->model->get_users($_SESSION["adminuser_order"], $paging->offset, $paging->size);
     $roles = $this->model->get_roles();
     if ($users === false || $roles === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $status = array("Disabled", "Change password", "Active");
     $this->output->open_tag("overview");
     $this->output->open_tag("users");
     foreach ($users as $user) {
         $user["status"] = $status[$user["status"]];
         $this->output->open_tag("user", array("id" => $user["id"], "admin" => show_boolean($user["is_admin"])));
         $this->output->add_tag("username", $user["username"]);
         $this->output->add_tag("fullname", $user["fullname"]);
         $this->output->add_tag("email", $user["email"]);
         $this->output->add_tag("status", $user["status"]);
         $this->output->close_tag();
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#6
0
 public function execute()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         /* Delete message
          */
         if ($this->model->delete_message($_POST["id"])) {
             $this->user->log_action("guestbook entry %d deleted", $_POST["id"]);
         }
     }
     handle_table_sort("adminguestbook_order", array("author", "message", "timestamp", "ip_address"), array("timestamp", "author"));
     $paging = new pagination($this->output, "admin_guestbook", $this->settings->admin_page_size, $message_count);
     if (($guestbook = $this->model->get_messages($_SESSION["adminguestbook_order"], $paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("guestbook");
     foreach ($guestbook as $item) {
         $item["message"] = truncate_text($item["message"], 45);
         if ($this->output->mobile) {
             $item["timestamp"] = date("Y-m-d", $item["timestamp"]);
         } else {
             $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]);
         }
         $this->output->record($item, "item");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#7
0
文件: news.php 项目: shannara/banshee
 public function execute()
 {
     $this->output->description = "News";
     $this->output->keywords = "news";
     $this->output->title = "News";
     $this->output->add_alternate("News", "application/rss+xml", "/news.xml");
     if ($this->page->type == "xml") {
         /* RSS feed
          */
         $rss = new RSS($this->output);
         if ($rss->fetch_from_cache("news_rss") == false) {
             $rss->title = $this->settings->head_title . " news";
             $rss->description = $this->settings->head_description;
             if (($news = $this->model->get_news(0, $this->settings->news_rss_page_size)) != false) {
                 foreach ($news as $item) {
                     $link = "/news/" . $item["id"];
                     $rss->add_item($item["title"], $item["content"], $link, $item["timestamp"]);
                 }
             }
             $rss->to_output();
         }
     } else {
         if (valid_input($this->page->pathinfo[1], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) {
             /* News item
              */
             if (($item = $this->model->get_news_item($this->page->pathinfo[1])) == false) {
                 $this->output->add_tag("result", "Unknown news item");
             } else {
                 $this->output->title = $item["title"] . " - News";
                 $item["timestamp"] = date("j F Y, H:i", strtotime($item["timestamp"]));
                 $this->output->record($item, "news");
             }
         } else {
             /* News overview
              */
             if (($count = $this->model->count_news()) === false) {
                 $this->output->add_tag("result", "Database error");
                 return;
             }
             $paging = new pagination($this->output, "news", $this->settings->news_page_size, $count);
             if (($news = $this->model->get_news($paging->offset, $paging->size)) === false) {
                 $this->output->add_tag("result", "Database error");
                 return;
             }
             foreach ($news as $item) {
                 $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]);
                 $this->output->record($item, "news");
             }
             $paging->show_browse_links(7, 3);
         }
     }
 }
示例#8
0
 public function execute()
 {
     $this->output->title = "Pagination demo";
     $list = array();
     for ($i = 0; $i < 200; $i++) {
         array_push($list, "List item " . ($i + 1));
     }
     $paging = new pagination($this->output, "demo", 15, count($list));
     $items = array_slice($list, $paging->offset, $paging->size);
     $this->output->open_tag("items");
     foreach ($items as $item) {
         $this->output->add_tag("item", $item);
     }
     $this->output->close_tag();
     $paging->show_browse_links();
 }
示例#9
0
 private function show_dictionary_overview()
 {
     if (($word_count = $this->model->count_words()) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "admin_dictionary", $this->settings->admin_page_size, $word_count);
     if (($words = $this->model->get_words($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("overview");
     $this->output->open_tag("words");
     foreach ($words as $word) {
         $this->output->record($word, "word");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#10
0
 private function show_overview()
 {
     if (($XXX_count = $this->model->count_XXXs()) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "XXXs", $this->settings->admin_page_size, $XXX_count);
     if (($XXXs = $this->model->get_XXXs($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("overview");
     $this->output->open_tag("XXXs");
     foreach ($XXXs as $XXX) {
         $this->output->record($XXX, "XXX");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#11
0
 public function execute()
 {
     if (valid_input($this->page->pathinfo[2], VALIDATE_NUMBERS, VALIDATE_NONEMPTY) == false) {
         $offset = 0;
     } else {
         $offset = $this->page->pathinfo[2];
     }
     if (isset($_SESSION["admin_actionlog_size"]) == false) {
         $_SESSION["admin_actionlog_size"] = $this->model->get_log_size();
     }
     $paging = new pagination($this->output, "admin_actionlog", $this->settings->admin_page_size, $_SESSION["admin_actionlog_size"]);
     if (($log = $this->model->get_action_log($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Error reading action log.");
         return;
     }
     $users = array($this->user->id => $this->user->username);
     $this->output->open_tag("log");
     $this->output->open_tag("list");
     foreach ($log as $entry) {
         $user_id = $entry["user_id"];
         list($user_id, $switch_id) = explode(":", $user_id);
         if (isset($users[$user_id]) == false) {
             if (($user = $this->model->get_user($user_id)) !== false) {
                 $users[$user_id] = $user["username"];
             }
         }
         if (isset($users[$switch_id]) == false) {
             if (($switch = $this->model->get_user($switch_id)) !== false) {
                 $users[$switch_id] = $switch["username"];
             }
         }
         $entry["username"] = isset($users[$user_id]) ? $users[$user_id] : "-";
         $entry["switch"] = isset($users[$switch_id]) ? $users[$switch_id] : "-";
         $this->output->record($entry, "entry");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#12
0
 private function show_overview()
 {
     if (($webserver_count = $this->model->count_webservers()) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "webservers", $this->settings->admin_page_size, $webserver_count);
     if (($webservers = $this->model->get_webservers($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("overview");
     $this->output->open_tag("webservers");
     foreach ($webservers as $webserver) {
         $webserver["tls"] = show_boolean($webserver["tls"]);
         $webserver["active"] = show_boolean($webserver["active"]);
         $this->output->record($webserver, "webserver");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
示例#13
0
 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();
     }
 }
示例#14
0
 private function show_weblog_overview()
 {
     if (($weblog_count = $this->model->count_weblogs()) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "admin_forum", $this->settings->admin_page_size, $weblog_count);
     if (($weblogs = $this->model->get_weblogs($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("overview");
     $this->output->open_tag("weblogs");
     foreach ($weblogs as $weblog) {
         $weblog["visible"] = show_boolean($weblog["visible"]);
         $weblog["timestamp"] = date("j F Y, H:i", $weblog["timestamp"]);
         $this->output->record($weblog, "weblog");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->add_tag("comments", show_boolean($this->user->access_allowed("cms/weblog/comment")));
     $this->output->close_tag();
 }
 protected function show_overview()
 {
     switch ($this->browsing) {
         case "alphabetize":
             $alphabet = new alphabetize($this->output, "tableadmin_" . $this->model->table);
             if ($_POST["submit_button"] == "Search") {
                 $alphabet->reset();
             }
             if (($items = $this->model->get_items($alphabet->char)) === false) {
                 $this->output->add_tag("result", "Error while creating overview.");
                 return;
             }
             break;
         case "pagination":
             if (($item_count = $this->model->count_items()) === false) {
                 $this->output->add_tag("result", "Error while counting items.");
                 return;
             }
             $paging = new pagination($this->output, "tableadmin_" . $this->model->table, $this->page_size, $item_count);
             if ($_POST["submit_button"] == "Search") {
                 $paging->reset();
             }
             if (($items = $this->model->get_items($paging->offset, $paging->size)) === false) {
                 $this->output->add_tag("result", "Error while creating overview.");
                 return;
             }
             break;
         case "datatables":
             $this->output->add_javascript("jquery/jquery.js");
             $this->output->add_javascript("banshee/jquery.datatables.js");
             $this->output->run_javascript("\$(document).ready(function(){ \$('table.datatable').dataTable(); });");
             $this->output->add_css("banshee/datatables.css");
             $this->_table_class = "datatable";
             $this->enable_search = false;
         default:
             if (($items = $this->model->get_items()) === false) {
                 $this->output->add_tag("result", "Error while creating overview.");
                 return;
             }
     }
     if ($this->table_class != null) {
         $this->_table_class .= " " . $this->table_class;
     }
     $params = array("class" => $this->_table_class, "allow_create" => show_boolean($this->model->allow_create));
     $this->output->open_tag("overview", $params);
     /* Labels
      */
     $this->output->open_tag("labels", array("name" => strtolower($this->name)));
     foreach ($this->model->elements as $name => $element) {
         $args = array("name" => $name, "overview" => show_boolean($element["overview"]));
         if ($element["overview"]) {
             $this->output->add_tag("label", $element["label"], $args);
         }
     }
     $this->output->close_tag();
     /* Values
      */
     $this->output->open_tag("items");
     foreach ($items as $item) {
         $this->output->open_tag("item", array("id" => $item["id"]));
         foreach ($item as $name => $value) {
             $element = $this->model->elements[$name];
             if ($element["overview"]) {
                 switch ($element["type"]) {
                     case "boolean":
                         $value = show_boolean($value);
                         break;
                     case "date":
                         $value = date("j F Y", strtotime($value));
                         break;
                     case "timestamp":
                         $value = date("j F Y H:i", strtotime($value));
                         break;
                     case "foreignkey":
                         if ($value === null) {
                             $value = $this->foreign_null;
                         } else {
                             if (($result = $this->db->entry($element["table"], $value)) != false) {
                                 if (is_array($element["column"]) == false) {
                                     $value = $result[$element["column"]];
                                 } else {
                                     $values = array();
                                     foreach ($element["column"] as $column) {
                                         array_push($values, $result[$column]);
                                     }
                                     $value = implode(" ", $values);
                                 }
                             }
                         }
                         break;
                 }
                 $this->output->add_tag("value", $value, array("name" => $name));
             }
         }
         $this->output->close_tag();
     }
     $this->output->close_tag();
     switch ($this->browsing) {
         case "alphabetize":
             $alphabet->show_browse_links();
             break;
         case "pagination":
             $paging->show_browse_links($this->pagination_links, $this->pagination_step);
             break;
     }
     if ($this->enable_search) {
         $this->output->add_tag("search", $_SESSION["tablemanager_search_" . $this->model->table]);
     }
     $this->output->close_tag();
 }