Commits

Anonymous committed 97ad67f

Upgrade to CodeIgniter 2.0.3

  • Participants
  • Parent commits d63204c

Comments (0)

Files changed (51)

 url=${1:-"http://php-resque.dotcloudapp.com/"}
 queue=${2:-default}
 number=${3:-10}
-csrf_token=4a42d1031ffb6cae2d5a9da00ffad955
 
 uri=`basename $url`
 if [ $uri = "editor" ] || [ $uri = "panel" ] ; then
 
 echo -ne "\033[1;31m]\r\033[1;34m--> \033[1;31m[\033[0m"
 
+csrf_token=`curl $url/editor 2>/dev/null \
+           | sed -n '/_experiment_jeton_/ s/.*value="\(.*\)".*/\1/p'`
+
 for ((i = 0 ; i != number ; i = i + 1)) ; do
-    curl $url/editor                    \
-        -b "ci_csrf_token=$csrf_token"  \
-        -F "ci_csrf_token=$csrf_token"  \
-        -F "job_name=hammer-$i"         \
-        -F "queue_name=$queue"          \
+    curl $url/editor                            \
+        -b "_experiment_biscuit_=$csrf_token"   \
+        -F "_experiment_jeton_=$csrf_token"     \
+        -F "job_name=hammer-$i"                 \
+        -F "queue_name=$queue"                  \
         -F "submit=Enqueue"
     echo -n '#'
 done

File system/core/CodeIgniter.php

  *  Define the CodeIgniter Version
  * ------------------------------------------------------
  */
-	define('CI_VERSION', '2.0.2');
+	define('CI_VERSION', '2.0.3');
 
 /*
  * ------------------------------------------------------
  *  Load the global functions
  * ------------------------------------------------------
  */
-	require(BASEPATH.'core/Common'.EXT);
+	require(BASEPATH.'core/Common.php');
 
 /*
  * ------------------------------------------------------
  *  Load the framework constants
  * ------------------------------------------------------
  */
-	if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT))
+	if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
 	{
-		require(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT);
+		require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
 	}
 	else
 	{
-		require(APPPATH.'config/constants'.EXT);
+		require(APPPATH.'config/constants.php');
 	}
 
 /*
  *
  */
 	// Load the base controller class
-	require BASEPATH.'core/Controller'.EXT;
+	require BASEPATH.'core/Controller.php';
 
 	function &get_instance()
 	{
 	}
 
 
-	if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT))
+	if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
 	{
-		require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT;
+		require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
 	}
 
 	// Load the local application controller
 	// Note: The Router class automatically validates the controller path using the router->_validate_request().
 	// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
-	if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT))
+	if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
 	{
 		show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
 	}
 
-	include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT);
+	include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
 
 	// Set a mark point for benchmarking
 	$BM->mark('loading_time:_base_classes_end');
 				$method = (isset($x[1]) ? $x[1] : 'index');
 				if ( ! class_exists($class))
 				{
-					if ( ! file_exists(APPPATH.'controllers/'.$class.EXT))
+					if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
 					{
 						show_404("{$class}/{$method}");
 					}
 
-					include_once(APPPATH.'controllers/'.$class.EXT);
+					include_once(APPPATH.'controllers/'.$class.'.php');
 					unset($CI);
 					$CI = new $class();
 				}

File system/core/Common.php

 * @param	string
 * @return	bool	TRUE if the current version is $version or higher
 */
+if ( ! function_exists('is_php'))
+{
 	function is_php($version = '5.0.0')
 	{
 		static $_is_php;
 
 		return $_is_php[$version];
 	}
+}
 
 // ------------------------------------------------------------------------
 
  * @access	private
  * @return	void
  */
+if ( ! function_exists('is_really_writable'))
+{
 	function is_really_writable($file)
 	{
 		// If we're on a Unix server with safe_mode off we call is_writable
 		fclose($fp);
 		return TRUE;
 	}
+}
 
 // ------------------------------------------------------------------------
 
 * @param	string	the class name prefix
 * @return	object
 */
+if ( ! function_exists('load_class'))
+{
 	function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
 	{
 		static $_classes = array();
 		// thenin the local application/libraries folder
 		foreach (array(BASEPATH, APPPATH) as $path)
 		{
-			if (file_exists($path.$directory.'/'.$class.EXT))
+			if (file_exists($path.$directory.'/'.$class.'.php'))
 			{
 				$name = $prefix.$class;
 
 				if (class_exists($name) === FALSE)
 				{
-					require($path.$directory.'/'.$class.EXT);
+					require($path.$directory.'/'.$class.'.php');
 				}
 
 				break;
 		}
 
 		// Is the request a class extension?  If so we load it too
-		if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT))
+		if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
 		{
 			$name = config_item('subclass_prefix').$class;
 
 			if (class_exists($name) === FALSE)
 			{
-				require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT);
+				require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php');
 			}
 		}
 
 		{
 			// Note: We use exit() rather then show_error() in order to avoid a
 			// self-referencing loop with the Excptions class
-			exit('Unable to locate the specified class: '.$class.EXT);
+			exit('Unable to locate the specified class: '.$class.'.php');
 		}
 
 		// Keep track of what we just loaded
 		$_classes[$class] = new $name();
 		return $_classes[$class];
 	}
+}
 
 // --------------------------------------------------------------------
 
 * @access	public
 * @return	array
 */
+if ( ! function_exists('is_loaded'))
+{
 	function is_loaded($class = '')
 	{
 		static $_is_loaded = array();
 
 		return $_is_loaded;
 	}
+}
 
 // ------------------------------------------------------------------------
 
 * @access	private
 * @return	array
 */
+if ( ! function_exists('get_config'))
+{
 	function &get_config($replace = array())
 	{
 		static $_config;
 		}
 
 		// Is the config file in the environment folder?
-		if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT))
+		if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
 		{
-			$file_path = APPPATH.'config/config'.EXT;
+			$file_path = APPPATH.'config/config.php';
 		}
 
 		// Fetch the config file
 
 		return $_config[0] =& $config;
 	}
+}
 
 // ------------------------------------------------------------------------
 
 * @access	public
 * @return	mixed
 */
+if ( ! function_exists('config_item'))
+{
 	function config_item($item)
 	{
 		static $_config_item = array();
 
 		return $_config_item[$item];
 	}
+}
 
 // ------------------------------------------------------------------------
 
 * @access	public
 * @return	void
 */
+if ( ! function_exists('show_error'))
+{
 	function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
 	{
 		$_error =& load_class('Exceptions', 'core');
 		echo $_error->show_error($heading, $message, 'error_general', $status_code);
 		exit;
 	}
+}
 
 // ------------------------------------------------------------------------
 
 * @access	public
 * @return	void
 */
+if ( ! function_exists('show_404'))
+{
 	function show_404($page = '', $log_error = TRUE)
 	{
 		$_error =& load_class('Exceptions', 'core');
 		$_error->show_404($page, $log_error);
 		exit;
 	}
+}
 
 // ------------------------------------------------------------------------
 
 * @access	public
 * @return	void
 */
+if ( ! function_exists('log_message'))
+{
 	function log_message($level = 'error', $message, $php_error = FALSE)
 	{
 		static $_log;
 		$_log =& load_class('Log');
 		$_log->write_log($level, $message, $php_error);
 	}
+}
 
 // ------------------------------------------------------------------------
 
  * @param	string
  * @return	void
  */
+if ( ! function_exists('set_status_header'))
+{
 	function set_status_header($code = 200, $text = '')
 	{
 		$stati = array(
 			header("HTTP/1.1 {$code} {$text}", TRUE, $code);
 		}
 	}
+}
 
 // --------------------------------------------------------------------
 
 * @access	private
 * @return	void
 */
+if ( ! function_exists('_exception_handler'))
+{
 	function _exception_handler($severity, $message, $filepath, $line)
 	{
 		 // We don't bother with "strict" notices since they tend to fill up
 
 		$_error->log_exception($severity, $message, $filepath, $line);
 	}
+}
 
-	// --------------------------------------------------------------------
+// --------------------------------------------------------------------
 
-	/**
-	 * Remove Invisible Characters
-	 *
-	 * This prevents sandwiching null characters
-	 * between ascii characters, like Java\0script.
-	 *
-	 * @access	public
-	 * @param	string
-	 * @return	string
-	 */
+/**
+ * Remove Invisible Characters
+ *
+ * This prevents sandwiching null characters
+ * between ascii characters, like Java\0script.
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('remove_invisible_characters'))
+{
 	function remove_invisible_characters($str, $url_encoded = TRUE)
 	{
 		$non_displayables = array();
 
 		return $str;
 	}
-
+}
 
 /* End of file Common.php */
 /* Location: ./system/core/Common.php */

File system/core/Config.php

 	 */
 	function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
 	{
-		$file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
+		$file = ($file == '') ? 'config' : str_replace('.php', '', $file);
 		$found = FALSE;
 		$loaded = FALSE;
 
 
 			foreach ($check_locations as $location)
 			{
-				$file_path = $path.'config/'.$location.EXT;
+				$file_path = $path.'config/'.$location.'.php';
 
 				if (in_array($file_path, $this->is_loaded, TRUE))
 				{
 
 			$loaded = TRUE;
 			log_message('debug', 'Config file loaded: '.$file_path);
+			break;
 		}
 
 		if ($loaded === FALSE)
 			{
 				return FALSE;
 			}
-			show_error('The configuration file '.$file.EXT.' does not exist.');
+			show_error('The configuration file '.$file.'.php'.' does not exist.');
 		}
 
 		return TRUE;
 	// --------------------------------------------------------------------
 
 	/**
-	 * Fetch a config file item - adds slash after item
-	 *
-	 * The second parameter allows a slash to be added to the end of
-	 * the item, in the case of a path.
+	 * Fetch a config file item - adds slash after item (if item is not empty)
 	 *
 	 * @access	public
 	 * @param	string	the config item name
 		{
 			return FALSE;
 		}
+		if( trim($this->config[$item]) == '')
+		{
+			return '';
+		}
 
 		return rtrim($this->config[$item], '/').'/';
 	}
 
 	/**
 	 * Site URL
+	 * Returns base_url . index_page [. uri_string]
 	 *
 	 * @access	public
 	 * @param	string	the URI string
 
 		if ($this->item('enable_query_strings') == FALSE)
 		{
+			$suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
+			return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
+		}
+		else
+		{
+			return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);
+		}
+	}
+	
+	// -------------------------------------------------------------
+	
+	/**
+	 * Base URL
+	 * Returns base_url [. uri_string]
+	 * 
+	 * @access public
+	 * @param string $uri
+	 * @return string
+	 */
+	function base_url($uri = '')
+	{
+		return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/');
+	}
+	
+	// -------------------------------------------------------------
+	
+	/**
+	 * Build URI string for use in Config::site_url() and Config::base_url()
+	 * 
+	 * @access protected
+	 * @param  $uri
+	 * @return string
+	 */
+	protected function _uri_string($uri)
+	{
+		if ($this->item('enable_query_strings') == FALSE)
+		{
 			if (is_array($uri))
 			{
 				$uri = implode('/', $uri);
 			}
-
-			$index = $this->item('index_page') == '' ? '' : $this->slash_item('index_page');
-			$suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
-			return $this->slash_item('base_url').$index.trim($uri, '/').$suffix;
+			$uri = trim($uri, '/');
 		}
 		else
 		{
 					$str .= $prefix.$key.'='.$val;
 					$i++;
 				}
-
 				$uri = $str;
 			}
-
-			return $this->slash_item('base_url').$this->item('index_page').'?'.$uri;
 		}
+	    return $uri;
 	}
 
 	// --------------------------------------------------------------------
-
+	
 	/**
 	 * System URL
 	 *
 // END CI_Config class
 
 /* End of file Config.php */
-/* Location: ./system/core/Config.php */
+/* Location: ./system/core/Config.php */

File system/core/Controller.php

 
 		$this->load =& load_class('Loader', 'core');
 
-		$this->load->_base_classes =& is_loaded();
-
-		$this->load->_ci_autoloader();
-
+		$this->load->set_base_classes()->ci_autoloader();
+		
 		log_message('debug', "Controller Class Initialized");
-
 	}
 
 	public static function &get_instance()

File system/core/Exceptions.php

 			ob_end_flush();
 		}
 		ob_start();
-		include(APPPATH.'errors/'.$template.EXT);
+		include(APPPATH.'errors/'.$template.'.php');
 		$buffer = ob_get_contents();
 		ob_end_clean();
 		return $buffer;
 			ob_end_flush();
 		}
 		ob_start();
-		include(APPPATH.'errors/error_php'.EXT);
+		include(APPPATH.'errors/error_php.php');
 		$buffer = ob_get_contents();
 		ob_end_clean();
 		echo $buffer;

File system/core/Hooks.php

 		// Grab the "hooks" definition file.
 		// If there are no hooks, we're done.
 
-		if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
+		if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
 		{
-		    include(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT);
+		    include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
 		}
-		elseif (is_file(APPPATH.'config/hooks'.EXT))
+		elseif (is_file(APPPATH.'config/hooks.php'))
 		{
-			include(APPPATH.'config/hooks'.EXT);
+			include(APPPATH.'config/hooks.php');
 		}
 
 

File system/core/Input.php

 	 */
 	public function is_cli_request()
 	{
-		return (bool) defined('STDIN');
+		return (php_sapi_name() == 'cli') or defined('STDIN');
 	}
 
 }

File system/core/Lang.php

 	 */
 	function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
 	{
-		$langfile = str_replace(EXT, '', $langfile);
+		$langfile = str_replace('.php', '', $langfile);
 
 		if ($add_suffix == TRUE)
 		{
 			$langfile = str_replace('_lang.', '', $langfile).'_lang';
 		}
 
-		$langfile .= EXT;
+		$langfile .= '.php';
 
 		if (in_array($langfile, $this->is_loaded, TRUE))
 		{
 	 */
 	function line($line = '')
 	{
-		$line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
+		$value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
 
 		// Because killer robots like unicorns!
-		if ($line === FALSE)
+		if ($value === FALSE)
 		{
 			log_message('error', 'Could not find the language line "'.$line.'"');
 		}
 
-		return $line;
+		return $value;
 	}
 
 }
 // END Language Class
 
 /* End of file Lang.php */
-/* Location: ./system/core/Lang.php */
+/* Location: ./system/core/Lang.php */

File system/core/Loader.php

 class CI_Loader {
 
 	// All these are set automatically. Don't mess with them.
-	var $_ci_ob_level;
-	var $_ci_view_path		= '';
-	var $_ci_library_paths	= array();
-	var $_ci_model_paths	= array();
-	var $_ci_helper_paths	= array();
-	var $_base_classes		= array(); // Set by the controller class
-	var $_ci_cached_vars	= array();
-	var $_ci_classes		= array();
-	var $_ci_loaded_files	= array();
-	var $_ci_models			= array();
-	var $_ci_helpers		= array();
-	var $_ci_varmap			= array('unit_test' => 'unit', 'user_agent' => 'agent');
-
+	protected $_ci_ob_level;
+	protected $_ci_view_paths		= array();
+	protected $_ci_library_paths	= array();
+	protected $_ci_model_paths		= array();
+	protected $_ci_helper_paths		= array();
+	protected $_base_classes		= array(); // Set by the controller class
+	protected $_ci_cached_vars		= array();
+	protected $_ci_classes			= array();
+	protected $_ci_loaded_files		= array();
+	protected $_ci_models			= array();
+	protected $_ci_helpers			= array();
+	protected $_ci_varmap			= array('unit_test' => 'unit', 
+											'user_agent' => 'agent');
 
 	/**
 	 * Constructor
 	 *
 	 * Sets the path to the view files and gets the initial output buffering level
-	 *
-	 * @access	public
 	 */
-	function __construct()
+	public function __construct()
 	{
-		$this->_ci_view_path = APPPATH.'views/';
 		$this->_ci_ob_level  = ob_get_level();
 		$this->_ci_library_paths = array(APPPATH, BASEPATH);
 		$this->_ci_helper_paths = array(APPPATH, BASEPATH);
 		$this->_ci_model_paths = array(APPPATH);
+		$this->_ci_view_paths = array(APPPATH.'views/'	=> TRUE);
+		
+		log_message('debug', "Loader Class Initialized");
+	}
 
-		log_message('debug', "Loader Class Initialized");
+	// --------------------------------------------------------------------
+	
+	/**
+	 * Set _base_classes variable
+	 *
+	 * This method is called once in CI_Controller.
+	 *
+	 * @param 	array 	
+	 * @return 	object
+	 */
+	public function set_base_classes()
+	{
+		$this->_base_classes =& is_loaded();
+		
+		return $this;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Is Loaded
+	 *
+	 * A utility function to test if a class is in the self::$_ci_classes array.
+	 * This function returns the object name if the class tested for is loaded,
+	 * and returns FALSE if it isn't.
+	 *
+	 * It is mainly used in the form_helper -> _get_validation_object()
+	 *
+	 * @param 	string	class being checked for
+	 * @return 	mixed	class object name on the CI SuperObject or FALSE
+	 */
+	public function is_loaded($class)
+	{
+		if (isset($this->_ci_classes[$class]))
+		{
+			return $this->_ci_classes[$class];
+		}
+				
+		return FALSE;
 	}
 
 	// --------------------------------------------------------------------
 	 * This function lets users load and instantiate classes.
 	 * It is designed to be called from a user's app controllers.
 	 *
-	 * @access	public
 	 * @param	string	the name of the class
 	 * @param	mixed	the optional parameters
 	 * @param	string	an optional object name
 	 * @return	void
 	 */
-	function library($library = '', $params = NULL, $object_name = NULL)
+	public function library($library = '', $params = NULL, $object_name = NULL)
 	{
 		if (is_array($library))
 		{
 	 *
 	 * This function lets users load and instantiate models.
 	 *
-	 * @access	public
 	 * @param	string	the name of the class
 	 * @param	string	name for the model
 	 * @param	bool	database connection
 	 * @return	void
 	 */
-	function model($model, $name = '', $db_conn = FALSE)
+	public function model($model, $name = '', $db_conn = FALSE)
 	{
 		if (is_array($model))
 		{
 
 		foreach ($this->_ci_model_paths as $mod_path)
 		{
-			if ( ! file_exists($mod_path.'models/'.$path.$model.EXT))
+			if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
 			{
 				continue;
 			}
 				load_class('Model', 'core');
 			}
 
-			require_once($mod_path.'models/'.$path.$model.EXT);
+			require_once($mod_path.'models/'.$path.$model.'.php');
 
 			$model = ucfirst($model);
 
 	/**
 	 * Database Loader
 	 *
-	 * @access	public
 	 * @param	string	the DB credentials
 	 * @param	bool	whether to return the DB object
 	 * @param	bool	whether to enable active record (this allows us to override the config setting)
 	 * @return	object
 	 */
-	function database($params = '', $return = FALSE, $active_record = NULL)
+	public function database($params = '', $return = FALSE, $active_record = NULL)
 	{
 		// Grab the super object
 		$CI =& get_instance();
 			return FALSE;
 		}
 
-		require_once(BASEPATH.'database/DB'.EXT);
+		require_once(BASEPATH.'database/DB.php');
 
 		if ($return === TRUE)
 		{
 	/**
 	 * Load the Utilities Class
 	 *
-	 * @access	public
 	 * @return	string
 	 */
-	function dbutil()
+	public function dbutil()
 	{
 		if ( ! class_exists('CI_DB'))
 		{
 		// this use is deprecated and strongly discouraged
 		$CI->load->dbforge();
 
-		require_once(BASEPATH.'database/DB_utility'.EXT);
-		require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility'.EXT);
+		require_once(BASEPATH.'database/DB_utility.php');
+		require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility.php');
 		$class = 'CI_DB_'.$CI->db->dbdriver.'_utility';
 
 		$CI->dbutil = new $class();
 	/**
 	 * Load the Database Forge Class
 	 *
-	 * @access	public
 	 * @return	string
 	 */
-	function dbforge()
+	public function dbforge()
 	{
 		if ( ! class_exists('CI_DB'))
 		{
 
 		$CI =& get_instance();
 
-		require_once(BASEPATH.'database/DB_forge'.EXT);
-		require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge'.EXT);
+		require_once(BASEPATH.'database/DB_forge.php');
+		require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge.php');
 		$class = 'CI_DB_'.$CI->db->dbdriver.'_forge';
 
 		$CI->dbforge = new $class();
 	 * some cases it's advantageous to be able to return data so that
 	 * a developer can process it in some way.
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	array
 	 * @param	bool
 	 * @return	void
 	 */
-	function view($view, $vars = array(), $return = FALSE)
+	public function view($view, $vars = array(), $return = FALSE)
 	{
 		return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
 	}
 	 *
 	 * This is a generic file loader
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	bool
 	 * @return	string
 	 */
-	function file($path, $return = FALSE)
+	public function file($path, $return = FALSE)
 	{
 		return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return));
 	}
 	 * Once variables are set they become available within
 	 * the controller class and its "view" files.
 	 *
-	 * @access	public
 	 * @param	array
 	 * @return	void
 	 */
-	function vars($vars = array(), $val = '')
+	public function vars($vars = array(), $val = '')
 	{
 		if ($val != '' AND is_string($vars))
 		{
 	// --------------------------------------------------------------------
 
 	/**
+	 * Get Variable
+	 *
+	 * Check if a variable is set and retrieve it.
+	 *
+	 * @param	array
+	 * @return	void
+	 */
+	public function get_var($key)
+	{
+		return isset($this->_ci_cached_vars[$key]) ? $this->_ci_cached_vars[$key] : NULL;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
 	 * Load Helper
 	 *
 	 * This function loads the specified helper file.
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @return	void
 	 */
-	function helper($helpers = array())
+	public function helper($helpers = array())
 	{
 		foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper)
 		{
 				continue;
 			}
 
-			$ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.EXT;
+			$ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.'.php';
 
 			// Is this a helper extension request?
 			if (file_exists($ext_helper))
 			{
-				$base_helper = BASEPATH.'helpers/'.$helper.EXT;
+				$base_helper = BASEPATH.'helpers/'.$helper.'.php';
 
 				if ( ! file_exists($base_helper))
 				{
-					show_error('Unable to load the requested file: helpers/'.$helper.EXT);
+					show_error('Unable to load the requested file: helpers/'.$helper.'.php');
 				}
 
 				include_once($ext_helper);
 			// Try to load the helper
 			foreach ($this->_ci_helper_paths as $path)
 			{
-				if (file_exists($path.'helpers/'.$helper.EXT))
+				if (file_exists($path.'helpers/'.$helper.'.php'))
 				{
-					include_once($path.'helpers/'.$helper.EXT);
+					include_once($path.'helpers/'.$helper.'.php');
 
 					$this->_ci_helpers[$helper] = TRUE;
 					log_message('debug', 'Helper loaded: '.$helper);
 			// unable to load the helper
 			if ( ! isset($this->_ci_helpers[$helper]))
 			{
-				show_error('Unable to load the requested file: helpers/'.$helper.EXT);
+				show_error('Unable to load the requested file: helpers/'.$helper.'.php');
 			}
 		}
 	}
 	 * This is simply an alias to the above function in case the
 	 * user has written the plural form of this function.
 	 *
-	 * @access	public
 	 * @param	array
 	 * @return	void
 	 */
-	function helpers($helpers = array())
+	public function helpers($helpers = array())
 	{
 		$this->helper($helpers);
 	}
 	/**
 	 * Loads a language file
 	 *
-	 * @access	public
 	 * @param	array
 	 * @param	string
 	 * @return	void
 	 */
-	function language($file = array(), $lang = '')
+	public function language($file = array(), $lang = '')
 	{
 		$CI =& get_instance();
 
 	/**
 	 * Loads a config file
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	void
 	 */
-	function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
+	public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
 	{
 		$CI =& get_instance();
 		$CI->config->load($file, $use_sections, $fail_gracefully);
 	 * @param	string	an optional object name
 	 * @return	void
 	 */
-	function driver($library = '', $params = NULL, $object_name = NULL)
+	public function driver($library = '', $params = NULL, $object_name = NULL)
 	{
 		if ( ! class_exists('CI_Driver_Library'))
 		{
 			// we aren't instantiating an object here, that'll be done by the Library itself
-			require BASEPATH.'libraries/Driver'.EXT;
+			require BASEPATH.'libraries/Driver.php';
 		}
 
 		// We can save the loader some time since Drivers will *always* be in a subfolder,
 	 *
 	 * Prepends a parent path to the library, model, helper, and config path arrays
 	 *
-	 * @access	public
 	 * @param	string
+	 * @param 	boolean 	
 	 * @return	void
 	 */
-	function add_package_path($path)
+	public function add_package_path($path, $view_cascade=TRUE)
 	{
 		$path = rtrim($path, '/').'/';
-
+		
 		array_unshift($this->_ci_library_paths, $path);
 		array_unshift($this->_ci_model_paths, $path);
 		array_unshift($this->_ci_helper_paths, $path);
 
+		$this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths;
+
 		// Add config file path
 		$config =& $this->_ci_get_component('config');
 		array_unshift($config->_config_paths, $path);
 	 *
 	 * Return a list of all package paths, by default it will ignore BASEPATH.
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	void
 	 */
-	function get_package_paths($include_base = FALSE)
+	public function get_package_paths($include_base = FALSE)
 	{
 		return $include_base === TRUE ? $this->_ci_library_paths : $this->_ci_model_paths;
 	}
 	 * Remove a path from the library, model, and helper path arrays if it exists
 	 * If no path is provided, the most recently added path is removed.
 	 *
-	 * @access	public
 	 * @param	type
 	 * @return	type
 	 */
-	function remove_package_path($path = '', $remove_config_path = TRUE)
+	public function remove_package_path($path = '', $remove_config_path = TRUE)
 	{
 		$config =& $this->_ci_get_component('config');
 
 			$void = array_shift($this->_ci_library_paths);
 			$void = array_shift($this->_ci_model_paths);
 			$void = array_shift($this->_ci_helper_paths);
+			$void = array_shift($this->_ci_view_paths);
 			$void = array_shift($config->_config_paths);
 		}
 		else
 		{
 			$path = rtrim($path, '/').'/';
-
 			foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var)
 			{
 				if (($key = array_search($path, $this->{$var})) !== FALSE)
 					unset($this->{$var}[$key]);
 				}
 			}
+			
+			if (isset($this->_ci_view_paths[$path.'views/']))
+			{
+				unset($this->_ci_view_paths[$path.'views/']);
+			}
 
 			if (($key = array_search($path, $config->_config_paths)) !== FALSE)
 			{
 		$this->_ci_library_paths = array_unique(array_merge($this->_ci_library_paths, array(APPPATH, BASEPATH)));
 		$this->_ci_helper_paths = array_unique(array_merge($this->_ci_helper_paths, array(APPPATH, BASEPATH)));
 		$this->_ci_model_paths = array_unique(array_merge($this->_ci_model_paths, array(APPPATH)));
+		$this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH.'views/' => TRUE));
 		$config->_config_paths = array_unique(array_merge($config->_config_paths, array(APPPATH)));
 	}
 
 	 * Variables are prefixed with _ci_ to avoid symbol collision with
 	 * variables made available to view files
 	 *
-	 * @access	private
 	 * @param	array
 	 * @return	void
 	 */
-	function _ci_load($_ci_data)
+	protected function _ci_load($_ci_data)
 	{
 		// Set the default data variables
 		foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
 		{
 			$$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val];
 		}
+		
+		$file_exists = FALSE;
 
 		// Set the path to the requested file
-		if ($_ci_path == '')
-		{
-			$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
-			$_ci_file = ($_ci_ext == '') ? $_ci_view.EXT : $_ci_view;
-			$_ci_path = $this->_ci_view_path.$_ci_file;
-		}
-		else
+		if ($_ci_path != '')
 		{
 			$_ci_x = explode('/', $_ci_path);
 			$_ci_file = end($_ci_x);
 		}
+		else
+		{
+			$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
+			$_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view;
 
-		if ( ! file_exists($_ci_path))
+			foreach ($this->_ci_view_paths as $view_file => $cascade)
+			{
+				if (file_exists($view_file.$_ci_file))
+				{
+					$_ci_path = $view_file.$_ci_file;
+					$file_exists = TRUE;
+					break;
+				}
+				
+				if ( ! $cascade)
+				{
+					break;
+				}				
+			}
+		}
+
+		if ( ! $file_exists && ! file_exists($_ci_path))
 		{
 			show_error('Unable to load the requested file: '.$_ci_file);
 		}
 	 *
 	 * This function loads the requested class.
 	 *
-	 * @access	private
 	 * @param	string	the item that is being loaded
 	 * @param	mixed	any additional parameters
 	 * @param	string	an optional object name
 	 * @return	void
 	 */
-	function _ci_load_class($class, $params = NULL, $object_name = NULL)
+	protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
 	{
 		// Get the class name, and while we're at it trim any slashes.
 		// The directory path can be included as part of the class name,
 		// but we don't want a leading slash
-		$class = str_replace(EXT, '', trim($class, '/'));
+		$class = str_replace('.php', '', trim($class, '/'));
 
 		// Was the path included with the class name?
 		// We look for a slash to determine this
 		// We'll test for both lowercase and capitalized versions of the file name
 		foreach (array(ucfirst($class), strtolower($class)) as $class)
 		{
-			$subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT;
+			$subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.'.php';
 
 			// Is this a class extension request?
 			if (file_exists($subclass))
 			{
-				$baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT;
+				$baseclass = BASEPATH.'libraries/'.ucfirst($class).'.php';
 
 				if ( ! file_exists($baseclass))
 				{
 			$is_duplicate = FALSE;
 			foreach ($this->_ci_library_paths as $path)
 			{
-				$filepath = $path.'libraries/'.$subdir.$class.EXT;
+				$filepath = $path.'libraries/'.$subdir.$class.'.php';
 
 				// Does the file exist?  No?  Bummer...
 				if ( ! file_exists($filepath))
 	/**
 	 * Instantiates a class
 	 *
-	 * @access	private
 	 * @param	string
 	 * @param	string
 	 * @param	string	an optional object name
 	 * @return	null
 	 */
-	function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
+	protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
 	{
 		// Is there an associated config file for this class?  Note: these should always be lowercase
 		if ($config === NULL)
 					// We test for both uppercase and lowercase, for servers that
 					// are case-sensitive with regard to file names. Check for environment
 					// first, global next
-					if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT))
+					if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
 					{
-						include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT);
+						include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
 						break;
 					}
-					elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT))
+					elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
 					{
-						include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT);
+						include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
 						break;
 					}
-					elseif (file_exists($path .'config/'.strtolower($class).EXT))
+					elseif (file_exists($path .'config/'.strtolower($class).'.php'))
 					{
-						include_once($path .'config/'.strtolower($class).EXT);
+						include_once($path .'config/'.strtolower($class).'.php');
 						break;
 					}
-					elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).EXT))
+					elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php'))
 					{
-						include_once($path .'config/'.ucfirst(strtolower($class)).EXT);
+						include_once($path .'config/'.ucfirst(strtolower($class)).'.php');
 						break;
 					}
 				}
 	 * The config/autoload.php file contains an array that permits sub-systems,
 	 * libraries, and helpers to be loaded automatically.
 	 *
-	 * @access	private
+	 * This function is public, as it's used in the CI_Controller class.  
+	 * However, there is no reason you should ever needs to use it.
+	 *
 	 * @param	array
 	 * @return	void
 	 */
-	function _ci_autoloader()
+	public function ci_autoloader()
 	{
-		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT))
+		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
 		{
-			include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT);
+			include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
 		}
 		else
 		{
-			include_once(APPPATH.'config/autoload'.EXT);
+			include_once(APPPATH.'config/autoload.php');
 		}
 		
 
 	 *
 	 * Takes an object as input and converts the class variables to array key/vals
 	 *
-	 * @access	private
 	 * @param	object
 	 * @return	array
 	 */
-	function _ci_object_to_array($object)
+	protected function _ci_object_to_array($object)
 	{
 		return (is_object($object)) ? get_object_vars($object) : $object;
 	}
 	/**
 	 * Get a reference to a specific library or model
 	 *
-	 * @access	private
 	 * @return	bool
 	 */
-	function &_ci_get_component($component)
+	protected function &_ci_get_component($component)
 	{
 		$CI =& get_instance();
 		return $CI->$component;
 	 *
 	 * This function preps the name of various items to make loading them more reliable.
 	 *
-	 * @access	private
 	 * @param	mixed
 	 * @return	array
 	 */
-	function _ci_prep_filename($filename, $extension)
+	protected function _ci_prep_filename($filename, $extension)
 	{
 		if ( ! is_array($filename))
 		{
-			return array(strtolower(str_replace(EXT, '', str_replace($extension, '', $filename)).$extension));
+			return array(strtolower(str_replace('.php', '', str_replace($extension, '', $filename)).$extension));
 		}
 		else
 		{
 			foreach ($filename as $key => $val)
 			{
-				$filename[$key] = strtolower(str_replace(EXT, '', str_replace($extension, '', $val)).$extension);
+				$filename[$key] = strtolower(str_replace('.php', '', str_replace($extension, '', $val)).$extension);
 			}
 
 			return $filename;
 		}
 	}
-
-
 }
 
 /* End of file Loader.php */
-/* Location: ./system/core/Loader.php */
+/* Location: ./system/core/Loader.php */

File system/core/Output.php

 		$this->_zlib_oc = @ini_get('zlib.output_compression');
 
 		// Get mime types for later
-		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
 		{
-		    include APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT;
+		    include APPPATH.'config/'.ENVIRONMENT.'/mimes.php';
 		}
 		else
 		{
-			include APPPATH.'config/mimes'.EXT;
+			include APPPATH.'config/mimes.php';
 		}
 
 

File system/core/Router.php

 		}
 
 		// Load the routes.php file.
-		if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT))
+		if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
 		{
-			include(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT);
+			include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
 		}
-		elseif (is_file(APPPATH.'config/routes'.EXT))
+		elseif (is_file(APPPATH.'config/routes.php'))
 		{
-			include(APPPATH.'config/routes'.EXT);
+			include(APPPATH.'config/routes.php');
 		}
 		
 		$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
 		}
 
 		// Does the requested controller exist in the root folder?
-		if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
+		if (file_exists(APPPATH.'controllers/'.$segments[0].'.php'))
 		{
 			return $segments;
 		}
 			if (count($segments) > 0)
 			{
 				// Does the requested controller exist in the sub-folder?
-				if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
+				if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].'.php'))
 				{
 					show_404($this->fetch_directory().$segments[0]);
 				}
 				}
 
 				// Does the default controller exist in the sub-folder?
-				if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
+				if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.'.php'))
 				{
 					$this->directory = '';
 					return array();

File system/core/Security.php

 	 */
 	public function __construct()
 	{
-		// Append application specific cookie prefix to token name
-		$this->_csrf_cookie_name = (config_item('cookie_prefix')) ? config_item('cookie_prefix').$this->_csrf_token_name : $this->_csrf_token_name;
+		// CSRF config
+		foreach(array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key)
+		{
+			if (FALSE !== ($val = config_item($key)))
+			{
+				$this->{'_'.$key} = $val;
+			}
+		}
+
+		// Append application specific cookie prefix
+		if (config_item('cookie_prefix'))
+		{
+			$this->_csrf_cookie_name = config_item('cookie_prefix').$this->_csrf_cookie_name;
+		}
 
 		// Set the CSRF hash
 		$this->_csrf_set_hash();
 // END Security Class
 
 /* End of file Security.php */
-/* Location: ./system/libraries/Security.php */
+/* Location: ./system/libraries/Security.php */

File system/core/URI.php

 		if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
 		{
 			// Is the request coming from the command line?
-			if (defined('STDIN'))
+			if (php_sapi_name() == 'cli' or defined('STDIN'))
 			{
 				$this->_set_uri_string($this->_parse_cli_args());
 				return;
 		$path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
 		$this->_set_uri_string($path);
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
 	{
 		// Filter out control characters
 		$str = remove_invisible_characters($str, FALSE);
-		
+
 		// If the URI contains only a slash we'll kill it
 		$this->uri_string = ($str == '/') ? '' : $str;
 	}
 	 */
 	private function _detect_uri()
 	{
-		if ( ! isset($_SERVER['REQUEST_URI']))
+		if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME']))
 		{
 			return '';
 		}
 			$_SERVER['QUERY_STRING'] = '';
 			$_GET = array();
 		}
-		
+
 		if ($uri == '/' || empty($uri))
 		{
 			return '/';
 		}
-				
+
 		$uri = parse_url($uri, PHP_URL_PATH);
 
 		// Do some final cleaning of the URI and return it

File system/database/DB.php

 	if (is_string($params) AND strpos($params, '://') === FALSE)
 	{
 		// Is the config file in the environment folder?
-		if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database'.EXT))
+		if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php'))
 		{
-			if ( ! file_exists($file_path = APPPATH.'config/database'.EXT))
+			if ( ! file_exists($file_path = APPPATH.'config/database.php'))
 			{
-				show_error('The configuration file database'.EXT.' does not exist.');
+				show_error('The configuration file database.php does not exist.');
 			}
 		}
 		
 		$active_record = $active_record_override;
 	}
 
-	require_once(BASEPATH.'database/DB_driver'.EXT);
+	require_once(BASEPATH.'database/DB_driver.php');
 
 	if ( ! isset($active_record) OR $active_record == TRUE)
 	{
-		require_once(BASEPATH.'database/DB_active_rec'.EXT);
+		require_once(BASEPATH.'database/DB_active_rec.php');
 
 		if ( ! class_exists('CI_DB'))
 		{
 		}
 	}
 
-	require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT);
+	require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php');
 
 	// Instantiate the DB adapter
 	$driver = 'CI_DB_'.$params['dbdriver'].'_driver';

File system/database/DB_active_rec.php

 	var $ar_cache_having		= array();
 	var $ar_cache_orderby		= array();
 	var $ar_cache_set			= array();
-
+	
+	var $ar_no_escape 			= array();
+	var $ar_cache_no_escape     = array();
 
 	// --------------------------------------------------------------------
 
 	 *
 	 * Generates the SELECT portion of the query
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	object
 	 */
-	function select($select = '*', $escape = NULL)
+	public function select($select = '*', $escape = NULL)
 	{
-		// Set the global value if this was sepecified
-		if (is_bool($escape))
-		{
-			$this->_protect_identifiers = $escape;
-		}
-
 		if (is_string($select))
 		{
 			$select = explode(',', $select);
 			if ($val != '')
 			{
 				$this->ar_select[] = $val;
+				$this->ar_no_escape[] = $escape;
 
 				if ($this->ar_caching === TRUE)
 				{
 					$this->ar_cache_select[] = $val;
 					$this->ar_cache_exists[] = 'select';
+					$this->ar_cache_no_escape[] = $escape;
 				}
 			}
 		}
 	 *
 	 * Generates a SELECT MAX(field) portion of a query
 	 *
-	 * @access	public
 	 * @param	string	the field
 	 * @param	string	an alias
 	 * @return	object
 	 */
-	function select_max($select = '', $alias = '')
+	public function select_max($select = '', $alias = '')
 	{
 		return $this->_max_min_avg_sum($select, $alias, 'MAX');
 	}
 	 *
 	 * Generates a SELECT MIN(field) portion of a query
 	 *
-	 * @access	public
 	 * @param	string	the field
 	 * @param	string	an alias
 	 * @return	object
 	 */
-	function select_min($select = '', $alias = '')
+	public function select_min($select = '', $alias = '')
 	{
 		return $this->_max_min_avg_sum($select, $alias, 'MIN');
 	}
 	 *
 	 * Generates a SELECT AVG(field) portion of a query
 	 *
-	 * @access	public
 	 * @param	string	the field
 	 * @param	string	an alias
 	 * @return	object
 	 */
-	function select_avg($select = '', $alias = '')
+	public function select_avg($select = '', $alias = '')
 	{
 		return $this->_max_min_avg_sum($select, $alias, 'AVG');
 	}
 	 *
 	 * Generates a SELECT SUM(field) portion of a query
 	 *
-	 * @access	public
 	 * @param	string	the field
 	 * @param	string	an alias
 	 * @return	object
 	 */
-	function select_sum($select = '', $alias = '')
+	public function select_sum($select = '', $alias = '')
 	{
 		return $this->_max_min_avg_sum($select, $alias, 'SUM');
 	}
 	 *	select_avg()
 	 *  select_sum()
 	 *
-	 * @access	public
 	 * @param	string	the field
 	 * @param	string	an alias
 	 * @return	object
 	 */
-	function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
+	protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
 	{
 		if ( ! is_string($select) OR $select == '')
 		{
 	/**
 	 * Determines the alias name based on the table
 	 *
-	 * @access	private
 	 * @param	string
 	 * @return	string
 	 */
-	function _create_alias_from_table($item)
+	protected function _create_alias_from_table($item)
 	{
 		if (strpos($item, '.') !== FALSE)
 		{
 	 *
 	 * Sets a flag which tells the query string compiler to add DISTINCT
 	 *
-	 * @access	public
 	 * @param	bool
 	 * @return	object
 	 */
-	function distinct($val = TRUE)
+	public function distinct($val = TRUE)
 	{
 		$this->ar_distinct = (is_bool($val)) ? $val : TRUE;
 		return $this;
 	 *
 	 * Generates the FROM portion of the query
 	 *
-	 * @access	public
 	 * @param	mixed	can be a string or array
 	 * @return	object
 	 */
-	function from($from)
+	public function from($from)
 	{
 		foreach ((array)$from as $val)
 		{
 	 *
 	 * Generates the JOIN portion of the query
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string	the join condition
 	 * @param	string	the type of join
 	 * @return	object
 	 */
-	function join($table, $cond, $type = '')
+	public function join($table, $cond, $type = '')
 	{
 		if ($type != '')
 		{
 	 * Generates the WHERE portion of the query. Separates
 	 * multiple calls with AND
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	mixed
 	 * @return	object
 	 */
-	function where($key, $value = NULL, $escape = TRUE)
+	public function where($key, $value = NULL, $escape = TRUE)
 	{
 		return $this->_where($key, $value, 'AND ', $escape);
 	}
 	 * Generates the WHERE portion of the query. Separates
 	 * multiple calls with OR
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	mixed
 	 * @return	object
 	 */
-	function or_where($key, $value = NULL, $escape = TRUE)
+	public function or_where($key, $value = NULL, $escape = TRUE)
 	{
 		return $this->_where($key, $value, 'OR ', $escape);
 	}
 	/**
 	 * Where
 	 *
-	 * Called by where() or orwhere()
+	 * Called by where() or or_where()
 	 *
-	 * @access	private
 	 * @param	mixed
 	 * @param	mixed
 	 * @param	string
 	 * @return	object
 	 */
-	function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
+	protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
 	{
 		if ( ! is_array($key))
 		{
 
 					$v = ' '.$this->escape($v);
 				}
-
+				
 				if ( ! $this->_has_operator($k))
 				{
-					$k .= ' =';
+					$k .= ' = ';
 				}
 			}
 			else
 	 * Generates a WHERE field IN ('item', 'item') SQL query joined with
 	 * AND if appropriate
 	 *
-	 * @access	public
 	 * @param	string	The field to search
 	 * @param	array	The values searched on
 	 * @return	object
 	 */
-	function where_in($key = NULL, $values = NULL)
+	public function where_in($key = NULL, $values = NULL)
 	{
 		return $this->_where_in($key, $values);
 	}
 	 * Generates a WHERE field IN ('item', 'item') SQL query joined with
 	 * OR if appropriate
 	 *
-	 * @access	public
 	 * @param	string	The field to search
 	 * @param	array	The values searched on
 	 * @return	object
 	 */
-	function or_where_in($key = NULL, $values = NULL)
+	public function or_where_in($key = NULL, $values = NULL)
 	{
 		return $this->_where_in($key, $values, FALSE, 'OR ');
 	}
 	 * Generates a WHERE field NOT IN ('item', 'item') SQL query joined
 	 * with AND if appropriate
 	 *
-	 * @access	public
 	 * @param	string	The field to search
 	 * @param	array	The values searched on
 	 * @return	object
 	 */
-	function where_not_in($key = NULL, $values = NULL)
+	public function where_not_in($key = NULL, $values = NULL)
 	{
 		return $this->_where_in($key, $values, TRUE);
 	}
 	 * Generates a WHERE field NOT IN ('item', 'item') SQL query joined
 	 * with OR if appropriate
 	 *
-	 * @access	public
 	 * @param	string	The field to search
 	 * @param	array	The values searched on
 	 * @return	object
 	 */
-	function or_where_not_in($key = NULL, $values = NULL)
+	public function or_where_not_in($key = NULL, $values = NULL)
 	{
 		return $this->_where_in($key, $values, TRUE, 'OR ');
 	}
 	 *
 	 * Called by where_in, where_in_or, where_not_in, where_not_in_or
 	 *
-	 * @access	public
 	 * @param	string	The field to search
 	 * @param	array	The values searched on
 	 * @param	boolean	If the statement would be IN or NOT IN
 	 * @param	string
 	 * @return	object
 	 */
-	function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
+	protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
 	{
 		if ($key === NULL OR $values === NULL)
 		{
 	 * Generates a %LIKE% portion of the query. Separates
 	 * multiple calls with AND
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	mixed
 	 * @return	object
 	 */
-	function like($field, $match = '', $side = 'both')
+	public function like($field, $match = '', $side = 'both')
 	{
 		return $this->_like($field, $match, 'AND ', $side);
 	}
 	 * Generates a NOT LIKE portion of the query. Separates
 	 * multiple calls with AND
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	mixed
 	 * @return	object
 	 */
-	function not_like($field, $match = '', $side = 'both')
+	public function not_like($field, $match = '', $side = 'both')
 	{
 		return $this->_like($field, $match, 'AND ', $side, 'NOT');
 	}
 	 * Generates a %LIKE% portion of the query. Separates
 	 * multiple calls with OR
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	mixed
 	 * @return	object
 	 */
-	function or_like($field, $match = '', $side = 'both')
+	public function or_like($field, $match = '', $side = 'both')
 	{
 		return $this->_like($field, $match, 'OR ', $side);
 	}
 	 * Generates a NOT LIKE portion of the query. Separates
 	 * multiple calls with OR
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	mixed
 	 * @return	object
 	 */
-	function or_not_like($field, $match = '', $side = 'both')
+	public function or_not_like($field, $match = '', $side = 'both')
 	{
 		return $this->_like($field, $match, 'OR ', $side, 'NOT');
 	}
 	 *
 	 * Called by like() or orlike()
 	 *
-	 * @access	private
 	 * @param	mixed
 	 * @param	mixed
 	 * @param	string
 	 * @return	object
 	 */
-	function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
+	protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
 	{
 		if ( ! is_array($field))
 		{
 	/**
 	 * GROUP BY
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	object
 	 */
-	function group_by($by)
+	public function group_by($by)
 	{
 		if (is_string($by))
 		{
 	 *
 	 * Separates multiple calls with AND
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	object
 	 */
-	function having($key, $value = '', $escape = TRUE)
+	public function having($key, $value = '', $escape = TRUE)
 	{
 		return $this->_having($key, $value, 'AND ', $escape);
 	}
 	 *
 	 * Separates multiple calls with OR
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	object
 	 */
-	function or_having($key, $value = '', $escape = TRUE)
+	public function or_having($key, $value = '', $escape = TRUE)
 	{
 		return $this->_having($key, $value, 'OR ', $escape);
 	}
 	 *
 	 * Called by having() or or_having()
 	 *
-	 * @access	private
 	 * @param	string
 	 * @param	string
 	 * @return	object
 	 */
-	function _having($key, $value = '', $type = 'AND ', $escape = TRUE)
+	protected function _having($key, $value = '', $type = 'AND ', $escape = TRUE)
 	{
 		if ( ! is_array($key))
 		{
 
 			if ($v != '')
 			{
-				$v = ' '.$this->escape_str($v);
+				$v = ' '.$this->escape($v);
 			}
 
 			$this->ar_having[] = $prefix.$k.$v;
 	/**
 	 * Sets the ORDER BY value
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string	direction: asc or desc
 	 * @return	object
 	 */
-	function order_by($orderby, $direction = '')
+	public function order_by($orderby, $direction = '')
 	{
 		if (strtolower($direction) == 'random')
 		{
 	/**
 	 * Sets the LIMIT value
 	 *
-	 * @access	public
 	 * @param	integer	the limit value
 	 * @param	integer	the offset value
 	 * @return	object
 	 */
-	function limit($value, $offset = '')
+	public function limit($value, $offset = '')
 	{
 		$this->ar_limit = $value;
 
 	/**
 	 * Sets the OFFSET value
 	 *
-	 * @access	public
 	 * @param	integer	the offset value
 	 * @return	object
 	 */
-	function offset($offset)
+	public function offset($offset)
 	{
 		$this->ar_offset = $offset;
 		return $this;
 	/**
 	 * The "set" function.  Allows key/value pairs to be set for inserting or updating
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	string
 	 * @param	boolean
 	 * @return	object
 	 */
-	function set($key, $value = '', $escape = TRUE)
+	public function set($key, $value = '', $escape = TRUE)
 	{
 		$key = $this->_object_to_array($key);
 
 	 * Compiles the select statement based on the other functions called
 	 * and runs the query
 	 *
-	 * @access	public
 	 * @param	string	the table