diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..28b6f07 --- /dev/null +++ b/.htaccess @@ -0,0 +1,19 @@ + +Order Allow,Deny +Deny from All + + + +Order Allow,Deny +Deny from All + + + +Order Allow,Deny +Deny from All + + + +Order Allow,Deny +Deny from All + \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/CICD_WebPage.iml b/.idea/CICD_WebPage.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/CICD_WebPage.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..146ab09 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..c10c940 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..7e5d55a --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Templates/.htaccess b/Templates/.htaccess new file mode 100644 index 0000000..aa5afc1 --- /dev/null +++ b/Templates/.htaccess @@ -0,0 +1,4 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/Templates/accueil.html b/Templates/accueil.html new file mode 100644 index 0000000..fb0d442 --- /dev/null +++ b/Templates/accueil.html @@ -0,0 +1,3 @@ +
+
Coucou !
+
\ No newline at end of file diff --git a/Templates/alerts.html b/Templates/alerts.html new file mode 100644 index 0000000..a981220 --- /dev/null +++ b/Templates/alerts.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Templates/chercher.html b/Templates/chercher.html new file mode 100644 index 0000000..510f601 --- /dev/null +++ b/Templates/chercher.html @@ -0,0 +1,27 @@ +
+
+
+ + +
+ + + +
+ + +
+
+ +
+ + {un_livre.TITLE}
+ {un_livre.ISBN13}
+
+
+ +
+ Previous + Next + +
\ No newline at end of file diff --git a/Templates/index.html b/Templates/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/Templates/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Templates/inf63/.htaccess b/Templates/inf63/.htaccess new file mode 100644 index 0000000..aa5afc1 --- /dev/null +++ b/Templates/inf63/.htaccess @@ -0,0 +1,4 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/Templates/inf63/index.html b/Templates/inf63/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/Templates/inf63/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Templates/menu.html b/Templates/menu.html new file mode 100644 index 0000000..988118b --- /dev/null +++ b/Templates/menu.html @@ -0,0 +1,11 @@ +
+ +
+
+ diff --git a/Templates/overall_footer.html b/Templates/overall_footer.html new file mode 100644 index 0000000..3b5d964 --- /dev/null +++ b/Templates/overall_footer.html @@ -0,0 +1,3 @@ + + + diff --git a/Templates/overall_header.html b/Templates/overall_header.html new file mode 100644 index 0000000..bffc0a7 --- /dev/null +++ b/Templates/overall_header.html @@ -0,0 +1,48 @@ + + + + + + + + +{BFMW_STYLE} + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/Traitement/.htaccess b/Traitement/.htaccess new file mode 100644 index 0000000..aa5afc1 --- /dev/null +++ b/Traitement/.htaccess @@ -0,0 +1,4 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/Traitement/accueil.php b/Traitement/accueil.php new file mode 100644 index 0000000..95bf6f1 --- /dev/null +++ b/Traitement/accueil.php @@ -0,0 +1,27 @@ +query($req) == 1) { + echo "OK"; + } + + exit(); +} + diff --git a/Traitement/chercher.php b/Traitement/chercher.php new file mode 100644 index 0000000..8a13ef7 --- /dev/null +++ b/Traitement/chercher.php @@ -0,0 +1,40 @@ +$_GET['bfmw_num_index'], + "INDEX_PREV"=>($_GET['bfmw_num_index']-10)>0?($_GET['bfmw_num_index']-10):0, + "CHAMP"=>$_GET['bfmw_orig_champ'], + "VALEUR"=>$_GET['bfmw_orig_valeur'] + )); + +} + + +generateCompleteXHTML($template, "chercher"); \ No newline at end of file diff --git a/Traitement/front.php b/Traitement/front.php new file mode 100644 index 0000000..2e541ed --- /dev/null +++ b/Traitement/front.php @@ -0,0 +1,59 @@ + $_POST["bfmw_orig_titre"]??$_GET["bfmw_orig_valeur"], + "index" => $index, + "count" => 5 + )); + $_SESSION["meslivres_resultat_recherche"] = $response; + $param .= "&index=".($index+5)."&champ=titre&valeur=".($_POST["bfmw_orig_titre"]??$_GET["bfmw_orig_valeur"]); + } + + if ((isset($_POST['bfmw_orig_auteur']) && !empty($_POST['bfmw_orig_auteur'])) || (isset($_GET["bfmw_orig_champ"]) && $_GET["bfmw_orig_champ"]=="auteur")) { + $response = WS_Util::CallWebService(BASE_URL_LIBRARY,GET_BOOKS_BY_AUTHOR,"GET",array( + "name" => $_POST["bfmw_orig_auteur"]??$_GET["bfmw_orig_valeur"], + "index" => $index, + "count" => 5 + )); + $_SESSION["meslivres_resultat_recherche"] = $response; + $param .= "&index=".($index+5)."&champ=auteur&valeur=".($_POST["bfmw_orig_auteur"]??$_GET["bfmw_orig_valeur"]); + } + +} + + +$message_erreur = ""; +if (isErreur()) { + $message_erreur = "&cpl=" . urlencode($_ERREUR[0]['COMPLEMENT']); + $message_erreur .= "&ttr=" . urlencode($_ERREUR[0]['TITRE']); + $message_erreur .= "&mss=" . urlencode($_ERREUR[0]['MESSAGE']); +} +$send = "p=" . $_GET['bfmw_orig_p2'] . $message_erreur . $param; +require 'refresh.php'; \ No newline at end of file diff --git a/Traitement/index.html b/Traitement/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/Traitement/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Traitement/logout.php b/Traitement/logout.php new file mode 100644 index 0000000..d74b705 --- /dev/null +++ b/Traitement/logout.php @@ -0,0 +1,17 @@ + "class=\"active\"" +); + +affectToXHTML($template, $table); + +generateCompleteXHTML($template, "menu"); diff --git a/Traitement/overall_footer.php b/Traitement/overall_footer.php new file mode 100644 index 0000000..3adce53 --- /dev/null +++ b/Traitement/overall_footer.php @@ -0,0 +1,19 @@ + "$nom_fichier", + "AGE_STYLE_SPECIFIQUE" => filemtime($nom_fichier) + )); + } + + $nom_fichier = "js/specific_" . $_SESSION["promotion_page"] . ".js"; + if (file_exists($nom_fichier)) { + openBloc($template, "specific_js"); + + affectToXHTML($template, array( + "JS_SPECIFIQUE" => "$nom_fichier", + "AGE_JS_SPECIFIQUE" => filemtime($nom_fichier) + )); + } +} + +$bfmw_style = "bfmw/css/bfmw.css"; +$bfmw_js = "bfmw/js/bfmw.js"; +$local_style = "css/style.css"; +$local_js = "js/main.js"; + +require_once "bfmw/css/bfmw.php"; + +affectToXHTML($template, array( + "BFMW_STYLE" => getBFMWcss(), + "LOCAL_STYLE" => "$local_style?v=".filemtime($local_style), + "BFMW_JS" => "$bfmw_js?v=".filemtime($bfmw_js), + "LOCAL_JS" => "$local_js?v=".filemtime($local_js) +)); + +generateCompleteXHTML($template, "header"); \ No newline at end of file diff --git a/bfmw/.htaccess b/bfmw/.htaccess new file mode 100644 index 0000000..b44ef56 --- /dev/null +++ b/bfmw/.htaccess @@ -0,0 +1,14 @@ + +Order Allow,Deny +Deny from All + + + +Order Allow,Deny +Deny from All + + + +Order Allow,Deny +Deny from All + \ No newline at end of file diff --git a/bfmw/Templates/.htaccess b/bfmw/Templates/.htaccess new file mode 100644 index 0000000..aa5afc1 --- /dev/null +++ b/bfmw/Templates/.htaccess @@ -0,0 +1,4 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/bfmw/Templates/accueil.html b/bfmw/Templates/accueil.html new file mode 100644 index 0000000..b59d0a1 --- /dev/null +++ b/bfmw/Templates/accueil.html @@ -0,0 +1,2 @@ + +
\ No newline at end of file diff --git a/bfmw/Templates/index.html b/bfmw/Templates/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/bfmw/Templates/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/bfmw/Templates/menu.html b/bfmw/Templates/menu.html new file mode 100644 index 0000000..3fd0419 --- /dev/null +++ b/bfmw/Templates/menu.html @@ -0,0 +1,3 @@ + +
+
\ No newline at end of file diff --git a/bfmw/Templates/overall_footer.html b/bfmw/Templates/overall_footer.html new file mode 100644 index 0000000..3b5d964 --- /dev/null +++ b/bfmw/Templates/overall_footer.html @@ -0,0 +1,3 @@ + + + diff --git a/bfmw/Templates/overall_header.html b/bfmw/Templates/overall_header.html new file mode 100644 index 0000000..06c11a8 --- /dev/null +++ b/bfmw/Templates/overall_header.html @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bfmw/Templates/tooold.html b/bfmw/Templates/tooold.html new file mode 100644 index 0000000..b6ad710 --- /dev/null +++ b/bfmw/Templates/tooold.html @@ -0,0 +1,28 @@ + + + + + + + + + + +

Votre navigateur n'est pas compatible avec ce site. Désolé !

+ + + \ No newline at end of file diff --git a/bfmw/Traitement/.htaccess b/bfmw/Traitement/.htaccess new file mode 100644 index 0000000..aa5afc1 --- /dev/null +++ b/bfmw/Traitement/.htaccess @@ -0,0 +1,4 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/bfmw/Traitement/accueil.php b/bfmw/Traitement/accueil.php new file mode 100644 index 0000000..4834ef2 --- /dev/null +++ b/bfmw/Traitement/accueil.php @@ -0,0 +1,22 @@ +query($req) == 1) { + echo "OK"; + } + + exit(); +} + diff --git a/bfmw/Traitement/front.php b/bfmw/Traitement/front.php new file mode 100644 index 0000000..4526052 --- /dev/null +++ b/bfmw/Traitement/front.php @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/bfmw/Traitement/menu.php b/bfmw/Traitement/menu.php new file mode 100644 index 0000000..511817a --- /dev/null +++ b/bfmw/Traitement/menu.php @@ -0,0 +1,22 @@ +close(); \ No newline at end of file diff --git a/bfmw/Traitement/overall_header.php b/bfmw/Traitement/overall_header.php new file mode 100644 index 0000000..e2fe71b --- /dev/null +++ b/bfmw/Traitement/overall_header.php @@ -0,0 +1,54 @@ + "$nom_fichier", + "AGE_STYLE_SPECIFIQUE" => filemtime($nom_fichier) + )); + } + + $nom_fichier = "js/specific_" . $_SESSION["projet_page"] . ".js"; + if (file_exists($nom_fichier)) { + openBloc($template, "specific_js"); + + affectToXHTML($template, array( + "JS_SPECIFIQUE" => "$nom_fichier", + "AGE_JS_SPECIFIQUE" => filemtime($nom_fichier) + )); + } +} + +$bfmw_style = "bfmw/css/bfmw.css"; +$bfmw_js = "bfmw/js/bfmw.js"; +$local_style = "css/style.css"; +$local_js = "js/main.js"; + +affectToXHTML($template, array( + "BFMW_STYLE" => "$bfmw_style?v=".filemtime($bfmw_style), + "LOCAL_STYLE" => "$local_style?v=".filemtime($local_style), + "BFMW_JS" => "$bfmw_js?v=".filemtime($bfmw_js), + "LOCAL_JS" => "$local_js?v=".filemtime($local_js) +)); + +generateCompleteXHTML($template, "header"); \ No newline at end of file diff --git a/bfmw/css/alert.css b/bfmw/css/alert.css new file mode 100644 index 0000000..63a1f0f --- /dev/null +++ b/bfmw/css/alert.css @@ -0,0 +1,113 @@ +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + + +/******************************************* +Alerts +********************************************/ +.alert { + padding: 20px; + background-color: #f44336; + color: white; + opacity: 1; + transition: opacity 0.6s; + margin-bottom: 15px; +} + +.alert.success {background-color: #4CAF50;} +.alert.info {background-color: #2196F3;} +.alert.warning {background-color: #ff9800;} + +.closebtn { + margin-left: 15px; + color: white; + font-weight: bold; + float: right; + font-size: 22px; + line-height: 20px; + cursor: pointer; + transition: 0.3s; +} + +.closebtn:hover { + color: black; +} + +.modal { + display: none; + position: fixed; + z-index: 1000; + padding-top: 100px; + left: 0; + top: 0; + width: 100%; + height: calc(100% - 100px); + overflow: auto; + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.4); +} + +/* Modal Content */ +.modal-content { + position: relative; + background-color: #fefefe; + margin: auto; + padding: 0; + border: 1px solid #888; + width: 80%; + box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); + -webkit-animation-name: animatetop; + -webkit-animation-duration: 0.4s; + animation-name: animatetop; + animation-duration: 0.4s +} + +/* Add Animation */ +@-webkit-keyframes animatetop { + from {top:-300px; opacity:0} + to {top:0; opacity:1} +} + +@keyframes animatetop { + from {top:-300px; opacity:0} + to {top:0; opacity:1} +} + +/* The Close Button */ +.close { + color: white; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close:hover, +.close:focus { + color: #000; + text-decoration: none; + cursor: pointer; +} + +.modal-header { + padding: 2px 16px; + background-color: red; + color: white; +} + +.modal-body { + padding: 2px 16px; + color : black; +} \ No newline at end of file diff --git a/bfmw/css/bfmw.css b/bfmw/css/bfmw.css new file mode 100644 index 0000000..4b64cc9 --- /dev/null +++ b/bfmw/css/bfmw.css @@ -0,0 +1,26 @@ +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + + +@import "global.css"; +@import "main.css"; +@import "master.css"; +@import "detail.css"; +@import "mdresponsive.css"; +@import "menu.css"; +@import "alert.css"; +@import "tooltip.css"; +@import "table.css"; diff --git a/bfmw/css/bfmw.php b/bfmw/css/bfmw.php new file mode 100644 index 0000000..133f8d7 --- /dev/null +++ b/bfmw/css/bfmw.php @@ -0,0 +1,44 @@ +\n"; + } + + $fichier_print = "print.css"; + + $retour .= "\t\t\n"; + + return $retour; +} \ No newline at end of file diff --git a/bfmw/css/detail.css b/bfmw/css/detail.css new file mode 100644 index 0000000..2b0c67c --- /dev/null +++ b/bfmw/css/detail.css @@ -0,0 +1,35 @@ +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + + +/******************************************* +Gestion detail +********************************************/ +#detail { + transition: .5s; + margin-left: 318px; + overflow: auto; +} + +a.show_master { + color : white; + text-decoration: none; + font-size: 30px; + visibility: collapse; + display: none; + z-index: 1000; + text-align: left; +} \ No newline at end of file diff --git a/bfmw/css/global.css b/bfmw/css/global.css new file mode 100644 index 0000000..c1d12e6 --- /dev/null +++ b/bfmw/css/global.css @@ -0,0 +1,163 @@ +/* /* Framework : BFMW +*/ +/******************************************* +Global +********************************************/ +body:not(.bfmw_no_style) { + font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; + font-size: 15px; + line-height: 1.5; + background-color: #29363f; + color : white; +} + +a { + color: white; + text-align: center; + text-decoration: none; +} + +a:hover { + color: #53ff53; + -webkit-transition: 0.3s ; + -moz-transition: 0.3s ; + -ms-transition: 0.3s ; + -o-transition: 0.3s ; + transition: 0.3s ; +} + +.vert { + color: #53ff53; +} + +.bleu { + color : #a3a3ff; +} + +.rouge { + color : #ff9999; +} + +.noir { + color : #000000; +} + +.jaune { + color : #999900; +} + +.jaune_force { + color : #999900 !important; +} + +.vert_doux { + color: #539953; +} + +.blanc { + color: #FFFFFF; +} + + + +.font_small { + font-size: small; +} + +.font_large { + font-size: large; +} + +.font_medium { + font-size: medium; +} + +.font_bold { + font-weight: bold; +} + +.width_100 { + width: 100% !important; +} + +.text_align_left { + text-align: left !important; +} + +.text_align_center { + text-align: center !important; +} + +.text_align_right { + text-align: right !important; +} + +.text_align_justify { + text-align: justify !important; +} + +.text_vertical_middle { + vertical-align: middle !important; +} + +.text_vertical_bottom { + vertical-align: bottom !important; +} + +.text_vertical_top { + vertical-align: top !important; +} + +.bfmw_noscript { + position: absolute; + height: 100%; + width: 100%; + background: black url("images/odin.png") no-repeat top; + z-index: 99999; + top: 0; + left: 0; + color: red; + text-align: center; + margin-top: 0; +} + +.no_wrap { + white-space: nowrap; +} + +.wrap { + white-space: normal !important; +} + +.hide { + display: none; +} + +.force_hide { + display: none !important; +} + +.bfmw_align_center { + margin-left:auto; + margin-right:auto; +} + +.CheckBoxList { + border:2px solid #ccc; + background-color: white; + color: black; + overflow-y: scroll; + display: inline-block; +} + +.monter:before { + content: '\25B2'; + white-space: nowrap; + text-shadow: -1px 0 #ffffff, 0 1px #ffffff, 1px 0 #ffffff, 0 -1px #ffffff; +} + +.descendre:before { + content: '\25BC'; + white-space: nowrap; + text-shadow: -1px 0 #ffffff, 0 1px #ffffff, 1px 0 #ffffff, 0 -1px #ffffff; +} \ No newline at end of file diff --git a/bfmw/css/index.php b/bfmw/css/index.php new file mode 100644 index 0000000..5290b4c --- /dev/null +++ b/bfmw/css/index.php @@ -0,0 +1,23 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/bfmw/includes/Comparateur.php b/bfmw/includes/Comparateur.php new file mode 100644 index 0000000..5da4aa5 --- /dev/null +++ b/bfmw/includes/Comparateur.php @@ -0,0 +1,86 @@ +clef = $clef; + $this->comparateur = $comparateur; + $this->selecteur = $selecteur; + $this->valeur_true = $valeur_true; + $this->valeur_false = $valeur_false; + } + + /** + * @return string + */ + public function getClef() : string + { + return $this->clef; + } + + /** + * @return string + */ + public function getComparateur() : ?string + { + return $this->comparateur; + } + + + /** + * @return string + */ + public function getSelecteur() : string + { + return $this->selecteur; + } + + + /** + * @return string + */ + public function getValeurTrue() : string + { + return $this->valeur_true; + } + + /** + * @return string + */ + public function getValeurFalse() : string + { + return $this->valeur_false; + } + + +} \ No newline at end of file diff --git a/bfmw/includes/common.php b/bfmw/includes/common.php new file mode 100644 index 0000000..7b1a453 --- /dev/null +++ b/bfmw/includes/common.php @@ -0,0 +1,46 @@ + $complement, + "TITRE" => $titre, + "MESSAGE" => $message + )); + +} + +function isErreur() +{ + global $_ERREUR; + return (count($_ERREUR, COUNT_RECURSIVE) > 0 || (isset($_GET['bfmw_orig_cpl']) && isset($_GET['bfmw_orig_ttr']) && isset($_GET['bfmw_orig_mss']))); +} + +function transformDate($date) { + if (strpos($date,"/") !== false) { + list($jour, $mois, $annee) = explode('/', $date); + } else { + if (strpos($date, "-") !== false) { + list($annee, $mois, $jour) = explode('-', $date); + } + } + + return mktime(0,0,0,$mois,$jour,$annee); +} +function transformDate2359($date) { + if (strpos($date,"/") !== false) { + list($jour, $mois, $annee) = explode('/', $date); + } else { + if (strpos($date, "-") !== false) { + list($annee, $mois, $jour) = explode('-', $date); + } + } + return mktime(23,59,59,$mois,$jour,$annee); +} + +function transformHeure($heure) { + if (strpos($heure,"h") !== false) { + list($hour, $minutes) = explode('h', $heure); + } else { + list($hour, $minutes) = explode(':', $heure); + } + return mktime($hour,$minutes,0,null,null,null); +} + +function transformDateHeureSepares($date,$heure,$separateur_horaire = "h") { + if (strpos($date,"/") !== false) { + list($jour, $mois, $annee) = explode('/', $date); + } else { + if (strpos($date, "-") !== false) { + list($annee, $mois, $jour) = explode('-', $date); + } + } + list($heure, $minutes) = explode($separateur_horaire, $heure); + return mktime($heure,$minutes,0,$mois,$jour,$annee); +} + +function transformDateHeure($complet) { + if (strpos($complet,"T") !== false) { + list($date, $heure) = explode('T', $complet); + } else { + list($date, $heure) = explode(' ', $complet); + } + if (strpos($date,"/") !== false) { + list($jour, $mois, $annee) = explode('/', $date); + } else { + if (strpos($date, "-") !== false) { + list($annee, $mois, $jour) = explode('-', $date); + } + } + if (strpos($heure,"h") !== false) { + list($heure, $minutes) = explode('h', $heure); + } else { + list($heure, $minutes) = explode(':', $heure); + } + return mktime($heure,$minutes,0,$mois,$jour,$annee); +} + +function extractTime(int $complet) : int { + $converteur = new DateTime(); + $converteur->setTimestamp($complet); + $converteur->setDate(1999,11,30); + return $converteur->getTimestamp(); +} + +function extractDate(int $complet) : int { + $converteur = new DateTime(); + $converteur->setTimestamp($complet); + $converteur->setTime(0,0,0); + return $converteur->getTimestamp(); +} + +function convertTimeStampToString(string $format,int $timestamp) : string { + $date = new DateTime(); + $date->setTimestamp($timestamp); + return $date->format($format); +} + +set_error_handler('exceptions_error_handler'); + +function exceptions_error_handler($severity, $message, $filename, $lineno) { + if (error_reporting() == 0) { + return; + } + if (error_reporting() & $severity) { + throw new ErrorException($message, 0, $severity, $filename, $lineno); + } +} \ No newline at end of file diff --git a/bfmw/includes/header.php b/bfmw/includes/header.php new file mode 100644 index 0000000..807f84d --- /dev/null +++ b/bfmw/includes/header.php @@ -0,0 +1,22 @@ + $val) { + foreach ($val as $k => $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key][addslashes($k)] = $v; + $process[] = &$process[$key][addslashes($k)]; + } else { + $process[$key][addslashes($k)] = addslashes($v); + } + } +} +unset($process); + +$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); +foreach ($process as $key => $val) { + foreach ($val as $k => $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key][htmlspecialchars($k)] = $v; + $process[] = &$process[$key][htmlspecialchars($k)]; + } else { + $process[$key][htmlspecialchars($k)] = htmlspecialchars($v); + } + } +} +unset($process); + +$process = array(&$_GET, &$_POST, &$_REQUEST); +manual_bfmw_secure($process); +unset($process); + +if (isset($_GET['bfmw_orig_ticket'])) { + $_GET['ticket'] = $_GET['bfmw_orig_ticket']; +} + +function get_numeric($val) { + if (is_array($val)) { + foreach ($val as $key => $valeur) { + $val[$key] = get_numeric($valeur); + } + return $val; + } + if (is_numeric(str_replace(",",".",$val))) { + $val = str_replace(",",".",$val); + return $val; + } + if ($val === "NULL") { + return null; + } + return null; +} + +function manual_bfmw_secure(&$process) { + foreach ($process as $key => $val) { + foreach ($val as $k => $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key]["bfmw_orig_".$k] = $v; + $process[$key]["bfmw_num_".$k] = get_numeric($v); + $process[] = &$process[$key]["bfmw_orig_".$k]; + $process[] = &$process[$key]["bfmw_num_".$k]; + } else { + $process[$key]["bfmw_orig_".$k] = $v; + $process[$key]["bfmw_num_".$k] = get_numeric($v); + } + } + } +} + +function bfmw_add_secured(array &$data,string $field,$value) { + $data["bfmw_orig_".$field] = $value; + $data["bfmw_num_".$field] = get_numeric($value); +} \ No newline at end of file diff --git a/bfmw/includes/template.php b/bfmw/includes/template.php new file mode 100644 index 0000000..2c17c9b --- /dev/null +++ b/bfmw/includes/template.php @@ -0,0 +1,1080 @@ + $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value + * if it's a root-level variable, it'll be like this: + * --> $this->_tpldata[.][0][varname] == value + */ + private $_tpldata = array('.' => array(0 => array())); + private $_rootref; + + // Root dir and hash of filenames for each template handle. + private $root = ''; + private $cachepath = ''; + private $files = array(); + private $filename = array(); + //private $files_inherit = array(); + //private $files_template = array(); + //private $inherit_root = ''; + + // this will hash handle names to the compiled/uncompiled code for that handle. + private $compiled_code = array(); + + // Various storage arrays(functions_template) + private $block_names = array(); + private $block_else_level = array(); + + // ***** addon ******* + private $lang = NULL; + const PHPEX = 'php'; + + + /** + * Set template location + * @access public + */ + public function __construct($template_path='template', $cache_path='cache', &$lang=NULL) + { + if (file_exists($template_path)) + { + $this->root = $template_path; + $this->cachepath = $cache_path . '/tpl_'; + $this->lang = &$lang; + } + else + trigger_error('Template path could not be found: ' . $template_path, E_USER_ERROR); + + $this->_rootref = &$this->_tpldata['.'][0]; + } + + /** + * Set custom template location (able to use directory outside of phpBB) + * @access public + */ + function set_custom_template($template_path, $cache_path) + { + $this->root = $template_path; + $this->cachepath = $cache_path . '/tpl_'; + + return true; + } + + /** + * addon + * Set custom language variable + * @access public + */ + function set_language_var(&$lang) + { + $this->lang = &$lang; + } + + /** + * Sets the template filenames for handles. $filename_array + * should be a hash of handle => filename pairs. + * @access public + */ + public function set_filenames($filename_array) + { + if (!is_array($filename_array)) + return false; + + foreach ($filename_array as $handle => $filename) + { + if (empty($filename)) + trigger_error("template->set_filenames: Empty filename specified for $handle", E_USER_ERROR); + + $this->filename[$handle] = $filename; + $this->files[$handle] = $this->root . '/' . $filename; + } + + return true; + } + + /** + * Destroy template data set + * @access public + */ + public function destroy() + { + $this->_tpldata = array('.' => array(0 => array())); + } + + /** + * Reset/empty complete block + * @access public + */ + public function destroy_block_vars($blockname) + { + if (strpos($blockname, '.') !== false) + { + // Nested block. + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + $str = &$this->_tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $str = &$str[$blocks[$i]]; + $str = &$str[sizeof($str) - 1]; + } + + unset($str[$blocks[$blockcount]]); + } + else + { + // Top-level block. + unset($this->_tpldata[$blockname]); + } + + return true; + } + + /** + * Display handle + * @access public + */ + public function display($handle, $include_once = true) + { + if ($filename = $this->_tpl_load($handle)) + ($include_once) ? include_once($filename) : include($filename); + else + eval(' ?>' . $this->compiled_code[$handle] . 'display($handle, $include_once); + $contents = ob_get_clean(); + + if ($return_content) + return $contents; + + $this->assign_var($template_var, $contents); + + return true; + } + + /** + * Load a compiled template if possible, if not, recompile it + * @access private + */ + private function _tpl_load(&$handle) + { + $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . self::PHPEX; + + if (!file_exists($filename) || @filesize($filename) === 0) + $recompile = true; + else + $recompile = (@filemtime($filename) < filemtime($this->files[$handle])) ? true : false; + + // Recompile page if the original template is newer, otherwise load the compiled version + if (!$recompile) + return $filename; + + // If we don't have a file assigned to this handle, die. + if (!isset($this->files[$handle])) + trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR); + + $this->_tpl_load_file($handle); + return false; + } + + /** + * Assign key variable pairs from an array + * @access public + */ + public function assign_vars($vararray) + { + foreach ($vararray as $key => $val) + $this->_rootref[$key] = $val; + + return true; + } + + /** + * Assign a single variable to a single key + * @access public + */ + public function assign_var($varname, $varval) + { + $this->_rootref[$varname] = $varval; + + return true; + } + + /** + * Assign key variable pairs from an array to a specified block + * @access public + */ + public function assign_block_vars($blockname, $vararray) + { + if (strpos($blockname, '.') !== false) + { + // Nested block. + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + $str = &$this->_tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $str = &$str[$blocks[$i]]; + if (!empty($str)) { + $str = &$str[sizeof($str) - 1]; + } + } + + $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0; + $vararray['S_ROW_COUNT'] = $s_row_count; + + // Assign S_FIRST_ROW + if (!$s_row_count) + $vararray['S_FIRST_ROW'] = true; + + // Now the tricky part, we always assign S_LAST_ROW and remove the entry before + // This is much more clever than going through the complete template data on display (phew) + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']); + + // Now we add the block that we're actually assigning to. + // We're adding a new iteration to this block with the given + // variable assignments. + $str[$blocks[$blockcount]][] = $vararray; + } + else + { + // Top-level block. + $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; + $vararray['S_ROW_COUNT'] = $s_row_count; + + // Assign S_FIRST_ROW + if (!$s_row_count) + $vararray['S_FIRST_ROW'] = true; + + // We always assign S_LAST_ROW and remove the entry before + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); + + // Add a new iteration to this block with the variable assignments we were given. + $this->_tpldata[$blockname][] = $vararray; + } + + return true; + } + + /** + * Change already assigned key variable pair (one-dimensional - single loop entry) + * + * An example of how to use this function: + * {@example alter_block_array.php} + * + * @param string $blockname the blockname, for example 'loop' + * @param array $vararray the var array to insert/add or merge + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to change or insert at directly given] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @param string $mode Mode to execute (valid modes are 'insert' and 'change') + * + * If insert, the vararray is inserted at the given position (position counting from zero). + * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). + * + * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) + * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) + * + * @return bool false on error, true on success + * @access public + */ + public function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') + { + if (strpos($blockname, '.') !== false) + { + // Nested blocks are not supported + return false; + } + + // Change key to zero (change first position) if false and to last position if true + if ($key === false || $key === true) + { + $key = ($key === false) ? 0 : sizeof($this->_tpldata[$blockname]); + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + + $key = NULL; + foreach ($this->_tpldata[$blockname] as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + $key = $i; + break; + } + } + + // key/value pair not found + if ($key === NULL) + return false; + } + + // Insert Block + if ($mode == 'insert') + { + // Make sure we are not exceeding the last iteration + if ($key >= sizeof($this->_tpldata[$blockname])) + { + $key = sizeof($this->_tpldata[$blockname]); + unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); + $vararray['S_LAST_ROW'] = true; + } + else if ($key === 0) + { + unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); + $vararray['S_FIRST_ROW'] = true; + } + + // Re-position template blocks + for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) + { + $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1]; + $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i; + } + + // Insert vararray at given position + $vararray['S_ROW_COUNT'] = $key; + $this->_tpldata[$blockname][$key] = $vararray; + + return true; + } + + // Which block to change? + if ($mode == 'change') + { + if ($key == sizeof($this->_tpldata[$blockname])) + { + $key--; + } + + $this->_tpldata[$blockname][$key] = array_merge($this->_tpldata[$blockname][$key], $vararray); + return true; + } + + return false; + } + + /** + * Include a separate template + * @access private + */ + private function _tpl_include($filename, $include = true) + { + $handle = $filename; + $this->filename[$handle] = $filename; + $this->files[$handle] = $this->root . '/' . $filename; + + $filename = $this->_tpl_load($handle); + + if ($include) + { + if ($filename) + { + include($filename); + return; + } + eval(' ?>' . $this->compiled_code[$handle] . 'files[$handle])) + trigger_error("template->_tpl_load_file(): File {$this->files[$handle]} does not exist or is empty", E_USER_ERROR); + + $this->compiled_code[$handle] = $this->compile(trim(@file_get_contents($this->files[$handle]))); + + // Actually compile the code now. + $this->compile_write($handle, $this->compiled_code[$handle]); + } + + /** + * Remove any PHP tags that do not belong, these regular expressions are derived from + * the ones that exist in zend_language_scanner.l + * @access private + */ + private function remove_php_tags(&$code) + { + // This matches the information gathered from the internal PHP lexer + $match = array( + '#<([\?%])=?.*?\1>#s', + '#.*?#s', + '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s' + ); + + $code = preg_replace($match, '', $code); + } + + /** + * The all seeing all doing compile method. Parts are inspired by or directly from Smarty + * @access private + */ + private function compile($code, $no_echo = false, $echo_var = '') + { + if ($echo_var) + global $$echo_var; + + // Remove any "loose" php ... we want to give admins the ability + // to switch on/off PHP for a given template. Allowing unchecked + // php is a no-no. There is a potential issue here in that non-php + // content may be removed ... however designers should use entities + // if they wish to display < and > + $this->remove_php_tags($code); + + // Pull out all block/statement level elements and separate plain text + preg_match_all('#(.*?)#s', $code, $matches); + $php_blocks = $matches[1]; + $code = preg_replace('#.*?#s', '', $code); + + preg_match_all('##', $code, $matches); + $include_blocks = $matches[1]; + $code = preg_replace('##', '', $code); + + preg_match_all('##', $code, $matches); + $includephp_blocks = $matches[1]; + $code = preg_replace('##', '', $code); + + preg_match_all('##', $code, $blocks, PREG_SET_ORDER); + + $text_blocks = preg_split('##', $code); + + for ($i = 0, $j = sizeof($text_blocks); $i < $j; $i++) + { + $this->compile_var_tags($text_blocks[$i]); + } + $compile_blocks = array(); + + for ($curr_tb = 0, $tb_size = sizeof($blocks); $curr_tb < $tb_size; $curr_tb++) + { + $block_val = &$blocks[$curr_tb]; + + switch ($block_val[1]) + { + case 'BEGIN': + $this->block_else_level[] = false; + $compile_blocks[] = 'compile_tag_block($block_val[2]) . ' ?>'; + break; + + case 'BEGINELSE': + $this->block_else_level[sizeof($this->block_else_level) - 1] = true; + $compile_blocks[] = ''; + break; + + case 'END': + array_pop($this->block_names); + $compile_blocks[] = 'block_else_level)) ? '}' : '}}') . ' ?>'; + break; + + case 'IF': + $compile_blocks[] = 'compile_tag_if($block_val[2], false) . ' ?>'; + break; + + case 'ELSE': + $compile_blocks[] = ''; + break; + + case 'ELSEIF': + $compile_blocks[] = 'compile_tag_if($block_val[2], true) . ' ?>'; + break; + + case 'ENDIF': + $compile_blocks[] = ''; + break; + + case 'DEFINE': + $compile_blocks[] = 'compile_tag_define($block_val[2], true) . ' ?>'; + break; + + case 'UNDEFINE': + $compile_blocks[] = 'compile_tag_define($block_val[2], false) . ' ?>'; + break; + + case 'INCLUDE': + $temp = array_shift($include_blocks); + $compile_blocks[] = 'compile_tag_include($temp) . ' ?>'; + $this->_tpl_include($temp, false); + break; + + case 'INCLUDEPHP': + $compile_blocks[] = ($config['tpl_allow_php']) ? 'compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>' : ''; + break; + + case 'PHP': + $compile_blocks[] = ($config['tpl_allow_php']) ? '' : ''; + break; + + default: + $this->compile_var_tags($block_val[0]); + $trim_check = trim($block_val[0]); + $compile_blocks[] = (!$no_echo) ? ((!empty($trim_check)) ? $block_val[0] : '') : ((!empty($trim_check)) ? $block_val[0] : ''); + break; + } + } + + $template_php = ''; + for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++) + { + $trim_check_text = trim($text_blocks[$i]); + $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : ''); + } + + // There will be a number of occasions where we switch into and out of + // PHP mode instantaneously. Rather than "burden" the parser with this + // we'll strip out such occurences, minimising such switching + $template_php = str_replace(' ?>generate_block_varref($namespace, $varname, true, $var_val[2]); + + $text_blocks = str_replace($var_val[0], $new, $text_blocks); + } + + // This will handle the remaining root-level varrefs + // transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array + if (strpos($text_blocks, '{L_') !== false) + { + $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*)\}#is', "_rootref['L_\\1'])) ? \$this->_rootref['L_\\1'] : ((isset(\$this->lang['\\1'])) ? \$this->lang['\\1'] : '{ \\1 }')); ?>", $text_blocks); + } + + // Handle addslashed language variables prefixed with LA_ + // If a template variable already exist, it will be used in favor of it... + if (strpos($text_blocks, '{LA_') !== false) + { + $text_blocks = preg_replace('#\{LA_([a-z0-9\-_]*)\}#is', "_rootref['LA_\\1'])) ? \$this->_rootref['LA_\\1'] : ((isset(\$this->_rootref['L_\\1'])) ? addslashes(\$this->_rootref['L_\\1']) : ((isset(\$this->lang['\\1'])) ? addslashes(\$this->lang['\\1']) : '{ \\1 }'))); ?>", $text_blocks); + } + + // Handle remaining varrefs + $text_blocks = preg_replace('#\{([a-z0-9\-_]+)\}#is', "_rootref['\\1'])) ? \$this->_rootref['\\1'] : ''; ?>", $text_blocks); + $text_blocks = preg_replace('#\{\$([a-z0-9\-_]+)\}#is', "_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks); + + return; + } + + /** + * Compile blocks + * @access private + */ + private function compile_tag_block($tag_args) + { + $no_nesting = false; + + // Is the designer wanting to call another loop in a loop? + if (strpos($tag_args, '!') === 0) + { + // Count the number if ! occurrences (not allowed in vars) + $no_nesting = substr_count($tag_args, '!'); + $tag_args = substr($tag_args, $no_nesting); + } + + // Allow for control of looping (indexes start from zero): + // foo(2) : Will start the loop on the 3rd entry + // foo(-2) : Will start the loop two entries from the end + // foo(3,4) : Will start the loop on the fourth entry and end it on the fifth + // foo(3,-4) : Will start the loop on the fourth entry and end it four from last + if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match)) + { + $tag_args = $match[1]; + + if ($match[2] < 0) + $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; + else + $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; + + if (strlen($match[3]) < 1 || $match[3] == -1) + $loop_end = '$_' . $tag_args . '_count'; + else if ($match[3] >= 0) + $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; + else //if ($match[3] < -1) + $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); + } + else + { + $loop_start = 0; + $loop_end = '$_' . $tag_args . '_count'; + } + + $tag_template_php = ''; + array_push($this->block_names, $tag_args); + + if ($no_nesting !== false) + { + // We need to implode $no_nesting times from the end... + $block = array_slice($this->block_names, -$no_nesting); + } + else + { + $block = $this->block_names; + } + + if (sizeof($block) < 2) + { + // Block is not nested. + $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; + $varref = "\$this->_tpldata['$tag_args']"; + } + else + { + // This block is nested. + // Generate a namespace string for this block. + $namespace = implode('.', $block); + + // Get a reference to the data array for this block that depends on the + // current indices of all parent blocks. + $varref = $this->generate_block_data_ref($namespace, false); + + // Create the for loop code to iterate over this block. + $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;'; + } + + $tag_template_php .= 'if ($_' . $tag_args . '_count) {'; + $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; + $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; + + return $tag_template_php; + } + + /** + * Compile IF tags - much of this is from Smarty with + * some adaptions for our block level methods + * @access private + */ + private function compile_tag_if($tag_args, $elseif) + { + // Tokenize args for 'if' tag. + preg_match_all('/(?: + "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | + \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | + [(),] | + [^\s(),]+)/x', $tag_args, $match); + + $tokens = $match[0]; + $is_arg_stack = array(); + + for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) + { + $token = &$tokens[$i]; + + switch ($token) + { + case '!==': + case '===': + case '<<': + case '>>': + case '|': + case '^': + case '&': + case '~': + case ')': + case ',': + case '+': + case '-': + case '*': + case '/': + case '@': + break; + + case '==': + case 'eq': + $token = '=='; + break; + + case '!=': + case '<>': + case 'ne': + case 'neq': + $token = '!='; + break; + + case '<': + case 'lt': + $token = '<'; + break; + + case '<=': + case 'le': + case 'lte': + $token = '<='; + break; + + case '>': + case 'gt': + $token = '>'; + break; + + case '>=': + case 'ge': + case 'gte': + $token = '>='; + break; + + case '&&': + case 'and': + $token = '&&'; + break; + + case '||': + case 'or': + $token = '||'; + break; + + case '!': + case 'not': + $token = '!'; + break; + + case '%': + case 'mod': + $token = '%'; + break; + + case '(': + array_push($is_arg_stack, $i); + break; + + case 'is': + $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; + $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); + + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); + + array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); + + $i = $is_arg_start; + + // no break + + default: + if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs)) + { + $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); + } + else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) + { + // Allow checking if loops are set with .loopname + // It is also possible to check the loop count by doing for example + $blocks = explode('.', $varrefs[1]); + + // If the block is nested, we have a reference that we can grab. + // If the block is not nested, we just go and grab the block from _tpldata + if (sizeof($blocks) > 1) + { + $block = array_pop($blocks); + $namespace = implode('.', $blocks); + $varref = $this->generate_block_data_ref($namespace, true); + + // Add the block reference for the last child. + $varref .= "['" . $block . "']"; + } + else + { + $varref = '$this->_tpldata'; + + // Add the block reference for the last child. + $varref .= "['" . $blocks[0] . "']"; + } + $token = "sizeof($varref)"; + } + else if (!empty($token)) + { + $token = '(' . $token . ')'; + } + + break; + } + } + + // If there are no valid tokens left or only control/compare characters left, we do skip this statement + if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '') + { + $tokens = array('false'); + } + return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { '); + } + + /** + * Compile DEFINE tags + * @access private + */ + private function compile_tag_define($tag_args, $op) + { + preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); + + if (empty($match[2]) || (!isset($match[4]) && $op)) + return ''; + + if (!$op) + return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');'; + + // Are we a string? + if ($match[3] && $match[5]) + { + $match[4] = str_replace(array('\\\'', '\\\\', '\''), array('\'', '\\', '\\\''), $match[4]); + + // Compile reference, we allow template variables in defines... + $match[4] = $this->compile($match[4]); + + // Now replace the php code + $match[4] = "'" . str_replace(array(''), array("' . ", " . '"), $match[4]) . "'"; + } + else + { + preg_match('#true|false|\.#i', $match[4], $type); + + switch (strtolower($type[0])) + { + case 'true': + case 'false': + $match[4] = strtoupper($match[4]); + break; + + case '.': + $match[4] = doubleval($match[4]); + break; + + default: + $match[4] = intval($match[4]); + break; + } + } + + return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';'; + } + + /** + * Compile INCLUDE tag + * @access private + */ + private function compile_tag_include($tag_args) + { + return "\$this->_tpl_include('$tag_args');"; + } + + /** + * Compile INCLUDE_PHP tag + * @access private + */ + private function compile_tag_include_php($tag_args) + { + return "include('" . $tag_args . "');"; + } + + /** + * parse expression + * This is from Smarty + * @access private + */ + private function _parse_is_expr($is_arg, $tokens) + { + $expr_end = 0; + $negate_expr = false; + + if (($first_token = array_shift($tokens)) == 'not') + { + $negate_expr = true; + $expr_type = array_shift($tokens); + } + else + { + $expr_type = $first_token; + } + + switch ($expr_type) + { + case 'even': + if (@$tokens[$expr_end] == 'by') + { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; + } + else + { + $expr = "!($is_arg & 1)"; + } + break; + + case 'odd': + if (@$tokens[$expr_end] == 'by') + { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "(($is_arg / $expr_arg) % $expr_arg)"; + } + else + { + $expr = "($is_arg & 1)"; + } + break; + + case 'div': + if (@$tokens[$expr_end] == 'by') + { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "!($is_arg % $expr_arg)"; + } + break; + } + + if ($negate_expr) + { + $expr = "!($expr)"; + } + + array_splice($tokens, 0, $expr_end, $expr); + + return $tokens; + } + + /** + * Generates a reference to the given variable inside the given (possibly nested) + * block namespace. This is a string of the form: + * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' + * It's ready to be inserted into an "echo" line in one of the templates. + * NOTE: expects a trailing "." on the namespace. + * @access private + */ + private function generate_block_varref($namespace, $varname, $echo = true, $defop = false) + { + // Strip the trailing period. + $namespace = substr($namespace, 0, -1); + + // Get a reference to the data block for this namespace. + $varref = $this->generate_block_data_ref($namespace, true, $defop); + // Prepend the necessary code to stick this in an echo line. + + // Append the variable reference. + $varref .= "['$varname']"; + $varref = ($echo) ? "" : ((isset($varref)) ? $varref : ''); + + return $varref; + } + + /** + * Generates a reference to the array of data values for the given + * (possibly nested) block namespace. This is a string of the form: + * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] + * + * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. + * NOTE: does not expect a trailing "." on the blockname. + * @access private + */ + private function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) + { + // Get an array of the blocks involved. + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + // DEFINE is not an element of any referenced variable, we must use _tpldata to access it + if ($defop) + { + $varref = '$this->_tpldata[\'DEFINE\']'; + // Build up the string with everything but the last child. + for ($i = 0; $i < $blockcount; $i++) + { + $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]'; + } + // Add the block reference for the last child. + $varref .= "['" . $blocks[$blockcount] . "']"; + // Add the iterator for the last child if requried. + if ($include_last_iterator) + { + $varref .= '[$_' . $blocks[$blockcount] . '_i]'; + } + return $varref; + } + else if ($include_last_iterator) + { + return '$_'. $blocks[$blockcount] . '_val'; + } + else + { + return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; + } + } + + /** + * Write compiled file to cache directory + * @access private + */ + private function compile_write($handle, $data) + { + $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . self::PHPEX; + + if ($fp = @fopen($filename, 'wb')) + { + @flock($fp, LOCK_EX); + @fwrite ($fp, $data); + @flock($fp, LOCK_UN); + @fclose($fp); + + /***phpbb_chmod($filename, CHMOD_WRITE);*/ + } + + return; + } +} diff --git a/bfmw/includes/tpl_functions.php b/bfmw/includes/tpl_functions.php new file mode 100644 index 0000000..68a2492 --- /dev/null +++ b/bfmw/includes/tpl_functions.php @@ -0,0 +1,111 @@ +set_filenames(array($identificator_name => $file_path)); +} + +function affectToXHTML(Template &$template,array $var_table) { + $template->assign_vars($var_table); +} + +function openBloc(Template &$template,string $bloc_name) { + $template->assign_block_vars($bloc_name,array()); +} + +function affectToBloc(Template &$template,string $bloc_name,array $var_table) { + $template->assign_block_vars($bloc_name,$var_table); +} + +function affectToBlocAndRepeat(Template &$template,string $bloc_name,array $donnes_de_la_table,Comparateur $comparateur = null,array $multiplicateur=null,?Closure $toDoAtEnd = null,?string $clefSansRepetition = null) : ?string { + $retour = ""; + $first = "-1"; + $valeur_non_repetition = array(); + foreach ($donnes_de_la_table as $une_ligne_de_la_table) { + if ($clefSansRepetition != null) { + if (!in_array($une_ligne_de_la_table[$clefSansRepetition],$valeur_non_repetition)) { + $valeur_non_repetition[] = $une_ligne_de_la_table[$clefSansRepetition]; + } else { + continue; + } + } + + + if ($comparateur != null) { + if ($first === "-1") { + $first = $une_ligne_de_la_table[$comparateur->getClef()]; + } + if ($une_ligne_de_la_table[$comparateur->getClef()] == $comparateur->getComparateur()) { + $retour = $une_ligne_de_la_table[$comparateur->getClef()]; + $une_ligne_de_la_table[$comparateur->getSelecteur()] = $comparateur->getValeurTrue(); + } else { + $une_ligne_de_la_table[$comparateur->getSelecteur()] = $comparateur->getValeurFalse(); + } + } + if ($multiplicateur != null) { + foreach ($multiplicateur as $bloc_de_break=>&$clef_de_break) { + if ($clef_de_break[0] != $une_ligne_de_la_table[$clef_de_break[1]]) { + + $go_clean = false; + foreach ($multiplicateur as $clean_key=>&$clean_value) { + if ($clean_key === $bloc_de_break) { + $go_clean = true; + continue; + } + if ($go_clean) { + $clean_value[0] = -1; + } + } + + $clef_de_break[0] = $une_ligne_de_la_table[$clef_de_break[1]]; + affectToBloc($template, $bloc_de_break, $une_ligne_de_la_table); + } + } + } + if ($toDoAtEnd != null) { + $toDoAtEnd($une_ligne_de_la_table); + } else { + affectToBloc($template, $bloc_name, $une_ligne_de_la_table); + } + } + return $retour===""?$first:$retour; +} + +function generateCompleteXHTML(Template &$template,$identificator_name,bool $without_echo=false) { + if ($without_echo) { + return $template->assign_display($identificator_name); + } else { + return $template->display($identificator_name); + } +} \ No newline at end of file diff --git a/bfmw/index.php b/bfmw/index.php new file mode 100644 index 0000000..d74b705 --- /dev/null +++ b/bfmw/index.php @@ -0,0 +1,17 @@ +" + contenu.replace(/\\/g, "") + "

"; + switch (complement) { + case "success" : + document.getElementById('modal_header').style.backgroundColor = "green"; + break; + case "info" : + document.getElementById('modal_header').style.backgroundColor = "blue"; + break; + case "warning" : + document.getElementById('modal_header').style.backgroundColor = "orange"; + break; + default : + document.getElementById('modal_header').style.backgroundColor = "red"; + break; + } + document.getElementById('myModal').style.display = "block"; +} + +function showMaster() { + document.getElementById("le_master").style.visibility = "visible"; + document.getElementById("detail").style.visibility = "collapse"; + document.getElementById("detail").style.display = "none"; +} + +function hideUpdater(){ + var updater = document.getElementById("bfmw_updater_simple"); + if (updater != null) { + updater.classList.add("hide"); + } + updater_visible = false; +} + +function showUpdater(event,field_name,field_value,field_value_where,modifier_id,binding_name,area=false,label=""){ + hideUpdater(); + var laboite = document.getElementById("bfmw_updater_simple"); + if (laboite != null) { + laboite.style.top = (event.clientY+(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+"px"; + laboite.style.left = (event.clientX+(document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft))+"px"; + laboite.classList.remove("hide"); + updater_visible = true; + document.getElementById("bfmw_update_field_label").innerText = label; + var element = !area?"bfmw_update_field_text":"bfmw_update_field_textarea" + document.getElementById(element).name = field_name; + document.getElementById(element).dataset.bfmw = field_value_where; + document.getElementById(element).dataset.bfmw2 = modifier_id; + document.getElementById(element).dataset.bfmw3 = binding_name; + document.getElementById(element).select(); + document.getElementById(element).classList.remove("force_hide"); + document.getElementById(area?"bfmw_update_field_text":"bfmw_update_field_textarea").classList.add("force_hide"); + if (!area) { + document.getElementById("bfmw_update_field_text").value = field_value; + } else { + document.getElementById("bfmw_update_field_textarea").innerText = field_value; + } + } + event.stopPropagation(); +} + +function active_blur_updater(element) { + if (element != null) { + element.onblur = function () { + var updater = this.dataset.bfmw2; + var value = this.value; + bind(this.dataset.bfmw3, this.value, this.dataset.bfmw, this, null, function () { + document.getElementById(updater).innerText = value; + }); + } + } + element = document.getElementById("bfmw_update_submit"); + if (element != null) { + hideUpdater(); + } +} + +function bind(type, valeur, where, obj, objColor, callback, callbackError = null) { + var xhttp; + if (window.XMLHttpRequest) { + xhttp = new XMLHttpRequest(); + } else { + xhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + + xhttp.open("POST", "index.php", true); + xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + if (obj.type === "checkbox") { + if (!obj.checked) { + valeur = '0'; + } + } + + if (typeof objColor === 'string') { + objColor = document.getElementById(objColor); + } + + xhttp.onreadystatechange = function () { + if (xhttp.readyState === 4) { + if (xhttp.status === 200) { + if (xhttp.responseText === "OK") { + if (objColor != null) { + objColor.style.backgroundColor = '#74DD71'; + } + if (callback != null) { + callback(); + } + } else { + if (objColor != null) { + objColor.style.backgroundColor = 'red'; + } + if (callbackError != null) { + callbackError(); + } + } + } else { + if (objColor != null) { + objColor.style.backgroundColor = 'red'; + } + if (callbackError != null) { + callbackError(); + } + } + } + }; + + xhttp.send("bind=doing&type=" + type + "&valeur=" + encodeURIComponent(valeur.trim()) + "&where=" + encodeURIComponent(where) + "&tag=" + encodeURIComponent(obj.name)); + +} + +function preparehide(element,affiche) { + if (affiche != null) { + if (affiche instanceof HTMLCollection) { + for (let i = 0; i < affiche.length; i++) { + affiche[i].classList.add("force_hide"); + } + } else { + affiche.classList.add("force_hide"); + } + + element.onclick = function (){ + if (this.classList.contains("plus")) { + this.classList.remove("plus"); + this.classList.add("moins"); + if (affiche instanceof HTMLCollection) { + for (let i = 0; i < affiche.length; i++) { + affiche[i].classList.remove("force_hide"); + } + } else { + affiche.classList.remove("force_hide"); + } + } else { + this.classList.add("plus"); + this.classList.remove("moins"); + if (affiche instanceof HTMLCollection) { + for (let i = 0; i < affiche.length; i++) { + affiche[i].classList.add("force_hide"); + } + } else { + affiche.classList.add("force_hide"); + } + } + } + } +} + +function autohide(element) { + element.classList.add("plus"); + element.classList.add("TreeViewCursor"); + var affiche = document.getElementById(element.dataset.bfmw); + preparehide(element,affiche); + if (affiche === null) { + affiche = document.getElementsByClassName(element.dataset.bfmw); + preparehide(element, affiche); + } +} + +function activateTreeView(oList,collapse = true) { + if (collapse) { + let LesElements = oList.getElementsByTagName("ul"); + for (let i = 0; i < LesElements.length; i++) { + LesElements[i].style.display = "none"; + } + } + + if (oList.addEventListener) { + oList.addEventListener("click", toggleBranch, false); + } + addLinksToBranches(oList); +} + +function toggleBranch(event) { + let oBranch, cSubBranches; + if (event.target) { + oBranch = event.target; + } else if (event.srcElement) { // For IE + oBranch = event.srcElement; + } + if (oBranch.tagName === "LI") { + oBranch.classList.remove("survol"); + cSubBranches = oBranch.getElementsByTagName("ul"); + if (cSubBranches.length > 0) { + if (cSubBranches[0].style.display === "block") { + cSubBranches[0].style.display = "none"; + oBranch.classList.add("survol"); + oBranch.classList.remove("moins"); + oBranch.classList.add("plus"); + } else { + cSubBranches[0].style.display = "block"; + oBranch.classList.add("moins"); + oBranch.classList.remove("plus"); + } + } + } +} + +function addLinksToBranches(oList) { + let cBranches = oList.getElementsByTagName("li"); + let i, n, cSubBranches; + if (cBranches.length > 0) { + for (i=0, n = cBranches.length; i < n; i++) { + cSubBranches = cBranches[i].getElementsByTagName("ul"); + if (cSubBranches.length > 0) { + addLinksToBranches(cSubBranches[0]); + cBranches[i].classList.add("TreeViewCursor"); + cBranches[i].classList.add("survol"); + cBranches[i].classList.add("plus"); + cSubBranches[0].style.cursor = "auto"; + } else { + cBranches[i].classList.add("rien"); + } + } + } +} + +function activateAutoHider(starteur) { + var lesElements = starteur.getElementsByClassName("bfmw_auto_hidder"); + for (var i = 0; i < lesElements.length; i++) { + autohide(lesElements[i]); + } +} + +function include(fileName){ + document.write("" ); +} + +function refresh(send) { + if (send !== "") { + window.location.replace("?" + send); + } else { + window.location.replace("?p=accueil"); + } +} + +function computeSizeMenuAndMaster(){ + var gap = document.getElementById("GeneralMenu").style.marginBottom; + var marginMenu = document.getElementById("GeneralMenu").clientHeight + gap; + if (document.getElementById("le_master") !== null) { + document.getElementById("le_master").style.top = (marginMenu).toString() + "px"; + document.getElementById("le_master").style.height = "calc(100% - "+(marginMenu).toString()+"px)"; + } + + var topFilter = document.getElementById("id_div_filter").clientHeight; + var lesElements = document.getElementsByClassName("master"); + for (var i = 0; i < lesElements.length; i++) { + lesElements[i].style.height = "calc(100% - "+(topFilter).toString()+"px)" + //lesElements[i].style.top = (marginMenu + topFilter).toString() + "px"; + } + + /* document.getElementById("id_margin_top").style.marginTop = (marginMenu).toString() + "px"; + var lesElements = document.getElementsByClassName("master"); + for (var i = 0; i < lesElements.length; i++) { + lesElements[i].style.height = "calc(100% - "+(marginMenu + topFilter).toString()+"px)" + lesElements[i].style.top = (marginMenu + topFilter).toString() + "px"; + } + if (document.getElementById("detail") != null) { + document.getElementById("detail").style.top = (marginMenu - gap).toString() + "px"; + document.getElementById("detail").style.height = "calc(100% - " + (marginMenu - gap).toString() + "px)"; + }*/ +} + +function toDoOnLoad(f) { + functionsToLoadOnLoad[functionsToLoadOnLoad.length] = f; +} + +//******************************** +//Inline +//******************************** +var functionsToLoadOnLoad = []; + +window.onload = function () { + for (var i = 0; i < functionsToLoadOnLoad.length; i++) { + try { + functionsToLoadOnLoad[i](); + } catch (e) { + + } + } +}; + +toDoOnLoad(function () { + var lesElements = document.getElementsByClassName("bfmw_refresh_dist"); + for (var i = 0; i < lesElements.length; i++) { + refresh(lesElements[i].dataset.bfmw); + } +}); + +toDoOnLoad(function () { + var lesElements = document.getElementsByClassName("show_master"); + for (var i = 0; i < lesElements.length; i++) { + lesElements[i].onclick = function () { + showMaster(); + }; + } +}); + +toDoOnLoad(function () { + var modal = document.getElementById('myModal'); + var updater = document.getElementById('bfmw_update_field_text'); + var updater_2 = document.getElementById('bfmw_update_field_textarea'); + var span = document.getElementsByClassName("close")[0]; + + span.onclick = function () { + modal.style.display = "none"; + }; + + window.onclick = function (event) { + if (event.target === modal) { + modal.style.display = "none"; + } + if (updater_visible && event.target !== updater && event.target !== updater_2) { + hideUpdater(); + event.stopPropagation(); + } + }; +}); + +toDoOnLoad(function () { + var lesElements = document.getElementsByClassName("show_message"); + for (var i = 0; i < lesElements.length; i++) { + showMessage(lesElements[i].dataset.complement, lesElements[i].dataset.titre, lesElements[i].dataset.message); + } +}); + +toDoOnLoad(function () { + computeSizeMenuAndMaster(); +}); + +toDoOnLoad(function () { + if (document.getElementById("id_margin_top") !== null) { + window.onresize = function () { + computeSizeMenuAndMaster(); + } + } +}); + +toDoOnLoad(function () { + try { + if (document.getElementById("tooold").dataset.bfmw === "tooold") { + return 0; + } + } catch (e) {} + document.location.replace("bfmw/tooold.php"); +}); + +toDoOnLoad(function () { + var lesElements = document.getElementsByClassName("TreeView"); + for (var i = 0; i < lesElements.length; i++) { + activateTreeView(lesElements[i]); + } +}); + +toDoOnLoad(function () { + activateAutoHider(document); +}); + +toDoOnLoad(function () { + var element = document.getElementById("bfmw_update_field_text"); + active_blur_updater(element); + element = document.getElementById("bfmw_update_field_textarea"); + active_blur_updater(element); +}); + + +toDoOnLoad(function () { + let lesElements = document.getElementsByClassName("bfmw_submit_ajax"); + for (let i = 0; i < lesElements.length; i++) { + lesElements[i].onsubmit = function() { + let formulaire = lesElements[i]; + let donnees = []; + for (let j=0;j + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/bfmw/language/global_fr.php b/bfmw/language/global_fr.php new file mode 100644 index 0000000..08b54a4 --- /dev/null +++ b/bfmw/language/global_fr.php @@ -0,0 +1,38 @@ + "A propos..." + ); +} + +function getLangueMenu() { + + return array( + "STC_WHOAMI" => "A propos..." + ); +} + +function getLangueAccueil() { + + return array( + "STC_WHOAMI" => "A propos..." + ); +} +?> diff --git a/bfmw/language/index.html b/bfmw/language/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/bfmw/language/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/bfmw/tooold.php b/bfmw/tooold.php new file mode 100644 index 0000000..fb45096 --- /dev/null +++ b/bfmw/tooold.php @@ -0,0 +1,24 @@ + + Order Allow,Deny + Deny from All + \ No newline at end of file diff --git a/common/Initialisation.php b/common/Initialisation.php new file mode 100644 index 0000000..1043d59 --- /dev/null +++ b/common/Initialisation.php @@ -0,0 +1,70 @@ + [ + 'method' => $method, + 'header' => 'Content-Type: application/json', // Remplacez si nécessaire + 'ignore_errors' => true, // Gérer les erreurs HTTP + ] + ]; + + if (!empty($queryParams)) { + $url .= '?' . http_build_query($queryParams); + } + + if (!empty($requestBody)) { + $options['http']['content'] = json_encode($requestBody); + } + + $context = stream_context_create($options); + + $response = file_get_contents($url, false, $context); + + $data = json_decode($response, true); + + $retour = []; + $retour = self::AllKeysToUppercase($data); + + return $retour; + } + + public static function AllKeysToUppercase(?array $data): array + { + $retour = []; + foreach ($data??[] as $cle => $valeur) { + $cleMajuscules = strtoupper($cle); + + if (is_array($valeur)) { + $retour[$cleMajuscules] = self::AllKeysToUppercase($valeur); + } else { + $retour[$cleMajuscules] = $valeur; + } + } + return $retour; + } +} + + diff --git a/css/index.html b/css/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/css/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/css/specific_accueil.css b/css/specific_accueil.css new file mode 100644 index 0000000..c82b42c --- /dev/null +++ b/css/specific_accueil.css @@ -0,0 +1,20 @@ +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + + +.specific_div_accueil_1{ + max-width: inherit; +} diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..78ff3d6 --- /dev/null +++ b/css/style.css @@ -0,0 +1,16 @@ +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + diff --git a/images/index.html b/images/index.html new file mode 100644 index 0000000..c6aa0d9 --- /dev/null +++ b/images/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/include.php b/include.php new file mode 100644 index 0000000..5bf7f48 --- /dev/null +++ b/include.php @@ -0,0 +1,2 @@ + + + + + + + + + diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..558024a --- /dev/null +++ b/js/main.js @@ -0,0 +1,32 @@ + +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + +//******************************** +//Functions +//******************************** + +//******************************** +//Inline +//******************************** +toDoOnLoad(function(){ + var lesElements = document.getElementsByClassName("texte_menu"); + for (var i = 0; i < lesElements.length; i++) { + lesElements[i].onclick = function () { + showResponsiveMenu(); + }; + } +}); diff --git a/js/specific_accueil.js b/js/specific_accueil.js new file mode 100644 index 0000000..b6cf46d --- /dev/null +++ b/js/specific_accueil.js @@ -0,0 +1,27 @@ +/* + * Auteur : Cédric BOUHOURS + * Ce code est mis à disposition selon les termes de la Licence Creative Commons Attribution + * Pas d'Utilisation Commerciale - Pas de Modification 4.0 International. + * + * Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence. Vous devez indiquer ces informations par tous les moyens raisonnables, sans toutefois suggérer que l'Offrant vous soutient ou soutient la façon dont vous avez utilisé son Oeuvre. + * + * Pas d’Utilisation Commerciale — Vous n'êtes pas autorisé à faire un usage commercial de cette Oeuvre, tout ou partie du matériel la composant. + * + * Pas de modifications — Dans le cas où vous effectuez un remix, que vous transformez, ou créez à partir du matériel composant l'Oeuvre originale, vous n'êtes pas autorisé à distribuer ou mettre à disposition l'Oeuvre modifiée. + * + * Pas de restrictions complémentaires — Vous n'êtes pas autorisé à appliquer des conditions légales ou des mesures techniques qui restreindraient légalement autrui à utiliser l'Oeuvre dans les conditions décrites par la licence. + * + * + */ + +/* +Fonctions + */ + + +/* +INLINE + */ +toDoOnLoad(function () { + +}); diff --git a/refresh.php b/refresh.php new file mode 100644 index 0000000..8709334 --- /dev/null +++ b/refresh.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/search.php b/search.php new file mode 100644 index 0000000..4074860 --- /dev/null +++ b/search.php @@ -0,0 +1,16 @@ + $_GET['query'], + "index" => 0, + "count" => 5 + )); + + echo $response; +} else { + echo "

Aucune requête valide.

"; +} \ No newline at end of file diff --git a/self_server_concrete.php b/self_server_concrete.php new file mode 100644 index 0000000..f08cbcb --- /dev/null +++ b/self_server_concrete.php @@ -0,0 +1,24 @@ +