checkbox_shown) { return $id; } if (!$email = $sg_subscribe->current_viewer_subscription_status()) : $checked_status = ( !empty($_COOKIE['subscribe_checkbox_'.COOKIEHASH]) && 'checked' == $_COOKIE['subscribe_checkbox_'.COOKIEHASH] ) ? true : false; ?>

clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments"> />

clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments"> manage_link($email, true, false), $sg_subscribe->author_text); ?>

clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments"> manage_link($email, true, false), $sg_subscribe->subscribed_text); ?>

checkbox_shown = true; return $id; } /* -------------------------------------------------------------------- */ /* This function outputs a "subscribe without commenting" form. */ /* Place this somewhere within "the loop", but NOT within another form */ /* This is NOT inserted automaticallly... you must place it yourself */ /* -------------------------------------------------------------------- */ function show_manual_subscription_form() { global $id, $sg_subscribe, $user_email; sg_subscribe_start(); $sg_subscribe->show_errors('solo_subscribe', '
', '
', __('Error: ', 'subscribe-to-comments'), '
'); if (!$sg_subscribe->current_viewer_subscription_status()) : get_currentuserinfo(); ?>


comment_subscribe == 'Y') { return true; } else { return false; } } // Do not change anything below this line include(dirname(__FILE__) . "/Subscribe.class.php"); include(dirname(__FILE__) . "/Settings.class.php"); function stc_checkbox_state($data) { if (isset($_POST['subscribe'])) { setcookie('subscribe_checkbox_'. COOKIEHASH, 'checked', time() + 30000000, COOKIEPATH); } else { setcookie('subscribe_checkbox_'. COOKIEHASH, 'unchecked', time() + 30000000, COOKIEPATH); } return $data; } function sg_subscribe_start() { global $sg_subscribe; if (!$sg_subscribe) { $path = PLUGINDIR . "/gurken-subscribe-to-comments/extras"; load_plugin_textdomain('subscribe-to-comments', $path); $sg_subscribe = new sg_subscribe(); } } // This will be overridden if the user manually places the function // in the comments form before the comment_form do_action() call add_action('comment_form', 'show_subscription_checkbox'); // priority is very low (50) because we want to let anti-spam plugins have their way first. add_action('comment_post', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->send_notifications($a);'), 50); add_action('comment_post', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->add_subscriber($a);')); add_action('wp_set_comment_status', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); return $sg_subscribe->send_notifications($a);')); add_action('admin_menu', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); $sg_subscribe->add_admin_menu();')); add_action('admin_head', create_function('$a', 'global $sg_subscribe; sg_subscribe_start(); $sg_subscribe->sg_wp_head();')); add_action('edit_comment', array('sg_subscribe', 'on_edit')); // save users' checkbox preference add_filter('preprocess_comment', 'stc_checkbox_state', 1); // detect "subscribe without commenting" attempts add_action('init', create_function('$a','global $sg_subscribe; if ( $_POST[\'solo-comment-subscribe\'] == \'solo-comment-subscribe\' && is_numeric($_POST[\'postid\']) ) { sg_subscribe_start(); $sg_subscribe->solo_subscribe(stripslashes($_POST[\'email\']), (int) $_POST[\'postid\']); }') ); if (isset($_REQUEST['wp-subscription-manager'])) { add_action('template_redirect', 'sg_subscribe_admin_standalone'); } function sg_subscribe_admin_standalone() { sg_subscribe_admin(true); } function sg_subscribe_admin($standalone = false) { global $wpdb, $sg_subscribe, $wp_version; sg_subscribe_start(); if ($standalone) { $sg_subscribe->form_action = get_option('home') . '/?wp-subscription-manager=1'; $sg_subscribe->standalone = true; ob_start(create_function('$a', 'return str_replace("", "<title> " . __("Subscription Manager", "subscribe-to-comments") . " » ", $a);')); } else { if (version_compare($wp_version, '2.7.0') === 1) { $sg_subscribe->form_action = 'tools.php?page=stc-management'; } else { $sg_subscribe->form_action = 'edit.php?page=stc-management'; } $sg_subscribe->standalone = false; } $sg_subscribe->manager_init(); get_currentuserinfo(); if (!$sg_subscribe->validate_key()) { die ( __('You may not access this page without a valid key.', 'subscribe-to-comments')); } $sg_subscribe->determine_action(); switch ($sg_subscribe->action) : case "change_email" : if ( $sg_subscribe->change_email() ) { $sg_subscribe->add_message(sprintf(__('All notifications that were formerly sent to <strong>%1$s</strong> will now be sent to <strong>%2$s</strong>!', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->new_email)); // change info to the new email $sg_subscribe->email = $sg_subscribe->new_email; unset($sg_subscribe->new_email); $sg_subscribe->key = $sg_subscribe->generate_key($sg_subscribe->email); $sg_subscribe->validate_key(); } break; case "remove_subscriptions" : $postsremoved = $sg_subscribe->remove_subscriptions($_POST['subscrips']); if ( $postsremoved > 0 ) $sg_subscribe->add_message(sprintf(__('<strong>%1$s</strong> %2$s removed successfully.', 'subscribe-to-comments'), $postsremoved, ($postsremoved != 1) ? __('subscriptions', 'subscribe-to-comments') : __('subscription', 'subscribe-to-comments'))); break; case "remove_block" : if ( $sg_subscribe->remove_block($sg_subscribe->email) ) $sg_subscribe->add_message(sprintf(__('The block on <strong>%s</strong> has been successfully removed.', 'subscribe-to-comments'), $sg_subscribe->email)); else $sg_subscribe->add_error(sprintf(__('<strong>%s</strong> isn\'t blocked!', 'subscribe-to-comments'), $sg_subscribe->email), 'manager'); break; case "email_change_request" : if ( $sg_subscribe->is_blocked($sg_subscribe->email) ) $sg_subscribe->add_error(sprintf(__('<strong>%s</strong> has been blocked from receiving notifications. You will have to have the administrator remove the block before you will be able to change your notification address.', 'subscribe-to-comments'), $sg_subscribe->email)); else if ($sg_subscribe->change_email_request($sg_subscribe->email, $sg_subscribe->new_email)) $sg_subscribe->add_message(sprintf(__('Your change of e-mail request was successfully received. Please check your old account (<strong>%s</strong>) in order to confirm the change.', 'subscribe-to-comments'), $sg_subscribe->email)); break; case "block_request" : if ($sg_subscribe->block_email_request($sg_subscribe->email )) $sg_subscribe->add_message(sprintf(__('Your request to block <strong>%s</strong> from receiving any further notifications has been received. In order for you to complete the block, please check your e-mail and click on the link in the message that has been sent to you.', 'subscribe-to-comments'), $sg_subscribe->email)); break; case "solo_subscribe" : $sg_subscribe->add_message(__('Please check your emails and click on the confirmation link.', 'subscribe-to-comments')); //$sg_subscribe->add_message(sprintf(__('<strong>%1$s</strong> has been successfully subscribed to %2$s', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->entry_link($_GET['subscribeid']))); break; case "block" : if ($sg_subscribe->add_block($sg_subscribe->email)) $sg_subscribe->add_message(sprintf(__('<strong>%1$s</strong> has been added to the "do not mail" list. You will no longer receive any notifications from this site. If this was done in error, please contact the <a href="mailto:%2$s">site administrator</a> to remove this block.', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->site_email)); else $sg_subscribe->add_error(sprintf(__('<strong>%s</strong> has already been blocked!', 'subscribe-to-comments'), $sg_subscribe->email), 'manager'); $sg_subscribe->key = $sg_subscribe->generate_key($sg_subscribe->email); $sg_subscribe->validate_key(); break; case "opt_in": $sg_subscribe->add_opt_in_subscriber($_REQUEST["id"]); break; case "solo_opt_in": $extra_key = empty($_GET["extra_key"]) ? NULL : $_GET["extra_key"]; $sg_subscribe->solo_opt_in_subscriber($_REQUEST["id"], $extra_key); break; endswitch; if ( $sg_subscribe->standalone ) { if ( !$sg_subscribe->use_wp_style && !empty($sg_subscribe->header) ) { @include($sg_subscribe->header); echo $sg_subscribe->before_manager; } else { ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title><?php printf(__('%s Comment Subscription Manager', 'subscribe-to-comments'), bloginfo('name')); ?> sg_wp_head(); ?> show_messages(); ?> show_errors(); ?>

ref)) : ?> add_message(sprintf(__('Return to the page you were viewing: %s', 'subscribe-to-comments'), $sg_subscribe->entry_link(url_to_postid($sg_subscribe->ref), $sg_subscribe->ref))); ?> show_messages(); ?> is_blocked() ) { ?>

%s. This should only be done if the user has specifically requested it.', 'subscribe-to-comments'), $sg_subscribe->email); ?>

hidden_form_fields(); ?>

%1$s from this site. If this is incorrect, or if you wish to have the block removed, please contact the site administrator.', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->site_email); ?>

subscriptions_from_email(); ?> email) && !is_array($postlist) && $sg_subscribe->email != $sg_subscribe->site_email && $sg_subscribe->email != get_bloginfo('admin_email')) { if (is_email($sg_subscribe->email)) { if ($sg_subscribe->is_subscribed_not_approved($sg_subscribe->email)) { $sg_subscribe->add_error( sprintf( __('%s is subscribed but the comment has not been approved yet.', 'subscribe-to-comments'), $sg_subscribe->email ) ); } else { $sg_subscribe->add_error(sprintf(__('%s is not subscribed to any posts on this site.', 'subscribe-to-comments'), $sg_subscribe->email)); } if ($sg_subscribe->is_subscribed_not_confirmed()) { $sg_subscribe->add_error(__("You have a pending subscription, please check your emails and click on the confirmation link.", 'subscribe-to-comments')); } } else { $sg_subscribe->add_error(sprintf(__('%s is not a valid e-mail address.', 'subscribe-to-comments'), $sg_subscribe->email)); } } ?> show_errors(); ?>

get_results("SELECT distinct LCASE(comment_author_email) as email, count(distinct comment_post_ID) as ccount FROM $wpdb->comments WHERE comment_subscribe='Y' AND comment_approved = '1' GROUP BY email ORDER BY ccount DESC $stc_limit"); $all_pm_subscriptions = $wpdb->get_results("SELECT distinct LCASE(meta_value) as email, count(post_id) as ccount FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments' GROUP BY email ORDER BY ccount DESC $stc_limit"); $all_subscriptions = array(); foreach ( array('all_ct_subscriptions', 'all_pm_subscriptions') as $each ) { foreach ( (array) $$each as $sub ) { if ( !isset($all_subscriptions[$sub->email]) ) $all_subscriptions[$sub->email] = (int) $sub->ccount; else $all_subscriptions[$sub->email] += (int) $sub->ccount; } } if ( !$_REQUEST['showallsubscribers'] ) : ?>

CC:-field format (for bulk e-mailing)', 'subscribe-to-comments'); ?>

\n"; foreach ( (array) $all_subscriptions as $email => $ccount ) { $enc_email = urlencode($email); echo "
  • ($ccount) " . wp_specialchars($email) . "
  • \n"; } echo "\n"; } ?> get_results("SELECT distinct comment_post_ID as post_id, count(distinct comment_author_email) as ccount FROM $wpdb->comments WHERE comment_subscribe='Y' AND comment_approved = '1' GROUP BY post_id ORDER BY ccount DESC LIMIT 25"); $top_subscribed_posts2 = $wpdb->get_results("SELECT distinct post_id, count(distinct meta_value) as ccount FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments' GROUP BY post_id ORDER BY ccount DESC LIMIT 25"); $all_top_posts = array(); foreach ( array('top_subscribed_posts1', 'top_subscribed_posts2') as $each ) { foreach ( (array) $$each as $pid ) { if ( !isset($all_top_posts[$pid->post_id]) ) $all_top_posts[$pid->post_id] = (int) $pid->ccount; else $all_top_posts[$pid->post_id] += (int) $pid->ccount; } } arsort($all_top_posts); echo ""; ?>
    0 && is_array($postlist) ) { ?>

    %s is subscribed to the posts listed below. To unsubscribe to one or more posts, click the checkbox next to the title, then click "Remove Selected Subscription(s)" at the bottom of the list.', 'subscribe-to-comments'), $sg_subscribe->email); ?>

    hidden_form_fields(); ?>

    hidden_form_fields(); ?>

    %s to be blocked from receiving any notifications from this site, click the button below. This should be reserved for cases where someone is signing you up for notifications without your consent.', 'subscribe-to-comments'), $sg_subscribe->email); ?>

    hidden_form_fields(); ?>

    %s).', 'subscribe-to-comments'), $sg_subscribe->email); ?>

    standalone ) : ?> use_wp_style ) : echo $sg_subscribe->after_manager; if ( !empty($sg_subscribe->sidebar) ) @include_once($sg_subscribe->sidebar); if ( !empty($sg_subscribe->footer) ) @include_once($sg_subscribe->footer); ?>