' . 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 and content together (interleaved for collapsible functionality) function format_tabs_and_content($contents) { $rows = explode("\n", $contents); $output = ''; // Start with General tab and its content $output .= '
General
'; $output .= '
'; for ($i = 0; $i < count($rows); $i++) { preg_match('/\/\*(.*?)\*\//', $rows[$i], $match); if ($match) { // Close previous content and start new tab $output .= '
'; $output .= '
' . $match[1] . '
'; $output .= '
'; } preg_match('/define\(\'(.*?)\', ?(.*?)\)/', $rows[$i], $define_match); if ($define_match) { $output .= format_var_html($define_match[1], $define_match[2]); } } $output .= '
'; return $output; } 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($file, $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_and_content($contents); $view .= ' '; //Output echo $view; template_footer(); ?>