Skip to content

Commit ebb5407

Browse files
committed
Disable validation when resource limits are not enabled.
1 parent 5d8c98b commit ebb5407

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

web/add/package/index.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
$errors[] = _("Rate Limit");
8585
}
8686

87-
if ($_SESSION['RESOURCES_LIMIT'] == 'yes') {
87+
if ($_SESSION["RESOURCES_LIMIT"] == "yes") {
8888
if (!isset($_POST["v_cpu_quota"])) {
8989
$errors[] = _("CPU quota");
9090
}
@@ -149,10 +149,16 @@
149149
$v_bandwidth = quoteshellarg($_POST["v_bandwidth"]);
150150
$v_ratelimit = quoteshellarg($_POST["v_ratelimit"]);
151151

152-
$v_cpu_quota = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_cpu_quota"]) : '';
153-
$v_cpu_quota_period = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_cpu_quota_period"]) : '';
154-
$v_memory_limit = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_memory_limit"]) : '';
155-
$v_swap_limit = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_swap_limit"]) : '';
152+
$v_cpu_quota =
153+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_cpu_quota"]) : "";
154+
$v_cpu_quota_period =
155+
$_SESSION["RESOURCES_LIMIT"] == "yes"
156+
? quoteshellarg($_POST["v_cpu_quota_period"])
157+
: "";
158+
$v_memory_limit =
159+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_memory_limit"]) : "";
160+
$v_swap_limit =
161+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_swap_limit"]) : "";
156162

157163
$v_ns1 = !empty($_POST["v_ns1"]) ? trim($_POST["v_ns1"], ".") : "";
158164
$v_ns2 = !empty($_POST["v_ns2"]) ? trim($_POST["v_ns2"], ".") : "";

web/edit/package/index.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
$errors[] = _("Bandwidth");
198198
}
199199

200-
if ($_SESSION['RESOURCES_LIMIT'] == 'yes') {
200+
if ($_SESSION["RESOURCES_LIMIT"] == "yes") {
201201
if (!isset($_POST["v_cpu_quota"])) {
202202
$errors[] = _("CPU quota");
203203
}
@@ -276,10 +276,14 @@
276276
$v_disk_quota = quoteshellarg($_POST["v_disk_quota"]);
277277
$v_bandwidth = quoteshellarg($_POST["v_bandwidth"]);
278278

279-
$v_cpu_quota = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_cpu_quota"]) : '';
280-
$v_cpu_quota_period = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_cpu_quota_period"]) : '';
281-
$v_memory_limit = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_memory_limit"]) : '';
282-
$v_swap_limit = $_SESSION['RESOURCES_LIMIT'] == 'yes' ? quoteshellarg($_POST["v_swap_limit"]) : '';
279+
$v_cpu_quota =
280+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_cpu_quota"]) : "";
281+
$v_cpu_quota_period =
282+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_cpu_quota_period"]) : "";
283+
$v_memory_limit =
284+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_memory_limit"]) : "";
285+
$v_swap_limit =
286+
$_SESSION["RESOURCES_LIMIT"] == "yes" ? quoteshellarg($_POST["v_swap_limit"]) : "";
283287

284288
$v_ns1 = !empty($_POST["v_ns1"]) ? trim($_POST["v_ns1"], ".") : "";
285289
$v_ns2 = !empty($_POST["v_ns2"]) ? trim($_POST["v_ns2"], ".") : "";

0 commit comments

Comments
 (0)