Index: trunk/docs/example_config.inc.php
===================================================================
--- trunk/docs/example_config.inc.php	(revision 266)
+++ 	(revision )
@@ -1,105 +1,0 @@
-<?php
-/**
- * _config.inc.php lives in the document root of the site/application. It is the beginning of everything.
- *
- * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
- * @author  Quinn Comendant <quinn@strangecode.com>
- * @version 1.2
- * @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';
-if (!preg_match('!^(/|[A-Z]:)!', __FILE__)) {
-    trigger_error('_config.inc.php include must be specified with an absolute file path (eg: "require_once dirname(__FILE__) . \'/_config.inc.php\';"', E_USER_ERROR);
-}
-
-// First things first. Define the globally used directory paths.
-// The parent directory of all application DocRoots.
-define('COMMON_BASE', realpath(dirname(__FILE__) . '/../'));
-
-// The DocRoot for this application. SITE_BASE is ifferent 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__));
-
-// Set include path for all tempates.
-ini_set('include_path', join(PATH_SEPARATOR, array(
-    COMMON_BASE,
-    SITE_BASE . '/_templates',
-    get_include_path(),
-)));
-
-// Include core libraries.
-require_once 'codebase/lib/Utilities.inc.php';
-require_once 'codebase/lib/Auth_SQL.inc.php';
-require_once 'codebase/lib/App.inc.php';
-
-// Primary application class.
-$app =& App::getInstance('example.org');
-$app->setParam(array(
-    'site_name' => 'My example site',
-    'site_email' => 'hello@example.com',
-    'redirect_home_url' => '/',
-
-    'date_format' => 'd M Y',
-    'sql_date_format' => '%e %b %Y',
-    'sql_time_format' => '%k:%i',
-    'character_set' => 'utf-8',
-
-    'enable_session' => false,
-    'enable_db_session_handler' => false,
-    'session_use_cookies' => true,
-
-    'enable_db' => false,
-    'db_always_debug' => false,
-    'db_debug' => true,
-    'db_die_on_failure' => true,
-    'db_create_tables' => true, /// Disable after site launch.
-
-    'display_errors' => true,
-
-    'log_directory' => COMMON_BASE . '/log',
-    'log_filename' => 'site_log',
-    'log_file_priority' => LOG_DEBUG,
-    'log_email_priority' => false,
-    'log_sms_priority' => false,
-    'log_screen_priority' => false,
-    'log_to_email_address' => 'log@example.com',
-    'log_to_sms_address' => 'sms@example.com',
-));
-// DB credentials for command line scripts stored in a file with read rights
-// given only to the user who will be executing the scripts: -rw-------
-// This file includes $app-> method calls so must be included after App.
-// require_once 'global/db_auth.inc.php';
-
-// Start application-based functionality: database, session, environment, ini setup, etc.
-// Most configuration parameters must be set before starting the App.
-$app->start();
-
-// Global DB object. Automatically preconfigured by $app->start().
-$db =& DB::getInstance();
-
-// User authentication.
-$auth = new Auth_SQL('user');
-$auth->setParam(array(
-    'db_table'          => 'user_tbl',
-    'db_primary_key'    => 'user_id',
-    'login_url'         => '/login.php'
-));
-
-// Set CSS files.
-require_once 'codebase/lib/CSS.inc.php';
-$css = new CSS();
-$css->setParam(array('cache_css' => true));
-$css->setFile('codebase/css/codebase.inc.css');
-$css->setFile('codebase/css/utilities.inc.css');
-$css->setFile('html/css/screen.inc.css');
-
-// Global navigation elements object.
-require_once 'codebase/lib/Navigation.inc.php';
-$nav = new Navigation(array(
-    'path_delimiter' => ' / ',
-    'last_crumb_format' => '<b>%s</b>',
-));
-
-?>
Index: trunk/docs/example_script_template.php
===================================================================
--- trunk/docs/example_script_template.php	(revision 266)
+++ 	(revision )
@@ -1,41 +1,0 @@
-<?php
-/**
- * __///__
- * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
- * @author  Quinn Comendant <quinn@strangecode.com>
- * @version 1.0
- * @since   __///__
- */
-
-require_once dirname(__FILE__) . '/_config.inc.php';
-
-$auth->requireLogin();
-$app->sslOn();
-
-require_once 'codebase/lib/FormValidator.inc.php';
-
-
-/********************************************************************
-* CONFIG
-********************************************************************/
-
-
-
-/********************************************************************
-* MAIN
-********************************************************************/
-
-
-
-/********************************************************************
-* OUTPUT
-********************************************************************/
-
-
-
-/********************************************************************
-* FUNCTIONS
-********************************************************************/
-
-
-?>
Index: trunk/docs/example_virtualhost_directive.txt
===================================================================
--- trunk/docs/example_virtualhost_directive.txt	(revision 266)
+++ 	(revision )
@@ -1,14 +1,0 @@
-<VirtualHost 123.123.123.123:80>
-    ServerName example.com
-    ServerAlias *.example.com
-    DocumentRoot /home/user/www.example.com/html
-    CustomLog /home/user/www.example.com/log/access_log combined
-    ErrorLog /home/user/www.example.com/log/error_log
-    SetEnv DB_NAME carl
-    SetEnv DB_USER user_asdf
-    SetEnv DB_PASS pass_asdf
-    SetEnv SIGNING_KEY wekgbb92e2397g3r293gh
-    <Directory "/home/user/www.example.com">
-        php_admin_value open_basedir "/home/user/www.example.com:/usr/local/lib/php:/tmp"
-    </Directory>
-</VirtualHost>
Index: trunk/docs/examples/_config.inc.php
===================================================================
--- trunk/docs/examples/_config.inc.php	(revision 288)
+++ trunk/docs/examples/_config.inc.php	(revision 288)
@@ -0,0 +1,105 @@
+<?php
+/**
+ * _config.inc.php lives in the document root of the site/application. It is the beginning of everything.
+ *
+ * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
+ * @author  Quinn Comendant <quinn@strangecode.com>
+ * @version 1.2
+ * @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';
+if (!preg_match('!^(/|[A-Z]:)!', __FILE__)) {
+    trigger_error('_config.inc.php include must be specified with an absolute file path (eg: "require_once dirname(__FILE__) . \'/_config.inc.php\';"', E_USER_ERROR);
+}
+
+// First things first. Define the globally used directory paths.
+// The parent directory of all application DocRoots.
+define('COMMON_BASE', realpath(dirname(__FILE__) . '/../'));
+
+// The DocRoot for this application. SITE_BASE is ifferent 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__));
+
+// Set include path for all tempates.
+ini_set('include_path', join(PATH_SEPARATOR, array(
+    COMMON_BASE,
+    SITE_BASE . '/_templates',
+    get_include_path(),
+)));
+
+// Include core libraries.
+require_once 'codebase/lib/Utilities.inc.php';
+require_once 'codebase/lib/Auth_SQL.inc.php';
+require_once 'codebase/lib/App.inc.php';
+
+// Primary application class.
+$app =& App::getInstance('example.org');
+$app->setParam(array(
+    'site_name' => 'My example site',
+    'site_email' => 'hello@example.com',
+    'redirect_home_url' => '/',
+
+    'date_format' => 'd M Y',
+    'sql_date_format' => '%e %b %Y',
+    'sql_time_format' => '%k:%i',
+    'character_set' => 'utf-8',
+
+    'enable_session' => false,
+    'enable_db_session_handler' => false,
+    'session_use_cookies' => true,
+
+    'enable_db' => false,
+    'db_always_debug' => false,
+    'db_debug' => true,
+    'db_die_on_failure' => true,
+    'db_create_tables' => true, /// Disable after site launch.
+
+    'display_errors' => true,
+
+    'log_directory' => COMMON_BASE . '/log',
+    'log_filename' => 'site_log',
+    'log_file_priority' => LOG_DEBUG,
+    'log_email_priority' => false,
+    'log_sms_priority' => false,
+    'log_screen_priority' => false,
+    'log_to_email_address' => 'log@example.com',
+    'log_to_sms_address' => 'sms@example.com',
+));
+// DB credentials for command line scripts stored in a file with read rights
+// given only to the user who will be executing the scripts: -rw-------
+// This file includes $app-> method calls so must be included after App.
+// require_once 'global/db_auth.inc.php';
+
+// Start application-based functionality: database, session, environment, ini setup, etc.
+// Most configuration parameters must be set before starting the App.
+$app->start();
+
+// Global DB object. Automatically preconfigured by $app->start().
+$db =& DB::getInstance();
+
+// User authentication.
+$auth = new Auth_SQL('user');
+$auth->setParam(array(
+    'db_table'          => 'user_tbl',
+    'db_primary_key'    => 'user_id',
+    'login_url'         => '/login.php'
+));
+
+// Set CSS files.
+require_once 'codebase/lib/CSS.inc.php';
+$css = new CSS();
+$css->setParam(array('cache_css' => true));
+$css->setFile('codebase/css/codebase.inc.css');
+$css->setFile('codebase/css/utilities.inc.css');
+$css->setFile('html/css/screen.inc.css');
+
+// Global navigation elements object.
+require_once 'codebase/lib/Navigation.inc.php';
+$nav = new Navigation(array(
+    'path_delimiter' => ' / ',
+    'last_crumb_format' => '<b>%s</b>',
+));
+
+?>
Index: trunk/docs/examples/contact_form/contact.eml
===================================================================
--- trunk/docs/examples/contact_form/contact.eml	(revision 288)
+++ trunk/docs/examples/contact_form/contact.eml	(revision 288)
@@ -0,0 +1,4 @@
+Message from {NAME} <{EMAIL}>:
+
+{MESSAGE}
+
Index: trunk/docs/examples/contact_form/contact.ihtml
===================================================================
--- trunk/docs/examples/contact_form/contact.ihtml	(revision 288)
+++ trunk/docs/examples/contact_form/contact.ihtml	(revision 288)
@@ -0,0 +1,19 @@
+<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
+    <?php $app->printHiddenSession(); ?>
+
+    <div class="sc-form-row<?php $fv->err('name'); ?>">
+        <label for="name"><?php echo _("Name"); ?></label>
+        <input type="text" name="name" id="name" class="sc-medium" value="<?php echo oTxt($frm['name']); ?>" />
+    </div>
+    <div class="sc-form-row<?php $fv->err('email'); ?>">
+        <label for="email"><?php echo _("Email"); ?></label>
+        <input type="text" name="email" id="email" class="sc-medium" value="<?php echo oTxt($frm['email']); ?>" />
+    </div>
+    <div class="sc-form-row<?php $fv->err('message'); ?>">
+        <label for="message"><?php echo _("Message"); ?></label>
+        <textarea name="message" id="message" rows="8" cols="40" class="sc-short sc-medium"><?php echo oTxt($frm['message']); ?></textarea>
+    </div>
+    <div class="sc-form-row sc-submit-buttons">
+        <input type="submit" value="<?php echo _("Send"); ?>" />
+    </div>
+</form>
Index: trunk/docs/examples/contact_form/contact.php
===================================================================
--- trunk/docs/examples/contact_form/contact.php	(revision 288)
+++ trunk/docs/examples/contact_form/contact.php	(revision 288)
@@ -0,0 +1,94 @@
+<?php
+/*
+* contact.php
+* Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
+* @author   Quinn Comendant <quinn@strangecode.com>
+* @version  1.0
+* @since    01 Aug 2006 09:35:14
+*/
+
+require_once dirname(__FILE__) . '/_config.inc.php';
+
+
+/********************************************************************
+* CONFIG
+********************************************************************/
+
+require_once 'codebase/lib/FormValidator.inc.php';
+require_once 'codebase/lib/Email.inc.php';
+
+$fv = new FormValidator();
+
+// Set this to the person who should receive emails.
+$email_to = 'The Form Admin <me@example.com>';
+
+
+/********************************************************************
+* MAIN
+********************************************************************/
+
+if (!empty($_POST)) {
+    // Validate submitted data.
+    $fv->notEmpty('name', sprintf(_("%s cannot be blank."), _("Name")));
+    $fv->stringLength('name', 0, 255, sprintf(_("%s must be %d-to-%d characters in length."), _("Name"), 0, 255));
+    
+    $fv->notEmpty('email', sprintf(_("%s cannot be blank."), _("Email")));
+    $fv->stringLength('email', 0, 255, sprintf(_("%s must be %d-to-%d characters in length."), _("Email"), 0, 255));
+    $fv->validateEmail('email');
+    
+    $fv->notEmpty('message', sprintf(_("%s cannot be blank."), _("Message")));
+    $fv->stringLength('message', 0, 32000, sprintf(_("%s must be %d-to-%d characters in length."), _("Message"), 0, 32000));
+        
+	if ($fv->anyErrors()) {
+        // Re-populate form values with the user data so they can make corrections.
+	    $frm = resetForm(getFormData());
+	} else {
+        // Setup email object.
+        $email = new Email(array(
+            'to' => $email_to,
+            'from' => sprintf('%s <%s>', $frm['name'], $frm['email']),
+            'subject' => 'Contact form email',
+        ));
+        $email->setTemplate('contact.eml');
+        $email->replace(array(
+            'name' => $frm['name'],
+            'email' => $frm['email'],
+            'message' => $frm['question'],
+        ));
+        // Send email!
+        $email->send();
+
+        // Reset form values to display a blank form.
+        $frm = resetForm();
+        $app->raiseMsg(_("<strong>Thank You!</strong> Your message has been sent."), MSG_SUCCESS, __FILE__, __LINE__);
+	}
+} else {
+    // Reset form values to display a blank form.
+    $frm = resetForm();
+}
+
+
+/********************************************************************
+* OUTPUT
+********************************************************************/
+
+include 'header.ihtml';
+include 'contact.ihtml';
+include 'footer.ihtml';
+
+
+/********************************************************************
+* FUNCTIONS
+********************************************************************/
+
+function resetForm($new_values = array())
+{
+	$default = array(
+		'name' => '',
+		'email' => '',
+		'message' => '',
+	);
+	return array_merge($default, $new_values);
+}
+
+?>
Index: trunk/docs/examples/script_template.php
===================================================================
--- trunk/docs/examples/script_template.php	(revision 288)
+++ trunk/docs/examples/script_template.php	(revision 288)
@@ -0,0 +1,41 @@
+<?php
+/**
+ * __///__
+ * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
+ * @author  Quinn Comendant <quinn@strangecode.com>
+ * @version 1.0
+ * @since   __///__
+ */
+
+require_once dirname(__FILE__) . '/_config.inc.php';
+
+$auth->requireLogin();
+$app->sslOn();
+
+require_once 'codebase/lib/FormValidator.inc.php';
+
+
+/********************************************************************
+* CONFIG
+********************************************************************/
+
+
+
+/********************************************************************
+* MAIN
+********************************************************************/
+
+
+
+/********************************************************************
+* OUTPUT
+********************************************************************/
+
+
+
+/********************************************************************
+* FUNCTIONS
+********************************************************************/
+
+
+?>
Index: trunk/docs/examples/virtualhost_directive.conf
===================================================================
--- trunk/docs/examples/virtualhost_directive.conf	(revision 288)
+++ trunk/docs/examples/virtualhost_directive.conf	(revision 288)
@@ -0,0 +1,14 @@
+<VirtualHost 123.123.123.123:80>
+    ServerName example.com
+    ServerAlias *.example.com
+    DocumentRoot /home/user/www.example.com/html
+    CustomLog /home/user/www.example.com/log/access_log combined
+    ErrorLog /home/user/www.example.com/log/error_log
+    SetEnv DB_NAME carl
+    SetEnv DB_USER user_asdf
+    SetEnv DB_PASS pass_asdf
+    SetEnv SIGNING_KEY wekgbb92e2397g3r293gh
+    <Directory "/home/user/www.example.com">
+        php_admin_value open_basedir "/home/user/www.example.com:/usr/local/lib/php:/tmp"
+    </Directory>
+</VirtualHost>
