[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/tools/toolsmng/ -> index.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # Version: MPL 1.1/GPL 2.0/LGPL 2.1
   4  #
   5  # The contents of this file are subject to the Mozilla Public License Version
   6  # 1.1 (the "License"); you may not use this file except in compliance with
   7  # the License. You may obtain a copy of the License at
   8  # http://www.mozilla.org/MPL/
   9  #
  10  # Software distributed under the License is distributed on an "AS IS" basis,
  11  # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12  # for the specific language governing rights and limitations under the
  13  # License.
  14  #
  15  # The Original Code is DotClear Weblog.
  16  #
  17  # The Initial Developer of the Original Code is
  18  # Olivier Meunier.
  19  # Portions created by the Initial Developer are Copyright (C) 2003
  20  # the Initial Developer. All Rights Reserved.
  21  #
  22  # Contributor(s):
  23  #
  24  # Alternatively, the contents of this file may be used under the terms of
  25  # either the GNU General Public License Version 2 or later (the "GPL"), or
  26  # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27  # in which case the provisions of the GPL or the LGPL are applicable instead
  28  # of those above. If you wish to allow use of your version of this file only
  29  # under the terms of either the GPL or the LGPL, and not to allow others to
  30  # use your version of this file under the terms of the MPL, indicate your
  31  # decision by deleting the provisions above and replace them with the notice
  32  # and other provisions required by the GPL or the LGPL. If you do not delete
  33  # the provisions above, a recipient may use your version of this file under
  34  # the terms of any one of the MPL, the GPL or the LGPL.
  35  #
  36  # ***** END LICENSE BLOCK *****
  37  
  38  $is_user_root = auth::AsLevel(PX_AUTH_ROOT);
  39  if (!$is_user_root):
  40      $m->setError( __('You do not have the rights to access this plugin.'));
  41  else:  
  42  
  43  $err = '';
  44  $tool_url = '';
  45  
  46  # Liste des thèmes
  47  $tolls_root = dirname(__FILE__).'/../';
  48  $objPlugins = new plugins($tolls_root);
  49  
  50  $m->l10n->loadPlugin($m->user->lang, 'toolsmng');
  51  $tools_list = $objPlugins->getPlugins('plugin',false);
  52  
  53  $is_writable = is_writable($tolls_root);
  54  
  55  # Installation d'un thème
  56  if ($is_writable && !empty($_GET['tool_url']))
  57  {
  58      $tool_url = $_GET['tool_url'];
  59      $parsed_url = parse_url($tool_url);
  60      
  61      if (empty($parsed_url['scheme']) || !preg_match('/^http|ftp$/',$parsed_url['scheme'])
  62      || empty($parsed_url['host']) || empty($parsed_url['path']))
  63      {
  64          $err =  __('Invalid URL.');
  65      }
  66      else
  67      {
  68          if (($err = $objPlugins->install($tool_url)) === true)
  69          {
  70              $msg =  __('The plugin was successfully installed.');
  71              header('Location: tools.php?p=toolsmng&msg='.urlencode($msg));
  72              exit;
  73          }
  74      }
  75  }
  76  
  77  # Suppression d'un thème
  78  $delete = (!empty($_GET['delete'])) ? $_GET['delete'] : '';
  79  
  80  if ($is_writable && $delete != '' && in_array($delete,array_keys($tools_list)) && $delete != 'default')
  81  {
  82      deltree($tolls_root.'/'.$delete);
  83      $msg =  __('The plugin was successfully deleted.');
  84      header('Location: tools.php?p=toolsmng&msg='.urlencode($msg));
  85      exit;
  86  }
  87  
  88  if($err != '')
  89  {
  90      echo '<div class="erreur"><p><strong>'. __('Error(s):').'</strong></p>'.$err.'</div>';
  91  }
  92  ?>
  93  
  94  <h1><?php  echo __('Plugin manager'); ?></h1>
  95  
  96  <!-- <h2><?php  echo __('Install a plugin'); ?></h2>
  97  <?php
  98  if (!$is_writable)
  99  {
 100      echo '<p>'.sprintf( __('The system has no write access to the folder %s, check its permissions.'), $tolls_root).'</p>';
 101  }
 102  else
 103  {
 104      echo '<form action="tools.php" method="get">'.
 105          '<p><label for="tool_url">'. __('Give the plugin file URL (http or ftp):').'</label>'.
 106          form::textField('tool_url',50,'',$tool_url).'</p>'.
 107          '<p><input type="submit" class="submit" value="'. __('Install').'" />'.
 108          '<input type="hidden" name="p" value="toolsmng" /></p>'.
 109          '</form>';
 110      
 111  }
 112  ?>
 113  -->
 114  <h2><?php  echo __('List of installed plugins'); ?></h2>
 115  <dl>
 116  <?php
 117  foreach ($tools_list as $k => $v)
 118  {
 119      echo '<dt>'.$v['label'].' - '.$k.'</dt>';
 120      echo '<dd>'.$v['desc'].' <br />'.
 121          __('by').' '.$v['author'].' - '. __('version').' '.$v['version'].' <br />';
 122      
 123      if ($k != 'toolsmng') {
 124          echo '<a href="tools.php?p=toolsmng&amp;delete='.$k.'" '.
 125          'onclick="return window.confirm(\''.addslashes(__('Are you sure you want to delete this plugin?')).'\')">'. __('delete').'</a>';
 126      }
 127      
 128      echo '</dd>';
 129  }
 130  ?>
 131  </dl>
 132  <?php 
 133  endif;
 134  ?>


Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics