]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Mar 2023 16:04:09 +0000 (17:04 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Mar 2023 16:04:09 +0000 (17:04 +0100)
.docker/config/httpd/httpd.conf
.htaccess
.idea/dataSources.local.xml
.idea/workspace.xml
config/sdb.php
scripts/lib/lib.php
scripts/lib/scenes.php

index c7da4719a523c7534761a20d4fa1464545897421..36ef7e9ab3294e27a5464a9dfc588414cf782c63 100644 (file)
@@ -289,8 +289,18 @@ DocumentRoot "/usr/local/apache2/htdocs"
     # Controls who can get stuff from this server.
     #
     Require all granted
+
 </Directory>
 
+RemoteIPHeader X-Forwarded-For
+RemoteIPInternalProxy nginx-proxy
+
+<Location />
+   <RequireAny>
+        Require ip 127.0.0.0/8 192.168.13.0/24 172.0.0.0/8
+   </RequireAny>
+</Location>
+
 ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://tortugahome:9000/application/$1" timeout=1800
 
 #
@@ -330,12 +340,12 @@ LogLevel warn
     # The following directives define some format nicknames for use with
     # a CustomLog directive (see below).
     #
-    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
-    LogFormat "%h %l %u %t \"%r\" %>s %b" common
+    LogFormat "%a %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+    LogFormat "%a %h %l %u %t \"%r\" %>s %b" common
 
     <IfModule logio_module>
       # You need to enable mod_logio.c to use %I and %O
-      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
+      LogFormat "%a %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
     </IfModule>
 
     #
index c6081bf3f713c80c6a0d235c28e58aeac330c9c9..e0f71fedad7dcf8f37c920dd17840c33c0373536 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,4 +1,3 @@
-Require ip 127.0.0.0/8 88.190.245.49 192.168.0.0/16 172.0.0.0/8
 <IfModule mod_rewrite.c>
         Options +FollowSymlinks
         RewriteEngine on
index 9ae1436f3b19515e1f0a695102d00fc314b4ab0b..8f6041bff1da1aee504b1c163ff4574f970d0a53 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="dataSourceStorageLocal" created-in="IU-223.8617.56">
+  <component name="dataSourceStorageLocal" created-in="IU-223.8836.41">
     <data-source name="LFY(3).db" uuid="e5a3291d-855f-44b2-be41-76fe6b0c2136">
       <database-info product="SQLite" version="3.25.1" jdbc-version="2.1" driver-name="SQLite JDBC" driver-version="3.25.1" dbms="SQLITE" exact-version="3.25.1" exact-driver-version="3.25">
         <identifier-quote-string>&quot;</identifier-quote-string>
index aaefba82fea77296d9ebce4ae45e82a2264f67a0..a80036acb0e49e845b499154a43aa2947b6e53ca 100644 (file)
@@ -5,8 +5,12 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change beforePath="$PROJECT_DIR$/.docker/config/httpd/httpd.conf" beforeDir="false" afterPath="$PROJECT_DIR$/.docker/config/httpd/httpd.conf" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.htaccess" beforeDir="false" afterPath="$PROJECT_DIR$/.htaccess" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/sdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/sdb.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1672344461763" duration="1440000" />
       <workItem from="1672659425048" duration="1077000" />
       <workItem from="1673335540351" duration="931000" />
-      <workItem from="1676446723673" duration="868000" />
-    </task>
-    <task id="LOCAL-00498" summary=".">
-      <created>1640605498962</created>
-      <option name="number" value="00498" />
-      <option name="presentableId" value="LOCAL-00498" />
-      <option name="project" value="LOCAL" />
-      <updated>1640605498962</updated>
+      <workItem from="1676446723673" duration="874000" />
+      <workItem from="1676884083150" duration="848000" />
+      <workItem from="1676918542672" duration="6000" />
+      <workItem from="1677676568616" duration="586000" />
+      <workItem from="1679405668871" duration="1633000" />
+      <workItem from="1679580438958" duration="5565000" />
     </task>
     <task id="LOCAL-00499" summary=".">
       <created>1640615601707</created>
       <option name="project" value="LOCAL" />
       <updated>1673336865834</updated>
     </task>
-    <option name="localTasksCounter" value="547" />
+    <task id="LOCAL-00547" summary=".">
+      <created>1676451765196</created>
+      <option name="number" value="00547" />
+      <option name="presentableId" value="LOCAL-00547" />
+      <option name="project" value="LOCAL" />
+      <updated>1676451765196</updated>
+    </task>
+    <option name="localTasksCounter" value="548" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 37139fe34b0cc85550a1e925e9b9f45bb30525df..5d0a221af3a12bddc2f1b4bd474be9158076b8e8 100644 (file)
@@ -15,19 +15,21 @@ config('HIDEMASK_TIMEOUT', 250);
 config('THEME', '#92475c');
 
 if (DISPLAYINTERFACE) {
-    $c = sdb();
-    $shortcuts['lights'] = $c['all'];
-    $nav = ['home', 'lights','water', 'music', 'media', 'remote', 'switch', 'settings', 'alert', 'off'];
+       $c = sdb();
+       $shortcuts['lights'] = $c['all'];
+       $nav = ['home', 'lights', 'water', 'music', 'media', 'remote', 'switch', 'settings', 'alert', 'off'];
 
-    include_once ROOT . '/config/music.php';
+       include_once ROOT . '/config/music.php';
 
-    $favoriteslights = [
-        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
-        ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
-    ];
-    $favoriteslights[] = array_merge($allmusics['France Info'], array('volume' => 50));
-    $favoriteslights = array_merge($favoriteslights, $c['favorites']);
-    include "water.php";
-    include "media.php";
-    include "default.php";
+       $favoriteslights = [
+               ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '+', 'label' => '<i class="fa fa-volume-up"></i>'],
+               ['type' => 'volume', 'volume' => config('VOLUME_STEP') . '%', 'increase' => '-', 'label' => '<i class="fa fa-volume-down"></i>'],
+       ];
+       $favoriteslights[] = array_merge($allmusics['France Info'], array('volume' => 45));
+       $favoriteslights = array_merge($favoriteslights, $c['favorites']);
+       $favoriteslights[] = array_merge($allmusics['FIP'], array('volume' => 50));
+       $favoriteslights[] = ['type' => 'phone', 'task' => 'Balance', 'phone' => 'sdb', 'label' => 'Balance'];
+       include "water.php";
+       include "media.php";
+       include "default.php";
 }
\ No newline at end of file
index 8c483f6531d8a351d8beab0d8a704cd67fb92f5d..4089440c90ebfc546ae2dbfcd14ff0588d6f285a 100644 (file)
@@ -59,586 +59,563 @@ profile('Loaded libraries', __FILE__, __LINE__);
 
 register_shutdown_function('shutdown');
 
-function runAtEnd($code)
-{
-    global $endQueue;
-    $endQueue[] = $code;
+function runAtEnd($code) {
+       global $endQueue;
+       $endQueue[] = $code;
 }
 
-function shutdown()
-{
-    global $endQueue;
-    returnHttpResponse();
-    foreach ($endQueue as $code) {
-        eval($code);
-    }
+function shutdown() {
+       global $endQueue;
+       returnHttpResponse();
+       foreach ($endQueue as $code) {
+               eval($code);
+       }
 }
 
-function getCurrentConfig()
-{
-    global $forceConfig;
+function getCurrentConfig() {
+       global $forceConfig;
 
-    $ips = ['192.168.13.31' => 'cuisine', '192.168.13.30' => 'salon', '192.168.13.32' => 'sdb'];
+       $ips = ['192.168.13.31' => 'cuisine', '192.168.13.30' => 'salon', '192.168.13.32' => 'sdb'];
 
-    if (!isset($forceConfig) && isset($_SERVER['HTTP_HOST']) && stristr($_SERVER['HTTP_HOST'], '.home.tortuga.enhydra.fr')) {
-        $e = explode('.', $_SERVER['HTTP_HOST']);
-        $_GET['c'] = array_shift($e);
-    }
+       if (!isset($forceConfig) && isset($_SERVER['HTTP_HOST']) && stristr($_SERVER['HTTP_HOST'], '.home.tortuga.enhydra.fr')) {
+               $e = explode('.', $_SERVER['HTTP_HOST']);
+               $_GET['c'] = array_shift($e);
+       }
 
-    if (isset($forceConfig)) {
-        $_GET['c'] = $forceConfig;
-    }
+       if (isset($forceConfig)) {
+               $_GET['c'] = $forceConfig;
+       }
 
-    $expires = time() + 60 * 60 * 24 * 30;
-    if (isset($_GET['c'])) {
-        $_SESSION['homeconfig'] = $_GET['c'];
-    }
+       $expires = time() + 60 * 60 * 24 * 30;
+       if (isset($_GET['c'])) {
+               $_SESSION['homeconfig'] = $_GET['c'];
+       }
 
 
-    if (!isset($_SESSION['homeconfig'])) {
-        if (isset($_SERVER['HTTP_X_REAL_IP']) && isset($ips[$_SERVER['HTTP_X_REAL_IP']])) {
-            $c = $ips[$_SERVER['HTTP_X_REAL_IP']];
-        } else {
-            $c = 'salon';
-        }
-        $_SESSION['homeconfig'] = $c;
-    }
-    return $_SESSION['homeconfig'];
+       if (!isset($_SESSION['homeconfig'])) {
+               if (isset($_SERVER['HTTP_X_REAL_IP']) && isset($ips[$_SERVER['HTTP_X_REAL_IP']])) {
+                       $c = $ips[$_SERVER['HTTP_X_REAL_IP']];
+               } else {
+                       $c = 'salon';
+               }
+               $_SESSION['homeconfig'] = $c;
+       }
+       return $_SESSION['homeconfig'];
 }
 
-function config($key = null, $value = null)
-{
-    global $config;
-    if (!isset($config)) {
-        $config = ['SLEEPSCREEN' => 0, 'MUSICPLAYER' => 'squeezebox', 'SLEEPTYPE' => 'off', 'DEVICE' => getCurrentConfig(), 'VOLUME_DEVICE' => 'auto'];
-    }
-    if (null == $key) {
-        return $config;
-    }
-    if (null == $value && isset($config[$key])) {
-        return $config[$key];
-    }
-    $config[$key] = $value;
-    return $config[$key];
+function config($key = null, $value = null) {
+       global $config;
+       if (!isset($config)) {
+               $config = ['SLEEPSCREEN' => 0, 'MUSICPLAYER' => 'squeezebox', 'SLEEPTYPE' => 'off', 'DEVICE' => getCurrentConfig(), 'VOLUME_DEVICE' => 'auto'];
+       }
+       if (null == $key) {
+               return $config;
+       }
+       if (null == $value && isset($config[$key])) {
+               return $config[$key];
+       }
+       $config[$key] = $value;
+       return $config[$key];
 }
 
-function hasConfig($key)
-{
-    global $config;
-    return isset($config[$key]);
+function hasConfig($key) {
+       global $config;
+       return isset($config[$key]);
 }
 
-function getLinkHash($s)
-{
-    return sha1(json_encode($s));
+function getLinkHash($s) {
+       return sha1(json_encode($s));
 }
 
-function accordionClosed($accordionId)
-{
-    return getState($accordionId, '0') == '0';
+function accordionClosed($accordionId) {
+       return getState($accordionId, '0') == '0';
 }
 
-function shortcutDir($allshortcuts)
-{
-    $res = array();
-    $hashs = array();
-    if (!is_array($allshortcuts)) {
-        $allshortcuts = array();
-    }
-
-
-    foreach ($allshortcuts as $name => $shortcuts) {
-        $cols = strpos($name, 'remote') !== 0;
-
-        $size = '';
-        if (isset($shortcuts['size'])) {
-            $size = ' data-size="' . $shortcuts['size'] . '"';
-            unset($shortcuts['size']);
-        }
-
-        $section = '<section ' . $size . ' data-section="' . $name . '">';
-        $fit = ($name == 'remote-default');
-        $i = 0;
-        if ($fit) {
-            $section .= '<div class="fit">';
-        }
-        foreach ($shortcuts as $k => $s) {
-            if ($s['type'] == 'clear' || $s['type'] == 'accordion' || $s['type'] == 'accordion-end') {
-                if ($i % 2 == 1) {
-                    $section .= '</div>';
-                    $i = 0;
-                }
-
-                if ($s['type'] === 'clear') {
-                    $section .= '<div class="clearcol"></div>';
-                } else if ($s['type'] === 'accordion') {
-                    $section .= '<accordion id="' . $s['id'] . '" class="accordion ' . (isset($s['closed']) && $s['closed'] ? 'closed' : '') . '"><a><span>' . $s['label'] . '</span></a>';
-                } else if ($s['type'] === 'accordion-end') {
-                    $section .= '</accordion>';
-                }
-
-                continue;
-            }
-            $size = '';
-            if (isset($s['size'])) {
-                $size = ' data-size="' . $s['size'] . '"';
-            }
-            if ($cols && $i % 2 == 0) {
-                $section .= '<div class="col" ' . $size . '>';
-            }
-
-            $hash = getLinkHash($s);
-            $shortcut = shortcut($s, $hash);
-            $section .= $shortcut;
-            $hashs[$hash] = $shortcut;
-
-            $i++;
-            if ($cols && $i % 2 == 0) {
-                $section .= '</div>';
-            }
-        }
-        if ($cols && $i % 2 == 1) {
-            $section .= '</div>';
-        }
-        if ($fit) {
-            $section .= '</div>';
-        }
-        $section .= '</section>';
-        $res[$name] = $section;
-    }
-
-    $json = json_encode($res);
-
-    connectRedis()->igbset('shortcuts.' . getCurrentConfig(), $json);
-    profile('save cache shortcuts', __FILE__, __LINE__);
-
-    return 'SECTIONS = ' . $json . ';';
+function shortcutDir($allshortcuts) {
+       $res = array();
+       $hashs = array();
+       if (!is_array($allshortcuts)) {
+               $allshortcuts = array();
+       }
+
+
+       foreach ($allshortcuts as $name => $shortcuts) {
+               $cols = strpos($name, 'remote') !== 0;
+
+               $size = '';
+               if (isset($shortcuts['size'])) {
+                       $size = ' data-size="' . $shortcuts['size'] . '"';
+                       unset($shortcuts['size']);
+               }
+
+               $section = '<section ' . $size . ' data-section="' . $name . '">';
+               $fit = ($name == 'remote-default');
+               $i = 0;
+               if ($fit) {
+                       $section .= '<div class="fit">';
+               }
+               foreach ($shortcuts as $k => $s) {
+                       if ($s['type'] == 'clear' || $s['type'] == 'accordion' || $s['type'] == 'accordion-end') {
+                               if ($i % 2 == 1) {
+                                       $section .= '</div>';
+                                       $i = 0;
+                               }
+
+                               if ($s['type'] === 'clear') {
+                                       $section .= '<div class="clearcol"></div>';
+                               } else if ($s['type'] === 'accordion') {
+                                       $section .= '<accordion id="' . $s['id'] . '" class="accordion ' . (isset($s['closed']) && $s['closed'] ? 'closed' : '') . '"><a><span>' . $s['label'] . '</span></a>';
+                               } else if ($s['type'] === 'accordion-end') {
+                                       $section .= '</accordion>';
+                               }
+
+                               continue;
+                       }
+                       $size = '';
+                       if (isset($s['size'])) {
+                               $size = ' data-size="' . $s['size'] . '"';
+                       }
+                       if ($cols && $i % 2 == 0) {
+                               $section .= '<div class="col" ' . $size . '>';
+                       }
+
+                       $hash = getLinkHash($s);
+                       $shortcut = shortcut($s, $hash);
+                       $section .= $shortcut;
+                       $hashs[$hash] = $shortcut;
+
+                       $i++;
+                       if ($cols && $i % 2 == 0) {
+                               $section .= '</div>';
+                       }
+               }
+               if ($cols && $i % 2 == 1) {
+                       $section .= '</div>';
+               }
+               if ($fit) {
+                       $section .= '</div>';
+               }
+               $section .= '</section>';
+               $res[$name] = $section;
+       }
+
+       $json = json_encode($res);
+
+       connectRedis()->igbset('shortcuts.' . getCurrentConfig(), $json);
+       profile('save cache shortcuts', __FILE__, __LINE__);
+
+       return 'SECTIONS = ' . $json . ';';
 }
 
 
-function shortcut($s, $hash)
-{
-    $attrs = array();
-    $markup = 'a';
-
-    if (isset($s['size'])) {
-        $attrs['data-size'] = $s['size'];
-        unset($s['size']);
-    }
-
-    if (is_string($s)) {
-        return;
-    }
-
-    $swcorner = '';
-
-    if ($s['type'] == 'ajax') {
-        $attrs['class'] = 'ajax';
-        $attrs['href'] = $s['url'];
-    } elseif ($s['type'] == 'task') {
-        $attrs['class'] = 'ajax';
-        $attrs['href'] = 'scripts/tortugatask.php?task=' . $s['command'];
-    } elseif ($s['type'] == 'light') {
-        $attrs['class'] = 'ajax';
-        $attrs['href'] = 'scripts/light.php?scene=' . $s['scene'];
-    } elseif ($s['type'] == 'url') {
-        $attrs['href'] = $s['href'];
-        if (isset($s['iframe']) && $s['iframe']) {
-            $attrs['class'] = 'iframe';
-        } else if (isset($s['tab']) && $s['tab']) {
-            $attrs['target'] = '_blank';
-        }
-    } else if ($s['type'] == 'squeeze' || $s['type'] == 'squeeze_spotify') {
-        $attrs['href'] = 'scripts/squeeze.php?player=' . config('SQUEEZEBOX_PLAYER') . '&name=' . $s['label'] . '&type=' . $s['type'];
-        $attrs['class'] = 'ajax music';
-    } else if ($s['type'] == 'squeeze_ambiance') {
-        $attrs['href'] = 'scripts/squeeze.php?player=' . config('SQUEEZEBOX_AMBIANCE_PLAYER') . '&name=' . $s['label'] . '&type=' . $s['type'];
-        $attrs['class'] = 'ajax';
-        $attrs['data-squeeze-volume'] = 60;
-        $attrs['data-squeeze-player'] = config('SQUEEZEBOX_AMBIANCE_PLAYER');
-    } else if ($s['type'] == 'vlc' || $s['type'] == 'omx') {
-        $attrs['href'] = $s['url'];
-        $attrs['class'] = $s['type'];
-    } elseif ($s['type'] == 'time') {
-        $attrs['href'] = isset($_GET['h']) && $_GET['h'] ? '//' . $_GET['h'] . '/' : '/';
-        $attrs['data-init'] = "0";
-        $attrs['data-init-function'] = "updateTime";
-        $attrs['class'] = $s['type'] . ' info';
-        if (!isset($s['label'])) {
-            $s['label'] = '-';
-        }
-    } elseif ($s['type'] == 'time' || $s['type'] == 'separator' || $s['type'] == 'back') {
-        $attrs['class'] = $s['type'] . ' info';
-        if (!isset($s['label'])) {
-            $s['label'] = '-';
-        }
-    } elseif ($s['type'] == 'volume') {
-        $attrs['class'] = 'ajax';
-        $attrs['href'] = 'scripts/volume.php?volume=' . $s['volume'];
-        if (isset($s['increase'])) {
-            $attrs['href'] .= '&increase=' . $s['increase'];
-        }
-        unset($s['volume']);
-    } else if ($s['type'] == 'weather') {
-        $attrs['class'] = $s['type'] . ' info';
-        $attrs['data-init'] = "0";
-        $attrs['data-init-function'] = "updateWeather";
-        $s['label'] = '
+function shortcut($s, $hash) {
+       $attrs = array();
+       $markup = 'a';
+
+       if (isset($s['size'])) {
+               $attrs['data-size'] = $s['size'];
+               unset($s['size']);
+       }
+
+       if (is_string($s)) {
+               return;
+       }
+
+       $swcorner = '';
+
+       if ($s['type'] == 'ajax') {
+               $attrs['class'] = 'ajax';
+               $attrs['href'] = $s['url'];
+       } elseif ($s['type'] == 'task') {
+               $attrs['class'] = 'ajax';
+               $attrs['href'] = 'scripts/tortugatask.php?task=' . $s['command'];
+       } elseif ($s['type'] == 'light') {
+               $attrs['class'] = 'ajax';
+               $attrs['href'] = 'scripts/light.php?scene=' . $s['scene'];
+       } elseif ($s['type'] == 'url') {
+               $attrs['href'] = $s['href'];
+               if (isset($s['iframe']) && $s['iframe']) {
+                       $attrs['class'] = 'iframe';
+               } else if (isset($s['tab']) && $s['tab']) {
+                       $attrs['target'] = '_blank';
+               }
+       } else if ($s['type'] == 'squeeze' || $s['type'] == 'squeeze_spotify') {
+               $attrs['href'] = 'scripts/squeeze.php?player=' . config('SQUEEZEBOX_PLAYER') . '&name=' . $s['label'] . '&type=' . $s['type'];
+               $attrs['class'] = 'ajax music';
+       } else if ($s['type'] == 'squeeze_ambiance') {
+               $attrs['href'] = 'scripts/squeeze.php?player=' . config('SQUEEZEBOX_AMBIANCE_PLAYER') . '&name=' . $s['label'] . '&type=' . $s['type'];
+               $attrs['class'] = 'ajax';
+               $attrs['data-squeeze-volume'] = 60;
+               $attrs['data-squeeze-player'] = config('SQUEEZEBOX_AMBIANCE_PLAYER');
+       } else if ($s['type'] == 'vlc' || $s['type'] == 'omx') {
+               $attrs['href'] = $s['url'];
+               $attrs['class'] = $s['type'];
+       } elseif ($s['type'] == 'time') {
+               $attrs['href'] = isset($_GET['h']) && $_GET['h'] ? '//' . $_GET['h'] . '/' : '/';
+               $attrs['data-init'] = "0";
+               $attrs['data-init-function'] = "updateTime";
+               $attrs['class'] = $s['type'] . ' info';
+               if (!isset($s['label'])) {
+                       $s['label'] = '-';
+               }
+       } elseif ($s['type'] == 'time' || $s['type'] == 'separator' || $s['type'] == 'back') {
+               $attrs['class'] = $s['type'] . ' info';
+               if (!isset($s['label'])) {
+                       $s['label'] = '-';
+               }
+       } elseif ($s['type'] == 'volume') {
+               $attrs['class'] = 'ajax';
+               $attrs['href'] = 'scripts/volume.php?volume=' . $s['volume'];
+               if (isset($s['increase'])) {
+                       $attrs['href'] .= '&increase=' . $s['increase'];
+               }
+               unset($s['volume']);
+       } else if ($s['type'] == 'weather') {
+               $attrs['class'] = $s['type'] . ' info';
+               $attrs['data-init'] = "0";
+               $attrs['data-init-function'] = "updateWeather";
+               $s['label'] = '
 <div class="icons"><span class="icon-day"></span><span class="icon-night"></span></div>
 <span class="temp"></span>
 <div class="temperatures"><span class="temp-min"></span><span class="temp-max"></span></div>';
-    } elseif ($s['type'] == 'traffic') {
-        $attrs['class'] = $s['type'] . ' info';
-        $attrs['data-init'] = "0";
-        $attrs['data-init-function'] = "updateTraffic";
-        $s['label'] = '<div class="departure">Départ à <span class="dtime"></span></div>
+       } elseif ($s['type'] == 'traffic') {
+               $attrs['class'] = $s['type'] . ' info';
+               $attrs['data-init'] = "0";
+               $attrs['data-init-function'] = "updateTraffic";
+               $s['label'] = '<div class="departure">Départ à <span class="dtime"></span></div>
 <ul class="issy"><li class="car"></li><li class="subway"></li><li class="bike"></li></ul>
 <div class="total_jams"><span class="jams"></span> de bouchons</div>';
 
-    } elseif ($s['type'] == 'velib') {
-        $attrs['class'] = $s['type'] . ' info';
-        $attrs['data-init'] = "0";
-        $attrs['data-init-function'] = "updateVelib";
-        $s['label'] = '<div class="dtime"></div><ul></ul>';
-    } elseif ($s['type'] == 'action') {
-        $attrs['data-action'] = $s['action'];
-        $attrs['data-device'] = isset($s['device']) ? $s['device'] : getCurrentConfig();
-        $attrs['href'] = '#';
-    } else if ($s['type'] == 'sub') {
-        if (strpos($s['sub'], 'sub-') === false) {
-            $s['sub'] = 'sub-' . $s['sub'];
-        }
-        $attrs['data-menu'] = $s['sub'];
-        $attrs['href'] = '#';
-    } else if ($s['type'] == 'phone') {
-        $attrs['href'] = 'scripts/phonetask.php?phone=' . $s['phone'] . '&task=' . trim(base64_encode($s['task']), "=");
-        $attrs['class'] = 'ajax';
-    } elseif ($s['type'] == 'media') {
-        $attrs['href'] = isset($s['path']) ? $s['path'] : $s['url'];
-        $attrs['class'] = 'media';
-    } elseif ($s['type'] == 'freebox' || $s['type'] === 'shield' || $s['type'] === 'netflix' || $s['type'] === 'amazonprime' || $s['type'] === 'nintendoswitch') {
-        $attrs['href'] = $s['url'];
-        $attrs['class'] = 'ajax play ' . $s['type'];
-        $attrs['data-remote'] = "1";
-    } else if ($s['type'] == 'map') {
-        $rand = rand(1, 1000000);
-        $html = '<img width="' . $s['width'] . '" height="' . $s['height'] . '" src="' . $s['image'] . '" usemap="#map_' . $rand . '" /><map class="' . $s['class'] . '" name="map_' . $rand . '">' . $s['map'] . '</map>';
-    } else if ($s['type'] == 'missing') {
-        $attrs['class'] = 'missing';
-    } else if ($s['type'] == 'bricks') {
-        $html = makeBricks($s['bricks']);
-    } else if ($s['type'] == 'raspberrycast') {
-        $attrs['class'] = 'raspberrycast';
-    } else if ($s['type'] == 'harmonyactivity') {
-        $attrs['class'] = 'harmonyactivity';
-        $attrs['data-activity'] = $s['activity'];
-    } else if ($s['type'] == 'ifttt') {
-        $attrs['class'] = 'ifttt';
-        $attrs['data-event'] = $s['event'];
-    } else if ($s['type'] == 'switch' || $s['type'] === 'switchshare') {
-        $attrs['href'] = '//' . $s['room'] . '.home.tortuga.enhydra.fr/';
-        if ($s['type'] == 'share') {
-            $h = isset($_GET['h']) && $_GET['h'] ? $_GET['h'] : $_SERVER['HTTP_HOST'];
-            $attrs['href'] .= '?h=' . $h;
-        } else {
-            $attrs['class'] = $s['type'];
-        }
-        $attrs['style'] = 'background-image:url(/images/rooms/small/' . $s['room'] . '.jpg);background-size:cover;color:#fff;text-shadow:3px;';
-    }
-
-    if (isset($s['seen']) && $s['seen']) {
-        $attrs['data-seen'] = '1';
-    }
-
-    if (isset($s['srt']) && count($s['srt'])) {
-        $langtoemoji = ['fr' => '🇫🇷', 'en' => '🇺🇸'];
-        foreach ($s['srt'] as $item) {
-            $swcorner .= '<span>' . $langtoemoji[$item] . '</span>';
-        }
-    }
-
-
-    if (isset($s['poster'])) {
-        if (!isset($attrs['class'])) {
-            $attrs['class'] = '';
-        }
-        $attrs['class'] .= ' poster';
-        $attrs['style'] = 'background-image:url(' . $s['poster'] . ');';
-        $s['label'] = '';
-    }
-
-    if ($markup == 'a' && !isset($attrs['href'])) {
-        $attrs['href'] = '#';
-    }
-
-    if (isset($s['screenoff'])) {
-        $attrs['data-screenoff'] = 1;
-    }
-    if (isset($s['volume'])) {
-        $attrs['data-volume'] = $s['volume'];
-    }
-
-    if (isset($s['confirm'])) {
-        $attrs['data-confirm'] = json_encode($s['confirm']['conditions']);
-        $attrs['data-confirm-message'] = $s['confirm']['message'];
-    }
-
-
-    if (isset($html)) {
-        $res = $html;
-    } else {
-        $res = '<' . $markup;
-        foreach ($attrs as $k => $v) {
-            if (is_array($v) || is_object($v)) {
-                $v = json_encode($v);
-            }
-
-            $res .= ' ' . $k . '="' . htmlspecialchars($v) . '"';
-        }
-        if (!isset($s['label'])) {
-            $s['label'] = '';
-        }
-        $res .= '><span>' . $s['label'] . '</span><div class="sw-corner">' . $swcorner . '</div></' . $markup . '>';
-    }
-    return $res;
+       } elseif ($s['type'] == 'velib') {
+               $attrs['class'] = $s['type'] . ' info';
+               $attrs['data-init'] = "0";
+               $attrs['data-init-function'] = "updateVelib";
+               $s['label'] = '<div class="dtime"></div><ul></ul>';
+       } elseif ($s['type'] == 'action') {
+               $attrs['data-action'] = $s['action'];
+               $attrs['data-device'] = isset($s['device']) ? $s['device'] : getCurrentConfig();
+               $attrs['href'] = '#';
+       } else if ($s['type'] == 'sub') {
+               if (strpos($s['sub'], 'sub-') === false) {
+                       $s['sub'] = 'sub-' . $s['sub'];
+               }
+               $attrs['data-menu'] = $s['sub'];
+               $attrs['href'] = '#';
+       } else if ($s['type'] == 'phone') {
+               $attrs['href'] = 'scripts/phonetask.php?phone=' . $s['phone'] . '&task=' . trim($s['task']);
+               $attrs['class'] = 'ajax';
+       } elseif ($s['type'] == 'media') {
+               $attrs['href'] = isset($s['path']) ? $s['path'] : $s['url'];
+               $attrs['class'] = 'media';
+       } elseif ($s['type'] == 'freebox' || $s['type'] === 'shield' || $s['type'] === 'netflix' || $s['type'] === 'amazonprime' || $s['type'] === 'nintendoswitch') {
+               $attrs['href'] = $s['url'];
+               $attrs['class'] = 'ajax play ' . $s['type'];
+               $attrs['data-remote'] = "1";
+       } else if ($s['type'] == 'map') {
+               $rand = rand(1, 1000000);
+               $html = '<img width="' . $s['width'] . '" height="' . $s['height'] . '" src="' . $s['image'] . '" usemap="#map_' . $rand . '" /><map class="' . $s['class'] . '" name="map_' . $rand . '">' . $s['map'] . '</map>';
+       } else if ($s['type'] == 'missing') {
+               $attrs['class'] = 'missing';
+       } else if ($s['type'] == 'bricks') {
+               $html = makeBricks($s['bricks']);
+       } else if ($s['type'] == 'raspberrycast') {
+               $attrs['class'] = 'raspberrycast';
+       } else if ($s['type'] == 'harmonyactivity') {
+               $attrs['class'] = 'harmonyactivity';
+               $attrs['data-activity'] = $s['activity'];
+       } else if ($s['type'] == 'ifttt') {
+               $attrs['class'] = 'ifttt';
+               $attrs['data-event'] = $s['event'];
+       } else if ($s['type'] == 'switch' || $s['type'] === 'switchshare') {
+               $attrs['href'] = '//' . $s['room'] . '.home.tortuga.enhydra.fr/';
+               if ($s['type'] == 'share') {
+                       $h = isset($_GET['h']) && $_GET['h'] ? $_GET['h'] : $_SERVER['HTTP_HOST'];
+                       $attrs['href'] .= '?h=' . $h;
+               } else {
+                       $attrs['class'] = $s['type'];
+               }
+               $attrs['style'] = 'background-image:url(/images/rooms/small/' . $s['room'] . '.jpg);background-size:cover;color:#fff;text-shadow:3px;';
+       }
+
+       if (isset($s['seen']) && $s['seen']) {
+               $attrs['data-seen'] = '1';
+       }
+
+       if (isset($s['srt']) && count($s['srt'])) {
+               $langtoemoji = ['fr' => '🇫🇷', 'en' => '🇺🇸'];
+               foreach ($s['srt'] as $item) {
+                       $swcorner .= '<span>' . $langtoemoji[$item] . '</span>';
+               }
+       }
+
+
+       if (isset($s['poster'])) {
+               if (!isset($attrs['class'])) {
+                       $attrs['class'] = '';
+               }
+               $attrs['class'] .= ' poster';
+               $attrs['style'] = 'background-image:url(' . $s['poster'] . ');';
+               $s['label'] = '';
+       }
+
+       if ($markup == 'a' && !isset($attrs['href'])) {
+               $attrs['href'] = '#';
+       }
+
+       if (isset($s['screenoff'])) {
+               $attrs['data-screenoff'] = 1;
+       }
+       if (isset($s['volume'])) {
+               $attrs['data-volume'] = $s['volume'];
+       }
+
+       if (isset($s['confirm'])) {
+               $attrs['data-confirm'] = json_encode($s['confirm']['conditions']);
+               $attrs['data-confirm-message'] = $s['confirm']['message'];
+       }
+
+
+       if (isset($html)) {
+               $res = $html;
+       } else {
+               $res = '<' . $markup;
+               foreach ($attrs as $k => $v) {
+                       if (is_array($v) || is_object($v)) {
+                               $v = json_encode($v);
+                       }
+
+                       $res .= ' ' . $k . '="' . htmlspecialchars($v) . '"';
+               }
+               if (!isset($s['label'])) {
+                       $s['label'] = '';
+               }
+               $res .= '><span>' . $s['label'] . '</span><div class="sw-corner">' . $swcorner . '</div></' . $markup . '>';
+       }
+       return $res;
 }
 
-function init()
-{
-    global $volume;
-    $volume = intval(CONFIG('VOLUME', '0'));
-    if ($volume > 0) {
-        volume($volume);
-    }
-    profile('Inited', __FILE__, __LINE__);
+function init() {
+       global $volume;
+       $volume = intval(CONFIG('VOLUME', '0'));
+       if ($volume > 0) {
+               volume($volume);
+       }
+       profile('Inited', __FILE__, __LINE__);
 }
 
-function getJsonRPCClientInstance($url)
-{
-    global $rpcclient;
-    if (!isset($rpcclient)) {
-        $rpcclient = new \Datto\JsonRpc\Http\Client($url);
-    }
-    return $rpcclient;
+function getJsonRPCClientInstance($url) {
+       global $rpcclient;
+       if (!isset($rpcclient)) {
+               $rpcclient = new \Datto\JsonRpc\Http\Client($url);
+       }
+       return $rpcclient;
 }
 
-function getSynologyInstance()
-{
-    global $syno;
-    if (!isset($syno)) {
-        $syno = new Synology_Api('192.168.13.3', 5002, 'https', 1);
-        $syno->connect('Vincent', 'xxxx');
-    }
-    return $syno;
+function getSynologyInstance() {
+       global $syno;
+       if (!isset($syno)) {
+               $syno = new Synology_Api('192.168.13.3', 5002, 'https', 1);
+               $syno->connect('Vincent', 'xxxx');
+       }
+       return $syno;
 }
 
-function hasNetwork()
-{
-    return true;
+function hasNetwork() {
+       return true;
 }
 
-function ping($ip, $timeout = 5, $port = 1817)
-{
-    $res = @fsockopen($ip, $port, $errno, $errstr, $timeout);
-    if (!$res) {
-        echo $errno . ': ' . $errstr . "\n";
-    }
-    return $res;
+function ping($ip, $timeout = 5, $port = 1817) {
+       $res = @fsockopen($ip, $port, $errno, $errstr, $timeout);
+       if (!$res) {
+               echo $errno . ': ' . $errstr . "\n";
+       }
+       return $res;
 }
 
-function volume($volume, $increase = '', $device = null)
-{
-    $d = $device === null ? config('VOLUME_DEVICE') : $device;
-    echo $d . ';' . $volume . ';' . $increase;
-
-    if ($increase == ' ') {
-        $increase = '+';
-    }
-
-    $e = explode(':', $d);
-
-    $device = config('DEVICE');
-    if (isset($e[1])) {
-        $device = $e[1];
-        $d = $e[0];
-    }
-    $d = mb_strtolower($d);
-
-    switch ($d) {
-        case 'shield':
-            if ($increase == '-') {
-                return shieldKey('volume-down', $device);
-            } else {
-                return shieldKey('volume-up', $device);
-            }
-        case 'raspberry':
-        case 'raspberrypi':
-            $cmd = 'amixer -c 0 -M -- sset PCM playback ' . round(max(0, min(100, $volume))) . '%' . $increase;
-            return sshCommand($cmd, $device);
-        case 'squeezeboplayer':
-        case 'squeezeboxplayer':
-        case 'squeezebox':
-            return squeezeVolume($volume, $increase, config('SQUEEZEBOX_PLAYER'));
-        case 'harmony':
-            $lastHarmonyVolume = min(time(), getState('last_harmony_volume', 0));
-            $limit = time() - 2;
-            if ($lastHarmonyVolume > $limit) {
-                return;
-            }
-            setState('last_harmony_volume', time());
-
-            $volume = min(5, max(1, $volume));
-
-            if ($increase == '-') {
-                return harmonyRequest('commands/volume-down?repeat=' . $volume, 'POST');
-            } else {
-                return harmonyRequest('commands/volume-up?repeat=' . $volume, 'POST');
-            }
-        case 'vlc':
-            return VLCCmd(['command' => 'volume', 'val' => $increase . '20'], $device);
-        case 'denonavr':
-            return denonAVRVolume($volume, $increase);
-    }
+function volume($volume, $increase = '', $device = null) {
+       $d = $device === null ? config('VOLUME_DEVICE') : $device;
+       echo $d . ';' . $volume . ';' . $increase;
+
+       if ($increase == ' ') {
+               $increase = '+';
+       }
+
+       $e = explode(':', $d);
+
+       $device = config('DEVICE');
+       if (isset($e[1])) {
+               $device = $e[1];
+               $d = $e[0];
+       }
+       $d = mb_strtolower($d);
+
+       switch ($d) {
+               case 'shield':
+                       if ($increase == '-') {
+                               return shieldKey('volume-down', $device);
+                       } else {
+                               return shieldKey('volume-up', $device);
+                       }
+               case 'raspberry':
+               case 'raspberrypi':
+                       $cmd = 'amixer -c 0 -M -- sset PCM playback ' . round(max(0, min(100, $volume))) . '%' . $increase;
+                       return sshCommand($cmd, $device);
+               case 'squeezeboplayer':
+               case 'squeezeboxplayer':
+               case 'squeezebox':
+                       return squeezeVolume($volume, $increase, config('SQUEEZEBOX_PLAYER'));
+               case 'harmony':
+                       $lastHarmonyVolume = min(time(), getState('last_harmony_volume', 0));
+                       $limit = time() - 2;
+                       if ($lastHarmonyVolume > $limit) {
+                               return;
+                       }
+                       setState('last_harmony_volume', time());
+
+                       $volume = min(5, max(1, $volume));
+
+                       if ($increase == '-') {
+                               return harmonyRequest('commands/volume-down?repeat=' . $volume, 'POST');
+                       } else {
+                               return harmonyRequest('commands/volume-up?repeat=' . $volume, 'POST');
+                       }
+               case 'vlc':
+                       return VLCCmd(['command' => 'volume', 'val' => $increase . '20'], $device);
+               case 'denonavr':
+                       return denonAVRVolume($volume, $increase);
+       }
 }
 
-function triggerErrorNotif($title, $message = '')
-{
-    phoneTask('TortugaMessage|||' . $title . '|||' . $message, 'vincent', true);
+function triggerErrorNotif($title, $message = '') {
+       phoneTask('TortugaMessage|||' . $title . '|||' . $message, 'vincent', true);
 }
 
-function phoneTask($task, $phone, $encode = true)
-{
-    global $phones;
-    $p = $phones[$phone];
-
-    if ($encode) {
-        $task = trim(base64_encode($task), '=');
-    }
-    $task = $task . "=:=task";
-
-    $password = $p['password'];
-
-    $url = "http://$p[ip]:1817/?message=$task&password=" . $password;
-    $res = getUrlContent($url);
-    //echo $url . ' : ' . $res . "\n--\n";
-    if (!$res) {
-        $url = "https://autoremotejoaomgcd.appspot.com/sendmessage?key=$p[key]&message=$task&target=TORTUGA&password=$password";
-        $res = getUrlContent($url);
-        //echo $url . ' : ' . $res . "\n--\n";
-    }
-    return $res;
+function phoneTask($task, $phone, $encode = true) {
+       global $phones;
+       $p = $phones[$phone];
+
+       if ($encode) {
+               $task = trim(base64_encode($task), '=');
+       }
+       $task = $task . "=:=task";
+
+       $password = $p['password'];
+
+       $url = "http://$p[ip]:1817/?message=$task&password=" . $password;
+       $res = getUrlContent($url);
+       //echo $url . ' : ' . $res . "\n--\n";
+       if (!$res) {
+               $url = "https://autoremotejoaomgcd.appspot.com/sendmessage?key=$p[key]&message=$task&target=TORTUGA&password=$password";
+               $res = getUrlContent($url);
+               //echo $url . ' : ' . $res . "\n--\n";
+       }
+       return $res;
 }
 
-function getUrlContent($url, $timeout = 30, $user = false, $newclient = false)
-{
-    $httpclient = getHttpClient($newclient);
-    $options = ['timeout' => $timeout, 'read_timeout' => $timeout];
-    if ($user !== false) {
-        $options['auth'] = $user;
-    }
-    try {
-        $response = $httpclient->get($url, $options);
-        return $response->getBody();
-    } catch (Exception $e) {
-        echo $e->getMessage();
-        return false;
-    }
+function getUrlContent($url, $timeout = 30, $user = false, $newclient = false) {
+       $httpclient = getHttpClient($newclient);
+       $options = ['timeout' => $timeout, 'read_timeout' => $timeout];
+       if ($user !== false) {
+               $options['auth'] = $user;
+       }
+       try {
+               $response = $httpclient->get($url, $options);
+               return $response->getBody();
+       } catch (Exception $e) {
+               echo $e->getMessage();
+               return false;
+       }
 }
 
-function waitEvent($event)
-{
-    $file = ROOT . '/cache/events/' . $event;
-    while (true) {
-        if (file_exists($file)) {
-            if (filemtime($file) < time() - 60) {
-                // Expired event
-                rename($file, $file . '_' . microtime(false));
-                continue;
-            }
-            rename($file, $file . '_' . microtime(false));
-            break;
-        }
-        usleep(0.1 * 1000000);
-    }
+function waitEvent($event) {
+       $file = ROOT . '/cache/events/' . $event;
+       while (true) {
+               if (file_exists($file)) {
+                       if (filemtime($file) < time() - 60) {
+                               // Expired event
+                               rename($file, $file . '_' . microtime(false));
+                               continue;
+                       }
+                       rename($file, $file . '_' . microtime(false));
+                       break;
+               }
+               usleep(0.1 * 1000000);
+       }
 }
 
-function returnHttpResponse()
-{
-    ignore_user_abort(true);
-    if (!defined('TIMELIMIT')) {
-        set_time_limit(0);
-    }
-    if (!headers_sent()) {
-        header('Connection: close');
-        header('Content-Length: ' . ob_get_length());
-    }
-    @ob_end_flush();
-    @ob_flush();
-    @flush();
-    if (session_id()) session_write_close();
-    if (function_exists('fastcgi_finish_request')) {
-        fastcgi_finish_request();
-    }
+function returnHttpResponse() {
+       ignore_user_abort(true);
+       if (!defined('TIMELIMIT')) {
+               set_time_limit(0);
+       }
+       if (!headers_sent()) {
+               header('Connection: close');
+               header('Content-Length: ' . ob_get_length());
+       }
+       @ob_end_flush();
+       @ob_flush();
+       @flush();
+       if (session_id())
+               session_write_close();
+       if (function_exists('fastcgi_finish_request')) {
+               fastcgi_finish_request();
+       }
 }
 
-function isProcessRunning($process)
-{
-    exec("ps aux | grep -i '" . $process . "' | grep -v grep", $pids);
-    if (empty($pids)) {
-        return false;
-    }
-    return true;
+function isProcessRunning($process) {
+       exec("ps aux | grep -i '" . $process . "' | grep -v grep", $pids);
+       if (empty($pids)) {
+               return false;
+       }
+       return true;
 }
 
-function toNumber($val, $round = false)
-{
-    if ($val === false) {
-        return '--';
-    }
-    $e = explode(',', $val);
-    $val = $e[0];
-    $val = preg_replace('/[^0-9-.]/', '', $val);
-    $val = floatval($val);
-    if ($round) {
-        $val = round($val, $round === true ? 0 : $round);
-    }
-    return $val;
+function toNumber($val, $round = false) {
+       if ($val === false) {
+               return '--';
+       }
+       $e = explode(',', $val);
+       $val = $e[0];
+       $val = preg_replace('/[^0-9-.]/', '', $val);
+       $val = floatval($val);
+       if ($round) {
+               $val = round($val, $round === true ? 0 : $round);
+       }
+       return $val;
 }
 
-function makeNav($nav)
-{
-    $map = [
-        'home' => '<div data-menu="home"><i class="fa fa-home" aria-hidden="true"></i><span>Accueil</span></div>',
-        'lights' => '<div data-menu="lights"><i class="far fa-lightbulb" aria-hidden="true"></i><span>Lumières</span></div>',
-        'music' => '<div data-menu="music"><i class="fa fa-music" aria-hidden="true"></i><span>Musique & Radio</span></div>',
-        'media' => '<div data-menu="media"><i class="fa fa-tv-retro" aria-hidden="true"></i><span>Medias & TV</span></div>',
-        'coffee' => '<div data-menu="coffee"><i class="fa fa-oven" aria-hidden="true"></i><span>Cuisine / Café</span></div>',
-        'water' => '<div data-menu="water"><i class="fa fa-faucet-drip" aria-hidden="true"></i><span>Eau chaude</span></div>',
-        'fan' => '<a href="/scripts/light.php?scene=' . config('ROOM') . '/fan/toggle" class="ajax"><i class="fa fa-fan" aria-hidden="true"></i><span>Ventilateur</span></a>',
-        'remote' => '<div data-menu="remote"><i class="fa fa-play" aria-hidden="true"></i><span>Télécommande</span></div>',
-        'switch' => '<div data-menu="switch"><i class="far fa-portal-enter" aria-hidden="true"></i><span>Changer de pièce</span></div>',
-        'clock' => '<div data-menu="clock"><i class="far fa-alarm-clock" aria-hidden="true"></i><span>Réveil</span></div>',
-        'settings' => '<div data-menu="settings"><i class="fa fa-cog" aria-hidden="true"></i><span>Paramètres</span></div>',
-        'alert' => '<div data-action="alert"><i class="fa fa-bell" aria-hidden="true"></i><span>Alerte</span></div>',
-        'off' => '<div data-action="off"><i class="fa fa-power-off" aria-hidden="true"></i><span>Éteindre</span></div>',
-    ];
-
-    $res = '<nav id="mainnav"><ul>';
-    foreach ($nav as $item) {
-        if (isset($map[$item])) {
-            $res .= '<li>' . $map[$item] . '</li>';
-        }
-    }
-    $res .= '</ul></nav>';
-    return $res;
+function makeNav($nav) {
+       $map = [
+               'home' => '<div data-menu="home"><i class="fa fa-home" aria-hidden="true"></i><span>Accueil</span></div>',
+               'lights' => '<div data-menu="lights"><i class="far fa-lightbulb" aria-hidden="true"></i><span>Lumières</span></div>',
+               'music' => '<div data-menu="music"><i class="fa fa-music" aria-hidden="true"></i><span>Musique & Radio</span></div>',
+               'media' => '<div data-menu="media"><i class="fa fa-tv-retro" aria-hidden="true"></i><span>Medias & TV</span></div>',
+               'coffee' => '<div data-menu="coffee"><i class="fa fa-oven" aria-hidden="true"></i><span>Cuisine / Café</span></div>',
+               'water' => '<div data-menu="water"><i class="fa fa-faucet-drip" aria-hidden="true"></i><span>Eau chaude</span></div>',
+               'fan' => '<a href="/scripts/light.php?scene=' . config('ROOM') . '/fan/toggle" class="ajax"><i class="fa fa-fan" aria-hidden="true"></i><span>Ventilateur</span></a>',
+               'remote' => '<div data-menu="remote"><i class="fa fa-play" aria-hidden="true"></i><span>Télécommande</span></div>',
+               'switch' => '<div data-menu="switch"><i class="far fa-portal-enter" aria-hidden="true"></i><span>Changer de pièce</span></div>',
+               'clock' => '<div data-menu="clock"><i class="far fa-alarm-clock" aria-hidden="true"></i><span>Réveil</span></div>',
+               'settings' => '<div data-menu="settings"><i class="fa fa-cog" aria-hidden="true"></i><span>Paramètres</span></div>',
+               'alert' => '<div data-action="alert"><i class="fa fa-bell" aria-hidden="true"></i><span>Alerte</span></div>',
+               'off' => '<div data-action="off"><i class="fa fa-power-off" aria-hidden="true"></i><span>Éteindre</span></div>',
+       ];
+
+       $res = '<nav id="mainnav"><ul>';
+       foreach ($nav as $item) {
+               if (isset($map[$item])) {
+                       $res .= '<li>' . $map[$item] . '</li>';
+               }
+       }
+       $res .= '</ul></nav>';
+       return $res;
 }
 
-function gloria()
-{
-    $j = intval(date('N'));
-    if ($j !== 1) {
-        return false;
-    }
-    $h = intval(date('H'));
-    return $h >= 12 && $h <= 17;
+function gloria() {
+       $j = intval(date('N'));
+       if ($j !== 1) {
+               return false;
+       }
+       $h = intval(date('H'));
+       return $h >= 12 && $h <= 17;
 }
index 59eccf338d8a6683e543ebad0ce2a0f1aadb9955..aa44366f8578f5b4c0dd3c10db7e9607e28a5ead 100644 (file)
@@ -648,16 +648,16 @@ $scenes = [
                ['type' => 'scene', 'scene' => 'bureau/sound/off'],
        ],
        'bureau/screen/down' => [
-               ['type' => 'domoticz', 'device' => '1', 'command' => true, 'priority' => true],
+               ['type' => 'domoticz', 'device' => '1', 'command' => 'Close', 'priority' => true],
        ],
        'bureau/screen/up' => [
-               ['type' => 'domoticz', 'device' => '1', 'command' => false, 'priority' => true],
+               ['type' => 'domoticz', 'device' => '1', 'command' => 'Open', 'priority' => true],
        ],
        'bureau/rideaux/close' => [
-               ['type' => 'domoticz', 'device' => '391', 'command' => true, 'priority' => true],
+               ['type' => 'domoticz', 'device' => '391', 'command' => 'Close', 'priority' => true],
        ],
        'bureau/rideaux/open' => [
-               ['type' => 'domoticz', 'device' => '391', 'command' => false, 'priority' => true],
+               ['type' => 'domoticz', 'device' => '391', 'command' => 'Open', 'priority' => true],
        ],
        'bureau/rideaux/toggle' => [
                ['type' => 'domoticz', 'device' => '391', 'command' => 'Toggle', 'priority' => true],