From ab33f8c7e4d288b6cc1a875c86de939200eaaeaf Mon Sep 17 00:00:00 2001
From: SofianeLasri <alasri250@gmail.com>
Date: Tue, 3 Nov 2020 10:14:59 +0100
Subject: [PATCH] v1d
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Correction d'un bug avec l'installateur,
Correction d'un autre avec les thèmes,
Changement de l'adresse du serveur de mise à jour (vbcms.net),
Changement de règle de mise à jour pour les paramètres.
---
 README.md                               |  4 ++--
 admin/includes/navbar.php               |  4 ++--
 admin/includes/translations/en/settings |  4 ++--
 admin/includes/translations/en/themes   |  2 +-
 admin/includes/translations/fr/settings |  4 ++--
 admin/includes/translations/fr/themes   |  2 +-
 admin/login.php                         | 10 +++++-----
 admin/settings.php                      | 13 +++++++++----
 admin/update.php                        |  6 +++---
 themes/doubleload/theme.json            |  2 +-
 themes/simpletip/theme.json             |  2 +-
 11 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/README.md b/README.md
index dea9cf8..5f4f278 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ VBcms est un panel intuitif qui vous facilitera la vie dans la création de votr
 Hi there and thank you for download VBcms! I'm sorry for the French rental of the panel, I'm working on an English translation.
 If you need help, don't hesitate to send me a PM, but also to read the panel documentation.
 
-Doc: https://vbcms.sl-projects.com/ (in french only for the moment)
+Doc: https://vbcms.net/ (in french only for the moment)
 
 To download themes PSD's, go to this link: https://cloud.sl-projects.com/index.php/s/TtSEGfyLK5pQ9W3 :)
 
@@ -13,6 +13,6 @@ To download themes PSD's, go to this link: https://cloud.sl-projects.com/index.p
 Salut cop1 :D
 Merci infiniment d'avoir téléchargé VBcms. Si tu as besoin d'aide, n'hésite surtout pas à m'envoyer un MP, mais aussi à lire la documentation du panel.
 
-Doc: https://vbcms.sl-projects.com/
+Doc: https://vbcms.net/
 
 Pour télécharger les fichiers PSD des thèmes, va sur ce lien: https://cloud.sl-projects.com/index.php/s/TtSEGfyLK5pQ9W3 :)
\ No newline at end of file
diff --git a/admin/includes/navbar.php b/admin/includes/navbar.php
index e512b54..47eb5e9 100644
--- a/admin/includes/navbar.php
+++ b/admin/includes/navbar.php
@@ -1,13 +1,13 @@
 <?php
 $format = 'Y-m-d H:i:s';
 
-$currentVJSON = file_get_contents('https://vbcms.sl-projects.com/getupdate.php?version='.getParameters("version"));
+$currentVJSON = file_get_contents('https://vbcms.net/getupdate.php?version='.getParameters("version"));
 if ($currentVJSON != "false") {
 	$currentVInfo = json_decode($currentVJSON);
 	$currentVDate = $currentVInfo->date;
 	$currentVDate = DateTime::createFromFormat($format, $currentVDate);
 
-	$newVJSON = file_get_contents('https://vbcms.sl-projects.com/getupdate.php?lastest');
+	$newVJSON = file_get_contents('https://vbcms.net/getupdate.php?lastest');
 	$newVInfo = json_decode($newVJSON);
 	$newVDate = $newVInfo->date;
 	$newVDate = DateTime::createFromFormat($format, $newVDate);
diff --git a/admin/includes/translations/en/settings b/admin/includes/translations/en/settings
index 1d35825..8592fff 100644
--- a/admin/includes/translations/en/settings
+++ b/admin/includes/translations/en/settings
@@ -35,13 +35,13 @@ if (isset($_GET["success"])) {
 	<div class="form-group">
 		<div class="form-label-group">
 			<label for="inputServerIp">Server's IP <b>(IP:Port)</b></label>
-			<input type="text" id="inputServerIp" name="inputServerIp" class="form-control" value="<?=getParameters("serverIp")?>" placeholder="server's ip" required="required">
+			<input type="text" id="inputServerIp" name="inputServerIp" class="form-control" value="<?=getParameters("serverIp")?>" placeholder="server's ip">
 		</div>
 	</div>
 	<div class="form-group">
 		<div class="form-label-group">
 			<label for="inputSteamAPIkey">Steam API key <b>(voir <a href="https://steamcommunity.com/dev/apikey">ce lien</a>)</b></label>
-			<input type="text" id="inputSteamAPIkey" name="inputSteamAPIkey" class="form-control" value="<?=getParameters("steamAPIkey")?>" placeholder="Steam API key" required="required">
+			<input type="text" id="inputSteamAPIkey" name="inputSteamAPIkey" class="form-control" value="<?=getParameters("steamAPIkey")?>" placeholder="Steam API key">
 		</div>
 	</div>
 	<div class="form-group">
diff --git a/admin/includes/translations/en/themes b/admin/includes/translations/en/themes
index 0525845..58f4de2 100644
--- a/admin/includes/translations/en/themes
+++ b/admin/includes/translations/en/themes
@@ -1,3 +1,3 @@
 <h1>Themes</h1>
-<p>Here you can see and apply the installed themes.<br>
+<p>Here you can see and apply the installed themes. <b>Themes with * need to have the steam API key and the server IP configured.</b><br>
 	Current theme: <b><?=getParameters("theme")?></b></p>
\ No newline at end of file
diff --git a/admin/includes/translations/fr/settings b/admin/includes/translations/fr/settings
index bb26ebd..9b5275f 100644
--- a/admin/includes/translations/fr/settings
+++ b/admin/includes/translations/fr/settings
@@ -35,13 +35,13 @@ if (isset($_GET["success"])) {
 	<div class="form-group">
 		<div class="form-label-group">
 			<label for="inputServerIp">IP du serveur <b>(IP:Port)</b></label>
-			<input type="text" id="inputServerIp" name="inputServerIp" class="form-control" value="<?=getParameters("serverIp")?>" placeholder="ip du serveur" required="required">
+			<input type="text" id="inputServerIp" name="inputServerIp" class="form-control" value="<?=getParameters("serverIp")?>" placeholder="ip du serveur">
 		</div>
 	</div>
 	<div class="form-group">
 		<div class="form-label-group">
 			<label for="inputSteamAPIkey">Steam API key <b>(voir <a href="https://steamcommunity.com/dev/apikey">ce lien</a>)</b></label>
-			<input type="text" id="inputSteamAPIkey" name="inputSteamAPIkey" class="form-control" value="<?=getParameters("steamAPIkey")?>" placeholder="clé steam API" required="required">
+			<input type="text" id="inputSteamAPIkey" name="inputSteamAPIkey" class="form-control" value="<?=getParameters("steamAPIkey")?>" placeholder="clé steam API">
 		</div>
 	</div>
 	<div class="form-group">
diff --git a/admin/includes/translations/fr/themes b/admin/includes/translations/fr/themes
index 3bf2689..056d9ad 100644
--- a/admin/includes/translations/fr/themes
+++ b/admin/includes/translations/fr/themes
@@ -1,3 +1,3 @@
 <h1>Thèmes</h1>
-<p>Ici tu peux voir et appliquer les thèmes installés.<br>
+<p>Ici tu peux voir et appliquer les thèmes installés. <b>Les thèmes avec * nécessites d'avoir la clé steam API et l'IP du serveur de configuré.</b><br>
 	Thème utilisé: <b><?=getParameters("theme")?></b></p>
\ No newline at end of file
diff --git a/admin/login.php b/admin/login.php
index 4b047af..850df12 100644
--- a/admin/login.php
+++ b/admin/login.php
@@ -24,7 +24,7 @@ if (isset($_POST["inputUser"]) AND ($installed == false)) {
 	$bdduser_str = var_export($_POST["inputBddUser"], true);
 	$bddpass_str = var_export($_POST["inputBddPass"], true);
 	$bddname_str = var_export($_POST["inputBddName"], true);
-	$var = ("<?php\n".'$bddHost = '.$bddhost_str.";\n".'$bddUser = '.$bdduser_str.";\n".'$bddMdp = '.$bddpass_str.";\n".'$bddName = '.$bddname_str.";\n\n".'$installed = true;'."\n?>");
+	$var = ("<?php\n".'$bddHost = '.$bddhost_str.";\n".'$bddUser = '.$bdduser_str.";\n".'$bddMdp = '.$bddpass_str.";\n".'$bddName = '.$bddname_str.";\n\n".'$installed = true;'."\n\n".'error_reporting(0); //désactive les messages derreur'."\n?>");
 	file_put_contents('includes/config.php', $var);
 	include 'includes/bdd.php';
 
@@ -41,14 +41,14 @@ if (isset($_POST["inputUser"]) AND ($installed == false)) {
 	$bdd->prepare($sql)->execute([NULL, $_POST["inputUser"], $hashed_password]);
 
 	$sql = "INSERT INTO settings (parameter, value) VALUES ('siteName', ?), ('siteUrl', ?), ('timeBackChange', ?), ('timePostChange', ?), ('musics', ?), ('backgroundImages', ?), ('version', ?), ('theme', ?), ('themePath', ?), ('themeInclude', ?), ('serverLogo', ?), ('serverIp', ?), ('steamAPIkey', ?), ('language', ?)";
-	$bdd->prepare($sql)->execute([$_POST["inputSiteName"], $_POST["inputUrl"], 5000, 7000, "[]", "[]", "1.2c", "demo", "../themes/demo/theme.json", "", "", $_POST["inputServerIp"], $_POST["inputSteamAPIkey"], $_POST["language"]]);
+	$bdd->prepare($sql)->execute([$_POST["inputSiteName"], $_POST["inputUrl"], 5000, 7000, "[]", "[]", "1.2d", "demo", "../themes/demo/theme.json", "", "", $_POST["inputServerIp"], $_POST["inputSteamAPIkey"], $_POST["language"]]);
 
 	header('Location: login.php');
 } elseif (isset($_POST["inputUser"]) AND ($installed == true)) {
 	include 'includes/constants.php';
-	if (getParameters("version") != "1.2c") {
+	if (getParameters("version") != "1.2d") {
 		$sql = "UPDATE settings SET value = ? WHERE parameter = 'version'";
-		$bdd->prepare($sql)->execute(["1.2c"]);
+		$bdd->prepare($sql)->execute(["1.2d"]);
 	}
 	$res=$bdd->query("SELECT * FROM users WHERE name = '".$_POST["inputUser"]."'");
 	$result = $res->fetch();
@@ -124,7 +124,7 @@ if (isset($_POST["inputUser"]) AND ($installed == false)) {
 				<div class="form-group">
 					<div class="form-label-group">
 						<label for="inputBddName">Nom de la base</label>
-						<input type="text" id="inputBddName" name="inputBddName" class="form-control" value="<?=$bddName?>" placeholder="bdd_user" required="required" autofocus="autofocus">
+						<input type="text" id="inputBddName" name="inputBddName" class="form-control" value="<?=$bddName?>" placeholder="bdd_name" required="required" autofocus="autofocus">
 					</div>
 				</div>
 				<div class="form-group">
diff --git a/admin/settings.php b/admin/settings.php
index 9523d19..52d7a9f 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -19,13 +19,18 @@ if (isset($_POST["submit"])) {
 	$bdd->prepare($sql)->execute([$_POST["inputMusic"]]);
 	$sql = "UPDATE settings SET value = ? WHERE parameter = 'serverLogo'";
 	$bdd->prepare($sql)->execute([$_POST["serverLogo"]]);
-	$sql = "UPDATE settings SET value = ? WHERE parameter = 'serverIp'";
-	$bdd->prepare($sql)->execute([$_POST["inputServerIp"]]);
-	$sql = "UPDATE settings SET value = ? WHERE parameter = 'steamAPIkey'";
-	$bdd->prepare($sql)->execute([$_POST["inputSteamAPIkey"]]);
 	$sql = "UPDATE settings SET value = ? WHERE parameter = 'language'";
 	$bdd->prepare($sql)->execute([$_POST["language"]]);
 
+	if (!empty($_POST["inputServerIp"])) {
+		$sql = "UPDATE settings SET value = ? WHERE parameter = 'serverIp'";
+		$bdd->prepare($sql)->execute([$_POST["inputServerIp"]]);
+	}
+	if (!empty($_POST["inputSteamAPIkey"])) {
+		$sql = "UPDATE settings SET value = ? WHERE parameter = 'steamAPIkey'";
+		$bdd->prepare($sql)->execute([$_POST["inputSteamAPIkey"]]);
+	}
+
 	//Actualisation de la page
 	header('Location: settings.php?success');
 }
diff --git a/admin/update.php b/admin/update.php
index c7188af..5838dbb 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -22,7 +22,7 @@ include 'includes/constants.php';
 		<div class="page-content container-fluid">
 			<img width="100px" src="images/vbcms-logo.png">
 			<h1><?php if(getParameters("language") == "fr"){echo "Mettre à jour VBcms";}elseif (getParameters("language") == "en") {echo "Update VBcms";} ?></h1>
-			<p>Réfère-toi à la <a href="https://vbcms.sl-projects.com/doc-update.php">documentation</a> pour mettre à jour.<br>
+			<p>Réfère-toi à la <a href="https://vbcms.net/doc-update.php">documentation</a> pour mettre à jour.<br>
 			<b>v<?=getParameters("version")?></b> par <a href="https://sl-projects.com/">SofianeLasri</a></p>
 
 			
@@ -35,7 +35,7 @@ include 'includes/constants.php';
 					<h1>Mise à jour <?=$newVInfo->version?></h1>
 					<h4 class='mt-n2'><?=$newVDate->format('Y/m/d')?></h4>
 					<p><?=$newVInfo->changelog?></p>
-					<br><a href="https://vbcms.sl-projects.com/update.php?ver=<?=getParameters("version")?>" target="_blank">En savoir plus</a>
+					<br><a href="https://vbcms.net/update.php?ver=<?=getParameters("version")?>" target="_blank">En savoir plus</a>
 				</div>
 				<div class="align-self-center">
 					<h5>À extraire à la racine!</h5>
@@ -49,7 +49,7 @@ include 'includes/constants.php';
 				echo "<br><br><h2>Version actuelle | ".getParameters("version")."</h2>";
 				echo "<h4 class='mt-n2'>".$currentVDate->format('Y/m/d')."</h4>";
 				echo ($currentVInfo->changelog);
-				echo "<br><a href='https://vbcms.sl-projects.com/update.php?ver=".getParameters("version")."' target='_blank'>En savoir plus</a>";
+				echo "<br><a href='https://vbcms.net/update.php?ver=".getParameters("version")."' target='_blank'>En savoir plus</a>";
 
 			} else {
 				echo "Vous disposez d'une version non officielle. :/";
diff --git a/themes/doubleload/theme.json b/themes/doubleload/theme.json
index 05ecee7..283c14b 100644
--- a/themes/doubleload/theme.json
+++ b/themes/doubleload/theme.json
@@ -4,7 +4,7 @@
   "version": "1.0",
   "compatible": "1.1d",
   "author": "SofianeLasri",
-  "description": "Deux barre de chargement? Pourquoi pas!",
+  "description": "Deux barre de chargement? Pourquoi pas! <b>*</b>",
   "index": "index.php",
   "features": ["dynamicBackgrounds", "tips", "musics"],
   "include": "assets/includes/customFeatures.php"
diff --git a/themes/simpletip/theme.json b/themes/simpletip/theme.json
index 786684d..519cc32 100644
--- a/themes/simpletip/theme.json
+++ b/themes/simpletip/theme.json
@@ -4,7 +4,7 @@
   "version": "1.0",
   "compatible": "1.1c",
   "author": "SofianeLasri",
-  "description": "Pourquoi se compliquer la vie? Un simple design suffis amplement. :D",
+  "description": "Pourquoi se compliquer la vie? Un simple design suffis amplement. :D <b>*</b>",
   "index": "index.php",
   "features": ["dynamicBackgrounds", "tips", "musics"],
   "include": "assets/includes/customFeatures.php"
-- 
GitLab