source: trunk/admin/updates_ext.php @ 26461

Last change on this file since 26461 was 26461, checked in by mistic100, 10 years ago

Update headers to 2014. Happy new year!!

File size: 3.8 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2014 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// +-----------------------------------------------------------------------+
23
24if( !defined("PHPWG_ROOT_PATH") )
25{
26  die ("Hacking attempt!");
27}
28
29$conf['updates_ignored'] = unserialize($conf['updates_ignored']);
30
31include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php');
32$autoupdate = new updates($page['page']);
33
34$show_reset = false;
35if (!$autoupdate->get_server_extensions())
36{
37  $page['errors'][] = l10n('Can\'t connect to server.');
38  return; // TODO: remove this return and add a proper "page killer"
39}
40
41foreach ($autoupdate->types as $type)
42{
43  $fs = 'fs_'.$type;
44  $server = 'server_'.$type;
45  $server_ext = $autoupdate->$type->$server;
46  $fs_ext = $autoupdate->$type->$fs;
47
48  if (empty($server_ext))
49  {
50    continue;
51  }
52
53  foreach($fs_ext as $ext_id => $fs_ext)
54  {
55    if (!isset($fs_ext['extension']) or !isset($server_ext[$fs_ext['extension']]))
56    {
57      continue;
58    }
59
60    $ext_info = $server_ext[$fs_ext['extension']];
61
62    if (!$autoupdate->version_compare($fs_ext['version'], $ext_info['revision_name'], $type))
63    {
64      $template->append('update_'.$type, array(
65        'ID' => $ext_info['extension_id'],
66        'REVISION_ID' => $ext_info['revision_id'],
67        'EXT_ID' => $ext_id,
68        'EXT_NAME' => $fs_ext['name'],
69        'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$ext_info['extension_id'],
70        'EXT_DESC' => trim($ext_info['extension_description'], " \n\r"),
71        'REV_DESC' => trim($ext_info['revision_description'], " \n\r"),
72        'CURRENT_VERSION' => $fs_ext['version'],
73        'NEW_VERSION' => $ext_info['revision_name'],
74        'AUTHOR' => $ext_info['author_name'],
75        'DOWNLOADS' => $ext_info['extension_nb_downloads'],
76        'URL_DOWNLOAD' => $ext_info['download_url'] . '&amp;origin=piwigo_download',
77        'IGNORED' => in_array($ext_id, $conf['updates_ignored'][$type]),
78        )
79      );
80    }
81  }
82
83  if (!empty($conf['updates_ignored'][$type]))
84  {
85    $show_reset = true;
86  }
87}
88
89$template->assign('SHOW_RESET', $show_reset);
90$template->assign('PWG_TOKEN', get_pwg_token());
91$template->assign('EXT_TYPE', $page['page'] == 'updates' ? 'extensions' : $page['page']);
92$template->set_filename('plugin_admin_content', 'updates_ext.tpl');
93$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
94
95?>
Note: See TracBrowser for help on using the repository browser.