|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Simple Machines Forum (SMF) |
|
4
|
|
|
* |
|
5
|
|
|
* @package SMF |
|
6
|
|
|
* @author Simple Machines http://www.simplemachines.org |
|
7
|
|
|
* @copyright 2017 Simple Machines and individual contributors |
|
8
|
|
|
* @license http://www.simplemachines.org/about/smf/license.php BSD |
|
9
|
|
|
* |
|
10
|
|
|
* @version 2.1 Beta 4 |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* The template for adding or editing a subscription. |
|
15
|
|
|
*/ |
|
16
|
|
|
function template_modify_subscription() |
|
17
|
|
|
{ |
|
18
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
19
|
|
|
|
|
20
|
|
|
echo ' |
|
21
|
|
|
<div id="admincenter"> |
|
22
|
|
|
<form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modify;sid=', $context['sub_id'], '" method="post"> |
|
23
|
|
|
<div class="cat_bar"> |
|
24
|
|
|
<h3 class="catbg">', $txt['paid_' . $context['action_type'] . '_subscription'], '</h3> |
|
25
|
|
|
</div>'; |
|
26
|
|
|
|
|
27
|
|
|
if (!empty($context['disable_groups'])) |
|
28
|
|
|
echo ' |
|
29
|
|
|
<div class="information"> |
|
30
|
|
|
<span class="alert">', $txt['paid_mod_edit_note'], '</span> |
|
31
|
|
|
</div>'; |
|
32
|
|
|
|
|
33
|
|
|
echo ' |
|
34
|
|
|
<div class="windowbg2"> |
|
35
|
|
|
<dl class="settings"> |
|
36
|
|
|
<dt> |
|
37
|
|
|
', $txt['paid_mod_name'], ': |
|
38
|
|
|
</dt> |
|
39
|
|
|
<dd> |
|
40
|
|
|
<input type="text" name="name" value="', $context['sub']['name'], '" size="30" class="input_text"> |
|
41
|
|
|
</dd> |
|
42
|
|
|
<dt> |
|
43
|
|
|
', $txt['paid_mod_desc'], ': |
|
44
|
|
|
</dt> |
|
45
|
|
|
<dd> |
|
46
|
|
|
<textarea name="desc" rows="3" cols="40">', $context['sub']['desc'], '</textarea> |
|
47
|
|
|
</dd> |
|
48
|
|
|
<dt> |
|
49
|
|
|
<label for="repeatable_check">', $txt['paid_mod_repeatable'], '</label>: |
|
50
|
|
|
</dt> |
|
51
|
|
|
<dd> |
|
52
|
|
|
<input type="checkbox" name="repeatable" id="repeatable_check"', empty($context['sub']['repeatable']) ? '' : ' checked', ' class="input_check"> |
|
53
|
|
|
</dd> |
|
54
|
|
|
<dt> |
|
55
|
|
|
<label for="activated_check">', $txt['paid_mod_active'], '</label>:<br><span class="smalltext">', $txt['paid_mod_active_desc'], '</span> |
|
56
|
|
|
</dt> |
|
57
|
|
|
<dd> |
|
58
|
|
|
<input type="checkbox" name="active" id="activated_check"', empty($context['sub']['active']) ? '' : ' checked', ' class="input_check"> |
|
59
|
|
|
</dd> |
|
60
|
|
|
</dl> |
|
61
|
|
|
<hr> |
|
62
|
|
|
<dl class="settings"> |
|
63
|
|
|
<dt> |
|
64
|
|
|
', $txt['paid_mod_prim_group'], ':<br><span class="smalltext">', $txt['paid_mod_prim_group_desc'], '</span> |
|
65
|
|
|
</dt> |
|
66
|
|
|
<dd> |
|
67
|
|
|
<select name="prim_group"', !empty($context['disable_groups']) ? ' disabled' : '', '> |
|
68
|
|
|
<option value="0"', $context['sub']['prim_group'] == 0 ? ' selected' : '', '>', $txt['paid_mod_no_group'], '</option>'; |
|
69
|
|
|
|
|
70
|
|
|
// Put each group into the box. |
|
71
|
|
|
foreach ($context['groups'] as $id => $name) |
|
72
|
|
|
echo ' |
|
73
|
|
|
<option value="', $id, '"', $context['sub']['prim_group'] == $id ? ' selected' : '', '>', $name, '</option>'; |
|
74
|
|
|
|
|
75
|
|
|
echo ' |
|
76
|
|
|
</select> |
|
77
|
|
|
</dd> |
|
78
|
|
|
<dt> |
|
79
|
|
|
', $txt['paid_mod_add_groups'], ':<br><span class="smalltext">', $txt['paid_mod_add_groups_desc'], '</span> |
|
80
|
|
|
</dt> |
|
81
|
|
|
<dd>'; |
|
82
|
|
|
|
|
83
|
|
|
// Put a checkbox in for each group |
|
84
|
|
|
foreach ($context['groups'] as $id => $name) |
|
85
|
|
|
echo ' |
|
86
|
|
|
<label for="addgroup_', $id, '"><input type="checkbox" id="addgroup_', $id, '" name="addgroup[', $id, ']"', in_array($id, $context['sub']['add_groups']) ? ' checked' : '', !empty($context['disable_groups']) ? ' disabled' : '', ' class="input_check"> <span class="smalltext">', $name, '</span></label><br>'; |
|
87
|
|
|
|
|
88
|
|
|
echo ' |
|
89
|
|
|
</dd> |
|
90
|
|
|
<dt> |
|
91
|
|
|
', $txt['paid_mod_reminder'], ':<br><span class="smalltext">', $txt['paid_mod_reminder_desc'], ' ', $txt['zero_to_disable'], '</span> |
|
92
|
|
|
</dt> |
|
93
|
|
|
<dd> |
|
94
|
|
|
<input type="number" name="reminder" value="', $context['sub']['reminder'], '" size="6" class="input_text"> |
|
95
|
|
|
</dd> |
|
96
|
|
|
<dt> |
|
97
|
|
|
', $txt['paid_mod_email'], ':<br><span class="smalltext">', $txt['paid_mod_email_desc'], '</span> |
|
98
|
|
|
</dt> |
|
99
|
|
|
<dd> |
|
100
|
|
|
<textarea name="emailcomplete" rows="6" cols="40">', $context['sub']['email_complete'], '</textarea> |
|
101
|
|
|
</dd> |
|
102
|
|
|
</dl> |
|
103
|
|
|
<hr> |
|
104
|
|
|
<input type="radio" name="duration_type" id="duration_type_fixed" value="fixed"', empty($context['sub']['duration']) || $context['sub']['duration'] == 'fixed' ? ' checked' : '', ' class="input_radio" onclick="toggleDuration(\'fixed\');"> |
|
105
|
|
|
<strong><label for="duration_type_fixed">', $txt['paid_mod_fixed_price'], '</label></strong> |
|
106
|
|
|
<br> |
|
107
|
|
|
<div id="fixed_area" ', empty($context['sub']['duration']) || $context['sub']['duration'] == 'fixed' ? '' : 'style="display: none;"', '> |
|
108
|
|
|
<fieldset> |
|
109
|
|
|
<dl class="settings"> |
|
110
|
|
|
<dt> |
|
111
|
|
|
', $txt['paid_cost'], ' (', str_replace('%1.2f', '', $modSettings['paid_currency_symbol']), '): |
|
112
|
|
|
</dt> |
|
113
|
|
|
<dd> |
|
114
|
|
|
<input type="number" name="cost" value="', empty($context['sub']['cost']['fixed']) ? '0' : $context['sub']['cost']['fixed'], '" size="4" class="input_text"> |
|
115
|
|
|
</dd> |
|
116
|
|
|
<dt> |
|
117
|
|
|
', $txt['paid_mod_span'], ': |
|
118
|
|
|
</dt> |
|
119
|
|
|
<dd> |
|
120
|
|
|
<input type="number" name="span_value" value="', $context['sub']['span']['value'], '" size="4" class="input_text"> |
|
121
|
|
|
<select name="span_unit"> |
|
122
|
|
|
<option value="D"', $context['sub']['span']['unit'] == 'D' ? ' selected' : '', '>', $txt['paid_mod_span_days'], '</option> |
|
123
|
|
|
<option value="W"', $context['sub']['span']['unit'] == 'W' ? ' selected' : '', '>', $txt['paid_mod_span_weeks'], '</option> |
|
124
|
|
|
<option value="M"', $context['sub']['span']['unit'] == 'M' ? ' selected' : '', '>', $txt['paid_mod_span_months'], '</option> |
|
125
|
|
|
<option value="Y"', $context['sub']['span']['unit'] == 'Y' ? ' selected' : '', '>', $txt['paid_mod_span_years'], '</option> |
|
126
|
|
|
</select> |
|
127
|
|
|
</dd> |
|
128
|
|
|
</dl> |
|
129
|
|
|
</fieldset> |
|
130
|
|
|
</div> |
|
131
|
|
|
<input type="radio" name="duration_type" id="duration_type_flexible" value="flexible"', !empty($context['sub']['duration']) && $context['sub']['duration'] == 'flexible' ? ' checked' : '', ' class="input_radio" onclick="toggleDuration(\'flexible\');"> |
|
132
|
|
|
<strong><label for="duration_type_flexible">', $txt['paid_mod_flexible_price'], '</label></strong> |
|
133
|
|
|
<br> |
|
134
|
|
|
<div id="flexible_area" ', !empty($context['sub']['duration']) && $context['sub']['duration'] == 'flexible' ? '' : 'style="display: none;"', '> |
|
135
|
|
|
<fieldset>'; |
|
136
|
|
|
|
|
137
|
|
|
//!! Removed until implemented |
|
138
|
|
|
if (!empty($sdflsdhglsdjgs)) |
|
|
|
|
|
|
139
|
|
|
echo ' |
|
140
|
|
|
<dl class="settings"> |
|
141
|
|
|
<dt> |
|
142
|
|
|
<label for="allow_partial_check">', $txt['paid_mod_allow_partial'], '</label>:<br><span class="smalltext">', $txt['paid_mod_allow_partial_desc'], '</span> |
|
143
|
|
|
</dt> |
|
144
|
|
|
<dd> |
|
145
|
|
|
<input type="checkbox" name="allow_partial" id="allow_partial_check"', empty($context['sub']['allow_partial']) ? '' : ' checked', ' class="input_check"> |
|
146
|
|
|
</dd> |
|
147
|
|
|
</dl>'; |
|
148
|
|
|
|
|
149
|
|
|
echo ' |
|
150
|
|
|
<div class="information"> |
|
151
|
|
|
<strong>', $txt['paid_mod_price_breakdown'], '</strong><br> |
|
152
|
|
|
', $txt['paid_mod_price_breakdown_desc'], ' |
|
153
|
|
|
</div> |
|
154
|
|
|
<dl class="settings"> |
|
155
|
|
|
<dt> |
|
156
|
|
|
<strong>', $txt['paid_duration'], '</strong> |
|
157
|
|
|
</dt> |
|
158
|
|
|
<dd> |
|
159
|
|
|
<strong>', $txt['paid_cost'], ' (', preg_replace('~%[df\.\d]+~', '', $modSettings['paid_currency_symbol']), ')</strong> |
|
160
|
|
|
</dd> |
|
161
|
|
|
<dt> |
|
162
|
|
|
', $txt['paid_per_day'], ': |
|
163
|
|
|
</dt> |
|
164
|
|
|
<dd> |
|
165
|
|
|
<input type="number" name="cost_day" value="', empty($context['sub']['cost']['day']) ? '0' : $context['sub']['cost']['day'], '" size="5" class="input_text"> |
|
166
|
|
|
</dd> |
|
167
|
|
|
<dt> |
|
168
|
|
|
', $txt['paid_per_week'], ': |
|
169
|
|
|
</dt> |
|
170
|
|
|
<dd> |
|
171
|
|
|
<input type="number" name="cost_week" value="', empty($context['sub']['cost']['week']) ? '0' : $context['sub']['cost']['week'], '" size="5" class="input_text"> |
|
172
|
|
|
</dd> |
|
173
|
|
|
<dt> |
|
174
|
|
|
', $txt['paid_per_month'], ': |
|
175
|
|
|
</dt> |
|
176
|
|
|
<dd> |
|
177
|
|
|
<input type="number" name="cost_month" value="', empty($context['sub']['cost']['month']) ? '0' : $context['sub']['cost']['month'], '" size="5" class="input_text"> |
|
178
|
|
|
</dd> |
|
179
|
|
|
<dt> |
|
180
|
|
|
', $txt['paid_per_year'], ': |
|
181
|
|
|
</dt> |
|
182
|
|
|
<dd> |
|
183
|
|
|
<input type="number" name="cost_year" value="', empty($context['sub']['cost']['year']) ? '0' : $context['sub']['cost']['year'], '" size="5" class="input_text"> |
|
184
|
|
|
</dd> |
|
185
|
|
|
</dl> |
|
186
|
|
|
</fieldset> |
|
187
|
|
|
</div> |
|
188
|
|
|
<input type="submit" name="save" value="', $txt['paid_settings_save'], '" class="button_submit"> |
|
189
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
|
190
|
|
|
<input type="hidden" name="', $context['admin-pms_token_var'], '" value="', $context['admin-pms_token'], '"> |
|
191
|
|
|
</div> |
|
192
|
|
|
</form> |
|
193
|
|
|
</div>'; |
|
194
|
|
|
|
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* The page for deleting a subscription. |
|
199
|
|
|
*/ |
|
200
|
|
|
function template_delete_subscription() |
|
201
|
|
|
{ |
|
202
|
|
|
global $context, $scripturl, $txt; |
|
203
|
|
|
|
|
204
|
|
|
echo ' |
|
205
|
|
|
<div id="admincenter"> |
|
206
|
|
|
<form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modify;sid=', $context['sub_id'], ';delete" method="post"> |
|
207
|
|
|
<div class="cat_bar"> |
|
208
|
|
|
<h3 class="catbg">', $txt['paid_delete_subscription'], '</h3> |
|
209
|
|
|
</div> |
|
210
|
|
|
<div class="windowbg"> |
|
211
|
|
|
<p>', $txt['paid_mod_delete_warning'], '</p> |
|
212
|
|
|
|
|
213
|
|
|
<input type="submit" name="delete_confirm" value="', $txt['paid_delete_subscription'], '" class="button_submit"> |
|
214
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
|
215
|
|
|
<input type="hidden" name="', $context['admin-pmsd_token_var'], '" value="', $context['admin-pmsd_token'], '"> |
|
216
|
|
|
</div> |
|
217
|
|
|
</form> |
|
218
|
|
|
</div>'; |
|
219
|
|
|
|
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* Add or edit an existing subscriber. |
|
224
|
|
|
*/ |
|
225
|
|
|
function template_modify_user_subscription() |
|
226
|
|
|
{ |
|
227
|
|
|
global $context, $scripturl, $txt; |
|
228
|
|
|
|
|
229
|
|
|
// Some quickly stolen javascript from Post, could do with being more efficient :) |
|
230
|
|
|
echo ' |
|
231
|
|
|
<script> |
|
232
|
|
|
var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
|
233
|
|
|
</script>'; |
|
234
|
|
|
|
|
235
|
|
|
echo ' |
|
236
|
|
|
<div id="admincenter"> |
|
237
|
|
|
<form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $context['sub_id'], ';lid=', $context['log_id'], '" method="post"> |
|
238
|
|
|
<div class="cat_bar"> |
|
239
|
|
|
<h3 class="catbg"> |
|
240
|
|
|
', $txt['paid_' . $context['action_type'] . '_subscription'], ' - ', $context['current_subscription']['name'], ' |
|
241
|
|
|
', empty($context['sub']['username']) ? '' : ' (' . $txt['user'] . ': ' . $context['sub']['username'] . ')', ' |
|
242
|
|
|
</h3> |
|
243
|
|
|
</div> |
|
244
|
|
|
<div class="windowbg"> |
|
245
|
|
|
<dl class="settings">'; |
|
246
|
|
|
|
|
247
|
|
|
// Do we need a username? |
|
248
|
|
|
if ($context['action_type'] == 'add') |
|
249
|
|
|
echo ' |
|
250
|
|
|
|
|
251
|
|
|
<dt> |
|
252
|
|
|
<strong>', $txt['paid_username'], ':</strong><br> |
|
253
|
|
|
<span class="smalltext">', $txt['one_username'], '</span> |
|
254
|
|
|
</dt> |
|
255
|
|
|
<dd> |
|
256
|
|
|
<input type="text" name="name" id="name_control" value="', $context['sub']['username'], '" size="30" class="input_text"> |
|
257
|
|
|
</dd>'; |
|
258
|
|
|
|
|
259
|
|
|
echo ' |
|
260
|
|
|
<dt> |
|
261
|
|
|
<strong>', $txt['paid_status'], ':</strong> |
|
262
|
|
|
</dt> |
|
263
|
|
|
<dd> |
|
264
|
|
|
<select name="status"> |
|
265
|
|
|
<option value="0"', $context['sub']['status'] == 0 ? ' selected' : '', '>', $txt['paid_finished'], '</option> |
|
266
|
|
|
<option value="1"', $context['sub']['status'] == 1 ? ' selected' : '', '>', $txt['paid_active'], '</option> |
|
267
|
|
|
</select> |
|
268
|
|
|
</dd> |
|
269
|
|
|
</dl> |
|
270
|
|
|
<fieldset> |
|
271
|
|
|
<legend>', $txt['start_date_and_time'], '</legend> |
|
272
|
|
|
<select name="year" id="year" onchange="generateDays();">'; |
|
273
|
|
|
|
|
274
|
|
|
// Show a list of all the years we allow... |
|
275
|
|
|
for ($year = 2005; $year <= 2030; $year++) |
|
276
|
|
|
echo ' |
|
277
|
|
|
<option value="', $year, '"', $year == $context['sub']['start']['year'] ? ' selected' : '', '>', $year, '</option>'; |
|
278
|
|
|
|
|
279
|
|
|
echo ' |
|
280
|
|
|
</select> |
|
281
|
|
|
', (isset($txt['calendar_month']) ? $txt['calendar_month'] : $txt['calendar_month']), ' |
|
282
|
|
|
<select name="month" id="month" onchange="generateDays();">'; |
|
283
|
|
|
|
|
284
|
|
|
// There are 12 months per year - ensure that they all get listed. |
|
285
|
|
|
for ($month = 1; $month <= 12; $month++) |
|
286
|
|
|
echo ' |
|
287
|
|
|
<option value="', $month, '"', $month == $context['sub']['start']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>'; |
|
288
|
|
|
|
|
289
|
|
|
echo ' |
|
290
|
|
|
</select> |
|
291
|
|
|
', (isset($txt['calendar_day']) ? $txt['calendar_day'] : $txt['calendar_day']), ' |
|
292
|
|
|
<select name="day" id="day">'; |
|
293
|
|
|
|
|
294
|
|
|
// This prints out all the days in the current month - this changes dynamically as we switch months. |
|
295
|
|
View Code Duplication |
for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++) |
|
296
|
|
|
echo ' |
|
297
|
|
|
<option value="', $day, '"', $day == $context['sub']['start']['day'] ? ' selected' : '', '>', $day, '</option>'; |
|
298
|
|
|
|
|
299
|
|
|
echo ' |
|
300
|
|
|
</select> |
|
301
|
|
|
', $txt['hour'], ': <input type="text" name="hour" value="', $context['sub']['start']['hour'], '" size="2" class="input_text"> |
|
302
|
|
|
', $txt['minute'], ': <input type="text" name="minute" value="', $context['sub']['start']['min'], '" size="2" class="input_text"> |
|
303
|
|
|
</fieldset> |
|
304
|
|
|
<fieldset> |
|
305
|
|
|
<legend>', $txt['end_date_and_time'], '</legend> |
|
306
|
|
|
<select name="yearend" id="yearend" onchange="generateDays(\'end\');">'; |
|
307
|
|
|
|
|
308
|
|
|
// Show a list of all the years we allow... |
|
309
|
|
|
for ($year = 2005; $year <= 2030; $year++) |
|
310
|
|
|
echo ' |
|
311
|
|
|
<option value="', $year, '"', $year == $context['sub']['end']['year'] ? ' selected' : '', '>', $year, '</option>'; |
|
312
|
|
|
|
|
313
|
|
|
echo ' |
|
314
|
|
|
</select> |
|
315
|
|
|
', (isset($txt['calendar_month']) ? $txt['calendar_month'] : $txt['calendar_month']), ' |
|
316
|
|
|
<select name="monthend" id="monthend" onchange="generateDays(\'end\');">'; |
|
317
|
|
|
|
|
318
|
|
|
// There are 12 months per year - ensure that they all get listed. |
|
319
|
|
View Code Duplication |
for ($month = 1; $month <= 12; $month++) |
|
320
|
|
|
echo ' |
|
321
|
|
|
<option value="', $month, '"', $month == $context['sub']['end']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>'; |
|
322
|
|
|
|
|
323
|
|
|
echo ' |
|
324
|
|
|
</select> |
|
325
|
|
|
', (isset($txt['calendar_day']) ? $txt['calendar_day'] : $txt['calendar_day']), ' |
|
326
|
|
|
<select name="dayend" id="dayend">'; |
|
327
|
|
|
|
|
328
|
|
|
// This prints out all the days in the current month - this changes dynamically as we switch months. |
|
329
|
|
View Code Duplication |
for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++) |
|
330
|
|
|
echo ' |
|
331
|
|
|
<option value="', $day, '"', $day == $context['sub']['end']['day'] ? ' selected' : '', '>', $day, '</option>'; |
|
332
|
|
|
|
|
333
|
|
|
echo ' |
|
334
|
|
|
</select> |
|
335
|
|
|
', $txt['hour'], ': <input type="number" name="hourend" value="', $context['sub']['end']['hour'], '" size="2" class="input_text"> |
|
336
|
|
|
', $txt['minute'], ': <input type="number" name="minuteend" value="', $context['sub']['end']['min'], '" size="2" class="input_text"> |
|
337
|
|
|
</fieldset> |
|
338
|
|
|
<input type="submit" name="save_sub" value="', $txt['paid_settings_save'], '" class="button_submit"> |
|
339
|
|
|
</div> |
|
340
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
|
341
|
|
|
</form> |
|
342
|
|
|
<script> |
|
343
|
|
|
var oAddMemberSuggest = new smc_AutoSuggest({ |
|
344
|
|
|
sSelf: \'oAddMemberSuggest\', |
|
345
|
|
|
sSessionId: smf_session_id, |
|
346
|
|
|
sSessionVar: smf_session_var, |
|
347
|
|
|
sSuggestId: \'name_subscriber\', |
|
348
|
|
|
sControlId: \'name_control\', |
|
349
|
|
|
sSearchType: \'member\', |
|
350
|
|
|
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', |
|
351
|
|
|
bItemList: false |
|
352
|
|
|
}); |
|
353
|
|
|
</script>'; |
|
354
|
|
|
|
|
355
|
|
|
if (!empty($context['pending_payments'])) |
|
356
|
|
|
{ |
|
357
|
|
|
echo ' |
|
358
|
|
|
<div class="cat_bar"> |
|
359
|
|
|
<h3 class="catbg">', $txt['pending_payments'], '</h3> |
|
360
|
|
|
</div> |
|
361
|
|
|
<div class="information"> |
|
362
|
|
|
', $txt['pending_payments_desc'], ' |
|
363
|
|
|
</div> |
|
364
|
|
|
<div class="cat_bar"> |
|
365
|
|
|
<h3 class="catbg">', $txt['pending_payments_value'], '</h3> |
|
366
|
|
|
</div> |
|
367
|
|
|
<div class="windowbg"> |
|
368
|
|
|
<ul>'; |
|
369
|
|
|
|
|
370
|
|
|
foreach ($context['pending_payments'] as $id => $payment) |
|
371
|
|
|
{ |
|
372
|
|
|
echo ' |
|
373
|
|
|
<li> |
|
374
|
|
|
', $payment['desc'], ' |
|
375
|
|
|
<span class="floatleft"> |
|
376
|
|
|
<a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;lid=', $context['log_id'], ';pending=', $id, ';accept">', $txt['pending_payments_accept'], '</a> |
|
377
|
|
|
</span> |
|
378
|
|
|
<span class="floatright"> |
|
379
|
|
|
<a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;lid=', $context['log_id'], ';pending=', $id, ';remove">', $txt['pending_payments_remove'], '</a> |
|
380
|
|
|
</span> |
|
381
|
|
|
</li>'; |
|
382
|
|
|
} |
|
383
|
|
|
|
|
384
|
|
|
echo ' |
|
385
|
|
|
</ul> |
|
386
|
|
|
</div>'; |
|
387
|
|
|
} |
|
388
|
|
|
|
|
389
|
|
|
echo ' |
|
390
|
|
|
</div>'; |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
/** |
|
394
|
|
|
* Template for a user to edit/pick their subscriptions. |
|
395
|
|
|
*/ |
|
396
|
|
|
function template_user_subscription() |
|
397
|
|
|
{ |
|
398
|
|
|
global $context, $txt, $scripturl, $modSettings; |
|
399
|
|
|
|
|
400
|
|
|
echo ' |
|
401
|
|
|
<div id="paid_subscription"> |
|
402
|
|
|
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=subscriptions;confirm" method="post"> |
|
403
|
|
|
<div class="cat_bar"> |
|
404
|
|
|
<h3 class="catbg">', $txt['subscriptions'], '</h3> |
|
405
|
|
|
</div>'; |
|
406
|
|
|
|
|
407
|
|
|
if (empty($context['subscriptions'])) |
|
408
|
|
|
{ |
|
409
|
|
|
echo ' |
|
410
|
|
|
<div class="information"> |
|
411
|
|
|
', $txt['paid_subs_none'], ' |
|
412
|
|
|
</div>'; |
|
413
|
|
|
} |
|
414
|
|
|
else |
|
415
|
|
|
{ |
|
416
|
|
|
echo ' |
|
417
|
|
|
<div class="information"> |
|
418
|
|
|
', $txt['paid_subs_desc'], ' |
|
419
|
|
|
</div>'; |
|
420
|
|
|
|
|
421
|
|
|
// Print out all the subscriptions. |
|
422
|
|
|
foreach ($context['subscriptions'] as $id => $subscription) |
|
423
|
|
|
{ |
|
424
|
|
|
|
|
425
|
|
|
// Ignore the inactive ones... |
|
426
|
|
|
if (empty($subscription['active'])) |
|
427
|
|
|
continue; |
|
428
|
|
|
|
|
429
|
|
|
echo ' |
|
430
|
|
|
<div class="cat_bar"> |
|
431
|
|
|
<h3 class="catbg">', $subscription['name'], '</h3> |
|
432
|
|
|
</div> |
|
433
|
|
|
<div class="windowbg"> |
|
434
|
|
|
<p><strong>', $subscription['name'], '</strong></p> |
|
435
|
|
|
<p class="smalltext">', $subscription['desc'], '</p>'; |
|
436
|
|
|
|
|
437
|
|
|
if (!$subscription['flexible']) |
|
438
|
|
|
echo ' |
|
439
|
|
|
<div><strong>', $txt['paid_duration'], ':</strong> ', $subscription['length'], '</div>'; |
|
440
|
|
|
|
|
441
|
|
|
if ($context['user']['is_owner']) |
|
442
|
|
|
{ |
|
443
|
|
|
echo ' |
|
444
|
|
|
<strong>', $txt['paid_cost'], ':</strong>'; |
|
445
|
|
|
|
|
446
|
|
|
if ($subscription['flexible']) |
|
447
|
|
|
{ |
|
448
|
|
|
echo ' |
|
449
|
|
|
<select name="cur[', $subscription['id'], ']">'; |
|
450
|
|
|
|
|
451
|
|
|
// Print out the costs for this one. |
|
452
|
|
|
foreach ($subscription['costs'] as $duration => $value) |
|
453
|
|
|
echo ' |
|
454
|
|
|
<option value="', $duration, '">', sprintf($modSettings['paid_currency_symbol'], $value), '/', $txt[$duration], '</option>'; |
|
455
|
|
|
|
|
456
|
|
|
echo ' |
|
457
|
|
|
</select>'; |
|
458
|
|
|
} |
|
459
|
|
|
else |
|
460
|
|
|
echo ' |
|
461
|
|
|
', sprintf($modSettings['paid_currency_symbol'], $subscription['costs']['fixed']); |
|
462
|
|
|
|
|
463
|
|
|
echo ' |
|
464
|
|
|
<hr> |
|
465
|
|
|
<input type="submit" name="sub_id[', $subscription['id'], ']" value="', $txt['paid_order'], '" class="button_submit">'; |
|
466
|
|
|
} |
|
467
|
|
|
else |
|
468
|
|
|
echo ' |
|
469
|
|
|
<a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $subscription['id'], ';uid=', $context['member']['id'], (empty($context['current'][$subscription['id']]) ? '' : ';lid=' . $context['current'][$subscription['id']]['id']), '">', empty($context['current'][$subscription['id']]) ? $txt['paid_admin_add'] : $txt['paid_edit_subscription'], '</a>'; |
|
470
|
|
|
|
|
471
|
|
|
echo ' |
|
472
|
|
|
</div>'; |
|
473
|
|
|
} |
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
echo ' |
|
477
|
|
|
</form> |
|
478
|
|
|
<br class="clear"/> |
|
479
|
|
|
<div class="cat_bar"> |
|
480
|
|
|
<h3 class="catbg">', $txt['paid_current'], '</h3> |
|
481
|
|
|
</div> |
|
482
|
|
|
<div class="information"> |
|
483
|
|
|
', $txt['paid_current_desc'], ' |
|
484
|
|
|
</div> |
|
485
|
|
|
<table class="table_grid"> |
|
486
|
|
|
<thead> |
|
487
|
|
|
<tr class="title_bar"> |
|
488
|
|
|
<th style="width: 30%">', $txt['paid_name'], '</th> |
|
489
|
|
|
<th>', $txt['paid_status'], '</th> |
|
490
|
|
|
<th>', $txt['start_date'], '</th> |
|
491
|
|
|
<th>', $txt['end_date'], '</th> |
|
492
|
|
|
</tr> |
|
493
|
|
|
</thead> |
|
494
|
|
|
<tbody>'; |
|
495
|
|
|
|
|
496
|
|
|
if (empty($context['current'])) |
|
497
|
|
|
echo ' |
|
498
|
|
|
<tr class="windowbg"> |
|
499
|
|
|
<td colspan="4"> |
|
500
|
|
|
', $txt['paid_none_yet'], ' |
|
501
|
|
|
</td> |
|
502
|
|
|
</tr>'; |
|
503
|
|
|
|
|
504
|
|
|
foreach ($context['current'] as $sub) |
|
505
|
|
|
{ |
|
506
|
|
|
|
|
507
|
|
|
if (!$sub['hide']) |
|
508
|
|
|
echo ' |
|
509
|
|
|
<tr class="windowbg"> |
|
510
|
|
|
<td> |
|
511
|
|
|
', (allowedTo('admin_forum') ? '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modifyuser;lid=' . $sub['id'] . '">' . $sub['name'] . '</a>' : $sub['name']), ' |
|
512
|
|
|
</td><td> |
|
513
|
|
|
<span style="color: ', ($sub['status'] == 2 ? 'green' : ($sub['status'] == 1 ? 'red' : 'orange')), '"><strong>', $sub['status_text'], '</strong></span> |
|
514
|
|
|
</td><td> |
|
515
|
|
|
', $sub['start'], ' |
|
516
|
|
|
</td><td> |
|
517
|
|
|
', $sub['end'], ' |
|
518
|
|
|
</td> |
|
519
|
|
|
</tr>'; |
|
520
|
|
|
} |
|
521
|
|
|
echo ' |
|
522
|
|
|
</tbody> |
|
523
|
|
|
</table> |
|
524
|
|
|
</div>'; |
|
525
|
|
|
} |
|
526
|
|
|
|
|
527
|
|
|
/** |
|
528
|
|
|
* The "choose payment" dialog. |
|
529
|
|
|
*/ |
|
530
|
|
|
function template_choose_payment() |
|
531
|
|
|
{ |
|
532
|
|
|
global $context, $txt; |
|
533
|
|
|
|
|
534
|
|
|
echo ' |
|
535
|
|
|
<div id="paid_subscription"> |
|
536
|
|
|
<div class="cat_bar"> |
|
537
|
|
|
<h3 class="catbg">', $txt['paid_confirm_payment'], '</h3> |
|
538
|
|
|
</div> |
|
539
|
|
|
<div class="information"> |
|
540
|
|
|
', $txt['paid_confirm_desc'], ' |
|
541
|
|
|
</div> |
|
542
|
|
|
<div class="windowbg"> |
|
543
|
|
|
<dl class="settings"> |
|
544
|
|
|
<dt> |
|
545
|
|
|
<strong>', $txt['subscription'], ':</strong> |
|
546
|
|
|
</dt> |
|
547
|
|
|
<dd> |
|
548
|
|
|
', $context['sub']['name'], ' |
|
549
|
|
|
</dd> |
|
550
|
|
|
<dt> |
|
551
|
|
|
<strong>', $txt['paid_cost'], ':</strong> |
|
552
|
|
|
</dt> |
|
553
|
|
|
<dd> |
|
554
|
|
|
', $context['cost'], ' |
|
555
|
|
|
</dd> |
|
556
|
|
|
</dl> |
|
557
|
|
|
</div>'; |
|
558
|
|
|
|
|
559
|
|
|
// Do all the gateway options. |
|
560
|
|
|
foreach ($context['gateways'] as $gateway) |
|
561
|
|
|
{ |
|
562
|
|
|
echo ' |
|
563
|
|
|
<div class="cat_bar"> |
|
564
|
|
|
<h3 class="catbg">', $gateway['title'], '</h3> |
|
565
|
|
|
</div> |
|
566
|
|
|
<div class="windowbg"> |
|
567
|
|
|
', $gateway['desc'], '<br> |
|
568
|
|
|
<form action="', $gateway['form'], '" method="post">'; |
|
569
|
|
|
|
|
570
|
|
|
if (!empty($gateway['javascript'])) |
|
571
|
|
|
echo ' |
|
572
|
|
|
<script> |
|
573
|
|
|
', $gateway['javascript'], ' |
|
574
|
|
|
</script>'; |
|
575
|
|
|
|
|
576
|
|
|
foreach ($gateway['hidden'] as $name => $value) |
|
577
|
|
|
echo ' |
|
578
|
|
|
<input type="hidden" id="', $gateway['id'], '_', $name, '" name="', $name, '" value="', $value, '">'; |
|
579
|
|
|
|
|
580
|
|
|
echo ' |
|
581
|
|
|
<br><input type="submit" value="', $gateway['submit'], '" class="button_submit"> |
|
582
|
|
|
</form> |
|
583
|
|
|
</div>'; |
|
584
|
|
|
} |
|
585
|
|
|
|
|
586
|
|
|
echo ' |
|
587
|
|
|
</div> |
|
588
|
|
|
<br class="clear">'; |
|
589
|
|
|
} |
|
590
|
|
|
|
|
591
|
|
|
/** |
|
592
|
|
|
* The "thank you" bit... |
|
593
|
|
|
*/ |
|
594
|
|
|
function template_paid_done() |
|
595
|
|
|
{ |
|
596
|
|
|
global $context, $txt, $scripturl; |
|
597
|
|
|
|
|
598
|
|
|
echo ' |
|
599
|
|
|
<div id="paid_subscription"> |
|
600
|
|
|
<div class="cat_bar"> |
|
601
|
|
|
<h3 class="catbg">', $txt['paid_done'], '</h3> |
|
602
|
|
|
</div> |
|
603
|
|
|
<div class="windowbg2"> |
|
604
|
|
|
<p>', $txt['paid_done_desc'], '</p> |
|
605
|
|
|
<br> |
|
606
|
|
|
<a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=subscriptions">', $txt['paid_sub_return'], '</a> |
|
607
|
|
|
</div> |
|
608
|
|
|
</div>'; |
|
609
|
|
|
} |
|
610
|
|
|
|
|
611
|
|
|
?> |
This check looks for calls to
isset(...)orempty()on variables that are yet undefined. These calls will always produce the same result and can be removed.This is most likely caused by the renaming of a variable or the removal of a function/method parameter.