Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
175 lines (153 sloc) 5.412 kB
<?php
/**
* This file acts as the "front controller" to your application. You can
* configure your application, modules, and system directories here.
* PHP error_reporting level may also be changed.
*
* @see http://kohanaphp.com
*/
/**
* This checks to see if the site is in maintenance mode. Put your site
* in maintenance mode by putting a 'maintenance.php' file in the root
* directory of your site. (Same directory as this index.php file)
*
*/
if (file_exists('maintenance.php'))
{
header("Status: 503 Service Temporarily Unavailable");
die(file_get_contents('maintenance.php'));
}
/**
* Define the website environment status. When this flag is set to TRUE, some
* module demonstration controllers will result in 404 errors. For more information
* about this option, read the documentation about deploying Kohana.
*
* @see http://docs.kohanaphp.com/installation/deployment
*/
define('IN_PRODUCTION', TRUE);
/**
* Website application directory. This directory should contain your application
* configuration, controllers, models, views, and other resources.
*
* This path can be absolute or relative to this file.
*/
$kohana_application = 'application';
/**
* Kohana modules directory. This directory should contain all the modules used
* by your application. Modules are enabled and disabled by the application
* configuration file.
*
* This path can be absolute or relative to this file.
*/
$kohana_modules = 'modules';
/**
* Kohana system directory. This directory should contain the core/ directory,
* and the resources you included in your download of Kohana.
*
* This path can be absolute or relative to this file.
*/
$kohana_system = 'system';
/**
* Themes directory.
*
* This path can be absolute or relative to this file.
*/
$kohana_themes = 'themes';
/**
* Plugin directory.
*
* This path can be absolute or relative to this file.
*/
$kohana_plugins = 'plugins';
/**
* Media directory.
*
* This path can be absolute or relative to this file.
*/
$kohana_media = 'media';
/**
* Test to make sure that Kohana is running on PHP 5.2 or newer. Once you are
* sure that your environment is compatible with Kohana, you can comment this
* line out. When running an application on a new server, uncomment this line
* to check the PHP version quickly.
*/
version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.');
/**
* Set the error reporting level. Unless you have a special need, E_ALL is a
* good level for error reporting.
*/
error_reporting(E_ALL & ~E_STRICT);
/**
* Turning off display_errors will effectively disable Kohana error display
* and logging. You can turn off Kohana errors in application/config/config.php
*/
ini_set('display_errors', TRUE);
/**
* If you rename all of your .php files to a different extension, set the new
* extension here. This option can left to .php, even if this file has a
* different extension.
*/
define('EXT', '.php');
//
// DO NOT EDIT BELOW THIS LINE, UNLESS YOU FULLY UNDERSTAND THE IMPLICATIONS.
// ----------------------------------------------------------------------------
// $Id: index.php 3168 2008-07-21 01:34:36Z Shadowhand $
//
// Define the front controller name and docroot
define('DOCROOT', getcwd().DIRECTORY_SEPARATOR);
define('KOHANA', basename(__FILE__));
// If the front controller is a symlink, change to the real docroot
is_link(KOHANA) and chdir(dirname(realpath(__FILE__)));
// Define application and system paths
define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/');
define('THEMEPATH', str_replace('\\', '/', realpath($kohana_themes)).'/');
define('PLUGINPATH', str_replace('\\', '/', realpath($kohana_plugins)).'/');
define('MODPATH', str_replace('\\', '/', realpath($kohana_modules)).'/');
define('SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/');
define('MEDIAPATH', str_replace('\\', '/', realpath($kohana_media)).'/');
// Clean up
unset($kohana_application, $kohana_themes, $kohana_plugins, $kohana_modules, $kohana_system, $kohana_media);
if ( ! IN_PRODUCTION)
{
// Check APPPATH
if ( ! (is_dir(APPPATH) AND is_file(APPPATH.'config/config'.EXT)))
{
die
(
'<div style="width:80%;margin:50px auto;text-align:center;">'.
'<h3>Application Directory Not Found</h3>'.
'<p>The <code>$kohana_application</code> directory does not exist.</p>'.
'<p>Set <code>$kohana_application</code> in <tt>'.KOHANA.'</tt> to a valid directory and refresh the page.</p>'.
'</div>'
);
}
// Check SYSPATH
if ( ! (is_dir(SYSPATH) AND is_file(SYSPATH.'core/Bootstrap'.EXT)))
{
die
(
'<div style="width:80%;margin:50px auto;text-align:center;">'.
'<h3>System Directory Not Found</h3>'.
'<p>The <code>$kohana_system</code> directory does not exist.</p>'.
'<p>Set <code>$kohana_system</code> in <tt>'.KOHANA.'</tt> to a valid directory and refresh the page.</p>'.
'</div>'
);
}
}
//
// Check if the application has been installed
// -------------------------------------------
// This has to be done before bootstrapping the Kohana framework
//
// Does the installer directory exist?
if (file_exists(DOCROOT.DIRECTORY_SEPARATOR.'installer'))
{
if ( ! file_exists(APPPATH.'config'.DIRECTORY_SEPARATOR.'database.php'))
{
// Redirect to the installer
header("Location: ./installer");
exit();
}
}
// Initialize.
require SYSPATH.'core/Bootstrap'.EXT;
Jump to Line
Something went wrong with that request. Please try again.