Source for file mod.php
Documentation is available at mod.php
* @package linea21.modules
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
//////////// Check Inclusion de pages ////////////
include_once("../lib/lib_common.php");
//////////// Check Droits utilisateur ////////////
if (isset ($_GET['id'])) $id= $_GET['id'];
if (isset ($_POST['id'])) $id= $_POST['id'];
$layer_tpl_1_2 = 'style="display:none;"';
$layer_tpl_3 = 'style="display:none;"';
if(isset ($_POST['enregistrer'])) {
include_once('../class/system/class.upload.php');
$result= $news_object->ModifyNews($id, $data_table, $sql_object);
if(isset ($visual_uri[0])) $result_rename= $upload_object->Archivefile('../'. $visual_uri[0]);
if(isset ($visual_uri[1])) $result_rename= $upload_object->Archivefile('../'. $visual_uri[1]);
$link_confirm= "confirm.php?rub=". $rub. "&todo=". $todo;
if($result) header("Location: ". $link_confirm);
// Titre de l'actu en cours de modification
$result= $sql_object->DBSelect($requete);
if($result== 0 || count($result)!= 1) exit;
else $news_current_title= formatText($result[0]['news_title'],'2HTML');
// Obtention des données de la BDD
$result= $sql_object->DBSelect($req_det);
if($result== 0 || count($result)!= 1) exit;
$form_title= formatText($result[0]['news_title'], '2FIELD');
$form_header= formatText($result[0]['news_header'], '2FIELD');
$form_body= formatText($result[0]['news_body'], '2FIELD');
$form_theme= $result[0]['news_theme'];
$form_scale= $result[0]['news_scale'];
$form_level= $result[0]['news_level'];
$form_template= $result[0]['news_template'];
$current_template= $form_template;
$form_statut= $result[0]['news_statut'];
$current_statut= $result[0]['news_statut'];
$news_owner = $result[0]['news_posted_by'];
//////////// Check Droits utilisateur ////////////
$news_photouri= urlencode($result[0]['news_photo_uri']);
$reca_visual= "<dl class=\"dl_mod\">\n";
$reca_visual.= "<dt>". $GLOBALS['lang']['news']['photouri']. ": </dt>\n";
$reca_visual.= "<dd>". $GLOBALS['lang']['divers']['none']. "</dd>\n";
$complete_uri= '../'. $visual[0];
$reca_visual.= "<dd> </dd>\n";
$reca_visual.= "<dt> .". $GLOBALS['lang']['news']['visu1']. ": </dt>\n";
$complete_uri= '../'. $visual[1];
$reca_visual.= "<dt> .". $GLOBALS['lang']['news']['visu2']. ": </dt>\n";
if(isset ($_POST['valider'])) {
$table[0]= $_POST['news_title'];
$table[1]= $_POST['news_header'];
$table[2]= $_POST['news_body'];
$table[3]= $_POST['news_theme'];
$table[4]= $_POST['news_scale'];
$table[5]= $_POST['news_level'];
$table[6]= $_POST['news_template'];
$news_photo_uri= urldecode($_POST['news_photouri']);
$table[7]= $news_photo_uri;
$table[8]= $_POST['news_statut'];
$table[9]= $current_statut; // statut courant
$current_template= urldecode($_POST['current_template']);
$integrity= $news_object->CheckDataIntegrity($table);
// si changement de template
if($_POST['news_template']!= $current_template) {
if(($_POST['news_template']== 1 && $current_template== 2) || ($_POST['news_template']== 2 && $current_template== 1)) {
$table[7]= urldecode($_POST['news_photouri']);
if($_POST['news_template']== 4) {
if(($_POST['news_template']== 1 || $_POST['news_template']== 2) && (!isset ($_FILES['news_visuel1']) || $_FILES['news_visuel1']['name']== '')) $template_integrity= $GLOBALS['lang']['news']['no_visu1'];
if(((!isset ($_FILES['news_visuel1']) || $_FILES['news_visuel1']['name']== '') || (!isset ($_FILES['news_visuel2']) || $_FILES['news_visuel2']['name']== '')) && $_POST['news_template']== 3) $template_integrity= $GLOBALS['lang']['news']['no_visu2'];
} else $template_integrity= 1;
if($template_integrity!= 1 && !is_string($integrity)) $integrity= $template_integrity;
if ($_POST['news_template'] != 4 && (isset ($_FILES['news_visuel1']) && $_FILES['news_visuel1']['name']!= '')) {
include_once('../class/system/class.upload.php');
include_once('../class/system/class.image.php');
$image_object = new image;
$upload1 = $_FILES['news_visuel1'];
$size_integrity= $upload_object->CheckMaxFile($upload1['size'], $news_object->UPLOAD_MAX_MO);
if(is_string($size_integrity)) $integrity= $size_integrity;
$format_integrity= $upload_object->CheckExtImage($upload1['name']);
if(is_string($format_integrity)) $integrity= $format_integrity;
if($_POST['news_template'] == 3 && (isset ($_FILES['news_visuel2']) && $_FILES['news_visuel2']['name']!= '')) {
$upload2 = $_FILES['news_visuel2'];
$size_integrity= $upload_object->CheckMaxFile($upload2['size'], $news_object->UPLOAD_MAX_MO);
if(is_string($size_integrity)) $integrity= $size_integrity;
$format_integrity= $upload_object->CheckExtImage($upload2['name']);
if(is_string($format_integrity)) $integrity= $format_integrity;
$destination= "../". $news_object->URI_INPUT. $dir_name;
$bdd_name= "1.". $upload_object->GetExtension($upload1['name']);
$final_name= 'temp_'. $bdd_name;
$visual_link1= $destination. $final_name;
$table[7]= $news_object->URI_INPUT. $dir_name. $bdd_name;
$result_upload= $upload_object->UploadFile($upload1, $final_name, $destination);
$image_object->ThumbCreate($destination. $final_name, $min_name , $news_object->MAX_PHOTO_MIN_WIDTH);
// on retaille l'original au besoin.
if(PHOTO_RESIZE== true && ExcedMaxSize($destination. $final_name, $news_object->MAX_PHOTO_MAX_WIDTH)) {
$image_object->ThumbCreate($destination. $final_name, $destination. $final_name , $news_object->MAX_PHOTO_MAX_WIDTH);
// préparation de l'affichage de la miniature
if($_POST['news_template'] == 3) {
$bdd_name= "2.". $upload_object->GetExtension($upload1['name']);
$final_name= 'temp_'. $bdd_name;
$visual_link2= $destination. $final_name;
$table[7] .= '|'. $news_object->URI_INPUT. $dir_name. $bdd_name;
$result_upload= $upload_object->UploadFile($upload2, $final_name, $destination);
$image_object->ThumbCreate($destination. $final_name, $min_name , $news_object->MAX_PHOTO_MIN_WIDTH);
// on retaille l'original au besoin.
if(PHOTO_RESIZE== true && ExcedMaxSize($destination. $final_name, $news_object->MAX_PHOTO_MAX_WIDTH)) {
$image_object->ThumbCreate($destination. $final_name, $destination. $final_name , $news_object->MAX_PHOTO_MAX_WIDTH);
// préparation de l'affichage de la miniature
if(is_string($integrity)) $text_format= '2FIELD';
else $text_format= '2HTML';
$form_title= formatText($_POST['news_title'],$text_format);
$form_header= formatText($_POST['news_header'], $text_format);
$form_body= formatText($_POST['news_body'], $text_format);
$form_theme= $_POST['news_theme'];
$form_scale= $_POST['news_scale'];
$form_level= $_POST['news_level'];
$form_template= $_POST['news_template'];
$form_statut= $_POST['news_statut'];
if($_POST['news_template']== 1) $mask_template_1= " selected=\"selected\"";
if($_POST['news_template']== 2) $mask_template_2= " selected=\"selected\"";
if($_POST['news_template']== 3) {
$mask_template_3= " selected=\"selected\"";
$layer_tpl_3 = "style=\"display:block;\"";
if($_POST['news_template']== 4) {
$mask_template_4= " selected=\"selected\"";
$layer_tpl_1_2 = "style=\"display:none;\"";
if($_POST['news_statut']== 'D') $mask_statut_D= "checked=\"checked\""; else $mask_statut_D= '';
if($_POST['news_statut']== 'P') $mask_statut_P= "checked=\"checked\""; else $mask_statut_P= '';
include_once("../lib/input_helpers.php");
$data= $sql_object->DBSelect($req_list_theme);
// select-box des échelles
$data= $sql_object->DBSelect($req_list_scale);
// select-box des niveaux
$data= $sql_object->DBSelect($req_list_level);
if($form_template== 1) $mask_template_1= ' selected="selected"';
if($form_template== 2) $mask_template_2= ' selected="selected"';
if($form_template== 3) $mask_template_3= ' selected="selected"';
if($form_template== 4) $mask_template_4= ' selected="selected"';
$select_template= "<select name=\"news_template\" id=\"news_template\" onchange=\"ShowFilesLayer(this.value, 'news')\">\n";
$select_template.= "<option value=\"1\"". $mask_template_1. ">". $news_object->GetTemplateName(1). "</option>\n";
$select_template.= "<option value=\"2\"". $mask_template_2. ">". $news_object->GetTemplateName(2). "</option>\n";
$select_template.= "<option value=\"3\"". $mask_template_3. ">". $news_object->GetTemplateName(3). "</option>\n";
$select_template.= "<option value=\"4\"". $mask_template_4. ">". $news_object->GetTemplateName(4). "</option>\n";
$select_template.= "</select>\n";
if($form_statut== 'P') $mask_archive_P= ' selected="selected"';
if($form_statut== 'D') $mask_archive_D= ' selected="selected"';
if($form_statut== 'AA') $mask_archive_AA= ' selected="selected"';
if($form_statut== 'PA') $mask_archive_PA= ' selected="selected"';
$select_statut= "<select name=\"news_statut\" id=\"news_statut\">\n";
$select_statut.= "<option value=\"P\"". $mask_archive_P. ">". display_statut('P'). "</option>\n";
$select_statut.= "<option value=\"D\"". $mask_archive_D. ">". display_statut('D'). "</option>\n";
$select_statut.= "<option value=\"AA\"". $mask_archive_AA. ">". display_statut('AA'). "</option>\n";
$select_statut.= "<option value=\"PA\"". $mask_archive_PA. ">". display_statut('PA'). "</option>\n";
$select_statut.= "</select>\n";
// Préparation affichage des layers Upload
$layer_tpl_1_2 = 'style="display:block;"';
if($form_template== 3) $layer_tpl_3 = 'style="display:block;"';
<a href="index.php"> <? echo $GLOBALS['lang']['way']['home']; ?></a>
<a href=" <?php echo $rub_link; ?>"> <? echo $GLOBALS['lang']['menu']['news'];?></a>
<span> <? echo formatNavTitle($GLOBALS['lang']['news']['mod']. ' : '. $news_current_title); ?></span>
include_once("quickicons.php");
if(!isset ($integrity) || is_string($integrity)) {
<div class="contentcontainer">
include_once($dir. "/menurub.php");
<form id="modnews" action=" <?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post" enctype="multipart/form-data">
<label for="news_title"> <? echo $GLOBALS['lang']['news']['title']; ?> : *</label>
<input name="news_title" type="text" class="textfield" maxlength="200" id="news_title" value=" <?php echo $form_title; ?>" />
<label for="news_header"> <? echo $GLOBALS['lang']['news']['header']; ?> : *</label>
<textarea id="news_header" name="news_header" class="largetextfield" <?php echo AREA_SETTINGS; ?>> <?php echo $form_header; ?></textarea>
<label for="news_body"> <? echo $GLOBALS['lang']['news']['body']; ?> : *</label>
<textarea id="news_body" name="news_body" class="largetextfield" <?php echo AREA_SETTINGS; ?>> <?php echo $form_body; ?></textarea>
<label for="news_theme" > <? echo $GLOBALS['lang']['news']['theme']; ?> : *</label>
<?php echo $select_theme; ?>
<label for="news_scale" > <? echo $GLOBALS['lang']['news']['scale']; ?> : *</label>
<?php echo $select_scale; ?>
<label for="news_level" > <? echo $GLOBALS['lang']['news']['level']; ?> : *</label>
<?php echo $select_level; ?>
<label for="news_template" > <? echo $GLOBALS['lang']['news']['template']; ?> : </label>
<?php echo $select_template; ?>
<?php echo $reca_visual; ?>
<p id="layervisuel1" <?php echo $layer_tpl_1_2; ?>>
<label for="news_visuel1"> <?php echo $GLOBALS['lang']['news']['visu1']; ?></label>
<input name="news_visuel1" type="file" size="47" id="news_visuel1" class="file" value="" /><br /><br />
<p id="layervisuel2" <?php echo $layer_tpl_3; ?>>
<label for="news_visuel2"> <?php echo $GLOBALS['lang']['news']['visu2']; ?></label>
<input name="news_visuel2" type="file" size="47" id="news_visuel2" class="file" /><br /><br />
<label for="news_statut" > <? echo $GLOBALS['lang']['news']['statut']; ?> : </label>
<?php echo $select_statut; ?>
<input name="id" type="hidden" value=" <?php echo $id; ?>" id="id" />
<input name="news_photouri" type="hidden" value=" <?php echo $news_photouri; ?>" id="news_photouri" />
<input name="current_template" type="hidden" value=" <?php echo $current_template; ?>" id="current_template" />
<input name="rub" type="hidden" value=" <?php echo $rub; ?>" id="rub" />
<input name="todo" type="hidden" value=" <?php echo $todo; ?>" id="todo" />
<input name="valider" type="submit" value=" <? echo $GLOBALS['lang']['btn']['valid']; ?>" class="button" id="valider" />
<?php include_once($dir. "/help.php"); ?>
$result= $sql_object->DBSelect($requete);
if($result== 0 || count($result)!= 1) exit;
else $theme_denomination= formatText($result[0]['theme_name']);
$result= $sql_object->DBSelect($requete);
if($result== 0 || count($result)!= 1) exit;
else $scale_denomination= formatText($result[0]['scale_denomination']);
$result= $sql_object->DBSelect($requete);
if($result== 0 || count($result)!= 1) exit;
else $level_denomination= formatText($result[0]['level_name']);
if(empty($form_header)) $display_form_header= $GLOBALS['lang']['news']['recap_nc'];
else $display_form_header= formatText($form_header);
if(isset ($visual_link1)) {
$reca_visual= "<dt>". $GLOBALS['lang']['news']['photouri']. "</dt>\n";
$reca_visual.= "<dd> </dd>\n";
$reca_visual.= "<dt>". $GLOBALS['lang']['news']['visu1']. " :</dt>\n";
$reca_visual.= "<dd>". $visual_link1. "</dd>\n";
if(isset ($visual_link2)) {
$reca_visual.= "<dt>". $GLOBALS['lang']['news']['visu2']. " :</dt>\n";
$reca_visual.= "<dd>". $visual_link2. "</dd>\n";
<div class="contentcontainer">
include_once($dir. "/menurub.php");
<h2> <? echo formatTitleh2($GLOBALS['lang']['recap']['title']); ?></h2>
echo "<dl class=\"dl3\">\n";
echo "<dt>". $GLOBALS['lang']['news']['title']. "</dt>\n";
echo "<dd>". $form_title. "</dd>\n";
echo "<dt>". $GLOBALS['lang']['news']['header']. "</dt>\n";
echo "<dt>". $GLOBALS['lang']['news']['body']. " :</dt>\n";
echo "<dt>". $GLOBALS['lang']['news']['theme']. " :</dt>\n";
echo "<dd>". $theme_denomination. "</dd>\n";
echo "<dt>". $GLOBALS['lang']['news']['scale']. " :</dt>\n";
echo "<dd>". $scale_denomination. "</dd>\n";
echo "<dt>". $GLOBALS['lang']['news']['level']. " :</dt>\n";
echo "<dd>". $level_denomination. "</dd>\n";
echo "<dt>". $GLOBALS['lang']['news']['template']. " :</dt>\n";
echo "<dd>". $news_object->GetTemplateName($form_template). "</dd>\n";
echo "<dt>". $GLOBALS['lang']['divers']['statut'] . "</dt>\n";
<br style="clear:both" />
<form id="modscale" action=" <?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<input name="id" type="hidden" value=" <?php echo $id; ?>" id="id" />
<input name="rub" type="hidden" value=" <?php echo $rub; ?>" id="rub" />
<input name="todo" type="hidden" value=" <?php echo $todo; ?>" id="todo" />
<input name="data_table" type="hidden" value=" <?php echo $table; ?>" id="data_table" />
<input name="retour" type="button" value=" <? echo $GLOBALS['lang']['btn']['preview']; ?>" class="button" id="retour" onclick="history.go(-1);" />
<input name="enregistrer" type="submit" value=" <? echo $GLOBALS['lang']['btn']['save']; ?>" class="button" id="valider" />
<?php include_once($dir. "/help.php"); ?>
|