' . format_key($key) . ''; if ($type == 'checkbox') { $html .= ''; } $html .= ''; return $html; } // Format form function format_form($contents) { $rows = explode("\n", $contents); echo '
'; for ($i = 0; $i < count($rows); $i++) { preg_match('/\/\*(.*?)\*\//', $rows[$i], $match); if ($match) { echo '
'; } preg_match('/define\(\'(.*?)\', ?(.*?)\)/', $rows[$i], $match); if ($match) { echo format_var_html($match[1], $match[2]); } } echo '
'; } if (!empty($_POST)) { // Update the configuration file with the new keys and values foreach ($_POST as $k => $v) { $v = in_array(strtolower($v), ['true', 'false']) ? strtolower($v) : '\'' . $v . '\''; $contents = preg_replace('/define\(\'' . $k . '\'\, ?(.*?)\)/s', 'define(\'' . $k . '\',' . $v . ')', $contents); } file_put_contents('../../system/config.php', $contents); header('Location: settings.php?success_msg=1'); exit; } // Handle success messages // fas-times-circle for error messages and demo if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { $success_msg = 'Settings updated successfully!'; } } ?>

Settings