[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/exec/ -> sites_edit.php (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2007                                                *
   7   *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
   8   *                                                                         *
   9   *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
  10   *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
  11  \***************************************************************************/
  12  
  13  if (!defined("_ECRIRE_INC_VERSION")) return;
  14  include_spip('inc/presentation');
  15  
  16  // http://doc.spip.org/@exec_sites_edit_dist
  17  function exec_sites_edit_dist()
  18  {
  19      global $connect_statut, $descriptif, $id_rubrique, $id_secteur, $id_syndic, $new, $nom_site, $syndication, $url_site, $url_syndic, $connect_id_rubrique;
  20  
  21      $result = spip_query("SELECT * FROM spip_syndic WHERE id_syndic=" . intval($id_syndic));
  22  
  23      if ($row = spip_fetch_array($result)) {
  24          $id_syndic = $row["id_syndic"];
  25          $id_rubrique = $row["id_rubrique"];
  26          $nom_site = $row["nom_site"];
  27          $url_site = $row["url_site"];
  28          $url_syndic = $row["url_syndic"];
  29          $descriptif = $row["descriptif"];
  30          $syndication = $row["syndication"];
  31          $extra=$row["extra"];
  32      } else {
  33          $syndication = 'non';
  34          $new = 'oui';
  35          if (!intval($id_rubrique)) {
  36              $in = !$connect_id_rubrique ? ''
  37                : (' WHERE id_rubrique IN (' . join(',', $connect_id_rubrique) . ')');
  38              $row = spip_fetch_array(spip_query("SELECT id_rubrique FROM spip_rubriques$in ORDER BY id_rubrique DESC LIMIT 1"));        
  39              $id_rubrique = $row['id_rubrique'];
  40          }
  41          if (!autoriser('creersitedans','rubrique',$id_rubrique )){
  42              // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
  43              $res = spip_query("SELECT id_rubrique FROM spip_rubriques WHERE id_parent=0");
  44              while (!autoriser('creersitedans','rubrique',$id_rubrique ) && $row_rub = spip_fetch_array($res)){
  45                  $id_rubrique = $row_rub['id_rubrique'];
  46              }
  47          }
  48      }
  49      $commencer_page = charger_fonction('commencer_page', 'inc');
  50      if ( ($new!='oui' AND (!autoriser('voir','site',$id_syndic) OR !autoriser('modifier','site',$id_syndic)))
  51        OR ($new=='oui' AND !autoriser('creersitedans','rubrique',$id_rubrique)) ){
  52          echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
  53          echo "<strong>"._T('avis_acces_interdit')."</strong>";
  54          echo fin_page();
  55          exit;
  56      }
  57  
  58      pipeline('exec_init',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
  59  
  60      echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
  61  
  62      debut_grand_cadre();
  63  
  64      echo afficher_hierarchie($id_rubrique);
  65  
  66      fin_grand_cadre();
  67  
  68      debut_gauche();
  69      echo pipeline('affiche_gauche',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
  70      creer_colonne_droite();
  71      echo pipeline('affiche_droite',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));      
  72      debut_droite();
  73      debut_cadre_formulaire();
  74  
  75      echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n<tr>";
  76  
  77      if ($new != 'oui') {
  78          echo "<td>";
  79          icone(_T('icone_retour'), generer_url_ecrire("sites","id_syndic=$id_syndic"), 'site-24.gif', "rien.gif");
  80          echo "</td>";
  81          echo "<td>". http_img_pack('rien.gif', " ", "width='10'") . "</td>\n";
  82      }
  83      echo "<td style='width: 100%'>";
  84      echo _T('titre_referencer_site');
  85      gros_titre($nom_site);
  86      echo "</td></tr></table><br />\n";
  87  
  88      if ($new == 'oui'
  89      AND ($connect_statut == '0minirezo' OR $GLOBALS['meta']["proposer_sites"] > 0)){
  90          $form_auto = "<span class='verdana1 spip_small'>"
  91          . _T('texte_referencement_automatique')
  92          . "</span>"
  93          . "\n<div align='right'><input type=\"text\" name=\"url\" class='fondl' size='40' value=\"http://\" />\n"
  94          . "\n<input type='hidden' name='id_parent' value='"
  95          . intval(_request('id_rubrique'))
  96          . "' />\n"
  97          . "<input type=\"submit\"  value=\""
  98          . _T('bouton_ajouter')
  99          . "\" class='fondo' />\n"
 100          . '</div>';
 101  
 102          $form_auto = generer_action_auteur('editer_site',
 103              'auto',
 104              generer_url_ecrire('sites'),
 105              $form_auto,
 106              " method='post' name='formulaireauto'"
 107                             );
 108  
 109          echo    debut_cadre_relief("site-24.gif", true)
 110          . $form_auto
 111          . fin_cadre_relief(true)
 112          . "\n<blockquote><b>"
 113          . _T('texte_non_fonction_referencement')
 114          . "</b>";
 115  
 116          $cadre_ouvert = true;
 117          $form = debut_cadre_enfonce("site-24.gif");
 118      } else $cadre_ouvert = $form = '';
 119  
 120      $url_syndic = entites_html($url_syndic);
 121      $nom_site = entites_html($nom_site);
 122      $url_site = entites_html($url_site);
 123      if (strlen($url_site)<8) $url_site="http://";
 124  
 125      if ($id_rubrique == 0) $logo = "racine-site-24.gif";
 126      else {
 127          $result=spip_query("SELECT id_parent FROM spip_rubriques WHERE id_rubrique='$id_rubrique'");
 128  
 129          while($row=spip_fetch_array($result)){
 130              $parent_parent=$row['id_parent'];
 131          }
 132          if ($parent_parent == 0) $logo = "secteur-24.gif";
 133          else $logo = "rubrique-24.gif";
 134      }
 135  
 136      // selecteur de rubriques
 137      $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc');
 138  
 139      $form .= _T('info_nom_site_2')
 140      . "<br />\n<input type='text' class='formo' name='nom_site' value=\""
 141      . $nom_site
 142      . "\" size='40' />\n<br />"
 143      . _T('entree_adresse_site')
 144      . "<br />\n<input type='text' class='formo' name='url_site' value=\""
 145      . $url_site
 146      . "\" size='40' /><br />\n"
 147      . debut_cadre_couleur($logo, true, "", _T('entree_interieur_rubrique'))
 148      . $chercher_rubrique($id_rubrique, 'site', false)
 149      . fin_cadre_couleur(true)
 150      . "\n<br />"
 151      ."<b>"
 152      . _T('entree_description_site')
 153      . "</b><br />\n"
 154      . "<textarea name='descriptif' rows='8' class='forml' cols='40' >"
 155      . entites_html($descriptif)
 156      . "</textarea>"
 157      . "\n<input type='hidden' name='syndication_old' value=\""
 158      . $syndication
 159      . "\" />";
 160  
 161      if ($GLOBALS['meta']["activer_syndic"]!= "non") {
 162          $form .= debut_cadre_enfonce('feed.png', true);
 163          if ($syndication == "non") {
 164              $form .= "\n<input type='radio' name='syndication' value='non' id='syndication_non' checked='checked' />";
 165          } else {
 166              $form .= "\n<input type='radio' name='syndication' value='non' id='syndication_non' />";
 167          }
 168          $form .= "\n<b><label for='syndication_non'>"
 169          . _T('bouton_radio_non_syndication')
 170          . "</label></b><br />\n";
 171  
 172          if ($syndication == "non") {
 173              $form .= "<input type='radio' name='syndication' value='oui' id='syndication_oui' />";
 174          } else {
 175              $form .= "<input type='radio' name='syndication' value='oui' id='syndication_oui' checked='checked' />";
 176          }
 177          $form .= "\n<b><label for='syndication_oui'>"
 178          . _T('bouton_radio_syndication')
 179          . "</label></b>"
 180          . aide("rubsyn")
 181          . "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n<tr><td style='width: 10px;'>&nbsp;</td>\n<td>"
 182          . _T('entree_adresse_fichier_syndication')
 183          . "<br />\n";
 184  
 185          if (strlen($url_syndic) < 8) $url_syndic = "http://";
 186  
 187      // cas d'une liste de flux detectee par feedfinder : menu
 188          if (preg_match(',^select: (.+),', $url_syndic, $regs)) {
 189              $feeds = explode(' ',$regs[1]);
 190              $form .= "<select name='url_syndic'>\n";
 191              foreach ($feeds as $feed) {
 192                  $form .= '<option value="'.entites_html($feed).'">'.$feed."</option>\n";
 193              }
 194              $form .= "</select>\n";
 195          } else {
 196              $form .= "<input type='text' class='formo' name='url_syndic' value=\"$url_syndic\" size='40' />\n";
 197          }
 198          $form .= "</td></tr></table>";
 199          $form .= fin_cadre_enfonce(true);
 200      }
 201  
 202      if ($GLOBALS['champs_extra']) {
 203          include_spip('inc/extra');
 204          $form .= extra_saisie($extra, 'sites', intval($id_secteur));
 205      }
 206  
 207      $form .= "\n<div align='right'><input type='submit' value='"
 208      . _T('bouton_enregistrer')
 209      . "' class='fondo' /></div>";
 210  
 211      $form = generer_action_auteur('editer_site',
 212                        ($new == 'oui') ? $new : $id_syndic,
 213                        generer_url_ecrire('sites'),
 214                        $form,
 215                        " method='post' name='formulaire'"
 216                        );
 217  
 218      if ($cadre_ouvert) {
 219          $form .= fin_cadre_enfonce(true);
 220          $form .= "</blockquote>\n";
 221      }
 222  
 223      echo $form;
 224      
 225      echo fin_cadre_formulaire(true);
 226      
 227      echo pipeline('affiche_milieu',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
 228  
 229      echo fin_gauche(), fin_page();
 230  }
 231  ?>


Généré le : Wed Nov 21 10:20:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics