Location: PHPKode > projects > DoubleSpeak > igloo-0.1/html/admin/view_story_queue.php
<?

/*
 | This file is part of the Igloo Weblog system.
 | Igloo is available under the GNU General Public
 | License.  For details on the GNU General Public
 | License, read the COPYING or the LICENSE file
 | that you received with this distribution.  If
 | you did not receive one of these files with the
 | distribution, you can find more information at
 | http://www.gnu.org.
 |
 | Igloo is the creation of Brad Johnson.  It is not
 | based on any other works.  Brad Johnson is the
 | sole owner of the copyright, but he welcomes all
 | to take the software, use it, modify it, change
 | it, or to do whatever they can do with it under
 | the provisions of the GNU General Public License.
 |
 | This software is provided as-is, with no warranty
 | whatsoever.  The author is not responsible for
 | anything that may happen as a result of your
 | using this software unless you have purchased an
 | extended warranty.  If you would like to
 | purchase an extended warranty, please contact
 | Brad Johnson via e-mail at hide@address.com
 |
 | This software may destroy your system, date your
 | sister, drink your beer, eat the last of the
 | potato chips, cause Democrats to get elected,
 | kick your dog, burn your house, wreck your car,
 | cause nuclear war, force you to kiss your
 | grandmother, or make you eat brussel sprouts.
 | You have been warned.
 |
 | If it breaks, you may feel free to keep both
 | pieces.
 */

  require "../config.inc";
  require "$config[private]/local.inc";
  require "$config[private]/storyfun.inc";
  require "$config[private]/adminfun.inc";

  $USER = getenv("REMOTE_USER");

  $admin = get_admin_info($USER);

  $date = exec("date +%A,\ %B\ %d\ @\ %l:%M:%S\ %p");

  common_header();

  /*
   * now that the requires and the header is out of the
   * way, you can start writing!
   * the first table row should start on line 26, fool!
   */

  if ($id) {

    $story_array = accquire_story_info($id);

    if ($submit) {
      $working_story   = htmlentities($working_story);
      $working_subject = htmlentities($working_subject);
      $working_story   = addslashes($working_story);
      $working_subject = addslashes($working_subject);
      
      $Results = do_mysql_query("INSERT INTO stories (headline, poster, story, time, topic)
        VALUES ('$working_subject', '$admin[id]', '$working_story', '$date', '$working_topic')")
          or die("I could not INSERT INTO the database\n");
      print "<tr>\n";
      print "  <td>\n";
      print "    Story Posted\n";
      print "  </td>\n";
      print "</tr>\n";
    } elseif ($preview) {
      preview_working($working_subject, $working_story, $working_topic, $id, $story_array);
      edit_working($working_subject, $working_story, $working_topic, $id);
    } else {
      preview_original($story_array);
      edit_original($story_array);
    }

  } else {

    $Results = do_mysql_query("SELECT count(*) FROM pending_stories")
      or die("I could not SELECT FROM the database\n");
    $Row = mysql_fetch_array($Results);
    mysql_free_result($Results);
    $number_in_queue = $Row[0];

    print "<tr>\n";
    print "  <th>\n";
    print "    The Story Queue\n";
    print "  </th>\n";
    print "</tr>\n";
    print "<tr>\n";
    print "  <td>\n";
    print "    <font size=\"2\">\n";
    print "      Current number of stories in queue: $number_in_queue\n";
    print "    </font>\n";
    print "  </td>\n";
    print "</tr>\n";
    print "<tr>\n";
    print "  <td>\n";
    print "    <b>Signed Stories</b>\n";
    print "  </td>\n";
    print "</tr>\n";
  
    $Results = do_mysql_query("SELECT * FROM pending_stories WHERE poster!=0")
      or die("I could not SELECT FROM the database\n");
    while ($Row = mysql_fetch_array($Results)) {
      print "<tr>\n";
      print "  <td>\n";
      print "    <a href=\"/admin/view_story_queue.php?id=$Row[id]\">\n";
      print "      $Row[headline]\n";
      print "    </a>\n";
      print "  </td>\n";
      print "</tr>\n";
    }

    print "<tr>\n";
    print "  <td>\n";
    print "    <b>Anonymous Stories</b>\n";
    print "  </td>\n";
    print "</tr>\n";
   
    $Results = do_mysql_query("SELECT * FROM pending_stories WHERE poster=0")
      or die("I could not SELECT FROM the database\n");
    while ($Row = mysql_fetch_array($Results)) {
      print "<tr>\n";
      print "  <td>\n";
      print "    <a href=\"/admin/view_story_queue.php?id=$Row[id]\">\n";
      print "      $Row[headline]\n";
      print "    </a>\n";
      print "  </td>\n";
      print "</tr>\n";
    }

  }

  common_footer();

?>
Return current item: DoubleSpeak