<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>controllers/form.php</filename>
    </added>
    <added>
      <filename>core/base.php</filename>
    </added>
    <added>
      <filename>core/common.php</filename>
    </added>
    <added>
      <filename>core/core.php</filename>
    </added>
    <added>
      <filename>libraries/Upload.php</filename>
    </added>
    <added>
      <filename>libraries/akismet.php</filename>
    </added>
    <added>
      <filename>libraries/cache.php</filename>
    </added>
    <added>
      <filename>libraries/error_log.php</filename>
    </added>
    <added>
      <filename>libraries/hooks.php</filename>
    </added>
    <added>
      <filename>libraries/routes.php</filename>
    </added>
    <added>
      <filename>libraries/twitter_api.php</filename>
    </added>
    <added>
      <filename>libraries/validation.php</filename>
    </added>
    <added>
      <filename>models/db.php</filename>
    </added>
    <added>
      <filename>themes/default/errors/php_error.php</filename>
    </added>
    <added>
      <filename>themes/default/form/form.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,7 @@
 
 &lt;head&gt;
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
-&lt;title&gt;MicroMVC Read Me&lt;/title&gt;
+&lt;title&gt;MicroMVC Framework - Read Me&lt;/title&gt;
 
 &lt;style type=&quot;text/css&quot;&gt;
 body {
@@ -42,37 +42,37 @@ padding: 10px;
 &lt;div id=&quot;main&quot;&gt;
 
 &lt;h2&gt;Welcome to Micro Model-View-Controller&lt;/h2&gt;
-&lt;b&gt;A tiny MVC framework crammed into less than 150kb - 
-including documentation!&lt;/b&gt;
 
-&lt;p&gt; I built this to have a base to compare 
-the speed of other frameworks like CodeIgniter, Zend, Solar, and CakePHP.&lt;/p&gt;
+&lt;p&gt;Micro Model-View-Controller (or MicroMVC) is a tiny MVC framework for 
+building websites with PHP 5. It offers Model, Library, Controller, Function, 
+and View management. Plus other features like URI Routing, hooks/plugins, 
+file uploads, database ORM, captcha creation, and more! If you are new 
+the Model/View/Controller world of OOP - then this system is for you. 
+Every line is documented making it simple to tear-apart and learn from.&lt;/p&gt;
 
-&lt;p&gt;It offers Model, Library, Controller, Function, and View management. 
-Plus other features like URI Routing, hooks/plugins, file uploads, database abstraction, 
-captcha creation, and more! If you are new the Model/View/Controller world 
-of OOP - then this system is for you. Every line is documented and it 
-is as simple of a system to tear-apart as you can get.&lt;/p&gt;
-
-&lt;p&gt;MicroMVC is &lt;i&gt;not&lt;/i&gt; a replacement for a full MCV framework. Do not plan on building
-the next Facebook with it! However, It is built for several reasons.&lt;/p&gt;
+&lt;p&gt;MicroMVC is not a replacement for a full MCV framework. Do not plan on
+building the next Facebook with it! This system is built for small teams
+ that need the power of Object Oriented Design without the &quot;multiple 
+ server cost&quot; of large bloated systems. MicroMVC has three goals:&lt;/p&gt;
 
 &lt;ul&gt;
-&lt;li&gt;Teach How MVC Works with a simple-to-understand code structure.&lt;/li&gt;
-&lt;li&gt;Provide a base speed for comparing frameworks&lt;/li&gt;
-&lt;li&gt;Run small scripts and systems (like blogs) that need MVC without a lot of overhead.&lt;/li&gt;
+&lt;li&gt;Teach new programers how MVC works with a simple-to-understand code structure.&lt;/li&gt;
+&lt;li&gt;Show how fast a PHP system can be to encourage other projects to increase performace.&lt;/li&gt;
+&lt;li&gt;Run small systems (like blogs and article sites) that need MVC without a lot of overhead.&lt;/li&gt;
 &lt;/ul&gt;
 
-&lt;p&gt;MicroMVC is licenced under the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GPL v3&lt;/a&gt;
-so you can use it for any personal or corporate projects free of charge.&lt;/p&gt;
-
+&lt;p&gt;MicroMVC is licensed under the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GPL v3.0&lt;/a&gt;
+so you can use it for any personal or corporate projects free of charge. 
+We believe in open source, so if you see something that is being done 
+inefficiently - let us know so we can fix it.&lt;/p&gt;
 
-&lt;h2&gt;Rquirements&lt;/h2&gt;
+&lt;h2&gt;Requirements&lt;/h2&gt;
 
 &lt;ul&gt;
 &lt;li&gt;PHP 5&lt;/li&gt;
-&lt;li&gt;mod_rewrite (apache module)&lt;/li&gt;
-&lt;li&gt;PDO if using the Database&lt;/li&gt;
+&lt;li&gt;mod_rewrite (Apache module)&lt;/li&gt;
+&lt;li&gt;PDO if using the Database ORM&lt;/li&gt;
+&lt;li&gt;cURL if using some of the extra libraries&lt;/li&gt;
 &lt;/ul&gt;
 
 &lt;h2&gt;Setup&lt;/h2&gt;
@@ -99,7 +99,7 @@ If you are using a subdomain like &lt;em&gt;http://mysite.somesite.com&lt;/em&gt; then you n
 
 &lt;h2&gt;How the System Works&lt;/h2&gt;
 
-When a request is sent to the folder where MicroMVC resides, the .htaccess file will send the request to 
+&lt;p&gt;When a request is sent to the folder where MicroMVC resides, the .htaccess file will send the request to 
 &lt;em&gt;index.php&lt;/em&gt;. The index will load the config files in &quot;localhost&quot; (or whatever you name it) and
 then checks to see if a &quot;cached&quot; version of the page already exists. If not, then it will continue to 
 load the core system files. &lt;/p&gt;
@@ -111,7 +111,7 @@ and method to call. &lt;/p&gt;
 &lt;li&gt;If a controller mattching the URL is found in &lt;em&gt;contollers/&lt;/em&gt;, then the method given 
 (either in the URL or config) is run and the output is returned.&lt;/li&gt;
 
-&lt;li&gt;If a controller is &lt;i&gt;not&lt;/i&gt; found, then it will trigger a 404 error as the output.
+&lt;li&gt;If a controller is &lt;i&gt;not&lt;/i&gt; found, then it will trigger a 404 error as the output.&lt;/li&gt;
 &lt;/ol&gt;
 
 &lt;p&gt;The output (wither an error or not) is then placed in the current theme and the final content is</diff>
      <filename>INTRO.HTML</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,8 @@
 /**
  * Posts
  *
- * Example of a &quot;post&quot; system that creates a simple SQLite table and fills
- * it with several rows useing a model. Then it prints out those rows with
- * a view. Each time this controller is called it deletes the sqlite file
- * and re-creates a new.
+ * Example of a &quot;post&quot; system that fills a table with several rows useing a 
+ * model. Then it prints out those rows with a view. Also see &quot;posts_model.php&quot;
  *
  * @package		MicroMVC
  * @author		David Pennington
@@ -22,38 +20,37 @@ class posts extends core {
 		//Load the core constructor
 		parent::__construct($config);
 
-		//Load the Model for this controller
-		$this-&gt;load('posts_model', 'posts', null, 'models');
-
-		//Delete the database if it is found
-		$this-&gt;posts-&gt;delete_table('sqlite2');
-
 		//Load the database
 		$this-&gt;load_database();
-
-		//Create a new table
-		$this-&gt;posts-&gt;create_table();
-
-		//Add three rows
-		$this-&gt;posts-&gt;insert();
+		
+		//Load the Model for this controller
+		$this-&gt;load('posts_model', 'posts', null, 'models');
 
 	}
 
 	//Show the lastest posts
 	function index() {
 
-		//Set config
-		$data = array('tables' =&gt; 'posts');
-
 		//Count the total posts
-		$count = $this-&gt;db-&gt;count($data);
-
-		//Select each row
-		$result = $this-&gt;db-&gt;select($data);
-
+		$count = $this-&gt;db-&gt;count('posts');
+		
+		//If there are no rows 
+		if($count &lt; 1) {
+			//Add three rows
+			$this-&gt;posts-&gt;insert();
+		}
+		
+		//Fetch every row
+		$result = $this-&gt;posts-&gt;fetch();
+
+		//Setup dat for the view
+		$view_data = array(
+			'result' =&gt; $result, 
+			'count' =&gt; $count
+		);
+		
 		//Place in a view file
-		$this-&gt;data['content'] = $this-&gt;view('posts/posts',
-		array('result' =&gt; $result, 'count' =&gt; $count), true);
+		$this-&gt;data['content'] = $this-&gt;view('posts/posts', $view_data);
 
 	}
 </diff>
      <filename>controllers/posts.php</filename>
    </modified>
    <modified>
      <diff>@@ -36,10 +36,10 @@ class welcome extends core {
 	function hooks() {
 	
 		//Call a function from a hook
-		$this-&gt;data['content'] = $this-&gt;call_hook('my_first_hook', true);
+		$this-&gt;data['content'] = $this-&gt;hooks-&gt;call('my_first_hook', true);
 		
 		//Call two class methods from a hook
-		$this-&gt;data['content'] .= $this-&gt;call_hook('my_second_hook', 'MY_WORD');
+		$this-&gt;data['content'] .= $this-&gt;hooks-&gt;call('my_second_hook', 'MY_WORD');
 		
 	}
 	
@@ -72,7 +72,7 @@ class welcome extends core {
 		);
 		
 		//Load the twitter model and create object
-		$this-&gt;load('twitter_api', null, $options, 'models');
+		$this-&gt;load('twitter_api', null, $options, 'libraries');
 		
 		
 		//Get current user_timeline</diff>
      <filename>controllers/welcome.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,19 +7,25 @@
  * @return mixed
  */
 function convert_time($timestamp=null) {
-	if(!$timestamp) {
-		$timestamp = time();
+	
+	//If there is nothing set - default to now()
+	if(!$timestamp || '0000-00-00' == $timestamp 
+		|| '0000-00-00 00:00:00' == $timestamp) {
+		return time();
 	}
-	//return Unix timestamp
+	
+	//Return Unix timestamp
 	if(!ctype_digit($timestamp)) {
 		return strtotime($timestamp);
 	}
+	
 	//return Mysql timestamp
 	return date('Y-m-d H:i:s', $timestamp);
 
 }
 
 
+
 /**
  * Turn 10 digit timestamp into an array
  * 
@@ -46,11 +52,14 @@ function time_to_array($ts=null) {
  * @param array $data
  * @return int
  */
-function array_to_time($data=null) {
-
-	//Now we return the value (a 10 digit UNIX timestamp).
-	return mktime($data['hour'],$data['minute'],$data['second'],$data['month'],$data['day'],$data['year']);
+function array_to_timestamp($data = NULL) {
+    //Sometimes hours/minutes/seconds aren't set; default to zero;
+    $hour   = @$data['hour']   ? $data['hour']   : 0;
+    $minute = @$data['minute'] ? $data['minute'] : 0;
+    $second = @$data['second'] ? $data['second'] : 0;
 
+    //Return the value (ten digit UNIX timestamp).
+    return mktime($hour, $minute, $second, $data['month'], $data['day'], $data['year']);
 }
 
 
@@ -59,45 +68,60 @@ function array_to_time($data=null) {
  * Turn a date/timestamp into select boxes
  * 
  * @param mixed $time
+ * @param string $prefix prefix elements with
  * @return string
  */
-function date_to_select($time=null) {
-
-	//If no timestamp is given
-	$time = $time ? $time : time();
+function date_to_select($time=null, $name='date') {
 
 	//If it is a timestamp - make an array
-	if(ctype_digit($time)) {
-		$time = time_to_array($time);
+	if(!ctype_digit($time) OR ! $time) {
+		$time = convert_time($time);
 	}
 	
-	$output = '';
+	//Convert to an array
+	$time = timestamp_to_array($time);
+	
+	$output = array();
 	
 	foreach($time as $type =&gt; $value) {
-		$output[$type] = '&lt;select name=&quot;'. $type. '&quot; class=&quot;'. $type. '&quot;&gt;'. &quot;\n&quot;;
+		$output[$type] = '&lt;select name=&quot;'. $name. '['. $type. ']&quot; class=&quot;'. $type. '&quot;&gt;'. &quot;\n&quot;;
 		
 		//Create years
 		if($type == 'year') {
-			for($x=-5; $x&lt;=5; $x++) {
+			for($x=-2; $x&lt;=2; $x++) {
 			
 				$year = $value + $x;
 					
 				$output[$type] .= &quot;\t&quot;. '&lt;option value=&quot;'. $year. '&quot;'
 					. ($year == $value ? ' selected=&quot;selected&quot;' : '')
-					. '&gt;'. date(&quot;Y&quot;, mktime(0, 0, 0, 0, 0, $year)). '&lt;/option&gt;'. &quot;\n&quot;;
+					. '&gt;'. $year. '&lt;/option&gt;'. &quot;\n&quot;;
 			}
 			
 		}
 		
 		//Create months
 		if($type == 'month') {
+			
+			/*
+			We need to hard code the months because timezones can 
+			throw off the PHP date function and return two month 
+			choices that are the same.
+			*/
+			
+			$months = array(
+				1 =&gt; 'Jan', 2 =&gt; 'Feb', 3 =&gt; 'Mar', 4 =&gt; 'Apr', 5 =&gt; 'May',
+				6 =&gt; 'Jun', 7 =&gt; 'Jul', 8 =&gt; 'Aug', 9 =&gt; 'Sep', 10 =&gt; 'Oct',
+				11 =&gt; 'Nov', 12 =&gt; 'Dec'
+			);
+			
 			for($x=1; $x&lt;=12; $x++) {
 				$output[$type] .= &quot;\t&quot;. '&lt;option value=&quot;'. $x. '&quot;'
 					. ($x == $value ? ' selected=&quot;selected&quot;' : '')
-					. '&gt;'. date(&quot;M&quot;, mktime(0, 0, 0, $x)). '&lt;/option&gt;'. &quot;\n&quot;;
+					. '&gt;'. $months[$x]. '&lt;/option&gt;'. &quot;\n&quot;;
 			}
 		}
 		
+		/* Can't caculate days based off current month!!!!
 		//Create Days
 		if($type == 'day') {
 			$days_in_month = date('t', strtotime($time['year']. '-'. $time['month']. '-1'));
@@ -108,6 +132,17 @@ function date_to_select($time=null) {
 					. '&gt;'. date(&quot;j&quot;, mktime(0, 0, 0, 0, $x)). '&lt;/option&gt;'. &quot;\n&quot;;
 			}
 		}
+		*/
+		
+		if($type == 'day') {
+			for($x=1;$x&lt;32;$x++) {
+				$output[$type] .= &quot;\t&quot;. '&lt;option value=&quot;'. $x. '&quot;'
+					. ($x == $value ? ' selected=&quot;selected&quot;' : '')
+					. '&gt;'. $x. '&lt;/option&gt;'. &quot;\n&quot;;
+			}
+		}
+		
+		
 		
 		if($type == 'hour') {
 			for($x=1;$x&lt;24;$x++) {
@@ -120,7 +155,7 @@ function date_to_select($time=null) {
 		if($type == 'minute' OR $type == 'second') {
 			for($x=0;$x&lt;60;$x+=5) {
 				$output[$type] .= &quot;\t&quot;. '&lt;option value=&quot;'. $x. '&quot;'
-					. ($value &gt; $x &amp;&amp; $value &lt; $x + 5 ? ' selected=&quot;selected&quot;' : '')
+					. ($value &gt;= $x &amp;&amp; $value &lt;= $x + 4 ? ' selected=&quot;selected&quot;' : '')
 					. '&gt;'. $x. '&lt;/option&gt;'. &quot;\n&quot;;
 			}
 		}
@@ -171,4 +206,72 @@ function calendar($month=null, $year=null)
 	return $out;
 }
 
-?&gt;
\ No newline at end of file
+
+/**
+ * Caculate the total, elapsed, percent complete, and days left between two dates.
+ *
+ * @param mixed $start
+ * @param mixed $end
+ * @return array
+ */
+function between_days($start=null, $end=null) {
+	
+	//Check the dates
+	foreach(array('start', 'end') as $type) {
+		//Dates must be given
+		if(!$$type) {
+			return FALSE;
+		}
+		//If it is NOT a timestamp - make it one!
+		if(!ctype_digit($$type)) {
+			$$type = strtotime($$type);
+		}
+		
+	}
+	
+	//Array
+	$date = array();
+	
+	//Days challenge lasts
+	$date['total'] = round(($end - $start) / 86400);
+	
+	//Days until end of challenge
+	$date['left'] = round(($end - time()) / 86400);
+	
+	//Only valid for challenges that have started!
+	if(time() &gt; $start) {
+		
+		//Days that have been completed
+		$date['completed'] = round((time() - $start) / 86400);
+		
+		//Already started
+		$date['starts'] = null;
+		
+		//Percent completed
+		$date['percent'] = round(($date['completed'] / $date['total']) * 100);
+		
+	} else {
+		//Not started yet
+		$date['completed'] = 0;
+		
+		//Days until challenge starts
+		$date['starts'] = round(($start - time()) / 86400);
+		
+		//Percent completed
+		$date['percent'] = 0;
+	}
+	
+	//If way past end date - limit to 100%
+	if($date['percent'] &gt; 100) {
+		$date['percent'] = 100;
+	}
+	
+	//If way past end date - limit to 0 days left
+	if($date['left'] &lt; 0) {
+		$date['left'] = 0;
+	}
+	
+	//Return an array
+	return $date;
+
+}</diff>
      <filename>functions/time.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,7 @@
  */
 
 
-/**
+/*
  * DEFINE START-UP SYSTEM VALUES
  */
 
@@ -50,32 +50,38 @@ if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])
 	define('AJAX_REQUEST', 0);
 }
 
+/*
+ * Begine loading of the system
+ */
+
 //Require the config file for this site name
 require('sites/'. SITE_NAME. '/config.php');
 
-//Require the config file for this server
-require_once('sites/'. SITE_NAME. '/server.php');
-
 //Include the common file
-require_once(INCLUDES_DIR. 'common.php');
+require_once(CORE_DIR. 'common.php');
+
+//Override the PHP error handler
+set_error_handler('mvc_error_handler');
 
-//Get IP address - if proxy lets get the REAL IP address
-$ip = !empty($_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;]) 
-	? $_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;] 
-	: $_SERVER['REMOTE_ADDR'];
+//Load the caching class
+$cache = load_class('cache');
 
-//Clean It
-sanitize_text($ip);
+//Require the config file for the hooks
+require('sites/'. SITE_NAME. '/hooks.php');
 
-//Set it
-define('IP_ADDRESS', $ip);
+//Load the hooks class
+$hooks = load_class('hooks', $hooks);
 
+//Call first hook
+$hooks-&gt;call('system_startup');
 
 /**
  * Check for cached version -die if found
  */
-if(fetch_cache(md5(PAGE_NAME. AJAX_REQUEST), null, null)) {
+if($output = $cache-&gt;fetch(md5(PAGE_NAME. AJAX_REQUEST), null, null)) {
 
+	print $output;
+	
 	//If debuging is enabled
 	if(DEBUG_MODE) {
 		$time = round((microtime(true) - START_TIME), 5);
@@ -87,28 +93,6 @@ if(fetch_cache(md5(PAGE_NAME. AJAX_REQUEST), null, null)) {
 }
 
 
-
-
-
-/**
- * Load the Core System Files
- */
-//glob() is much slower so we use opendir...
-if ($dh = opendir(INCLUDES_DIR)) {
-	while (($file = readdir($dh)) !== false) {
-		if(preg_match(&quot;/.php/&quot;, $file)) {
-			$file = INCLUDES_DIR. $file;
-			//Include the file
-			require_once($file);
-		}
-	}
-	closedir($dh);
-} else {
-	die('Couldn\'t load the system files');
-}
-
-
-
 /**
  * strip the slashes that have been added to our POST/GET data!
  */
@@ -124,18 +108,23 @@ if (ini_get('magic_quotes_gpc')) {
 }
 
 
+//Include the core file
+require_once(CORE_DIR. 'core.php');
+
+//Include the base file
+require_once(CORE_DIR. 'base.php');
 
 
 /**
  * Get the controller from the URI
  */
-$routes	= routes::current();
+$routes = load_class('routes');
 
 //Set default controller/method if none is set in URL
 $routes-&gt;set_defaults(
-$config['default_controller'],
-$config['default_method'],
-$config['permitted_uri_chars']
+	$config['default_controller'],
+	$config['default_method'],
+	$config['permitted_uri_chars']
 );
 
 //Parse the URI
@@ -167,19 +156,17 @@ if (!class_exists($controller)) {
 
 //Make sure someone isn't trying to access core/private functions
 if(($method !== 'request_error' &amp;&amp; method_exists('core', $method))
-|| !method_exists($controller, $method)
-|| !is_callable(array($controller, $method))) {
-
+//And make sure this method exists (and is public)
+|| !in_array($method, get_class_methods($controller))) {
 	//Trigger a 404 not found error
 	$method = 'request_error';
-
 }
 
 //Create a new instance of that controller and pass the $config
 $controller = new $controller($config);
 
 //Call the startup hook
-$controller-&gt;call_hook('startup');
+$controller-&gt;hooks-&gt;call('post_constructor');
 
 // Call the requested method.
 // Any URI segments present (besides the class/function)
@@ -187,10 +174,10 @@ $controller-&gt;call_hook('startup');
 call_user_func_array(array(&amp;$controller, $method), array_slice($routes-&gt;fetch(true), 2));
 
 //Call the post-controller hook
-$controller-&gt;call_hook('post_method');
+$controller-&gt;hooks-&gt;call('post_method');
 
 // And we're done!
 $controller-&gt;render();
 
 //Call the finish hook
-$controller-&gt;call_hook('finish');
+$controller-&gt;hooks-&gt;call('system_shutdown');</diff>
      <filename>index.php</filename>
    </modified>
    <modified>
      <diff>@@ -182,4 +182,3 @@ class captcha {
 
 }
 
-?&gt;
\ No newline at end of file</diff>
      <filename>libraries/captcha.php</filename>
    </modified>
    <modified>
      <diff>@@ -47,4 +47,3 @@ class my_second_hook {
 	}
 
 }
-?&gt;
\ No newline at end of file</diff>
      <filename>libraries/my_second_hook.php</filename>
    </modified>
    <modified>
      <diff>@@ -12,11 +12,11 @@
  * @version		1.0.0 &lt;2/20/2009&gt;
  ********************************** 80 Columns *********************************
  */
-class posts_model {
+class posts_model extends base {
 
 
 	/**
-	 * Add some sample rows to the sample database
+	 * Add some sample rows to the database
 	 * @return	void
 	 */
 	function insert() {
@@ -47,34 +47,14 @@ class posts_model {
 
 	}
 
-	/**
-	 * Create a new SQLite table
-	 * @return	void
+	
+	/*
+	 * Get all the posts
 	 */
-	function create_table() {
-
-		$query = '
-		CREATE TABLE posts ( 
-		id INTEGER PRIMARY KEY,
-		title varchar(100),
-		text text,
-		author INTEGER
-		);';
-
-		//Create the new table
-		$this-&gt;db-&gt;query($query);
+	function fetch() {
+		return $this-&gt;db-&gt;get('posts');
 	}
 
-	/**
-	 * Delete the SQLite DB file if it exists
-	 * @param	string	$name = table name
-	 * @return	void
-	 */
-	function delete_table($name=null) {
-		if(file_exists($name)) {
-			unlink($name);
-		}
-	}
 
 }
 </diff>
      <filename>models/posts_model.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,84 @@
 &lt;?php
 
+//Theme to load
 $config['theme'] = 'default';
+//Default controller to call
 $config['default_controller'] = 'welcome';
+//Default method to run
 $config['default_method'] = 'index';
+//Characters to allow in the URI string ($_GET data)
 $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
-//Site email account (for errors etc...)
-$config['email'] = 'david@xeoncross.com';
+//An array of config files to auto-load (FALSE for none)
+$config['load_config'] = array('hooks');
+// Use hooks?
+$config['hooks'] = TRUE;
 
+//Enable error reporting?
+//error_reporting(E_ALL|E_STRICT);
 
+/*
+ * Set the server timezone
+ * see: http://us3.php.net/manual/en/timezones.php
+ */
+date_default_timezone_set(&quot;America/Chicago&quot;);
+
+
+/**
+ * Enable or Disable caching for this site
+ *
+ * Set to FALSE to disable caching
+ * Set to a number (in seconds) to enable:
+ * i.e. 60 * 2 = 2 minutes
+ */
+define('CACHING', FALSE);
+
+//Should Debug info be shown with errors and such? (true or false)
+define('DEBUG_MODE', TRUE);
+
+
+/* 
+ * FILE SYSTEM PATHS
+ */
+
+// Absolute file system path to the root
+define('SITE_DIR', rtrim(realpath(dirname(__FILE__). &quot;/../../&quot;), '/\\'). '/');
+
+// Absolute file system path to the themes directory
+define('THEME_DIR', SITE_DIR. 'themes/'. $config['theme']. '/');
+
+// Absolute file system path to /includes
+define('CORE_DIR', SITE_DIR. &quot;core/&quot;);
+
+// Absolute file system path to /includes
+define('LIBRARIES_DIR', SITE_DIR. &quot;libraries/&quot;);
+
+// Absolute file system path to /includes
+define('MODELS_DIR', SITE_DIR. &quot;models/&quot;);
+
+// Absolute file system path to /includes
+define('FUNCTIONS_DIR', SITE_DIR. &quot;functions/&quot;);
+
+//The file system path of the upload dir
+define('UPLOAD_DIR', SITE_DIR. 'uploads/');
+
+//The file system path of the cache dir
+define('CACHE_DIR', SITE_DIR. 'cache/');
+
+
+/* 
+ * URL ADDRESS PATHS
+ */
+
+// Absolute URL path to the system root
+// Leave blank unless this site is in a subfolder.
+define('SITE_URL', '/MicroMVC/');
+
+// Absolute URL path to the themes directory
+define('THEME_URL', SITE_URL. 'themes/'. $config['theme']. '/');
+
+// Absolute URL path to the upload directory
+define('UPLOAD_URL', SITE_URL. 'uploads/');
+
+// Absolute URL path to the cache directory
+define('CACHE_URL', SITE_URL. 'cache/');
 </diff>
      <filename>sites/localhost/config.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,21 +1,13 @@
 &lt;?php
-/* MySQL Database Config
-$database['user'] = 'root';
-$database['pass'] = '';
-$database['name'] = 'database';
-$database['host'] = 'localhost';
-$database['type'] = 'mysql';
-$database['port'] = null;
-$database['persistent'] = false;
-*/
 
-/* SQLite Database Config */
-$database['user'] = null;
-$database['pass'] = null;
-$database['name'] = 'sqlite2';
-$database['host'] = null;
-$database['type'] = 'sqlite2';
-$database['port'] = null;
-$database['persistent'] = false;
+/* PDO MySQL Database Config */
+$database= array(
+	'type'	=&gt; 'mysql',
+	'dns'	=&gt; 'host=127.0.0.1;dbname=pdo_test',
+	'port'	=&gt; '3306',
+	'name'	=&gt; '',
+	'user'	=&gt; 'root',
+	'pass'	=&gt; '',
+	'options'	=&gt; null,//PDO::ATTR_PERSISTENT, PDO::ATTR_STATEMENT_CLASS, etc
+);
 
-?&gt;
\ No newline at end of file</diff>
      <filename>sites/localhost/database.php</filename>
    </modified>
    <modified>
      <diff>@@ -5,22 +5,62 @@
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
 &lt;title&gt;MicroMVC PHP Framework&lt;/title&gt;
 
-&lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php print THEME_PATH; ?&gt;style.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php print THEME_URL; ?&gt;style.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
 &lt;?php if(!empty($header_files)) { print $header_files; } ?&gt;
 
 &lt;/head&gt;
 &lt;body&gt;
 
-&lt;div id=&quot;main&quot;&gt;
-	&lt;ul id=&quot;menu&quot;&gt;
-		&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_PATH; ?&gt;welcome/&quot;&gt;Welcome&lt;/a&gt;&lt;/li&gt;
-		&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_PATH; ?&gt;welcome/hooks/&quot;&gt;Hooks&lt;/a&gt;&lt;/li&gt;
-		&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_PATH; ?&gt;welcome/say/&quot;&gt;URI&lt;/a&gt;&lt;/li&gt;
-		&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_PATH; ?&gt;welcome/twitter/&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt;
-		&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_PATH; ?&gt;posts/&quot;&gt;SQLite&lt;/a&gt;&lt;/li&gt;
-	&lt;/ul&gt;
+&lt;div id=&quot;container&quot;&gt;
+	&lt;div id=&quot;menu&quot;&gt;
+		&lt;ul&gt;
+			&lt;?php
+			//Get the URI of this page
+			$uri = $this-&gt;routes-&gt;fetch();
+			
+			//Create a list of the menu links
+			$links = array(
+				'Welcome' =&gt; 'welcome/index', 
+				'Hooks' =&gt; 'welcome/hooks',
+				'URI' =&gt; 'welcome/say',
+				'Twitter' =&gt; 'welcome/twitter',
+				'SQLite' =&gt; 'posts',
+			);
+			
+			//For each link
+			foreach($links as $name =&gt; $link) {
+				//If this this link is the current one in the URI
+				if(stripos($uri, $link) !== FALSE) {
+					print '&lt;li class=&quot;selected&quot;&gt;';
+				} else {
+					print '&lt;li&gt;';
+				}
+				print '&lt;a href=&quot;'. SITE_URL. $link. '&quot;&gt;'. $name. '&lt;/a&gt;&lt;/li&gt;';
+			}
+			
+			/* Normal way:
+				&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_URL; ?&gt;welcome/&quot;&gt;Welcome&lt;/a&gt;&lt;/li&gt;
+				&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_URL; ?&gt;welcome/hooks/&quot;&gt;Hooks&lt;/a&gt;&lt;/li&gt;
+				&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_URL; ?&gt;welcome/say/&quot;&gt;URI&lt;/a&gt;&lt;/li&gt;
+				&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_URL; ?&gt;welcome/twitter/&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt;
+				&lt;li&gt;&lt;a href=&quot;&lt;?php print SITE_URL; ?&gt;posts/&quot;&gt;SQLite&lt;/a&gt;&lt;/li&gt;
+			*/?&gt;
+		&lt;/ul&gt;
+	&lt;/div&gt;
 
-	&lt;?php print $content; ?&gt;
+	&lt;div id=&quot;main&quot;&gt;
+		&lt;div class=&quot;wrapper&quot;&gt;
+			&lt;?php print $content; ?&gt;
+		&lt;/div&gt;
+	&lt;/div&gt;
+	
+	&lt;div id=&quot;footer&quot;&gt;
+		&lt;div class=&quot;wrapper&quot;&gt;
+			&lt;p&gt;Page rendered in &lt;?php print round((microtime(true) - START_TIME), 5); ?&gt; seconds
+			taking &lt;?php print round((memory_get_usage() - START_MEMORY_USAGE) / 1024, 2); ?&gt; KB 
+			(&lt;?php print (memory_get_usage() - START_MEMORY_USAGE); ?&gt; Bytes).&lt;/p&gt;
+		&lt;/div&gt;
+	&lt;/div&gt;
 &lt;/div&gt;
 
 &lt;/body&gt;</diff>
      <filename>themes/default/layout.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,9 @@
-&lt;h4&gt;&lt;?php print $count-&gt;fetchColumn(); ?&gt; Posts found in the database&lt;/h4&gt;
+&lt;h4&gt;&lt;?php print $count; ?&gt; Posts found in the database&lt;/h4&gt;
 
-&lt;?php while($row = $result-&gt;fetch(PDO::FETCH_ASSOC)) { ?&gt;
+&lt;?php while($row = $result-&gt;fetch()) { ?&gt;
 
-&lt;h2&gt;&lt;?php print $row['title']; ?&gt;&lt;/h2&gt;
-&lt;small&gt;Posted by &lt;?php print $row['author']; ?&gt;&lt;/small&gt;
-&lt;p&gt;&lt;?php print $row['text']; ?&gt;&lt;/p&gt;
+&lt;h2&gt;&lt;?php print $row-&gt;title; ?&gt;&lt;/h2&gt;
+&lt;small&gt;Posted by &lt;?php print $row-&gt;author; ?&gt;&lt;/small&gt;
+&lt;p&gt;&lt;?php print $row-&gt;text; ?&gt;&lt;/p&gt;
 
 &lt;?php } ?&gt;</diff>
      <filename>themes/default/posts/posts.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,10 @@
-html {
-border-top: 20px solid #eee;
-}
-
 body {
 background: #fff;
 font: 13px/19px verdana;
 text-align: left;
 margin: 0;
 padding:0;
-color: #777;
+color: #555;
 }
 
 
@@ -23,39 +19,59 @@ color: #881a3c;
 }
 
 
-#main {
+.wrapper {
 margin: 0 auto;
 padding: 0;
 width: 500px;
 }
 
 
-ul#menu {
+#menu {background: #CDE3F2; }
+
+#menu ul {
 list-style: none;
-margin: 0;
+margin: 0 auto;
 padding: 0;
-width: 100%;
+width: 500px;
 height: 35px;
 clear: both;
 }
 
-ul#menu li {}
-
-ul#menu li a{
+#menu ul li {
 float: left;
-padding: 0 20px;
-display: block;
+height: 35px;
+}
+
+
+#menu ul li a{
+padding: 5px 10px;
+margin: 0 10px;
 line-height: 35px;
-border-right: 1px solid #eee;
+-moz-border-radius: 4px;
+border: 1px solid #CDE3F2;
 }
 
-ul#menu li:first-child a {
-border-left: 1px solid #eee;
+#menu ul li.selected a,
+#menu ul li a:hover {
+background: #fff;
+text-decoration: none;
+border: 1px solid #AECCE1;
 }
 
+
+#main{ padding: 20px 0;border-top: 1px solid #AECCE1;}
+
+
 .tweet {
 margin: 0;
 padding: 2em;
 border-top: 1px solid #ddd;
 }
 
+
+#footer { 
+border-top: 1px solid #eee; 
+margin: 20px 0 0 0;
+padding: 0;
+font-size: 11px;
+}</diff>
      <filename>themes/default/style.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,3 @@
-&lt;p&gt;Page rendered in &lt;?php print round((microtime(true) - START_TIME), 5); ?&gt; seconds
-taking &lt;?php print round((memory_get_usage() - START_MEMORY_USAGE) / 1024, 2); ?&gt; KB 
-(&lt;?php print (memory_get_usage() - START_MEMORY_USAGE); ?&gt; Bytes).&lt;/p&gt;
-
 &lt;b&gt;Files Included:&lt;/b&gt;
 &lt;ul&gt;
 &lt;li&gt;&lt;?php print implode(&quot;&lt;/li&gt;\n&lt;li&gt;&quot;, get_included_files()); ?&gt;</diff>
      <filename>themes/default/welcome/debug.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,27 @@
 &lt;h2&gt;Welcome to Micro Model-View-Controller&lt;/h2&gt;
 &lt;b&gt;Thank you for trying out MicroMVC&lt;/b&gt;
 
-&lt;p&gt;This is a full MVC framework crammed into less than 90kb - 
-including documentation! I built this to have a base to compare 
-the speed of other frameworks like CodeIgniter, Zend, Solar, and CakePHP.&lt;/p&gt;
-
-&lt;p&gt;It offers Model, Library, Controller, function, and View management. 
-Plus other features like URI Routing, file uploads, database abstraction, 
-captcha creation, and more! If you are new the Model/View/Controller world 
-of OOP - then this system is for you. Every line is documented and it 
-is as simple of a system to tear-apart as you can get.&lt;/p&gt;
+&lt;p&gt;Micro Model-View-Controller (or MicroMVC) is a tiny MVC framework for 
+building websites with PHP 5. It offers Model, Library, Controller, Function, 
+and View management. Plus other features like URI Routing, hooks/plugins, 
+file uploads, database ORM, captcha creation, and more! If you are new 
+the Model/View/Controller world of OOP - then this system is for you. 
+Every line is documented making it simple to tear-apart and learn from.&lt;/p&gt;
+
+&lt;p&gt;MicroMVC is not a replacement for a full MCV framework. Do not plan on
+building the next Facebook with it! This system is built for small teams
+ that need the power of Object Oriented Design without the &quot;multiple 
+ server cost&quot; of large bloated systems. MicroMVC has three goals:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Teach new programers how MVC works with a simple-to-understand code structure.&lt;/li&gt;
+&lt;li&gt;Show how fast a PHP system can be to encourage other projects to increase performace.&lt;/li&gt;
+&lt;li&gt;Run small systems (like blogs and article sites) that need MVC without a lot of overhead.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;MicroMVC is licensed under the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GPL v3.0&lt;/a&gt;
+so you can use it for any personal or corporate projects free of charge. 
+We believe in open source, so if you see something that is being done 
+inefficiently - let us know so we can fix it.&lt;/p&gt;
 
 &lt;?php include('debug.php'); ?&gt;</diff>
      <filename>themes/default/welcome/welcome.php</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>database/mvcpdo.php</filename>
    </removed>
    <removed>
      <filename>database/mysql.php</filename>
    </removed>
    <removed>
      <filename>database/sqlite2.php</filename>
    </removed>
    <removed>
      <filename>includes/common.php</filename>
    </removed>
    <removed>
      <filename>includes/core.php</filename>
    </removed>
    <removed>
      <filename>includes/routes.php</filename>
    </removed>
    <removed>
      <filename>sites/localhost/server.php</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>b87e511a42c2e2cef2742b4d85e91386201c9fa2</id>
    </parent>
  </parents>
  <author>
    <name>Xeoncross</name>
    <email>david@xeoncross.com</email>
  </author>
  <url>http://github.com/Xeoncross/micromvc/commit/152f3e79fc5cf41f751bb2895b4d7666195a8198</url>
  <id>152f3e79fc5cf41f751bb2895b4d7666195a8198</id>
  <committed-date>2009-05-31T22:30:38-07:00</committed-date>
  <authored-date>2009-05-31T22:30:38-07:00</authored-date>
  <message>Major update to system logic. Now include the new PDOORM library and moved to using a singleton registry class loader enabling hook calls before the controller loads. Classes that want to inherit controller objects should extend the base class.</message>
  <tree>e1b011b922463750b26cbb18266b10f1075e5329</tree>
  <committer>
    <name>Xeoncross</name>
    <email>david@xeoncross.com</email>
  </committer>
</commit>
