linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file mod.php

Documentation is available at mod.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage content
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Content' module is used by 'Publication' and 'Workshop' modules
  10.  */
  11.  
  12. //////////// Check Inclusion de pages ////////////
  13. if (!function_exists('AuthenthificationProcess')) {
  14.   include_once("../lib/lib_common.php");
  15.   ReloadIndex('admin');
  16. }
  17. ////////////
  18.  
  19. if(isset($_POST['id']))    $id=$_POST['id'];
  20. if(isset($_GET['id']))    $id=$_GET['id'];
  21. $complete_type=strtoupper($mod_inc);
  22.  
  23. $contents_object new contents;
  24.  
  25. $mask_template=array_fill(13'');
  26. $layer_tpl_1 "style=\"display:block;\"";
  27.  
  28. if($type=='P'{
  29.   $requeteSQL_getOnePublicationParts($id);
  30.   $result=$sql_object->DBSelect($requete);
  31.   $form_title=formatText($result[0]['publicon_title'],'2FIELD');
  32.   $form_body=formatText($result[0]['publicon_body'],'2FIELD');
  33.   $current_template=$result[0]['publicon_template'];
  34.   $form_visual=$result[0]['publicon_photos_uri'];
  35.   $reca_visual="<dl class=\"dl_mod\">\n";
  36.   $reca_visual.="<dt>"._t('contents','visu1').": </dt>\n";
  37.   if(empty($result[0]['publicon_photos_uri'])) {
  38.     $reca_visual.="<dd>"._t('divers','none')."</dd>\n";
  39.     $reca_visual2=_t('divers','none');
  40.   else {
  41.     $complete_uri='../'.$result[0]['publicon_photos_uri'];
  42.     list($width$height$type_img$attrgetimagesize($complete_uri);
  43.     $reca_visual.='<dd>'.EnlargeImage($complete_uri)."</dd>\n";
  44.     $reca_visual2=EnlargeImage($complete_uri);
  45.   }
  46.   $reca_visual.="</dl>\n";
  47.   if(!isset($_POST['valider'])) $mask_template[$current_template]=' selected="selected"';
  48.   if(!isset($_POST['valider']&& $result[0]['publicon_template']==3$layer_tpl_1 "style=\"display:none;\"";
  49. }
  50. if($type=='W'{
  51.   $requeteSQL_getOneWorkshopParts($id);
  52.   $result=$sql_object->DBSelect($requete);
  53.   $form_title=formatText($result[0]['workrepcon_title']'2FIELD');
  54.   $form_body=formatText($result[0]['workrepcon_body']'2FIELD');
  55. }
  56.  
  57.  
  58.  
  59. if(isset($_POST['enregistrer'])) {
  60.   include_once('../class/system/class.upload.php');
  61.   $upload_objectnew upload;
  62.   $data_table=unserialize(urldecode($_POST['data_table']));
  63.   $result=$contents_object->ModifyContents($id$data_table$complete_type$sql_object);
  64.   if(isset($data_table[3])) $result_rename=$upload_object->Archivefile('../'.$data_table[3]);
  65.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&type=".$type."&id=".$parent;
  66.   if($resultheader("Location: ".$link_confirm);
  67.   else  system_error();
  68. }
  69.  
  70. if(isset($_POST['valider'])) {
  71.   $table[0]=$_POST['part_title'];
  72.   $table[1]=$_POST['part_body'];
  73.  
  74.   $integrity=$contents_object->CheckDataIntegrity($table,$type);
  75.  
  76.   if($type=='P'{
  77.     $table[2]=$_POST['part_template'];
  78.     $table[3]=isset($_FILES['visuel1']['name']$_FILES['visuel1']['name''' ;
  79.     if(!is_string($integrity&& $_POST['current_template']==&& ($_POST['part_template']==|| $_POST['part_template']==&& (!isset($_FILES['visuel1']|| $_FILES['visuel1']['name']=='' )) $integrity=_t('contents','no_visu1');
  80.         
  81.     if(!is_string($integrity)) {
  82.       if($_POST['part_template']!=&& isset($_FILES['visuel1']['name']&& $_FILES['visuel1']['name']!=''{
  83.         include_once('../class/system/class.upload.php');
  84.         include_once('../class/system/class.image.php');
  85.         $image_object new image;
  86.         $upload_object new upload;
  87.         $upload1 $_FILES['visuel1'];
  88.         $size_integrity=$upload_object->CheckMaxFile($upload1['size']$contents_object->P_UPLOAD_MAX_MO);
  89.         if(is_string($size_integrity)) $integrity=$size_integrity;
  90.         $format_integrity=$upload_object->CheckExtImage($upload1['name']);
  91.         if(is_string($format_integrity)) $integrity=$format_integrity;
  92.  
  93.         if(!is_string($integrity)) {
  94.           $file_name=$id;
  95.           $destination="../".$contents_object->P_URI_INPUT;
  96.           $bdd_name=$file_name.".".$upload_object->GetExtension($upload1['name']);
  97.           $final_name='temp_'.$bdd_name;
  98.           $visual_link1=$destination.$final_name;
  99.           $table[3]=$contents_object->P_URI_INPUT.$bdd_name;
  100.  
  101.           $result_upload=$upload_object->UploadFile($upload1$final_name$destination);
  102.  
  103.           // création des thumbs
  104.           $min_name=get_min_name($destination.$final_name);
  105.           $image_object->ThumbCreate($destination.$final_name$min_name $contents_object->P_MAX_PHOTO_MIN_WIDTH);
  106.  
  107.           // on retaille l'original au besoin.
  108.           if(PHOTO_RESIZE==true && ExcedMaxSize($destination.$final_name$contents_object->P_MAX_PHOTO_MAX_WIDTH)) {
  109.             $image_object->ThumbCreate($destination.$final_name$destination.$final_name $contents_object->P_MAX_PHOTO_MAX_WIDTH);
  110.           }
  111.  
  112.           // préparation de l'affichage de la miniature
  113.           $visual_link1=EnlargeImage($visual_link1);
  114.  
  115.         }
  116.       else {
  117.         if($_POST['part_template']!=3$table[3]=$result[0]['publicon_photos_uri'];
  118.         else $table[3]='';
  119.       }
  120.     }
  121.   }
  122.  
  123.  
  124.   if(is_string($integrity)) {
  125.     $text_format='2FIELD';
  126.   else {
  127.     $text_format='2HTML';
  128.   }
  129.   $form_title=formatText($_POST['part_title']$text_format);
  130.   $form_body=formatText($_POST['part_body']$text_format);
  131.   if($type=='P'{
  132.     $mask_template[$_POST['part_template']]=' selected="selected"';
  133.     if($_POST['part_template']==3$layer_tpl_1 "style=\"display:none;\"";
  134.   }
  135.  
  136.   $table=urlencode(serialize($table));
  137. }
  138.  
  139. if($type=='P'{
  140.   $requeteSQL_getPublicationTitle($parent);
  141.   $result=$sql_object->DBSelect($requete);
  142.   $current_title=FormatText($result[0]['publi_title']'2HTML');
  143.   $current_owner=$result[0]['publi_posted_by'];
  144.  
  145.   //////////// Check Droits utilisateur ////////////
  146.   if (GetSessionElement('id')!=$current_owner && !IsSuperAdmin()) ReloadIndex('admin');
  147.   ///////////
  148.  
  149.  
  150.   // select-box Templates
  151.   $select_template="<select name=\"part_template\" id=\"part_template\" onchange=\"ShowFilesLayer(this.value, 'contents')\">\n";
  152.   $select_template.="<option value=\"1\"".$mask_template[1].">".$contents_object->GetTemplateName(1)."</option>\n";
  153.   $select_template.="<option value=\"2\"".$mask_template[2].">".$contents_object->GetTemplateName(2)."</option>\n";
  154.   $select_template.="<option value=\"3\"".$mask_template[3].">".$contents_object->GetTemplateName(3)."</option>\n";
  155.   $select_template.="</select>\n";
  156. }
  157. if($type=='W'{
  158.   $requeteSQL_getWorkshopRepTitleAndGroup($parent);
  159.   $result=$sql_object->DBSelect($requete);
  160.   $current_title=FormatText($result[0]['workrep_title'].' ('.$result[0]['workshop_denomination'].').''2HTML');
  161.   $current_workshop_id=$result[0]['workrep_workshop_id'];
  162.  
  163.   //////////// Check Droits utilisateur ////////////
  164.   if (!AuthUser4Workshop($current_workshop_id$sql_object&& !IsSuperAdmin()) ReloadIndex('admin');
  165.   ///////////
  166.  
  167. }
  168. ?>
  169. <div id="chemin">
  170. <ul>
  171.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a>
  172.     </li>
  173.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  174.         class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  175.     <li><span><?php echo formatNavTitle(_t('contents',$mod_inc.'_type')." : "$current_title)?></span>
  176.     </li>
  177. </ul>
  178. </div>
  179. <!--end barre haute -->
  180. <?php
  181. include_once(THEME_ADMIN_PATH."quickicons.php");
  182. ?>
  183.  
  184. <?php
  185. if(!isset($integrity|| is_string($integrity)) {
  186.   ?>
  187. <div class="contentcontainer"><?php
  188. include_once($dir."/menurub.php");
  189. ?>
  190. <div id="content"><?php
  191. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  192. ?>
  193. <h2><?php echo formatTitleh2($current_title)?></h2>
  194. <form id="modpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  195.     method="post" enctype="multipart/form-data">
  196. <p><label for="part_title"><?php echo _t('contents','title')?> : *</label>
  197. <input name="part_title" type="text" class="textfield" id="part_title"
  198.     maxlength="200" value="<?php echo $form_title?>" /></p>
  199. <p><label for="part_body"><?php echo _t('contents','body')?> : *</label>
  200. <textarea id="part_body" name="part_body" class="largetextfield"
  201. <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea></p>
  202.  
  203. <?php  if($type=='P'?>
  204. <p><label for="part_template"><?php echo _t('contents','template')?> :
  205. *</label> <?php echo $select_template?></p>
  206. <p id="layervisuel1" <?php echo $layer_tpl_1?>><label for="visuel1"><?php echo _t('contents','visu1')?></label>
  207. <input name="visuel1" type="file" size="47" id="visuel1" class="file" />
  208. </p>
  209. <?php echo $reca_visual?> <?php ?> <br />
  210. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  211. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  212. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  213. <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  214. <input name="parent" type="hidden" value="<?php echo $parent?>"
  215.     id="parent" /> <input name="current_template" type="hidden"
  216.     value="<?php echo $current_template?>" id="current_template" /> <?php echo cancel_button($cancel_link)?>
  217. <input name="valider" type="submit"
  218.     value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  219. </div>
  220. </form>
  221. </div>
  222. <?php include_once($dir."/help.php")?></div>
  223. <?php
  224. // Récapitulatif
  225. else    {
  226.  
  227.   if($type=='P'{
  228.     if($_POST['part_template']==3{
  229.       $display_visual=_t('divers','none');
  230.     else {
  231.       if(isset($visual_link1)) $display_visual=$visual_link1;
  232.       else $display_visual=$reca_visual2;
  233.     }
  234.     $display_template_choice=$contents_object->GetTemplateName($_POST['part_template']);
  235.   }
  236.  
  237.   ?>
  238. <div class="contentcontainer"><?php
  239. include_once($dir."/menurub.php");
  240. ?>
  241. <div id="content">
  242. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  243. <?php
  244. echo "<dl class=\"dl3\">\n";
  245. echo "<dt>"._t('contents','title')."</dt>\n";
  246. echo "<dd>".$form_title."</dd>\n";
  247. echo "<dt>"._t('contents','body')."</dt>\n";
  248. echo "<dd>".linkin_content($form_body)."</dd>\n";
  249. if($type=='P'{
  250.   echo "<dt>"._t('contents','template')."</dt>\n";
  251.   echo "<dd>".$display_template_choice."</dd>\n";
  252.   echo "<dt>"._t('contents','visu1')."</dt>\n";
  253.   echo "<dd>".$display_visual."</dd>\n";
  254. }
  255. echo "</dl>\n";
  256. ?> <br style="clear: both" />
  257. <form id="modpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  258.     method="post">
  259. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  260. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  261. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  262. <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  263. <input name="parent" type="hidden" value="<?php echo $parent?>"
  264.     id="parent" /> <input name="data_table" type="hidden"
  265.     value="<?php echo $table?>" id="data_table" /> <?php echo cancel_button($cancel_link)?>
  266. <input name="retour" type="button"
  267.     value="<?php echo _t('btn','preview'?>" class="button" id="retour"
  268.     onclick="history.go(-1);" /> <input name="enregistrer" type="submit"
  269.     value="<?php echo _t('btn','save'?>" class="button" id="valider" /></div>
  270. </form>
  271. </div>
  272. <?php include_once($dir."/help.php")?></div>
  273. <?php
  274. }
  275. ?>

Documentation generated on Fri, 01 Apr 2011 09:33:17 +0200 by phpDocumentor 1.4.1