[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/balise/ -> formulaire_admin.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;    #securite
  14  
  15  
  16  // http://doc.spip.org/@balise_FORMULAIRE_ADMIN
  17  function balise_FORMULAIRE_ADMIN ($p) {
  18      return calculer_balise_dynamique($p,'FORMULAIRE_ADMIN', array());
  19  }
  20  
  21  # on ne peut rien dire au moment de l'execution du squelette
  22  
  23  // http://doc.spip.org/@balise_FORMULAIRE_ADMIN_stat
  24  function balise_FORMULAIRE_ADMIN_stat($args, $filtres) {
  25      return $args;
  26  }
  27  
  28  # les boutons admin sont mis d'autorite si absents
  29  # donc une variable statique controle si FORMULAIRE_ADMIN a ete vu.
  30  # Toutefois, si c'est le debuger qui appelle,
  31  # il peut avoir recopie le code dans ses donnees et il faut le lui refounir.
  32  # Pas question de recompiler: ca fait boucler !
  33  # Le debuger transmet donc ses donnees, et cette balise y retrouve son petit.
  34  
  35  // http://doc.spip.org/@balise_FORMULAIRE_ADMIN_dyn
  36  function balise_FORMULAIRE_ADMIN_dyn($float='', $debug='') {
  37  
  38      global $var_preview, $use_cache, $forcer_debug, $xhtml;
  39      global $id_article, $id_breve, $id_rubrique, $id_mot, $id_auteur, $id_syndic;
  40      static $dejafait = false;
  41  
  42      if (!$GLOBALS['spip_admin'])
  43          return '';
  44  
  45      if (!is_array($debug)) {
  46          if ($dejafait)
  47              return '';
  48      } else {
  49          if ($dejafait) {
  50              $res = '';
  51              foreach($debug['sourcefile'] as $k => $v) {
  52                  if (strpos($v,'administration.') !== false)
  53                      return $debug['resultat'][$k . 'tout'];
  54              }
  55              return '';
  56          }
  57      }
  58      $dejafait = true;
  59      include_spip('inc/urls');
  60      $objet_affiche = '';
  61  
  62      // Ne pas afficher le bouton 'Modifier ce...' si l'objet n'existe pas
  63      foreach (array('article', 'breve', 'rubrique', 'mot', 'auteur', 'syndic') as $type) {
  64          $id_type = id_table_objet($type);
  65          if ($n = intval($$id_type)) {
  66              $s = spip_query("SELECT $id_type FROM spip_".table_objet($type)."    WHERE $id_type=".$$id_type);
  67              if ($s AND spip_num_rows($s)) {
  68                  $$id_type = $n;
  69                  $objet_affiche = $type;
  70                  break;
  71              }
  72          }
  73      }
  74  
  75      $statut = isset($GLOBALS['auteur_session']['statut']) ?
  76          $GLOBALS['auteur_session']['statut'] : '';
  77  
  78      // Bouton statistiques
  79      $visites = $popularite = $statistiques = '';
  80      if ($GLOBALS['meta']["activer_statistiques"] != "non" 
  81      AND $id_article
  82      AND !$var_preview
  83      AND $statut == '0minirezo'
  84      ) {
  85          $result = spip_query("SELECT visites, popularite FROM spip_articles WHERE id_article=$id_article AND statut='publie'");
  86  
  87          if ($row = @spip_fetch_array($result)) {
  88              $visites = intval($row['visites']);
  89              $popularite = ceil($row['popularite']);
  90              $statistiques = str_replace('&amp;', '&', generer_url_ecrire_statistiques($id_article));
  91          }
  92      }
  93  
  94      // Bouton de debug
  95      $debug =
  96      (
  97          (    $forcer_debug
  98              OR $GLOBALS['bouton_admin_debug']
  99              OR (
 100                  $GLOBALS['var_mode'] == 'debug'
 101                  AND $GLOBALS['_COOKIE']['spip_debug']
 102              )
 103          ) AND (
 104              $statut == '0minirezo'
 105          ) AND (
 106              !$var_preview
 107          )
 108      ) ? parametre_url(self(),'var_mode', 'debug', '&'): '';
 109          $analyser = !$xhtml ? "" :
 110          (($xhtml === 'sax') ?
 111          (parametre_url(self(), 'var_mode', 'debug', '&')
 112              .'&var_mode_affiche=validation') :
 113          ('http://validator.w3.org/check?uri='
 114          . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
 115      
 116      // hack - ne pas avoir la rubrique si un autre bouton est deja present
 117      if ($id_article OR $id_breve) unset ($id_rubrique);
 118  
 119      // Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
 120      if (!($id_article || $id_rubrique || $id_auteur || $id_breve || $id_mot || $id_syndic))
 121          $ecrire = _DIR_RESTREINT_ABS;
 122      else $ecrire = '';
 123      // Bouton "preview" si l'objet demande existe et est previsualisable
 124      $preview = false;
 125  
 126      if (!$GLOBALS['var_preview'] AND (
 127      (($GLOBALS['meta']['preview']=='1comite'
 128          AND $statut =='1comite')
 129      OR ($GLOBALS['meta']['preview']<>''
 130          AND $statut =='0minirezo'))
 131      )) {
 132          $p = ($objet_affiche == 'article' AND $GLOBALS['meta']['post_dates'] != 'oui');
 133  
 134          if ($objet_affiche == 'article'
 135          OR $objet_affiche == 'breve'
 136          OR $objet_affiche == 'rubrique'
 137          OR $objet_affiche == 'syndic')
 138            $preview = spip_num_rows(spip_query("SELECT id_$objet_affiche FROM spip_".table_objet($objet_affiche)." WHERE ".id_table_objet($objet_affiche)."=".$$id_type." AND ((statut IN ('prop', 'prive')) " . (!$p ? '' : "OR (statut='publie' AND date>NOW())") .")"));
 139      }
 140  
 141      //
 142      // Regler les boutons dans la langue de l'admin (sinon tant pis)
 143      //
 144      include_spip('inc/lang');
 145      include_spip('base/abstract_sql');
 146      $login = preg_replace(',^@,','',$GLOBALS['spip_admin']);
 147      $alang = spip_abstract_fetsel(array('lang'), array('spip_auteurs'),
 148          array("login=" . _q($login)));
 149      if ($alang['lang']) {
 150          lang_select($alang['lang']);
 151          $lang = $GLOBALS['spip_lang'];
 152          lang_dselect();
 153      } else
 154          $lang = '';
 155  
 156      // Preparer le #ENV des boutons
 157      $env = array(
 158          'ecrire' => $ecrire,
 159          'action' => self(),
 160          'divclass' => $float,
 161          'lang' => $lang,
 162          'calcul' => (_request('var_mode') ? 'recalcul' : 'calcul'),
 163      );
 164  
 165      if ($preview)
 166          $env['preview']=parametre_url(self(),'var_mode','preview','&');
 167      if ($debug)
 168          $env['debug'] = $debug;
 169      if ($statistiques) {
 170          $env['popularite'] = $popularite;
 171          $env['statistiques'] = $statistiques;
 172          $env['visites'] = $visites;
 173      }
 174      if (!$use_cache)
 175          $env['use_cache'] = ' *';
 176      if ($analyser)
 177          $env['analyser'] = $analyser;
 178      if (isset($GLOBALS['xhtml_error']) AND $GLOBALS['xhtml_error']) {
 179          $env['xhtml_error'] = count($GLOBALS['xhtml_error']);
 180      }
 181      foreach (array('article','rubrique','auteur','breve','mot','syndic'=>'site')
 182      as $id => $obj) {
 183          if (is_int($id)) $id = $obj;
 184          if (${'id_'.$id}) {
 185              $env['id_'.$id] = ${'id_'.$id};
 186              $g = 'generer_url_ecrire_'.$obj;
 187              $env['voir_'.$obj] = str_replace('&amp;', '&',
 188                  $g(${'id_'.$id}, 'prop'));
 189          }
 190      }
 191  
 192      return array('formulaires/administration', 0, $env);
 193  }
 194  
 195  ?>


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