|
101 | 101 | * ---------------------------------------------------------------
|
102 | 102 | */
|
103 | 103 |
|
104 |
| -// Set the current directory correctly for CLI requests |
105 |
| -if (defined('STDIN')) |
106 |
| -{ |
107 |
| - chdir(__DIR__); |
108 |
| -} |
| 104 | +// Ensure the current directory is pointing to the front controller's directory |
| 105 | +chdir(__DIR__); |
109 | 106 |
|
110 |
| -if (($_temp = realpath($system_path)) !== false) |
111 |
| -{ |
112 |
| - $system_path = $_temp.'/'; |
113 |
| -} |
114 |
| -else |
| 107 | +// Are the system and application paths correct? |
| 108 | +if ( ! realpath($system_path) OR ! is_dir($system_path)) |
115 | 109 | {
|
116 |
| - // Ensure there's a trailing slash |
117 |
| - $system_path = rtrim($system_path, '/').'/'; |
| 110 | + header('HTTP/1.1 503 Service Unavailable.', true, 503); |
| 111 | + echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '. |
| 112 | + pathinfo(__FILE__, PATHINFO_BASENAME); |
| 113 | + exit(3); // EXIT_CONFIG |
118 | 114 | }
|
119 | 115 |
|
120 |
| -// Is the system path correct? |
121 |
| -if ( ! is_dir($system_path)) |
| 116 | +if ( ! realpath($application_folder) OR ! is_dir($application_folder)) |
122 | 117 | {
|
123 | 118 | header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
124 |
| - echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '. |
| 119 | + echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '. |
125 | 120 | pathinfo(__FILE__, PATHINFO_BASENAME);
|
126 | 121 | exit(3); // EXIT_CONFIG
|
127 | 122 | }
|
|
137 | 132 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
138 | 133 |
|
139 | 134 | // Path to the system folder
|
140 |
| -define('BASEPATH', realpath(str_replace('\\', '/', $system_path)).DIRECTORY_SEPARATOR); |
| 135 | +define('BASEPATH', realpath($system_path).DIRECTORY_SEPARATOR); |
141 | 136 |
|
142 | 137 | // Path to the front controller (this file)
|
143 |
| -define('FCPATH', realpath(__DIR__).DIRECTORY_SEPARATOR); |
| 138 | +define('FCPATH', __DIR__.DIRECTORY_SEPARATOR); |
144 | 139 |
|
145 | 140 | // Path to the writable directory.
|
146 |
| -define('WRITEPATH', realpath(str_replace('\\', '/', $writable_directory)).DIRECTORY_SEPARATOR); |
| 141 | +define('WRITEPATH', realpath($writable_directory).DIRECTORY_SEPARATOR); |
147 | 142 |
|
148 | 143 | // The path to the "application" folder
|
149 |
| -if (is_dir($application_folder)) |
150 |
| -{ |
151 |
| - if (($_temp = realpath($application_folder)) !== false) |
152 |
| - { |
153 |
| - $application_folder = $_temp; |
154 |
| - } |
155 |
| - |
156 |
| - define('APPPATH', realpath($application_folder).DIRECTORY_SEPARATOR); |
157 |
| -} |
158 |
| -else |
159 |
| -{ |
160 |
| - if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
161 |
| - { |
162 |
| - header('HTTP/1.1 503 Service Unavailable.', true, 503); |
163 |
| - echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '. |
164 |
| - SELF; |
165 |
| - exit(3); // EXIT_CONFIG |
166 |
| - } |
167 |
| - |
168 |
| - define('APPPATH', realpath(BASEPATH.$application_folder).DIRECTORY_SEPARATOR); |
169 |
| -} |
| 144 | +define('APPPATH', realpath($application_folder).DIRECTORY_SEPARATOR); |
170 | 145 |
|
171 | 146 | /*
|
172 | 147 | * --------------------------------------------------------------------
|
|
0 commit comments