forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
50 lines (42 loc) · 1.12 KB
/
index.php
File metadata and controls
50 lines (42 loc) · 1.12 KB
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
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
$TAB = "SERVER";
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check user
if ($_SESSION["userContext"] !== "admin" && $user_plain === "$ROOT_USER") {
header("Location: /list/user");
exit();
}
// Check POST request
if (!empty($_POST["save"])) {
if (!empty($_POST["v_config"])) {
$fp = tmpfile();
$new_conf = stream_get_meta_data($fp)["uri"];
$config = str_replace("\r\n", "\n", $_POST["v_config"]);
if (!str_ends_with($config, "\n")) {
$config .= "\n";
}
fwrite($fp, $config);
exec(
HESTIA_CMD .
"v-change-sys-service-config " .
quoteshellarg($new_conf) .
" hestiaweb yes",
$output,
$return_var,
);
check_return_code($return_var, $output);
unset($output);
fclose($fp);
}
}
$v_config_path = "/var/spool/cron/crontabs/hestiaweb";
$v_service_name = _("Panel Cronjobs");
// Read config
$v_config = shell_exec(HESTIA_CMD . "v-open-fs-config " . $v_config_path);
// Render page
render_page($user, $TAB, "edit_server_service");
// Flush session messages
unset($_SESSION["error_msg"]);
unset($_SESSION["ok_msg"]);