3 * Sets the default required environment for FusionForge
5 * Some of the settings made here can be overwrite in the
6 * configuration file if needed.
12 * Copyright 2013, Franck Villaume - TrivialDev
14 * This file is part of FusionForge. FusionForge is free software;
15 * you can redistribute it and/or modify it under the terms of the
16 * GNU General Public License as published by the Free Software
17 * Foundation; either version 2 of the Licence, or (at your option)
20 * FusionForge is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License along
26 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 if (!getenv('SERVER_SOFTWARE')) {
31 /* when running outside of the Web */
33 /* enable maximum error reporting */
35 /* disable output buffering */
37 /* allow it to eat all memory */
38 ini_set("memory_limit", -1);
41 // Attempt to set up the include path, to fix problems with relative includes
42 $fusionforge_basedir = dirname(dirname(dirname( __FILE__ )));
44 // By default, the include_path is changed to include path needed by FusionForge.
45 // If this does not work, then set defines to real path directly.
47 // In case of failure, the following defines are set:
48 // $gfconfig: Directory where are the configuration files (/etc/fusionforge).
49 // $gfcommon: Directory common of fusionforge (for common php classes).
50 // $gfwww: Directory www of fusionforge (publicly accessible files).
51 // $gfplugins: Directory for plugins.
54 // Easyforge config, allow several instances of fusionforge based on server name.
55 // Require multiples VirtualHosts in your httpd configuration.
56 // FORGE_CONFIG_PATH var is set in httpd.conf file and is default method shipped with the Fusionforge code source.
57 if (getenv('FORGE_CONFIG_PATH') && file_exists(getenv('FORGE_CONFIG_PATH').'/config.ini')) {
58 $gfconfig = getenv('FORGE_CONFIG_PATH').'/';
59 $gfcgfile = 'config.ini';
60 } elseif (getenv('sys_localinc')) {
61 $gfcgfile = getenv('sys_localinc');
62 $gfconfig = dirname($gfcgfile).'/';
63 $gfcgfile = basename($gfcgfile);
64 } elseif (isset($_SERVER['SERVER_NAME']) &&
65 file_exists('/etc/fusionforge/'.$_SERVER['SERVER_NAME'].'/config.ini')) {
66 $gfcgfile = 'config.ini';
67 $gfconfig = '/etc/fusionforge/'.$_SERVER['SERVER_NAME'].'/';
68 } elseif (isset($_SERVER['SERVER_NAME']) &&
69 file_exists($fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/config.ini')) {
70 $gfcgfile = '/config.ini';
71 $gfconfig = $fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/';
72 } elseif (file_exists($fusionforge_basedir.'/config/config.ini')) {
73 $gfcgfile = 'config.ini';
74 $gfconfig = $fusionforge_basedir.'/config/';
75 } elseif (is_dir('/etc/gforge')) {
76 $gfcgfile = 'config.ini';
77 $gfconfig = '/etc/gforge/';
79 $gfcgfile = 'config.ini';
80 if (is_dir('/etc/fusionforge')) {
81 $gfconfig = '/etc/fusionforge/';
87 $include_path = join(PATH_SEPARATOR,
91 $fusionforge_basedir.'/common',
92 $fusionforge_basedir.'/www',
93 $fusionforge_basedir.'/plugins',
95 $fusionforge_basedir.'/www/include',
96 $fusionforge_basedir.'/common/include',
103 if( !ini_set('include_path', $include_path ) && !set_include_path( $include_path )) {
104 $gfcommon = $fusionforge_basedir.'/common/';
105 $gfwww = $fusionforge_basedir.'/www/';
106 $gfplugins = $fusionforge_basedir.'/plugins/';