source: trunk/admin/plugins_new.php @ 2255

Last change on this file since 2255 was 2255, checked in by rvelices, 17 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
RevLine 
[2242]1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
[2255]4// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
[2242]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
[2255]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
[2242]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{
[2243]42  include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
[2242]43
[2243]44  $install_status  = extract_plugin_files('install',
45                      $_GET['install'],
46                      $_GET['extension']);
[2242]47
[2243]48  redirect($my_base_url . '&installstatus=' . $install_status);
[2242]49}
50
51
52//--------------------------------------------------------------install result
53if (isset($_GET['installstatus']))
54{
[2243]55  switch ($_GET['installstatus'])
56  {
57  case 'ok':
58    array_push($page['infos'], l10n('plugins_install_ok'), l10n('plugins_install_need_activate'));
59    break;
[2245]60
[2243]61  case 'temp_path_error':
[2245]62    array_push($page['errors'], l10n('plugins_temp_path_error'));
[2243]63    break;
[2245]64
[2243]65  case 'dl_archive_error':
[2245]66    array_push($page['errors'], l10n('plugins_dl_archive_error'));
[2243]67    break;
[2242]68
[2243]69  case 'archive_error':
[2245]70    array_push($page['errors'], l10n('plugins_archive_error'));
[2243]71    break;
[2242]72
[2243]73  default:
[2245]74    array_push($page['errors'], sprintf(l10n('plugins_extract_error'), $_GET['installstatus']), l10n('plugins_check_chmod'));
[2243]75  }
[2242]76}
77
78
79//----------------------------------------------------------------sort options
80$order = isset($_GET['order']) ? $_GET['order'] : 'date';
[2245]81
82$template->assign('order',
[2255]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')));
[2245]86
[2255]87$template->assign('selected', $my_base_url.'&amp;order='.$order);
[2242]88
89
90// +-----------------------------------------------------------------------+
91// |                     start template output                             |
92// +-----------------------------------------------------------------------+
[2245]93$plugins_infos = check_server_plugins($fs_plugins, true);
[2242]94if ($plugins_infos !== false)
95{
[2243]96  if ($order == 'date') krsort($plugins_infos);
97  else uasort($plugins_infos, 'extension_'.$order.'_compare');
[2245]98
[2243]99  foreach($plugins_infos as $plugin)
100  {
101    $ext_desc = nl2br(htmlspecialchars(strip_tags(
[2242]102                  utf8_encode($plugin['ext_description']))));
[2245]103
[2243]104    $ver_desc = sprintf(l10n('plugins_description'),
105            $plugin['version'],
106            date('Y-m-d', $plugin['date']),
107            nl2br(htmlspecialchars(strip_tags(
[2242]108              utf8_encode($plugin['description'])))));
[2245]109
[2255]110    $url_auto_install = $my_base_url
[2243]111        . '&amp;extension=' . $plugin['id_extension']
112        . '&amp;install=%2Fupload%2Fextension-' . $plugin['id_extension']
113        . '%2Frevision-' . $plugin['id_revision'] . '%2F'
[2242]114        .  str_replace(' ', '%20',$plugin['url']);
[2245]115
[2243]116    $url_download = PEM_URL .'/upload/extension-'.$plugin['id_extension']
117        . '/revision-' . $plugin['id_revision']
118        . '/' . $plugin['url'];
[2245]119
[2243]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  }
[2242]131}
132else
133{
[2243]134  array_push($page['errors'], l10n('plugins_server_error'));
[2242]135}
136
[2255]137$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
[2242]138?>
Note: See TracBrowser for help on using the repository browser.