[ Index ]
 

Code source de Dotclear 1.2.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ecrire/ -> tools.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2004 Olivier Meunier and contributors. All rights
   5  # reserved.
   6  #
   7  # DotClear is free software; you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation; either version 2 of the License, or
  10  # (at your option) any later version.
  11  # 
  12  # DotClear is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  # 
  17  # You should have received a copy of the GNU General Public License
  18  # along with DotClear; if not, write to the Free Software
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  #
  21  # ***** END LICENSE BLOCK *****
  22  
  23  require dirname(__FILE__).'/inc/prepend.php';
  24  require dirname(__FILE__).'/../inc/libs/lib.buffer.php';
  25  
  26  if (!empty($_GET['logout'])) {
  27      $_SESSION = array();
  28  }
  29  
  30  $auth->check(9);
  31  
  32  include dirname(__FILE__).'/inc/connexion.php';
  33  
  34  $plugins_root = dirname(__FILE__).'/tools/';
  35  
  36  $plugins = new plugins($plugins_root);
  37  $plugins->getPlugins(true);
  38  $plugins_list = $plugins->getPluginsList();
  39  
  40  $PLUGIN_HEAD = '';
  41  $PLUGIN_BODY = '';
  42  
  43  if ((!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']])
  44  && $plugins_list[$_REQUEST['p']]['active']))
  45  {
  46      $p = $_REQUEST['p'];
  47      $plugins->loadl10n($p);
  48      buffer::init();
  49      include $plugins_root.$p.'/index.php';
  50      $PLUGIN_BODY = buffer::getContent();
  51      buffer::clean();
  52      
  53      $mySubMenu->addItem(__('Back to tools'),'tools.php',
  54      'images/ico_retour.png',false);
  55  }
  56  
  57  openPage(__('Tools'),$PLUGIN_HEAD);
  58  if ($PLUGIN_BODY != '')
  59  {
  60      echo $PLUGIN_BODY;
  61  }
  62  else
  63  {
  64      echo '<h2>'.__('Tools').'</h2>';
  65  
  66      if (count($plugins_list) == 0)
  67      {
  68          echo '<p>Aucun outil n\'est disponible ou actif</p>';
  69      }
  70      else
  71      {
  72          # Traduction des plugins
  73          foreach ($plugins_list as $k => $v)
  74          {
  75              $plugins->loadl10n($k);
  76              
  77              $plugins_list[$k]['label'] = __($v['label']);
  78              $plugins_list[$k]['desc'] = __($v['desc']);
  79          }
  80          
  81          # Tri des plugins par leur nom
  82          uasort($plugins_list,create_function('$a,$b','return strcmp($a["label"],$b["label"]);'));
  83          
  84          # Liste des plugins
  85          echo '<dl class="plugin-list">';
  86          foreach ($plugins_list as $k => $v)
  87          {
  88              $plink = '<a href="tools.php?p='.$k.'">%s</a>';
  89              $plabel = (!empty($v['label'])) ? $v['label'] : $v['name'];
  90              
  91              echo '<dt>';
  92              if (file_exists($plugins_root.$k.'/icon.png')) {
  93                  printf($plink,'<img alt="" src="tools/'.$k.'/icon.png" />');
  94                  echo ' ';
  95              }
  96              
  97              printf($plink,$plabel);
  98              echo '</dt>';
  99              
 100              echo '<dd>'.$v['desc'].'</dd>';
 101          }
 102          echo '</dl>';
 103      }
 104  }
 105  closePage();
 106  ?>


Généré le : Fri Feb 23 21:40:15 2007 par Balluche grâce à PHPXref 0.7