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 (!class_exists('auth')) {
  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 (!$l21auth->hasRight('publication')) ReloadIndex('admin');
  30.   if ($l21auth->GetSessionElement('id')!=$publi_owner && !$l21auth->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 (!$l21auth->hasRight('workshop')) ReloadIndex('admin');
  41.   if (!$l21auth->isWorkgroupOrganiser($l21auth->GetSessionElement('id')$sql_object$workshop_id&& !$l21auth->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></li>
  83.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  84.     <li><span><?php echo formatNavTitle(_t('resources',$mod_inc.'_type').' : '$current_title)?></span></li>
  85. </ul>
  86. </div>
  87. <!--end barre haute -->
  88. <?php
  89. include_once(THEME_ADMIN_PATH."quickicons.php");
  90. ?>
  91.  
  92. <?php
  93. if(!isset($integrity|| is_string($integrity)) {
  94. ?>
  95. <div class="contentcontainer"><?php
  96. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  97. ?>
  98. <div id="content">
  99. <?php
  100. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  101. ?>
  102. <h2><?php echo formatTitleh2($current_title)?></h2>
  103. <form id="modlink" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  104.     <p>
  105.         <label for="link_url"><?php echo mb_ucfirst(_t('resources','url'))?> : *</label>
  106.         <input name="link_url" type="text" class="textfield" id="link_url" maxlength="1000" value="<?php echo $form_url?>" />
  107.     </p>
  108.     <p>
  109.         <label for="link_url_mask"><?php echo mb_ucfirst(_t('resources','url_mask'))?> : </label>
  110.         <input name="link_url_mask" type="text" class="textfield"    id="link_url_mask" maxlength="200" value="<?php echo $form_url_mask?>" />
  111.     </p>
  112.     <div>
  113.         <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  114.         <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  115.         <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  116.         <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  117.         <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  118.         <?php echo cancel_button($cancel_link)?>
  119.         <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  120.     </div>
  121. </form>
  122. </div>
  123. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  124. <?php
  125. // Récapitulatif
  126. else    {
  127.  
  128.   if(trim($form_url_mask)==''{
  129.     $form_url_mask=_t('divers','none');
  130.     $display_visual_test="<a href=\"".$form_url."\" class=\"out\">".$form_url."</a>";
  131.   else {
  132.     $display_visual_test="<a href=\"".$form_url."\" class=\"out\">".$form_url_mask."</a>";
  133.   }
  134.  
  135.   ?>
  136. <div class="contentcontainer"><?php
  137. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  138. ?>
  139. <div id="content">
  140. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  141. <?php
  142. echo "<dl class=\"summary\">\n";
  143. echo "<dt>".mb_ucfirst(_t('resources','url'))." :</dt>\n";
  144. echo "<dd>".$form_url."</dd>\n";
  145. echo "<dt>".mb_ucfirst(_t('resources','url_mask'))." :</dt>\n";
  146. echo "<dd>".$form_url_mask."</dd>\n";
  147. echo "<dt>".mb_ucfirst(_t('resources','url_visual_test'))." :</dt>\n";
  148. echo "<dd>".$display_visual_test."</dd>\n";
  149. echo "</dl>\n";
  150. ?>
  151. <form id="modlink" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  152.     <div>
  153.         <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  154.         <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  155.         <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  156.         <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  157.         <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  158.         <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  159.         <?php echo cancel_button($cancel_link)?>
  160.         <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  161.         <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  162.     </div>
  163. </form>
  164. </div>
  165. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  166. <?php
  167. }
  168. ?>

Documentation generated on Thu, 20 Mar 2014 16:49:03 +0100 by phpDocumentor 1.4.1