source: extensions/autoupdate/trunk/plugins_update.php @ 6264

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

Webmaster status is required to launch any upgrade process.
Display "save template directory" fielset only if Piwigo version < 2.1.
Add random parameter in all_version url (to avoid cache server).
Move empty directory to trash is rmdir fail.

File size: 1.7 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5function autoupdate_plugins_update_filter($content, &$smarty)
6{
7  $l_key = version_compare(PHPWG_VERSION, '2.1', '<') ? 'plugins_download' : 'Download file';
8
9  $search = '<a href="{$plugin.URL_DOWNLOAD}">{\''.$l_key.'\'|@translate}</a>';
10
11  $replacement = '  <a href="{$plugin.URL_DOWNLOAD}">{\''.$l_key.'\'|@translate}</a><br>
12    <a href="#" onClick="autoupdate_ignore(\'{$plugin.EXT_NAME}\', true, {$smarty.foreach.plugins_loop.index}); return false;" id="au_ignore_{$smarty.foreach.plugins_loop.index}_true" {if $plugin.EXT_NAME|@in_array:$AU_IGNORE_LIST}style="display: none;"{/if}>{\'Don\\\'t notify on admin homepage\'|@translate}</a>
13    <a href="#" onClick="autoupdate_ignore(\'{$plugin.EXT_NAME}\', false, {$smarty.foreach.plugins_loop.index}); return false;" id="au_ignore_{$smarty.foreach.plugins_loop.index}_false" {if !$plugin.EXT_NAME|@in_array:$AU_IGNORE_LIST}style="display: none;"{/if}>{\'Notify on admin homepage\'|@translate}</a>';
14
15  return str_replace($search, $replacement, $content);; 
16}
17
18$script_head = '
19<script type="text/javascript">
20function autoupdate_ignore(name, bool, id) {
21  jQuery.post(
22    "'.PHPWG_ROOT_PATH.'plugins/autoupdate/remote.php",
23    { "autoupdate_ignore'.(version_compare(PHPWG_VERSION, '2.1', '<') ? '[]' : '').'": [name, bool] },
24    function(data) {
25      if (data == "ok") {
26        jQuery("#au_ignore_"+id+"_"+bool).hide();
27        jQuery("#au_ignore_"+id+"_"+!bool).show();
28      }
29    }
30  );
31}
32</script>
33';
34
35$template->block_html_head('', $script_head, $smarty, $repeat);
36$template->set_prefilter('plugins', 'autoupdate_plugins_update_filter');
37$template->assign('AU_IGNORE_LIST', unserialize($conf['autoupdate_ignore_list']));
38
39?>
Note: See TracBrowser for help on using the repository browser.