Skip to content

Commit 6944201

Browse files
committed
More intelegent way to pass arguments to the CLI
1 parent 04e252d commit 6944201

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

web/api/index.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
}
2929

3030
// Prepare arguments
31-
$cmd = escapeshellarg($_POST['cmd']);
32-
$arg1 = escapeshellarg($_POST['arg1']);
33-
$arg2 = escapeshellarg($_POST['arg2']);
34-
$arg3 = escapeshellarg($_POST['arg3']);
35-
$arg4 = escapeshellarg($_POST['arg4']);
36-
$arg5 = escapeshellarg($_POST['arg5']);
37-
$arg6 = escapeshellarg($_POST['arg6']);
38-
$arg7 = escapeshellarg($_POST['arg7']);
39-
$arg8 = escapeshellarg($_POST['arg8']);
40-
$arg9 = escapeshellarg($_POST['arg9']);
31+
if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);
32+
if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']);
33+
if (isset($_POST['arg2'])) $arg2 = escapeshellarg($_POST['arg2']);
34+
if (isset($_POST['arg3'])) $arg3 = escapeshellarg($_POST['arg3']);
35+
if (isset($_POST['arg4'])) $arg4 = escapeshellarg($_POST['arg4']);
36+
if (isset($_POST['arg5'])) $arg5 = escapeshellarg($_POST['arg5']);
37+
if (isset($_POST['arg6'])) $arg6 = escapeshellarg($_POST['arg6']);
38+
if (isset($_POST['arg7'])) $arg7 = escapeshellarg($_POST['arg7']);
39+
if (isset($_POST['arg8'])) $arg8 = escapeshellarg($_POST['arg8']);
40+
if (isset($_POST['arg9'])) $arg9 = escapeshellarg($_POST['arg9']);
4141

4242
// Run query
4343
exec (VESTA_CMD.$cmd." ".$arg1." ".$arg2." ".$arg3." ".$arg4." ".$arg5." ".$arg6." ".$arg7." ".$arg8." ".$arg9, $output, $return_var);

0 commit comments

Comments
 (0)