<?php session_start(); include '../db/db.php'; $db = new Database(); include 'scripts/authentication.php'; checkAdmin(); $articles = $db->dq('SELECT id, title, timestamp, url, status FROM blog ORDER BY timestamp DESC'); $cquery = 'SELECT comments.id AS id, comment, title, name FROM comments INNER JOIN blog ON postid=blog.id WHERE comments.status="submitted" ORDER BY comments.timestamp DESC'; $comments = $db->dq($cquery); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Admin Dashboard</title> <link rel="stylesheet" href="styles/lists.css"> </head> <body> <div id="content"> <header> <a href="post.php"> New + </a> <a href="http://www.pixarportal.com" target="_blank"> Pixar Portal </a> <a href="http://toolbox.omnis.com/phpmyadmin/" target="_blank"> Database </a> </header> <div id="lcol"> <?php foreach ($articles as $a) {
<?php require_once 'db/db.php'; $db = new Database(); // ! CYCLE THROUGH ENTRIES, CHANGE IMDB VALS /* $res = $db->dq('SELECT id, imdb FROM movies'); foreach($res as $r){ preg_match('/tt[0-9]+/', $r['imdb'], $matches); $db->dc('UPDATE movies SET imdb = "'.$matches[0].'" WHERE id = '.$r['id']); echo $matches[0].'<br>'; } */ $res = $db->dq('SELECT * FROM movies'); foreach ($res as $r) { switch ($_GET['action']) { case 'imdb': $mov = json_decode(file_get_contents('http://www.omdbapi.com/?i=' . $r['imdb'])); $query = 'UPDATE movies SET genres = "' . $mov->Genre . '", directors = "' . $mov->Director . '", writers = "' . $mov->Writer . '", actors = "' . $mov->Actors . '", poster = "' . $mov->Poster . '", length = "' . (int) $mov->Runtime . '", mpaa = "' . $mov->Rated . '" WHERE id = ' . $r['id']; //$query = 'UPDATE movies SET mpaa = "'. $mov->Rated .'" WHERE id = '.$r['id']; $query = 'UPDATE movies SET category = "movie" WHERE category = "feature"'; if ($db->dc($query)) {
include 'nodes/header.php'; ?> <div id="frame" class="frame"> <section class="content"> <article> <?php // •••••••••• SEARCH RESULTS $postsperpage = 20; $pg = !isset($_GET['pg']) ? 1 : $_GET['pg']; $first = ($pg - 1) * $postsperpage; //Which post to start with on the page $query = 'SELECT * FROM blog WHERE ' . $search . ' ORDER BY timestamp DESC LIMIT ' . $first . ', ' . $postsperpage; $posts = $db->dq($query); echo '<h1>Search results for: ' . $_GET['search'] . '</h1>'; if (sizeof($posts) < 1) { echo '<p>No matches.</p>'; } else { foreach ($posts as $post) { echo '<div class="search_result"> <h2><a href="/blog/' . $post['url'] . '">' . stripslashes($post['title']) . '</a></h2> <time dateTime="' . date("Y-m-d", $post['timestamp']) . '">' . date("j F Y", $post['timestamp']) . '</time> <p>' . summarize($post['article'], $post['color']) . '…</p> </div>'; } } ?>
<?php session_start(); date_default_timezone_set('America/Denver'); include 'scripts/authentication.php'; checkAdmin(); include '../db/db.php'; $db = new Database(); $res = $db->dq('SELECT id, title FROM films'); $action = 'insert'; $comments = array(); if (isset($_GET['id'])) { $article = $db->dq1('SELECT * FROM blog WHERE id=' . $_GET['id']); $action = 'update'; $cquery = 'SELECT id, comment, name, timestamp FROM comments WHERE postid=' . $article['id'] . ' ORDER BY timestamp DESC'; $comments = $db->dq($cquery); } function a($idx, $default = null) { global $article; return isset($article[$idx]) ? $article[$idx] : $default; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Blog Post | Pixar Portal</title> <link rel="stylesheet" href="styles/blogpost.css"> </head>
<?php include '../../db/db.php'; $db = new Database(); $rows = $db->dq('SELECT * FROM blog WHERE status="published" ORDER BY timestamp DESC LIMIT 30'); $filecontent = '<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>Pixar Portal</title> <link>http://www.pixarportal.com</link> <description>News, rumors, community and information about your favorite animated movies from Pixar Animation Studios.</description> <language>en-us</language> <ttl>30</ttl> '; foreach ($rows as $row) { $filecontent .= ' <item> <title>' . stripslashes($row['title']) . '</title> <link>http://www.pixarportal.com/blog.php?id=' . $row['url'] . '</link> <description>' . $db->websafe($row['article']) . '</description> <pubDate>' . date('D, d M Y H:i:s O', $row['timestamp']) . '</pubDate> </item> '; } $filecontent .= ' </channel> </rss> '; $rssFile = fopen("../../feed.rss", "w"); $success = fwrite($rssFile, $filecontent); if (!$success) {
<h3>Other Links</h3> <?php if (!empty($mov['trailer'])) { echo '<p><a href="' . $mov['trailer'] . '">Watch the Trailer</a></p>'; } if (!empty($mov['imdb'])) { echo '<p><a href="' . $mov['imdb'] . '">' . $mov['title'] . ' IMDb Page</a></p>'; } ?> </div> </div> <h2>Articles</h2> <table class="movie_articles"> <?php $articles = $db->dq('SELECT * FROM blog WHERE film=' . $mov['id'] . ' AND status="published" ORDER BY timestamp DESC'); foreach ($articles as $article) { echo '<tr><td>' . '<time datetime="' . date("Y-m-d", $article['timestamp']) . '">' . date("d M Y", $article['timestamp']) . '</time></td>' . '<td><a href="/blog/' . $article['url'] . '">' . $article['title'] . '</a></td></tr>'; } ?> </table> </article> </section> <?php include 'nodes/sidebar.php'; ?> </div>