|
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 |
|
| 1116 | + // Change API access |
| 1117 | + if (empty($_SESSION['error_msg'])) { |
| 1118 | + if ($_POST['v_api'] != $_SESSION['API']) { |
| 1119 | + $api_status = 'disable'; |
| 1120 | + if ($_POST['v_api'] == 'yes') { |
| 1121 | + $api_status = 'enable'; |
| 1122 | + } |
| 1123 | + exec(HESTIA_CMD."v-change-sys-api ".escapeshellarg($api_status), $output, $return_var); |
| 1124 | + check_return_code($return_var, $output); |
| 1125 | + unset($output); |
| 1126 | + if (empty($_SESSION['error_msg'])) { |
| 1127 | + $v_api = $_POST['v_api']; |
| 1128 | + } |
| 1129 | + $v_security_adv = 'yes'; |
| 1130 | + } |
| 1131 | + } |
| 1132 | + |
| 1133 | + // Change API allowed IPs |
1116 | 1134 | if (empty($_SESSION['error_msg'])) { |
1117 | 1135 | if ($_POST['v_api_allowed_ip'] != $_SESSION['API_ALLOWED_IP']) { |
1118 | 1136 | $ips = array(); |
1119 | 1137 | foreach (explode("\n", $_POST['v_api_allowed_ip']) as $ip) { |
1120 | | - if ($ip != "allow-all") { |
| 1138 | + if (trim($ip) != "allow-all") { |
1121 | 1139 | if (filter_var(trim($ip), FILTER_VALIDATE_IP)) { |
1122 | 1140 | $ips[] = trim($ip); |
1123 | 1141 | } |
|
1130 | 1148 | check_return_code($return_var, $output); |
1131 | 1149 | unset($output); |
1132 | 1150 | if (empty($_SESSION['error_msg'])) { |
1133 | | - $v_login_style = $_POST['v_api_allowed_ip']; |
| 1151 | + $v_api_allowed_ip = $_POST['v_api_allowed_ip']; |
1134 | 1152 | } |
1135 | 1153 | $v_security_adv = 'yes'; |
1136 | 1154 | } |
1137 | 1155 | } |
1138 | 1156 | } |
1139 | 1157 |
|
1140 | | - if (empty($_SESSION['error_msg'])) { |
1141 | | - if ($_POST['v_api'] != $_SESSION['API']) { |
1142 | | - $api_status = 'disable'; |
1143 | | - if ($_POST['v_api'] == 'yes') { |
1144 | | - $api_status = 'enable'; |
1145 | | - } |
1146 | | - exec(HESTIA_CMD."v-change-sys-api ".escapeshellarg($api_status), $output, $return_var); |
1147 | | - check_return_code($return_var, $output); |
1148 | | - unset($output); |
1149 | | - if (empty($_SESSION['error_msg'])) { |
1150 | | - $v_login_style = $_POST['v_api']; |
1151 | | - } |
1152 | | - $v_security_adv = 'yes'; |
1153 | | - } |
1154 | | - } |
1155 | | - |
1156 | 1158 | // Update SSL certificate |
1157 | 1159 | if ((!empty($_POST['v_ssl_crt'])) && (empty($_SESSION['error_msg']))) { |
1158 | 1160 | if (($v_ssl_crt != str_replace("\r\n", "\n", $_POST['v_ssl_crt'])) || ($v_ssl_key != str_replace("\r\n", "\n", $_POST['v_ssl_key']))) { |
|
0 commit comments