-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodtask.php
793 lines (633 loc) · 36.3 KB
/
modtask.php
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
<?php
/**
**************************
** FreeTSP Version: 1.0 **
**************************
** http://www.freetsp.info
** https://github.com/Krypto/FreeTSP
** Licence Info: GPL
** Copyright (C) 2010 FreeTSP v1.0
** A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
** Project Leaders: Krypto, Fireknight.
**/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.'function_main.php');
require_once(FUNC_DIR.'function_user.php');
require_once(FUNC_DIR.'function_vfunctions.php');
require_once(FUNC_DIR.'function_page_verify.php');
db_connect(false);
logged_in();
$newpage = new page_verify();
$newpage->check('_modtask_');
if ($CURUSER['class'] < UC_MODERATOR)
{
die();
}
//-- Correct Call To Script --//
if ((isset($_POST['action'])) && ($_POST['action'] == "edituser"))
{
// Set user id
if (isset($_POST['userid']))
{
$userid = $_POST['userid'];
}
else
{
die();
}
//-- And Verify... --//
if (!is_valid_id($userid))
{
error_message("error", "Error", "Bad User ID.");
}
//-- Handle CSRF (Modtask Posts Form Other Domains, Especially To Update Class) --//
require_once(FUNC_DIR.'function_user_validator.php');
if (!validate($_POST[validator], "ModTask_$userid"))
{
die ("Invalid");
}
// Fetch Current User Data... --//
$res = sql_query("SELECT *
FROM users
WHERE id=".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$user = mysql_fetch_assoc($res) or sqlerr(__FILE__, __LINE__);
//--Used In Writing To Staff Log --//
$username = $user["username"];
//-- Check To Make Sure Your Not Editing Someone Of The Same Or Higher Class --//
if ($CURUSER["class"] <= $user['class'] && ($CURUSER['id'] != $userid && $CURUSER["class"] < UC_ADMINISTRATOR))
{
error_message("warn", "Warning", "You cannot edit someone of the same or higher class.. Action Logged");
}
$updateset = array();
$modcomment = (isset($_POST['modcomment']) && $CURUSER['class'] == UC_SYSOP) ? $_POST['modcomment'] : $user['modcomment'];
//-- Set Class --//
if ((isset($_POST['class'])) && (($class = $_POST['class']) != $user['class']))
{
if ($class >= UC_MANAGER || ($class >= $CURUSER['class']) || ($user['class'] >= $CURUSER['class']))
{
error_message("error", "User Error", "Please try again");
}
if (!is_valid_user_class($class) || $CURUSER["class"] <= $_POST['class'])
{
error_message("error", "Error", "Bad Class");
}
//-- Notify User --//
$what = ($class > $user['class'] ? "Promoted" : "Demoted");
$msg = sqlesc("You have been $what to '".get_user_class_name($class)."' by ".$CURUSER['username']);
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES(0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "class = ".sqlesc($class);
$modcomment = gmdate("Y-m-d")." - $what to '".get_user_class_name($class)."' by $CURUSER[username].\n".$modcomment;
}
//-- Invite Rights --//
if ((isset($_POST['invite_rights'])) && (($invite_rights = $_POST['invite_rights']) != $user['invite_rights']))
{
if ($invite_rights == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Invite Rights Enabled by ".htmlspecialchars($CURUSER['username']).".\n".$modcomment;
$msg = sqlesc("Your invite rights have been given back by ".htmlspecialchars($CURUSER['username']).".You can Invite Users again.");
$subject = sqlesc("Invite Rights");
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added, subject)
VALUES (0, $userid, $msg, $added, $subject)") or sqlerr(__FILE__, __LINE__);
}
if ($invite_rights == 'no')
{
$modcomment = gmdate("Y-m-d")." - Invite Rights Disabled by ".htmlspecialchars($CURUSER['username']).".\n".$modcomment;
$msg = sqlesc("Your Invite Rights have been Removed by ".htmlspecialchars($CURUSER['username']).", probably because you Invited a Bad User.");
$subject = sqlesc("Invite Rights");
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added, subject)
VALUES (0, $userid, $msg, $added, $subject)") or sqlerr(__FILE__, __LINE__);
}
$updateset[] = "invite_rights = ".sqlesc($invite_rights);
}
//-- Change Invite Amount --//
if ((isset($_POST['invites'])) && (($invites = $_POST['invites']) != ($curinvites = $user['invites'])))
{
$modcomment = gmdate("Y-m-d")." - Invite Amount changed to ".$invites." from ".$curinvites." by ".htmlspecialchars($CURUSER['username']).".\n".$modcomment;
$updateset[] = "invites = ".sqlesc($invites);
}
//-- Clear Warning - Code Not Called For Setting Warning --//
if (isset($_POST['warned']) && (($warned = $_POST['warned']) != $user['warned']))
{
$updateset[] = "warned = ".sqlesc($warned);
$updateset[] = "warneduntil = '0000-00-00 00:00:00'";
if ($warned == 'no')
{
$modcomment = gmdate("Y-m-d")." - Warning Removed by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Warning has been Removed by ".$CURUSER['username'].".");
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
//-- Set Warning - Time Based --//
if (isset($_POST['warnlength']) && ($warnlength = 0 + $_POST['warnlength']))
{
unset($warnpm);
if (isset($_POST['warnpm']))
{
$warnpm = $_POST['warnpm'];
}
if ($warnlength == 255)
{
$modcomment = gmdate("Y-m-d")." - Warned by ".$CURUSER['username'].".\nReason: $warnpm\n".$modcomment;
$msg = sqlesc("You have received a Rules Warning from ".$CURUSER['username'].($warnpm ? "\n\nReason: $warnpm" : ""));
$updateset[] = "warneduntil = '0000-00-00 00:00:00'";
}
else
{
$warneduntil = get_date_time(gmtime() + $warnlength * 604800);
$dur = $warnlength." week".($warnlength > 1 ? "s" : "");
$msg = sqlesc("You have received a $dur Rules Warning from ".$CURUSER['username'].($warnpm ? "\n\nReason: $warnpm" : ""));
$modcomment = gmdate("Y-m-d")." - Warned for $dur by ".$CURUSER['username'].".\nReason: $warnpm\n".$modcomment;
$updateset[] = "warneduntil = ".sqlesc($warneduntil);
}
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "warned = 'yes'";
}
//-- Clear Donor - Code Not Called For Setting Donor --//
if (isset($_POST['donor']) && (($donor = $_POST['donor']) != $user['donor']))
{
$updateset[] = "donor = ".sqlesc($donor);
//$updateset[] = "donoruntil = '0000-00-00 00:00:00'";
if ($donor == 'no')
{
$modcomment = gmdate("Y-m-d")." - Donor Status Removed by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Donator Status has Expired.");
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
elseif ($donor == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Donor Status Added by ".$CURUSER['username'].".\n".$modcomment;
}
}
//-- Set Donor - Time Based --//
/*
if ((isset($_POST['donorlength'])) && ($donorlength = 0 + $_POST['donorlength']))
{
if ($donorlength == 255)
{
$modcomment = gmdate("Y-m-d")." - Donor Status set by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("You have received Donor Status from ".$CURUSER['username']);
$updateset[] = "donoruntil = '0000-00-00 00:00:00'";
}
else
{
$donoruntil = get_date_time(gmtime() + $donorlength * 604800);
$dur = $donorlength." week".($donorlength > 1 ? "s" : "");
$msg = sqlesc("You have received Donator Status for $dur from ".$CURUSER['username']);
$modcomment = gmdate("Y-m-d")." - Donator Status set for $dur by ".$CURUSER['username']."\n".$modcomment;
$updateset[] = "donoruntil = ".sqlesc($donoruntil);
}
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "donor = 'yes'";
}
*/
//-- Change Users Sig --//
if ((isset($_POST['signature'])) && (($signature = $_POST['signature']) != ($cursignature = $user['signature'])))
{
$modcomment = gmdate("Y-m-d")." - Signature changed from '".$cursignature."' to '".$signature."' by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "signature = ".sqlesc($signature);
write_log("User ID <a href=userdetails.php?id=$userid>$userid</a> had there Signature changed from $cursignature to $signature by <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>");
}
//-- Enable / Disable --//
if ((isset($_POST['enabled'])) && (($enabled = $_POST['enabled']) != $user['enabled']))
{
if ($enabled == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Enabled by ".$CURUSER['username'].".\n".$modcomment;
}
else
{
$modcomment = gmdate("Y-m-d")." - Disabled by ".$CURUSER['username'].".\n".$modcomment;
}
$updateset[] = "enabled = ".sqlesc($enabled);
}
//-- Park / Un-Park --//
if ((isset($_POST['parked'])) && (($parked = $_POST['parked']) != $user['parked']))
{
if ($parked == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Account Parked by ".$CURUSER['username'].".\n".$modcomment;
}
else
{
$modcomment = gmdate("Y-m-d")." - Account Un-Parked by ".$CURUSER['username'].".\n".$modcomment;
}
$updateset[] = "parked = ".sqlesc($parked);
}
//-- Forum Permission - Enable --//
if ((isset($_POST['forumpos'])) && (($forumpos = $_POST['forumpos']) != $user['forumpos']))
{
if ($forumpos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Forum Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Forum Privilege has been returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Forum Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Forum Privilage returned by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
}
$updateset[] = "forumpos = ".sqlesc($forumpos);
}
//-- Set Forum Permission - Disabled - Time based --//
if (isset($_POST['forumposuntillength']) && ($forumposuntillength = 0 + $_POST['forumposuntillength']))
{
unset($forumposuntilpm);
if (isset($_POST['forumposuntilpm']))
{
$forumposuntilpm = $_POST['forumposuntilpm'];
}
if ($forumposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Forum Disabled By - ".$CURUSER['username'].".\nReason: $forumposuntilpm\n".$modcomment;
$msg = sqlesc("Your Forum Privilage has been Removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "forumposuntil = '0000-00-00 00:00:00'";
}
else
{
$forumposuntil = get_date_time(gmtime() + $forumposuntillength * 604800);
$dur = $forumposuntillength." week".($forumposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your Forum Privilage has been Removed for - $dur.".$CURUSER['username'].($forumposuntilpm ? "\n\nReason: $forumposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Forum Disabled for $dur by ".$CURUSER['username'].".\nReason: $forumposuntilpm\n".$modcomment;
$updateset[] = "forumposuntil = ".sqlesc($forumposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Forum Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Forum Privilage Removed for $dur by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
$updateset[] = "forumpos = 'no'";
}
//-- Change Custom Title --//
if ((isset($_POST['title'])) && (($title = $_POST['title']) != ($curtitle = $user['title'])))
{
$modcomment = gmdate("Y-m-d")." - Custom Title changed to '".$title."' from '".$curtitle."' by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "title = ".sqlesc($title);
}
//-- Change Members Username --//
if ((isset($_POST['username'])) && (($username = $_POST['username']) != ($curusername = $user['username'])))
{
$modcomment = gmdate("Y-m-d")." - Username changed to '".$username."' from '".$curusername."' by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "username = ".sqlesc($username);
}
//-- Change Members Email --//
if ((isset($_POST['email'])) && (($email = $_POST['email']) != ($curemail = $user['email'])))
{
$modcomment = gmdate("Y-m-d")." - Email changed to '".$email."' from '".$curemail."' by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "email = ".sqlesc($email);
}
//-- Change Users Info --//
if ((isset($_POST['info'])) && (($info = $_POST['info']) != ($curinfo = $user['info'])))
{
$modcomment = gmdate("Y-m-d")." - Info changed from '".$curinfo."' to '".$info."' by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "info = ".sqlesc($info);
}
/*
The Following Code Will Place The Old Passkey In The Mod Comment And Create A New Passkey.
This Is Good Practice As It Allows Usersearch To Find Old Passkeys By Searching The Mod Comments Of Members.
*/
//-- Reset Passkey --//
if ((isset($_POST['resetpasskey'])) && ($_POST['resetpasskey']))
{
$newpasskey = md5($user['username'].get_date_time().$user['passhash']);
$modcomment = gmdate("Y-m-d")." - Passkey ".sqlesc($user['passkey'])." Reset to ".sqlesc($newpasskey)." by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "passkey=".sqlesc($newpasskey);
}
/*
This Code Is For Use With The Safe Mod Comment Modification. If You Have Installed The Safe Mod Comment Mod, Then Uncomment This Section...
*/
//-- Add Comment to ModComment --//
if ((isset($_POST['addcomment'])) && ($addcomment = trim($_POST['addcomment'])))
{
$modcomment = gmdate("Y-m-d")." - ".$addcomment." - ".$CURUSER['username'].".\n".$modcomment;
}
//-- Upload Permission - Enable --//
if ((isset($_POST['uploadpos'])) && (($uploadpos = $_POST['uploadpos']) != $user['uploadpos']))
{
if ($uploadpos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Upload Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("\nYour Upload Privilege has been returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Upload Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'>$username</a> had their Upload Privilage returned by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
}
$updateset[] = "uploadpos = ".sqlesc($uploadpos);
}
//-- Set Upload Permission - Disabled - Time Based --//
if (isset($_POST['uploadposuntillength']) && ($uploadposuntillength = 0 + $_POST['uploadposuntillength']))
{
unset($uploadposuntilpm);
if (isset($_POST['uploadposuntilpm']))
{
$uploadposuntilpm = $_POST['uploadposuntilpm'];
}
if ($uploadposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Upload Disabled By - ".$CURUSER['username'].".\nReason: $uploadposuntilpm\n".$modcomment;
$msg = sqlesc("Your Upload Privilage has been Removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "uploadposuntil = '0000-00-00 00:00:00'";
}
else
{
$uploadposuntil = get_date_time(gmtime() + $uploadposuntillength * 604800);
$dur = $uploadposuntillength." week".($uploadposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your Upload Privilage has been Removed for - $dur.".$CURUSER['username'].($uploadposuntilpm ? "\n\nReason: $uploadposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Upload Disabled for $dur by ".$CURUSER['username'].".\nReason: $uploadposuntilpm\n".$modcomment;
$updateset[] = "uploadposuntil = ".sqlesc($uploadposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Upload Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'>$username</a> had their Upload Privilage Removed for $dur by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
$updateset[] = "uploadpos = 'no'";
}
//-- Download Permission - Enable --//
if ((isset($_POST['downloadpos'])) && (($downloadpos = $_POST['downloadpos']) != $user['downloadpos']))
{
if ($downloadpos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Download Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Download Privilege has been Returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Download Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Download Privilage Returned by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
}
$updateset[] = "downloadpos = ".sqlesc($downloadpos);
}
//-- Set Download Permission - Disabled - Time Based --//
if (isset($_POST['downloadposuntillength']) && ($downloadposuntillength = 0 + $_POST['downloadposuntillength']))
{
unset($downloadposuntilpm);
if (isset($_POST['downloadposuntilpm']))
{
$downloadposuntilpm = $_POST['downloadposuntilpm'];
}
if ($downloadposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Download Disabled By - ".$CURUSER['username'].".\nReason: $downloadposuntilpm\n".$modcomment;
$msg = sqlesc("Your Download Privilage has been removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "downloadposuntil = '0000-00-00 00:00:00'";
}
else
{
$downloadposuntil = get_date_time(gmtime() + $downloadposuntillength * 604800);
$dur = $downloadposuntillength." week".($downloadposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your download privilage has been Removed for - $dur.".$CURUSER['username'].($downloadposuntilpm ? "\n\nReason: $downloadposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Download Disabled for $dur by ".$CURUSER['username'].".\nReason: $downloadposuntilpm\n".$modcomment;
$updateset[] = "downloadposuntil = ".sqlesc($downloadposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Download Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Download Privilage Removed for $dur by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
$updateset[] = "downloadpos = 'no'";
}
// --Shoutbox Permission - Enable --//
if ((isset($_POST['shoutboxpos'])) && (($shoutboxpos = $_POST['shoutboxpos']) != $user['shoutboxpos']))
{
if ($shoutboxpos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Shoutbox Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Shoutbox Privilege has been Returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Shoutbox Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Shoutbox Privilage Returned by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
}
$updateset[] = "shoutboxpos = ".sqlesc($shoutboxpos);
}
//-- Set Shoutbox Permission - Disabled - Time Based --//
if (isset($_POST['shoutboxposuntillength']) && ($shoutboxposuntillength = 0 + $_POST['shoutboxposuntillength']))
{
unset($shoutboxposuntilpm);
if (isset($_POST['shoutboxposuntilpm']))
{
$shoutboxposuntilpm = $_POST['shoutboxposuntilpm'];
}
if ($shoutboxposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Shoutbox Disabled By - ".$CURUSER['username'].".\nReason: $shoutboxposuntilpm\n".$modcomment;
$msg = sqlesc("Your Shoutbox Privilage has been Removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "shoutboxposuntil = '0000-00-00 00:00:00'";
}
else
{
$shoutboxposuntil = get_date_time(gmtime() + $shoutboxposuntillength * 604800);
$dur = $shoutboxposuntillength." week".($shoutboxposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your Shoutbox Privilage has been Removed for - $dur.".$CURUSER['username'].($shoutboxposuntilpm ? "\n\nReason: $shoutboxposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Shoutbox Disabled for $dur by ".$CURUSER['username'].".\nReason: $shoutboxposuntilpm\n".$modcomment;
$updateset[] = "shoutboxposuntil = ".sqlesc($shoutboxposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Shoutbox Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Shoutbox Privilage Removed for $dur by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
$updateset[] = "shoutboxpos = 'no'";
}
// Torrent Comments Permission - Enable
if ((isset($_POST['torrcompos'])) && (($torrcompos = $_POST['torrcompos']) != $user['torrcompos']))
{
if ($torrcompos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Torrent Comment Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Torrent Comment Privilege has been Returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Torrent Comment Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Torrent Comment Privilage Returned by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
}
$updateset[] = "torrcompos = ".sqlesc($torrcompos);
}
//-- Set Torrent Comments - Disabled - Time Based --//
if (isset($_POST['torrcomposuntillength']) && ($torrcomposuntillength = 0 + $_POST['torrcomposuntillength']))
{
unset($torrcomposuntilpm);
if (isset($_POST['torrcomposuntilpm']))
{
$torrcomposuntilpm = $_POST['torrcomposuntilpm'];
}
if ($torrcomposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Torrent Comment Disabled By - ".$CURUSER['username'].".\nReason: $torrcomposuntilpm\n".$modcomment;
$msg = sqlesc("Your Torrent Comment Privilage has been Removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "torrcomposuntil = '0000-00-00 00:00:00'";
}
else
{
$torrcomposuntil = get_date_time(gmtime() + $torrcomposuntillength * 604800);
$dur = $torrcomposuntillength." week".($torrcomposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your Torrent Comment Privilage has been Removed for - $dur.".$CURUSER['username'].($torrcomposuntilpm ? "\n\nReason: $torrcomposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Torrent Comment Disabled for $dur by ".$CURUSER['username'].".\nReason: $torrcomposuntilpm\n".$modcomment;
$updateset[] = "torrcomposuntil = ".sqlesc($torrcomposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Torrent Comment Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href='userdetails.php?id=$userid'><strong>$username</strong></a> had their Torrent Comment Privilage Removed for $dur by <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a>");
$updateset[] = "torrcompos = 'no'";
}
//-- Offer Comments Permission - Enable --//
if ((isset($_POST['offercompos'])) && (($offercompos = $_POST['offercompos']) != $user['offercompos']))
{
if ($offercompos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Offer Comment Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Offer Comment Privilege has been Returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Offer Comment Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href=userdetails.php?id=$userid><strong>$username</strong></a> had their Offer Comment Privilage Returned by <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>");
}
$updateset[] = "offercompos = ".sqlesc($offercompos);
}
//-- Set Offer Comments - Disabled - Time Based --//
if (isset($_POST['offercomposuntillength']) && ($offercomposuntillength = 0 + $_POST['offercomposuntillength']))
{
unset($offercomposuntilpm);
if (isset($_POST['offercomposuntilpm']))
{
$offercomposuntilpm = $_POST['offercomposuntilpm'];
}
if ($offercomposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Offer Comment Disabled By - ".$CURUSER['username'].".\nReason: $offercomposuntilpm\n".$modcomment;
$msg = sqlesc("Your Offer Comment Privilage has been Removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "offercomposuntil = '0000-00-00 00:00:00'";
}
else
{
$offercomposuntil = get_date_time(gmtime() + $offercomposuntillength * 604800);
$dur = $offercomposuntillength." week".($offercomposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your Offer Comment Privilage has been Removed for - $dur.".$CURUSER['username'].($offercomposuntilpm ? "\n\nReason: $offercomposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Offer Comment Disabled for $dur by ".$CURUSER['username'].".\nReason: $offercomposuntilpm\n".$modcomment;
$updateset[] = "offercomposuntil = ".sqlesc($offercomposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Offer Comment Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href=userdetails.php?id=$userid><strong>$username</strong></a> had their Offer Comment Privilage Removed for $dur by <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>");
$updateset[] = "offercompos = 'no'";
}
//-- Request Comments Permission - Enable --//
if ((isset($_POST['requestcompos'])) && (($requestcompos = $_POST['requestcompos']) != $user['requestcompos']))
{
if ($requestcompos == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Request Comment Permission - Enabled by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("Your Request Comment Privilege has been Returned to you. \n Please be more careful in the future.");
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Request Comment Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href=userdetails.php?id=$userid><strong>$username</strong></a> had their Request Comment PrivilageRreturned by <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>");
}
$updateset[] = "requestcompos = ".sqlesc($requestcompos);
}
//-- Set Request Comments - Disabled - Time Based --//
if (isset($_POST['requestcomposuntillength']) && ($requestcomposuntillength = 0 + $_POST['requestcomposuntillength']))
{
unset($requestcomposuntilpm);
if (isset($_POST['requestcomposuntilpm']))
{
$requestcomposuntilpm = $_POST['requestcomposuntilpm'];
}
if ($requestcomposuntillength == 255)
{
$modcomment = gmdate("Y-m-d")." - Request Comment Disabled By - ".$CURUSER['username'].".\nReason: $requestcomposuntilpm\n".$modcomment;
$msg = sqlesc("Your Request Comment Privilage has been Removed - until further notice. \nPlease contact a member of Staff to try to resolve this issue");
$updateset[] = "requestcomposuntil = '0000-00-00 00:00:00'";
}
else
{
$requestcomposuntil = get_date_time(gmtime() + $requestcomposuntillength * 604800);
$dur = $requestcomposuntillength." week".($requestcomposuntillength > 1 ? "s" : "");
$msg = sqlesc("Your Request Comment Privilage has been Removed for - $dur.".$CURUSER['username'].($requestcomposuntilpm ? "\n\nReason: $requestcomposuntilpm" : ""));
$modcomment = gmdate("Y-m-d")." - Request Comment Disabled for $dur by ".$CURUSER['username'].".\nReason: $requestcomposuntilpm\n".$modcomment;
$updateset[] = "requestcomposuntil = ".sqlesc($requestcomposuntil);
}
$added = sqlesc(get_date_time());
$subject = sqlesc("Your Request Comment Status");
sql_query("INSERT INTO messages (sender, receiver, subject, msg, added)
VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__);
write_stafflog("<a href=userdetails.php?id=$userid><strong>$username</strong></a> had their Request Comment Privilage Removed for $dur by <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>");
$updateset[] = "requestcompos = 'no'";
}
//-- Avatar Changed --//
if ((isset($_POST['avatar'])) && (($avatar = $_POST['avatar']) != ($curavatar = $user['avatar'])))
{
$modcomment = gmdate("Y-m-d")." - Avatar changed from ".htmlspecialchars($curavatar)." to ".htmlspecialchars($avatar)." by ".$CURUSER['username'].".\n".$modcomment;
$updateset[] = "avatar = ".sqlesc($avatar);
}
//-- Set First Line Support Yes / No --//
if ((isset($_POST['support'])) && (($support = $_POST['support']) != $user['support']))
{
if ($support == 'yes')
{
$modcomment = gmdate("Y-m-d")." - Promoted to FLS by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("You have been Added to First Line Support by ".htmlspecialchars($CURUSER['username']).".");
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
if ($support == 'no')
{
$updateset[] = "support_lang =''";
$updateset[] = "supportfor =''";
$modcomment = gmdate("Y-m-d")." - Demoted from FLS by ".$CURUSER['username'].".\n".$modcomment;
$msg = sqlesc("You have been Removed from First Line Support by ".htmlspecialchars($CURUSER['username']).", probably because you were Inactive or asked to be Removed.");
$added = sqlesc(get_date_time());
sql_query("INSERT INTO messages (sender, receiver, msg, added)
VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
$updateset[] = "support = ".sqlesc($support);
}
//-- Set First Line Support For --//
if (isset($_POST["supportfor"]) && ($supportfor = $_POST["supportfor"]) != $user["supportfor"])
{
$updateset[] = "supportfor = ".sqlesc($supportfor);
}
//-- Set First Line Support Language --//
if (isset($_POST["support_lang"]) && ($support_lang = $_POST["support_lang"]) != $user["support_lang"])
{
$updateset[] = "support_lang = ".sqlesc($support_lang);
}
//-- Add ModComment... (If We Changed Something We Update Otherwise We Dont Include This..) --//
if (($CURUSER['class'] >= UC_SYSOP && ($user['modcomment'] != $_POST['modcomment'] || $modcomment != $_POST['modcomment'])) || ($CURUSER['class'] < UC_SYSOP && $modcomment != $user['modcomment']))
{
$updateset[] = "modcomment = ".sqlesc($modcomment);
}
if (sizeof($updateset) > 0)
{
sql_query("UPDATE users
SET ".implode(", ", $updateset)."
WHERE id=".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
status_change($userid);
}
$returnto = $_POST["returnto"];
header("Location: $site_url/$returnto");
die();
}
?>