' . format_key($key) . ' - Admin+'; } elseif ($key == '3'){ $html .= ''; } elseif ($key == '2'){ $html .= ''; } elseif ($key == '1'){ $html .= ''; } elseif ($key == '0'){ $html .= ''; } else { $html .= ''; } if ($type == 'checkbox') { $html .= ''; } $html .= ''; return $html; } // Format tabs function format_tabs($contents) { $rows = explode("\n", $contents); $tab = '
'; $tab .= 'General'; for ($i = 0; $i < count($rows); $i++) { preg_match('/\/\*(.*?)\*\//', $rows[$i], $match); if ($match) { $tab .= '' . $match[1] . ''; } } $tab .= '
'; return $tab; } // Format form function format_form($contents) { $rows = explode("\n", $contents); $form = '
'; for ($i = 0; $i < count($rows); $i++) { preg_match('/\/\*(.*?)\*\//', $rows[$i], $match); if ($match) { $form .= '
'; } preg_match('/define\(\'(.*?)\', ?(.*?)\)/', $rows[$i], $match); if ($match) { $form .= format_var_html($match[1], $match[2]); } } $form .= '
'; return $form; } if (isset($_POST['submit']) && !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('./settings/config_redirector.php', $contents); //Return succesmessage header('Location: index.php?page=settings&success_msg=1'); exit; } if (isset($_POST['geoupdate'])){ //GEOLOCATION UPDATE geolocationUpdate($_SESSION['userkey']); } if (isset($_POST['updatecartest'])){ //GEOLOCATION UPDATE convertCartest(); } // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { $success_msg = 'Settings updated successfully!'; } } template_header('Settings', 'settings'); $view .= '

Settings

'; if (isset($success_msg)){ $view .= '

'.$success_msg.'

'; } $view .= format_tabs($contents); $view .= '
'; $view .= format_form($contents); $view .= '
'; //Output echo $view; template_footer(); ?>