File indexing completed on 2024-12-22 05:33:07

0001 <?php
0002 /**
0003  *
0004  *   ocs-apiserver
0005  *
0006  *   Copyright 2016 by pling GmbH.
0007  *
0008  *    This file is part of ocs-apiserver.
0009  *
0010  *    This program is free software: you can redistribute it and/or modify
0011  *    it under the terms of the GNU Affero General Public License as
0012  *    published by the Free Software Foundation, either version 3 of the
0013  *    License, or (at your option) any later version.
0014  *
0015  *    This program is distributed in the hope that it will be useful,
0016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  *    GNU Affero General Public License for more details.
0019  *
0020  *    You should have received a copy of the GNU Affero General Public License
0021  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0022  *
0023  */
0024 
0025 defined('APPLICATION_TIMEZONE')
0026 || define('APPLICATION_TIMEZONE', (getenv('APPLICATION_TIMEZONE') ? getenv('APPLICATION_TIMEZONE') : 'UTC'));
0027 
0028 date_default_timezone_set(APPLICATION_TIMEZONE);
0029 
0030 // Define path to application directory
0031 defined('APPLICATION_PATH')
0032 || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
0033 
0034 // Define application environment
0035 defined('APPLICATION_ENV')
0036 || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
0037 
0038 // Define path to application cache
0039 defined('APPLICATION_CACHE')
0040 || define('APPLICATION_CACHE', realpath(dirname(__FILE__) . '/../data/cache'));
0041 
0042 // Define path to application cache
0043 defined('APPLICATION_DATA')
0044 || define('APPLICATION_DATA', realpath(dirname(__FILE__) . '/../data'));
0045 
0046 // Define path to application library
0047 defined('APPLICATION_LIB')
0048 || define('APPLICATION_LIB', realpath(dirname(__FILE__) . '/../library'));
0049 
0050 
0051 // Ensure library/ is on include_path
0052 set_include_path(implode(PATH_SEPARATOR, array(
0053     realpath(APPLICATION_PATH . '/../library'),
0054     get_include_path(),
0055 )));
0056 
0057 //require_once realpath(APPLICATION_PATH . '/../vendor/autoload.php');
0058 
0059 // Initialising Autoloader
0060 require APPLICATION_LIB . '/Zend/Loader/SplAutoloader.php';
0061 require APPLICATION_LIB . '/Zend/Loader/StandardAutoloader.php';
0062 require APPLICATION_LIB . '/Zend/Loader/AutoloaderFactory.php';
0063 Zend_Loader_AutoloaderFactory::factory(array(
0064     'Zend_Loader_StandardAutoloader' => array(
0065         'autoregister_zf' => true,
0066         'namespaces'      => array(
0067             'Application' => APPLICATION_PATH
0068         )
0069     )
0070 ));
0071 
0072 // Including plugin cache file
0073 if (file_exists(APPLICATION_CACHE . DIRECTORY_SEPARATOR . 'pluginLoaderCache.php')) {
0074     include_once APPLICATION_CACHE . DIRECTORY_SEPARATOR . 'pluginLoaderCache.php';
0075 }
0076 Zend_Loader_PluginLoader::setIncludeFileCache(APPLICATION_CACHE . DIRECTORY_SEPARATOR . 'pluginLoaderCache.php');
0077 
0078 // Set configuration
0079 $configuration = APPLICATION_PATH . '/configs/application.ini';
0080 // Merge an existing local configuration file (application.local.ini) with global config
0081 if (file_exists(APPLICATION_PATH . '/configs/application.local.ini')) {
0082     $configuration = array(
0083         'config' => array(
0084             APPLICATION_PATH . '/configs/application.ini',
0085             APPLICATION_PATH . '/configs/application.local.ini'
0086         )
0087     );
0088 }
0089 
0090 // Init and start Zend_Application
0091 require_once APPLICATION_LIB . '/Local/Application.php';
0092 // Create application, bootstrap, and run
0093 $application = new Local_Application(APPLICATION_ENV, $configuration);
0094 $application->bootstrap();
0095 $application->run();