forked from GeonoTRON2000/CashMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.txt
356 lines (277 loc) · 16.9 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
##
##
## Mod title: Cash Mod
##
## Mod version: 1.5.4.1
## Works on FluxBB: 1.5.6
## Release date: 2013-10-01
## Author: GeonoTRON2000 + Apache Kof (Pandark) + Gary(13579) Schilling
##
## Description: This mod gives people "cash" for their posts.
##
## Affects DB: Yes
##
## Affected files: post.php
## viewtopic.php
## delete.php
## profile.php
##
## Notes: The Original Cash Mod 1.0.1 was made by Gary(13579) Schilling.
## Localisation of its and other changes 1.0.1 from made by Apache Kof (Pandark).
## Upgrade to FluxBB 1.5 made by GeonoTRON2000.
##
## DISCLAIMER: Please note that 'mods' are not officially supported by
## FluxBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
#
#---------[ 1. UPLOAD ]---------------------------------------------------
#
install_mod.php to ./
donate.php to ./
bank.php to ./
lottery.php to ./
AP_Cash_Mod.php to ./plugins/
English/cash.php to ./lang/English/
#
#---------[ 2. RUN ]---------------------------------------------------
#
install_mod.php
#
#---------[ 3. DELETE ]---------------------------------------------------
#
install_mod.php
#
#---------[ 4. OPEN ]---------------------------------------------------
#
viewtopic.php
#
#---------[ 5. FIND ]---------------------------------------------------
#
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
#
#---------[ 6. REPLACE WITH ]---------------------------------------------------
#
$result = $db->query('SELECT u.cm_cash, u.cm_bank, u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
#
#---------[ 7. FIND ]---------------------------------------------------
#
$user_info[] = '<dd><span>'.$lang_topic['Posts'].' '.forum_number_format($cur_post['num_posts']).'</span></dd>';
#
#---------[ 8. AFTER, ADD ]---------------------------------------------------
#
$user_info[] = '<dd><span>'.ucwords($pun_config['cm_cur_name']).': '.forum_number_format($cur_post['cm_cash']).'</span></dd>';
if ($pun_config['cm_bank'] == 1)
$user_info[] = '<dd><span>'.$lang_common['Bank'].': '.forum_number_format($cur_post['cm_bank']).'</span></dd>';
#
#---------[ 9. SAVE/UPLOAD ]---------------------------------------------------
#
viewtopic.php
#
#---------[ 10. OPEN ]---------------------------------------------------
#
post.php
#
#---------[ 11. FIND ]---------------------------------------------------
#
// Fetch some info about the topic and/or the forum
if ($tid)
$result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
#
#---------[ 12. REPLACE WITH ]---------------------------------------------------
#
// Fetch some info about the topic and/or the forum
if ($tid)
$result = $db->query('SELECT f.cm_cpp, f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT f.cm_cpt, f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
#
#---------[ 13. FIND ]---------------------------------------------------
#
// If the posting user is logged in, increment his/her post count
if (!$pun_user['is_guest'])
{
$db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
// Promote this user to a new group if enabled
if ($pun_user['g_promote_next_group'] != 0 && $pun_user['num_posts'] + 1 >= $pun_user['g_promote_min_posts'])
{
$new_group_id = $pun_user['g_promote_next_group'];
$db->query('UPDATE '.$db->prefix.'users SET group_id='.$new_group_id.' WHERE id='.$pun_user['id']) or error('Unable to promote user to new group', __FILE__, __LINE__, $db->error());
}
// Topic tracking stuff...
$tracked_topics = get_tracked_topics();
$tracked_topics['topics'][$new_tid] = time();
set_tracked_topics($tracked_topics);
}
else
{
$db->query('UPDATE '.$db->prefix.'online SET last_post='.$now.' WHERE ident=\''.$db->escape(get_remote_address()).'\'' ) or error('Unable to update user', __FILE__, __LINE__, $db->error());
}
#
#---------[ 14. REPLACE WITH ]---------------------------------------------------
#
// If the posting user is logged in, increment his/her post count
if (!$pun_user['is_guest'])
{
$db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
// Promote this user to a new group if enabled
if ($pun_user['g_promote_next_group'] != 0 && $pun_user['num_posts'] + 1 >= $pun_user['g_promote_min_posts'])
{
$new_group_id = $pun_user['g_promote_next_group'];
$db->query('UPDATE '.$db->prefix.'users SET group_id='.$new_group_id.' WHERE id='.$pun_user['id']) or error('Unable to promote user to new group', __FILE__, __LINE__, $db->error());
}
// Topic tracking stuff...
$tracked_topics = get_tracked_topics();
$tracked_topics['topics'][$new_tid] = time();
set_tracked_topics($tracked_topics);
if ($tid)
{
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash+'.$cur_posting['cm_cpp'].' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect'].'<br />'.$lang_cash['You_won'].' '.$cur_posting['cm_cpp'].' '.$pun_config['cm_cur_name'].'.');
}
else if($fid)
{
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash+'.$cur_posting['cm_cpt'].' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect'].'<br />'.$lang_cash['You_won'].' '.$cur_posting['cm_cpt'].' '.$pun_config['cm_cur_name'].'.');
}
}
else
{
$db->query('UPDATE '.$db->prefix.'onlast_post='.$now.' WHERE ident=\''.$db->escape(get_remote_address()).'\'' ) or error('Unable to update user', __FILE__, __LINE__, $db->error());
}
#
#---------[ 15. SAVE/UPLOAD ]---------------------------------------------------
#
post.php
#
#---------[ 16. OPEN ]---------------------------------------------------
#
delete.php
#
#---------[ 17. FIND ]---------------------------------------------------
#
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.first_post_id, t.closed, p.posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
#
#---------[ 18. REPLACE WITH ]---------------------------------------------------
#
$result = $db->query('SELECT f.cm_cpp, f.cm_cpt, f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.first_post_id, t.closed, p.posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
#
#---------[ 19. FIND ]---------------------------------------------------
#
// Delete the topic and all of its posts
delete_topic($cur_post['tid']);
update_forum($cur_post['fid']);
#
#---------[ 20. AFTER, ADD ]---------------------------------------------------
#
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash-'.$cur_post['cm_cpt'].' WHERE id='.$cur_post['poster_id']) or error('Unable to modify user\'s cash', __FILE__, __LINE__, $db->error());
#
#---------[ 21. FIND ]---------------------------------------------------
#
// Delete just this one post
delete_post($id, $cur_post['tid']);
update_forum($cur_post['fid']);
#
#---------[ 22. AFTER, ADD ]---------------------------------------------------
#
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash-'.$cur_post['cm_cpp'].' WHERE id='.$cur_post['poster_id']) or error('Unable to modify user\'s cash', __FILE__, __LINE__, $db->error());
#
#---------[ 23. SAVE/UPLOAD ]---------------------------------------------------
#
delete.php
#
#---------[ 24. OPEN ]---------------------------------------------------
#
profile.php
#
#---------[ 25. FIND ]---------------------------------------------------
#
// We only allow administrators to update the post count
if ($pun_user['g_id'] == PUN_ADMIN)
$form['num_posts'] = intval($_POST['num_posts']);
}
#
#---------[ 26. REPLACE WITH ]---------------------------------------------------
#
// We only allow administrators to update the post count
if ($pun_user['g_id'] == PUN_ADMIN)
{
$form['num_posts'] = intval($_POST['num_posts']);
$form['cm_cash'] = intval($_POST['cm_cash']);
$form['cm_bank'] = intval($_POST['cm_bank']);
}
}
#
#---------[ 27. FIND ]---------------------------------------------------
#
$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.dst, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, u.last_visit, g.g_id, g.g_user_title, g.g_moderator FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
#
#---------[ 28. REPLACE WITH ]---------------------------------------------------
#
$result = $db->query('SELECT u.cm_cash, u.cm_bank, u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.dst, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, u.last_visit, g.g_id, g.g_user_title, g.g_moderator FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
#
#---------[ 29. FIND ]---------------------------------------------------
#
if ($posts_field != '')
{
$user_activity[] = '<dt>'.$lang_common['Posts'].'</dt>';
$user_activity[] = '<dd>'.$posts_field.'</dd>';
}
#
#---------[ 30. AFTER, ADD ]---------------------------------------------------
#
// Cash Mod
$user_activity[] = '<dt>'.ucwords($pun_config['cm_cur_name']).'</dt>';
$user_activity[] = '<dd>'.forum_number_format($user['cm_cash']).'</dd>';
$user_activity[] = '<dt>'.$lang_common['Bank'].'</dt>';
$user_activity[] = '<dd>'.forum_number_format($user['cm_bank']).'</dd>';
#
#---------[ 31. FIND ]---------------------------------------------------
#
if ($pun_user['g_id'] == PUN_ADMIN)
$posts_field .= '<label>'.$lang_common['Posts'].'<br /><input type="text" name="num_posts" value="'.$user['num_posts'].'" size="8" maxlength="8" /><br /></label>';
else if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod'])
$posts_actions[] = sprintf($lang_profile['Posts info'], forum_number_format($user['num_posts']));
#
#---------[ 32. REPLACE WITH ]---------------------------------------------------
#
if ($pun_user['g_id'] == PUN_ADMIN)
{
$posts_field .= '<label>'.$lang_common['Posts'].'<br /><input type="text" name="num_posts" value="'.$user['num_posts'].'" size="8" maxlength="8" /><br /></label>';
$posts_field .= '<label>'.ucwords($pun_config['cm_cur_name']).'<br /><input type="text" name="cm_cash" value="'.$user['cm_cash'].'" size="8" maxlength="8" /><br /></label>'."\n";
$posts_field .= ($pun_config['cm_bank'] == 1) ? '<label>'.$lang_common['Bank'].'<br /><input type="text" name="cm_bank" value="'.$user['cm_bank'].'" size="8" maxlength="8" /><br /></label>'."\n" : '';
}
else if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod'])
{
$posts_actions[] = sprintf($lang_profile['Posts info'], forum_number_format($user['num_posts']));
$posts_actions[] = ucwords($pun_config['cm_cur_name']).': '.forum_number_format($user['cm_cash']);
$posts_actions[] = $lang_common['Bank'].': '.forum_number_format($user['cm_bank']);
}
#
#---------[ 33. SAVE/UPLOAD ]---------------------------------------------------
#
profile.php
#
#---------[ 34. OPEN ]---------------------------------------------------
#
lang/English/common.php
#
#---------[ 35. FIND ]---------------------------------------------------
#
'Mark all as read' => 'Mark all topics as read',
'Mark forum read' => 'Mark this forum as read',
'Title separator' => ' / ',
#
#---------[ 36. AFTER, ADD ]---------------------------------------------------
#
// Cash Mod
'Bank' => 'Bank',
'Lottery' => 'Lottery',
'Donate' => 'Donate',
#
#---------[ 37. SAVE/UPLOAD ]---------------------------------------------------
#
lang/English/common.php