From 2fedd63db4663d30f415296a15a176846ecf32a5 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 29 Apr 2015 09:38:29 +0000 Subject: [PATCH] config : read the configuration from data or datas git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2092 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- config.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/config.php b/config.php index adb84af..f4746e2 100644 --- a/config.php +++ b/config.php @@ -3,6 +3,8 @@ @package domframework @author Dominique Fournier */ +require_once ("domframework/form.php"); + /** Manage the configurations of the module done by administrator in a config file It is based on the module configuration defaults @@ -26,6 +28,10 @@ class config { if (defined("CONFIGFILE")) $this->confFile = CONFIGFILE; + if (file_exists ("./datas/configuration.php")) + $this->confFile = "./datas/configuration.php"; + elseif (file_exists ("./data/configuration.php")) + $this->confFile = "./data/configuration.php"; } /** List all the parameters configurable in the software */ @@ -144,4 +150,25 @@ class config return $phpcode; } + + /** Return an array of fields */ + private function configRead ($params) + { + $fields = array (); + foreach ($params as $p1=>$vals1) + { + if (is_array ($vals1)) + { + $fields = array_merge ($fields, $this->configRead ($vals1)); + } + else + { + $field = new formfield ($vals1, $vals1); + $field->group = $p1; + $fields[] = $field; + unset ($field); + } + } + return $fields; + } }