source: trunk/admin/updates_ext.php @ 17386

Last change on this file since 17386 was 10596, checked in by patdenice, 14 years ago

Only reset one type of extension.

File size: 3.6 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010      Pierrick LE GALL             http://piwigo.org |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
19// | USA.                                                                  |
20// +-----------------------------------------------------------------------+
21
22if( !defined("PHPWG_ROOT_PATH") )
23{
24  die ("Hacking attempt!");
25}
26
27$conf['updates_ignored'] = unserialize($conf['updates_ignored']);
28
29include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php');
30$autoupdate = new updates($page['page']);
31
32$show_reset = false;
33if (!$autoupdate->get_server_extensions())
34{
35  array_push($page['errors'], l10n('Can\'t connect to server.'));
36  return;
37}
38
39foreach ($autoupdate->types as $type)
40{
41  $fs = 'fs_'.$type;
42  $server = 'server_'.$type;
43  $server_ext = $autoupdate->$type->$server;
44  $fs_ext = $autoupdate->$type->$fs;
45
46  if (empty($server_ext))
47  {
48    continue;
49  }
50
51  foreach($fs_ext as $ext_id => $fs_ext)
52  {
53    if (!isset($fs_ext['extension']) or !isset($server_ext[$fs_ext['extension']]))
54    {
55      continue;
56    }
57
58    $ext_info = $server_ext[$fs_ext['extension']];
59
60    if (!$autoupdate->version_compare($fs_ext['version'], $ext_info['revision_name'], $type))
61    {
62      $template->append('update_'.$type, array(
63        'ID' => $ext_info['extension_id'],
64        'REVISION_ID' => $ext_info['revision_id'],
65        'EXT_ID' => $ext_id,
66        'EXT_NAME' => $fs_ext['name'],
67        'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$ext_info['extension_id'],
68        'EXT_DESC' => trim($ext_info['extension_description'], " \n\r"),
69        'REV_DESC' => trim($ext_info['revision_description'], " \n\r"),
70        'CURRENT_VERSION' => $fs_ext['version'],
71        'NEW_VERSION' => $ext_info['revision_name'],
72        'AUTHOR' => $ext_info['author_name'],
73        'DOWNLOADS' => $ext_info['extension_nb_downloads'],
74        'URL_DOWNLOAD' => $ext_info['download_url'] . '&amp;origin=piwigo_download',
75        'IGNORED' => in_array($ext_id, $conf['updates_ignored'][$type]),
76        )
77      );
78    }
79  }
80
81  if (!empty($conf['updates_ignored'][$type]))
82  {
83    $show_reset = true;
84  }
85}
86
87$template->assign('SHOW_RESET', $show_reset);
88$template->assign('PWG_TOKEN', get_pwg_token());
89$template->assign('EXT_TYPE', $page['page'] == 'updates' ? 'extensions' : $page['page']);
90$template->set_filename('plugin_admin_content', 'updates_ext.tpl');
91$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
92
93?>
Note: See TracBrowser for help on using the repository browser.