Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
authorDan
Tue, 26 Jun 2007 17:28:18 -0400
changeset 21 663fcf528726
parent 20 40105681f495
child 22 d0314575e2f0
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
TODO
ajax.php
includes/captcha.php
includes/clientside/jsres.php
includes/clientside/static/admin-menu.js
includes/clientside/static/dropdown.js
includes/clientside/static/enano-lib-basic.js
includes/comment.php
includes/common.php
includes/constants.php
includes/dbal.php
includes/email.php
includes/functions.php
includes/graphs.php
includes/js-compressor.php
includes/pageprocess.php
includes/pageutils.php
includes/paths.php
includes/plugins.php
includes/render.php
includes/search.php
includes/sessions.php
includes/stats.php
includes/template.php
includes/wikiengine/Render/Xhtml/Url.php
includes/wikiengine/Render/Xhtml/Wikilink.php
includes/wikiengine/Tables.php
index.php
install.php
schema.sql
upgrade.php
upgrade.sql
--- a/TODO	Sat Jun 23 19:27:41 2007 -0400
+++ b/TODO	Tue Jun 26 17:28:18 2007 -0400
@@ -28,6 +28,7 @@
 [x] Trigger form submit on press of enter in Dynano login form
 [ ] Rewrite the change theme dialog - it's archaic code that hasn't changed since beta 1!
     [ ] This should be the next-to-last step in phasing out the JWS code, which should be removed in the first 1.1 alpha
+[ ] Get the new page ID cleaner code working 100% perfectly - this is the core of Enano and should be completely bug free
 
 
 Enano Clurichaun - TODO
--- a/ajax.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/ajax.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -28,7 +28,8 @@
       break;
     case "getpage":
       // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
-      $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace );
+      $revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
+      $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
       $page->send();
       break;
     case "savepage":
@@ -54,36 +55,6 @@
     case "rollback":
       echo PageUtils::rollback( (int)$_GET['id'] );
       break;
-      
-      /*
-       * This is old code and should not be used. It's badly broken and a perfect example of bad database organization.
-       
-    case "addcomment":
-      $cc = ( isset($_POST['captcha_code']) ) ? $_POST['captcha_code'] : false;
-      $ci = ( isset($_POST['captcha_id']  ) ) ? $_POST['captcha_id']   : false;
-      if(!isset($_POST['text']) ||
-         !isset($_POST['subj']) ||
-         !isset($_POST['name'])) die('alert(\'Error in POST DATA string, aborting\');');
-      if($_POST['text']=='' ||
-         $_POST['name']=='' ||
-         $_POST['subj']=='') die('alert(\'One or more POST DATA fields was empty, aborting post submission\')');
-     echo PageUtils::addcomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cc, $ci);
-     break;
-    case "comments":
-      echo PageUtils::comments($paths->cpage['urlname_nons'], $paths->namespace, ( isset($_GET['action']) ? $_GET['action'] : false ), Array(
-          'name' => ( isset($_POST['name']) ) ? $_POST['name'] : '',
-          'subj' => ( isset($_POST['subj']) ) ? $_POST['subj'] : '',
-          'text' => ( isset($_POST['text']) ) ? $_POST['text'] : ''
-        ));
-      break;
-    case "savecomment":
-      echo PageUtils::savecomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['s'], $_POST['t'], $_POST['os'], $_POST['ot'], $_POST['id']);
-      break;
-    case "deletecomment":
-      echo PageUtils::deletecomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $_GET['id']);
-      break;
-      */
-      
     case "comments":
       $comments = new Comments($paths->cpage['urlname_nons'], $paths->namespace);
       if ( isset($_POST['data']) )
--- a/includes/captcha.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/captcha.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * captcha.php - visual confirmation system used during registration
  *
--- a/includes/clientside/jsres.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/clientside/jsres.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * jsres.php - the Enano client-side runtime, a.k.a. AJAX on steroids
  *
@@ -40,7 +40,7 @@
 {
   echo "/*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * [Aggressively compressed] Javascript client code
  * Copyright (C) 2006-2007 Dan Fuhry
  * Enano is Free Software, licensed under the GNU General Public License; see http://www.enanocms.org/ for details.
--- a/includes/clientside/static/admin-menu.js	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/clientside/static/admin-menu.js	Tue Jun 26 17:28:18 2007 -0400
@@ -33,17 +33,24 @@
  * is not a "competing product" I was allowed to treat the code as GPL. The conversation can be seen in the
  * /licenses/tigra-menu.html document in the Enano distribution.
  */
- 
-var ck = readCookie('admin_menu_state');
-if(ck)
+
+if ( typeof(readCookie) == 'function' )
 {
-  var ck = parseInt(ck);
+  var ck = readCookie('admin_menu_state');
+  if(ck)
+  {
+    ck = parseInt(ck);
+  }
+  else
+  {
+    ck = 0;
+  }
+  ck = ( isNaN(ck) ) ? 0 : ck;
 }
 else
 {
-  ck = 0;
+  var ck = 0;
 }
-ck = ( isNaN(ck) ) ? 0 : ck;
 
 function tree (a_items, a_template) {
 
--- a/includes/clientside/static/dropdown.js	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/clientside/static/dropdown.js	Tue Jun 26 17:28:18 2007 -0400
@@ -11,6 +11,9 @@
 // Blocks animations from running if there's already an animation going on the same object
 var jBoxSlideBlocker = new Object();
 
+// Switch to enable or disable jBox slide animation
+var jBox_slide_enable = true;
+
 // Speed at which the menus should slide open. 1 to 100 or -1 to disable.
 // Setting this higher than 100 will cause an infinite loop in the browser.
 // Default is 80 - anything higher than 90 means exponential speed increase
@@ -93,6 +96,8 @@
 // Called when user hovers mouse over a submenu
 function jBoxOverHandler(obj)
 {
+  if ( is_Safari )
+    alert('Safari and over');
   // Random ID used to track the object to perform on
   var seed = Math.floor(Math.random() * 1000000);
   jBoxObjCache[seed] = obj;
@@ -135,13 +140,23 @@
     var offtop = parseInt(off['top']);
     var top = dimh + offtop;
     left = off['left'];
+    if ( jBox_slide_enable )
+    {
+      domObjChangeOpac(0, ul);
+    }
     ul.style.left = left + 'px';
     ul.style.top = top + 'px';
-    domObjChangeOpac(0, ul);
     ul.style.clip = 'rect(auto,auto,auto,auto)';
     ul.style.overflow = 'visible';
     ul.style.display = 'block';
-    slideOut(ul);
+    if ( jBox_slide_enable )
+    {
+      slideOut(ul);
+    }
+    else
+    {
+      domObjChangeOpac(100, ul);
+    }
   }
 }
 
--- a/includes/clientside/static/enano-lib-basic.js	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/clientside/static/enano-lib-basic.js	Tue Jun 26 17:28:18 2007 -0400
@@ -23,6 +23,7 @@
 
 var detect = navigator.userAgent.toLowerCase();
 var IE;
+var is_Safari;
 
 // dummy tinyMCE object
 var tinyMCE = new Object();
@@ -37,6 +38,8 @@
 if (checkIt('msie')) IE = true;
 else IE = false;
 
+is_Safari = checkIt('safari') ? true : false;
+
 var cmt_open;
 var list;
 var edit_open = false;
--- a/includes/comment.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/comment.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/common.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/common.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
   exit;
 }
 
-$version = '1.0RC3';
+$version = '1.0';
 
 function microtime_float()
 {
--- a/includes/constants.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/constants.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * constants.php - important defines used Enano-wide
  *
--- a/includes/dbal.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/dbal.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/email.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/email.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/functions.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/functions.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -1439,7 +1439,7 @@
     }
     elseif ( $in_tag && $trk_name )
     {
-      $is_alphabetical = ( strtolower($chr) != strtoupper($chr) || in_array($chr, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')) || $chr == '?' );
+      $is_alphabetical = ( strtolower($chr) != strtoupper($chr) || in_array($chr, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')) || $chr == '?' || $chr == '!' || $chr == '-' );
       if ( $is_alphabetical )
         $tag_name .= $chr;
       else
@@ -1456,6 +1456,9 @@
   // The rule is so specific because everything else will have been filtered by now
   $html = preg_replace('/<(script|iframe)(.+?)src=([^>]*)</i', '&lt;\\1\\2src=\\3&lt;', $html);
   
+  // Unstrip comments
+  $html = preg_replace('/&lt;!--([^>]*?)--&gt;/i', '', $html);
+  
   return $html;
   
 }
@@ -1850,7 +1853,7 @@
   // Remove character escapes
   $page_id = dirtify_page_id($page_id);
   
-  $pid_clean = preg_replace('/[\w\/:;\(\)@\[\]_-]/', 'X', $page_id);
+  $pid_clean = preg_replace('/[\w\.\/:;\(\)@\[\]_-]/', 'X', $page_id);
   $pid_dirty = enano_str_split($pid_clean, 1);
   
   foreach ( $pid_dirty as $id => $char )
@@ -1878,12 +1881,12 @@
       $page_id_cleaned .= $pid_dirty[$id];
   }
   
-  global $mime_types;
+  // global $mime_types;
           
-  $exts = array_keys($mime_types);
-  $exts = '(' . implode('|', $exts) . ')';
+  // $exts = array_keys($mime_types);
+  // $exts = '(' . implode('|', $exts) . ')';
   
-  $page_id_cleaned = preg_replace('/\.2e' . $exts . '$/', '.\\1', $page_id_cleaned);
+  // $page_id_cleaned = preg_replace('/\.2e' . $exts . '$/', '.\\1', $page_id_cleaned);
   
   return $page_id_cleaned;
 }
--- a/includes/graphs.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/graphs.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/js-compressor.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/js-compressor.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * Javascript compression library - used to compact the client-side Javascript code (all 72KB of it!) to save some bandwidth
  *
--- a/includes/pageprocess.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/pageprocess.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * pageprocess.php - intelligent retrieval of pages
  * Copyright (C) 2006-2007 Dan Fuhry
  *
@@ -32,6 +32,13 @@
   var $namespace;
   
   /**
+   * The revision ID (history entry) to send. If set to 0 (the default) then the most recent revision will be sent.
+   * @var int
+   */
+  
+  var $revision_id = 0;
+  
+  /**
    * Unsanitized page ID.
    * @var string
    */
@@ -79,7 +86,7 @@
    */
   
   var $debug = array(
-      'enable' => true,
+      'enable' => false,
       'works'  => false
     );
   
@@ -87,9 +94,10 @@
    * Constructor.
    * @param string The page ID (urlname) of the page
    * @param string The namespace of the page
+   * @param int Optional. The revision ID to send.
    */
   
-  function __construct( $page_id, $namespace )
+  function __construct( $page_id, $namespace, $revision_id = 0 )
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     
@@ -107,7 +115,10 @@
       $this->send_error('The namespace "' . htmlspecialchars($namespace) . '" does not exist.');
     }
     
-    $this->_setup( $page_id, $namespace );
+    if ( !is_int($revision_id) )
+      $revision_id = 0;
+    
+    $this->_setup( $page_id, $namespace, $revision_id );
     
   }
   
@@ -195,6 +206,9 @@
     else // (disabled for compatibility reasons) if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists )
     {
       // Send as regular page
+      
+      // die($this->page_id);
+      
       $text = $this->fetch_text();
       if ( $text == 'err_no_text_rows' )
       {
@@ -213,7 +227,7 @@
    * @access private
    */
   
-  function _setup($page_id, $namespace)
+  function _setup($page_id, $namespace, $revision_id)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     
@@ -221,6 +235,7 @@
     
     $this->page_id = $page_id_cleaned;
     $this->namespace = $namespace;
+    $this->revision_id = $revision_id;
     $this->page_id_unclean = dirtify_page_id($page_id);
     
     $this->perms = $session->fetch_page_acl( $page_id, $namespace );
@@ -244,6 +259,27 @@
     {
       $this->page_exists = true;
     }
+    
+    // Compatibility with older databases
+    if ( strstr($this->page_id, '.2e') && !$this->page_exists )
+    {
+      $page_id = str_replace('.2e', '.', $page_id);
+      
+      if ( $paths->cpage['urlname_nons'] == $page_id && $paths->namespace == $namespace && !$paths->page_exists && ( $this->namespace != 'Admin' || ($this->namespace == 'Admin' && !function_exists($fname) ) ) )
+      {
+        $this->page_exists = false;
+      }
+      else if ( !isset( $paths->pages[ $paths->nslist[$namespace] . $page_id ] ) && ( $this->namespace == 'Admin' && !function_exists($fname) ) )
+      {
+        $this->page_exists = false;
+      }
+      else
+      {
+        $this->page_exists = true;
+      }
+      
+    }
+    
   }
   
   /**
@@ -256,19 +292,24 @@
     $text = $this->fetch_text();
     
     $this->header();
-    if ( $this->send_headers )
+    // if ( $this->send_headers )
+    // {
+      display_page_headers();
+    // }
+    
+    if ( $this->revision_id )
     {
-      display_page_headers();
+      echo '<div class="info-box" style="margin-left: 0; margin-top: 5px;"><b>Notice:</b><br />The page you are viewing was archived on '.date('F d, Y \a\t h:i a', $this->revision_id).'.<br /><a href="'.makeUrlNS($this->namespace, $this->page_id).'" onclick="ajaxReset(); return false;">View current version</a>  |  <a href="'.makeUrlNS($this->namespace, $this->pageid, 'do=rollback&amp;id='.$this->revision_id).'" onclick="ajaxRollback(\''.$this->revision_id.'\')">Restore this version</a></div><br />';
     }
     
     $text = '?>' . RenderMan::render($text);
     // echo('<pre>'.htmlspecialchars($text).'</pre>');
     eval ( $text );
     
-    if ( $this->send_headers )
-    {
+    // if ( $this->send_headers )
+    // {
       display_page_footers();
-    }
+    // }
     
     $this->footer();
   }
@@ -309,19 +350,83 @@
       return $this->text_cache;
     }
     
-    $q = $db->sql_query('SELECT page_text, char_tag FROM '.table_prefix.'page_text WHERE page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\';');
-    if ( !$q )
-    {
-      $this->send_error('Error during SQL query.', true);
-    }
-    if ( $db->numrows() < 1 )
+    if ( $this->revision_id > 0 && is_int($this->revision_id) )
     {
-      $this->page_exists = false;
-      return 'err_no_text_rows';
+    
+      $q = $db->sql_query('SELECT page_text, char_tag, date_string FROM '.table_prefix.'logs WHERE page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\' AND time_id=' . $this->revision_id . ';');
+      if ( !$q )
+      {
+        $this->send_error('Error during SQL query.', true);
+      }
+      if ( $db->numrows() < 1 )
+      {
+        // Compatibility fix for old pages with dots in the page ID
+        if ( strstr($this->page_id, '.2e') )
+        {
+          $db->free_result();
+          $page_id = str_replace('.2e', '.', $this->page_id);
+          $q = $db->sql_query('SELECT page_text, char_tag, date_string FROM '.table_prefix.'logs WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $this->namespace . '\' AND time_id=' . $this->revision_id . ';');
+          if ( !$q )
+          {
+            $this->send_error('Error during SQL query.', true);
+          }
+          if ( $db->numrows() < 1 )
+          {
+            $this->page_exists = false;
+            return 'err_no_text_rows';
+          }
+        }
+        else
+        {
+          $this->page_exists = false;
+          return 'err_no_text_rows';
+        }
+      }
+      else
+      {
+        $row = $db->fetchrow();
+      }
+      
+      $db->free_result();
+      
     }
-    
-    $row = $db->fetchrow();
-    $db->free_result();
+    else
+    {
+      
+      $q = $db->sql_query('SELECT page_text, char_tag FROM '.table_prefix.'page_text WHERE page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\';');
+      if ( !$q )
+      {
+        $this->send_error('Error during SQL query.', true);
+      }
+      if ( $db->numrows() < 1 )
+      {
+        // Compatibility fix for old pages with dots in the page ID
+        if ( strstr($this->page_id, '.2e') )
+        {
+          $db->free_result();
+          $page_id = str_replace('.2e', '.', $this->page_id);
+          $q = $db->sql_query('SELECT page_text, char_tag FROM '.table_prefix.'page_text WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $this->namespace . '\';');
+          if ( !$q )
+          {
+            $this->send_error('Error during SQL query.', true);
+          }
+          if ( $db->numrows() < 1 )
+          {
+            $this->page_exists = false;
+            return 'err_no_text_rows';
+          }
+        }
+        else
+        {
+          $this->page_exists = false;
+          return 'err_no_text_rows';
+        }
+      }
+      
+      $row = $db->fetchrow();
+      $db->free_result();
+      
+    }
     
     if ( !empty($row['char_tag']) )
     {
@@ -380,12 +485,11 @@
     
     $this->header();
     
-    if ( $send_headers )
-    {
+    // if ( $send_headers )
+    // {
       display_page_headers();
-    }
+    // }
    
-    /*
     // Start left sidebar: basic user info, latest comments
     
     echo '<table border="0" cellspacing="4" cellpadding="0" style="width: 100%;">';
@@ -400,7 +504,6 @@
           </div>';
     
     echo '</td><td>';
-    */
     
     // User's own content
     
@@ -416,8 +519,6 @@
       $this->err_page_not_existent();
     }
     
-    /*
-    
     // Right sidebar
     
     echo '</td><td style="width: 150px;">';
@@ -432,12 +533,10 @@
           
     echo '</tr></table>';
     
-    if ( $send_headers )
-    {
+    // if ( $send_headers )
+    // {
       display_page_footers();
-    }
-    
-    */
+    // }
     
     $this->send_headers = $send_headers;
     unset($send_headers);
@@ -543,13 +642,13 @@
    * @see PageProcessor::__construct()
    */
   
-  function PageProcessor( $page_id, $namespace )
+  function PageProcessor( $page_id, $namespace, $revision_id = 0 )
   {
-    $this->__construct($page_id, $namespace);
+    $this->__construct($page_id, $namespace, $revision_id);
   }
   
   /**
-   * Send an error message and die
+   * Send an error message and die. For debugging or critical technical errors only - nothing that would under normal circumstances be shown to the user.
    * @var string Error message
    * @var bool If true, send DBAL's debugging information as well
    */
--- a/includes/pageutils.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/pageutils.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * pageutils.php - a class that handles raw page manipulations, used mostly by AJAX requests or their old-fashioned form-based counterparts
  *
@@ -324,16 +324,17 @@
     {
       if(!PageUtils::createPage($page_id, $namespace))
         return 'The page did not exist, and I was not able to create it. Permissions problem?';
+      $paths->page_exists = true;
     }
     
     $prot = ( ( $paths->pages[$pname]['protected'] == 2 && $session->user_logged_in && $session->reg_time + 60*60*24*4 < time() ) || $paths->pages[$pname]['protected'] == 1) ? true : false;
     $wiki = ( ( $paths->pages[$pname]['wiki_mode'] == 2 && getConfig('wiki_mode') == '1') || $paths->pages[$pname]['wiki_mode'] == 1) ? true : false;
     if(($prot || !$wiki) && $session->user_level < USER_LEVEL_ADMIN ) return('You are not authorized to edit this page.');
     
-    // Strip potentially harmful tags and PHP from the message, if we are in wiki mode and the user is not an administrator
+    // Strip potentially harmful tags and PHP from the message, dependent upon permissions settings
     $message = RenderMan::preprocess_text($message, false, false);
     
-    $msg=$db->escape($message);
+    $msg = $db->escape($message);
     
     $minor = $minor ? 'true' : 'false';
     $q='INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \''.$paths->cpage['urlname_nons'].'\', \''.$paths->namespace.'\', \''.$msg.'\', \''.$uid.'\', \''.$session->username.'\', \''.$db->escape(htmlspecialchars($summary)).'\', '.$minor.');';
@@ -389,9 +390,10 @@
       return false; // Not authorized to create system messages
     }
     
+    $page_id = dirtify_page_id($page_id);
+    
     if ( !$name )
       $name = str_replace('_', ' ', $page_id);
-    $page = str_replace(' ', '_', $page_id);
     $regex = '#^([A-z0-9 _\-\.\/\!\@\(\)]*)$#is';
     if(!preg_match($regex, $page))
     {
@@ -399,18 +401,24 @@
       return false; // Name contains invalid characters
     }
     
+    $page_id = sanitize_page_id( $page_id );
+    
     $prot = ( $namespace == 'System' ) ? 1 : 0;
     
-    $paths->add_page(Array(
+    $page_data = Array(
       'name'=>$name,
-      'urlname'=>$page,
+      'urlname'=>$page_id,
       'namespace'=>$namespace,
       'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>$prot,'delvotes'=>0,'delvote_ips'=>'','wiki_mode'=>2,
-    ));
+    );
+    
+    // die('PageUtils::createpage: Creating page with this data:<pre>' . print_r($page_data, true) . '</pre>');
     
-    $qa = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,visible,protected) VALUES(\''.$db->escape($name).'\', \''.$db->escape($page).'\', \''.$namespace.'\', '. ( $visible ? '1' : '0' ) .', '.$prot.');');
-    $qb = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace) VALUES(\''.$db->escape($page).'\', \''.$namespace.'\');');
-    $qc = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$db->escape($page).'\', \''.$namespace.'\');');
+    $paths->add_page($page_data);
+    
+    $qa = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,visible,protected) VALUES(\''.$db->escape($name).'\', \''.$db->escape($page_id).'\', \''.$namespace.'\', '. ( $visible ? '1' : '0' ) .', '.$prot.');');
+    $qb = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace) VALUES(\''.$db->escape($page_id).'\', \''.$namespace.'\');');
+    $qc = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$db->escape($page_id).'\', \''.$namespace.'\');');
     
     if($qa && $qb && $qc)
       return true;
--- a/includes/paths.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/paths.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /**
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * paths.php - The part of Enano that actually manages content. Everything related to page handling and namespaces is in here.
  *
--- a/includes/plugins.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/plugins.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/render.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/render.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * render.php - handles fetching pages and parsing them into HTML
  * Copyright (C) 2006-2007 Dan Fuhry
  *
--- a/includes/search.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/search.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * search.php - algorithm used to search pages
  *
--- a/includes/sessions.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/sessions.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * sessions.php - everything related to security and user management
  *
--- a/includes/stats.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/stats.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * stats.php - handles statistics for pages (disablable in the admin CP)
  *
--- a/includes/template.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/template.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/wikiengine/Render/Xhtml/Url.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/wikiengine/Render/Xhtml/Url.php	Tue Jun 26 17:28:18 2007 -0400
@@ -113,7 +113,7 @@
             }
 
             // finish up output
-            $output .= ">$text</a>";
+            $output .= " rel=".'"'."nofollow".'"'.">$text</a>";
 
             // make numbered references look like footnotes when no
             // CSS class specified, make them superscript by default
--- a/includes/wikiengine/Render/Xhtml/Wikilink.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/wikiengine/Render/Xhtml/Wikilink.php	Tue Jun 26 17:28:18 2007 -0400
@@ -57,8 +57,14 @@
     function token($options)
     {
         global $session;
-        if($session->sid_super) $as = htmlspecialchars(urlSeparator).'auth='.$session->sid_super;
-        else $as = '';
+        if ( $session->sid_super )
+        {
+          $as = htmlspecialchars(urlSeparator) . 'auth='.$session->sid_super;
+        }
+        else
+        {
+          $as = '';
+        }
         // make nice variable names (page, anchor, text)
         extract($options);
 
@@ -71,6 +77,8 @@
         } else {
         	$callback = false;
         }
+        
+        $page = sanitize_page_id( $page );
 
         if ($callback) {
             // use the callback function
@@ -92,7 +100,7 @@
         //$page = $this->urlEncode($page);
         $anchor = $this->urlEncode($anchor);
         $text = $this->textEncode($text);
-
+        
         // does the page exist?
         if ($exists) {
 
--- a/includes/wikiengine/Tables.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/includes/wikiengine/Tables.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /**
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/index.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/index.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /**
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * @Version 1.0 release candidate 3 (Druid)
+ * @Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -51,7 +51,8 @@
       break;
     case 'view':
       // echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
-      $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace );
+      $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
+      $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $rev_id );
       $page->send_headers = true;
       $page->send();
       break;
--- a/install.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/install.php	Tue Jun 26 17:28:18 2007 -0400
@@ -1,7 +1,7 @@
 <?php
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * Copyright (C) 2006-2007 Dan Fuhry
  * install.php - handles everything related to installation and initial configuration
  *
@@ -23,7 +23,6 @@
 define('IN_ENANO_INSTALL', 'true');
 
 define('ENANO_VERSION', '1.0');
-define('ENANO_BETA_VERSION', '3'); // This is really RC
 // In beta versions, define ENANO_BETA_VERSION here
 
 if(!defined('scriptPath')) {
@@ -258,7 +257,7 @@
 }
 
 $template = new template_nodb();
-$template->load_theme('stpatty', 'shamrock', false);
+$template->load_theme('oxygen', 'bleu', false);
 
 $modestrings = Array(
               'welcome' => 'Welcome',
@@ -313,8 +312,8 @@
     <div style="text-align: center; margin-top: 10px;">
       <img alt="[ Enano CMS Project logo ]" src="images/enano-artwork/installer-greeting-blue.png" style="display: block; margin: 0 auto; padding-left: 100px;" />
       <h2>Welcome to Enano</h2>
-      <h3>version 1.0rc3 &ndash; security release<br />
-      <span style="font-weight: normal;">also affectionately known as "druid" <tt>:)</tt></span></h3>
+      <h3>version 1.0 &ndash; stable<br />
+      <span style="font-weight: normal;">also affectionately known as "banshee" <tt>:)</tt></span></h3>
       <?php
       if ( file_exists('./_nightly.php') )
       {
@@ -1042,7 +1041,8 @@
       $schema = str_replace('{{TABLE_PREFIX}}', $_POST['table_prefix'],                          $schema);
       $schema = str_replace('{{VERSION}}',      ENANO_VERSION,                                   $schema);
       $schema = str_replace('{{ADMIN_EMBED_PHP}}', $_POST['admin_embed_php'],                    $schema);
-      $schema = str_replace('{{BETA_VERSION}}', ENANO_BETA_VERSION,                              $schema);
+      // Not anymore!! :-D
+      // $schema = str_replace('{{BETA_VERSION}}', ENANO_BETA_VERSION,                              $schema);
       
       if(isset($_POST['wiki_mode'])) $schema = str_replace('{{WIKI_MODE}}', '1', $schema);
       else $schema = str_replace('{{WIKI_MODE}}', '0', $schema);
--- a/schema.sql	Sat Jun 23 19:27:41 2007 -0400
+++ b/schema.sql	Tue Jun 26 17:28:18 2007 -0400
@@ -19,12 +19,12 @@
 CREATE TABLE {{TABLE_PREFIX}}group_members( member_id int(12) UNSIGNED NOT NULL auto_increment, group_id mediumint(5) UNSIGNED NOT NULL, user_id int(12) NOT NULL, is_mod tinyint(1) NOT NULL DEFAULT 0, pending tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY ( member_id ) );
 CREATE TABLE {{TABLE_PREFIX}}acl( rule_id int(12) UNSIGNED NOT NULL auto_increment, target_type tinyint(1) UNSIGNED NOT NULL, target_id int(12) UNSIGNED NOT NULL, page_id varchar(255), namespace varchar(24), rules text, PRIMARY KEY ( rule_id ) );
 CREATE TABLE {{TABLE_PREFIX}}search_cache( search_id int(15) NOT NULL auto_increment, search_time int(11) NOT NULL, query text, results longblob, PRIMARY KEY ( search_id ));
-INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES ('site_name', '{{SITE_NAME}}'), ('main_page', 'Main_Page'), ('site_desc', '{{SITE_DESC}}'), ('wiki_mode', '{{WIKI_MODE}}'), ('wiki_edit_notice', '0'), ('sflogo_enabled', '0'), ('sflogo_groupid', ''), ('sflogo_type', '1'), ('w3c_vh32', '0'), ('w3c_vh40', '0'), ('w3c_vh401', '0'), ('w3c_vxhtml10', '0'), ('w3c_vxhtml11', '0'), ('w3c_vcss', '0'), ('approve_comments', '0'), ('enable_comments', '1'), ('plugin_SpecialAdmin.php', '1'), ('plugin_SpecialPageFuncs.php', '1'), ('plugin_SpecialUserFuncs.php', '1'), ('plugin_SpecialCSS.php', '1'), ('copyright_notice', '{{COPYRIGHT}}'), ('wiki_edit_notice_text', '== Why can I edit this page? ==\n\nEveryone can edit almost any page in this website. This concept is called a wiki. It gives everyone the opportunity to make a change for the best. While some spam and vandalism may occur, it is believed that most contributions will be legitimate and helpful.\n\nFor security purposes, a history of all page edits is kept, and administrators are able to restore vandalized or spammed pages with just a few clicks.'), ('cache_thumbs', '{{ENABLE_CACHE}}'), ('max_file_size', '256000'),('enano_version', '{{VERSION}}'),('enano_rc_version', '{{BETA_VERSION}}'),( 'allowed_mime_types', 'cbf:len=168;crc=c3dcad3f;data=0[1],1[4],0[3],1[1],0[2],1[1],0[11],1[1],0[7],1[1],0[9],1[1],0[6],1[3],0[10],1[1],0[2],1[2],0[1],1[1],0[1],1[2],0[6],1[3],0[1],1[1],0[2],1[4],0[1],1[2],0[3],1[1],0[4],1[2],0[26],1[5],0[6],1[2],0[2],1[1],0[4],1[1],0[10],1[2],0[1],1[1],0[6]|end' ), ('contact_email', '{{ADMIN_EMAIL}}');
+INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES ('site_name', '{{SITE_NAME}}'), ('main_page', 'Main_Page'), ('site_desc', '{{SITE_DESC}}'), ('wiki_mode', '{{WIKI_MODE}}'), ('wiki_edit_notice', '0'), ('sflogo_enabled', '0'), ('sflogo_groupid', ''), ('sflogo_type', '1'), ('w3c_vh32', '0'), ('w3c_vh40', '0'), ('w3c_vh401', '0'), ('w3c_vxhtml10', '0'), ('w3c_vxhtml11', '0'), ('w3c_vcss', '0'), ('approve_comments', '0'), ('enable_comments', '1'), ('plugin_SpecialAdmin.php', '1'), ('plugin_SpecialPageFuncs.php', '1'), ('plugin_SpecialUserFuncs.php', '1'), ('plugin_SpecialCSS.php', '1'), ('copyright_notice', '{{COPYRIGHT}}'), ('wiki_edit_notice_text', '== Why can I edit this page? ==\n\nEveryone can edit almost any page in this website. This concept is called a wiki. It gives everyone the opportunity to make a change for the best. While some spam and vandalism may occur, it is believed that most contributions will be legitimate and helpful.\n\nFor security purposes, a history of all page edits is kept, and administrators are able to restore vandalized or spammed pages with just a few clicks.'), ('cache_thumbs', '{{ENABLE_CACHE}}'), ('max_file_size', '256000'),('enano_version', '{{VERSION}}'),( 'allowed_mime_types', 'cbf:len=168;crc=c3dcad3f;data=0[1],1[4],0[3],1[1],0[2],1[1],0[11],1[1],0[7],1[1],0[9],1[1],0[6],1[3],0[10],1[1],0[2],1[2],0[1],1[1],0[1],1[2],0[6],1[3],0[1],1[1],0[2],1[4],0[1],1[2],0[3],1[1],0[4],1[2],0[26],1[5],0[6],1[2],0[2],1[1],0[4],1[1],0[10],1[2],0[1],1[1],0[6]|end' ), ('contact_email', '{{ADMIN_EMAIL}}');
 INSERT INTO {{TABLE_PREFIX}}page_text(page_id, namespace, page_text, char_tag) VALUES ('Main_Page', 'Article', '=== Enano has been successfully installed! ===\n\nYou have finished installing Enano on this server. Congratulations!', '');
 INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, '');
-INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES ('oxygen', 'Oxygen', 2, 'bleu.css', 1),('stpatty', 'St. Patty', 1, 'shamrock.css', 1);
-INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time) VALUES(1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'stpatty', 'shamrock', '', 0);
-INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, account_active, reg_time) VALUES (2, '{{ADMIN_USER}}', '{{ADMIN_PASS}}', '{{ADMIN_EMAIL}}', '{{REAL_NAME}}', 9, 'stpatty', 'shamrock', 1, UNIX_TIMESTAMP());
+INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES ('oxygen', 'Oxygen', 1, 'bleu.css', 1),('stpatty', 'St. Patty', 2, 'shamrock.css', 1);
+INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time) VALUES(1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0);
+INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, account_active, reg_time) VALUES (2, '{{ADMIN_USER}}', '{{ADMIN_PASS}}', '{{ADMIN_EMAIL}}', '{{REAL_NAME}}', 9, 'oxygen', 'bleu', 1, UNIX_TIMESTAMP());
 INSERT INTO {{TABLE_PREFIX}}groups(group_id,group_name,group_type,system_group) VALUES(1, 'Everyone', 3, 1),(2,'Administrators',3,1),(3,'Moderators',3,1);
 INSERT INTO {{TABLE_PREFIX}}group_members(group_id,user_id,is_mod) VALUES(2, 2, 1);
 INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES(1,2,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=4;clear_logs=4;vote_delete=4;vote_reset=4;delete_page=4;set_wiki_mode=4;password_set=4;password_reset=4;mod_misc=4;edit_cat=4;even_when_protected=4;upload_files=4;upload_new_version=4;create_page=4;php_in_pages={{ADMIN_EMBED_PHP}};edit_acl=4;'),(1,3,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=3;clear_logs=2;vote_delete=4;vote_reset=4;delete_page=4;set_wiki_mode=2;password_set=2;password_reset=2;mod_misc=2;edit_cat=4;even_when_protected=4;upload_files=2;upload_new_version=3;create_page=3;php_in_pages=2;edit_acl=2;');
--- a/upgrade.php	Sat Jun 23 19:27:41 2007 -0400
+++ b/upgrade.php	Tue Jun 26 17:28:18 2007 -0400
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 3 (Druid)
+ * Version 1.0 (Banshee)
  * upgrade.php - upgrade script
  * Copyright (C) 2006-2007 Dan Fuhry
  *
@@ -30,7 +30,18 @@
 global $_starttime, $this_page, $sideinfo;
 $_starttime = microtime(true);
 
-define('ENANO_ROOT', dirname(__FILE__));
+// Determine directory (special case for development servers)
+if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') )
+{
+  $filename = str_replace('/repo/', '/', __FILE__);
+}
+else
+{
+  $filename = __FILE__;
+}
+
+define('ENANO_ROOT', dirname($filename));
+
 require(ENANO_ROOT.'/includes/constants.php');
 
 if(defined('ENANO_DEBUG'))
@@ -50,19 +61,20 @@
 // Everything related to versions goes here!
 
 // Valid versions to upgrade from
-$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2');
+$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3');
 
 // Basically a list of dependencies, which should be resolved automatically
-// If, for example, if upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not
+// If, for example, upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not
 // normally be required (for whatever reason) then you would add a custom version number to the array under key '1.0b1'.
 $deps_list = Array(
     '1.0b1' => Array('1.0b2'),
     '1.0b2' => Array('1.0b3'),
     '1.0b3' => Array('1.0b4'),
     '1.0b4' => Array('1.0RC1'),
-    '1.0RC1' => Array('1.0RC2')
+    '1.0RC1' => Array('1.0RC2'),
+    '1.0RC2' => Array('1.0RC3')
   );
-$this_version   = '1.0RC3';
+$this_version   = '1.0';
 $func_list = Array(
     '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text') // ,
     // '1.0RC2' => Array('u_1_0_populate_userpage_comments')
@@ -339,6 +351,10 @@
 
 function u_1_0_populate_userpage_comments()
 {
+  //
+  // UNFINISHED...
+  //
+  
   /*
   global $db;
   $q = $db->sql_query('SELECT COUNT(c.comment_id) AS num_comments...');
@@ -476,7 +492,9 @@
       <p>Your version of Enano (<?php echo $v; ?>) can't be upgraded to this version (<?php echo $this_version; ?>).</p>
       <?php
       break;
-    } elseif($v == '') {
+    } 
+    else if($v == '')
+    {
       // OK, we don't know which version he's running. So we'll cheat ;-)
       $template->header();
       echo "<form action='upgrade.php?mode=confirm&amp;auth={$session->sid_super}' method='post'>";
@@ -494,7 +512,9 @@
       <?php
       echo `</form>`;
       break;
-    } else {
+    }
+    else
+    {
       header('Location: upgrade.php?mode=confirm&auth='.$session->sid_super);
     }
     break;
--- a/upgrade.sql	Sat Jun 23 19:27:41 2007 -0400
+++ b/upgrade.sql	Tue Jun 26 17:28:18 2007 -0400
@@ -3,7 +3,11 @@
 -- ALL NON-SQL LINES, even otherwise blank lines, must start with "--" or they will get sent to MySQL!
 -- Common tasks (version numbers)
 DELETE FROM {{TABLE_PREFIX}}config WHERE config_name='enano_version' OR config_name='enano_beta_version' OR config_name='enano_alpha_version' OR config_name='enano_rc_version';
-INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.0' ),( 'enano_rc_version', '3' );
+INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.0' );
+---BEGIN 1.0RC3---
+-- Placeholder (all versions need to have at least one query performed)
+UPDATE {{TABLE_PREFIX}}config SET config_value='' WHERE config_name='              ';
+---END 1.0RC3---
 ---BEGIN 1.0RC2---
 -- Add the "Moderators" group
 UPDATE {{TABLE_PREFIX}}groups SET group_id=9999 WHERE group_id=3;