index.php 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727
  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. ) {
  577. $v_smtp_relay = true;
  578. $v_smtp_relay_host = quoteshellarg($_POST["v_smtp_relay_host"]);
  579. $v_smtp_relay_user = quoteshellarg($_POST["v_smtp_relay_user"]);
  580. $v_smtp_relay_pass = quoteshellarg($_POST["v_smtp_relay_pass"]);
  581. if (!empty($_POST["v_smtp_relay_port"])) {
  582. $v_smtp_relay_port = quoteshellarg($_POST["v_smtp_relay_port"]);
  583. } else {
  584. $v_smtp_relay_port = "587";
  585. }
  586. exec(
  587. HESTIA_CMD .
  588. "v-add-sys-smtp-relay " .
  589. $v_smtp_relay_host .
  590. " " .
  591. $v_smtp_relay_user .
  592. " " .
  593. $v_smtp_relay_pass .
  594. " " .
  595. $v_smtp_relay_port,
  596. $output,
  597. $return_var,
  598. );
  599. check_return_code($return_var, $output);
  600. unset($output);
  601. }
  602. }
  603. if (!isset($_POST["v_smtp_relay"]) && $v_smtp_relay == true) {
  604. $v_smtp_relay = false;
  605. $v_smtp_relay_host = $v_smtp_relay_user = $v_smtp_relay_pass = $v_smtp_relay_port = "";
  606. exec(HESTIA_CMD . "v-delete-sys-smtp-relay", $output, $return_var);
  607. check_return_code($return_var, $output);
  608. unset($output);
  609. }
  610. }
  611. // Update phpMyAdmin url
  612. if (empty($_SESSION["error_msg"])) {
  613. if ($_POST["v_mysql_url"] != $_SESSION["DB_PMA_ALIAS"]) {
  614. exec(
  615. HESTIA_CMD . "v-change-sys-db-alias pma " . quoteshellarg($_POST["v_mysql_url"]),
  616. $output,
  617. $return_var,
  618. );
  619. check_return_code($return_var, $output);
  620. unset($output);
  621. $v_db_adv = "yes";
  622. }
  623. }
  624. // Update phpPgAdmin url
  625. if (empty($_SESSION["error_msg"])) {
  626. if (empty($_POST["v_pgsql_url"])) {
  627. $_POST["v_pgsql_url"] = "";
  628. }
  629. if ($_POST["v_pgsql_url"] != $_SESSION["DB_PGA_ALIAS"]) {
  630. exec(
  631. HESTIA_CMD . "v-change-sys-db-alias pga " . quoteshellarg($_POST["v_pgsql_url"]),
  632. $output,
  633. $return_var,
  634. );
  635. check_return_code($return_var, $output);
  636. unset($output);
  637. $v_db_adv = "yes";
  638. }
  639. }
  640. // Update send notification setting
  641. if (empty($_SESSION["error_msg"])) {
  642. if ($_SESSION["UPGRADE_SEND_EMAIL"] == "true") {
  643. $ugrade_send_mail = "on";
  644. } else {
  645. $ugrade_send_mail = "";
  646. }
  647. if ($_POST["v_upgrade_send_notification_email"] != $ugrade_send_mail) {
  648. if ($_POST["v_upgrade_send_notification_email"] == "on") {
  649. $_POST["v_upgrade_send_notification_email"] = "true";
  650. } else {
  651. $_POST["v_upgrade_send_notification_email"] = "false";
  652. }
  653. exec(
  654. HESTIA_CMD .
  655. "v-change-sys-config-value UPGRADE_SEND_EMAIL " .
  656. quoteshellarg($_POST["v_upgrade_send_notification_email"]),
  657. $output,
  658. $return_var,
  659. );
  660. check_return_code($return_var, $output);
  661. unset($output);
  662. $v_upgrade_notification_adv = "yes";
  663. }
  664. }
  665. // Update send log by email setting
  666. if (empty($_SESSION["error_msg"])) {
  667. if ($_SESSION["UPGRADE_SEND_EMAIL_LOG"] == "true") {
  668. $send_email_log = "on";
  669. } else {
  670. $send_email_log = "";
  671. }
  672. if (empty($_POST["v_upgrade_send_email_log"])) {
  673. $_POST["v_upgrade_send_email_log"] = "";
  674. }
  675. if ($_POST["v_upgrade_send_email_log"] != $send_email_log) {
  676. if ($_POST["v_upgrade_send_email_log"] == "on") {
  677. $_POST["v_upgrade_send_email_log"] = "true";
  678. } else {
  679. $_POST["v_upgrade_send_email_log"] = "false";
  680. }
  681. exec(
  682. HESTIA_CMD .
  683. "v-change-sys-config-value UPGRADE_SEND_EMAIL_LOG " .
  684. quoteshellarg($_POST["v_upgrade_send_email_log"]),
  685. $output,
  686. $return_var,
  687. );
  688. check_return_code($return_var, $output);
  689. unset($output);
  690. $v_upgrade_send_log_adv = "yes";
  691. }
  692. }
  693. // Disable local backup
  694. if (empty($_SESSION["error_msg"])) {
  695. if ($_POST["v_backup"] == "no" && $v_backup == "yes") {
  696. exec(HESTIA_CMD . "v-delete-backup-host local", $output, $return_var);
  697. check_return_code($return_var, $output);
  698. unset($output);
  699. if (empty($_SESSION["error_msg"])) {
  700. $v_backup = "no";
  701. }
  702. $v_backup_adv = "yes";
  703. }
  704. }
  705. // Enable local backups
  706. if (empty($_SESSION["error_msg"])) {
  707. if ($_POST["v_backup"] == "yes" && $v_backup != "yes") {
  708. exec(HESTIA_CMD . "v-add-backup-host local", $output, $return_var);
  709. check_return_code($return_var, $output);
  710. unset($output);
  711. if (empty($_SESSION["error_msg"])) {
  712. $v_backup = "yes";
  713. }
  714. $v_backup_adv = "yes";
  715. }
  716. }
  717. // Change backup gzip level
  718. if (empty($_SESSION["error_msg"])) {
  719. if ($_POST["v_backup_gzip"] != $v_backup_gzip) {
  720. if ($_POST["v_backup_mode"] == "gzip") {
  721. $_POST["v_backup_gzip"] = 9;
  722. }
  723. exec(
  724. HESTIA_CMD .
  725. "v-change-sys-config-value BACKUP_GZIP " .
  726. quoteshellarg($_POST["v_backup_gzip"]),
  727. $output,
  728. $return_var,
  729. );
  730. check_return_code($return_var, $output);
  731. unset($output);
  732. if (empty($_SESSION["error_msg"])) {
  733. $v_backup_gzip = $_POST["v_backup_gzip"];
  734. }
  735. $v_backup_adv = "yes";
  736. }
  737. }
  738. // Change backup mode
  739. if (empty($_SESSION["error_msg"])) {
  740. if ($_POST["v_backup_mode"] != $v_backup_mode) {
  741. exec(
  742. HESTIA_CMD .
  743. "v-change-sys-config-value BACKUP_MODE " .
  744. quoteshellarg($_POST["v_backup_mode"]),
  745. $output,
  746. $return_var,
  747. );
  748. check_return_code($return_var, $output);
  749. unset($output);
  750. if (empty($_SESSION["error_msg"])) {
  751. $v_backup_mode = $_POST["v_backup_mode"];
  752. }
  753. $v_backup_adv = "yes";
  754. if ($_POST["v_backup_mode"] == "gzip") {
  755. $_POST["v_backup_gzip"] = 9;
  756. if (empty($_SESSION["error_msg"])) {
  757. $v_backup_gzip = $_POST["v_backup_gzip"];
  758. }
  759. exec(
  760. HESTIA_CMD .
  761. "v-change-sys-config-value BACKUP_GZIP " .
  762. quoteshellarg($_POST["v_backup_gzip"]),
  763. $output,
  764. $return_var,
  765. );
  766. }
  767. }
  768. }
  769. // Change backup path
  770. if (empty($_SESSION["error_msg"])) {
  771. if (empty($_POST["v_backup_dir"])) {
  772. $_POST["v_backup_dir"] = "";
  773. }
  774. if ($_POST["v_backup_dir"] != $v_backup_dir) {
  775. /*
  776. See #1655
  777. exec (HESTIA_CMD."v-change-sys-config-value BACKUP ".quoteshellarg($_POST['v_backup_dir']), $output, $return_var);
  778. check_return_code($return_var,$output);
  779. unset($output);
  780. */
  781. if (empty($_SESSION["error_msg"])) {
  782. $v_backup_dir = $_POST["v_backup_dir"];
  783. }
  784. #$v_backup_adv = 'yes';
  785. }
  786. }
  787. // Add remote backup host
  788. if (empty($_SESSION["error_msg"])) {
  789. if (
  790. $v_backup_host == "" &&
  791. $v_backup_bucket == "" &&
  792. (!empty($_POST["v_backup_host"]) || !empty($_POST["v_backup_bucket"]))
  793. ) {
  794. if (in_array($_POST["v_backup_type"], ["ftp", "sftp"])) {
  795. $v_backup_host = quoteshellarg($_POST["v_backup_host"]);
  796. $v_backup_port = quoteshellarg($_POST["v_backup_port"]);
  797. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  798. $v_backup_username = quoteshellarg($_POST["v_backup_username"]);
  799. $v_backup_password = quoteshellarg($_POST["v_backup_password"]);
  800. $v_backup_bpath = quoteshellarg($_POST["v_backup_bpath"]);
  801. exec(
  802. HESTIA_CMD .
  803. "v-add-backup-host " .
  804. $v_backup_type .
  805. " " .
  806. $v_backup_host .
  807. " " .
  808. $v_backup_username .
  809. " " .
  810. $v_backup_password .
  811. " " .
  812. $v_backup_bpath .
  813. " " .
  814. $v_backup_port,
  815. $output,
  816. $return_var,
  817. );
  818. check_return_code($return_var, $output);
  819. unset($output);
  820. if (empty($_SESSION["error_msg"])) {
  821. $v_backup_host = $_POST["v_backup_host"];
  822. }
  823. if (empty($_SESSION["error_msg"])) {
  824. $v_backup_type = $_POST["v_backup_type"];
  825. }
  826. if (empty($_SESSION["error_msg"])) {
  827. $v_backup_username = $_POST["v_backup_username"];
  828. }
  829. if (empty($_SESSION["error_msg"])) {
  830. $v_backup_password = $_POST["v_backup_password"];
  831. }
  832. if (empty($_SESSION["error_msg"])) {
  833. $v_backup_bpath = $_POST["v_backup_bpath"];
  834. }
  835. if (empty($_SESSION["error_msg"])) {
  836. $v_backup_port = $_POST["v_backup_port"];
  837. }
  838. $v_backup_new = "yes";
  839. $v_backup_adv = "yes";
  840. $v_backup_remote_adv = "yes";
  841. } elseif (in_array($_POST["v_backup_type"], ["b2"])) {
  842. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  843. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  844. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  845. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  846. exec(
  847. HESTIA_CMD .
  848. "v-add-backup-host " .
  849. $v_backup_type .
  850. " " .
  851. $v_backup_bucket .
  852. " " .
  853. $v_backup_application_id .
  854. " " .
  855. $v_backup_application_key,
  856. $output,
  857. $return_var,
  858. );
  859. check_return_code($return_var, $output);
  860. unset($output);
  861. if (empty($_SESSION["error_msg"])) {
  862. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  863. }
  864. if (empty($_SESSION["error_msg"])) {
  865. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  866. }
  867. if (empty($_SESSION["error_msg"])) {
  868. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  869. }
  870. $v_backup_new = "yes";
  871. $v_backup_adv = "yes";
  872. $v_backup_remote_adv = "yes";
  873. }
  874. }
  875. if (
  876. $v_rclone_host == "" &&
  877. !empty($_POST["v_rclone_host"]) &&
  878. $_POST["v_backup_type"] == "rclone"
  879. ) {
  880. $v_rclone_host = quoteshellarg($_POST["v_rclone_host"]);
  881. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  882. $v_rclone_path = quoteshellarg($_POST["v_rclone_path"]);
  883. exec(
  884. HESTIA_CMD .
  885. "v-add-backup-host " .
  886. $v_backup_type .
  887. " " .
  888. $v_rclone_host .
  889. " '' '' " .
  890. $v_rclone_path,
  891. $output,
  892. $return_var,
  893. );
  894. check_return_code($return_var, $output);
  895. unset($output);
  896. $v_backup_new = "yes";
  897. $v_backup_adv = "yes";
  898. $v_backup_remote_adv = "yes";
  899. }
  900. }
  901. // Change remote backup host type
  902. if (empty($_SESSION["error_msg"])) {
  903. if (
  904. !empty($_POST["v_backup_host"]) &&
  905. $_POST["v_backup_type"] != $v_backup_type &&
  906. $v_backup_type != ""
  907. ) {
  908. exec(
  909. HESTIA_CMD . "v-delete-backup-host " . quoteshellarg($v_backup_type),
  910. $output,
  911. $return_var,
  912. );
  913. unset($output);
  914. if (in_array($_POST["v_backup_type"], ["ftp", "sftp"])) {
  915. $v_backup_host = quoteshellarg($_POST["v_backup_host"]);
  916. $v_backup_port = quoteshellarg($_POST["v_backup_port"]);
  917. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  918. $v_backup_username = quoteshellarg($_POST["v_backup_username"]);
  919. $v_backup_password = quoteshellarg($_POST["v_backup_password"]);
  920. $v_backup_bpath = quoteshellarg($_POST["v_backup_bpath"]);
  921. exec(
  922. HESTIA_CMD .
  923. "v-add-backup-host " .
  924. $v_backup_type .
  925. " " .
  926. $v_backup_host .
  927. " " .
  928. $v_backup_username .
  929. " " .
  930. $v_backup_password .
  931. " " .
  932. $v_backup_bpath .
  933. " " .
  934. $v_backup_port,
  935. $output,
  936. $return_var,
  937. );
  938. check_return_code($return_var, $output);
  939. unset($output);
  940. if (empty($_SESSION["error_msg"])) {
  941. $v_backup_host = $_POST["v_backup_host"];
  942. }
  943. if (empty($_SESSION["error_msg"])) {
  944. $v_backup_type = $_POST["v_backup_type"];
  945. }
  946. if (empty($_SESSION["error_msg"])) {
  947. $v_backup_username = $_POST["v_backup_username"];
  948. }
  949. if (empty($_SESSION["error_msg"])) {
  950. $v_backup_password = $_POST["v_backup_password"];
  951. }
  952. if (empty($_SESSION["error_msg"])) {
  953. $v_backup_bpath = $_POST["v_backup_bpath"];
  954. }
  955. if (empty($_SESSION["error_msg"])) {
  956. $v_backup_port = $_POST["v_backup_port"];
  957. }
  958. $v_backup_adv = "yes";
  959. $v_backup_remote_adv = "yes";
  960. } elseif (in_array($_POST["v_backup_type"], ["b2"])) {
  961. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  962. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  963. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  964. exec(
  965. HESTIA_CMD .
  966. "v-add-backup-host " .
  967. $v_backup_type .
  968. " " .
  969. $v_backup_bucket .
  970. " " .
  971. $v_backup_application_id .
  972. " " .
  973. $v_backup_application_key,
  974. $output,
  975. $return_var,
  976. );
  977. check_return_code($return_var, $output);
  978. unset($output);
  979. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  980. if (empty($_SESSION["error_msg"])) {
  981. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  982. }
  983. if (empty($_SESSION["error_msg"])) {
  984. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  985. }
  986. if (empty($_SESSION["error_msg"])) {
  987. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  988. }
  989. $v_backup_adv = "yes";
  990. $v_backup_remote_adv = "yes";
  991. }
  992. }
  993. }
  994. // Change remote backup host
  995. if (empty($_SESSION["error_msg"])) {
  996. if ($_POST["v_backup_type"] == $v_backup_type && !isset($v_backup_new)) {
  997. if (in_array($_POST["v_backup_type"], ["ftp", "sftp"])) {
  998. if (
  999. $_POST["v_backup_host"] != $v_backup_host ||
  1000. $_POST["v_backup_username"] != $v_backup_username ||
  1001. $_POST["v_backup_password"] != $v_backup_password ||
  1002. ($_POST["v_backup_bpath"] != $v_backup_bpath ||
  1003. $_POST["v_backup_port"] != $v_backup_port)
  1004. ) {
  1005. $v_backup_host = quoteshellarg($_POST["v_backup_host"]);
  1006. $v_backup_port = quoteshellarg($_POST["v_backup_port"]);
  1007. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  1008. $v_backup_username = quoteshellarg($_POST["v_backup_username"]);
  1009. $v_backup_password = quoteshellarg($_POST["v_backup_password"]);
  1010. $v_backup_bpath = quoteshellarg($_POST["v_backup_bpath"]);
  1011. exec(
  1012. HESTIA_CMD .
  1013. "v-add-backup-host " .
  1014. $v_backup_type .
  1015. " " .
  1016. $v_backup_host .
  1017. " " .
  1018. $v_backup_username .
  1019. " " .
  1020. $v_backup_password .
  1021. " " .
  1022. $v_backup_bpath .
  1023. " " .
  1024. $v_backup_port,
  1025. $output,
  1026. $return_var,
  1027. );
  1028. check_return_code($return_var, $output);
  1029. unset($output);
  1030. if (empty($_SESSION["error_msg"])) {
  1031. $v_backup_host = $_POST["v_backup_host"];
  1032. }
  1033. if (empty($_SESSION["error_msg"])) {
  1034. $v_backup_type = $_POST["v_backup_type"];
  1035. }
  1036. if (empty($_SESSION["error_msg"])) {
  1037. $v_backup_username = $_POST["v_backup_username"];
  1038. }
  1039. if (empty($_SESSION["error_msg"])) {
  1040. $v_backup_password = $_POST["v_backup_password"];
  1041. }
  1042. if (empty($_SESSION["error_msg"])) {
  1043. $v_backup_bpath = $_POST["v_backup_bpath"];
  1044. }
  1045. if (empty($_SESSION["error_msg"])) {
  1046. $v_backup_port = $_POST["v_backup_port"];
  1047. }
  1048. $v_backup_adv = "yes";
  1049. $v_backup_remote_adv = "yes";
  1050. }
  1051. } elseif (in_array($_POST["v_backup_type"], ["b2"])) {
  1052. if (
  1053. $_POST["v_backup_bucket"] != $v_backup_bucket ||
  1054. $_POST["v_backup_application_key"] != $v_backup_application_key ||
  1055. $_POST["v_backup_application_id"] != $v_backup_application_id
  1056. ) {
  1057. $v_backup_type = quoteshellarg($_POST["v_backup_type"]);
  1058. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  1059. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  1060. $v_backup_application_key = quoteshellarg($_POST["v_backup_application_key"]);
  1061. exec(
  1062. HESTIA_CMD .
  1063. "v-add-backup-host " .
  1064. $v_backup_type .
  1065. " " .
  1066. $v_backup_bucket .
  1067. " " .
  1068. $v_backup_application_id .
  1069. " " .
  1070. $v_backup_application_key,
  1071. $output,
  1072. $return_var,
  1073. );
  1074. check_return_code($return_var, $output);
  1075. unset($output);
  1076. if (empty($_SESSION["error_msg"])) {
  1077. $v_backup_bucket = quoteshellarg($_POST["v_backup_bucket"]);
  1078. }
  1079. if (empty($_SESSION["error_msg"])) {
  1080. $v_backup_application_id = quoteshellarg($_POST["v_backup_application_id"]);
  1081. }
  1082. if (empty($_SESSION["error_msg"])) {
  1083. $v_backup_application_key = quoteshellarg(
  1084. $_POST["v_backup_application_key"],
  1085. );
  1086. }
  1087. $v_backup_adv = "yes";
  1088. $v_backup_remote_adv = "yes";
  1089. }
  1090. }
  1091. }
  1092. }
  1093. // Delete remote backup host
  1094. if (empty($_SESSION["error_msg"])) {
  1095. if (empty($_POST["v_backup_remote_adv"]) && $v_backup_remote_adv != "") {
  1096. exec(
  1097. HESTIA_CMD . "v-delete-backup-host " . quoteshellarg($v_backup_type),
  1098. $output,
  1099. $return_var,
  1100. );
  1101. check_return_code($return_var, $output);
  1102. unset($output);
  1103. if (empty($_SESSION["error_msg"])) {
  1104. $v_backup_host = "";
  1105. }
  1106. if (empty($_SESSION["error_msg"])) {
  1107. $v_backup_type = "";
  1108. }
  1109. if (empty($_SESSION["error_msg"])) {
  1110. $v_backup_username = "";
  1111. }
  1112. if (empty($_SESSION["error_msg"])) {
  1113. $v_backup_password = "";
  1114. }
  1115. if (empty($_SESSION["error_msg"])) {
  1116. $v_backup_bpath = "";
  1117. }
  1118. if (empty($_SESSION["error_msg"])) {
  1119. $v_backup_bucket = "";
  1120. }
  1121. if (empty($_SESSION["error_msg"])) {
  1122. $v_backup_application_id = "";
  1123. }
  1124. if (empty($_SESSION["error_msg"])) {
  1125. $v_backup_application_key = "";
  1126. }
  1127. $v_backup_adv = "";
  1128. $v_backup_remote_adv = "";
  1129. }
  1130. }
  1131. // Change INACTIVE_SESSION_TIMEOUT
  1132. if (empty($_SESSION["error_msg"])) {
  1133. if ($_POST["v_inactive_session_timeout"] != $_SESSION["INACTIVE_SESSION_TIMEOUT"]) {
  1134. if ($_POST["v_inactive_session_timeout"] < 1) {
  1135. $_SESSION["error_msg"] = _("Inactive session timeout can not lower than 1 minute.");
  1136. } else {
  1137. exec(
  1138. HESTIA_CMD .
  1139. "v-change-sys-config-value INACTIVE_SESSION_TIMEOUT " .
  1140. quoteshellarg($_POST["v_inactive_session_timeout"]),
  1141. $output,
  1142. $return_var,
  1143. );
  1144. check_return_code($return_var, $output);
  1145. unset($output);
  1146. if (empty($_SESSION["error_msg"])) {
  1147. $v_inactive_session_timeout = $_POST["v_inactive_session_timeout"];
  1148. }
  1149. }
  1150. $v_security_adv = "yes";
  1151. }
  1152. }
  1153. // Change POLICY_CSRF_STRICTNESS
  1154. if (empty($_SESSION["error_msg"])) {
  1155. if ($_POST["v_policy_csrf_strictness"] != $_SESSION["POLICY_CSRF_STRICTNESS"]) {
  1156. exec(
  1157. HESTIA_CMD .
  1158. "v-change-sys-config-value POLICY_CSRF_STRICTNESS " .
  1159. quoteshellarg($_POST["v_policy_csrf_strictness"]),
  1160. $output,
  1161. $return_var,
  1162. );
  1163. check_return_code($return_var, $output);
  1164. unset($output);
  1165. if (empty($_SESSION["error_msg"])) {
  1166. $v_policy_csrf_strictness = $_POST["v_inactive_session_timeout"];
  1167. }
  1168. $v_security_adv = "yes";
  1169. }
  1170. }
  1171. // Change ENFORCE_SUBDOMAIN_OWNERSHIP
  1172. if (empty($_SESSION["error_msg"])) {
  1173. if ($_POST["v_enforce_subdomain_ownership"] != $_SESSION["ENFORCE_SUBDOMAIN_OWNERSHIP"]) {
  1174. exec(
  1175. HESTIA_CMD .
  1176. "v-change-sys-config-value ENFORCE_SUBDOMAIN_OWNERSHIP " .
  1177. quoteshellarg($_POST["v_enforce_subdomain_ownership"]),
  1178. $output,
  1179. $return_var,
  1180. );
  1181. check_return_code($return_var, $output);
  1182. unset($output);
  1183. if (empty($_SESSION["error_msg"])) {
  1184. $v_enforce_subdomain_ownership = $_POST["v_enforce_subdomain_ownership"];
  1185. }
  1186. $v_security_adv = "yes";
  1187. }
  1188. }
  1189. // Change POLICY_USER_EDIT_DETAILS
  1190. if (empty($_SESSION["error_msg"])) {
  1191. if ($_POST["v_policy_user_edit_details"] != $_SESSION["POLICY_USER_EDIT_DETAILS"]) {
  1192. exec(
  1193. HESTIA_CMD .
  1194. "v-change-sys-config-value POLICY_USER_EDIT_DETAILS " .
  1195. quoteshellarg($_POST["v_policy_user_edit_details"]),
  1196. $output,
  1197. $return_var,
  1198. );
  1199. check_return_code($return_var, $output);
  1200. unset($output);
  1201. if (empty($_SESSION["error_msg"])) {
  1202. $v_policy_user_edit_details = $_POST["v_policy_user_edit_details"];
  1203. }
  1204. $v_security_adv = "yes";
  1205. }
  1206. }
  1207. // Change POLICY_USER_EDIT_WEB_TEMPLATES
  1208. if (empty($_SESSION["error_msg"])) {
  1209. if (
  1210. $_POST["v_policy_user_edit_web_templates"] !=
  1211. $_SESSION["POLICY_USER_EDIT_WEB_TEMPLATES"]
  1212. ) {
  1213. exec(
  1214. HESTIA_CMD .
  1215. "v-change-sys-config-value POLICY_USER_EDIT_WEB_TEMPLATES " .
  1216. quoteshellarg($_POST["v_policy_user_edit_web_templates"]),
  1217. $output,
  1218. $return_var,
  1219. );
  1220. check_return_code($return_var, $output);
  1221. unset($output);
  1222. if (empty($_SESSION["error_msg"])) {
  1223. $v_policy_user_edit_details = $_POST["v_policy_user_edit_web_templates"];
  1224. }
  1225. $v_security_adv = "yes";
  1226. }
  1227. }
  1228. // Change POLICY_USER_EDIT_DNS_TEMPLATES
  1229. if (empty($_SESSION["error_msg"])) {
  1230. if (
  1231. $_POST["v_policy_user_edit_dns_templates"] !=
  1232. $_SESSION["POLICY_USER_EDIT_DNS_TEMPLATES"]
  1233. ) {
  1234. exec(
  1235. HESTIA_CMD .
  1236. "v-change-sys-config-value POLICY_USER_EDIT_DNS_TEMPLATES " .
  1237. quoteshellarg($_POST["v_policy_user_edit_dns_templates"]),
  1238. $output,
  1239. $return_var,
  1240. );
  1241. check_return_code($return_var, $output);
  1242. unset($output);
  1243. if (empty($_SESSION["error_msg"])) {
  1244. $v_policy_user_edit_details = $_POST["v_policy_user_edit_dns_templates"];
  1245. }
  1246. $v_security_adv = "yes";
  1247. }
  1248. }
  1249. if (
  1250. $_POST["v_api_system"] != $_SESSION["API_SYSTEM"] ||
  1251. $_POST["v_api"] != $_SESSION["API"] ||
  1252. $_POST["v_api_allowed_ip"] != $_SESSION["API_ALLOWED_IP"]
  1253. ) {
  1254. if (empty($_SESSION["error_msg"])) {
  1255. if ($_POST["v_api"] == "no" && $_POST["v_api_system"] === 0) {
  1256. exec(HESTIA_CMD . "v-change-sys-api 'disable'", $output, $return_var);
  1257. check_return_code($return_var, $output);
  1258. unset($output);
  1259. }
  1260. if (
  1261. $_POST["v_api"] == "yes" ||
  1262. ($_POST["v_api_system"] !== 0 &&
  1263. $_POST["v_api_system"] != $_SESSION["API_SYSTEM"]) ||
  1264. $_POST["v_api"] != $_SESSION["API"]
  1265. ) {
  1266. exec(HESTIA_CMD . "v-change-sys-api 'enable'", $output, $return_var);
  1267. check_return_code($return_var, $output);
  1268. unset($output);
  1269. }
  1270. }
  1271. if (empty($_SESSION["error_msg"])) {
  1272. if ($_POST["v_api_system"] != $_SESSION["API_SYSTEM"]) {
  1273. exec(
  1274. HESTIA_CMD .
  1275. "v-change-sys-config-value API_SYSTEM " .
  1276. quoteshellarg($_POST["v_api_system"]),
  1277. $output,
  1278. $return_var,
  1279. );
  1280. check_return_code($return_var, $output);
  1281. unset($output);
  1282. if (empty($_SESSION["error_msg"])) {
  1283. $v_policy_user_edit_details = $_POST["v_api_system"];
  1284. }
  1285. $v_security_adv = "yes";
  1286. }
  1287. }
  1288. // Change API access
  1289. if (empty($_SESSION["error_msg"])) {
  1290. if ($_POST["v_api"] != $_SESSION["API"]) {
  1291. $api_status = "no";
  1292. if ($_POST["v_api"] == "yes") {
  1293. $api_status = "yes";
  1294. }
  1295. exec(
  1296. HESTIA_CMD . "v-change-sys-config-value API " . quoteshellarg($api_status),
  1297. $output,
  1298. $return_var,
  1299. );
  1300. check_return_code($return_var, $output);
  1301. unset($output);
  1302. if (empty($_SESSION["error_msg"])) {
  1303. $v_api = $_POST["v_api"];
  1304. }
  1305. $v_security_adv = "yes";
  1306. }
  1307. }
  1308. // Change API allowed IPs
  1309. if (empty($_SESSION["error_msg"])) {
  1310. if ($_POST["v_api_allowed_ip"] != $_SESSION["API_ALLOWED_IP"]) {
  1311. $ips = [];
  1312. foreach (explode("\n", $_POST["v_api_allowed_ip"]) as $ip) {
  1313. if (trim($ip) != "allow-all") {
  1314. if (filter_var(trim($ip), FILTER_VALIDATE_IP)) {
  1315. $ips[] = trim($ip);
  1316. }
  1317. } else {
  1318. $ips[] = trim($ip);
  1319. }
  1320. }
  1321. if (implode(",", $ips) != $_SESSION["API_ALLOWED_IP"]) {
  1322. exec(
  1323. HESTIA_CMD .
  1324. "v-change-sys-config-value API_ALLOWED_IP " .
  1325. quoteshellarg(implode(",", $ips)),
  1326. $output,
  1327. $return_var,
  1328. );
  1329. check_return_code($return_var, $output);
  1330. unset($output);
  1331. if (empty($_SESSION["error_msg"])) {
  1332. $v_api_allowed_ip = $_POST["v_api_allowed_ip"];
  1333. }
  1334. $v_security_adv = "yes";
  1335. }
  1336. }
  1337. }
  1338. }
  1339. // Change POLICY_USER_VIEW_LOGS
  1340. if (empty($_SESSION["error_msg"])) {
  1341. if ($_POST["v_policy_user_view_logs"] != $_SESSION["POLICY_USER_VIEW_LOGS"]) {
  1342. exec(
  1343. HESTIA_CMD .
  1344. "v-change-sys-config-value POLICY_USER_VIEW_LOGS " .
  1345. quoteshellarg($_POST["v_policy_user_view_logs"]),
  1346. $output,
  1347. $return_var,
  1348. );
  1349. check_return_code($return_var, $output);
  1350. unset($output);
  1351. if (empty($_SESSION["error_msg"])) {
  1352. $v_policy_user_view_logs = $_POST["v_policy_user_view_logs"];
  1353. }
  1354. $v_security_adv = "yes";
  1355. }
  1356. }
  1357. // Change POLICY_USER_DELETE_LOGS
  1358. if (empty($_SESSION["error_msg"])) {
  1359. if ($_POST["v_policy_user_delete_logs"] != $_SESSION["POLICY_USER_DELETE_LOGS"]) {
  1360. exec(
  1361. HESTIA_CMD .
  1362. "v-change-sys-config-value POLICY_USER_DELETE_LOGS " .
  1363. quoteshellarg($_POST["v_policy_user_delete_logs"]),
  1364. $output,
  1365. $return_var,
  1366. );
  1367. check_return_code($return_var, $output);
  1368. unset($output);
  1369. if (empty($_SESSION["error_msg"])) {
  1370. $v_policy_user_delete_logs = $_POST["v_policy_user_delete_logs"];
  1371. }
  1372. $v_security_adv = "yes";
  1373. }
  1374. }
  1375. // Change POLICY_SYSTEM_PASSWORD_RESET
  1376. if (empty($_SESSION["error_msg"])) {
  1377. if ($_POST["v_policy_system_password_reset"] != $_SESSION["POLICY_SYSTEM_PASSWORD_RESET"]) {
  1378. exec(
  1379. HESTIA_CMD .
  1380. "v-change-sys-config-value POLICY_SYSTEM_PASSWORD_RESET " .
  1381. quoteshellarg($_POST["v_policy_system_password_reset"]),
  1382. $output,
  1383. $return_var,
  1384. );
  1385. check_return_code($return_var, $output);
  1386. unset($output);
  1387. if (empty($_SESSION["error_msg"])) {
  1388. $v_policy_system_password_reset = $_POST["v_policy_system_password_reset"];
  1389. }
  1390. $v_security_adv = "yes";
  1391. }
  1392. }
  1393. // Change POLICY_SYSTEM_PROTECTED_ADMIN
  1394. if (empty($_SESSION["error_msg"])) {
  1395. if (
  1396. $_POST["v_policy_system_protected_admin"] != $_SESSION["POLICY_SYSTEM_PROTECTED_ADMIN"]
  1397. ) {
  1398. exec(
  1399. HESTIA_CMD .
  1400. "v-change-sys-config-value POLICY_SYSTEM_PROTECTED_ADMIN " .
  1401. quoteshellarg($_POST["v_policy_system_protected_admin"]),
  1402. $output,
  1403. $return_var,
  1404. );
  1405. check_return_code($return_var, $output);
  1406. unset($output);
  1407. if (empty($_SESSION["error_msg"])) {
  1408. $v_policy_system_protected_admin = $_POST["v_policy_system_protected_admin"];
  1409. }
  1410. $v_security_adv = "yes";
  1411. }
  1412. }
  1413. // Change POLICY_USER_VIEW_SUSPENDED
  1414. if (empty($_SESSION["error_msg"])) {
  1415. if (
  1416. $_POST["v_policy_user_view_suspended"] != $_SESSION["POLICY_USER_VIEW_SUSPENDED"] &&
  1417. !empty($_SESSION["POLICY_USER_VIEW_SUSPENDED"])
  1418. ) {
  1419. exec(
  1420. HESTIA_CMD .
  1421. "v-change-sys-config-value POLICY_USER_VIEW_SUSPENDED " .
  1422. quoteshellarg($_POST["v_policy_user_view_suspended"]),
  1423. $output,
  1424. $return_var,
  1425. );
  1426. check_return_code($return_var, $output);
  1427. unset($output);
  1428. if (empty($_SESSION["error_msg"])) {
  1429. $v_policy_system_hide_admin = $_POST["v_policy_user_view_suspended"];
  1430. }
  1431. $v_security_adv = "yes";
  1432. }
  1433. }
  1434. // Change POLICY_USER_CHANGE_THEME
  1435. if (empty($_SESSION["error_msg"])) {
  1436. if (empty($_POST["v_policy_user_change_theme"])) {
  1437. $_POST["v_policy_user_change_theme"] = "";
  1438. }
  1439. if ($_POST["v_policy_user_change_theme"] == "on") {
  1440. $_POST["v_policy_user_change_theme"] = "no";
  1441. } else {
  1442. $_POST["v_policy_user_change_theme"] = "yes";
  1443. }
  1444. if ($_POST["v_policy_user_change_theme"] != $_SESSION["POLICY_USER_CHANGE_THEME"]) {
  1445. exec(
  1446. HESTIA_CMD .
  1447. "v-change-sys-config-value POLICY_USER_CHANGE_THEME " .
  1448. quoteshellarg($_POST["v_policy_user_change_theme"]),
  1449. $output,
  1450. $return_var,
  1451. );
  1452. check_return_code($return_var, $output);
  1453. unset($output);
  1454. if ($_POST["v_policy_user_change_theme"]) {
  1455. unset($_SESSION["userTheme"]);
  1456. $require_refresh = true;
  1457. }
  1458. if (empty($_SESSION["error_msg"])) {
  1459. $v_policy_user_change_theme = $_POST["v_policy_user_change_theme"];
  1460. }
  1461. }
  1462. }
  1463. // Change POLICY_SYSTEM_HIDE_ADMIN
  1464. if (empty($_SESSION["error_msg"])) {
  1465. if ($_POST["v_policy_system_hide_admin"] != $_SESSION["POLICY_SYSTEM_HIDE_ADMIN"]) {
  1466. exec(
  1467. HESTIA_CMD .
  1468. "v-change-sys-config-value POLICY_SYSTEM_HIDE_ADMIN " .
  1469. quoteshellarg($_POST["v_policy_system_hide_admin"]),
  1470. $output,
  1471. $return_var,
  1472. );
  1473. check_return_code($return_var, $output);
  1474. unset($output);
  1475. if (empty($_SESSION["error_msg"])) {
  1476. $v_policy_system_hide_admin = $_POST["v_policy_system_hide_admin"];
  1477. }
  1478. $v_security_adv = "yes";
  1479. }
  1480. }
  1481. // Change POLICY_SYSTEM_HIDE_SERVICES
  1482. if (empty($_SESSION["error_msg"])) {
  1483. if ($_POST["v_policy_system_hide_services"] != $_SESSION["POLICY_SYSTEM_HIDE_SERVICES"]) {
  1484. exec(
  1485. HESTIA_CMD .
  1486. "v-change-sys-config-value POLICY_SYSTEM_HIDE_SERVICES " .
  1487. quoteshellarg($_POST["v_policy_system_hide_services"]),
  1488. $output,
  1489. $return_var,
  1490. );
  1491. check_return_code($return_var, $output);
  1492. unset($output);
  1493. if (empty($_SESSION["error_msg"])) {
  1494. $v_policy_system_hide_services = $_POST["v_policy_system_hide_services"];
  1495. }
  1496. $v_security_adv = "yes";
  1497. }
  1498. }
  1499. // Change POLICY_SYSTEM_HIDE_SERVICES
  1500. if (empty($_SESSION["error_msg"])) {
  1501. if (
  1502. $_POST["v_policy_backup_suspended_users"] != $_SESSION["POLICY_BACKUP_SUSPENDED_USERS"]
  1503. ) {
  1504. exec(
  1505. HESTIA_CMD .
  1506. "v-change-sys-config-value POLICY_BACKUP_SUSPENDED_USERS " .
  1507. quoteshellarg($_POST["v_policy_backup_suspended_users"]),
  1508. $output,
  1509. $return_var,
  1510. );
  1511. check_return_code($return_var, $output);
  1512. unset($output);
  1513. if (empty($_SESSION["error_msg"])) {
  1514. $v_policy_system_hide_services = $_POST["v_policy_backup_suspended_users"];
  1515. }
  1516. $v_security_adv = "yes";
  1517. }
  1518. }
  1519. if (empty($_SESSION["error_msg"])) {
  1520. if ($_POST["v_policy_sync_error_documents"] != $_SESSION["POLICY_SYNC_ERROR_DOCUMENTS"]) {
  1521. exec(
  1522. HESTIA_CMD .
  1523. "v-change-sys-config-value POLICY_SYNC_ERROR_DOCUMENTS " .
  1524. quoteshellarg($_POST["v_policy_sync_error_documents"]),
  1525. $output,
  1526. $return_var,
  1527. );
  1528. check_return_code($return_var, $output);
  1529. unset($output);
  1530. if (empty($_SESSION["error_msg"])) {
  1531. $v_policy_sync_error_documents = $_POST["v_policy_sync_error_documents"];
  1532. }
  1533. $v_security_adv = "yes";
  1534. }
  1535. }
  1536. if (empty($_SESSION["error_msg"])) {
  1537. if ($_POST["v_policy_sync_skeleton"] != $_SESSION["POLICY_SYNC_SKELETON"]) {
  1538. exec(
  1539. HESTIA_CMD .
  1540. "v-change-sys-config-value POLICY_SYNC_SKELETON " .
  1541. quoteshellarg($_POST["v_policy_sync_skeleton"]),
  1542. $output,
  1543. $return_var,
  1544. );
  1545. check_return_code($return_var, $output);
  1546. unset($output);
  1547. if (empty($_SESSION["error_msg"])) {
  1548. $v_policy_sync_skeleton = $_POST["v_policy_sync_skeleton"];
  1549. }
  1550. $v_security_adv = "yes";
  1551. }
  1552. }
  1553. // Change login style
  1554. if (empty($_SESSION["error_msg"])) {
  1555. if ($_POST["v_login_style"] != $_SESSION["LOGIN_STYLE"]) {
  1556. exec(
  1557. HESTIA_CMD .
  1558. "v-change-sys-config-value LOGIN_STYLE " .
  1559. quoteshellarg($_POST["v_login_style"]),
  1560. $output,
  1561. $return_var,
  1562. );
  1563. check_return_code($return_var, $output);
  1564. unset($output);
  1565. if (empty($_SESSION["error_msg"])) {
  1566. $v_login_style = $_POST["v_login_style"];
  1567. }
  1568. $v_security_adv = "yes";
  1569. }
  1570. }
  1571. // Update SSL certificate
  1572. if (!empty($_POST["v_ssl_crt"]) && empty($_SESSION["error_msg"])) {
  1573. if (
  1574. $v_ssl_crt != str_replace("\r\n", "\n", $_POST["v_ssl_crt"]) ||
  1575. $v_ssl_key != str_replace("\r\n", "\n", $_POST["v_ssl_key"])
  1576. ) {
  1577. exec("mktemp -d", $mktemp_output, $return_var);
  1578. $tmpdir = $mktemp_output[0];
  1579. // Certificate
  1580. if (!empty($_POST["v_ssl_crt"])) {
  1581. $fp = fopen($tmpdir . "/certificate.crt", "w");
  1582. fwrite($fp, str_replace("\r\n", "\n", $_POST["v_ssl_crt"]));
  1583. fwrite($fp, "\n");
  1584. fclose($fp);
  1585. }
  1586. // Key
  1587. if (!empty($_POST["v_ssl_key"])) {
  1588. $fp = fopen($tmpdir . "/certificate.key", "w");
  1589. fwrite($fp, str_replace("\r\n", "\n", $_POST["v_ssl_key"]));
  1590. fwrite($fp, "\n");
  1591. fclose($fp);
  1592. }
  1593. exec(HESTIA_CMD . "v-change-sys-hestia-ssl " . $tmpdir, $output, $return_var);
  1594. check_return_code($return_var, $output);
  1595. unset($output);
  1596. // List ssl certificate info
  1597. exec(HESTIA_CMD . "v-list-sys-hestia-ssl json", $output, $return_var);
  1598. $ssl_str = json_decode(implode("", $output), true);
  1599. unset($output);
  1600. $v_ssl_crt = $ssl_str["HESTIA"]["CRT"];
  1601. $v_ssl_key = $ssl_str["HESTIA"]["KEY"];
  1602. $v_ssl_ca = $ssl_str["HESTIA"]["CA"];
  1603. $v_ssl_subject = $ssl_str["HESTIA"]["SUBJECT"];
  1604. $v_ssl_aliases = $ssl_str["HESTIA"]["ALIASES"];
  1605. $v_ssl_not_before = $ssl_str["HESTIA"]["NOT_BEFORE"];
  1606. $v_ssl_not_after = $ssl_str["HESTIA"]["NOT_AFTER"];
  1607. $v_ssl_signature = $ssl_str["HESTIA"]["SIGNATURE"];
  1608. $v_ssl_pub_key = $ssl_str["HESTIA"]["PUB_KEY"];
  1609. $v_ssl_issuer = $ssl_str["HESTIA"]["ISSUER"];
  1610. // Cleanup certificate tempfiles
  1611. if (file_exists($tmpdir . "/certificate.crt")) {
  1612. unlink($tmpdir . "/certificate.crt");
  1613. }
  1614. if (file_exists($tmpdir . "/certificate.key")) {
  1615. unlink($tmpdir . "/certificate.key");
  1616. }
  1617. rmdir($tmpdir);
  1618. }
  1619. }
  1620. // Flush field values on success
  1621. if (empty($_SESSION["error_msg"])) {
  1622. $_SESSION["ok_msg"] = _("Changes have been saved.");
  1623. }
  1624. if ($require_refresh == true) {
  1625. $refresh = $_SERVER["REQUEST_URI"];
  1626. $_SESSION["ok_msg"] = _("Changes have been saved.");
  1627. header("Location: $refresh");
  1628. die();
  1629. }
  1630. }
  1631. // Check system configuration
  1632. exec(HESTIA_CMD . "v-list-sys-config json", $output, $return_var);
  1633. $data = json_decode(implode("", $output), true);
  1634. unset($output);
  1635. $sys_arr = $data["config"];
  1636. foreach ($sys_arr as $key => $value) {
  1637. $_SESSION[$key] = $value;
  1638. }
  1639. // Render page
  1640. render_page($user, $TAB, "edit_server");
  1641. // Flush session messages
  1642. unset($_SESSION["error_msg"]);
  1643. unset($_SESSION["ok_msg"]);