-
Notifications
You must be signed in to change notification settings - Fork 1
/
blakserv.php
51 lines (39 loc) · 1.05 KB
/
blakserv.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
<?php
/**
* Before using this script for the first time, please run `composer install`.
*/
require "vendor/autoload.php";
use App\Blakserv\Commands;
$command = "";
if ( isset($_SERVER['argv']) )
{
// CLI
$command = trim(str_replace($_SERVER['SCRIPT_FILENAME'], '', join(" ", $_SERVER['argv'])));
}else{
// Web - Kill it without authentication...
dd("You are not allowed to run this script in a Web Browser.");
die(); // paranoid?
exit(); // wow just in case.. :)
}
if ( ! $command )
{
dd("No commands to process...");
}
$available_commands = Commands::COMMANDS;
//dd($available_commands);
/**
* Check if we are allowed to use this Blakserv function first.
*/
foreach($available_commands as $available_command)
{
if ( isset($available_command['method']) && $available_command['method'] == $command)
{
$m59 = new Commands();
$m59->$command();
exit();
}
}
/**
* Check for allowed game commands
*/
dd(["AVAILABLE COMMANDS" => $available_commands]);