source: branches/2.0/admin/plugins_new.php @ 2881

Last change on this file since 2881 was 2881, checked in by patdenice, 15 years ago

merge -c2880 from trunk to branch 2.0

  • Add fetchRemote function which allow to retrieve datas over HTTP protocol using cURL method, file_get_contents function or fsockopen method. This allow to retrieve datas or files even if allow_url_fopen is deactivated.
  • Use fetchRemote function in plugins manager and in latest version checking.
  • Add german translations for upgrade.lang.php.
  • Remove empty line at the end of pclzip.lib.php.
  • Change display of deactivated plugins after upgrade.
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 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
24if( !defined("PHPWG_ROOT_PATH") )
25{
26  die ("Hacking attempt!");
27}
28
29include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
30
31$template->set_filenames(array('plugins' => 'plugins_new.tpl'));
32
33$order = isset($_GET['order']) ? $_GET['order'] : 'date';
34$base_url = get_root_url().'admin.php?page='.$page['page'].'&order='.$order;
35
36$plugins = new plugins();
37
38//------------------------------------------------------automatic installation
39if (isset($_GET['revision']) and isset($_GET['extension']) and !is_adviser())
40{
41  $install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension']);
42
43  redirect($base_url.'&installstatus='.$install_status);
44}
45
46//--------------------------------------------------------------install result
47if (isset($_GET['installstatus']))
48{
49  switch ($_GET['installstatus'])
50  {
51    case 'ok':
52      array_push($page['infos'],
53        l10n('plugins_install_ok'),
54        l10n('plugins_install_need_activate'));
55      break;
56
57    case 'temp_path_error':
58      array_push($page['errors'], l10n('plugins_temp_path_error'));
59      break;
60
61    case 'dl_archive_error':
62      array_push($page['errors'], l10n('plugins_dl_archive_error'));
63      break;
64
65    case 'archive_error':
66      array_push($page['errors'], l10n('plugins_archive_error'));
67      break;
68
69    default:
70      array_push($page['errors'],
71        sprintf(l10n('plugins_extract_error'), $_GET['installstatus']),
72        l10n('plugins_check_chmod'));
73  } 
74}
75
76//--------------------------------------------------------------------Tabsheet
77set_plugins_tabsheet($page['page']);
78
79//---------------------------------------------------------------Order options
80$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
81$template->assign('order_options',
82  array(
83    $link.'date' => l10n('Post date'),
84    $link.'revision' => l10n('plugins_revisions'),
85    $link.'name' => l10n('Name'),
86    $link.'author' => l10n('Author')));
87$template->assign('order_selected', $link.$order);
88
89// +-----------------------------------------------------------------------+
90// |                     start template output                             |
91// +-----------------------------------------------------------------------+
92if ($plugins->get_server_plugins(true))
93{
94  $plugins->sort_server_plugins($order);
95
96  foreach($plugins->server_plugins as $plugin)
97  {
98    /* Need to remove this lines for final release : piwigo website will be utf8 only */
99    $plugin['extension_description'] = utf8_encode($plugin['extension_description']);
100    $plugin['revision_description'] = utf8_encode($plugin['revision_description']);
101
102    list($date, ) = explode(' ', $plugin['revision_date']);
103
104    $ver_desc = sprintf(l10n('plugins_description'),
105      $plugin['revision_name'],
106      $date,
107      $plugin['revision_description']);
108
109    $url_auto_install = htmlentities($base_url)
110      . '&amp;revision=' . $plugin['revision_id']
111      . '&amp;extension=' . $plugin['extension_id'];
112
113    $template->append('plugins', array(
114      'EXT_NAME' => $plugin['extension_name'],
115      'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['extension_id'],
116      'EXT_DESC' => $plugin['extension_description'],
117      'VERSION' => $plugin['revision_name'],
118      'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin['revision_id'],
119      'DATE' => $date,
120      'VER_DESC' => $ver_desc,
121      'AUTHOR' => $plugin['author_name'],
122      'URL_INSTALL' => $url_auto_install,
123      'URL_DOWNLOAD' => $plugin['download_url'] . '&amp;origin=piwigo_download'));
124  }
125}
126else
127{
128  array_push($page['errors'], l10n('plugins_server_error'));
129}
130
131$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
132?>
Note: See TracBrowser for help on using the repository browser.