<?php
// namespace core;
// require('core/config.php');

/* Run autoloader */
spl_autoload_register('autoloader');
/** 
* This will pick up all need classes and include/register the appropriately for us 
*/
function autoloader($class) {

	// error_log($class);
	$filename = CONTROLLER_PATH.strtolower($class).".php";
	if(file_exists($filename)){
		// error_log($filename);
		require $filename;
	} 

	$filename = CORE_PATH.strtolower($class).".php";
	if(file_exists($filename)){
		// error_log($filename);
		require $filename;
	}

	$filename = HELPER_PATH.strtolower($class).".php";
	if(file_exists($filename)){
		// error_log($filename);
		require $filename;
	}
	
	$filename = MODEL_PATH.strtolower($class).".php";
	if(file_exists($filename)){
		// error_log($filename);
		require $filename;
	}
}

//require('core/config.php');
/* "OLD FASHION" way.. */
// require 'helpers/database.php';
// require 'core/cookie.php';
// require 'helpers/url.php';
// require 'core/logger.php';
// require 'core/router.php';
// require 'core/view.php';
// require 'core/model.php';
// require 'core/auth.php';
// require 'core/controller.php';
// require 'core/error.php';
// require 'helpers/session.php';