2 // Import framework stuff
3 use CoreFramework\Configuration\FrameworkConfiguration;
4 use CoreFramework\Object\BaseFrameworkSystem;
7 * The application selector main include file
9 * @author Roland Haeder <webmaster@shipsimu.org>
11 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
12 * @license GNU GPL 3.0 or any newer version
13 * @link http://www.shipsimu.org
15 * @todo Minimize these includes
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 // Try to load these includes in the given order
32 $configAppIncludes = array(
33 'class_' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
34 'debug', // Some debugging stuff
35 'exceptions', // The application's own exception handler
36 'loader', // The application's class loader
37 'config', // The application's own configuration
38 'config-local', // Local configuration file (optional)
39 'data', // Application data
40 'init', // The application initializer
41 'starter', // The application starter (calls entryPoint(), etc.)
44 // Cache base path/file here
45 $basePathFile = FrameworkConfiguration::getSelfInstance()->getConfigEntry('application_path') . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name');
47 // Is the directory there?
48 if (!is_dir($basePathFile)) {
50 trigger_error('Application ' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name') . ' not found.');
54 // Load them all (try only)
55 foreach ($configAppIncludes as $appInc) {
56 // Skip starter in test mode
57 if (($appInc == 'starter') && (defined('TEST'))) {
62 // Generate a FQFN for the helper class
63 $appFqFn = $basePathFile . '/' . $appInc . '.php';
65 // Does the include file exists?
66 if (BaseFrameworkSystem::isReadableFile($appFqFn)) {
68 //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - START\n";
70 //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - END\n";
71 } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('verbose_level') > 0) {
73 trigger_error(sprintf('Cannot load application script %s.php! File is missing or read-protected.',
80 // Remove variables from namespace, which we don't need
82 unset($configAppIncludes);