%PDF- %PDF-
Direktori : /home/alliance/domains/congress-intercultural.eu/public_html/sauv/ |
Current File : /home/alliance/domains/congress-intercultural.eu/public_html/sauv/a-modifier_collectivite.php |
<?php include_once("inc/config.php"); include_once("inc/functions.php"); include_once("inc/init.php"); include_once("inc/session.php"); $db = new BaseOps; verif_get($_GET['id']); $query = "SELECT * FROM `section` WHERE id = ".$_GET['id']; $this_section=$db->select_array($query); if(!$db->isres($query)) { include('a-404.php'); exit(0); } $page = new Page(); //$page_sec = $section->page_sec($_GET['id']); verif_co_sec($_GET['id']); if(isset($_POST['post']) && $_POST['post'] == 1) { verif_co_sec($this_section['id']); $erreur1="ok"; $erreur2="ok"; if (verif_lang(1)) { $erreur1 = $db->verif($_POST['titre_fr'], "Le titre "); if($this_section['profil']!=3){ if($erreur1 == "ok") $erreur1 = $db->verif($_POST['population'], $admtext->getText("population",$_SESSION['lang']) ); if($erreur1 == "ok") $erreur1 = verifie_num($_POST['population'],$admtext->getText("population",$_SESSION['lang'])); } } if (verif_lang(2)) { $erreur2 = $db->verif($_POST['titre_en'], "Title"); if($this_section['profil']!=3){ if($erreur2 == "ok") $erreur2 = $db->verif($_POST['population'], $admtext->getText("population",$_SESSION['lang'])); if($erreur2 == "ok") $erreur2 = verifie_num($_POST['population'],$admtext->getText("population",$_SESSION['lang'])); } } if($erreur1 == "ok" && $erreur2 == "ok") { //Photos if($_POST['photo1'] != null) { if($_POST['photo1'] != $this_section['photo1']) { $section->suppr_photo($this_section['id'], 1); $_POST['photo1'] = photo_move($_POST['photo1']); } } if($_POST['photo2'] != null) { if($_POST['photo2'] != $this_section['photo2']) { $section->suppr_photo($this_section['id'], 2); $_POST['photo2'] = photo_move($_POST['photo2']); } } if($_POST['photo3'] != null) { if($_POST['photo3'] != $this_section['photo3']) { $section->suppr_photo($this_section['id'], 3); $_POST['photo3'] = photo_move($_POST['photo3']); } } if($_POST['photo4'] != null) { if($_POST['photo4'] != $this_section['photo4']) { $section->suppr_photo($this_section['id'], 4); $_POST['photo4'] = photo_move($_POST['photo4']); } } if($_POST['photo1'] == null) { $_POST['photo1'] = $this_section['photo1']; } if($_POST['photo2'] == null) { $_POST['photo2'] = $this_section['photo2']; } if($_POST['photo3'] == null) { $_POST['photo3'] = $this_section['photo3']; } if($_POST['photo4'] == null) { $_POST['photo4'] = $this_section['photo4']; } if(isset($_POST['supp1']) && $_POST['supp1']) { photo_supp($this_section['photo1']); $_POST['photo1'] = null; } if(isset($_POST['supp2']) && $_POST['supp2']) { photo_supp($this_section['photo2']); $_POST['photo2'] = null; } if(isset($_POST['supp3']) && $_POST['supp3']) { photo_supp($this_section['photo3']); $_POST['photo3'] = null; } if(isset($_POST['supp4']) && $_POST['supp4']) { photo_supp($this_section['photo4']); $_POST['photo4'] = null; } $where = "id = ".$_GET['id']; $where2 = "section = ".$_GET['id']; // page $values = array( "population"=> $_POST['population'], "adresse"=> $_POST['adresse'], "codepostal"=> $_POST['codepostal'], "photo1" => $_POST['photo1'], "photo2" => $_POST['photo2'], "photo3" => $_POST['photo3'], "photo4" => $_POST['photo4'], "partenaire"=> $_POST['partenaire'] ); $db->update("section", $values, $where); if (verif_lang(1)) { //page_fr $values = array ( "titre" => $_POST['titre_fr'], "texte" => $_POST['texte_fr'], "permalien" => cleanUrl($_POST['titre_fr']) ); $db->update("section_lang", $values, $where2." AND lang = 1"); } if (verif_lang(2)) { //page_en $values = array ( "titre" => $_POST['titre_en'], "texte" => $_POST['texte_en'], "permalien" => cleanUrl($_POST['titre_en']) ); $db->update("section_lang", $values, $where2." AND lang = 2"); } $yes = true; header("Location:editer_section.php?id=".$_GET['id']."&msg=yes"); } else { $err = true; } } $query = "SELECT * FROM `section` WHERE id = ".$_GET['id']; $data = $db->select_array($query); $query = "SELECT * FROM `section_lang` WHERE lang = 1 AND section = ".$data['id']; $data_fr = $db->select_array($query); $query = "SELECT * FROM `section_lang` WHERE lang = 2 AND section = ".$data['id']; $data_en = $db->select_array($query); if(!isset($_POST['photo1'])) $_POST['photo1'] = $data['photo1']; if(!isset($_POST['photo2'])) $_POST['photo2'] = $data['photo2']; if(!isset($_POST['photo3'])) $_POST['photo3'] = $data['photo3']; if(!isset($_POST['photo4'])) $_POST['photo4'] = $data['photo4']; if(!isset($_POST['titre_fr'])) $_POST['titre_fr'] = $data_fr['titre']; if(!isset($_POST['titre_en'])) $_POST['titre_en'] = $data_en['titre']; if(!isset($_POST['texte_fr'])) $_POST['texte_fr'] = $data_fr['texte']; if(!isset($_POST['texte_en'])) $_POST['texte_en'] = $data_en['texte']; if(!isset($_POST['population'])) $_POST['population'] = $data['population']; if(!isset($_POST['site'])) $_POST['site'] = $data['site']; if(!isset($_POST['adresse'])) $_POST['adresse'] = $data['adresse']; if(!isset($_POST['codepostal'])) $_POST['codepostal'] = $data['codepostal']; if(!isset($_POST['partenaire'])) $_POST['partenaire'] = $data['partenaire']; //affichage du html include("theme/html.php"); //affichage des metas include("theme/meta.php"); echo "\n<title>".$admtext->getText("edit_collectivity",$_SESSION['lang'])." - ".$info_titresite."</title>\n"; //affichage du header if(estadmin()) include("theme/header_admin.php"); else include("theme/header_redacteur.php"); $this_edition=$edition->getCurrentEdition($aff="ins",$_SESSION['lang']); ?> <div class="text_admin"> <h2><?=$admtext->getText("edit_collectivity",$_SESSION['lang'])?></h2> <p><?=$admtext->getText("notice_blocs",$_SESSION['lang'])?></p> <div id="test"></div> <?php if($_GET['msg']=="yes") { echo "<p class=\"infobloc\">Opération effectuée</p>"; } ?> <input type="hidden" id="pageid" value="<?php echo $_GET['id']; ?>" /> <ul class="sousmenuadmin"> <li><a href="admin/editer_section.php?id=<?php echo $_GET['id']; ?>"><?=$admtext->getText("return_admin_panel",$_SESSION['lang'])?></a></li> </ul> <?php if($err) { if (verif_lang(1)) { echo "<p class=\"erreurbloc\">".$erreur1."</p>"; } else { echo "<p class=\"erreurbloc\">".$erreur2."</p>"; } } if($yes) { echo "<p class=\"infobloc\">Opération effectuée</p>"; } ?> <div class="text_admin"> <form action="admin/modifier_collectivite.php?id=<?php echo $_GET['id']; ?>" enctype="multipart/form-data" method="post" class="form"> <table> <?if (estadmin()) : ?> <tr> <td class="label"></td> <td class="field head">Français</td> <td class="field head">Anglais</td> </tr> <? endif; ?> <tr> <td class="label"><?=$admtext->getText("community_name",$_SESSION['lang'])?> <span class="etoile">*</span></td> <?if(verif_lang(1)):?><td class="field"><input type="text" name="titre_fr" value="<?php echo $_POST['titre_fr']; ?>" /></td><?endif;?> <?if(verif_lang(2)):?><td class="field"><input type="text" name="titre_en" value="<?php echo $_POST['titre_en']; ?>" /></td><?endif;?> </tr> <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> <?if(verif_lang(1)):?><td class="field top"><textarea name="texte_fr"><?php echo $_POST['texte_fr']; ?></textarea></td><? endif; ?> <?if(verif_lang(2)):?><td class="field top"><textarea name="texte_en"><?php echo $_POST['texte_en']; ?></textarea></td><? endif; ?> </tr> <tr> <td class="label"><?=$admtext->getText("address",$_SESSION['lang'])?> </td> <td class="field"><input type="text" name="adresse" value="<?php echo $_POST['adresse']; ?>" /></td> </tr> <tr> <td class="label"><?=$admtext->getText("codepostal",$_SESSION['lang'])?> </td> <td class="field"><input type="text" name="codepostal" value="<?php echo $_POST['codepostal']; ?>" /></td> </tr> <?if($this_section['profil']!=3): ?> <tr> <td class="label"><?=$admtext->getText("population",$_SESSION['lang'])?> </td> <td class="field"><input type="text" name="population" value="<?php echo $_POST['population']; ?>" /></td> </tr> <? endif; ?> <tr> <td colspan="3" class="label"><?=$admtext->getText("question_colpartner",$_SESSION['lang'])?> </td> </tr> <tr> <td class="label"></td> <td class="field"><input type="text" name="partenaire" value="<?php echo $_POST['partenaire']; ?>" /></td> </tr> <tr class="news"> <td class="label top"><?=$admtext->getText("main_picture",$_SESSION['lang'])?></td> <td class="field"><input type="file" name="file_1" id="file_1" /><?php if($_POST['photo1']) echo '<div class="uploadifyQueueItem completed"><div class="cancel"><input type="checkbox" class="radio supphoto" name="supp1" id="supp1"> <label for="supp1">Supprimer</label></div><a href="uploads/'.$_POST['photo1'].'" class="zoom">'.$_POST['photo1'].'</a></div> '; ?></td> <td class="field"><input type="hidden" name="photo1" id="photo1" value="<?php echo $_POST['photo1']; ?>" /></td> </tr> <tr class="news"> <td class="label top"><?=$admtext->getText("picture",$_SESSION['lang'])?> n°2</td> <td class="field"><input type="file" name="file_2" id="file_2" /><?php if($_POST['photo2']) echo '<div class="uploadifyQueueItem completed"><div class="cancel"><input type="checkbox" class="radio supphoto" name="supp2" id="supp2"> <label for="supp2">Supprimer</label></div><a href="uploads/'.$_POST['photo2'].'" class="zoom">'.$_POST['photo2'].'</a></div> '; ?></td> <td class="field"><input type="hidden" name="photo2" id="photo2" value="<?php echo $_POST['photo2']; ?>" /></td> </tr> <tr class="news"> <td class="label top"><?=$admtext->getText("picture",$_SESSION['lang'])?> n°3</td> <td class="field"><input type="file" name="file_3" id="file_3" /><?php if($_POST['photo3']) echo '<div class="uploadifyQueueItem completed"><div class="cancel"><input type="checkbox" class="radio supphoto" name="supp3" id="supp3"> <label for="supp3">Supprimer</label></div><a href="uploads/'.$_POST['photo3'].'" class="zoom">'.$_POST['photo3'].'</a></div> '; ?></td> <td class="field"><input type="hidden" name="photo3" id="photo3" value="<?php echo $_POST['photo3']; ?>" /></td> </tr> <tr class="news"> <td class="label top"><?=$admtext->getText("picture",$_SESSION['lang'])?> n°4</td> <td class="field"><input type="file" name="file_4" id="file_4" /><?php if($_POST['photo4']) echo '<div class="uploadifyQueueItem completed"><div class="cancel"><input type="checkbox" class="radio supphoto" name="supp4" id="supp4"> <label for="supp4">Supprimer</label></div><a href="uploads/'.$_POST['photo4'].'" class="zoom">'.$_POST['photo4'].'</a></div> '; ?></td> <td class="field"><input type="hidden" name="photo4" id="photo4" value="<?php echo $_POST['photo4']; ?>" /></td> </tr> </table> <div class="form_bouton"> <input type="hidden" name="post" value="1" /> <input type="submit" class="bouton" id="maj_bouton" value="<?=$admtext->getText("edit_collectivity",$_SESSION['lang'])?>" /> <?if (estadmin() && !$section->isValid($_GET['id'],$this_edition['id'])) : ?> <a href="admin/valider_section.php?id=<?php echo $_GET['id']; ?>&edition=<?=$this_edition['id']?>" class="bouton" />Valider la collectivité</a> <? endif;?> </div> </form> </div> <? //affichage du footer include("theme/footer.php"); ?>