Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r bd41eef81acb -r 32e4f0d0ab0c subscribe2.php
- --- a/subscribe2.php Wed Dec 22 14:47:56 2010 +0100
- +++ b/subscribe2.php Wed Dec 22 14:49:20 2010 +0100
- @@ -418,19 +418,24 @@ class s2class {
- return $status;
- } // end mail()
- /**
- Construct standard set of email headers
- */
- function headers($type='text') {
- if ( empty($this->myname) || empty($this->myemail) ) {
- - $admin = $this->get_userdata($this->subscribe2_options['sender']);
- - $this->myname = html_entity_decode($admin->display_name, ENT_QUOTES);
- - $this->myemail = $admin->user_email;
- + if ( $this->subscribe2_options['sender'] == 'blogname' ) {
- + $this->myname = html_entity_decode(get_bloginfo('name'), ENT_QUOTES);
- + $this->myemail = get_bloginfo('admin_email');
- + } else {
- + $admin = $this->get_userdata($this->subscribe2_options['sender']);
- + $this->myname = html_entity_decode($admin->display_name, ENT_QUOTES);
- + $this->myemail = $admin->user_email;
- + }
- }
- $header['From'] = $this->myname . " <" . $this->myemail . ">";
- $header['Reply-To'] = $this->myname . " <" . $this->myemail . ">";
- $header['Return-path'] = "<" . $this->myemail . ">";
- $header['Precedence'] = "list\nList-Id: " . get_option('blogname') . "";
- $header['X-Mailer'] = "PHP" . phpversion() . "";
- if ( $type == 'html' ) {
- @@ -541,27 +546,31 @@ class s2class {
- // passing them in function calls a little later
- $this->post_title = "<a href=\"" . get_permalink($post->ID) . "\">" . html_entity_decode($post->post_title, ENT_QUOTES) . "</a>";
- $this->permalink = get_permalink($post->ID);
- $this->post_date = get_the_time(get_option('date_format'));
- $this->post_time = get_the_time();
- $author = get_userdata($post->post_author);
- $this->authorname = $author->display_name;
- -
- // do we send as admin, or post author?
- if ( 'author' == $this->subscribe2_options['sender'] ) {
- // get author details
- $user = &$author;
- + $this->myemail = $user->user_email;
- + $this->myname = html_entity_decode($user->display_name, ENT_QUOTES);
- + } elseif ( 'blogname' == $this->subscribe2_options['sender'] ) {
- + $this->myemail = get_bloginfo('admin_email');
- + $this->myname = html_entity_decode(get_bloginfo('name'), ENT_QUOTES);
- } else {
- // get admin details
- $user = $this->get_userdata($this->subscribe2_options['sender']);
- + $this->myemail = $user->user_email;
- + $this->myname = html_entity_decode($user->display_name, ENT_QUOTES);
- }
- - $this->myemail = $user->user_email;
- - $this->myname = html_entity_decode($user->display_name, ENT_QUOTES);
- $this->post_cat_names = implode(', ', wp_get_post_categories($post->ID, array('fields' => 'names')));
- $this->post_tag_names = implode(', ', wp_get_post_tags($post->ID, array('fields' => 'names')));
- // Get email subject
- $subject = stripslashes(strip_tags($this->substitute($this->subscribe2_options['notification_subject'])));
- // Get the message template
- $mailtext = apply_filters('s2_email_template', $this->subscribe2_options['mailtext']);
- @@ -1861,19 +1870,22 @@ class s2class {
- // BCClimit
- if ( is_numeric($_POST['bcc']) && $_POST['bcc'] >= 0 ) {
- $this->subscribe2_options['bcclimit'] = $_POST['bcc'];
- }
- // admin_email
- $this->subscribe2_options['admin_email'] = $_POST['admin_email'];
- // send as author or admin?
- - $sender = 'author';
- if ( is_numeric($_POST['sender']) ) {
- $sender = $_POST['sender'];
- + } elseif ($_POST['sender'] == 'author') {
- + $sender = 'author';
- + } else {
- + $sender = 'blogname';
- }
- $this->subscribe2_options['sender'] = $sender;
- // send email for pages, private and password protected posts
- $this->subscribe2_options['stylesheet'] = $_POST['stylesheet'];
- $this->subscribe2_options['pages'] = $_POST['pages'];
- $this->subscribe2_options['password'] = $_POST['password'];
- $this->subscribe2_options['private'] = $_POST['private'];
- @@ -2809,19 +2821,19 @@ class s2class {
- $wp_user_search = new WP_User_Search( '', '', $role);
- $admins_string = implode(', ', $wp_user_search->get_results());
- $sql = "SELECT ID, display_name FROM $wpdb->users WHERE ID IN (" . $admins_string . ")";
- $admins = $wpdb->get_results($sql);
- }
- if ( $inc_author ) {
- $author[] = (object)array('ID' => 'author', 'display_name' => 'Post Author');
- + $author[] = (object)array('ID' => 'blogname', 'display_name' => html_entity_decode(get_bloginfo('name'), ENT_QUOTES));
- $admins = array_merge($author, $admins);
- }
- -
- echo "<select name=\"sender\">\r\n";
- foreach ( $admins as $admin ) {
- echo "<option value=\"" . $admin->ID . "\"";
- if ( $admin->ID == $this->subscribe2_options['sender'] ) {
- echo " selected=\"selected\"";
- }
- echo ">" . $admin->display_name . "</option>\r\n";
- }
- @@ -3534,20 +3546,24 @@ class s2class {
- $message_posttime = trim($message_posttime);
- //sanity check - don't send a mail if the content is empty
- if ( !$message_post && !$message_posttime && !$table && !$tablelinks ) {
- return;
- }
- // get admin details
- - $user = $this->get_userdata($this->subscribe2_options['sender']);
- - $this->myemail = $user->user_email;
- - $this->myname = html_entity_decode($user->display_name, ENT_QUOTES);
- -
- + if ( $this->subscribe2_options['sender'] == 'blogname' ) {
- + $this->myname = html_entity_decode(get_bloginfo('name'), ENT_QUOTES);
- + $this->myemail = get_bloginfo('admin_email');
- + } else {
- + $user = $this->get_userdata($this->subscribe2_options['sender']);
- + $this->myemail = $user->user_email;
- + $this->myname = html_entity_decode($user->display_name, ENT_QUOTES);
- + }
- $scheds = (array)wp_get_schedules();
- $email_freq = $this->subscribe2_options['email_freq'];
- $display = $scheds[$email_freq]['display'];
- ( '' == get_option('blogname') ) ? $subject = "" : $subject = "[" . stripslashes(get_option('blogname')) . "] ";
- $subject .= $display . " " . __('Digest Email', 'subscribe2');
- $mailtext = str_replace("TABLELINKS", $tablelinks, $mailtext);
- $mailtext = str_replace("TABLE", $table, $mailtext);
- $mailtext = str_replace("POSTTIME", $message_posttime, $mailtext);
- @@ -3730,9 +3746,9 @@ class s2class {
- var $added = '';
- var $deleted = '';
- var $subscribe = '';
- var $unsubscribe = '';
- var $confirm_subject = '';
- var $options_saved = '';
- var $options_reset = '';
- } // end class subscribe2
- -?>
- \ No newline at end of file
- +?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement