[ Index ]
 

Code source de Dotclear 2.0-beta6

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

title

Body

[fermer]

/admin/ -> plugin.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2005 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/admin/prepend.php';
  24  
  25  dcPage::check('usage,contentadmin');
  26  
  27  $p_file = '';
  28  $p = !empty($_REQUEST['p']) ? $_REQUEST['p'] : null;
  29  
  30  if ($core->plugins->moduleExists($p)) {
  31      $p_file = $core->plugins->moduleRoot($p).'/index.php';
  32  }
  33  
  34  if (file_exists($p_file))
  35  {
  36      # Loading plugin
  37      $p_info = $core->plugins->getModules($p);
  38      
  39      $p_url = 'plugin.php?p='.$p;
  40      
  41      $p_title = 'no content - plugin';
  42      $p_head = '';
  43      $p_content = '<p>'.__('No content found on this plugin.').'</p>';
  44      
  45      ob_start();
  46      include $p_file;
  47      $res = ob_get_contents();
  48      ob_end_clean();
  49      
  50      if (preg_match('|<head>(.*?)</head|ms',$res,$m)) {
  51          if (preg_match('|<title>(.*?)</title>|ms',$m[1],$mt)) {
  52              $p_title = $mt[1];
  53          }
  54          
  55          if (preg_match_all('|(<script.*?>.*?</script>)|ms',$m[1],$ms)) {
  56              foreach ($ms[1] as $v) {
  57                  $p_head .= $v."\n";
  58              }
  59          }
  60          
  61          if (preg_match_all('|(<style.*?>.*?</style>)|ms',$m[1],$ms)) {
  62              foreach ($ms[1] as $v) {
  63                  $p_head .= $v."\n";
  64              }
  65          }
  66          
  67          if (preg_match_all('|(<link.*?/>)|ms',$m[1],$ms)) {
  68              foreach ($ms[1] as $v) {
  69                  $p_head .= $v."\n";
  70              }
  71          }
  72      }
  73      
  74      if (preg_match('|<body>(.*?)</body>|ms',$res,$m)) {
  75          $p_content = $m[1];
  76      }
  77      
  78      dcPage::open($p_title,$p_head);
  79      echo $p_content;
  80      dcPage::close();
  81  }
  82  else
  83  {
  84      dcPage::open(__('Plugin not found'));
  85      
  86      echo '<h2>'.__('Plugin not found').'</h2>';
  87      
  88      echo '<p>'.__('The plugin you reached does not exist or does not have an admin page.').'</p>';
  89      
  90      dcPage::close();
  91  }
  92  ?>


Généré le : Fri Feb 23 22:16:06 2007 par Balluche grâce à PHPXref 0.7