REVIEWED THE FILE INCLUSION POLICY

- includes are relative to the application root folder, aka APPROOT
- changed the config file, while preserving the compatibility with older installs

SVN:trunk[962]
This commit is contained in:
Romain Quetiez
2010-11-22 17:53:52 +00:00
parent d0f168adbb
commit d8bb6a45b2
59 changed files with 369 additions and 308 deletions

View File

@@ -23,8 +23,8 @@
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
require_once("../application/nicewebpage.class.inc.php");
define('INSTALL_LOG_FILE', '../setup.log');
require_once(APPROOT."/application/nicewebpage.class.inc.php");
define('INSTALL_LOG_FILE', APPROOT.'/setup.log');
date_default_timezone_set('Europe/Paris');
class SetupWebPage extends NiceWebPage
{
@@ -258,9 +258,15 @@ table.formTable {
static $m_aModules = array();
// All the entries below are list of (relative) file paths
// All the entries below are list of file paths relative to the module directory
static $m_aFilesList = array('datamodel', 'dictionary', 'data.struct', 'data.sample');
static $m_sModulePath = null;
public function SetModulePath($sModulePath)
{
self::$m_sModulePath = $sModulePath;
}
public static function AddModule($sFilePath, $sId, $aArgs)
{
foreach (self::$m_aModuleArgs as $sArgName => $sArgDesc)
@@ -272,14 +278,14 @@ table.formTable {
}
self::$m_aModules[$sId] = $aArgs;
$sDirPart = dirname($sFilePath).'/';
foreach(self::$m_aFilesList as $sAttribute)
{
// All the items below are list of files, that are relative to the current file
// being loaded, let's update their path to store a full (absolute) path in the config
// being loaded, let's update their path to store path relative to the application directory
foreach(self::$m_aModules[$sId][$sAttribute] as $idx => $sRelativePath)
{
self::$m_aModules[$sId][$sAttribute][$idx] = $sDirPart.$sRelativePath;
self::$m_aModules[$sId][$sAttribute][$idx] = self::$m_sModulePath.'/'.$sRelativePath;
}
}
}