Index: /trunk/bin/acl.cli.php
===================================================================
--- /trunk/bin/acl.cli.php	(revision 467)
+++ /trunk/bin/acl.cli.php	(revision 468)
@@ -5,5 +5,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -12,10 +12,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -113,6 +113,6 @@
         break;
     case 'all' :
-        listObjects('root', 'aro');                               
-        listObjects('root', 'aco');                               
+        listObjects('root', 'aro');
+        listObjects('root', 'aco');
         listObjects('root', 'axo');
         break;
@@ -238,9 +238,9 @@
 but could just as easily be SPICES -> CUISINES -> DISHES. A privilege is
 allowed if a user (ARO) can perform an action (ACO) on something (AXO).
-For example, with an `ARO->ACO->AXO` of `Bob->edit->4`, Bob can edit article 4. 
-If the AXO were omitted (i.e. just `Bob->edit`), this becomes "Bob can edit" 
+For example, with an `ARO->ACO->AXO` of `Bob->edit->4`, Bob can edit article 4.
+If the AXO were omitted (i.e. just `Bob->edit`), this becomes "Bob can edit"
 (he can edit any object).
 
-Each access object is stored as a node in hierarchical tree structures. 
+Each access object is stored as a node in hierarchical tree structures.
 A permission granted to a node is applied to all its children. If a child
 node is specified a different permission that is more specific than
@@ -252,5 +252,5 @@
 
 Where command is any of the following (with arguments):
-    
+
     initdb
     list [aro | aco | axo | all | perms]
@@ -268,8 +268,8 @@
     revoke aro [aco] [axo]
     delete [aro] [aco] [axo]
-    
-
-For the add*, mv*, grant, and revoke commands if any of the optional 
-args are not provided, 'root' is assumed. For the delete command 
+
+
+For the add*, mv*, grant, and revoke commands if any of the optional
+args are not provided, 'root' is assumed. For the delete command
 'null' is considered a wild-card to delete all objects of that type.
 
@@ -297,5 +297,5 @@
     $db =& DB::getInstance();
     global $this_script;
-    
+
     echo "\n";
 
@@ -324,7 +324,7 @@
     $qid = $db->query("SELECT lft, rgt FROM $tbl WHERE name = '" . $db->escapeString($root) . "'");
     list($lft, $rgt) = mysql_fetch_row($qid);
-    
+
     $depth = array();
-    
+
     // Retrieve all descendants of the root node
     $qid = $db->query("SELECT name, lft, rgt, added_datetime FROM $tbl WHERE lft BETWEEN $lft AND $rgt ORDER BY lft ASC");
@@ -334,8 +334,8 @@
             array_pop($depth);
         }
-    
+
         // Display indented node title.
         printf("%-35s %-5s %-5s %s\n", str_repeat('    ', sizeof($depth)) . $name, $lft, $rgt, date($app->getParam('date_format'), strtotime($added_datetime)));
-        
+
         // Add this node to the stack.
         $depth[] = $rgt;
@@ -356,5 +356,5 @@
     $db =& DB::getInstance();
     global $this_script;
-    
+
     // Retrieve access value from db.
     $qid = $db->query("
@@ -371,7 +371,6 @@
     while ($p = mysql_fetch_assoc($qid)) {
         printf("%-25s %-25s %-25s \033[0;%sm%-6s\033[0m %-10s\n", $p['aro'], $p['aco'], $p['axo'], ('allow' == $p['access'] ? '32' : '31'), $p['access'], date($app->getParam('date_format'), strtotime($p['added_datetime'])));
-    }    
-}
-
-
-?>
+    }
+}
+
+
Index: /trunk/bin/file_importer.php
===================================================================
--- /trunk/bin/file_importer.php	(revision 467)
+++ /trunk/bin/file_importer.php	(revision 468)
@@ -123,3 +123,2 @@
 // }
 // 
-// ?>
Index: /trunk/bin/module_maker/_config.inc.php
===================================================================
--- /trunk/bin/module_maker/_config.inc.php	(revision 467)
+++ /trunk/bin/module_maker/_config.inc.php	(revision 468)
@@ -73,3 +73,2 @@
 
 
-?>
Index: /trunk/bin/module_maker/form_template.cli.php
===================================================================
--- /trunk/bin/module_maker/form_template.cli.php	(revision 467)
+++ /trunk/bin/module_maker/form_template.cli.php	(revision 468)
@@ -249,4 +249,2 @@
 
 echo join("\n", $output);
-
-?>
Index: /trunk/bin/module_maker/list_template.cli.php
===================================================================
--- /trunk/bin/module_maker/list_template.cli.php	(revision 467)
+++ /trunk/bin/module_maker/list_template.cli.php	(revision 468)
@@ -36,5 +36,5 @@
     $db_tbl = $_SERVER['argv'][2];
 } else {
-    die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
+    die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s\n", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
 }
 
@@ -213,4 +213,2 @@
 
 E_O_F;
-
-?>
Index: /trunk/bin/module_maker/module.cli.php
===================================================================
--- /trunk/bin/module_maker/module.cli.php	(revision 467)
+++ /trunk/bin/module_maker/module.cli.php	(revision 468)
@@ -596,4 +596,2 @@
     }
 }
-
-?>
Index: /trunk/bin/module_maker/skel/admin.php
===================================================================
--- /trunk/bin/module_maker/skel/admin.php	(revision 467)
+++ /trunk/bin/module_maker/skel/admin.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -236,5 +236,5 @@
 	$db =& DB::getInstance();
 	$app =& App::getInstance();
-	
+
     $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
     if ($lock->isLocked() && !$lock->isMine()) {
@@ -278,5 +278,5 @@
 	$db =& DB::getInstance();
 	$app =& App::getInstance();
-	
+
     $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
     if ($lock->isLocked() && !$lock->isMine()) {
@@ -314,5 +314,5 @@
 	$db =& DB::getInstance();
 	$app =& App::getInstance();
-	
+
     // Remove any stale cached list data.
     $cache->delete('list');
@@ -337,5 +337,5 @@
 	$db =& DB::getInstance();
 	$app =& App::getInstance();
-    
+
     $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']);
     if ($lock->isLocked() && !$lock->isMine()) {
@@ -364,7 +364,7 @@
     global $tmp_prefs;
     global $cache;
-	$db =& DB::getInstance();	
-	$app =& App::getInstance();
-    
+	$db =& DB::getInstance();
+	$app =& App::getInstance();
+
     $where_clause = '';
 
@@ -379,5 +379,5 @@
     if (getFormData('filter___///__', false)) {
         // Limit by filter.
-        $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " __///__ = '" . $db->escapeString(getFormData('filter___///__')) . "'";
+        $where_clause .= (empty($where_clause) ? 'WHERE' : ' AND') . " __///__ = '" . $db->escapeString(getFormData('filter___///__')) . "'";
     }
 
@@ -425,5 +425,5 @@
         return $list;
     }
-    
+
     // The list was not cached, so issue the real query.
     $qid = $db->query($sql);
@@ -445,5 +445,5 @@
 	$db =& DB::getInstance();
 	$app =& App::getInstance();
-	
+
     if (!is_array($ranks)) {
         $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);
@@ -476,4 +476,2 @@
     }
 }
-
-?>
Index: /trunk/bin/module_maker/skel/public.php
===================================================================
--- /trunk/bin/module_maker/skel/public.php	(revision 467)
+++ /trunk/bin/module_maker/skel/public.php	(revision 468)
@@ -145,3 +145,2 @@
 include 'footer.ihtml';
 
-?>
Index: /trunk/bin/module_maker/sql.cli.php
===================================================================
--- /trunk/bin/module_maker/sql.cli.php	(revision 467)
+++ /trunk/bin/module_maker/sql.cli.php	(revision 468)
@@ -5,5 +5,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -12,10 +12,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -36,5 +36,5 @@
     $db_tbl = $_SERVER['argv'][2];
 } else {
-    die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
+    die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s\n", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
 }
 
@@ -218,3 +218,2 @@
 
 echo isset($op) ? '' : "\n\n\n";
-?>
Index: /trunk/bin/module_maker/validation.cli.php
===================================================================
--- /trunk/bin/module_maker/validation.cli.php	(revision 467)
+++ /trunk/bin/module_maker/validation.cli.php	(revision 468)
@@ -309,3 +309,2 @@
     " . join("\n    ", $o) . "
 }";
-?>
Index: /trunk/docs/codebase_v1-to-v2_upgrade_checklist.txt
===================================================================
--- /trunk/docs/codebase_v1-to-v2_upgrade_checklist.txt	(revision 467)
+++ /trunk/docs/codebase_v1-to-v2_upgrade_checklist.txt	(revision 468)
@@ -1,4 +1,2 @@
-<?php 
-
 =====================================================================
 In General
@@ -8,32 +6,32 @@
 
     include SITE_BASE . '/_templates/header.ihtml';
-    
+
 do this:
 
     include 'header.ihtml';
-    
+
 
 2. CODE_BASE is a defunct constant. The location of the codebase is no longer important as long as it can be found in the currently configured include_path. This will usually include the local site directory (where the codebase normally would be found) as well as the server-wide /usr/lib/php directory where the codebase might be included for the whole server. So now, instead of this:
 
     require_once CODE_BASE . '/lib/Utilities.inc.php';
-    
+
 do this:
 
     require_once 'codebase/lib/Utilities.inc.php';
-    
-    
+
+
 3. $CFG-> variables are gone. Most of these should be converted into their $app and $auth equivalents. If a $CFG variable is NOT something used by the codebase but is still needed by the website application, I suggest converting these values to a $cfg array. For example, this:
 
     $CFG->gallery_images_url = '/gallery_images';
-    
+
 should become:
 
     $cfg['gallery_images_url'] = '/gallery_images';
-    
+
 And of course change the code where they are used to support the array instead of object-properties. If the array is inside of double-quotes it should be written like:
 
-    "{$cfg['gallery_images_url']}/my/path". 
-    
-If the value used is now to be retrieved from a $object->getParam(...) method call, you'll need to do this: 
+    "{$cfg['gallery_images_url']}/my/path".
+
+If the value used is now to be retrieved from a $object->getParam(...) method call, you'll need to do this:
 
     $object->getParam('gallery_images_url') . '/my/path'
@@ -43,9 +41,9 @@
 
     <a href="<?php echo ohref("$CFG->site_url/my/file.php"); ?>">
-    
+
 to this:
 
     <a href="<?php echo $app->ohref("/my/file.php"); ?>">
-    
+
 (In other words, the URL should be a not-fully-qualified URL starting with a slash.)
 
@@ -62,13 +60,13 @@
         '\1' => '\2'
     ));
-    
-    
+
+
 6. Many classes now require object-method calls, and the object must be globally scoped. For example, to call the $cache->exists() method inside a function, be sure to add:
 
     global $cache;
-    
+
 at the top of the function.
 
-    
+
 
 =====================================================================
@@ -80,5 +78,5 @@
 ---------------------------------------------------------------------
 $CFG global variables are converted to object properties specific to their usage.
-    
+
 For example:
 
@@ -98,16 +96,16 @@
 Convert functions to methods.
 
-raiseMsg(...)                           $app->raiseMsg(...) 
-logMsg(...)                             $app->logMsg(...) 
+raiseMsg(...)                           $app->raiseMsg(...)
+logMsg(...)                             $app->logMsg(...)
 include 'message_header.ihtml';         $app->printRaisedMessages();
 $carry_queries = array(... , ...);      $app->carryQuery(...);  //call for each value in array
-ohref(...)                              $app->ohref(...) 
-printHiddenSession(...);                $app->printHiddenSession(...); 
-dieURL(...);                            $app->dieURL(...); 
-dieBoomerangURL(...);                   $app->dieBoomerangURL(...); 
-setBoomerangURL(...);                   $app->setBoomerangURL(...); 
-getBoomerangURL(...);                   $app->getBoomerangURL(...); 
-validBoomerangURL(...);                 $app->validBoomerangURL(...); 
-deleteBoomerangURL(...);                $app->deleteBoomerangURL(...); 
+ohref(...)                              $app->ohref(...)
+printHiddenSession(...);                $app->printHiddenSession(...);
+dieURL(...);                            $app->dieURL(...);
+dieBoomerangURL(...);                   $app->dieBoomerangURL(...);
+setBoomerangURL(...);                   $app->setBoomerangURL(...);
+getBoomerangURL(...);                   $app->getBoomerangURL(...);
+validBoomerangURL(...);                 $app->validBoomerangURL(...);
+deleteBoomerangURL(...);                $app->deleteBoomerangURL(...);
 sslOn();                                $app->sslOn();
 sslOff();                               $app->sslOff();
@@ -121,5 +119,5 @@
 =====================================================================
 DB
-===================================================================== 
+=====================================================================
 
 dbQuery(...)                            $db->query(...)
@@ -209,5 +207,5 @@
 
     $lock = new RecordLock($GLOBALS['_admin']);
-    
+
 to:
 
@@ -215,5 +213,5 @@
     global $auth;
     $lock =& Lock::getInstance($auth);
-     
+
 And instantiate the original global $lock object in _config.inc.php as follows:
 
@@ -236,5 +234,5 @@
 
     $version = new RecordVersion();
-    
+
 to:
 
@@ -250,5 +248,5 @@
 Changed all method calls to now require object calls rather than static calls. In other words, change this:
 
-    if (SessionCache::isCached('mydata')) { 
+    if (SessionCache::isCached('mydata')) {
         $list = SessionCache::getCache('mydata');
     }
@@ -304,5 +302,2 @@
 
 include_once 'form_error_header.ihtml';      $fv->printErrorMessages();
-
-
-?>
Index: /trunk/docs/examples/_config.inc.php
===================================================================
--- /trunk/docs/examples/_config.inc.php	(revision 467)
+++ /trunk/docs/examples/_config.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,15 +11,15 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** 
+/**
  * _config.inc.php lives in the document root of the site/application. It is the beginning of everything.
  *
@@ -28,5 +28,5 @@
  * @since   03 Dec 2005 19:09:32
  */
- 
+
 // The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows.
 // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php';
@@ -39,5 +39,5 @@
 define('COMMON_BASE', realpath(dirname(__FILE__) . '/../'));
 
-// The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the 
+// The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the
 // latter does not change when using the apache Alias directive or URL Rewriting to define a site.
 define('SITE_BASE', dirname(__FILE__));
@@ -148,10 +148,10 @@
 require_once 'codebase/lib/Cache.inc.php';
 $cache = new Cache('global');
-$cache->setParam(array('enabled' => true));
+$cache->setParam(array('enabled' => true)); // TODO: Enable caching after site launch.
 
 // Setup CSS files to include. These will always be available.
 require_once 'codebase/lib/CSS.inc.php';
 $css = new CSS();
-$css->setParam(array('cache_css' => false)); /// Enable caching after site launch.
+$css->setParam(array('cache_css' => false)); // TODO: Enable caching after site launch.
 $css->setFile('codebase/css/codebase.inc.css');
 $css->setFile('codebase/css/utilities.inc.css');
@@ -170,3 +170,2 @@
 // require_once 'global/config.inc.php';
 
-?>
Index: /trunk/docs/examples/contact_form/contact.php
===================================================================
--- /trunk/docs/examples/contact_form/contact.php	(revision 467)
+++ /trunk/docs/examples/contact_form/contact.php	(revision 468)
@@ -119,3 +119,2 @@
 }
 
-?>
Index: /trunk/docs/examples/db_auth.inc.php
===================================================================
--- /trunk/docs/examples/db_auth.inc.php	(revision 467)
+++ /trunk/docs/examples/db_auth.inc.php	(revision 468)
@@ -35,3 +35,2 @@
     'db_pass' => '',
 ));
-?>
Index: /trunk/docs/examples/example.cli.php
===================================================================
--- /trunk/docs/examples/example.cli.php	(revision 467)
+++ /trunk/docs/examples/example.cli.php	(revision 468)
@@ -146,3 +146,2 @@
 
 
-?>
Index: /trunk/docs/examples/script_template.php
===================================================================
--- /trunk/docs/examples/script_template.php	(revision 467)
+++ /trunk/docs/examples/script_template.php	(revision 468)
@@ -60,3 +60,2 @@
 
 
-?>
Index: /trunk/lib/ACL.inc.php
===================================================================
--- /trunk/lib/ACL.inc.php	(revision 467)
+++ /trunk/lib/ACL.inc.php	(revision 468)
@@ -39,7 +39,9 @@
 class ACL {
 
+    // A place to keep an object instance for the singleton pattern.
+    private static $instance = null;
+
     // Configuration parameters for this object.
-    var $_params = array(
-
+    private $_params = array(
         // If false nothing will be cached or retrieved. Useful for testing realtime data requests.
         'enable_cache' => true,
@@ -52,5 +54,5 @@
      * Constructor.
      */
-    function ACL()
+    public function __construct()
     {
 		$app =& App::getInstance();
@@ -73,13 +75,11 @@
      * @static
      */
-    static function &getInstance()
-    {
-        static $instance = null;
-
-        if ($instance === null) {
-            $instance = new ACL();
-        }
-
-        return $instance;
+    public static function &getInstance()
+    {
+        if (self::$instance === null) {
+            self::$instance = new self();
+        }
+
+        return self::$instance;
     }
 
@@ -91,5 +91,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -110,5 +110,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -129,5 +129,5 @@
      * @since   04 Jun 2006 16:41:42
      */
-    function initDB($recreate_db=false)
+    public function initDB($recreate_db=false)
     {
 		$app =& App::getInstance();
@@ -224,5 +224,5 @@
     * @since    14 Jun 2006 22:39:29
     */
-    function add($name, $parent=null, $type)
+    public function add($name, $parent=null, $type)
     {
         $app =& App::getInstance();
@@ -287,13 +287,13 @@
 
     // Alias functions for the different object types.
-    function addRequestObject($name, $parent=null)
+    public function addRequestObject($name, $parent=null)
     {
         return $this->add($name, $parent, 'aro');
     }
-    function addControlObject($name, $parent=null)
+    public function addControlObject($name, $parent=null)
     {
         return $this->add($name, $parent, 'aco');
     }
-    function addXtraObject($name, $parent=null)
+    public function addXtraObject($name, $parent=null)
     {
         return $this->add($name, $parent, 'axo');
@@ -311,5 +311,5 @@
     * @since    14 Jun 2006 22:39:29
     */
-    function remove($name, $type)
+    public function remove($name, $type)
     {
         $app =& App::getInstance();
@@ -368,13 +368,13 @@
 
     // Alias functions for the different object types.
-    function removeRequestObject($name)
+    public function removeRequestObject($name)
     {
         return $this->remove($name, 'aro');
     }
-    function removeControlObject($name)
+    public function removeControlObject($name)
     {
         return $this->remove($name, 'aco');
     }
-    function removeXtraObject($name)
+    public function removeXtraObject($name)
     {
         return $this->remove($name, 'axo');
@@ -393,5 +393,5 @@
     * @since    14 Jun 2006 22:39:29
     */
-    function move($name, $new_parent, $type)
+    public function move($name, $new_parent, $type)
     {
         $app =& App::getInstance();
@@ -490,13 +490,13 @@
 
     // Alias functions for the different object types.
-    function moveRequestObject($name, $new_parent=null)
+    public function moveRequestObject($name, $new_parent=null)
     {
         return $this->move($name, $new_parent, 'aro');
     }
-    function moveControlObject($name, $new_parent=null)
+    public function moveControlObject($name, $new_parent=null)
     {
         return $this->move($name, $new_parent, 'aco');
     }
-    function moveXtraObject($name, $new_parent=null)
+    public function moveXtraObject($name, $new_parent=null)
     {
         return $this->move($name, $new_parent, 'axo');
@@ -516,5 +516,5 @@
     * @since    15 Jun 2006 01:58:48
     */
-    function grant($aro=null, $aco=null, $axo=null, $access='allow')
+    public function grant($aro=null, $aco=null, $axo=null, $access='allow')
     {
         $app =& App::getInstance();
@@ -573,5 +573,5 @@
     * @since    15 Jun 2006 04:35:54
     */
-    function revoke($aro=null, $aco=null, $axo=null)
+    public function revoke($aro=null, $aco=null, $axo=null)
     {
         return $this->grant($aro, $aco, $axo, 'deny');
@@ -591,5 +591,5 @@
     * @since    20 Jun 2006 20:16:12
     */
-    function delete($aro=null, $aco=null, $axo=null)
+    public function delete($aro=null, $aco=null, $axo=null)
     {
         $app =& App::getInstance();
@@ -650,5 +650,5 @@
     * @since    15 Jun 2006 03:58:23
     */
-    function check($aro, $aco=null, $axo=null)
+    public function check($aro, $aco=null, $axo=null)
     {
         $app =& App::getInstance();
@@ -713,5 +713,5 @@
     * @since    20 Jan 2014 12:09:03
     */
-    function requireAllow($aro, $aco=null, $axo=null, $message='', $type=MSG_NOTICE, $file=null, $line=null)
+    public function requireAllow($aro, $aco=null, $axo=null, $message='', $type=MSG_NOTICE, $file=null, $line=null)
     {
 		$app =& App::getInstance();
@@ -725,5 +725,2 @@
 
 } // End class.
-
-
-?>
Index: /trunk/lib/App.inc.php
===================================================================
--- /trunk/lib/App.inc.php	(revision 467)
+++ /trunk/lib/App.inc.php	(revision 468)
@@ -42,21 +42,24 @@
 class App {
 
+    // A place to keep an object instance for the singleton pattern.
+    private static $instance = null;
+
     // Namespace of this application instance.
-    var $_ns;
+    private $_ns;
 
     // If $app->start has run successfully.
-    var $running = false;
+    public $running = false;
 
     // Instance of database object.
-    var $db;
+    public $db;
 
     // Array of query arguments will be carried persistently between requests.
-    var $_carry_queries = array();
+    private $_carry_queries = array();
 
     // Dictionary of global application parameters.
-    var $_params = array();
+    private $_params = array();
 
     // Default parameters.
-    var $_param_defaults = array(
+    private $_param_defaults = array(
 
         // Public name and email address for this application.
@@ -162,4 +165,21 @@
 
     /**
+     * Constructor.
+     */
+    public function __construct($namespace='')
+    {
+        // Set namespace of application instance.
+        $this->_ns = $namespace;
+
+        // Initialize default parameters.
+        $this->_params = array_merge($this->_params, $this->_param_defaults);
+
+        // Begin timing script.
+        require_once dirname(__FILE__) . '/ScriptTimer.inc.php';
+        $this->timer = new ScriptTimer();
+        $this->timer->start('_app');
+    }
+
+    /**
      * This method enforces the singleton pattern for this class. Only one application is running at a time.
      *
@@ -169,30 +189,12 @@
      * @static
      */
-    static function &getInstance($namespace='')
-    {
-        static $instance = null;
-
-        if ($instance === null) {
-            $instance = new App($namespace);
-        }
-
-        return $instance;
-    }
-
-    /**
-     * Constructor.
-     */
-    function App($namespace='')
-    {
-        // Set namespace of application instance.
-        $this->_ns = $namespace;
-
-        // Initialize default parameters.
-        $this->_params = array_merge($this->_params, $this->_param_defaults);
-
-        // Begin timing script.
-        require_once dirname(__FILE__) . '/ScriptTimer.inc.php';
-        $this->timer = new ScriptTimer();
-        $this->timer->start('_app');
+    public static function &getInstance($namespace='')
+    {
+        if (self::$instance === null) {
+            // TODO: Yep, having a namespace with one singletone instance is not very useful.
+            self::$instance = new self($namespace);
+        }
+
+        return self::$instance;
     }
 
@@ -203,5 +205,5 @@
      * @param  array    $param     Array of parameters (key => val pairs).
      */
-    function setParam($param=null)
+    public function setParam($param=null)
     {
         if (isset($param) && is_array($param)) {
@@ -218,5 +220,5 @@
      * @return  mixed               Parameter value, or null if not existing.
      */
-    function getParam($param=null)
+    public function getParam($param=null)
     {
         if ($param === null) {
@@ -225,5 +227,4 @@
             return $this->_params[$param];
         } else {
-            trigger_error(sprintf('Parameter is not set: %s', $param), E_USER_NOTICE);
             return null;
         }
@@ -237,5 +238,5 @@
      * @since   15 Jul 2005 00:32:21
      */
-    function start()
+    public function start()
     {
         if ($this->running) {
@@ -275,14 +276,14 @@
 
             // DB connection parameters taken from environment variables in the httpd.conf file, readable only by root.
-            if (!empty($_SERVER['DB_SERVER'])) {
+            if (!empty($_SERVER['DB_SERVER']) && !$this->getParam('db_server')) {
                 $this->setParam(array('db_server' => $_SERVER['DB_SERVER']));
             }
-            if (!empty($_SERVER['DB_NAME'])) {
+            if (!empty($_SERVER['DB_NAME']) && !$this->getParam('db_name')) {
                 $this->setParam(array('db_name' => $_SERVER['DB_NAME']));
             }
-            if (!empty($_SERVER['DB_USER'])) {
+            if (!empty($_SERVER['DB_USER']) && !$this->getParam('db_user')) {
                 $this->setParam(array('db_user' => $_SERVER['DB_USER']));
             }
-            if (!empty($_SERVER['DB_PASS'])) {
+            if (!empty($_SERVER['DB_PASS']) && !$this->getParam('db_pass')) {
                 $this->setParam(array('db_pass' => $_SERVER['DB_PASS']));
             }
@@ -394,8 +395,7 @@
      * @since   17 Jul 2005 17:20:18
      */
-    function stop()
+    public function stop()
     {
         session_write_close();
-        restore_include_path();
         $this->running = false;
         $num_queries = 0;
@@ -423,5 +423,5 @@
      * @param string $line    __LINE__.
      */
-    function raiseMsg($message, $type=MSG_NOTICE, $file=null, $line=null)
+    public function raiseMsg($message, $type=MSG_NOTICE, $file=null, $line=null)
     {
         $message = trim($message);
@@ -465,5 +465,5 @@
      * @since   21 Dec 2005 13:09:20
      */
-    function getRaisedMessages()
+    public function getRaisedMessages()
     {
         if (!$this->running) {
@@ -471,5 +471,4 @@
             return false;
         }
-
         return isset($_SESSION['_app'][$this->_ns]['messages']) ? $_SESSION['_app'][$this->_ns]['messages'] : array();
     }
@@ -482,5 +481,5 @@
      * @since   21 Dec 2005 13:21:54
      */
-    function clearRaisedMessages()
+    public function clearRaisedMessages()
     {
         if (!$this->running) {
@@ -503,6 +502,7 @@
      * @since   15 Jul 2005 01:39:14
      */
-    function printRaisedMessages($above='', $below='', $print_gotohash_js=false, $hash='sc-msg')
-    {
+    public function printRaisedMessages($above='', $below='', $print_gotohash_js=false, $hash='sc-msg')
+    {
+
         if (!$this->running) {
             $this->logMsg(sprintf('Canceled method call %s, application not running.', __FUNCTION__), LOG_NOTICE, __FILE__, __LINE__);
@@ -576,5 +576,5 @@
      * @param string $line      The line of the file where the log event occurs.
      */
-    function logMsg($message, $priority=LOG_INFO, $file=null, $line=null)
+    public function logMsg($message, $priority=LOG_INFO, $file=null, $line=null)
     {
         static $previous_events = array();
@@ -690,5 +690,5 @@
         // SCREEN ACTION
         if (false !== $this->getParam('log_screen_priority') && $priority <= $this->getParam('log_screen_priority')) {
-            echo "[{$event['type']}] [{$event['message']}]\n";
+            file_put_contents('php://stderr', "[{$event['type']}] [{$event['message']}]\n", FILE_APPEND);
         }
 
@@ -706,5 +706,5 @@
      * @return                The string representation of $priority.
      */
-    function logPriorityToString($priority) {
+    public function logPriorityToString($priority) {
         $priorities = array(
             LOG_EMERG   => 'emergency',
@@ -735,5 +735,5 @@
      * @since   13 Oct 2007 11:34:51
      */
-    function setQuery($query_key, $val)
+    public function setQuery($query_key, $val)
     {
         if (!is_array($query_key)) {
@@ -757,5 +757,5 @@
      * @since   14 Nov 2005 19:24:52
      */
-    function carryQuery($query_key, $default=false)
+    public function carryQuery($query_key, $default=false)
     {
         if (!is_array($query_key)) {
@@ -782,5 +782,5 @@
      * @since   18 Jun 2007 20:57:29
      */
-    function dropQuery($query_key, $unset=false)
+    public function dropQuery($query_key, $unset=false)
     {
         if (!is_array($query_key)) {
@@ -818,5 +818,5 @@
      * @return string url with attached queries and, if not using cookies, the session id
      */
-    function url($url, $carry_args=null, $always_include_sid=false)
+    public function url($url, $carry_args=null, $always_include_sid=false)
     {
         if (!$this->running) {
@@ -909,5 +909,5 @@
      * @since   09 Dec 2005 17:58:45
      */
-    function oHREF($url, $carry_args=null, $always_include_sid=false)
+    public function oHREF($url, $carry_args=null, $always_include_sid=false)
     {
         $url = $this->url($url, $carry_args, $always_include_sid);
@@ -929,5 +929,5 @@
      *                                      false  <-- To not carry any queries. If URL already has queries those will be retained.
      */
-    function printHiddenSession($carry_args=null)
+    public function printHiddenSession($carry_args=null)
     {
         if (!$this->running) {
@@ -995,5 +995,5 @@
      * @param   bool    $always_include_sid     Force session id to be added to Location header.
      */
-    function dieURL($url, $carry_args=null, $always_include_sid=false)
+    public function dieURL($url, $carry_args=null, $always_include_sid=false)
     {
         if (!$this->running) {
@@ -1042,5 +1042,5 @@
     * @since    31 Mar 2006 19:17:00
     */
-    function dieBoomerangURL($id=null, $carry_args=null, $default_url=null, $queryless_referrer_comparison=false)
+    public function dieBoomerangURL($id=null, $carry_args=null, $default_url=null, $queryless_referrer_comparison=false)
     {
         if (!$this->running) {
@@ -1085,5 +1085,5 @@
      * FIXME: url garbage collection?
      */
-    function setBoomerangURL($url=null, $id=null)
+    public function setBoomerangURL($url=null, $id=null)
     {
         if (!$this->running) {
@@ -1093,5 +1093,4 @@
         // A redirection will never happen immediately after setting the boomerangURL.
         // Set the time so ensure this doesn't happen. See $app->validBoomerangURL for more.
-        /// FIXME: Why isn't the time set here under setBoomerangURL() and only under dieBoomerangURL()?
 
         if ('' != $url && is_string($url)) {
@@ -1124,5 +1123,5 @@
      * @param string  $id     An identification tag for this url.
      */
-    function getBoomerangURL($id=null)
+    public function getBoomerangURL($id=null)
     {
         if (!$this->running) {
@@ -1149,5 +1148,5 @@
      * @param string  $id     An identification tag for this url.
      */
-    function deleteBoomerangURL($id=null)
+    public function deleteBoomerangURL($id=null)
     {
         if (!$this->running) {
@@ -1171,5 +1170,5 @@
      * @return bool  True if it is set and valid, false otherwise.
      */
-    function validBoomerangURL($id=null, $use_nonspecificboomerang=false)
+    public function validBoomerangURL($id=null, $use_nonspecificboomerang=false)
     {
         if (!$this->running) {
@@ -1221,5 +1220,5 @@
      * the same page but with https.
      */
-    function sslOn()
+    public function sslOn()
     {
         if (function_exists('apache_get_modules')) {
@@ -1242,5 +1241,5 @@
      * a http version of the current url.
      */
-    function sslOff()
+    public function sslOff()
     {
         if ('' != getenv('HTTPS')) {
@@ -1248,7 +1247,3 @@
         }
     }
-
-
 } // End.
-
-?>
Index: /trunk/lib/Auth_File.inc.php
===================================================================
--- /trunk/lib/Auth_File.inc.php	(revision 467)
+++ /trunk/lib/Auth_File.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,15 +11,15 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/**
+/*
  * Auth_File.inc.php
  *
@@ -30,5 +30,5 @@
  * @version 1.2
  */
- 
+
 // Usage example:
 // $auth = new Auth_File();
@@ -40,24 +40,24 @@
 // ));
 
-// Available encryption types for class Auth_SQL.
-define('AUTH_ENCRYPT_MD5', 'md5');
-define('AUTH_ENCRYPT_CRYPT', 'crypt');
-define('AUTH_ENCRYPT_SHA1', 'sha1');
-define('AUTH_ENCRYPT_PLAINTEXT', 'plaintext');
-
 class Auth_File {
-    
+
+    // Available encryption types for class Auth_File.
+    const ENCRYPT_MD5 = 'md5';
+    const ENCRYPT_CRYPT = 'crypt';
+    const ENCRYPT_SHA1 = 'sha1';
+    const ENCRYPT_PLAINTEXT = 'plaintext';
+
     // Namespace of this auth object.
-    var $_ns;
-    
+    private $_ns;
+
     // Parameters to be specified by setParam().
-    var $_params = array();
-    var $_default_params = array(
-        
+    private $_params = array();
+    private $_default_params = array(
+
         // Full path to htpasswd file.
         'htpasswd_file' => null,
 
-        // The type of encryption to use for passwords stored in the db_table. Use one of the AUTH_ENCRYPT_* types specified above.
-        'encryption_type' => AUTH_ENCRYPT_CRYPT,
+        // The type of encryption to use for passwords stored in the db_table. Use one of the self::ENCRYPT_* types specified above.
+        'encryption_type' => self::ENCRYPT_CRYPT,
 
         // The URL to the login script.
@@ -77,14 +77,14 @@
 
     // Associative array of usernames to hashed passwords.
-    var $_users = array();
-
-    /**
-     * Constructs a new htpasswd authentication object.
-     *
-     * @access public
-     *
-     * @param optional array $params  A hash containing parameters.
-     */
-    function Auth_File($namespace='')
+    private $_users = array();
+
+    /*
+    * Constructs a new htpasswd authentication object.
+    *
+    * @access public
+    *
+    * @param optional array $params  A hash containing parameters.
+    */
+    public function __construct($namespace='')
     {
         $this->_ns = $namespace;
@@ -94,11 +94,11 @@
     }
 
-    /**
-     * Set the params of an auth object.
-     *
-     * @param  array $params   Array of parameter keys and value to set.
-     * @return bool true on success, false on failure
-     */
-    function setParam($params)
+    /*
+    * Set the params of an auth object.
+    *
+    * @param  array $params   Array of parameter keys and value to set.
+    * @return bool true on success, false on failure
+    */
+    public function setParam($params)
     {
         if (isset($params) && is_array($params)) {
@@ -108,15 +108,15 @@
     }
 
-    /**
-     * Return the value of a parameter, if it exists.
-     *
-     * @access public
-     * @param string $param        Which parameter to return.
-     * @return mixed               Configured parameter value.
-     */
-    function getParam($param)
-    {
-		$app =& App::getInstance();
-    
+    /*
+    * Return the value of a parameter, if it exists.
+    *
+    * @access public
+    * @param string $param        Which parameter to return.
+    * @return mixed               Configured parameter value.
+    */
+    public function getParam($param)
+    {
+        $app = &App::getInstance();
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -127,23 +127,22 @@
     }
 
-    /**
-     * Clear any authentication tokens in the current session. A.K.A. logout.
-     *
-     * @access public
-     */
-    function clear()
+    /*
+    * Clear any authentication tokens in the current session. A.K.A. logout.
+    *
+    * @access public
+    */
+    public function clear()
     {
         $_SESSION['_auth_file'][$this->_ns] = array('authenticated' => false);
     }
 
-
-    /**
-     * Sets a variable into a registered auth session.
-     *
-     * @access public
-     * @param mixed $key      Which value to set.
-     * @param mixed $val      Value to set variable to.
-     */
-    function set($key, $val)
+    /*
+    * Sets a variable into a registered auth session.
+    *
+    * @access public
+    * @param mixed $key      Which value to set.
+    * @param mixed $val      Value to set variable to.
+    */
+    public function set($key, $val)
     {
         if (!isset($_SESSION['_auth_file'][$this->_ns]['user_data'])) {
@@ -153,13 +152,13 @@
     }
 
-    /**
-     * Returns a specified value from a registered auth session.
-     *
-     * @access public
-     * @param mixed $key      Which value to return.
-     * @param mixed $default  Value to return if key not found in user_data.
-     * @return mixed          Value stored in session.
-     */
-    function get($key, $default='')
+    /*
+    * Returns a specified value from a registered auth session.
+    *
+    * @access public
+    * @param mixed $key      Which value to return.
+    * @param mixed $default  Value to return if key not found in user_data.
+    * @return mixed          Value stored in session.
+    */
+    public function get($key, $default='')
     {
         if (isset($_SESSION['_auth_file'][$this->_ns][$key])) {
@@ -171,24 +170,25 @@
         }
     }
-    /**
-     * Find out if a set of login credentials are valid. Only supports
-     * htpasswd files with DES passwords right now.
-     *
-     * @access public
-     *
-     * @param string $username      The username to check.
-     * @param array $password      The password to compare to username.
-     *
-     * @return boolean  Whether or not the credentials are valid.
-     */
-    function authenticate($username, $password)
-    {
-		$app =& App::getInstance();
-    
+
+    /*
+    * Find out if a set of login credentials are valid. Only supports
+    * htpasswd files with DES passwords right now.
+    *
+    * @access public
+    *
+    * @param string $username      The username to check.
+    * @param array $password      The password to compare to username.
+    *
+    * @return boolean  Whether or not the credentials are valid.
+    */
+    public function authenticate($username, $password)
+    {
+        $app = &App::getInstance();
+
         if ('' == trim($password)) {
             $app->logMsg(_("No password provided for authentication."), LOG_INFO, __FILE__, __LINE__);
             return false;
         }
-        
+
         // Load users file.
         $this->_loadHTPasswdFile();
@@ -203,20 +203,20 @@
             return false;
         }
-        
+
         // Authentication successful!
         return true;
     }
 
-    /**
-     * If user passes authentication create authenticated session.
-     *
-     * @access public
-     *
-     * @param string $username     The username to check.
-     * @param array $password     The password to compare to username.
-     *
-     * @return boolean  Whether or not the credentials are valid.
-     */
-    function login($username, $password)
+    /*
+    * If user passes authentication create authenticated session.
+    *
+    * @access public
+    *
+    * @param string $username     The username to check.
+    * @param array $password     The password to compare to username.
+    *
+    * @return boolean  Whether or not the credentials are valid.
+    */
+    public function login($username, $password)
     {
         $username = mb_strtolower(trim($username));
@@ -228,5 +228,5 @@
             return false;
         }
-        
+
         $_SESSION['_auth_file'][$this->_ns] = array(
             'authenticated' => true,
@@ -241,18 +241,18 @@
     }
 
-    /**
-     * Test if user has a currently logged-in session.
-     *  - authentication flag set to true
-     *  - username not empty
-     *  - total logged-in time is not greater than login_timeout
-     *  - idle time is not greater than idle_timeout
-     *  - remote address is the same as the login remote address.
-     *
-     * @access public
-     */
-    function isLoggedIn()
-    {
-		$app =& App::getInstance();
-    
+    /*
+    * Test if user has a currently logged-in session.
+    *  - authentication flag set to true
+    *  - username not empty
+    *  - total logged-in time is not greater than login_timeout
+    *  - idle time is not greater than idle_timeout
+    *  - remote address is the same as the login remote address.
+    *
+    * @access public
+    */
+    public function isLoggedIn()
+    {
+        $app = &App::getInstance();
+
         // Some users will access from networks with a changing IP number (i.e. behind a proxy server). These users must be allowed entry by adding their IP to the list of trusted_networks.
         if ($trusted_net = ipInRange(getRemoteAddr(), $this->_params['trusted_networks'])) {
@@ -268,9 +268,9 @@
         // Test login with information stored in session. Skip IP matching for users from trusted networks.
         if (isset($_SESSION['_auth_file'][$this->_ns])
-            && true === $_SESSION['_auth_file'][$this->_ns]['authenticated']
-            && !empty($_SESSION['_auth_file'][$this->_ns]['username'])
-            && strtotime($_SESSION['_auth_file'][$this->_ns]['login_datetime']) > time() - $this->_params['login_timeout']
-            && strtotime($_SESSION['_auth_file'][$this->_ns]['last_access_datetime']) > time() - $this->_params['idle_timeout']
-            && ($_SESSION['_auth_file'][$this->_ns]['remote_ip'] == getRemoteAddr() || $user_in_trusted_network)
+        && true === $_SESSION['_auth_file'][$this->_ns]['authenticated']
+        && !empty($_SESSION['_auth_file'][$this->_ns]['username'])
+        && strtotime($_SESSION['_auth_file'][$this->_ns]['login_datetime']) > time() - $this->_params['login_timeout']
+        && strtotime($_SESSION['_auth_file'][$this->_ns]['last_access_datetime']) > time() - $this->_params['idle_timeout']
+        && ($_SESSION['_auth_file'][$this->_ns]['remote_ip'] == getRemoteAddr() || $user_in_trusted_network)
         ) {
             // User is authenticated!
@@ -303,18 +303,18 @@
     }
 
-    /**
-     * Redirect user to login page if they are not logged in.
-     *
-     * @param string $message The text description of a message to raise.
-     * @param int    $type    The type of message: MSG_NOTICE,
-     *                        MSG_SUCCESS, MSG_WARNING, or MSG_ERR.
-     * @param string $file    __FILE__.
-     * @param string $line    __LINE__.
-     * @access public
-     */
-    function requireLogin($message='', $type=MSG_NOTICE, $file=null, $line=null)
-    {
-		$app =& App::getInstance();
-    
+    /*
+    * Redirect user to login page if they are not logged in.
+    *
+    * @param string $message The text description of a message to raise.
+    * @param int    $type    The type of message: MSG_NOTICE,
+    *                        MSG_SUCCESS, MSG_WARNING, or MSG_ERR.
+    * @param string $file    __FILE__.
+    * @param string $line    __LINE__.
+    * @access public
+    */
+    public function requireLogin($message='', $type=MSG_NOTICE, $file=null, $line=null)
+    {
+        $app = &App::getInstance();
+
         if (!$this->isLoggedIn()) {
             // Display message for requiring login. (RaiseMsg will ignore empty strings.)
@@ -326,13 +326,12 @@
         }
     }
-    
-    /**
-     * Wrapper function for compatibility with lib/Lock.inc.php.
-     *
-     * @param  string  $username    Username to return.
-     * @return string               Username, or false if none found.
-     */
-    function getUsername($username)
-    {
+
+    /*
+    * Wrapper function for compatibility with lib/Lock.inc.php.
+    *
+    * @param  string  $username    Username to return.
+    * @return string               Username, or false if none found.
+    */
+    public function getUsername($username) {
         if ('' != $username) {
             return $username;
@@ -351,15 +350,15 @@
     * @since    18 Apr 2006 18:17:48
     */
-    function _loadHTPasswdFile()
-    {
-		$app =& App::getInstance();
-    
+    private function _loadHTPasswdFile()
+    {
+        $app = &App::getInstance();
+
         static $users = null;
-        
+
         if (!file_exists($this->_params['htpasswd_file'])) {
             $app->logMsg(sprintf('htpasswd file missing or not specified: %s', $this->_params['htpasswd_file']), LOG_ERR, __FILE__, __LINE__);
             return false;
         }
-        
+
         if (!isset($users)) {
             if (false === ($users = file($this->_params['htpasswd_file']))) {
@@ -379,29 +378,29 @@
     }
 
-    /**
-     * Hash a given password according to the configured encryption
-     * type.
-     *
-     * @param string $password              The password to encrypt.
-     * @param string $encrypted_password    The currently encrypted password to use as salt, if needed.
-     *
-     * @return string  The hashed password.
-     */
-    function _encrypt($password, $encrypted_password=null)
+    /*
+    * Hash a given password according to the configured encryption
+    * type.
+    *
+    * @param string $password              The password to encrypt.
+    * @param string $encrypted_password    The currently encrypted password to use as salt, if needed.
+    *
+    * @return string  The hashed password.
+    */
+    private function _encrypt($password, $encrypted_password=null)
     {
         switch ($this->_params['encryption_type']) {
-        case AUTH_ENCRYPT_PLAINTEXT :
+        case self::ENCRYPT_PLAINTEXT :
             return $password;
             break;
 
-        case AUTH_ENCRYPT_SHA1 :
+        case self::ENCRYPT_SHA1 :
             return sha1($password);
             break;
 
-        case AUTH_ENCRYPT_MD5 :
+        case self::ENCRYPT_MD5 :
             return md5($password);
             break;
 
-        case AUTH_ENCRYPT_CRYPT :
+        case self::ENCRYPT_CRYPT :
         default :
             return crypt($password, $encrypted_password);
@@ -411,3 +410,2 @@
 
 } // end class
-?>
Index: /trunk/lib/Auth_SQL.inc.php
===================================================================
--- /trunk/lib/Auth_SQL.inc.php	(revision 467)
+++ /trunk/lib/Auth_SQL.inc.php	(revision 468)
@@ -28,25 +28,25 @@
 */
 
-// Available encryption types for class Auth_SQL.
-define('AUTH_ENCRYPT_PLAINTEXT', 1);
-define('AUTH_ENCRYPT_CRYPT', 2);
-define('AUTH_ENCRYPT_SHA1', 3);
-define('AUTH_ENCRYPT_SHA1_HARDENED', 4);
-define('AUTH_ENCRYPT_MD5', 5);
-define('AUTH_ENCRYPT_MD5_HARDENED', 6);
-
 require_once dirname(__FILE__) . '/Email.inc.php';
 
 class Auth_SQL {
 
+    // Available encryption types for class Auth_SQL.
+    const ENCRYPT_PLAINTEXT = 1;
+    const ENCRYPT_CRYPT = 2;
+    const ENCRYPT_SHA1 = 3;
+    const ENCRYPT_SHA1_HARDENED = 4;
+    const ENCRYPT_MD5 = 5;
+    const ENCRYPT_MD5_HARDENED = 6;
+
     // Namespace of this auth object.
-    var $_ns;
+    private $_ns;
 
     // Static var for test.
-    var $_authentication_tested;
+    private $_authentication_tested;
 
     // Parameters to be configured by setParam.
-    var $_params = array();
-    var $_default_params = array(
+    private $_params = array();
+    private $_default_params = array(
 
         // Automatically create table and verify columns. Better set to false after site launch.
@@ -66,8 +66,8 @@
         'db_login_table' => 'user_login_tbl',
 
-        // The type of encryption to use for passwords stored in the db_table. Use one of the AUTH_ENCRYPT_* types specified above.
+        // The type of encryption to use for passwords stored in the db_table. Use one of the Auth_SQL::ENCRYPT_* types specified above.
         // Hardened password hashes rely on the same key/salt being used to compare encryptions.
         // Be aware that when using one of the hardened types the App signing_key or $more_salt below cannot change!
-        'encryption_type' => AUTH_ENCRYPT_MD5,
+        'encryption_type' => self::ENCRYPT_MD5,
 
         // The URL to the login script.
@@ -127,5 +127,5 @@
      * @param optional array $params  A hash containing parameters.
      */
-    function Auth_SQL($namespace='')
+    public function __construct($namespace='')
     {
 		$app =& App::getInstance();
@@ -153,5 +153,5 @@
      * @since   26 Aug 2005 17:09:36
      */
-    function initDB($recreate_db=false)
+    public function initDB($recreate_db=false)
     {
 		$app =& App::getInstance();
@@ -253,5 +253,5 @@
      * @return bool true on success, false on failure
      */
-    function setParam($params)
+    public function setParam($params)
     {
         if (isset($params['match_remote_ip_exempt_usernames'])) {
@@ -274,5 +274,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -291,5 +291,5 @@
      * @access public
      */
-    function clear()
+    public function clear()
     {
 		$db =& DB::getInstance();
@@ -326,5 +326,5 @@
      * @param mixed $val      Value to set variable to.
      */
-    function set($key, $val)
+    public function set($key, $val)
     {
         if (!isset($_SESSION['_auth_sql'][$this->_ns]['user_data'])) {
@@ -342,5 +342,5 @@
      * @return mixed          Value stored in session.
      */
-    function get($key, $default='')
+    public function get($key, $default='')
     {
         if (isset($_SESSION['_auth_sql'][$this->_ns][$key])) {
@@ -361,5 +361,5 @@
      * @return mixed  False if credentials not found in DB, or returns DB row matching credentials.
      */
-    function authenticate($username, $password)
+    public function authenticate($username, $password)
     {
 		$app =& App::getInstance();
@@ -369,5 +369,5 @@
 
         switch ($this->_params['encryption_type']) {
-        case AUTH_ENCRYPT_CRYPT :
+        case self::ENCRYPT_CRYPT :
             // Query DB for user matching credentials. Compare cyphertext with salted-encrypted password.
             $qid = $db->query("
@@ -378,7 +378,7 @@
             ");
             break;
-        case AUTH_ENCRYPT_PLAINTEXT :
-        case AUTH_ENCRYPT_MD5 :
-        case AUTH_ENCRYPT_SHA1 :
+        case self::ENCRYPT_PLAINTEXT :
+        case self::ENCRYPT_MD5 :
+        case self::ENCRYPT_SHA1 :
         default :
             // Query DB for user matching credentials. Directly compare cyphertext with result from encryptPassword().
@@ -412,5 +412,5 @@
      * @return boolean  Whether or not the credentials are valid.
      */
-    function login($username, $password)
+    public function login($username, $password)
     {
 		$app =& App::getInstance();
@@ -421,5 +421,5 @@
         $this->clear();
 
-        if (!$user_data = $this->authenticate($username, $password)) {
+        if (!($user_data = $this->authenticate($username, $password))) {
             // No login: failed authentication!
             return false;
@@ -539,5 +539,5 @@
      * @access public
      */
-    function isLoggedIn($user_id=null)
+    public function isLoggedIn($user_id=null)
     {
 		$app =& App::getInstance();
@@ -671,5 +671,5 @@
      * @access public
      */
-    function requireLogin($message='', $type=MSG_NOTICE, $file=null, $line=null)
+    public function requireLogin($message='', $type=MSG_NOTICE, $file=null, $line=null)
     {
 		$app =& App::getInstance();
@@ -693,5 +693,5 @@
      * @param  string   $reason      The reason for blocking the account.
      */
-    function blockAccount($user_id=null, $reason='')
+    public function blockAccount($user_id=null, $reason='')
     {
 		$app =& App::getInstance();
@@ -723,5 +723,5 @@
      * @return boolean              True if the user is blocked, false otherwise.
      */
-    function isBlocked($user_id=null)
+    public function isBlocked($user_id=null)
     {
     	$db =& DB::getInstance();
@@ -745,5 +745,5 @@
      * Unblocks a user in the db_table, and clears any blocked_reason.
      */
-    function unblockAccount($user_id=null)
+    public function unblockAccount($user_id=null)
     {
 		$db =& DB::getInstance();
@@ -769,5 +769,5 @@
      * @return bool                 True if username exists.
      */
-    function usernameExists($username)
+    public function usernameExists($username)
     {
 		$db =& DB::getInstance();
@@ -789,5 +789,5 @@
      * @return string               Username, or false if none found.
      */
-    function getUsername($user_id)
+    public function getUsername($user_id)
     {
 		$db =& DB::getInstance();
@@ -813,15 +813,15 @@
      * patterns, at minimum the US State Department standard: cvcddcvc.
      *
-     * - x    a random upper or lower alpha character or digit
-     * - C    a random upper or lower consonant
-     * - V    a random upper or lower vowel
-     * - c    a random lowercase consonant
-     * - v    a random lowercase vowel
-     * - d    a random digit
+     * - x    A random upper or lower character, digit, or punctuation.
+     * - C    A random upper or lower consonant.
+     * - V    A random upper or lower vowel.
+     * - c    A random lowercase consonant.
+     * - v    A random lowercase vowel.
+     * - d    A random digit.
      *
      * @param  string $pattern  a sequence of character types, above.
      * @return string           a password
      */
-    function generatePassword($pattern='CvcdCvc')
+    public function generatePassword($pattern='CvcdCvc')
     {
         $app =& App::getInstance();
@@ -846,5 +846,5 @@
      *
      */
-    function encryptPassword($password, $salt=null)
+    public function encryptPassword($password, $salt=null)
     {
         $app =& App::getInstance();
@@ -855,18 +855,18 @@
 
         switch ($this->_params['encryption_type']) {
-        case AUTH_ENCRYPT_PLAINTEXT :
+        case self::ENCRYPT_PLAINTEXT :
             return $password;
             break;
 
-        case AUTH_ENCRYPT_CRYPT :
+        case self::ENCRYPT_CRYPT :
             // If comparing plaintext password with a hash, provide first two chars of the hash as the salt.
             return isset($salt) ? crypt($password, mb_substr($salt, 0, 2)) : crypt($password);
             break;
 
-        case AUTH_ENCRYPT_SHA1 :
+        case self::ENCRYPT_SHA1 :
             return sha1($password);
             break;
 
-        case AUTH_ENCRYPT_SHA1_HARDENED :
+        case self::ENCRYPT_SHA1_HARDENED :
             $hash = sha1($app->getParam('signing_key') . $password . $more_salt);
             // Increase key strength by 12 bits.
@@ -877,9 +877,9 @@
             break;
 
-        case AUTH_ENCRYPT_MD5 :
+        case self::ENCRYPT_MD5 :
             return md5($password);
             break;
 
-        case AUTH_ENCRYPT_MD5_HARDENED :
+        case self::ENCRYPT_MD5_HARDENED :
             // Include salt to improve hash
             $hash = md5($app->getParam('signing_key') . $password . $more_salt);
@@ -901,5 +901,5 @@
      *
      */
-    function setPassword($user_id=null, $password)
+    public function setPassword($user_id=null, $password)
     {
 		$app =& App::getInstance();
@@ -951,5 +951,5 @@
      * @return string            The user's new password.
      */
-    function resetPassword($user_id=null, $reason='')
+    public function resetPassword($user_id=null, $reason='')
     {
 		$app =& App::getInstance();
@@ -1016,7 +1016,6 @@
      * @return bool     true if user is a member of security zone, false otherwise
      */
-    function inClearanceZone($security_zone, $user_type='')
-    {
-        // return true; /// WTF?
+    public function inClearanceZone($security_zone, $user_type='')
+    {
         $zone_members = preg_split('/,\s*/', $security_zone);
         $user_type = empty($user_type) ? $this->get('user_type') : $user_type;
@@ -1039,9 +1038,8 @@
      * @param  constant $security_zone   string of comma delimited privileges for the zone
      */
-    function requireAccessClearance($security_zone, $message='')
+    public function requireAccessClearance($security_zone, $message='')
     {
 		$app =& App::getInstance();
 
-        // return true; /// WTF?
         $zone_members = preg_split('/,\s*/', $security_zone);
 
@@ -1097,3 +1095,2 @@
 // 128.0.0.0        10000000.00000000.00000000.00000000  /1
 // 0.0.0.0          00000000.00000000.00000000.00000000  /0   IP space
-?>
Index: /trunk/lib/AuthorizeNet.inc.php
===================================================================
--- /trunk/lib/AuthorizeNet.inc.php	(revision 467)
+++ /trunk/lib/AuthorizeNet.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -31,5 +31,5 @@
  * @date 2004-04-06
  */
- 
+
 // Example usage
 // require_once 'codebase/lib/AuthorizeNet.inc.php';
@@ -61,8 +61,8 @@
 class AuthorizeNet {
 
-    var $post_url = ''; // The URL to post data to.
-    var $_results = array();
-    var $_params = array();
-    var $_default_params = array(
+    public $post_url = ''; // The URL to post data to.
+    private $_results = array();
+    private $_params = array();
+    private $_default_params = array(
         'x_version'         => '3.1',
         'x_relay_response'  => 'FALSE',
@@ -80,5 +80,5 @@
 
     // Array of response names. Used in the results array.
-    var $_result_fields = Array(
+    private $_result_fields = Array(
         'x_response_code',
         'x_response_subcode',
@@ -129,5 +129,5 @@
      * @param optional array $_params  A hash containing parameters.
      */
-    function AuthorizeNet($params = array())
+    public function __construct($params = array())
     {
         $app =& App::getInstance();
@@ -143,5 +143,5 @@
         $this->_params = $this->_default_params;
         $this->setParam($params);
-        
+
         $this->setParam(array('md5_hash_salt' => $app->getParam('signing_key')));
     }
@@ -153,8 +153,8 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
-    
+
         if (isset($params) && is_array($params)) {
             // Merge new parameters with old overriding only those passed.
@@ -172,8 +172,8 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
-    
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -192,8 +192,8 @@
      * @return mixed      False or x_response_code: false = error, 1 = accepted, 2 = declined, 3 = error
      */
-    function process()
+    public function process()
     {
 		$app =& App::getInstance();
-    
+
         if (empty($this->_params['x_login'])) {
             $this->_results['x_response_reason_text'] = _("Transaction gateway temporarily not available. Please try again later.");
@@ -245,5 +245,5 @@
      * @return array             Returns the results array.
      */
-    function getResult($key=null)
+    public function getResult($key=null)
     {
         if (isset($key)) {
@@ -265,5 +265,5 @@
      * @return bool             True if the hash is valid, false otherwise.
      */
-    function validMD5Hash()
+    public function validMD5Hash()
     {
         return (
@@ -282,5 +282,5 @@
      * @access public
      */
-    function reset()
+    public function reset()
     {
         $this->_results = Array();
@@ -297,5 +297,5 @@
      * @return integer      Transaction result code.
      */
-    function _processResult($result)
+    private function _processResult($result)
     {
         $this->_results = Array();
@@ -315,3 +315,2 @@
     }
 }
-?>
Index: /trunk/lib/CSS.inc.php
===================================================================
--- /trunk/lib/CSS.inc.php	(revision 467)
+++ /trunk/lib/CSS.inc.php	(revision 468)
@@ -32,8 +32,8 @@
 
     // Include these style sheets.
-    var $_css_files = array('default' => array());
+    private $_css_files = array('default' => array());
 
     // CSS object parameters.
-    var $_params = array(
+    private $_params = array(
         'character_set' => 'utf-8',
         'cache_css' => false,
@@ -48,5 +48,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -67,5 +67,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -87,5 +87,5 @@
      * @return  bool    True on success, false on failure.
      */
-    function setFile($file, $realms='')
+    public function setFile($file, $realms='')
     {
 		$app =& App::getInstance();
@@ -115,5 +115,5 @@
      * @return  bool    False if no files have been set.
      */
-    function headers($realm='')
+    public function headers($realm='')
     {
 		$app =& App::getInstance();
@@ -157,5 +157,5 @@
      * @return  bool    False if no files have been set.
      */
-    function output($realm='')
+    public function output($realm='')
     {
         $realm = '' == $realm ? 'default' : $realm;
@@ -181,3 +181,2 @@
     }
 }
-?>
Index: /trunk/lib/Cache.inc.php
===================================================================
--- /trunk/lib/Cache.inc.php	(revision 467)
+++ /trunk/lib/Cache.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -31,16 +31,19 @@
  * @since   2001
  */
- 
-// Flags.
-define('CACHE_ALLOW_OVERSIZED', 1);
 
 class Cache {
 
+    // A place to keep object instances for the singleton pattern.
+    private static $instances = array();
+
     // Namespace of this instance of Prefs.
-    var $_ns;
+    private $_ns;
 
     // Configuration parameters for this object.
-    var $_params = array(
-        
+    private $_params = array(
+
+        // Type of cache. Currently only 'session' is supported.
+        'type' => 'session',
+
         // If false nothing will be cached or retrieved. Useful for testing realtime data requests.
         'enabled' => true,
@@ -48,14 +51,17 @@
         // The maximum size in bytes of any one variable.
         'item_size_limit' => 4194304, // 4 MB
-        
+
         // The maximum size in bytes before the cache will begin flushing out old items.
         'stack_size_limit' => 4194304, // 4 MB
-        
+
         // The minimum items to keep in the cache regardless of item or cache size.
         'min_items' => 5,
     );
-    
+
     /*
-    * Constructor
+    * Constructor. This is publically accessible for compatability with older implementations,
+    * but the preferred method of instantiation is by use of the singleton pattern:
+    *   $cache =& Cache::getInstance('namespace');
+    *   $cache->setParam(array('enabled' => true));
     *
     * @access   public
@@ -65,8 +71,8 @@
     * @since    05 Jun 2006 23:14:21
     */
-    function Cache($namespace='')
+    public function __construct($namespace='')
     {
         $app =& App::getInstance();
-        
+
         $this->_ns = $namespace;
 
@@ -75,5 +81,5 @@
             $this->setParam(array('enabled' => false));
         }
-        
+
         if (!isset($_SESSION['_cache'][$this->_ns])) {
             $this->clear();
@@ -88,13 +94,10 @@
      * @static
      */
-    static function &getInstance($namespace='')
-    {
-        static $instances = array();
-
-        if (!array_key_exists($namespace, $instances)) {
-            $instances[$namespace] = new Cache($namespace);
-        }
-
-        return $instances[$namespace];
+    public static function &getInstance($namespace='')
+    {
+        if (!array_key_exists($namespace, self::$instances)) {
+            self::$instances[$namespace] = new self($namespace);
+        }
+        return self::$instances[$namespace];
     }
 
@@ -105,5 +108,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -124,8 +127,8 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
-    
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -138,15 +141,13 @@
     /**
      * Stores a new variable in the session cache. The $key should not be numeric
-     * because the array_shift function will reset the key to the next largest 
+     * because the array_shift function will reset the key to the next largest
      * int key. Weird behavior I can't understand. For example $cache["123"] will become $cache[0]
      *
-     * @param str   $key        An identifier for the cached object.
-     * @param mixed $var        The var to store in the session cache.
-     * @param bool  $flags      If we have something really big that we
-     *                          still want to cache, setting this to
-     *                          CACHE_ALLOW_OVERSIZED allows this.
-     * @return bool             True on success, false otherwise.
-     */
-    function set($key, $var, $flags=0)
+     * @param str   $key                An identifier for the cached object.
+     * @param mixed $var                The data to store in the session cache.
+     * @param bool  $allow_oversized    If we have something really big that we still want to cache, setting this to true allows this.
+     * @return bool                     True on success, false otherwise.
+     */
+    public function set($key, $var, $allow_oversized=false)
     {
 		$app =& App::getInstance();
@@ -157,4 +158,8 @@
         }
 
+        if (is_numeric($key)) {
+            $app->logMsg(sprintf('Cache::set key value should not be numeric (%s given)', $key), LOG_WARNING, __FILE__, __LINE__);
+        }
+
         $var = serialize($var);
         $var_len = mb_strlen($var);
@@ -165,8 +170,8 @@
         }
 
-        if ($flags & CACHE_ALLOW_OVERSIZED == 0 && $var_len >= $this->getParam('stack_size_limit')) {
+        if ($allow_oversized && $var_len >= $this->getParam('stack_size_limit')) {
             $app->logMsg(sprintf('Serialized variable (%s bytes) more than stack_size_limit (%s bytes).', $var_len, $this->getParam('stack_size_limit')), LOG_NOTICE, __FILE__, __LINE__);
             return false;
-        }        
+        }
 
         // Remove any value already stored under this key.
@@ -197,5 +202,5 @@
      * @return mixed          The requested datum, or false on failure.
      */
-    function get($key)
+    public function get($key)
     {
         $app =& App::getInstance();
@@ -226,5 +231,5 @@
      * @return bool         True if a value exists for the given key.
      */
-    function exists($key)
+    public function exists($key)
     {
         $app =& App::getInstance();
@@ -244,5 +249,5 @@
      * @return bool         True if the value existed before being unset.
      */
-    function delete($key)
+    public function delete($key)
     {
         if (array_key_exists($key, $_SESSION['_cache'][$this->_ns])) {
@@ -253,5 +258,5 @@
         }
     }
-    
+
     /*
     * Delete all existing items from the cache.
@@ -262,5 +267,5 @@
     * @since    05 Jun 2006 23:51:34
     */
-    function clear()
+    public function clear()
     {
         $_SESSION['_cache'][$this->_ns] = array();
@@ -270,3 +275,2 @@
 }
 
-?>
Index: /trunk/lib/Captcha.inc.php
===================================================================
--- /trunk/lib/Captcha.inc.php	(revision 467)
+++ /trunk/lib/Captcha.inc.php	(revision 468)
@@ -54,7 +54,7 @@
 class Captcha {
 
-    var $secret_key = 'some random seed text for the md5';
-    var $random_number;
-    var $ascii_numbers = array(
+    public $secret_key = 'some random seed text for the md5';
+    public $random_number;
+    public $ascii_numbers = array(
         array(
             '  #####   ',
@@ -147,5 +147,5 @@
      * @since   20 Jan 2006 13:08:22
      */
-    function Captcha()
+    public function __construct()
     {
 		$app =& App::getInstance();
@@ -164,5 +164,5 @@
      * @since   07 Dec 2005 21:59:25
      */
-    function getAsciiNumber($num=null)
+    public function getAsciiNumber($num=null)
     {
 		$app =& App::getInstance();
@@ -200,5 +200,5 @@
      * @since   07 Dec 2005 22:09:04
      */
-    function printAsciiNumber()
+    public function printAsciiNumber()
     {
         $ascii = $this->getAsciiNumber($this->random_number);
@@ -213,5 +213,5 @@
      * @since   07 Dec 2005 22:09:04
      */
-    function printForm()
+    public function printForm()
     {
         $hash = $this->_getMD5key($this->random_number);
@@ -231,5 +231,5 @@
      * @since   07 Dec 2005 22:19:33
      */
-    function valid()
+    public function valid()
     {
         $number = getFormData('sc-captcha-input');
@@ -251,5 +251,5 @@
      * @since   07 Dec 2005 21:40:25
      */
-    function _getRandomNumber()
+    public function _getRandomNumber()
     {
         return mb_substr(strval(rand(10000, 99999)), 0, rand(3, 5));
@@ -265,5 +265,5 @@
      * @since   07 Dec 2005 21:53:35
      */
-    function _getMD5key($input)
+    public function _getMD5key($input)
     {
         return md5($this->secret_key . $input);
@@ -272,3 +272,2 @@
 }
 
-?>
Index: /trunk/lib/Cart.inc.php
===================================================================
--- /trunk/lib/Cart.inc.php	(revision 467)
+++ /trunk/lib/Cart.inc.php	(revision 468)
@@ -71,8 +71,8 @@
 
     // Namespace of this instance.
-    var $_ns;
+    private $_ns;
 
     // Configuration parameters for this object.
-    var $_params = array(
+    private $_params = array(
     );
 
@@ -80,5 +80,5 @@
      * Cart constructor.
      */
-    function Cart($namespace='')
+    public function __construct($namespace='')
     {
 		$app =& App::getInstance();
@@ -97,5 +97,5 @@
      * @param  array $params   Array of param keys and values to set.
      */
-    function setParam($params=null)
+    public function setParam($params=null)
     {
         if (isset($params) && is_array($params)) {
@@ -112,5 +112,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -137,5 +137,5 @@
     * @since    11 Mar 2008 18:59:37
     */
-    function add($item_id, $price, $quantity=1, $specs=array())
+    public function add($item_id, $price, $quantity=1, $specs=array())
     {
         $app =& App::getInstance();
@@ -166,5 +166,5 @@
     * @since    10 May 2008 16:42:25
     */
-    function setQty($item_id, $quantity)
+    public function setQty($item_id, $quantity)
     {
         if ($quantity <= 0) {
@@ -195,5 +195,5 @@
     * @since    10 May 2008 16:42:25
     */
-    function setPrice($item_id, $price)
+    public function setPrice($item_id, $price)
     {
         if (isset($_SESSION['_cart'][$this->_ns]['items'][$item_id])) {
@@ -218,5 +218,5 @@
     * @since    11 Mar 2008 18:59:48
     */
-    function remove($item_id)
+    public function remove($item_id)
     {
         $app =& App::getInstance();
@@ -242,5 +242,5 @@
     * @since    11 Mar 2008 18:59:55
     */
-    function get($item_id, $spec_key)
+    public function get($item_id, $spec_key)
     {
         if (isset($_SESSION['_cart'][$this->_ns]['items'][$item_id][$spec_key])) {
@@ -259,5 +259,5 @@
     * @since    11 Mar 2008 18:59:55
     */
-    function getList()
+    public function getList()
     {
         return $_SESSION['_cart'][$this->_ns]['items'];
@@ -277,5 +277,5 @@
     * @since    11 Mar 2008 19:00:12
     */
-    function sum($key='extended_price')
+    public function sum($key='extended_price')
     {
 		$sum = 0;
@@ -306,5 +306,5 @@
      * as $auth->clear(), such as when logging out.
      */
-    function clear()
+    public function clear()
     {
         $_SESSION['_cart'][$this->_ns] = array(
@@ -313,5 +313,2 @@
     }
 }
-
-
-?>
Index: /trunk/lib/Currency.inc.php
===================================================================
--- /trunk/lib/Currency.inc.php	(revision 467)
+++ /trunk/lib/Currency.inc.php	(revision 468)
@@ -41,5 +41,5 @@
 
     // Configuration parameters for this object.
-    var $_params = array(
+    private $_params = array(
         'cache_result' => true,
         'cache_dir' => '',
@@ -52,5 +52,5 @@
      * Cart constructor.
      */
-    function Currency($params=array())
+    public function __construct($params=array())
     {
 		$app =& App::getInstance();
@@ -79,5 +79,5 @@
      * @param  array $params   Array of param keys and values to set.
      */
-    function setParam($params=null)
+    public function setParam($params=null)
     {
         if (isset($params) && is_array($params)) {
@@ -94,5 +94,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -118,5 +118,5 @@
     * @since    05 May 2008 23:50:59
     */
-    function getValue($amount, $base, $target)
+    public function getValue($amount, $base, $target)
     {
         if (false !== $rate = $this->getRate($base, $target)) {
@@ -138,5 +138,5 @@
     * @since    25 May 2011 01:26:24
     */
-    function getRate($base, $target)
+    public function getRate($base, $target)
     {
         $app =& App::getInstance();
@@ -180,5 +180,5 @@
      * @access private
      */
-    function _performAPICall($parameters=null)
+    private function _performAPICall($parameters=null)
     {
         $app =& App::getInstance();
@@ -251,3 +251,2 @@
 
 
-?>
Index: /trunk/lib/DB.inc.php
===================================================================
--- /trunk/lib/DB.inc.php	(revision 467)
+++ /trunk/lib/DB.inc.php	(revision 468)
@@ -32,18 +32,21 @@
 class DB {
 
+    // A place to keep an object instance for the singleton pattern.
+    private static $instance = null;
+
     // If $db->connect has successfully opened a db connection.
-    var $_connected = false;
+    private $_connected = false;
 
     // Database handle.
-    var $dbh;
+    public $dbh;
 
     // Count how many queries run during the whole instance.
-    var $_query_count = 0;
+    private $_query_count = 0;
 
     // Hash of DB parameters.
-    var $_params = array();
+    private $_params = array();
 
     // Default parameters.
-    var $_param_defaults = array(
+    private $_param_defaults = array(
 
         // DB passwords should be set as apache environment variables in httpd.conf, readable only by root.
@@ -64,5 +67,5 @@
 
     // Translate between HTML and MySQL character set names.
-    var $mysql_character_sets = array(
+    public $mysql_character_sets = array(
         'utf-8' => 'utf8',
         'iso-8859-1' => 'latin1',
@@ -70,6 +73,6 @@
 
     // Caches.
-    var $existing_tables;
-    var $table_columns;
+    private $existing_tables;
+    private $table_columns;
 
     /**
@@ -80,13 +83,11 @@
      * @static
      */
-    static function &getInstance()
-    {
-        static $instance = null;
-
-        if ($instance === null) {
-            $instance = new DB();
-        }
-
-        return $instance;
+    public static function &getInstance()
+    {
+        if (self::$instance === null) {
+            self::$instance = new self();
+        }
+
+        return self::$instance;
     }
 
@@ -98,5 +99,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -117,5 +118,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -136,5 +137,5 @@
      * @since   28 Aug 2005 14:02:49
      */
-    function connect()
+    public function connect()
     {
 		$app =& App::getInstance();
@@ -146,5 +147,5 @@
 
         // Connect to database. Always create a new link to the server.
-        if ($this->dbh = mysql_connect($this->getParam('db_server'), $this->getParam('db_user'), $this->getParam('db_pass'), true)) {
+        if ($this->dbh = @mysql_connect($this->getParam('db_server'), $this->getParam('db_user'), $this->getParam('db_pass'), true)) {
             // Select database
             mysql_select_db($this->getParam('db_name'), $this->dbh);
@@ -185,5 +186,5 @@
      * @since   28 Aug 2005 14:32:01
      */
-    function close()
+    public function close()
     {
         if (!$this->_connected) {
@@ -204,5 +205,5 @@
     * @since    03 Jul 2013 14:50:23
     */
-    function reconnect()
+    public function reconnect()
     {
         $this->close();
@@ -221,5 +222,5 @@
     * @since    15 Jan 2007 15:59:00
     */
-    function _fail()
+    private function _fail()
     {
         if ($this->getParam('db_die_on_failure')) {
@@ -240,5 +241,5 @@
      * @since   20 Aug 2005 13:50:36
      */
-    function getDBH()
+    public function getDBH()
     {
         if (!$this->_connected) {
@@ -256,5 +257,5 @@
      * @since   28 Aug 2005 14:58:09
      */
-    function isConnected()
+    public function isConnected()
     {
         return (true === $this->_connected);
@@ -270,5 +271,5 @@
      * @since   06 Mar 2006 16:41:32
      */
-    function escapeString($string)
+    public function escapeString($string)
     {
         if (!$this->_connected) {
@@ -287,5 +288,5 @@
      * @return resource         Query identifier
      */
-    function query($query, $debug=false)
+    public function query($query, $debug=false)
     {
         $app =& App::getInstance();
@@ -336,5 +337,5 @@
      * @return bool                         true if given $table exists.
      */
-    function tableExists($table, $use_cached_results=true)
+    public function tableExists($table, $use_cached_results=true)
     {
 		$app =& App::getInstance();
@@ -368,5 +369,5 @@
      * @return bool                         true if column(s) exist.
      */
-    function columnExists($table, $columns, $strict=true, $use_cached_results=true)
+    public function columnExists($table, $columns, $strict=true, $use_cached_results=true)
     {
         if (!$this->_connected) {
@@ -416,5 +417,5 @@
     * @since    15 Jun 2006 11:46:05
     */
-    function numQueries()
+    public function numQueries()
     {
         return $this->_query_count;
@@ -428,5 +429,5 @@
      * @since   28 Aug 2005 22:10:50
      */
-    function resetCache()
+    public function resetCache()
     {
         $this->existing_tables = null;
@@ -436,3 +437,2 @@
 } // End.
 
-?>
Index: /trunk/lib/DBSessionHandler.inc.php
===================================================================
--- /trunk/lib/DBSessionHandler.inc.php	(revision 467)
+++ /trunk/lib/DBSessionHandler.inc.php	(revision 468)
@@ -32,7 +32,7 @@
 class DBSessionHandler {
 
-    var $db; // DB object.
+    public $db; // DB object.
 
-    var $_params = array(
+    private $_params = array(
         'db_table' => 'session_tbl',
 
@@ -51,5 +51,5 @@
      * @since   18 Jul 2005 11:02:50
      */
-    function DBSessionHandler($db, $params=array())
+    public function __construct($db, $params=array())
     {
 		$app =& App::getInstance();
@@ -94,5 +94,5 @@
      * @since   26 Aug 2005 17:09:36
      */
-    function initDB($recreate_db=false)
+    public function initDB($recreate_db=false)
     {
 		$app =& App::getInstance();
@@ -121,15 +121,15 @@
     }
 
-    function dbSessionOpen($save_path, $sess_name)
+    public function dbSessionOpen($save_path, $sess_name)
     {
         return true;
     }
 
-    function dbSessionClose()
+    public function dbSessionClose()
     {        
         return true;
     }
 
-    function dbSessionRead($session_id)
+    public function dbSessionRead($session_id)
     {
         // Select the data belonging to session $session_id from the session table
@@ -146,5 +146,5 @@
     }
 
-    function dbSessionWrite($session_id, $session_data)
+    public function dbSessionWrite($session_id, $session_data)
     {
         // Write the serialized session data ($session_data) to the session table
@@ -154,5 +154,5 @@
     }
 
-    function dbSessionDestroy($session_id)
+    public function dbSessionDestroy($session_id)
     {
         // Delete from the table all data for the session $session_id
@@ -162,5 +162,5 @@
     }
 
-    function dbSessionGarbage($max_lifetime=72000)
+    public function dbSessionGarbage($max_lifetime=72000)
     {
         // Delete old values from the session table.
@@ -171,3 +171,2 @@
 }
 
-?>
Index: /trunk/lib/Email.inc.php
===================================================================
--- /trunk/lib/Email.inc.php	(revision 467)
+++ /trunk/lib/Email.inc.php	(revision 468)
@@ -56,5 +56,5 @@
 
     // Default parameters, to be overwritten by setParam() and read with getParam()
-    var $_params = array(
+    private $_params = array(
         'to' => null,
         'from' => null,
@@ -74,8 +74,8 @@
 
     // String that contains the email body.
-    var $_template;
+    private $_template;
 
     // String that contains the email body after replacements.
-    var $_template_replaced;
+    private $_template_replaced;
 
     /**
@@ -87,5 +87,5 @@
      * @since   28 Nov 2005 12:59:41
      */
-    function Email($params=null)
+    public function __construct($params=null)
     {
         // The regex used in validEmail(). Set here instead of in the default _params above so we can use the concatenation . dot.
@@ -118,5 +118,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -145,5 +145,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -165,5 +165,5 @@
      * @since   28 Nov 2005 12:56:23
      */
-    function setTemplate($template)
+    public function setTemplate($template)
     {
 		$app =& App::getInstance();
@@ -189,5 +189,5 @@
      * @since   28 Nov 2005 12:56:23
      */
-    function setString($string)
+    public function setString($string)
     {
 		$app =& App::getInstance();
@@ -213,5 +213,5 @@
      * @since   28 Nov 2005 13:08:51
      */
-    function replace($replacements)
+    public function replace($replacements)
     {
 		$app =& App::getInstance();
@@ -250,5 +250,5 @@
      * @since   28 Nov 2005 12:56:09
      */
-    function send($to=null, $from=null, $subject=null, $headers=null)
+    public function send($to=null, $from=null, $subject=null, $headers=null)
     {
 		$app =& App::getInstance();
@@ -364,5 +364,5 @@
      * @since   30 Nov 2005 22:00:50
      */
-    function validEmail($email)
+    public function validEmail($email)
     {
 		$app =& App::getInstance();
@@ -388,3 +388,2 @@
 }
 
-?>
Index: /trunk/lib/FormValidator.inc.php
===================================================================
--- /trunk/lib/FormValidator.inc.php	(revision 467)
+++ /trunk/lib/FormValidator.inc.php	(revision 468)
@@ -58,8 +58,8 @@
 require_once 'codebase/lib/Validator.inc.php';
 
-class FormValidator extends Validator {
+class FormValidator {
 
     // Class parameters.
-    var $_params = array(
+    private $_params = array(
         'error' => ' sc-msg-error ',
         'warning' => ' sc-msg-warning ',
@@ -69,5 +69,5 @@
 
     // Array filling with error messages.
-    var $errors = array();
+    public $errors = array();
 
     /**
@@ -77,5 +77,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -96,5 +96,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -115,5 +115,5 @@
      *                  vals: the message to display for that error
      */
-    function getErrorList()
+    public function getErrorList()
     {
         return $this->errors;
@@ -130,5 +130,5 @@
      * @param   string $line        __LINE__.
      */
-    function addError($form_name, $msg='', $type=MSG_ERR, $file=null, $line=null)
+    public function addError($form_name, $msg='', $type=MSG_ERR, $file=null, $line=null)
     {
         $this->errors[] = array(
@@ -149,5 +149,5 @@
      *                a variable of $form_name, false otherwise
      */
-    function anyErrors($form_name=null)
+    public function anyErrors($form_name=null)
     {
         if (isset($form_name)) {
@@ -166,5 +166,5 @@
      * Reset the error list.
      */
-    function resetErrorList()
+    public function resetErrorList()
     {
         $this->errors = array();
@@ -182,5 +182,5 @@
      * @since   15 Jul 2005 01:39:14
      */
-    function printErrorMessages($above='', $below='', $print_gotohash_js=false, $hash='sc-msg-formvalidator')
+    public function printErrorMessages($above='', $below='', $print_gotohash_js=false, $hash='sc-msg-formvalidator')
     {
         $app =& App::getInstance();
@@ -238,5 +238,5 @@
      *                           not provided, use default.
      */
-    function err($form_name, $marker=null)
+    public function err($form_name, $marker=null)
     {
         if (false !== ($type = $this->anyErrors($form_name))) {
@@ -274,7 +274,7 @@
      * @return bool   true if form is not empty, false otherwise.
      */
-    function notEmpty($form_name, $msg='')
-    {
-        if (parent::notEmpty(getFormData($form_name))) {
+    public function notEmpty($form_name, $msg='')
+    {
+        if (Validator::notEmpty(getFormData($form_name))) {
             return true;
         } else {
@@ -290,5 +290,5 @@
     * @since    03 Jun 2006 22:56:46
     */
-    function isEmpty($form_name, $msg='')
+    public function isEmpty($form_name, $msg='')
     {
         $this->notEmpty($form_name, $msg);
@@ -303,7 +303,7 @@
      * @return bool   true if form is a string, false otherwise.
      */
-    function isString($form_name, $msg='')
-    {
-        if (parent::isString(getFormData($form_name))) {
+    public function isString($form_name, $msg='')
+    {
+        if (Validator::isString(getFormData($form_name))) {
             return true;
         } else {
@@ -321,7 +321,7 @@
      * @return bool   true if no errors found, false otherwise
      */
-    function isNumber($form_name, $msg='')
-    {
-        if (parent::isNumber(getFormData($form_name))) {
+    public function isNumber($form_name, $msg='')
+    {
+        if (Validator::isNumber(getFormData($form_name))) {
             return true;
         } else {
@@ -340,7 +340,7 @@
      * @return bool   true if value is an integer
      */
-    function isInteger($form_name, $msg='', $negative_ok=false)
-    {
-        if (parent::isInteger(getFormData($form_name), $negative_ok)) {
+    public function isInteger($form_name, $msg='', $negative_ok=false)
+    {
+        if (Validator::isInteger(getFormData($form_name), $negative_ok)) {
             return true;
         } else {
@@ -360,7 +360,7 @@
      * @return bool   true if value is a float
      */
-    function isFloat($form_name, $msg='', $negative_ok=false)
-    {
-        if (parent::isFloat(getFormData($form_name), $negative_ok)) {
+    public function isFloat($form_name, $msg='', $negative_ok=false)
+    {
+        if (Validator::isFloat(getFormData($form_name), $negative_ok)) {
             return true;
         } else {
@@ -378,7 +378,7 @@
      * @return bool   true if value is a float
      */
-    function isArray($form_name, $msg='')
-    {
-        if (parent::isArray(getFormData($form_name))) {
+    public function isArray($form_name, $msg='')
+    {
+        if (Validator::isArray(getFormData($form_name))) {
             return true;
         } else {
@@ -399,7 +399,7 @@
      * @return bool   true if value passes regex test
      */
-    function checkRegex($form_name, $regex, $valid_on_match, $msg='')
-    {
-        if (parent::checkRegex(getFormData($form_name), $regex, $valid_on_match)) {
+    public function checkRegex($form_name, $regex, $valid_on_match=true, $msg='')
+    {
+        if (Validator::checkRegex(getFormData($form_name), $regex, $valid_on_match)) {
             return true;
         } else {
@@ -419,7 +419,7 @@
      * @return bool   true if string length is within given boundaries
      */
-    function stringLength($form_name, $min, $max, $msg='')
-    {
-        if (parent::stringLength(getFormData($form_name), $min, $max)) {
+    public function stringLength($form_name, $min, $max, $msg='')
+    {
+        if (Validator::stringLength(getFormData($form_name), $min, $max)) {
             return true;
         } else {
@@ -439,7 +439,7 @@
      * @return bool   true if no errors found, false otherwise
      */
-    function numericRange($form_name, $min, $max, $msg='')
-    {
-        if (parent::numericRange(getFormData($form_name), $min, $max)) {
+    public function numericRange($form_name, $min, $max, $msg='')
+    {
+        if (Validator::numericRange(getFormData($form_name), $min, $max)) {
             return true;
         } else {
@@ -463,5 +463,5 @@
      * @author  Quinn Comendant <quinn@strangecode.com>
      */
-    function validateEmail($form_name)
+    public function validateEmail($form_name, $strict=false)
     {
 		$app =& App::getInstance();
@@ -474,31 +474,27 @@
         }
 
-        // Validator::validateEmail() returns a value that relates to the VALIDATE_EMAIL_* constants (defined in Validator.inc.php).
-        switch (parent::validateEmail($email)) {
-        case VALIDATE_EMAIL_REGEX_FAIL:
+        // Validator::validateEmail() returns a value that relates to the Validate::EMAIL_* constants (defined in Validator.inc.php).
+        switch (Validator::validateEmail($email, $strict)) {
+        case Validator::EMAIL_REGEX_FAIL:
             // Failed regex match.
             $this->addError($form_name, sprintf(_("The email address <em>%s</em> is formatted incorrectly."), oTxt($email)));
             $app->logMsg(sprintf('The email address %s is not valid.', oTxt($email)), LOG_DEBUG, __FILE__, __LINE__);
             return false;
-            break;
-
-        case VALIDATE_EMAIL_LENGTH_FAIL :
+
+        case Validator::EMAIL_LENGTH_FAIL :
             // Failed length requirements.
             $this->addError($form_name, sprintf(_("The email address <em>%s</em> is too long (email addresses must have fewer than 256 characters)."), oTxt($email)));
             $app->logMsg(sprintf('The email address %s must contain less than 256 characters.', oTxt($email)), LOG_DEBUG, __FILE__, __LINE__);
             return false;
-            break;
-
-        case VALIDATE_EMAIL_MX_FAIL :
+
+        case Validator::EMAIL_MX_FAIL :
             // Failed MX record test.
             $this->addError($form_name, sprintf(_("The email address <em>%s</em> does not have a valid domain name"), oTxt($email)));
             $app->logMsg(sprintf('The email address %s does not have a valid domain name.', oTxt($email)), LOG_INFO, __FILE__, __LINE__);
             return false;
-            break;
-
-        case VALIDATE_EMAIL_SUCCESS :
+
+        case Validator::EMAIL_SUCCESS :
         default :
             return true;
-            break;
         }
     }
@@ -513,12 +509,28 @@
      * @return bool    true if no errors found, false otherwise
      */
-    function validatePhone($form_name)
-    {
+    public function validatePhone($form_name)
+    {
+        $app =& App::getInstance();
+
         $phone = getFormData($form_name);
 
-        return (
-            $this->checkRegex($form_name, '/^[0-9 +().-]*$/', true, sprintf(_("The phone number <em>%s</em> is not valid."), $phone))
-            && $this->stringLength($form_name, 0, 25, sprintf(_("The phone number <em>%s</em> is too long"), $phone))
-        );
+        // Validator::validateEmail() returns a value that relates to the Validate::PHONE_* constants (defined in Validator.inc.php).
+        switch (Validator::validatePhone($phone)) {
+        case Validator::PHONE_REGEX_FAIL:
+            // Failed regex match.
+            $this->addError($form_name, sprintf(_("The phone number <em>%s</em> is not valid."), oTxt($phone)));
+            $app->logMsg(sprintf('The phone number %s is not valid.', oTxt($phone)), LOG_DEBUG, __FILE__, __LINE__);
+            return false;
+
+        case Validator::PHONE_LENGTH_FAIL :
+            // Failed length requirements.
+            $this->addError($form_name, sprintf(_("The phone number <em>%s</em> is too long (phone number must have fewer than 25 characters)."), oTxt($phone)));
+            $app->logMsg(sprintf('The phone number %s must contain less than 256 characters.', oTxt($phone)), LOG_DEBUG, __FILE__, __LINE__);
+            return false;
+
+        case Validator::PHONE_SUCCESS :
+        default :
+            return true;
+        }
     }
 
@@ -531,9 +543,9 @@
      * @return bool    true if no errors found, false otherwise
      */
-    function validateStrDate($form_name, $msg='')
+    public function validateStrDate($form_name, $msg='')
     {
         $app =& App::getInstance();
 
-        if (parent::validateStrDate(getFormData($form_name, ''))) {
+        if (Validator::validateStrDate(getFormData($form_name, ''))) {
             return true;
         } else {
@@ -550,13 +562,13 @@
      *
      * @param  string  $form_name   The name of the incoming form variable.
-     * @param  string  $cc_type     Optional, card type to do specific checks. One of the CC_TYPE_* constants.
+     * @param  string  $cc_type     Optional, card type to do specific checks. One of the Validator::CC_TYPE_* constants.
      *
      * @return bool    true if no errors found, false otherwise
      */
-    function validateCCNumber($form_name, $cc_type=null)
+    public function validateCCNumber($form_name, $cc_type=null)
     {
         $cc_num = getFormData($form_name);
 
-        if (parent::validateCCNumber($cc_num, $cc_type)) {
+        if (Validator::validateCCNumber($cc_num, $cc_type)) {
             return true;
         } else {
@@ -574,7 +586,7 @@
      * @return bool   true if no errors found, false otherwise
      */
-    function fileUploaded($form_name, $msg='')
-    {
-        if (parent::fileUploaded($form_name)) {
+    public function fileUploaded($form_name, $msg='')
+    {
+        if (Validator::fileUploaded($form_name)) {
             return true;
         } else {
@@ -586,3 +598,2 @@
 } // THE END
 
-?>
Index: /trunk/lib/Google_API.inc.php
===================================================================
--- /trunk/lib/Google_API.inc.php	(revision 467)
+++ /trunk/lib/Google_API.inc.php	(revision 468)
@@ -53,5 +53,5 @@
      * @access private
      */
-    var $_licenseKey = '';
+    private $_licenseKey = '';
 
     /**
@@ -59,5 +59,5 @@
      * @access private
      */
-    var $_soapClient = NULL;
+    private $_soapClient = NULL;
 
     /**
@@ -67,5 +67,5 @@
      * @access public
      */
-    function Google_API($licenseKey)
+    public function __construct($licenseKey)
     {
         $this->_licenseKey = $licenseKey;
@@ -82,5 +82,5 @@
      * @access public
      */
-    function getCachedPage($url)
+    public function getCachedPage($url)
     {
         $result = $this->_performAPICall(
@@ -104,5 +104,5 @@
      * @access public
      */
-    function getSpellingSuggestion($phrase)
+    public function getSpellingSuggestion($phrase)
     {
         return $this->_performAPICall(
@@ -122,5 +122,5 @@
      * @access public
      */
-    function search($parameters = array())
+    public function search($parameters = array())
     {
         if (!isset($parameters['query'])) {
@@ -150,5 +150,5 @@
      * @access private
      */
-    function _performAPICall($apiCall, $parameters)
+    private function _performAPICall($apiCall, $parameters)
     {
         $app =& App::getInstance();
@@ -167,5 +167,2 @@
     }
 }
-?>
-
-
Index: /trunk/lib/Hierarchy.inc.php
===================================================================
--- /trunk/lib/Hierarchy.inc.php	(revision 467)
+++ /trunk/lib/Hierarchy.inc.php	(revision 468)
@@ -52,5 +52,5 @@
      *
      */
-    var $params = array();
+    public $params = array();
 
 
@@ -59,5 +59,5 @@
      * @var string $child_type
      */
-    var $child_type;
+    public $child_type;
 
     /**
@@ -65,5 +65,5 @@
      * @var string $child_id
      */
-    var $child_id;
+    public $child_id;
 
     /**
@@ -72,5 +72,5 @@
      * @var bool $node_init
      */
-    var $node_init = false;
+    public $node_init = false;
 
     /**
@@ -80,5 +80,5 @@
      *                          configuration or connection parameters.
      */
-    function Hierarchy($params=array())
+    public function __construct($params=array())
     {
         $this->params = $params;
@@ -92,5 +92,5 @@
      *                      if no new ones are specified.
      */
-    function currentNode($child_type=null, $child_id=null)
+    public function currentNode($child_type=null, $child_id=null)
     {
         $old_type = isset($this->child_type) ? $this->child_type : $child_type;
@@ -113,5 +113,5 @@
      *                  otherwise if an array is provided, an array of identifiers is returned.
      */
-    function toStringID($child_type=null, $child_id=null)
+    public function toStringID($child_type=null, $child_id=null)
     {
 			$app =& App::getInstance();
@@ -147,5 +147,5 @@
      * @return mixed    Array of node type and id on success, false on failure.
      */
-    function toArrayID(&$node)
+    public function toArrayID(&$node)
     {
 			$app =& App::getInstance();
@@ -167,5 +167,5 @@
      * @return bool     true on success, false on error.
      */
-    function insertNode($parents, $child_type=null, $child_id=null, $relationship_type=null, $title='')
+    public function insertNode($parents, $child_type=null, $child_id=null, $relationship_type=null, $title='')
     {
 		$app =& App::getInstance();
@@ -246,5 +246,5 @@
      * @return bool      false on error, true otherwise.
      */
-    function deleteNode($child_type=null, $child_id=null)
+    public function deleteNode($child_type=null, $child_id=null)
     {
 		$app =& App::getInstance();
@@ -296,5 +296,5 @@
      * @return bool      false on error, true otherwise.
      */
-    function moveNode($new_parents=null, $child_type=null, $child_id=null, $relationship_type=null, $title='')
+    public function moveNode($new_parents=null, $child_type=null, $child_id=null, $relationship_type=null, $title='')
     {
 			$app =& App::getInstance();
@@ -373,5 +373,5 @@
      * @return string   The parents as an array of serialized node identifiers.
      */
-    function getParents($child_type=null, $child_id=null, $type_constraint=null, $order='')
+    public function getParents($child_type=null, $child_id=null, $type_constraint=null, $order='')
     {
 		$app =& App::getInstance();
@@ -424,5 +424,5 @@
      * @return array   type, id, title, subnode_quantity.
      */
-    function getNode($child_type=null, $child_id=null)
+    public function getNode($child_type=null, $child_id=null)
     {
 		$app =& App::getInstance();
@@ -468,5 +468,5 @@
      * @return string  The children as an array of serialized node identifiers.
      */
-    function getChildren($child_type=null, $child_id=null, $type_constraint=null, $order='')
+    public function getChildren($child_type=null, $child_id=null, $type_constraint=null, $order='')
     {
 		$app =& App::getInstance();
@@ -520,5 +520,5 @@
      * @return integer
      */
-    function getNumberChildren($child_type=null, $child_id=null, $type_constraint=null)
+    public function getNumberChildren($child_type=null, $child_id=null, $type_constraint=null)
     {
 		$app =& App::getInstance();
@@ -561,5 +561,5 @@
      * @return bool      true if a leaf, or false if not or an error
      */
-    function isLeaf($child_type=null, $child_id=null)
+    public function isLeaf($child_type=null, $child_id=null)
     {
 		$app =& App::getInstance();
@@ -595,5 +595,5 @@
      *                   parent, or false otherwise, or in case of failure.
      */
-    function isAncestor($child_type, $child_id, $considered_parent_type, $considered_parent_id)
+    public function isAncestor($child_type, $child_id, $considered_parent_type, $considered_parent_id)
     {
         $family_tree = $this->getAllAncestors($considered_parent_type, $considered_parent_id);
@@ -622,5 +622,5 @@
      * @return array     Array of serialized node identifiers.
      */
-    function getAllAncestors($child_type, $child_id, $go_linear=false, $_return_flag=true)
+    public function getAllAncestors($child_type, $child_id, $go_linear=false, $_return_flag=true)
     {
 		$db =& DB::getInstance();
@@ -676,5 +676,5 @@
      * @return bool      true if a leaf, or false if not or an error
      */
-    function nodeExists($child_type=null, $child_id=null, $parent_type=null, $parent_id=null, $relationship_type=null)
+    public function nodeExists($child_type=null, $child_id=null, $parent_type=null, $parent_id=null, $relationship_type=null)
     {
 		$app =& App::getInstance();
@@ -728,5 +728,5 @@
      *                specified node: (type, id, title, indent level, selected status)
      */
-    function &getNodeList($preselected=null, $child_type=null, $child_id=null, $type_constraint=null, $include_curr=false, $order='', $_indent=0, $_return_flag=true)
+    public function &getNodeList($preselected=null, $child_type=null, $child_id=null, $type_constraint=null, $include_curr=false, $order='', $_indent=0, $_return_flag=true)
     {
 		$app =& App::getInstance();
@@ -801,5 +801,5 @@
      * @param  string  $type_constraint  An array of node types to restrict the search to.
      */
-    function rebuildSubnodeQty($type_constraint=null)
+    public function rebuildSubnodeQty($type_constraint=null)
     {
 		$db =& DB::getInstance();
@@ -825,5 +825,5 @@
      * all parents recursively.
      */
-    function setSubnodeQtyToParents($child_type, $child_id, $num_children)
+    public function setSubnodeQtyToParents($child_type, $child_id, $num_children)
     {
 		$db =& DB::getInstance();
@@ -848,7 +848,2 @@
 // THE END
 }
-
-
-
-
-?>
Index: /trunk/lib/Image.inc.php
===================================================================
--- /trunk/lib/Image.inc.php	(revision 467)
+++ /trunk/lib/Image.inc.php	(revision 468)
@@ -31,5 +31,5 @@
 
     // Object parameters.
-    var $_params = array();
+    private $_params = array();
 
     /**
@@ -41,5 +41,5 @@
      * @since   26 Jan 2005 01:54:50
      */
-    function Image($params=array())
+    public function __construct($params=array())
     {
         if (!is_array($params)) {
@@ -72,5 +72,5 @@
      * @since   26 Jan 2005 01:54:50
       */
-    function exists($id)
+    public function exists($id)
     {
         $src = $this->oSrc($id);
@@ -96,5 +96,5 @@
      * @since   26 Jan 2005 01:54:50
      */
-    function size($id, $key)
+    public function size($id, $key)
     {
         $src = $this->oSrc($id);
@@ -114,5 +114,5 @@
      * @since   26 Jan 2005 01:56:35
      */
-    function oSrc($id)
+    public function oSrc($id)
     {
         $file_name = '';
@@ -139,5 +139,5 @@
      * @since   26 Jan 2005 01:57:33
      */
-    function oImg($id, $alt='', $extra='')
+    public function oImg($id, $alt='', $extra='')
     {
         $src = $this->oSrc($id);
@@ -158,4 +158,2 @@
     }
 } // End class
-
-?>
Index: /trunk/lib/ImageThumb.inc.php
===================================================================
--- /trunk/lib/ImageThumb.inc.php	(revision 467)
+++ /trunk/lib/ImageThumb.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -41,7 +41,7 @@
 
 class ImageThumb {
-    
+
     // General object parameters.
-    var $_params = array(
+    private $_params = array(
         // The location for images to create thumbnails from.
         'source_dir' => null,
@@ -58,5 +58,5 @@
         // Require file to have one of the following file name extensions.
         'valid_file_extensions' => array('jpg', 'jpeg', 'gif', 'png'),
-        
+
         // Method to use for resizing. (IMAGETHUMB_METHOD_NETPBM or IMAGETHUMB_METHOD_GD)
         'resize_method' => IMAGETHUMB_METHOD_NETPBM,
@@ -70,11 +70,11 @@
         'display_messages' => MSG_ALL,
     );
-    
+
     // Default image size specs.
-    var $_default_image_specs = array(
-        // The destination for an image thumbnail size. 
+    private $_default_image_specs = array(
+        // The destination for an image thumbnail size.
         // Use initial / to specify absolute paths, leave off to specify a path relative to source_dir (eg: ../thumbs).
         'dest_dir' => null,
-        
+
         // Destination file types. (IMG_JPG, IMG_PNG, IMG_GIF, IMG_WBMP)
         'dest_file_type' => IMG_JPG,
@@ -82,5 +82,5 @@
         // Destination file types. ('jpg', 'png', 'gif', 'wbmp')
         'dest_file_extension' => 'jpg',
-        
+
         // Type of scaling to perform, and sizes used to calculate max dimensions.
         'scaling_type' => IMAGETHUMB_FIT_LARGER,
@@ -96,5 +96,5 @@
         // If using GD method, apply sharpen filter. Requires PHP > 5.1.
         'sharpen' => true,
-        
+
         // Integers between 1-100, useful values are 65-85.
         'sharpen_value' => 75,
@@ -108,5 +108,5 @@
 
     // Final specifications for image sizes, set with setSpec().
-    var $_image_specs = array();
+    private $_image_specs = array();
 
     /**
@@ -116,5 +116,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -160,8 +160,8 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
-    {
-		$app =& App::getInstance();
-    
+    public function getParam($param)
+    {
+		$app =& App::getInstance();
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -180,5 +180,5 @@
      *                          Use to overwrite existing spec array values.
      */
-    function setSpec($spec, $index=null)
+    public function setSpec($spec, $index=null)
     {
 		$app =& App::getInstance();
@@ -188,5 +188,5 @@
             $app->logMsg('setSpec error: dest_dir not specified.', LOG_ERR, __FILE__, __LINE__);
         } else {
-            $spec['dest_dir'] = trim($spec['dest_dir']);            
+            $spec['dest_dir'] = trim($spec['dest_dir']);
         }
         if (isset($spec['dest_file_type'])) {
@@ -233,5 +233,5 @@
             $app->logMsg('The "progressive" specification is not used unless IMG_JPG is the dest_file_type.', LOG_INFO, __FILE__, __LINE__);
         }
-        
+
         // Add to _image_specs array.
         if (isset($index) && isset($this->_image_specs[$index])) {
@@ -241,11 +241,11 @@
         } else {
             // Merge with spec defaults.
-            $final_spec = array_merge($this->_default_image_specs, $spec);            
+            $final_spec = array_merge($this->_default_image_specs, $spec);
             $this->_image_specs[] = $final_spec;
         }
-        
+
         return $final_spec;
     }
-    
+
     /*
     * Retrieve a value of a thumb specification.
@@ -259,5 +259,5 @@
     * @since    08 May 2007 15:26:39
     */
-    function getSpec($key, $index=null)
+    public function getSpec($key, $index=null)
     {
         $index = isset($index) ? $index : 0;
@@ -271,5 +271,5 @@
      * @return  bool true on success, false on failure.
      */
-    function processAll($runtime_specs=null)
+    public function processAll($runtime_specs=null)
     {
 		$app =& App::getInstance();
@@ -313,5 +313,5 @@
      * @return  bool true on success, false on failure.
      */
-    function processFile($file_name, $runtime_specs=null)
+    public function processFile($file_name, $runtime_specs=null)
     {
 		$app =& App::getInstance();
@@ -319,5 +319,5 @@
         // Source file determined by provided file_name.
         $source_file = realpath(sprintf('%s/%s', $this->getParam('source_dir'), $file_name));
-        
+
         // Ensure we have a source.
         if (sizeof($this->_image_specs) < 1) {
@@ -326,5 +326,5 @@
             } else {
                 $app->logMsg(sprintf('Image specifications not set before processing.'), LOG_ERR, __FILE__, __LINE__);
-                return false;                
+                return false;
             }
         }
@@ -369,5 +369,5 @@
             return false;
         }
-        
+
         // To keep this script running even if user tries to stop browser.
         ignore_user_abort(true);
@@ -379,10 +379,10 @@
 
         foreach ($this->_image_specs as $index => $spec) {
-            
+
             if (is_array($runtime_specs)) {
                 // Override with runtime specs.
                 $spec = $this->setSpec($runtime_specs, $index);
             }
-            
+
             // Destination filename uses the extension defined by dest_file_extension.
             if ('/' == $spec['dest_dir']{0}) {
@@ -393,5 +393,5 @@
                 $dest_file = sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $spec['dest_file_extension']);
             }
-                 
+
             // Ensure destination directory exists and is writable.
             if (!is_dir(dirname($dest_file)) || !is_writable(dirname($dest_file))) {
@@ -438,5 +438,5 @@
         return 0 === $return_val;
     }
-    
+
     /*
     * Use the Netpbm and libjpg cjpeg tools to generate a rescaled compressed image.
@@ -452,5 +452,5 @@
     * @since    19 May 2006 13:55:46
     */
-    function _resizeWithNetpbm($source_file, $dest_file, $spec)
+    private function _resizeWithNetpbm($source_file, $dest_file, $spec)
     {
 		$app =& App::getInstance();
@@ -491,5 +491,5 @@
         );
         $app->logMsg(sprintf('ImageThumb Netpbm command: %s', $command), LOG_DEBUG, __FILE__, __LINE__);
-        
+
         // Execute!
         exec($command, $output, $return_val);
@@ -521,5 +521,5 @@
     * @since    19 May 2006 15:46:02
     */
-    function _resizeWithGD($source_file, $dest_file, $spec)
+    private function _resizeWithGD($source_file, $dest_file, $spec)
     {
 		$app =& App::getInstance();
@@ -593,5 +593,5 @@
             return 1;
         }
-        
+
         // Create destination image data in memory.
         $dest_image_resource = imagecreatetruecolor($dest_image_width, $dest_image_height);
@@ -605,9 +605,9 @@
             return 1;
         }
-        
+
         // Sharpen image using a custom filter matrix.
         if (phpversion() > '5.1' && true === $spec['sharpen'] && $spec['sharpen_value'] > 0) {
-            $sharpen_value = round((((48 - 10) / (100 - 1)) * (100 - $spec['sharpen_value'])) + 10); /// WTF is this math?
-            imageconvolution($dest_image_resource, array(array(-1,-1,-1),array(-1,$sharpen_value,-1),array(-1,-1,-1)), ($sharpen_value - 8), 0);
+            $sharpen_value = round((((48 - 10) / (100 - 1)) * (100 - $spec['sharpen_value'])) + 10); // TODO: WTF is this math?
+            imageconvolution($dest_image_resource, array(array(-1, -1, -1), array(-1, $sharpen_value, -1),array(-1, -1, -1)), ($sharpen_value - 8), 0);
         }
 
@@ -662,5 +662,5 @@
      * @return  bool true on success, false on failure.
      */
-    function deleteThumbs($file_name, $use_glob=false)
+    public function deleteThumbs($file_name, $use_glob=false)
     {
 		$app =& App::getInstance();
@@ -677,9 +677,9 @@
             $dest_dir = '/' == $spec['dest_dir']{0} ? $spec['dest_dir'] : sprintf('%s/%s', $this->getParam('source_dir'), $spec['dest_dir']);
             if ($use_glob) {
-                $dest_file = realpath(sprintf('%s/%s', $dest_dir, $this->_glob($file_name, $dest_dir)));                
+                $dest_file = realpath(sprintf('%s/%s', $dest_dir, $this->_glob($file_name, $dest_dir)));
             } else {
                 $dest_file = realpath(sprintf('%s/%s.%s', $dest_dir, mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $spec['dest_file_extension']));
-            }            
-            
+            }
+
             if (file_exists($dest_file)) {
                 if (!unlink($dest_file)) {
@@ -700,5 +700,5 @@
      * @return  bool true on success, false on failure.
      */
-    function deleteOriginal($file_name)
+    public function deleteOriginal($file_name)
     {
 		$app =& App::getInstance();
@@ -733,5 +733,5 @@
      * @return  bool true on success, false on failure.
      */
-    function exists($file_name)
+    public function exists($file_name)
     {
 		$app =& App::getInstance();
@@ -754,8 +754,8 @@
      * @return  bool    True on success, false on failure.
      */
-    function _validFileExtension($file_name)
+    private function _validFileExtension($file_name)
     {
         preg_match('/.*?\.(\w+)$/i', $file_name, $ext);
-        return !empty($ext) && in_array(mb_strtolower($ext[1]), $this->getParam('valid_file_extensions'));        
+        return !empty($ext) && in_array(mb_strtolower($ext[1]), $this->getParam('valid_file_extensions'));
     }
 
@@ -766,5 +766,5 @@
      * @return  bool true on success, false on failure.
      */
-    function _createDestDirs($filename=null)
+    private function _createDestDirs($filename=null)
     {
 		$app =& App::getInstance();
@@ -792,32 +792,12 @@
                 }
                 if (!file_exists($dest_dir)) {
+                    // Recursively create destination directory.
                     $app->logMsg(sprintf('Creating dest dir: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__);
-                    if (phpversion() > '5') {
-                        // Recursive.
-                        if (!file_exists($dest_dir) && !($ret = mkdir($dest_dir, $this->getParam('dest_dir_perms'), true))) {
-                            $return_val++;
-                            $app->logMsg(sprintf('mkdir failure: %s', $dest_dir), LOG_ERR, __FILE__, __LINE__);
-                        }
-                    } else {
-                        // Recursive mkdir for php 4.
-                        $path = '';
-                        $depth = 0;
-                        $ret = true;
-                        foreach (array_diff(explode('/', $dest_dir), array('')) as $dir) {
-                            $path .= '/' . $dir;
-                            $depth++;
-                            /// FIXME: This is a dirty way to make this work when open_basedir prevents looking at the first 3 directories in an absolute path.
-                            if ($depth > 3 && !($ret = file_exists($path) ? true : mkdir($path, $this->getParam('dest_dir_perms')))) {
-                                $return_val++;
-                                $app->logMsg(sprintf('mkdir failure: %s', $path), LOG_ERR, __FILE__, __LINE__);
-                                break;
-                            } else {
-                                $app->logMsg(sprintf('mkdir attempt: %s', $path), LOG_DEBUG, __FILE__, __LINE__);
-                            }
-                        }
+                    if (!file_exists($dest_dir) && !($ret = mkdir($dest_dir, $this->getParam('dest_dir_perms'), true))) {
+                        $return_val++;
+                        $app->logMsg(sprintf('mkdir failure: %s', $dest_dir), LOG_ERR, __FILE__, __LINE__);
                     }
-
                     if ($ret) {
-                        $app->logMsg(sprintf('mkdir success: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__);                        
+                        $app->logMsg(sprintf('mkdir success: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__);
                     }
                 } else {
@@ -844,5 +824,5 @@
      * @param string $line    __LINE__.
      */
-    function _raiseMsg($message, $type, $file, $line)
+    private function _raiseMsg($message, $type, $file, $line)
     {
 		$app =& App::getInstance();
@@ -852,5 +832,5 @@
         }
     }
-    
+
     /**
      * Get filename by glob pattern. Searches a directory for an image that matches the
@@ -864,5 +844,5 @@
      * @since   15 Nov 2005 20:55:22
      */
-    function _glob($pattern, $directory)
+    private function _glob($pattern, $directory)
     {
         $file_list = glob(sprintf('%s/%s', $directory, $pattern));
@@ -875,3 +855,2 @@
 
 } // End of class.
-?>
Index: /trunk/lib/Lock.inc.php
===================================================================
--- /trunk/lib/Lock.inc.php	(revision 467)
+++ /trunk/lib/Lock.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -31,6 +31,9 @@
 class Lock {
 
+    // A place to keep an object instance for the singleton pattern.
+    private static $instance = null;
+
     // Configuration of this object.
-    var $_params = array(
+    private $_params = array(
         'timeout' => 600,
         'auto_timeout' => 1800,
@@ -44,8 +47,8 @@
 
     // Store lock data from DB.
-    var $data = array();
+    private $data = array();
 
     // Auth_SQL object from which to access a current user_id.
-    var $_auth;
+    private $_auth;
 
     /**
@@ -56,13 +59,11 @@
      * @static
      */
-    static function &getInstance($auth_object)
-    {
-        static $instance = null;
-
-        if ($instance === null) {
-            $instance = new Lock($auth_object);
-        }
-
-        return $instance;
+    public static function &getInstance($auth_object)
+    {
+        if (self::$instance === null) {
+            self::$instance = new self($auth_object);
+        }
+
+        return self::$instance;
     }
 
@@ -72,5 +73,5 @@
      * @param mixed  $auth_object  An Auth_SQL or Auth_FILE object.
      */
-    function Lock($auth_object)
+    public function __construct($auth_object)
     {
 		$app =& App::getInstance();
@@ -95,5 +96,5 @@
      * @since   26 Aug 2005 17:09:36
      */
-    function initDB($recreate_db=false)
+    public function initDB($recreate_db=false)
     {
 		$app =& App::getInstance();
@@ -142,5 +143,5 @@
      * @param  array $params   Array of param keys and values to set.
      */
-    function setParam($params=null)
+    public function setParam($params=null)
     {
         if (isset($params) && is_array($params)) {
@@ -157,8 +158,8 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
-    {
-		$app =& App::getInstance();
-    
+    public function getParam($param)
+    {
+		$app =& App::getInstance();
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -178,5 +179,5 @@
      * @param string $title       A title to apply to the lock, for display purposes.
      */
-    function select($record_table_or_lock_id, $record_key=null, $record_val=null)
+    public function select($record_table_or_lock_id, $record_key=null, $record_val=null)
     {
 		$app =& App::getInstance();
@@ -205,5 +206,5 @@
         if ($this->data = mysql_fetch_assoc($qid)) {
             $app->logMsg(sprintf('Selecting %slocked record: %s %s %s', ($this->data['set_by_admin_id'] == $this->_auth->get('user_id') ? 'self-' : ''), $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__);
-            /// FIX ME: What if admin set lock, but public user is current lock user?
+            // FIXME: What if admin set lock, but public user is current lock user?
             $this->data['editor'] = $this->_auth->getUsername($this->data['set_by_admin_id']);
             return true;
@@ -219,5 +220,5 @@
      * @return bool            True if locked.
      */
-    function isLocked()
+    public function isLocked()
     {
         return isset($this->data['lock_id']);
@@ -230,8 +231,8 @@
      * @return bool            True if current user set the lock.
      */
-    function isMine()
-    {
-		$db =& DB::getInstance();
-	
+    public function isMine()
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
@@ -258,8 +259,8 @@
      * @return int            The id for the lock (mysql last insert id).
      */
-    function set($record_table, $record_key, $record_val, $title='')
-    {
-		$db =& DB::getInstance();
-	
+    public function set($record_table, $record_key, $record_val, $title='')
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
@@ -304,5 +305,5 @@
      * Unlock the currently selected record.
      */
-    function remove()
+    public function remove()
     {
 		$app =& App::getInstance();
@@ -326,5 +327,5 @@
      * Unlock all records, or all records for a specified user.
      */
-    function removeAll($user_id=null)
+    public function removeAll($user_id=null)
     {
 		$app =& App::getInstance();
@@ -350,8 +351,8 @@
      * Deletes all locks that are older than auto_timeout.
      */
-    function _auto_timeout()
-    {
-		$db =& DB::getInstance();
-	
+    public function _auto_timeout()
+    {
+		$db =& DB::getInstance();
+
         static $_timeout_run = false;
 
@@ -371,5 +372,5 @@
      * Redirect to record lock error page.
      */
-    function dieErrorPage()
+    public function dieErrorPage()
     {
 		$app =& App::getInstance();
@@ -381,5 +382,5 @@
      * Print error page.
      */
-    function printErrorHTML()
+    public function printErrorHTML()
     {
 		$app =& App::getInstance();
@@ -416,5 +417,5 @@
      * Return lock_id of locked record.
      */
-    function getID()
+    public function getID()
     {
         return $this->data['lock_id'];
@@ -424,5 +425,5 @@
      * Return title of locked record.
      */
-    function getTitle()
+    public function getTitle()
     {
         return $this->data['title'];
@@ -432,5 +433,5 @@
      * Return administrator username for locked record.
      */
-    function getEditor()
+    public function getEditor()
     {
         return $this->data['editor'];
@@ -440,5 +441,5 @@
      * Return total seconds since the record was locked.
      */
-    function getSecondsElapsed()
+    public function getSecondsElapsed()
     {
         if (isset($this->data['lock_datetime']) && strtotime($this->data['lock_datetime']) < time()) {
@@ -451,3 +452,2 @@
 
 } // End of class.
-?>
Index: /trunk/lib/MCVE.inc.php
===================================================================
--- /trunk/lib/MCVE.inc.php	(revision 467)
+++ /trunk/lib/MCVE.inc.php	(revision 468)
@@ -31,17 +31,17 @@
 class MCVE {
 
-    var $username;
-    var $password;
-    var $host = 'localhost';
-    var $ip_port = 8333;
-    var $ssl_port = 8444;
-    var $ca_bundle_file = '/usr/share/ssl/certs/ca-bundle.crt';
-    var $connect_method = 'ip';
-    var $timeout = 10;
-    var $blocking = 1;
-    var $connected = false;
-    var $conn;
-
-    function MCVE($username, $password)
+    public $username;
+    public $password;
+    public $host = 'localhost';
+    public $ip_port = 8333;
+    public $ssl_port = 8444;
+    public $ca_bundle_file = '/usr/share/ssl/certs/ca-bundle.crt';
+    public $connect_method = 'ip';
+    public $timeout = 10;
+    public $blocking = 1;
+    public $connected = false;
+    public $conn;
+
+    public function __construct($username, $password)
     {
 		$app =& App::getInstance();
@@ -58,5 +58,5 @@
     }
 
-    function _connect()
+    private function _connect()
     {
 		$app =& App::getInstance();
@@ -123,5 +123,5 @@
     }
 
-    function beginTrans()
+    public function beginTrans()
     {
         if (!$this->_connect()) {
@@ -134,5 +134,5 @@
     }
 
-    function transParam($tid, $key, $var1, $var2=null)
+    public function transParam($tid, $key, $var1, $var2=null)
     {
         if (!isset($var2)) {
@@ -144,5 +144,5 @@
     }
 
-    function sendTrans($tid, $type='', $hide_msg=false)
+    public function sendTrans($tid, $type='', $hide_msg=false)
     {
 		$app =& App::getInstance();
@@ -191,5 +191,5 @@
     }
 
-    function disconnect($tid)
+    public function disconnect($tid)
     {
         if ($this->connected) {
@@ -208,3 +208,2 @@
 // End of class.
 
-?>
Index: /trunk/lib/Navigation.inc.php
===================================================================
--- /trunk/lib/Navigation.inc.php	(revision 467)
+++ /trunk/lib/Navigation.inc.php	(revision 468)
@@ -37,5 +37,5 @@
 
     // Configuration parameters for this object.
-    var $_params = array(
+    private $_params = array(
         'head_title' => true,
         'body_title' => true,
@@ -48,10 +48,10 @@
         'last_crumb_format' => '%s',
     );
-    var $pages = array();
+    public $pages = array();
 
     /**
      * Navigation constructor.
      */
-    function Navigation($params=null)
+    public function __construct($params=null)
     {
 		$app =& App::getInstance();
@@ -74,5 +74,5 @@
      * @param   array   $vars       Additional page variables.
      */
-    function add($title, $url=null, $vars=array())
+    public function add($title, $url=null, $vars=array())
     {
         $page = array(
@@ -91,5 +91,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -110,5 +110,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -127,5 +127,5 @@
      * @access  public
      */
-    function clear()
+    public function clear()
     {
         $this->pages = array();
@@ -139,5 +139,5 @@
      * @param mixed $val      Value to set variable to.
      */
-    function set($key, $val)
+    public function set($key, $val)
     {
         // Set params of current page.
@@ -154,5 +154,5 @@
      * @return mixed          Value stored in session.
      */
-    function get($key, $default='')
+    public function get($key, $default='')
     {
         $curr_page =& $this->pages[sizeof($this->pages) - 1];
@@ -205,5 +205,5 @@
      * @return  mixed           Path (string) or false if path param is not set.
      */
-    function getPath($key='title')
+    public function getPath($key='title')
     {
         if ($this->getParam('path')) {
@@ -227,5 +227,5 @@
      * @return  string   Breadcrumbs or empty string if breadcrumbs param not set.
      */
-    function getBreadcrumbs()
+    public function getBreadcrumbs()
     {
 		$app =& App::getInstance();
@@ -279,5 +279,5 @@
      * @return  mixed   The value set for $return, TRUE by default.
      */
-    function currentPage($test_uri, $true_return=true, $false_return=false, $strip_query=false)
+    public function currentPage($test_uri, $true_return=true, $false_return=false, $strip_query=false)
     {
         $actual_uri = $strip_query ? strtok($_SERVER['REQUEST_URI'], '?') : $_SERVER['REQUEST_URI'];
@@ -291,4 +291,2 @@
 }
 // End of class.
-
-?>
Index: /trunk/lib/PEdit.inc.php
===================================================================
--- /trunk/lib/PEdit.inc.php	(revision 467)
+++ /trunk/lib/PEdit.inc.php	(revision 468)
@@ -70,5 +70,5 @@
 
     // PEdit object parameters.
-    var $_params = array(
+    private $_params = array(
         'data_dir' => '',
         'character_set' => 'utf-8',
@@ -77,9 +77,9 @@
     );
 
-    var $_data = array(); // Array to store loaded data.
-    var $_data_file = ''; // Full file path to the pedit data file.
-    var $_authorized = false; // User is authenticated to see extended functions.
-    var $_data_loaded = false;
-    var $op = '';
+    private $_data = array(); // Array to store loaded data.
+    private $_data_file = ''; // Full file path to the pedit data file.
+    private $_authorized = false; // User is authenticated to see extended functions.
+    private $_data_loaded = false;
+    public $op = '';
 
     /**
@@ -93,5 +93,5 @@
      * @param optional array $params  A hash containing connection parameters.
      */
-    function PEdit($params)
+    public function __construct($params)
     {
         $this->setParam($params);
@@ -121,5 +121,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -140,5 +140,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -159,5 +159,5 @@
     * @since    12 Apr 2006 12:43:47
     */
-    function start($initialize_data_file=false)
+    public function start($initialize_data_file=false)
     {
 		$app =& App::getInstance();
@@ -217,5 +217,5 @@
      * @param array     $options         Additional options to store with this data.
      */
-    function set($name, $options=array())
+    public function set($name, $options=array())
     {
 		$app =& App::getInstance();
@@ -236,5 +236,5 @@
      * @return string        The trimmed content of the named data.
      */
-    function get($name)
+    public function get($name)
     {
         $name = preg_replace('/\s/', '_', $name);
@@ -251,5 +251,5 @@
      * @return bool  False if unauthorized or current page is a version.
      */
-    function formBegin()
+    public function formBegin()
     {
 		$app =& App::getInstance();
@@ -288,5 +288,5 @@
      * @access public
      */
-    function printAllForms()
+    public function printAllForms()
     {
         if ($this->_authorized && $this->op == 'Edit' && is_array($this->_data) && $this->_data_loaded) {
@@ -305,5 +305,5 @@
      * @param string $type      Type of form to print. Currently only 'text' and 'textarea' supported.
      */
-    function printForm($name, $type='text')
+    public function printForm($name, $type='text')
     {
         if ($this->_authorized && $this->op == 'Edit' && $this->_data_loaded) {
@@ -345,5 +345,5 @@
      * @return bool  False if unauthorized or current page is a version.
      */
-    function formEnd()
+    public function formEnd()
     {
         if (!$this->_authorized || empty($this->_data)) {
@@ -399,5 +399,5 @@
      * @access public
      */
-    function printVersions()
+    public function printVersions()
     {
 		$app =& App::getInstance();
@@ -442,5 +442,5 @@
     * @since    12 Apr 2006 10:52:35
     */
-    function _fileHash()
+    private function _fileHash()
     {
 		$app =& App::getInstance();
@@ -457,5 +457,5 @@
     * @since    11 Apr 2006 20:36:26
     */
-    function _loadDataFile()
+    private function _loadDataFile()
     {
 		$app =& App::getInstance();
@@ -496,5 +496,5 @@
     * @since    11 Apr 2006 20:53:42
     */
-    function _initializeDataFile()
+    private function _initializeDataFile()
     {
 		$app =& App::getInstance();
@@ -512,5 +512,5 @@
      * @return bool  False if unauthorized or on failure. True on success.
      */
-    function _writeData()
+    private function _writeData()
     {
 		$app =& App::getInstance();
@@ -560,5 +560,5 @@
     * @since    11 Apr 2006 22:48:30
     */
-    function _filePutContents($filename, $content)
+    private function _filePutContents($filename, $content)
     {
 		$app =& App::getInstance();
@@ -610,5 +610,5 @@
      * @return bool  False on failure. True on success.
      */
-    function _createVersion()
+    private function _createVersion()
     {
 		$app =& App::getInstance();
@@ -648,5 +648,5 @@
     * @since    12 Apr 2006 11:08:11
     */
-    function _deleteOldVersions()
+    private function _deleteOldVersions()
     {
 		$app =& App::getInstance();
@@ -676,5 +676,5 @@
      * @return array  Array of versions.
      */
-    function _getVersions()
+    private function _getVersions()
     {
         $version_files = array();
@@ -707,5 +707,5 @@
      * @return bool  False on failure. True on success.
      */
-    function _restoreVersion($version)
+    private function _restoreVersion($version)
     {
 		$app =& App::getInstance();
@@ -742,4 +742,2 @@
 
 } // End class.
-
-?>
Index: /trunk/lib/PageNumbers.inc.php
===================================================================
--- /trunk/lib/PageNumbers.inc.php	(revision 467)
+++ /trunk/lib/PageNumbers.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -39,33 +39,33 @@
 class PageNumbers {
 
-    var $total_items;       // Total quantity of items.
-    var $total_pages;       // The total number of pages.
-    var $current_page = 1;  // Current page number.
-    var $first_item;        // The counter for the first item on this page (zero index).
-    var $last_item;         // The counter for the last item on this page (zero index).
-    var $max_num_links = 9; // The max number of links to show on page (odd numbers look best).
-    var $_num_links;        // The number of links to show on page.
-    var $_per_page = 25;    // Items per page.
+    public $total_items;       // Total quantity of items.
+    public $total_pages;       // The total number of pages.
+    public $current_page = 1;  // Current page number.
+    public $first_item;        // The counter for the first item on this page (zero index).
+    public $last_item;         // The counter for the last item on this page (zero index).
+    public $max_num_links = 9; // The max number of links to show on page (odd numbers look best).
+    private $_num_links;        // The number of links to show on page.
+    private $_per_page = 25;    // Items per page.
 
     // Flags to ensure all necessary values have been set before calling calculate().
-    var $set_per_page_initialized = false;
-    var $set_page_number_initialized = false;
-    var $set_total_items_initialized = false;
+    public $set_per_page_initialized = false;
+    public $set_page_number_initialized = false;
+    public $set_total_items_initialized = false;
 
     // These are initialized in the constructor.
-    var $per_page_options;
-    var $left_arrow;
-    var $left_arrow_disabled;
-    var $left_dbl_arrow;
-    var $left_dbl_arrow_disabled;
-    var $right_arrow;
-    var $right_arrow_disabled;
-    var $right_dbl_arrow;
-    var $right_dbl_arrow_disabled;
+    public $per_page_options;
+    public $left_arrow;
+    public $left_arrow_disabled;
+    public $left_dbl_arrow;
+    public $left_dbl_arrow_disabled;
+    public $right_arrow;
+    public $right_arrow_disabled;
+    public $right_dbl_arrow;
+    public $right_dbl_arrow_disabled;
 
     /**
      * PageNumbers constructor. All arguments are depreciated. Use set* functions instead.
      */
-    function PageNumbers()
+    public function __construct()
     {
         // Default options for the quantity per page links.
@@ -85,5 +85,5 @@
         // in special cases like using a /my/page/# scheme.
         $this->url_base = $_SERVER['PHP_SELF'] . '?page_number=';
-        
+
         $this->prefs = new Prefs($_SERVER['PHP_SELF']);
         $this->prefs->setParam(array('persistent' => false));
@@ -93,5 +93,5 @@
      * Set the number of items per page.
      */
-    function setPerPage($per_page, $default=25, $save_value=true)
+    public function setPerPage($per_page, $default=25, $save_value=true)
     {
     	// (1) By provided argument, if valid.
@@ -115,5 +115,5 @@
      * Set the current page number.
      */
-    function setPageNumber($page_number, $save_value=true)
+    public function setPageNumber($page_number, $save_value=true)
     {
         // (1) By provided argument, if valid.
@@ -139,5 +139,5 @@
      * Set the total number of items.
      */
-    function setTotalItems($total_items)
+    public function setTotalItems($total_items)
     {
         if (is_numeric($total_items) && $total_items > 0) {
@@ -158,5 +158,5 @@
      * @access public
      */
-    function calculate()
+    public function calculate()
     {
 		$app =& App::getInstance();
@@ -212,5 +212,5 @@
      * Returns the SQL code to limit query to items that are on current page.
      */
-    function getLimitSQL()
+    public function getLimitSQL()
     {
 		$app =& App::getInstance();
@@ -230,5 +230,5 @@
      * @access public
      */
-    function printPerPageLinks($query_key='per_page')
+    public function printPerPageLinks($query_key='per_page')
     {
 		$app =& App::getInstance();
@@ -260,5 +260,5 @@
      * @access public
      */
-    function getPageNumURL($page_number, $carry_args=null)
+    public function getPageNumURL($page_number, $carry_args=null)
     {
 		$app =& App::getInstance();
@@ -266,5 +266,5 @@
         return $app->oHREF($this->url_base . $page_number, $carry_args);
     }
-    function printPageNumURL($page_number, $carry_args=null)
+    public function printPageNumURL($page_number, $carry_args=null)
     {
         echo $this->getPageNumURL($page_number, $carry_args);
@@ -276,5 +276,5 @@
      * @access public
      */
-    function getPageNumbersArray($carry_args=null)
+    public function getPageNumbersArray($carry_args=null)
     {
         $page_numbers = array();
@@ -296,5 +296,5 @@
      * @access public
      */
-    function getPageNumbers($carry_args=null)
+    public function getPageNumbers($carry_args=null)
     {
         $page_numbers_string = '';
@@ -361,5 +361,5 @@
     }
 
-    function printPageNumbers($carry_args=null)
+    public function printPageNumbers($carry_args=null)
     {
         echo $this->getPageNumbers($carry_args);
@@ -368,3 +368,2 @@
 }
 
-?>
Index: /trunk/lib/PageSequence.inc.php
===================================================================
--- /trunk/lib/PageSequence.inc.php	(revision 467)
+++ /trunk/lib/PageSequence.inc.php	(revision 468)
@@ -35,9 +35,9 @@
 class PageSequence
 {
-    var $current_step_id = 0;
-    var $start_url;
-    var $sequence_title = '';
-    var $seq = '_sequence_';
-    var $idle_timeout;
+    public $current_step_id = 0;
+    public $start_url;
+    public $sequence_title = '';
+    public $seq = '_sequence_';
+    public $idle_timeout;
 
     /**
@@ -47,5 +47,5 @@
      * @access public
      */
-    function PageSequence($params)
+    public function __construct($params)
     {
         if (isset($params['sequence_title'])) {
@@ -84,5 +84,5 @@
      * @access public
      */
-    function addStep($step_id, $params)
+    public function addStep($step_id, $params)
     {
         // Keys for the steps array cannot be numeric.
@@ -114,5 +114,5 @@
      * @return bool true on success, false on failure
      */
-    function setFeature($step_id=null, $features)
+    public function setFeature($step_id=null, $features)
     {
         $pos = isset($step_id) ? $this->getPosition($step_id) : $this->getPosition();
@@ -134,5 +134,5 @@
      * @return mixed          Value stored in session.
      */
-    function getFeature($step_id, $key, $default='')
+    public function getFeature($step_id, $key, $default='')
     {
         $pos = isset($step_id) ? $this->getPosition($step_id) : $this->getPosition();
@@ -151,5 +151,5 @@
      * @access public
      */
-    function setCurrent($step_id)
+    public function setCurrent($step_id)
     {
 		$app =& App::getInstance();
@@ -171,5 +171,5 @@
      * @access public
      */
-    function getID($pos=null)
+    public function getID($pos=null)
     {
         if (isset($pos)) {
@@ -188,5 +188,5 @@
      * @access public
      */
-    function getPosition($step_id=null)
+    public function getPosition($step_id=null)
     {
         // Get current step id if step not provided.
@@ -217,5 +217,5 @@
      * @access public
      */
-    function getRequiredID($curr_step_id)
+    public function getRequiredID($curr_step_id)
     {
         if ('' === $curr_step_id) {
@@ -242,5 +242,5 @@
      * @access public
      */
-    function getNextID()
+    public function getNextID()
     {
         // Loop through all steps.
@@ -263,5 +263,5 @@
      * @access public
      */
-    function complete($step_id=null)
+    public function complete($step_id=null)
     {
         $pos = isset($step_id) ? $this->getPosition($step_id) : $this->getPosition();
@@ -277,5 +277,5 @@
      * @access public
      */
-    function printEditLink($step_id=null)
+    public function printEditLink($step_id=null)
     {
 		$app =& App::getInstance();
@@ -296,5 +296,5 @@
      * @access public
      */
-    function setDataDefault($data_key, $data_val)
+    public function setDataDefault($data_key, $data_val)
     {
         if (!isset($_SESSION[$this->seq]['data'][$data_key])) {
@@ -310,5 +310,5 @@
      * @access public
      */
-    function getData($data_key=null)
+    public function getData($data_key=null)
     {
         if (!isset($data_key)) {
@@ -328,5 +328,5 @@
      * @access public
      */
-    function clearData($data_key=null)
+    public function clearData($data_key=null)
     {
         if (isset($data_key)) {
@@ -342,5 +342,5 @@
      * Deletes all data that are older than auto_timeout. Set current time if not not expired or not set.
      */
-    function _auto_timeout()
+    private function _auto_timeout()
     {
 		$app =& App::getInstance();
@@ -363,5 +363,5 @@
      * @access public
      */
-    function registerData($step_data)
+    public function registerData($step_data)
     {
         $_SESSION[$this->seq]['data'] = array_merge($_SESSION[$this->seq]['data'], $step_data);
@@ -372,5 +372,5 @@
      *
      */
-    function startOver()
+    public function startOver()
     {
         $this->current_step_id = 0;
@@ -383,3 +383,2 @@
 } // END CLASS
 
-?>
Index: /trunk/lib/PayPal.inc.php
===================================================================
--- /trunk/lib/PayPal.inc.php	(revision 467)
+++ /trunk/lib/PayPal.inc.php	(revision 468)
@@ -33,5 +33,5 @@
 
     // General object parameters.
-    var $_params = array(
+    private $_params = array(
         'paypal_url' => 'https://www.paypal.com/cgi-bin/webscr',
         'test_mode' => false,
@@ -39,11 +39,11 @@
 
     // Options used for specific buttons and links.
-    var $_default_button_options = array();
+    private $_default_button_options = array();
 
     // Array of buttons created by newButton().
-    var $_buttons = array();
+    private $_buttons = array();
 
     // Store the response from the last IPN.
-    var $_ipn_response;
+    private $_ipn_response;
 
     /**
@@ -52,5 +52,5 @@
      * @param   bool    $test_mode  Use PayPal sandbox for testing.
      */
-    function PayPal($test_mode=false)
+    public function __construct($test_mode=false)
     {
         if ($test_mode) {
@@ -95,5 +95,5 @@
      * @return  bool    True on success, false on failure.
      */
-    function setButtonDefaults($type, $options)
+    public function setButtonDefaults($type, $options)
     {
 		$app =& App::getInstance();
@@ -127,5 +127,5 @@
      * @return  bool    True on success, false on failure.
      */
-    function newButton($type, $name, $options=null)
+    public function newButton($type, $name, $options=null)
     {
 		$app =& App::getInstance();
@@ -162,5 +162,5 @@
      * @return  mixed   Link of button, or false on failure.
      */
-    function getLink($name)
+    public function getLink($name)
     {
 		$app =& App::getInstance();
@@ -196,5 +196,5 @@
      * @param   string  $name   Name of button for which to generate link.
      */
-    function printLink($name)
+    public function printLink($name)
     {
         echo $this->getLink($name);
@@ -208,5 +208,5 @@
      * @param   string  $name   Name of button to print.
      */
-    function printButton($name)
+    public function printButton($name)
     {
         ?>
@@ -234,5 +234,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -253,5 +253,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -272,5 +272,5 @@
      * @return  bool    True if valid, false if invalid.
      */
-    function incomingIPNRequest()
+    public function incomingIPNRequest()
     {
         if ($_SERVER['REQUEST_METHOD'] == 'POST'
@@ -290,5 +290,5 @@
      * @return  bool    True on success, false on failure.
      */
-    function processIPN()
+    public function processIPN()
     {
 		$app =& App::getInstance();
@@ -351,5 +351,5 @@
      * @return  bool    True if response contains VERIFIED, false otherwise.
      */
-    function verifiedIPN()
+    public function verifiedIPN()
     {
 		$app =& App::getInstance();
@@ -380,3 +380,2 @@
 } // End of class.
 
-?>
Index: /trunk/lib/Prefs.inc.php
===================================================================
--- /trunk/lib/Prefs.inc.php	(revision 467)
+++ /trunk/lib/Prefs.inc.php	(revision 468)
@@ -55,8 +55,8 @@
 
     // Namespace of this instance of Prefs.
-    var $_ns;
+    private $_ns;
 
     // Configuration parameters for this object.
-    var $_params = array(
+    private $_params = array(
 
         // Enable database storage. If this is false, all prefs will live only as long as the session.
@@ -80,5 +80,5 @@
      * Prefs constructor.
      */
-    function Prefs($namespace='')
+    public function __construct($namespace='')
     {
 		$app =& App::getInstance();
@@ -104,5 +104,5 @@
      * @since   04 Jun 2006 16:41:42
      */
-    function initDB($recreate_db=false)
+    public function initDB($recreate_db=false)
     {
 		$app =& App::getInstance();
@@ -142,5 +142,5 @@
      * @param  array $params   Array of param keys and values to set.
      */
-    function setParam($params=null)
+    public function setParam($params=null)
     {
         if (isset($params) && is_array($params)) {
@@ -157,5 +157,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -176,5 +176,5 @@
      * @param  array $defaults  Array of key-value pairs
      */
-    function setDefaults($defaults)
+    public function setDefaults($defaults)
     {
         if (isset($defaults) && is_array($defaults)) {
@@ -192,5 +192,5 @@
      * @param  bool   $persistent   Save this value forever? Set to false and value will exist as long as the session is in use.
      */
-    function set($key, $val)
+    public function set($key, $val)
     {
         $app =& App::getInstance();
@@ -223,5 +223,5 @@
      * @return string           The value of the preference.
      */
-    function get($key)
+    public function get($key)
     {
         $app =& App::getInstance();
@@ -244,5 +244,5 @@
      * @return boolean          True if the preference isset and not empty false otherwise.
      */
-    function exists($key)
+    public function exists($key)
     {
         return array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['saved']);
@@ -254,5 +254,5 @@
      * @param string $key       The name of the preference to delete.
      */
-    function delete($key)
+    public function delete($key)
     {
         unset($_SESSION['_prefs'][$this->_ns]['saved'][$key]);
@@ -263,5 +263,5 @@
      * as $auth->clear(), such as when logging out.
      */
-    function clear($focus='all')
+    public function clear($focus='all')
     {
         switch ($focus) {
@@ -295,5 +295,5 @@
     * @since    04 Jun 2006 16:56:53
     */
-    function load($force=false)
+    public function load($force=false)
     {
         $app =& App::getInstance();
@@ -352,5 +352,5 @@
     * @since    04 Jun 2006 17:12:44
     */
-    function _isLoaded()
+    private function _isLoaded()
     {
         if (isset($_SESSION['_prefs'][$this->_ns]['load_datetime'])
@@ -373,5 +373,5 @@
     * @since    04 Jun 2006 17:19:56
     */
-    function save()
+    public function save()
     {
         $app =& App::getInstance();
@@ -424,4 +424,2 @@
 }
 
-
-?>
Index: /trunk/lib/ScriptTimer.inc.php
===================================================================
--- /trunk/lib/ScriptTimer.inc.php	(revision 467)
+++ /trunk/lib/ScriptTimer.inc.php	(revision 468)
@@ -26,15 +26,15 @@
 class ScriptTimer {
 
-    var $time_format = '%.3f';
-    var $_timing_start_times = array();
-    var $_timing_stop_times = array();
-    var $_timing_cumulative_times = array();
+    public $time_format = '%.3f';
+    private $_timing_start_times = array();
+    private $_timing_stop_times = array();
+    private $_timing_cumulative_times = array();
     
-	function start($name='default')
+	public function start($name='default')
 	{
         $this->_timing_start_times[$name] = explode(' ', microtime());
 	}
 	
-	function stop($name='default')
+	public function stop($name='default')
 	{
 	    if (!isset($this->_timing_stop_times[$name]) || !isset($this->_timing_cumulative_times[$name])) {
@@ -46,5 +46,5 @@
 	}
 	
-	function getTime($name='default')
+	public function getTime($name='default')
 	{
         if (!isset($this->_timing_start_times[$name])) {
@@ -62,5 +62,5 @@
 	}
 	
-	function printAll($sort_by_time=false)
+	public function printAll($sort_by_time=false)
 	{
 	    $names = array_map('strlen', array_keys($this->_timing_start_times));
@@ -81,4 +81,2 @@
 	}
 }
-
-?>
Index: /trunk/lib/SortOrder.inc.php
===================================================================
--- /trunk/lib/SortOrder.inc.php	(revision 467)
+++ /trunk/lib/SortOrder.inc.php	(revision 468)
@@ -37,11 +37,11 @@
 class SortOrder {
 
-    var $_columns;
-    var $sort_by;
-    var $order;
-    var $asc_widget;
-    var $desc_widget;
-    var $default_sort;
-    var $default_order;
+    private $_columns;
+    public $sort_by;
+    public $order;
+    public $asc_widget;
+    public $desc_widget;
+    public $default_sort;
+    public $default_order;
 
     /**
@@ -53,5 +53,5 @@
      *                               current order.
      */
-    function SortOrder($default_sort = '', $default_order = '')
+    public function __construct($default_sort = '', $default_order = '')
     {
         $app =& App::getInstance();
@@ -81,5 +81,5 @@
      * @param string $desc_sql  The sort SQL if $this->order is descending.
      */
-    function setColumn($name, $asc_sql, $desc_sql)
+    public function setColumn($name, $asc_sql, $desc_sql)
     {
         $this->_columns[$name] = array(
@@ -99,5 +99,5 @@
      *                               current order.
      */
-    function setDefault($default_sort = '', $default_order = '')
+    public function setDefault($default_sort = '', $default_order = '')
     {
         // Which column to sort by?
@@ -139,5 +139,5 @@
      *                               for example, for an alphabetical sort)
      */
-    function set($sort=null, $order=null, $save_value=true)
+    public function set($sort=null, $order=null, $save_value=true)
     {
         // Set new sort value.
@@ -163,5 +163,5 @@
      * @return array    Array with keys: sort and order. These can be fed back into the SortOrder::set() method or defaults.
      */
-    function get()
+    public function get()
     {
         return array(
@@ -174,5 +174,5 @@
      * Returns the SQL code to sort by set column and set order.
      */
-    function getSortOrderSQL()
+    public function getSortOrderSQL()
     {
 		$app =& App::getInstance();
@@ -205,5 +205,5 @@
      *                               for example, for an alphabetical sort)
      */
-    function printSortHeader($col, $col_name, $default_order='ASC')
+    public function printSortHeader($col, $col_name, $default_order='ASC')
     {
 		$app =& App::getInstance();
@@ -226,3 +226,2 @@
 }
 
-?>
Index: /trunk/lib/SpellCheck.inc.php
===================================================================
--- /trunk/lib/SpellCheck.inc.php	(revision 467)
+++ /trunk/lib/SpellCheck.inc.php	(revision 468)
@@ -61,5 +61,5 @@
 class SpellCheck {
 
-    var $_params = array(
+    private $_params = array(
         'language' => 'en',
         'personal_wordlist' => '', // Text file to save custom words to.
@@ -70,8 +70,8 @@
     );
 
-    var $_pspell_cfg_handle;
-    var $_pspell_handle;
-    var $_use_personal_wordlist = false;
-    var $_errors = array();
+    private $_pspell_cfg_handle;
+    private $_pspell_handle;
+    private $_use_personal_wordlist = false;
+    private $_errors = array();
 
     /**
@@ -80,5 +80,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function SpellCheck($params)
+    public function __construct($params)
     {
 		$app =& App::getInstance();
@@ -118,5 +118,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -137,5 +137,5 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
@@ -154,5 +154,5 @@
      * @return bool   True if any errors were found, false otherwise.
      */
-    function anyErrors()
+    public function anyErrors()
     {
         return (sizeof($this->_errors) > 0);
@@ -162,5 +162,5 @@
      * Reset the error list.
      */
-    function resetErrorList()
+    public function resetErrorList()
     {
         $this->_errors = array();
@@ -177,5 +177,5 @@
      * @since   09 Jun 2005 18:23:51
      */
-    function check($word)
+    public function check($word)
     {
         if (pspell_check($this->_pspell_handle, $word)) {
@@ -197,5 +197,5 @@
      * @since   09 Jun 2005 18:23:51
      */
-    function suggest($word)
+    public function suggest($word)
     {
         return pspell_suggest($this->_pspell_handle, $word);
@@ -212,5 +212,5 @@
      * @since   09 Jun 2005 18:23:51
      */
-    function add($word)
+    public function add($word)
     {
 		$app =& App::getInstance();
@@ -237,5 +237,5 @@
      * @since   09 Jun 2005 18:23:51
      */
-    function save()
+    public function save()
     {
 		$app =& App::getInstance();
@@ -263,5 +263,5 @@
      * @since   09 Jun 2005 21:29:49
      */
-    function getStringSuggestions($string)
+    public function getStringSuggestions($string)
     {
         $corrections = array();
@@ -299,5 +299,5 @@
      * @since   09 Jun 2005 22:11:27
      */
-    function checkString($string)
+    public function checkString($string)
     {
         $errors = array();
@@ -331,5 +331,5 @@
      * @since   09 Jun 2005 21:29:49
      */
-    function getStringHighlighted($string, $show_footnote=false)
+    public function getStringHighlighted($string, $show_footnote=false)
     {
         $words = preg_split('/([\W]+?)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -357,5 +357,5 @@
      * @since   09 Jun 2005 21:29:49
      */
-    function printCorrectionForm($form_name)
+    public function printCorrectionForm($form_name)
     {
         ?>
@@ -402,5 +402,5 @@
      * @since   09 Jun 2005 23:15:35
      */
-    function anyFormCorrections()
+    public function anyFormCorrections()
     {
         return (false !== getFormData('spelling_suggestions', false)) || (false !== getFormData('spelling_corrections', false));
@@ -417,5 +417,5 @@
      * @since   09 Jun 2005 23:18:51
      */
-    function applyFormCorrections($form_name)
+    public function applyFormCorrections($form_name)
     {
         $form_words = preg_split('/([\W]+?)/', getFormData($form_name), -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -445,3 +445,2 @@
 } // End.
 
-?>
Index: /trunk/lib/TemplateGlue.inc.php
===================================================================
--- /trunk/lib/TemplateGlue.inc.php	(revision 467)
+++ /trunk/lib/TemplateGlue.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -24,17 +24,4 @@
  * TemplateGlue.inc.php
  */
-
-/**
- * Print URL to download file with BBEdit/Interarchy. "USER" must be a pre-set
- * environment variable. Files must reside within and be relative to env "DOCUMENT_ROOT".
- *
- * @access  public
- * @param   mixed   $file   File path relative to DOCUMENT_ROOT (i.e. '/_templates/index.ihtml').
- * @return  string  <a> with file basename as text.
- */
-function bbftp($file)
-{
-    return sprintf('<a href="bbftp://%s@%s:%s%s" title="%s" style="text-decoration: none; border-bottom: blue 1px dotted;">%s</a>', $_SERVER['USER'], $_SERVER['HTTP_HOST'], $_SERVER['DOCUMENT_ROOT'], $file, $file, basename($file));
-}
 
 /**
@@ -89,5 +76,5 @@
 	$app =& App::getInstance();
 	$db =& DB::getInstance();
-	
+
     $qid = $db->query("SHOW COLUMNS FROM " . $db->escapeString($db_table) . " LIKE '" . $db->escapeString($db_col) . "'",false);
 
@@ -95,5 +82,5 @@
     if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $enum)) {
         if ($sort) {
-            natsort($enum[1]);            
+            natsort($enum[1]);
         }
         return $enum[1];
@@ -329,5 +316,5 @@
 {
 	$db =& DB::getInstance();
-	
+
     // Sometimes preselected comes as a comma list.
     if (!is_array($preselected)) {
@@ -373,5 +360,5 @@
 {
 	$db =& DB::getInstance();
-	
+
     // Sometimes preselected comes as a comma list.
     if (!is_array($preselected)) {
@@ -501,4 +488,2 @@
     }
 }
-
-?>
Index: /trunk/lib/Upload.inc.php
===================================================================
--- /trunk/lib/Upload.inc.php	(revision 467)
+++ /trunk/lib/Upload.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -41,5 +41,5 @@
 
     // General object parameters.
-    var $_params = array(
+    private $_params = array(
 
         // Which messages do we pass to raiseMsg?
@@ -63,8 +63,8 @@
 
     // Array of files with errors.
-    var $errors = array();
+    public $errors = array();
 
     // Array of file name extensions and corresponding mime-types.
-    var $mime_extension_map = array( 'ez' => 'application/andrew-inset', 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => 'application/octet-stream', 'class' => 'application/octet-stream', 'dll' => 'application/octet-stream', 'dms' => 'application/octet-stream', 'exe' => 'application/octet-stream', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'so' => 'application/octet-stream', 'oda' => 'application/oda', 'pdf' => 'application/pdf', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', 'smi' => 'application/smil', 'smil' => 'application/smil', 'mif' => 'application/vnd.mif', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'sxc' => 'application/vnd.sun.xml.calc', 'stc' => 'application/vnd.sun.xml.calc.template', 'sxd' => 'application/vnd.sun.xml.draw', 'std' => 'application/vnd.sun.xml.draw.template', 'sxi' => 'application/vnd.sun.xml.impress', 'sti' => 'application/vnd.sun.xml.impress.template', 'sxm' => 'application/vnd.sun.xml.math', 'sxw' => 'application/vnd.sun.xml.writer', 'sxg' => 'application/vnd.sun.xml.writer.global', 'stw' => 'application/vnd.sun.xml.writer.template', 'vsd' => 'application/vnd.visio', 'wbxml' => 'application/vnd.wap.wbxml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'bcpio' => 'application/x-bcpio', 'vcd' => 'application/x-cdlink', 'pgn' => 'application/x-chess-pgn', 'Z' => 'application/x-compress', 'cpio' => 'application/x-cpio', 'csh' => 'application/x-csh', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'dxr' => 'application/x-director', 'dvi' => 'application/x-dvi', 'spl' => 'application/x-futuresplash', 'gtar' => 'application/x-gtar', 'tgz' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'hdf' => 'application/x-hdf', 'php' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php3', 'js' => 'application/x-javascript', 'skd' => 'application/x-koan', 'skm' => 'application/x-koan', 'skp' => 'application/x-koan', 'skt' => 'application/x-koan', 'latex' => 'application/x-latex', 'wmd' => 'application/x-ms-wmd', 'wmz' => 'application/x-ms-wmz', 'cdf' => 'application/x-netcdf', 'nc' => 'application/x-netcdf', 'pl' => 'application/x-perl', 'pm' => 'application/x-perl', 'psd' => 'application/x-photoshop', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'swf' => 'application/x-shockwave-flash', 'sit' => 'application/x-stuffit', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'roff' => 'application/x-troff', 't' => 'application/x-troff', 'tr' => 'application/x-troff', 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'ms' => 'application/x-troff-ms', 'ustar' => 'application/x-ustar', 'src' => 'application/x-wais-source', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xml' => 'application/xml', 'zip' => 'application/zip', 'au' => 'audio/basic', 'snd' => 'audio/basic', 'kar' => 'audio/midi', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mpga' => 'audio/mpeg', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'm3u' => 'audio/x-mpegurl', 'wax' => 'audio/x-ms-wax', 'wma' => 'audio/x-ms-wma', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'wav' => 'audio/x-wav', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-xyz', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'ief' => 'image/ief', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'wbmp' => 'image/vnd.wap.wbmp', 'ras' => 'image/x-cmu-raster', 'pnm' => 'image/x-portable-anymap', 'pbm' => 'image/x-portable-bitmap', 'pgm' => 'image/x-portable-graymap', 'ppm' => 'image/x-portable-pixmap', 'rgb' => 'image/x-rgb', 'xbm' => 'image/x-xbitmap', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-xwindowdump', 'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh', 'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml', 'ics' => 'text/calendar', 'ifb' => 'text/calendar', 'vcs' => 'text/calendar', 'vfb' => 'text/calendar', 'css' => 'text/css', 'csv' => 'text/csv', 'diff' => 'text/diff', 'patch' => 'text/diff', 'htm' => 'text/html', 'html' => 'text/html', 'shtml' => 'text/html', 'asc' => 'text/plain', 'log' => 'text/plain', 'po' => 'text/plain', 'txt' => 'text/plain', 'rtx' => 'text/richtext', 'rtf' => 'text/rtf', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'tsv' => 'text/tab-separated-values', 'wml' => 'text/vnd.wap.wml', 'wmls' => 'text/vnd.wap.wmlscript', 'etx' => 'text/x-setext', 'vcf' => 'text/x-vcard', 'xsl' => 'text/xml', 'mp4' => 'video/mp4', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mov' => 'video/quicktime', 'qt' => 'video/quicktime', 'mxu' => 'video/vnd.mpegurl', 'asf' => 'video/x-ms-asf', 'asx' => 'video/x-ms-asf', 'wm' => 'video/x-ms-wm', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wvx' => 'video/x-ms-wvx', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'ice' => 'x-conference/x-cooltalk', );
+    public $mime_extension_map = array( 'ez' => 'application/andrew-inset', 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => 'application/octet-stream', 'class' => 'application/octet-stream', 'dll' => 'application/octet-stream', 'dms' => 'application/octet-stream', 'exe' => 'application/octet-stream', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'so' => 'application/octet-stream', 'oda' => 'application/oda', 'pdf' => 'application/pdf', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', 'smi' => 'application/smil', 'smil' => 'application/smil', 'mif' => 'application/vnd.mif', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'sxc' => 'application/vnd.sun.xml.calc', 'stc' => 'application/vnd.sun.xml.calc.template', 'sxd' => 'application/vnd.sun.xml.draw', 'std' => 'application/vnd.sun.xml.draw.template', 'sxi' => 'application/vnd.sun.xml.impress', 'sti' => 'application/vnd.sun.xml.impress.template', 'sxm' => 'application/vnd.sun.xml.math', 'sxw' => 'application/vnd.sun.xml.writer', 'sxg' => 'application/vnd.sun.xml.writer.global', 'stw' => 'application/vnd.sun.xml.writer.template', 'vsd' => 'application/vnd.visio', 'wbxml' => 'application/vnd.wap.wbxml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'bcpio' => 'application/x-bcpio', 'vcd' => 'application/x-cdlink', 'pgn' => 'application/x-chess-pgn', 'Z' => 'application/x-compress', 'cpio' => 'application/x-cpio', 'csh' => 'application/x-csh', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'dxr' => 'application/x-director', 'dvi' => 'application/x-dvi', 'spl' => 'application/x-futuresplash', 'gtar' => 'application/x-gtar', 'tgz' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'hdf' => 'application/x-hdf', 'php' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php3', 'js' => 'application/x-javascript', 'skd' => 'application/x-koan', 'skm' => 'application/x-koan', 'skp' => 'application/x-koan', 'skt' => 'application/x-koan', 'latex' => 'application/x-latex', 'wmd' => 'application/x-ms-wmd', 'wmz' => 'application/x-ms-wmz', 'cdf' => 'application/x-netcdf', 'nc' => 'application/x-netcdf', 'pl' => 'application/x-perl', 'pm' => 'application/x-perl', 'psd' => 'application/x-photoshop', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'swf' => 'application/x-shockwave-flash', 'sit' => 'application/x-stuffit', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'roff' => 'application/x-troff', 't' => 'application/x-troff', 'tr' => 'application/x-troff', 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'ms' => 'application/x-troff-ms', 'ustar' => 'application/x-ustar', 'src' => 'application/x-wais-source', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xml' => 'application/xml', 'zip' => 'application/zip', 'au' => 'audio/basic', 'snd' => 'audio/basic', 'kar' => 'audio/midi', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mpga' => 'audio/mpeg', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'm3u' => 'audio/x-mpegurl', 'wax' => 'audio/x-ms-wax', 'wma' => 'audio/x-ms-wma', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'wav' => 'audio/x-wav', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-xyz', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'ief' => 'image/ief', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'wbmp' => 'image/vnd.wap.wbmp', 'ras' => 'image/x-cmu-raster', 'pnm' => 'image/x-portable-anymap', 'pbm' => 'image/x-portable-bitmap', 'pgm' => 'image/x-portable-graymap', 'ppm' => 'image/x-portable-pixmap', 'rgb' => 'image/x-rgb', 'xbm' => 'image/x-xbitmap', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-xwindowdump', 'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh', 'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml', 'ics' => 'text/calendar', 'ifb' => 'text/calendar', 'vcs' => 'text/calendar', 'vfb' => 'text/calendar', 'css' => 'text/css', 'csv' => 'text/csv', 'diff' => 'text/diff', 'patch' => 'text/diff', 'htm' => 'text/html', 'html' => 'text/html', 'shtml' => 'text/html', 'asc' => 'text/plain', 'log' => 'text/plain', 'po' => 'text/plain', 'txt' => 'text/plain', 'rtx' => 'text/richtext', 'rtf' => 'text/rtf', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'tsv' => 'text/tab-separated-values', 'wml' => 'text/vnd.wap.wml', 'wmls' => 'text/vnd.wap.wmlscript', 'etx' => 'text/x-setext', 'vcf' => 'text/x-vcard', 'xsl' => 'text/xml', 'mp4' => 'video/mp4', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mov' => 'video/quicktime', 'qt' => 'video/quicktime', 'mxu' => 'video/vnd.mpegurl', 'asf' => 'video/x-ms-asf', 'asx' => 'video/x-ms-asf', 'wm' => 'video/x-ms-wm', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wvx' => 'video/x-ms-wvx', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'ice' => 'x-conference/x-cooltalk', );
 
     /**
@@ -74,5 +74,5 @@
      * @param  array    $params     Array of parameters (key => val pairs).
      */
-    function setParam($params)
+    public function setParam($params)
     {
 		$app =& App::getInstance();
@@ -118,8 +118,8 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
-    {
-		$app =& App::getInstance();
-    
+    public function getParam($param)
+    {
+		$app =& App::getInstance();
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -144,5 +144,5 @@
      *                        In this case it is necessary to check the Upload::anyErrors method to discover if any did fail.
      */
-    function process($form_name, $custom_file_name=null)
+    public function process($form_name, $custom_file_name=null)
     {
 		$app =& App::getInstance();
@@ -278,6 +278,6 @@
 
             // Check to be sure the file has a valid file name extension.
-            if (!in_array(mb_strtolower($this->getFilenameExtension($file_name)), $this->getParam('valid_file_extensions'))) {
-                /// TODO: Add option to allow any extention to be uploaded.
+            if (!in_array(mb_strtolower(self::getFilenameExtension($file_name)), $this->getParam('valid_file_extensions'))) {
+                // TODO: Add option to allow any extention to be uploaded.
                 $this->_raiseMsg(sprintf(_("The file %s failed uploading: it is an unrecognized type. Files must have one of the following file name extensions: %s."), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__);
                 $app->logMsg(sprintf('The uploaded file %s has an unrecognized file name extension.', $file_name), LOG_WARNING, __FILE__, __LINE__);
@@ -306,5 +306,5 @@
 
             // FINAL path and file name, lowercase extension.
-            $file_extension = mb_strtolower($this->getFilenameExtension($file_name));
+            $file_extension = mb_strtolower(self::getFilenameExtension($file_name));
             $file_name = sprintf('%s.%s', mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $file_extension);
             $file_path_name = sprintf('%s/%s', $this->getParam('upload_path'), $file_name);
@@ -351,5 +351,5 @@
      * @return  bool                Success of operation.
      */
-    function deleteFile($file_name, $use_glob=false)
+    public function deleteFile($file_name, $use_glob=false)
     {
 		$app =& App::getInstance();
@@ -384,5 +384,5 @@
      * @return  bool                Success of operation.
      */
-    function moveFile($old_name, $new_name)
+    public function moveFile($old_name, $new_name)
     {
 		$app =& App::getInstance();
@@ -419,5 +419,5 @@
      * @return  bool                Existence of file.
      */
-    function exists($file_name)
+    public function exists($file_name)
     {
 		$app =& App::getInstance();
@@ -442,5 +442,5 @@
      * @since   15 Nov 2005 20:55:22
      */
-    function getFilenameGlob($pattern)
+    public function getFilenameGlob($pattern)
     {
         $file_list = glob(sprintf('%s/%s', $this->getParam('upload_path'), $pattern));
@@ -458,5 +458,5 @@
      * @return  array   List of file names.
      */
-    function getErrors()
+    public function getErrors()
     {
         return $this->errors;
@@ -468,5 +468,5 @@
      * @access  public
      */
-    function anyErrors()
+    public function anyErrors()
     {
         return sizeof($this->errors) > 0;
@@ -480,11 +480,11 @@
      * @return  string              The same name, but cleaned.
      */
-    function cleanFileName($file_name)
-    {
-        $bad  = 'Ã¡Ã©Ã­Ã³ÃºÃ ÃšÃ¬Ã²Ã¹Ã€Ã«Ã¯Ã¶ÃŒÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ¢ÃªÃ®ÃŽÃ»ÃÃÃÃÃÃ±Ã§Ã@';
-        $good = 'aeiouaeiouaeiouAEIOUAEIOUAEIOUaeiouAEIOUncCa';
+    public function cleanFileName($file_name)
+    {
+        $bad  = 'Ã¡Ã©Ã­Ã³ÃºÃ ÃšÃ¬Ã²Ã¹Ã€Ã«Ã¯Ã¶ÃŒÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ¢ÃªÃ®ÃŽÃ»ÃÃÃÃÃÃ±Ã§Ã';
+        $good = 'aeiouaeiouaeiouAEIOUAEIOUAEIOUaeiouAEIOUncC';
         $file_name = trim($file_name);
         $file_name = strtr($file_name, $bad, $good);
-        $file_name = preg_replace('/[^-\w.,~_=+()]+/i', '_', $file_name);
+        $file_name = preg_replace('/[^-\w.,~_=+()@]+/i', '_', $file_name);
         $file_name = mb_substr($file_name, 0, 250);
         return $file_name;
@@ -499,5 +499,5 @@
      * @return  string              The value found after the dot
      */
-    function getFilenameExtension($file_name)
+    static public function getFilenameExtension($file_name)
     {
         preg_match('/.*?\.(\w+)$/i', trim($file_name), $ext);
@@ -516,5 +516,5 @@
      * @param string $line    __LINE__.
      */
-    function _raiseMsg($message, $type, $file, $line)
+    public function _raiseMsg($message, $type, $file, $line)
     {
 		$app =& App::getInstance();
@@ -526,3 +526,2 @@
 }
 
-?>
Index: /trunk/lib/Utilities.inc.php
===================================================================
--- /trunk/lib/Utilities.inc.php	(revision 467)
+++ /trunk/lib/Utilities.inc.php	(revision 468)
@@ -950,5 +950,5 @@
 
 	$add_members = '/usr/lib/mailman/bin/add_members';
-    /// FIXME: checking of executable is disabled.
+    // FIXME: checking of executable is disabled.
     if (true || is_executable($add_members) && is_readable($add_members)) {
         $welcome_msg = $send_welcome_message ? 'y' : 'n';
@@ -982,5 +982,5 @@
 
     $remove_members = '/usr/lib/mailman/bin/remove_members';
-    /// FIXME: checking of executable is disabled.
+    // FIXME: checking of executable is disabled.
     if (true || is_executable($remove_members) && is_readable($remove_members)) {
         $userack = $send_user_ack ? '' : '--nouserack';
@@ -1120,4 +1120,2 @@
     }
 }
-
-?>
Index: /trunk/lib/Validator.inc.php
===================================================================
--- /trunk/lib/Validator.inc.php	(revision 467)
+++ /trunk/lib/Validator.inc.php	(revision 468)
@@ -31,20 +31,25 @@
  */
 
-// Known credit card types.
-define('CC_TYPE_VISA', 1);
-define('CC_TYPE_MASTERCARD', 2);
-define('CC_TYPE_AMEX', 3);
-define('CC_TYPE_DISCOVER', 4);
-define('CC_TYPE_DINERS', 5);
-define('CC_TYPE_JCB', 6);
-
-// validateEmail return types.
-define('VALIDATE_EMAIL_SUCCESS', 0);
-define('VALIDATE_EMAIL_REGEX_FAIL', 1);
-define('VALIDATE_EMAIL_LENGTH_FAIL', 2);
-define('VALIDATE_EMAIL_MX_FAIL', 3);
-
 class Validator {
 
+    // Known credit card types.
+    const CC_TYPE_VISA = 1;
+    const CC_TYPE_MASTERCARD = 2;
+    const CC_TYPE_AMEX = 3;
+    const CC_TYPE_DISCOVER = 4;
+    const CC_TYPE_DINERS = 5;
+    const CC_TYPE_JCB = 6;
+
+    // Validator::validateEmail() return types.
+    const EMAIL_SUCCESS = 0;
+    const EMAIL_REGEX_FAIL = 1;
+    const EMAIL_LENGTH_FAIL = 2;
+    const EMAIL_MX_FAIL = 3;
+
+    // Validator::validatePhone() return types.
+    const PHONE_SUCCESS = 0;
+    const PHONE_REGEX_FAIL = 1;
+    const PHONE_LENGTH_FAIL = 2;
+
     /**
      * Ensures a value is empty.
@@ -53,5 +58,5 @@
      * @return bool   true if form is not empty, false otherwise.
      */
-    function notEmpty($val)
+    static public function notEmpty($val)
     {
         return '' != trim((string)$val);
@@ -64,5 +69,5 @@
      * @return bool   true if form is empty, false otherwise.
      */
-    function isEmpty($val)
+    static public function isEmpty($val)
     {
         return '' == trim((string)$val);
@@ -75,5 +80,5 @@
      * @return bool   true if form is a string, false otherwise.
      */
-    function isString($val)
+    static public function isString($val)
     {
         return '' == trim((string)$val) || is_string($val);
@@ -86,5 +91,5 @@
      * @return bool   True if no errors found, false otherwise.
      */
-    function isNumber($val)
+    static public function isNumber($val)
     {
         return '' == trim((string)$val) || is_numeric($val);
@@ -98,5 +103,5 @@
      * @return bool   true if value is an integer
      */
-    function isInteger($val, $negative_ok=false)
+    static public function isInteger($val, $negative_ok=false)
     {
         $pattern = $negative_ok ? '/^-?[[:digit:]]+$/' : '/^[[:digit:]]+$/';
@@ -112,5 +117,5 @@
      * @return bool   true if value is a float
      */
-    function isFloat($val, $negative_ok=false)
+    static public function isFloat($val, $negative_ok=false)
     {
         $pattern = $negative_ok ? '/^-?[[:digit:]]*(?:\.?[[:digit:]]+)$/' : '/^[[:digit:]]*(?:\.?[[:digit:]]+)$/';
@@ -124,5 +129,5 @@
      * @return bool   true if value is a float
      */
-    function isArray($val)
+    static public function isArray($val)
     {
         return (is_string($val) && '' == trim((string)$val)) || is_array($val);
@@ -138,5 +143,5 @@
      * @return bool   true if value passes regex test
      */
-    function checkRegex($val, $regex, $valid_on_match=true)
+    static public function checkRegex($val, $regex, $valid_on_match=true)
     {
         return $valid_on_match ? preg_match($regex, $val) : !preg_match($regex, $val);
@@ -151,5 +156,5 @@
      * @return bool   true if string length is within given boundaries
      */
-    function stringLength($val, $min, $max)
+    static public function stringLength($val, $min, $max)
     {
         return mb_strlen(trim((string)$val)) >= $min && mb_strlen($val) <= $max;
@@ -164,5 +169,5 @@
      * @return bool   True if no errors found, false otherwise.
      */
-    function numericRange($val, $min, $max)
+    static public function numericRange($val, $min, $max)
     {
         return '' == trim((string)$val) || (is_numeric($val) && $val >= $min && $val <= $max);
@@ -180,8 +185,9 @@
      * @access  public
      * @param   string  $val    The input data to validate..
-     * @return  const           One of the constant values: VALIDATE_EMAIL_SUCCESS|VALIDATE_EMAIL_REGEX_FAIL|VALIDATE_EMAIL_LENGTH_FAIL|VALIDATE_EMAIL_MX_FAIL
+     * @param   bool    $strict Do we run strict tests?
+     * @return  const           One of the constant values: Validate::EMAIL_SUCCESS|Validate::EMAIL_REGEX_FAIL|Validate::EMAIL_LENGTH_FAIL|Validate::EMAIL_MX_FAIL
      * @author  Quinn Comendant <quinn@strangecode.com>
      */
-    function validateEmail($val)
+    static public function validateEmail($val, $strict=false)
     {
         require_once 'codebase/lib/Email.inc.php';
@@ -190,5 +196,5 @@
         // Test email address format.
         if (!preg_match($e->getParam('regex'), $val, $e_parts)) {
-            return VALIDATE_EMAIL_REGEX_FAIL;
+            return self::EMAIL_REGEX_FAIL;
         }
 
@@ -203,15 +209,35 @@
         // Test length.
         if (mb_strlen($local) > 64 || mb_strlen($domain) > 191) {
-            return VALIDATE_EMAIL_LENGTH_FAIL;
-        }
-
-        // Check domain exists: It's a domain if ip2long fails; Checkdnsrr ensures a MX record exists; Gethostbyname() ensures the domain exists.
-        // Compare ip2long twice for php4 backwards compat.
-        if ((ip2long($domain) == '-1' || ip2long($domain) === false) && function_exists('checkdnsrr') && !checkdnsrr($domain . '.', 'MX') && gethostbyname($domain) == $domain) {
-            // FIXME: Do we care?
-            // return VALIDATE_EMAIL_MX_FAIL;
-        }
-
-        return VALIDATE_EMAIL_SUCCESS;
+            return self::EMAIL_LENGTH_FAIL;
+        }
+
+        // Strict tests below.
+
+        // Check domain exists: It's a domain if ip2long fails; checkdnsrr ensures a MX record exists; gethostbyname() ensures the domain exists.
+        if ($strict && ip2long($domain) === false && function_exists('checkdnsrr') && !checkdnsrr($domain . '.', 'MX') && gethostbyname($domain) == $domain) {
+            return self::EMAIL_MX_FAIL;
+        }
+
+        return self::EMAIL_SUCCESS;
+    }
+
+    /**
+     * Check whether input is a valid phone number. Notice: it is now set
+     * to allow characters like - or () or + so people can type in a phone
+     * number that looks like: +1 (530) 555-1212
+     *
+     * @param  string  $form_name the name of the incoming form variable
+     *
+     * @return bool    true if no errors found, false otherwise
+     */
+    static public function validatePhone($val)
+    {
+        if (!self::checkRegex($val, '/^[0-9 +().-]*$/', true)) {
+            return self::PHONE_REGEX_FAIL;
+        }
+        if (!self::stringLength($val, 0, 25)) {
+            return self::PHONE_LENGTH_FAIL;
+        }
+        return self::PHONE_SUCCESS;
     }
 
@@ -223,8 +249,6 @@
      * @return bool    True if no errors found, false otherwise.
      */
-    function validateStrDate($val)
-    {
-		$app =& App::getInstance();
-
+    static public function validateStrDate($val)
+    {
 		if (is_string($val) && '' === trim($val)) {
 		    // Don't be too bothered about empty strings.
@@ -249,66 +273,66 @@
      * @return bool    True if no errors found, false otherwise.
      */
-     function validateCCNumber($val, $cc_type=null)
-     {
-         // Get rid of any non-digits
-         $cc_num = preg_replace('/[^\d]/', '', $val);
-
-         // Perform card-specific checks, if applicable
-         switch ($cc_type) {
-             case CC_TYPE_VISA :
-                 $regex = '/^4\d{15}$|^4\d{12}$/';
-                 break;
-             case CC_TYPE_MASTERCARD :
-                 $regex = '/^5[1-5]\d{14}$/';
-                 break;
-             case CC_TYPE_AMEX :
-                 $regex = '/^3[47]\d{13}$/';
-                 break;
-             case CC_TYPE_DISCOVER :
-                 $regex = '/^6011\d{12}$/';
-                 break;
-             case CC_TYPE_DINERS :
-                 $regex = '/^30[0-5]\d{11}$|^3[68]\d{12}$/';
-                 break;
-             case CC_TYPE_JCB :
-                 $regex = '/^3\d{15}$|^2131|1800\d{11}$/';
-                 break;
-             default :
-                 $regex = '';
-                 break;
-         }
-
-         if ('' != $regex && !preg_match($regex, $cc_num)) {
-             // Invalid format.
-             return false;
-         }
-
-         // The Luhn formula works right to left, so reverse the number.
-         $cc_num = strrev($cc_num);
-
-         $luhn_total = 0;
-
-         $num = mb_strlen($cc_num);
-         for ($i=0; $i<$num; $i++) {
-             // Get each digit.
-             $digit = mb_substr($cc_num, $i, 1);
-
-             //  If it's an odd digit, double it.
-             if ($i / 2 != floor($i / 2)) {
-                 $digit *= 2;
-             }
-
-             //  If the result is two digits, add them.
-             if (mb_strlen($digit) == 2) {
-                 $digit = mb_substr($digit, 0, 1) + mb_substr($digit, 1, 1);
-             }
-
-             //  Add the current digit to the $luhn_total.
-             $luhn_total += $digit;
-         }
-
-         // If the Total is evenly divisible by 10, it's cool!
-         return $luhn_total % 10 == 0;
-     }
+    static public function validateCCNumber($val, $cc_type=null)
+    {
+        // Get rid of any non-digits
+        $cc_num = preg_replace('/[^\d]/', '', $val);
+
+        // Perform card-specific checks, if applicable
+        switch ($cc_type) {
+        case self::CC_TYPE_VISA :
+            $regex = '/^4\d{15}$|^4\d{12}$/';
+            break;
+        case self::CC_TYPE_MASTERCARD :
+            $regex = '/^5[1-5]\d{14}$/';
+            break;
+        case self::CC_TYPE_AMEX :
+            $regex = '/^3[47]\d{13}$/';
+            break;
+        case self::CC_TYPE_DISCOVER :
+            $regex = '/^6011\d{12}$/';
+            break;
+        case self::CC_TYPE_DINERS :
+            $regex = '/^30[0-5]\d{11}$|^3[68]\d{12}$/';
+            break;
+        case self::CC_TYPE_JCB :
+            $regex = '/^3\d{15}$|^2131|1800\d{11}$/';
+            break;
+        default :
+            $regex = '';
+            break;
+        }
+
+        if ('' != $regex && !preg_match($regex, $cc_num)) {
+            // Invalid format.
+            return false;
+        }
+
+        // The Luhn formula works right to left, so reverse the number.
+        $cc_num = strrev($cc_num);
+
+        $luhn_total = 0;
+
+        $num = mb_strlen($cc_num);
+        for ($i=0; $i<$num; $i++) {
+            // Get each digit.
+            $digit = mb_substr($cc_num, $i, 1);
+
+            //  If it's an odd digit, double it.
+            if ($i / 2 != floor($i / 2)) {
+                $digit *= 2;
+            }
+
+            //  If the result is two digits, add them.
+            if (mb_strlen($digit) == 2) {
+                $digit = mb_substr($digit, 0, 1) + mb_substr($digit, 1, 1);
+            }
+
+            //  Add the current digit to the $luhn_total.
+            $luhn_total += $digit;
+        }
+
+        // If the Total is evenly divisible by 10, it's cool!
+        return $luhn_total % 10 == 0;
+    }
 
     /**
@@ -318,5 +342,5 @@
      * @return bool   True if no errors found, false otherwise.
      */
-    function fileUploaded($form_name)
+    static public function fileUploaded($form_name)
     {
         if (!isset($_FILES[$form_name]['name']) || empty($_FILES[$form_name]['name'])) {
@@ -341,3 +365,2 @@
 } // THE END
 
-?>
Index: /trunk/lib/Version.inc.php
===================================================================
--- /trunk/lib/Version.inc.php	(revision 467)
+++ /trunk/lib/Version.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -39,11 +39,14 @@
 class Version {
 
+    // A place to keep an object instance for the singleton pattern.
+    private static $instance = null;
+
     // Configuration of this object.
-    var $_params = array(
+    private $_params = array(
         'max_qty' => 100, // Never have more than this many versions of each record.
         'min_qty' => 25, // Keep at least this many versions of each record.
         'min_days' => 7, // Keep ALL versions within this many days, even if MORE than min_qty.
         'db_table' => 'version_tbl',
-        
+
         // Automatically create table and verify columns. Better set to false after site launch.
         // This value is overwritten by the $app->getParam('db_create_tables') setting if it is available.
@@ -54,5 +57,5 @@
 
     // Auth_SQL object from which to access a current user_id.
-    var $_auth;
+    private $_auth;
 
     /**
@@ -63,13 +66,11 @@
      * @static
      */
-    static function &getInstance($auth_object)
-    {
-        static $instance = null;
-
-        if ($instance === null) {
-            $instance = new Version($auth_object);
-        }
-
-        return $instance;
+    public static function &getInstance($auth_object)
+    {
+        if (self::$instance === null) {
+            self::$instance = new self($auth_object);
+        }
+
+        return self::$instance;
     }
 
@@ -79,5 +80,5 @@
      * @param mixed  $auth_object  An Auth_SQL object.
      */
-    function Version($auth_object)
+    public function __construct($auth_object)
     {
 		$app =& App::getInstance();
@@ -102,5 +103,5 @@
      * @since   26 Aug 2005 17:09:36
      */
-    function initDB($recreate_db=false)
+    public function initDB($recreate_db=false)
     {
 		$app =& App::getInstance();
@@ -155,5 +156,5 @@
      * @param  array $params   Array of param keys and values to set.
      */
-    function setParam($params=null)
+    public function setParam($params=null)
     {
         if (isset($params) && is_array($params)) {
@@ -170,8 +171,8 @@
      * @return mixed               Configured parameter value.
      */
-    function getParam($param)
+    public function getParam($param)
     {
 		$app =& App::getInstance();
-    
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -192,5 +193,5 @@
      * @return int                  The id for the version (mysql last insert id).
      */
-    function create($record_table, $record_key, $record_val, $title='', $notes='')
+    public function create($record_table, $record_key, $record_val, $title='', $notes='')
     {
 		$app =& App::getInstance();
@@ -204,5 +205,5 @@
             return false;
         }
-        
+
         // Get previous version_number.
         $qid = $db->query("
@@ -253,5 +254,5 @@
      * @return int                  The id for the version (mysql last insert id).
      */
-    function restore($version_id)
+    public function restore($version_id)
     {
 		$app =& App::getInstance();
@@ -314,8 +315,8 @@
      * @return mixed                Array of versions, or false if none.
      */
-    function deleteOld($record_table, $record_key, $record_val)
-    {
-		$db =& DB::getInstance();
-	
+    public function deleteOld($record_table, $record_key, $record_val)
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
@@ -381,13 +382,13 @@
      * @return mixed                Array of versions, or false if none.
      */
-    function getList($record_table, $record_key, $record_val)
-    {
-		$db =& DB::getInstance();
-	
+    public function getList($record_table, $record_key, $record_val)
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
         // Get versions of this record.
         $qid = $db->query("
-            SELECT 
+            SELECT
                 version_id,
                 saved_by_user_id,
@@ -418,8 +419,8 @@
      * @return mixed                Array of data saved in version, or false if none.
      */
-    function getVerson($version_id)
-    {
-		$db =& DB::getInstance();
-	
+    public function getVerson($version_id)
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
@@ -439,8 +440,8 @@
      * @return mixed                Array of data saved in version, or false if none.
      */
-    function getData($version_id)
-    {
-		$db =& DB::getInstance();
-	
+    public function getData($version_id)
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
@@ -465,8 +466,8 @@
      * @return mixed                Array of data saved in version, or false if none.
      */
-    function getCurrent($record_table, $record_key, $record_val)
-    {
-		$db =& DB::getInstance();
-	
+    public function getCurrent($record_table, $record_key, $record_val)
+    {
+		$db =& DB::getInstance();
+
         $this->initDB();
 
@@ -484,3 +485,2 @@
 
 } // End of class.
-?>
Index: /trunk/services/admins.php
===================================================================
--- /trunk/services/admins.php	(revision 467)
+++ /trunk/services/admins.php	(revision 468)
@@ -55,5 +55,5 @@
 
 // Configure the cache object.
-$cache = new Cache('admins');
+$cache =& Cache::getInstance('admins');
 $cache->setParam(array('enabled' => false)); // Better leave disabled; the list gets out of sync with the db otherwise, somehow.
 
@@ -552,3 +552,2 @@
 }
 
-?>
Index: /trunk/services/css.php
===================================================================
--- /trunk/services/css.php	(revision 467)
+++ /trunk/services/css.php	(revision 468)
@@ -36,3 +36,2 @@
 }
 
-?>
Index: /trunk/services/lock.php
===================================================================
--- /trunk/services/lock.php	(revision 467)
+++ /trunk/services/lock.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -69,3 +69,2 @@
 include 'footer.ihtml';
 
-?>
Index: /trunk/services/login.php
===================================================================
--- /trunk/services/login.php	(revision 467)
+++ /trunk/services/login.php	(revision 468)
@@ -36,10 +36,7 @@
 $login_prefs->setDefaults(array('username' => ''));
 
-if ('' != $login_prefs->get('username')) {
-    $frm['remember_me'] = '1';
-}
-
 $frm['username'] = getFormdata('username', $login_prefs->get('username'));
 $frm['password'] = getFormdata('password');
+$frm['remember_me'] = ('' != $login_prefs->get('username')) ? '1' : '';
 
 if (getFormdata('username', false)) {
@@ -69,3 +66,2 @@
 include 'footer.ihtml';
 
-?>
Index: /trunk/services/logout.php
===================================================================
--- /trunk/services/logout.php	(revision 467)
+++ /trunk/services/logout.php	(revision 468)
@@ -38,3 +38,2 @@
 $app->dieURL($app->getParam('redirect_home_url'));
 
-?>
Index: /trunk/services/logs.php
===================================================================
--- /trunk/services/logs.php	(revision 467)
+++ /trunk/services/logs.php	(revision 468)
@@ -293,3 +293,2 @@
 
 
-?>
Index: /trunk/services/password.php
===================================================================
--- /trunk/services/password.php	(revision 467)
+++ /trunk/services/password.php	(revision 468)
@@ -87,3 +87,2 @@
 include 'footer.ihtml';
 
-?>
Index: /trunk/services/phpinfo.php
===================================================================
--- /trunk/services/phpinfo.php	(revision 467)
+++ /trunk/services/phpinfo.php	(revision 468)
@@ -38,3 +38,2 @@
 ?><h1>$_SERVER dump</h1><?php
 dump($_SERVER,1);
-?>
Index: /trunk/services/reset_password.php
===================================================================
--- /trunk/services/reset_password.php	(revision 467)
+++ /trunk/services/reset_password.php	(revision 468)
@@ -87,3 +87,2 @@
 include 'footer.ihtml';
 
-?>
Index: /trunk/services/versions.php
===================================================================
--- /trunk/services/versions.php	(revision 467)
+++ /trunk/services/versions.php	(revision 468)
@@ -136,3 +136,2 @@
 include 'footer.ihtml';
 
-?>
Index: /trunk/tests/AppTest.php
===================================================================
--- /trunk/tests/AppTest.php	(revision 467)
+++ /trunk/tests/AppTest.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -30,13 +30,10 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class AppTest extends PHPUnit_TestCase {
+
+class AppTest extends PHPUnit_Framework_TestCase {
 
     var $App;
 
-    function AppTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
+    static $shared_session;
 
     function setUp()
@@ -44,4 +41,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         $this->App =& $app;
+        $_SESSION = AppTest::$shared_session;
     }
 
@@ -49,4 +47,5 @@
     {
         unset($this->App);
+        AppTest::$shared_session = $_SESSION;
     }
 
@@ -62,10 +61,13 @@
             'test_config_value' => 1234
         ));
-        $this->assertTrue(1234 === $this->App->_params['test_config_value']);
+        $this->assertTrue(1234 === $this->App->getParam('test_config_value'));
     }
 
     function test_getParam()
     {
-        $this->App->_params['test_config_value2'] = 'okay';
+        //$this->App->setParam('test_config_value2', 'okay');
+        $this->App->setParam(array(
+            'test_config_value2' => 'okay'
+        ));
         $result = $this->App->getParam('test_config_value2');
         $this->assertEquals('okay', $result);
@@ -93,5 +95,5 @@
     {
 		$db =& DB::getInstance();
-	
+
         $qid = $db->query("SELECT 2 + 2");
         list($result) = mysql_fetch_row($qid);
@@ -104,5 +106,5 @@
         $expected = 'My message';
         $app->raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__);
-        $msg = current($_SESSION['_app'][$this->App->_ns]['messages']);
+        $msg = current($_SESSION['_app']['testapp']['messages']);
         $this->assertEquals($expected, $msg['message']);
     }
@@ -111,4 +113,5 @@
     {
         ob_start();
+        $this->test_raisemsg();  //had to add this line for phpunit ver. 3.7 ///
         $app =& App::getInstance();
         $app->printraisedmessages();
@@ -205,6 +208,7 @@
 }
 // Running the test.
+/*
 $suite = new PHPUnit_TestSuite('AppTest');
 $result = PHPUnit::run($suite);
 echo $result->toString();
-?>
+ */
Index: /trunk/tests/AuthFileTest.php
===================================================================
--- /trunk/tests/AuthFileTest.php	(revision 468)
+++ /trunk/tests/AuthFileTest.php	(revision 468)
@@ -0,0 +1,116 @@
+<?php
+/**
+ * The Strangecode Codebase - a general application development framework for PHP
+ * For details visit the project site: <http://trac.strangecode.com/codebase/>
+ * Copyright 2001-2012 Strangecode, LLC
+ * 
+ * This file is part of The Strangecode Codebase.
+ *
+ * The Strangecode Codebase is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ * 
+ * The Strangecode Codebase is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * PHPUnit test case for codebase/lib/AuthFile.inc.php
+ *
+ * The method skeletons below need to be filled in with
+ * real data so that the tests will run correctly. Replace
+ * all EXPECTED_VAL and PARAM strings with real data.
+ *
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+//
+class AuthFileTest extends PHPUnit_Framework_TestCase {
+
+    var $AuthFile;
+    
+    static $shared_session;
+
+    function setUp()
+    {
+        require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/Auth_File.inc.php';
+        $this->AuthFile = new Auth_File('test_auth');
+        $this->AuthFile->setParam(array('htpasswd_file' => dirname(__FILE__) . '/_test_htpasswd'));
+        $_SESSION = AuthFileTest::$shared_session;
+    }
+
+    function tearDown()
+    {
+        unset($this->AuthFile);
+        AuthFileTest::$shared_session = $_SESSION;
+    }
+
+    function test_authenticate()
+    {
+        $true = $this->AuthFile->authenticate('testuser', 'testpass');
+        $this->assertTrue($true, 'testuser not authorized with good password.');
+
+        $false = $this->AuthFile->authenticate('testuser', 'wrongpass');
+        $this->assertFalse($false, 'testuser not blocked with bad password.');
+    }
+
+    function test_login()
+    {
+        $result = $this->AuthFile->login('testuser', 'testpass');
+        $this->assertTrue($result, 'testuser login failed.');
+        $this->assertTrue($_SESSION['_auth_file']['test_auth']['authenticated'], 'testuser authentication not found in session.');
+    }
+
+    function test_clear()
+    {
+        $result = $this->AuthFile->login('testuser', 'testpass');
+        $this->AuthFile->clear();
+        $this->assertFalse($_SESSION['_auth_file']['test_auth']['authenticated'], 'testuser authentication not false in session.');
+    }
+
+    function test_isloggedin()
+    {
+        $this->AuthFile->login('testuser', 'testpass');
+        $true = $this->AuthFile->isloggedin();
+        $this->assertTrue($true, 'testuser not logged in but should be.');
+
+        $this->AuthFile->clear();
+        $false = $this->AuthFile->isloggedin();
+        $this->assertFalse($false, 'testuser is logged in but shouldn\'t be.');
+    }
+
+//     function test_isadmin()
+//     {
+//         $this->AuthFile->login('testuser', 'testpass');
+//         $true = $this->AuthFile->isadmin();
+//         $this->assertTrue($true);
+//     }
+//
+//     function test_requireadminlogin()
+//     {
+//         $result = $this->AuthFile->requireadminlogin(PARAM);
+//         $expected = EXPECTED_VAL;
+//         $this->assertEquals($expected, $result);
+//     }
+//
+//     function test__encrypt()
+//     {
+//         $result = $this->AuthFile->_encrypt(PARAM);
+//         $expected = EXPECTED_VAL;
+//         $this->assertEquals($expected, $result);
+//     }
+//
+//     function test__salt()
+//     {
+//         $result = $this->AuthFile->_salt(PARAM);
+//         $expected = EXPECTED_VAL;
+//         $this->assertEquals($expected, $result);
+//     }
+
+}
Index: /trunk/tests/AuthSQLTest.php
===================================================================
--- /trunk/tests/AuthSQLTest.php	(revision 468)
+++ /trunk/tests/AuthSQLTest.php	(revision 468)
@@ -0,0 +1,275 @@
+<?php
+/**
+ * The Strangecode Codebase - a general application development framework for PHP
+ * For details visit the project site: <http://trac.strangecode.com/codebase/>
+ * Copyright 2001-2012 Strangecode, LLC
+ *
+ * This file is part of The Strangecode Codebase.
+ *
+ * The Strangecode Codebase is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * The Strangecode Codebase is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * PHPUnit test case for codebase/lib/Auth_SQL.inc.php
+ *
+ * The method skeletons below need to be filled in with
+ * real data so that the tests will run correctly. Replace
+ * all EXPECTED_VAL and PARAM strings with real data.
+ *
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+class AuthSQLTest extends PHPUnit_Framework_TestCase {
+
+    var $Auth_SQL;
+
+    static $shared_session;
+
+    function setUp()
+    {
+	    require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/Auth_SQL.inc.php';
+        $this->Auth_SQL = new Auth_SQL('testauth');
+        $this->Auth_SQL->setParam(array(
+            'db_table'          => 'test_user_tbl',
+            'db_primary_key'    => 'user_id',
+            'db_login_table'    => 'test_login_tbl',
+            'login_url'         => '/login.php',
+            'blocking'          => true,
+            'encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED,
+        ));
+
+        // Use fresh user table.
+        $this->Auth_SQL->initDB(true);
+
+        // Insert test data.
+        $db =& DB::getInstance();
+        $db->query("
+            INSERT INTO test_user_tbl (
+                username,
+                userpass,
+                first_name,
+                last_name,
+                email
+            ) VALUES (
+                'testuser',
+                '" . $this->Auth_SQL->encryptPassword('testpass') . "',
+                'John',
+                'Doe',
+                'root@localhost'
+            )
+        ");
+        $_SESSION = AuthSQLTest::$shared_session;
+    }
+
+    function tearDown()
+    {
+    	$db =& DB::getInstance();
+
+	    unset($this->Auth_SQL);
+        $db->query("DROP TABLE IF EXISTS test_user_tbl");
+        $db->query("DROP TABLE IF EXISTS test_login_tbl");
+        AuthSQLTest::$shared_session = $_SESSION;
+    }
+
+    function test_set()
+    {
+        $this->Auth_SQL->set('testuserkey', 'testuserval');
+        $this->assertEquals('testuserval', $_SESSION['_auth_sql']['testauth']['user_data']['testuserkey']);
+    }
+
+    function test_get()
+    {
+        $_SESSION['_auth_sql']['testauth']['user_data']['testuserkey'] = 'testuserval';
+        $val = $this->Auth_SQL->get('testuserkey');
+        $this->assertEquals('testuserval', $val);
+    }
+
+    function test_setparam()
+    {
+        $this->Auth_SQL->setParam(array(
+            'login_url'         => 'testloginurl.php'
+        ));
+        $this->assertEquals('testloginurl.php', $this->Auth_SQL->getParam('login_url'));
+    }
+
+    function test_getparam()
+    {
+        //$this->Auth_SQL->_params['login_url'] = 'testloginurl.php';
+        $this->Auth_SQL->setParam(array(
+            'login_url'         => 'testloginurl.php'
+        ));
+        $param = $this->Auth_SQL->getParam('login_url');
+        $this->assertEquals('testloginurl.php', $param);
+    }
+
+    function test_clear()
+    {
+        $login = $this->Auth_SQL->login('testuser', 'testpass');
+        $this->assertTrue($login, 'User login failed, but should have succeeded.');
+        $before_logged_in = $this->Auth_SQL->isloggedin();
+        $this->assertTrue($before_logged_in, 'User is not logged in, but should be.');
+        $this->Auth_SQL->clear();
+        $after_logged_in = $this->Auth_SQL->isloggedin();
+        $this->assertFalse($after_logged_in, 'User is still logged in but should not be.');
+    }
+
+    function test_authenticate()
+    {
+        $true = $this->Auth_SQL->authenticate('testuser', 'testpass');
+        $this->assertInternalType('array', $true, 'User login failed, but should have succeeded.');
+
+        // Testing wrong password.
+        $false = $this->Auth_SQL->authenticate('testuser', 'wrongpass');
+
+        $this->assertfalse($false, 'User login succeeded, but should have failed.');
+    }
+
+    function test_login_and_isLoggedIn()
+    {
+        $login = $this->Auth_SQL->login('testuser', 'testpass');
+        $this->assertTrue($login, '1. User login failed, but should have succeeded.');
+        $before_logged_in = $this->Auth_SQL->isloggedin();
+        $this->assertTrue($before_logged_in, '2. User is not logged in, but should be.');
+        $this->Auth_SQL->clear();
+        $after_logged_in = $this->Auth_SQL->isloggedin();
+        $this->assertFalse($after_logged_in, '3. User is still logged in but should not be.');
+
+        // Testing wrong password.
+        $login2 = $this->Auth_SQL->login('testuser', 'wrongpass');
+        $this->assertFalse($login2, '4. User login succeeded, but should have failed.');
+        $before_logged_in2 = $this->Auth_SQL->isloggedin();
+        $this->assertFalse($before_logged_in2, '5. User is logged in, but should not be.');
+        $this->Auth_SQL->clear();
+        $after_logged_in2 = $this->Auth_SQL->isloggedin();
+        $this->assertFalse($after_logged_in2, '6. Wrong user is still logged in but should not be.');
+    }
+
+    function test_requirelogin()
+    {
+//         $this->Auth_SQL->requirelogin('Login is required!');
+    }
+
+    function test_blockaccount()
+    {
+		$db =& DB::getInstance();
+
+        $this->Auth_SQL->login('testuser', 'testpass');
+        $this->Auth_SQL->blockaccount(null, 'blocktestuser');
+        $qid = $db->query("
+            SELECT blocked_reason
+            FROM test_user_tbl
+        ");
+        list($reason) = mysql_fetch_row($qid);
+        $this->assertEquals('blocktestuser', $reason, "Block not found in DB record.");
+    }
+
+    function test_unblockaccount()
+    {
+		$db =& DB::getInstance();
+
+        $db->query("
+            UPDATE test_user_tbl SET blocked_reason = 'blocktestuser'
+        ");
+        $this->Auth_SQL->unblockaccount();
+
+        $qid = $db->query("
+            SELECT blocked_reason
+            FROM test_user_tbl
+        ");
+        list($reason) = mysql_fetch_row($qid);
+        $this->assertTrue('' == $reason, "Block not removed from DB record.");
+    }
+
+    function test_usernameexists()
+    {
+        $result = $this->Auth_SQL->usernameexists('testuser');
+        $this->assertTrue($result);
+    }
+
+    function test_getusername()
+    {
+        $result = $this->Auth_SQL->getusername(1);
+        $this->assertEquals('testuser', $result);
+    }
+
+    function test_generatepassword()
+    {
+        $result = $this->Auth_SQL->generatepassword('xCVcvd');
+        $this->assertRegExp('/[bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZaeiouyAEIOUY0123456789!@#%&*-=+.?][bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZ][aeiouyAEIOUY][bcdfghjklmnprstvwxz][aeiouy][0123456789]/', $result, 'Generated password does not match intended pattern');
+    }
+
+    function test_encryptpassword()
+    {
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5));
+        $result = $this->Auth_SQL->encryptpassword('123');
+        $this->assertEquals('202cb962ac59075b964b07152d234b70', $result);
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED));
+        $result = $this->Auth_SQL->encryptpassword('123');
+        $this->assertEquals('c55e4ac608a8768ecd758fab971b0646', $result);
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1));
+        $result = $this->Auth_SQL->encryptpassword('123');
+        $this->assertEquals('40bd001563085fc35165329ea1ff5c5ecbdbbeef', $result);
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
+        $result = $this->Auth_SQL->encryptpassword('123');
+        $this->assertEquals('33d90af96a5928ac93cbd41fc436e8c55d2768c2', $result);
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_PLAINTEXT));
+        $result = $this->Auth_SQL->encryptpassword('123');
+        $this->assertEquals('123', $result);
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_CRYPT));
+        $result = $this->Auth_SQL->encryptpassword('123', 'saltstring');
+        $this->assertEquals('saEZ6MlWYV9nQ', $result);
+    }
+
+    function test_setpassword()
+    {
+		$db =& DB::getInstance();
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
+        $this->Auth_SQL->setpassword(null, '123');
+        $qid = $db->query("
+            SELECT userpass
+            FROM test_user_tbl
+        ");
+        list($pass) = mysql_fetch_row($qid);
+        $this->assertEquals('33d90af96a5928ac93cbd41fc436e8c55d2768c2', $pass);
+    }
+
+    function test_resetpassword()
+    {
+        $result = $this->Auth_SQL->resetpassword(1, 'Because this is a test.');
+        $this->assertInternalType('array', $result);
+
+    }
+
+//     function test_inclearancezone()
+//     {
+//         $result = $this->Auth_SQL->inclearancezone(PARAM);
+//         $expected = EXPECTED_VAL;
+//         $this->assertEquals($expected, $result);
+//     }
+//
+//     function test_requireaccessclearance()
+//     {
+//         $result = $this->Auth_SQL->requireaccessclearance(PARAM);
+//         $expected = EXPECTED_VAL;
+//         $this->assertEquals($expected, $result);
+//     }
+
+}
+
Index: /trunk/tests/Auth_FileTest.php
===================================================================
--- /trunk/tests/Auth_FileTest.php	(revision 467)
+++ /trunk/tests/Auth_FileTest.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -120,3 +120,2 @@
 $result = PHPUnit::run($suite);
 echo $result->toString();
-?>
Index: /trunk/tests/Auth_SQLTest.php
===================================================================
--- /trunk/tests/Auth_SQLTest.php	(revision 467)
+++ /trunk/tests/Auth_SQLTest.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -30,5 +30,5 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
+
 class Auth_SQLTest extends PHPUnit_TestCase {
 
@@ -51,5 +51,5 @@
             'login_url'         => '/login.php',
             'blocking'          => true,
-            'encryption_type' => AUTH_ENCRYPT_MD5_HARDENED,
+            'encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED,
         ));
 
@@ -80,5 +80,5 @@
     {
     	$db =& DB::getInstance();
-	
+
 	    unset($this->Auth_SQL);
         $db->query("DROP TABLE IF EXISTS test_user_tbl");
@@ -145,5 +145,5 @@
         $after_logged_in = $this->Auth_SQL->isloggedin();
         $this->assertFalse($after_logged_in, '3. User is still logged in but should not be.');
-        
+
         // Testing wrong password.
         $login2 = $this->Auth_SQL->login('testuser', 'wrongpass');
@@ -164,5 +164,5 @@
     {
 		$db =& DB::getInstance();
-	
+
         $this->Auth_SQL->login('testuser', 'testpass');
         $this->Auth_SQL->blockaccount(null, 'blocktestuser');
@@ -178,5 +178,5 @@
     {
 		$db =& DB::getInstance();
-	
+
         $db->query("
             UPDATE test_user_tbl SET blocked_reason = 'blocktestuser'
@@ -212,25 +212,25 @@
     function test_encryptpassword()
     {
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_MD5));
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5));
         $result = $this->Auth_SQL->encryptpassword('123');
         $this->assertEquals('202cb962ac59075b964b07152d234b70', $result);
 
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_MD5_HARDENED));
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED));
         $result = $this->Auth_SQL->encryptpassword('123');
         $this->assertEquals('c55e4ac608a8768ecd758fab971b0646', $result);
 
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_SHA1));
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1));
         $result = $this->Auth_SQL->encryptpassword('123');
         $this->assertEquals('40bd001563085fc35165329ea1ff5c5ecbdbbeef', $result);
 
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_SHA1_HARDENED));
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
         $result = $this->Auth_SQL->encryptpassword('123');
         $this->assertEquals('33d90af96a5928ac93cbd41fc436e8c55d2768c2', $result);
 
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_PLAINTEXT));
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_PLAINTEXT));
         $result = $this->Auth_SQL->encryptpassword('123');
         $this->assertEquals('123', $result);
 
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_CRYPT));
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_CRYPT));
         $result = $this->Auth_SQL->encryptpassword('123', 'saltstring');
         $this->assertEquals('saEZ6MlWYV9nQ', $result);
@@ -240,6 +240,6 @@
     {
 		$db =& DB::getInstance();
-	
-        $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_SHA1_HARDENED));
+
+        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
         $this->Auth_SQL->setpassword(null, '123');
         $qid = $db->query("
@@ -261,3 +261,2 @@
 $result = PHPUnit::run($suite);
 echo $result->toString();
-?>
Index: /trunk/tests/AuthorizeNetTest.php
===================================================================
--- /trunk/tests/AuthorizeNetTest.php	(revision 467)
+++ /trunk/tests/AuthorizeNetTest.php	(revision 468)
@@ -30,14 +30,11 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class AuthorizeNetTest extends PHPUnit_TestCase {
+
+class AuthorizeNetTest extends PHPUnit_Framework_TestCase {
 
     var $AuthorizeNet;
-
-    function AuthorizeNetTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
-
+    
+    static $shared_session;
+    
     function setUp()
     {
@@ -45,5 +42,5 @@
         require_once '../lib/AuthorizeNet.inc.php';
 
-        $this->AuthorizeNet =& new AuthorizeNet();
+        $this->AuthorizeNet = new AuthorizeNet();
         $this->AuthorizeNet->setParam(array(
             'x_login' => 'myaccount',
@@ -61,4 +58,5 @@
             'x_zip' => '75010',
         ));
+        $_SESSION = AuthorizeNetTest::$shared_session;
     }
 
@@ -66,4 +64,5 @@
     {
         unset($this->AuthorizeNet);
+        AuthorizeNetTest::$shared_session = $_SESSION;
     }
 
@@ -71,5 +70,5 @@
     {
         $this->AuthorizeNet->setparam(array('x_Login' => 'myaccount2'));
-        $this->assertEquals('myaccount2', $this->AuthorizeNet->_params['x_Login']);
+        $this->assertEquals('myaccount2', $this->AuthorizeNet->getParam('x_Login'));
     }
 
@@ -119,7 +118,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('AuthorizeNetTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/CSSTest.php
===================================================================
--- /trunk/tests/CSSTest.php	(revision 467)
+++ /trunk/tests/CSSTest.php	(revision 468)
@@ -30,14 +30,9 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class CSSTest extends PHPUnit_TestCase {
+
+class CSSTest extends PHPUnit_Framework_TestCase {
 
     var $CSS;
     var $test_css_file;
-
-    function CSSTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -46,5 +41,5 @@
         $this->test_css_file = dirname(__FILE__) . '/../css/codebase.inc.css';
         require_once '../lib/CSS.inc.php';
-        $this->CSS =& new CSS();
+        $this->CSS = new CSS();
         $this->CSS->setFile($this->test_css_file);
     }
@@ -86,7 +81,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('CSSTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/CacheTest.php
===================================================================
--- /trunk/tests/CacheTest.php	(revision 467)
+++ /trunk/tests/CacheTest.php	(revision 468)
@@ -7,5 +7,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -14,10 +14,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class CacheTest extends PHPUnit_TestCase {
+
+class CacheTest extends PHPUnit_Framework_TestCase {
 
     var $Cache;
@@ -40,5 +40,5 @@
     function CacheTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -105,7 +105,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('CacheTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/DBSessionHandlerTest.php
===================================================================
--- /trunk/tests/DBSessionHandlerTest.php	(revision 467)
+++ /trunk/tests/DBSessionHandlerTest.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -30,13 +30,8 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class DBSessionHandlerTest extends PHPUnit_TestCase {
+
+class DBSessionHandlerTest extends PHPUnit_Framework_TestCase {
 
     var $DBSessionHandler;
-
-    function DBSessionHandlerTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -73,4 +68,7 @@
     function test_DBsessionwrite()
     {
+        if (!isset($_SESSION)) {
+            $_SESSION = array();
+        }
         $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
     }
@@ -87,7 +85,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('DBSessionHandlerTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/EmailTest.php
===================================================================
--- /trunk/tests/EmailTest.php	(revision 467)
+++ /trunk/tests/EmailTest.php	(revision 468)
@@ -1,3 +1,4 @@
 <?php
+
 /**
  * The Strangecode Codebase - a general application development framework for PHP
@@ -30,13 +31,8 @@
  * Created with PHPUnit_Skeleton on 2005-12-01
  */
-require_once 'PHPUnit.php';
-class EmailTest extends PHPUnit_TestCase {
+
+class EmailTest extends PHPUnit_Framework_TestCase {
 
     var $Email;
-
-    function EmailTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -44,5 +40,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/Email.inc.php';
-        $this->Email =& new Email();
+        $this->Email = new Email();
     }
 
@@ -122,7 +118,2 @@
 
 }
-// Running the test.
-$suite  = new PHPUnit_TestSuite('EmailTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/FormValidatorTest.php
===================================================================
--- /trunk/tests/FormValidatorTest.php	(revision 467)
+++ /trunk/tests/FormValidatorTest.php	(revision 468)
@@ -30,13 +30,8 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class FormValidatorTest extends PHPUnit_TestCase {
+
+class FormValidatorTest extends PHPUnit_Framework_TestCase {
 
     var $FormValidator;
-
-    function FormValidatorTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -44,5 +39,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/FormValidator.inc.php';
-        $this->FormValidator =& new FormValidator();
+        $this->FormValidator = new FormValidator();
     }
 
@@ -294,7 +289,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('FormValidatorTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/Google_APITest.php
===================================================================
--- /trunk/tests/Google_APITest.php	(revision 467)
+++ /trunk/tests/Google_APITest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class GoogleAPITest extends PHPUnit_TestCase {
+
+class GoogleAPITest extends PHPUnit_Framework_TestCase {
 
     var $GoogleAPI;
@@ -40,5 +40,5 @@
     function GoogleAPITest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -91,7 +91,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('GoogleAPITest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/HierarchyTest.php
===================================================================
--- /trunk/tests/HierarchyTest.php	(revision 467)
+++ /trunk/tests/HierarchyTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class HierarchyTest extends PHPUnit_TestCase {
+
+class HierarchyTest extends PHPUnit_Framework_TestCase {
 
     var $Hierarchy;
@@ -40,5 +40,5 @@
     function HierarchyTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -175,7 +175,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('HierarchyTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/ImageThumbTest.php
===================================================================
--- /trunk/tests/ImageThumbTest.php	(revision 467)
+++ /trunk/tests/ImageThumbTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class ImageThumbTest extends PHPUnit_TestCase {
+
+class ImageThumbTest extends PHPUnit_Framework_TestCase {
 
     var $ImageThumb;
@@ -40,5 +40,5 @@
     function ImageThumbTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -119,7 +119,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('ImageThumbTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/LockTest.php
===================================================================
--- /trunk/tests/LockTest.php	(revision 467)
+++ /trunk/tests/LockTest.php	(revision 468)
@@ -30,14 +30,9 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class LockTest extends PHPUnit_TestCase {
+
+class LockTest extends PHPUnit_Framework_TestCase {
 
     var $Lock;
     var $Auth_SQL;
-
-    function LockTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -47,5 +42,5 @@
         require_once '../lib/Auth_SQL.inc.php';
 
-        $this->Auth_SQL =& new Auth_SQL('test');
+        $this->Auth_SQL = new Auth_SQL('test');
         $this->Auth_SQL->setParam(array(
             'db_table'          => 'test_user_tbl',
@@ -208,11 +203,6 @@
     {
         $result = $this->Lock->getsecondselapsed();
-        $this->assertType('integer', $result);
+        $this->assertInternalType('integer', $result);
     }
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('LockTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/MCVETest.php
===================================================================
--- /trunk/tests/MCVETest.php	(revision 467)
+++ /trunk/tests/MCVETest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class MCVETest extends PHPUnit_TestCase {
+
+class MCVETest extends PHPUnit_Framework_TestCase {
 
     var $MCVE;
@@ -40,5 +40,5 @@
     function MCVETest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -91,7 +91,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('MCVETest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/NavTest.php
===================================================================
--- /trunk/tests/NavTest.php	(revision 467)
+++ /trunk/tests/NavTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class NavigationTest extends PHPUnit_TestCase {
+
+class NavigationTest extends PHPUnit_Framework_TestCase {
 
     var $Navigation;
@@ -40,5 +40,5 @@
     function NavigationTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -133,7 +133,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('NavigationTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/PEditTest.php
===================================================================
--- /trunk/tests/PEditTest.php	(revision 467)
+++ /trunk/tests/PEditTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class PEditTest extends PHPUnit_TestCase {
+
+class PEditTest extends PHPUnit_Framework_TestCase {
 
     var $PEdit;
@@ -40,5 +40,5 @@
     function PEditTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -154,7 +154,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('PEditTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/PageNumbersTest.php
===================================================================
--- /trunk/tests/PageNumbersTest.php	(revision 467)
+++ /trunk/tests/PageNumbersTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class PageNumbersTest extends PHPUnit_TestCase {
+
+class PageNumbersTest extends PHPUnit_Framework_TestCase {
 
     var $PageNumbers;
@@ -40,5 +40,5 @@
     function PageNumbersTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -133,7 +133,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('PageNumbersTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/PageSequenceTest.php
===================================================================
--- /trunk/tests/PageSequenceTest.php	(revision 467)
+++ /trunk/tests/PageSequenceTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class PageSequenceTest extends PHPUnit_TestCase {
+
+class PageSequenceTest extends PHPUnit_Framework_TestCase {
 
     var $PageSequence;
@@ -40,5 +40,5 @@
     function PageSequenceTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -182,7 +182,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('PageSequenceTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/PayPalTest.php
===================================================================
--- /trunk/tests/PayPalTest.php	(revision 467)
+++ /trunk/tests/PayPalTest.php	(revision 468)
@@ -30,13 +30,8 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class PayPalTest extends PHPUnit_TestCase {
+
+class PayPalTest extends PHPUnit_Framework_TestCase {
 
     var $PayPal;
-
-    function PayPalTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -44,5 +39,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/PayPal.inc.php';
-        $this->PayPal =& new PayPal();
+        $this->PayPal = new PayPal();
 
         // Defaults for purchasing classified postings.
@@ -90,5 +85,6 @@
         ));
         $result = $this->PayPal->getlink('testitem');
-        $this->assertTrue(preg_match('/customdata/', $result));
+        //$this->assertTrue(preg_match('/customdata/', $result));
+        $this->assertSame(1, preg_match('/customdata/', $result));
     }
 
@@ -103,5 +99,7 @@
         $this->PayPal->printbutton('testitem');
         $result = ob_get_clean();
-        $this->assertTrue(preg_match('/customdata/', $result));
+        //$this->assertTrue(preg_match('/customdata/', $result));
+        $this->assertSame(1, preg_match('/customdata/', $result));
+        
     }
 
@@ -134,7 +132,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('PayPalTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/PrefsTest.php
===================================================================
--- /trunk/tests/PrefsTest.php	(revision 467)
+++ /trunk/tests/PrefsTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class PrefsTest extends PHPUnit_TestCase {
+
+class PrefsTest extends PHPUnit_Framework_TestCase {
 
     var $Prefs;
@@ -40,5 +40,5 @@
     function PrefsTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -112,7 +112,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('PrefsTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/ScriptTimerTest.php
===================================================================
--- /trunk/tests/ScriptTimerTest.php	(revision 467)
+++ /trunk/tests/ScriptTimerTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class ScriptTimerTest extends PHPUnit_TestCase {
+
+class ScriptTimerTest extends PHPUnit_Framework_TestCase {
 
     var $ScriptTimer;
@@ -40,5 +40,5 @@
     function ScriptTimerTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -77,7 +77,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('ScriptTimerTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/SortOrderTest.php
===================================================================
--- /trunk/tests/SortOrderTest.php	(revision 467)
+++ /trunk/tests/SortOrderTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class SortOrderTest extends PHPUnit_TestCase {
+
+class SortOrderTest extends PHPUnit_Framework_TestCase {
 
     var $SortOrder;
@@ -40,5 +40,5 @@
     function SortOrderTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -91,7 +91,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('SortOrderTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/SpellCheckTest.php
===================================================================
--- /trunk/tests/SpellCheckTest.php	(revision 467)
+++ /trunk/tests/SpellCheckTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class SpellCheckTest extends PHPUnit_TestCase {
+
+class SpellCheckTest extends PHPUnit_Framework_TestCase {
 
     var $SpellCheck;
@@ -40,5 +40,5 @@
     function SpellCheckTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -154,7 +154,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('SpellCheckTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/TemplateGlueTest.php
===================================================================
--- /trunk/tests/TemplateGlueTest.php	(revision 467)
+++ /trunk/tests/TemplateGlueTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class TemplateGlueTest extends PHPUnit_TestCase {
+
+class TemplateGlueTest extends PHPUnit_Framework_TestCase {
 
     var $TemplateGlue;
@@ -40,5 +40,5 @@
     function TemplateGlueTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -56,7 +56,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('TemplateGlueTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/UploadTest.php
===================================================================
--- /trunk/tests/UploadTest.php	(revision 467)
+++ /trunk/tests/UploadTest.php	(revision 468)
@@ -7,5 +7,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -14,10 +14,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class UploadTest extends PHPUnit_TestCase {
+
+class UploadTest extends PHPUnit_Framework_TestCase {
 
     var $Upload;
@@ -40,5 +40,5 @@
     function UploadTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -120,5 +120,5 @@
     function test_getfilenameextension()
     {
-        $result = $this->Upload->getfilenameextension(PARAM);
+        $result = $this->Upload::getfilenameextension(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -126,7 +126,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('UploadTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/UtilitiesTest.php
===================================================================
--- /trunk/tests/UtilitiesTest.php	(revision 467)
+++ /trunk/tests/UtilitiesTest.php	(revision 468)
@@ -33,6 +33,6 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class UtilitiesTest extends PHPUnit_TestCase {
+
+class UtilitiesTest extends PHPUnit_Framework_TestCase {
 
     var $Utilities;
@@ -40,5 +40,5 @@
     function UtilitiesTest($name)
     {
-        $this->PHPUnit_TestCase($name);
+        $this->PHPUnit_Framework_TestCase($name);
     }
 
@@ -56,7 +56,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('UtilitiesTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/VersionTest.php
===================================================================
--- /trunk/tests/VersionTest.php	(revision 467)
+++ /trunk/tests/VersionTest.php	(revision 468)
@@ -30,14 +30,9 @@
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-require_once 'PHPUnit.php';
-class VersionTest extends PHPUnit_TestCase {
+
+class VersionTest extends PHPUnit_Framework_TestCase {
 
     var $Version;
     var $Auth_SQL;
-
-    function VersionTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
 
     function setUp()
@@ -47,5 +42,5 @@
 
         require_once '../lib/Auth_SQL.inc.php';
-        $this->Auth_SQL =& new Auth_SQL('testauth');
+        $this->Auth_SQL = new Auth_SQL('testauth');
         $this->Auth_SQL->setParam(array(
             'db_table'          => 'test_user_tbl',
@@ -116,5 +111,5 @@
     {
         $result = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
-        $this->assertTrue($result);
+        $this->assertSame(1, $result);
     }
 
@@ -190,7 +185,2 @@
 
 }
-// Running the test.
-$suite = new PHPUnit_TestSuite('VersionTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
-?>
Index: /trunk/tests/_config.inc.php
===================================================================
--- /trunk/tests/_config.inc.php	(revision 467)
+++ /trunk/tests/_config.inc.php	(revision 468)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -28,4 +28,5 @@
 */
 require_once '../lib/App.inc.php';
+
 $app =& App::getInstance('testapp');
 
@@ -44,6 +45,6 @@
     'db_die_on_failure' => true,
     'db_server' => 'localhost',
-    'db_name' => 'test',
-    'db_user' => 'root',
+    'db_name' => getenv('DB_NAME'),
+    'db_user' => getenv('DB_USER'),
     'db_pass' => getenv('DB_PASS'),
     'display_errors' => true,
@@ -59,3 +60,2 @@
 
 $app->start();
-?>
Index: /trunk/tests/_skel.php
===================================================================
--- /trunk/tests/_skel.php	(revision 467)
+++ /trunk/tests/_skel.php	(revision 468)
@@ -78,3 +78,2 @@
 // }
 
-?>
Index: /trunk/tests/bootstrap.php
===================================================================
--- /trunk/tests/bootstrap.php	(revision 468)
+++ /trunk/tests/bootstrap.php	(revision 468)
@@ -0,0 +1,5 @@
+<?php
+// session_start();
+// //set_include_path(get_include_path() . PATH_SEPARATOR . '../..');
+// ini_set('include_path',get_include_path().PATH_SEPARATOR.'/opt'.PATH_SEPARATOR.'..');
+// //die(get_include_path());
Index: /trunk/tests/phpunit.xml
===================================================================
--- /trunk/tests/phpunit.xml	(revision 468)
+++ /trunk/tests/phpunit.xml	(revision 468)
@@ -0,0 +1,38 @@
+<!--
+For config options see:
+http://phpunit.de/manual/current/en/appendixes.configuration.html
+
+Run all scripts by executing ./run_tests.sh
+-->
+<phpunit
+convertErrorsToExceptions="false"
+convertNoticesToExceptions="false"
+convertWarningsToExceptions="false"
+bootstrap="bootstrap.php"
+strict="true"
+verbose="true"
+debug="true"
+tap="true"
+stopOnError="true"
+stopOnFailure="true"
+stopOnIncomplete="true"
+stopOnSkipped="true"
+>
+    <includePath>.</includePath>
+    <includePath>/opt</includePath>
+    <testsuites>
+        <testsuite name="Codebase_Tests">
+            <file>AppTest.php</file>
+            <file>AuthFileTest.php</file>
+<!--        <file>AuthorizeNetTest.php</file> -->
+            <file>AuthSQLTest.php</file>
+            <file>CSSTest.php</file>
+            <file>DBSessionHandlerTest.php</file>
+            <file>EmailTest.php</file>
+            <file>FormValidatorTest.php</file>
+            <file>LockTest.php</file>
+            <file>PayPalTest.php</file>
+            <file>VersionTest.php</file>
+        </testsuite>
+    </testsuites>
+</phpunit>
Index: /trunk/tests/run_tests.sh
===================================================================
--- /trunk/tests/run_tests.sh	(revision 467)
+++ /trunk/tests/run_tests.sh	(revision 468)
@@ -1,13 +1,33 @@
-#!/bin/sh
+#!/bin/bash
+
+# This script sets-up the test environment and runs all tests.
+# You'll want to define your local mysql credentials for a test
+# database as environment variables, e.g., in ~/.bash_profile:
+#  export DB_NAME="test"
+#  export DB_USER="test"
+#  export DB_PASS="..."
 
 # Be in the directory with all the tests.
 cd `dirname $0`;
 
+# Get required ENV variables.
+if [[ -z "$DB_USER$DB_PASS$DB_NAME" ]]; then
+    echo "MySQL test DB credential environment variables are missing.\nSet these in ~/.bash_profile to avoid seeing these prompts each time.";
+fi
+for E in DB_USER DB_PASS DB_NAME; do
+    while [[ -z ${!E} ]]; do
+        read -p "$E: " $E;
+    done
+    export $E;
+done
+
 # Create database.
 mysql -e 'CREATE DATABASE IF NOT EXISTS `test`';
 
-# Run tests sequentially.
-for foo in *Test.php; 
-do
-    php $foo;
-done;
+# Go!
+echo "Running the tests!";
+echo "You'll want to 'tail -f /tmp/codebase_test_log' and watch for errors.";
+
+# Config options go in phpunit.xml
+# phpunit --tap | grep -v '^ok '
+phpunit --stderr
