%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-ajouter_bloc.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['page']);
verif_get($_GET['type']);
verif_co_sec($section->page_sec($_GET['page']));
$page = new Page();


$db = new BaseOps;

if($_GET['type'] == 5) {
	$_POST['post'] = 1;
	$_POST['type'] = 5;
	$_POST['valide'] = 1;
	$_POST['page'] = $_GET['page'];
}

if(isset($_POST['post']) && $_POST['post'] == 1)
{
	verif_co_sec($section->page_sec($_POST['page']));
	$erreur1 = "ok";
	$erreur2 = "ok";
	if($_POST['type'] == 1 || $_POST['type'] == 2 || $_POST['type'] == 3)
	{
		if (verif_lang(1)) {
			if($erreur1 == "ok") $erreur1 = $db->verif($_POST['texte_fr'], "Le texte", false, false, 1);
		}
		if (verif_lang(2)) {
			if($erreur2 == "ok") $erreur2 = $db->verif($_POST['texte_en'], "Text", false, false, 2);
		}
	}
	if($_POST['type'] == 2 || $_POST['type'] == 3 || $_POST['type'] == 4)
	{
		if (verif_lang(1)) {
			if($erreur1 == "ok") $erreur1 = $db->verif($_POST['photo'], "La photo", false, false, 1);
		}
		else{
			if($erreur2 == "ok") $erreur2 = $db->verif($_POST['photo'], "Picture", false, false, 2);
		}
		
	}
	if($_POST['type'] == 6)
	{
		if (verif_lang(1)) {
			if($erreur1 == "ok") $erreur1 = $db->verif($_POST['bouton'], "Le lien bouton", false, false, 1);
		}
		else{
			if($erreur2 == "ok") $erreur2 = $db->verif($_POST['bouton'], "Button link", false, false, 2);
		}
		if (verif_lang(1)) {
			if($erreur1 == "ok") $erreur1 = $db->verif($_POST['bouton_fr'], "Le bouton", false, false, 1);
		}
		if (verif_lang(2)) {
			if($erreur2 == "ok") $erreur2 = $db->verif($_POST['bouton_en'], "The button", false, false, 2);
		}
	}
	if($_POST['type'] == 7)
	{
		if (verif_lang(1)) {
			if($erreur1 == "ok") $erreur1 = $db->verif($_POST['soustitre_fr'], "Le sous-titre", false, false, 1);
		}
		if (verif_lang(2)) {
			if($erreur2 == "ok") $erreur2 = $db->verif($_POST['soustitre_en'], "Subtitle", false, false, 2);
		}
	}
	if($erreur1 == "ok" && $erreur2 == "ok")
	{
		//Photo
		if($_POST['photo'] != null) $_POST['photo'] = photo_move($_POST['photo']);
		
		//Bloc
		$next_ordre = $db->next_ordre("bloc", "page = ".$_POST['page']);
		$next_id = $db->next_id("bloc");
		$values = array(
			"id" => $next_id,
			"page" => $_POST['page'],
			"ordre" => $next_ordre,
			"type" => $_POST['type'],
			"photo" => $_POST['photo'],
			"taillephoto" => $_POST['taillephoto'],
			"valide" => $_POST['valide'],
			"bouton" => $_POST['bouton'] );
		$db->insert("bloc", $values);
		
		if (verif_lang(1)) {
			//Bloc_fr
			$values = array (
				"bloc" => $next_id,
				"lang" => 1,
				"texte" => $_POST['texte_fr'],
				"soustitre" => $_POST['soustitre_fr'],
				"bouton" => $_POST['bouton_fr'] );
			$db->insert("bloc_lang", $values);
			
			// si on est en français et pas admin
			if(!estadmin()){
				$values = array (
					"bloc" => $next_id,
					"lang" => 2,
					"texte" => $_POST['texte_fr'],
					"soustitre" => $_POST['soustitre_fr'],
					"bouton" => $_POST['bouton_fr'] );
				$db->insert("bloc_lang", $values);
			}
		}
		if (verif_lang(2)) {
			//Bloc_en
			$values = array (
				"bloc" => $next_id,
				"lang" => 2,
				"texte" => $_POST['texte_en'],
				"soustitre" => $_POST['soustitre_en'],
				"bouton" => $_POST['bouton_en'] );
			$db->insert("bloc_lang", $values);
		
		
			// si on est en anglais et pas admin
			if(!estadmin()){
				$values = array (
					"bloc" => $next_id,
					"lang" => 1,
					"texte" => $_POST['texte_en'],
					"soustitre" => $_POST['soustitre_en'],
					"bouton" => $_POST['bouton_en'] );
				$db->insert("bloc_lang", $values);
			}
		}
		
		if($_POST['type'] == 1 || $_POST['type'] == 2 || $_POST['type'] == 3 || $_POST['type'] == 7){
			if(!estadmin()){
				$where="id=".$_POST['page'];
				$values = array(
					"valide" => 0
				);
					
				$db->update("page", $values,$where);

			}
		}
		
		header("Location:modifier_page.php?id=".$_POST['page']."&msg=yes");
	}
	else {
		$err = true;
	}
}

//affichage du html
include("theme/html.php");
//affichage des metas
include("theme/meta.php");
echo "\n<title>".$admtext->getText("add_bloc",$_SESSION['lang'])." - ".$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><?=$admtext->getText("add_bloc",$_SESSION['lang'])?></h2>
<ul class="sousmenuadmin">
	<li>
		<a href="admin/modifier_page.php?id=<?php echo $_GET['page']; ?>"><?=$admtext->getText("return_activity",$_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>";
}
$next_id = $db->next_id("bloc");
?>
<form action="admin/ajouter_bloc.php?page=<?php echo $_GET['page']; ?>&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) { ?>
		<?if (estadmin()) : ?>
			<tr>
				<td class="label"></td>
				<td class="field head">Français</td>
				<td class="field head">Anglais</td>
			</tr>
		<? endif; ?>
<?php } ?>
		<input type="hidden" name="page" value="<?php echo $_GET['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>
			<?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>
<?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">'.$_POST['photo'].'</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'] == 700) echo 'selected="selected"'; ?> value="700"><?=$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>
			<?if(verif_lang(1)):?><td class="field"><input type="text" name="bouton_fr" value="<?php echo $_POST['bouton_fr']; ?>" /></td><?endif;?>
			<?if(verif_lang(2)):?><td class="field"><input type="text" name="bouton_en" value="<?php echo $_POST['bouton_en']; ?>" /></td><?endif;?>
		</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>
			<?if(verif_lang(1)):?><td class="field"><input type="text" name="soustitre_fr" value="<?php echo $_POST['soustitre_fr']; ?>" /></td><?endif;?>
			<?if(verif_lang(2)):?><td class="field"><input type="text" name="soustitre_en" value="<?php echo $_POST['soustitre_en']; ?>" /></td><?endif;?>
		</tr>

<?php } if($_GET['type'] == 8) {
if(!file_exists("uploads/bloc".$next_id)) mkdir("uploads/bloc".$next_id, 0755, true);
 ?>
		<tr>
			<td class="label top"><?=$admtext->getText("add_files",$_SESSION['lang'])?> <span class="etoile">*</span></td>
			<td class="field"><input type="file" name="file_docs" id="file_docs" /></td>
			<td class="field"><input type="hidden" id="file_folder" value="bloc<?php echo $next_id; ?>" /></td>
		</tr>
<?php } ?>
		<? if($_GET['type']==1 || $_GET['type']==2 || $_GET['type']==3 || $_GET['type']==7):?>
			<?if(estadmin()):?>
				<tr>
					<td class="label">Valide (mettre sur non si il manque encore des traductions pour ce bloc)</td>
					<td class="field"><input type="radio" name="valide" value="1" checked="checked" /> Oui</td>
					<td class="field"><input type="radio" name="valide" value="0" /> Non</td>
				</tr>
			<? else : ?>
				<input type="hidden" name="valide" value="0" />
			<? 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("create_bloc",$_SESSION['lang'])?>" />
	</div>
</form>
</div>

<?

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

?>

Zerion Mini Shell 1.0