414 lines
16 KiB
PHP
Executable File
414 lines
16 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
$trouve=false;
|
|
|
|
if (!empty($_POST['nomThemeCss'])) {
|
|
$nomThemeCss=$_POST['nomThemeCss'];
|
|
$_SESSION['nomThemeCss']=$nomThemeCss;
|
|
}
|
|
else {
|
|
if (isset($_SESSION['nomThemeCss']) && !empty($_SESSION['nomThemeCss']))
|
|
{$nomThemeCss=$_SESSION['nomThemeCss'];}
|
|
}
|
|
|
|
$reqUpdate="UPDATE " .$nomThemeCss. " SET ";
|
|
if ($textDecorationCss!='') {$reqUpdate=$reqUpdate. " `text-decoration`='" .$textDecorationCss. "', ";}
|
|
if ($textAlignCss!='') {$reqUpdate=$reqUpdate. "`text-align`='" .$textAlignCss. "', ";}
|
|
if ($fontCss!='') {$reqUpdate=$reqUpdate. "`font-family`='" .$fontCss. "', ";}
|
|
if ($fontStyleCss!='') {$reqUpdate=$reqUpdate. "`font-style`='" .$fontStyleCss. "', ";}
|
|
if ($fontSizeCss!='') {$reqUpdate=$reqUpdate. "`font-size`='" .$fontSizeCss. "', ";}
|
|
if ($couleurTexteCss!='') {$reqUpdate=$reqUpdate. "`color`='" .$couleurTexteCss. "', ";$reqUpdate=$reqUpdate. "`fill`='" .$couleurTexteCss. "', ";}
|
|
if ($fontWeightCss!='') {$reqUpdate=$reqUpdate. "`font-weight`='" .$fontWeightCss. "', ";}
|
|
//if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqUpdate' => $reqUpdate], 'css.reqUpdateStyles.php');}
|
|
|
|
// -----------------------------------------------------
|
|
// Largeur
|
|
// -----------------------------------------------------
|
|
if ($widthCss!='') {
|
|
$widthCss=calcUnite($widthCss,$widthUnite);
|
|
$reqUpdate=$reqUpdate. "`width`='" .$widthCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Largeur max
|
|
// -----------------------------------------------------
|
|
if ($maxWidthCss!='') {
|
|
$maxWidthCss=calcUnite($maxWidthCss,$maxWidthUnite);
|
|
$reqUpdate=$reqUpdate. "`max-width`='" .$maxWidthCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Largeur min
|
|
// -----------------------------------------------------
|
|
if ($minWidthCss!='') {
|
|
$minWidthCss=calcUnite($minWidthCss,$minWidthUnite);
|
|
$reqUpdate=$reqUpdate. "`min-width`='" .$minWidthCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Hauteur :
|
|
// -----------------------------------------------------
|
|
if ($heightCss!='') {
|
|
$heightCss=calcUnite($heightCss,$heightUnite);
|
|
$reqUpdate=$reqUpdate. "`height`='" .$heightCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Hauteur max
|
|
// -----------------------------------------------------
|
|
if ($maxHeightCss!='') {
|
|
$maxHeightCss=calcUnite($maxHeightCss,$maxHeightUnite);
|
|
$reqUpdate=$reqUpdate. "`max-height`='" .$maxHeightCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Hauteur max
|
|
// -----------------------------------------------------
|
|
if ($minHeightCss!='') {
|
|
$minHeightCss=calcUnite($minHeightCss,$minHeightUnite);
|
|
$reqUpdate=$reqUpdate. "`min-height`='" .$minHeightCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Background
|
|
// -----------------------------------------------------
|
|
if ($backGroundCss!='')
|
|
{$reqUpdate=$reqUpdate. "`background`='" .$backGroundCss. "', ";}
|
|
|
|
if ($verticalAlignCss!='') {$reqUpdate=$reqUpdate. "`vertical-align`='" .$verticalAlignCss. "', ";}
|
|
|
|
// -----------------------------------------------------
|
|
// Marges
|
|
// -----------------------------------------------------
|
|
if ($marginTopCss!='') {
|
|
$marginTopCss=calcUnite($marginTopCss,$topMarginUnite);
|
|
$reqUpdate=$reqUpdate. "`margin-top`='" .$marginTopCss. "', ";
|
|
}
|
|
|
|
if ($marginRightCss!='') {
|
|
$marginRightCss=calcUnite($marginRightCss,$rightMarginUnite);
|
|
$reqUpdate=$reqUpdate. "`margin-right`='" .$marginRightCss. "', ";
|
|
}
|
|
|
|
if ($marginBottomCss!='') {
|
|
$marginBottomCss=calcUnite($marginBottomCss,$bottomtMarginUnite);
|
|
$reqUpdate=$reqUpdate. "`margin-bottom`='" .$marginBottomCss. "', ";
|
|
}
|
|
|
|
if ($marginLeftCss!='') {
|
|
$marginLeftCss=calcUnite($marginLeftCss,$leftMarginUnite);
|
|
$reqUpdate=$reqUpdate. "`margin-left`='" .$marginLeftCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Position
|
|
// -----------------------------------------------------
|
|
if ($positionCss!='') {$reqUpdate=$reqUpdate. "`position`='" .$positionCss. "', ";}
|
|
if ($displayCss!='') {$reqUpdate=$reqUpdate. "`display`='" .$displayCss. "', ";}
|
|
|
|
if ($leftCss!='') {
|
|
$leftCss=calcUnite($leftCss,$leftUnite);
|
|
$reqUpdate=$reqUpdate. "`theLeft`='" .$leftCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Position haut
|
|
// -----------------------------------------------------
|
|
if ($topCss!='') {
|
|
$topCss=calcUnite($topCss,$topUnite);
|
|
$reqUpdate=$reqUpdate. "`top`='" .$topCss. "', ";
|
|
}
|
|
//if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqUpdate' => $reqUpdate], 'css.reqUpdateStyles.php');}
|
|
// -----------------------------------------------------
|
|
// Position bas
|
|
// -----------------------------------------------------
|
|
if ($bottomCss!='') {
|
|
$bottomCss=calcUnite($bottomCss,$bottomUnite);
|
|
$reqUpdate=$reqUpdate. "`bottom`='" .$bottomCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Position droite
|
|
// -----------------------------------------------------
|
|
if ($rightCss!='') {
|
|
$rightCss=calcUnite($rightCss,$rightUnite);
|
|
$reqUpdate=$reqUpdate. "`theRight`='" .$rightCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Hauteur de ligne
|
|
// -----------------------------------------------------
|
|
if ($lineHeightCSS!='') {
|
|
$lineHeightCSS=calcUnite($lineHeightCSS,$lineHeightUnite);
|
|
$reqUpdate=$reqUpdate. "`line-height`='" .$lineHeightCSS. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Bordures
|
|
// -----------------------------------------------------
|
|
if ($bordCss!='') {$reqUpdate=$reqUpdate. "`border-width`='" .$bordCss. "', ";}
|
|
if ($bordStyleCss!='') {$reqUpdate=$reqUpdate. "`border-style`='" .$bordStyleCss. "', ";}
|
|
if ($borderColorCss!='') {$reqUpdate=$reqUpdate. "`border-color`='" .$borderColorCss. "', ";}
|
|
if ($borderRadiusCss!='') {$reqUpdate=$reqUpdate. "`border-radius`='" .$borderRadiusCss. "', ";}
|
|
|
|
if ($borderTopCss!='') {$reqUpdate=$reqUpdate. "`border-top`='" .$borderTopCss. "', ";}
|
|
if ($borderRightCss!='') {$reqUpdate=$reqUpdate. "`border-right`='" .$borderRightCss. "', ";}
|
|
if ($borderBottomCss!='') {$reqUpdate=$reqUpdate. "`border-bottom`='" .$borderBottomCss. "', ";}
|
|
if ($borderLeftCss!='') {$reqUpdate=$reqUpdate. "`border-left`='" .$borderLeftCss. "', ";}
|
|
|
|
if ($borderTopLeftCss!='') {$reqUpdate=$reqUpdate. "`border-top-left-radius`='" .$borderTopLeftCss. "', ";}
|
|
if ($borderTopRightCss!='') {$reqUpdate=$reqUpdate. "`border-top-right-radius`='" .$borderTopRightCss. "', ";}
|
|
if ($borderBottomLeftCss!='') {$reqUpdate=$reqUpdate. "`border-bottom-left-radius`='" .$borderBottomLeftCss. "', ";}
|
|
if ($borderBottomRightCss!='') {$reqUpdate=$reqUpdate. "`border-bottom-right-radius`='" .$borderBottomRightCss. "', ";}
|
|
|
|
// -----------------------------------------------------
|
|
// Padding
|
|
// -----------------------------------------------------
|
|
if ($paddingTopCss!='') {
|
|
$paddingTopCss=calcUnite($paddingTopCss,$topPaddingUnite);
|
|
$reqUpdate=$reqUpdate. "`padding-top`='" .$paddingTopCss. "', ";
|
|
}
|
|
|
|
if ($paddingRightCss!='') {
|
|
$paddingRightCss=calcUnite($paddingRightCss,$rightPaddingUnite);
|
|
$reqUpdate=$reqUpdate. "`padding-right`='" .$paddingRightCss. "', ";
|
|
}
|
|
|
|
if ($paddingBottomCss!='') {
|
|
$paddingBottomCss=calcUnite($paddingBottomCss,$bottomPaddingUnite);
|
|
$reqUpdate=$reqUpdate. "`padding-bottom`='" .$paddingBottomCss. "', ";
|
|
}
|
|
|
|
if ($paddingLeftCss!='') {
|
|
$paddingLeftCss=calcUnite($paddingLeftCss,$leftPaddingUnite);
|
|
$reqUpdate=$reqUpdate. "`padding-left`='" .$paddingLeftCss. "', ";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Float
|
|
// -----------------------------------------------------
|
|
if ($floatCss!='') {$reqUpdate=$reqUpdate. "`theFloat`='" .$floatCss. "', ";}
|
|
|
|
// edt champs overflow a implémenter plus tard en base
|
|
if ($resizeCss!='' && $resize!="none" && $resize!="-")
|
|
{$reqUpdate=$reqUpdate. "`resize`='" .$resizeCss. "', "; $reqUpdate=$reqUpdate. "`overflow`='auto', ";}
|
|
else
|
|
{
|
|
if ($resizeCss!='') {$reqUpdate=$reqUpdate. "`resize`='" .$resizeCss. "', ";}
|
|
}
|
|
// -----------------------------------------------------
|
|
// Animations
|
|
// -----------------------------------------------------
|
|
if ($transformCss!='') {$reqUpdate=$reqUpdate. "`transform`='" .$transformCss. "', ";}
|
|
if ($transitionCss!='') {$reqUpdate=$reqUpdate. "`transition`='" .$transitionCss. "', ";}
|
|
if ($animationCss!='') {$reqUpdate=$reqUpdate. "`animation`='" .$animationCss. "', ";}
|
|
if ($textTransformCss!='') {$reqUpdate=$reqUpdate. "`text-transform`='" .$textTransformCss. "', ";}
|
|
if ($textShadowCss!='') {$reqUpdate=$reqUpdate. "`text-shadow`='" .$textShadowCss. "', ";}
|
|
|
|
// if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqUpdate' => $reqUpdate], '');}
|
|
// -----------------------------------------------------
|
|
// Ombre
|
|
// -----------------------------------------------------
|
|
if ($boxShadowCss!='') {$reqUpdate=$reqUpdate. "`box-shadow`='" .$boxShadowCss. "', ";}
|
|
|
|
// -----------------------------------------------------
|
|
// Depassement
|
|
// -----------------------------------------------------
|
|
if ($overflowCss!='') {$reqUpdate=$reqUpdate. "`overflow`='" .$overflowCss. "', ";}
|
|
|
|
// -----------------------------------------------------
|
|
// Puces
|
|
// -----------------------------------------------------
|
|
if (!empty($listStyleCss)) {$reqUpdate=$reqUpdate. "`list-style-type`='" .$listStyleCss. "', ";}
|
|
|
|
if (!empty($clearCss)) {$reqUpdate=$reqUpdate. "`clear`='" .$clearCss. "', ";}
|
|
|
|
if (!empty($opacityCss)) {$reqUpdate=$reqUpdate. "`opacity`='" .$opacityCss. "', ";}
|
|
|
|
if (!empty($visibilityCss)) {$reqUpdate=$reqUpdate. "`visibility`='" .$visibilityCss. "', ";}
|
|
|
|
if (!empty($whiteSpaceCss)) {$reqUpdate=$reqUpdate. "`white-space`='" .$whiteSpaceCss. "', ";}
|
|
|
|
if (!empty($zIndexeCss)) {$reqUpdate=$reqUpdate. "`z-index`='" .$zIndexeCss. "', ";}
|
|
|
|
if (!empty($KframeCss)) {$reqUpdate=$reqUpdate. "`@keyframes`='" .$KframeCss. "', ";}
|
|
|
|
if (!empty($theCursor)) {$reqUpdate=$reqUpdate. "`theCursor`='" .$theCursor. "', ";}
|
|
|
|
if (!empty($bgImageCss)) {$reqUpdate=$reqUpdate. "`background-image:url`='" .$bgImageCss. "', ";}
|
|
|
|
if (!empty($bgRepeatCss)) {$reqUpdate=$reqUpdate. "`background-repeat`='" .$bgRepeatCss. "', ";}
|
|
|
|
if (!empty($bgSizeCss)) {$reqUpdate=$reqUpdate. "`background-size`='" .$bgSizeCss. "', ";}
|
|
|
|
if (!empty($flexDirectionCss)) {$reqUpdate=$reqUpdate. "`flex-direction`='" .$flexDirectionCss. "', ";}
|
|
|
|
if (!empty($flexBasisCss)) {
|
|
$trouveUnit=false;
|
|
switch (substr($flexBasisCss,-2)) {
|
|
case 'px':
|
|
$flexBasisCss=substr($flexBasisCss,0,-2) .$cssFlexBasisUnite;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
case 'em':
|
|
$flexBasisCss=substr($flexBasisCss,0,-2) .$cssFlexBasisUnite;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
if (substr($flexBasisCss,-1)=='%') {
|
|
$test=strlen($flexBasisCss)-1;
|
|
$flexBasisCss=substr($flexBasisCss,0,-1) .$cssFlexBasisUnite;
|
|
$trouveUnit=true;
|
|
}
|
|
|
|
if ($trouveUnit===false) {
|
|
if ($cssFlexBasisUnite!='-' && $flexBasisCss!='-' && $flexBasisCss!='') {$flexBasisCss=$flexBasisCss .$cssFlexBasisUnite; }
|
|
}
|
|
}
|
|
|
|
if ($flexBasisCss!='') {$reqUpdate=$reqUpdate. "`flex-basis`='" .$flexBasisCss. "', ";}
|
|
if ($flexWrapCss!='') {$reqUpdate=$reqUpdate. "`flex-wrap`='" .$flexWrapCss. "', ";}
|
|
|
|
// align-content vaut pour flex et grid meme s'il s'appelmle flexAlignContentCss
|
|
if ($flexAlignContentCss!='')
|
|
{$reqUpdate=$reqUpdate. "`align-content`='" .$flexAlignContentCss. "', ";}
|
|
if ($justifyContentCss!='') {$reqUpdate=$reqUpdate. "`justify-content`='" .$justifyContentCss. "', ";}
|
|
if ($alignItemsCss!='') {$reqUpdate=$reqUpdate. "`align-items`='" .$alignItemsCss. "', ";}
|
|
if ($justifyItemsCss!='') {$reqUpdate=$reqUpdate. "`justify-items`='" .$justifyItemsCss. "', ";}
|
|
|
|
if ($commentCss!='') {
|
|
if (!empty($commentCss)) $commentCss = addslashes($commentCss);
|
|
$commentCss=htmlspecialchars($commentCss, ENT_QUOTES,"UTF-8",false);
|
|
$reqUpdate=$reqUpdate. "`commentaires`='" .$commentCss. "', ";
|
|
}
|
|
|
|
if ($gridTemplateColumnsCss!='') {$reqUpdate=$reqUpdate. "`grid-template-columns`='" .$gridTemplateColumnsCss. "', ";}
|
|
if ($gridTemplateRowsCss!='') {$reqUpdate=$reqUpdate. "`grid-template-rows`='" .$gridTemplateRowsCss. "', ";}
|
|
if ($gridColumnGapCss!='') {$reqUpdate=$reqUpdate. "`grid-column-gap`='" .$gridColumnGapCss. "', ";}
|
|
if ($gridRowGappCss!='') {$reqUpdate=$reqUpdate. "`grid-row-gap`='" .$gridRowGappCss. "', ";}
|
|
if ($gridGappCss!='') {$reqUpdate=$reqUpdate. "`grid-gap`='" .$gridGappCss. "', ";}
|
|
|
|
if ($gridColumnCss!='') {
|
|
$reqUpdate=$reqUpdate. "`grid-column`='" .$gridColumnCss. "', ";
|
|
}
|
|
if ($gridRowCss!='') {$reqUpdate=$reqUpdate. "`grid-row`='" .$gridRowCss. "', ";}
|
|
if ($gridTemplateAreaCss!='') {$reqUpdate=$reqUpdate. "`grid-template-areas`='" .$gridTemplateAreaCss. "', ";}
|
|
if ($gridAreaCss!='') {$reqUpdate=$reqUpdate. "`grid-area`='" .$gridAreaCss. "', ";}
|
|
|
|
// -----------------------------------------------------
|
|
// Etre sur d'avoir le bon nom css cad reprendre le # si besoin
|
|
// -----------------------------------------------------
|
|
$reqSelect="SELECT nom FROM `" .$nomThemeCss. "` WHERE nom ='#" .$nomCss. "';";
|
|
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqSelect' => $reqSelect], 'css.reqUpdateStyles.php');}
|
|
$result='';
|
|
$resConn='';
|
|
$resConn=$idPdo->query($reqSelect) ;
|
|
if ($resConn) {
|
|
$result=$resConn->fetch(PDO::FETCH_BOTH);
|
|
if (!empty($result['nom'])) $nomCss=$result['nom'];
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['nomCss' => $nomCss], '');}
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Moche mais pour le moment comme ca ( non pas sur upadate ne marche pas )
|
|
// -----------------------------------------------------
|
|
if($nomCss=="icones") {
|
|
// $nomCss=".icones, .fas, .fad, .far, .fab, .fal";
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Requete
|
|
// -----------------------------------------------------
|
|
// la derniere sequence à tjrs une virgule et espace, on l'enleve
|
|
// -----------------------------------------------------
|
|
$rest = strlen($reqUpdate)-2;
|
|
$reqUpdate=substr($reqUpdate,0,$rest);
|
|
$reqUpdate .= " WHERE nom='" .$nomCss. "';";
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqUpdate' => $reqUpdate], 'css.reqUpdateStyles.php');}
|
|
|
|
$resConn='';
|
|
$resConn=$idPdo->query($reqUpdate);
|
|
if ($resConn)
|
|
{$resUpdate="Ok!"; }
|
|
else
|
|
{$resUpdate="Ko!";}
|
|
|
|
// -----------------------------------------------------
|
|
// Fonction : la premiere fois pas d'unité on la rajoute. Ensuite si unité on la change, sinon rien
|
|
// -----------------------------------------------------
|
|
function calcUnite($item, $unit) {
|
|
$trouveUnit=false;
|
|
|
|
global $admMsg;
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Fonction calcUnite item' => $item, ' unit' => $unit], '');}
|
|
|
|
if (substr($item,-4)=='auto') {
|
|
$item=substr($item,0,-4) .$unit;
|
|
$trouveUnit=true;
|
|
}
|
|
|
|
if ($trouveUnit==false) {
|
|
if ($unit=='auto') {
|
|
$item=$unit;
|
|
$trouveUnit=true;
|
|
}
|
|
}
|
|
|
|
if ($trouveUnit==false) {
|
|
if (substr($item,-3)=='rem') {
|
|
$item=substr($item,0,-3) .$unit;
|
|
$trouveUnit=true;
|
|
}
|
|
}
|
|
|
|
if ($trouveUnit==false) {
|
|
switch (substr($item,-2)) {
|
|
case 'px':
|
|
$item=substr($item,0,-2) .$unit;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
case 'em':
|
|
$item=substr($item,0,-2) .$unit;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
case 'fr':
|
|
$item=substr($item,0,-2) .$unit;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
case 'vw':
|
|
$item=substr($item,0,-2) .$unit;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
case 'vh':
|
|
$item=substr($item,0,-2) .$unit;
|
|
$trouveUnit=true;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($trouveUnit==false) {
|
|
if (substr($item,-1)=='%') {
|
|
$item=substr($item,0,-1) .$unit;
|
|
$trouveUnit=true;
|
|
}
|
|
}
|
|
|
|
if ($trouveUnit==false) {
|
|
if ($item!='-' && $item!='' && $unit!="-" && $unit!="") {$item=$item .$unit;}
|
|
}
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Fonction calcUnite 2 item' => $item, ' Unit' => $unit], '');}
|
|
return $item;
|
|
}
|
|
?>
|