2015-08-28 23:43:35 -05:00
|
|
|
<?php
|
2016-02-02 10:53:32 -06:00
|
|
|
|
|
|
|
// Used by the debug toolbar. Do not remove.
|
|
|
|
$startMemory = memory_get_usage();
|
2016-03-28 23:27:23 -05:00
|
|
|
$startTime = microtime(true);
|
2016-02-02 10:53:32 -06:00
|
|
|
|
2016-04-12 09:36:57 -05:00
|
|
|
$useKint = false;
|
|
|
|
|
2015-08-28 23:43:35 -05:00
|
|
|
/*
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
* APPLICATION ENVIRONMENT
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* You can load different configurations depending on your
|
|
|
|
* current environment. Setting the environment also influences
|
|
|
|
* things like logging and error reporting.
|
|
|
|
*
|
|
|
|
* This can be set to anything, but default usage is:
|
|
|
|
*
|
|
|
|
* development
|
|
|
|
* testing
|
|
|
|
* production
|
|
|
|
*
|
|
|
|
* NOTE: If you change these, also change the error_reporting() code below
|
|
|
|
*/
|
2016-04-29 21:33:36 -05:00
|
|
|
|
|
|
|
// running under Continuous Integration server?
|
|
|
|
if (getenv('CI') !== false)
|
|
|
|
{
|
|
|
|
define('ENVIRONMENT', 'testing');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
|
|
|
|
}
|
2015-08-28 23:43:35 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
* ERROR REPORTING
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Different environments will require different levels of error reporting.
|
|
|
|
* By default development will show errors but testing and live will hide them.
|
|
|
|
*/
|
|
|
|
switch (ENVIRONMENT)
|
|
|
|
{
|
|
|
|
case 'development':
|
2016-02-29 00:17:07 -06:00
|
|
|
case 'testing':
|
2015-08-28 23:43:35 -05:00
|
|
|
error_reporting(-1);
|
|
|
|
ini_set('display_errors', 1);
|
2016-02-04 21:54:40 -06:00
|
|
|
define('CI_DEBUG', 1);
|
2016-03-29 22:30:05 +09:00
|
|
|
define('SHOW_DEBUG_BACKTRACE', TRUE);
|
2016-04-12 09:36:57 -05:00
|
|
|
$useKint = true;
|
2015-08-28 23:43:35 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'production':
|
|
|
|
ini_set('display_errors', 0);
|
|
|
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
2016-02-04 21:54:40 -06:00
|
|
|
define('CI_DEBUG', 0);
|
2015-08-28 23:43:35 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2015-08-28 23:43:58 -05:00
|
|
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
2015-08-28 23:43:35 -05:00
|
|
|
echo 'The application environment is not set correctly.';
|
|
|
|
exit(1); // EXIT_ERROR
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
* SYSTEM FOLDER NAME
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* This variable must contain the name of your "system" folder.
|
|
|
|
* Include the path if the folder is not in the same directory
|
|
|
|
* as this file.
|
|
|
|
*/
|
|
|
|
$system_path = 'system';
|
|
|
|
|
|
|
|
/*
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
* APPLICATION FOLDER NAME
|
|
|
|
*---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* If you want this front controller to use a different "application"
|
|
|
|
* folder than the default one you can set its name here. The folder
|
2016-01-14 09:09:41 -06:00
|
|
|
* can also be renamed or relocated anywhere on your getServer. If
|
|
|
|
* you do, use a full getServer path. For more info please see the user guide:
|
2015-08-28 23:43:35 -05:00
|
|
|
* http://codeigniter.com/user_guide/general/managing_apps.html
|
|
|
|
*
|
|
|
|
* NO TRAILING SLASH!
|
|
|
|
*/
|
|
|
|
$application_folder = 'application';
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ---------------------------------------------------------------
|
|
|
|
* WRITABLE DIRECTORY NAME
|
|
|
|
* ---------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* This variable must contain the name of your "writable" directory.
|
|
|
|
* The writable directory allows you to group all directories that
|
|
|
|
* need write permission to a single place that can be tucked away
|
|
|
|
* for maximum security, keeping it out of the application and/or
|
|
|
|
* system directories.
|
|
|
|
*/
|
|
|
|
$writable_directory = 'writable';
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ---------------------------------------------------------------
|
|
|
|
* Resolve the system path for increased reliability
|
|
|
|
* ---------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2016-03-29 10:48:58 +02:00
|
|
|
// Ensure the current directory is pointing to the front controller's directory
|
|
|
|
chdir(__DIR__);
|
2015-08-28 23:43:35 -05:00
|
|
|
|
2016-03-29 10:48:58 +02:00
|
|
|
// Are the system and application paths correct?
|
2016-03-29 20:47:49 +02:00
|
|
|
if ( ! realpath($system_path) OR ! is_dir($system_path))
|
2015-08-28 23:43:35 -05:00
|
|
|
{
|
2016-03-29 10:48:58 +02:00
|
|
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
|
|
|
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.
|
|
|
|
pathinfo(__FILE__, PATHINFO_BASENAME);
|
|
|
|
exit(3); // EXIT_CONFIG
|
2015-08-28 23:43:35 -05:00
|
|
|
}
|
|
|
|
|
2016-03-29 20:47:49 +02:00
|
|
|
if ( ! realpath($application_folder) OR ! is_dir($application_folder))
|
2015-08-28 23:43:35 -05:00
|
|
|
{
|
2015-08-28 23:43:58 -05:00
|
|
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
2016-03-29 10:48:58 +02:00
|
|
|
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.
|
2015-08-28 23:43:58 -05:00
|
|
|
pathinfo(__FILE__, PATHINFO_BASENAME);
|
2015-08-28 23:43:35 -05:00
|
|
|
exit(3); // EXIT_CONFIG
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* Now that we know the path, set the main path constants
|
|
|
|
* -------------------------------------------------------------------
|
2015-11-29 22:08:01 -06:00
|
|
|
* Always use 'realpath' on the paths to help ensure that we can
|
|
|
|
* take advantage of PHP's realpath cache for slight performance boost.
|
2015-08-28 23:43:35 -05:00
|
|
|
*/
|
|
|
|
// The name of THIS file
|
|
|
|
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
|
|
|
|
|
|
|
// Path to the system folder
|
2016-03-29 10:48:58 +02:00
|
|
|
define('BASEPATH', realpath($system_path).DIRECTORY_SEPARATOR);
|
2015-08-28 23:43:35 -05:00
|
|
|
|
|
|
|
// Path to the front controller (this file)
|
2016-03-29 10:48:58 +02:00
|
|
|
define('FCPATH', __DIR__.DIRECTORY_SEPARATOR);
|
2015-08-28 23:43:35 -05:00
|
|
|
|
|
|
|
// Path to the writable directory.
|
2016-03-29 10:48:58 +02:00
|
|
|
define('WRITEPATH', realpath($writable_directory).DIRECTORY_SEPARATOR);
|
2015-08-28 23:43:35 -05:00
|
|
|
|
|
|
|
// The path to the "application" folder
|
2016-03-29 10:48:58 +02:00
|
|
|
define('APPPATH', realpath($application_folder).DIRECTORY_SEPARATOR);
|
2015-08-28 23:43:35 -05:00
|
|
|
|
2016-04-12 09:35:20 -05:00
|
|
|
/*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
* Load the Kint Debugger
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*/
|
2016-04-12 09:36:57 -05:00
|
|
|
if ($useKint === true)
|
2016-04-12 09:35:20 -05:00
|
|
|
{
|
|
|
|
require_once BASEPATH.'Debug/Kint/Kint.class.php';
|
|
|
|
}
|
|
|
|
|
2016-03-30 14:10:30 +09:00
|
|
|
/*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
* Load any environment-specific settings from .env file
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Load environment settings from .env files
|
|
|
|
// into $_SERVER and $_ENV
|
|
|
|
require BASEPATH.'Config/DotEnv.php';
|
|
|
|
$env = new CodeIgniter\Config\DotEnv(APPPATH);
|
|
|
|
$env->load();
|
|
|
|
unset($env);
|
|
|
|
|
2016-03-30 07:30:02 +09:00
|
|
|
/*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
* Load the framework constants
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*/
|
|
|
|
if (file_exists(APPPATH.'Config/'.ENVIRONMENT.'/Constants.php'))
|
|
|
|
{
|
|
|
|
require_once APPPATH.'Config/'.ENVIRONMENT.'/Constants.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once(APPPATH.'Config/Constants.php');
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
* Setup the autoloader
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*/
|
|
|
|
// The autoloader isn't initialized yet, so load the file manually.
|
|
|
|
require BASEPATH.'Autoloader/Autoloader.php';
|
|
|
|
require APPPATH.'Config/Autoload.php';
|
|
|
|
require APPPATH.'Config/Services.php';
|
|
|
|
|
2016-04-03 18:32:36 +09:00
|
|
|
// Use Config\Services as CodeIgniter\Services
|
|
|
|
class_alias('Config\Services', 'CodeIgniter\Services');
|
|
|
|
|
2016-03-30 07:30:02 +09:00
|
|
|
// The Autoloader class only handles namespaces
|
|
|
|
// and "legacy" support.
|
2016-04-02 19:00:43 +09:00
|
|
|
$loader = CodeIgniter\Services::autoloader();
|
2016-03-30 07:30:02 +09:00
|
|
|
$loader->initialize(new Config\Autoload());
|
|
|
|
|
|
|
|
// The register function will prepend
|
|
|
|
// the psr4 loader.
|
|
|
|
$loader->register();
|
|
|
|
|
2016-03-30 16:19:46 +09:00
|
|
|
/*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
* Load the global functions
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once BASEPATH.'Common.php';
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
* Set custom exception handling
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*/
|
|
|
|
$config = new \Config\App();
|
|
|
|
|
2016-04-02 19:00:43 +09:00
|
|
|
CodeIgniter\Services::exceptions($config, true)
|
2016-03-30 16:19:46 +09:00
|
|
|
->initialize();
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// Should we use a Composer autoloader?
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
if ($composer_autoload = $config->composerAutoload)
|
|
|
|
{
|
|
|
|
if ($composer_autoload === TRUE)
|
|
|
|
{
|
|
|
|
file_exists(APPPATH.'vendor/autoload.php')
|
|
|
|
? require_once(APPPATH.'vendor/autoload.php')
|
|
|
|
: log_message('error', '$config->\'composerAutoload\' is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.');
|
|
|
|
}
|
|
|
|
elseif (file_exists($composer_autoload))
|
|
|
|
{
|
|
|
|
require_once($composer_autoload);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
log_message('error', 'Could not find the specified $config->\'composerAutoload\' path: '.$composer_autoload);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-28 23:43:35 -05:00
|
|
|
/*
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* LOAD THE BOOTSTRAP FILE
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* And away we go...
|
|
|
|
*/
|
2016-03-30 07:30:02 +09:00
|
|
|
$codeigniter = new CodeIgniter\CodeIgniter($startMemory, $startTime, $config);
|
2016-03-27 22:39:43 -05:00
|
|
|
$codeigniter->run();
|