Skip to content
Snippets Groups Projects
Commit 26c374c8 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

14H47 - +VBcmsGetSetting($settings)

parent 572d59e6
No related branches found
No related tags found
No related merge requests found
<?php <?php
// Fichier de test // Fichier de test
$deTest['width'] = 1920; $deTest['type'] = "identifier";
$deTest['height'] = 1080; $deTest['name'] = "test";
echo json_encode($deTest); echo urlencode(json_encode($deTest));
\ No newline at end of file \ No newline at end of file
<!-- Contenu --> <!-- Contenu -->
<div class="page-content d-flex flex-column" leftSidebar="240" rightSidebar="0" style="height:calc(100% - 60px);"> <div class="page-content d-flex flex-column" leftSidebar="240" rightSidebar="0" style="height:calc(100% - 60px);">
<div class="d-flex align-items-center">
<h3><?=translate("loadingscreens")?></h3> <h3><?=translate("loadingscreens")?></h3>
<div class="ml-2">
<button type="button" class="btn btn-brown btn-sm" data-toggle="modal" data-target="#createLoadingScreen"><i class="fas fa-plus-circle"></i> <?=translate("create")?></button>
</div>
</div>
<p><?=translate("loadingscreens_listPhrase")?></p> <p><?=translate("loadingscreens_listPhrase")?></p>
<div class="d-flex flex-column" id="page-content"> <div class="d-flex flex-column" id="page-content">
<div class="d-flex flex-wrap"> <div class="d-flex flex-wrap">
<?php
$loadingscreens = $bdd->query('SELECT * FROM `vbcmsLoadingScreens_list`')->fetchAll(PDO::FETCH_ASSOC);
foreach ($loadingscreens as $loadingscreen){
$backgroundImage = 'https://api.apiflash.com/v1/urltoimage?access_key=65e037cb81b44087ba537b58dd19e4ff&format=jpeg&quality=80&response_type=image&url='.urlencode($GLOBALS['websiteUrl'].$this->clientAccess.'/'.$loadingscreen['identifier']).'/&width=1920&height=1080';
echo('
<div class="ld-card border rounded mx-1 my-1" style="background-image: url(\''.$backgroundImage.'\');">
<div class="ld-card-content p-2">
<span><strong>'.$loadingscreen['showName'].'</strong></span>
<a href="'.$GLOBALS['websiteUrl'].'vbcms-admin/'.$this->adminAccess.'/edit?id='.$loadingscreen['identifier'].'" class="btn btn-sm btn-brown float-right">'.translate('modify').'</a>
</div>
</div>');
}
?>
<div class="ld-card border rounded mx-1 my-1" style="background-image: url('https://sofianelasri.mtxserv.com/vbcms-content/uploads/stayonline.jpg');"> <div class="ld-card border rounded mx-1 my-1" style="background-image: url('https://sofianelasri.mtxserv.com/vbcms-content/uploads/stayonline.jpg');">
<div class="ld-card-content p-2"> <div class="ld-card-content p-2">
<span><strong>Un super loading screen</strong></span> <span><strong>Un super loading screen</strong></span>
...@@ -35,7 +53,134 @@ ...@@ -35,7 +53,134 @@
</div> </div>
</div> </div>
<div class="modal fade" id="createLoadingScreen">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-brown text-white">
<h5 id="extensionDesacctivationModalTitle" class="modal-title"><?=translate("loadingscreens_giveAName")?></h5>
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="createLoadingScreenForm">
<p><?=translate("ws_askExtToDeleteItsData")?></p>
<div class="form-group">
<label><?=translate("name")?></label>
<input type="text" class="form-control" id="showName" name="showName">
<div id="badName" class="invalid-feedback"></div>
</div>
<div class="form-group">
<label><?=translate("ws_clientAccess")?></label>
<input type="text" class="form-control" id="identifier" name="identifier">
<small class="form-text text-muted"><?=translate("loadingscreens_createLegendIdentifier")?></small>
<div id="badIdentifier" class="invalid-feedback"></div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-brown" data-dismiss="modal"><?=translate("cancel")?></button>
<button id="createLoadingScreenCreateBtn" onclick="createLoadingScreen()" type="button" class="btn btn-brown" disabled><?=translate("create")?></button>
</div>
</div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
document.getElementById('showName').addEventListener('change', function (evt) {
let slug = this.value
slug = slug.toLowerCase().replace(/ /g,'-').replace(/[^\w-]+/g,'');
$("#identifier").val(slug);
let array = {};
array.type="showName";
array.name=this.value;
$.get("<?=$websiteUrl?>vbcms-admin/<?=$urlPath[2]?>/backTasks?checkIdentifierOrName="+encodeURIComponent(JSON.stringify(array)), function(data) {
let json = JSON.parse(data);
if(typeof json.error === 'undefined'){
if(json.used == false){
$("#badName").css("display", "none");
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") !== 'undefined' && $("#badIdentifier").css("display") == "none" && $("#identifier").val() != ""){
$("#createLoadingScreenCreateBtn").removeAttr("disabled");
}
if(!isAlphanumeric($("#identifier").val())){
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") === 'undefined'){
$("#createLoadingScreenCreateBtn").attr("disabled", "");
}
}
} else {
$("#badName").html("<?=translate('alreadyUsed')?>");
$("#badName").css("display", "block");
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") === 'undefined'){
$("#createLoadingScreenCreateBtn").attr("disabled", "");
}
}
} else {
$("#badName").html(json.error);
$("#badName").css("display", "block");
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") === 'undefined'){
$("#createLoadingScreenCreateBtn").attr("disabled", "");
}
}
})
});
document.getElementById('identifier').addEventListener('change', function (evt) {
let array = {};
array.type="identifier";
array.name=this.value;
$.get("<?=$websiteUrl?>vbcms-admin/<?=$urlPath[2]?>/backTasks?checkIdentifierOrName="+encodeURIComponent(JSON.stringify(array)), function(data) {
let json = JSON.parse(data);
if(typeof json.error === 'undefined'){
if(json.used == false){
$("#badIdentifier").css("display", "none");
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") !== 'undefined' && $("#badName").css("display") == "none" && $("#showName").val() != ""){
$("#createLoadingScreenCreateBtn").removeAttr("disabled");
}
if(!isAlphanumeric($("#identifier").val())){
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") === 'undefined'){
$("#createLoadingScreenCreateBtn").attr("disabled", "");
}
}
} else {
$("#badIdentifier").html("<?=translate('alreadyUsed')?>");
$("#badIdentifier").css("display", "block");
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") === 'undefined'){
$("#createLoadingScreenCreateBtn").attr("disabled", "");
}
}
} else {
$("#badIdentifier").html(json.error);
$("#badIdentifier").css("display", "block");
if(typeof $("#createLoadingScreenCreateBtn").attr("disabled") === 'undefined'){
$("#createLoadingScreenCreateBtn").attr("disabled", "");
}
}
})
});
function createLoadingScreen(){
$.post( "<?=$GLOBALS['websiteUrl']?>vbcms-admin/<?=$urlPath[2]?>/backTasks?createLoadingScreen", $( "#createLoadingScreenForm" ).serialize() )
.done(function( data ) {
if(data == ""){
window.location.href = "<?=$GLOBALS['websiteUrl']?>vbcms-admin/<?=$urlPath[2]?>/edit?id="+$("#identifier").val();
} else {
SnackBar({
message: data,
status: "danger",
timeout: false
});
}
});
}
function isAlphanumeric(text){
var letterNumber = /^[0-9a-zA-Z-\-]+$/;
if(text.match(letterNumber)){
return true;
}else{
return false;
}
}
</script> </script>
</div> </div>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
if(isset($_GET['id'])){ if(isset($_GET['id'])){
$loadingScreenIdentifier = $_GET['id']; $loadingScreenIdentifier = $_GET['id'];
} else { } else {
$loadingScreenIdentifier = "temp-".$_SESSION['user_id']; $redirectToList = true;
} }
?> ?>
...@@ -12,6 +12,8 @@ if(isset($_GET['id'])){ ...@@ -12,6 +12,8 @@ if(isset($_GET['id'])){
<div style="padding: 30px 50px; background-color:#3e3e3e;"> <div style="padding: 30px 50px; background-color:#3e3e3e;">
<div class="d-flex text-white"> <div class="d-flex text-white">
<div style="margin-right: 50px;"> <div style="margin-right: 50px;">
<h4><?=translate("loadingscreens_openEditor")?></h4>
<button type="button" class="btn btn-brown"><?=translate("loadingscreens_openEditor")?></button>
<h4><?=translate("modifyProperties")?></h4> <h4><?=translate("modifyProperties")?></h4>
<div class="form-group"> <div class="form-group">
<label><?=translate("theme")?></label> <label><?=translate("theme")?></label>
...@@ -25,7 +27,7 @@ if(isset($_GET['id'])){ ...@@ -25,7 +27,7 @@ if(isset($_GET['id'])){
</div> </div>
<div class="form-group"> <div class="form-group">
<label><?=translate("previewResolution")?></label> <label><?=translate("loadingscreens_previewResolution")?></label>
<select class="form-control form-control-sm" id="previewResolution"> <select class="form-control form-control-sm" id="previewResolution">
<option value='{"width":2560,"height":1440}'>2560 x 1440</option> <option value='{"width":2560,"height":1440}'>2560 x 1440</option>
<option value='{"width":1920,"height":1080}' selected>1920 x 1080</option> <option value='{"width":1920,"height":1080}' selected>1920 x 1080</option>
...@@ -80,6 +82,11 @@ if(isset($_GET['id'])){ ...@@ -80,6 +82,11 @@ if(isset($_GET['id'])){
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
<?php
if(isset($redirectToList)){
echo 'window.location.href = "'.$GLOBALS['websiteUrl'].'vbcms-admin/'.$urlPath[2].'/browse";';
}
?>
resizePreview(); resizePreview();
}); });
$( window ).resize(function() { $( window ).resize(function() {
......
...@@ -6,7 +6,12 @@ $translation["loadingscreens_list"] = "Liste des écrans de chargements"; ...@@ -6,7 +6,12 @@ $translation["loadingscreens_list"] = "Liste des écrans de chargements";
$translation["loadingscreens_create"] = "Créer un écran de chargement"; $translation["loadingscreens_create"] = "Créer un écran de chargement";
$translation["loadingscreens_listPhrase"] = "Voici la liste des écrans de chargements actuellment créés."; $translation["loadingscreens_listPhrase"] = "Voici la liste des écrans de chargements actuellment créés.";
$translation["loadingscreens_createPhrase"] = "Ici tu peux créer un écran de chargement comme bon te semble! :D"; $translation["loadingscreens_createPhrase"] = "Ici tu peux créer un écran de chargement comme bon te semble! :D";
$translation["previewResolution"] = "Résolution de la prévisualisation"; $translation["loadingscreens_previewResolution"] = "Résolution de la prévisualisation";
$translation["loadingscreens_giveAName"] = "Donnez un nom pour en créer un.";
$translation["loadingscreens_createLegendIdentifier"] = "Sera utilisé pour accéder à l'écran de chargement.<br>Doit être en alphanumérique!";
$translation["loadingscreens_openEditor"] = "Ouvrir l'éditeur";
$translation["sample"] = "sample";
$translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
......
...@@ -7,11 +7,12 @@ function enable($name, $path, $adminAccess, $clientAccess){ ...@@ -7,11 +7,12 @@ function enable($name, $path, $adminAccess, $clientAccess){
adminNavbarAddItem($name, "fas fa-brush", "themes", "/themes"); adminNavbarAddItem($name, "fas fa-brush", "themes", "/themes");
// On va créer les tables // On va créer les tables
if(!tableExist("vbcmsLoadingScreens_list")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_list` ( `identifier` VARCHAR(128) NOT NULL , `visibility` INT NOT NULL , `sequenceId` INT NULL DEFAULT NULL , PRIMARY KEY (`identifier`)) ENGINE = InnoDB;"); if(!tableExist("vbcmsLoadingScreens_list")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_list` ( `identifier` VARCHAR(128) NOT NULL , `visibility` INT NOT NULL , `sequenceId` INT NULL DEFAULT NULL , `showName` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , PRIMARY KEY (`identifier`)) ENGINE = InnoDB;");
if(!tableExist("vbcmsLoadingScreens_sequences")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_sequences` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;"); if(!tableExist("vbcmsLoadingScreens_sequences")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_sequences` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;");
if(!tableExist("vbcmsLoadingScreens_sequencesData")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_sequencesData` ( `sequenceId` INT NOT NULL , `dataId` INT NOT NULL , `type` VARCHAR(128) NOT NULL , `data` JSON NOT NULL , PRIMARY KEY (`sequenceId`, `dataId`)) ENGINE = InnoDB;"); if(!tableExist("vbcmsLoadingScreens_sequencesData")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_sequencesData` ( `sequenceId` INT NOT NULL , `dataId` INT NOT NULL , `parentId` INT NULL DEFAULT NULL , `type` VARCHAR(128) NOT NULL , `data` JSON NOT NULL , PRIMARY KEY (`sequenceId`, `dataId`)) ENGINE = InnoDB;");
if(!tableExist("vbcmsLoadingScreens_tempSequencesData")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_tempSequencesData` ( `sequenceId` INT NOT NULL , `dataId` INT NOT NULL , `type` VARCHAR(128) NOT NULL , `data` JSON NOT NULL , `date` DATETIME NOT NULL , PRIMARY KEY (`sequenceId`, `dataId`)) ENGINE = InnoDB;"); if(!tableExist("vbcmsLoadingScreens_tempSequencesData")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_tempSequencesData` ( `sequenceId` INT NOT NULL , `dataId` INT NOT NULL , `parentId` INT NULL DEFAULT NULL , `type` VARCHAR(128) NOT NULL , `data` JSON NOT NULL , `date` DATETIME NOT NULL , PRIMARY KEY (`sequenceId`, `dataId`)) ENGINE = InnoDB;");
if(!tableExist("vbcmsLoadingScreens_clientsData")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_clientsData` ( `identifier` VARCHAR(64) NOT NULL , `stringId` VARCHAR(32) NOT NULL , `data` JSON NOT NULL , PRIMARY KEY (`identifier`)) ENGINE = InnoDB;"); if(!tableExist("vbcmsLoadingScreens_clientsData")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_clientsData` ( `identifier` VARCHAR(64) NOT NULL , `stringId` VARCHAR(32) NOT NULL , `data` JSON NOT NULL , PRIMARY KEY (`identifier`)) ENGINE = InnoDB;");
if(!tableExist("vbcmsLoadingScreens_previewTokens")) $bdd->query("CREATE TABLE `vbcmsLoadingScreens_previewTokens` ( `stringId` VARCHAR(32) NOT NULL , `lsId` INT NOT NULL , `expire` DATETIME NOT NULL , PRIMARY KEY (`stringId`)) ENGINE = InnoDB;");
} }
function deleteData(){ function deleteData(){
...@@ -21,6 +22,7 @@ function deleteData(){ ...@@ -21,6 +22,7 @@ function deleteData(){
$bdd->query('DROP TABLE vbcmsLoadingScreens_sequencesData'); $bdd->query('DROP TABLE vbcmsLoadingScreens_sequencesData');
$bdd->query('DROP TABLE vbcmsLoadingScreens_tempSequencesData'); $bdd->query('DROP TABLE vbcmsLoadingScreens_tempSequencesData');
$bdd->query('DROP TABLE vbcmsLoadingScreens_clientsData'); $bdd->query('DROP TABLE vbcmsLoadingScreens_clientsData');
$bdd->query('DROP TABLE vbcmsLoadingScreens_previewTokens');
} }
function getSettingsHTML($params){ function getSettingsHTML($params){
......
...@@ -5,15 +5,63 @@ if($type =="admin"){ ...@@ -5,15 +5,63 @@ if($type =="admin"){
case 'browse': case 'browse':
if(verifyUserPermission($_SESSION['user_id'], $this->name, 'access-browse')){ if(verifyUserPermission($_SESSION['user_id'], $this->name, 'access-browse')){
$pageToInclude = $extensionFullPath."/admin/browse.php"; $pageToInclude = $extensionFullPath."/admin/browse.php";
extensionCreatePage($type, 0, $pageToInclude, translate("loadingscreens_list"), "", $pageDepedencies); $this->extensionCreatePage($type, 0, $pageToInclude, translate("loadingscreens_list"), "", $pageDepedencies);
} }
break; break;
case 'create': case 'edit':
if(verifyUserPermission($_SESSION['user_id'], $this->name, 'access-browse')){ if(verifyUserPermission($_SESSION['user_id'], $this->name, 'canEdit')){
$pageToInclude = $extensionFullPath."/admin/create.php"; $pageToInclude = $extensionFullPath."/admin/edit.php";
extensionCreatePage($type, 0, $pageToInclude, translate("loadingscreens_create"), "", $pageDepedencies); $this->extensionCreatePage($type, 0, $pageToInclude, translate("loadingscreens_create"), "", $pageDepedencies);
}
break;
case 'backTasks':
if(isset($_GET['checkIdentifierOrName'])){
if(!empty($_GET['checkIdentifierOrName'])){
if(isJson(urldecode($_GET['checkIdentifierOrName']))){
$json = json_decode(urldecode($_GET['checkIdentifierOrName']), true);
if(isset($json['type']) && $json['type']=='identifier'){
$response = $bdd->prepare('SELECT * FROM `vbcmsLoadingScreens_list` WHERE identifier = ?');
$response->execute([$json['name']]);
$response=$response->fetch();
}elseif(isset($json['type']) && $json['type']=='showName'){
$response = $bdd->prepare('SELECT * FROM `vbcmsLoadingScreens_list` WHERE showName = ?');
$response->execute([$json['name']]);
$response=$response->fetch();
}else{
$return['error'] = translate('unknownType');
}
if(isset($response) && empty($response)){
$return['used'] = false;
} elseif(isset($response) && !empty($response)){
$return['used'] = true;
}
echo json_encode($return);
} else {
$return['error'] = translate('thisIsNotJSON');
echo json_encode($return);
}
} else {
$return['error'] = translate('noNameGiven');
echo json_encode($return);
}
} elseif(isset($_GET["createLoadingScreen"])){
if(isset($_POST)&&!empty($_POST)){
$query = $bdd->prepare('INSERT INTO `vbcmsLoadingScreens_list` (`identifier`, `visibility`, `sequenceId`, `showName`) VALUES (?, 1, NULL, ?)');
$query->execute([$_POST['identifier'], $_POST['showName']]);
} else {
echo translate('noPostData');
}
} elseif(isset($_GET)&&!empty($_GET)){
$return['error'] = "Commande \"".array_key_first($_GET)."(".$_GET[array_key_first($_GET)].")\" non reconnue.";
echo json_encode($return);
} else {
$return['error'] = translate('noCommandSpecified');
echo json_encode($return);
} }
break; break;
} }
......
...@@ -15,7 +15,7 @@ $translation["none"] = "Aucun"; ...@@ -15,7 +15,7 @@ $translation["none"] = "Aucun";
$translation["none-f"] = "Aucune"; $translation["none-f"] = "Aucune";
$translation["modify"] = "Modifier"; $translation["modify"] = "Modifier";
$translation["delete"] = "Supprimer"; $translation["delete"] = "Supprimer";
$translation["name"] = "Name"; $translation["name"] = "Nom";
$translation["parent"] = "Parent"; $translation["parent"] = "Parent";
$translation["website"] = "Site internet"; $translation["website"] = "Site internet";
$translation["noCategory"] = "Sans catégorie"; $translation["noCategory"] = "Sans catégorie";
...@@ -50,7 +50,7 @@ $translation["usernameEmail"] = "Nom d'utilisateur / Email"; ...@@ -50,7 +50,7 @@ $translation["usernameEmail"] = "Nom d'utilisateur / Email";
$translation["invite"] = "Inviter"; $translation["invite"] = "Inviter";
$translation["themes"] = "Thèmes"; $translation["themes"] = "Thèmes";
$translation["theme"] = "Thème"; $translation["theme"] = "Thème";
$translation["sample"] = "sample"; $translation["cancel"] = "Annuler";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
...@@ -99,6 +99,14 @@ $translation["sendInvite"] = "Envoyer l'invitation"; ...@@ -99,6 +99,14 @@ $translation["sendInvite"] = "Envoyer l'invitation";
$translation["toInviteAnUserYouMustSpecifyHisEmailOrUsername"] = "Pour inviter un utilisateur, tu dois connaitre son adresse email ou son nom d'utilisateur."; $translation["toInviteAnUserYouMustSpecifyHisEmailOrUsername"] = "Pour inviter un utilisateur, tu dois connaitre son adresse email ou son nom d'utilisateur.";
$translation["inviteSent"] = "Invitation envoyée!"; $translation["inviteSent"] = "Invitation envoyée!";
$translation["modifyProperties"] = "Modifier les propriétés"; $translation["modifyProperties"] = "Modifier les propriétés";
$translation["noParametersGiven"] = "Aucun paramètre de donné";
$translation["noNameGiven"] = "Aucun nom de donné";
$translation["thisIsNotJSON"] = "Ce n'est pas du JSON";
$translation["unknownType"] = "Type inconnu";
$translation["alreadyUsed"] = "Déjà utilisé";
$translation["noCommandSpecified"] = "Aucune commande de spcécifiée";
$translation["noPostData"] = "Pas de donnée POST :(";
$translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
$translation["sample"] = "sample"; $translation["sample"] = "sample";
......
...@@ -386,7 +386,7 @@ class module { ...@@ -386,7 +386,7 @@ class module {
} }
function call(array $parameters, $type){ function call(array $parameters, $type){
//$mbdd=$this->mbdd; $moduleName=$this->name; $adminAccess=$this->adminAccess; $clientAccess=$this->clientAccess;
$bdd=$this->bdd; $bdd=$this->bdd;
$extensionFullPath = $this->extensionFullPath; $extensionFullPath = $this->extensionFullPath;
global $translation; global $translation;
...@@ -407,4 +407,34 @@ class module { ...@@ -407,4 +407,34 @@ class module {
return $this->extensionFullPath."/includes/translations/EN.php"; return $this->extensionFullPath."/includes/translations/EN.php";
} }
} }
// Cette fonction est appelée par les modules afin de créer des pages selon 3 modes (pas vraiment besoin de l'appeler pour le 3ème)
function extensionCreatePage($panelMode, $creationMode, $pageToInclude, $title, $description, $depedencies){
// Le mode 0 correspond à l'inclusion d'une page qui retourne du code HTML
// Le mode 1 correspond à l'inclusion d'une page qui ne fait que passer des paramètres
// Le mode 2 correspond à l'inclusion d'une page qui n'utilise pas la maquette du thème, qui renvoie sa propre page
global $bdd;
$websiteUrl = VBcmsGetSetting("websiteUrl");
$websiteName = VBcmsGetSetting("websiteName");
$websiteDescription = VBcmsGetSetting("websiteDescription");
$websiteLogo = VBcmsGetSetting("websiteLogo");
// Ici on ne peut pas récupérer $http et $urlPath, on va réécrire le code ici
if(isset($_SERVER['HTTPS'])) $http = "https"; else $http = "http";
$url = parse_url("$http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
$urlPath = explode("/", $url["path"]);
if($creationMode == 0){
if($panelMode == "admin"){
$vbcmsRequest = true;
require $GLOBALS['vbcmsRootPath']."/vbcms-admin/includes/emptyPage.php";
}
} elseif($creationMode == 1){
} elseif($creationMode == 2){
require $pageToInclude;
}
}
} }
<?php <?php
// Cette fonctions permettra de récupérer des variables propres au panel dans des endroits où les variables de variables.php ne sont plus accessibles
function VBcmsGetSetting($setting){
global $bdd;
$response = $bdd->prepare("SELECT value FROM `vbcms-settings` WHERE name = ?");
$response->execute([$setting]);
return $response->fetchColumn();
}
function loadModule($type, $moduleAlias, $moduleParams){ function loadModule($type, $moduleAlias, $moduleParams){
global $bdd, $http, $websiteUrl, $translation; global $bdd;
// On va enregistrer l'évènement // On va enregistrer l'évènement
$response = $bdd->prepare("INSERT INTO `vbcms-events` (id,date,module,content,url,ip) VALUES (?,?,?,?,?,?)"); $response = $bdd->prepare("INSERT INTO `vbcms-events` (id,date,module,content,url,ip) VALUES (?,?,?,?,?,?)");
...@@ -60,24 +69,7 @@ function loadModule($type, $moduleAlias, $moduleParams){ ...@@ -60,24 +69,7 @@ function loadModule($type, $moduleAlias, $moduleParams){
} }
} }
// Cette fonction est appelée par les modules afin de créer des pages selon 3 modes (pas vraiment besoin de l'appeler pour le 3ème)
function extensionCreatePage($panelMode, $creationMode, $pageToInclude, $title, $description, $depedencies){
// Le mode 0 correspond à l'inclusion d'une page qui retourne du code HTML
// Le mode 1 correspond à l'inclusion d'une page qui ne fait que passer des paramètres
// Le mode 2 correspond à l'inclusion d'une page qui n'utilise pas la maquette du thème, qui renvoie sa propre page
global $bdd, $http, $websiteUrl, $translation, $websiteName, $websiteMetaColor, $websiteDescription, $websiteLogo, $paths;
if($creationMode == 0){
if($panelMode == "admin"){
$vbcmsRequest = true;
require $GLOBALS['vbcmsRootPath']."/vbcms-admin/includes/emptyPage.php";
}
} elseif($creationMode == 1){
} elseif($creationMode == 2){
require $pageToInclude;
}
}
// Cette fonction permet la traduction des textures en fcontion de la langue utilisée par l'utilisateur // Cette fonction permet la traduction des textures en fcontion de la langue utilisée par l'utilisateur
function translate($index){ function translate($index){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment