set_prefilter('picture', 'stc_on_picture_prefilter'); } function stc_on_picture_prefilter($template, &$smarty) { global $user, $picture; ## subscribe while add a comment ## $search[0] = ''; $replace[0] = ' '; if (is_a_guest()) { $replace[0].= ' {footer_script require="jquery"}{literal} jQuery(document).ready(function() { $("input[name=stc_check]").change(function() { if ($(this).is(":checked")) $("#stc_mail").css("display", ""); else $("#stc_mail").css("display", "none"); }); }); {/literal}{/footer_script}'; } $replace[0].= $search[0]; ## subscribe at any moment ## $search[1] = '{if isset($comment_add)}'; $replace[1] = $search[1].'
'; return str_replace($search, $replace, $template); } /** * add field and on album page */ function stc_on_album() { global $page, $template, $pwg_loaded_plugins; if ( script_basename() != 'index' or !isset($page['section']) or !isset($pwg_loaded_plugins['Comments_on_Albums']) or $page['section'] != 'categories' or !isset($page['category']) ) { return; } if (isset($_POST['stc_check_stdl'])) { subscribe_to_comments($page['category']['id'], @$_POST['stc_mail_stdl'], 'category'); } $template->set_prefilter('comments_on_albums', 'stc_on_album_prefilter'); } function stc_on_album_prefilter($template, &$smarty) { global $user, $page; ## subscribe while add a comment ## $search[0] = ''; $replace[0] = ' '; if (is_a_guest()) { $replace[0].= ' {footer_script require="jquery"}{literal} jQuery(document).ready(function() { $("input[name=stc_check]").change(function() { if ($(this).is(":checked")) $("#stc_mail").css("display", ""); else $("#stc_mail").css("display", "none"); }); }); {/literal}{/footer_script}'; } $replace[0].= $search[0]; ## subscribe at any moment ## $search[1] = '{if isset($comment_add)}'; $replace[1] = $search[1].' '; return str_replace($search, $replace, $template); } ?>