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 // Attempt to set up the include path, to fix problems with relative includes
28 $fusionforge_basedir = dirname(dirname(dirname( __FILE__ )));
30 // By default, the include_path is changed to include path needed by Gforge.
31 // If this does not work, then set defines to real path directly.
33 // In case of failure, the following defines are set:
34 // $gfconfig : Directory where are the configuration files (/etc/gforge).
35 // $gfcommon : Directory common of gforge (for common php classes).
36 // $gfwww : Directory www of gforge (publicly accessible files).
37 // $gfplugins: Directory for plugins.
40 // Easyforge config, allow several instances of gforge based on server name.
41 if (getenv('sys_localinc')) {
42 $gfcgfile = getenv('sys_localinc');
43 $gfconfig = dirname($gfcgfile).'/';
44 } elseif (isset($_SERVER['SERVER_NAME']) &&
45 file_exists($fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php')) {
46 $gfcgfile = $fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php';
47 $gfconfig = $fusionforge_basedir.'/config/'.$_SERVER['SERVER_NAME'].'/';
48 } elseif (file_exists($fusionforge_basedir.'/config/local.inc.php')) {
49 $gfcgfile = $fusionforge_basedir.'/config/local.inc.php';
50 $gfconfig = $fusionforge_basedir.'/config/';
51 } elseif (file_exists('/etc/gforge/local.inc.php')) {
52 $gfcgfile = '/etc/gforge/local.inc.php';
53 $gfconfig = '/etc/gforge/';
54 } elseif (file_exists('/etc/gforge/local.inc')) {
55 $gfcgfile = '/etc/gforge/local.inc';
56 $gfconfig = '/etc/gforge/';
57 } elseif (file_exists('/etc/fusionforge/config.ini')) {
58 $gfconfig = '/etc/fusionforge/';
59 } elseif (file_exists('/etc/gforge/config.ini')) {
60 $gfconfig = '/etc/gforge/';
62 $gfcgfile = 'local.inc';
63 if (is_dir('/etc/gforge')){
64 $gfconfig = '/etc/gforge/';
70 $include_path = join(PATH_SEPARATOR,
74 $fusionforge_basedir.'/common',
75 $fusionforge_basedir.'/www',
76 $fusionforge_basedir.'/plugins',
78 $fusionforge_basedir.'/www/include',
79 $fusionforge_basedir.'/common/include',
86 if( !ini_set('include_path', $include_path ) && !set_include_path( $include_path )) {
87 $gfcommon = $fusionforge_basedir.'/common/';
88 $gfwww = $fusionforge_basedir.'/www/';
89 $gfplugins = $fusionforge_basedir.'/plugins/';