-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd.php
51 lines (48 loc) · 1.28 KB
/
cmd.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
if (PHP_SAPI !== 'cli')
{
die ('Access denied');
}
chdir(dirname(__FILE__));
require_once 'init.php';
parse_str($argv[1], $_REQUEST);
$class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
$static = isset($_REQUEST['static']) ? $_REQUEST['static'] : '';
$method = isset($_REQUEST['method']) ? $_REQUEST['method'] : '';
try
{
if (class_exists($class))
{
if (method_exists($class, $method))
{
if ($static)
{
$rf = new ReflectionMethod($class, $method);
if ($rf->isStatic())
{
call_user_func(array($class, $method),$_REQUEST);
}
else
{
call_user_func(array(new $class($_GET), $method),$_REQUEST);
}
}
else
{
call_user_func(array(new $class($_GET), $method),$_REQUEST);
}
}
else
{
echo 'Error: ' . TAdiantiCoreTranslator::translate('Method ^1 not found', "$class::$method")."\n";
}
}
else
{
echo 'Error: ' . TAdiantiCoreTranslator::translate('Class ^1 not found', $class)."\n";
}
}
catch (Exception $e)
{
echo 'Error: ' . $e->getMessage();
}