Index: /trunk/bin/module_maker/list_template.cli.php
===================================================================
--- /trunk/bin/module_maker/list_template.cli.php	(revision 315)
+++ /trunk/bin/module_maker/list_template.cli.php	(revision 316)
@@ -54,6 +54,18 @@
         // Human readable.
         $field = $col[0];
+        $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]);
         $title = ucfirst(str_replace('_', ' ', $field));
-        $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]);
+
+        switch ($field) {
+        case 'added_by_user_id' :
+        case 'modified_by_user_id' :
+            $title = "by";
+            break;
+
+        case 'added_datetime' :
+        case 'modified_datetime' :
+            $title = str_replace(' datetime', '', $title);
+            break;
+        }
 
         // Get primary key.
@@ -136,8 +148,14 @@
 if (!isset($op) || 'headerrows' == $op) {
     foreach ($headers as $field=>$title) {
+        if (preg_match('/(_date|_datetime|_time|price|value|quantity)/', $field)) {
+            $ordering = 'DESC';
+        } else {
+            $ordering = 'ASC';
+        }
+
         if ($field == $primary_key) {
-            echo "        <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"ID\"), 'ASC'); \x3f></th>\n";
+            echo "        <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"ID\"), 'DESC'); \x3f></th>\n";
         } else {
-            echo "        <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"$title\"), 'ASC'); \x3f></th>\n";
+            echo "        <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"$title\"), '$ordering'); \x3f></th>\n";
         }
     }
@@ -149,6 +167,6 @@
     <\x3fphp for (\$i = 0; \$i <= \$page->last_item - \$page->first_item && \$page->total_items > 0; \$i++) { \x3f>
     <tr>
-        <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0" /></a> &nbsp;</td>
-        <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
+        <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> &nbsp;</td>
+        <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/i/multiple.png" alt="" width="12" height="12" border="0" /></a> &nbsp;</td>
 
 E_O_F;
@@ -164,5 +182,5 @@
 
 echo isset($op) ? '' : <<<E_O_F
-        <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onclick"javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>');"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
+        <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onclick"javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>');"><img src="/admin/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> &nbsp;</td>
     </tr>
     <\x3fphp } \x3f>
Index: /trunk/bin/module_maker/module.cli.php
===================================================================
--- /trunk/bin/module_maker/module.cli.php	(revision 315)
+++ /trunk/bin/module_maker/module.cli.php	(revision 316)
@@ -118,14 +118,14 @@
 // Ensure essential directories exist.
 if (!is_dir("$admin_dir")) {
-    die(basename($_SERVER['argv'][0]) . " Error: $admin_dir directory not found.\n");
+    die(basename($_SERVER['argv'][0]) . " Error: admin_dir '$admin_dir' directory not found.\n");
 }
 if (!is_dir("$admin_tpl_dir")) {
-    die(basename($_SERVER['argv'][0]) . " Error: $admin_tpl_dir directory not found.\n");
+    die(basename($_SERVER['argv'][0]) . " Error: admin_tpl_dir '$admin_tpl_dir' directory not found.\n");
 }
 if (!is_dir("$public_dir")) {
-    die(basename($_SERVER['argv'][0]) . " Error: $public_dir directory not found.\n");
+    die(basename($_SERVER['argv'][0]) . " Error: public_dir '$public_dir' directory not found.\n");
 }
 if (!is_dir("$public_tpl_dir")) {
-    die(basename($_SERVER['argv'][0]) . " Error: $public_tpl_dir directory not found.\n");
+    die(basename($_SERVER['argv'][0]) . " Error: public_tpl_dir '$public_tpl_dir' directory not found.\n");
 }
 
@@ -174,4 +174,8 @@
         $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]);
         $default = $col[4];
+        
+        if (mb_strpos($default, '0000') !== false || '0' == $default) {
+            $default = '';
+        }
 
         // Get primary key.
Index: /trunk/bin/module_maker/skel/adm_list.ihtml
===================================================================
--- /trunk/bin/module_maker/skel/adm_list.ihtml	(revision 315)
+++ /trunk/bin/module_maker/skel/adm_list.ihtml	(revision 316)
@@ -26,8 +26,8 @@
     <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
     <tr>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0" /></a> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/i/multiple.png" alt="" width="12" height="12" border="0" /></a> &nbsp;</td>
 %ADM_LIST_ROWS%
-        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onclick"javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['__///__'])) ?>');"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onclick"javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['__///__'])) ?>');"><img src="/admin/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> &nbsp;</td>
     </tr>
     <?php } ?>
Index: /trunk/docs/examples/_config.inc.php
===================================================================
--- /trunk/docs/examples/_config.inc.php	(revision 315)
+++ /trunk/docs/examples/_config.inc.php	(revision 316)
@@ -39,4 +39,5 @@
     'site_email' => 'hello@example.com',
     'redirect_home_url' => '/',
+    'images_path' => '/i',
 
     'date_format' => 'd M Y',
Index: /trunk/docs/examples/db_auth.inc.php
===================================================================
--- /trunk/docs/examples/db_auth.inc.php	(revision 316)
+++ /trunk/docs/examples/db_auth.inc.php	(revision 316)
@@ -0,0 +1,16 @@
+<?php
+/* 
+* The credentials here are to be loaded only by command-line scripts executed 
+* on the command line or via cron. This script should be not be readable by apache. 
+* Ownershipt should be the web owner, with only user-readbility, such as:
+* -rw-------@  1 bob  bob   416 Mar 10 16:59 global/db_auth.inc.php
+*/
+require_once 'codebase/lib/App.inc.php';
+$app =& App::getInstance();
+
+$app->setParam(array(
+    'db_name' => '',
+    'db_user' => '',
+    'db_pass' => '',
+));
+?>
Index: /trunk/lib/AuthorizeNet.inc.php
===================================================================
--- /trunk/lib/AuthorizeNet.inc.php	(revision 315)
+++ /trunk/lib/AuthorizeNet.inc.php	(revision 316)
@@ -42,5 +42,4 @@
 
     var $post_url = ''; // The URL to post data to.
-    var $md5_hash_value = ','; // A custom value for the response delimination character.
     var $_results = array();
     var $_params = array();
@@ -57,4 +56,5 @@
         'x_delim_char'      => ',',
         'x_encap_char'      => '',
+        'md5_hash_salt'    => '',
     );
 
@@ -111,4 +111,6 @@
     function AuthorizeNet($params = array())
     {
+        $app =& App::getInstance();
+
         if (!function_exists('curl_init')) {
             trigger_error('AuthorizeNet error: curl not installed.', E_USER_ERROR);
@@ -118,9 +120,8 @@
         $this->post_url = isset($params['post_url']) ? $params['post_url'] : 'https://secure.authorize.net/gateway/transact.dll';
 
-        // A custom value for the response delimination character.
-        $this->md5_hash_value = isset($params['md5_hash_value']) ? $params['md5_hash_value'] : '';
-
         // Set default parameters.
         $this->_params = $this->_default_params;
+        
+        $this->setParam(array('md5_hash_salt' => $app->getParam('signing_key')));
     }
 
@@ -239,5 +240,5 @@
         return (
             mb_strtolower($this->getResult('x_md5_hash')) == mb_strtolower(md5(
-                $this->md5_hash_value .
+                $this->getParam('md5_hash_salt') .
                 $this->getParam('x_login') .
                 $this->getResult('x_trans_id') .
Index: /trunk/lib/Cache.inc.php
===================================================================
--- /trunk/lib/Cache.inc.php	(revision 315)
+++ /trunk/lib/Cache.inc.php	(revision 316)
@@ -133,5 +133,5 @@
 
         if (true !== $this->getParam('enabled')) {
-            $app->logMsg(sprintf('Cache not enabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Cache disabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__);
             return false;
         }
@@ -182,5 +182,5 @@
 
         if (true !== $this->getParam('enabled')) {
-            $app->logMsg(sprintf('Cache not enabled, not getting data.', null), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Cache disabled, not getting data.', null), LOG_DEBUG, __FILE__, __LINE__);
             return false;
         }
Index: /trunk/lib/SortOrder.inc.php
===================================================================
--- /trunk/lib/SortOrder.inc.php	(revision 315)
+++ /trunk/lib/SortOrder.inc.php	(revision 316)
@@ -20,6 +20,6 @@
     var $sort_by;
     var $order;
-    var $asc_widget = '<img src="/admin/_widgets/sort_ascending.gif" alt="[ASC]" width="11" height="7" border="0" />';
-    var $desc_widget = '<img src="/admin/_widgets/sort_descending.gif" alt="[DESC]" width="11" height="7" border="0" />';
+    var $asc_widget;
+    var $desc_widget;
     var $default_sort;
     var $default_order;
@@ -35,11 +35,20 @@
     function SortOrder($default_sort = '', $default_order = '')
     {
+        $app =& App::getInstance();
+        
+        // Setup the HTML for printing ASC/DESC paths.
+        // This should be converted to CSS someday.
+        $images_path = $app->getParam('images_path') ? $app->getParam('images_path') : '/admin/_widgets';
+        $this->asc_widget = sprintf('<img src="%s/sort_ascending.gif" alt="%s" width="11" height="7" border="0" />', $images_path, _("Ascending"));
+        $this->desc_widget = sprintf('<img src="%s/sort_descending.gif" alt="%s" width="11" height="7" border="0" />', $images_path, _("Ascending"));
+        
+        // Setup prefs object.
         $this->prefs = new Prefs($_SERVER['PHP_SELF']);
         $this->prefs->setParam(array('persistent' => false));
 
+        // Setup defaults.
         $this->setDefault($default_sort, $default_order);
-
         $this->default_sort = $default_sort;
-        $this->default_order = $default_order;        
+        $this->default_order = $default_order;
     }
 
Index: /trunk/services/templates/admin_list.ihtml
===================================================================
--- /trunk/services/templates/admin_list.ihtml	(revision 315)
+++ /trunk/services/templates/admin_list.ihtml	(revision 316)
@@ -32,6 +32,6 @@
     <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
     <tr>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0" /></a> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF(sprintf('/admin/versions.php?record_table=%s&record_key=%s&record_val=%s&boomerang=true', $auth->getParam('db_table'), $auth->getParam('db_primary_key'), $list[$i]['admin_id'])); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF(sprintf('/admin/versions.php?record_table=%s&record_key=%s&record_val=%s&boomerang=true', $auth->getParam('db_table'), $auth->getParam('db_primary_key'), $list[$i]['admin_id'])); ?>"><img src="/admin/i/multiple.png" alt="" width="12" height="12" border="0" /></a> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
@@ -50,5 +50,5 @@
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> &nbsp;</td>
         <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['modified_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])); ?> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onclick"javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onclick"javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> &nbsp;</td>
     </tr>
     <?php } ?>
