Skip to content

Commit c28dea8

Browse files
committed
Updated formatting
1 parent b82e086 commit c28dea8

File tree

6 files changed

+111
-95
lines changed

6 files changed

+111
-95
lines changed

api2/index.php

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
const debugOn = false;
44

5-
set_error_handler(function($n, $msg, $file, $line){
5+
set_error_handler(function ($n, $msg, $file, $line){
66
header("Content-Type: text/plain");
77
echo "Error: $msg at $file#$line";
88
http_response_code(500);
99
exit;
1010
});
1111
if(isset($_FILES["phar"])){
1212
$newApi = "2.0.0";
13-
if(isset($_REQUEST["diffapi"]) and $_REQUEST["diffapi"] === "on" and isset($_REQUEST["api"])) $newApi = $_REQUEST["api"];
13+
if(isset($_REQUEST["diffapi"]) and $_REQUEST["diffapi"] === "on" and isset($_REQUEST["api"])){
14+
$newApi = $_REQUEST["api"];
15+
}
1416
$path = $_FILES["phar"]["tmp_name"];
1517
$extended = $path . ".phar";
1618
move_uploaded_File($path, $extended);
@@ -23,7 +25,9 @@
2325
}
2426
$contents = file_get_contents($phar["plugin.yml"]);
2527
$yaml = yaml_parse($contents);
26-
if(!is_array($yaml["api"])) $yaml["api"] = [$yaml["api"]];
28+
if(!is_array($yaml["api"])){
29+
$yaml["api"] = [$yaml["api"]];
30+
}
2731
if(in_array($newApi, $yaml["api"])){
2832
header("Content-Type: text/plain");
2933
echo "API version $newApi is already declared.";
@@ -33,7 +37,9 @@
3337
$contents = yaml_emit($yaml);
3438
$phar->addFromString("plugin.yml", $contents);
3539

36-
if(debugOn) header("Content-Type: text/plain");
40+
if(debugOn){
41+
header("Content-Type: text/plain");
42+
}
3743

3844
$replaceUse = ($_REQUEST["nbt-use"] ?? "off") === "on";
3945
$replaceFQN = ($_REQUEST["nbt-fqn"] ?? "off") === "on";
@@ -52,7 +58,7 @@
5258
"Enum" => "ListTag",
5359
"Long" => "LongTag",
5460
"Short" => "ShortTag",
55-
"String" => "StringTag"
61+
"String" => "StringTag",
5662
];
5763
foreach(new \RecursiveIteratorIterator($phar) as $localName => $file){
5864
$fn = $file->getFileName();
@@ -63,7 +69,7 @@
6369
$ns = "pocketmine\\nbt\\tag\\";
6470
$quotedNs = preg_quote($ns);
6571
$names = implode("|", array_map("preg_quote", array_keys($refactorTable)));
66-
$c = preg_replace_callback("/use[ \t\n\r]+$quotedNs($names)[ \t\n\r]*;/i", function($match) use($ns, $refactorTable){
72+
$c = preg_replace_callback("/use[ \t\n\r]+$quotedNs($names)[ \t\n\r]*;/i", function ($match) use ($ns, $refactorTable){
6773
return "use $ns" . $refactorTable[$match[1]] . ";";
6874
}, $c);
6975
}
@@ -78,15 +84,15 @@
7884
$ns = "pocketmine\\nbt\\tag\\";
7985
$quotedNs = preg_quote($ns);
8086
$names = implode("|", array_map("preg_quote", array_keys($refactorTable)));
81-
$c = preg_replace_callback("/new[ \t\n\r]+($names)[ \t\n\r]*([\(\);,])/i", function($match) use($ns, $refactorTable){
87+
$c = preg_replace_callback("/new[ \t\n\r]+($names)[ \t\n\r]*([\(\);,])/i", function ($match) use ($ns, $refactorTable){
8288
return "new " . $refactorTable[$match[1]] . $match[2];
8389
}, $c);
8490
}
8591
if($replaceInstanceOf){
8692
$ns = "pocketmine\\nbt\\tag\\";
8793
$quotedNs = preg_quote($ns);
8894
$names = implode("|", array_map("preg_quote", array_keys($refactorTable)));
89-
$c = preg_replace_callback("/instanceof[ \t\n\r]+$quotedNs($names)/i", function($match) use($ns, $refactorTable){
95+
$c = preg_replace_callback("/instanceof[ \t\n\r]+$quotedNs($names)/i", function ($match) use ($ns, $refactorTable){
9096
return "instanceof " . $refactorTable[$match[1]];
9197
}, $c);
9298
}
@@ -115,33 +121,41 @@
115121
<title>Plugin API version bumper</title>
116122
</head>
117123
<body>
118-
<h1>API 2.0.0 injection</h1>
119-
<p>Before using this tool, please carefully read the following caution:</p>
124+
<h1>API 2.0.0 injection</h1>
125+
<p>Before using this tool, please carefully read the following caution:</p>
126+
<ul>
127+
<li>This tool only <em>forces</em> the plugin to say that it supports API 2.0.0 (PHP 7 update), and optionally,
128+
blindly replaces some specific backwards-incompatible changes in the phar. It will not fix the actual
129+
incompatibility issues.
130+
</li>
131+
<li>If errors happen after using phars downloaded from this page, unintsall it immediately.</li>
132+
<li>Click <span
133+
onclick='alert("Thanks for carefully reading the caution!"); document.getElementById("upload").disabled = false;'>these three words</span>
134+
if you have read the above.
135+
</li>
136+
</ul>
137+
<hr>
138+
<form action="updated.phar" method="post" enctype="multipart/form-data">
139+
<p><input type="file" name="phar"></p>
120140
<ul>
121-
<li>This tool only <em>forces</em> the plugin to say that it supports API 2.0.0 (PHP 7 update), and optionally, blindly replaces some specific backwards-incompatible changes in the phar. It will not fix the actual incompatibility issues.</li>
122-
<li>If errors happen after using phars downloaded from this page, unintsall it immediately.</li>
123-
<li>Click <span onclick='alert("Thanks for carefully reading the caution!"); document.getElementById("upload").disabled = false;'>these three words</span> if you have read the above.</li>
141+
<li>
142+
<input type="checkbox" name="diffapi" onclick='document.getElementById("apiInput").disabled = false;'> No, I
143+
don't want API <code>2.0.0</code>.
144+
I want something else: <input id="apiInput" type="text" name="api" value="2.0.0" disabled>
145+
</li>
146+
<li>
147+
Replace the following usage of NBT tags:
148+
<ul>
149+
<li><input type="checkbox" name="nbt-use" checked> <code>use pocketmine\nbt\tag\****Tag</code></li>
150+
<li><input type="checkbox" name="nbt-fqn" checked> fully-qualified
151+
<code>\pocketmine\nbt\tag\****Tag</code></li>
152+
<li><input type="checkbox" name="nbt-new" checked> <code>new ****Tag</code></li>
153+
<li><input type="checkbox" name="nbt-instanceof" checked> <code>instanceof ****Tag</code></li>
154+
</ul>
155+
</li>
124156
</ul>
125-
<hr>
126-
<form action="updated.phar" method="post" enctype="multipart/form-data">
127-
<p><input type="file" name="phar"></p>
128-
<ul>
129-
<li>
130-
<input type="checkbox" name="diffapi" onclick='document.getElementById("apiInput").disabled = false;'> No, I don't want API <code>2.0.0</code>.
131-
I want something else: <input id="apiInput" type="text" name="api" value="2.0.0" disabled>
132-
</li>
133-
<li>
134-
Replace the following usage of NBT tags:
135-
<ul>
136-
<li><input type="checkbox" name="nbt-use" checked> <code>use pocketmine\nbt\tag\****Tag</code></li>
137-
<li><input type="checkbox" name="nbt-fqn" checked> fully-qualified <code>\pocketmine\nbt\tag\****Tag</code></li>
138-
<li><input type="checkbox" name="nbt-new" checked> <code>new ****Tag</code></li>
139-
<li><input type="checkbox" name="nbt-instanceof" checked> <code>instanceof ****Tag</code></li>
140-
</ul>
141-
</li>
142-
</ul>
143-
<p><input type="submit" id="upload" value="Inject" disabled></p>
144-
</form>
157+
<p><input type="submit" id="upload" value="Inject" disabled></p>
158+
</form>
145159
</body>
146160
</html>
147161

functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function deldir($dir){
105105
rmdir($dir);
106106
}
107107

108-
define("PRIV_DATA", SERVER_PATH . "privdata\\");
108+
define("PRIV_DATA", SERVER_PATH . "privdata/");
109109
@mkdir(PRIV_DATA);
110110

111111
function randomClass($length, $init = "_"){

insta/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function reloadMe(){
145145
<br>
146146
Languages:
147147
<?php foreach($langs as $lang => $cnt): ?>
148-
<span class="lang-data" title="<?= $cnt / $sum * 100 ?>%"
148+
<span class="lang-data" title="<?= round($cnt / $sum * 100, 2) ?>%"
149149
style="font-size: <?= 50 + $cnt / $sum * 150 ?>%"><?= $lang ?></span>
150150
<?php endforeach; ?><br>
151151
<button onclick='window.open(<?= json_encode($gist["html_url"]) ?>);'>Open on GitHub Gist</button>

perm/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<?php
2-
if(strpos(getallheaders()["Accept"], "json") !== false) echo json_encode(yaml_parse_file("perm.yml"), JSON_PRETTY_PRINT);
2+
if(strpos(getallheaders()["Accept"], "json") !== false){
3+
echo json_encode(yaml_parse_file("perm.yml"), JSON_PRETTY_PRINT);
4+
}
35

perm/perm.json

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
[
2-
"pocketmine",
3-
"pocketmine.broadcast",
4-
"pocketmine.broadcast.admin",
5-
"pocketmine.broadcast.user",
6-
"pocketmine.command",
7-
"pocketmine.command.whitelist",
8-
"pocketmine.command.whitelist.add",
9-
"pocketmine.command.whitelist.remove",
10-
"pocketmine.command.whitelist.reload",
11-
"pocketmine.command.whitelist.enable",
12-
"pocketmine.command.whitelist.disable",
13-
"pocketmine.command.whitelist.list",
14-
"pocketmine.command.ban",
15-
"pocketmine.command.ban.player",
16-
"pocketmine.command.ban.ip",
17-
"pocketmine.command.unban",
18-
"pocketmine.command.unban.player",
19-
"pocketmine.command.unban.ip",
20-
"pocketmine.command.op",
21-
"pocketmine.command.op.give",
22-
"pocketmine.command.op.take",
23-
"pocketmine.command.save",
24-
"pocketmine.command.save.enable",
25-
"pocketmine.command.save.disable",
26-
"pocketmine.command.save.perform",
27-
"pocketmine.command.time",
28-
"pocketmine.command.time.add",
29-
"pocketmine.command.time.set",
30-
"pocketmine.command.time.start",
31-
"pocketmine.command.time.stop",
32-
"pocketmine.command.time.query",
33-
"pocketmine.command.kill",
34-
"pocketmine.command.kill.self",
35-
"pocketmine.command.kill.other",
36-
"pocketmine.command.me",
37-
"pocketmine.command.tell",
38-
"pocketmine.command.say",
39-
"pocketmine.command.give",
40-
"pocketmine.command.effect",
41-
"pocketmine.command.enchant",
42-
"pocketmine.command.particle",
43-
"pocketmine.command.teleport",
44-
"pocketmine.command.kick",
45-
"pocketmine.command.stop",
46-
"pocketmine.command.list",
47-
"pocketmine.command.help",
48-
"pocketmine.command.plugins",
49-
"pocketmine.command.reload",
50-
"pocketmine.command.version",
51-
"pocketmine.command.gamemode",
52-
"pocketmine.command.defaultgamemode",
53-
"pocketmine.command.seed",
54-
"pocketmine.command.status",
55-
"pocketmine.command.gc",
56-
"pocketmine.command.dumpmemory",
57-
"pocketmine.command.timings",
58-
"pocketmine.command.spawnpoint",
59-
"pocketmine.command.setworldspawn"
2+
"pocketmine",
3+
"pocketmine.broadcast",
4+
"pocketmine.broadcast.admin",
5+
"pocketmine.broadcast.user",
6+
"pocketmine.command",
7+
"pocketmine.command.whitelist",
8+
"pocketmine.command.whitelist.add",
9+
"pocketmine.command.whitelist.remove",
10+
"pocketmine.command.whitelist.reload",
11+
"pocketmine.command.whitelist.enable",
12+
"pocketmine.command.whitelist.disable",
13+
"pocketmine.command.whitelist.list",
14+
"pocketmine.command.ban",
15+
"pocketmine.command.ban.player",
16+
"pocketmine.command.ban.ip",
17+
"pocketmine.command.unban",
18+
"pocketmine.command.unban.player",
19+
"pocketmine.command.unban.ip",
20+
"pocketmine.command.op",
21+
"pocketmine.command.op.give",
22+
"pocketmine.command.op.take",
23+
"pocketmine.command.save",
24+
"pocketmine.command.save.enable",
25+
"pocketmine.command.save.disable",
26+
"pocketmine.command.save.perform",
27+
"pocketmine.command.time",
28+
"pocketmine.command.time.add",
29+
"pocketmine.command.time.set",
30+
"pocketmine.command.time.start",
31+
"pocketmine.command.time.stop",
32+
"pocketmine.command.time.query",
33+
"pocketmine.command.kill",
34+
"pocketmine.command.kill.self",
35+
"pocketmine.command.kill.other",
36+
"pocketmine.command.me",
37+
"pocketmine.command.tell",
38+
"pocketmine.command.say",
39+
"pocketmine.command.give",
40+
"pocketmine.command.effect",
41+
"pocketmine.command.enchant",
42+
"pocketmine.command.particle",
43+
"pocketmine.command.teleport",
44+
"pocketmine.command.kick",
45+
"pocketmine.command.stop",
46+
"pocketmine.command.list",
47+
"pocketmine.command.help",
48+
"pocketmine.command.plugins",
49+
"pocketmine.command.reload",
50+
"pocketmine.command.version",
51+
"pocketmine.command.gamemode",
52+
"pocketmine.command.defaultgamemode",
53+
"pocketmine.command.seed",
54+
"pocketmine.command.status",
55+
"pocketmine.command.gc",
56+
"pocketmine.command.dumpmemory",
57+
"pocketmine.command.timings",
58+
"pocketmine.command.spawnpoint",
59+
"pocketmine.command.setworldspawn"
6060
]

pocketmine-frame-up.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://github.com/PEMapModder/web-server-source/issues" target="_blank">the issue tracker</a>.
1212
When you create a report, please provide as much information as possible.
1313
<br>
14-
This website is authored by <a href="https://github.com/PEMapModder">PEMapModder</a> (with help from many people) and is hosted by <a href="https://www.michael.yoo.id.au">sekjun9878</a>.
14+
This website is authored by <a href="https://github.com/PEMapModder">PEMapModder</a> (with help from many people) and is hosted by techplayer.org.
1515
</font>
1616
<a name="bottom"></a>
1717
</body></html>

0 commit comments

Comments
 (0)