1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | function 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|@htmlspecialchars_decode}\', true, {$smarty.foreach.plugins_loop.index}); return false;" id="au_ignore_{$smarty.foreach.plugins_loop.index}_true" {if $plugin.EXT_NAME|@htmlspecialchars_decode|@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|@htmlspecialchars_decode}\', false, {$smarty.foreach.plugins_loop.index}); return false;" id="au_ignore_{$smarty.foreach.plugins_loop.index}_false" {if !$plugin.EXT_NAME|@htmlspecialchars_decode|@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"> |
---|
20 | function 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 | ?> |
---|