source: extensions/autoupdate/trunk/update_ext.inc.php @ 9723

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

Add pwg_token to ajax request.

File size: 4.8 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5// Plugins
6include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
7$plugins = new plugins();
8$update_plugins = array();
9if ($plugins->get_server_plugins())
10{
11  foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
12  {
13    if (isset($fs_plugin['extension'])
14      and isset($plugins->server_plugins[$fs_plugin['extension']]))
15    {
16      $plugin_info = $plugins->server_plugins[$fs_plugin['extension']];
17
18      if (!$plugins->plugin_version_compare($fs_plugin['version'], $plugin_info['revision_name']))
19      {
20        $update_plugins[] = array(
21          'ID' => $plugin_info['extension_id'],
22          'PLUGIN_ID' => $plugin_id,
23          'REVISION_ID' => $plugin_info['revision_id'],
24          'EXT_NAME' => $fs_plugin['name'],
25          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'],
26          'EXT_DESC' => trim($plugin_info['extension_description'], " \n\r"),
27          'REV_DESC' => trim($plugin_info['revision_description'], " \n\r"),
28          'CURRENT_VERSION' => $fs_plugin['version'],
29          'NEW_VERSION' => $plugin_info['revision_name'],
30          'AUTHOR' => $plugin_info['author_name'],
31          'DOWNLOADS' => $plugin_info['extension_nb_downloads'],
32          'URL_DOWNLOAD' => $plugin_info['download_url'] . '&amp;origin=piwigo_download',
33          'IGNORED' => in_array($plugin_id, $conf['AU_ignore']['plugins']),
34        );
35      }
36    }
37  }
38}
39
40// Themes
41include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
42$themes = new themes();
43$update_themes = array();
44if ($themes->get_server_themes())
45{
46  foreach($themes->fs_themes as $theme_id => $fs_theme)
47  {
48    if (isset($fs_theme['extension'])
49      and isset($themes->server_themes[$fs_theme['extension']]))
50    {
51      $theme_info = $themes->server_themes[$fs_theme['extension']];
52
53      if (!$themes->theme_version_compare($fs_theme['version'], $theme_info['revision_name']))
54      {
55        $update_themes[] = array(
56          'ID' => $theme_info['extension_id'],
57          'THEME_ID' => $theme_id,
58          'REVISION_ID' => $theme_info['revision_id'],
59          'EXT_NAME' => $fs_theme['name'],
60          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$theme_info['extension_id'],
61          'EXT_DESC' => trim($theme_info['extension_description'], " \n\r"),
62          'REV_DESC' => trim($theme_info['revision_description'], " \n\r"),
63          'CURRENT_VERSION' => $fs_theme['version'],
64          'NEW_VERSION' => $theme_info['revision_name'],
65          'AUTHOR' => $theme_info['author_name'],
66          'DOWNLOADS' => $theme_info['extension_nb_downloads'],
67          'URL_DOWNLOAD' => $theme_info['download_url'] . '&amp;origin=piwigo_download',
68          'IGNORED' => in_array($theme_id, $conf['AU_ignore']['themes']),
69        );
70      }
71    }
72  }
73}
74
75// Languages
76include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php');
77$languages = new languages();
78$update_languages = array();
79if ($languages->get_server_languages())
80{
81  foreach($languages->fs_languages as $language_id => $fs_language)
82  {
83    if (isset($fs_language['extension'])
84      and isset($languages->server_languages[$fs_language['extension']]))
85    {
86      $language_info = $languages->server_languages[$fs_language['extension']];
87
88      if (!$languages->language_version_compare($fs_language['version'], $language_info['revision_name']))
89      {
90        $update_languages[] = array(
91          'ID' => $language_info['extension_id'],
92          'LANGUAGE_ID' => $language_id,
93          'REVISION_ID' => $language_info['revision_id'],
94          'EXT_NAME' => $fs_language['name'],
95          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$language_info['extension_id'],
96          'EXT_DESC' => trim($language_info['extension_description'], " \n\r"),
97          'REV_DESC' => trim($language_info['revision_description'], " \n\r"),
98          'CURRENT_VERSION' => $fs_language['version'],
99          'NEW_VERSION' => $language_info['revision_name'],
100          'AUTHOR' => $language_info['author_name'],
101          'DOWNLOADS' => $language_info['extension_nb_downloads'],
102          'URL_DOWNLOAD' => $language_info['download_url'] . '&amp;origin=piwigo_download',
103          'IGNORED' => in_array($language_id, $conf['AU_ignore']['languages']),
104        );
105      }
106    }
107  }
108}
109
110$template->assign('update_plugins', $update_plugins);
111$template->assign('update_themes', $update_themes);
112$template->assign('update_languages', $update_languages);
113$template->assign('SHOW_RESET', (!empty($conf['AU_ignore']['plugins']) or !empty($conf['AU_ignore']['themes']) or !empty($conf['AU_ignore']['languages'])));
114$template->assign('PWG_TOKEN', get_pwg_token());
115$template->set_filename('plugin_admin_content', realpath(AUTOUPDATE_PATH.'template/update_ext.tpl'));
116$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
117
118?>
Note: See TracBrowser for help on using the repository browser.