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

Source for file add_link.php

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

Documentation generated on Thu, 20 Mar 2014 16:45:56 +0100 by phpDocumentor 1.4.1