source: trunk/admin/plugins_new.php @ 2255

Last change on this file since 2255 was 2255, checked in by rvelices, 16 years ago
  • plugins.php does only the tabsheet - nothing else
  • need to review plugins_update.php upgrade action
  • 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// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
5// +-----------------------------------------------------------------------+
6// | file          : $Id: plugins_new.php 2255 2008-03-06 02:29:29Z rvelices $
7// | last update   : $Date: 2008-03-06 02:29:29 +0000 (Thu, 06 Mar 2008) $
8// | last modifier : $Author: rvelices $
9// | revision      : $Revision: 2255 $
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
31
32$fs_plugins = get_fs_plugins();
33$my_base_url= get_root_url().'admin.php'.get_query_string_diff( array('install', 'extension', 'installstatus', 'order') );
34
35
36$template->set_filenames(array('plugins' => 'admin/plugins_new.tpl'));
37
38
39//------------------------------------------------------automatic installation
40if (isset($_GET['install']) and isset($_GET['extension']) and !is_adviser())
41{
42  include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
43
44  $install_status  = extract_plugin_files('install',
45                      $_GET['install'],
46                      $_GET['extension']);
47
48  redirect($my_base_url . '&installstatus=' . $install_status);
49}
50
51
52//--------------------------------------------------------------install result
53if (isset($_GET['installstatus']))
54{
55  switch ($_GET['installstatus'])
56  {
57  case 'ok':
58    array_push($page['infos'], l10n('plugins_install_ok'), l10n('plugins_install_need_activate'));
59    break;
60
61  case 'temp_path_error':
62    array_push($page['errors'], l10n('plugins_temp_path_error'));
63    break;
64
65  case 'dl_archive_error':
66    array_push($page['errors'], l10n('plugins_dl_archive_error'));
67    break;
68
69  case 'archive_error':
70    array_push($page['errors'], l10n('plugins_archive_error'));
71    break;
72
73  default:
74    array_push($page['errors'], sprintf(l10n('plugins_extract_error'), $_GET['installstatus']), l10n('plugins_check_chmod'));
75  }
76}
77
78
79//----------------------------------------------------------------sort options
80$order = isset($_GET['order']) ? $_GET['order'] : 'date';
81
82$template->assign('order',
83    array($my_base_url.'&amp;order=date' => l10n('Post date'),
84          $my_base_url.'&amp;order=name' => l10n('Name'),
85          $my_base_url.'&amp;order=author' => l10n('Author')));
86
87$template->assign('selected', $my_base_url.'&amp;order='.$order);
88
89
90// +-----------------------------------------------------------------------+
91// |                     start template output                             |
92// +-----------------------------------------------------------------------+
93$plugins_infos = check_server_plugins($fs_plugins, true);
94if ($plugins_infos !== false)
95{
96  if ($order == 'date') krsort($plugins_infos);
97  else uasort($plugins_infos, 'extension_'.$order.'_compare');
98
99  foreach($plugins_infos 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 = $my_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        . '/' . $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          'VER_DESC' => $ver_desc,
127          'AUTHOR' => $plugin['author'],
128          'URL_INSTALL' => $url_auto_install,
129          'URL_DOWNLOAD' => $url_download));
130  }
131}
132else
133{
134  array_push($page['errors'], l10n('plugins_server_error'));
135}
136
137$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
138?>
Note: See TracBrowser for help on using the repository browser.