Skip to content

Commit 5babb1c

Browse files
committed
fix argument shift
1 parent d8e6411 commit 5babb1c

File tree

2 files changed

+39
-25
lines changed

2 files changed

+39
-25
lines changed

web/add/dns/index.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
$v_domain = escapeshellarg($v_domain);
3636
$v_domain = strtolower($v_domain);
3737
$v_ip = escapeshellarg($_POST['v_ip']);
38-
if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
39-
if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
40-
if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
41-
if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
42-
if (!empty($_POST['v_ns5'])) $v_ns5 = escapeshellarg($_POST['v_ns5']);
43-
if (!empty($_POST['v_ns6'])) $v_ns6 = escapeshellarg($_POST['v_ns6']);
44-
if (!empty($_POST['v_ns7'])) $v_ns7 = escapeshellarg($_POST['v_ns7']);
45-
if (!empty($_POST['v_ns8'])) $v_ns8 = escapeshellarg($_POST['v_ns8']);
38+
$v_ns1 = escapeshellarg($_POST['v_ns1']);
39+
$v_ns2 = escapeshellarg($_POST['v_ns2']);
40+
$v_ns3 = escapeshellarg($_POST['v_ns3']);
41+
$v_ns4 = escapeshellarg($_POST['v_ns4']);
42+
$v_ns5 = escapeshellarg($_POST['v_ns5']);
43+
$v_ns6 = escapeshellarg($_POST['v_ns6']);
44+
$v_ns7 = escapeshellarg($_POST['v_ns7']);
45+
$v_ns8 = escapeshellarg($_POST['v_ns8']);
4646

4747
// Add dns domain
4848
if (empty($_SESSION['error_msg'])) {

web/api/index.php

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,39 @@
3131
echo 'Error: authentication failed';
3232
exit;
3333
}
34-
35-
// Prepare for iteration
36-
$args = [];
37-
$i = 0;
38-
39-
// Loop through args until there isn't another.
40-
while (true)
41-
{
42-
$i++;
43-
if (!empty($_POST['arg' . $i]))
44-
{
45-
$args[] = $_POST['arg' . $i];
46-
continue;
47-
}
48-
break;
49-
}
34+
35+
// Prepare arguments
36+
if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);
37+
if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']);
38+
if (isset($_POST['arg2'])) $arg2 = escapeshellarg($_POST['arg2']);
39+
if (isset($_POST['arg3'])) $arg3 = escapeshellarg($_POST['arg3']);
40+
if (isset($_POST['arg4'])) $arg4 = escapeshellarg($_POST['arg4']);
41+
if (isset($_POST['arg5'])) $arg5 = escapeshellarg($_POST['arg5']);
42+
if (isset($_POST['arg6'])) $arg6 = escapeshellarg($_POST['arg6']);
43+
if (isset($_POST['arg7'])) $arg7 = escapeshellarg($_POST['arg7']);
44+
if (isset($_POST['arg8'])) $arg8 = escapeshellarg($_POST['arg8']);
45+
if (isset($_POST['arg9'])) $arg9 = escapeshellarg($_POST['arg9']);
5046

5147
// Build query
52-
$cmdquery = VESTA_CMD . $cmd . " " . implode(" ", $args);
48+
$cmdquery = VESTA_CMD.$cmd." ";
49+
if(!empty($arg1)){
50+
$cmdquery = $cmdquery.$arg1." "; }
51+
if(!empty($arg2)){
52+
$cmdquery = $cmdquery.$arg2." "; }
53+
if(!empty($arg3)){
54+
$cmdquery = $cmdquery.$arg3." "; }
55+
if(!empty($arg4)){
56+
$cmdquery = $cmdquery.$arg4." "; }
57+
if(!empty($arg5)){
58+
$cmdquery = $cmdquery.$arg5." "; }
59+
if(!empty($arg6)){
60+
$cmdquery = $cmdquery.$arg6." "; }
61+
if(!empty($arg7)){
62+
$cmdquery = $cmdquery.$arg7." "; }
63+
if(!empty($arg8)){
64+
$cmdquery = $cmdquery.$arg8." "; }
65+
if(!empty($arg9)){
66+
$cmdquery = $cmdquery.$arg9; }
5367

5468
// Check command
5569
if ($cmd == "'v-make-tmp-file'") {

0 commit comments

Comments
 (0)