Fixed missing break; causing overflow
[dylansserver.git] / index.php
index 8245ec2..bf2249b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -13,10 +13,10 @@ abstract class cms {
   public function __construct() {
     $config = parse_ini_file($this->config_file, true);
     $this->db = new mysqli(
-      $config[database]['domain'],
-      $config[database]['user'],
-      $config[database]['password'],
-      $config[database]['database']);
+      $config['database']['domain'],
+      $config['database']['user'],
+      $config['database']['password'],
+      $config['database']['database']);
     if (mysqli_connect_errno()) {
       echo "Problem connecting to database: ";
       echo mysqli_connect_error();
@@ -163,7 +163,7 @@ class index extends cms {
         </li>
 
         <li><a href=
-        "git">git://dylansserver.com</a></li>
+        "/git/">git://dylansserver.com</a></li>
 
         <li>
           <h3>some notes:</h3>
@@ -172,6 +172,13 @@ class index extends cms {
         <li><a href=
         "/notes/">here</a> [<a href="/notes/rss">rss</a>]</li>
 
+        <li>
+          <h3>my resume:</h3>
+        </li>
+
+        <li>[<a href=
+        "/resume">pdf</a>]</li>
+
         <li>
         </li>
 OTHER_PROJECTS;
@@ -187,7 +194,7 @@ OTHER_PROJECTS;
 
   protected function display_exhibits() {
     echo "<div id='exhibit'>";
-    $sql = "SELECT text FROM projects";
+    $sql = "SELECT text FROM projects ORDER BY rank";
     $result = $this->db->query($sql);
     while ($entry = $result->fetch_object()) {
       echo $entry->text;
@@ -201,7 +208,7 @@ OTHER_PROJECTS;
           <h3>my projects:</h3>
         </li>
 HEREDOC;
-    $sql = "SELECT title FROM projects";
+    $sql = "SELECT title FROM projects ORDER BY rank";
     $result = $this->db->query($sql);
     while ($entry = $result->fetch_object()) {
       echo "<li><a class='tab' href='$entry->title'>$entry->title</a></li>";
@@ -243,8 +250,8 @@ class page extends cms {
     $this->scripts = "
         <script type='text/javascript' src='/includes/syntax/scripts/shCore.js'></script>
         <script type='text/javascript' src='/includes/syntax/scripts/shAutoloader.js'></script>
-        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shCore.css'></script>
-        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shThemeDefault.css'></link>
+        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shCore.css'>
+        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shThemeDefault.css'>
         <script type='text/javascript'>
           function highlight() {
             SyntaxHighlighter.autoloader(
@@ -346,8 +353,8 @@ class note extends cms {
       $this->scripts = "
         <script type='text/javascript' src='/includes/syntax/scripts/shCore.js'></script>
         <script type='text/javascript' src='/includes/syntax/scripts/shAutoloader.js'></script>
-        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shCore.css'></script>
-        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shThemeDefault.css'></link>
+        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shCore.css'>
+        <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shThemeDefault.css'>
         <script type='text/javascript'>
           function highlight() {
             SyntaxHighlighter.autoloader(
@@ -363,7 +370,7 @@ class note extends cms {
       ";
 
     if (isset($_GET['comments'])) {
-      $this->scripts += "
+      $this->scripts .= "
         <script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>
         <script type='text/javascript' src='/includes/comment.js'></script>";
     }
@@ -435,8 +442,8 @@ class note extends cms {
       // and a default author needs to be set
       // for no-javascript users.
       $stmt->bind_param('sss',
-                          htmlspecialchars($_POST['name']),
-                          htmlspecialchars($_POST['text']),
+                          $_POST['name'],
+                          $_POST['text'],
                         $this->id);
       $stmt->execute();
     }
@@ -491,7 +498,7 @@ END_OF_NAVIGATION;
       $date_posted = $entry['date_posted'];
       $author = $entry['author'];
       $text = htmlspecialchars($entry['text']);
-      $head = "<h3>$author</h3>";
+      $head = "<h3>" . htmlspecialchars($author) . "</h3>";
       echo <<<END_OF_COMMENT
       <div class='comment'>
       $head
@@ -666,15 +673,15 @@ class rss extends cms {
          echo <<<END_OF_ENTRY
          <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
       <channel>
-           <title>dylanstestserver.com/notes/rss</title>
-               <link>http://dylanstestserver.com/notes</link>
-               <description>dylanstestserver.com/notes/rss</description>
-               <atom:link href="http://dylanstestserver.com/notes/rss" rel="self" type="application/rss+xml" />
+           <title>dylansserver.com/notes/rss</title>
+               <link>http://dylansserver.com/notes</link>
+               <description>dylansserver.com/notes/rss</description>
+               <atom:link href="http://dylansserver.com/notes/rss" rel="self" type="application/rss+xml" />
 END_OF_ENTRY;
        while ($entry = $result->fetch_object()) {
          $title = $entry->title;
          $date_posted = $entry->date_posted;
-         $url = "http://dylanstestserver.com/note/" . $entry->url;
+         $url = "http://dylansserver.com/note/" . $entry->url;
          $text = $entry->text;
          $text = strip_tags($text);
          $end_of_first_sentence = strpos($text, '.');
@@ -751,6 +758,7 @@ switch (cms::determine_type()) {
   case "rss":
     $rss = new rss();
        $rss->display();
+    break;
   case 'archive':
     $archive = new archive;
        $archive->display();