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

Version Description

  • Upgrade highly recommended. Several bug fixes, improvements, and some new features.

=

Download this release

Release Info

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

Code changes from version 3.0.4 to 3.0.5

Files changed (111) hide show
  1. images/brand-upsell-pro.fla +0 -0
  2. images/brand-upsell-pro.png +0 -0
  3. images/logo.fla +0 -0
  4. images/logo.png +0 -0
  5. images/paypal-logo.png +0 -0
  6. images/promos/590x300.jpg +0 -0
  7. images/promos/900x285.jpg +0 -0
  8. images/promos/900x385.jpg +0 -0
  9. images/promos/shots/00_preview-590x300.jpg +0 -0
  10. images/promos/shots/00_preview-900x285.jpg +0 -0
  11. images/promos/shots/00_preview-900x385.jpg +0 -0
  12. includes/codes.inc.php +1 -1
  13. includes/funcs.inc.php +1 -1
  14. includes/functions/activate-deactivate.inc.php +44 -8
  15. includes/functions/admin-lockout.inc.php +3 -3
  16. includes/functions/admin-notices.inc.php +1 -1
  17. includes/functions/auto-eots.inc.php +55 -72
  18. includes/functions/catg-level-access.inc.php +40 -23
  19. includes/functions/constants.inc.php +11 -9
  20. includes/functions/css-js-w-globals.inc.php +212 -0
  21. includes/functions/demotions.inc.php +29 -0
  22. includes/functions/email-configs.inc.php +1 -1
  23. includes/functions/extend-cron.inc.php +33 -0
  24. includes/functions/file-download-access.inc.php +73 -29
  25. includes/functions/force-ssl.inc.php +71 -0
  26. includes/functions/hide-some-systematics.inc.php +1 -1
  27. includes/functions/ip-restrictions.inc.php +2 -2
  28. includes/functions/is-systematic.inc.php +4 -4
  29. includes/functions/js-globals.inc.php +0 -161
  30. includes/functions/list-servers.inc.php +1 -1
  31. includes/functions/login-customizations.inc.php +1 -1
  32. includes/functions/login-redirection.inc.php +5 -7
  33. includes/functions/menu-pages.inc.php +21 -11
  34. includes/functions/nocache.inc.php +1 -1
  35. includes/functions/page-level-access.inc.php +20 -14
  36. includes/functions/paypal-button.inc.php +144 -0
  37. includes/functions/paypal-notify.inc.php +381 -193
  38. includes/functions/paypal-return.inc.php +48 -39
  39. includes/functions/paypal-utilities.inc.php +208 -18
  40. includes/functions/post-level-access.inc.php +17 -11
  41. includes/functions/profile-modifications.inc.php +29 -17
  42. includes/functions/ptag-level-access.inc.php +31 -19
  43. includes/functions/readme-parsing.inc.php +22 -16
  44. includes/functions/register-access.inc.php +153 -121
  45. includes/functions/ruri-level-access.inc.php +13 -8
  46. includes/functions/shortcodes.inc.php +0 -142
  47. includes/functions/sp-access.inc.php +3 -3
  48. includes/functions/tracking-codes.inc.php +3 -3
  49. includes/functions/translations.inc.php +1 -1
  50. includes/functions/user-access-level.inc.php +5 -3
  51. includes/functions/user-deletions.inc.php +6 -8
  52. includes/functions/user-has-wp-role.inc.php +1 -1
  53. includes/functions/user-notes.inc.php +1 -1
  54. includes/functions/users-list.inc.php +77 -81
  55. includes/functions/utilities.inc.php +87 -1
  56. includes/hooks.inc.php +7 -1
  57. includes/menu-pages/api-ops.inc.php +32 -31
  58. includes/menu-pages/buttons.inc.php +0 -647
  59. includes/menu-pages/code-samples/ccap-file-downloads.php +2 -0
  60. includes/menu-pages/code-samples/current-user-access-label.php +1 -1
  61. includes/menu-pages/code-samples/current-user-can-specific-content.php +1 -1
  62. includes/menu-pages/code-samples/level0-file-downloads-allowed-days.php +3 -0
  63. includes/menu-pages/code-samples/level0-file-downloads-allowed.php +3 -0
  64. includes/menu-pages/code-samples/level0-label.php +3 -0
  65. includes/menu-pages/code-samples/level1-file-downloads-allowed-days.php +1 -1
  66. includes/menu-pages/code-samples/level1-file-downloads-allowed.php +1 -1
  67. includes/menu-pages/code-samples/level1-label.php +1 -1
  68. includes/menu-pages/code-samples/level2-file-downloads-allowed-days.php +1 -1
  69. includes/menu-pages/code-samples/level2-file-downloads-allowed.php +1 -1
  70. includes/menu-pages/code-samples/level2-label.php +1 -1
  71. includes/menu-pages/code-samples/level3-file-downloads-allowed-days.php +1 -1
  72. includes/menu-pages/code-samples/level3-file-downloads-allowed.php +1 -1
  73. includes/menu-pages/code-samples/level3-label.php +1 -1
  74. includes/menu-pages/code-samples/level4-file-downloads-allowed-days.php +1 -1
  75. includes/menu-pages/code-samples/level4-file-downloads-allowed.php +1 -1
  76. includes/menu-pages/code-samples/level4-label.php +1 -1
  77. includes/menu-pages/down-ops.inc.php +53 -12
  78. includes/menu-pages/els-ops.inc.php +2 -1
  79. includes/menu-pages/info.inc.php +2 -1
  80. includes/menu-pages/menu-pages-s.js +100 -68
  81. includes/menu-pages/options.inc.php +200 -70
  82. includes/menu-pages/paypal-buttons.inc.php +650 -0
  83. includes/menu-pages/paypal-ops.inc.php +28 -17
  84. includes/menu-pages/scripting.inc.php +50 -9
  85. includes/menu-pages/start.inc.php +2 -1
  86. includes/menu-pages/trk-ops.inc.php +14 -13
  87. includes/profile.inc.php +22 -16
  88. includes/s2member-min.js +0 -1
  89. includes/s2member.css +12 -0
  90. includes/s2member.js +23 -32
  91. includes/syscon.inc.php +27 -33
  92. includes/templates/buttons/{c-button.html → paypal-cancellation-button.html} +0 -0
  93. includes/templates/buttons/{button.html → paypal-checkout-button.html} +1 -1
  94. includes/templates/buttons/{sp-button.html → paypal-sp-checkout-button.html} +1 -1
  95. includes/templates/options/{currencies.html → paypal-currencies.html} +0 -0
  96. includes/templates/options/{membership-modification-levels.html → paypal-membership-modification-levels.html} +6 -0
  97. includes/templates/options/{membership-regular-terms.html → paypal-membership-regular-terms.html} +4 -7
  98. includes/templates/options/{membership-trial-terms.html → paypal-membership-trial-terms.html} +0 -0
  99. includes/templates/options/{sp-hours.html → paypal-sp-hours.html} +8 -0
  100. includes/templates/shortcodes/c-shortcode.html +0 -1
  101. includes/templates/shortcodes/paypal-cancellation-button-shortcode.html +1 -0
  102. includes/templates/shortcodes/paypal-checkout-button-shortcode.html +1 -0
  103. includes/templates/shortcodes/paypal-sp-checkout-button-shortcode.html +1 -0
  104. includes/templates/shortcodes/shortcode.html +0 -1
  105. includes/templates/shortcodes/sp-shortcode.html +0 -1
  106. licensing/license.txt +1 -5
  107. readme.txt +85 -81
  108. s2member.php +28 -14
  109. screenshot-10.png +0 -0
  110. screenshot-5.png +0 -0
  111. screenshot-9.png +0 -0
images/brand-upsell-pro.fla ADDED
Binary file
images/brand-upsell-pro.png ADDED
Binary file
images/logo.fla CHANGED
Binary file
images/logo.png CHANGED
Binary file
images/paypal-logo.png ADDED
Binary file
images/promos/590x300.jpg CHANGED
Binary file
images/promos/900x285.jpg CHANGED
Binary file
images/promos/900x385.jpg CHANGED
Binary file
images/promos/shots/00_preview-590x300.jpg CHANGED
Binary file
images/promos/shots/00_preview-900x285.jpg CHANGED
Binary file
images/promos/shots/00_preview-900x385.jpg CHANGED
Binary file
includes/codes.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Add WordPress® Editor Shortcodes.
18
http://codex.wordpress.org/Shortcode_API
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Add WordPress® Editor Shortcodes.
18
http://codex.wordpress.org/Shortcode_API
includes/funcs.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Include all of the functions that came with this plugin.
18
*/
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Include all of the functions that came with this plugin.
18
*/
includes/functions/activate-deactivate.inc.php CHANGED
@@ -12,7 +12,22 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for handling activation routines.
18
This function should match the array key for this plugin:
@@ -29,6 +44,9 @@ if (!function_exists ("ws_plugin__s2member_activate"))
29
{
30
do_action ("ws_plugin__s2member_before_activation", get_defined_vars ());
31
/**/
32
add_role ("s2member_level1", "s2Member Level 1");
33
add_role ("s2member_level2", "s2Member Level 2");
34
add_role ("s2member_level3", "s2Member Level 3");
@@ -37,48 +55,56 @@ if (!function_exists ("ws_plugin__s2member_activate"))
37
$role = &get_role ("s2member_level1");
38
$role->add_cap ("read");
39
$role->add_cap ("level_0");
40
$role->add_cap ("access_s2member_level1");
41
/**/
42
$role = &get_role ("s2member_level2");
43
$role->add_cap ("read");
44
$role->add_cap ("level_0");
45
- $role->add_cap ("access_s2member_level2");
46
$role->add_cap ("access_s2member_level1");
47
/**/
48
$role = &get_role ("s2member_level3");
49
$role->add_cap ("read");
50
$role->add_cap ("level_0");
51
- $role->add_cap ("access_s2member_level3");
52
- $role->add_cap ("access_s2member_level2");
53
$role->add_cap ("access_s2member_level1");
54
/**/
55
$role = &get_role ("s2member_level4");
56
$role->add_cap ("read");
57
$role->add_cap ("level_0");
58
- $role->add_cap ("access_s2member_level4");
59
- $role->add_cap ("access_s2member_level3");
60
- $role->add_cap ("access_s2member_level2");
61
$role->add_cap ("access_s2member_level1");
62
/**/
63
$role = &get_role ("administrator");
64
$role->add_cap ("access_s2member_level1");
65
$role->add_cap ("access_s2member_level2");
66
$role->add_cap ("access_s2member_level3");
67
$role->add_cap ("access_s2member_level4");
68
/**/
69
$role = &get_role ("editor");
70
$role->add_cap ("access_s2member_level1");
71
$role->add_cap ("access_s2member_level2");
72
$role->add_cap ("access_s2member_level3");
73
$role->add_cap ("access_s2member_level4");
74
/**/
75
$role = &get_role ("author");
76
$role->add_cap ("access_s2member_level1");
77
$role->add_cap ("access_s2member_level2");
78
$role->add_cap ("access_s2member_level3");
79
$role->add_cap ("access_s2member_level4");
80
/**/
81
$role = &get_role ("contributor");
82
$role->add_cap ("access_s2member_level1");
83
$role->add_cap ("access_s2member_level2");
84
$role->add_cap ("access_s2member_level3");
@@ -112,9 +138,11 @@ if (!function_exists ("ws_plugin__s2member_activate"))
112
if (!is_array (get_option ("ws_plugin__s2member_options")))
113
update_option ("ws_plugin__s2member_options", array ());
114
/**/
115
if (get_option ("ws_plugin__s2member_configured")) /* If they already have s2Member configured, read the Changelog. */
116
{
117
- $notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version. Your existing configuration remains intact.<br />';
118
$notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-info">read the Changelog</a>, and make some money! :-)';
119
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
120
}
@@ -143,30 +171,37 @@ if (!function_exists ("ws_plugin__s2member_deactivate"))
143
/**/
144
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
145
{
146
remove_role ("s2member_level1");
147
remove_role ("s2member_level2");
148
remove_role ("s2member_level3");
149
remove_role ("s2member_level4");
150
/**/
151
$role = &get_role ("administrator");
152
$role->remove_cap ("access_s2member_level1");
153
$role->remove_cap ("access_s2member_level2");
154
$role->remove_cap ("access_s2member_level3");
155
$role->remove_cap ("access_s2member_level4");
156
/**/
157
$role = &get_role ("editor");
158
$role->remove_cap ("access_s2member_level1");
159
$role->remove_cap ("access_s2member_level2");
160
$role->remove_cap ("access_s2member_level3");
161
$role->remove_cap ("access_s2member_level4");
162
/**/
163
$role = &get_role ("author");
164
$role->remove_cap ("access_s2member_level1");
165
$role->remove_cap ("access_s2member_level2");
166
$role->remove_cap ("access_s2member_level3");
167
$role->remove_cap ("access_s2member_level4");
168
/**/
169
$role = &get_role ("contributor");
170
$role->remove_cap ("access_s2member_level1");
171
$role->remove_cap ("access_s2member_level2");
172
$role->remove_cap ("access_s2member_level3");
@@ -198,6 +233,7 @@ if (!function_exists ("ws_plugin__s2member_deactivate"))
198
@rmdir ($logs_dir);
199
}
200
/**/
201
delete_option ("ws_plugin__s2member_configured");
202
delete_option ("ws_plugin__s2member_cache");
203
delete_option ("ws_plugin__s2member_notices");
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Check existing installations that have not been re-activated.
18
+ Attach to: add_action("admin_init");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_check_activation"))
21
+ {
22
+ function ws_plugin__s2member_check_activation () /* Re-activated? */
23
+ {
24
+ $v = get_option ("ws_plugin__s2member_activated_version");
25
+ if (!$v || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
26
+ ws_plugin__s2member_activate ();
27
+ /**/
28
+ return;
29
+ }
30
+ }
31
/*
32
Function for handling activation routines.
33
This function should match the array key for this plugin:
44
{
45
do_action ("ws_plugin__s2member_before_activation", get_defined_vars ());
46
/**/
47
+ $role = &get_role ("subscriber");
48
+ $role->add_cap ("access_s2member_level0");
49
+ /**/
50
add_role ("s2member_level1", "s2Member Level 1");
51
add_role ("s2member_level2", "s2Member Level 2");
52
add_role ("s2member_level3", "s2Member Level 3");
55
$role = &get_role ("s2member_level1");
56
$role->add_cap ("read");
57
$role->add_cap ("level_0");
58
+ $role->add_cap ("access_s2member_level0");
59
$role->add_cap ("access_s2member_level1");
60
/**/
61
$role = &get_role ("s2member_level2");
62
$role->add_cap ("read");
63
$role->add_cap ("level_0");
64
+ $role->add_cap ("access_s2member_level0");
65
$role->add_cap ("access_s2member_level1");
66
+ $role->add_cap ("access_s2member_level2");
67
/**/
68
$role = &get_role ("s2member_level3");
69
$role->add_cap ("read");
70
$role->add_cap ("level_0");
71
+ $role->add_cap ("access_s2member_level0");
72
$role->add_cap ("access_s2member_level1");
73
+ $role->add_cap ("access_s2member_level2");
74
+ $role->add_cap ("access_s2member_level3");
75
/**/
76
$role = &get_role ("s2member_level4");
77
$role->add_cap ("read");
78
$role->add_cap ("level_0");
79
+ $role->add_cap ("access_s2member_level0");
80
$role->add_cap ("access_s2member_level1");
81
+ $role->add_cap ("access_s2member_level2");
82
+ $role->add_cap ("access_s2member_level3");
83
+ $role->add_cap ("access_s2member_level4");
84
/**/
85
$role = &get_role ("administrator");
86
+ $role->add_cap ("access_s2member_level0");
87
$role->add_cap ("access_s2member_level1");
88
$role->add_cap ("access_s2member_level2");
89
$role->add_cap ("access_s2member_level3");
90
$role->add_cap ("access_s2member_level4");
91
/**/
92
$role = &get_role ("editor");
93
+ $role->add_cap ("access_s2member_level0");
94
$role->add_cap ("access_s2member_level1");
95
$role->add_cap ("access_s2member_level2");
96
$role->add_cap ("access_s2member_level3");
97
$role->add_cap ("access_s2member_level4");
98
/**/
99
$role = &get_role ("author");
100
+ $role->add_cap ("access_s2member_level0");
101
$role->add_cap ("access_s2member_level1");
102
$role->add_cap ("access_s2member_level2");
103
$role->add_cap ("access_s2member_level3");
104
$role->add_cap ("access_s2member_level4");
105
/**/
106
$role = &get_role ("contributor");
107
+ $role->add_cap ("access_s2member_level0");
108
$role->add_cap ("access_s2member_level1");
109
$role->add_cap ("access_s2member_level2");
110
$role->add_cap ("access_s2member_level3");
138
if (!is_array (get_option ("ws_plugin__s2member_options")))
139
update_option ("ws_plugin__s2member_options", array ());
140
/**/
141
+ update_option ("ws_plugin__s2member_activated_version", WS_PLUGIN__S2MEMBER_VERSION);
142
+ /**/
143
if (get_option ("ws_plugin__s2member_configured")) /* If they already have s2Member configured, read the Changelog. */
144
{
145
+ $notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version. Your existing configuration remains.<br />';
146
$notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-info">read the Changelog</a>, and make some money! :-)';
147
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
148
}
171
/**/
172
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
173
{
174
+ $role = &get_role ("subscriber");
175
+ $role->remove_cap ("access_s2member_level0");
176
+ /**/
177
remove_role ("s2member_level1");
178
remove_role ("s2member_level2");
179
remove_role ("s2member_level3");
180
remove_role ("s2member_level4");
181
/**/
182
$role = &get_role ("administrator");
183
+ $role->remove_cap ("access_s2member_level0");
184
$role->remove_cap ("access_s2member_level1");
185
$role->remove_cap ("access_s2member_level2");
186
$role->remove_cap ("access_s2member_level3");
187
$role->remove_cap ("access_s2member_level4");
188
/**/
189
$role = &get_role ("editor");
190
+ $role->remove_cap ("access_s2member_level0");
191
$role->remove_cap ("access_s2member_level1");
192
$role->remove_cap ("access_s2member_level2");
193
$role->remove_cap ("access_s2member_level3");
194
$role->remove_cap ("access_s2member_level4");
195
/**/
196
$role = &get_role ("author");
197
+ $role->remove_cap ("access_s2member_level0");
198
$role->remove_cap ("access_s2member_level1");
199
$role->remove_cap ("access_s2member_level2");
200
$role->remove_cap ("access_s2member_level3");
201
$role->remove_cap ("access_s2member_level4");
202
/**/
203
$role = &get_role ("contributor");
204
+ $role->remove_cap ("access_s2member_level0");
205
$role->remove_cap ("access_s2member_level1");
206
$role->remove_cap ("access_s2member_level2");
207
$role->remove_cap ("access_s2member_level3");
233
@rmdir ($logs_dir);
234
}
235
/**/
236
+ delete_option ("ws_plugin__s2member_activated_version");
237
delete_option ("ws_plugin__s2member_configured");
238
delete_option ("ws_plugin__s2member_cache");
239
delete_option ("ws_plugin__s2member_notices");
includes/functions/admin-lockout.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for handling admin lockouts.
18
Attach to: add_action("admin_init");
@@ -25,9 +25,9 @@ if (!function_exists ("ws_plugin__s2member_admin_lockout"))
25
/**/
26
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
27
&& !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
28
- && apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ()) && /* Give filters a chance. */
29
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
30
- exit;
31
/**/
32
do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
33
/**/
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function for handling admin lockouts.
18
Attach to: add_action("admin_init");
25
/**/
26
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
27
&& !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
28
+ && apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ()) && /* Filter. */
29
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
30
+ exit ();
31
/**/
32
do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
33
/**/
includes/functions/admin-notices.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function displays an admin notice immediately.
18
*/
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function displays an admin notice immediately.
18
*/
includes/functions/auto-eots.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function processed by WP-Cron. This handles Auto-EOTs.
18
If you have a HUGE user-base, increase the max eots per process.
@@ -32,70 +32,70 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
32
{
33
$per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
34
/**/
35
- if ($eots = $wpdb->get_results ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_auto_eot_time' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process))
36
{
37
foreach ($eots as $eot) /* Go through the array of eots. We need to (demote|delete) each of them. */
38
{
39
- $user_id = $eot->user_id; /* Grab the user ID value from the query. */
40
- /**/
41
- $user = new WP_User ($user_id); /* Acquire user object. */
42
- /**/
43
- delete_usermeta ($user_id, "s2member_auto_eot_time"); /* Always delete this. */
44
- /* Removing this prevents re-runs on non WP Roles. Which are scanned for next. */
45
- /**/
46
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
47
{
48
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
49
{
50
- $user->set_role ("subscriber");
51
- /**/
52
- $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
53
- $custom = get_usermeta ($user_id, "s2member_custom");
54
- /**/
55
- delete_usermeta ($user_id, "s2member_custom");
56
- delete_usermeta ($user_id, "s2member_subscr_id");
57
- delete_usermeta ($user_id, "s2member_last_payment_time");
58
- delete_usermeta ($user_id, "s2member_auto_eot_time");
59
- /**/
60
- foreach ($user->allcaps as $cap => $cap_enabled)
61
- if (preg_match ("/^access_s2member_ccap_/", $cap))
62
- $user->remove_cap ($ccap = $cap);
63
- /**/
64
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
65
- delete_usermeta ($user_id, "s2member_file_download_access_log");
66
- /**/
67
- ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
68
- /**/
69
- if ($subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
70
{
71
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
72
- /**/
73
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($subscr_id), $url)))
74
- if (($url = preg_replace ("/%%user_first_name%%/i", urlencode ($user->first_name), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", urlencode ($user->last_name), $url)))
75
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
76
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
77
- /**/
78
- if (($url = trim ($url))) /* Empty? */
79
- ws_plugin__s2member_remote ($url);
80
}
81
/**/
82
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
83
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
84
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
85
- }
86
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
87
- {
88
- wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
89
- /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
90
- /**/
91
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
92
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
93
unset ($__refs, $__v); /* Unset defined __refs, __v. */
94
}
95
- /**/
96
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
97
- do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
98
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
99
}
100
}
101
}
@@ -128,30 +128,13 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system_via_cron"))
128
do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
129
}
130
/**/
131
- exit; /* Exit. */
132
}
133
/**/
134
do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
135
}
136
}
137
/*
138
- Extends the WP-Cron schedules to support 10 minute intervals.
139
- Attach to: add_filter("cron_schedules");
140
- */
141
- if (!function_exists ("ws_plugin__s2member_extend_cron_schedules"))
142
- {
143
- function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
144
- {
145
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
146
- do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
147
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
148
- /**/
149
- $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
150
- /**/
151
- return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
152
- }
153
- }
154
- /*
155
Adds a scheduled task for s2Member's Auto-EOT System.
156
*/
157
if (!function_exists ("ws_plugin__s2member_add_auto_eot_system"))
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function processed by WP-Cron. This handles Auto-EOTs.
18
If you have a HUGE user-base, increase the max eots per process.
32
{
33
$per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
34
/**/
35
+ if ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_auto_eot_time' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process))
36
{
37
foreach ($eots as $eot) /* Go through the array of eots. We need to (demote|delete) each of them. */
38
{
39
+ if (($user_id = $eot->ID) && is_object ($user = new WP_User ($user_id)) && $user->ID)
40
{
41
+ delete_usermeta ($user_id, "s2member_auto_eot_time"); /* Always delete this. */
42
+ /* Removing this prevents re-runs on non WP Roles. Which are scanned for next. */
43
+ /**/
44
+ if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles ( Subscriber excluded ). */
45
{
46
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
47
{
48
+ $demotion_role = ws_plugin__s2member_force_demotion_role ("subscriber");
49
+ $user->set_role ($demotion_role); /* Defaults to Free Subscriber. */
50
+ /**/
51
+ $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
52
+ $custom = get_usermeta ($user_id, "s2member_custom");
53
+ /**/
54
+ delete_usermeta ($user_id, "s2member_custom");
55
+ delete_usermeta ($user_id, "s2member_subscr_id");
56
+ delete_usermeta ($user_id, "s2member_last_payment_time");
57
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
58
+ /**/
59
+ foreach ($user->allcaps as $cap => $cap_enabled)
60
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
61
+ $user->remove_cap ($ccap = $cap);
62
+ /**/
63
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
64
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
65
+ /**/
66
+ ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
67
+ /**/
68
+ if ($subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
69
+ {
70
+ foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
71
+ /**/
72
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($subscr_id)), $url)))
73
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
74
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
75
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
76
+ /**/
77
+ if (($url = trim ($url))) /* Empty? */
78
+ ws_plugin__s2member_remote ($url);
79
+ }
80
+ /**/
81
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
82
+ do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
83
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
84
+ }
85
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
86
+ {
87
+ wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
88
+ /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
89
+ /**/
90
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
91
+ do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
92
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
}
94
/**/
95
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
96
+ do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
97
unset ($__refs, $__v); /* Unset defined __refs, __v. */
98
}
99
}
100
}
101
}
128
do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
129
}
130
/**/
131
+ exit ();
132
}
133
/**/
134
do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
135
}
136
}
137
/*
138
Adds a scheduled task for s2Member's Auto-EOT System.
139
*/
140
if (!function_exists ("ws_plugin__s2member_add_auto_eot_system"))
includes/functions/catg-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for handling category level access permissions.
18
Attach to: add_action("template_redirect");
@@ -35,75 +35,92 @@ if (!function_exists ("ws_plugin__s2member_check_catg_level_access"))
35
/**/
36
if (is_category () && $cat_ID) /* We also check if this is a child category of a restricted category. */
37
{
38
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
39
- exit;
40
/**/
41
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && in_array ($cat_ID, ($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
42
- exit;
43
/**/
44
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
- exit;
46
/**/
47
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && in_array ($cat_ID, ($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
48
- exit;
49
/**/
50
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
51
- exit;
52
/**/
53
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && in_array ($cat_ID, ($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
54
- exit;
55
/**/
56
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
57
- exit;
58
/**/
59
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && in_array ($cat_ID, ($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
60
- exit;
61
/**/
62
if ($level1_catgs)
63
foreach ($level1_catgs as $catg)
64
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
65
- exit;
66
/**/
67
if ($level2_catgs)
68
foreach ($level2_catgs as $catg)
69
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
70
- exit;
71
/**/
72
if ($level3_catgs)
73
foreach ($level3_catgs as $catg)
74
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
75
- exit;
76
/**/
77
if ($level4_catgs)
78
foreach ($level4_catgs as $catg)
79
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
80
- exit;
81
}
82
else if (is_single () && !is_page () && $post_ID)
83
{
84
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
85
- exit;
86
/**/
87
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && (in_category (($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level1_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
88
- exit;
89
/**/
90
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
91
- exit;
92
/**/
93
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && (in_category (($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level2_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
94
- exit;
95
/**/
96
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
97
- exit;
98
/**/
99
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && (in_category (($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level3_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
100
- exit;
101
/**/
102
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
103
- exit;
104
/**/
105
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && (in_category (($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level4_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
106
- exit;
107
}
108
/**/
109
do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
/*
17
Function for handling category level access permissions.
18
Attach to: add_action("template_redirect");
35
/**/
36
if (is_category () && $cat_ID) /* We also check if this is a child category of a restricted category. */
37
{
38
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
39
+ exit ();
40
+ /**/
41
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] && in_array ($cat_ID, ($level0_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
42
+ exit ();
43
+ /**/
44
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
+ exit ();
46
/**/
47
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && in_array ($cat_ID, ($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
48
+ exit ();
49
/**/
50
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
51
+ exit ();
52
/**/
53
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && in_array ($cat_ID, ($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
54
+ exit ();
55
/**/
56
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
57
+ exit ();
58
/**/
59
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && in_array ($cat_ID, ($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
60
+ exit ();
61
/**/
62
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
63
+ exit ();
64
/**/
65
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && in_array ($cat_ID, ($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
66
+ exit ();
67
+ /**/
68
+ if ($level0_catgs)
69
+ foreach ($level0_catgs as $catg)
70
+ if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
71
+ exit ();
72
/**/
73
if ($level1_catgs)
74
foreach ($level1_catgs as $catg)
75
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
76
+ exit ();
77
/**/
78
if ($level2_catgs)
79
foreach ($level2_catgs as $catg)
80
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
81
+ exit ();
82
/**/
83
if ($level3_catgs)
84
foreach ($level3_catgs as $catg)
85
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
86
+ exit ();
87
/**/
88
if ($level4_catgs)
89
foreach ($level4_catgs as $catg)
90
if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
91
+ exit ();
92
}
93
else if (is_single () && !is_page () && $post_ID)
94
{
95
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
96
+ exit ();
97
+ /**/
98
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] && (in_category (($level0_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level0_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
99
+ exit ();
100
+ /**/
101
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
102
+ exit ();
103
/**/
104
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && (in_category (($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level1_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
105
+ exit ();
106
/**/
107
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
108
+ exit ();
109
/**/
110
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && (in_category (($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level2_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
111
+ exit ();
112
/**/
113
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
114
+ exit ();
115
/**/
116
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && (in_category (($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level3_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
117
+ exit ();
118
/**/
119
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
120
+ exit ();
121
/**/
122
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && (in_category (($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level4_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
123
+ exit ();
124
}
125
/**/
126
do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
includes/functions/constants.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Define several API Constants for s2Member.
18
Note that these are duplicated into the JavaScript API as well.
@@ -29,7 +29,8 @@ if (!function_exists ("ws_plugin__s2member_constants"))
29
$level = ws_plugin__s2member_user_access_level ();
30
$current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
31
$file_downloads = ws_plugin__s2member_user_downloads ("", $metas["s2member_file_download_access_log"]);
32
- $login_redirection_override = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"];
33
/**/
34
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
35
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
@@ -43,8 +44,8 @@ if (!function_exists ("ws_plugin__s2member_constants"))
43
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]); /* This will always be a (string). Empty if not logged in. */
44
define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", (($current_user) ? (($metas["s2member_subscr_id"]) ? $metas["s2member_subscr_id"] : $current_user->ID) : "")); /* Empty if not logged in. */
45
define ("S2MEMBER_CURRENT_USER_CUSTOM", (($current_user) ? $metas["s2member_custom"] : "")); /* This will always a (string). However, it will be empty if not logged in. */
46
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", (($current_user) ? strtotime ($current_user->user_registered) : 0)); /* Always an (int). Or 0 if they're not logged in. */
47
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", (($current_user) ? floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)); /* (int). */
48
define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", (($current_user) ? $current_user->display_name : "")); /* This will always be a (string). Empty if not logged in. */
49
define ("S2MEMBER_CURRENT_USER_FIRST_NAME", (($current_user) ? $current_user->user_firstname : "")); /* This will always be a (string). Empty if not logged in. */
50
define ("S2MEMBER_CURRENT_USER_LAST_NAME", (($current_user) ? $current_user->user_lastname : "")); /* This will always be a (string). Empty if not logged in. */
@@ -73,16 +74,19 @@ if (!function_exists ("ws_plugin__s2member_constants"))
73
define ("S2MEMBER_LOGOUT_PAGE_URL", wp_logout_url ()); /* This is always the same, it is the default wordpress action=logout url generated by wp_logout_url(). */
74
define ("S2MEMBER_LOGIN_PAGE_URL", wp_login_url ()); /* This is always the same, it is the default wordpress login url that is generated by wp_login_url(). */
75
/**/
76
define ("S2MEMBER_LEVEL1_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); /* This is the (string) label that you created for membership level number 1. */
77
define ("S2MEMBER_LEVEL2_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); /* This is the (string) label that you created for membership level number 2. */
78
define ("S2MEMBER_LEVEL3_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); /* This is the (string) label that you created for membership level number 3. */
79
define ("S2MEMBER_LEVEL4_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); /* This is the (string) label that you created for membership level number 4. */
80
/**/
81
define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
82
define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
83
define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
84
define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
85
/**/
86
define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]); /* This is (int) allowed days. */
87
define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]); /* This is (int) allowed days. */
88
define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]); /* This is (int) allowed days. */
@@ -98,12 +102,10 @@ if (!function_exists ("ws_plugin__s2member_constants"))
98
define ("S2MEMBER_PAYPAL_ENDPOINT", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")); /* Using sandbox? */
99
define ("S2MEMBER_PAYPAL_BUSINESS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]); /* This is the email address that identifies your paypal business. */
100
/**/
101
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID && !ws_plugin__s2member_user_has_wp_role ($current_user)) ? "Updating Subscr. ID" : ""));
102
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* ^ Not for built-in WP Roles. */
103
/**/
104
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
105
do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
106
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
107
/**/
108
return;
109
}
@@ -200,7 +202,7 @@ if (!function_exists ("ws_plugin__s2member_constant_metas"))
200
/**/
201
if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
202
{
203
- if (is_array ($results = $wpdb->get_results ("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . $current_user->ID . "' AND (meta_key = 's2member_file_download_access_log' OR meta_key = 's2member_subscr_id' OR meta_key = 's2member_custom') LIMIT 3")))
204
{
205
foreach ($results as $r) /* Fill in the array we need. */
206
if ($r->meta_key === "s2member_file_download_access_log")
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Define several API Constants for s2Member.
18
Note that these are duplicated into the JavaScript API as well.
29
$level = ws_plugin__s2member_user_access_level ();
30
$current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
31
$file_downloads = ws_plugin__s2member_user_downloads ("", $metas["s2member_file_download_access_log"]);
32
+ $login_redirection_override = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]) ? /* Only when applicable. */
33
+ ws_plugin__s2member_fill_login_redirect_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"], $current_user) : "";
34
/**/
35
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
36
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
44
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]); /* This will always be a (string). Empty if not logged in. */
45
define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", (($current_user) ? (($metas["s2member_subscr_id"]) ? $metas["s2member_subscr_id"] : $current_user->ID) : "")); /* Empty if not logged in. */
46
define ("S2MEMBER_CURRENT_USER_CUSTOM", (($current_user) ? $metas["s2member_custom"] : "")); /* This will always a (string). However, it will be empty if not logged in. */
47
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", (($current_user) ? (int)strtotime ($current_user->user_registered) : 0)); /* Always an (int). Or 0 if they're not logged in. */
48
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", (($current_user) ? (int)floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)); /* (int). */
49
define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", (($current_user) ? $current_user->display_name : "")); /* This will always be a (string). Empty if not logged in. */
50
define ("S2MEMBER_CURRENT_USER_FIRST_NAME", (($current_user) ? $current_user->user_firstname : "")); /* This will always be a (string). Empty if not logged in. */
51
define ("S2MEMBER_CURRENT_USER_LAST_NAME", (($current_user) ? $current_user->user_lastname : "")); /* This will always be a (string). Empty if not logged in. */
74
define ("S2MEMBER_LOGOUT_PAGE_URL", wp_logout_url ()); /* This is always the same, it is the default wordpress action=logout url generated by wp_logout_url(). */
75
define ("S2MEMBER_LOGIN_PAGE_URL", wp_login_url ()); /* This is always the same, it is the default wordpress login url that is generated by wp_login_url(). */
76
/**/
77
+ define ("S2MEMBER_LEVEL0_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); /* This is the (string) label that you created for membership level number 0. */
78
define ("S2MEMBER_LEVEL1_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); /* This is the (string) label that you created for membership level number 1. */
79
define ("S2MEMBER_LEVEL2_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); /* This is the (string) label that you created for membership level number 2. */
80
define ("S2MEMBER_LEVEL3_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); /* This is the (string) label that you created for membership level number 3. */
81
define ("S2MEMBER_LEVEL4_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); /* This is the (string) label that you created for membership level number 4. */
82
/**/
83
+ define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
84
define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
85
define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
86
define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
87
define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
88
/**/
89
+ define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"]); /* This is (int) allowed days. */
90
define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]); /* This is (int) allowed days. */
91
define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]); /* This is (int) allowed days. */
92
define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]); /* This is (int) allowed days. */
102
define ("S2MEMBER_PAYPAL_ENDPOINT", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")); /* Using sandbox? */
103
define ("S2MEMBER_PAYPAL_BUSINESS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]); /* This is the email address that identifies your paypal business. */
104
/**/
105
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr. ID" : "")); /* Subscr. ID or $user->ID. Either will work. */
106
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* Subscr. ID or $user->ID. */
107
/**/
108
do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
109
/**/
110
return;
111
}
202
/**/
203
if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
204
{
205
+ if (is_array ($results = $wpdb->get_results ("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . $current_user->ID . "' AND (meta_key = 's2member_file_download_access_log' OR meta_key = 's2member_custom_fields' OR meta_key = 's2member_subscr_id' OR meta_key = 's2member_custom') LIMIT 3")))
206
{
207
foreach ($results as $r) /* Fill in the array we need. */
208
if ($r->meta_key === "s2member_file_download_access_log")
includes/functions/css-js-w-globals.inc.php ADDED
@@ -0,0 +1,212 @@
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
+ Function adds styles to the header.
18
+ This function is also fired in the admin area.
19
+ Do NOT enqueue styles in the admin area.
20
+ Attach to: add_action("wp_print_styles");
21
+ */
22
+ if (!function_exists ("ws_plugin__s2member_add_css"))
23
+ {
24
+ function ws_plugin__s2member_add_css ()
25
+ {
26
+ do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
27
+ /**/
28
+ if (!is_admin () /* Not in the admin. */ && (has_action ("ws_plugin__s2member_during_add_css") || has_action ("ws_plugin__s2member_during_css"))) /* Framework support here. Currently this is NOT used unless hooks are attached, in which case it needs to be enqueued. */
29
+ {
30
+ wp_enqueue_style ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_css=1&qcABC=1", array (), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
31
+ /**/
32
+ do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
33
+ }
34
+ /**/
35
+ do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
36
+ /**/
37
+ return;
38
+ }
39
+ }
40
+ /*
41
+ Function for adding s2member.css.
42
+ Attach to: add_action("init");
43
+ */
44
+ if (!function_exists ("ws_plugin__s2member_css"))
45
+ {
46
+ function ws_plugin__s2member_css ()
47
+ {
48
+ do_action ("ws_plugin__s2member_before_css", get_defined_vars ());
49
+ /**/
50
+ if ($_GET["ws_plugin__s2member_css"])
51
+ {
52
+ header("Content-Type: text/css; charset=utf-8");
53
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
54
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
55
+ header("Cache-Control: max-age=604800");
56
+ header("Pragma: public");
57
+ /**/
58
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
59
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
60
+ /**/
61
+ include_once dirname (dirname (__FILE__)) . "/s2member.css";
62
+ /**/
63
+ do_action ("ws_plugin__s2member_during_css", get_defined_vars ());
64
+ /**/
65
+ exit ();
66
+ }
67
+ /**/
68
+ do_action ("ws_plugin__s2member_after_css", get_defined_vars ());
69
+ }
70
+ }
71
+ /*
72
+ Function for adding scripts to the header.
73
+ This function is fired in the admin area also.
74
+ Do NOT enqueue scripts in the admin area.
75
+ Attach to: add_action("wp_print_scripts");
76
+ */
77
+ if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
78
+ {
79
+ function ws_plugin__s2member_add_js_w_globals ()
80
+ {
81
+ do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
82
+ /**/
83
+ if (!is_admin ()) /* Not in the admin. */
84
+ {
85
+ if (is_user_logged_in ())
86
+ {
87
+ $a = get_defined_constants (true);
88
+ $c = (array)$a["user"];
89
+ unset($a);
90
+ /**/
91
+ foreach ($c as $k => $v)
92
+ if (preg_match ("/^S2MEMBER_/i", $k))
93
+ $s2member[$k] = $v;
94
+ /**/
95
+ $md5 = md5 (serialize ($s2member)); /* This is a hash based on the global key => values. */
96
+ /* The md5 hash allows the script to be cached in the browser until the globals happen to change. */
97
+ /* For instance, the global variables may change when a user who is logged-in changes their profile. */
98
+ wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5, array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
99
+ }
100
+ else /* Else if they are not logged in, we distinguish the script by not including the md5 hash. */
101
+ { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
102
+ wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
103
+ }
104
+ /**/
105
+ do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
106
+ }
107
+ /**/
108
+ do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
109
+ /**/
110
+ return;
111
+ }
112
+ }
113
+ /*
114
+ Function for adding s2member.js with globals.
115
+ Attach to: add_action("init");
116
+ */
117
+ if (!function_exists ("ws_plugin__s2member_js_w_globals"))
118
+ {
119
+ function ws_plugin__s2member_js_w_globals ()
120
+ {
121
+ do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
122
+ /**/
123
+ if ($_GET["ws_plugin__s2member_js_w_globals"])
124
+ {
125
+ header("Content-Type: text/javascript; charset=utf-8");
126
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
127
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
128
+ header("Cache-Control: max-age=604800");
129
+ header("Pragma: public");
130
+ /**/
131
+ $g = "var S2MEMBER_VERSION = '" . ws_plugin__s2member_esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
132
+ /**/
133
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
134
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
135
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
136
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
137
+ $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
138
+ $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_CUSTOM) . "',";
139
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
140
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
141
+ $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
142
+ $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
143
+ $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
144
+ $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_LOGIN) . "',";
145
+ $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_EMAIL) . "',";
146
+ $g .= "S2MEMBER_CURRENT_USER_IP = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_IP) . "',";
147
+ $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
148
+ $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
149
+ /**/
150
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
151
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
152
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
153
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
154
+ /**/
155
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
156
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
157
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
158
+ /**/
159
+ $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
160
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
161
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
162
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
163
+ $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LOGOUT_PAGE_URL) . "',";
164
+ $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LOGIN_PAGE_URL) . "',";
165
+ /**/
166
+ $g .= "S2MEMBER_LEVEL0_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL0_LABEL) . "',";
167
+ $g .= "S2MEMBER_LEVEL1_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL1_LABEL) . "',";
168
+ $g .= "S2MEMBER_LEVEL2_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL2_LABEL) . "',";
169
+ $g .= "S2MEMBER_LEVEL3_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL3_LABEL) . "',";
170
+ $g .= "S2MEMBER_LEVEL4_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL4_LABEL) . "',";
171
+ /**/
172
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED . ",";
173
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
174
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
175
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
176
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
177
+ /**/
178
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
179
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
180
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
181
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
182
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
183
+ /**/
184
+ $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . ws_plugin__s2member_esc_sq (S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
185
+ /**/
186
+ $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
187
+ $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
188
+ /**/
189
+ $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
190
+ $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_RETURN_URL) . "',";
191
+ $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
192
+ $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_BUSINESS) . "',";
193
+ /**/
194
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
195
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
196
+ /**/
197
+ $g = trim ($g, " ,") . ";" . "\n"; /* Trim & add semicolon. */
198
+ /**/
199
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
200
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
201
+ /**/
202
+ include_once dirname (dirname (__FILE__)) . "/s2member.js";
203
+ /**/
204
+ do_action ("ws_plugin__s2member_during_js_w_globals", get_defined_vars ());
205
+ /**/
206
+ exit ();
207
+ }
208
+ /**/
209
+ do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
210
+ }
211
+ }
212
+ ?>
includes/functions/demotions.inc.php ADDED
@@ -0,0 +1,29 @@
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
+ Forces a specific Role to demote to; whenever a Member is demoted in one way or another.
18
+ Use by PayPal® IPN routines, and also by the Auto-EOT system.
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_force_demotion_role"))
21
+ {
22
+ function ws_plugin__s2member_force_demotion_role ($demotion_role = FALSE)
23
+ {
24
+ do_action ("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
25
+ /**/
26
+ return apply_filters ("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
27
+ }
28
+ }
29
+ ?>
includes/functions/email-configs.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Functions that modify the email From: name/address.
18
*/
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Functions that modify the email From: name/address.
18
*/
includes/functions/extend-cron.inc.php ADDED
@@ -0,0 +1,33 @@
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
+ Extends the WP-Cron schedules to support 10 minute intervals.
18
+ Attach to: add_filter("cron_schedules");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_extend_cron_schedules"))
21
+ {
22
+ function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
23
+ {
24
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
25
+ do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
26
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
+ /**/
28
+ $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
29
+ /**/
30
+ return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
31
+ }
32
+ }
33
+ ?>
includes/functions/file-download-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function determines the max period in days for download access.
18
Returns number of days, where 0 means no access to files has been allowed.
@@ -61,6 +61,12 @@ if (!function_exists ("ws_plugin__s2member_user_downloads"))
61
/**/
62
if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
63
{
64
if (current_user_can ("access_s2member_level1") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"])
65
{
66
$allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"];
@@ -97,7 +103,8 @@ if (!function_exists ("ws_plugin__s2member_user_downloads"))
97
}
98
/*
99
Function determines the minimum level required for file download access.
100
- Returns 0-4, where 0 means no access to file downloads has been allowed.
101
*/
102
if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
103
{
@@ -105,7 +112,13 @@ if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
105
{
106
do_action ("ws_plugin__s2member_before_min_level_4_downloads", get_defined_vars ());
107
/**/
108
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
109
{
110
$file_download_access_is_allowed = $min_level_4_downloads = 1;
111
}
@@ -122,7 +135,7 @@ if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
122
$file_download_access_is_allowed = $min_level_4_downloads = 4;
123
}
124
/**/
125
- return apply_filters ("ws_plugin__s2member_min_level_4_downloads", (int)$min_level_4_downloads, get_defined_vars ());
126
}
127
}
128
/*
@@ -137,35 +150,44 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
137
/**/
138
if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
139
{
140
- $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ()); /* Or use $_GET["s2member_free_file_download_key"]. */
141
- /**/
142
- if (!$excluded && (!$_GET["s2member_free_file_download_key"] || ($_GET["s2member_free_file_download_key"] !== md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"])))))
143
{
144
- $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
145
- /**/
146
- $file_download_access_is_allowed = $minimum_level_required_to_download_files = ws_plugin__s2member_min_level_4_downloads ();
147
/**/
148
- if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false) /* Redirect Users who are not logged in. */
149
- && wp_redirect (add_query_arg (array ("s2member_level_req" => $minimum_level_required_to_download_files, "s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
150
- exit;
151
/**/
152
- else if (!$file_download_access_is_allowed) /* Have file downloads even been enabled? */
153
{
154
- header ("HTTP/1.0 503 Service Temporarily Unavailable");
155
- echo '503: File Downloads Are Not Enabled.';
156
- exit;
157
}
158
/**/
159
else if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
160
{
161
- header ("HTTP/1.0 404 Not Found"); /* The file does not even exist. */
162
- echo '404: File Download Not Found.';
163
- exit;
164
}
165
/**/
166
else if ((!is_array ($file_downloads = ws_plugin__s2member_user_downloads ()) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
167
&& wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
168
- exit;
169
/**/
170
$previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
171
$max_days_logged = ws_plugin__s2member_max_download_period (); /* The longest period in days. */
@@ -190,7 +212,7 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
190
/**/
191
if (!$already_downloaded && $previous_file_downloads >= $file_downloads["allowed"] /* They have NOT already downloaded this file, and they're over their limit. */
192
&& wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
193
- exit;
194
/**/
195
if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
196
$file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
@@ -198,15 +220,14 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
198
update_usermeta ($current_user->ID, "s2member_file_download_access_arc", ws_plugin__s2member_array_unique ($file_download_access_arc));
199
update_usermeta ($current_user->ID, "s2member_file_download_access_log", ws_plugin__s2member_array_unique ($file_download_access_log));
200
}
201
- else /* This is a free download that we just need to check on the existence of. */
202
{
203
$_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
204
/**/
205
if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
206
{
207
- header ("HTTP/1.0 404 Not Found"); /* The file does not exist. */
208
- echo '404: File Download Not Found.';
209
- exit;
210
}
211
}
212
/*
@@ -226,7 +247,8 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
226
/*
227
Now send the file to the browser. Be sure to turn off output compression.
228
*/
229
- ini_set ("zlib.output_compression", 0); /* Must be turned off. */
230
/**/
231
header ("Content-Encoding: none");
232
header ("Content-Type: " . $mimetype);
@@ -241,12 +263,34 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
241
header ("Cache-Control: post-check=0, pre-check=0", false);
242
header ("Pragma: no-cache");
243
/**/
244
- readfile ($file);
245
/**/
246
- exit;
247
}
248
/**/
249
do_action ("ws_plugin__s2member_after_file_download_access", get_defined_vars ());
250
}
251
}
252
?>
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function determines the max period in days for download access.
18
Returns number of days, where 0 means no access to files has been allowed.
61
/**/
62
if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
63
{
64
+ if (current_user_can ("access_s2member_level0") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"])
65
+ {
66
+ $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"];
67
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"];
68
+ }
69
+ /**/
70
if (current_user_can ("access_s2member_level1") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"])
71
{
72
$allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"];
103
}
104
/*
105
Function determines the minimum level required for file download access.
106
+ Test === false to see if no access is allowed.
107
+ This returns false, or (int)[0-1].
108
*/
109
if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
110
{
112
{
113
do_action ("ws_plugin__s2member_before_min_level_4_downloads", get_defined_vars ());
114
/**/
115
+ $file_download_access_is_allowed = $min_level_4_downloads = false; /* Test with === false, which means no access is allowed at all. */
116
+ /**/
117
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"])
118
+ {
119
+ $file_download_access_is_allowed = $min_level_4_downloads = 0;
120
+ }
121
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
122
{
123
$file_download_access_is_allowed = $min_level_4_downloads = 1;
124
}
135
$file_download_access_is_allowed = $min_level_4_downloads = 4;
136
}
137
/**/
138
+ return apply_filters ("ws_plugin__s2member_min_level_4_downloads", ($file_download_access_is_allowed = $min_level_4_downloads), get_defined_vars ());
139
}
140
}
141
/*
150
/**/
151
if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
152
{
153
+ $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
154
+ $_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"];
155
+ /* The use of `md5(s2member_xencrypt("locaton of file"))` was deprecated in v3.0.5 in favor of `s2member_file_download_key()` - because it provides better security and greater flexibility. Also, $_GET["s2member_free_file_download_key"] is deprecated, in favor of $_GET["s2member_file_download_key"]. */
156
+ if (!$excluded && (!$_GET["s2member_file_download_key"] || ($_GET["s2member_file_download_key"] && !($_GET["s2member_file_download_key"] === ws_plugin__s2member_file_download_key ($_GET["s2member_file_download"]) || /* Deprecated « */ $_GET["s2member_file_download_key"] === md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"])) /* » */))))
157
{
158
+ $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Now trim slashes after key comparison. */
159
/**/
160
+ $file_download_access_is_allowed = $min_level_4_downloads = ws_plugin__s2member_min_level_4_downloads ();
161
/**/
162
+ if ($file_download_access_is_allowed === false) /* Have file downloads even been enabled? */
163
{
164
+ header ("HTTP/1.0 503 Service Temporarily Unavailable"); /* Not yet configured? */
165
+ exit ("503: Sorry, file downloads are not enabled yet. Please contact Support for assistance. If you are the site owner, please configure `s2Member -> Download Options`.");
166
}
167
/**/
168
+ else if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false) /* Redirect Users who are not logged in. */
169
+ && wp_redirect (add_query_arg (array ("s2member_level_req" => (string)$min_level_4_downloads, "s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
170
+ exit ();
171
+ /**/
172
else if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
173
{
174
+ header ("HTTP/1.0 404 Not Found"); /* The file does not even exist? */
175
+ exit ("404: Sorry, file download not found. Please contact Support for assistance.");
176
}
177
/**/
178
else if ((!is_array ($file_downloads = ws_plugin__s2member_user_downloads ()) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
179
&& wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
180
+ exit ();
181
+ /**/
182
+ else if (preg_match ("/^access[_\-]s2member[_\-](.+?)\//", $_GET["s2member_file_download"])) /* Custom Capability? */
183
+ {
184
+ list ($cap_req) = preg_split ("/\//", $_GET["s2member_file_download"], 2); /* Which Capability does this require? */
185
+ $cap_req = preg_replace ("/-/", "_", $cap_req); /* Supports (optional) dashed sub-folders instead of underscores. */
186
+ /**/
187
+ if (!$current_user->has_cap ($cap_req) /* Ok, so we've got a Custom Capability required. Do they have permission? */
188
+ && wp_redirect (add_query_arg (array ("s2member_cap_req" => $cap_req, "s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
189
+ exit ();
190
+ }
191
/**/
192
$previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
193
$max_days_logged = ws_plugin__s2member_max_download_period (); /* The longest period in days. */
212
/**/
213
if (!$already_downloaded && $previous_file_downloads >= $file_downloads["allowed"] /* They have NOT already downloaded this file, and they're over their limit. */
214
&& wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
215
+ exit ();
216
/**/
217
if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
218
$file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
220
update_usermeta ($current_user->ID, "s2member_file_download_access_arc", ws_plugin__s2member_array_unique ($file_download_access_arc));
221
update_usermeta ($current_user->ID, "s2member_file_download_access_log", ws_plugin__s2member_array_unique ($file_download_access_log));
222
}
223
+ else /* Else, this is a download that is either $excluded, or has been granted exclusive permission with a key. */
224
{
225
$_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
226
/**/
227
if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
228
{
229
+ header ("HTTP/1.0 404 Not Found"); /* The file does not even exist? */
230
+ exit ("404: Sorry, file download not found. Please contact Support for assistance.");
231
}
232
}
233
/*
247
/*
248
Now send the file to the browser. Be sure to turn off output compression.
249
*/
250
+ set_time_limit (0); /* Make time. */
251
+ ini_set ("zlib.output_compression", 0);
252
/**/
253
header ("Content-Encoding: none");
254
header ("Content-Type: " . $mimetype);
263
header ("Cache-Control: post-check=0, pre-check=0", false);
264
header ("Pragma: no-cache");
265
/**/
266
+ ob_clean () . flush () . readfile ($file);
267
/**/
268
+ exit ();
269
}
270
/**/
271
do_action ("ws_plugin__s2member_after_file_download_access", get_defined_vars ());
272
}
273
}
274
+ /*
275
+ Function creates a special file download key.
276
+ This replaces the old way of doing things: using md5(s2member_xencrypt("location of file")).
277
+ This new function adds date("Y-m-d").$HTTP_USER_AGENT.$REMOTE_ADDR to the salt used in hash creation.
278
+ */
279
+ if (!function_exists ("ws_plugin__s2member_file_download_key"))
280
+ {
281
+ function ws_plugin__s2member_file_download_key ($file = FALSE)
282
+ {
283
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
284
+ do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
285
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
286
+ /**/
287
+ $key = md5 (ws_plugin__s2member_encrypt (date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file));
288
+ /**/
289
+ return apply_filters ("ws_plugin__s2member_file_download_key", $key, get_defined_vars ());
290
+ }
291
+ function s2member_file_download_key ($file = FALSE) /* Alias for API usage. */
292
+ {
293
+ return ws_plugin__s2member_file_download_key ($file);
294
+ }
295
+ }
296
?>
includes/functions/force-ssl.inc.php ADDED
@@ -0,0 +1,71 @@
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
+ Function that forces SSL on specific Posts/Pages.
18
+ Attach to: add_action("template_redirect");
19
+
20
+ Triggered by Custom Field:
21
+ s2member_force_ssl = 1
22
+ */
23
+ if (!function_exists ("ws_plugin__s2member_check_force_ssl"))
24
+ {
25
+ function ws_plugin__s2member_check_force_ssl () /* Forces SSL. */
26
+ {
27
+ global $post; /* We need the global $post variable here. */
28
+ /**/
29
+ do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
30
+ /**/
31
+ if (is_singular () && get_post_meta ($post->ID, "s2member_force_ssl", true))
32
+ {
33
+ if (!preg_match ("/^on#x2F;i", $_SERVER["HTTPS"]))
34
+ {
35
+ wp_redirect ("https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
36
+ exit (); /* Redirect to SSL enabled Post/Page. Site must have SSL cert. */
37
+ }
38
+ else /* Otherwise, we buffer the output, and switch everything to https. */
39
+ {
40
+ function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
41
+ {
42
+ $o_pcre = ini_get ("pcre.backtrack_limit");
43
+ /**/
44
+ ini_set ("pcre.backtrack_limit", 10000000);
45
+ /**/
46
+ $tags = "script|style|link|img|input|iframe|object|embed"; /* Specific tags. */
47
+ /**/
48
+ $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags", $tags, get_defined_vars ());
49
+ /**/
50
+ $buffer = preg_replace_callback ("/\<(" . $tags . ")[^\>]+/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer);
51
+ /**/
52
+ ini_set ("pcre.backtrack_limit", $o_pcre);
53
+ /**/
54
+ return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
55
+ }
56
+ /**/
57
+ function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
58
+ {
59
+ return preg_replace ("/http\:\/\//i", "https://", $m[0]);
60
+ }
61
+ /**/
62
+ ob_start ("_ws_plugin__s2member_force_ssl_buffer");
63
+ }
64
+ }
65
+ /**/
66
+ do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
67
+ /**/
68
+ return;
69
+ }
70
+ }
71
+ ?>
includes/functions/hide-some-systematics.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function that hides some of the systematic use pages.
18
Attach to: add_filter("posts_where");
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function that hides some of the systematic use pages.
18
Attach to: add_filter("posts_where");
includes/functions/ip-restrictions.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for handling IP Restrictions.
18
IP addresses are stored in a Transient field.
@@ -51,7 +51,7 @@ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
51
echo 'Too many IP addresses accessing one account/link!<br />' . "\n";
52
echo 'Please contact Support if you need assistance.';
53
/**/
54
- exit; /* Exit now. */
55
}
56
else /* Looks legit. Continue updating the Transient array of IP addresses. */
57
{
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function for handling IP Restrictions.
18
IP addresses are stored in a Transient field.
51
echo 'Too many IP addresses accessing one account/link!<br />' . "\n";
52
echo 'Please contact Support if you need assistance.';
53
/**/
54
+ exit ();
55
}
56
else /* Looks legit. Continue updating the Transient array of IP addresses. */
57
{
includes/functions/is-systematic.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function that determines whether we are on a systematic use page.
18
*/
@@ -24,9 +24,9 @@ if (!function_exists ("ws_plugin__s2member_is_systematic_use_page"))
24
/**/
25
if (isset ($is_systematic)) /* Already cached? This saves time. */
26
{
27
- return apply_filters ("ws_plugin__s2member_is_systematic_use_page", $is_systematic, get_defined_vars ());
28
}
29
- else if (is_admin ()) /* In the admin area? */
30
{
31
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
32
}
@@ -56,7 +56,7 @@ if (!function_exists ("ws_plugin__s2member_is_systematic_use_page"))
56
}
57
else if (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))
58
{
59
- return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); /* Only true when the request starts with /?s2member from the root URL of the domain, or from the root URL of the install. */
60
}
61
else /* Otherwise, we return false. */
62
{
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
/*
17
Function that determines whether we are on a systematic use page.
18
*/
24
/**/
25
if (isset ($is_systematic)) /* Already cached? This saves time. */
26
{
27
+ return $is_systematic; /* Filters will have already been applied. */
28
}
29
+ else if (is_admin ()) /* In the admin area? - All administrational pages are considered systematic. */
30
{
31
return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
32
}
56
}
57
else if (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))
58
{
59
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); /* Only true when the request starts with /?s2member from the root URL of the domain, or from the install. */
60
}
61
else /* Otherwise, we return false. */
62
{
includes/functions/js-globals.inc.php DELETED
@@ -1,161 +0,0 @@
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;
16
- /*
17
- Function for adding script to the header.
18
- This function is fired in the admin area also.
19
- Do NOT enqueue the script in the admin area.
20
- Attach to: add_action("wp_print_scripts");
21
- */
22
- if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
23
- {
24
- function ws_plugin__s2member_add_js_w_globals ()
25
- {
26
- do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
27
- /**/
28
- if (!is_admin ()) /* Not in the admin. */
29
- {
30
- if (is_user_logged_in ())
31
- {
32
- $a = get_defined_constants (true);
33
- $c = (array)$a["user"];
34
- unset ($a);
35
- /**/
36
- foreach ($c as $k => $v)
37
- if (preg_match ("/^S2MEMBER_/i", $k))
38
- $s2member[$k] = $v;
39
- /**/
40
- $md5 = md5 (serialize ($s2member)); /* This is a hash based on the global key => values. */
41
- /* The md5 hash allows the script to be cached in the browser until the globals happen to change. */
42
- /* For instance, the global variables may change when a user who is logged-in changes their profile. */
43
- wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5, array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
44
- }
45
- else /* Else if they are not logged in, we distinguish the script by not including the md5 hash. */
46
- { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
47
- wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
48
- }
49
- /**/
50
- do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
51
- }
52
- /**/
53
- do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
54
- /**/
55
- return;
56
- }
57
- }
58
- /*
59
- Function for adding s2member.js with globals.
60
- Attach to: add_action("init");
61
- */
62
- if (!function_exists ("ws_plugin__s2member_js_w_globals"))
63
- {
64
- function ws_plugin__s2member_js_w_globals ()
65
- {
66
- do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
67
- /**/
68
- if ($_GET["ws_plugin__s2member_js_w_globals"])
69
- {
70
- $g = ""; /* Initialize here to give hooks a chance. */
71
- /**/
72
- header ("Content-Type: text/javascript; charset=utf-8");
73
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
74
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
75
- header ("Cache-Control: max-age=604800");
76
- header ("Pragma: public");
77
- /**/
78
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
79
- do_action ("ws_plugin__s2member_during_js_w_globals_before", get_defined_vars ());
80
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
81
- /**/
82
- $g .= "var S2MEMBER_VERSION = '" . preg_replace ("/'/", "\'", S2MEMBER_VERSION) . "',"; /* Since s2Member 3.0. */
83
- /**/
84
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
85
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
86
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
87
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
88
- $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
89
- $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_CUSTOM) . "',";
90
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
91
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
92
- $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
93
- $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
94
- $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
95
- $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_LOGIN) . "',";
96
- $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_EMAIL) . "',";
97
- $g .= "S2MEMBER_CURRENT_USER_IP = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_IP) . "',";
98
- $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
99
- $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
100
- /**/
101
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
102
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
103
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
104
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
105
- /**/
106
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
107
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
108
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
109
- /**/
110
- $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
111
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
112
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
113
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
114
- $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGOUT_PAGE_URL) . "',";
115
- $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGIN_PAGE_URL) . "',";
116
- /**/
117
- $g .= "S2MEMBER_LEVEL1_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL1_LABEL) . "',";
118
- $g .= "S2MEMBER_LEVEL2_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL2_LABEL) . "',";
119
- $g .= "S2MEMBER_LEVEL3_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL3_LABEL) . "',";
120
- $g .= "S2MEMBER_LEVEL4_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL4_LABEL) . "',";
121
- /**/
122
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
123
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
124
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
125
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
126
- /**/
127
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
128
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
129
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
130
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
131
- /**/
132
- $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . preg_replace ("/'/", "\'", S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
133
- /**/
134
- $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
135
- $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . preg_replace ("/'/", "\'", S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
136
- /**/
137
- $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
138
- $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_RETURN_URL) . "',";
139
- $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_ENDPOINT) . "',";
140
- $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_BUSINESS) . "',";
141
- /**/
142
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
143
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
144
- /**/
145
- $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
146
- $j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
147
- $j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
148
- /**/
149
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
150
- do_action ("ws_plugin__s2member_during_js_w_globals_after", get_defined_vars ());
151
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
152
- /**/
153
- echo apply_filters ("ws_plugin__s2member_js_w_globals", $j, get_defined_vars ());
154
- /**/
155
- exit;
156
- }
157
- /**/
158
- do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
159
- }
160
- }
161
- ?>
includes/functions/list-servers.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function that process list server integrations for s2Member.
18
*/
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function that process list server integrations for s2Member.
18
*/
includes/functions/login-customizations.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for filtering the login logo url.
18
Attach to: add_filter("login_headerurl");
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function for filtering the login logo url.
18
Attach to: add_filter("login_headerurl");
includes/functions/login-redirection.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for handling login redirections.
18
Attach to: add_action("wp_login");
@@ -25,9 +25,7 @@ if (!function_exists ("ws_plugin__s2member_login_redirect"))
25
do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
26
unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
/**/
28
- $user = new WP_User ($username); /* Get user object reference. */
29
- /**/
30
- if (!$user->has_cap ("edit_posts")) /* Subscribers & Members. */
31
{
32
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
33
do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
@@ -43,7 +41,7 @@ if (!function_exists ("ws_plugin__s2member_login_redirect"))
43
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
44
}
45
/**/
46
- exit;
47
}
48
/**/
49
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
@@ -67,8 +65,8 @@ if (!function_exists ("ws_plugin__s2member_fill_login_redirect_rc_vars"))
67
$current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
68
$current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
69
/**/
70
- $url = preg_replace ("/%%current_user_login%%/i", $current_user_login, $url);
71
- $url = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $url);
72
/**/
73
return apply_filters ("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
74
}
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function for handling login redirections.
18
Attach to: add_action("wp_login");
25
do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
26
unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
/**/
28
+ if (!is_object ($user = new WP_User ($username)) || !$user->ID || !$user->has_cap ("edit_posts"))
29
{
30
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
31
do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
41
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
42
}
43
/**/
44
+ exit ();
45
}
46
/**/
47
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
65
$current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
66
$current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
67
/**/
68
+ $url = preg_replace ("/%%current_user_login%%/i", ws_plugin__s2member_esc_ds ($current_user_login), $url);
69
+ $url = preg_replace ("/%%current_user_ID%%/i", ws_plugin__s2member_esc_ds ($current_user_ID), $url);
70
/**/
71
return apply_filters ("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
72
}
includes/functions/menu-pages.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for saving all options from any page.
18
*/
@@ -75,20 +75,27 @@ if (!function_exists ("ws_plugin__s2member_add_admin_options"))
75
{
76
function ws_plugin__s2member_add_admin_options ()
77
{
78
do_action ("ws_plugin__s2member_before_add_admin_options", get_defined_vars ());
79
/**/
80
add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
81
/**/
82
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
83
{
84
- add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
85
add_submenu_page ("ws-plugin--s2member-options", "s2Member General Options", "General Options", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
86
/**/
87
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_ops_page", true, get_defined_vars ()))
88
add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal Options", "PayPal® Options", "edit_plugins", "ws-plugin--s2member-paypal-ops", "ws_plugin__s2member_paypal_ops_page");
89
/**/
90
- if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_buttons_page", true, get_defined_vars ()))
91
- add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal® Buttons", "PayPal® Buttons", "edit_plugins", "ws-plugin--s2member-buttons", "ws_plugin__s2member_buttons_page");
92
/**/
93
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_down_ops_page", true, get_defined_vars ()))
94
add_submenu_page ("ws-plugin--s2member-options", "s2Member File Download Options", "Download Options", "edit_plugins", "ws-plugin--s2member-down-ops", "ws_plugin__s2member_down_ops_page");
@@ -215,7 +222,7 @@ if (!function_exists ("ws_plugin__s2member_menu_pages_js"))
215
/**/
216
do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
217
/**/
218
- exit;
219
}
220
/**/
221
do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
@@ -247,7 +254,7 @@ if (!function_exists ("ws_plugin__s2member_menu_pages_css"))
247
/**/
248
do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
249
/**/
250
- exit;
251
}
252
/**/
253
do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
@@ -408,15 +415,18 @@ if (!function_exists ("ws_plugin__s2member_api_ops_page"))
408
/*
409
Function for building the PayPal Button Generator page.
410
*/
411
- if (!function_exists ("ws_plugin__s2member_buttons_page"))
412
{
413
- function ws_plugin__s2member_buttons_page ()
414
{
415
- do_action ("ws_plugin__s2member_before_buttons_page", get_defined_vars ());
416
/**/
417
- include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
418
/**/
419
- do_action ("ws_plugin__s2member_after_buttons_page", get_defined_vars ());
420
/**/
421
return;
422
}
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function for saving all options from any page.
18
*/
75
{
76
function ws_plugin__s2member_add_admin_options ()
77
{
78
+ global $menu; /* Need this to work out positioning. */
79
+ /**/
80
do_action ("ws_plugin__s2member_before_add_admin_options", get_defined_vars ());
81
/**/
82
add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
83
/**/
84
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
85
{
86
+ $position = (!$position && !$menu[71]) ? 71 : $position; /* Ideal position if available. */
87
+ $position = (!$position && !$menu[72]) ? 72 : $position; /* Else position here if available. */
88
+ $position = (!$position && !$menu[73]) ? 73 : $position; /* Else position here if available. */
89
+ $position = (!$position && !$menu[74]) ? 74 : $position; /* Else position here if available. */
90
+ /**/
91
+ add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page", "", $position);
92
add_submenu_page ("ws-plugin--s2member-options", "s2Member General Options", "General Options", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
93
/**/
94
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_ops_page", true, get_defined_vars ()))
95
add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal Options", "PayPal® Options", "edit_plugins", "ws-plugin--s2member-paypal-ops", "ws_plugin__s2member_paypal_ops_page");
96
/**/
97
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_buttons_page", true, get_defined_vars ()))
98
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal® Buttons", "PayPal® Buttons", "edit_plugins", "ws-plugin--s2member-paypal-buttons", "ws_plugin__s2member_paypal_buttons_page");
99
/**/
100
if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_down_ops_page", true, get_defined_vars ()))
101
add_submenu_page ("ws-plugin--s2member-options", "s2Member File Download Options", "Download Options", "edit_plugins", "ws-plugin--s2member-down-ops", "ws_plugin__s2member_down_ops_page");
222
/**/
223
do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
224
/**/
225
+ exit ();
226
}
227
/**/
228
do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
254
/**/
255
do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
256
/**/
257
+ exit ();
258
}
259
/**/
260
do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
415
/*
416
Function for building the PayPal Button Generator page.
417
*/
418
+ if (!function_exists ("ws_plugin__s2member_paypal_buttons_page"))
419
{
420
+ function ws_plugin__s2member_paypal_buttons_page ()
421
{
422
+ do_action ("ws_plugin__s2member_before_paypal_buttons_page", get_defined_vars ());
423
+ /**/
424
+ if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]) /* Report error if PayPal® Options are not yet configured. */
425
+ ws_plugin__s2member_display_admin_notice ('Please configure <code>s2Member -> PayPal® Options</code> first. Once all of your PayPal® Options have been configured, return to this page &amp; generate your PayPal® Button(s).', true);
426
/**/
427
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-buttons.inc.php";
428
/**/
429
+ do_action ("ws_plugin__s2member_after_paypal_buttons_page", get_defined_vars ());
430
/**/
431
return;
432
}
includes/functions/nocache.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Handles no-cache headers and compatible constants for s2Member.
18
This is compatible with Quick Cache and also with WP Super Cache.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Handles no-cache headers and compatible constants for s2Member.
18
This is compatible with Quick Cache and also with WP Super Cache.
includes/functions/page-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
/*
17
Function for handling Page Level Access permissions.
18
Attach to: add_action("template_redirect");
@@ -31,38 +31,44 @@ if (!function_exists ("ws_plugin__s2member_check_page_level_access"))
31
{
32
$current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
/**/
34
- if ($page_ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || (!current_user_can ("access_s2member_level1") && !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"])) && $page_ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
35
- exit;
36
/**/
37
- else if ($page_ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && $page_ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
38
- exit;
39
/**/
40
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
41
- exit;
42
/**/
43
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
44
- exit;
45
/**/
46
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
47
- exit;
48
/**/
49
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
50
- exit;
51
/**/
52
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
53
- exit;
54
/**/
55
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
56
- exit;
57
/**/
58
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
59
- exit;
60
/**/
61
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
62
- exit;
63
/**/
64
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && ws_plugin__s2member_nocache_constants () !== "nill" &&am