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

Source for file mod_link.php

Documentation is available at mod_link.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage resources
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Resource' 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.  
  22. if($type=='P'{
  23.   $requeteSQL_getPublicationTitle($parent);
  24.   $result=$sql_object->DBSelect($requete);
  25.   $current_title=FormatText($result[0]['publi_title']'2HTML');
  26.   $publi_owner=$result[0]['publi_posted_by'];
  27.  
  28.   //////////// Check Droits utilisateur ////////////
  29.   if (!hasRight('publication')) ReloadIndex('admin');
  30.   if (GetSessionElement('id')!=$publi_owner && !IsSuperAdmin()) ReloadIndex('admin');
  31.   ///////////
  32. }
  33. if($type=='W'{
  34.   $requeteSQL_getWorkshopRepTitleAndGroup($parent);
  35.   $result=$sql_object->DBSelect($requete);
  36.   $current_title=FormatText($result[0]['workrep_title'].' ('.$result[0]['workshop_denomination'].')''2HTML');
  37.   $workshop_id=$result[0]['workrep_workshop_id'];
  38.  
  39.   //////////// Check Droits utilisateur ////////////
  40.   if (!hasRight('workshop')) ReloadIndex('admin');
  41.   if (!AuthUser4Workshop($workshop_id$sql_object&& !IsSuperAdmin()) ReloadIndex('admin');
  42.   ///////////
  43. }
  44.  
  45. $resources_objectnew resources;
  46.  
  47. if(isset($_POST['enregistrer'])) {
  48.   $data_table=unserialize(urldecode($_POST['data_table']));
  49.   $result=$resources_object->ModifyLinkRes($id$data_table$sql_object);
  50.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&type=".$type."&id=".$parent;
  51.   if($resultheader("Location: ".$link_confirm);
  52.   else  system_error();
  53. }
  54.  
  55. if(isset($_POST['valider'])) {
  56.   $table[0]=$_POST['link_url'];
  57.   $table[1]=$_POST['link_url_mask'];
  58.  
  59.   $integrity=$resources_object->CheckDataIntegrity($table,'LINK');
  60.  
  61.   if(is_string($integrity)) {
  62.     $text_format='2FIELD';
  63.   else {
  64.     $text_format='2HTML';
  65.   }
  66.   $form_url=formatText($_POST['link_url']$text_format);
  67.   $form_url_mask=formatText($_POST['link_url_mask']$text_format);
  68.  
  69.   $table=urlencode(serialize($table));
  70. }
  71.  
  72. if(!isset($_POST['valider'])) {
  73.   $requeteSQL_getLinkInfo($id);
  74.   $result=$sql_object->DBSelect($requete);
  75.   $form_url=formatText($result[0]['linkres_text']'2FIELD');
  76.   $form_url_mask=formatText($result[0]['linkres_mask']'2FIELD');
  77. }
  78. ?>
  79.  
  80. <div id="chemin">
  81. <ul>
  82.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a>
  83.     </li>
  84.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  85.         class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  86.     <li><span><?php echo formatNavTitle(_t('resources',$mod_inc.'_type').' : '$current_title)?></span>
  87.     </li>
  88. </ul>
  89. </div>
  90. <!--end barre haute -->
  91. <?php
  92. include_once(THEME_ADMIN_PATH."quickicons.php");
  93. ?>
  94.  
  95. <?php
  96. if(!isset($integrity|| is_string($integrity)) {
  97.   ?>
  98. <div class="contentcontainer"><?php
  99. include_once($dir."/menurub.php");
  100. ?>
  101. <div id="content"><?php
  102. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  103. ?>
  104. <h2><?php echo formatTitleh2($current_title)?></h2>
  105. <form id="modlink" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  106.     method="post">
  107. <p><label for="link_url"><?php echo _t('resources','url')?> : *</label>
  108. <input name="link_url" type="text" class="textfield" id="link_url"
  109.     maxlength="1000" value="<?php echo $form_url?>" /></p>
  110. <p><label for="link_url_mask"><?php echo _t('resources','url_mask')?>
  111. : </label> <input name="link_url_mask" type="text" class="textfield"
  112.     id="link_url_mask" maxlength="200"
  113.     value="<?php echo $form_url_mask?>" /></p>
  114. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  115. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  116. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  117. <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  118. <input name="parent" type="hidden" value="<?php echo $parent?>"
  119.     id="parent" /> <?php echo cancel_button($cancel_link)?> <input
  120.     name="valider" type="submit" value="<?php echo _t('btn','valid'?>"
  121.     class="button" id="valider" /></div>
  122. </form>
  123. </div>
  124. <?php include_once($dir."/help.php")?></div>
  125. <?php
  126. // Récapitulatif
  127. else    {
  128.  
  129.   if(trim($form_url_mask)==''{
  130.     $form_url_mask=_t('divers','none');
  131.     $display_visual_test="<a href=\"".$form_url."\" class=\"out\">".$form_url."</a>";
  132.   else {
  133.     $display_visual_test="<a href=\"".$form_url."\" class=\"out\">".$form_url_mask."</a>";
  134.   }
  135.  
  136.   ?>
  137. <div class="contentcontainer"><?php
  138. include_once($dir."/menurub.php");
  139. ?>
  140. <div id="content">
  141. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  142. <?php
  143. echo "<dl class=\"dl3\">\n";
  144. echo "<dt>"._t('resources','url')."</dt>\n";
  145. echo "<dd>".$form_url."</dd>\n";
  146. echo "<dt>"._t('resources','url_mask')."</dt>\n";
  147. echo "<dd>".$form_url_mask."</dd>\n";
  148. echo "<dt>"._t('resources','url_visual_test')."</dt>\n";
  149. echo "<dd>".$display_visual_test."</dd>\n";
  150. echo "</dl>\n";
  151. ?>
  152. <form id="modlink" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  153.     method="post">
  154. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  155. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  156. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  157. <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  158. <input name="parent" type="hidden" value="<?php echo $parent?>"
  159.     id="parent" /> <input name="data_table" type="hidden"
  160.     value="<?php echo $table?>" id="data_table" /> <?php echo cancel_button($cancel_link)?>
  161. <input name="retour" type="button"
  162.     value="<?php echo _t('btn','preview'?>" class="button" id="retour"
  163.     onclick="history.go(-1);" /> <input name="enregistrer" type="submit"
  164.     value="<?php echo _t('btn','save'?>" class="button" id="valider" /></div>
  165. </form>
  166. </div>
  167. <?php include_once($dir."/help.php")?></div>
  168. <?php
  169. }
  170. ?>

Documentation generated on Thu, 03 May 2012 15:06:38 +0200 by phpDocumentor 1.4.1