0byt3m1n1
Path:
/
home
/
k
/
a
/
s
/
kassiope
/
www
/
administrer
/
[
Home
]
File: static.php
<? include("../configuration.inc.php"); necessite_identification(); necessite_priv("admin"); //ini_set('display_errors',1); $DOC_TITLE = "Gérer les contenus"; include("modeles/haut.php"); //ini_set('display_errors',1); $start = vn($_REQUEST['start']);// Détermine la variable start (début de contenu) switch (vb($_REQUEST['mode'])) { case "ajout" : affiche_formulaire_ajout_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; case "modif" : affiche_formulaire_modif_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; case "positionner" : if (isset($_POST['id'])) { for($i=0;$i<count($_POST['id']);$i++) { mysql_query_override("UPDATE gaia_static SET position = '".$i."' WHERE id = '".intval($_POST['id'][$i])."'"); } } echo '<div class="alert alert-success">Le positionnement des contenus a été effectué.</div>'; affiche_formulaire_liste_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; case "suppr" : supprime_static(vn($_REQUEST['id']), $_REQUEST['rub']); affiche_formulaire_liste_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; case "insere" : insere_sous_static(vn($_REQUEST['id']), $_POST); affiche_formulaire_liste_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; case "maj" : maj_static(vn($_REQUEST['id']),$_POST); if(substr($_REQUEST['rub'],0,5)=='page_') affiche_formulaire_modif_static(vn($_REQUEST['id']), $_REQUEST['rub']); else affiche_formulaire_liste_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; case "addfile" : if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {$id = $_REQUEST['id'] ; maj_static($_REQUEST['id'], $_POST); } else $id = insere_sous_static(vn($_REQUEST['id']), $_POST); if (!empty($_FILES[$_REQUEST['img']]['name'])) { if(in_array($_REQUEST['rub'], $static_options['exclude_jcrop']) || in_array(substr($_REQUEST['rub'],0,4), $static_options['exclude_jcrop'])) $img = move_upload_pict($_FILES[$_REQUEST['img']], ''); else { $img = upload_pict_($_FILES[$_REQUEST['img']], 2000, 2000); echo '<div class="alert alert-danger">ATTENTION ! Vous n\'avez pas encore recadré votre photo. Celle-ci n\'apparaitra pas sur le site.</div>'; } $id = f_add_pict($id, $img, $_REQUEST['img']); } affiche_formulaire_modif_static($id, $_REQUEST['rub']); break; case "majfile" : f_modif_pict($_POST, $_REQUEST['img']); echo '<div class="alert alert-success">Votre image a bien été importée et retaillée.</div>'; if(substr($_REQUEST['rub'],0,5)=='page_') affiche_formulaire_modif_static(vn($_REQUEST['id']), $_REQUEST['rub']); else affiche_formulaire_liste_static($_REQUEST['id'], $_REQUEST['rub']); break; case "addvideo" : if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {$id = $_REQUEST['id'] ; maj_static($_REQUEST['id'], $_POST); } else $id = insere_sous_static(vn($_REQUEST['id']), $_POST); if (!empty($_FILES['video']['name'])) { $video = move_upload_pict($_FILES['video']); $id = f_add_video($id, $video, 'video'); } affiche_formulaire_modif_static($id, $_REQUEST['rub']); break; case "supprfile" : supprime_fichier(vn($_REQUEST['id']), $_GET['file']); affiche_formulaire_modif_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; default : affiche_formulaire_liste_static(vn($_REQUEST['id']), $_REQUEST['rub']); break; } include("modeles/bas.php"); /****************************************************************************** * FONCTIONS *****************************************************************************/ function f_add_pict($f_id, $name, $img ) { if ($f_id==0) $query = "insert into gaia_static (".$img.") values ('".$name."')"; else $query = "UPDATE gaia_static SET ".$img." = '".$name."' where id='".$f_id."'"; mysql_query_override($query); if($f_id==0) $f_id = mysql_insert_id_override(); return $f_id; } function f_add_video($f_id, $name, $video ) { if ($f_id==0) $query = "insert into gaia_static (".$video.") values ('".$name."')"; else $query = "UPDATE gaia_static SET ".$video." = '".$name."' where id='".$f_id."'"; mysql_query_override($query); if($f_id==0) $f_id = mysql_insert_id_override(); return $f_id; } function f_modif_pict($f_post, $img) { global $dirroot, $prodminwidth, $prodminheight; extract($f_post); $query = "SELECT ".$img." FROM gaia_static where id='".$id."'"; $rec = mysql_query_override($query); $img_file = mysql_result_override($rec,0,$img); $ext = pathinfo($img_file, PATHINFO_EXTENSION); $imgfile = $dirroot.'/upload/zoom_'.$img_file; $dest_small = $dirroot.'/upload/'.$img_file; $dest_small_webp = $dirroot.'/upload/'.str_replace($ext,'webp',$img_file); $origimg = imagecreatefromjpeg($imgfile); if(!$origimg) $origimg = imagecreatefrompng($imgfile); $cropimg = imagecreatetruecolor($_POST['wi'.$img],$_POST['he'.$img]); list($widtha, $heighta) = getimagesize($imgfile); imagecopyresampled($cropimg, $origimg, 0, 0, $_POST['x1'.$img], $_POST['y1'.$img], $_POST['wi'.$img], $_POST['he'.$img], $_POST['w'.$img], $_POST['h'.$img]); imagejpeg($cropimg, $dest_small, 100); imagewebp($cropimg, $dest_small_webp, 100); /* list($widtha, $heighta) = getimagesize($imgfile); imagecopyresized($cropimg, $origimg, 0, 0, $_POST['x1'.$img], $_POST['y1'.$img], $widtha, $heighta, $widtha, $heighta); imagejpeg($cropimg, $dest_small, 99); $thumb = imagecreatetruecolor($_POST['wi'.$img], $_POST['he'.$img]); $source = imagecreatefromjpeg($dest_small); imagecopyresized($thumb, $source, 0, 0, 0, 0, $_POST['wi'.$img], $_POST['he'.$img], $_POST['w'.$img], $_POST['h'.$img]); imagejpeg($thumb, $dest_small, 99); */ if(file_exists($dest_small)) { $query = "UPDATE gaia_static SET ".$img." = '".$img_file."' where id ='".$id."'"; mysql_query_override($query); unlink($imgfile); } //genere_min($img_file, $prodminwidth, $prodminheight); } function affiche_formulaire_ajout_static($id, $rub='') { global $rubrique_options, $frm; /* Affiche un formulaire de rubrique vide */ /* Valeurs par défaut */ $frm["nouveau_mode"] = "insere"; foreach ($_SESSION['lng'] as $lng) { $frm['nom_'.$lng.''] = ""; //$frm['descriptif_'.$lng.''] = ""; $frm['description_'.$lng.''] = ""; } $frm['rub'] = $rub; $frm['etat'] = ""; $frm['on_special'] = ""; $frm["titre_soumet"] = "Ajouter un contenu"; /* Affiche la liste des rubriques, en présélectionnant la rubrique choisie. */ affiche_formulaire_static(); } function affiche_formulaire_modif_static($id,$rub='') { /* Affiche le formulaire de modification de rubrique. */ global $frm, $rubrique_options; /* Charge les infos de la rubrique. */ $qid = mysql_query_override("SELECT * FROM gaia_static WHERE id = '$id'"); $frm = mysql_fetch_array_override($qid); $frm["rub"] = $rub; $frm["nouveau_mode"] = "maj"; $frm["titre_soumet"] = "Sauvegarder changements"; /* Affiche la liste des rubriques, en présélectionnant la rubrique choisie. */ affiche_formulaire_static(); } function supprime_static($id) { /* Supprime la rubrique spécifiée par ve($_REQUEST['id']), et déplace tous les produits sous * cette rubrique au parent immédiat. */ supprime_fichier($id,$rub=''); /* Trouve le parent de cette rubrique */ $qid = mysql_query_override(" SELECT * FROM gaia_static WHERE id = '$id' "); if ($qid) { mysql_query_override("DELETE FROM gaia_static WHERE id = '$id'"); } echo '<div class="alert alert-error">Le contenu a été effacé <button type="button" class="close" data-dismiss="alert">×</button></div>'; } function insere_sous_static($id, $frm) { /* Ajoute une nouvelle sous-rubrique sous le parent ve($_REQUEST['id']). Tous les champs sont stockés dans la variable $frm */ valide($frm['on_special']); valide($frm['etat']); //if (!empty($frm['nom_'.$_SESSION['langue'].''])) { $sql = ""; $sql .= "INSERT INTO gaia_static (etat, on_special, on_menu, rub, parent_id, icon, taille_bloc, type_bloc, link, position_titre, googlefont1, googlefont2, video"; foreach ($_SESSION['lng'] as $lng) { $sql .= ", nom_".$lng.", description_".$lng.", surtitre_".$lng.", link_".$lng.", meta_titre_".$lng.", meta_desc_".$lng.""; //, descriptif_".$lng.""; } $sql .= ") VALUES ('".$frm['etat']."', '".$frm['on_special']."', '".$frm['on_menu']."', '".$frm['rub']."', '".$frm['parent_id']."', '".$frm['icon']."', '".$frm['taille_bloc']."', '".$frm['type_bloc']."', '".addslashes($frm['link'])."', '".$frm['position_titre']."', '".addslashes($frm['googlefont1'])."', '".addslashes($frm['googlefont2'])."', '".addslashes($frm['video'])."'"; foreach ($_SESSION['lng'] as $lng) { $sql .= ", '".addslashes($frm['nom_'.$lng.''])."', '".addslashes($frm['description_'.$lng.''])."', '".addslashes($frm['surtitre_'.$lng.''])."', '".addslashes($frm['link_'.$lng.''])."' , '".addslashes($frm['meta_titre_'.$lng.''])."', '".addslashes($frm['meta_desc_'.$lng.''])."'"; //, '".addslashes($frm['descriptif_'.$lng.''])."'"; } $sql .= ")"; mysql_query_override($sql); $staticId = mysql_insert_id_override(); /* ajoute les références associées */ for ($i = 0; $i < count(vn($frm['prods'])); $i++) { if (!empty($frm['prods'][$i])) { $qid = mysql_query_override(" INSERT INTO gaia_static_produits (produit_id, static_id) VALUES ('{$frm['prods'][$i]}', '$staticId') "); } } echo '<div class="alert alert-success">Le contenu a été ajouté <button type="button" class="close" data-dismiss="alert">×</button></div>'; /* } else { echo '<div class="alert alert-error">Vous devez insérer un titre de page <button type="button" class="close" data-dismiss="alert">×</button></div>'; } */ return $staticId; } function maj_static($id, $frm) { /* Met à jour la rubrique $id avec les nouvelles valeurs contenues dans $frm */ valide($frm['on_special']); valide($frm['on_menu']); valide($frm['etat']); $sql = " UPDATE gaia_static SET etat = '$frm[etat]', rub = '$frm[rub]', parent_id = '$frm[parent_id]'"; foreach ($_SESSION['lng'] as $lng) { $sql .=",nom_".$lng." = '".addslashes($frm['nom_'.$lng.''])."' ,surtitre_".$lng." = '".addslashes($frm['surtitre_'.$lng.''])."' ,description_".$lng." = '".(addslashes($frm['description_'.$lng.'']))."' ,descriptif_".$lng." = '".addslashes($frm['descriptif_'.$lng.''])."' ,link_".$lng." = '".addslashes($frm['link_'.$lng.''])."' , meta_desc_".$lng." = '".(addslashes($frm['meta_desc_'.$lng.'']))."' , meta_titre_".$lng." = '".(addslashes($frm['meta_titre_'.$lng.'']))."'"; } $sql .=" , on_special = '$frm[on_special]' , on_menu = '$frm[on_menu]' , icon = '$frm[icon]' , googlefont1 = '".addslashes($frm['googlefont1'])."' , googlefont2 = '".addslashes($frm['googlefont2'])."' , video = '".addslashes($frm['video'])."' , taille_bloc = '$frm[taille_bloc]' , type_bloc = '$frm[type_bloc]' , link = '".addslashes($frm['link'])."' , position_titre = '$frm[position_titre]' WHERE id = $id "; //echo $sql; // = mysqli_real_escape_string($sql); mysql_query_override($sql); /* Efface toutes les références auxquelles le produit est associé */ $qid = mysql_query_override(" DELETE FROM gaia_static_produits WHERE static_id = $id "); /* ajoute les références associées */ for ($i = 0; $i < count(vn($frm['prods'])); $i++) { if (!empty($frm['prods'][$i])) { $qid = mysql_query_override(" INSERT INTO gaia_static_produits (produit_id, static_id) VALUES ('{$frm['prods'][$i]}', '$id') "); } } echo '<div class="alert alert-success">Le contenu a été modifié <button type="button" class="close" data-dismiss="alert">×</button></div>'; } function affiche_formulaire_liste_static($id, $rub='') { global $rubrique_options; /* Affiche un formulaire de rubrique vide */ /* Valeurs par défaut */ $frm["nouveau_mode"] = "insere"; foreach ($_SESSION['lng'] as $lng) { $frm['nom_'.$lng.''] = ""; $frm['surtitre_'.$lng.''] = ""; $frm['descriptif_'.$lng.''] = ""; $frm['description_'.$lng.''] = ""; $frm['link_'.$lng.''] = ""; $frm["meta_desc_".$lng.""] = ""; $frm["meta_titre_".$lng.""] = ""; } $frm["rub"] = $rub; $frm["etat"] = ""; $frm["icon"] = ""; $frm["googlefont1"] = ""; $frm["googlefont2"] = ""; $frm["taille_bloc"] = ""; $frm["type_bloc"] = ""; $frm["link"] = ""; $frm["position_titre"] = ""; $frm["on_special"] = ""; $frm["alpha"] = ""; /* Affiche la liste des rubriques, en présélectionnant la rubrique choisie. */ affiche_liste_static(); } function affiche_liste_static() { GLOBAL $rubrique_options; GLOBAL $id; GLOBAL $wwwroot; GLOBAL $static_options; ?> <form name="entryform" method="post" action="<?=$_SERVER['PHP_SELF']?>?rub=<?php echo (!empty($frm["rub"])?$frm["rub"]:(!empty($_GET["rub"])?$_GET["rub"]:0)); ?>"> <input type="hidden" name="mode" value="positionner"> <input type="hidden" name="rub" value="<?php echo (!empty($frm["rub"])?$frm["rub"]:(!empty($_GET["rub"])?$_GET["rub"]:0)); ?>"> <table border="0" class="tablespace" width="100%" cellpadding="0" cellspacing="0"> <tr><th colspan="5" class="entete">Liste des contenus</th></tr> <?php if(!in_array($_REQUEST['rub'], $static_options['exclude_ajout'])) { ?> <tr> <td colspan="5" class="action"><a href="<?=$_SERVER['PHP_SELF']?>?mode=ajout<?=(isset($_REQUEST['rub'])?'&rub='.$_REQUEST['rub'].'':'')?>"> Ajouter un contenu</a></td> </tr> <?php } ?> <? if(isset($_REQUEST['rub'])) $sup = " and rub = '".$_REQUEST['rub']."' "; else $sup = ''; $result = mysql_query_override("SELECT * FROM gaia_static WHERE 1=1 ".$sup." ORDER BY position"); if (mysql_num_rows_override($result) == 0) {echo "<tr><td class=normal><b>Aucun contenu enregistré dans la base.</b></td></tr>"; } else { ?> <tr> <td class="menu">Action</td> <td class="menu">Contenu</td> <td class="menu"></td> <?php if(in_array($_REQUEST['rub'], $static_options['has_galerie'])) { ?><td class="menu" align="center">Galerie</td><?php } ?> <?php if(array_key_exists($_REQUEST['rub'], $static_options['has_parent'])) { ?><td class="menu" align="center">Parent</td><?php } ?> <td class="menu" align="center">Etat</td> <?php if(in_array($_REQUEST['rub'], $static_options['has_mea'])) { ?><td class="menu" align="center">Mise en avant</td><?php } ?> <?php if(in_array($_REQUEST['rub'], $static_options['has_menu'])) { ?><td class="menu" align="center">Affichage menu</td><?php } ?> </tr> <?php echo '<tbody id="sortable">'; $cpt=1; while ($rub = mysql_fetch_array_override($result)) { $supnom = ''; if($rub['type_bloc']==1) $supnom = 'Bloc gris + texte'; if($rub['type_bloc']==2) $supnom = 'Texte uniquement'; if($rub['type_bloc']==3) $supnom = 'Image uniquement'; if($rub['type_bloc']==4) $supnom = 'Texte + Image'; ?> <tr><td style="width:100px"> <input type="hidden" name="id[]" value="<?=$rub['id']?>"> <i style="cursor:pointer; margin-right:10px" title="Tirer pour déplacer" rel="tooltip" class="fa fa-reorder"></i> <?php if(!in_array($_REQUEST['rub'], $static_options['exclude_ajout'])) { ?><a href="#myModal<?=$rub['id']?>" role="button" data-toggle="modal" title="Supprimer" rel="tooltip" ><i class="ti-close"></i></a><?php } ?> <a title="Modifier" rel="tooltip" href="<?=$_SERVER['PHP_SELF']?>?mode=modif&id=<?=$rub['id'] ?><?=(isset($_REQUEST['rub'])?'&rub='.$_REQUEST['rub'].'':'')?>"><i class="ti-pencil"></i></a> </td> <td style="width:400px"><a href="<?=$_SERVER['PHP_SELF']?>?mode=modif&id=<?=$rub['id'] ?><?=(isset($_REQUEST['rub'])?'&rub='.$_REQUEST['rub'].'':'')?>"> <?php if(substr($_REQUEST['rub'],0,4)=='sous') { echo '{BLOC '.$cpt.' : '.$supnom.'} '; } ?> <?=html_entity_decode((!empty($rub['nom_'.$_SESSION['langue'].''])?$rub['nom_'.$_SESSION['langue'].'']:'')); ?></a></td> <td align="center"> <? if(in_array($_REQUEST['rub'], $static_options['has_souspage'])) { echo '<a href="static.php?rub=sous-'.$rub['id'].'">gérer les blocs</a>'; } ?> <? if(substr($_REQUEST['rub'],0,4)=='sous') { echo $rub['taille_bloc'].' / 12 bloc(s)'; } ?> </td> <?php if(in_array($_REQUEST['rub'], $static_options['has_galerie'])) { ?> <td align="center"><? echo '<a href="static.php?rub=gale-'.$rub['id'].'">gérer les images</a>'; ?></td> <?php } ?> <?php if(array_key_exists($_REQUEST['rub'], $static_options['has_parent'])) { ?> <td align="center"><? $s = get_static($rub['parent_id']); echo $s['nom_fr']; ?></td> <?php } ?> <td align="center"><? if (empty($rub['etat'])) { echo '<i class="ti-check-empty"></i>';} else {echo '<i class="ti-check"></i>';} ?></td> <?php if(in_array($_REQUEST['rub'], $static_options['has_mea'])) { ?><td align="center"><? if (empty($rub['on_special'])) { echo '<i class="ti-check-empty"></i>';} else {echo '<i class="ti-check"></i>';} ?></td><?php } ?> <?php if(in_array($_REQUEST['rub'], $static_options['has_menu'])) { ?><td align="center"><? if (empty($rub['on_menu'])) { echo '<i class="ti-check-empty"></i>';} else {echo '<i class="ti-check"></i>';} ?></td><?php } ?> </tr> <div id="myModal<?=$rub['id']?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Supprimer</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>Êtes-vous sur de vouloir supprimer cet enregistrement ?</p> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button> <a class="btn btn-primary" href="<?=$_SERVER['PHP_SELF']?>?mode=suppr&id=<?=$rub['id'] ?><?=(isset($_REQUEST['rub'])?'&rub='.$_REQUEST['rub'].'':'')?>">Supprimer</a> </div> </div> </div> </div> <? $cpt++; } echo '</tbody>'; if($_REQUEST['rub']!='photoslider2') echo '<tr><td colspan="5" align="center" class="bouton" style="background:#fff"><input type="submit" value="Positionner les contenus"></td></tr>'; } ?> </table></form> <? }?> <? function affiche_formulaire_static() { GLOBAL $frm,$rubrique_options,$id,$repertoire_images, $wwwroot, $repertoire_upload, $dirroot, $static_options, $static_size; ?> <form name="entryform" method="post" action="<?=$_SERVER['PHP_SELF']?>?rub=<?php echo (!empty($frm["rub"])?$frm["rub"]:0); ?>" enctype="multipart/form-data"> <input type="hidden" name="mode" id="mode" value="<?=$frm["nouveau_mode"]?>"> <input type="hidden" name="id" value="<?=$frm['id']?>"> <input type="hidden" name="rub" value="<?php echo (!empty($frm["rub"])?$frm["rub"]:0); ?>"> <input type="hidden" name="etat" value="1"> <input type="hidden" name="on_special" value="0"> <input type="hidden" name="on_menu" value="0"> <input type="hidden" name="img" id="img" value=""> <input type="hidden" name="descriptif_fr" value=""> <input type="hidden" name="descriptif_en" value=""> <input type="hidden" name="surtitre_fr" value=""> <input type="hidden" name="surtitre_en" value=""> <input type="hidden" name="etat" value="1" /> <input type="hidden" name="icon" value="" /> <input type="hidden" name="taille_bloc" value="" /> <input type="hidden" name="link_fr" value="" /> <input type="hidden" name="link_en" value="" /> <input type="hidden" name="googlefont1" value="" /> <input type="hidden" name="googlefont2" value="" /> <input type="hidden" name="description_fr" value="" /> <?php //if(substr($frm['rub'],0,5)=='sous-') $frm['rub'] = 'sous'; ?> <table border=0 widtd="100%" cellpadding="0" cellspacing="0" width="100%" class="tablespace"> <tr> <th class="entete" colspan="2">Ajouter / modifier un contenu</th> </tr> <?php if(in_array($frm['rub'], $static_options['has_mea'])) { ?> <tr> <td>Remonter en page d'accueil :</td> <td><input type="checkbox" name="on_special" <?=frmvalide($frm['on_special'])?>></td> </tr> <?php } ?> <?php if(in_array($frm['rub'], $static_options['has_menu'])) { ?> <tr> <td>Remonter dans le menu :</td> <td><input type="checkbox" name="on_menu" <?=frmvalide($frm['on_menu'])?>></td> </tr> <?php } ?> <!-- <tr><td> Lien de la page : </td> <td><a href="<?php echo $wwwroot; ?>/fr/<?php echo $frm['id']; ?>-p-<?php echo propre($frm['nom_fr'].' '.$frm['surtitre_fr']); ?>-mademoiselle-camille.html" target="_blank"><?php echo $wwwroot; ?>/<?php echo $frm['id']; ?>-p-<?php echo propre($frm['nom_fr'].' '.$frm['surtitre_fr']); ?>-mademoiselle-camille.html</a></td> </tr> --> <?php if(substr($frm['rub'],0,4)=='sous') { ?> <tr> <td>Taille du bloc :</td> <td> <input type="radio" name="taille_bloc" value="3" <?php if((vb($frm['taille_bloc'])=="3")||(!$frm['taille_bloc'])) {echo "checked";} ?>>1/4 <input type="radio" name="taille_bloc" value="4" <?php if(vb($frm['taille_bloc'])=="4") {echo "checked";} ?>>1/3 <input type="radio" name="taille_bloc" value="6" <?php if(vb($frm['taille_bloc'])=="6") {echo "checked";} ?>>1/2 <input type="radio" name="taille_bloc" value="8" <?php if(vb($frm['taille_bloc'])=="8") {echo "checked";} ?>>2/3 <input type="radio" name="taille_bloc" value="9" <?php if(vb($frm['taille_bloc'])=="9") {echo "checked";} ?>>3/4 <input type="radio" name="taille_bloc" value="12" <?php if(vb($frm['taille_bloc'])=="12") {echo "checked";} ?>>4/4 </td> </tr> <tr> <td>Type du bloc :</td> <td> <label><input type="radio" name="type_bloc" onclick="document.getElementById('position_titre').style.display='none';document.getElementById('lien_photo').style.display='table'" value="1" <?php if((vb($frm['type_bloc'])=="1")||(!$frm['type_bloc'])) {echo "checked";} ?>>Bloc gris + texte </label> <label><input type="radio" name="type_bloc" onclick="document.getElementById('position_titre').style.display='none';document.getElementById('lien_photo').style.display='none'" value="2" <?php if((vb($frm['type_bloc'])=="2")||(!$frm['type_bloc'])) {echo "checked";} ?>>Texte uniquement </label> <label><input type="radio" name="type_bloc" onclick="document.getElementById('position_titre').style.display='table';document.getElementById('lien_photo').style.display='table'" value="3" <?php if(vb($frm['type_bloc'])=="3") {echo "checked";} ?>>Image uniquement </label> <label><input type="radio" name="type_bloc" onclick="document.getElementById('position_titre').style.display='none';document.getElementById('lien_photo').style.display='none'" value="4" <?php if((vb($frm['type_bloc'])=="4")||(!$frm['type_bloc'])) {echo "checked";} ?>>Texte + image </label> </td> </tr> <tr> <td colspan="2"> <table id="lien_photo" style="<?php if(!isset($frm['type_bloc']) || $frm['type_bloc']!=2) : ?>display: table<?php endif; ?>" class="tablespace" width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td>Lien sur la photo :</td> <td><input type="text" name="link" value="<?php echo html_entity_decode(vb($frm['link']))?>"></td> </tr> </table> <table id="position_titre" style="<?php if(!isset($frm['type_bloc']) || $frm['type_bloc']!=3) : ?>display: none<?php endif; ?>" class="tablespace" width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td>Position de la description :</td> <td> <label><input type="radio" name="position_titre" value="1" <?php if((vb($frm['position_titre'])=="1")||(!$frm['position_titre'])) {echo "checked";} ?>>Pas de description affiché </label> <label><input type="radio" name="position_titre" value="2" <?php if(vb($frm['position_titre'])=="2") {echo "checked";} ?>>Au dessus de l'image </label> <label><input type="radio" name="position_titre" value="3" <?php if(vb($frm['position_titre'])=="3") {echo "checked";} ?>>Sur l'image </label> <label><input type="radio" name="position_titre" value="4" <?php if(vb($frm['position_titre'])=="4") {echo "checked";} ?>>Au dessous de l'image </label> </td> </tr> </table> </td> </tr> <!-- <tr> <td>Lien :</td> <td><input type="text" name="link" value="<?php echo html_entity_decode(vb($frm['link']))?>"></td> </tr> --> <?php } ?> <?php if(in_array($frm['rub'], $static_options['has_etat'])) { ?> <tr> <td class=normal>Etat du contenu :</td> <td class=normal> <input type="radio" name="etat" value="1" <?php if ((vb($frm['etat'])=="1")||(!$frm['etat'])) {echo "checked";} ?>>En ligne<br /> <input type="radio" name="etat" value="0" <?php if(vb($frm['etat'])=="0") {echo "checked";} ?>>En attente </td> </tr> <?php } ?> <?php if(in_array($frm['rub'], array('blocs'))) { ?> <tr> <td>Police Google Font :</td> <td><input type="text" name="googlefont1" value='<?php echo (vb($frm['googlefont1']))?>'> <i><link href="https://fonts.googleapis.com/css?family=Black+Han+Sans" rel="stylesheet"></i></td> </tr> <tr> <td>Police Google Font :</td> <td><input type="text" name="googlefont2" value="<?php echo html_entity_decode(vb($frm['googlefont2']))?>"> <i>font-family: 'Black Han Sans', sans-serif;</i></td> </tr> <?php } ?> <?php if(in_array($frm['rub'], $static_options['has_icon'])) { ?> <tr> <td>Icône :</td> <td><input type="text" class="icp icp-auto" name="icon" value="<?php echo html_entity_decode(vb($frm['icon']))?>"></td> </tr> <?php } ?> <?php if(array_key_exists($frm['rub'], $static_options['has_parent'])) { ?> <tr> <td>Parent :</td> <td> <select name="parent_id"> <option value="">--</option> <?php $cats = get_static_list($static_options['has_parent'][$frm['rub']]); foreach($cats as $k => $v) { echo '<option value="'.$v['id'].'" '.(($v['id']==$frm['parent_id'])?'selected':'').'>'.$v['nom_fr'].'</option>'; } ?> </select> </td> </tr> <?php } ?> <?php $nblng = count($_SESSION['lng']); foreach ($_SESSION['lng'] as $lng) { ?> <? echo (($nblng>1)?'<tr><td colspan="2" class="menu">BLOC DE LANGUE '.strtoupper($lng).'</td></tr>':'')?> <?php if(substr($frm['rub'],0,4)!= 'sous') { ?> <tr> <td><?php if($frm['rub']=='faq') { ?>Question<?php } else { ?>Titre<?php } ?> <?echo $lng ?>:</td> <td><input type="text" name="nom_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['nom_'.$lng.'']))?>"></td> </tr> <?php } else { ?> <tr> <td>Nom du bloc <?echo $lng ?>:<br /><i>Non affiché sur le site</i></td> <td><input type="text" name="nom_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['nom_'.$lng.'']))?>"></td> </tr> <?php } ?> <?php if(in_array($frm['rub'], $static_options['has_sous_titre'])) { ?> <?php if($frm['rub']=='blog_articles') { ?> <tr> <td>Date <i>(JJ/MM/AAAA)</i> :</td> <td><input type="text" name="surtitre_<?echo $lng ?>" placeholder="JJ/MM/AAAA" value="<?php echo html_entity_decode(vb($frm['surtitre_'.$lng.'']))?>"></td> </tr> <?php } elseif($frm['rub']=='bloc_home') { ?> <tr> <td>Vidéo :</td> <td><input type="text" name="surtitre_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['surtitre_'.$lng.'']))?>"></td> </tr> <?php } elseif($frm['rub']=='photoslider' || $frm['rub']=='who' || $frm['rub']=='page_who' || $frm['rub']=='page_bloclibre') { ?> <tr> <td>Intitulé du lien :</td> <td><input type="text" name="surtitre_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['surtitre_'.$lng.'']))?>"></td> </tr> <?php } else { ?> <tr> <td>Sous titre <?echo $lng ?>:</td> <td><input type="text" name="surtitre_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['surtitre_'.$lng.'']))?>"></td> </tr> <?php }} ?> <?php if(in_array($frm['rub'], $static_options['has_link'])) { ?> <tr> <td>Lien <?echo $lng ?> :</td> <td><input type="text" name="link_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['link_'.$lng.'']))?>"></td> </tr> <?php } ?> <?php if(in_array($frm['rub'], $static_options['has_short_txt'])) { ?> <?php if($frm['rub']=='blog_articles') { ?> <tr valign=top> <td>Auteur :<br /></td> <td><input type="text" name="descriptif_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['descriptif_'.$lng.'']))?>"></td> </tr> <?php } elseif($frm['rub']=='photoslider') { ?> <tr valign=top> <td>Lien :<br /></td> <td><input type="text" name="descriptif_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['descriptif_'.$lng.'']))?>"></td> </tr> <?php } elseif($frm['rub']=='page_bandohome') { ?> <tr valign=top> <td>Lien :<br /></td> <td><input type="text" name="descriptif_<?echo $lng ?>" value="<?php echo html_entity_decode(vb($frm['descriptif_'.$lng.'']))?>"></td> </tr> <?php } else { ?> <tr valign=top> <td colspan="2">Texte court <?echo $lng ?>:<br /></td> </tr> <tr> <td colspan="2" style="padding-left:0" > <textarea name="descriptif_<?echo $lng ?>" style="width:90%" id="descriptif_<?echo $lng ?>"><?php echo stripslashes(vb($frm['descriptif_'.$lng.''])) ?></textarea> </td> </tr> <?php }} ?> <?php if(!in_array($frm['rub'], $static_options['exclude_texte']) && !in_array(substr($frm['rub'],0,4), $static_options['exclude_texte'])) { ?> <tr valign=top> <td colspan="2"><?php if($frm['rub']=='faq') { ?>Réponse<?php } else { ?>Description<?php } ?> <? echo $lng ?>:<br /></td> </tr> <tr> <td colspan="2" style="padding-left:0" > <textarea name="description_<?echo $lng ?>" style="width:90%" id="description_<?echo $lng ?>"><?php echo stripslashes(vb($frm['description_'.$lng.''])) ?></textarea> </td> </tr> <?php } ?> <? } ?> <?php if(in_array($frm['rub'], $static_options['has_video'])) { ?> <tr><th colspan="2" class="entete">BLOC VIDÉO</th></tr> <tr> <td>Vidéo :</td> <td><textarea class="mceNoEditor icp icp-auto" name="video" style="width:920px" rows="5" ><?php echo html_entity_decode(vb($frm['video']))?></textarea></td> </tr> <?php } elseif(in_array($frm['rub'], $static_options['has_video_upload'])) { ?> <tr><th colspan="2" class="entete">BLOC VIDÉO</th></tr> <tr> <td colspan="2"> <?php if (!empty($frm['video'])) { echo '<center>'; echo '<input type="hidden" name="video" value="'.$frm['video'].'" />'; echo '<video width="600" height="450" controls><source src="'.$wwwroot.'/upload/'.$frm['video'].'" type="video/mp4"></source></video>'; echo '<div style="margin:20px 0"> <a class="btn" href="?mode=supprfile&id='.$frm['id'].'&file=video&rub='.(!empty($frm["rub"])?$frm["rub"]:0).'">Supprimer la vidéo</a> </div>'; echo '</center>'; } else { echo '<span class="btn fileinput-button"> <i class="icon-plus icon-white"></i> <span>Sélectionnez une vidéo...</span> <input type="file" name="video" value=""> </span> <button type="submit" class="btn red-bg" name="add_img" onclick="document.getElementById(\'mode\').value=\'addvideo\';">Ajouter une video</button>'; } ?> </td> </tr> <?php } else echo '<input type="hidden" name="video" value="'.$frm['video'].'" />'; ?> <?php if(in_array($frm['rub'], $static_options['has_big_img']) || in_array($frm['rub'], $static_options['has_img']) || in_array(substr($frm['rub'],0,4), $static_options['has_img']) ) { ?> <tr><th colspan="2" class="entete">BLOC IMAGES</th></tr> <? $w = 500; $h = 500; if(in_array($frm['rub'], $static_options['has_big_img']) && in_array($frm['rub'], $static_options['has_img'])) { $nbpict = 2; $intit[1] = 'Image principale'; $intit[2] = 'Image bandeau'; if(isset($static_size[$frm['rub']])) { $w = $static_size[$frm['rub']][0]; $h = $static_size[$frm['rub']][1]; } } elseif(in_array($frm['rub'], $static_options['has_big_img']) && !in_array($frm['rub'], $static_options['has_img'])) { $nbpict = 1; $w = 1920; $h = 350; $intit[1] = 'Image bandeau'; } elseif(!in_array($frm['rub'], $static_options['has_big_img']) && (in_array($frm['rub'], $static_options['has_img']) || in_array(substr($frm['rub'],0,4), $static_options['has_img']) )) { $nbpict = 1; $intit[1] = 'Image principale'; if(isset($static_size[$frm['rub']])) { $w = $static_size[$frm['rub']][0]; $h = $static_size[$frm['rub']][1]; } if(isset($static_size[substr($frm['rub'],0,4)])) { $w = $static_size[substr($frm['rub'],0,4)][0]; $h = $static_size[substr($frm['rub'],0,4)][1]; } } if(in_array($frm['rub'], $static_options['exclude_big_img']) ) { $nbpict = 0; } //#################################################################### // Traitement des images //#################################################################### for ($i=1;$i<($nbpict+1);$i++) { if($i==2) { $w = 1900; $h = 200; } if($_REQUEST['rub']=='photoslider2' && $frm['position']==0) { $w = 540; $h = 840; } echo '<tr><td colspan="2" style="padding-top:10px; padding-bottom:10px; border-bottom:1px dashed #ccc; background:#fff">'.$intit[$i].' : '; if (!empty($frm['image'.$i])) { echo '<input type="hidden" name="image'.$i.'" value="'.$frm['image'.$i].'">'; $iden = 'style="max-width:100%"'; $sup = ''; if (file_exists($dirroot.'/upload/zoom_'.$frm['image'.$i]) && !file_exists($dirroot.'/upload/'.$frm['image'.$i]) ) { $resized_img = list($temp_width, $temp_height) = getimagesize($dirroot.'/upload/zoom_'.$frm['image'.$i]); echo '<div class="alert alert-danger">ATTENTION ! Vous n\'avez pas encore recadré votre photo. Celle-ci n\'apparaitra pas sur le site.</div>'; $iden = 'id="target'.$i.'"'; echo '<input type="hidden" id="x1" name="x1image'.$i.'" /> <input type="hidden" id="y1" name="y1image'.$i.'" /> <input type="hidden" id="w" name="wimage'.$i.'" /> <input type="hidden" id="h" name="himage'.$i.'" /> <input type="hidden" id="wi" name="wiimage'.$i.'" value="'.$w.'" /> <input type="hidden" id="he" name="heimage'.$i.'" value="'.$h.'" />'; $sup = 'zoom_'; } echo '<center>'; echo '<img src="'.$wwwroot.'/upload/'.$sup.''.$frm['image'.$i].'" '.$iden.'>'; echo '<div style="margin:20px 0"> '.((file_exists($dirroot.'/upload/zoom_'.$frm['image'.$i]) && !file_exists($dirroot.'/upload/'.$frm['image'.$i]) )?'<button type="submit" class="btn btn-success" name="modif_img" onclick="document.getElementById(\'mode\').value=\'majfile\';document.getElementById(\'img\').value=\'image'.$i.'\'">Modifier l\'image</button>':'').' <a class="btn red-bg" href="?mode=supprfile&id='.$frm['id'].'&file=image'.$i.'&rub='.(!empty($frm["rub"])?$frm["rub"]:0).'">Supprimer l\'image</a> </div>'; echo '</center>'; } else { echo '<span class="btn fileinput-button"> <i class="icon-plus icon-white"></i> <span>Sélectionnez une image...</span> <input type="file" name="image'.$i.'" value=""> </span> <button type="submit" class="btn red-bg" name="add_img" onclick="document.getElementById(\'mode\').value=\'addfile\';document.getElementById(\'img\').value=\'image'.$i.'\'">Ajouter une image</button><i>Minimum : '.$w.'px X '.$h.'px</i>'; } echo '<input type="hidden" name="resized_temp_w_'.$i.'" value="'.($resized_img ? $temp_width : null).'"> <input type="hidden" name="resized_temp_h_'.$i.'" value="'.($resized_img ? $temp_height : null).'">'; echo '</td></tr>'; } //#################################################################### } ?> <?php if(in_array($frm['rub'], $static_options['has_prods'])) { $prods = array(); $recprods = mysql_query_override("select * from gaia_static_produits where static_id = '".$frm['id']."'"); if(mysql_num_rows_override($recprods)>0) { while($prds = mysql_fetch_array_override($recprods)) { $prods[] = $prds['produit_id']; } } ?> <tr> <th class="entete" colspan="2">Produits associés :</th> </tr> <tr> <td colspan="2"> <select name="prods[]" multiple style="width:95%" size="15"> <option value="" selected>-------------------------------------------</option> <? $select = mysql_query_override("SELECT id, color, reference, nom_".$_SESSION['langue']." FROM gaia_produits ORDER BY nom_".$_SESSION['langue']." ASC"); if (mysql_num_rows_override($select) > 0) { while ($nom = mysql_fetch_array_override($select)) { $selectionne = in_array( $nom['id'], vb($prods)) ? "selected" : ""; echo "<option value=\"" . $nom['id'] . "\" $selectionne>" . $nom['reference'] . " - ". $nom['nom_'.$_SESSION['langue'].''] ." ". get_color($nom['color']) ."</option>"; } } ?> </select> </td> </tr> <?php } ?> <?php if(!in_array($frm['rub'], $static_options['exclude_meta']) && !in_array(substr($frm['rub'],0,4), $static_options['exclude_meta'])) { ?> <?php foreach ($_SESSION['lng'] as $lng) { ?> <tr><th colspan="2" class="entete">Méta de la page <?php echo strtoupper($lng); ?></th></tr> <tr> <td >Méta titre <?php echo $lng; ?> :</td> <td><input type="text" name="meta_titre_<?php echo $lng; ?>" size=70 value="<?=stripslashes($frm["meta_titre_".$lng.""]) ?>"></td> </tr> <!-- <tr > <td colspan="2">Méta mot clé (séparer les mots clés par des virgules) :</td> </tr> <tr valign="top" > <td style="padding-right:0; padding-left:0" colspan="2"><textarea class="mceNoEditor" style="width:920px" name="meta_key" rows="5"><?=stripslashes($frm["meta_key"]) ?></textarea></td> </tr> --> <tr > <td colspan="2">Méta description <?php echo $lng; ?> :</td> </tr> <tr valign="top" > <td style="padding-right:0; padding-left:0" colspan="2" ><textarea class="mceNoEditor" style="width:920px" name="meta_desc_<?php echo $lng; ?>" rows="5"><?=stripslashes($frm["meta_desc_".$lng.""]) ?></textarea></td> </tr> <?php } ?> <?php } ?> <tr> <td colspan="2" class="bouton" align="center"><input type="button" onclick="history.go(-1)" value="Annuler"><input class="bouton" type="submit" value="<?=$frm["titre_soumet"] ?>"></td> </tr> </table> </form> <script type="text/javascript"> $( document ).ready(function() { var api; <? for ($i=1;$i<($nbpict+1);$i++) { ?> var wi_w = $('input[name=wiimage<?=$i?>]').val(); var wi_h = $('input[name=heimage<?=$i?>]').val(); var temp_w = $('input[name=resized_temp_w_<?=$i?>]').val(); var temp_h = $('input[name=resized_temp_h_<?=$i?>]').val(); var ratio = parseFloat(wi_w/wi_h).toFixed(3); $('#target<?=$i?>').Jcrop({ onChange: showCoords, onSelect: showCoords, aspectRatio: ratio },function(){ api = this; api.setSelect([130,65,130+350,65+285]); api.setOptions({ bgFade: true, allowResize: true, trueSize: [temp_w, temp_h] }); api.ui.selection.addClass('jcrop-selection'); }); <? } ?> }); </script> <? } function supprime_fichier($id, $img = '') { /* Supprime le produit spécificié par $id. Il faut supprimer le produit * puis les entrées correspondantes de la table produits_categories. */ global $the_path ; /* Charge les infos du produit. */ if(empty($img)) { $sql = "SELECT image1, image2, video FROM gaia_static WHERE id = '$id'"; $res = mysql_query_override($sql); $file = mysql_fetch_row_override($res); mysql_query_override("UPDATE gaia_static SET image1 = '', image2 = '', video = '' WHERE id = '$id'"); @unlink($the_path.$file[0]); @unlink($the_path.$file[1]); @unlink($the_path.$file[2]); } else { $sql = "SELECT ".$img." FROM gaia_static WHERE id = '$id'"; $res = mysql_query_override($sql); $file = mysql_fetch_row_override($res); mysql_query_override("UPDATE gaia_static SET ".$img." = '' WHERE id = '$id'"); @unlink($the_path.$file[0]); echo '<div class="alert alert-error">Le fichier <b>'.$file[0].'</b> a été effacé du serveur</div>'; } } ?>