-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddranks.php
92 lines (77 loc) · 1.86 KB
/
addranks.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
<?php
// AcmlmBoard XD - Rankset import tool
// Access: administrators
include("lib/common.php");
AssertForbidden("addRanks");
if($loguser['powerlevel'] < 3)
Kill(__("You must be an administrator to import ranksets."));
Query("truncate table ranks");
Query("truncate table ranksets");
include("ranksets.php");
$bads = array(" ","-",".",",", "'", '"');
write(
"
<table class=\"outline margin width25\">
<tr class=\"header1\">
<th>
".__("Postcount")."
</th>
<th>
".__("Rank")."
</th>
</tr>
");
foreach($ranks as $rankset)
{
write(
"
<tr class=\"header0\">
<th colspan=\"2\">
{0}
</th>
</tr>
", $rankset['name']);
if(!$rankset['directory'])
$rankset['directory'] = strtolower($rankset['name']);
$index++;
$description = format(__("Set index is {0}. Base directory is {1}."), $index, "<a href=\"img/ranks/".$rankset['directory']."/\"><code>".$rankset['directory']."</code></a>");
if($rankset['notolower'])
$description .= " ".__("Set does not use lowercase filenames.");
if($rankset['noimages'])
$description .= " ".__("Set is text-only.");
write(
"
<tr class=\"cell1\">
<td colspan=\"2\">
{0}
</td>
</tr>
", $description);
Query("insert into ranksets (name) values ('".$rankset['name']."')");
foreach($rankset['ranks'] as $val => $text)
{
$img = "<img src=\"img/ranks/".$rankset['directory']."/".str_replace($bads,"",(!$rankset['notolower']?strtolower($text):$text)).".png\" alt=\"".$text."\" /> ".($rankset['splitlines'] ? "<br />" : "").$text;
if($val < 10 || $rankset['noimages'])
$img = $text;
write(
"
<tr class=\"cell0\">
<td>
{0}
</td>
<td>
{1}
</td>
</tr>
", $val, $img);
Query("insert into ranks (rset, num, text) values (".$index.", ".$val.", '".justEscape($img)."')");
}
}
write(
"
</table>
<div>
".__("The above ranks and sets have been imported.")."
</div>
");
?>