I’m working with a network-enabled site, with admin behind SSL. I created a patch for the subscribe2 plugin (Version 6.0) to improve how it worked with the setup. For example, internal links it created were directed to non-https admin pages, which would cause a redirection. Also, assets such as css were not linked via https, causing warnings to appear to people viewing admin pages.
See Github for the patch: //gist.github.com/617790
Platform:
WordPress 3.0.1 Subscribe2: 6.0
Patch is below as well
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | --- subscribe2.bak.php 2010-10-08 13:05:14.000000000 -0400 +++ subscribe2.php 2010-10-08 14:39:48.000000000 -0400 @@ -53,30 +53,51 @@ // start our class class s2class { <h2> // variables and constructor are declared at the end</h2> <ul> <li>function should_use_ssl() {</li> <li>return isset($this->subscribe2_options['use_ssl']) && $this->subscribe2_options['use_ssl'] == 'yes';</li> <li>} +</li> <li>function get_home() {</li> <li>$opt = get_option('home');</li> <li>return $this->should_use_ssl() ? $this->force_ssl($opt) : $opt;</li> <li>}</li> <li> <ul> <li>function get_content_url() {</li> </ul></li> <li>$opt = WP_CONTENT_URL;</li> <li>return $this->should_use_ssl() ? $this->force_ssl($opt) : $opt;</li> <li>}</li> <li> <ul> <li>function get_siteurl() {</li> </ul></li> <li>$opt = get_option('siteurl');</li> <li>return $this->should_use_ssl() ? $this->force_ssl($opt) : $opt;</li> <li>}</li> <li> <ul> <li>function force_ssl($url) {</li> </ul></li> <li>return preg_replace('//i', 'https:', $url);</li> <li>} /** Load all our strings */ function load_strings() { // adjust the output of Subscribe2 here</li> <li>$this-&gt;please_log_in = &quot;&lt;p&gt;&quot; . __('To manage your subscription options please', 'subscribe2') . &quot; &lt;a href=\&quot;&quot; . get_option('siteurl') . &quot;/wp-login.php\&quot;&gt;&quot; . __('login', 'subscribe2') . &quot;&lt;/a&gt;.&lt;/p&gt;&quot;; </li> <li>$this-&gt;please_log_in = &quot;&lt;p&gt;&quot; . __('To manage your subscription options please', 'subscribe2') . &quot; &lt;a href=\&quot;&quot; . $this-&gt;get_siteurl() . &quot;/wp-login.php\&quot;&gt;&quot; . __('login', 'subscribe2') . &quot;&lt;/a&gt;.&lt;/p&gt;&quot;; </li> <li>$this-&gt;use_profile_admin = &quot;&lt;p&gt;&quot; . __('You may manage your subscription options from your', 'subscribe2') . &quot; &lt;a href=\&quot;&quot; . get_option('siteurl') . &quot;/wp-admin/users.php?page=s2_users\&quot;&gt;&quot; . __('profile', 'subscribe2') . &quot;&lt;/a&gt;.&lt;/p&gt;&quot;; </li> <li>$this->use_profile_admin = "<p>" . __('You may manage your subscription options from your', 'subscribe2') . " <a href=\"" . $this->get_siteurl() . "/wp-admin/users.php?page=s2_users\">" . __('profile', 'subscribe2') . "</a>.</p>"; if ( $this->s2_mu === true) { global $blog_id, $user_ID; if ( !is_blog_user($blog_id) ) { // if we are on multisite and the user is not a member of this blog change the link</li> <li>$this->use_profile_admin = "<p><a href=\"" . get_option('siteurl') . "/wp-admin/?s2mu_subscribe=" . $blog_id . "\">" . __('Subscribe', 'subscribe2') . "</a>" . __('to email notifications when this blog posts new content', 'subscribe2') . ".</p>";</li> <li> $this-&gt;use_profile_admin = &quot;&lt;p&gt;&lt;a href=\&quot;&quot; . $this-&gt;get_siteurl() . &quot;/wp-admin/?s2mu_subscribe=&quot; . $blog_id . &quot;\&quot;&gt;&quot; . __('Subscribe', 'subscribe2') . &quot;&lt;/a&gt;&quot; . __('to email notifications when this blog posts new content', 'subscribe2') . &quot;.&lt;/p&gt;&quot;; } } </li> <li>$this-&gt;use_profile_users = &quot;&lt;p&gt;&quot; . __('You may manage your subscription options from your', 'subscribe2') . &quot; &lt;a href=\&quot;&quot; . get_option('siteurl') . &quot;/wp-admin/profile.php?page=s2_users\&quot;&gt;&quot; . __('profile', 'subscribe2') . &quot;&lt;/a&gt;.&lt;/p&gt;&quot;; </li> <li>$this->use_profile_users = "<p>" . __('You may manage your subscription options from your', 'subscribe2') . " <a href=\"" . $this->get_siteurl() . "/wp-admin/profile.php?page=s2_users\">" . __('profile', 'subscribe2') . "</a>.</p>"; if ( $this->s2_mu === true) { global $blog_id, $user_ID; if ( !is_blog_user($blog_id) ) { // if we are on multisite and the user is not a member of this blog change the link</li> <li>$this->use_profile_users = "<p><a href=\"" . get_option('siteurl') . "/wp-admin/?s2mu_subscribe=" . $blog_id . "\">" . __('Subscribe', 'subscribe2') . "</a>" . __('to email notifications when this blog posts new content', 'subscribe2') . ".</p>";</li> <li>$this->use_profile_users = "<p><a href=\"" . $this->get_siteurl() . "/wp-admin/?s2mu_subscribe=" . $blog_id . "\">" . __('Subscribe', 'subscribe2') . "</a>" . __('to email notifications when this blog posts new content', 'subscribe2') . ".</p>"; } }</li> </ul> @@ -142,22 +163,22 @@ Hook for Admin Drop Down Icons */ function ozh_s2_icon() { - return WP_CONTENT_URL . '/plugins/' . S2DIR . '/include/email_edit.png'; + return $this->get_content_url . '/plugins/' . S2DIR . '/include/email_edit.png'; } // end ozh_s2_icon() /** Insert Javascript into admin_header */ function checkbox_form_js() { - wp_enqueue_script('s2_checkbox', WP_CONTENT_URL . '/plugins/' . S2DIR . '/include/s2_checkbox.js', array('jquery'), '1.0'); + wp_enqueue_script('s2_checkbox', $this->get_content_url . '/plugins/' . S2DIR . '/include/s2_checkbox.js', array('jquery'), '1.0'); } //end checkbox_form_js() function user_admin_css() { - wp_enqueue_style('s2_user_admin', WP_CONTENT_URL . '/plugins/ '. S2DIR . '/include/s2_user_admin.css', array(), '1.0'); + wp_enqueue_style('s2_user_admin', $this->get_content_url . '/plugins/ '. S2DIR . '/include/s2_user_admin.css', array(), '1.0'); } function option_form_js() { - wp_enqueue_script('s2_edit', WP_CONTENT_URL . '/plugins/' . S2DIR . '/include/s2_edit.js', array('jquery'), '1.0'); + wp_enqueue_script('s2_edit', $this->get_content_url . '/plugins/' . S2DIR . '/include/s2_edit.js', array('jquery'), '1.0'); } // end option_form_js() /* ===== Install, upgrade, reset ===== */ @@ -301,7 +322,7 @@ return; } $string = str_replace("BLOGNAME", html_entity_decode(get_option('blogname'), ENT_QUOTES), $string); - $string = str_replace("BLOGLINK", get_option('home'), $string); + $string = str_replace("BLOGLINK", $this->get_home(), $string); $string = str_replace("TITLE", stripslashes($this->post_title), $string); $link = "<a href=\"" . $this->permalink . "\">" . $this->permalink . "</a>"; $string = str_replace("PERMALINK", $link, $string); @@ -678,7 +699,7 @@ // HASH = md5 hash of email address // ID = user's ID in the subscribe2 table // use home instead of siteurl incase index.php is not in core wordpress directory - $link = get_option('home') . "/?s2="; + $link = $this->get_home() . "/?s2="; if ( 'add' == $what ) { $link .= '1'; @@ -1384,18 +1405,18 @@ switch_to_blog(key($user_blogs)); } else { // no longer a member of a blog - wp_redirect(get_option('siteurl')); // redirect to front page + wp_redirect($this->get_siteurl()); // redirect to front page exit(); } } // redirect to profile page if ( current_user_can('manage_options') ) { - $url = get_option('siteurl') . '/wp-admin/users.php?page=s2_users'; + $url = $this->get_siteurl() . '/wp-admin/users.php?page=s2_users'; wp_redirect($url); exit(); } else { - $url = get_option('siteurl') . '/wp-admin/profile.php?page=s2_users'; + $url = $this->get_siteurl() . '/wp-admin/profile.php?page=s2_users'; wp_redirect($url); exit(); } @@ -1585,7 +1606,7 @@ $reminderform = false; $urlpath = str_replace(&quot;\\&quot;, &quot;/&quot;, S2PATH); - $urlpath = trailingslashit(get_option('siteurl')) . substr($urlpath,strpos($urlpath, "wp-content/")); + $urlpath = trailingslashit($this->get_siteurl()) . substr($urlpath,strpos($urlpath, "wp-content/")); if ( isset($<em>GET['s2page']) ) { $page = (int) $_GET['s2page']; } else { @@ -1773,7 +1794,7 @@ } elseif ( in_array($subscriber, $all_users) ) { echo "</td><td align=\"center\"></td><td align=\"center\"></td>\r\n"; echo "<td><span style=\"color:#006600\">&reg;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n"; - echo "(<a href=\"" . get_option('siteurl') . "/wp-admin/users.php?page=s2_users&amp;email=" . urlencode($subscriber) . "\">" . _</em>('edit', 'subscribe2') . "</a>)\r\n"; + echo "(<a href=\"" . $this->get_siteurl() . "/wp-admin/users.php?page=s2_users&amp;email=" . urlencode($subscriber) . "\">" . __('edit', 'subscribe2') . "</a>)\r\n"; } echo "</td></tr>\r\n"; ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate'; @@ -1855,6 +1876,9 @@ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Attempt made to resend the Digest Notification email', 'subscribe2') . "</strong></p></div>"; } } elseif ( $_POST['submit'] ) { + // security + $this->subscribe2_options['use_ssl'] = $_POST['use_ssl']; +<br /> // BCClimit if ( is_numeric($_POST['bcc']) && $_POST['bcc'] >= 0 ) { $this->subscribe2_options['bcclimit'] = $_POST['bcc']; @@ -1875,6 +1899,7 @@ $this->subscribe2_options['password'] = $_POST['password']; $this->subscribe2_options['private'] = $_POST['private']; $this->subscribe2_options['cron_order'] = $_POST['cron_order']; + // send per-post or digest emails $email_freq = $_POST['email_freq']; @@ -2009,6 +2034,15 @@ echo "<input type=\"hidden\" id=\"jspage\" value=\"" . $this->subscribe2_options['s2page'] . "\" />"; echo "<input type=\"hidden\" id=\"jsentries\" value=\"" . $this->subscribe2_options['entries'] . "\" />"; <ul> <li>echo "<h2>" . __('Security Settings', 'subscribe2') . "</h2>\r\n";</li> <li>echo __('Use SSL Links', 'subscribe2') . ': ';</li> <li>echo "<label><input type=\"checkbox\" name=\"use_ssl\" value=\"yes\"";</li> <li>if ( $this->should_use_ssl() ) {</li> <li>echo " checked=\"checked\"";</li> <li>}</li> <li>echo '/> '.__('Forces http links to https for key pages', 'subscribe2');</li> <li> + // settings for outgoing emails echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n"; echo __('Restrict the number of recipients per email to (0 for unlimited)', 'subscribe2') . ': '; @@ -2121,7 +2155,7 @@ echo "<h3>" . __('Message substitions', 'subscribe2') . "</h3>\r\n"; echo "<dl>"; echo "<dt><b>BLOGNAME</b></dt><dd>" . get_option('blogname') . "</dd>\r\n";</li> <li>echo "<dt><b>BLOGLINK</b></dt><dd>" . get_option('home') . "</dd>\r\n";</li> <li>echo "<dt><b>BLOGLINK</b></dt><dd>" . $this->get_home() . "</dd>\r\n"; echo "<dt><b>TITLE</b></dt><dd>" . __("the post's title<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n"; echo "<dt><b>POST</b></dt><dd>" . __("the excerpt or the entire post<br />(<i>based on the subscriber's preferences</i>)", 'subscribe2') . "</dd>\r\n"; echo "<dt><b>POSTTIME</b></dt><dd>" . __("the excerpt of the post and the time it was posted<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n"; @@ -2449,11 +2483,11 @@ $subscribed = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed')); // if we are subscribed to the current blog display an "unsubscribe" link if ( !empty($subscribed) ) {</li> <li>$unsubscribe_link = get_option('home') . "/wp-admin/?s2mu_unsubscribe=". $blog_id;</li> <li>$unsubscribe_link = $this->get_home() . "/wp-admin/?s2mu_unsubscribe=". $blog_id; echo "<p><a href=\"". $unsubscribe_link ."\" class=\"button\">" . __('Unsubscribe me from this blog', 'subscribe2') . "</a></p>"; } else { // else we show a "subscribe" link</li> <li>$subscribe_link = get_option('home') . "/wp-admin/?s2mu_subscribe=". $blog_id;</li> <li>$subscribe_link = $this->get_home() . "/wp-admin/?s2mu_subscribe=". $blog_id; echo "<p><a href=\"". $subscribe_link ."\" class=\"button\">" . __('Subscribe to all categories', 'subscribe2') . "</a></p>"; } echo "<h2>" . __('Subscribed Categories on', 'subscribe2') . " " . get_option('blogname') . " </h2>\r\n"; @@ -2514,8 +2548,8 @@ $blog['blogname'] = $blogname; } $blog['description'] = get_option('blogdescription');</li> <li>$blog['blogurl'] = get_option('home');</li> <li>$blog['subscribe_page'] = get_option('home') . "/wp-admin/users.php?page=s2_users";</li> <li>$blog['blogurl'] = $this->get_home();</li> <li> $blog['subscribe_page'] = $this-&gt;get_home() . &quot;/wp-admin/users.php?page=s2_users&quot;; $key = strtolower($blog['blogname'] . &quot;-&quot; . $blog['blog_id']); if ( !empty($subscribed) ) { @@ -3210,7 +3244,7 @@ Function to add js files to admin header */ function widget_s2counter_js() {</li> <li>echo '<script type="text/javascript" src="' . WP_CONTENT_URL . '/plugins/' . S2DIR . '/include/colorpicker/js/colorpicker.js"></script>' . "\r\n";</li> <li>echo '<script type="text/javascript" src="' . $this->get_content_url . '/plugins/' . S2DIR . '/include/colorpicker/js/colorpicker.js"></script>' . "\r\n"; echo "<script type=\"text/javascript\"> jQuery(document).ready(function() { jQuery('.colorpickerField').focusin(function() { @@ -3239,7 +3273,7 @@ Function to add css files to admin header */ function widget_s2counter_css() {</li> <li>echo '<link rel="stylesheet" href="' . WP_CONTENT_URL . '/plugins/' . S2DIR . '/include/colorpicker/css/colorpicker.css" type="text/css" />' . "\r\n";</li> <li>echo '&lt;link rel=&quot;stylesheet&quot; href=&quot;' . $this-&gt;get_content_url . '/plugins/' . S2DIR . '/include/colorpicker/css/colorpicker.css&quot; type=&quot;text/css&quot; /&gt;' . &quot;\r\n&quot;; } // end widget_s2counter_css function namechange_subscribe2_widget() { @@ -3274,7 +3308,7 @@ */ function add_minimeta() { if ( $this->subscribe2_options['s2page'] != 0 ) {</li> <li>echo "<li><a href=\"" . get_option('siteurl') . "/?page_id=" . $this->subscribe2_options['s2page'] . "\">" . __('[Un]Subscribe to Posts', 'subscribe2') . "</a></li>\r\n";</li> <li>echo "<li><a href=\"" . $this->get_siteurl() . "/?page_id=" . $this->subscribe2_options['s2page'] . "\">" . __('[Un]Subscribe to Posts', 'subscribe2') . "</a></li>\r\n"; } } // end add_minimeta()</li> </ul> @@ -3291,7 +3325,7 @@ add_filter('mce_buttons', array(&$this, 'mce3_button')); } else { buttonsnap_separator(); - buttonsnap_jsbutton(WP_CONTENT_URL . '/plugins/' . S2DIR . '/include/s2_button.png', __('Subscribe2', 'subscribe2'), 's2_insert_token();'); + buttonsnap_jsbutton($this->get_content_url . '/plugins/' . S2DIR . '/include/s2_button.png', __('Subscribe2', 'subscribe2'), 's2_insert_token();'); } } // end button_init() @@ -3299,7 +3333,7 @@ Add buttons for WordPress 2.5+ using built in hooks */ function mce3_plugin($arr) { - $path = WP_CONTENT_URL . '/plugins/' . S2DIR . '/tinymce3/editor_plugin.js'; + $path = $this->get_content_url . '/plugins/' . S2DIR . '/tinymce3/editor_plugin.js'; $arr['subscribe2'] = $path; return $arr; } @@ -3699,4 +3733,4 @@ var $options_saved = ''; var $options_reset = ''; } // end class subscribe2 -?> \ No newline at end of file +?> |