source: trunk/admin/plugins_new.php @ 2577

Last change on this file since 2577 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
RevLine 
[2242]1<?php
2// +-----------------------------------------------------------------------+
[2297]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// +-----------------------------------------------------------------------+
[2242]23
24if( !defined("PHPWG_ROOT_PATH") )
25{
26  die ("Hacking attempt!");
27}
28
[2263]29include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
[2255]30
[2530]31$template->set_filenames(array('plugins' => 'plugins_new.tpl'));
[2255]32
[2263]33$order = isset($_GET['order']) ? $_GET['order'] : 'date';
[2264]34$base_url = get_root_url().'admin.php?page='.$page['page'].'&order='.$order;
[2255]35
[2264]36$plugins = new plugins();
[2242]37
38//------------------------------------------------------automatic installation
39if (isset($_GET['install']) and isset($_GET['extension']) and !is_adviser())
40{
[2264]41  $install_status =
42    $plugins->extract_plugin_files('install', $_GET['install'], $_GET['extension']);
43
44  redirect($base_url.'&installstatus='.$install_status);
[2242]45}
46
47//--------------------------------------------------------------install result
48if (isset($_GET['installstatus']))
49{
[2264]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  } 
[2242]75}
76
[2264]77//--------------------------------------------------------------------Tabsheet
[2272]78set_plugins_tabsheet($page['page']);
[2264]79
80//---------------------------------------------------------------Order options
[2272]81$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
[2264]82$template->assign('order_options',
83  array(
84    $link.'date' => l10n('Post date'),
[2272]85    $link.'revision' => l10n('plugins_revisions'),
[2264]86    $link.'name' => l10n('Name'),
87    $link.'author' => l10n('Author')));
88$template->assign('order_selected', $link.$order);
89
[2242]90// +-----------------------------------------------------------------------+
91// |                     start template output                             |
92// +-----------------------------------------------------------------------+
[2264]93$plugins->get_server_plugins(true);
[2263]94
[2272]95if (is_array($plugins->server_plugins))
[2242]96{
[2272]97  $plugins->sort_server_plugins($order);
98
[2263]99  foreach($plugins->server_plugins as $plugin)
[2243]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
[2264]110    $url_auto_install = htmlentities($base_url)
[2263]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']);
[2245]115
[2243]116    $url_download = PEM_URL .'/upload/extension-'.$plugin['id_extension']
[2263]117      . '/revision-' . $plugin['id_revision']
118      . '/' . str_replace(' ', '%20',$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'],
[2272]126          'DATE' => date('Y-m-d', $plugin['date']),
[2243]127          'VER_DESC' => $ver_desc,
128          'AUTHOR' => $plugin['author'],
129          'URL_INSTALL' => $url_auto_install,
130          'URL_DOWNLOAD' => $url_download));
131  }
[2242]132}
133else
134{
[2243]135  array_push($page['errors'], l10n('plugins_server_error'));
[2242]136}
137
[2255]138$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
[2242]139?>
Note: See TracBrowser for help on using the repository browser.