session_start(); // Load the common PHP classes. require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "template.class.php"; $common = new common(); $settings = new settings(); $template = new template(); $pageData = array(); // The title of this page. $pageData['title'] = "Flights Seen"; // Add blog post data to the $pageData array. $dbh = $common->pdoOpen(); $sql = "SELECT * FROM " . $settings::db_prefix . "flights WHERE flight LIKE ? ORDER BY lastSeen DESC, flight"; $sth = $dbh->prepare($sql); $sth->bindValue(1, "%" . $_POST['flight'] . "%", PDO::PARAM_STR); $sth->execute(); $flights = $sth->fetchAll(); $sth = NULL; $dbh = NULL; //$pageData['flights'] = $flights; // Pagination. $itemsPerPage = 25; $page = isset($_GET['page']) ? $_GET['page'] : 1; $pageData['flights'] = $common->paginateArray($flights, $page, $itemsPerPage - 1); // Calculate the number of pagination links to show. $pageData['pageLinks'] = count($flights) / $itemsPerPage; $template->display($pageData); ?>
require_once '../../classes/account.class.php'; require_once '../../classes/blog.class.php'; $common = new common(); $account = new account(); $blog = new blog(); // Check if the user is logged in. if (!$account->isAuthenticated()) { // The user is not logged in so forward them to the login page. header("Location: login.php"); } // Get titles and dates for all blog posts. $allPosts = $blog->getAllPosts(); // Pagination. $itemsPerPage = 10; $page = isset($_GET['page']) ? $_GET['page'] : 1; $posts = $common->paginateArray($allPosts, $page, $itemsPerPage - 1); //////////////// // BEGIN HTML require_once '../includes/header.inc.php'; ?> <h1>Blog Management</h1> <hr /> <h2>Blog Posts</h2> <a href="/admin/blog/add.php" class="btn btn-info" style="margin-bottom: 10px;" role="button">Add Post</a> <div class="table-responsive"> <table class="table table-striped table-condensed"> <tr> <th></th> <th>Title</th> <th>Date</th>
// SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; require_once 'classes/template.class.php'; require_once 'classes/blog.class.php'; $common = new common(); $template = new template(); $blog = new blog(); $pageData = array(); // The title of this page. $pageData['title'] = "Blog"; // Get all blog posts from the XML file storing them. $allPosts = $blog->getAllPosts(); // Format the post dates according to the related setting. foreach ($allPosts as &$post) { if (strpos($post['contents'], '{more}') !== false) { $post['contents'] = substr($post['contents'], 0, strpos($post['contents'], '{more}')); } $post['author'] = $common->getAdminstratorName($post['author']); $post['date'] = date_format(date_create($post['date']), $common->getSetting('dateFormat')); } // Pagination. $itemsPerPage = 5; $page = isset($_GET['page']) ? $_GET['page'] : 1; $pageData['blogPosts'] = $common->paginateArray($allPosts, $page, $itemsPerPage - 1); // Calculate the number of pagination links to show. $pageData['pageLinks'] = count($allPosts) / $itemsPerPage; $template->display($pageData);