%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/alliance/domains/congress-intercultural.eu/public_html/
Upload File :
Create Path :
Current File : /home/alliance/domains/congress-intercultural.eu/public_html/a-adm_text.php

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

verif_co_admin();

if(isset($_POST['post']) && $_POST['post'] == 1)
{
	$db = new BaseOps;
	$page=$admtext->getPage($_GET['page']);
	if(isset($_GET['edition'])){ $ed=$_GET['edition']; } else{ $ed=null; }
	if(!$admtext->textExist($_GET['page'],$ed)){
		// ajout
		
		
		if($page['profil']==1){
			$aj_profils=$profil->getProfils();
			foreach($aj_profils as $aj_profil){
				if($page['lib']==1){
					$_POST['texte_fr_'.$aj_profil['id']]=str_replace(array("<p>", "</p>"),"",$_POST['texte_fr_'.$aj_profil['id']]);
					$_POST['texte_en_'.$aj_profil['id']]=str_replace(array("<p>", "</p>"),"",$_POST['texte_en_'.$aj_profil['id']]);
				}
				if(!isset($_GET['edition'])){
					//texte_fr
					
					$values = array (
						"page" => $page['id'],
						"lang" => 1,
						"profil" => $aj_profil['id'],
						"texte" => $_POST['texte_fr_'.$aj_profil['id']] );
					$db->insert("page_adm_lang", $values);
						
					//texte_en
					$values = array (
						"page" => $page['id'],
						"lang" => 2,
						"profil" => $aj_profil['id'],
						"texte" => $_POST['texte_en_'.$aj_profil['id']] );
					$db->insert("page_adm_lang", $values);
			
				}
				else{
					//texte_fr
					$values = array (
						"page" => $page['id'],
						"lang" => 1,
						"profil" => $aj_profil['id'],
						"edition" => $_GET['edition'],
						"texte" => $_POST['texte_fr_'.$aj_profil['id']] );
					$db->insert("page_adm_lang", $values);
						
					//texte_en
					$values = array (
						"page" => $page['id'],
						"lang" => 2,
						"profil" => $aj_profil['id'],
						"edition" => $_GET['edition'],
						"texte" => $_POST['texte_en_'.$aj_profil['id']] );
					$db->insert("page_adm_lang", $values);
				}
			}
		
		}
		else{
			if($page['lib']==1){
				$_POST['texte_fr']=str_replace(array("<p>", "</p>"),"",$_POST['texte_fr']);
				$_POST['texte_en']=str_replace(array("<p>", "</p>"),"",$_POST['texte_en']);
			}
			if(!isset($_GET['edition'])){
				
				//texte_fr
				$values = array (
					"page" => $page['id'],
					"lang" => 1,
					"texte" => $_POST['texte_fr'] );
				$db->insert("page_adm_lang", $values);
					
				//texte_en
				$values = array (
					"page" => $page['id'],
					"lang" => 2,
					"texte" => $_POST['texte_en'] );
				$db->insert("page_adm_lang", $values);
		
			}
			else{
				//texte_fr
				$values = array (
					"page" => $page['id'],
					"lang" => 1,
					"edition" => $_GET['edition'],
					"texte" => $_POST['texte_fr'] );
				$db->insert("page_adm_lang", $values);
					
				//texte_en
				$values = array (
					"page" => $page['id'],
					"lang" => 2,
					"edition" => $_GET['edition'],
					"texte" => $_POST['texte_en'] );
				$db->insert("page_adm_lang", $values);
			}
		}		
		
		
		$yes=true;
	}
	else {
		
		//edition
		$page=$admtext->getPage($_GET['page']);
		
		
		//titre libelle
		$where="id=".$page['id'];
		$values = array (
			"libelle" => $_POST['titre'] );
		$db->update("page_adm", $values,$where);
		
		if($page['profil']){
			
			$aj_profils=$profil->getProfils();
			foreach($aj_profils as $aj_profil){
				if($page['lib']==1){
					$_POST['texte_fr_'.$aj_profil['id']]=str_replace(array("<p>", "</p>"),"",$_POST['texte_fr_'.$aj_profil['id']]);
					$_POST['texte_en_'.$aj_profil['id']]=str_replace(array("<p>", "</p>"),"",$_POST['texte_en_'.$aj_profil['id']]);
				}
				if(!isset($_GET['edition'])){
					//texte_fr
					$where="page=".$page['id']." AND profil=".$aj_profil['id'];
					$values = array (
						"texte" => $_POST['texte_fr_'.$aj_profil['id']] );
					$db->update("page_adm_lang", $values,$where." AND lang = 1");
						
					//texte_en
					$values = array (
						"texte" => $_POST['texte_en_'.$aj_profil['id']] );
					$db->update("page_adm_lang", $values,$where." AND lang = 2");
			
				}
				else{
					//texte_fr
					$where="page=".$page['id']." AND profil=".$aj_profil['id']." AND edition=".$_GET['edition'];
					$values = array (
						"texte" => $_POST['texte_fr_'.$aj_profil['id']] );
					$db->update("page_adm_lang", $values,$where." AND lang = 1");
						
					//texte_en
					$values = array (
						"texte" => $_POST['texte_en_'.$aj_profil['id']] );
					$db->update("page_adm_lang", $values,$where." AND lang = 2");
				}
			}
		
		}
		else{
			if($page['lib']==1){
				$_POST['texte_fr']=str_replace(array("<p>", "</p>"),"",$_POST['texte_fr']);
				$_POST['texte_en']=str_replace(array("<p>", "</p>"),"",$_POST['texte_en']);
			}
			if(!isset($_GET['edition'])){
				//texte_fr
				$where="page=".$page['id'];
				$values = array (
					"texte" => $_POST['texte_fr'] );
				$db->update("page_adm_lang", $values,$where." AND lang = 1");
					
				//texte_en
				$values = array (
					"texte" => $_POST['texte_en'] );
				$db->update("page_adm_lang", $values,$where." AND lang = 2");
		
			}
			else{
				//texte_fr
				$where="page=".$page['id']." AND edition=".$_GET['edition'];
				$values = array (
					"texte" => $_POST['texte_fr'] );
				$db->update("page_adm_lang", $values,$where." AND lang = 1");
					
				//texte_en
				$values = array (
					"texte" => $_POST['texte_en'] );
				$db->update("page_adm_lang", $values,$where." AND lang = 2");
			}
		}		
		
		
		$yes=true;
	}
	if(!isset($_GET['edition'])){
		header("Location:liste_adm_text.php?msg=yes");
	}
}



//affichage du html
include("theme/html.php");
//affichage des metas
include("theme/meta.php");
echo "\n<title>Administrer le texte - ".$info_titresite."</title>\n";
//affichage du header
include("theme/header_admin.php");

$this_edition=false;
$this_profils=false;
$page=$admtext->getPage($_GET['page']);
if($page['profil']==1){
	$this_profils=$profil->getProfils();
}
$get="";

if(isset($_GET['edition'])){
	$this_edition=$_GET['edition'];
	$get.="&edition=".$_GET['edition'];
}
?>



<div class="text_admin">
<h2>Administrer le texte : <?=$page['libelle']?></h2>
<?php
if($err) {
	echo "<p class=\"erreurbloc\">".$erreur."</p>";
}
if($yes) {
	echo "<p class=\"infobloc\">Opération effectuée</p>";
}


?>
<form action="admin/adm_text.php?page=<?=$_GET['page']?><?=$get?>" method="post" class="form">
	<table>
		<tr>
			<td class="label"></td>
			<td class="field head">Français</td>
			<td class="field head">Anglais</td>
		</tr>
		<tr>
			<td class="label">Titre du libelle <span class="etoile">*</span></td>
			<td class="field"><input type="text" name="titre" value="<?=$page['libelle']?>" /></td>
			<td class="field"></td>
		</tr>
		<tr class="news">
			<td class="label"></td>
			<td class="field" colspan="2">
				<div id="toolbar"></div>
			</td>
		</tr>
		<? if (!$this_profils):?>
		<tr class="news">
			<td class="label top">Texte</td>
			<td class="field top"><textarea name="texte_fr"><?=$admtext->getText($_GET['page'],1,$this_edition,null,"back")  ?></textarea></td>
			<td class="field top"><textarea name="texte_en"><?=$admtext->getText($_GET['page'],2,$this_edition,null,"back")  ?></textarea></td>
		</tr>
		<? else: ?>
			<? foreach ($this_profils as $this_profil): ?>
				<tr class="news">
					<td class="label top">Texte <?=$this_profil['libelle']?></td>
					<td class="field top"><textarea name="texte_fr_<?=$this_profil['id']?>"><?=$admtext->getText($_GET['page'],1,$this_edition,$this_profil['id'],"back")?></textarea></td>
					<td class="field top"><textarea name="texte_en_<?=$this_profil['id']?>"><?=$admtext->getText($_GET['page'],2,$this_edition,$this_profil['id'],"back")?></textarea></td>
				</tr>
			<? endforeach; ?>
		<? endif;?>
		
		
	</table>
	<div class="form_bouton">
		<input type="hidden" name="post" value="1" />
		<input type="submit" class="bouton" id="maj_bouton" value="Enregistrer" />
	</div>
</form>
</div>

<?

//affichage du footer
include("theme/footer.php");

?>

Zerion Mini Shell 1.0