#!/usr/bin/php "/mymoduledir/ * * The global $SYSCONFDIR is also set for backward compatibility. * * \Note Since so many files expect directory paths that used to be in pathinclude.php * to be global, this function will define the same globals (everything in the * DIRECTORIES section of fossology.conf). */ function bootstrap($sysconfdir="") { $rcfile = "fossology.rc"; if (empty($sysconfdir)) { $sysconfdir = getenv('SYSCONFDIR'); if ($sysconfdir === false) { if (file_exists($rcfile)) $sysconfdir = file_get_contents($rcfile); if ($sysconfdir === false) { /* NO SYSCONFDIR specified */ $text = _("FATAL! System Configuration Error, no SYSCONFDIR."); echo "$text\n"; exit(1); } } } $sysconfdir = trim($sysconfdir); $GLOBALS['SYSCONFDIR'] = $sysconfdir; /************* Parse fossology.conf *******************/ $ConfFile = "{$sysconfdir}/fossology.conf"; if (!file_exists($ConfFile)) { $text = _("FATAL! Missing configuration file: $ConfFile"); echo "$text\n"; exit(1); } $SysConf = parse_ini_file($ConfFile, true); if ($SysConf === false) { $text = _("FATAL! Invalid configuration file: $ConfFile"); echo "$text\n"; exit(1); } /* evaluate all the DIRECTORIES group for variable substitutions. * For example, if PREFIX=/usr/local and BINDIR=$PREFIX/bin, we * want BINDIR=/usr/local/bin */ foreach($SysConf['DIRECTORIES'] as $var=>$assign) { /* Evaluate the individual variables because they may be referenced * in subsequent assignments. */ $toeval = "\$$var = \"$assign\";"; eval($toeval); /* now reassign the array value with the evaluated result */ $SysConf['DIRECTORIES'][$var] = ${$var}; $GLOBALS[$var] = ${$var}; } if (empty($MODDIR)) { $text = _("FATAL! System initialization failure: MODDIR not defined in $SysConf"); echo $text. "\n"; exit(1); } //require("i18n.php"); DISABLED until i18n infrastructure is set-up. require_once("$MODDIR/www/ui/template/template-plugin.php"); require_once("$MODDIR/lib/php/common.php"); return $SysConf; }