root/trunk/index.php
| Revision 2750, 3.9 kB (checked in by zombor, 1 month ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | <?php |
| 2 | /** |
| 3 | * This file acts as the "front controller" to your application. You can |
| 4 | * configure your application, modules, and system directories here. |
| 5 | * PHP error_reporting level may also be changed. |
| 6 | * |
| 7 | * @see http://kohanaphp.com |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Define the website environment status. When this flag is set to TRUE, some |
| 12 | * module demonstration controllers will result in 404 errors. For more information |
| 13 | * about this option, read the documentation about deploying Kohana. |
| 14 | * |
| 15 | * @see http://docs.kohanaphp.com/installation/deployment |
| 16 | */ |
| 17 | define('IN_PRODUCTION', FALSE); |
| 18 | |
| 19 | /** |
| 20 | * Website application directory. This directory should contain your application |
| 21 | * configuration, controllers, models, views, and other resources. |
| 22 | * |
| 23 | * This path can be absolute or relative to this file. |
| 24 | */ |
| 25 | $kohana_application = 'application'; |
| 26 | |
| 27 | /** |
| 28 | * Kohana modules directory. This directory should contain all the modules used |
| 29 | * by your application. Modules are enabled and disabled by the application |
| 30 | * configuration file. |
| 31 | * |
| 32 | * This path can be absolute or relative to this file. |
| 33 | */ |
| 34 | $kohana_modules = 'modules'; |
| 35 | |
| 36 | /** |
| 37 | * Kohana system directory. This directory should contain the core/ directory, |
| 38 | * and the resources you included in your download of Kohana. |
| 39 | * |
| 40 | * This path can be absolute or relative to this file. |
| 41 | */ |
| 42 | $kohana_system = 'system'; |
| 43 | |
| 44 | /** |
| 45 | * Test to make sure that Kohana is running on PHP 5.2 or newer. Once you are |
| 46 | * sure that your environment is compatible with Kohana, you can comment this |
| 47 | * line out. When running an application on a new server, uncomment this line |
| 48 | * to check the PHP version quickly. |
| 49 | */ |
| 50 | version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.'); |
| 51 | |
| 52 | /** |
| 53 | * Set the error reporting level. Unless you have a special need, E_ALL is a |
| 54 | * good level for error reporting. |
| 55 | */ |
| 56 | error_reporting(E_ALL & ~E_STRICT); |
| 57 | |
| 58 | /** |
| 59 | * Turning off display_errors will effectively disable Kohana error display |
| 60 | * and logging. You can turn off Kohana errors in application/config/config.php |
| 61 | */ |
| 62 | ini_set('display_errors', TRUE); |
| 63 | |
| 64 | /** |
| 65 | * If you rename all of your .php files to a different extension, set the new |
| 66 | * extension here. This option can left to .php, even if this file has a |
| 67 | * different extension. |
| 68 | */ |
| 69 | define('EXT', '.php'); |
| 70 | |
| 71 | // |
| 72 | // DO NOT EDIT BELOW THIS LINE, UNLESS YOU FULLY UNDERSTAND THE IMPLICATIONS. |
| 73 | // ---------------------------------------------------------------------------- |
| 74 | // $Id$ |
| 75 | // |
| 76 | |
| 77 | // Define the front controller name and docroot |
| 78 | define('DOCROOT', getcwd().DIRECTORY_SEPARATOR); |
| 79 | define('KOHANA', basename(__FILE__)); |
| 80 | |
| 81 | // If the front controller is a symlink, change to the real docroot |
| 82 | is_link(KOHANA) and chdir(dirname(realpath(__FILE__))); |
| 83 | |
| 84 | // Define application and system paths |
| 85 | define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/'); |
| 86 | define('MODPATH', str_replace('\\', '/', realpath($kohana_modules)).'/'); |
| 87 | define('SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/'); |
| 88 | |
| 89 | // Clean up |
| 90 | unset($kohana_application, $kohana_modules, $kohana_system); |
| 91 | |
| 92 | if ( ! IN_PRODUCTION) |
| 93 | { |
| 94 | // Check APPPATH |
| 95 | if ( ! (is_dir(APPPATH) AND file_exists(APPPATH.'config/config'.EXT))) |
| 96 | { |
| 97 | die |
| 98 | ( |
| 99 | '<div style="width:80%;margin:50px auto;text-align:center;">'. |
| 100 | '<h3>Application Directory Not Found</h3>'. |
| 101 | '<p>The <code>$kohana_application</code> directory does not exist.</p>'. |
| 102 | '<p>Set <code>$kohana_application</code> in <tt>'.KOHANA.'</tt> to a valid directory and refresh the page.</p>'. |
| 103 | '</div>' |
| 104 | ); |
| 105 | } |
| 106 | |
| 107 | // Check SYSPATH |
| 108 | if ( ! (is_dir(SYSPATH) AND file_exists(SYSPATH.'core/Bootstrap'.EXT))) |
| 109 | { |
| 110 | die |
| 111 | ( |
| 112 | '<div style="width:80%;margin:50px auto;text-align:center;">'. |
| 113 | '<h3>System Directory Not Found</h3>'. |
| 114 | '<p>The <code>$kohana_system</code> directory does not exist.</p>'. |
| 115 | '<p>Set <code>$kohana_system</code> in <tt>'.KOHANA.'</tt> to a valid directory and refresh the page.</p>'. |
| 116 | '</div>' |
| 117 | ); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | // Initialize. |
| 122 | require SYSPATH.'core/Bootstrap'.EXT; |
Note: See TracBrowser for help on using the browser.
