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("", " " . __("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 %1$s will now be sent to %2$s!', '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(__('%1$s %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 %s has been successfully removed.', 'subscribe-to-comments'), $sg_subscribe->email));
else
$sg_subscribe->add_error(sprintf(__('%s 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(__('%s 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 (%s) 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 %s 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(__('%1$s 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(__('%1$s 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 site administrator to remove this block.', 'subscribe-to-comments'), $sg_subscribe->email, $sg_subscribe->site_email));
else
$sg_subscribe->add_error(sprintf(__('%s 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 { ?>
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() ) { ?>
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(); ?>
0 && is_array($postlist) ) { ?>
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);
?>