diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-12 01:26:58 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-12 01:26:58 +0200 |
commit | 079fbfcde095230f304e889217f897031a948f61 (patch) | |
tree | eaad5b05fcf646665a5ffdf125fa47bbe29a8ed5 | |
parent | c73df1de471d4dc849942e718e17d97a04c6fd20 (diff) |
Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue #1321) and removed EXT constant
-rw-r--r-- | index.php | 46 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 8 |
2 files changed, 37 insertions, 17 deletions
@@ -178,9 +178,11 @@ if (defined('ENVIRONMENT')) { $system_path = realpath($system_path).'/'; } - - // ensure there's a trailing slash - $system_path = rtrim($system_path, '/').'/'; + else + { + // Ensure there's a trailing slash + $system_path = rtrim($system_path, '/').'/'; + } // Is the system path correct? if ( ! is_dir($system_path)) @@ -196,10 +198,6 @@ if (defined('ENVIRONMENT')) // The name of THIS file define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); - // The PHP file extension - // this global constant is deprecated. - define('EXT', '.php'); - // Path to the system folder define('BASEPATH', str_replace('\\', '/', $system_path)); @@ -212,6 +210,11 @@ if (defined('ENVIRONMENT')) // The path to the "application" folder if (is_dir($application_folder)) { + if (realpath($system_path) !== FALSE) + { + $application_folder = realpath($application_folder); + } + define('APPPATH', $application_folder.'/'); } else @@ -226,20 +229,33 @@ if (defined('ENVIRONMENT')) } // The path to the "views" folder - if (is_dir($view_folder)) - { - define ('VIEWPATH', $view_folder .'/'); - } - else + if ( ! is_dir($view_folder)) { - if ( ! is_dir(APPPATH.'views/')) + if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.'/')) + { + $view_folder = APPPATH.$view_folder; + } + elseif ( ! is_dir(APPPATH.'views/')) { header('HTTP/1.1 503 Service Unavailable.', TRUE, '503'); exit('Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF); } + else + { + $view_folder = APPPATH.'views'; + } + } - define ('VIEWPATH', APPPATH.'views/' ); + if (realpath($view_folder) !== FALSE) + { + $view_folder = realpath($view_folder).'/'; } + else + { + $view_folder = rtrim($view_folder, '/').'/'; + } + + define ('VIEWPATH', $view_folder); /* * -------------------------------------------------------------------- @@ -251,4 +267,4 @@ if (defined('ENVIRONMENT')) require_once BASEPATH.'core/CodeIgniter.php'; /* End of file index.php */ -/* Location: ./index.php */ +/* Location: ./index.php */
\ No newline at end of file diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 6d2971103..ebf29791b 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -33,15 +33,18 @@ Release Date: Not Released - Added support for ics Calendar files to mimes.php - Updated support for xml ('application/xml') and xsl ('application/xml', 'text/xsl') files in mimes.php. - Updated support for doc files in mimes.php. + - Added some more doctypes. - Added Romanian and Greek characters in foreign_characters.php. - Changed logger to only chmod when file is first created. - Removed previously deprecated SHA1 Library. - Removed previously deprecated use of ``$autoload['core']`` in application/config/autoload.php. Only entries in ``$autoload['libraries']`` are auto-loaded now. - - Added some more doctypes. + - Removed previously deprecated EXT constant. - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Moved error templates to "application/views/errors" - - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per Env. + - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. + - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. + - Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths. - Helpers @@ -255,6 +258,7 @@ Bug fixes for 3.0 - Fixed a bug where :doc:`Query Builder <database/query_builder>`'s join() method failed with identifiers containing dashes. - Fixed a bug (#1264) - :doc:`Database Forge <database/forge>` and :doc:`Database Utilities <database/utilities>` didn't update/reset the databases and tables list cache when a table or a database is created, dropped or renamed. - Fixed a bug (#7) - :doc:`Query Builder <database/query_builder>`'s join() method only escaped one set of conditions. +- Fixed a bug (#1321) - Core Exceptions class couldn't find the errors/ folder in some cases. Version 2.1.1 ============= |