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

Documentation generated on Thu, 03 May 2012 15:02:01 +0200 by phpDocumentor 1.4.1