index.php 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. $TAB = "SERVER";
  4. // Main include
  5. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  6. // Check user
  7. if ($_SESSION["userContext"] != "admin") {
  8. header("Location: /list/user");
  9. exit();
  10. }
  11. // Get server hostname
  12. $v_hostname = exec("hostname");
  13. // List available timezones and get current one
  14. exec(HESTIA_CMD . "v-get-sys-timezone", $output, $return_var);
  15. $v_timezone = $output[0];
  16. unset($output);
  17. exec(HESTIA_CMD . "v-get-sys-timezones json", $output, $return_var);
  18. $v_timezones = json_decode(implode("", $output), true);
  19. unset($output);
  20. // List supported php versions
  21. exec(HESTIA_CMD . "v-list-web-templates-backend json", $output, $return_var);
  22. $backend_templates = json_decode(implode("", $output), true);
  23. unset($output);
  24. $v_php_versions = [
  25. "php-5.6",
  26. "php-7.0",
  27. "php-7.1",
  28. "php-7.2",
  29. "php-7.3",
  30. "php-7.4",
  31. "php-8.0",
  32. "php-8.1",
  33. "php-8.2",
  34. ];
  35. sort($v_php_versions);
  36. if (empty($backend_templates)) {
  37. $v_php_versions = [];
  38. }
  39. $backends_active = backendtpl_with_webdomains();
  40. $v_php_versions = array_map(function ($php_version) use ($backend_templates, $backends_active) {
  41. // Mark installed php versions
  42. if (stripos($php_version, "php") !== 0) {
  43. return false;
  44. }
  45. $phpinfo = (object) [
  46. "name" => $php_version,
  47. "tpl" => strtoupper(str_replace(".", "_", $php_version)),
  48. "version" => str_ireplace("php-", "", $php_version),
  49. "usedby" => [],
  50. "installed" => false,
  51. "protected" => false,
  52. ];
  53. if (in_array($phpinfo->tpl, $backend_templates)) {
  54. $phpinfo->installed = true;
  55. }
  56. if (array_key_exists($phpinfo->tpl, $backends_active)) {
  57. // Prevent used php version to be removed
  58. if ($phpinfo->installed) {
  59. $phpinfo->protected = true;
  60. }
  61. $phpinfo->usedby = $backends_active[$phpinfo->tpl];
  62. }
  63. if ($phpinfo->name == DEFAULT_PHP_VERSION) {
  64. // Prevent default php version to be removed
  65. if ($phpinfo->installed) {
  66. $phpinfo->protected = true;
  67. }
  68. if (!empty($backends_active["default"])) {
  69. $phpinfo->usedby = array_merge_recursive($phpinfo->usedby, $backends_active["default"]);
  70. }
  71. }
  72. return $phpinfo;
  73. }, $v_php_versions);
  74. // List languages
  75. exec(HESTIA_CMD . "v-list-sys-languages json", $output, $return_var);
  76. $language = json_decode(implode("", $output), true);
  77. foreach ($language as $lang) {
  78. $languages[$lang] = translate_json($lang);
  79. }
  80. asort($languages);
  81. unset($output);
  82. // List themes
  83. exec(HESTIA_CMD . "v-list-sys-themes json", $output, $return_var);
  84. $theme = json_decode(implode("", $output), true);
  85. unset($output);
  86. // List dns cluster hosts
  87. exec(HESTIA_CMD . "v-list-remote-dns-hosts json", $output, $return_var);
  88. $dns_cluster = json_decode(implode("", $output), true);
  89. unset($output);
  90. if (is_array($dns_cluster)) {
  91. foreach ($dns_cluster as $key => $value) {
  92. $v_dns_cluster = "yes";
  93. }
  94. }
  95. if (empty($v_dns_cluster)) {
  96. $v_dns_cluster = "";
  97. }
  98. $v_release_branch = $_SESSION["RELEASE_BRANCH"];
  99. // List smtp relay settings
  100. if (!empty($_SESSION["SMTP_RELAY"])) {
  101. $v_smtp_relay = $_SESSION["SMTP_RELAY"];
  102. } else {
  103. $v_smtp_relay = "";
  104. }
  105. if (!empty($_SESSION["SMTP_RELAY_HOST"])) {
  106. $v_smtp_relay_host = $_SESSION["SMTP_RELAY_HOST"];
  107. } else {
  108. $v_smtp_relay_host = "";
  109. }
  110. if (!empty($_SESSION["SMTP_RELAY_PORT"])) {
  111. $v_smtp_relay_port = $_SESSION["SMTP_RELAY_PORT"];
  112. } else {
  113. $v_smtp_relay_port = "";
  114. }
  115. if (!empty($_SESSION["SMTP_RELAY_USER"])) {
  116. $v_smtp_relay_user = $_SESSION["SMTP_RELAY_USER"];
  117. } else {
  118. $v_smtp_relay_user = "";
  119. }
  120. $v_smtp_relay_pass = "";
  121. if (empty($_POST["v_experimental_features"])) {
  122. $_POST["v_experimental_features"] = "false";
  123. }
  124. if (empty($_POST["v_policy_user_view_suspended"])) {
  125. $_POST["v_policy_user_view_suspended"] = "false";
  126. }
  127. // List Database hosts
  128. exec(HESTIA_CMD . "v-list-database-hosts json", $output, $return_var);
  129. $db_hosts = json_decode(implode("", $output), true);
  130. unset($output);
  131. $v_mysql_hosts = array_values(
  132. array_filter($db_hosts, function ($host) {
  133. return $host["TYPE"] === "mysql";
  134. }),
  135. );
  136. $v_mysql = count($v_mysql_hosts) ? "yes" : "no";
  137. $v_pgsql_hosts = array_values(
  138. array_filter($db_hosts, function ($host) {
  139. return $host["TYPE"] === "pgsql";
  140. }),
  141. );
  142. $v_pgsql = count($v_pgsql_hosts) ? "yes" : "no";
  143. unset($db_hosts);
  144. // List backup settings
  145. $v_backup_dir = "/backup";
  146. if (!empty($_SESSION["BACKUP"])) {
  147. $v_backup_dir = $_SESSION["BACKUP"];
  148. }
  149. $v_backup_gzip = "5";
  150. if (!empty($_SESSION["BACKUP_GZIP"])) {
  151. $v_backup_gzip = $_SESSION["BACKUP_GZIP"];
  152. }
  153. $v_backup_mode = "gzip";
  154. if (!empty($_SESSION["BACKUP_MODE"])) {
  155. $v_backup_mode = $_SESSION["BACKUP_MODE"];
  156. }
  157. $backup_types = explode(",", $_SESSION["BACKUP_SYSTEM"]);
  158. foreach ($backup_types as $backup_type) {
  159. if ($backup_type == "local") {
  160. $v_backup = "yes";
  161. } else {
  162. exec(
  163. HESTIA_CMD . "v-list-backup-host " . quoteshellarg($backup_type) . " json",
  164. $output,
  165. $return_var,
  166. );
  167. $v_remote_backup = json_decode(implode("", $output), true);
  168. unset($output);
  169. if (in_array($backup_type, ["ftp", "sftp"])) {
  170. $v_backup_host = $v_remote_backup[$backup_type]["HOST"];
  171. $v_backup_type = $v_remote_backup[$backup_type]["TYPE"];
  172. $v_backup_username = $v_remote_backup[$backup_type]["USERNAME"] ?? "";
  173. $v_backup_password = "";
  174. $v_backup_port = $v_remote_backup[$backup_type]["PORT"] ?? "";
  175. $v_backup_bpath = $v_remote_backup[$backup_type]["BPATH"];
  176. $v_backup_remote_adv = "yes";
  177. } elseif (in_array($backup_type, ["b2"])) {
  178. $v_backup_bucket = $v_remote_backup[$backup_type]["BUCKET"];
  179. $v_backup_type = $v_remote_backup[$backup_type]["TYPE"];
  180. $v_backup_application_id = $v_remote_backup[$backup_type]["B2_KEY_ID"];
  181. $v_backup_application_key = "";
  182. $v_backup_remote_adv = "yes";
  183. } elseif (in_array($backup_type, ["rclone"])) {
  184. $v_backup_type = $v_remote_backup[$backup_type]["TYPE"];
  185. $v_rclone_host = $v_remote_backup[$backup_type]["HOST"];
  186. $v_rclone_path = $v_remote_backup[$backup_type]["BPATH"];
  187. $v_backup_remote_adv = "yes";
  188. }
  189. }
  190. }
  191. if (empty($v_backup)) {
  192. $v_backup = "";
  193. }
  194. if (empty($v_backup_host)) {
  195. $v_backup_host = "";
  196. }
  197. if (empty($v_backup_type)) {
  198. $v_backup_type = "";
  199. }
  200. if (empty($v_backup_username)) {
  201. $v_backup_username = "";
  202. }
  203. if (empty($v_backup_password)) {
  204. $v_backup_password = "";
  205. }
  206. if (empty($v_backup_port)) {
  207. $v_backup_port = "";
  208. }
  209. if (empty($v_backup_bpath)) {
  210. $v_backup_bpath = "";
  211. }
  212. if (empty($v_backup_bucket)) {
  213. $v_backup_bucket = "";
  214. }
  215. if (empty($v_backup_application_id)) {
  216. $v_backup_application_id = "";
  217. }
  218. if (empty($v_backup_application_key)) {
  219. $v_backup_application_key = "";
  220. }
  221. if (empty($v_backup_remote_adv)) {
  222. $v_backup_remote_adv = "";
  223. }
  224. if (empty($v_rclone_host)) {
  225. $v_rclone_host = "";
  226. }
  227. if (empty($v_rclone_path)) {
  228. $v_rclone_path = "";
  229. }
  230. // List ssl certificate info
  231. exec(HESTIA_CMD . "v-list-sys-hestia-ssl json", $output, $return_var);
  232. $ssl_str = json_decode(implode("", $output), true);
  233. unset($output);
  234. $v_ssl_crt = $ssl_str["HESTIA"]["CRT"];
  235. $v_ssl_key = $ssl_str["HESTIA"]["KEY"];
  236. $v_ssl_ca = $ssl_str["HESTIA"]["CA"];
  237. $v_ssl_subject = $ssl_str["HESTIA"]["SUBJECT"];
  238. $v_ssl_aliases = $ssl_str["HESTIA"]["ALIASES"];
  239. $v_ssl_not_before = $ssl_str["HESTIA"]["NOT_BEFORE"];
  240. $v_ssl_not_after = $ssl_str["HESTIA"]["NOT_AFTER"];
  241. $v_ssl_signature = $ssl_str["HESTIA"]["SIGNATURE"];
  242. $v_ssl_pub_key = $ssl_str["HESTIA"]["PUB_KEY"];
  243. $v_ssl_issuer = $ssl_str["HESTIA"]["ISSUER"];
  244. // Check POST request
  245. if (!empty($_POST["save"])) {
  246. $require_refresh = false;
  247. // Check token
  248. verify_csrf($_POST);
  249. // Change hostname
  250. if (!empty($_POST["v_hostname"]) && $v_hostname != $_POST["v_hostname"]) {
  251. exec(
  252. HESTIA_CMD . "v-change-sys-hostname " . quoteshellarg($_POST["v_hostname"]),
  253. $output,
  254. $return_var,
  255. );
  256. check_return_code($return_var, $output);
  257. unset($output);
  258. $v_hostname = $_POST["v_hostname"];
  259. }
  260. if ($_SESSION["WEB_BACKEND"] == "php-fpm") {
  261. // Install/remove php versions
  262. if (empty($_SESSION["error_msg"])) {
  263. if (!empty($v_php_versions)) {
  264. $post_php = $_POST["v_php_versions"];
  265. if (empty($post_php)) {
  266. $post_php = [];
  267. }
  268. array_map(function ($php_version) use ($post_php) {
  269. if (array_key_exists($php_version->tpl, $post_php)) {
  270. if (!$php_version->installed) {
  271. exec(
  272. HESTIA_CMD .
  273. "v-add-web-php " .
  274. quoteshellarg($php_version->version),
  275. $output,
  276. $return_var,
  277. );
  278. check_return_code($return_var, $output);
  279. unset($output);
  280. if (empty($_SESSION["error_msg"])) {
  281. $php_version->installed = true;
  282. }
  283. }
  284. } else {
  285. if ($php_version->installed && !$php_version->protected) {
  286. exec(
  287. HESTIA_CMD .
  288. "v-delete-web-php " .
  289. quoteshellarg($php_version->version),
  290. $output,
  291. $return_var,
  292. );
  293. check_return_code($return_var, $output);
  294. unset($output);
  295. if (empty($_SESSION["error_msg"])) {
  296. $php_version->installed = false;
  297. }
  298. }
  299. }
  300. return $php_version;
  301. }, $v_php_versions);
  302. }
  303. }
  304. if (empty($_SESSION["error_msg"])) {
  305. if ("php-" . $_POST["v_php_default_version"] != DEFAULT_PHP_VERSION) {
  306. exec(
  307. HESTIA_CMD .
  308. "v-change-sys-php " .
  309. quoteshellarg($_POST["v_php_default_version"]),
  310. $output,
  311. $return_var,
  312. );
  313. check_return_code($return_var, $output);
  314. unset($output);
  315. //force reload
  316. $require_refresh = true;
  317. }
  318. }
  319. }
  320. // Change timezone
  321. if (empty($_SESSION["error_msg"])) {
  322. if (!empty($_POST["v_timezone"])) {
  323. if ($v_timezone != $_POST["v_timezone"]) {
  324. exec(
  325. HESTIA_CMD . "v-change-sys-timezone " . quoteshellarg($_POST["v_timezone"]),
  326. $output,
  327. $return_var,
  328. );
  329. check_return_code($return_var, $output);
  330. $v_timezone = $_POST["v_timezone"];
  331. unset($output);
  332. }
  333. }
  334. }
  335. // Change default language
  336. if (empty($_SESSION["error_msg"])) {
  337. if (!empty($_POST["v_language"]) && $_SESSION["LANGUAGE"] != $_POST["v_language"]) {
  338. if (isset($_POST["v_language_update"])) {
  339. exec(
  340. HESTIA_CMD .
  341. "v-change-sys-language " .
  342. quoteshellarg($_POST["v_language"]) .
  343. " yes",
  344. $output,
  345. $return_var,
  346. );
  347. if (empty($_SESSION["error_msg"])) {
  348. $_SESSION["LANGUAGE"] = $_POST["v_language"];
  349. }
  350. }
  351. exec(
  352. HESTIA_CMD . "v-change-sys-language " . quoteshellarg($_POST["v_language"]),
  353. $output,
  354. $return_var,
  355. );
  356. check_return_code($return_var, $output);
  357. unset($output);
  358. if (empty($_SESSION["error_msg"])) {
  359. $_SESSION["LANGUAGE"] = $_POST["v_language"];
  360. }
  361. }
  362. }
  363. // Update theme
  364. if (empty($_SESSION["error_msg"])) {
  365. if ($_POST["v_theme"] != $_SESSION["THEME"]) {
  366. exec(
  367. HESTIA_CMD . "v-change-sys-config-value THEME " . quoteshellarg($_POST["v_theme"]),
  368. $output,
  369. $return_var,
  370. );
  371. check_return_code($return_var, $output);
  372. unset($output);
  373. }
  374. }
  375. // Update debug mode status
  376. if (empty($_SESSION["error_msg"])) {
  377. if ($_POST["v_debug_mode"] == "on") {
  378. $_POST["v_debug_mode"] = "true";
  379. } else {
  380. $_POST["v_debug_mode"] = "false";
  381. }
  382. if ($_POST["v_debug_mode"] != $_SESSION["DEBUG_MODE"]) {
  383. exec(
  384. HESTIA_CMD .
  385. "v-change-sys-config-value DEBUG_MODE " .
  386. quoteshellarg($_POST["v_debug_mode"]),
  387. $output,
  388. $return_var,
  389. );
  390. check_return_code($return_var, $output);
  391. unset($output);
  392. $v_debug_mode_adv = "yes";
  393. }
  394. }
  395. // Enable/Disable Quick App Installer
  396. if (empty($_SESSION["error_msg"])) {
  397. if ($_POST["v_plugin_app_installer"] != $_SESSION["PLUGIN_APP_INSTALLER"]) {
  398. if ($_POST["v_plugin_app_installer"] == "true") {
  399. $_POST["v_plugin_app_installer"] = "true";
  400. } else {
  401. $_POST["v_plugin_app_installer"] = "false";
  402. }
  403. exec(
  404. HESTIA_CMD .
  405. "v-change-sys-config-value PLUGIN_APP_INSTALLER " .
  406. quoteshellarg($_POST["v_plugin_app_installer"]),
  407. $output,
  408. $return_var,
  409. );
  410. check_return_code($return_var, $output);
  411. unset($output);
  412. }
  413. }
  414. // Update experimental features status
  415. if (
  416. empty($_SESSION["error_msg"]) &&
  417. $_POST["v_experimental_features"] != $_SESSION["POLICY_SYSTEM_ENABLE_BACON"]
  418. ) {
  419. if ($_POST["v_experimental_features"] == "on") {
  420. $_POST["v_experimental_features"] = "true";
  421. } else {
  422. $_POST["v_experimental_features"] = "false";
  423. }
  424. if ($_POST["v_experimental_features"] != $_SESSION["POLICY_SYSTEM_ENABLE_BACON"]) {
  425. exec(
  426. HESTIA_CMD .
  427. "v-change-sys-config-value POLICY_SYSTEM_ENABLE_BACON " .
  428. quoteshellarg($_POST["v_experimental_features"]),
  429. $output,
  430. $return_var,
  431. );
  432. check_return_code($return_var, $output);
  433. unset($output);
  434. $v_debug_mode_adv = "yes";
  435. }
  436. if (
  437. $_POST["v_policy_user_view_suspended"] != $_SESSION["POLICY_SYSTEM_ENABLE_BACON"] &&
  438. $_POST["v_experimental_features"] == "false"
  439. ) {
  440. //disable preview mode
  441. exec(
  442. HESTIA_CMD .
  443. "v-change-sys-config-value POLICY_USER_VIEW_SUSPENDED " .
  444. quoteshellarg($_POST["v_policy_user_view_suspended"]),
  445. $output,
  446. $return_var,
  447. );
  448. check_return_code($return_var, $output);
  449. unset($output);
  450. }
  451. }
  452. // Set File Manager support
  453. if (empty($_SESSION["error_msg"])) {
  454. if (
  455. !empty($_POST["v_filemanager"]) &&
  456. $_SESSION["FILE_MANAGER"] != $_POST["v_filemanager"]
  457. ) {
  458. if ($_POST["v_filemanager"] == "true") {
  459. exec(HESTIA_CMD . "v-add-sys-filemanager", $output, $return_var);
  460. check_return_code($return_var, $output);
  461. unset($output);
  462. if (empty($_SESSION["error_msg"])) {
  463. $_SESSION["FILE_MANAGER"] = "true";
  464. }
  465. } else {
  466. exec(HESTIA_CMD . "v-delete-sys-filemanager", $output, $return_var);
  467. check_return_code($return_var, $output);
  468. unset($output);
  469. if (empty($_SESSION["error_msg"])) {
  470. $_SESSION["FILE_MANAGER"] = "false";
  471. }
  472. }
  473. }
  474. }
  475. // Set phpMyAdmin SSO key
  476. if (empty($_SESSION["error_msg"])) {
  477. if (!empty($_POST["v_phpmyadmin_key"])) {
  478. if ($_POST["v_phpmyadmin_key"] == "yes" && $_SESSION["PHPMYADMIN_KEY"] == "") {
  479. exec(HESTIA_CMD . "v-add-sys-pma-sso quiet", $output, $return_var);
  480. check_return_code($return_var, $output);
  481. unset($output);
  482. if (empty($_SESSION["error_msg"])) {
  483. $_SESSION["PHPMYADMIN_KEY"] != "";
  484. }
  485. } elseif ($_POST["v_phpmyadmin_key"] == "no" && $_SESSION["PHPMYADMIN_KEY"] != "") {
  486. exec(HESTIA_CMD . "v-delete-sys-pma-sso quiet", $output, $return_var);
  487. check_return_code($return_var, $output);
  488. unset($output);
  489. if (empty($_SESSION["error_msg"])) {
  490. $_SESSION["PHPMYADMIN_KEY"] = "";
  491. }
  492. }
  493. }
  494. }
  495. // Set disk_quota support
  496. if (empty($_SESSION["error_msg"])) {
  497. if (!empty($_POST["v_quota"]) && $_SESSION["DISK_QUOTA"] != $_POST["v_quota"]) {
  498. if ($_POST["v_quota"] == "yes") {
  499. exec(HESTIA_CMD . "v-add-sys-quota", $output, $return_var);
  500. check_return_code($return_var, $output);
  501. unset($output);
  502. if (empty($_SESSION["error_msg"])) {
  503. $_SESSION["DISK_QUOTA"] = "yes";
  504. }
  505. } else {
  506. exec(HESTIA_CMD . "v-delete-sys-quota", $output, $return_var);
  507. check_return_code($return_var, $output);
  508. unset($output);
  509. if (empty($_SESSION["error_msg"])) {
  510. $_SESSION["DISK_QUOTA"] = "no";
  511. }
  512. }
  513. }
  514. }
  515. // Set firewall support
  516. if (empty($_SESSION["error_msg"])) {
  517. if ($_SESSION["FIREWALL_SYSTEM"] == "iptables") {
  518. $v_firewall = "yes";
  519. }
  520. if ($_SESSION["FIREWALL_SYSTEM"] != "iptables") {
  521. $v_firewall = "no";
  522. }
  523. if (!empty($_POST["v_firewall"]) && $v_firewall != $_POST["v_firewall"]) {
  524. if ($_POST["v_firewall"] == "yes") {
  525. exec(HESTIA_CMD . "v-add-sys-firewall", $output, $return_var);
  526. check_return_code($return_var, $output);
  527. unset($output);
  528. if (empty($_SESSION["error_msg"])) {
  529. $_SESSION["FIREWALL_SYSTEM"] = "iptables";
  530. }
  531. } else {
  532. exec(HESTIA_CMD . "v-delete-sys-firewall", $output, $return_var);
  533. check_return_code($return_var, $output);
  534. unset($output);
  535. if (empty($_SESSION["error_msg"])) {
  536. $_SESSION["FIREWALL_SYSTEM"] = "";
  537. }
  538. }
  539. }
  540. }
  541. // Update mysql pasword
  542. if (empty($_SESSION["error_msg"])) {
  543. if (!empty($_POST["v_mysql_password"])) {
  544. exec(
  545. HESTIA_CMD .
  546. "v-change-database-host-password mysql localhost root " .
  547. quoteshellarg($_POST["v_mysql_password"]),
  548. $output,
  549. $return_var,
  550. );
  551. check_return_code($return_var, $output);
  552. unset($output);
  553. $v_db_adv = "yes";
  554. }
  555. }
  556. // Update webmail url
  557. if (empty($_SESSION["error_msg"])) {
  558. if ($_POST["v_webmail_alias"] != $_SESSION["WEBMAIL_ALIAS"]) {
  559. exec(
  560. HESTIA_CMD . "v-change-sys-webmail " . quoteshellarg($_POST["v_webmail_alias"]),
  561. $output,
  562. $return_var,
  563. );
  564. check_return_code($return_var, $output);
  565. unset($output);
  566. $v_mail_adv = "yes";
  567. }
  568. }
  569. // Update system wide smtp relay
  570. if (empty($_SESSION["error_msg"])) {
  571. if (isset($_POST["v_smtp_relay"]) && !empty($_POST["v_smtp_relay_host"])) {
  572. if (
  573. $_POST["v_smtp_relay_host"] != $v_smtp_relay_host ||
  574. $_POST["v_smtp_relay_user"] != $v_smtp_relay_user ||
  575. $_POST["v_smtp_relay_port"] != $v_smtp_relay_port ||
  576. !empty($_POST["v_smtp_relay_pass"])
  577. ) {
  578. $v_smtp_relay = true;
  579. $v_smtp_relay_host = quoteshellarg($_POST["v_smtp_relay_host"]);
  580. $v_smtp_relay_user = quoteshellarg($_POST["v_smtp_relay_user"]);
  581. $v_smtp_relay_pass = quoteshellarg($_POST["v_smtp_relay_pass"]);
  582. if (!empty($_POST["v_smtp_relay_port"])) {
  583. $v_smtp_relay_port = quoteshellarg($_POST["v_smtp_relay_port"]);
  584. } else {
  585. $v_smtp_relay_port = "587";
  586. }
  587. exec(
  588. HESTIA_CMD .
  589. "v-add-sys-smtp-relay " .
  590. $v_smtp_relay_host .
  591. " " .
  592. $v_smtp_relay_user .
  593. " " .
  594. $v_smtp_relay_pass .
  595. " " .
  596. $v_smtp_relay_port,
  597. $output,
  598. $return_var,
  599. );
  600. check_return_code($return_var, $output);
  601. unset($output);
  602. }
  603. }
  604. if (!isset($_POST["v_smtp_relay"]) && $v_smtp_relay == true) {
  605. $v_smtp_relay = false;
  606. $v_smtp_relay_host = $v_smtp_relay_user = $v_smtp_relay_pass = $v_smtp_relay_port = "";
  607. exec(HESTIA_CMD . "v-delete-sys-smtp-relay", $output, $return_var);
  608. check_return_code($return_var, $output);
  609. unset($output);
  610. }
  611. }
  612. // Update phpMyAdmin url
  613. if (empty($_SESSION["error_msg"])) {
  614. if ($_POST["v_mysql_url"] != $_SESSION["DB_PMA_ALIAS"]) {
  615. exec(
  616. HESTIA_CMD . "v-change-sys-db-alias pma " . quoteshellarg($_POST["v_mysql_url"]),
  617. $output,
  618. $return_var,
  619. );
  620. check_return_code($return_var, $output);
  621. unset($output);
  622. $v_db_adv = "yes";
  623. }
  624. }
  625. // Update phpPgAdmin url
  626. if (empty($_SESSION["error_msg"])) {
  627. if (empty($_POST["v_pgsql_url"])) {
  628. $_POST["v_pgsql_url"] = "";
  629. }
  630. if ($_POST["v_pgsql_url"] != $_SESSION["DB_PGA_ALIAS"]) {
  631. exec(
  632. HESTIA_CMD . "v-change-sys-db-alias pga " . quoteshellarg($_POST["v_pgsql_url"]),
  633. $output,
  634. $return_var,
  635. );
  636. check_return_code($return_var, $output);
  637. unset($output);
  638. $v_db_adv = "yes";
  639. }
  640. }
  641. // Update send notification setting
  642. if (empty($_SESSION["error_msg"])) {
  643. if ($_SESSION["UPGRADE_SEND_EMAIL"] == "true") {
  644. $ugrade_send_mail = "on";
  645. } else {
  646. $ugrade_send_mail = "";
  647. }
  648. if ($_POST["v_upgrade_send_notification_email"] != $ugrade_send_mail) {
  649. if ($_POST["v_upgrade_send_notification_email"] == "on") {
  650. $_POST["v_upgrade_send_notification_email"] = "true";
  651. } else {
  652. $_POST["v_upgrade_send_notification_email"] = "false";
  653. }
  654. exec(
  655. HESTIA_CMD .
  656. "v-change-sys-config-value UPGRADE_SEND_EMAIL " .
  657. quoteshellarg($_POST["v_upgrade_send_notification_email"]),
  658. $output,
  659. $return_var,
  660. );
  661. check_return_code($return_var, $output);
  662. unset($output);
  663. $v_upgrade_notification_adv = "yes";
  664. }
  665. }
  666. // Update send log by email setting
  667. if (empty($_SESSION["error_msg"])) {
  668. if ($_SESSION["UPGRADE_SEND_EMAIL_LOG"] == "true") {
  669. $send_email_log = "on";
  670. } else {
  671. $send_email_log = "";
  672. }
  673. if (empty($_POST["v_upgrade_send_email_log"])) {
  674. $_POST["v_upgrade_send_email_log"] = "";
  675. }
  676. if ($_POST["v_upgrade_send_email_log"] != $send_email_log) {
  677. if ($_POST["v_upgrade_send_email_log"] == "on") {
  678. $_POST["v_upgrade_send_email_log"] = "true";
  679. } else {
  680. $_POST["v_upgrade_send_email_log"] = "false";
  681. }
  682. exec(
  683. HESTIA_CMD .
  684. "v-change-sys-config-value UPGRADE_SEND_EMAIL_LOG " .
  685. quoteshellarg($_POST["v_upgrade_send_email_log"]),
  686. $output,
  687. $return_var,
  688. );
  689. check_return_code($return_var, $output);
  690. unset($output);
  691. $v_upgrade_send_log_adv = "yes";
  692. }
  693. }
  694. // Disable local backup
  695. if (empty($_SESSION["error_msg"])) {
  696. if ($_POST["v_backup"] == "no" && $v_backup == "yes") {
  697. exec(HESTIA_CMD . "v-delete-backup-host local", $output, $return_var);
  698. check_return_code($return_var, $output);
  699. unset($output);
  700. if (empty($_SESSION["error_msg"])) {
  701. $v_backup = "no";
  702. }
  703. $v_backup_adv = "yes";
  704. }
  705. }
  706. // Enable local backups
  707. if (empty($_SESSION["error_msg"])) {
  708. if ($_POST["v_backup"] == "yes" && $v_backup != "yes") {
  709. exec(HESTIA_CMD . "v-add-backup-host local", $output, $return_var);
  710. check_return_code($return_var, $output);
  711. unset($output);
  712. if (empty($_SESSION["error_msg"])) {
  713. $v_backup = "yes";
  714. }
  715. $v_backup_adv = "yes";
  716. }
  717. }
  718. // Change backup gzip level
  719. if (empty($_SESSION["error_msg"])) {
  720. if ($_POST["v_backup_gzip"] != $v_backup_gzip) {
  721. if ($_POST["v_backup_mode"] == "gzip") {
  722. $_POST["v_backup_gzip"] = 9;
  723. }
  724. exec(
  725. HESTIA_CMD .
  726. "v-change-sys-config-value BACKUP_GZIP " .
  727. quoteshellarg($_POST["v_backup_gzip"]),
  728. $output,
  729. $return_var,
  730. );
  731. check_return_code($return_var, $output);
  732. unset($output);
  733. if (empty($_SESSION["error_msg"])) {
  734. $v_backup_gzip = $_POST["v_backup_gzip"];
  735. }
  736. $v_backup_adv = "yes";
  737. }
  738. }
  739. // Change backup mode
  740. if (empty($_SESSION["error_msg"])) {
  741. if ($_POST["v_backup_mode"] != $v_backup_mode) {
  742. exec(
  743. HESTIA_CMD .
  744. "v-change-sys-config-value BACKUP_MODE " .
  745. quoteshellarg($_POST["v_backup_mode"]),
  746. $output,
  747. $return_var,
  748. );
  749. check_return_code($return_var, $output);
  750. unset($output);
  751. if (empty($_SESSION["error_msg"])) {
  752. $v_backup_mode = $_POST["v_backup_mode"];
  753. }
  754. $v_backup_adv = "yes";
  755. if ($_POST["v_backup_mode"] == "gzip") {
  756. $_POST["v_backup_gzip"] = 9;
  757. if (empty($_SESSION["error_msg"])) {
  758. $v_backup_gzip = $_POST["v_backup_gzip"];
  759. }
  760. exec(
  761. HESTIA_CMD .
  762. "v-change-sys-config-value BACKUP_GZIP " .
  763. quoteshellarg($_POST["v_backup_gzip"]),
  764. $output,
  765. $return_var,
  766. );
  767. }
  768. }
  769. }
  770. // Change backup path
  771. if (empty($_SESSION["error_msg"])) {
  772. if (empty($_POST["v_backup_dir"])) {
  773. $_POST["v_backup_dir"] = "";
  774. }
  775. if ($_POST["v_backup_dir"] != $v_backup_dir) {
  776. /*
  777. See #1655
  778. exec (HESTIA_CMD."v-change-sys-config-value BACKUP ".quoteshellarg($_POST['v_backup_dir']), $output, $return_var);
  779. check_return_code($return_var,$output);
  780. unset($output);
  781. */
  782. if (empty($_SESSION["error_msg"])) {
  783. $v_backup_dir = $_POST["v_backup_dir"];
  784. }
  785. #$v_backup_adv = 'yes';
  786. }
  787. }
  788. // Add remote backup host
  789. if (empty($_SESSION["error_msg"])) {
  790. if (
  791. $v_backup_host == "" &&
  792. $v_backup_bucket == "" &&
  793. (!empty($_POST["v_backup_host"]) || !empty($_POST["v_backup_bucket"]))
  794. ) {
  795. if (in_array($_POST["v_backup_type"], ["ftp", "sftp"])) {
  796. $v_backup_host = quoteshellarg($_POST["v_backup_host"]);
  797. $v_backup_port = quoteshellarg($_POST["v_backup_port"]);
  798. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  799. $v_backup_username = quoteshellarg($_POST["v_backup_username"]);
  800. $v_backup_password = quoteshellarg($_POST["v_backup_password"]);
  801. $v_backup_bpath = quoteshellarg($_POST["v_backup_bpath"]);
  802. exec(
  803. HESTIA_CMD .
  804. "v-add-backup-host " .
  805. $v_backup_type .
  806. " " .
  807. $v_backup_host .
  808. " " .
  809. $v_backup_username .
  810. " " .
  811. $v_backup_password .
  812. " " .
  813. $v_backup_bpath .
  814. " " .
  815. $v_backup_port,
  816. $output,
  817. $return_var,
  818. );
  819. check_return_code($return_var, $output);
  820. unset($output);
  821. if (empty($_SESSION["error_msg"])) {
  822. $v_backup_host = $_POST["v_backup_host"];
  823. }
  824. if (empty($_SESSION["error_msg"])) {
  825. $v_backup_type = $_POST["v_backup_type"];
  826. }
  827. if (empty($_SESSION["error_msg"])) {
  828. $v_backup_username = $_POST["v_backup_username"];
  829. }
  830. if (empty($_SESSION["error_msg"])) {
  831. $v_backup_password = $_POST["v_backup_password"];
  832. }
  833. if (empty($_SESSION["error_msg"])) {
  834. $v_backup_bpath = $_POST["v_backup_bpath"];
  835. }
  836. if (empty($_SESSION["error_msg"])) {
  837. $v_backup_port = $_POST["v_backup_port"];
  838. }
  839. $v_backup_new = "yes";
  840. $v_backup_adv = "yes";
  841. $v_backup_remote_adv = "yes";
  842. } elseif (in_array($_POST["v_backup_type"], ["b2"])) {
  843. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  844. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  845. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  846. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  847. exec(
  848. HESTIA_CMD .
  849. "v-add-backup-host " .
  850. $v_backup_type .
  851. " " .
  852. $v_backup_bucket .
  853. " " .
  854. $v_backup_application_id .
  855. " " .
  856. $v_backup_application_key,
  857. $output,
  858. $return_var,
  859. );
  860. check_return_code($return_var, $output);
  861. unset($output);
  862. if (empty($_SESSION["error_msg"])) {
  863. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  864. }
  865. if (empty($_SESSION["error_msg"])) {
  866. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  867. }
  868. if (empty($_SESSION["error_msg"])) {
  869. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  870. }
  871. $v_backup_new = "yes";
  872. $v_backup_adv = "yes";
  873. $v_backup_remote_adv = "yes";
  874. }
  875. }
  876. if (
  877. $v_rclone_host == "" &&
  878. !empty($_POST["v_rclone_host"]) &&
  879. $_POST["v_backup_type"] == "rclone"
  880. ) {
  881. $v_rclone_host = quoteshellarg($_POST["v_rclone_host"]);
  882. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  883. $v_rclone_path = quoteshellarg($_POST["v_rclone_path"]);
  884. exec(
  885. HESTIA_CMD .
  886. "v-add-backup-host " .
  887. $v_backup_type .
  888. " " .
  889. $v_rclone_host .
  890. " '' '' " .
  891. $v_rclone_path,
  892. $output,
  893. $return_var,
  894. );
  895. check_return_code($return_var, $output);
  896. unset($output);
  897. $v_backup_new = "yes";
  898. $v_backup_adv = "yes";
  899. $v_backup_remote_adv = "yes";
  900. }
  901. }
  902. // Change remote backup host type
  903. if (empty($_SESSION["error_msg"])) {
  904. if (
  905. !empty($_POST["v_backup_host"]) &&
  906. $_POST["v_backup_type"] != $v_backup_type &&
  907. $v_backup_type != ""
  908. ) {
  909. exec(
  910. HESTIA_CMD . "v-delete-backup-host " . quoteshellarg($v_backup_type),
  911. $output,
  912. $return_var,
  913. );
  914. unset($output);
  915. if (in_array($_POST["v_backup_type"], ["ftp", "sftp"])) {
  916. $v_backup_host = quoteshellarg($_POST["v_backup_host"]);
  917. $v_backup_port = quoteshellarg($_POST["v_backup_port"]);
  918. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  919. $v_backup_username = quoteshellarg($_POST["v_backup_username"]);
  920. $v_backup_password = quoteshellarg($_POST["v_backup_password"]);
  921. $v_backup_bpath = quoteshellarg($_POST["v_backup_bpath"]);
  922. exec(
  923. HESTIA_CMD .
  924. "v-add-backup-host " .
  925. $v_backup_type .
  926. " " .
  927. $v_backup_host .
  928. " " .
  929. $v_backup_username .
  930. " " .
  931. $v_backup_password .
  932. " " .
  933. $v_backup_bpath .
  934. " " .
  935. $v_backup_port,
  936. $output,
  937. $return_var,
  938. );
  939. check_return_code($return_var, $output);
  940. unset($output);
  941. if (empty($_SESSION["error_msg"])) {
  942. $v_backup_host = $_POST["v_backup_host"];
  943. }
  944. if (empty($_SESSION["error_msg"])) {
  945. $v_backup_type = $_POST["v_backup_type"];
  946. }
  947. if (empty($_SESSION["error_msg"])) {
  948. $v_backup_username = $_POST["v_backup_username"];
  949. }
  950. if (empty($_SESSION["error_msg"])) {
  951. $v_backup_password = $_POST["v_backup_password"];
  952. }
  953. if (empty($_SESSION["error_msg"])) {
  954. $v_backup_bpath = $_POST["v_backup_bpath"];
  955. }
  956. if (empty($_SESSION["error_msg"])) {
  957. $v_backup_port = $_POST["v_backup_port"];
  958. }
  959. $v_backup_adv = "yes";
  960. $v_backup_remote_adv = "yes";
  961. } elseif (in_array($_POST["v_backup_type"], ["b2"])) {
  962. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  963. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  964. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  965. exec(
  966. HESTIA_CMD .
  967. "v-add-backup-host " .
  968. $v_backup_type .
  969. " " .
  970. $v_backup_bucket .
  971. " " .
  972. $v_backup_application_id .
  973. " " .
  974. $v_backup_application_key,
  975. $output,
  976. $return_var,
  977. );
  978. check_return_code($return_var, $output);
  979. unset($output);
  980. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  981. if (empty($_SESSION["error_msg"])) {
  982. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  983. }
  984. if (empty($_SESSION["error_msg"])) {
  985. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  986. }
  987. if (empty($_SESSION["error_msg"])) {
  988. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  989. }
  990. $v_backup_adv = "yes";
  991. $v_backup_remote_adv = "yes";
  992. }
  993. }
  994. }
  995. // Change remote backup host
  996. if (empty($_SESSION["error_msg"])) {
  997. if ($_POST["v_backup_type"] == $v_backup_type && !isset($v_backup_new)) {
  998. if (in_array($_POST["v_backup_type"], ["ftp", "sftp"])) {
  999. if (
  1000. $_POST["v_backup_host"] != $v_backup_host ||
  1001. $_POST["v_backup_username"] != $v_backup_username ||
  1002. $_POST["v_backup_password"] != $v_backup_password ||
  1003. ($_POST["v_backup_bpath"] != $v_backup_bpath ||
  1004. $_POST["v_backup_port"] != $v_backup_port)
  1005. ) {
  1006. $v_backup_host = quoteshellarg($_POST["v_backup_host"]);
  1007. $v_backup_port = quoteshellarg($_POST["v_backup_port"]);
  1008. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  1009. $v_backup_username = quoteshellarg($_POST["v_backup_username"]);
  1010. $v_backup_password = quoteshellarg($_POST["v_backup_password"]);
  1011. $v_backup_bpath = quoteshellarg($_POST["v_backup_bpath"]);
  1012. exec(
  1013. HESTIA_CMD .
  1014. "v-add-backup-host " .
  1015. $v_backup_type .
  1016. " " .
  1017. $v_backup_host .
  1018. " " .
  1019. $v_backup_username .
  1020. " " .
  1021. $v_backup_password .
  1022. " " .
  1023. $v_backup_bpath .
  1024. " " .
  1025. $v_backup_port,
  1026. $output,
  1027. $return_var,
  1028. );
  1029. check_return_code($return_var, $output);
  1030. unset($output);
  1031. if (empty($_SESSION["error_msg"])) {
  1032. $v_backup_host = $_POST["v_backup_host"];
  1033. }
  1034. if (empty($_SESSION["error_msg"])) {
  1035. $v_backup_type = $_POST["v_backup_type"];
  1036. }
  1037. if (empty($_SESSION["error_msg"])) {
  1038. $v_backup_username = $_POST["v_backup_username"];
  1039. }
  1040. if (empty($_SESSION["error_msg"])) {
  1041. $v_backup_password = $_POST["v_backup_password"];
  1042. }
  1043. if (empty($_SESSION["error_msg"])) {
  1044. $v_backup_bpath = $_POST["v_backup_bpath"];
  1045. }
  1046. if (empty($_SESSION["error_msg"])) {
  1047. $v_backup_port = $_POST["v_backup_port"];
  1048. }
  1049. $v_backup_adv = "yes";
  1050. $v_backup_remote_adv = "yes";
  1051. }
  1052. } elseif (in_array($_POST["v_backup_type"], ["b2"])) {
  1053. if (
  1054. $_POST["v_backup_bucket"] != $v_backup_bucket ||
  1055. $_POST["v_backup_application_key"] != $v_backup_application_key ||
  1056. $_POST["v_backup_application_id"] != $v_backup_application_id
  1057. ) {
  1058. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  1059. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  1060. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  1061. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  1062. exec(
  1063. HESTIA_CMD .
  1064. "v-add-backup-host " .
  1065. $v_backup_type .
  1066. " " .
  1067. $v_backup_bucket .
  1068. " " .
  1069. $v_backup_application_id .
  1070. " " .
  1071. $v_backup_application_key,
  1072. $output,
  1073. $return_var,
  1074. );
  1075. check_return_code($return_var, $output);
  1076. unset($output);
  1077. if (empty($_SESSION["error_msg"])) {
  1078. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  1079. }
  1080. if (empty($_SESSION["error_msg"])) {
  1081. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  1082. }
  1083. if (empty($_SESSION["error_msg"])) {
  1084. $v_backup_application_key = quoteshellarg(
  1085. $_POST["v_backup_application_key"],
  1086. );
  1087. }
  1088. $v_backup_adv = "yes";
  1089. $v_backup_remote_adv = "yes";
  1090. }
  1091. }
  1092. }
  1093. }
  1094. // Delete remote backup host
  1095. if (empty($_SESSION["error_msg"])) {
  1096. if (empty($_POST["v_backup_remote_adv"]) && $v_backup_remote_adv != "") {
  1097. exec(
  1098. HESTIA_CMD . "v-delete-backup-host " . quoteshellarg($v_backup_type),
  1099. $output,
  1100. $return_var,
  1101. );
  1102. check_return_code($return_var, $output);
  1103. unset($output);
  1104. if (empty($_SESSION["error_msg"])) {
  1105. $v_backup_host = "";
  1106. }
  1107. if (empty($_SESSION["error_msg"])) {
  1108. $v_backup_type = "";
  1109. }
  1110. if (empty($_SESSION["error_msg"])) {
  1111. $v_backup_username = "";
  1112. }
  1113. if (empty($_SESSION["error_msg"])) {
  1114. $v_backup_password = "";
  1115. }
  1116. if (empty($_SESSION["error_msg"])) {
  1117. $v_backup_bpath = "";
  1118. }
  1119. if (empty($_SESSION["error_msg"])) {
  1120. $v_backup_bucket = "";
  1121. }
  1122. if (empty($_SESSION["error_msg"])) {
  1123. $v_backup_application_id = "";
  1124. }
  1125. if (empty($_SESSION["error_msg"])) {
  1126. $v_backup_application_key = "";
  1127. }
  1128. $v_backup_adv = "";
  1129. $v_backup_remote_adv = "";
  1130. }
  1131. }
  1132. // Change INACTIVE_SESSION_TIMEOUT
  1133. if (empty($_SESSION["error_msg"])) {
  1134. if ($_POST["v_inactive_session_timeout"] != $_SESSION["INACTIVE_SESSION_TIMEOUT"]) {
  1135. if ($_POST["v_inactive_session_timeout"] < 1) {
  1136. $_SESSION["error_msg"] = _("Inactive session timeout can not lower than 1 minute.");
  1137. } else {
  1138. exec(
  1139. HESTIA_CMD .
  1140. "v-change-sys-config-value INACTIVE_SESSION_TIMEOUT " .
  1141. quoteshellarg($_POST["v_inactive_session_timeout"]),
  1142. $output,
  1143. $return_var,
  1144. );
  1145. check_return_code($return_var, $output);
  1146. unset($output);
  1147. if (empty($_SESSION["error_msg"])) {
  1148. $v_inactive_session_timeout = $_POST["v_inactive_session_timeout"];
  1149. }
  1150. }
  1151. $v_security_adv = "yes";
  1152. }
  1153. }
  1154. // Change POLICY_CSRF_STRICTNESS
  1155. if (empty($_SESSION["error_msg"])) {
  1156. if ($_POST["v_policy_csrf_strictness"] != $_SESSION["POLICY_CSRF_STRICTNESS"]) {
  1157. exec(
  1158. HESTIA_CMD .
  1159. "v-change-sys-config-value POLICY_CSRF_STRICTNESS " .
  1160. quoteshellarg($_POST["v_policy_csrf_strictness"]),
  1161. $output,
  1162. $return_var,
  1163. );
  1164. check_return_code($return_var, $output);
  1165. unset($output);
  1166. if (empty($_SESSION["error_msg"])) {
  1167. $v_policy_csrf_strictness = $_POST["v_inactive_session_timeout"];
  1168. }
  1169. $v_security_adv = "yes";
  1170. }
  1171. }
  1172. // Change ENFORCE_SUBDOMAIN_OWNERSHIP
  1173. if (empty($_SESSION["error_msg"])) {
  1174. if ($_POST["v_enforce_subdomain_ownership"] != $_SESSION["ENFORCE_SUBDOMAIN_OWNERSHIP"]) {
  1175. exec(
  1176. HESTIA_CMD .
  1177. "v-change-sys-config-value ENFORCE_SUBDOMAIN_OWNERSHIP " .
  1178. quoteshellarg($_POST["v_enforce_subdomain_ownership"]),
  1179. $output,
  1180. $return_var,
  1181. );
  1182. check_return_code($return_var, $output);
  1183. unset($output);
  1184. if (empty($_SESSION["error_msg"])) {
  1185. $v_enforce_subdomain_ownership = $_POST["v_enforce_subdomain_ownership"];
  1186. }
  1187. $v_security_adv = "yes";
  1188. }
  1189. }
  1190. // Change POLICY_USER_EDIT_DETAILS
  1191. if (empty($_SESSION["error_msg"])) {
  1192. if ($_POST["v_policy_user_edit_details"] != $_SESSION["POLICY_USER_EDIT_DETAILS"]) {
  1193. exec(
  1194. HESTIA_CMD .
  1195. "v-change-sys-config-value POLICY_USER_EDIT_DETAILS " .
  1196. quoteshellarg($_POST["v_policy_user_edit_details"]),
  1197. $output,
  1198. $return_var,
  1199. );
  1200. check_return_code($return_var, $output);
  1201. unset($output);
  1202. if (empty($_SESSION["error_msg"])) {
  1203. $v_policy_user_edit_details = $_POST["v_policy_user_edit_details"];
  1204. }
  1205. $v_security_adv = "yes";
  1206. }
  1207. }
  1208. // Change POLICY_USER_EDIT_WEB_TEMPLATES
  1209. if (empty($_SESSION["error_msg"])) {
  1210. if (
  1211. $_POST["v_policy_user_edit_web_templates"] !=
  1212. $_SESSION["POLICY_USER_EDIT_WEB_TEMPLATES"]
  1213. ) {
  1214. exec(
  1215. HESTIA_CMD .
  1216. "v-change-sys-config-value POLICY_USER_EDIT_WEB_TEMPLATES " .
  1217. quoteshellarg($_POST["v_policy_user_edit_web_templates"]),
  1218. $output,
  1219. $return_var,
  1220. );
  1221. check_return_code($return_var, $output);
  1222. unset($output);
  1223. if (empty($_SESSION["error_msg"])) {
  1224. $v_policy_user_edit_details = $_POST["v_policy_user_edit_web_templates"];
  1225. }
  1226. $v_security_adv = "yes";
  1227. }
  1228. }
  1229. // Change POLICY_USER_EDIT_DNS_TEMPLATES
  1230. if (empty($_SESSION["error_msg"])) {
  1231. if (
  1232. $_POST["v_policy_user_edit_dns_templates"] !=
  1233. $_SESSION["POLICY_USER_EDIT_DNS_TEMPLATES"]
  1234. ) {
  1235. exec(
  1236. HESTIA_CMD .
  1237. "v-change-sys-config-value POLICY_USER_EDIT_DNS_TEMPLATES " .
  1238. quoteshellarg($_POST["v_policy_user_edit_dns_templates"]),
  1239. $output,
  1240. $return_var,
  1241. );
  1242. check_return_code($return_var, $output);
  1243. unset($output);
  1244. if (empty($_SESSION["error_msg"])) {
  1245. $v_policy_user_edit_details = $_POST["v_policy_user_edit_dns_templates"];
  1246. }
  1247. $v_security_adv = "yes";
  1248. }
  1249. }
  1250. if (
  1251. $_POST["v_api_system"] != $_SESSION["API_SYSTEM"] ||
  1252. $_POST["v_api"] != $_SESSION["API"] ||
  1253. $_POST["v_api_allowed_ip"] != $_SESSION["API_ALLOWED_IP"]
  1254. ) {
  1255. if (empty($_SESSION["error_msg"])) {
  1256. if ($_POST["v_api"] == "no" && $_POST["v_api_system"] === 0) {
  1257. exec(HESTIA_CMD . "v-change-sys-api 'disable'", $output, $return_var);
  1258. check_return_code($return_var, $output);
  1259. unset($output);
  1260. }
  1261. if (
  1262. $_POST["v_api"] == "yes" ||
  1263. ($_POST["v_api_system"] !== 0 &&
  1264. $_POST["v_api_system"] != $_SESSION["API_SYSTEM"]) ||
  1265. $_POST["v_api"] != $_SESSION["API"]
  1266. ) {
  1267. exec(HESTIA_CMD . "v-change-sys-api 'enable'", $output, $return_var);
  1268. check_return_code($return_var, $output);
  1269. unset($output);
  1270. }
  1271. }
  1272. if (empty($_SESSION["error_msg"])) {
  1273. if ($_POST["v_api_system"] != $_SESSION["API_SYSTEM"]) {
  1274. exec(
  1275. HESTIA_CMD .
  1276. "v-change-sys-config-value API_SYSTEM " .
  1277. quoteshellarg($_POST["v_api_system"]),
  1278. $output,
  1279. $return_var,
  1280. );
  1281. check_return_code($return_var, $output);
  1282. unset($output);
  1283. if (empty($_SESSION["error_msg"])) {
  1284. $v_policy_user_edit_details = $_POST["v_api_system"];
  1285. }
  1286. $v_security_adv = "yes";
  1287. }
  1288. }
  1289. // Change API access
  1290. if (empty($_SESSION["error_msg"])) {
  1291. if ($_POST["v_api"] != $_SESSION["API"]) {
  1292. $api_status = "no";
  1293. if ($_POST["v_api"] == "yes") {
  1294. $api_status = "yes";
  1295. }
  1296. exec(
  1297. HESTIA_CMD . "v-change-sys-config-value API " . quoteshellarg($api_status),
  1298. $output,
  1299. $return_var,
  1300. );
  1301. check_return_code($return_var, $output);
  1302. unset($output);
  1303. if (empty($_SESSION["error_msg"])) {
  1304. $v_api = $_POST["v_api"];
  1305. }
  1306. $v_security_adv = "yes";
  1307. }
  1308. }
  1309. // Change API allowed IPs
  1310. if (empty($_SESSION["error_msg"])) {
  1311. if ($_POST["v_api_allowed_ip"] != $_SESSION["API_ALLOWED_IP"]) {
  1312. $ips = [];
  1313. foreach (explode("\n", $_POST["v_api_allowed_ip"]) as $ip) {
  1314. if (trim($ip) != "allow-all") {
  1315. if (filter_var(trim($ip), FILTER_VALIDATE_IP)) {
  1316. $ips[] = trim($ip);
  1317. }
  1318. } else {
  1319. $ips[] = trim($ip);
  1320. }
  1321. }
  1322. if (implode(",", $ips) != $_SESSION["API_ALLOWED_IP"]) {
  1323. exec(
  1324. HESTIA_CMD .
  1325. "v-change-sys-config-value API_ALLOWED_IP " .
  1326. quoteshellarg(implode(",", $ips)),
  1327. $output,
  1328. $return_var,
  1329. );
  1330. check_return_code($return_var, $output);
  1331. unset($output);
  1332. if (empty($_SESSION["error_msg"])) {
  1333. $v_api_allowed_ip = $_POST["v_api_allowed_ip"];
  1334. }
  1335. $v_security_adv = "yes";
  1336. }
  1337. }
  1338. }
  1339. }
  1340. // Change POLICY_USER_VIEW_LOGS
  1341. if (empty($_SESSION["error_msg"])) {
  1342. if ($_POST["v_policy_user_view_logs"] != $_SESSION["POLICY_USER_VIEW_LOGS"]) {
  1343. exec(
  1344. HESTIA_CMD .
  1345. "v-change-sys-config-value POLICY_USER_VIEW_LOGS " .
  1346. quoteshellarg($_POST["v_policy_user_view_logs"]),
  1347. $output,
  1348. $return_var,
  1349. );
  1350. check_return_code($return_var, $output);
  1351. unset($output);
  1352. if (empty($_SESSION["error_msg"])) {
  1353. $v_policy_user_view_logs = $_POST["v_policy_user_view_logs"];
  1354. }
  1355. $v_security_adv = "yes";
  1356. }
  1357. }
  1358. // Change POLICY_USER_DELETE_LOGS
  1359. if (empty($_SESSION["error_msg"])) {
  1360. if ($_POST["v_policy_user_delete_logs"] != $_SESSION["POLICY_USER_DELETE_LOGS"]) {
  1361. exec(
  1362. HESTIA_CMD .
  1363. "v-change-sys-config-value POLICY_USER_DELETE_LOGS " .
  1364. quoteshellarg($_POST["v_policy_user_delete_logs"]),
  1365. $output,
  1366. $return_var,
  1367. );
  1368. check_return_code($return_var, $output);
  1369. unset($output);
  1370. if (empty($_SESSION["error_msg"])) {
  1371. $v_policy_user_delete_logs = $_POST["v_policy_user_delete_logs"];
  1372. }
  1373. $v_security_adv = "yes";
  1374. }
  1375. }
  1376. // Change POLICY_SYSTEM_PASSWORD_RESET
  1377. if (empty($_SESSION["error_msg"])) {
  1378. if ($_POST["v_policy_system_password_reset"] != $_SESSION["POLICY_SYSTEM_PASSWORD_RESET"]) {
  1379. exec(
  1380. HESTIA_CMD .
  1381. "v-change-sys-config-value POLICY_SYSTEM_PASSWORD_RESET " .
  1382. quoteshellarg($_POST["v_policy_system_password_reset"]),
  1383. $output,
  1384. $return_var,
  1385. );
  1386. check_return_code($return_var, $output);
  1387. unset($output);
  1388. if (empty($_SESSION["error_msg"])) {
  1389. $v_policy_system_password_reset = $_POST["v_policy_system_password_reset"];
  1390. }
  1391. $v_security_adv = "yes";
  1392. }
  1393. }
  1394. // Change POLICY_SYSTEM_PROTECTED_ADMIN
  1395. if (empty($_SESSION["error_msg"])) {
  1396. if (
  1397. $_POST["v_policy_system_protected_admin"] != $_SESSION["POLICY_SYSTEM_PROTECTED_ADMIN"]
  1398. ) {
  1399. exec(
  1400. HESTIA_CMD .
  1401. "v-change-sys-config-value POLICY_SYSTEM_PROTECTED_ADMIN " .
  1402. quoteshellarg($_POST["v_policy_system_protected_admin"]),
  1403. $output,
  1404. $return_var,
  1405. );
  1406. check_return_code($return_var, $output);
  1407. unset($output);
  1408. if (empty($_SESSION["error_msg"])) {
  1409. $v_policy_system_protected_admin = $_POST["v_policy_system_protected_admin"];
  1410. }
  1411. $v_security_adv = "yes";
  1412. }
  1413. }
  1414. // Change POLICY_USER_VIEW_SUSPENDED
  1415. if (empty($_SESSION["error_msg"])) {
  1416. if (
  1417. $_POST["v_policy_user_view_suspended"] != $_SESSION["POLICY_USER_VIEW_SUSPENDED"] &&
  1418. !empty($_SESSION["POLICY_USER_VIEW_SUSPENDED"])
  1419. ) {
  1420. exec(
  1421. HESTIA_CMD .
  1422. "v-change-sys-config-value POLICY_USER_VIEW_SUSPENDED " .
  1423. quoteshellarg($_POST["v_policy_user_view_suspended"]),
  1424. $output,
  1425. $return_var,
  1426. );
  1427. check_return_code($return_var, $output);
  1428. unset($output);
  1429. if (empty($_SESSION["error_msg"])) {
  1430. $v_policy_system_hide_admin = $_POST["v_policy_user_view_suspended"];
  1431. }
  1432. $v_security_adv = "yes";
  1433. }
  1434. }
  1435. // Change POLICY_USER_CHANGE_THEME
  1436. if (empty($_SESSION["error_msg"])) {
  1437. if (empty($_POST["v_policy_user_change_theme"])) {
  1438. $_POST["v_policy_user_change_theme"] = "";
  1439. }
  1440. if ($_POST["v_policy_user_change_theme"] == "on") {
  1441. $_POST["v_policy_user_change_theme"] = "no";
  1442. } else {
  1443. $_POST["v_policy_user_change_theme"] = "yes";
  1444. }
  1445. if ($_POST["v_policy_user_change_theme"] != $_SESSION["POLICY_USER_CHANGE_THEME"]) {
  1446. exec(
  1447. HESTIA_CMD .
  1448. "v-change-sys-config-value POLICY_USER_CHANGE_THEME " .
  1449. quoteshellarg($_POST["v_policy_user_change_theme"]),
  1450. $output,
  1451. $return_var,
  1452. );
  1453. check_return_code($return_var, $output);
  1454. unset($output);
  1455. if ($_POST["v_policy_user_change_theme"]) {
  1456. unset($_SESSION["userTheme"]);
  1457. $require_refresh = true;
  1458. }
  1459. if (empty($_SESSION["error_msg"])) {
  1460. $v_policy_user_change_theme = $_POST["v_policy_user_change_theme"];
  1461. }
  1462. }
  1463. }
  1464. // Change POLICY_SYSTEM_HIDE_ADMIN
  1465. if (empty($_SESSION["error_msg"])) {
  1466. if ($_POST["v_policy_system_hide_admin"] != $_SESSION["POLICY_SYSTEM_HIDE_ADMIN"]) {
  1467. exec(
  1468. HESTIA_CMD .
  1469. "v-change-sys-config-value POLICY_SYSTEM_HIDE_ADMIN " .
  1470. quoteshellarg($_POST["v_policy_system_hide_admin"]),
  1471. $output,
  1472. $return_var,
  1473. );
  1474. check_return_code($return_var, $output);
  1475. unset($output);
  1476. if (empty($_SESSION["error_msg"])) {
  1477. $v_policy_system_hide_admin = $_POST["v_policy_system_hide_admin"];
  1478. }
  1479. $v_security_adv = "yes";
  1480. }
  1481. }
  1482. // Change POLICY_SYSTEM_HIDE_SERVICES
  1483. if (empty($_SESSION["error_msg"])) {
  1484. if ($_POST["v_policy_system_hide_services"] != $_SESSION["POLICY_SYSTEM_HIDE_SERVICES"]) {
  1485. exec(
  1486. HESTIA_CMD .
  1487. "v-change-sys-config-value POLICY_SYSTEM_HIDE_SERVICES " .
  1488. quoteshellarg($_POST["v_policy_system_hide_services"]),
  1489. $output,
  1490. $return_var,
  1491. );
  1492. check_return_code($return_var, $output);
  1493. unset($output);
  1494. if (empty($_SESSION["error_msg"])) {
  1495. $v_policy_system_hide_services = $_POST["v_policy_system_hide_services"];
  1496. }
  1497. $v_security_adv = "yes";
  1498. }
  1499. }
  1500. // Change POLICY_SYSTEM_HIDE_SERVICES
  1501. if (empty($_SESSION["error_msg"])) {
  1502. if (
  1503. $_POST["v_policy_backup_suspended_users"] != $_SESSION["POLICY_BACKUP_SUSPENDED_USERS"]
  1504. ) {
  1505. exec(
  1506. HESTIA_CMD .
  1507. "v-change-sys-config-value POLICY_BACKUP_SUSPENDED_USERS " .
  1508. quoteshellarg($_POST["v_policy_backup_suspended_users"]),
  1509. $output,
  1510. $return_var,
  1511. );
  1512. check_return_code($return_var, $output);
  1513. unset($output);
  1514. if (empty($_SESSION["error_msg"])) {
  1515. $v_policy_system_hide_services = $_POST["v_policy_backup_suspended_users"];
  1516. }
  1517. $v_security_adv = "yes";
  1518. }
  1519. }
  1520. if (empty($_SESSION["error_msg"])) {
  1521. if ($_POST["v_policy_sync_error_documents"] != $_SESSION["POLICY_SYNC_ERROR_DOCUMENTS"]) {
  1522. exec(
  1523. HESTIA_CMD .
  1524. "v-change-sys-config-value POLICY_SYNC_ERROR_DOCUMENTS " .
  1525. quoteshellarg($_POST["v_policy_sync_error_documents"]),
  1526. $output,
  1527. $return_var,
  1528. );
  1529. check_return_code($return_var, $output);
  1530. unset($output);
  1531. if (empty($_SESSION["error_msg"])) {
  1532. $v_policy_sync_error_documents = $_POST["v_policy_sync_error_documents"];
  1533. }
  1534. $v_security_adv = "yes";
  1535. }
  1536. }
  1537. if (empty($_SESSION["error_msg"])) {
  1538. if ($_POST["v_policy_sync_skeleton"] != $_SESSION["POLICY_SYNC_SKELETON"]) {
  1539. exec(
  1540. HESTIA_CMD .
  1541. "v-change-sys-config-value POLICY_SYNC_SKELETON " .
  1542. quoteshellarg($_POST["v_policy_sync_skeleton"]),
  1543. $output,
  1544. $return_var,
  1545. );
  1546. check_return_code($return_var, $output);
  1547. unset($output);
  1548. if (empty($_SESSION["error_msg"])) {
  1549. $v_policy_sync_skeleton = $_POST["v_policy_sync_skeleton"];
  1550. }
  1551. $v_security_adv = "yes";
  1552. }
  1553. }
  1554. // Change login style
  1555. if (empty($_SESSION["error_msg"])) {
  1556. if ($_POST["v_login_style"] != $_SESSION["LOGIN_STYLE"]) {
  1557. exec(
  1558. HESTIA_CMD .
  1559. "v-change-sys-config-value LOGIN_STYLE " .
  1560. quoteshellarg($_POST["v_login_style"]),
  1561. $output,
  1562. $return_var,
  1563. );
  1564. check_return_code($return_var, $output);
  1565. unset($output);
  1566. if (empty($_SESSION["error_msg"])) {
  1567. $v_login_style = $_POST["v_login_style"];
  1568. }
  1569. $v_security_adv = "yes";
  1570. }
  1571. }
  1572. // Update SSL certificate
  1573. if (!empty($_POST["v_ssl_crt"]) && empty($_SESSION["error_msg"])) {
  1574. if (
  1575. $v_ssl_crt != str_replace("\r\n", "\n", $_POST["v_ssl_crt"]) ||
  1576. $v_ssl_key != str_replace("\r\n", "\n", $_POST["v_ssl_key"])
  1577. ) {
  1578. exec("mktemp -d", $mktemp_output, $return_var);
  1579. $tmpdir = $mktemp_output[0];
  1580. // Certificate
  1581. if (!empty($_POST["v_ssl_crt"])) {
  1582. $fp = fopen($tmpdir . "/certificate.crt", "w");
  1583. fwrite($fp, str_replace("\r\n", "\n", $_POST["v_ssl_crt"]));
  1584. fwrite($fp, "\n");
  1585. fclose($fp);
  1586. }
  1587. // Key
  1588. if (!empty($_POST["v_ssl_key"])) {
  1589. $fp = fopen($tmpdir . "/certificate.key", "w");
  1590. fwrite($fp, str_replace("\r\n", "\n", $_POST["v_ssl_key"]));
  1591. fwrite($fp, "\n");
  1592. fclose($fp);
  1593. }
  1594. exec(HESTIA_CMD . "v-change-sys-hestia-ssl " . $tmpdir, $output, $return_var);
  1595. check_return_code($return_var, $output);
  1596. unset($output);
  1597. // List ssl certificate info
  1598. exec(HESTIA_CMD . "v-list-sys-hestia-ssl json", $output, $return_var);
  1599. $ssl_str = json_decode(implode("", $output), true);
  1600. unset($output);
  1601. $v_ssl_crt = $ssl_str["HESTIA"]["CRT"];
  1602. $v_ssl_key = $ssl_str["HESTIA"]["KEY"];
  1603. $v_ssl_ca = $ssl_str["HESTIA"]["CA"];
  1604. $v_ssl_subject = $ssl_str["HESTIA"]["SUBJECT"];
  1605. $v_ssl_aliases = $ssl_str["HESTIA"]["ALIASES"];
  1606. $v_ssl_not_before = $ssl_str["HESTIA"]["NOT_BEFORE"];
  1607. $v_ssl_not_after = $ssl_str["HESTIA"]["NOT_AFTER"];
  1608. $v_ssl_signature = $ssl_str["HESTIA"]["SIGNATURE"];
  1609. $v_ssl_pub_key = $ssl_str["HESTIA"]["PUB_KEY"];
  1610. $v_ssl_issuer = $ssl_str["HESTIA"]["ISSUER"];
  1611. // Cleanup certificate tempfiles
  1612. if (file_exists($tmpdir . "/certificate.crt")) {
  1613. unlink($tmpdir . "/certificate.crt");
  1614. }
  1615. if (file_exists($tmpdir . "/certificate.key")) {
  1616. unlink($tmpdir . "/certificate.key");
  1617. }
  1618. rmdir($tmpdir);
  1619. }
  1620. }
  1621. // Flush field values on success
  1622. if (empty($_SESSION["error_msg"])) {
  1623. $_SESSION["ok_msg"] = _("Changes have been saved.");
  1624. }
  1625. if ($require_refresh == true) {
  1626. $refresh = $_SERVER["REQUEST_URI"];
  1627. $_SESSION["ok_msg"] = _("Changes have been saved.");
  1628. header("Location: $refresh");
  1629. die();
  1630. }
  1631. }
  1632. // Check system configuration
  1633. exec(HESTIA_CMD . "v-list-sys-config json", $output, $return_var);
  1634. $data = json_decode(implode("", $output), true);
  1635. unset($output);
  1636. $sys_arr = $data["config"];
  1637. foreach ($sys_arr as $key => $value) {
  1638. $_SESSION[$key] = $value;
  1639. }
  1640. // Render page
  1641. render_page($user, $TAB, "edit_server");
  1642. // Flush session messages
  1643. unset($_SESSION["error_msg"]);
  1644. unset($_SESSION["ok_msg"]);