From 83ec534aa1b64601f2c9d9fd317f9f77ea96f3ff Mon Sep 17 00:00:00 2001 From: mrflos Date: Tue, 31 May 2022 11:47:49 +0300 Subject: [PATCH] fix(config): get good configuration file path --- actions/EditConfigAction.php | 6 +++--- includes/YesWiki.php | 2 ++ includes/YesWikiInit.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/actions/EditConfigAction.php b/actions/EditConfigAction.php index 729e0763f..322fa6f71 100644 --- a/actions/EditConfigAction.php +++ b/actions/EditConfigAction.php @@ -59,7 +59,7 @@ public function run() 'message'=> get_class($this)." : " . _t('BAZ_NEED_ADMIN_RIGHTS') ]) ; } - if (!is_writable('wakka.config.php')) { + if (!is_writable($this->wiki->configFile)) { return $this->render('@templates/alert-message.twig', [ 'type'=>'danger', 'message'=> _t('ERROR_NO_ACCESS'). ' '._t('FILE_WRITE_PROTECTED') @@ -201,7 +201,7 @@ private function arrayIsList(array $array): bool */ private function save(): bool { - $config = $this->configurationService->getConfiguration('wakka.config.php'); + $config = $this->configurationService->getConfiguration($this->wiki->configFile); $config->load(); $keysAsArray = $this->convertKeysAsArray($this->getAuthorizedKeys()[0]); @@ -304,7 +304,7 @@ private function save(): bool */ private function getDataFromConfigFile(): array { - $config = $this->configurationService->getConfiguration('wakka.config.php'); + $config = $this->configurationService->getConfiguration($this->wiki->configFile); $config->load(); $data = []; $placeholders = []; diff --git a/includes/YesWiki.php b/includes/YesWiki.php index bfacd5c76..76df72653 100755 --- a/includes/YesWiki.php +++ b/includes/YesWiki.php @@ -50,6 +50,7 @@ class Wiki public $method; public $page; public $tag; + public $configFile; public $parameter = array(); public $request; // current output used for actions/handlers/formatters @@ -74,6 +75,7 @@ public function __construct($config = array()) { $init = new \YesWiki\Init($config); $this->config = $init->config; + $this->configFile = $init->configFile; $this->CookiePath = $init->initCookies(); $this->tag = $init->page; $this->method = $init->method; diff --git a/includes/YesWikiInit.php b/includes/YesWikiInit.php index 9113c737a..2627bfea8 100644 --- a/includes/YesWikiInit.php +++ b/includes/YesWikiInit.php @@ -49,7 +49,7 @@ public function __construct($config = array()) { $this->getRoute(); if (!empty($_SERVER['YESWIKI_DATA_PATH']) && is_dir($_SERVER['YESWIKI_DATA_PATH'])) { - $this->configFile = $_SERVER['YESWIKI_DATA_PATH'].'/yeswiki.config.php'; + $this->configFile = $_SERVER['YESWIKI_DATA_PATH'].'/'.$this->configFile; } $this->config = $this->getConfig($config); $this->setIframeHeaders();