source: trunk/admin/plugins_new.php @ 2530

Last change on this file since 2530 was 2530, checked in by vdigital, 16 years ago

Wigo becomes "goto".
Admin tpl files are moved.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 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['install']) and isset($_GET['extension']) and !is_adviser())
40{
41  $install_status =
42    $plugins->extract_plugin_files('install', $_GET['install'], $_GET['extension']);
43
44  redirect($base_url.'&installstatus='.$install_status);
45}
46
47//--------------------------------------------------------------install result
48if (isset($_GET['installstatus']))
49{
50  switch ($_GET['installstatus'])
51  {
52    case 'ok':
53      array_push($page['infos'],
54        l10n('plugins_install_ok'),
55        l10n('plugins_install_need_activate'));
56      break;
57
58    case 'temp_path_error':
59      array_push($page['errors'], l10n('plugins_temp_path_error'));
60      break;
61
62    case 'dl_archive_error':
63      array_push($page['errors'], l10n('plugins_dl_archive_error'));
64      break;
65
66    case 'archive_error':
67      array_push($page['errors'], l10n('plugins_archive_error'));
68      break;
69
70    default:
71      array_push($page['errors'],
72        sprintf(l10n('plugins_extract_error'), $_GET['installstatus']),
73        l10n('plugins_check_chmod'));
74  } 
75}
76
77//--------------------------------------------------------------------Tabsheet
78set_plugins_tabsheet($page['page']);
79
80//---------------------------------------------------------------Order options
81$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
82$template->assign('order_options',
83  array(
84    $link.'date' => l10n('Post date'),
85    $link.'revision' => l10n('plugins_revisions'),
86    $link.'name' => l10n('Name'),
87    $link.'author' => l10n('Author')));
88$template->assign('order_selected', $link.$order);
89
90// +-----------------------------------------------------------------------+
91// |                     start template output                             |
92// +-----------------------------------------------------------------------+
93$plugins->get_server_plugins(true);
94
95if (is_array($plugins->server_plugins))
96{
97  $plugins->sort_server_plugins($order);
98
99  foreach($plugins->server_plugins as $plugin)
100  {
101    $ext_desc = nl2br(htmlspecialchars(strip_tags(
102                  utf8_encode($plugin['ext_description']))));
103
104    $ver_desc = sprintf(l10n('plugins_description'),
105            $plugin['version'],
106            date('Y-m-d', $plugin['date']),
107            nl2br(htmlspecialchars(strip_tags(
108              utf8_encode($plugin['description'])))));
109
110    $url_auto_install = htmlentities($base_url)
111      . '&amp;extension=' . $plugin['id_extension']
112      . '&amp;install=%2Fupload%2Fextension-' . $plugin['id_extension']
113      . '%2Frevision-' . $plugin['id_revision'] . '%2F'
114      .  str_replace(' ', '%20',$plugin['url']);
115
116    $url_download = PEM_URL .'/upload/extension-'.$plugin['id_extension']
117      . '/revision-' . $plugin['id_revision']
118      . '/' . str_replace(' ', '%20',$plugin['url']);
119
120    $template->append('plugins',
121        array('EXT_NAME' => $plugin['ext_name'],
122          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['id_extension'],
123          'EXT_DESC' => $ext_desc,
124          'VERSION' => $plugin['version'],
125          'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin['id_revision'],
126          'DATE' => date('Y-m-d', $plugin['date']),
127          'VER_DESC' => $ver_desc,
128          'AUTHOR' => $plugin['author'],
129          'URL_INSTALL' => $url_auto_install,
130          'URL_DOWNLOAD' => $url_download));
131  }
132}
133else
134{
135  array_push($page['errors'], l10n('plugins_server_error'));
136}
137
138$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
139?>
Note: See TracBrowser for help on using the repository browser.