Alexandru Bucur avatar Alexandru Bucur committed e1760fb

Initial base changes ported from an existing application, i hope all works, didn't test it yet

Comments (0)

Files changed (52)

application/config/autoload.php

 |	$autoload['libraries'] = array('database', 'session', 'xmlrpc');
 */
 
-$autoload['libraries'] = array();
+$autoload['libraries'] = array('database', 'session', 'ion_auth', 'carabiner', 'template');
 
 
 /*
 |	$autoload['helper'] = array('url', 'file');
 */
 
-$autoload['helper'] = array();
+$autoload['helper'] = array('url');
 
 
 /*
 
 
 /* End of file autoload.php */
-/* Location: ./application/config/autoload.php */
+/* Location: ./application/config/autoload.php */

application/config/carabiner.php

+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+/**
+* Carabiner 1.45 configuration file.
+* CodeIgniter-library for Asset Management
+*/
+
+/*
+|--------------------------------------------------------------------------
+| Script Directory
+|--------------------------------------------------------------------------
+|
+| Path to the script directory.  Relative to the CI front controller.
+|
+*/
+
+$config['script_dir'] = 'assets/js/';
+
+
+/*
+|--------------------------------------------------------------------------
+| Style Directory
+|--------------------------------------------------------------------------
+|
+| Path to the style directory.  Relative to the CI front controller
+|
+*/
+
+$config['style_dir'] = 'assets/css/';
+
+/*
+|--------------------------------------------------------------------------
+| Cache Directory
+|--------------------------------------------------------------------------
+|
+| Path to the cache directory. Must be writable. Relative to the CI 
+| front controller.
+|
+*/
+
+$config['cache_dir'] = 'assets/cache/';
+
+
+
+
+/*
+* The following config values are not required.  See Libraries/Carabiner.php
+* for more information.
+*/
+
+
+
+/*
+|--------------------------------------------------------------------------
+| Base URI
+|--------------------------------------------------------------------------
+|
+|  Base uri of the site, like http://www.example.com/ Defaults to the CI 
+|  config value for base_url.
+|
+*/
+
+//$config['base_uri'] = 'http://www.example.com/';
+
+
+/*
+|--------------------------------------------------------------------------
+| Development Flag
+|--------------------------------------------------------------------------
+|
+|  Flags whether your in a development environment or not. Defaults to FALSE.
+|
+*/
+
+$config['dev'] = TRUE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Combine
+|--------------------------------------------------------------------------
+|
+| Flags whether files should be combined. Defaults to TRUE.
+|
+*/
+
+$config['combine'] = TRUE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Minify Javascript
+|--------------------------------------------------------------------------
+|
+| Global flag for whether JS should be minified. Defaults to TRUE.
+|
+*/
+
+$config['minify_js'] = TRUE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Minify CSS
+|--------------------------------------------------------------------------
+|
+| Global flag for whether CSS should be minified. Defaults to TRUE.
+|
+*/
+
+$config['minify_css'] = TRUE;
+
+/*
+|--------------------------------------------------------------------------
+| Force cURL
+|--------------------------------------------------------------------------
+|
+| Global flag for whether to force the use of cURL instead of file_get_contents()
+| Defaults to FALSE.
+|
+*/
+
+$config['force_curl'] = FALSE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Predifined Asset Groups
+|--------------------------------------------------------------------------
+|
+| Any groups defined here will automatically be included.  Of course, they
+| won't be displayed unless you explicity display them ( like this: $this->carabiner->display('jquery') )
+| See docs for more.
+| 
+| Currently created groups:
+|	> jQuery (latest in 1.xx version)
+|	> jQuery UI (latest in 1.xx version)
+|	> Ext Core (latest in 3.xx version)
+|	> Chrome Frame (latest in 1.xx version)
+|	> Prototype (latest in 1.x.x.x version)
+|	> script.aculo.us (latest in 1.x.x version)
+|	> Mootools (1.xx version)
+|	> Dojo (latest in 1.xx version)
+|	> SWFObject (latest in 2.xx version)
+|	> YUI (latest core JS/CSS in 2.x.x version)
+|
+*/
+
+// jQuery (latest, as of 1.xx)
+$config['groups']['jquery'] = array(
+	
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', TRUE, FALSE)
+	
+	)
+);
+
+
+// jQuery UI (latest, as of 1.xx)
+$config['groups']['jqueryui'] = array(
+	
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', TRUE, FALSE),
+		array('http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js', TRUE, FALSE)
+	
+	)
+);
+
+
+// Ext Core (latest, as of 3.xx)
+$config['groups']['ext-core'] = array(
+	
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core-debug.js', 'http://ajax.googleapis.com/ajax/libs/ext-core/3/ext-core.js', TRUE, FALSE)
+	
+	)
+);
+
+// Chrome Frame (latest, as of 1.xx)
+$config['groups']['chrome-frame'] = array(
+	
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core-debug.js', 'http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js', TRUE, FALSE)
+	
+	)
+);
+
+// Prototype (latest, as of 1.x.x.x)
+$config['groups']['prototype'] = array(
+
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js', 'http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js', TRUE, FALSE)
+	
+	)
+);
+
+
+// script.aculo.us (latest, as of 1.x.x)
+$config['groups']['scriptaculous'] = array(
+
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js', 'http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js', TRUE , FALSE),
+		array('http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js', 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js', TRUE, FALSE)
+		
+	)
+	
+);
+
+
+// MooTools
+$config['groups']['mootools'] = array(
+	
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/mootools/1/mootools.js', 'http://ajax.googleapis.com/ajax/libs/mootools/1/mootools-yui-compressed.js', TRUE, FALSE)
+		
+	)
+);
+
+
+// Dojo (latest, as of 1.xx)
+$config['groups']['dojo'] = array(
+	
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js.uncompressed.js', 'http://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js', TRUE, FALSE)
+	
+	)
+);
+
+
+// SWFObject (latest, as of 2.xx)
+$config['groups']['swfobject'] = array(
+
+	'js' => array(
+	
+		array('http://ajax.googleapis.com/ajax/libs/swfobject/2/swfobject_src.js', 'http://ajax.googleapis.com/ajax/libs/swfobject/2/swfobject.js', TRUE, FALSE)
+	
+	)
+	
+);
+
+
+// YUI (latest, as of 2.x.x)
+$config['groups']['yui'] = array(
+	
+	'js' => array(
+	
+		// JS Core
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/yuiloader/yuiloader.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/yuiloader/yuiloader.js', TRUE, FALSE),
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/dom/dom.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/dom/dom-min.js', TRUE, FALSE),
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/event/event.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/event/event-min.js', TRUE, FALSE)
+		
+		// JS Utilities: Uncomment as needed
+		//,array('http://ajax.googleapis.com/ajax/libs/yui/2/build/animation/animation.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/animation/animation-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/connection/connection.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/connection/connection-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/cookie/cookie.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/cookie/cookie-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/datasource/datasource.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/datasource/datasource-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/dragdrop/dragdrop.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/dragdrop/dragdrop-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/element/element.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/element/element-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/history/history.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/history/history-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/imageloader/imageloader.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/imageloader/imageloader-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/json/json.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/json/json-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/paginator/paginator.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/paginator/paginator-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/resize/resize.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/resize/resize-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/selector/selector.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/selector/selector-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/stylesheet/stylesheet.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/stylesheet/stylesheet-min.js', TRUE, FALSE),
+		
+		// Widget JS Tools: Uncomment as needed
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/container/container.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/container/container-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/menu/menu.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/menu/menu-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/autocomplete/autocomplete.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/autocomplete/autocomplete-min.js', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/button/button.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/button/button-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/calendar/calendar.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/calendar/calendar-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/charts/charts.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/charts/charts-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/colorpicker/colorpicker.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/colorpicker/colorpicker-min.js', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/datatable/datatable.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/datatable/datatable-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/editor/editor.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/editor/editor-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/imagecropper/imagecropper.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/imagecropper/imagecropper-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/layout/layout.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/layout/layout-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/paginator/paginator.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/paginator/paginator-min.js', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/slider/slider.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/slider/slider-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/tabview/tabview.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/tabview/tabview-min.js', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/treeview/treeview.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/treeview/treeview-min.js', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/uploader/uploader.js', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/uploader/uploader-min.js', TRUE, FALSE),		
+
+	),
+	
+	
+	'css' => array(
+	
+		// CSS Core
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/fonts/fonts.css', 'screen', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/fonts/fonts-min.css', TRUE, FALSE),	
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/reset/reset.css', 'screen', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/reset/reset-min.css', TRUE, FALSE),
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/grids/grids.css', 'screen', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/grids/grids-min.css', TRUE, FALSE),
+		array('http://ajax.googleapis.com/ajax/libs/yui/2/build/base/base.css', 'screen', 'http://ajax.googleapis.com/ajax/libs/yui/2/build/base/base-min.css', TRUE, FALSE)
+
+		//CSS for Controls: Uncomment as Needed
+		//,array('http://ajax.googleapis.com/ajax/libs/yui/2/build/autocomplete/assets/skins/sam/autocomplete.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/container/assets/skins/sam/container.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/menu/assets/skins/sam/menu.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/button/assets/skins/sam/button.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/calendar/assets/skins/sam/calendar.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/carousel/assets/skins/sam/carousel.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/slider/assets/skins/sam/slider.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/colorpicker/assets/skins/sam/colorpicker.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/datatable/assets/skins/sam/datatable.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/editor/assets/skins/sam/editor.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/resize/assets/skins/sam/resize.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/imagecropper/assets/skins/sam/imagecropper.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/layout/assets/skins/sam/layout.css', 'screen', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/tabview/assets/skins/sam/tabview.css', 'screen', TRUE, FALSE), 
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/treeview/assets/skins/sam/treeview.css', 'screen', TRUE, FALSE),
+		//array('http://ajax.googleapis.com/ajax/libs/yui/2/build/editor/assets/skins/sam/simpleeditor.css', 'screen', TRUE, FALSE)
+	
+	)
+
+);
+

application/config/config.php

 */
 $config['proxy_ips'] = '';
 
-
+/*
+| -------------------------------------------------------------------
+|  Native Core Auto-load
+| -------------------------------------------------------------------
+| 
+| Nothing to do with config/autoload.php, this allows PHP autoload to work
+| for core controllers.
+|
+*/
+function __autoload($class)
+{
+    if(strpos($class, 'CI_') !== 0)
+    {
+        @include_once( APPPATH . 'core/'. $class . EXT );
+    }
+}
 /* End of file config.php */
-/* Location: ./application/config/config.php */
+/* Location: ./application/config/config.php */

application/config/ion_auth.php

+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+* Name:  Ion Auth Config
+* 
+* Author: Ben Edmunds
+* 		  ben.edmunds@gmail.com
+*         @benedmunds
+*          
+* Added Awesomeness: Phil Sturgeon
+* 
+* Location: http://github.com/benedmunds/ion_auth/
+*          
+* Created:  10.01.2009 
+* 
+* Description:  Modified auth system based on redux_auth with extensive customization.  This is basically what Redux Auth 2 should be.  Original redux license is below.
+* Original Author name has been kept but that does not mean that the method has not been modified.
+* 
+*/
+
+	/**
+	 * Tables.
+	 **/
+	$config['tables']['groups']  = 'groups';
+	$config['tables']['users']   = 'users';
+	$config['tables']['meta']    = 'meta';
+	
+	/**
+	 * Site Title, example.com
+	 */
+	$config['site_title']		   = "ClusterCS";
+	
+	/**
+	 * Admin Email, admin@example.com
+	 */
+	$config['admin_email']		   = "admin@clustercs.com";
+	
+	/**
+	 * Default group, use name
+	 */
+	$config['default_group']       = 'members';
+	
+	/**
+	 * Default administrators group, use name
+	 */
+	$config['admin_group']         = 'admin';
+	 
+	/**
+	 * Meta table column you want to join WITH.
+	 * Joins from users.id
+	 **/
+	$config['join']                = 'user_id';
+	
+	/**
+	 * Columns in your meta table,
+	 * id not required.
+	 **/
+	$config['columns']             = array('first_name', 'last_name', 'company', 'phone');
+	
+	/**
+	 * A database column which is used to
+	 * login with.
+	 **/
+	$config['identity']            = 'email';
+		 
+	/**
+	 * Minimum Required Length of Password
+	 **/
+	$config['min_password_length'] = 8;
+	
+	/**
+	 * Maximum Allowed Length of Password
+	 **/
+	$config['max_password_length'] = 20;	
+
+	/**
+	 * Email Activation for registration
+	 **/
+	$config['email_activation']    = false;
+	
+	/**
+	 * Allow users to be remembered and enable auto-login
+	 **/
+	$config['remember_users']      = true;
+	
+	/**
+	 * How long to remember the user (seconds)
+	 **/
+	$config['user_expire']         = 86500;
+	
+	/**
+	 * Extend the users cookies everytime they auto-login
+	 **/
+	$config['user_extend_on_login'] = false;
+	
+	/**
+	 * Folder where email templates are stored.
+     * Default : auth/
+	 **/
+	$config['email_templates']     = 'user/email/';
+	
+	/**
+	 * activate Account Email Template
+     * Default : activate.tpl.php
+	 **/
+	$config['email_activate']   = 'activate.tpl.php';
+	
+	/**
+	 * Forgot Password Email Template
+     * Default : forgot_password.tpl.php
+	 **/
+	$config['email_forgot_password']   = 'forgot_password.tpl.php';
+
+	/**
+	 * Forgot Password Complete Email Template
+     * Default : new_password.tpl.php
+	 **/
+	$config['email_forgot_password_complete']   = 'new_password.tpl.php';
+	
+	/**
+	 * Approval for Updated Profile details
+     * Default : update_profile_approved.tpl.php
+	 **/
+	$config['update_profile_approved']   = 'update_profile_approved.tpl.php';
+	
+	/**
+	 * Denial for Updated Profile details
+     * Default : update_profile_denied.tpl.php
+	 **/
+	$config['update_profile_denied']   = 'update_profile_denied.tpl.php';
+	
+	/**
+	 * Salt Length
+	 **/
+	$config['salt_length'] = 10;
+
+	/**
+	 * Should the salt be stored in the database?
+	 * This will change your password encryption algorithm, 
+	 * default password, 'password', changes to 
+	 * fbaa5e216d163a02ae630ab1a43372635dd374c0 with default salt.
+	 **/
+	$config['store_salt'] = false;
+	
+	/**
+	 * Message Start Delimiter
+	 **/
+	$config['message_start_delimiter'] = '<p>';
+	
+	/**
+	 * Message End Delimiter
+	 **/
+	$config['message_end_delimiter'] = '</p>';
+	
+	/**
+	 * Error Start Delimiter
+	 **/
+	$config['error_start_delimiter'] = '<p>';
+	
+	/**
+	 * Error End Delimiter
+	 **/
+	$config['error_end_delimiter'] = '</p>';
+	
+/* End of file ion_auth.php */
+/* Location: ./system/application/config/ion_auth.php */

application/config/routes.php

 | would be loaded.
 */
 
-$route['default_controller'] = "welcome";
+$route['admin/([a-zA-Z_-]+)/(:any)'] = '$1/admin/$2';
+$route['admin/login'] = 'admin/login';
+$route['admin/logout'] = 'admin/logout';
+$route['admin/([a-zA-Z_-]+)'] = '$1/admin/index';
+$route['admin'] = 'admin'; 
+
+$route['default_controller'] = "page";
 
 
 /* End of file routes.php */
-/* Location: ./application/config/routes.php */
+/* Location: ./application/config/routes.php */

application/controllers/admin.php

+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+class Admin extends Admin_Controller {
+
+    function __construct() 
+    {
+        parent::__construct();
+    }
+    
+    function index()
+    {
+        $data['title'] = 'Store Admin'; 
+
+        $this->template->view('admin/index.php', $data);
+    }
+    
+}
+
+/* End of file page.php */
+/* Location: ./application/controllers/page.php */

application/controllers/welcome.php

-<?php
-
-class Welcome extends Controller {
-
-	function Welcome()
-	{
-		parent::Controller();	
-	}
-	
-	function index()
-	{
-		$this->load->view('welcome_message');
-	}
-}
-
-/* End of file welcome.php */
-/* Location: ./application/controllers/welcome.php */

application/core/Admin_Controller.php

+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Admin_Controller extends MY_Controller {
+
+    function Admin_Controller()
+    {
+        parent::MY_Controller();
+        
+        if (!$this->ion_auth->logged_in()) {
+            //redirect them to the login page
+            redirect('user/login', 'refresh');
+        }
+        elseif (!$this->ion_auth->is_admin()) {
+            //redirect them to the home page because they must be an administrator to view this
+            redirect('user', 'refresh');
+        }
+        
+        $this->template->set_template_name('admin');
+    }
+}

application/core/MY_Controller.php

+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+
+class MY_Controller extends Controller {
+
+    function MY_Controller()
+    {
+        parent::Controller();
+    }
+}

application/core/MY_Loader.php

+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+
+/* define a fall back language in-case the current language file is missing */
+define('FALLBACK_LANGUAGE', 'english');
+
+/**
+ * Modular Separation - PHP5
+ *
+ * Adapted from the CodeIgniter Core Classes
+ * @copyright	Copyright (c) 2006, EllisLab, Inc.
+ * @link		http://codeigniter.com
+ *
+ * Description:
+ * This library extends the CodeIgniter Loader class
+ * and adds features allowing use of modules within an application.
+ *
+ * Install this file as application/libraries/MY_Loader.php
+ *
+ * @copyright 	Copyright (c) Wiredesignz 2010-03-01
+ * @version 	2.0
+ * @modified	Phil Sturgeon
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * */
+class MY_Loader extends CI_Loader {
+
+	private $_module;
+	public static $APP;
+
+	public function __construct()
+	{
+		parent::__construct();
+		self::$APP = CI_Base::get_instance();
+		self::$APP->config = new MX_Config();
+		self::$APP->lang = new MX_Language();
+		$this->_module = self::$APP->router->fetch_module();
+	}
+
+	/** Load a module config file * */
+	public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
+	{
+		return self::$APP->config->load($file, $use_sections, $fail_gracefully, $this->_module);
+	}
+
+	/** Load the database drivers * */
+	public function database($params = '', $return = FALSE, $active_record = NULL)
+	{
+		if (class_exists('CI_DB', FALSE) AND $return == FALSE AND $active_record == NULL)
+			return;
+
+		require_once BASEPATH . 'database/DB' . EXT;
+
+		if ($return === TRUE)
+			return DB($params, $active_record);
+
+		self::$APP->db = DB($params, $active_record);
+		$this->_ci_assign_to_models();
+		return self::$APP->db;
+	}
+
+	/** Load a module helper * */
+	public function helper($helper)
+	{
+		if (is_array($helper))
+			return $this->helpers($helper);
+
+		if (isset($this->_ci_helpers[$helper]))
+			return;
+
+		list($path, $_helper) = Modules::find($helper . '_helper', $this->_module, 'helpers/');
+
+		if ($path === FALSE)
+			return parent::helper($helper);
+
+		Modules::load_file($_helper, $path);
+		$this->_ci_helpers[$_helper] = TRUE;
+	}
+
+	/** Load an array of helpers * */
+	public function helpers($helpers)
+	{
+		foreach ($helpers as $_helper)
+			$this->helper($_helper);
+	}
+
+	/** Load a module language file * */
+	public function language($langfile, $lang = '', $return = FALSE)
+	{
+		return self::$APP->lang->load($langfile, $lang, $return, $this->_module);
+	}
+
+	/** Load a module library * */
+	public function library($library, $params = NULL, $object_name = NULL)
+	{
+
+		// If it's an array, load em all
+		if (is_array($library))
+		{
+			foreach ($library as $lib)
+			{
+				$this->library($lib);
+			}
+			return;
+		}
+
+		$class = strtolower(end(explode('/', $library)));
+
+		if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class])
+		{
+			return self::$APP->$_alias;
+		}
+
+		($_alias = $object_name) OR $_alias = $class;
+		list($path, $_library) = Modules::find($library, $this->_module, 'libraries/');
+
+		/* load library config file as params */
+		if ($params == NULL)
+		{
+			list($path2, $file) = Modules::find($_alias, $this->_module, 'config/');
+			($path2) AND $params = Modules::load_file($file, $path2, 'config');
+		}
+
+		if ($path === FALSE)
+		{
+			parent::_ci_load_class($library, $params, $object_name);
+			$_alias = $this->_ci_classes[$class];
+		}
+
+		else
+		{
+			Modules::load_file($_library, $path);
+			$library = ucfirst($_library);
+			self::$APP->$_alias = new $library($params);
+			$this->_ci_classes[$class] = $_alias;
+		}
+
+		$this->_ci_assign_to_models();
+		return self::$APP->$_alias;
+	}
+
+	/** Load a module model * */
+	public function model($model, $object_name = NULL, $connect = FALSE)
+	{
+		if (is_array($model))
+		{
+			return $this->models($model);
+		}
+
+		($_alias = $object_name) OR $_alias = end(explode('/', $model));
+
+		if (in_array($_alias, $this->_ci_models, TRUE))
+		{
+			return self::$APP->$_alias;
+		}
+
+		list($path, $model) = Modules::find($model, $this->_module, 'models/');
+
+		if(CI_VERSION < 2)
+		{
+			class_exists('Model', FALSE) OR load_class('Model', FALSE);
+		}
+
+		else
+		{
+			class_exists('Model', FALSE) OR load_class('Model', 'core');
+		}
+
+		if ($connect !== FALSE)
+		{
+			if ($connect === TRUE)
+			{
+				$connect = '';
+			}
+
+			$this->database($connect, FALSE, TRUE);
+		}
+
+		Modules::load_file($model, $path);
+		$model = ucfirst($model);
+		self::$APP->$_alias = new $model();
+
+		$this->_ci_assign_to_models();
+		$this->_ci_models[] = $_alias;
+
+		return self::$APP->$_alias;
+	}
+
+	/** Load an array of models * */
+	function models($models)
+	{
+		foreach ($models as $_model)
+		{
+			$this->model($_model);
+		}
+	}
+
+	/** Load a module plugin * */
+	public function plugin($plugin)
+	{
+		if (is_array($plugin))
+		{
+			return $this->plugins($plugin);
+		}
+
+		if (isset($this->_ci_plugins[$plugin]))
+		{
+			return;
+		}
+
+		list($path, $_plugin) = Modules::find($plugin . '_pi', $this->_module, 'plugins/');
+
+		if ($path === FALSE)
+		{
+			return parent::plugin($plugin);
+		}
+
+		Modules::load_file($_plugin, $path);
+		$this->_ci_plugins[$plugin] = TRUE;
+	}
+
+	/** Load an array of plugins * */
+	function plugins($plugins)
+	{
+		foreach ($plugins as $_plugin)
+		{
+			$this->plugin($_plugin);
+		}
+	}
+
+	/** Load a module view * */
+	public function view($view, $vars = array(), $return = FALSE)
+	{
+		list($path, $view) = Modules::find($view, $this->_module, 'views/');
+		$this->_ci_view_path = $path;
+		return parent::_ci_load(array('_ci_view' => $view, '_ci_vars' => parent::_ci_object_to_array($vars), '_ci_return' => $return));
+	}
+
+	/** Assign libraries to models * */
+	public function _ci_assign_to_models()
+	{
+		foreach ($this->_ci_models as $model)
+		{
+			self::$APP->$model->_assign_libraries();
+		}
+	}
+
+	/** Autload items * */
+	public function _ci_autoloader()
+	{
+		parent::_ci_autoloader();
+
+		if ($this->_module)
+		{
+			$autoload = array();
+
+			list($path, $file) = Modules::find('autoload', $this->_module, 'config/');
+
+			/* module autoload file */
+			if ($path != FALSE)
+			{
+				$autoload = array_merge(Modules::load_file($file, $path, 'autoload'), $autoload);
+			}
+
+			/* nothing to do */
+			if (count($autoload) == 0)
+			{
+				return;
+			}
+
+			/* autoload config */
+			if (isset($autoload['config']))
+			{
+				foreach ($autoload['config'] as $key => $val)
+				{
+					$this->config($val);
+				}
+			}
+
+			/* autoload helpers, plugins, languages */
+			foreach (array('helper', 'plugin', 'language') as $type)
+			{
+				if (isset($autoload[$type]))
+				{
+					foreach ($autoload[$type] as $item)
+					{
+						$this->$type($item);
+					}
+				}
+			}
+
+			/* autoload database & libraries */
+			if (isset($autoload['libraries']))
+			{
+				if (in_array('database', $autoload['libraries']))
+				{
+					/* autoload database */
+					if (!$db = self::$APP->config->item('database'))
+					{
+						$db['params'] = 'default';
+						$db['active_record'] = TRUE;
+					}
+					$this->database($db['params'], FALSE, $db['active_record']);
+					$autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
+				}
+
+				/* autoload libraries */
+				foreach ($autoload['libraries'] as $library)
+				{
+					$this->library($library);
+				}
+			}
+
+			/* autoload models */
+			if (isset($autoload['model']))
+			{
+				foreach ($autoload['model'] as $model => $alias)
+				{
+					(is_numeric($model)) ? $this->model($alias) : $this->model($model, $alias);
+				}
+			}
+		}
+	}
+
+}
+
+class MX_Config extends CI_Config {
+
+	public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = NULL)
+	{
+		($file == '') AND $file = 'config';
+
+		if (in_array($file, $this->is_loaded, TRUE))
+		{
+			return $this->item($file);
+		}
+
+		$_module || $_module = MY_Loader::$APP->router->fetch_module();
+		list($path, $file) = Modules::find($file, $_module, 'config/');
+
+		if ($path === FALSE)
+		{
+			parent::load($file, $use_sections, $fail_gracefully);
+			return $this->item($file);
+		}
+
+		if ($config = Modules::load_file($file, $path, 'config'))
+		{
+
+			/* reference to the config array */
+			$current_config = & $this->config;
+
+			if ($use_sections === TRUE)
+			{
+				if (isset($current_config[$file]))
+				{
+					$current_config[$file] = array_merge($current_config[$file], $config);
+				}
+
+				else
+				{
+					$current_config[$file] = $config;
+				}
+			}
+
+			else
+			{
+				$current_config = array_merge($current_config, $config);
+			}
+
+			$this->is_loaded[] = $file;
+			unset($config);
+			return $this->item($file);
+		}
+	}
+
+}
+
+if(CI_VERSION < 2)
+{
+	class CI_Lang extends CI_Language {}
+}
+
+class MX_Language extends CI_Lang
+{
+	public function load($langfile, $lang = '', $return = FALSE, $_module = NULL)
+	{
+		if (is_array($langfile))
+		{
+			return $this->load_multi($langfile);
+		}
+
+		$deft_lang = MY_Loader::$APP->config->item('language');
+		$idiom = ($lang == '') ? $deft_lang : $lang;
+
+		if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE))
+		{
+			return $this->language;
+		}
+
+		$_module || $_module = MY_Loader::$APP->router->fetch_module();
+		list($path, $_langfile) = Modules::find($langfile.'_lang', $_module, 'language/', $idiom);
+
+		// Falls back to a default language if the current language file is missing.
+		if ($path === FALSE && FALLBACK_LANGUAGE)
+		{
+			list($path, $_langfile) = Modules::find($langfile.'_lang', $_module, 'language/', FALLBACK_LANGUAGE);
+		}
+
+		if ($path === FALSE)
+		{
+			if (file_exists(APPPATH . 'language/' . $idiom . '/' . $langfile . '_lang.php'))
+			{
+				if ($lang = parent::load($langfile, $lang, $return))
+				{
+					return $lang;
+				}
+			}
+			else
+			{
+				if ($lang = parent::load($langfile, FALLBACK_LANGUAGE, $return))
+				{
+					return $lang;
+				}
+			}
+		}
+
+		else
+		{
+			if($lang = Modules::load_file($_langfile, $path, 'lang'))
+			{
+				if ($return) return $lang;
+				$this->language = array_merge($this->language, $lang);
+				$this->is_loaded[] = $langfile.'_lang'.EXT;
+				unset($lang);
+			}
+		}
+
+		return $this->language;
+	}
+
+	/** Load an array of language files * */
+	private function load_multi($languages)
+	{
+		foreach ($languages as $_langfile)
+		{
+			$this->load($_langfile);
+		}
+	}
+
+}

application/core/MY_Router.php

+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+
+/* PHP5 spl_autoload */
+spl_autoload_register('Modules::autoload');
+
+/* define the module locations and offset */
+Modules::$locations = array(
+	APPPATH . 'modules/' => '../modules/'
+);
+
+/**
+ * Modular Separation - PHP5
+ *
+ * Adapted from the CodeIgniter Core Classes
+ * @copyright	Copyright (c) 2006, EllisLab, Inc.
+ * @link		http://codeigniter.com
+ *
+ * Description:
+ * This library extends the CodeIgniter router class.
+ *
+ * Install this file as application/libraries/MY_Router.php
+ *
+ * @copyright 	Copyright (c) Wiredesignz 2010-03-01
+ * @version 	2.1
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * */
+class MY_Router extends CI_Router {
+
+	private $module;
+
+	public function fetch_module()
+	{
+		return $this->module;
+	}
+
+	public function _validate_request($segments)
+	{
+
+		/* locate module controller */
+		if ($located = $this->locate($segments))
+		{
+			return $located;
+		}
+
+		/* use a default 404 controller */
+		if (isset($this->routes['404']) AND $segments = explode('/', $this->routes['404']))
+		{
+			if ($located = $this->locate($segments))
+				return $located;
+		}
+
+		/* no controller found */
+		show_404();
+	}
+
+	/** Locate the controller * */
+	public function locate($segments)
+	{
+		$this->module = '';
+		$this->directory = '';
+		$ext = $this->config->item('controller_suffix') . EXT;
+
+		/* use module route if available */
+		if (isset($segments[0]) AND $routes = Modules::parse_routes($segments[0], implode('/', $segments)))
+		{
+			$segments = $routes;
+		}
+
+		/* get the segments array elements */
+		list($module, $directory, $controller) = array_pad($segments, 3, NULL);
+
+		foreach (Modules::$locations as $location => $offset)
+		{
+			/* module exists? */
+			if (is_dir($source = $location . $module . '/controllers/'))
+			{
+				$this->module = $module;
+				$this->directory = $offset . $module . '/controllers/';
+
+				/* module sub-controller exists? */
+				if ($directory AND is_file($source . $directory . $ext))
+				{
+					return array_slice($segments, 1);
+				}
+
+				/* module sub-directory exists? */
+				if ($directory AND is_dir($module_subdir = $source . $directory . '/'))
+				{
+					$this->directory .= $directory . '/';
+
+					/* module sub-directory controller exists? */
+					if (is_file($module_subdir . $directory . $ext))
+					{
+						return array_slice($segments, 1);
+					}
+
+					/* module sub-directory sub-controller exists? */
+					if ($controller AND is_file($module_subdir . $controller . $ext))
+					{
+						return array_slice($segments, 2);
+					}
+				}
+
+				/* module controller exists? */
+				if (is_file($source . $module . $ext))
+				{
+					return $segments;
+				}
+			}
+		}
+
+		/* application controller exists? */
+		if (is_file(APPPATH . 'controllers/' . $module . $ext))
+		{
+			return $segments;
+		}
+
+		/* application sub-directory controller exists? */
+		if (is_file(APPPATH . 'controllers/' . $module . '/' . $directory . $ext))
+		{
+			$this->directory = $module . '/';
+			return array_slice($segments, 1);
+		}
+	}
+
+	public function set_class($class)
+	{
+		$this->class = $class . $this->config->item('controller_suffix');
+	}
+
+}
+
+class Modules {
+
+	public static $routes, $locations;
+
+	/** Library base class autoload * */
+	public static function autoload($class)
+	{
+
+		/* don't autoload CI_ or MY_ prefixed classes */
+		if (strstr($class, 'CI_') OR strstr($class, 'MY_'))
+		{
+			return;
+		}
+
+		if (is_file($location = APPPATH . 'libraries/' . $class . EXT))
+		{
+			include_once $location;
+		}
+	}
+
+	/** Load a module file * */
+	public static function load_file($file, $path, $type = 'other', $result = TRUE)
+	{
+		$file = str_replace(EXT, '', $file);
+		$location = $path . $file . EXT;
+
+		if ($type === 'other')
+		{
+
+			if (class_exists($file, FALSE))
+			{
+				log_message('debug', "File already loaded: {$location}");
+				return $result;
+			}
+
+			include_once $location;
+		}
+
+		else
+		{
+
+			/* load config or language array */
+			include $location;
+
+			if (!isset($$type) OR !is_array($$type))
+				show_error("{$location} does not contain a valid {$type} array");
+
+			$result = $$type;
+		}
+
+		log_message('debug', "File loaded: {$location}");
+
+		return $result;
+	}
+
+	/**
+	 * Find a file
+	 * Scans for files located within modules directories.
+	 * Also scans application directories for models and views.
+	 * Generates fatal error if file not found.
+	 * */
+	public static function find($file, $module, $base, $lang = '')
+	{
+
+		$segments = explode('/', $file);
+
+		$file = array_pop($segments);
+		if ($base == 'libraries/')
+			$file = ucfirst($file);
+		else if ($base == 'models/')
+			$file = strtolower($file);
+		$file_ext = strpos($file, '.') ? $file : $file . EXT;
+
+		$lang && $lang .= '/';
+		$path = ltrim(implode('/', $segments) . '/', '/');
+		$module ? $modules[$module] = $path : $modules = array();
+
+		if (!empty($segments))
+		{
+			$modules[array_shift($segments)] = ltrim(implode('/', $segments) . '/', '/');
+		}
+
+		foreach (Modules::$locations as $location => $offset)
+		{
+
+			foreach ($modules as $module => $subpath)
+			{
+				$fullpath = $location . $module . '/' . $base . $lang . $subpath;
+				if (is_file($fullpath . $file_ext))
+					return array($fullpath, $file);
+			}
+		}
+
+		/* is the file in an application directory? */
+		if ($base == 'views/' OR $base == 'models/')
+		{
+			if (is_file(APPPATH . $base . $path . $file_ext))
+				return array(APPPATH . $base . $path, $file);
+			show_error("Unable to locate the file: {$path}{$file_ext}");
+		}
+
+		return array(FALSE, $file);
+	}
+
+	/** Parse module routes * */
+	public static function parse_routes($module, $uri)
+	{
+
+		/* load the route file */
+		if (!isset(self::$routes[$module]))
+		{
+			if (list($path) = self::find('routes', $module, 'config/') AND $path)
+				self::$routes[$module] = self::load_file('routes', $path, 'route');
+		}
+
+		if (!isset(self::$routes[$module]))
+		{
+			return;
+		}
+
+		/* parse module routes */
+		foreach (self::$routes[$module] as $key => $val)
+		{
+
+			$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
+
+			if (preg_match('#^' . $key . '$#', $uri))
+			{
+				if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE)
+				{
+					$val = preg_replace('#^' . $key . '$#', $val, $uri);
+				}
+
+				return explode('/', $module . '/' . $val);
+			}
+		}
+	}
+
+}

application/core/Public_Controller.php

+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Public_Controller extends MY_Controller
+{
+    function __construct()
+    {
+        parent::__construct();
+    }
+}

application/libraries/Ion_auth.php

+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+* Name:  Ion Auth
+*
+* Author: Ben Edmunds
+* 		  ben.edmunds@gmail.com
+*         @benedmunds
+*
+* Added Awesomeness: Phil Sturgeon
+*
+* Location: http://github.com/benedmunds/CodeIgniter-Ion-Auth
+*
+* Created:  10.01.2009
+*
+* Description:  Modified auth system based on redux_auth with extensive customization.  This is basically what Redux Auth 2 should be.  Original redux license is below.
+* Original Author name has been kept but that does not mean that the method has not been modified.
+*
+* Requirements: PHP5 or above
+*
+*/
+
+class Ion_auth
+{
+	/**
+	 * CodeIgniter global
+	 *
+	 * @var string
+	 **/
+	protected $ci;
+
+	/**
+	 * account status ('not_activated', etc ...)
+	 *
+	 * @var string
+	 **/
+	protected $status;
+
+	/**
+	 * message (uses lang file)
+	 *
+	 * @var string
+	 **/
+	protected $messages;
+
+	/**
+	 * error message (uses lang file)
+	 *
+	 * @var string
+	 **/
+	protected $errors = array();
+
+	/**
+	 * error start delimiter
+	 *
+	 * @var string
+	 **/
+	protected $error_start_delimiter;
+
+	/**
+	 * error end delimiter
+	 *
+	 * @var string
+	 **/
+	protected $error_end_delimiter;
+
+	/**
+	 * extra where
+	 *
+	 * @var array
+	 **/
+	public $_extra_where = array();
+
+	/**
+	 * extra set
+	 *
+	 * @var array
+	 **/
+	public $_extra_set = array();
+
+	/**
+	 * __construct
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function __construct()
+	{
+		$this->ci =& get_instance();
+		$this->ci->load->config('ion_auth', TRUE);
+		$this->ci->load->library('email');
+		$this->ci->load->library('session');
+		$this->ci->lang->load('ion_auth');
+		$this->ci->load->model('ion_auth_model');
+		$this->ci->load->helper('cookie');
+
+		$this->messages = array();
+		$this->errors = array();
+		$this->message_start_delimiter = $this->ci->config->item('message_start_delimiter', 'ion_auth');
+		$this->message_end_delimiter   = $this->ci->config->item('message_end_delimiter', 'ion_auth');
+		$this->error_start_delimiter   = $this->ci->config->item('error_start_delimiter', 'ion_auth');
+		$this->error_end_delimiter     = $this->ci->config->item('error_end_delimiter', 'ion_auth');
+
+		//auto-login the user if they are remembered
+		if (!$this->logged_in() && get_cookie('identity') && get_cookie('remember_code'))
+		{
+			$this->ci->ion_auth_model->login_remembered_user();
+		}
+	}
+
+	/**
+	 * __call
+	 *
+	 * Acts as a simple way to call model methods without loads of stupid alias'
+	 *
+	 **/
+	public function __call($method, $arguments)
+	{
+		if( !method_exists( $this->ci->ion_auth_model, $method) )
+		{
+			throw new Exception('Undefined method Ion_auth::' . $method . '() called');
+		}
+
+		return call_user_func_array( array($this->ci->ion_auth_model, $method), $arguments);
+	}
+
+	/**
+	 * Activate user.
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function activate($id, $code=false)
+	{
+		if ($this->ci->ion_auth_model->activate($id, $code))
+		{
+			$this->set_message('activate_successful');
+			return TRUE;
+		}
+
+		$this->set_error('activate_unsuccessful');
+		return FALSE;
+	}
+
+	/**
+	 * Deactivate user.
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function deactivate($id)
+	{
+		if ($this->ci->ion_auth_model->deactivate($id))
+		{
+			$this->set_message('deactivate_successful');
+			return TRUE;
+		}
+
+		$this->set_error('deactivate_unsuccessful');
+		return FALSE;
+	}
+
+	/**
+	 * Change password.
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function change_password($identity, $old, $new)
+	{
+        if ($this->ci->ion_auth_model->change_password($identity, $old, $new))
+        {
+        	$this->set_message('password_change_successful');
+        	return TRUE;
+        }
+
+		$this->set_error('password_change_unsuccessful');
+        return FALSE;
+	}
+
+	/**
+	 * forgotten password feature
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function forgotten_password($email)
+	{
+		if ( $this->ci->ion_auth_model->forgotten_password($email) )
+		{
+			// Get user information
+			$user = $this->get_user_by_email($email);
+
+			$data = array(
+				'identity'		=> $user->{$this->ci->config->item('identity', 'ion_auth')},
+				'forgotten_password_code' => $user->forgotten_password_code
+			);
+
+			$message = $this->ci->load->view($this->ci->config->item('email_templates', 'ion_auth').$this->ci->config->item('email_forgot_password', 'ion_auth'), $data, true);
+			$this->ci->email->clear();
+			$config['mailtype'] = "html";
+			$this->ci->email->initialize($config);
+			$this->ci->email->set_newline("\r\n");
+			$this->ci->email->from($this->ci->config->item('admin_email', 'ion_auth'), $this->ci->config->item('site_title', 'ion_auth'));
+			$this->ci->email->to($user->email);
+			$this->ci->email->subject($this->ci->config->item('site_title', 'ion_auth') . ' - Forgotten Password Verification');
+			$this->ci->email->message($message);
+
+			if ($this->ci->email->send())
+			{
+				$this->set_error('forgot_password_successful');
+				return TRUE;
+			}
+			else
+			{
+				$this->set_error('forgot_password_unsuccessful');
+				return FALSE;
+			}
+		}
+		else
+		{
+			$this->set_error('forgot_password_unsuccessful');
+			return FALSE;
+		}
+	}
+
+	/**
+	 * forgotten_password_complete
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function forgotten_password_complete($code)
+	{
+	    $identity     = $this->ci->config->item('identity', 'ion_auth');
+	    $profile      = $this->ci->ion_auth_model->profile($code, true); //pass the code to profile
+
+            if (!is_object($profile)) 
+            {
+                $this->set_error('password_change_unsuccessful');
+                return FALSE;
+            }
+
+		$new_password = $this->ci->ion_auth_model->forgotten_password_complete($code, $profile->salt);
+
+		if ($new_password)
+		{
+			$data = array(
+				'identity'     => $profile->{$identity},
+				'new_password' => $new_password
+			);
+
+			$message = $this->ci->load->view($this->ci->config->item('email_templates', 'ion_auth').$this->ci->config->item('email_forgot_password_complete', 'ion_auth'), $data, true);
+
+			$this->ci->email->clear();
+			$config['mailtype'] = "html";
+			$this->ci->email->initialize($config);
+			$this->ci->email->set_newline("\r\n");
+			$this->ci->email->from($this->ci->config->item('admin_email', 'ion_auth'), $this->ci->config->item('site_title', 'ion_auth'));
+			$this->ci->email->to($profile->email);
+			$this->ci->email->subject($this->ci->config->item('site_title', 'ion_auth') . ' - New Password');
+			$this->ci->email->message($message);
+
+			if ($this->ci->email->send())
+			{
+				$this->set_error('password_change_successful');
+				return TRUE;
+			}
+			else
+			{
+				$this->set_error('password_change_unsuccessful');
+				return FALSE;
+			}
+		}
+
+		$this->set_error('password_change_unsuccessful');
+		return FALSE;
+	}
+
+	/**
+	 * register
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function register($username, $password, $email, $additional_data, $group_name = false) //need to test email activation
+	{
+	    $email_activation = $this->ci->config->item('email_activation', 'ion_auth');
+
+		if (!$email_activation)
+		{
+			if ($this->ci->ion_auth_model->register($username, $password, $email, $additional_data, $group_name))
+			{
+				$this->set_message('account_creation_successful');
+				return TRUE;
+			}
+			else
+			{
+				$this->set_error('account_creation_unsuccessful');
+				return FALSE;
+			}
+		}
+		else
+		{
+			$id = $this->ci->ion_auth_model->register($username, $password, $email, $additional_data, $group_name);
+
+			if (!$id)
+			{
+				$this->set_error('account_creation_unsuccessful');
+				return FALSE;
+			}
+
+			$deactivate = $this->ci->ion_auth_model->deactivate($id);
+
+			if (!$deactivate)
+			{
+				$this->set_error('deactivate_unsuccessful');
+				return FALSE;
+			}
+
+			$activation_code = $this->ci->ion_auth_model->activation_code;
+			$identity        = $this->ci->config->item('identity', 'ion_auth');
+	    	$user            = $this->ci->ion_auth_model->get_user($id)->row();
+
+			$data = array(
+				'identity'   => $user->{$identity},
+				'id'         => $user->id,
+        		'email'      => $email,
+        		'activation' => $activation_code,
+			);
+
+			$message = $this->ci->load->view($this->ci->config->item('email_templates', 'ion_auth').$this->ci->config->item('email_activate', 'ion_auth'), $data, true);
+
+			$this->ci->email->clear();
+			$config['mailtype'] = "html";
+			$this->ci->email->initialize($config);
+			$this->ci->email->set_newline("\r\n");
+			$this->ci->email->from($this->ci->config->item('admin_email', 'ion_auth'), $this->ci->config->item('site_title', 'ion_auth'));
+			$this->ci->email->to($email);
+			$this->ci->email->subject($this->ci->config->item('site_title', 'ion_auth') . ' - Account Activation');
+			$this->ci->email->message($message);
+
+			if ($this->ci->email->send() == TRUE)
+			{
+				$this->set_message('activation_email_successful');
+				return TRUE;
+			}
+
+			$this->set_error('activation_email_unsuccessful');
+			return FALSE;
+		}
+	}
+
+	/**
+	 * login
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function login($identity, $password, $remember=false)
+	{
+		if ($this->ci->ion_auth_model->login($identity, $password, $remember))
+		{
+			$this->set_message('login_successful');
+			return TRUE;
+		}
+
+		$this->set_error('login_unsuccessful');
+		return FALSE;
+	}
+
+	/**
+	 * logout
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function logout()
+	{
+	    $identity = $this->ci->config->item('identity', 'ion_auth');
+	    $this->ci->session->unset_userdata($identity);
+	    $this->ci->session->unset_userdata('group');
+	    $this->ci->session->unset_userdata('id');
+	    $this->ci->session->unset_userdata('user_id');
+
+	    //delete the remember me cookies if they exist
+	    if (get_cookie('identity'))
+	    {
+	    	delete_cookie('identity');
+	    }
+		if (get_cookie('remember_code'))
+	    {
+	    	delete_cookie('remember_code');
+	    }
+
+		$this->ci->session->sess_destroy();
+
+		$this->set_message('logout_successful');
+		return TRUE;
+	}
+
+	/**
+	 * logged_in
+	 *
+	 * @return bool
+	 * @author Mathew
+	 **/
+	public function logged_in()
+	{
+	    $identity = $this->ci->config->item('identity', 'ion_auth');
+
+		return (bool) $this->ci->session->userdata($identity);
+	}
+
+	/**
+	 * is_admin
+	 *
+	 * @return bool
+	 * @author Ben Edmunds
+	 **/
+	public function is_admin()
+	{
+	    $admin_group = $this->ci->config->item('admin_group', 'ion_auth');
+	    $user_group  = $this->ci->session->userdata('group');
+
+	    return $user_group == $admin_group;
+	}
+
+	/**
+	 * is_group
+	 *
+	 * @return bool
+	 * @author Phil Sturgeon
+	 **/
+	public function is_group($check_group)
+	{
+	    $user_group = $this->ci->session->userdata('group');
+
+	    if(is_array($check_group))
+	    {
+	    	return in_array($user_group, $check_group);
+	    }
+
+	    return $user_group == $check_group;
+	}
+
+	/**
+	 * Profile
+	 *
+	 * @return void
+	 * @author Mathew
+	 **/
+	public function profile()
+	{
+	    $session  = $this->ci->config->item('identity', 'ion_auth');
+	    $identity = $this->ci->session->userdata($session);
+
+	    return $this->ci->ion_auth_model->profile($identity);
+	}
+
+	/**
+	 * Get Users
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_users($group_name = false)
+	{
+	    return $this->ci->ion_auth_model->get_users($group_name)->result();
+	}
+
+	/**
+	 * Get Users Array
+	 *
+	 * @return array Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_users_array($group_name = false)
+	{
+	    return $this->ci->ion_auth_model->get_users($group_name)->result_array();
+	}
+
+	/**
+	 * Get Newest Users
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_newest_users($limit = 10)
+	{
+	    return $this->ci->ion_auth_model->get_newest_users($limit)->result();
+	}
+
+	/**
+	 * Get Newest Users Array
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_newest_users_array($limit = 10)
+	{
+	    return $this->ci->ion_auth_model->get_newest_users($limit)->result_array();
+	}
+
+	/**
+	 * Get Active Users
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_active_users($group_name = false)
+	{
+	    return $this->ci->ion_auth_model->get_active_users($group_name)->result();
+	}
+
+	/**
+	 * Get Active Users Array
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_active_users_array($group_name = false)
+	{
+	    return $this->ci->ion_auth_model->get_active_users($group_name)->result_array();
+	}
+
+	/**
+	 * Get In-Active Users
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_inactive_users($group_name = false)
+	{
+	    return $this->ci->ion_auth_model->get_inactive_users($group_name)->result();
+	}
+
+	/**
+	 * Get In-Active Users Array
+	 *
+	 * @return object Users
+	 * @author Ben Edmunds
+	 **/
+	public function get_inactive_users_array($group_name = false)
+	{
+	    return $this->ci->ion_auth_model->get_inactive_users($group_name)->result_array();
+	}
+
+	/**
+	 * Get User
+	 *
+	 * @return object User
+	 * @author Ben Edmunds
+	 **/
+	public function get_user($id=false)
+	{
+	    return $this->ci->ion_auth_model->get_user($id)->row();
+	}
+
+	/**
+	 * Get User by Email
+	 *
+	 * @return object User
+	 * @author Ben Edmunds
+	 **/
+	public function get_user_by_email($email)
+	{
+	    return $this->ci->ion_auth_model->get_user_by_email($email)->row();
+	}
+
+	/**
+	 * Get User as Array
+	 *
+	 * @return array User
+	 * @author Ben Edmunds
+	 **/
+	public function get_user_array($id=false)
+	{
+	    return $this->ci->ion_auth_model->get_user($id)->row_array();
+	}
+
+
+	/**
+	 * update_user
+	 *
+	 * @return void
+	 * @author Phil Sturgeon
+	 **/
+	public function update_user($id, $data)
+	{
+		 if ($this->ci->ion_auth_model->update_user($id, $data))
+		 {
+		 	$this->set_message('update_successful');
+		 	return TRUE;
+		 }
+
+		$this->set_error('update_unsuccessful');
+		return FALSE;
+	}
+
+
+	/**
+	 * delete_user
+	 *
+	 * @return void
+	 * @author Phil Sturgeon
+	 **/
+	public function delete_user($id)
+	{
+		 if ($this->ci->ion_auth_model->delete_user($id))
+		 {
+		 	$this->set_message('delete_successful');
+		 	return TRUE;
+		 }
+
+		$this->set_error('delete_unsuccessful');
+		return FALSE;
+	}
+
+
+	/**
+	 * extra_where
+	 *
+	 * Crazy function that allows extra where field to be used for user fetching/unique checking etc.
+	 * Basically this allows users to be unique based on one other thing than the identifier which is helpful
+	 * for sites using multiple domains on a single database.
+	 *
+	 * @return void
+	 * @author Phil Sturgeon
+	 **/
+	public function extra_where()
+	{
+		$where =& func_get_args();
+
+		$this->_extra_where = count($where) == 1 ? $where[0] : array($where[0] => $where[1]);
+	}
+
+	/**
+	 * extra_set
+	 *
+	 * Set your extra field for registration
+	 *
+	 * @return void
+	 * @author Phil Sturgeon
+	 **/
+	public function extra_set()
+	{
+		$set =& func_get_args();
+
+		$this->_extra_set = count($set) == 1 ? $set[0] : array($set[0] => $set[1]);
+	}
+
+	/**
+	 * set_message_delimiters
+	 *
+	 * Set the message delimiters
+	 *
+	 * @return void
+	 * @author Ben Edmunds
+	 **/
+	public function set_message_delimiters($start_delimiter, $end_delimiter)
+	{
+		$this->message_start_delimiter = $start_delimiter;
+		$this->message_end_delimiter   = $end_delimiter;
+
+		return TRUE;
+	}
+
+	/**
+	 * set_error_delimiters
+	 *
+	 * Set the error delimiters
+	 *
+	 * @return void
+	 * @author Ben Edmunds
+	 **/
+	public function set_error_delimiters($start_delimiter, $end_delimiter)
+	{
+		$this->error_start_delimiter = $start_delimiter;
+		$this->error_end_delimiter   = $end_delimiter;
+
+		return TRUE;
+	}
+
+	/**
+	 * set_message
+	 *
+	 * Set a message
+	 *
+	 * @return void
+	 * @author Ben Edmunds
+	 **/
+	public function set_message($message)
+	{
+		$this->messages[] = $message;
+
+		return $message;
+	}
+
+	/**
+	 * messages
+	 *
+	 * Get the messages
+	 *
+	 * @return void
+	 * @author Ben Edmunds
+	 **/
+	public function messages()
+	{
+		$_output = '';
+		foreach ($this->messages as $message)
+		{
+			$_output .= $this->message_start_delimiter . $this->ci->lang->line($message) . $this->message_end_delimiter;