source: trunk/admin/plugins_new.php @ 8079

Last change on this file since 8079 was 6363, checked in by plg, 14 years ago

remove all svn:mergeinfo properties

  • Property svn:eol-style set to LF
File size: 5.2 KB
RevLine 
[2242]1<?php
2// +-----------------------------------------------------------------------+
[2297]3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
[5196]5// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
[2297]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
[5406]39if (isset($_GET['revision']) and isset($_GET['extension']))
[2242]40{
[5406]41  if (!is_webmaster())
42  {
43    array_push($page['errors'], l10n('Webmaster status is required.'));
44  }
45  else
46  {
47    check_pwg_token();
48   
49    $install_status = $plugins->extract_plugin_files('install', $_GET['revision'], $_GET['extension']);
[2264]50
[5406]51    redirect($base_url.'&installstatus='.$install_status);
52  }
[2242]53}
54
55//--------------------------------------------------------------install result
56if (isset($_GET['installstatus']))
57{
[2264]58  switch ($_GET['installstatus'])
59  {
60    case 'ok':
61      array_push($page['infos'],
[5021]62        l10n('Plugin has been successfully copied'),
63        l10n('You might go to plugin list to install and activate it.'));
[2264]64      break;
65
66    case 'temp_path_error':
[5021]67      array_push($page['errors'], l10n('Can\'t create temporary file.'));
[2264]68      break;
69
70    case 'dl_archive_error':
[5021]71      array_push($page['errors'], l10n('Can\'t download archive.'));
[2264]72      break;
73
74    case 'archive_error':
[5021]75      array_push($page['errors'], l10n('Can\'t read or extract archive.'));
[2264]76      break;
77
78    default:
79      array_push($page['errors'],
[5021]80        sprintf(l10n('An error occured during extraction (%s).'), $_GET['installstatus']),
[5297]81        l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).'));
[2264]82  } 
[2242]83}
84
[2264]85//--------------------------------------------------------------------Tabsheet
[5367]86$plugins->set_tabsheet($page['page']);
[2264]87
88//---------------------------------------------------------------Order options
[2272]89$link = get_root_url().'admin.php?page='.$page['page'].'&amp;order=';
[2264]90$template->assign('order_options',
91  array(
92    $link.'date' => l10n('Post date'),
[5021]93    $link.'revision' => l10n('Last revisions'),
[2264]94    $link.'name' => l10n('Name'),
[3143]95    $link.'author' => l10n('Author'),
96    $link.'downloads' => l10n('Number of downloads')));
[2264]97$template->assign('order_selected', $link.$order);
98
[2242]99// +-----------------------------------------------------------------------+
100// |                     start template output                             |
101// +-----------------------------------------------------------------------+
[2880]102if ($plugins->get_server_plugins(true))
[2242]103{
[2272]104  $plugins->sort_server_plugins($order);
105
[2263]106  foreach($plugins->server_plugins as $plugin)
[2243]107  {
[5515]108    $ext_desc = trim($plugin['extension_description'], " \n\r");
109    list($small_desc) = explode("\n", wordwrap($ext_desc, 200));
[2647]110
[2264]111    $url_auto_install = htmlentities($base_url)
[2647]112      . '&amp;revision=' . $plugin['revision_id']
[5195]113      . '&amp;extension=' . $plugin['extension_id']
114      . '&amp;pwg_token='.get_pwg_token()
115    ;
[2245]116
[2647]117    $template->append('plugins', array(
[5515]118      'ID' => $plugin['extension_id'],
[2647]119      'EXT_NAME' => $plugin['extension_name'],
120      'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['extension_id'],
[5515]121      'SMALL_DESC' => trim($small_desc, " \r\n"),
122      'BIG_DESC' => $ext_desc,
[2647]123      'VERSION' => $plugin['revision_name'],
124      'AUTHOR' => $plugin['author_name'],
[5516]125      'DOWNLOADS' => $plugin['extension_nb_downloads'],
[2647]126      'URL_INSTALL' => $url_auto_install,
127      'URL_DOWNLOAD' => $plugin['download_url'] . '&amp;origin=piwigo_download'));
[2243]128  }
[2242]129}
130else
131{
[5021]132  array_push($page['errors'], l10n('Can\'t connect to server.'));
[2242]133}
134
[2255]135$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
[2242]136?>
Note: See TracBrowser for help on using the repository browser.