Index: /tags/2.0.2/lib/Auth_SQL.inc.php
===================================================================
--- /tags/2.0.2/lib/Auth_SQL.inc.php	(revision 265)
+++ /tags/2.0.2/lib/Auth_SQL.inc.php	(revision 266)
@@ -577,8 +577,8 @@
 
     /**
-     * This sets the 'blocked' field for a user in the db_table, and also
-     * adds an optional reason
-     *
-     * @param  string   $reason      The reason for blocking the account.
+     * Tests if the "blocked" flag is set for a user.
+     *
+     * @param  int      $user_id    User id to look for.
+     * @return boolean              True if the user is blocked, false otherwise.
      */
     function isBlocked($user_id=null)
Index: /trunk/bin/module_maker/validation.cli.php
===================================================================
--- /trunk/bin/module_maker/validation.cli.php	(revision 265)
+++ /trunk/bin/module_maker/validation.cli.php	(revision 266)
@@ -184,5 +184,5 @@
         }
         if ($max_length > 0 && $len_type == 'setenum') {
-            $o[] = "\$fv->stringLength('$field', 0, $max_length, _(\"$title has an invalid selection.\"));";
+            $o[] = "\$fv->stringLength('$field', 0, $max_length, sprintf(_(\"%s has an invalid selection.\"), _(\"$title\")));";
         }
         if ($max_length > 0 && $len_type == 'string') {
@@ -241,19 +241,19 @@
         case 'date' :
         case 'datetime' :
-            // \$fv->validateStrDate('$field', sprintf(_(\"%s must be a valid date in YYYY-MM-DD format.\"), _(\"$field\")));
-            $o[] = "\$fv->validateStrDate('$field', sprintf(_(\"%s must be a valid date in YYYY-MM-DD format.\"), _(\"$field\")));";
-            $o[] = "\$fv->checkRegex('$field', '/^\d{4}-\d{2}-\d{2}$/', true, sprintf(_(\"%s must be in YYYY-MM-DD format.\"), _(\"$field\")));";
+            // \$fv->validateStrDate('$field', sprintf(_(\"%s must be a valid date in YYYY-MM-DD format.\"), _(\"$title\")));
+            $o[] = "\$fv->validateStrDate('$field', sprintf(_(\"%s must be a valid date in YYYY-MM-DD format.\"), _(\"$title\")));";
+            $o[] = "\$fv->checkRegex('$field', '/^\d{4}-\d{2}-\d{2}$/', true, sprintf(_(\"%s must be in YYYY-MM-DD format.\"), _(\"$title\")));";
             break;
 
         case 'timestamp' :
-            $o[] = "\$fv->checkRegex('$field', '/^\d{14}$/', true, sprintf(_(\"%s must be a valid mysql timestamp in YYYYMMDDhhmmss format.\"), _(\"$field\")));";
+            $o[] = "\$fv->checkRegex('$field', '/^\d{14}$/', true, sprintf(_(\"%s must be a valid mysql timestamp in YYYYMMDDhhmmss format.\"), _(\"$title\")));";
             break;
 
         case 'time' :
-            $o[] = "\$fv->checkRegex('$field', '/^\d{1,3}:\d{2}:\d{2}$/', true, sprintf(_(\"%s must be a valid time in hh:mm:ss format.\"), _(\"$field\")));";
+            $o[] = "\$fv->checkRegex('$field', '/^\d{1,3}:\d{2}:\d{2}$/', true, sprintf(_(\"%s must be a valid time in hh:mm:ss format.\"), _(\"$title\")));";
             break;
 
         case 'year' :
-            $o[] = "\$fv->checkRegex('$field', '/^\d{4}$/', true, sprintf(_(\"%s must be a valid year in YYYY format.\"), _(\"$field\")));";
+            $o[] = "\$fv->checkRegex('$field', '/^\d{4}$/', true, sprintf(_(\"%s must be a valid year in YYYY format.\"), _(\"$title\")));";
             break;
 
Index: /trunk/docs/upgrade_v1-to-v2.mysql
===================================================================
--- /trunk/docs/upgrade_v1-to-v2.mysql	(revision 265)
+++ /trunk/docs/upgrade_v1-to-v2.mysql	(revision 266)
@@ -1,10 +1,13 @@
 ## Update user_tbl.
-## (If it exists.)
-# ALTER TABLE `user_tbl` ADD modified_by_user_id smallint(11) default NULL AFTER added_by_user_id;
-# ALTER TABLE `user_tbl` MODIFY added_datetime datetime NOT NULL default '0000-00-00 00:00:00' AFTER modified_by_user_id;
-# ALTER TABLE `user_tbl` ADD modified_datetime datetime NOT NULL default '0000-00-00 00:00:00' AFTER added_datetime;
+## (If it exists!)
+ALTER TABLE `user_tbl` ADD modified_by_user_id smallint(11) default NULL AFTER added_by_user_id;
+ALTER TABLE `user_tbl` MODIFY added_datetime datetime NOT NULL default '0000-00-00 00:00:00' AFTER modified_by_user_id;
+ALTER TABLE `user_tbl` ADD modified_datetime datetime NOT NULL default '0000-00-00 00:00:00' AFTER added_datetime;
 
 ## Update admin_tbl.
-ALTER TABLE `admin_tbl` ADD login_abuse_exempt enum('true') default NULL AFTER priv;
+## NOTE: This first one might need customizing.
+ALTER TABLE `admin_tbl` CHANGE priv user_type enum('root','admin','editor') default NULL;
+
+ALTER TABLE `admin_tbl` ADD login_abuse_exempt enum('true') default NULL AFTER user_type;
 ALTER TABLE `admin_tbl` ADD blocked enum('true') default NULL AFTER login_abuse_exempt;
 ALTER TABLE `admin_tbl` ADD blocked_reason varchar(255) NOT NULL default '' AFTER blocked;
@@ -22,7 +25,4 @@
 ## Rename added_by_admin_id -> added_by_user_id in all tables.
 ## Changing these will require source code modifications.
-ALTER TABLE `client_tbl` CHANGE added_by_admin_id added_by_user_id smallint(11) default NULL;
-ALTER TABLE `config_event_tbl` CHANGE added_by_admin_id added_by_user_id smallint(11) default NULL;
-ALTER TABLE `invoice_tbl` CHANGE added_by_admin_id added_by_user_id smallint(11) default NULL;
-ALTER TABLE `payment_tbl` CHANGE added_by_admin_id added_by_user_id smallint(11) default NULL;
-ALTER TABLE `site_tbl` CHANGE added_by_admin_id added_by_user_id smallint(11) default NULL;
+## This is just an EXAMPLE!
+# ALTER TABLE `client_tbl` CHANGE added_by_admin_id added_by_user_id smallint(11) default NULL;
Index: /trunk/lib/Auth_SQL.inc.php
===================================================================
--- /trunk/lib/Auth_SQL.inc.php	(revision 265)
+++ /trunk/lib/Auth_SQL.inc.php	(revision 266)
@@ -638,4 +638,29 @@
 
     /**
+     * Tests if the "blocked" flag is set for a user.
+     *
+     * @param  int      $user_id    User id to look for.
+     * @return boolean              True if the user is blocked, false otherwise.
+     */
+    function isBlocked($user_id=null)
+    {
+    	$db =& DB::getInstance();
+
+        $this->initDB();
+
+        if ($this->getParam('blocking')) {
+            // Get user_id if specified.
+            $user_id = isset($user_id) ? $user_id : $this->getVal('user_id');
+            $qid = $db->query("
+                SELECT 1 
+                FROM " . $this->_params['db_table'] . "
+                WHERE blocked = 'true'
+                AND " . $this->_params['db_primary_key'] . " = '" . $db->escapeString($user_id) . "'
+            ");
+            return mysql_num_rows($qid) === 1;
+        }
+    }
+
+    /**
      * Unblocks a user in the db_table, and clears any blocked_reason.
      */
@@ -902,19 +927,21 @@
     /**
      * If the current user has access to the specified $security_zone, return true.
-     * If the optional $priv is supplied, test that against the zone.
+     * If the optional $user_type is supplied, test that against the zone.
+     *
+     * NOTE: "user_type" used to be called "priv" in some older implementations.
      *
      * @param  constant $security_zone   string of comma delimited priviliges for the zone
-     * @param  string   $priv            a privilege that might be found in a zone
+     * @param  string   $user_type       a privilege that might be found in a zone
      * @return bool     true if user is a member of security zone, false otherwise
      */
-    function inClearanceZone($security_zone, $priv='')
+    function inClearanceZone($security_zone, $user_type='')
     {
         return true;
         $zone_members = preg_split('/,\s*/', $security_zone);
-        $priv = empty($priv) ? $this->get('priv') : $priv;
+        $user_type = empty($user_type) ? $this->get('user_type') : $user_type;
 
         // If the current user's privilege level is NOT in that array or if the
         // user has no privilege, return false. Otherwise the user is clear.
-        if (!in_array($priv, $zone_members) || empty($priv)) {
+        if (!in_array($user_type, $zone_members) || empty($user_type)) {
             return false;
         } else {
@@ -926,4 +953,6 @@
      * This function tests a list of arguments $security_zone against the priv that the current user has.
      * If the user doesn't have one of the supplied privs, die.
+     *
+     * NOTE: "user_type" used to be called "priv" in some older implementations.
      *
      * @param  constant $security_zone   string of comma delimited priviliges for the zone
@@ -938,5 +967,5 @@
         /* If the current user's privilege level is NOT in that array or if the
          * user has no privilege, DIE with a message. */
-        if (!in_array($this->get('priv'), $zone_members) || !$this->get('priv')) {
+        if (!in_array($this->get('user_type'), $zone_members) || !$this->get('user_type')) {
             $message = empty($message) ? _("You have insufficient privileges to view that page.") : $message;
             $app->raiseMsg($message, MSG_NOTICE, __FILE__, __LINE__);
Index: /trunk/lib/FormValidator.inc.php
===================================================================
--- /trunk/lib/FormValidator.inc.php	(revision 265)
+++ /trunk/lib/FormValidator.inc.php	(revision 266)
@@ -40,6 +40,51 @@
 class FormValidator extends Validator {
 
+    // Class parameters.
+    var $_params = array(
+        'error' => ' sc-msg-error ',
+        'warning' => ' sc-msg-warning ',
+        'notice' => ' sc-msg-notice ',
+        'success' => ' sc-msg-success ',
+    );
+
     // Array filling with error messages.
     var $errors = array();
+    
+    /**
+     * Set (or overwrite existing) parameters by passing an array of new parameters.
+     *
+     * @access public
+     * @param  array    $params     Array of parameters (key => val pairs).
+     */
+    function setParam($params)
+    {
+		$app =& App::getInstance();
+    
+        if (isset($params) && is_array($params)) {
+            // Merge new parameters with old overriding only those passed.
+            $this->_params = array_merge($this->_params, $params);
+        } else {
+            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
+        }
+    }
+
+    /**
+     * 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();
+    
+        if (isset($this->_params[$param])) {
+            return $this->_params[$param];
+        } else {
+            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
+            return null;
+        }
+    }
     
     /**
@@ -164,17 +209,17 @@
                 case MSG_ERR:
                 default:
-                    echo ' sc-msg-error ';
+                    echo $this->getParam('error');
                     break;
 
                 case MSG_WARNING:
-                    echo ' sc-msg-warning ';
+                    echo $this->getParam('warning');
                     break;
 
+                case MSG_NOTICE:
+                    echo $this->getParam('notice');
+                    break;
+
                 case MSG_SUCCESS:
-                    echo ' sc-msg-success ';
-                    break;
-
-                case MSG_NOTICE:
-                    echo ' sc-msg-notice ';
+                    echo $this->getParam('success');
                     break;
                 }
Index: /trunk/lib/Validator.inc.php
===================================================================
--- /trunk/lib/Validator.inc.php	(revision 265)
+++ /trunk/lib/Validator.inc.php	(revision 266)
@@ -208,5 +208,5 @@
         $timestamp = strtotime($val);
         // Return values change between php4 and php5.
-        if ($timestamp === -1 || $timestamp === false) {
+        if ('' != trim($val) && ($timestamp === -1 || $timestamp === false)) {
             return false;
         } else {
Index: /trunk/services/admins.php
===================================================================
--- /trunk/services/admins.php	(revision 265)
+++ /trunk/services/admins.php	(revision 266)
@@ -86,5 +86,5 @@
     // Initialize variables for the form template.
     $frm =& addRecordForm();
-    $nav->add(_("Add Admin"));
+    $nav->add(_("Add Administrator"));
     $main_template = 'admin_form.ihtml';
     break;
@@ -93,5 +93,5 @@
     // Initialize variables for the form template.
     $frm =& editRecordForm(getFormData('admin_id'));
-    $nav->add(_("Edit Admin"));
+    $nav->add(_("Edit Administrator"));
     $main_template = 'admin_form.ihtml';
     break;
@@ -120,5 +120,5 @@
         $frm =& addRecordForm();
         $frm = array_merge($frm, getFormData());
-        $nav->add(_("Add Admin"));
+        $nav->add(_("Add Administrator"));
         $main_template = 'admin_form.ihtml';
     } else {
@@ -156,5 +156,5 @@
         $frm =& editRecordForm(getFormData('admin_id'));
         $frm = array_merge($frm, getFormData());
-        $nav->add(_("Edit Admin"));
+        $nav->add(_("Edit Administrator"));
         $main_template = 'admin_form.ihtml';
     } else {
@@ -254,5 +254,5 @@
         'new_op' => 'insert',
         'submit_buttons' => array(
-            'submit' => _("Add Admin"),
+            'submit' => _("Add Administrator"),
             'repeat' => _("Add &amp; repeat"),
             'cancel' => _("Cancel"),
@@ -408,5 +408,5 @@
     $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']);
 
-    $app->raiseMsg(sprintf(_("The Admin <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
+    $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
 
     return $last_insert_id;
@@ -452,5 +452,5 @@
     $version->create('admin_tbl', 'admin_id', $frm['admin_id'], $frm['username']);
 
-    $app->raiseMsg(sprintf(_("The Admin <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
+    $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
 
     // Unlock record.
@@ -523,5 +523,6 @@
     // First try to return from the cache.
     if ($cache->exists('list')) {
-        return $cache->get('list');
+        $list = $cache->get('list');
+        return $list;
     }
     
