Index: trunk/bin/module_maker/_config.inc.php
===================================================================
--- trunk/bin/module_maker/_config.inc.php	(revision 523)
+++ 	(revision )
@@ -1,98 +1,0 @@
-<?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/>.
- */
-
-/* module_maker/_config.inc.php */
-
-// Test argument.
-if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
-    // Determine common site directory.
-    $common_base = realpath($_SERVER['argv'][1]);
-
-    // First arg is path to current site. Realpath removes trailing /s
-    define('COMMON_BASE', $common_base);
-} else {
-    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
-}
-
-// Make sure necessary files exist.
-$db_auth_file = false;
-$db_json_file = false;
-$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(COMMON_BASE));
-$rii->setMaxDepth(2);
-foreach ($rii as $filename => $file) {
-    if (mb_strpos($filename, 'db_auth.json') !== false) {
-        $db_json_file = $filename;
-        break;
-    }
-    if (mb_strpos($filename, 'db_auth.inc.php') !== false) {
-        $db_auth_file = $filename;
-        break;
-    }
-}
-
-if (!$db_auth_file && !$db_json_file) {
-    die("Error: First argument directory must contain the global/db_auth.inc.php file with valid MySQL credentials.\n");
-}
-
-// Set include path for all templates and libraries.
-ini_set('include_path', join(PATH_SEPARATOR, array(
-    COMMON_BASE,
-    get_include_path(),
-)));
-
-// Include core libraries.
-require_once 'codebase/lib/App.inc.php';
-require_once 'codebase/lib/Utilities.inc.php';
-require_once 'codebase/lib/Auth_SQL.inc.php';
-
-$app =& App::getInstance('module_maker');
-$app->setParam(array(
-    'site_name' => 'Module Maker',
-    'site_email' => 'codebase@strangecode.com',
-    'enable_session' => false,
-    'enable_db' => true,
-    'db_always_debug' => false,
-    'db_debug' => true,
-    'db_die_on_failure' => true,
-    'display_errors' => true,
-    'error_reporting' => E_ALL,
-    'log_screen_priority' => LOG_DEBUG,
-    'log_directory' => COMMON_BASE . '/log',
-));
-
-if ($db_json_file) {
-    $app->setParam(array(
-        'db_auth_file' => $db_json_file,
-    ));
-} else {
-    require_once $db_auth_file;
-}
-
-// Start application-based functionality: database, session, environment, ini setup, etc.
-// Most configuration parameters must be set before starting the App.
-define('_CLI', true);
-$app->start();
-
-// Global DB object. Automatically pre-configured by $app->start().
-$db =& DB::getInstance();
-
-
Index: trunk/bin/module_maker/form_template.cli.php
===================================================================
--- trunk/bin/module_maker/form_template.cli.php	(revision 523)
+++ trunk/bin/module_maker/form_template.cli.php	(revision 533)
@@ -26,5 +26,12 @@
  */
 
-include_once dirname(__FILE__) . '/_config.inc.php';
+if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
+    // First arg is path to current site. Realpath removes trailing /s
+    define('COMMON_BASE', realpath($_SERVER['argv'][1]));
+} else {
+    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
+}
+
+include_once dirname(__FILE__) . '/../_config.inc.php';
 
 // Test arguments.
Index: trunk/bin/module_maker/list_template.cli.php
===================================================================
--- trunk/bin/module_maker/list_template.cli.php	(revision 523)
+++ trunk/bin/module_maker/list_template.cli.php	(revision 533)
@@ -26,5 +26,12 @@
  */
 
-include_once dirname(__FILE__) . '/_config.inc.php';
+if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
+    // First arg is path to current site. Realpath removes trailing /s
+    define('COMMON_BASE', realpath($_SERVER['argv'][1]));
+} else {
+    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
+}
+
+include_once dirname(__FILE__) . '/../_config.inc.php';
 
 $op = null;
Index: trunk/bin/module_maker/module.cli.php
===================================================================
--- trunk/bin/module_maker/module.cli.php	(revision 523)
+++ trunk/bin/module_maker/module.cli.php	(revision 533)
@@ -26,5 +26,12 @@
  */
 
-include_once dirname(__FILE__) . '/_config.inc.php';
+if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
+    // First arg is path to current site. Realpath removes trailing /s
+    define('COMMON_BASE', realpath($_SERVER['argv'][1]));
+} else {
+    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
+}
+
+include_once dirname(__FILE__) . '/../_config.inc.php';
 
 $op = null;
Index: trunk/bin/module_maker/sql.cli.php
===================================================================
--- trunk/bin/module_maker/sql.cli.php	(revision 523)
+++ trunk/bin/module_maker/sql.cli.php	(revision 533)
@@ -26,5 +26,12 @@
  */
 
-include_once dirname(__FILE__) . '/_config.inc.php';
+if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
+    // First arg is path to current site. Realpath removes trailing /s
+    define('COMMON_BASE', realpath($_SERVER['argv'][1]));
+} else {
+    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
+}
+
+include_once dirname(__FILE__) . '/../_config.inc.php';
 
 $op = null;
Index: trunk/bin/module_maker/validation.cli.php
===================================================================
--- trunk/bin/module_maker/validation.cli.php	(revision 523)
+++ trunk/bin/module_maker/validation.cli.php	(revision 533)
@@ -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/>.
@@ -26,5 +26,12 @@
  */
 
-include_once dirname(__FILE__) . '/_config.inc.php';
+if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
+    // First arg is path to current site. Realpath removes trailing /s
+    define('COMMON_BASE', realpath($_SERVER['argv'][1]));
+} else {
+    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
+}
+
+include_once dirname(__FILE__) . '/../_config.inc.php';
 
 // Test arguments.
