forked from TheGamesDB/TheGamesDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tab_admincp.php
1104 lines (991 loc) · 53.2 KB
/
tab_admincp.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
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
if ($loggedin = 1 && $adminuserlevel == 'ADMINISTRATOR')
{
##Image Resizing and caching script
include('simpleimage.php');
function imageDualResize($filename, $cleanFilename, $wtarget, $htarget)
{
if(!file_exists($cleanFilename))
{
$dims = getimagesize($filename);
$width = $dims[0];
$height = $dims[1];
while($width > $wtarget || $height > $htarget)
{
if($width > $wtarget)
{
$percentage = ($wtarget / $width);
}
if($height > $htarget)
{
$percentage = ($htarget / $height);
}
/*if($width > $height)
{
$percentage = ($target / $width);
}
else
{
$percentage = ($target / $height);
}*/
//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);
}
$image = new SimpleImage();
$image->load($filename);
$image->resize($width, $height);
$image->save($cleanFilename);
$image = null;
}
//returns the new sizes in html image tag format...this is so you can plug this function inside an image tag and just get the
return "src=\"$baseurl/$cleanFilename\"";
}
if (!isset($cptab)) { $cptab = "userinfo"; }
?>
<div id="gameHead">
<?php if($errormessage): ?>
<div class="error"><?= $errormessage ?></div>
<?php endif; ?>
<?php if($message): ?>
<div class="message"><?= $message ?></div>
<?php endif; ?>
<div>
<h1>Admin Control Panel</h1>
<p> </p>
</div>
<?php
// Fetch number of uploads to be moderated
$modQueueResult = mysql_query("SELECT id FROM moderation_uploads");
$modQueueCount = mysql_num_rows($modQueueResult);
// Fetch number of reported images to be moderated
$repQueueResult = mysql_query("SELECT id FROM moderation_reported");
$repQueueCount = mysql_num_rows($repQueueResult);
?>
<div id="controlPanelWrapper">
<div id="controlPanelNav">
<ul>
<li<?php if($cptab == "userinfo"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=userinfo">My User Info</a></li>
<li<?php if($cptab == "moderationqueue"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=moderationqueue&queuetype=frontboxart">Uploaded Images Moderation Queue</a><br /><a href="<?= $baseurl ?>/admincp/?cptab=moderationqueue" style="text-decoration: none;"><span style="padding: 3px 9px; font-weight: bold; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $modQueueCount ?></span></a></li>
<li<?php if($cptab == "reportedqueue"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=frontboxart">Reported Images/Games Moderation Queue</a><br /><a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue" style="text-decoration: none;"><span style="padding: 3px 9px; font-weight: bold; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $repQueueCount ?></span></a></li>
<li<?php if($cptab == "addplatform"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=addplatform">Add New Platform</a></li>
<li<?php if($cptab == "addgenre"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=addgenre">Add New Genre</a></li>
<li<?php if($cptab == "publishers"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=pubdev">Manage Publishers & Developers</a></li>
<li<?php if($cptab == "sendpm"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=sendpm">Send PM</a></li>
<li<?php if($cptab == "platformalias"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=platformalias">Generate Platform Alias's</a></li>
<li<?php if($cptab == "elasticsearchmanage"){ ?> class="active" <?php } ?>><a href="<?= $baseurl ?>/admincp/?cptab=elasticsearchmanage">Manage ElasticSearch Index</a></li>
</ul>
</div>
<div id="controlPanelContent">
<?php
switch($cptab)
{
case "userinfo":
?>
<h2>User Information | <?=$user->username?></h2>
<p> </p>
<div style="float:left;">
<form style="padding: 14px; border: 1px solid #999; background-color: #444444;" method="post" action="<?= $baseurl; ?>/admincp/" enctype="multipart/form-data">
<h2>User Image...</h2>
<?php
$filename = glob("banners/users/" . $user->id . "-*.jpg");
if(file_exists($filename[0]))
{
?>
<p style="text-align: center;"><img src="<?= $baseurl; ?>/<?= $filename[0]; ?>" alt="Current User Image" title="Current User Image" /></p>
<?php
$filename = null;
}
else
{
?>
<p style="text-align: center;"><img src="<?= $baseurl; ?>/images/common/icons/user-black_64.png" alt="Current User Image" title="Current User Image" /></p>
<?php
}
?>
<p style="text-align: center;">
<input type="file" name="userimage" /><br />
<input type="hidden" name="function" value="Update User Image" />
<input type="submit" name="submit" value="Upload Image" /></p>
</form>
</div>
<form action="<?=$fullurl?>" method="POST" style="float:left; border-left: 1px solid #333; padding-left: 16px; margin-left: 16px;">
<table cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td><b>Password</b></td>
<td><input type="password" name="userpass1"></td>
</tr>
<tr>
<td><b>Re-Enter Password</b></td>
<td><input type="password" name="userpass2"></td>
</tr>
<tr>
<td><b>Email Address</b></td>
<td><input type="text" name="email" value="<?=$user->emailaddress?>"></td>
</tr>
<tr>
<td><b>Preferred Language</b></td>
<td>
<select name="languageid" size="1">
<?php
## Display language selector
foreach ($languages AS $langid => $langname) {
## If we have the currently selected language
if ($user->languageid == $langid) {
$selected = 'selected';
}
## Otherwise
else {
$selected = '';
}
print "<option value=\"$langid\" $selected>$langname</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><b>Account Identifier</b></td>
<td><input type="text" name="form_uniqueid" value="<?=$user->uniqueid?>" readonly></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="function" value="Update User Information"></td>
</tr>
</table>
</form>
<?php
break;
case "moderationqueue":
?>
<style>
button.approve {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #ffffff;
padding: 6px 12px;
background: -moz-linear-gradient(
top,
#c8ffbf 0%,
#72cc72 25%,
#22a800);
background: -webkit-gradient(
linear, left top, left bottom,
from(#c8ffbf),
color-stop(0.25, #72cc72),
to(#22a800));
-moz-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
border: 2px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(43,255,0,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(43,255,0,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(43,255,0,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
cursor: pointer;
}
.deny {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
color: #ffffff;
padding: 6px 12px;
background: -moz-linear-gradient(
top,
#ffbfbf 0%,
#cc7272 25%,
#a80000);
background: -webkit-gradient(
linear, left top, left bottom,
from(#ffbfbf),
color-stop(0.25, #cc7272),
to(#a80000));
-moz-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
border: 2px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(255,0,0,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(255,0,0,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(255,0,0,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
cursor: pointer;
}
.compare {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
color: #ffffff;
padding: 6px 12px;
background: -moz-linear-gradient(
top,
#bfcaff 0%,
#82a1ff 25%,
#4646fa);
background: -webkit-gradient(
linear, left top, left bottom,
from(#bfcaff),
color-stop(0.25, #82a1ff),
to(#4646fa));
-moz-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
border: 2px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(0,13,255,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(0,13,255,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(0,13,255,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
cursor: pointer;
}
</style>
<?php
// Fetch number of uploads to be moderated
$frontQueueResult = mysql_query("SELECT id FROM moderation_uploads WHERE imagekey = 'front'");
$frontQueueCount = mysql_num_rows($frontQueueResult);
if( empty($frontQueueCount)) { $frontQueueCount = 0; }
$backQueueResult = mysql_query("SELECT id FROM moderation_uploads WHERE imagekey = 'back'");
$backQueueCount = mysql_num_rows($backQueueResult);
if( empty($backQueueCount)) { $backQueueCount = 0; }
$clearlogoQueueResult = mysql_query("SELECT id FROM moderation_uploads WHERE imagekey = 'clearlogo'");
$clearlogoQueueCount = mysql_num_rows($clearlogoQueueResult);
if( empty($clearlogoQueueCount)) { $clearlogoQueueCount = 0; }
?>
<p><a href="<?= $baseurl ?>/admincp/?cptab=moderationqueue&queuetype=frontboxart" style="color: orange; font-size: 16;">Front Boxart</a><span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $frontQueueCount ?></span> | <a href="<?= $baseurl ?>/admincp/?cptab=moderationqueue&queuetype=backboxart" style="color: orange; font-size: 16;">Rear Boxart</a><span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $backQueueCount ?></span> | <a href="<?= $baseurl ?>/admincp/?cptab=moderationqueue&queuetype=clearlogo" style="color: orange; font-size: 16;">ClearLOGO</a><span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $clearlogoQueueCount ?></span></p>
<?php
if ($queuetype == "frontboxart")
{
$modQueueResult = mysql_query("SELECT m.*, u.username, g.GameTitle, p. NAME AS PlatformName, p.id AS PlatformID FROM moderation_uploads AS m, users AS u, games AS g, platforms AS p WHERE imagekey = 'front' AND m.userID = u.id AND m.gameID = g.id AND g.Platform = p.id ORDER BY dateadded");
$queueheader = "Front Boxart Moderation Queue";
}
else if ($queuetype == "backboxart")
{
$modQueueResult = mysql_query("SELECT m.*, u.username, g.GameTitle, p. NAME AS PlatformName, p.id AS PlatformID FROM moderation_uploads AS m, users AS u, games AS g, platforms AS p WHERE imagekey = 'back' AND m.userID = u.id AND m.gameID = g.id AND g.Platform = p.id ORDER BY dateadded");
$queueheader = "Rear Boxart Moderation Queue";
}
else if ($queuetype == "clearlogo")
{
$modQueueResult = mysql_query("SELECT m.*, u.username, g.GameTitle, p. NAME AS PlatformName, p.id AS PlatformID FROM moderation_uploads AS m, users AS u, games AS g, platforms AS p WHERE imagekey = 'clearlogo' AND m.userID = u.id AND m.gameID = g.id AND g.Platform = p.id ORDER BY dateadded");
$queueheader = "ClearLOGO Moderation Queue";
}
$modQueueCount = mysql_num_rows($modQueueResult);
?>
<table call-padding="0" cell-spacing="0" style="border: 2px solid #444; border-radius: 6px; background-color: #EEEEEE; color: #333333; border-collapse: separate; border-spacing: 2px; border-color: gray; width: 100%;">
<thead style="text-align: left;">
<tr>
<th colspan="3" style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#C5C5C5,#F9F9F9); padding: 7px 7px 8px; font-size: 18px; text-align: center; border-bottom: 1px solid #444;"><?= $queueheader; ?></th>
</tr>
<tr>
<th style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#C5C5C5,#F9F9F9); padding: 7px 7px 8px; font-size: 16px; border-bottom: 1px solid #444;">Art</th>
<th style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#C5C5C5,#F9F9F9); padding: 7px 7px 8px; font-size: 16px; border-bottom: 1px solid #444;">Info</th>
<th style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#C5C5C5,#F9F9F9); padding: 7px 7px 8px; font-size: 16px; border-bottom: 1px solid #444;">Date</th>
</tr>
</thead>
<tfoot style="text-align: left;">
<tr>
<th style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#F9F9F9,#C5C5C5); padding: 7px 7px 8px; font-size: 16px; border-top: 1px solid #444;">Art</th>
<th style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#F9F9F9,#C5C5C5); padding: 7px 7px 8px; font-size: 16px; border-top: 1px solid #444;">Info</th>
<th style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#F9F9F9,#C5C5C5); padding: 7px 7px 8px; font-size: 16px; border-top: 1px solid #444;">Date</th>
</tr>
</tfoot>
<tbody>
<?php
if ($modQueueCount > 0)
{
while ($modQueueObject = mysql_fetch_object($modQueueResult))
{
?>
<tr id="modItem-<?= $modQueueObject->id ?>">
<td style="padding: 10px 10px; border-bottom: 1px solid #444; vertical-align: top; text-align: center;">
<?php
if(!file_exists("moderationqueue/_cache/$modQueueObject->filename"))
{
WideImage::load("moderationqueue/$modQueueObject->filename")->resize(200, 200)->saveToFile("moderationqueue/_cache/$modQueueObject->filename");
}
?>
<a href="<?= "$baseurl/moderationqueue/$modQueueObject->filename" ?>" rel="facebox"><img src="<?= "$baseurl/moderationqueue/_cache/$modQueueObject->filename" ?>" /></a>
</td>
<td style="padding: 10px 10px; border-bottom: 1px solid #444; vertical-align: top;"><span style="font-weight: bold;">Game:</span> <a href="<?= $baseurl . "/game/" . $modQueueObject->gameID; ?>" style="color: darkorange;"><?= $modQueueObject->GameTitle; ?></a><br />
<span style="font-weight: bold;">Platform:</span> <a href="<?= $baseurl . "/platform/" . $modQueueObject->PlatformID; ?>" style="color: darkorange;"><?= $modQueueObject->PlatformName; ?></a><br />
<span style="font-weight: bold;">Filename:</span> <?= $modQueueObject->filename; ?> <br />
<span style="font-weight: bold;">Dimensions:</span> <?= $modQueueObject->resolution; ?>px<br />
<span style="font-weight: bold;">Uploader:</span> <a href="<?= $baseurl . "/artistbanners/?id=" . $modQueueObject->userID; ?>" style="color: darkorange;"><?= $modQueueObject->username; ?></a>
<p> </p>
<p style="text-align: right;"><button type="button" class="approve" onclick="$.get('<?= $baseurl; ?>/scripts/modqueue_approve.php?modID=<?= $modQueueObject->id; ?>', function(data){ if(data == 'Success') { $('#modItem-<?= $modQueueObject->id ?> img').css('display', 'none'); $('#modItem-<?= $modQueueObject->id ?>').slideUp(); } else { alert(data); } });">Approve</button> <a class="compare" rel="facebox" href="<?= "$baseurl/scripts/modqueue_compare.php?modimageid=$modQueueObject->id" ?>">Compare</a> <button type="button" class="deny" onclick="$('#deny-<?= $modQueueObject->id ?>').slideToggle();">Deny</button></p>
<div id="deny-<?= $modQueueObject->id ?>" style="display: none;">
<hr />
<p style="font-weight: bold;">Reason for denial:</p>
<select id="deny-select-<?= $modQueueObject->id ?>">
<option>Submitted image is pixellated, of poor quality, or has artifacts.</option>
<option>Submitted image is of smaller dimensions than the current.</option>
<option>Submitted image does not possess a transparent background.</option>
<option>Submitted image is the incorrect type/category.</option>
<option>Submitted image is of an non-english language.</option>
<option>Submitted image is for the wrong platform.</option>
<option>Submitted image is for the wrong game.</option>
<option>Submitted image is heavily stained.</option>
<option>Submitted image is watermarked.</option>
<option>Other (specify in comments).</option>
</select>
<p style="font-weight: bold;">Additional comments:</p>
<textarea id="deny-additional-<?= $modQueueObject->id ?>" style="width: 100%; height: 100px;"></textarea>
<p style="text-align: center;"><a class="deny" href="javascript:void();" onclick="var reason = $('#deny-select-<?= $modQueueObject->id ?>').val(); var additional = $('#deny-additional-<?= $modQueueObject->id ?>').val(); $.get('<?= $baseurl; ?>/scripts/modqueue_deny.php?modID=<?= $modQueueObject->id; ?>&denyreason=' + reason + '&denyadditional=' + additional, function(data){ if(data == 'Success') { $('#modItem-<?= $modQueueObject->id ?> img').css('display', 'none'); $('#modItem-<?= $modQueueObject->id ?>').slideUp(); } else { alert(data); } });">Confirm Denial</a>
<!--<p style="text-align: center;"><a class="deny" href="javascript:void();" onclick="$.get('<?= $baseurl; ?>/scripts/modqueue_deny.php?modID=<?= $modQueueObject->id; ?>', function(data){ if(data == 'Success') { $('#modItem-<?= $modQueueObject->id ?> img').css('display', 'none'); $('#modItem-<?= $modQueueObject->id ?>').slideUp(); } else { alert(data); } });">Confirm Denial</a> -->
</div></td>
<td style="padding: 10px 10px; border-bottom: 1px solid #444; vertical-align: top;"><?= $modQueueObject->dateadded ?></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="3" style="padding: 10px 10px; font-size: 18px; text-align: center;">This moderation queue is empty.</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
break;
case "reportedqueue":
?>
<style>
button.approve {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #ffffff;
padding: 6px 12px;
background: -moz-linear-gradient(
top,
#c8ffbf 0%,
#72cc72 25%,
#22a800);
background: -webkit-gradient(
linear, left top, left bottom,
from(#c8ffbf),
color-stop(0.25, #72cc72),
to(#22a800));
-moz-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
border: 2px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(43,255,0,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(43,255,0,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(43,255,0,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
cursor: pointer;
}
.deny {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
color: #ffffff;
padding: 6px 12px;
background: -moz-linear-gradient(
top,
#ffbfbf 0%,
#cc7272 25%,
#a80000);
background: -webkit-gradient(
linear, left top, left bottom,
from(#ffbfbf),
color-stop(0.25, #cc7272),
to(#a80000));
-moz-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
border: 2px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(255,0,0,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(255,0,0,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(255,0,0,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
cursor: pointer;
}
.compare {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
color: #ffffff;
padding: 6px 12px;
background: -moz-linear-gradient(
top,
#bfcaff 0%,
#82a1ff 25%,
#4646fa);
background: -webkit-gradient(
linear, left top, left bottom,
from(#bfcaff),
color-stop(0.25, #82a1ff),
to(#4646fa));
-moz-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
border: 2px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(0,13,255,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(0,13,255,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 8px rgba(0,13,255,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
cursor: pointer;
}
</style>
<?php
// Fetch number of reported images to be moderated
//Front Boxart
$reportedFrontQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND b.keytype = 'boxart' AND b.filename LIKE '%front%'");
$reportedFrontQueueCount = mysql_num_rows($reportedFrontQueueResult);
//Rear Boxart
$reportedRearQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND b.keytype = 'boxart' AND b.filename LIKE '%back%'");
$reportedRearQueueCount = mysql_num_rows($reportedRearQueueResult);
//ClearLOGO
$reportedClearlogoQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND b.keytype = 'clearlogo'");
$reportedClearlogoQueueCount = mysql_num_rows($reportedClearlogoQueueResult);
//Fanart
$reportedFanartQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND b.keytype = 'fanart'");
$reportedFanartQueueCount = mysql_num_rows($reportedFanartQueueResult);
//Screenshot
$reportedScreenshotQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND b.keytype = 'screenshot'");
$reportedScreenshotQueueCount = mysql_num_rows($reportedScreenshotQueueResult);
//Banner
$reportedBannerQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND b.keytype = 'series'");
$reportedBannerQueueCount = mysql_num_rows($reportedBannerQueueResult);
//Games
$reportedGameQueueResult = mysql_query("SELECT m.id FROM moderation_reported AS m, games AS g WHERE m.reportid = g.id AND m.reporttype = 'game'");
$reportedGameQueueCount = mysql_num_rows($reportedGameQueueResult);
?>
<p>
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=frontboxart" style="color: orange; font-size: 16;">Front Boxart</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedFrontQueueCount ?></span>
|
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=rearboxart" style="color: orange; font-size: 16;">Rear Boxart</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedRearQueueCount ?></span>
|
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=clearlogo" style="color: orange; font-size: 16;">ClearLOGO</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedClearlogoQueueCount ?></span>
|
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=fanart" style="color: orange; font-size: 16;">Fanart</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedFanartQueueCount ?></span>
|
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=screenshot" style="color: orange; font-size: 16;">Screenshot</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedScreenshotQueueCount ?></span>
|
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=banner" style="color: orange; font-size: 16;">Banner</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedBannerQueueCount ?></span>
|
<a href="<?= $baseurl ?>/admincp/?cptab=reportedqueue&queuetype=game" style="color: orange; font-size: 16;">Game</a>
<span style="margin-left: 4px; padding: 1px 6px; background-color: orange; color: #444444; border: 1px soid #FFFFFF; border-radius: 5px;"><?= $reportedGameQueueCount ?></span>
</p>
<?php
switch ($queuetype)
{
case "frontboxart":
$reportedResult = mysql_query("SELECT m.*, u.username, b.filename, b.resolution, g.id AS gameID, g.GameTitle, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND m.userID = u.id AND b.keyvalue = g.id AND g.Platform = p.id AND b.keytype = 'boxart' AND b.filename LIKE '%front%' ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported Front Boxart Queue";
break;
case "rearboxart":
$reportedResult = mysql_query("SELECT m.*, u.username, b.filename, b.resolution, g.id AS gameID, g.GameTitle, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND m.userID = u.id AND b.keyvalue = g.id AND g.Platform = p.id AND b.keytype = 'boxart' AND b.filename LIKE '%back%' ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported Rear Boxart Queue";
break;
case "clearlogo":
$reportedResult = mysql_query("SELECT m.*, u.username, b.filename, b.resolution, g.id AS gameID, g.GameTitle, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND m.userID = u.id AND b.keyvalue = g.id AND g.Platform = p.id AND b.keytype = 'clearlogo' ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported ClearLOGO Queue";
break;
case "fanart":
$reportedResult = mysql_query("SELECT m.*, u.username, b.filename, b.resolution, g.id AS gameID, g.GameTitle, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND m.userID = u.id AND b.keyvalue = g.id AND g.Platform = p.id AND b.keytype = 'fanart' ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported Fanart Queue";
break;
case "screenshot":
$reportedResult = mysql_query("SELECT m.*, u.username, b.filename, b.resolution, g.id AS gameID, g.GameTitle, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND m.userID = u.id AND b.keyvalue = g.id AND g.Platform = p.id AND b.keytype = 'screenshot' ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported Screenshot Queue";
break;
case "banner":
$reportedResult = mysql_query("SELECT m.*, u.username, b.filename, b.resolution, g.id AS gameID, g.GameTitle, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p, banners AS b WHERE m.reportid = b.id AND m.reporttype = 'image' AND m.userID = u.id AND b.keyvalue = g.id AND g.Platform = p.id AND b.keytype = 'series' ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported Banner Queue";
break;
case "game":
$reportedResult = mysql_query("SELECT m.*, u.username, g.id AS gameID, g.GameTitle, g.Developer, g.Publisher, g.ReleaseDate, g.Overview, p.name AS PlatformName, p.id AS PlatformID FROM moderation_reported AS m, users AS u, games AS g, platforms AS p WHERE m.reportid = g.id AND m.reporttype = 'game' AND m.userID = u.id AND g.Platform = p.id ORDER BY m.dateadded") or die(mysql_error());
$queueheader = "Reported Game Queue";
break;
}
$reportedCount = mysql_num_rows($reportedResult);
?>
<table call-padding="0" cell-spacing="0" style="border: 2px solid #444; border-radius: 6px; background-color: #EEEEEE; color: #333333; border-collapse: separate; border-spacing: 2px; border-color: gray; width: 100%;">
<thead style="text-align: left;">
<tr>
<th colspan="3" style="background: #F1F1F1; background-image: -webkit-linear-gradient(bottom,#C5C5C5,#F9F9F9); padding: 7px 7px 8px; font-size: 18px; text-align: center; border-bottom: 1px solid #444;"><?= $queueheader; ?></th>
</tr>
<tr>
<?php if ($queuetype == "game"){?>
<th class="modTableTitle">Game</th>
<th class="modTableTitle">Report Info</th>
<?php }else{?>
<th class="modTableTitle">Art</th>
<th class="modTableTitle">Art Info</th>
<th class="modTableTitle">Report Info</th>
<?php }?>
</tr>
</thead>
<tfoot style="text-align: left;">
<tr>
<?php if ($queuetype == "game"){?>
<th class="modTableTitle">Game</th>
<th class="modTableTitle">Report Info</th>
<?php }else{?>
<th class="modTableTitle">Art</th>
<th class="modTableTitle">Art Info</th>
<th class="modTableTitle">Report Info</th>
<?php }?>
</tr>
</tfoot>
<tbody>
<?php
if ($reportedCount > 0)
{
while ($reportedObject = mysql_fetch_object($reportedResult))
{
?>
<tr id="modItem-<?= $reportedObject->id ?>">
<?php if ($queuetype != "game"){?>
<td style="padding: 10px 10px; border-bottom: 1px solid #444; vertical-align: top; text-align: center;">
<?php
if(!file_exists("reportedqueue/_cache/$reportedObject->filename"))
{
WideImage::load("banners/$reportedObject->filename")->resize(200, 200)->saveToFile("reportedqueue/_cache/$reportedObject->filename");
}
?>
<a href="<?= "$baseurl/banners/$reportedObject->filename" ?>" rel="facebox"><img src="<?= "$baseurl/reportedqueue/_cache/$reportedObject->filename" ?>" /></a>
</td>
<?php }?>
<td style="padding: 10px 10px; border-bottom: 1px solid #444; vertical-align: top;"><span style="font-weight: bold;">Game:</span> <a href="<?= $baseurl . "/game/" . $reportedObject->gameID; ?>" style="color: darkorange;"><?= $reportedObject->GameTitle; ?></a><br />
<span style="font-weight: bold;">Platform:</span> <a href="<?= $baseurl . "/platform/" . $reportedObject->PlatformID; ?>" style="color: darkorange;"><?= $reportedObject->PlatformName; ?></a><br />
<?php if ($queuetype != "game"){?>
<span style="font-weight: bold;">Filename:</span> <?= $reportedObject->filename; ?> <br />
<span style="font-weight: bold;">Dimensions:</span> <? if (!empty($reportedObject->resolution)) { echo $reportedObject->resolution . "px"; } else{ echo "N/A"; } ?>
<?php } else {?>
<span style="font-weight: bold;">Developer:</span> <? if (!empty($reportedObject->Developer)) { echo $reportedObject->Developer; } else{ echo "N/A"; } ?><br/>
<span style="font-weight: bold;">Publisher:</span> <? if (!empty($reportedObject->Publisher)) { echo $reportedObject->Publisher; } else{ echo "N/A"; } ?><br/>
<span style="font-weight: bold;">Release Date:</span> <? if (!empty($reportedObject->ReleaseDate)) { echo $reportedObject->ReleaseDate; } else{ echo "N/A"; } ?><br/>
<span style="font-weight: bold;">Overview:</span> <? if (!empty($reportedObject->Overview)) { echo "<div style=\"border: 1px solid #999; margin: 4px; padding: 4px; width: 100%; height: 150px; overflow: auto;\">".nl2br(strip_tags($reportedObject->Overview))."</div>"; } else{ echo "N/A"; } ?>
<?php }?>
<p style="text-align: right;">
<?php $type = "image";
if ($queuetype == "game")
$type = "game";
?>
<button type="button" class="approve" onclick="$.get('<?= $baseurl; ?>/scripts/reportqueue_keep.php?reportType=<?=$type;?>&reportedID=<?= $reportedObject->reportid; ?>&reportID=<?= $reportedObject->id; ?>', function(data){ if(data.indexOf('Success') >= 0) { $('#modItem-<?= $reportedObject->id ?> img').css('display', 'none'); $('#modItem-<?= $reportedObject->id ?>').slideUp(); } else { alert(data); } });">Keep</button>
<button type="button" class="deny" onclick="$.get('<?= $baseurl; ?>/scripts/reportqueue_delete.php?reportType=<?=$type;?>&reportedID=<?= $reportedObject->reportid; ?>&reportID=<?= $reportedObject->id; ?>', function(data){ if(data.indexOf('Success') >= 0) { $('#modItem-<?= $reportedObject->id ?> img').css('display', 'none'); $('#modItem-<?= $reportedObject->id ?>').slideUp(); } else { alert(data); } });">Delete</button>
</p>
<div id="deny-<?= $reportedObject->id ?>" style="display: none;">
<hr />
<p style="font-weight: bold;">Reason for denial:</p>
<select id="deny-select-<?= $reportedObject->id ?>">
<option>Submitted image is pixellated, of poor quality, or has artifacts.</option>
<option>Submitted image is of smaller dimensions than the current.</option>
<option>Submitted image does not possess a transparent background.</option>
<option>Submitted image is of an non-english language.</option>
<option>Submitted image is for the wrong platform.</option>
<option>Submitted image is for the wrong game.</option>
<option>Submitted image is heavily stained.</option>
<option>Submitted image contains offensive material such as gross violence or nudity.</option>
<option>Submitted image is not related to the game.</option>
</select>
<p style="font-weight: bold;">Additional comments:</p>
<textarea id="deny-additional-<?= $reportedObject->id ?>" style="width: 100%; height: 100px;"></textarea>
<p style="text-align: center;"><a class="deny" href="javascript:void();" onclick="var reason = $('#deny-select-<?= $reportedObject->id ?>').val(); var additional = $('#deny-additional-<?= $reportedObject->id ?>').val(); $.get('<?= $baseurl; ?>/scripts/modqueue_deny.php?modID=<?= $reportedObject->id; ?>&denyreason=' + reason + '&denyadditional=' + additional, function(data){ if(data == 'Success') { $('#modItem-<?= $reportedObject->id ?> img').css('display', 'none'); $('#modItem-<?= $reportedObject->id ?>').slideUp(); } else { alert(data); } });">Confirm Denial</a>
<!--<p style="text-align: center;"><a class="deny" href="javascript:void();" onclick="$.get('<?= $baseurl; ?>/scripts/modqueue_deny.php?modID=<?= $reportedObject->id; ?>', function(data){ if(data == 'Success') { $('#modItem-<?= $reportedObject->id ?> img').css('display', 'none'); $('#modItem-<?= $reportedObject->id ?>').slideUp(); } else { alert(data); } });">Confirm Denial</a> -->
</div></td>
<td style="padding: 10px 10px; border-bottom: 1px solid #444; vertical-align: top; width: 30%;">
<span style="font-weight: bold;">Date Reported:</span><br /><?= $reportedObject->dateadded ?><br />
<span style="font-weight: bold;">Reported By:</span><br /><a href="<?= $baseurl . "/artistbanners/?id=" . $reportedObject->userid; ?>" style="color: darkorange;"><?= $reportedObject->username; ?></a><br />
<span style="font-weight: bold;">Reason For Report:</span><br /><?= $reportedObject->reason ?><br />
<span style="font-weight: bold;">Additional:</span><br /><? if (!empty($reportedObject->additional)) { echo $reportedObject->additional; } else{ echo "N/A"; } ?>
</td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="3" style="padding: 10px 10px; font-size: 18px; text-align: center;">This moderation queue is empty.</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
break;
case "addplatform":
?>
<h2>Add a Platform...</h2>
<p> </p>
<form method="post" action="<?= $baseurl; ?>/admincp/" enctype="multipart/form-data">
<p style="text-align: center;"><img src="<?= $baseurl; ?>/images/common/consoles/png24/console_default.png" style="vertical-align: middle;" /> To create a new platform, enter it's name below.</p>
<p style="text-align: center; font-weight: bold;">Platform Name: <input type="text" name="PlatformTitle" size="60" /><br />
<input type="hidden" name="function" value="Add Platform" />
<input type="submit" name="submit" value="Add New Platform" style="padding: 6px;" /></p>
</form>
<?php
break;
case "addgenre":
?>
<h2>Add a Genre...</h2>
<p> </p>
<form method="post" action="<?= $baseurl; ?>/admincp/" enctype="multipart/form-data">
<p style="text-align: center;"> To create a new genre, enter it's name below.</p>
<p style="text-align: center; font-weight: bold;">Genre Name: <input type="text" name="genreName" size="60" /><br />
<input type="hidden" name="function" value="Add Genre" />
<input type="submit" name="submit" value="Add New Genre" style="padding: 6px;" /></p>
</form>
<p> </p>
<h2>Existing games genres<h2>
<p> </p>
<table align="center" border="1" cellspacing="0" cellpadding="7" bgcolor="#888888">
<tr>
<th style="background-color: #333; color: #FFF;">Id</th>
<th style="background-color: #333; color: #FFF;">Genre</th>
</tr>
<?php
$pubdevQuery = mysql_query(" SELECT * FROM genres ORDER BY genre ASC");
while($pubdevResult = mysql_fetch_object($pubdevQuery))
{
?>
<tr>
<td><?= $pubdevResult->id ?></td>
<td><?= $pubdevResult->genre ?></td>
</tr>
<?php
}
?>
</table>
<?php
break;
case "pubdev":
?>
<h2>Manage Publishers and Developers</h2>
<p> </p>
<p style="text-align: center;"><a style="color: orange;" href="<?= $baseurl ?>/addpub/">Add new Publisher/Developer</a></p>
<table align="center" border="1" cellspacing="0" cellpadding="7" bgcolor="#888888">
<tr>
<th style="background-color: #333; color: #FFF;">Keywords</th>
<th style="background-color: #333; color: #FFF;">Logo</th>
<th style="background-color: #333; color: #FFF;">Action</th>
</tr>
<?php
$pubdevQuery = mysql_query(" SELECT * FROM pubdev ORDER BY keywords ASC");
while($pubdevResult = mysql_fetch_object($pubdevQuery))
{
?>
<tr>
<td><?= $pubdevResult->keywords ?></td>
<?php
if(!file_exists("banners/_admincpcache/publisher-logos/$pubdevResult->logo"))
{
WideImage::load("banners/publisher-logos/$pubdevResult->logo")->resize(400, 60)->saveToFile("banners/_admincpcache/publisher-logos/$pubdevResult->logo");
}
?>
<?php
if($pubdevResult->logo)
{
?>
<td><img src="<?= $baseurl ?>/banners/_admincpcache/publisher-logos/<?= $pubdevResult->logo ?>" style="vertical-align: middle;" /></td>
<?php
}
else
{
echo "<td>Logo Missing</td>";
}
?>
<td><a style="color: orange;" href="<?= $baseurl ?>/updatepub/?publisherid=<?= $pubdevResult->id ?>">Update Keywords & Logo</a></td>
</tr>
<?php
}
?>
</table>
<?php
break;
case "sendpm":
?>
<h2>Send PM to User...</h2>
<form action="<?= $baseurl; ?>/admincp/?cptab=sendpm" method="post">
<span style="float: right;"><input type="submit" name="function" value="Send PM" /></span>
<p><b>Send To:</b> <input type="text" name="pmto" id="pm-to" size="36" /> <a href="#pm-userlist" rel="facebox">User List</a></p>
<p><b>Subject:</b> <input type="text" name="pmsubject" size="36" /></p>
<p><b>Message:</b><br />
<textarea name="pmmessage" style="width: 100%; height: 300px;"></textarea></p>
</form>
<!-- User List-->
<div id="pm-userlist" style="display: none;">
<div style="height: 400px; overflow: auto;">
<p>
<?php
$userlistQuery = mysql_query("SELECT id, username FROM users ORDER BY username ASC");
while($userlist = mysql_fetch_object($userlistQuery))
{
?>
<a href="javascript: void();" onclick="$('#pm-to').val('<?= $userlist->username ?>'); jQuery(document).trigger('close.facebox');"><?= $userlist->username; ?></a><br />
<?php
}
?>
</p>
</div>
</div>
<?php
break;
case "platformalias":
?>
<h2>Generate Platform Alias'...</h2>
<form action="<?= $baseurl; ?>/admincp/?cptab=platformalias" method="post" style="text-align: center; padding: 16px; border: 1px solid #666; background-color: #333; color: #fff; margin: 16px;">
<p style="font-size: 18px;">Press the button below to auto-generate alias's for platforms missing an alias.</p>
<input type="submit" name="function" value="Generate Platform Alias's" style="padding: 16px;" />
</form>
<table align="center" border="1" cellspacing="0" cellpadding="7" bgcolor="#888888">
<tr>
<th style="background-color: #333; color: #FFF;" width="14%">ID</th>
<th style="background-color: #333; color: #FFF;" width="43%">Name</th>
<th style="background-color: #333; color: #FFF;" width="43%">Alias</th>
</tr>
<?php
$platformsResult = mysql_query(" SELECT p.id, p.name, p.alias FROM platforms AS p ORDER BY p.id ");
while($platforms = mysql_fetch_object($platformsResult))
{
if ($class == 'odd') { $class = 'even'; } else { $class = 'odd'; }
?>
<tr class="<?= $class; ?>">
<td align="center"><?= $platforms->id; ?></td>
<td><?= $platforms->name; ?></td>
<td><?php if($platforms->alias == "") { echo "N/A"; } else { echo $platforms->alias; } ?></td>
</tr>
<?php
}
?>
</table>
<?php
break;
case "elasticsearchmanage":
?>
<h2>Manage ElasticSearch Index...</h2>
<h1>Elasticsearch Management Area</h1>
<p> </p>
<p style="text-align: center;"><a class="darkorangeButton" href="<?php echo $baseurl; ?>/admincp/?cptab=elasticsearchmanage&command=createelasticsearchgamesindex">Create ElasticSearch 'TheGamesDB' Index</a></p>
<br>
<hr>
<br>
<p style="text-align: center;"><a class="darkorangeButton" href="<?php echo $baseurl; ?>/admincp/?cptab=elasticsearchmanage&command=populategames">Index/Re-Index Games Table into ElasticSearch</a></p>
<br>
<hr>
<br>
<form action="<?php echo $baseurl; ?>/admincp/" method="post" style="text-align: center;">
<input type="text" name="searchterm" style="width: 80%; margin: auto; font-size: 18px; padding: 5px;" placeholder="Enter Game Title..." />
<input type="hidden" name="cptab" value="elasticsearchmanage" />
<input type="hidden" name="command" value="search" />
<input class="darkorangeButton" type="submit" value="Search Elasticsearch Index for Game" />
</form>
<br>
<hr>
<br>
<p style="text-align: center;"><a class="darkorangeButton" href="<?php echo $baseurl; ?>/adminarea/elastichq/" target="_blank">Launch ElasticHQ Management Portal</a></p>
<br>
<hr>
<br>
<?php
// Main Switchboard
switch ($command)
{
case ('createelasticsearchgamesindex'):
echo '<h2>Create ElasticSearch TheGamesDB Index</h2>';
try {
$indexParams['index'] = 'thegamesdb';
// Example Index Mapping
$myTypeMapping = array(
'_source' => array(
'enabled' => true
),
'PlatformName' => array(
'type' => 'string',
'index' => 'not_analyzed'
)
);
$indexParams['body']['mappings']['game'] = $myTypeMapping;
// Create the index
if ($elasticsearchClient->indices()->create($indexParams))
{
echo '<p style="text-align: center;">ElasticSearch Index \'thegamesdb\' Created Successfully</p>';
}
}
catch (Exception $e)
{
?>
<div style="text-align: center;">
<p><strong>Whoops!</strong> Something went wrong while trying to create the index...</p>
<p><em>Maybe the index 'thegamesdb' already exists, or ElasticSearch was unreachable?</em></p>
<h3>Exception Dump</h3>
<pre><?php echo $e->getMessage(); ?></pre>
</div>
<?php
}
break;
case ('populategames'):
echo '<h2>Populate Elasticsearch With Games Data</h2>';
$dbGamesResult = mysql_query("SELECT `g`.*, `p`.`id` AS `PlatformId`, `p`.`name` AS `PlatformName`, `p`.`alias` AS `PlatformAlias`, `p`.`icon` AS `PlatformIcon` FROM `games` AS `g`, `platforms` AS `p` WHERE `g`.`Platform` = `p`.`id`");
while ($dbGamesRow = mysql_fetch_assoc($dbGamesResult))
{
$searchParams = array();
$searchParams['body'] = $dbGamesRow;
$searchParams['index'] = 'thegamesdb';
$searchParams['type'] = 'game';
$searchParams['id'] = $dbGamesRow['id'];
$ret = $elasticsearchClient->index($searchParams);
var_dump($ret);
}
break;
case ('search'):
echo '<h2>Search Elasticsearch For ' . $searchterm . '</h2>';
// Set initial Search Parameters
$searchParams = array();
$searchParams['index'] = 'thegamesdb';
$searchParams['type'] = 'game';
$searchParams['size'] = 100;
// Check if $search term contains an integer
if (strcspn($searchterm, '0123456789') != strlen($searchterm))
{
echo "<p>Search Term Contains a Number</p>";
// Extract first number found in string