alpha_full/admin/agencement/favIcon/favIcon.modale.php
2026-04-06 22:58:51 +02:00

231 lines
9.1 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// -----------------------------------------------------
// Etre admin
// -----------------------------------------------------
if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin']=='O' ) {
$theFavIcon='';
if (isset($_POST['theFavIcon'])) {$theFavIcon=$_POST['theFavIcon'];} // parcourir
if (isset($_GET['theImage'])) {$theImage=$_GET['theImage'];} // biblio
if (isset($_GET['src'])) {$src=$_GET['src']; } // choix iFrame
if ($codeOpe=="majFavIco" || $codeOpe=='majGallerie') {
$uploadOk=0;
// -----------------------------------------------------
// Check du upload image
// -----------------------------------------------------
if (!empty($_FILES["fileToUpload"]["tmp_name"])) {
$target_dir = "../Design/_favIcon/";
$targetExtension =['jpeg', 'jpg', 'png', 'ico', 'bmp', 'gif'];
$targetSize ='5242880'; //5 Mo
$largeurMax = 0;
$hauteurMax = 0;
$largeurMin = 0;
$hauteurMin = 0;
include ($includePathAdmin ."/_fonctions/uploadGenerique.php");
$theFavIcon=$theImage;
}
else if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug (1,['Pas de upload theFavIcon' => $theFavIcon ],'');}
// -----------------------------------------------------
// Req UPDATE
// -----------------------------------------------------
$theFavIcon=$theImage;
// si on n'a pas fait de upload et donc on doit recup extension
if (!empty($theFavIcon) && !isset($imageFileType) ) {
$imageFileType=substr($theFavIcon,-3);
}
// Debug
if (isset($debug[1]) && $debug[1] == '1' ) {
$debugMsg .= monDebug (1,[
'theImage' => $theImage,
'theFavIcon' => $theFavIcon,
'imageFileType' => $imageFileType
],'');
}
// -----------------------------------------------------
// Meta
// -----------------------------------------------------
switch ($imageFileType) {
case 'png':
$headMsg='<link rel="icon" type="image/png" href="' .$theFavIcon. '" />';
break;
case 'gif':
$headMsg='<link rel="icon" type="image/gif" href="' .$theFavIcon. '" />';
break;
case 'jpg':
$headMsg='<link rel="icon" type="image/jpg" href="' .$theFavIcon. '" />';
break;
case 'peg':
$headMsg='<link rel="icon" type="image/jpeg" href="' .$theFavIcon. '" />';
break;
case 'ico':
$headMsg='<link rel="shortcut icon" type="image/x-icon" href="' .$theFavIcon. '" />';
break;
default:
break;
}
$retour='';
// -----------------------------------------------------
// Ecriture du fichier favicon
// -----------------------------------------------------
$favFile='../Design/_favIcon/favIcon' .$_SESSION['lgCouranteCode']. '.php';
$retour=file_put_contents($favFile, $headMsg);
if ($retour!='') {$admMsg .= '<br>Le favicon a été mis à jour. '; $admMsgClass='ok';}
else {
$admMsg .= 'Erreur lors de la mise à jour du favicon.';
if (isset($debug[1]) && $debug[1] == '1' ) {
$debugMsg .= monDebug (1,['Retour' => $Retour,'favFile' => $favFile,'headMsg' => $headMsg,'imageFileType' => $imageFileType,'theFavIcon' => $theFavIcon
],'');
$admMsgClass='ko';
}
}
// -----------------------------------------------------
// Ecriture en bdd
// -----------------------------------------------------
include ("faviconReqUpdatePropager.php");
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Icône favori propagé à toutes les langues' => ''], '');}
}
else{
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['pas de maj favIcon' => ''], '');}
}
// -----------------------------------------------------
// Requete Select
// -----------------------------------------------------
include ("faviconReqSelect.php");
// -----------------------------------------------------
// Debug
// -----------------------------------------------------
if (isset($debug[1]) && $debug[1] == '1' ) {
$debugMsg .= monDebug (1,[
'thePopup' => $thePopup,
'theFavIcon' => $theFavIcon,
'theImage' => $theImage,
'theFaviconMsg' => $theFaviconMsg,
'lg' => $lg,
'modifLg' => $modifLg,
'lgCourante' => $_SESSION['lgCouranteCode'],
'codeOpe' => $codeOpe,
'trouveLG' =>$trouveLG,
'propager' => $propager,
'src' => $src
],'');
}
// -----------------------------------------------------
// Formulaire
// -----------------------------------------------------
echo '<form name="favIconModaleF" method="POST" enctype="multipart/form-data">';
// -----------------------------------------------------
// Zone Form
// -----------------------------------------------------
echo '<div id="zoneFormModales" >';
// -----------------------------------------------------
// Champs cachés
// -----------------------------------------------------
echo '<input type="hidden" name="codeOpe" id="codeOpe" value="' .$codeOpe. '" >';
echo '<input type="hidden" name="lg" id="lg" value="' .$lg. '" >';
// -----------------------------------------------------
// Langue drapeaux
// -----------------------------------------------------
echo '<span>';
include ($includePathAdmin. "/drapeaux/drapeauxAff.php");
echo '</span>';
// -----------------------------------------------------
// Icône
// -----------------------------------------------------
echo '<span class="libChampsWebmaster" >Icône : &#160;';
echo '<img style="max-width:75px;" src=".' .$theFavIcon. '" name="theFavIcon" valign="middle" />&#160;';
echo '<input style="display:none;" type="file" name="fileToUpload" id="fileToUpload" >';
echo '<input type="hidden" name="theFavIcon" id="theFavIcon" value="' .$theFavIcon. '" >';
echo '</span>';
echo '<br><span class="libChampsWebmaster">Chemin actuel : <span class="inputWebmaster" >' .$theFavIcon. '</span></span>';
// -----------------------------------------------------
// Gallerie
// -----------------------------------------------------
echo '<div style="display:block; width:100%; border:1px solid lightgrey; padding:0px; margin: auto;" >';
// Bouton parcourir
echo '<label for="fileToUpload"><span class="boutonsWebmaster" title="Cliquez ici pour parcourir les dossiers de votre ordinateur. " >';
echo '<i class="fad fa-download"></i>&#160;';
echo 'Parcourir...&#160;</span></label>';
// Images du site
echo '<span class="boutonsWebmaster" onClick="document.getElementById(\'iFr\').src =\'../Design/gallerie.php?scope=favIcon&siteDossier=' .$_SESSION['siteDossier']. '&server=' .$_SESSION['server']. '&src=Design&propager=' .$propager. '\';">🖼️ Images du site</span>';
// Bibliothèque
echo '<span class="boutonsWebmaster" onClick="document.getElementById(\'iFr\').src =\'/include/biblio/gallerie.php?scope=favIcon&siteDossier=' .$_SESSION['siteDossier']. '&server=' .$_SESSION['server']. '&src=Biblio&propager=' .$propager. '\';">📚 Bibliothèque</span>';
if (isset( $src)) {
switch ($src) {
case 'Design':
$src='../Design/gallerie.php?scope=favIcon&siteDossier=' .$_SESSION['siteDossier']. '&server=' .$_SESSION['server']. '&src=Design&propager=' .$propager;
break;
case 'Biblio':
default:
$src='/include/biblio/gallerie.php?scope=favIcon&siteDossier=' .$_SESSION['siteDossier']. '&server=' .$_SESSION['server']. '&src=Biblio&propager=' .$propager;
break;
}
echo '<iframe id="iFr" class="catalogIframe" src="' .$src. '" >';
echo '</iframe>';
}
echo '</div>';
echo '</div>';
// Zone validate
echo '<div id="zoneValidateModales" style="height:auto;" >';
// -----------------------------------------------------
// Bouton Valider
// -----------------------------------------------------
echo '<div class="boutonsWebmaster" onClick="majFavIco();" >';
echo '<i class="fad fa-check-circle"></i>&#160;';
echo 'Valider pour toutes les langues';
echo '</div>';
// -----------------------------------------------------
// Bouton Fin
// -----------------------------------------------------
echo '<div class="boutonsWebmaster" onClick="window.location=\'./frmAdmin.php?affAdmin=2&lg=FRA\'" target="_parent" >';
echo '<i class="fad fa-chevron-circle-left"></i>&#160;';
echo 'Retour à l\'agencement';
echo '</div>';
// -----------------------------------------------------
// Lien vers ico en ligne
// -----------------------------------------------------
echo ' <br><br>
<span class="actionMessages">Quelques pistes pour créer des icônes favoris : <br>
- <a target="_blank" href="https://www.favikon.com/">favikon.com</a><br>
- <a target="_blank" href="https://www.favicon.cc/">favicon.cc</a></span>
';
echo '</div>'; //zone validate
echo '</form>';
}
else {
$confPath="../_conf";
include ("./adminInclude/redirectionAdmin.php");
}
?>