Index: branches/eli_branch/lib/App.inc.php
===================================================================
--- branches/eli_branch/lib/App.inc.php	(revision 446)
+++ branches/eli_branch/lib/App.inc.php	(revision 447)
@@ -30,6 +30,4 @@
  */
 
-//ob_start();
-
 // Message Types.
 define('MSG_ERR', 1);
@@ -321,5 +319,4 @@
 
             // Session parameters.
-            /*
             ini_set('session.gc_probability', 1);
             ini_set('session.gc_divisor', 1000);
@@ -330,5 +327,4 @@
             ini_set('session.entropy_length', '512');
             ini_set('session.cookie_httponly', true);
-             * */
             session_name($this->getParam('session_name'));
 
@@ -343,5 +339,5 @@
 
             // Start the session.
-            //session_start();
+            session_start();
 
             if (!isset($_SESSION['_app'][$this->_ns])) {
@@ -378,5 +374,5 @@
 
         // Character set. This should also be printed in the html header template.
-        //header('Content-type: text/html; charset=' . $this->getParam('character_set'));
+        header('Content-type: text/html; charset=' . $this->getParam('character_set'));
 
         // Set the version of the codebase we're using.
@@ -385,5 +381,5 @@
             $codebase_version = trim(file_get_contents($codebase_version_file));
             $this->setParam(array('codebase_version' => $codebase_version));
-            //header('X-Codebase-Version: ' . $codebase_version);
+            header('X-Codebase-Version: ' . $codebase_version);
         }
 
@@ -472,5 +468,4 @@
             return false;
         }
-        //die($_SESSION['_app'][$this->_ns]['messages']);
         return isset($_SESSION['_app'][$this->_ns]['messages']) ? $_SESSION['_app'][$this->_ns]['messages'] : array();
     }
Index: branches/eli_branch/lib/Auth_File.inc.php
===================================================================
--- branches/eli_branch/lib/Auth_File.inc.php	(revision 446)
+++ branches/eli_branch/lib/Auth_File.inc.php	(revision 447)
@@ -40,11 +40,11 @@
 // ));
 
-// 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.
@@ -58,6 +58,6 @@
         '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.
@@ -390,17 +390,17 @@
     {
         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);
Index: branches/eli_branch/lib/Auth_SQL.inc.php
===================================================================
--- branches/eli_branch/lib/Auth_SQL.inc.php	(revision 446)
+++ branches/eli_branch/lib/Auth_SQL.inc.php	(revision 447)
@@ -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,19 +28,19 @@
 */
 
-// 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.
     private $_ns;
-    
+
     // Static var for test.
     private $_authentication_tested;
@@ -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.
@@ -130,7 +130,7 @@
     {
 		$app =& App::getInstance();
-        
+
         $this->_ns = $namespace;
-        
+
         // Initialize default parameters.
         $this->setParam($this->_default_params);
@@ -157,6 +157,6 @@
 		$app =& App::getInstance();
 		$db =& DB::getInstance();
-	
-    
+
+
         static $_db_tested = false;
 
@@ -277,5 +277,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -294,5 +294,5 @@
     {
 		$db =& DB::getInstance();
-	
+
         $this->initDB();
 
@@ -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().
@@ -416,14 +416,14 @@
 		$app =& App::getInstance();
     	$db =& DB::getInstance();
-	
+
         $this->initDB();
 
         $this->clear();
 
-        if (!$user_data = $this->authenticate($username, $password)) {
+        if ((!$user_data = $this->authenticate($username, $password))) {
             // No login: failed authentication!
             return false;
         }
-        
+
         // Register authenticated session.
         $_SESSION['_auth_sql'][$this->_ns] = array(
@@ -563,5 +563,5 @@
         $this->_authentication_tested = true;
 
-        // Some users will access from networks with a changing IP number (i.e. behind a proxy server). 
+        // 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, or their usernames to the list of match_remote_ip_exempt_usernames.
         if ($trusted_net = ipInRange(getRemoteAddr(), $this->_params['trusted_networks'])) {
@@ -579,10 +579,10 @@
             $user_in_trusted_network = false;
         }
-        
+
         // Do we match the user's remote IP at all? Yes, if set in config and not disabled for specific user.
         if ($this->getParam('match_remote_ip') && !$this->get('match_remote_ip_exempt')) {
             $remote_ip_is_matched = (isset($_SESSION['_auth_sql'][$this->_ns]['remote_ip']) && $_SESSION['_auth_sql'][$this->_ns]['remote_ip'] == getRemoteAddr()) || $user_in_trusted_network;
         } else {
-            $app->logMsg(sprintf('User_id %s exempt from remote_ip match (comparing %s == %s)', 
+            $app->logMsg(sprintf('User_id %s exempt from remote_ip match (comparing %s == %s)',
                 ($this->get('user_id') ? $this->get('user_id') . ' (' .  $this->get('username') . ')' : 'unknown'),
                 $_SESSION['_auth_sql'][$this->_ns]['remote_ip'],
@@ -593,5 +593,5 @@
 
         // Test login with information stored in session. Skip IP matching for users from trusted networks.
-        if (isset($_SESSION['_auth_sql'][$this->_ns]['authenticated']) 
+        if (isset($_SESSION['_auth_sql'][$this->_ns]['authenticated'])
             && true === $_SESSION['_auth_sql'][$this->_ns]['authenticated']
             && isset($_SESSION['_auth_sql'][$this->_ns]['username'])
@@ -671,5 +671,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (!$this->isLoggedIn()) {
             // Display message for requiring login. (RaiseMsg will ignore empty strings.)
@@ -694,5 +694,5 @@
 		$app =& App::getInstance();
     	$db =& DB::getInstance();
-	
+
         $this->initDB();
 
@@ -730,5 +730,5 @@
             $user_id = isset($user_id) ? $user_id : $this->getVal('user_id');
             $qid = $db->query("
-                SELECT 1 
+                SELECT 1
                 FROM " . $this->_params['db_table'] . "
                 WHERE blocked = 'true'
@@ -745,7 +745,7 @@
     {
 		$db =& DB::getInstance();
-	
+
         $this->initDB();
-	
+
         if ($this->getParam('blocking')) {
             // Get user_id if specified.
@@ -769,5 +769,5 @@
     {
 		$db =& DB::getInstance();
-	
+
         $this->initDB();
 
@@ -789,5 +789,5 @@
     {
 		$db =& DB::getInstance();
-	
+
         $this->initDB();
 
@@ -846,43 +846,43 @@
     {
         $app =& App::getInstance();
-        
+
         // Existing password hashes rely on the same key/salt being used to compare encryptions.
         // Don't change this (or the value applied to signing_key) unless you know existing hashes or signatures will not be affected!
         $more_salt = 'B36D18E5-3FE4-4D58-8150-F26642852B81';
-        
+
         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.
-            for ($i=0; $i < 4096; $i++) { 
-                $hash = sha1($hash); 
-            } 
+            for ($i=0; $i < 4096; $i++) {
+                $hash = sha1($hash);
+            }
             return $hash;
             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);
             // Increase key strength by 12 bits.
-            for ($i=0; $i < 4096; $i++) { 
-                $hash = md5($hash); 
-            } 
+            for ($i=0; $i < 4096; $i++) {
+                $hash = md5($hash);
+            }
             return $hash;
             break;
@@ -902,5 +902,5 @@
 		$app =& App::getInstance();
     	$db =& DB::getInstance();
-	
+
         $this->initDB();
 
@@ -909,5 +909,5 @@
 
         // Get old password.
-        $qid = $db->query(" 
+        $qid = $db->query("
             SELECT userpass
             FROM " . $this->_params['db_table'] . "
@@ -918,5 +918,5 @@
             return false;
         }
-        
+
         // Compare old with new to ensure we're actually *changing* the password.
         $encrypted_password = $this->encryptPassword($password);
@@ -932,10 +932,10 @@
             WHERE " . $this->_params['db_primary_key'] . " = '" . $db->escapeString($user_id) . "'
         ");
-        
+
         if (mysql_affected_rows($db->getDBH()) != 1) {
             $app->logMsg(sprintf('Failed to update password for user_id %s', $user_id), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
-        
+
         return true;
     }
@@ -952,5 +952,5 @@
 		$app =& App::getInstance();
     	$db =& DB::getInstance();
-	
+
         $this->initDB();
 
@@ -1039,5 +1039,5 @@
     {
 		$app =& App::getInstance();
-    
+
         // return true; /// WTF?
         $zone_members = preg_split('/,\s*/', $security_zone);
Index: branches/eli_branch/lib/AuthorizeNet.inc.php
===================================================================
--- branches/eli_branch/lib/AuthorizeNet.inc.php	(revision 446)
+++ branches/eli_branch/lib/AuthorizeNet.inc.php	(revision 447)
@@ -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';
@@ -143,5 +143,5 @@
         $this->_params = $this->_default_params;
         $this->setParam($params);
-        
+
         $this->setParam(array('md5_hash_salt' => $app->getParam('signing_key')));
     }
@@ -156,5 +156,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (isset($params) && is_array($params)) {
             // Merge new parameters with old overriding only those passed.
@@ -175,5 +175,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -195,5 +195,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (empty($this->_params['x_login'])) {
             $this->_results['x_response_reason_text'] = _("Transaction gateway temporarily not available. Please try again later.");
Index: branches/eli_branch/lib/FormValidator.inc.php
===================================================================
--- branches/eli_branch/lib/FormValidator.inc.php	(revision 446)
+++ branches/eli_branch/lib/FormValidator.inc.php	(revision 447)
@@ -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/>.
@@ -70,5 +70,5 @@
     // Array filling with error messages.
     public $errors = array();
-    
+
     /**
      * Set (or overwrite existing) parameters by passing an array of new parameters.
@@ -80,5 +80,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (isset($params) && is_array($params)) {
             // Merge new parameters with old overriding only those passed.
@@ -99,5 +99,5 @@
     {
 		$app =& App::getInstance();
-    
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
@@ -107,5 +107,5 @@
         }
     }
-    
+
     /**
      * Return the current list of errors.
@@ -159,5 +159,5 @@
             return false;
         } else {
-            return (sizeof($this->errors) > 0);            
+            return (sizeof($this->errors) > 0);
         }
     }
@@ -283,8 +283,8 @@
         }
     }
-    
+
     /*
     * We were using the isEmpty method *wrong* all these years and should have been using notEmpty.
-    * But the fact is the only use is to ensure a value is not empty, so this function simply becomes 
+    * But the fact is the only use is to ensure a value is not empty, so this function simply becomes
     * an alias of the one-true notEmpty() function.
     * @since    03 Jun 2006 22:56:46
@@ -474,7 +474,7 @@
         }
 
-        // Validator::validateEmail() returns a value that relates to the VALIDATE_EMAIL_* constants (defined in Validator.inc.php).
+        // 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:
+        case parent::EMAIL_REGEX_FAIL:
             // Failed regex match.
             $this->addError($form_name, sprintf(_("The email address <em>%s</em> is formatted incorrectly."), oTxt($email)));
@@ -482,6 +482,6 @@
             return false;
             break;
-            
-        case VALIDATE_EMAIL_LENGTH_FAIL :
+
+        case parent::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)));
@@ -489,6 +489,6 @@
             return false;
             break;
-            
-        case VALIDATE_EMAIL_MX_FAIL :
+
+        case parent::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)));
@@ -496,6 +496,6 @@
             return false;
             break;
-            
-        case VALIDATE_EMAIL_SUCCESS :
+
+        case parent::EMAIL_SUCCESS :
         default :
             return true;
@@ -550,5 +550,5 @@
      *
      * @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
@@ -557,5 +557,5 @@
     {
         $cc_num = getFormData($form_name);
-        
+
         if (parent::validateCCNumber($cc_num, $cc_type)) {
             return true;
Index: branches/eli_branch/lib/Validator.inc.php
===================================================================
--- branches/eli_branch/lib/Validator.inc.php	(revision 446)
+++ branches/eli_branch/lib/Validator.inc.php	(revision 447)
@@ -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,5 +24,5 @@
  * Validator.inc.php
  *
- * The Validator class provides a methods for validating input against different criteria. 
+ * The Validator class provides a methods for validating input against different criteria.
  * All functions return true if the input passes the test.
  *
@@ -31,19 +31,19 @@
  */
 
-// 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;
 
     /**
@@ -180,5 +180,5 @@
      * @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
+     * @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>
      */
@@ -190,12 +190,12 @@
         // Test email address format.
         if (!preg_match($e->getParam('regex'), $val, $e_parts)) {
-            return VALIDATE_EMAIL_REGEX_FAIL;
-        }
-        
+            return self::EMAIL_REGEX_FAIL;
+        }
+
         // We have a match! Here are the captured subpatterns, on which further tests are run.
-        // The part before the @. 
+        // The part before the @.
         $local = $e_parts[2];
 
-        // The part after the @. 
+        // The part after the @.
         // If domain is an IP [XXX.XXX.XXX.XXX] strip off the brackets.
         $domain = $e_parts[3]{0} == '[' ? mb_substr($e_parts[3], 1, -1) : $e_parts[3];
@@ -203,5 +203,5 @@
         // Test length.
         if (mb_strlen($local) > 64 || mb_strlen($domain) > 191) {
-            return VALIDATE_EMAIL_LENGTH_FAIL;
+            return self::EMAIL_LENGTH_FAIL;
         }
 
@@ -210,8 +210,8 @@
         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_MX_FAIL;
+        }
+
+        return self::EMAIL_SUCCESS;
     }
 
@@ -225,5 +225,5 @@
     {
 		$app =& App::getInstance();
-		
+
 		if ('' == trim($val)) {
 		    // Don't be too bothered about empty strings.
@@ -257,20 +257,20 @@
          // Perform card-specific checks, if applicable
          switch ($cc_type) {
-             case CC_TYPE_VISA :
+             case self::CC_TYPE_VISA :
                  $regex = '/^4\d{15}$|^4\d{12}$/';
                  break;
-             case CC_TYPE_MASTERCARD :
+             case self::CC_TYPE_MASTERCARD :
                  $regex = '/^5[1-5]\d{14}$/';
                  break;
-             case CC_TYPE_AMEX :
+             case self::CC_TYPE_AMEX :
                  $regex = '/^3[47]\d{13}$/';
                  break;
-             case CC_TYPE_DISCOVER :
+             case self::CC_TYPE_DISCOVER :
                  $regex = '/^6011\d{12}$/';
                  break;
-             case CC_TYPE_DINERS :
+             case self::CC_TYPE_DINERS :
                  $regex = '/^30[0-5]\d{11}$|^3[68]\d{12}$/';
                  break;
-             case CC_TYPE_JCB :
+             case self::CC_TYPE_JCB :
                  $regex = '/^3\d{15}$|^2131|1800\d{11}$/';
                  break;
@@ -279,5 +279,5 @@
                  break;
          }
-         
+
          if ('' != $regex && !preg_match($regex, $cc_num)) {
              // Invalid format.
@@ -324,5 +324,5 @@
             return false;
         }
-        
+
         if (is_array($_FILES[$form_name]['name'])) {
             foreach($_FILES[$form_name]['name'] as $f) {
@@ -336,5 +336,5 @@
             }
         }
-        
+
         return true;
     }
