source: trunk/admin/plugins_new.php @ 2297

Last change on this file since 2297 was 2297, checked in by plg, 16 years ago

Modification: new header on PHP files, PhpWebGallery renamed Piwigo.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23// +-----------------------------------------------------------------------+
24// | PhpWebGallery - a PHP based picture gallery                           |
25// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
26// +-----------------------------------------------------------------------+
27// | file          : $Id: plugins_new.php 2297 2008-04-04 22:57:23Z plg $
28// | last update   : $Date: 2008-04-04 22:57:23 +0000 (Fri, 04 Apr 2008) $
29// | last modifier : $Author: plg $
30// | revision      : $Revision: 2297 $
31// +-----------------------------------------------------------------------+
32// | This program is free software; you can redistribute it and/or modify  |
33// | it under the terms of the GNU General Public License as published by  |
34// | the Free Software Foundation                                          |
35// |                                                                       |
36// | This program is distributed in the hope that it will be useful, but   |
37// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
38// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
39// | General Public License for more details.                              |
40// |                                                                       |
41// | You should have received a copy of the GNU General Public License     |
42// | along with this program; if not, write to the Free Software           |
43// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
44// | USA.                                                                  |
45// +-----------------------------------------------------------------------+
46
47if( !defined("PHPWG_ROOT_PATH") )
48{
49  die ("Hacking attempt!");
50}
51
52include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
53
54$template->set_filenames(array('plugins' => 'admin/plugins_new.tpl'));
55
56$order = isset($_GET['order']) ? $_GET['order'] : 'date';
57$base_url = get_root_url().'admin.php?page='.$page['page'].'&order='.$order;
58
59$plugins = new plugins();
60
61//------------------------------------------------------automatic installation
62if (isset($_GET['install']) and isset($_GET['extension']) and !is_adviser())
63{
64  $install_status =
65    $plugins->extract_plugin_files('install', $_GET['install'], $_GET['extension']);
66
67  redirect($base_url.'&installstatus='.$install_status);
68}
69
70//--------------------------------------------------------------install result
71if (isset($_GET['installstatus']))
72{
73  switch ($_GET['installstatus'])
74  {
75    case 'ok':
76      array_push($page['infos'],
77        l10n('plugins_install_ok'),
78        l10n('plugins_install_need_activate'));
79      break;
80
81    case 'temp_path_error':
82      array_push($page['errors'], l10n('plugins_temp_path_error'));
83      break;
84
85    case 'dl_archive_error':
86      array_push($page['errors'], l10n('plugins_dl_archive_error'));
87      break;
88
89    case 'archive_error':
90      array_push($page['errors'], l10n('plugins_archive_error'));
91      break;
92
93    default:
94      array_push($page['errors'],
95        sprintf(l10n('plugins_extract_error'), $_GET['installstatus']),
96        l10n('plugins_check_chmod'));
97  } 
98}
99
100//--------------------------------------------------------------------Tabsheet
101set_plugins_tabsheet($page['page']);
102
103//---------------------------------------------------------------Order options
104$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
105$template->assign('order_options',
106  array(
107    $link.'date' => l10n('Post date'),
108    $link.'revision' => l10n('plugins_revisions'),
109    $link.'name' => l10n('Name'),
110    $link.'author' => l10n('Author')));
111$template->assign('order_selected', $link.$order);
112
113// +-----------------------------------------------------------------------+
114// |                     start template output                             |
115// +-----------------------------------------------------------------------+
116$plugins->get_server_plugins(true);
117
118if (is_array($plugins->server_plugins))
119{
120  $plugins->sort_server_plugins($order);
121
122  foreach($plugins->server_plugins as $plugin)
123  {
124    $ext_desc = nl2br(htmlspecialchars(strip_tags(
125                  utf8_encode($plugin['ext_description']))));
126
127    $ver_desc = sprintf(l10n('plugins_description'),
128            $plugin['version'],
129            date('Y-m-d', $plugin['date']),
130            nl2br(htmlspecialchars(strip_tags(
131              utf8_encode($plugin['description'])))));
132
133    $url_auto_install = htmlentities($base_url)
134      . '&amp;extension=' . $plugin['id_extension']
135      . '&amp;install=%2Fupload%2Fextension-' . $plugin['id_extension']
136      . '%2Frevision-' . $plugin['id_revision'] . '%2F'
137      .  str_replace(' ', '%20',$plugin['url']);
138
139    $url_download = PEM_URL .'/upload/extension-'.$plugin['id_extension']
140      . '/revision-' . $plugin['id_revision']
141      . '/' . str_replace(' ', '%20',$plugin['url']);
142
143    $template->append('plugins',
144        array('EXT_NAME' => $plugin['ext_name'],
145          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['id_extension'],
146          'EXT_DESC' => $ext_desc,
147          'VERSION' => $plugin['version'],
148          'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin['id_revision'],
149          'DATE' => date('Y-m-d', $plugin['date']),
150          'VER_DESC' => $ver_desc,
151          'AUTHOR' => $plugin['author'],
152          'URL_INSTALL' => $url_auto_install,
153          'URL_DOWNLOAD' => $url_download));
154  }
155}
156else
157{
158  array_push($page['errors'], l10n('plugins_server_error'));
159}
160
161$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
162?>
Note: See TracBrowser for help on using the repository browser.