source: trunk/admin/plugins_new.php @ 2263

Last change on this file since 2263 was 2263, checked in by patdenice, 16 years ago

Use class for plugins management

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
5// +-----------------------------------------------------------------------+
6// | file          : $Id: plugins_new.php 2263 2008-03-07 10:42:51Z patdenice $
7// | last update   : $Date: 2008-03-07 10:42:51 +0000 (Fri, 07 Mar 2008) $
8// | last modifier : $Author: patdenice $
9// | revision      : $Revision: 2263 $
10// +-----------------------------------------------------------------------+
11// | This program is free software; you can redistribute it and/or modify  |
12// | it under the terms of the GNU General Public License as published by  |
13// | the Free Software Foundation                                          |
14// |                                                                       |
15// | This program is distributed in the hope that it will be useful, but   |
16// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
17// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
18// | General Public License for more details.                              |
19// |                                                                       |
20// | You should have received a copy of the GNU General Public License     |
21// | along with this program; if not, write to the Free Software           |
22// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
23// | USA.                                                                  |
24// +-----------------------------------------------------------------------+
25
26if( !defined("PHPWG_ROOT_PATH") )
27{
28  die ("Hacking attempt!");
29}
30
31include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
32
33$template->set_filenames(array('plugins' => 'admin/plugins_new.tpl'));
34
35$order = isset($_GET['order']) ? $_GET['order'] : 'date';
36
37$plugins = new plugins($page['page'], $order);
38
39//------------------------------------------------------automatic installation
40if (isset($_GET['install']) and isset($_GET['extension']) and !is_adviser())
41{
42  $plugins->install($_GET['install'], $_GET['extension']);
43}
44
45//--------------------------------------------------------------install result
46if (isset($_GET['installstatus']))
47{
48  $plugins->get_result($_GET['installstatus']);
49}
50
51// +-----------------------------------------------------------------------+
52// |                     start template output                             |
53// +-----------------------------------------------------------------------+
54$plugins->tabsheet();
55$plugins->check_server_plugins();
56$plugins->set_order_options(array(
57    'date' => l10n('Post date'),
58    'name' => l10n('Name'),
59    'author' => l10n('Author')));
60
61if ($plugins->server_plugins !== false)
62{
63  foreach($plugins->server_plugins as $plugin)
64  {
65    $ext_desc = nl2br(htmlspecialchars(strip_tags(
66                  utf8_encode($plugin['ext_description']))));
67
68    $ver_desc = sprintf(l10n('plugins_description'),
69            $plugin['version'],
70            date('Y-m-d', $plugin['date']),
71            nl2br(htmlspecialchars(strip_tags(
72              utf8_encode($plugin['description'])))));
73
74    $url_auto_install = $plugins->html_base_url
75      . '&amp;extension=' . $plugin['id_extension']
76      . '&amp;install=%2Fupload%2Fextension-' . $plugin['id_extension']
77      . '%2Frevision-' . $plugin['id_revision'] . '%2F'
78      .  str_replace(' ', '%20',$plugin['url']);
79
80    $url_download = PEM_URL .'/upload/extension-'.$plugin['id_extension']
81      . '/revision-' . $plugin['id_revision']
82      . '/' . str_replace(' ', '%20',$plugin['url']);
83
84    $template->append('plugins',
85        array('EXT_NAME' => $plugin['ext_name'],
86          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['id_extension'],
87          'EXT_DESC' => $ext_desc,
88          'VERSION' => $plugin['version'],
89          'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin['id_revision'],
90          'VER_DESC' => $ver_desc,
91          'AUTHOR' => $plugin['author'],
92          'URL_INSTALL' => $url_auto_install,
93          'URL_DOWNLOAD' => $url_download));
94  }
95}
96else
97{
98  array_push($page['errors'], l10n('plugins_server_error'));
99}
100
101$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
102?>
Note: See TracBrowser for help on using the repository browser.