<?php
session_start();
// Chronométrage du début
$St2Time  = microtime(true);

// ************ IP LOG & Compteurs ************
include __DIR__ ."/include/IpLogDetect.php";
include_once __DIR__ ."/include/BlackListRecord.php"; // *** BlacklistIP ***

//  -*-*--*-*-*-*-*-*-*-*-  Démarrage de session  -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-
include_once __DIR__ ."/include/CouleurDetect.php";

// Inclusions indispensables, ne pas toucher
if (file_exists("/var/www/html/config/config.php")) include_once __DIR__ ."/config/config.php";
if (file_exists("/var/www/html/config/Bconfig.php")) include_once __DIR__ ."/config/Bconfig.php";

include_once __DIR__ ."/include/tools.php";
include_once __DIR__ ."/include/functions.php";
include_once __DIR__ ."/include/init.php";
include_once __DIR__ ."/version.php";


// ************* JOUR --- NUIT **************
// require '/var/www/html/config/config.php';
// $heure = date("G");               // Heure de 0 à 23
// if ($heure >= 6 && $heure < 18) { $logo = LOGO; } else { $logo = LOGOn; }

// Début du HTML --**--**--**--**--**--**--**--**--**--
?>

<!DOCTYPE html>
<html lang="fr">
<head>
      <meta charset="UTF-8">
      <title><?php echo getConfigItem("Info", "Name", $configs); ?> - Reflecteur-YSF Tableau-De-Bord VA2VDC</title>

      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <meta name="description" content="YSF-Reflecteur Tableau de Bord Fr Par VA2VDC">
      <meta name="author" content="DG9VH, KC1AWV, VA2VDC">

      <meta http-equiv="refresh" content="<?= REFRESHAFTER ?>">
  <!-- So refresh works every time -->
      <meta http-equiv="expires" content="0">

<style>
  :root {
    --BGround-color2: <?= $bgColor2 ?>;
    --BGround-color0: <?= $bgColor0 ?>;
  }
</style>

      <!-- Bootstrap core CSS -->
      <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
      <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

  <!-- Bootstrap core JavaScript -->
  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 				integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" 	integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" 		integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

      <!-- Datatables -->
      <link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css">

  <!-- Inclure le script de la librairie emoji-picker-element -->
  <!-- script type="module" src="https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js"></script --> 
  <script type="module" src="/js/index.js"></script>

  <script type="text/javascript" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>

  <script type="text/javascript" src="/js/tx3.js"></script> <!-- ********  Detect TX ID Amateur  ************ -->

    <!-- Le reste de la partie head -->
    <link rel="stylesheet" href="/css/custom.css.php?v=<?=filemtime(__DIR__.'/css/custom.css.php')?>">
    <link rel="stylesheet" href="/css/custom.css">

<style>
.logo-container {
  position: relative;
  display: inline-block;
}

.main-logo {
  width: 220px;
  height: 250px;
  border-radius: 15px;
  box-shadow: 0px 0px 10px 3px #000;
  padding: 2px;
  background: #404040;
}

.overlay-image {
  position: absolute;
  top: 2px;         /* ajuste selon placement souhaité   --- 117  ---8   */
  right: 5px;       /* ajustement    ---  127 ---8   */
  width: 220px;     /* taille de ton overlay petite image  --- 80  ---140   */
  height: auto;
  opacity: 0.98;
  border-radius: 15px;
//  animation: blink 2s infinite alternate;
}

@keyframes blink {
  from { opacity: 1; }
  to { opacity: 0.4; }
}
</style>


</head>

<body class="navbar" style="background-color: #131414; color: #FF2222;">

<?php
require '/var/www/html/config/config.php';
    $heure = date("G");            // Heure de 0 à 23
 if ($heure >= 5 && $heure < 20) {
    $logo = LOGO;
 // $bgColor0 = "#DEDFDF"; // #DEDFDF
 // $bgColor2 = "#E7E7E7"; // #E7E7E7
 } else if ($heure >= 20 && $heure < 23) {
    $logo = LOGOn;
    $bgColor0 = "#5E7F9F"; // #6E8FAF
    $bgColor2 = "#17375F"; // #17375F
 } else {
    $logo = LOGOn;
    $bgColor0 = "#030304"; // #030304
    $bgColor2 = "#333434"; // #333434
}
?>

<!-- Contenu HTML -->
<?php
if ($bgColor0 == "#030304") {
    $ColorA = "#F0804F";
    $ColorB = "#E8301F";
    $ColorC = "#50505F";
} elseif ($bgColor0 == "#074C88") {
    $ColorA = "#F0F0FF";
    $ColorB = "#30A0FF";
    $ColorC = "#A0A0AF";
} else {
    $ColorA = "#001048";
    $ColorB = "#481000";
    $ColorC = "#50505F";
}
?>

<!-- Navigation ---------  Recherche Fichier SETUP  -------------------------------------------------  -->
<?php checkSetup(); ?>

<!-- Page Content  ------------------- Haut de Page -------------------------------------------------  -->

<!-- script type="text/javascript" src="https://click123.ca/dist/js/heart.js"></script -->




<div class="boz">
  <nav class="navbar navbar-expand-lg navbar-dark static-top" style="background-color: <?= $bgColor0 ?>; color: #9090DC"> <!-- fixed-top  or static-top   -->
    <div class="container-fluid" style=" color: #9090DF";>
      <span class="float:left">
        <a class="navbar-brand" href="#" style=" color: <?= $ColorA ?>";>-Reflecteur-YSF- <?= getConfigItem("Info", "Name", $configs) ?> / <?= getConfigItem("Info", "Description", $configs) ?> (#<?= getConfigItem("Info", "Id", $configs) ?>)</a>
      </span>
      <span class="navbar-brand float:center" style=" color: <?= $ColorC ?>";>
        <a id="chatLink" target="_new" href="/SChatSetup.php" style=" color: <?= $ColorC ?>";>Version: </a><a id="chatLink" target="_new" href="/InfoBSetup.php" style=" color: <?= $ColorC ?>";><?= getYSFReflectorVersion() ?></a>
      </span>
      <span class="navbar-brand float:right" style=" color: <?= $ColorB ?>";>
     <a id="chatLink" target="_new" href="/couleurs.php" style=" color: <?= $ColorB ?>";>  System Fusion IP </a>
     </span>
    </div>
  </nav>

<!-- Page Content  ------------------- Tx Info / logo  -----------------------------------------------  -->
  <nav class="navbar navbar-expand-lg navbar-dark static-top" style="background-color: <?= $bgColor2 ?>;">
    <div class="container-fluid">
     <div class="col-12">

       <div class="ROW couleur1-forcee">
	<div class="flex-container1">

          <div class="boxy">
            <!--   <span class="navbar-brand float:center"> -->
		<?php include "/var/www/html/include/txinfo.php"; ?>
	    <!--   </span> -->
          </div>

	  <!-- Page Content  -- Col ------ Logo ----------  -->
	  <div class="col-2.4">
            <div class="boxy">
	      <!--   <span class="navbar-brand float:right">  title="T l charger le PNG OU PDF OU Ect..."   -->




<div class="logo-container">

		<?php if (LOGO !== "") { ?>

		<a id="chatLink" target="_new" href="/DlFiles/">

		<img src="<?= $logo ?>" class="main-logo" width="220px" height="250" style="width:220px; border-radius:15px; box-shadow: 0px 0px 10px 3px #000; padding:2px; background:#404040;" border="3" hspace="5" vspace="5" align="justify-content-left">

    <img id="overlayImage" class="overlay-image" style="display:none" />

		</a>

		<?php } else { ?>
		    <h3 class="text-center">YSF-Reflecteur<br />Tableau-De-Bord</h3>
		<?php } ?>
	      <!--   </span> -->
</div>




            </div>
         </div>

        </div>
      </div>

    </div>
  </div>
 </nav>

<!-- Page Content  ------------------- Info / System / Chat --------------------------------------------  -->
 <nav class="navbar navbar-expand-lg navbar-dark static-top" style="background-color: <?= $bgColor2 ?>;">
  <div class="container-fluid">
   <div class="col-12">

    <div class="ROW couleur2-forcee">
      <div class="flex-container">

       <div class="box"><?php include "/var/www/html/include/sysinfo.php"; ?></div>

       <!-- Page Content  -- Col ------ Chat ---------  -->
       <div class="col">

	 <?php
	     $unread = file_exists(__DIR__ . "/log/" . "SMessages_Readed.txt") ? file_get_contents(__DIR__ . "/log/" . "SMessages_Readed.txt") : "0";
	 if ($unread == "1") {
	     $css_class = "clignote1";
	 } else if ($unread == "2") {
	     $css_class = "clignote2";
	 } else if ($unread == "3") {
	     $css_class = "clignote3";
	 } else if ($unread == "4") {
	     $css_class = "clignote4";
	 } else if ($unread >= "5") {
	     $css_class = "clignote5";
	 } else {
	     $css_class = "";
	 }
 	 ?>

	 <div class="box" nowrap>
	    <button id="btChanger1" class="col-7" style="box-shadow: 0px 0px 10px 3px #000; text-shadow: 1px 1px 2px #000;">Info / Systeme / 
	    <a id="chatLink" target="_new" href="/chatme.php" class="<?php echo $css_class; ?>"> Chat <?php if ($unread != "0") {echo $unread;} ?>
	    </a>
	    </button>

	    <a id="logsLink" target="_new" href="/Visites.php"
	      style="display: inline-block; 
	        background-color: #223252; 
	        border-radius: 20px; 
	        box-shadow: 0px 0px 10px 3px #000; 
	        color: #EFA74F; 
		font-size: 1.3em; 
		padding: 5px 15px 10px 15px; 
		text-decoration: none;"> Logs
	    </a>

	    <a id="logsLink" target="_new" href="/DenyIP.php"
	      style="display: inline-block; 
		background-color: #223252; 
		border-radius: 20px; 
		box-shadow: 0px 0px 10px 3px #000; 
		color: #4FB7FF; 
		font-size: 1.3em; 
		padding: 5px 15px 10px 15px; 
		text-decoration: none;"> ADM
	    </a>

	    <div id="LstBulle" class="col8" style="box-shadow: 0px 0px 10px 3px #000; border-radius: 15px;"></div>
	 </div>

       </div>

      </div>
     </div>

   </div>
  </div>
 </nav>

<!-- Page Content  ------------------- Passerelle GW ---------------------------------------------------  -->
  <nav class="navbar navbar-expand-lg navbar-dark static-top" id="blocE" style="display:block; width:100%; margin-bottom:0px; background-color: <?= $bgColor2 ?>;">
     <div class="container-fluid">
      <div class="col-12"><div class="row" style="size:210;"><div class="col"><?php include "include/gateways.php"; ?></div></div></div>
     </div>
  </nav>

<!-- Page Content  ------------------- LH ---------------------------------------------------------------  -->
  <nav class="navbar navbar-expand-lg navbar-dark static-top" id="blocD" style="display:block; width:100%; margin-bottom:0px; background-color: <?= $bgColor2 ?>;">
     <div class="container-fluid">
      <div class="col-12"><div class="row" style="size:210;"><div class="col"><?php include "include/lh.php"; ?></div></div></div>
     </div>
  </nav>

<!-- Page Content  ------------------- AllHeard  &  OldHeard  -------------------------------------------- --> 
  <nav class="navbar navbar-expand-lg navbar-dark static-top" style="background-color: <?= $bgColor2 ?>;">
   <div style="text-align:center; margin:20px 20px 20px 30px; background-color: <?= $bgColor2 ?>;">
      <button class="btn btn-success" onclick="afficher('A')"style="background-color: #EB5837; color: #F9FCFF; margin:5px 3px 5px 3px; font-size: 1.6em; text-shadow: 0px 0px 3px #011; padding: 3px 10px 3px 10px; box-shadow: 0px 0px 5px 2px #000; border-radius:10px;">Off </button>
      <button class="btn btn-primary" onclick="afficher('B')" style="background-color: #838393; color: #DFEFFF; margin:5px 3px 5px 3px; font-size: 1.6em; text-shadow: 0px 0px 3px #011; padding: 3px 20px 3px 20px; box-shadow: 0px 0px 5px 2px #000; border-radius:10px;">Graphique Aujourd’hui </button>
      <button class="btn btn-primary" onclick="afficher('C')"style="background-color: #237AFA; color: #F8F8FF; margin:5px 3px 5px 3px; font-size: 1.6em; text-shadow: 0px 0px 3px #011; padding: 3px 20px 3px 20px; box-shadow: 0px 0px 5px 2px #000; border-radius:10px;">Graphique Historique </button>
      <button class="btn btn-warning" onclick="afficher('AB')"style="background-color: #EBC877; color: #292C2F; margin:5px 3px 5px 3px; font-size: 1.6em; text-shadow: 0px 0px 3px #011; padding: 3px 25px 3px 25px; box-shadow: 0px 0px 5px 2px #000; border-radius:10px;">Les Deux Graphiques </button>
      <button class="btn btn-secondary" onclick="afficher('E')"style="background-color: #353535; color: #585858; margin:5px 3px 5px 3px; font-size: 1.6em; text-shadow: 0px 0px 3px #011; padding: 3px 10px 3px 10px; box-shadow: 0px 0px 5px 2px #000; border-radius:10px;"><span id="countdown-seconds" style="color: #DFAF55;" ></span></button>
   </div>

   <div id="blocA" style="display:none; width:100%; margin-bottom:30px; background-color: <?= $bgColor2 ?>;">
      <iframe src="" width="100%" height="10" frameborder="0" style="border-radius:10px; box-shadow:0 0 10px #000;"></iframe>
   </div>
   <script type="text/javascript" src="/js/VarMultiBlock.js"></script>
  </nav>

<!-- Page Content  ------------------- AllHeard ------------------------------ Display none ou block  -------------------------------- --> 
  <nav class="navbar navbar-expand-lg navbar-dark static-top" id="blocB" style="display:none; width:100%; margin-bottom:0px; background-color: <?= $bgColor2 ?>;">
   <!-- div class="container-fluid" -->
    <div class="col-12"><div class="row" style="size:210;"><!-- div class="col" -->
	<iframe src="idxSW1.php" width="100%" height="710" frameborder="0"
	    style="border-radius:10px; 
	    box-shadow:0 0 10px #000;">
	</iframe><!-- /div --></div>
    </div>
   <!-- /div -->
  </nav> 

<!-- Page Content  ------------------- oldAllHeard --------------------------- Display none ou block  -------------------------------- -->
  <nav class="navbar navbar-expand-lg navbar-dark static-top" id="blocC" style="display:none; width:100%; margin-bottom:0px; background-color: <?= $bgColor2 ?>;">
    <div class="container-fluid">
      <div class="col-12"><div class="row" style="size:210;"><div class="col"><?php include "include/oldheard2.php"; ?></div></div></div>
    </div>
  </nav>

<!-- Page Content  --------------LH & OLD HEARD --- Lst2 -------------------------------------------------  -->
  <nav class="navbar navbar-expand-lg navbar-dark static-top" style="background-color: <?= $bgColor2 ?>;">
    <div class="container-fluid">

      <div class="col-12"><div class="row" style="size:210;"><div class="col">
	    <button id="changer2" style="background-color: #237AFA; color: #89CFFF; font-size: 1.8em; text-shadow: 1px 1px 4px #011; padding: 3px 35px 3px 35px; box-shadow: 0px 0px 10px 3px #000; border-radius:10px;">Historique / Tous Les Temps</button>
	    <button id="changer4" style="background-color: #454545; color: #858585; font-size: 1.8em; text-shadow: 1px 1px 4px #011; padding: 3px 35px 3px 35px; box-shadow: 0px 0px 10px 3px #000; border-radius:10px;"><a id="ADM" target="_new" href="/include/EditFilePlus.php" class="ADM"> ADM</a></button>
	    <div id="Lst2"></div><div id="Lst4"></div>

	    <br>
	</div></div></div>

    </div>
  </nav>

<!-- Page Content  -------------------- Bas De Page -----------------------------------------------------  -->
  <nav class="flex-container" style="background-color: #131414; color: #9090DC">
    <div class="flex-container" style="background-color: #131414; color: #FFF8EF;">
	<?php
	    $lastReload = new DateTime();
	    $lastReload->setTimezone(new DateTimeZone(TIMEZONE));
	    echo "YSF-Dashboard Ver.: ".VERSION." | M.a.J. le : ".$lastReload->format('d-m-Y,  H:i:s')." (".TIMEZONE.")";
	?> | <a href="<?php if (!file_exists('YSF_D_Board-FR.tar.gz')) {
	    echo'http://amiatous.ddns.net:8081/indexC.php';
	    } else {
	    echo 'YSF_D_Board-FR.tar.gz';
	    };
	    ?>">Votre Copie Ici:</a> <-Fr-  -En-> <a href="https://github.com/dg9vh/YSFReflector-Dashboard"> DG9VH YSFReflector-Dashboard </a><a id="chatLink" target="_new" href="/ADMcouleurs.php"> . </a>
    </div>
  </nav>

 <nav class="flex-container" style="background-color: #131414; color: #FE4433; padding: 5px;">
  <div>
    <?php
	// Chronométrage du début
	$finish = microtime(true);
	$total_time = round(($finish - $St2Time), 4);
	echo "<p style='text-align: center; font-size: 1.6em; color: #15FDE0;'>Page produite en -> " . $total_time . " <- Secondes.</p>";
	echo "<p style='text-align: center; font-size: 1.85em;'>Nombre de visites : " . $count . "</p>";
    ?></div><br>
  </nav>
 </div><!--  Container last div  -->

    <!--  Debut  *****    -->
        <script>
          window.REFRESHAFTER = <?= REFRESHAFTER ?>;
        </script>
        <script src="/js/VarCountD.js"></script>
        <script src="/js/Chargement124.js"></script>
        <script src="/js/VarFramA.js"></script>
    <!--  Fin    *****    -->


    <!-- Effet de flocons de neige   Debut  *****    -->
<?php
    require '/var/www/html/floccon.php';
?>
    <!-- Effet de flocons de neige   Fin    *****    -->

 </body>
</html>
