diff --git a/README.md b/README.md
index 5169b5a..8fdffb4 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
# 
-Php web interface to manage Philips Hue lights in a local network.
+Php web interface and api to manage Philips Hue lights in a local network.
## Main Functionnalities
* **Full group management**
* **Scenes update or creation**
-* Manage and run **scripted effects** (debug mode available) ([see wiki](https://github.com/FredBardin/phpMyHue/wiki/Effects-scripts))
+* Manage and run xml **scripted effects** (debug mode available) ([see wiki](https://github.com/FredBardin/phpMyHue/wiki/Effects-scripts))
* **Full rules management** for sensors (simplified mode available for **Hue Tap** switch with on/off functionalities)
* Set color and/or brightness for a light or several at once
* Copy color settings between lights (copy to, copy from, switch with)
diff --git a/histo.txt b/histo.txt
index b2937a2..bfbf13d 100644
--- a/histo.txt
+++ b/histo.txt
@@ -6,6 +6,8 @@ v1.6 - /09/2017 :
- Don't display 'LightSource' groups (already included into 'Luminaire' groups)
WIP - Display now color and brightness of a lamp in details tab even if turned off
WIP - Lights details tab now always displays changes immediately for color or brightness
+ - Add choose language function in 'about' tab for updatable config file
+ (depend on your installation)
v1.5 - 11/09/2016 :
- Add Sensors Rules management
- Update color conversion with new formulas from meethue
diff --git a/include/about.php b/include/about.php
index 388d47e..3349749 100644
--- a/include/about.php
+++ b/include/about.php
@@ -1,21 +1,25 @@
phpMyHue 1.6
-©
F. Bardin 12-2016/01-2017
+©
F. Bardin 04-2015/09-2017
Bridge IP :
-Current language :
+Current language :
-\n";
} // selMethod
-
?>
diff --git a/include/init_conf.php b/include/init_conf.php
index bf876d5..fbc683c 100644
--- a/include/init_conf.php
+++ b/include/init_conf.php
@@ -17,16 +17,37 @@
$conf_file = "config.php";
$template_file = "config.tpl.php";
-
ini_set('default_socket_timeout', 1);
// If config file does not exist : copy template
if (file_exists("include/$conf_file")){
+ @$updconf = $_REQUEST['updconf'];
+ if (isset($updconf)){
+ // Backup config parameters sent
+ @$bridgeip_bck = $_REQUEST['bridgeip'];
+ @$username_bck = $_REQUEST['username'];
+ @$lang_bck = $_REQUEST['lang'];
+
+ // Load config to initialize all parameters
+ include "include/$conf_file";
+
+ // Update old config with new parameter
+ if (isset($bridgeip_bck)){$bridgeip = $bridgeip_bck;}
+ if (isset($username_bck)){$username = $username_bck;}
+ if (isset($lang_bck)){$lang = $lang_bck;}
+
+ // Write new config
+// TODO ==> TO TRANSLATE AND TO DISPLAY as message
+ if (writeConf()){$msg="Config updated";}
+ else {echo "Problem writing config file";}
+ }
+
// Read config
include "include/$conf_file";
} else {
- // Init parameters
@$confstep = $_REQUEST['confstep'];
+
+ // Load config parameters
@$bridgeip = $_REQUEST['bridgeip'];
@$username = $_REQUEST['username'];
@$lang = $_REQUEST['lang'];
@@ -143,7 +164,35 @@ function getUserName(){
// Function to record configuration
//----------------------------------------------
function recordConf(){
- global $trs,$bridgeip,$username,$lang,$conf_file,$template_file;
+ global $trs,$conf_file,$template_file;
+
+ $conf_html="Y";
+ if (! writeConf($conf_html)){// Warning, conf_html is used as reference in the called function. Don't use litteral value.
+ echo "
".$trs["Fatal_Error"]." : ".$trs["Automatic_creation_of"]." 'include/$conf_file' ".$trs["failed"].".
";
+ echo "".$trs["Copy_manually"]." 'include/$template_file' ".$trs["to"]." 'include/$conf_file' ".$trs["then_fill_this_file_with_the_following_values"]." :
";
+ } else {
+ echo "".$trs["Configuration_file_created_successfully_with_the_following_values"]." :
";
+ }
+ // Echo to screen
+ echo "
".$conf_html."
";
+
+} // recordConf
+
+//----------------------------------------------
+// Function to update configuration
+// (no part of ini process)
+//----------------------------------------------
+function updateConf(){
+} // updateConf
+
+//-----------------------------------------------------------------------------------------------
+// Function to (re)write completly config.php file
+// Parameter : conf_html (optional). If set get in return the config file content in html format
+// Return : true/false (true=writing ok, false=error)
+// All config parameters must be already set as global
+//-----------------------------------------------------------------------------------------------
+function writeConf(&$conf_html=""){
+ global $trs,$bridgeip,$username,$lang,$conf_file;
// Init config content
$conf_array = array(
@@ -157,6 +206,8 @@ function recordConf(){
"\$lang = \"$lang\";",
"?>"
);
+
+ // Format array content to be usable
$conf_count = count($conf_array);
$conf_rec = "";
$conf_html = "";
@@ -165,14 +216,9 @@ function recordConf(){
$conf_html .= str_replace(" "," ",htmlentities($conf_array[$i]))."
\n";
}
- if (! file_put_contents("include/$conf_file",$conf_rec)){
- echo "
".$trs["Fatal_Error"]." : ".$trs["Automatic_creation_of"]." 'include/$conf_file' ".$trs["failed"].".
";
- echo "i".$trs["Copy_manually"]." 'include/$template_file' ".$trs["to"]." 'include/$conf_file' ".$trs["then_fill_this_file_with_the_following_values"]." :
";
- } else {
- echo "".$trs["Configuration_file_created_successfully_with_the_following_values"]." :
";
- }
- // Echo to screen
- echo "
".$conf_html."
";
+ // Write conf file
+ if (file_put_contents("include/$conf_file",$conf_rec)){return true;}
+ else {return false;}
+} // writeConf
-} // recordConf
?>