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

Documentation generated on Fri, 16 Oct 2009 09:28:19 +0200 by phpDocumentor 1.4.1