From b52a018ba070ce74c87bfc31be5d6501e01d4eae Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 5 Aug 2011 19:56:41 +0200 Subject: [PATCH] Fixed missing include of options.inc.php --- .../lib/data/option/OptionEditor.class.php | 2 +- .../install/files/lib/system/WCF.class.php | 33 +++++++++---------- .../install/files/lib/system/WCFACP.class.php | 2 +- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/wcfsetup/install/files/lib/data/option/OptionEditor.class.php b/wcfsetup/install/files/lib/data/option/OptionEditor.class.php index cc747e555d..52a5399f99 100644 --- a/wcfsetup/install/files/lib/data/option/OptionEditor.class.php +++ b/wcfsetup/install/files/lib/data/option/OptionEditor.class.php @@ -120,7 +120,7 @@ class OptionEditor extends DatabaseObjectEditor implements IEditableCachedObject // get all options $options = Option::getOptions($packageID); foreach ($options as $optionName => $option) { - $buffer .= "define('".$optionName."', ".(($option['optionType'] == 'boolean' || $option['optionType'] == 'integer') ? intval($option['optionValue']) : "'".addcslashes($option['optionValue'], "'\\")."'").");\n"; + $buffer .= "if (!defined('".$optionName."')) define('".$optionName."', ".(($option['optionType'] == 'boolean' || $option['optionType'] == 'integer') ? intval($option['optionValue']) : "'".addcslashes($option['optionValue'], "'\\")."'").");\n"; } unset($options); diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 3f800f0d49..abae90261a 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -116,7 +116,7 @@ class WCF { // start initialization $this->initMagicQuotes(); $this->initDB(); - $this->initOptions(); + $this->loadOptions(); $this->initCache(); $this->initSession(); $this->initLanguage(); @@ -307,25 +307,17 @@ class WCF { /** * Includes the options file. * If the option file doesn't exist, the rebuild of it is started. + * + * @param string $filename */ - protected function initOptions() { - // get options file name - $optionsFile = $this->getOptionsFilename(); + protected function loadOptions($filename = null) { + if ($filename === null) $filename = WCF_DIR.'options.inc.php'; // create options file if doesn't exist - if (!file_exists($optionsFile) || filemtime($optionsFile) <= 1) { - \wcf\data\option\OptionEditor::rebuildFile($optionsFile); + if (!file_exists($filename) || filemtime($filename) <= 1) { + \wcf\data\option\OptionEditor::rebuildFile($filename); } - require_once($optionsFile); - } - - /** - * Returns the name of the options file. - * - * @return string name of the options file - */ - protected function getOptionsFilename() { - return WCF_DIR.'options.inc.php'; + require_once($filename); } /** @@ -417,8 +409,8 @@ class WCF { * Loads an application. * * @param wcf\system\database\statement\PreparedStatement $statement - * @param wcf\data\application\Application $application - * @param boolean $isDependentApplication + * @param wcf\data\application\Application $application + * @param boolean $isDependentApplication */ protected function loadApplication(PreparedStatement $statement, Application $application, $isDepedentApplication = false) { $statement->execute(array($application->packageID)); @@ -446,6 +438,11 @@ class WCF { unset(self::$autoloadDirectories[$abbreviation]); throw new exception\SystemException('Unable to run '.$row['package'].', '.$className.' missing.'); } + + // load options + if (!$isDepedentApplication) { + $this->loadOptions($packageDir.'options.inc.php'); + } } /** diff --git a/wcfsetup/install/files/lib/system/WCFACP.class.php b/wcfsetup/install/files/lib/system/WCFACP.class.php index 8be508a9a6..88694258a6 100644 --- a/wcfsetup/install/files/lib/system/WCFACP.class.php +++ b/wcfsetup/install/files/lib/system/WCFACP.class.php @@ -31,7 +31,7 @@ class WCFACP extends WCF { $this->initMagicQuotes(); $this->initDB(); $this->initPackage(); - $this->initOptions(); + $this->loadOptions(); $this->initCache(); $this->initSession(); $this->initLanguage(); -- 2.20.1