%PDF- %PDF-
Direktori : /home/alliance/domains/sedl.alnetis.fr/public_html/ |
Current File : /home/alliance/domains/sedl.alnetis.fr/public_html/a-modifier_bloc_lang.php |
<?php include_once("inc/config.php"); include_once("inc/functions.php"); include_once("inc/session.php"); include_once("inc/init.php"); verif_get($_GET['id']); verif_get($_GET['type']); verif_get($_GET['language']); $query = "SELECT * FROM `bloc` WHERE id = ".$_GET['id']; if(!$db->isres($query)) { include('a-404.php'); exit(0); } $data = $db->select_array($query); $query="SELECT * FROM lang WHERE id=".$_GET['language']; $thelang=$db->select_array($query); $bloc_sec = $section->bloc_sec($_GET['id']); verif_co_sec($connection,$bloc_sec); if(isset($_POST['post']) && $_POST['post'] == 1) { $erreur2 = "ok"; if($_POST['type'] == 1 || $_POST['type'] == 2 || $_POST['type'] == 3) { if($erreur2 == "ok") $erreur2 = $db->verif($_POST['texte'], "Text", false, false, 2); } if($_POST['type'] == 6) { if($erreur2 == "ok") $erreur2 = $db->verif($_POST['bouton'], "Button link", false, false, 2); if($erreur2 == "ok") $erreur2 = $db->verif($_POST['bouton_en'], "The button", false, false, 2); } if($_POST['type'] == 7) { if($erreur2 == "ok") $erreur2 = $db->verif($_POST['soustitre_en'], "Subtitle", false, false, 2); } if($erreur2 == "ok") { //Photo if($_POST['photo'] != null) { if($_POST['photo'] != $data['photo']) { $page->suppr_photo($data['id']); $_POST['photo'] = photo_move($_POST['photo']); } } $where = "id = ".$_GET['id']; $where2 = "bloc = ".$_GET['id']; //Bloc $values = array( "photo" => $_POST['photo'], "taillephoto" => $_POST['taillephoto'], "valide" => (int)$_POST['valide'], "bouton" => $_POST['bouton'] ); $db->update("bloc", $values, $where); $query="SELECT * FROM `bloc_lang` WHERE `bloc`=".$_GET['id']." AND `lang`=".$_GET['language']; echo $query; if(!$db->isres($query)){ $values = array ( "bloc" => $_GET['id'], "lang" => $_GET['language'], "texte" => $_POST['texte'], "soustitre" => $_POST['soustitre'], "bouton" => $_POST['bouton'] ); $db->insert("bloc_lang", $values); } else{ $values = array ( "texte" => $_POST['texte'], "soustitre" => $_POST['soustitre'], "bouton" => $_POST['bouton'] ); $db->update("bloc_lang", $values, $where2." AND lang = ".$_GET['language']); } header("Location:modifier_page_lang.php?id=".$data['page']."&msg=yes&language=".$_GET['language']); } else { $err = true; } } $query = "SELECT * FROM `bloc_lang` WHERE `lang`=".$_GET['language']." AND `bloc` = ".$_GET['id']; $datalang = $db->select_array($query); if(!isset($_POST['texte'])) $_POST['texte'] = $datalang['texte']; if(!isset($_POST['soustitre'])) $_POST['soustitre'] = $datalang['soustitre']; if(!isset($_POST['bouton'])) $_POST['bouton'] = $datalang['bouton']; if(!isset($_POST['photo'])) $_POST['photo'] = $data['photo']; if(!isset($_POST['taillephoto'])) $_POST['taillephoto'] = $data['taillephoto']; if(!isset($_POST['bouton'])) $_POST['bouton'] = $data['bouton']; if(!isset($_POST['page'])) $_POST['page'] = $data['page']; if(!isset($_POST['type'])) $_POST['type'] = $data['type']; $query = "SELECT * FROM `bloc_lang` WHERE `lang` = ".$_SESSION['lang']." AND `bloc` = ".$_GET['id']; $oldlang = $db->select_array($query); if($_POST['texte']=="") $_POST['texte'] = $oldlang['texte']; if($_POST['soustitre']=="") $_POST['soustitre'] = $oldlang['soustitre']; if($_POST['bouton']=="") $_POST['bouton'] = $oldlang['bouton']; //affichage du html include("theme/html.php"); //affichage des metas include("theme/meta.php"); echo "\n<title>".$admtext->getText("edit_bloc",$_SESSION['lang'])." - ".$info_titresite."</title>\n"; //affichage du header $pagesection=true; $sectionid=$bloc_sec; if(estadmin()) include("theme/header_admin.php"); else include("theme/header_redacteur.php"); ?> <div class="text_admin"> <h2><?=$admtext->getText("edit_bloc",$_SESSION['lang'])?> - <?=$admtext->getText("translation",$_SESSION['lang'])?> <?=$thelang['nom']?></h2> <ul class="sousmenuadmin"> <li> <a href="admin/modifier_page_lang.php?id=<?php echo $data['page']; ?>&language=<?=$_GET['language']?>"><?=$admtext->getText("return_activity",$_SESSION['lang'])?></a> </li> </ul> <?php if(isset($err) && $err) { if (verif_lang(1)) { echo "<p class=\"erreurbloc\">".$erreur1."</p>"; } else { echo "<p class=\"erreurbloc\">".$erreur2."</p>"; } } if(isset($yes) && $yes) { echo "<p class=\"infobloc\">Opération effectuée</p>"; } ?> <form action="admin/modifier_bloc_lang.php?id=<?php echo $_GET['id']; ?>&type=<?php echo $_GET['type']; ?>&language=<?=$_GET['language']?>" enctype="multipart/form-data" method="post" class="form"> <table> <?php if($_GET['type'] == 1 || $_GET['type'] == 2 || $_GET['type'] == 3 || $_GET['type'] == 6 || $_GET['type'] == 7) { ?> <?php } ?> <input type="hidden" name="page" value="<?php echo $_POST['page']; ?>" /> <input type="hidden" name="type" value="<?php echo $_GET['type']; ?>" /> <?php if($_GET['type'] == 1 || $_GET['type'] == 2 || $_GET['type'] == 3) { ?> <tr> <td class="label"></td> <td class="field" colspan="2"> <div id="toolbar"></div> </td> </tr> <tr> <td class="label top"><?=$admtext->getText("blocs_text",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field top field_fr"><textarea name="texte"><?php echo $_POST['texte']; ?></textarea></td> </tr> <?php } if($_GET['type'] == 2 || $_GET['type'] == 3 | $_GET['type'] == 4) { ?> <tr> <td class="label top"><?=$admtext->getText("blocs_picture",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field"><input type="file" name="file_1" id="file_1" /><?php if(isset($_POST['photo'])) echo '<div class="uploadifyQueueItem completed"><a href="uploads/'.$_POST['photo'].'" class="zoom">'.$_POST['photo'].'</a></div> '; ?></td> <td class="field"><input type="hidden" name="photo" id="photo1" value="<?php echo $_POST['photo']; ?>" /></td> </tr> <tr> <td class="label"><?=$admtext->getText("picture_size",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field"> <select name="taillephoto"> <?php if($_GET['type'] == 4) { ?> <option <?php if($_POST['taillephoto'] == 698) echo 'selected="selected"'; ?> value="698"><?=$admtext->getText("full_width",$_SESSION['lang'])?></option> <?php } ?> <option <?php if($_POST['taillephoto'] == 340) echo 'selected="selected"'; ?> value="340"><?=$admtext->getText("large",$_SESSION['lang'])?></option> <option <?php if($_POST['taillephoto'] == 220) echo 'selected="selected"'; ?> value="220"><?=$admtext->getText("medium",$_SESSION['lang'])?></option> <option <?php if($_POST['taillephoto'] == 110) echo 'selected="selected"'; ?> value="110"><?=$admtext->getText("small",$_SESSION['lang'])?></option> </select> </td> <td class="field"></td> </tr> <?php } if($_GET['type'] == 6) { ?> <tr> <td class="label"><?=$admtext->getText("button_title",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field"><input type="text" name="bouton" value="<?php echo $_POST['bouton']; ?>" /></td> </tr> <tr> <td class="label"><?=$admtext->getText("button_link",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field"><input type="text" name="bouton" value="<?php echo $_POST['bouton']; ?>" /></td> <td class="field"></td> </tr> <?php } if($_GET['type'] == 7) { ?> <tr> <td class="label"><?=$admtext->getText("subtitle",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field"><input type="text" name="soustitre" value="<?php echo $_POST['soustitre']; ?>" /></td> </tr> <?php } if($_GET['type'] == 8) { ?> <tr> <td class="label top"><?=$admtext->getText("edit_files",$_SESSION['lang'])?> <span class="etoile">*</span></td> <td class="field"><input type="file" name="file_docs" id="file_docs" /> <?php $dirname = 'uploads/bloc'.$data['id']; $dir = opendir($dirname); while($file = readdir($dir)) { if($file != '.' && $file != '..' && !is_dir($dirname.$file)) { echo '<div class="uploadifyQueueItem completed"><div class="cancel"><a href="admin/suppr_doc.php?doc='.$file.'&bloc='.$_GET['id'].'" class="confirm"><img src="uploadify/cancel.png" /></a></div><a href="'.$dirname.'/'.$file.'">'.$file.'</a></div> '; } } closedir($dir); ?> </td> <td class="field"><input type="hidden" id="file_folder" value="bloc<?php echo $data['id']; ?>" /></td> </tr> <?php } ?> <? if($_GET['type']==1 || $_GET['type']==2 || $_GET['type']==3 || $_GET['type']==7):?> <?if(estadmin()):?> <tr> <td class="label">Publié ? (mettre sur non si il manque encore des traductions pour ce bloc)</td> <td class="field"> <p><input type="radio" id="radoui" class="radio" name="valide" value="1" checked="checked" /> <label for="radoui">Oui</label></p> <p><input type="radio" id="radnon" class="radio" name="valide" value="0" /> <label for="radnon">Non</label></p> </td> <td class="field"></td> </tr> <? else : ?> <?if($data['valide']==1):?> <input type="hidden" name="valide" value="2" /> <? else: ?> <input type="hidden" name="valide" value="0" /> <? endif; ?> <? endif; ?> <? else: ?> <input type="hidden" name="valide" value="1" /> <? endif; ?> </table> <div class="form_bouton"> <input type="hidden" name="post" value="1" /> <input type="submit" class="bouton" id="maj_bouton" value="<?=$admtext->getText("edit_bloc",$_SESSION['lang'])?>" /> <a href="admin/suppr_bloc.php?id=<?php echo $_GET['id']; ?>" class="bouton confirm" /><?=$admtext->getText("delete_bloc",$_SESSION['lang'])?></a> </div> </form> </div> <? //affichage du footer include("theme/footer.php"); ?>