s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) - Version 3.5.3

Version Description

  • (s2Member). Feature improvement. s2Member's Bridge integration with bbPress. It is now possible to allow bbPress forums to be available to the public ( with read-only access ), and to restrict participation access by Level # instead of locking everything down entirely. You now have the choice whenever you install and/or re-install the bbPress Bridge/plugin for s2Member. In addition, s2Member makes a new API function available for bbPress current_wp_user_is(). This will be useful to developers integrating bbPress with s2Member in creative ways. For further details, please check your Dashboard under: s2Member -> API Bridges -> bbPress.
  • (s2Member Pro). Feature improvement. s2Member Pro Forms for Free Registration access are now more versatile. It is now possible to configure your Pro Form Shortcode so that Free Registrants come into your site with something other than the default Level #0 Access Level. For example, if you need to, you can change the Form Attribute level="0", to level="1", attach Custom Capabilities with the ccaps="" Attribute, and even limit this access to a certain timeframe with tp="30" tt="D" ( i.e. 30 Days ). So this Form is very flexible now. It can be used to allow free access to just about any aspect of your service. For more information on this topic, please check your Dashboard under: s2Member -> PayPal Pro Forms -> Free Registration Forms. Also works with Pro Forms for Authorize.Net.
  • (s2Member). New Filters. s2Member v3.5.3 adds two new WordPress Filters that allow developers to further customize the inner workings of s2Member ( among 300+ other existing Filters already established for s2Member ). You will find these two new Filters in the source code of the free version: wp_register_location and ws_plugin__s2member_redirection_url_after_modification. For Multisite Networks, there is also this Filter available: wp_signup_location. If you're a novice site owner, please keep tabs on our forums for examples on how to utilize these new Filters. We're sure this topic will come up.
  • (s2Member). New Filters. s2Member v3.5.3 adds two new WordPress Filters that allow developers to further customize tinyURLs generated for email confirmations. You will find these two new Filters in the source code of the free version: ws_plugin__s2member_register_link_gen_alternative and ws_plugin__s2member_sp_access_link_gen_alternative. I've posted an example of how to use these in the forums. So these new Filters make it possible to use a shortening service that you prefer over tinyURL ( but you will have to integrate it yourself ). In a later release, we'll try to add some pre-integrated alternatives into the Dashboard for s2Member.
  • (s2Member). New Replacement Code. s2Member's EOT/Deletion Notification now provides additional detail about the actual event that triggers this API Notification through a new Replacement Code: %%eot_del_type%%. For further details on this new Replacement Code, and a list of possible values, please check your Dashboard under: s2Member -> API Notifications -> EOT/Deletion Notifications.
  • (s2Member). Bug fix. A common error that site owners see in s2Member's log file is unable to verify POST vars. This is due to issues with various hosting companies not being configured with either cURL and/or allow_url_fopen -> on. However, we recently discovered that WordPress ( i.e. via the WP_Http class ) will attempt to officially verify the SSL certificate issued through remote connections to Payment Gateways integrated with s2Member. This can cause an additional roadblock on some servers, because often they are not capable of officially verifying SSL certificates. They lack the extended configuration necessary to do so. In other words, this default behavior in the WP_Http class file can ultimately lead to unable to verify POST vars in s2Member. To workaround this compatibility issue, s2Member now specifies `sslverify
Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 3.5.3
Comparing to
See all releases

Code changes from version 3.5.2 to 3.5.3

Files changed (39) hide show
  1. includes/classes/auto-eots.inc.php +9 -5
  2. includes/classes/cache.inc.php +92 -0
  3. includes/classes/check-activation.inc.php +1 -1
  4. includes/classes/constants.inc.php +36 -97
  5. includes/classes/css-js-in.inc.php +1 -1
  6. includes/classes/files-in.inc.php +6 -6
  7. includes/classes/installation.inc.php +6 -6
  8. includes/classes/list-servers.inc.php +20 -19
  9. includes/classes/login-redirects.inc.php +4 -4
  10. includes/classes/menu-pages.inc.php +22 -21
  11. includes/classes/op-notices.inc.php +1 -1
  12. includes/classes/option-forces.inc.php +9 -6
  13. includes/classes/paypal-notify-in.inc.php +18 -8
  14. includes/classes/paypal-return-in.inc.php +44 -20
  15. includes/classes/register-access.inc.php +5 -1
  16. includes/classes/registrations.inc.php +135 -116
  17. includes/classes/sp-access.inc.php +4 -1
  18. includes/classes/ssl-in.inc.php +70 -24
  19. includes/classes/ssl.inc.php +1 -1
  20. includes/classes/user-deletions.inc.php +7 -3
  21. includes/classes/user-securities.inc.php +19 -23
  22. includes/classes/users-list-in.inc.php +2 -2
  23. includes/classes/users-list.inc.php +2 -1
  24. includes/classes/utils-arrays.inc.php +30 -5
  25. includes/classes/utils-dirs.inc.php +2 -2
  26. includes/classes/utils-urls.inc.php +15 -15
  27. includes/dropins/bridges/_s2member-bbpress-bridge.php +147 -63
  28. includes/hooks.inc.php +3 -3
  29. includes/menu-pages/api-ops.inc.php +3 -0
  30. includes/menu-pages/bridges.inc.php +50 -15
  31. includes/menu-pages/els-ops.inc.php +2 -2
  32. includes/menu-pages/menu-pages-s-min.js +1 -1
  33. includes/menu-pages/menu-pages-s.js +30 -0
  34. includes/menu-pages/paypal-ops.inc.php +2 -2
  35. includes/s2member-min.js +1 -1
  36. includes/s2member.js +19 -19
  37. includes/syscon.inc.php +6 -4
  38. readme.txt +26 -8
  39. s2member.php +4 -4
includes/classes/auto-eots.inc.php CHANGED
@@ -80,7 +80,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
80
/**/
81
include_once ABSPATH . "wp-admin/includes/admin.php";
82
/**/
83
- set_time_limit (0); /* Make time for processing larger userbases. */
84
@ini_set ("memory_limit", "256M"); /* Acquire some additional RAM. */
85
/**/
86
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
@@ -109,7 +109,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
109
/**/
110
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
111
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
112
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "auto-eot-cancellation-expiration-demotion");
113
unset ($__refs, $__v); /* Unset defined __refs, __v. */
114
/**/
115
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
@@ -144,7 +144,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
144
{
145
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
146
/**/
147
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($subscr_id)), $url)))
148
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
149
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
150
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
@@ -168,6 +168,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
168
$msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
169
$msg .= "\n\n"; /* Spacing in the message body. */
170
/**/
171
$msg .= "subscr_id: %%subscr_id%%\n";
172
$msg .= "user_first_name: %%user_first_name%%\n";
173
$msg .= "user_last_name: %%user_last_name%%\n";
@@ -191,7 +192,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
191
$msg .= "cv8: %%cv8%%\n";
192
$msg .= "cv9: %%cv9%%";
193
/**/
194
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($subscr_id), $msg)))
195
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
196
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
197
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
@@ -217,9 +218,12 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
217
{
218
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
219
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
220
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "auto-eot-cancellation-expiration-deletion");
221
unset ($__refs, $__v); /* Unset defined __refs, __v. */
222
/**/
223
if (is_multisite ()) /* Multisite does NOT actually delete; ONLY removes. */
224
{
225
remove_user_from_blog ($user_id, $current_blog->blog_id);
80
/**/
81
include_once ABSPATH . "wp-admin/includes/admin.php";
82
/**/
83
+ @set_time_limit (0); /* Make time for processing larger userbases. */
84
@ini_set ("memory_limit", "256M"); /* Acquire some additional RAM. */
85
/**/
86
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
109
/**/
110
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
111
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
112
+ do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "auto-eot-cancellation-expiration-demotion", "cancellation-expiration");
113
unset ($__refs, $__v); /* Unset defined __refs, __v. */
114
/**/
115
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
144
{
145
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
146
/**/
147
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ("auto-eot-cancellation-expiration-demotion")), $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($subscr_id)), $url)))
148
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
149
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
150
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
168
$msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
169
$msg .= "\n\n"; /* Spacing in the message body. */
170
/**/
171
+ $msg .= "eot_del_type: %%eot_del_type%%\n";
172
$msg .= "subscr_id: %%subscr_id%%\n";
173
$msg .= "user_first_name: %%user_first_name%%\n";
174
$msg .= "user_last_name: %%user_last_name%%\n";
192
$msg .= "cv8: %%cv8%%\n";
193
$msg .= "cv9: %%cv9%%";
194
/**/
195
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ("auto-eot-cancellation-expiration-demotion"), $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($subscr_id), $msg)))
196
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
197
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
198
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
218
{
219
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
220
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
221
+ do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "auto-eot-cancellation-expiration-deletion", "cancellation-expiration");
222
unset ($__refs, $__v); /* Unset defined __refs, __v. */
223
/**/
224
+ $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
225
+ $GLOBALS["ws_plugin__s2member_eot_del_type_spec"] = "cancellation-expiration";
226
+ /**/
227
if (is_multisite ()) /* Multisite does NOT actually delete; ONLY removes. */
228
{
229
remove_user_from_blog ($user_id, $current_blog->blog_id);
includes/classes/cache.inc.php ADDED
@@ -0,0 +1,92 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_cache"))
18
+ {
19
+ class c_ws_plugin__s2member_cache
20
+ {
21
+ /*
22
+ Pulls all of the Page links needed for Constants.
23
+ Page links are cached into the s2Member options on 15 min intervals.
24
+ This allows the API Constants to provide quick access to them without being forced to execute get_page_link() all the time, which piles up DB queries.
25
+ */
26
+ public static function cached_page_links ()
27
+ {
28
+ do_action ("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
29
+ /**/
30
+ $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
31
+ $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
32
+ $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
33
+ /**/
34
+ $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
35
+ $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
36
+ $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
37
+ /**/
38
+ $links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
39
+ /**/
40
+ if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
41
+ {
42
+ $links["login_welcome_page"] = $login_welcome_page_cache["link"];
43
+ }
44
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
45
+ {
46
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
47
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
48
+ $links["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
49
+ /**/
50
+ $cache_needs_updating = true; /* Flag for cache update. */
51
+ }
52
+ /**/
53
+ if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
54
+ {
55
+ $links["membership_options_page"] = $membership_options_page_cache["link"];
56
+ }
57
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
58
+ {
59
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
60
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
61
+ $links["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
62
+ /**/
63
+ $cache_needs_updating = true; /* Flag for cache update. */
64
+ }
65
+ /**/
66
+ if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
67
+ {
68
+ $links["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
69
+ }
70
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
71
+ {
72
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
73
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
74
+ $links["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
75
+ /**/
76
+ $cache_needs_updating = true; /* Flag for cache update. */
77
+ }
78
+ /**/
79
+ if ($cache_needs_updating) /* Cache is also reset dynamically during back-end option updates. */
80
+ {
81
+ update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
82
+ }
83
+ /**/
84
+ $scheme = (is_ssl ()) ? "https" : "http"; /* SSL mode? */
85
+ foreach ($links as &$link) /* Conversions for SSL and non-SSL mode. */
86
+ $link = preg_replace ("/^http(s)?\:\/\//i", $scheme . "://", $link);
87
+ /**/
88
+ return apply_filters ("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
89
+ }
90
+ }
91
+ }
92
+ ?>
includes/classes/check-activation.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_check_activation"))
19
class c_ws_plugin__s2member_check_activation
20
{
21
/*
22
- Check existing installations that have not been re-activated.
23
Attach to: add_action("admin_init");
24
*/
25
public static function check () /* Up-to-date? */
19
class c_ws_plugin__s2member_check_activation
20
{
21
/*
22
+ Checks existing installs that are NOT yet re-activated.
23
Attach to: add_action("admin_init");
24
*/
25
public static function check () /* Up-to-date? */
includes/classes/constants.inc.php CHANGED
@@ -19,72 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
19
class c_ws_plugin__s2member_constants
20
{
21
/*
22
- This function pulls all of the Page links needed for Constants.
23
- Page links are cached into the s2Member options on 15 min intervals.
24
- This allows the API Constants to provide quick access to them without being forced to execute get_page_link() all the time, which piles up DB queries.
25
- */
26
- public static function constant_links ()
27
- {
28
- do_action ("ws_plugin__s2member_before_constant_links", get_defined_vars ());
29
- /**/
30
- $l = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
31
- /**/
32
- $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
33
- $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
34
- $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
35
- /**/
36
- $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
37
- $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
38
- $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
39
- /**/
40
- if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
41
- {
42
- $l["login_welcome_page"] = $login_welcome_page_cache["link"];
43
- }
44
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
45
- {
46
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
47
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
48
- $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
49
- /**/
50
- $cache_needs_updating = true;
51
- }
52
- /**/
53
- if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
54
- {
55
- $l["membership_options_page"] = $membership_options_page_cache["link"];
56
- }
57
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
58
- {
59
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
60
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
61
- $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
62
- /**/
63
- $cache_needs_updating = true;
64
- }
65
- /**/
66
- if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
67
- {
68
- $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
69
- }
70
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
71
- {
72
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
73
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
74
- $l["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
75
- /**/
76
- $cache_needs_updating = true;
77
- }
78
- /**/
79
- if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
80
- {
81
- update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
82
- }
83
- /**/
84
- return apply_filters ("ws_plugin__s2member_constant_links", $l, get_defined_vars ());
85
- }
86
- /*
87
- Define several API Constants for s2Member.
88
Note that these are duplicated into the JavaScript API as well.
89
Attach to: add_action("init");
90
*/
@@ -92,16 +27,19 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
92
{
93
do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
94
/**/
95
- $links = c_ws_plugin__s2member_constants::constant_links ();
96
- $level = c_ws_plugin__s2member_user_access::user_access_level ();
97
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
98
- $file_downloads = c_ws_plugin__s2member_files::user_downloads ($current_user, false, null);
99
- $subscr_id = ($current_user) ? get_user_option ("s2member_subscr_id", $current_user->ID) : "";
100
- $subscr_gateway = ($current_user) ? get_user_option ("s2member_subscr_gateway", $current_user->ID) : "";
101
- $custom = ($current_user) ? get_user_option ("s2member_custom", $current_user->ID) : "";
102
- $custom_fields = ($current_user) ? get_user_option ("s2member_custom_fields", $current_user->ID) : array ();
103
- $paid_registration_times = ($current_user) ? get_user_option ("s2member_paid_registration_times", $current_user->ID) : array ();
104
- $login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($current_user);
105
/**/
106
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
107
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
@@ -109,26 +47,27 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
109
/**/
110
define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION));
111
/**/
112
- define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($current_user) ? true : false)));
113
- define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($current_user && $level >= 1) ? true : false)));
114
- define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
115
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
116
- define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = ( ($current_user && $subscr_id) ? (string)$subscr_id : "")));
117
- define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : "")));
118
- define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($current_user) ? (string)$subscr_gateway : "")));
119
- define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (string)$custom));
120
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = ( ($current_user && $current_user->user_registered) ? (int)strtotime ($current_user->user_registered) : 0)));
121
- define ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME", ($c[] = ( ($current_user && (int)$paid_registration_times["level"]) ? (int)$paid_registration_times["level"] : 0)));
122
- define ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS", ($c[] = ( ($current_user && (int)$paid_registration_times["level"]) ? (int)floor ((strtotime ("now") - (int)$paid_registration_times["level"]) / 86400) : 0)));
123
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", ($c[] = ( ($current_user && $current_user->user_registered) ? (int)floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)));
124
- define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", ($c[] = (($current_user) ? (string)$current_user->display_name : "")));
125
- define ("S2MEMBER_CURRENT_USER_FIRST_NAME", ($c[] = (($current_user) ? (string)$current_user->first_name : "")));
126
- define ("S2MEMBER_CURRENT_USER_LAST_NAME", ($c[] = (($current_user) ? (string)$current_user->last_name : "")));
127
- define ("S2MEMBER_CURRENT_USER_LOGIN", ($c[] = (($current_user) ? (string)$current_user->user_login : "")));
128
- define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($current_user) ? (string)$current_user->user_email : "")));
129
define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
130
- define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($current_user) ? (int)$current_user->ID : 0)));
131
- define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
132
/**/
133
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
134
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = ( ($file_downloads["allowed"] >= 999999999) ? true : false)));
@@ -141,10 +80,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
141
/**/
142
define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = site_url ("/?s2member_profile=1")));
143
define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
144
- define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"]));
145
define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
146
- define ("S2MEMBER_LOGOUT_PAGE_URL", ($c[] = (string)wp_logout_url ()));
147
- define ("S2MEMBER_LOGIN_PAGE_URL", ($c[] = (string)wp_login_url ()));
148
/**/
149
define ("S2MEMBER_LEVEL0_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]));
150
define ("S2MEMBER_LEVEL1_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]));
19
class c_ws_plugin__s2member_constants
20
{
21
/*
22
+ Defines several API Constants for s2Member.
23
Note that these are duplicated into the JavaScript API as well.
24
Attach to: add_action("init");
25
*/
27
{
28
do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
29
/**/
30
+ $links = c_ws_plugin__s2member_cache::cached_page_links ();
31
+ /**/
32
+ $user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
+ /**/
34
+ $level = c_ws_plugin__s2member_user_access::user_access_level ($user);
35
+ $file_downloads = c_ws_plugin__s2member_files::user_downloads ($user);
36
+ $login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
37
+ /**/
38
+ $custom = ($user) ? get_user_option ("s2member_custom", $user->ID) : "";
39
+ $subscr_id = ($user) ? get_user_option ("s2member_subscr_id", $user->ID) : "";
40
+ $subscr_gateway = ($user) ? get_user_option ("s2member_subscr_gateway", $user->ID) : "";
41
+ $custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
42
+ $paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
43
/**/
44
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
45
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
47
/**/
48
define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION));
49
/**/
50
+ define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($user) ? true : false)));
51
+ define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($user && $level >= 1) ? true : false)));
52
+ define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level)); /* Negative -1 through max Membership Level number. */
53
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
54
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = ( ($user && $subscr_id) ? (string)$subscr_id : ""))); /* Paid Subscr. ID. */
55
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : "")));
56
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($user) ? (string)$subscr_gateway : ""))); /* Payment Gateway. */
57
+ define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (($user) ? (string)$custom : ""))); /* Starts w/ domain name. */
58
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = ( ($user && $user->user_registered) ? (int)strtotime ($user->user_registered) : 0)));
59
+ define ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME", ($c[] = ( ($user && (int)$paid_registration_times["level"]) ? (int)$paid_registration_times["level"] : 0)));
60
+ define ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS", ($c[] = ( ($user && (int)$paid_registration_times["level"]) ? (int)floor ((strtotime ("now") - (int)$paid_registration_times["level"]) / 86400) : 0)));
61
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", ($c[] = ( ($user && $user->user_registered) ? (int)floor ((strtotime ("now") - strtotime ($user->user_registered)) / 86400) : 0)));
62
+ define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", ($c[] = (($user) ? (string)$user->display_name : "")));
63
+ define ("S2MEMBER_CURRENT_USER_FIRST_NAME", ($c[] = (($user) ? (string)$user->first_name : "")));
64
+ define ("S2MEMBER_CURRENT_USER_LAST_NAME", ($c[] = (($user) ? (string)$user->last_name : "")));
65
+ define ("S2MEMBER_CURRENT_USER_LOGIN", ($c[] = (($user) ? (string)$user->user_login : "")));
66
+ define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($user) ? (string)$user->user_email : "")));
67
define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
68
+ define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($user) ? (int)$user->ID : 0)));
69
+ /**/
70
+ define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
71
/**/
72
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
73
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = ( ($file_downloads["allowed"] >= 999999999) ? true : false)));
80
/**/
81
define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = site_url ("/?s2member_profile=1")));
82
define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
83
+ define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"])); /* Signup page. */
84
define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
85
+ define ("S2MEMBER_LOGOUT_PAGE_URL", ($c[] = (string)wp_logout_url ())); /* This triggers `wp_nonce_tick()`; watch out for dynamic changes. */
86
+ define ("S2MEMBER_LOGIN_PAGE_URL", ($c[] = (string)wp_login_url ())); /* Will not trigger `wp_nonce_tick()`, no worries in this case. */
87
/**/
88
define ("S2MEMBER_LEVEL0_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]));
89
define ("S2MEMBER_LEVEL1_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]));
includes/classes/css-js-in.inc.php CHANGED
@@ -65,7 +65,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
65
header ("Cache-Control: max-age=604800");
66
header ("Pragma: public");
67
/**/
68
- $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
69
/**/
70
$g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
71
$g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
65
header ("Cache-Control: max-age=604800");
66
header ("Pragma: public");
67
/**/
68
+ $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',";
69
/**/
70
$g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
71
$g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
includes/classes/files-in.inc.php CHANGED
@@ -30,8 +30,6 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
30
{
31
$excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
32
/**/
33
- $_GET["s2member_file_download_key"] = (!$_GET["s2member_file_download_key"] && $_GET["s2member_free_file_download_key"]) ? $_GET["s2member_free_file_download_key"] : $_GET["s2member_file_download_key"];
34
- /**/
35
if (!$excluded && (!$_GET["s2member_file_download_key"] || ($_GET["s2member_file_download_key"] && ! ($file_download_key_is_valid = ($_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"]) || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], true))))))
36
{
37
$_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Trim slashes after Key comparison. */
@@ -142,13 +140,13 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
142
Send the file to the browser in chunks ( in support of larger files ).
143
Be sure to turn off output compression, as it DOES get in the way.
144
*/
145
- set_time_limit (0); /* Unlimited. */
146
@ini_set ("zlib.output_compression", 0);
147
/**/
148
header ("Accept-Ranges: none");
149
header ("Content-Encoding: none");
150
header ("Content-Type: " . $mimetype);
151
- header ("Transfer-Encoding: chunked");
152
header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
153
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
154
header ("Cache-Control: no-cache, must-revalidate, max-age=0");
@@ -159,12 +157,14 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
159
/**/
160
if ($length && apply_filters ("ws_plugin__s2member_stream_file_downloads", true, get_defined_vars ()) && ($stream = fopen ($file, "rb")))
161
{
162
- @ob_end_clean (); /* End/clean output buffer. */
163
/**/
164
while (!feof ($stream) && ($chunk_size = strlen ($data = fread ($stream, 2097152))))
165
eval ('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
166
/**/
167
- fclose($stream);
168
/**/
169
exit ("0\r\n\r\n");
170
}
30
{
31
$excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
32
/**/
33
if (!$excluded && (!$_GET["s2member_file_download_key"] || ($_GET["s2member_file_download_key"] && ! ($file_download_key_is_valid = ($_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"]) || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], true))))))
34
{
35
$_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Trim slashes after Key comparison. */
140
Send the file to the browser in chunks ( in support of larger files ).
141
Be sure to turn off output compression, as it DOES get in the way.
142
*/
143
+ @set_time_limit (0); /* Unlimited. */
144
@ini_set ("zlib.output_compression", 0);
145
/**/
146
header ("Accept-Ranges: none");
147
header ("Content-Encoding: none");
148
header ("Content-Type: " . $mimetype);
149
+ header ("Content-Length: " . $length);
150
header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
151
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
152
header ("Cache-Control: no-cache, must-revalidate, max-age=0");
157
/**/
158
if ($length && apply_filters ("ws_plugin__s2member_stream_file_downloads", true, get_defined_vars ()) && ($stream = fopen ($file, "rb")))
159
{
160
+ header ("Transfer-Encoding: chunked"); /* Uses `Transfer-Encoding: chunked` for simulated streaming. */
161
+ /**/
162
+ eval ('while (@ob_end_clean ());'); /* End/clean all output buffers that may or may not exist. */
163
/**/
164
while (!feof ($stream) && ($chunk_size = strlen ($data = fread ($stream, 2097152))))
165
eval ('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
166
/**/
167
+ fclose ($stream);
168
/**/
169
exit ("0\r\n\r\n");
170
}
includes/classes/installation.inc.php CHANGED
@@ -162,7 +162,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
162
/* Version 3.5 introduced a dismissal message regarding Screen Options in the list of Users/Members. */
163
{
164
$notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
165
- c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:users.php", false, false, true); /* Visible until dismissed. */
166
}
167
/**/
168
$notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
@@ -183,7 +183,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
183
{
184
$notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
185
/**/
186
- c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:users.php", false, false, true); /* Remain visible until dismissed by the site owner. */
187
/**/
188
$notice = '<strong>s2Member</strong> v' . esc_html (WS_PLUGIN__S2MEMBER_VERSION) . ' has been <strong>activated</strong>. Nice work!<br />';
189
$notice .= 'Have fun, <a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-start")) . '">read the Quick Start Guide</a>, and make some money! :-)';
@@ -279,9 +279,9 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
279
{
280
if (file_exists ($htaccess = $files_dir . "/.htaccess"))
281
if (is_writable ($htaccess))
282
- unlink ($htaccess);
283
/**/
284
- @rmdir ($files_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir));
285
}
286
/**/
287
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
@@ -289,9 +289,9 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
289
foreach (scandir ($logs_dir) as $log_file)
290
if (is_file ($log_file = $logs_dir . "/" . $log_file))
291
if (is_writable ($log_file))
292
- unlink ($log_file);
293
/**/
294
- @rmdir ($logs_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir));
295
}
296
/**/
297
delete_option ("ws_plugin__s2member_cache");
162
/* Version 3.5 introduced a dismissal message regarding Screen Options in the list of Users/Members. */
163
{
164
$notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
165
+ c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:users.php", false, false, true);
166
}
167
/**/
168
$notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
183
{
184
$notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>( upper right-hand corner )</em>. With WordPress® Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
185
/**/
186
+ c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:users.php", false, false, true);
187
/**/
188
$notice = '<strong>s2Member</strong> v' . esc_html (WS_PLUGIN__S2MEMBER_VERSION) . ' has been <strong>activated</strong>. Nice work!<br />';
189
$notice .= 'Have fun, <a href="' . esc_attr (admin_url ("/admin.php?page=ws-plugin--s2member-start")) . '">read the Quick Start Guide</a>, and make some money! :-)';
279
{
280
if (file_exists ($htaccess = $files_dir . "/.htaccess"))
281
if (is_writable ($htaccess))
282
+ unlink($htaccess);
283
/**/
284
+ @rmdir($files_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir));
285
}
286
/**/
287
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
289
foreach (scandir ($logs_dir) as $log_file)
290
if (is_file ($log_file = $logs_dir . "/" . $log_file))
291
if (is_writable ($log_file))
292
+ unlink($log_file);
293
/**/
294
+ @rmdir($logs_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir));
295
}
296
/**/
297
delete_option ("ws_plugin__s2member_cache");
includes/classes/list-servers.inc.php CHANGED
@@ -19,8 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
19
class c_ws_plugin__s2member_list_servers
20
{
21
/*
22
- Function that determines whether or not any list
23
- servers have been integrated into the s2Member options.
24
*/
25
public static function list_servers_integrated ()
26
{
@@ -33,9 +32,9 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
33
return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
34
}
35
/*
36
- Function that processes List Server integrations for s2Member.
37
*/
38
- public static function process_list_servers ($role = FALSE, $level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE, $user_id = FALSE)
39
{
40
global $current_site, $current_blog; /* For Multisite support. */
41
/**/
@@ -43,10 +42,10 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
43
do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
44
unset ($__refs, $__v); /* Unset defined __refs, __v. */
45
/**/
46
- if (strlen ($level) && is_email ($email) && $opt_in) /* Must have these. */
47
{
48
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (0);
49
- c_ws_plugin__s2member_email_configs::email_config_release (); /* Release Filters. */
50
/**/
51
if (($mailchimp_api_key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]))
52
if (($mailchimp_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
@@ -62,8 +61,10 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
62
/**/
63
if (($aweber_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
64
{
65
foreach (preg_split ("/[\r\n\t\s;,]+/", $aweber_list_ids) as $aweber_list_id)
66
- wp_mail ($aweber_list_id . "@aweber.com", apply_filters ("ws_plugin__s2member_aweber_sbj", "s2Member Subscription Request", get_defined_vars ()), apply_filters ("ws_plugin__s2member_aweber_msg", "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nRole: " . $role . "\nLevel: " . $level . "\n - end.", get_defined_vars ()), "From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
67
}
68
/**/
69
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
@@ -81,9 +82,9 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
81
return; /* Return for uniformity. */
82
}
83
/*
84
- Function that processes list server removals for s2Member.
85
*/
86
- public static function process_list_server_removals ($role = FALSE, $level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_out = FALSE, $user_id = FALSE)
87
{
88
global $current_site, $current_blog; /* For Multisite support. */
89
/**/
@@ -91,7 +92,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
91
do_action ("ws_plugin__s2member_before_process_list_server_removals", get_defined_vars ());
92
unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
/**/
94
- if (strlen ($level) && is_email ($email) && $opt_out) /* Must have these. */
95
{
96
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (0);
97
c_ws_plugin__s2member_email_configs::email_config_release (); /* Release Filters. */
@@ -129,12 +130,12 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
129
return; /* Return for uniformity. */
130
}
131
/*
132
- This function listens to Collective EOT/MOD Events processed internally by s2Member.
133
This is only applicable when ["custom_reg_auto_opt_outs"] contains related Event(s).
134
- Attach to: add_action("ws_plugin__s2member_during_collective_eots");
135
- Attach to: add_action("ws_plugin__s2member_during_collective_mods");
136
*/
137
- public static function auto_process_list_server_removals ($user_id = FALSE, $vars = FALSE, $event = FALSE, $new_level = FALSE)
138
{
139
global $current_site, $current_blog; /* For Multisite support. */
140
static $auto_processed = array (); /* Only process ONE time for each User ID. */
@@ -143,14 +144,14 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
143
do_action ("ws_plugin__s2member_before_auto_process_list_server_removals", get_defined_vars ());
144
unset ($__refs, $__v); /* Unset defined __refs, __v. */
145
/**/
146
- if ($user_id && !in_array ($user_id, $auto_processed) && in_array ($event, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"]) && c_ws_plugin__s2member_list_servers::list_servers_integrated () && is_object ($user = new WP_User ($user_id)) && $user->ID)
147
{
148
- if ((!strlen ($new_level) || (int)$new_level !== c_ws_plugin__s2member_user_access::user_access_level ($user)) && ($auto_processed[$user_id] = true))
149
{
150
- c_ws_plugin__s2member_list_servers::process_list_server_removals (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_email, $user->first_name, $user->last_name, false, true, $user_id);
151
/**/
152
- if (strlen ($new_level) && apply_filters ("ws_plugin__s2member_auto_process_new_list_servers", true, get_defined_vars ())) /* Subscribe to new List(s)? */
153
- c_ws_plugin__s2member_list_servers::process_list_servers ("s2member_level" . $new_level, $new_level, $user->user_email, $user->first_name, $user->last_name, false, true, $user_id);
154
}
155
}
156
/**/
19
class c_ws_plugin__s2member_list_servers
20
{
21
/*
22
+ Determines whether or not any list servers have been integrated into the s2Member options.
23
*/
24
public static function list_servers_integrated ()
25
{
32
return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
33
}
34
/*
35
+ Processes List Server integrations for s2Member.
36
*/
37
+ public static function process_list_servers ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE, $user_id = FALSE)
38
{
39
global $current_site, $current_blog; /* For Multisite support. */
40
/**/
42
do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
43
unset ($__refs, $__v); /* Unset defined __refs, __v. */
44
/**/
45
+ if ($role && strlen ($level) && $login && is_email ($email) && $opt_in && $user_id)
46
{
47
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (0);
48
+ c_ws_plugin__s2member_email_configs::email_config_release (); /* Release. */
49
/**/
50
if (($mailchimp_api_key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]))
51
if (($mailchimp_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
61
/**/
62
if (($aweber_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
63
{
64
+ $aweber_pass_inclusion = /* Off by default ( this poses a security risk ) » */ (apply_filters ("ws_plugin__s2member_aweber_pass_inclusion", false, get_defined_vars ()) && $pass) ? "\nPass: " . $pass : false;
65
+ /**/
66
foreach (preg_split ("/[\r\n\t\s;,]+/", $aweber_list_ids) as $aweber_list_id)
67
+ wp_mail ($aweber_list_id . "@aweber.com", apply_filters ("ws_plugin__s2member_aweber_sbj", "s2Member Subscription Request", get_defined_vars ()), apply_filters ("ws_plugin__s2member_aweber_msg", "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber_pass_inclusion . "\nRole: " . $role . "\nLevel: " . $level . "\n - end.", get_defined_vars ()), "From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
68
}
69
/**/
70
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
82
return; /* Return for uniformity. */
83
}
84
/*
85
+ Processes list server removals for s2Member.
86
*/
87
+ public static function process_list_server_removals ($role = FALSE, $level = FALSE, $login = FALSE, $pass = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_out = FALSE, $user_id = FALSE)
88
{
89
global $current_site, $current_blog; /* For Multisite support. */
90
/**/
92
do_action ("ws_plugin__s2member_before_process_list_server_removals", get_defined_vars ());
93
unset ($__refs, $__v); /* Unset defined __refs, __v. */
94
/**/
95
+ if ($role && strlen ($level) && $login && is_email ($email) && $opt_out && $user_id)
96
{
97
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status (0);
98
c_ws_plugin__s2member_email_configs::email_config_release (); /* Release Filters. */
130
return; /* Return for uniformity. */
131
}
132
/*
133
+ Listens to Collective EOT/MOD Events processed internally by s2Member.
134
This is only applicable when ["custom_reg_auto_opt_outs"] contains related Event(s).
135
+ Attach to: add_action("ws_plugin__s2member_during_collective_eots");
136
+ Attach to: add_action("ws_plugin__s2member_during_collective_mods");
137
*/
138
+ public static function auto_process_list_server_removals ($user_id = FALSE, $vars = FALSE, $event = FALSE, $_event_spec = FALSE, $_mod_new_level = FALSE)
139
{
140
global $current_site, $current_blog; /* For Multisite support. */
141
static $auto_processed = array (); /* Only process ONE time for each User ID. */
144
do_action ("ws_plugin__s2member_before_auto_process_list_server_removals", get_defined_vars ());
145
unset ($__refs, $__v); /* Unset defined __refs, __v. */
146
/**/
147
+ if ($user_id && !in_array ($user_id, $auto_processed) && (c_ws_plugin__s2member_utils_arrays::in_regex_array ($event, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"]) || c_ws_plugin__s2member_utils_arrays::in_regex_array ($_event_spec, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"])) && c_ws_plugin__s2member_list_servers::list_servers_integrated () && is_object ($user = new WP_User ($user_id)) && $user->ID)
148
{
149
+ if (($_event_spec !== "modification" || ($_event_spec === "modification" && strlen ($_mod_new_level) && (int)$_mod_new_level !== c_ws_plugin__s2member_user_access::user_access_level ($user))) && ($auto_processed[$user_id] = true))
150
{
151
+ c_ws_plugin__s2member_list_servers::process_list_server_removals (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user_id);
152
/**/
153
+ if ($_event_spec === "modification" && strlen ($_mod_new_level) && apply_filters ("ws_plugin__s2member_auto_process_new_list_servers", true, get_defined_vars ())) /* Subscribe to new List(s)? */
154
+ c_ws_plugin__s2member_list_servers::process_list_servers ("s2member_level" . $_mod_new_level, $_mod_new_level, $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user_id);
155
}
156
}
157
/**/
includes/classes/login-redirects.inc.php CHANGED
@@ -28,9 +28,9 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
28
do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
29
unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
/**/
31
- $username = (!$username && is_object ($current_user = wp_get_current_user ())) ? $current_user->user_login : $username;
32
/**/
33
- if ($username && is_object ($user = new WP_User ($username)) && ($user_id = $user->ID) && (!$user->has_cap ("edit_posts") || apply_filters ("ws_plugin__s2member_login_redirect", false, get_defined_vars ())))
34
{
35
if ($user->has_cap ("edit_posts") || strtolower ($username) === "demo" || c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
36
{
@@ -38,7 +38,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
38
{
39
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) /* Using custom Passwords? */
40
{
41
- delete_user_setting ("default_password_nag"); /* setcookie(). */
42
update_user_option ($user_id, "default_password_nag", false, true);
43
}
44
/**/
@@ -47,7 +47,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
47
unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
/**/
49
if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
50
- wp_redirect ($special_redirection_url); /* Special Redirection. */
51
/**/
52
else /* Else we use the Login Welcome Page configured for s2Member. */
53
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
28
do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
29
unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
/**/
31
+ $username = (!$username && is_object ($user = wp_get_current_user ())) ? $user->user_login : $username;
32
/**/
33
+ if ($username && (is_object ($user) || is_object ($user = new WP_User ($username))) && ($user_id = $user->ID) && (!$user->has_cap ("edit_posts") || apply_filters ("ws_plugin__s2member_login_redirect", false, get_defined_vars ())))
34
{
35
if ($user->has_cap ("edit_posts") || strtolower ($username) === "demo" || c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
36
{
38
{
39
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) /* Using custom Passwords? */
40
{
41
+ delete_user_setting ("default_password_nag"); /* `setcookie()` */
42
update_user_option ($user_id, "default_password_nag", false, true);
43
}
44
/**/
47
unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
/**/
49
if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
50
+ wp_redirect($special_redirection_url); /* Special Redirection. */
51
/**/
52
else /* Else we use the Login Welcome Page configured for s2Member. */
53
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
includes/classes/menu-pages.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
19
class c_ws_plugin__s2member_menu_pages
20
{
21
/*
22
- Function that saves all options from any page.
23
Options can also be passed in directly.
24
Can also be self-verified.
25
*/
@@ -95,7 +95,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
95
return $updated_all_options; /* Return status update. */
96
}
97
/*
98
- Add the options menus & sub-menus.
99
Attach to: add_action("admin_menu");
100
*/
101
public static function add_admin_options ()
@@ -167,7 +167,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
167
return; /* Return for uniformity. */
168
}
169
/*
170
- Add the options menus & sub-menus.
171
Attach to: add_action("network_admin_menu");
172
*/
173
public static function add_network_admin_options ()
@@ -260,7 +260,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
260
return; /* Return for uniformity. */
261
}
262
/*
263
- Function for building and handling the Main Multisite Options page.
264
*/
265
public static function mms_options_page ()
266
{
@@ -278,7 +278,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
278
return; /* Return for uniformity. */
279
}
280
/*
281
- Function for building and handling the General Options page.
282
*/
283
public static function options_page ()
284
{
@@ -295,7 +295,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
295
return; /* Return for uniformity. */
296
}
297
/*
298
- Function for building and handling the Paypal Options page.
299
*/
300
public static function paypal_ops_page ()
301
{
@@ -337,7 +337,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
337
return; /* Return for uniformity. */
338
}
339
/*
340
- Function for building and handling the Download Options page.
341
*/
342
public static function down_ops_page ()
343
{
@@ -373,7 +373,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
373
return; /* Return for uniformity. */
374
}
375
/*
376
- Function for building and handling the API Tracking options page.
377
*/
378
public static function trk_ops_page ()
379
{
@@ -390,7 +390,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
390
return; /* Return for uniformity. */
391
}
392
/*
393
- Function for building and handling the API List Server options page.
394
*/
395
public static function els_ops_page ()
396
{
@@ -407,7 +407,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
407
return; /* Return for uniformity. */
408
}
409
/*
410
- Function for building and handling the API Notifications page.
411
*/
412
public static function api_ops_page ()
413
{
@@ -424,7 +424,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
424
return; /* Return for uniformity. */
425
}
426
/*
427
- Function for building the PayPal Button Generator page.
428
*/
429
public static function paypal_buttons_page ()
430
{
@@ -442,7 +442,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
442
return; /* Return for uniformity. */
443
}
444
/*
445
- Function for building the API Scripting page.
446
*/
447
public static function scripting_page ()
448
{
@@ -457,7 +457,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
457
return; /* Return for uniformity. */
458
}
459
/*
460
- Function for building the Bridge Integrations page.
461
*/
462
public static function bridges_page ()
463
{
@@ -476,8 +476,9 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
476
if (preg_match ("/^Install/i", $post["ws_plugin__s2member_bridge_bbpress_action"]))
477
{
478
$min = (string)$post["ws_plugin__s2member_bridge_bbpress_min_level"];
479
/**/
480
- if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($min), $file)) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
481
c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
482
/**/
483
else /* Otherwise, something unexpected. The site owner will need to install the bbPress® plugin manually. */
@@ -492,7 +493,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
492
c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unknown error. Please try again, or un-install manually.", true);
493
/**/
494
else /* Otherwise, everything looks good. The plugin file has been removed successfully. */
495
- c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been successfully <strong>un-installed</strong>.");
496
}
497
else
498
c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin is already un-installed.", true);
@@ -505,10 +506,10 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
505
c_ws_plugin__s2member_admin_notices::display_admin_notice ("The directory you specified does NOT exist. Please try again, or install manually.", true);
506
}
507
/**/
508
- if (!is_dir ($plugins_dir_guess = $_SERVER["DOCUMENT_ROOT"] . "/bbpress/my-plugins"))
509
- if (!is_dir ($plugins_dir_guess = $_SERVER["DOCUMENT_ROOT"] . "/forums/my-plugins"))
510
- if (!is_dir ($plugins_dir_guess = $_SERVER["DOCUMENT_ROOT"] . "/bbpress/bb-plugins"))
511
- if (!is_dir ($plugins_dir_guess = $_SERVER["DOCUMENT_ROOT"] . "/forums/bb-plugins"))
512
$plugins_dir_guess = ($plugins_dir) ? $plugins_dir : $plugins_dir_guess;
513
/**/
514
$_bridge_bbpress_plugins_dir_guess = ($plugins_dir) ? $plugins_dir : $plugins_dir_guess;
@@ -520,7 +521,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
520
return; /* Return for uniformity. */
521
}
522
/*
523
- Function for building the s2Member Info page.
524
*/
525
public static function info_page ()
526
{
@@ -535,7 +536,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
535
return; /* Return for uniformity. */
536
}
537
/*
538
- Function for building and handling the Quick Start page.
539
*/
540
public static function start_page ()
541
{
19
class c_ws_plugin__s2member_menu_pages
20
{
21
/*
22
+ Saves all options from any page.
23
Options can also be passed in directly.
24
Can also be self-verified.
25
*/
95
return $updated_all_options; /* Return status update. */
96
}
97
/*
98
+ Adds the options menus & sub-menus.
99
Attach to: add_action("admin_menu");
100
*/
101
public static function add_admin_options ()
167
return; /* Return for uniformity. */
168
}
169
/*
170
+ Adds the options menus & sub-menus.
171
Attach to: add_action("network_admin_menu");
172
*/
173
public static function add_network_admin_options ()
260
return; /* Return for uniformity. */
261
}
262
/*
263
+ Builds and handles the Main Multisite Options page.
264
*/
265
public static function mms_options_page ()
266
{
278
return; /* Return for uniformity. */
279
}
280
/*
281
+ Builds and handles the General Options page.
282
*/
283
public static function options_page ()
284
{
295
return; /* Return for uniformity. */
296
}
297
/*
298
+ Builds and handles the Paypal Options page.
299
*/
300
public static function paypal_ops_page ()
301
{
337
return; /* Return for uniformity. */
338
}
339
/*
340
+ Builds and handles the Download Options page.
341
*/
342
public static function down_ops_page ()
343
{
373
return; /* Return for uniformity. */
374
}
375
/*
376
+ Builds and handles the API Tracking options page.
377
*/
378
public static function trk_ops_page ()
379
{
390
return; /* Return for uniformity. */
391
}
392
/*
393
+ Builds and handles the API List Server options page.
394
*/
395
public static function els_ops_page ()
396
{
407
return; /* Return for uniformity. */
408
}
409
/*
410
+ Builds and handles the API Notifications page.
411
*/
412
public static function api_ops_page ()
413
{
424
return; /* Return for uniformity. */
425
}
426
/*
427
+ Builds and handles the PayPal Button Generator page.
428
*/
429
public static function paypal_buttons_page ()
430
{
442
return; /* Return for uniformity. */
443
}
444
/*
445
+ Builds and handles the API Scripting page.
446
*/
447
public static function scripting_page ()
448
{
457
return; /* Return for uniformity. */
458
}
459
/*
460
+ Builds and handles the Bridge Integrations page.
461
*/
462
public static function bridges_page ()
463
{
476
if (preg_match ("/^Install/i", $post["ws_plugin__s2member_bridge_bbpress_action"]))
477
{
478
$min = (string)$post["ws_plugin__s2member_bridge_bbpress_min_level"];
479
+ $ovg = (string)$post["ws_plugin__s2member_bridge_bbpress_ovg"];
480
/**/
481
+ if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($min), preg_replace ("/%%ovg%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($ovg), $file))) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
482
c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
483
/**/
484
else /* Otherwise, something unexpected. The site owner will need to install the bbPress® plugin manually. */
493
c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unknown error. Please try again, or un-install manually.", true);
494
/**/
495
else /* Otherwise, everything looks good. The plugin file has been removed successfully. */
496
+ c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been successfully <strong>uninstalled</strong>.");
497
}
498
else
499
c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin is already un-installed.", true);
506
c_ws_plugin__s2member_admin_notices::display_admin_notice ("The directory you specified does NOT exist. Please try again, or install manually.", true);
507
}
508
/**/
509
+ if (!is_dir ($plugins_dir_guess = untrailingslashit ($_SERVER["DOCUMENT_ROOT"]) . "/bbpress/my-plugins"))
510
+ if (!is_dir ($plugins_dir_guess = untrailingslashit ($_SERVER["DOCUMENT_ROOT"]) . "/forums/my-plugins"))
511
+ if (!is_dir ($plugins_dir_guess = untrailingslashit ($_SERVER["DOCUMENT_ROOT"]) . "/bbpress/bb-plugins"))
512
+ if (!is_dir ($plugins_dir_guess = untrailingslashit ($_SERVER["DOCUMENT_ROOT"]) . "/forums/bb-plugins"))
513
$plugins_dir_guess = ($plugins_dir) ? $plugins_dir : $plugins_dir_guess;
514
/**/
515
$_bridge_bbpress_plugins_dir_guess = ($plugins_dir) ? $plugins_dir : $plugins_dir_guess;
521
return; /* Return for uniformity. */
522
}
523
/*
524
+ Builds and handles the s2Member Info page.
525
*/
526
public static function info_page ()
527
{
536
return; /* Return for uniformity. */
537
}
538
/*
539
+ Builds and handles the Quick Start page.
540
*/
541
public static function start_page ()
542
{
includes/classes/op-notices.inc.php CHANGED
@@ -60,7 +60,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
60
{
61
if (version_compare (get_bloginfo ("version"), "3.1-RC", ">="))
62
{
63
- $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code> and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />Please check: <code>s2Member -> Multisite ( Config )</code>.";
64
/**/
65
$js = '<script type="text/javascript">';
66
$js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
60
{
61
if (version_compare (get_bloginfo ("version"), "3.1-RC", ">="))
62
{
63
+ $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code> and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />Please check: <code>s2Member -> Multisite ( Config )</code>.";
64
/**/
65
$js = '<script type="text/javascript">';
66
$js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
includes/classes/option-forces.inc.php CHANGED
@@ -117,26 +117,29 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
117
/**/
118
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
119
/**/
120
- if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || !is_main_site ()) /* NOT a Blog Farm. */
121
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
122
/**/
123
- else if (!is_admin () && $users_can_register !== "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
124
{
125
if (is_super_admin () || current_user_can ("create_users") || ( ($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_level"]))) && ! ($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
126
{
127
- if (is_super_admin () || current_user_can ("create_users"))
128
{
129
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
130
}
131
else if ($subscr_gateway && $subscr_id && $custom && $level) /* A paying Customer? Cookies already authenticated above. */
132
{
133
- list ($level) = preg_split ("/\:/", $level, 1); /* Parse out the level now. */
134
/**/
135
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level])
136
{
137
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
138
}
139
- else /* Otherwise, we MUST allow them to create an account; they paid for it! */
140
{
141
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "user"), get_defined_vars ());
142
}
117
/**/
118
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
119
/**/
120
+ if (defined ("BP_VERSION") && is_multisite () && /* BP Multisite / but NOT offering Blogs? */ !c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
121
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = ( (c_ws_plugin__s2member_option_forces::check_register_access ()) ? "user" : "none")), get_defined_vars ());
122
+ /**/
123
+ else if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || !is_main_site ()) /* Blog Farm? */
124
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
125
/**/
126
+ else if (!is_admin () && $users_can_register !== "all") /* Do NOT run these checks on option pages; it's confusing to a site owner. */
127
{
128
if (is_super_admin () || current_user_can ("create_users") || ( ($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_level"]))) && ! ($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
129
{
130
+ if (is_super_admin () || current_user_can ("create_users")) /* Either a Super Administrator, or an Administrator that can create. */
131
{
132
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
133
}
134
else if ($subscr_gateway && $subscr_id && $custom && $level) /* A paying Customer? Cookies already authenticated above. */
135
{
136
+ list ($level) = preg_split ("/\:/", $level, 1); /* Parse out the Membership Level now. We'll need this below. */
137
/**/
138
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level]) /* Blog(s) allowed? */
139
{
140
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
141
}
142
+ else /* Otherwise, we MUST allow them to at least create an account; they paid for it! Defaults to `user`. */
143
{
144
return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "user"), get_defined_vars ());
145
}
includes/classes/paypal-notify-in.inc.php CHANGED
@@ -40,7 +40,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
40
/**/
41
if ($_GET["s2member_paypal_notify"] && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || $_GET["s2member_paypal_proxy"]))
42
{
43
- ignore_user_abort(true); /* Important. Continue processing even if/when the connection is broken by the sending party. */
44
/**/
45
include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get administrative functions. Needed for `wp_delete_user()`. */
46
/**/
@@ -403,7 +403,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
403
/**/
404
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
405
do_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_signup_w_update_vars", get_defined_vars ());
406
- do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", $paypal["level"]);
407
unset ($__refs, $__v); /* Unset defined __refs, __v. */
408
/**/
409
$fields = get_user_option ("s2member_custom_fields", $user_id);
@@ -861,7 +861,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
861
/**/
862
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
863
do_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", get_defined_vars ());
864
- do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", $paypal["level"]);
865
unset ($__refs, $__v); /* Unset defined __refs, __v. */
866
/**/
867
$fields = get_user_option ("s2member_custom_fields", $user_id);
@@ -1312,9 +1312,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1312
{
1313
$processing = $during = true; /* Yes, we ARE processing this. */
1314
/**/
1315
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
1316
do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote", get_defined_vars ());
1317
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "ipn-refund-reversal-demotion");
1318
unset ($__refs, $__v); /* Unset defined __refs, __v. */
1319
/**/
1320
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
@@ -1351,7 +1354,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1351
{
1352
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
1353
/**/
1354
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
1355
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
1356
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
1357
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
@@ -1375,6 +1378,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1375
$msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
1376
$msg .= "\n\n"; /* Spacing in the message body. */
1377
/**/
1378
$msg .= "subscr_id: %%subscr_id%%\n";
1379
$msg .= "user_first_name: %%user_first_name%%\n";
1380
$msg .= "user_last_name: %%user_last_name%%\n";
@@ -1398,7 +1402,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1398
$msg .= "cv8: %%cv8%%\n";
1399
$msg .= "cv9: %%cv9%%";
1400
/**/
1401
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $msg)))
1402
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
1403
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
1404
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
@@ -1427,11 +1431,17 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1427
{
1428
$processing = $during = true; /* Yes, we ARE processing this. */
1429
/**/
1430
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
1431
do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_delete", get_defined_vars ());
1432
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "ipn-refund-reversal-deletion");
1433
unset ($__refs, $__v); /* Unset defined __refs, __v. */
1434
/**/
1435
if (is_multisite ()) /* Multisite does NOT actually delete; ONLY removes. */
1436
{
1437
remove_user_from_blog ($user_id, $current_blog->blog_id);
@@ -1441,7 +1451,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1441
/**/
1442
else /* Otherwise, we can actually delete them. */
1443
/* This will automatically trigger `eot_del_notification_urls` as well. */
1444
- wp_delete_user($user_id); /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */
1445
/**/
1446
$paypal["s2member_log"][] = "This Member's account has been " . ( (is_multisite ()) ? "removed" : "deleted") . ".";
1447
/**/
40
/**/
41
if ($_GET["s2member_paypal_notify"] && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || $_GET["s2member_paypal_proxy"]))
42
{
43
+ @ignore_user_abort (true); /* Important. Continue processing even if/when the connection is broken by the sending party. */
44
/**/
45
include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get administrative functions. Needed for `wp_delete_user()`. */
46
/**/
403
/**/
404
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
405
do_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_signup_w_update_vars", get_defined_vars ());
406
+ do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", "modification", $paypal["level"]);
407
unset ($__refs, $__v); /* Unset defined __refs, __v. */
408
/**/
409
$fields = get_user_option ("s2member_custom_fields", $user_id);
861
/**/
862
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
863
do_action ("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", get_defined_vars ());
864
+ do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", "modification", $paypal["level"]);
865
unset ($__refs, $__v); /* Unset defined __refs, __v. */
866
/**/
867
$fields = get_user_option ("s2member_custom_fields", $user_id);
1312
{
1313
$processing = $during = true; /* Yes, we ARE processing this. */
1314
/**/
1315
+ $eot_del_type = ($is_refund_or_reversal) ? "ipn-refund-reversal-demotion" : "ipn-cancellation-expiration-demotion";
1316
+ $eot_del_type_spec = ($is_refund_or_reversal) ? "refund-reversal" : "cancellation-expiration";
1317
+ /**/
1318
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
1319
do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote", get_defined_vars ());
1320
+ do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, $eot_del_type_spec);
1321
unset ($__refs, $__v); /* Unset defined __refs, __v. */
1322
/**/
1323
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
1354
{
1355
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
1356
/**/
1357
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($eot_del_type)), $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
1358
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
1359
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
1360
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
1378
$msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
1379
$msg .= "\n\n"; /* Spacing in the message body. */
1380
/**/
1381
+ $msg .= "eot_del_type: %%eot_del_type%%\n";
1382
$msg .= "subscr_id: %%subscr_id%%\n";
1383
$msg .= "user_first_name: %%user_first_name%%\n";
1384
$msg .= "user_last_name: %%user_last_name%%\n";
1402
$msg .= "cv8: %%cv8%%\n";
1403
$msg .= "cv9: %%cv9%%";
1404
/**/
1405
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($eot_del_type), $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $msg)))
1406
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
1407
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
1408
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
1431
{
1432
$processing = $during = true; /* Yes, we ARE processing this. */
1433
/**/
1434
+ $eot_del_type = ($is_refund_or_reversal) ? "ipn-refund-reversal-deletion" : "ipn-cancellation-expiration-deletion";
1435
+ $eot_del_type_spec = ($is_refund_or_reversal) ? "refund-reversal" : "cancellation-expiration";
1436
+ /**/
1437
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
1438
do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_delete", get_defined_vars ());
1439
+ do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, $eot_del_type_spec);
1440
unset ($__refs, $__v); /* Unset defined __refs, __v. */
1441
/**/
1442
+ $GLOBALS["ws_plugin__s2member_eot_del_type"] = $eot_del_type;
1443
+ $GLOBALS["ws_plugin__s2member_eot_del_type_spec"] = $eot_del_type_spec;
1444
+ /**/
1445
if (is_multisite ()) /* Multisite does NOT actually delete; ONLY removes. */
1446
{
1447
remove_user_from_blog ($user_id, $current_blog->blog_id);
1451
/**/
1452
else /* Otherwise, we can actually delete them. */
1453
/* This will automatically trigger `eot_del_notification_urls` as well. */
1454
+ wp_delete_user ($user_id); /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */
1455
/**/
1456
$paypal["s2member_log"][] = "This Member's account has been " . ( (is_multisite ()) ? "removed" : "deleted") . ".";
1457
/**/
includes/classes/paypal-return-in.inc.php CHANGED
@@ -47,7 +47,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
47
email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
48
$paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
49
/*
50
- Custom conditionals can be applied by filters.
51
*/
52
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
53
if (!apply_filters ("ws_plugin__s2member_during_paypal_return_conditionals", false, get_defined_vars ()))
@@ -98,7 +98,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
98
/**/
99
$paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
100
/**/
101
- wp_redirect ($sp_access_url); /* Redirect Customer immediately. */
102
}
103
else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
104
{
@@ -201,12 +201,24 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
201
do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars ());
202
unset ($__refs, $__v); /* Unset defined __refs, __v. */
203
/**/
204
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
205
- /**/
206
- echo '<script type="text/javascript">' . "\n";
207
- echo "alert('Thank you! You\\'ve been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nPlease log back in now.');" . "\n";
208
- echo "window.location = '" . esc_js (wp_login_url ()) . "';" . "\n";
209
- echo '</script>' . "\n";
210
}
211
else
212
{
@@ -264,15 +276,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
264
/**/
265
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && is_main_site ())
266
{
267
- echo '<script type="text/javascript">' . "\n";
268
- echo "alert('Thank you! Your account has been approved.\\nThe next step is to Register.\\n\\nPlease click OK to Register now.');" . "\n";/**/
269
- echo "window.location = '" . esc_js (c_ws_plugin__s2member_utils_urls::wp_signup_url ()) . "';" . "\n";
270
echo '</script>' . "\n";
271
}
272
else /* Otherwise, this is NOT a Multisite install. Or it is, but the Super Administrator is NOT selling Blog creation. */
273
{
274
- echo '<script type="text/javascript">' . "\n";
275
- echo "alert('Thank you! Your account has been approved.\\nThe next step is to Register a Username.\\n\\nPlease click OK to Register now.');" . "\n";/**/
276
echo "window.location = '" . esc_js (c_ws_plugin__s2member_utils_urls::wp_register_url ()) . "';" . "\n";
277
echo '</script>' . "\n";
278
}
@@ -349,12 +361,24 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
349
do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars ());
350
unset ($__refs, $__v); /* Unset defined __refs, __v. */
351
/**/
352
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
353
- /**/
354
- echo '<script type="text/javascript">' . "\n";
355
- echo "alert('Thank you! You\\'ve been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nPlease log back in now.');" . "\n";
356
- echo "window.location = '" . esc_js (wp_login_url ()) . "';";
357
- echo '</script>' . "\n";
358
}
359
else
360
{
@@ -436,7 +460,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
436
unset ($__refs, $__v); /* Unset defined __refs, __v. */
437
}
438
}
439
- else if (!isset ($_GET["tx"]) && (empty ($_POST) || $_POST["auth"]))
440
{
441
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
442
do_action ("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
47
email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
48
$paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
49
/*
50
+ Custom conditionals can be applied by Filters.
51
*/
52
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
53
if (!apply_filters ("ws_plugin__s2member_during_paypal_return_conditionals", false, get_defined_vars ()))
98
/**/
99
$paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
100
/**/
101
+ wp_redirect($sp_access_url); /* Redirect Customer to the Specific Post/Page. */
102
}
103
else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
104
{
201
do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars ());
202
unset ($__refs, $__v); /* Unset defined __refs, __v. */
203
/**/
204
+ if ($redirection_url_after_modification = apply_filters ("ws_plugin__s2member_redirection_url_after_modification", false, get_defined_vars ()))
205
+ {
206
+ $paypal["s2member_log"][] = "Redirecting this Member to a custom URL after modification: " . $redirection_url_after_modification;
207
+ /**/
208
+ echo '<script type="text/javascript">' . "\n";
209
+ echo "alert('Thank you! You\\'ve been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "');" . "\n";
210
+ echo "window.location = '" . esc_js ($redirection_url_after_modification) . "';" . "\n";
211
+ echo '</script>' . "\n";
212
+ }
213
+ else /* Else, use standard/default handling in this scenario. Have the Customer log in again. */
214
+ {
215
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in.";
216
+ /**/
217
+ echo '<script type="text/javascript">' . "\n";
218
+ echo "alert('Thank you! You\\'ve been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "');" . "\n";
219
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';" . "\n";
220
+ echo '</script>' . "\n";
221
+ }
222
}
223
else
224
{
276
/**/
277
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && is_main_site ())
278
{
279
+ echo '<script type="text/javascript">' . "\n"; /* This default location can be Filtered in WP with: `wp_signup_location`. */
280
+ echo "alert('Thank you! Your account has been approved.\\nThe next step is to Register.\\n\\nPlease click OK to Register now.');" . "\n";
281
+ echo "window.location = '" . esc_js (c_ws_plugin__s2member_utils_urls::wp_signup_url ()) . "';" . "\n"; /* Filterable. */
282
echo '</script>' . "\n";
283
}
284
else /* Otherwise, this is NOT a Multisite install. Or it is, but the Super Administrator is NOT selling Blog creation. */
285
{
286
+ echo '<script type="text/javascript">' . "\n"; /* This location can be Filtered with: `wp_register_location`. */
287
+ echo "alert('Thank you! Your account has been approved.\\nThe next step is to Register a Username.\\n\\nPlease click OK to Register now.');" . "\n";
288
echo "window.location = '" . esc_js (c_ws_plugin__s2member_utils_urls::wp_register_url ()) . "';" . "\n";
289
echo '</script>' . "\n";
290
}
361
do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars ());
362
unset ($__refs, $__v); /* Unset defined __refs, __v. */
363
/**/
364
+ if ($redirection_url_after_modification = apply_filters ("ws_plugin__s2member_redirection_url_after_modification", false, get_defined_vars ()))
365
+ {
366
+ $paypal["s2member_log"][] = "Redirecting this Member to a custom URL after modification: " . $redirection_url_after_modification;
367
+ /**/
368
+ echo '<script type="text/javascript">' . "\n";
369
+ echo "alert('Thank you! You\\'ve been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "');" . "\n";
370
+ echo "window.location = '" . esc_js ($redirection_url_after_modification) . "';";
371
+ echo '</script>' . "\n";
372
+ }
373
+ else /* Else, use standard/default handling in this scenario. Have the Customer log in again. */
374
+ {
375
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in.";
376
+ /**/
377
+ echo '<script type="text/javascript">' . "\n";
378
+ echo "alert('Thank you! You\\'ve been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "');" . "\n";
379
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';";
380
+ echo '</script>' . "\n";
381
+ }
382
}
383
else
384
{
460
unset ($__refs, $__v); /* Unset defined __refs, __v. */
461
}
462
}
463
+ else if (!isset ($_GET["tx"])) /* No Return-Data from PayPal® at all? */
464
{
465
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
466
do_action ("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
includes/classes/register-access.inc.php CHANGED
@@ -32,8 +32,12 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
32
$register = c_ws_plugin__s2member_utils_encryption::encrypt ("subscr_gateway_subscr_id_custom_item_number_time:.:|:.:" . $subscr_gateway . ":.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime ("now"));
33
$register_link = site_url ("/?s2member_register=" . urlencode ($register));
34
/**/
35
- if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
36
return apply_filters ("ws_plugin__s2member_register_link_gen", $tinyurl . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
37
else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
38
return apply_filters ("ws_plugin__s2member_register_link_gen", $register_link, get_defined_vars ());
39
}
32
$register = c_ws_plugin__s2member_utils_encryption::encrypt ("subscr_gateway_subscr_id_custom_item_number_time:.:|:.:" . $subscr_gateway . ":.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime ("now"));
33
$register_link = site_url ("/?s2member_register=" . urlencode ($register));
34
/**/
35
+ if ($shrink && ($_alternative = apply_filters ("ws_plugin__s2member_register_link_gen_alternative", $register_link, get_defined_vars ())) && strlen ($_alternative) < strlen ($register_link))
36
+ return apply_filters ("ws_plugin__s2member_register_link_gen", $_alternative, get_defined_vars ());
37
+ /**/
38
+ else if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
39
return apply_filters ("ws_plugin__s2member_register_link_gen", $tinyurl . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
40
+ /**/
41
else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
42
return apply_filters ("ws_plugin__s2member_register_link_gen", $register_link, get_defined_vars ());
43
}
includes/classes/registrations.inc.php CHANGED
@@ -337,8 +337,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
337
if (!is_admin () && ($post["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"] || $post["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $post["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $post["ws_plugin__s2member_custom_reg_field_s2member_ccaps"] || $post["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"] || $post["ws_plugin__s2member_custom_reg_field_s2member_notes"]))
338
exit ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!");
339
/**/
340
- $_pm = array_merge ((array)$post, (array)$meta); /* Merge these two data sources together now; ALWAYS after the security routine above ^. */
341
- unset ($post, $meta); /* These can be unset now; no longer needed ( we use $_pm instead, it's a combination of the two arrays ). */
342
/**/
343
if (!is_admin () /* Only run this particular routine whenever a Member Level [1-4] is registering themselves with paid authorization cookies in their browser. */
344
&& ($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_level"])))/**/
@@ -353,7 +353,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
353
/**/
354
$current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
355
list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
356
- $role = "s2member_level" . $level; /* Level 1-4. */
357
/**/
358
$email = $user->user_email;
359
$login = $user->user_login;
@@ -363,26 +363,26 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
363
if ($eotper) /* If a specific EOT Period has been attached; calculate that now. */
364
$auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time ("", "", "", $eotper);
365
/**/
366
- $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
367
/**/
368
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
369
- $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
370
/**/
371
if (! ($fname = $user->first_name))
372
- if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
373
- $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
374
/**/
375
if (!$fname) /* Also try BuddyPress. */
376
- if ($_pm["field_1"]) /* BuddyPress. */
377
- $fname = trim (preg_replace ("/ (.*)#x2F;", "", $_pm["field_1"]));
378
/**/
379
if (! ($lname = $user->last_name))
380
- if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
381
- $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
382
/**/
383
if (!$lname) /* Also try BuddyPress. */
384
- if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)#x2F;", $_pm["field_1"]))
385
- $lname = trim (preg_replace ("/^(.+?) (.+)#x2F;", "$2", $_pm["field_1"]));
386
/**/
387
$name = trim ($fname . " " . $lname); /* Both names. */
388
/**/
@@ -391,8 +391,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
391
$pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
392
/**/
393
if (!$pass) /* Also try BuddyPress Password. */
394
- if ($_pm["signup_password"]) /* BuddyPress. */
395
- $pass = $_pm["signup_password"];
396
/**/
397
if ($pass) /* No Password nag. Update this globally. */
398
{
@@ -441,8 +441,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
441
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
442
$field_id_class = preg_replace ("/_/", "-", $field_var);
443
/**/
444
- if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
445
- $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
446
}
447
/**/
448
update_user_option ($user_id, "s2member_custom_fields", $fields);
@@ -477,52 +477,54 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
477
}
478
/**/
479
else if (!is_admin ()) /* Otherwise, if we are NOT inside the Dashboard during the creation of this account. */
480
- { /*
481
- This routine could be processed through `wp-login.php?action=register`, `wp-activate.php`, or `/activate` via BuddyPress`.
482
This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
483
If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
484
*/
485
$processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
486
/**/
487
- $role = ($current_role = c_ws_plugin__s2member_user_access::user_access_role ($user));
488
$role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
489
/**/
490
- $level = (preg_match ("/^(administrator|editor|author|contributor)#x2F;i", $role)) ? "4" : $level;
491
$level = (!$level && preg_match ("/^s2member_level[1-4]#x2F;i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
492
$level = (!$level && preg_match ("/^subscriber#x2F;i", $role)) ? "0" : $level;
493
$level = (!$level) ? "0" : $level;
494
/**/
495
- $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
496
/**/
497
$email = $user->user_email;
498
$login = $user->user_login;
499
$ip = $_SERVER["REMOTE_ADDR"];
500
- $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
501
- $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
502
- $subscr_gateway = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
503
- $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
504
/**/
505
- $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
506
- $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
507
/**/
508
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
509
- $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
510
/**/
511
if (! ($fname = $user->first_name))
512
- if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
513
- $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
514
/**/
515
if (!$fname) /* Also try BuddyPress. */
516
- if ($_pm["field_1"]) /* BuddyPress. */
517
- $fname = trim (preg_replace ("/ (.*)#x2F;", "", $_pm["field_1"]));
518
/**/
519
if (! ($lname = $user->last_name))
520
- if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
521
- $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
522
/**/
523
if (!$lname) /* Also try BuddyPress. */
524
- if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)#x2F;", $_pm["field_1"]))
525
- $lname = trim (preg_replace ("/^(.+?) (.+)#x2F;", "$2", $_pm["field_1"]));
526
/**/
527
$name = trim ($fname . " " . $lname); /* Both names. */
528
/**/
@@ -531,8 +533,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
531
$pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
532
/**/
533
if (!$pass) /* Also try BuddyPress Password. */
534
- if ($_pm["signup_password"]) /* BuddyPress. */
535
- $pass = $_pm["signup_password"];
536
/**/
537
if ($pass) /* No Password nag. Update this globally. */
538
{
@@ -581,8 +583,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
581
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
582
$field_id_class = preg_replace ("/_/", "-", $field_var);
583
/**/
584
- if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
585
- $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
586
}
587
/**/
588
update_user_option ($user_id, "s2member_custom_fields", $fields);
@@ -607,36 +609,39 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
607
*/
608
$processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
609
/**/
610
- $role = ($current_role = c_ws_plugin__s2member_user_access::user_access_role ($user));
611
$role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
612
/**/
613
- $level = (preg_match ("/^(administrator|editor|author|contributor)#x2F;i", $role)) ? "4" : $level;
614
$level = (!$level && preg_match ("/^s2member_level[1-4]#x2F;i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
615
$level = (!$level && preg_match ("/^subscriber#x2F;i", $role)) ? "0" : $level;
616
$level = (!$level) ? "0" : $level;
617
/**/
618
- $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
619
/**/
620
$email = $user->user_email;
621
$login = $user->user_login;
622
$ip = ""; /* N/Applicable. */
623
- $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
624
- $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
625
- $subscr_gateway = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
626
- $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
627
/**/
628
- $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
629
- $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
630
/**/
631
- $opt_in = ($_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
632
/**/
633
if (! ($fname = $user->first_name)) /* `Users -> Add New`. */
634
- if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
635
- $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
636
/**/
637
if (! ($lname = $user->last_name)) /* `Users -> Add New`. */
638
- if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
639
- $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
640
/**/
641
$name = trim ($fname . " " . $lname); /* Both names. */
642
/**/
@@ -645,8 +650,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
645
$pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
646
/**/
647
if (!$pass) /* Also try the `Users -> Add New` form. */
648
- if ($_pm["pass1"]) /* Field in user-new.php. */
649
- $pass = $_pm["pass1"];
650
/**/
651
if ($pass) /* No Password nag. Update this globally. */
652
{
@@ -695,8 +700,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
695
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
696
$field_id_class = preg_replace ("/_/", "-", $field_var);
697
/**/
698
- if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
699
- $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
700
}
701
/**/
702
update_user_option ($user_id, "s2member_custom_fields", $fields);
@@ -723,22 +728,24 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
723
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
724
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($role)), $url)))
725
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($level)), $url)))
726
- if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($fname)), $url)))
727
- if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($lname)), $url)))
728
- if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($name)), $url)))
729
- if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($email)), $url)))
730
- if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($login)), $url)))
731
- if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($pass)), $url)))
732
- if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
733
- {
734
- if (is_array ($fields) && !empty ($fields))
735
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
736
- if (! ($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
737
- break;
738
- /**/
739
- if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
740
- c_ws_plugin__s2member_utils_urls::remote ($url);
741
- }
742
/**/
743
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
744
{
@@ -747,6 +754,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
747
/**/
748
$msg .= "role: %%role%%\n";
749
$msg .= "level: %%level%%\n";
750
$msg .= "user_first_name: %%user_first_name%%\n";
751
$msg .= "user_last_name: %%user_last_name%%\n";
752
$msg .= "user_full_name: %%user_full_name%%\n";
@@ -773,23 +782,25 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
773
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
774
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($role), $msg)))
775
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($level), $msg)))
776
- if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($fname), $msg)))
777
- if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($lname), $msg)))
778
- if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($name), $msg)))
779
- if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($email), $msg)))
780
- if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($login), $msg)))
781
- if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($pass), $msg)))
782
- if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
783
- {
784
- if (is_array ($fields) && !empty ($fields))
785
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
786
- if (! ($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
787
- break;
788
- /**/
789
- if (($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
790
- foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
791
- ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_registration_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
792
- }
793
}
794
/**/
795
if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
@@ -797,30 +808,38 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
797
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
798
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($role)), $url)))
799
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($level)), $url)))
800
- if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($fname)), $url)))
801
- if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($lname)), $url)))
802
- if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($name)), $url)))
803
- if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($email)), $url)))
804
- if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($login)), $url)))
805
- if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($pass)), $url)))
806
- if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
807
- {
808
- if (is_array ($fields) && !empty ($fields))
809
- foreach ($fields as $var => $val) /* Custom Registration Fields. */
810
- if (! ($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
811
- break;
812
- /**/
813
- if (($url = trim ($url))) /* Preserve remaining Replacements. */
814
- /* Because the parent routine may perform replacements too. */
815
- $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
816
- }
817
- /**/
818
- c_ws_plugin__s2member_list_servers::process_list_servers ($role, $level, $email, $fname, $lname, $ip, $opt_in, $user_id);
819
- /**/
820
- setcookie ("s2member_subscr_gateway", "", time () + 31556926, "/");
821
- setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
822
- setcookie ("s2member_custom", "", time () + 31556926, "/");
823
- setcookie ("s2member_level", "", time () + 31556926, "/");
824
/**/
825
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
826
do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
337
if (!is_admin () && ($post["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"] || $post["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $post["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $post["ws_plugin__s2member_custom_reg_field_s2member_ccaps"] || $post["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"] || $post["ws_plugin__s2member_custom_reg_field_s2member_notes"]))
338
exit ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!");
339
/**/
340
+ $_pmr = array_merge ((array)$post, (array)$meta, (array)$GLOBALS["ws_plugin__s2member_registration_vars"]); /* Merge these together. */
341
+ unset ($post, $meta, $GLOBALS["ws_plugin__s2member_registration_vars"]); /* These vars can all be unset now; we have them all now inside $_pmr. */
342
/**/
343
if (!is_admin () /* Only run this particular routine whenever a Member Level [1-4] is registering themselves with paid authorization cookies in their browser. */
344
&& ($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_level"])))/**/
353
/**/
354
$current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
355
list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
356
+ $role = "s2member_level" . $level; /* Membership Level. */
357
/**/
358
$email = $user->user_email;
359
$login = $user->user_login;
363
if ($eotper) /* If a specific EOT Period has been attached; calculate that now. */
364
$auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time ("", "", "", $eotper);
365
/**/
366
+ $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
367
/**/
368
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
369
+ $opt_in = (!$opt_in && $_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
370
/**/
371
if (! ($fname = $user->first_name))
372
+ if ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])
373
+ $fname = $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
374
/**/
375
if (!$fname) /* Also try BuddyPress. */
376
+ if ($_pmr["field_1"]) /* BuddyPress. */
377
+ $fname = trim (preg_replace ("/ (.*)#x2F;", "", $_pmr["field_1"]));
378
/**/
379
if (! ($lname = $user->last_name))
380
+ if ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])
381
+ $lname = $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
382
/**/
383
if (!$lname) /* Also try BuddyPress. */
384
+ if ($_pmr["field_1"] && preg_match ("/^(.+?) (.+)#x2F;", $_pmr["field_1"]))
385
+ $lname = trim (preg_replace ("/^(.+?) (.+)#x2F;", "$2", $_pmr["field_1"]));
386
/**/
387
$name = trim ($fname . " " . $lname); /* Both names. */
388
/**/
391
$pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
392
/**/
393
if (!$pass) /* Also try BuddyPress Password. */
394
+ if ($_pmr["signup_password"]) /* BuddyPress. */
395
+ $pass = $_pmr["signup_password"];
396
/**/
397
if ($pass) /* No Password nag. Update this globally. */
398
{
441
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
442
$field_id_class = preg_replace ("/_/", "-", $field_var);
443
/**/
444
+ if (isset ($_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var]))
445
+ $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
446
}
447
/**/
448
update_user_option ($user_id, "s2member_custom_fields", $fields);
477
}
478
/**/
479
else if (!is_admin ()) /* Otherwise, if we are NOT inside the Dashboard during the creation of this account. */
480
+ { /* This routine could be processed through `wp-login.php?action=register`, `wp-activate.php`, or `/activate` via BuddyPress`.
481
This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
482
If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
483
*/
484
$processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
485
/**/
486
+ $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
487
+ $role = ($level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) ? "s2member_level" . $level : $role;
488
+ $role = (!$role && $current_role) ? $current_role : $role; /* Use existing Role? */
489
$role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
490
/**/
491
+ $level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
492
+ $level = (!$level && preg_match ("/^(administrator|editor|author|contributor)#x2F;i", $role)) ? "4" : $level;
493
$level = (!$level && preg_match ("/^s2member_level[1-4]#x2F;i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
494
$level = (!$level && preg_match ("/^subscriber#x2F;i", $role)) ? "0" : $level;
495
$level = (!$level) ? "0" : $level;
496
/**/
497
+ $ccaps = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
498
/**/
499
$email = $user->user_email;
500
$login = $user->user_login;
501
$ip = $_SERVER["REMOTE_ADDR"];
502
+ $custom = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
503
+ $subscr_id = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
504
+ $subscr_gateway = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
505
+ $cv = preg_split ("/\|/", $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
506
/**/
507
+ $auto_eot_time = ($eot = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
508
+ $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
509
/**/
510
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
511
+ $opt_in = (!$opt_in && $_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
512
/**/
513
if (! ($fname = $user->first_name))
514
+ if ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])
515
+ $fname = $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
516
/**/
517
if (!$fname) /* Also try BuddyPress. */
518
+ if ($_pmr["field_1"]) /* BuddyPress. */
519
+ $fname = trim (preg_replace ("/ (.*)#x2F;", "", $_pmr["field_1"]));
520
/**/
521
if (! ($lname = $user->last_name))
522
+ if ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])
523
+ $lname = $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
524
/**/
525
if (!$lname) /* Also try BuddyPress. */
526
+ if ($_pmr["field_1"] && preg_match ("/^(.+?) (.+)#x2F;", $_pmr["field_1"]))
527
+ $lname = trim (preg_replace ("/^(.+?) (.+)#x2F;", "$2", $_pmr["field_1"]));
528
/**/
529
$name = trim ($fname . " " . $lname); /* Both names. */
530
/**/
533
$pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
534
/**/
535
if (!$pass) /* Also try BuddyPress Password. */
536
+ if ($_pmr["signup_password"]) /* BuddyPress. */
537
+ $pass = $_pmr["signup_password"];
538
/**/
539
if ($pass) /* No Password nag. Update this globally. */
540
{
583
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
584
$field_id_class = preg_replace ("/_/", "-", $field_var);
585
/**/
586
+ if (isset ($_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var]))
587
+ $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
588
}
589
/**/
590
update_user_option ($user_id, "s2member_custom_fields", $fields);
609
*/
610
$processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
611
/**/
612
+ $current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
613
+ $role = ($level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) ? "s2member_level" . $level : $role;
614
+ $role = (!$role && $current_role) ? $current_role : $role; /* Use existing Role? */
615
$role = (!$role) ? get_option ("default_role") : $role; /* Otherwise default. */
616
/**/
617
+ $level = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
618
+ $level = (!$level && preg_match ("/^(administrator|editor|author|contributor)#x2F;i", $role)) ? "4" : $level;
619
$level = (!$level && preg_match ("/^s2member_level[1-4]#x2F;i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
620
$level = (!$level && preg_match ("/^subscriber#x2F;i", $role)) ? "0" : $level;
621
$level = (!$level) ? "0" : $level;
622
/**/
623
+ $ccaps = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
624
/**/
625
$email = $user->user_email;
626
$login = $user->user_login;
627
$ip = ""; /* N/Applicable. */
628
+ $custom = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"];
629
+ $subscr_id = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
630
+ $subscr_gateway = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"];
631
+ $cv = preg_split ("/\|/", $_pmr["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
632
/**/
633
+ $auto_eot_time = ($eot = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
634
+ $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
635
/**/
636
+ $opt_in = ($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
637
/**/
638
if (! ($fname = $user->first_name)) /* `Users -> Add New`. */
639
+ if ($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])
640
+ $fname = $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
641
/**/
642
if (! ($lname = $user->last_name)) /* `Users -> Add New`. */
643
+ if ($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])
644
+ $lname = $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
645
/**/
646
$name = trim ($fname . " " . $lname); /* Both names. */
647
/**/
650
$pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
651
/**/
652
if (!$pass) /* Also try the `Users -> Add New` form. */
653
+ if ($_pmr["pass1"]) /* Field in user-new.php. */
654
+ $pass = $_pmr["pass1"];
655
/**/
656
if ($pass) /* No Password nag. Update this globally. */
657
{
700
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
701
$field_id_class = preg_replace ("/_/", "-", $field_var);
702
/**/
703
+ if (isset ($_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var]))
704
+ $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
705
}
706
/**/
707
update_user_option ($user_id, "s2member_custom_fields", $fields);
728
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
729
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($role)), $url)))
730
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($level)), $url)))
731
+ if (($url = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($ccaps)), $url)))
732
+ if (($url = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($auto_eot_time)), $url)))
733
+ if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($fname)), $url)))
734
+ if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($lname)), $url)))
735
+ if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($name)), $url)))
736
+ if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($email)), $url)))
737
+ if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($login)), $url)))
738
+ if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($pass)), $url)))
739
+ if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
740
+ {
741
+ if (is_array ($fields) && !empty ($fields))
742
+ foreach ($fields as $var => $val) /* Custom Registration Fields. */
743
+ if (! ($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
744
+ break;
745
+ /**/
746
+ if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
747
+ c_ws_plugin__s2member_utils_urls::remote ($url);
748
+ }
749
/**/
750
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
751
{
754
/**/
755
$msg .= "role: %%role%%\n";
756
$msg .= "level: %%level%%\n";
757
+ $msg .= "ccaps: %%ccaps%%\n";
758
+ $msg .= "auto_eot_time: %%auto_eot_time%%\n";
759
$msg .= "user_first_name: %%user_first_name%%\n";
760
$msg .= "user_last_name: %%user_last_name%%\n";
761
$msg .= "user_full_name: %%user_full_name%%\n";
782
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
783
if (($msg = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($role), $msg)))
784
if (($msg = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($level), $msg)))
785
+ if (($msg = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($ccaps), $msg)))
786
+ if (($msg = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($auto_eot_time), $msg)))
787
+ if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($fname), $msg)))
788
+ if (($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($lname), $msg)))
789
+ if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($name), $msg)))
790
+ if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($email), $msg)))
791
+ if (($msg = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($login), $msg)))
792
+ if (($msg = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($pass), $msg)))
793
+ if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
794
+ {
795
+ if (is_array ($fields) && !empty ($fields))
796
+ foreach ($fields as $var => $val) /* Custom Registration Fields. */
797
+ if (! ($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
798
+ break;
799
+ /**/
800
+ if (($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
801
+ foreach (c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
802
+ ($recipient) ? wp_mail ($recipient, apply_filters ("ws_plugin__s2member_registration_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
803
+ }
804
}
805
/**/
806
if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
808
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
809
if (($url = preg_replace ("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($role)), $url)))
810
if (($url = preg_replace ("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($level)), $url)))
811
+ if (($url = preg_replace ("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($ccaps)), $url)))
812
+ if (($url = preg_replace ("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($auto_eot_time)), $url)))
813
+ if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($fname)), $url)))
814
+ if (($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($lname)), $url)))
815
+ if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($name)), $url)))
816
+ if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($email)), $url)))
817
+ if (($url = preg_replace ("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($login)), $url)))
818
+ if (($url = preg_replace ("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($pass)), $url)))
819
+ if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
820
+ {
821
+ if (is_array ($fields) && !empty ($fields))
822
+ foreach ($fields as $var => $val) /* Custom Registration Fields. */
823
+ if (! ($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
824
+ break;
825
+ /**/
826
+ if (($url = trim ($url))) /* Preserve remaining Replacements. */
827
+ /* Because the parent routine may perform replacements too. */
828
+ $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
829
+ }
830
+ /**/
831
+ c_ws_plugin__s2member_list_servers::process_list_servers ($role, $level, $login, $pass, $email, $fname, $lname, $ip, $opt_in, $user_id);
832
+ /*
833
+ Suppress errors here in case this routine is fired in unexpected locations; or with odd output buffering techniques.
834
+ @TODO: It may also be impossible to delete cookies when fired inside: `/wp-activate.php`.
835
+ */
836
+ if (!headers_sent ()) /* Only if headers are NOT yet sent. */
837
+ {
838
+ @setcookie ("s2member_subscr_gateway", "", time () + 31556926, "/");
839
+ @setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
840
+ @setcookie ("s2member_custom", "", time () + 31556926, "/");
841
+ @setcookie ("s2member_level", "", time () + 31556926, "/");
842
+ }
843
/**/
844
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
845
do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
includes/classes/sp-access.inc.php CHANGED
@@ -32,7 +32,10 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
32
$sp_access = c_ws_plugin__s2member_utils_encryption::encrypt ("sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime ("now") . ":.:|:.:" . $hours);
33
$sp_access_link = add_query_arg ("s2member_sp_access", urlencode ($sp_access), get_permalink ($leading_id));
34
/**/
35
- if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
36
return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $tinyurl . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
37
/**/
38
else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
32
$sp_access = c_ws_plugin__s2member_utils_encryption::encrypt ("sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime ("now") . ":.:|:.:" . $hours);
33
$sp_access_link = add_query_arg ("s2member_sp_access", urlencode ($sp_access), get_permalink ($leading_id));
34
/**/
35
+ if ($shrink && ($_alternative = apply_filters ("ws_plugin__s2member_sp_access_link_gen_alternative", $sp_access_link, get_defined_vars ())) && strlen ($_alternative) < strlen ($sp_access_link))
36
+ return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $_alternative, get_defined_vars ());
37
+ /**/
38
+ else if ($shrink && ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
39
return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $tinyurl . "#" . $_SERVER["HTTP_HOST"], get_defined_vars ());
40
/**/
41
else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
includes/classes/ssl-in.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
19
class c_ws_plugin__s2member_ssl_in
20
{
21
/*
22
- Function that forces SSL on specific Posts/Pages.
23
Attach to: add_action("template_redirect");
24
25
Triggered by Custom Field:
@@ -58,39 +58,48 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
58
define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
59
define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
60
/**/
61
- /* Except these. We do NOT want to create a sitewide https conversion! */
62
add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
63
add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
64
add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
65
add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
66
- /**/
67
- if (!function_exists ("_ws_plugin__s2member_force_non_ssl_scheme"))
68
- {
69
- function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
70
- {
71
- return ($scheme) ? $url : preg_replace ("/^https\:\/\//i", "http://", $url);
72
- }
73
- }
74
/**/
75
if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer"))
76
{
77
function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
78
{
79
- $o_pcre = @ini_get ("pcre.backtrack_limit");
80
/**/
81
- @ini_set ("pcre.backtrack_limit", 10000000);
82
/**/
83
- $tags = array ("script", "style", "link", "img", "input", "iframe", "object", "embed");
84
- $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags_array", $tags, get_defined_vars ());
85
- $tags = array_unique (array_map ("strtolower", $tags)); /* This array should be lowercase / unique. */
86
/**/
87
- $regex_tags = implode ("|", array_map ("preg_quote", $tags)); /* Prepare for regex. */
88
/**/
89
- $buffer = ($regex_tags) ? preg_replace_callback ("/\<(" . $regex_tags . ")[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
90
- $buffer = (in_array ("script", $tags)) ? preg_replace_callback ("/\<script[^\>]*\>(.+?)\<\/script\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
91
- $buffer = (in_array ("style", $tags)) ? preg_replace_callback ("/\<style[^\>]*\>(.+?)\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
92
/**/
93
- @ini_set ("pcre.backtrack_limit", $o_pcre);
94
/**/
95
return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
96
}
@@ -100,14 +109,51 @@ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
100
{
101
function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
102
{
103
- $c = preg_replace ("/http\:\/\//i", "https://", $m[0]);
104
/**/
105
if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Need port conversions? */
106
- $c = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $c);
107
/**/
108
- $c = (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $c; /* Alternates are fine to leave like they are. */
109
/**/
110
- return $c; /* Return string with conversions. */
111
}
112
}
113
/**/
19
class c_ws_plugin__s2member_ssl_in
20
{
21
/*
22
+ Forces SSL on specific Posts/Pages.
23
Attach to: add_action("template_redirect");
24
25
Triggered by Custom Field:
58
define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
59
define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
60
/**/
61
+ /* Filter these. We do NOT want to create a sitewide https conversion! */
62
add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
63
add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
64
add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
65
add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
66
+ /*
67
+ These additional URLs are NOT Filtered by default; but can be if needed. Use these Filters. */
68
+ if (apply_filters ("_ws_plugin__s2member_force_non_ssl_scheme_plugins_url", false, get_defined_vars ()))
69
+ add_filter ("plugins_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 2);
70
+ /*
71
+ These additional URLs are NOT Filtered by default; but can be if needed. Use these Filters. */
72
+ if (apply_filters ("_ws_plugin__s2member_force_non_ssl_scheme_content_url", false, get_defined_vars ()))
73
+ add_filter ("content_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 2);
74
/**/
75
if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer"))
76
{
77
function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
78
{
79
+ $o_pcre = @ini_get ("pcre.backtrack_limit"); /* Current configuration. */
80
/**/
81
+ @ini_set ("pcre.backtrack_limit", 10000000); /* Expands abilities for this routine. */
82
/**/
83
+ $ssl_tags = array ("script", "style", "link", "img", "input", "iframe", "object", "embed");
84
+ $ssl_tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags_array", $ssl_tags, get_defined_vars ());
85
+ $ssl_tags = array_unique (array_map ("strtolower", $ssl_tags)); /* This array should be lowercase / unique. */
86
/**/
87
+ $ssl_regex_tags = implode ("|", array_map ("preg_quote", $ssl_tags)); /* Prepare for regex. */
88
/**/
89
+ $buffer = ($ssl_regex_tags) ? preg_replace_callback ("/\<(" . $ssl_regex_tags . ")(?![a-z_0-9\-])[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
90
+ $buffer = (in_array ("object", $ssl_tags)) ? preg_replace_callback ("/\<object(?![a-z_0-9\-])[^\>]*\>.*?\<\/object\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
91
+ $buffer = (in_array ("script", $ssl_tags)) ? preg_replace_callback ("/\<script(?![a-z_0-9\-])[^\>]*\>.*?\<\/script\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
92
+ $buffer = (in_array ("style", $ssl_tags)) ? preg_replace_callback ("/\<style(?![a-z_0-9\-])[^\>]*\>.*?\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
93
/**/
94
+ $non_ssl_tags = array ("a"); /* Tags that should NOT contain SSL-enabled links in them. Prevents site-wide conversions */
95
+ $non_ssl_tags = apply_filters ("_ws_plugin__s2member_force_non_ssl_buffer_tags_array", $non_ssl_tags, get_defined_vars ());
96
+ $non_ssl_tags = array_unique (array_map ("strtolower", $non_ssl_tags)); /* This array should be lowercase / unique. */
97
+ /**/
98
+ $non_ssl_regex_tags = implode ("|", array_map ("preg_quote", $non_ssl_tags)); /* Prepare for regex. */
99
+ /**/
100
+ $buffer = ($non_ssl_regex_tags) ? preg_replace_callback ("/\<(" . $non_ssl_regex_tags . ")(?![a-z_0-9\-])[^\>]+\>/i", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
101
+ /**/
102
+ @ini_set ("pcre.backtrack_limit", $o_pcre); /* Restores previous configuration value now. */
103
/**/
104
return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
105
}
109
{
110
function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
111
{
112
+ $s = preg_replace ("/http\:\/\//i", "https://", $m[0]); /* Conversion. */
113
/**/
114
if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Need port conversions? */
115
+ $s = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $s);
116
+ /**/
117
+ $s = (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $s; /* Alternates are fine to leave like they are. */
118
+ /**/
119
+ return $s; /* Return string with conversions. */
120
+ }
121
+ }
122
+ /**/
123
+ if (!function_exists ("_ws_plugin__s2member_force_non_ssl_buffer_callback"))
124
+ {
125
+ function _ws_plugin__s2member_force_non_ssl_buffer_callback ($m = FALSE)
126
+ {
127
+ $s = preg_replace ("/https\:\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host_port, "/") . "/i", "http://" . _ws_plugin__s2member_force_ssl_host, $m[0]);
128
+ /**/
129
+ $s = preg_replace ("/https\:\/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "/i", "http://" . _ws_plugin__s2member_force_ssl_host, $s);
130
+ /*
131
+ Data gets converted to prevent a site-wide conversion over to SSL links.
132
+ */
133
+ return $s; /* Return string with conversions. */
134
+ }
135
+ }
136
+ /**/
137
+ if (!function_exists ("_ws_plugin__s2member_force_non_ssl_scheme"))
138
+ {
139
+ function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
140
+ {
141
+ if (!in_array ($scheme, array ("http", "https"))) /* If NOT explicitly passed through. */
142
+ {
143
+ /* Allows for special exceptions to the rule of always forcing a non-SSL scheme. */
144
+ if (($scheme === "login_post" || $scheme === "rpc") && (force_ssl_login () || force_ssl_admin ()))
145
+ $scheme = "https";
146
+ else if ($scheme === "login" && force_ssl_admin ())
147
+ $scheme = "https";
148
+ else if ($scheme === "admin" && force_ssl_admin ())
149
+ $scheme = "https";
150
+ else /* Defaults to http. */
151
+ $scheme = "http";
152
+ }
153
/**/
154
+ $scheme = apply_filters ("_ws_plugin__s2member_force_non_ssl_scheme", $scheme, get_defined_vars ());
155
/**/
156
+ return preg_replace ("/^http(s)?\:\/\//i", $scheme . "://", $url);
157
}
158
}
159
/**/
includes/classes/ssl.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_ssl"))
19
class c_ws_plugin__s2member_ssl
20
{
21
/*
22
- Function that forces SSL on specific Posts/Pages.
23
Attach to: add_action("template_redirect");
24
25
Triggered by Custom Field:
19
class c_ws_plugin__s2member_ssl
20
{
21
/*
22
+ Forces SSL on specific Posts/Pages.
23
Attach to: add_action("template_redirect");
24
25
Triggered by Custom Field:
includes/classes/user-deletions.inc.php CHANGED
@@ -76,9 +76,12 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
76
$subscr_id = get_user_option ("s2member_subscr_id", $user_id); /* And also, EVEN if this is empty. */
77
$fields = get_user_option ("s2member_custom_fields", $user_id); /* Used in API Notifications. */
78
/**/
79
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
80
do_action ("ws_plugin__s2member_during_handle_user_before_deletions", get_defined_vars ());
81
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "user-removal-deletion");
82
unset ($__refs, $__v); /* Unset defined __refs, __v. */
83
/**/
84
delete_user_option ($user_id, "s2member_custom"); /* Now we can remove these User options ( for this Blog ). */
@@ -99,7 +102,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
99
{
100
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications on user deletion. */
101
/**/
102
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($subscr_id)), $url)))
103
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
104
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
105
if (($url = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->user_email)), $url)))
@@ -123,6 +126,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
123
$msg = $sbj = "( s2Member / API Notification Email ) - EOT/Deletion";
124
$msg .= "\n\n"; /* Spacing in the message body. */
125
/**/
126
$msg .= "subscr_id: %%subscr_id%%\n";
127
$msg .= "user_first_name: %%user_first_name%%\n";
128
$msg .= "user_last_name: %%user_last_name%%\n";
@@ -146,7 +150,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
146
$msg .= "cv8: %%cv8%%\n";
147
$msg .= "cv9: %%cv9%%";
148
/**/
149
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($subscr_id), $msg)))
150
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
151
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
152
if (($msg = preg_replace ("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->user_email), $msg)))
76
$subscr_id = get_user_option ("s2member_subscr_id", $user_id); /* And also, EVEN if this is empty. */
77
$fields = get_user_option ("s2member_custom_fields", $user_id); /* Used in API Notifications. */
78
/**/
79
+ $eot_del_type = ($GLOBALS["ws_plugin__s2member_eot_del_type"]) ? $GLOBALS["ws_plugin__s2member_eot_del_type"] : "user-removal-deletion";
80
+ $eot_del_type_spec = ($GLOBALS["ws_plugin__s2member_eot_del_type_spec"]) ? $GLOBALS["ws_plugin__s2member_eot_del_type_spec"] : "removal-deletion";
81
+ /**/
82
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
83
do_action ("ws_plugin__s2member_during_handle_user_before_deletions", get_defined_vars ());
84
+ do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), "user-removal-deletion", $eot_del_type_spec);
85
unset ($__refs, $__v); /* Unset defined __refs, __v. */
86