3 * Sets the default required environement for FusionForge
5 * Some of the settings made here can be overwrite in the
6 * configuration file if needed.
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 if (!getenv('SERVER_SOFTWARE')) {
28 /* when running outside of the Web */
30 /* enable maximum error reporting */
32 /* disable output buffering */
34 /* allow it to eat all memory */
35 ini_set("memory_limit", -1);
38 // Attempt to set up the include path, to fix problems with relative includes
39 $fusionforge_basedir = dirname(dirname(dirname( __FILE__ )));
41 // By default, the include_path is changed to include path needed by Gforge.
42 // If this does not work, then set defines to real path directly.
44 // In case of failure, the following defines are set:
45 // $gfconfig : Directory where are the configuration files (/etc/gforge).
46 // $gfcommon : Directory common of gforge (for common php classes).
47 // $gfwww : Directory www of gforge (publicly accessible files).
48 // $gfplugins: Directory for plugins.
51 // Easyforge config, allow several instances of gforge based on server name.
52 if (getenv('FORGE_CONFIG_PATH') && file_exists(getenv('FORGE_CONFIG_PATH').'/config.ini')) {
53 $gfconfig = getenv('FORGE_CONFIG_PATH').'/';
54 } elseif (getenv('sys_localinc')) {
55 $gfcgfile = getenv('sys_localinc');
56 $gfconfig = dirname($gfcgfile).'/';
57 } elseif (isset($_SERVER['SERVER_NAME']) &&
58 file_exists($fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php')) {
59 $gfcgfile = $fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php';
60 $gfconfig = $fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/';
61 } elseif (file_exists($fusionforge_basedir.'/config/local.inc.php')) {
62 $gfcgfile = $fusionforge_basedir.'/config/local.inc.php';
63 $gfconfig = $fusionforge_basedir.'/config/';
64 } elseif (file_exists('/etc/gforge/local.inc.php')) {
65 $gfcgfile = '/etc/gforge/local.inc.php';
66 $gfconfig = '/etc/gforge/';
67 } elseif (file_exists('/etc/gforge/local.inc')) {
68 $gfcgfile = '/etc/gforge/local.inc';
69 $gfconfig = '/etc/gforge/';
70 } elseif (file_exists('/etc/gforge/config.ini')) {
71 $gfconfig = '/etc/gforge/';
72 } elseif (file_exists('/etc/fusionforge/config.ini')) {
73 $gfconfig = '/etc/fusionforge/';
75 $gfcgfile = 'local.inc';
76 if (is_dir('/etc/gforge')){
77 $gfconfig = '/etc/gforge/';
83 $include_path = join(PATH_SEPARATOR,
87 $fusionforge_basedir.'/common',
88 $fusionforge_basedir.'/www',
89 $fusionforge_basedir.'/plugins',
91 $fusionforge_basedir.'/www/include',
92 $fusionforge_basedir.'/common/include',
99 if( !ini_set('include_path', $include_path ) && !set_include_path( $include_path )) {
100 $gfcommon = $fusionforge_basedir.'/common/';
101 $gfwww = $fusionforge_basedir.'/www/';
102 $gfplugins = $fusionforge_basedir.'/plugins/';