<?php
//******************************************************************//
// |     MAP - Mumb1e Admin Plugin   |   http://www.mumb1e.de/    | //    
// |              ___      ___   _________   _________            | //
// |             |   \    /   | |   ___   | |   ___   |           | //
// |             |    \__/    | |  |   |  | |  |   |  |           | //
// |             |  |\    /|  | |  |___|  | |  |___|  |           | //
// |             |  | \__/ |  | |   ___   | |   ______|           | //
// |             |  |      |  | |  |   |  | |  |                  | //
// |             |__|      |__| |__|   |__| |__|                  | //
// |                                                              | //
// | --- VERSION ---                                              | //
// | Build: 419                                                   | //
// | Version: V2.3.1                                              | //
// | Date: 2010-05-30                                             | //
// | --- COPYRIGTH ---                                            | //
// | Build by P.M. and M.H. | Accept the Copyrigths!              | //
// | © by Michael Koch 'aka' P.M. <princemichi@web.de>            | //
// | --- LICENSE ---                                              | //
// | MAP - Mumb1e Admin Plugin is a dual-licensed software        | //
// | MAP is released for private end-users under GPLv3            | //
// |   >>  (visit at: http://www.gnu.org/licenses/gpl-3.0.html)   | //
// | MAP is released for commercial use under a commerial license | //
// |   >>  (visit at: http://www.mumb1e.de/index.php/en/license)  | //
// | --- ATTENTION ---                                            | //
// | Changing, editing or spreading of this sourcecode in other   | //
// | scripts, or on other websites only with permission by PM!    | //
//******************************************************************//
//************************************************************************************************//
// **START**  Deklariert wichtige globale Einstellungen !!!NICHT Ã„NDERN!!!
//************************************************************************************************//
// Definiert Ort des Scripts
$dir = "settings";
// Definition Ort der Templates
$template_dir = '../inc/tpl/';
//Definition des Language Ordners
$language_dir = '../inc/_lang/';
// LÃ¤dt Globale Funktionen
include("../inc/functions.php");
//************************************************************************************************//
// **ENDE**  Deklariert wichtige globale Einstellungen !!!NICHT Ã„NDERN!!!
//************************************************************************************************//
//************************************************************************************************//
// Start des Ausgabeinhalts
//************************************************************************************************//
// Definiere, bzw. lade Section
if (!isset($_GET['section'])) {
    $section = "";
    } else {
        $section = $_GET['section'];
}

// Gehe zu aufgerufenem Bereich
switch ($section){
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
// **START**  VerÃ¤nderte Einstellungen aus dem Formular in CB schreiben
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
case 'settings_db':
    // Definition Seitentitel
    $seitentitel .= _pagetitel_admin_settings_db;

    // Check ob User eingeloggt, ansonsten wird Fehlermeldung angezeigt
    if (isset($_COOKIE['MAP_user_id'])&& isset($_COOKIE['MAP_user_pwd'])) {
        // Check ob User berechtigt ist diesen zu sehen, ansonsten wird Fehlermeldung angezeigt
        if ($perm_e_settings == "TRUE") { 
            //Start definition eigentliche Funktionen dieser Section:
            // Eingaben speichern -- Aus Formular Ã¼bernehmen
            $pagetitle = $_POST["pagetitle"];
            $pagetitle_version_show = $_POST["version_show"];
            $language = $_POST["language"];
            $template = $_POST["template"];
            $ver_chk_on = $_POST["ver_chk_on"];
            $create_map_user_email = $_POST["create_map_user_email"];
            $request_account = $_POST["request_account"];
            $request_account_pw_on = $_POST["request_account_pw_on"];
            $request_account_password = $_POST["request_account_password"];
            $request_access_page =  $_POST["request_access_page"];
            $dbus_functions_on = $_POST["dbus_functions_on"];
            $ice_functions_on = $_POST["ice_functions_on"];
            $ice_host = $_POST["ice_host"];
            $ice_port = $_POST["ice_port"];
            $logging_functions_on = $_POST["logging_functions_on"];
            $logging_priority = $_POST["logging_priority"];
            $logging_show_priority = $_POST["logging_show_priority"];
            $logging_days = $_POST["logging_days"];
            $logging_show_permissions = $_POST["logging_show_permissons"];
            $forgot_area_on = $_POST["forgot_area_on"];
           
            //Pagetitle, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '3'");
            $get_pagetitle = mysql_fetch_array($qry);
            if ($pagetitle != $get_pagetitle[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$pagetitle' WHERE id = '3'");
                $true_change = 'TRUE';
            }
          
            //Anzeige der Version im Seitentitel, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '8'");
            $get_pagetitle_version_show = mysql_fetch_array($qry);
            if ($pagetitle_version_show == '') {
                $pagetitle_version_show = '0';
            }
            if ($pagetitle_version_show != $get_pagetitle_version_show[2] && $pagetitle_version_show == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '8'");
                $true_change = 'TRUE';
            } elseif ($pagetitle_version_show != $get_pagetitle_version_show[2] && $pagetitle_version_show == '0'){
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '8'");
                $true_change = 'TRUE';
            }
          
            //Language, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '6'");
            $get_language = mysql_fetch_array($qry);
            if ($language != $get_language[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$language' WHERE id = '6'");
                $true_change = 'TRUE';
            }
            
            //Template, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '5'");
            $get_template = mysql_fetch_array($qry);
            if ($template != $get_template[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$template' WHERE id = '5'");
                $true_change = 'TRUE';
            }
            
        	//Versionscheck An, falls geändert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '30'");
            $get_ver_chk_on = mysql_fetch_array($qry);
       	    if ($ver_chk_on == '') {
                $ver_chk_on = '0';
            }
            if ($ver_chk_on != $get_ver_chk_on[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$ver_chk_on' WHERE id = '30'");
                $true_change = 'TRUE';
            }
                        
            //E-Mail an MAP User, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '11'");
            $get_create_map_user_email = mysql_fetch_array($qry);
            if ($create_map_user_email == '')  {
                $create_map_user_email = '0';
            }
            if ($create_map_user_email != $get_create_map_user_email[2] && $create_map_user_email == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '11'");
                $true_change = 'TRUE';
                } elseif ($create_map_user_email != $get_create_map_user_email[2] && $create_map_user_email == '0') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '11'");
                    $true_change = 'TRUE';
            }
                        
            //Account request, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '16'");
            $get_request_account = mysql_fetch_array($qry);
            if ($request_account == '') {
                $request_account = '0';
            }
            if ($request_account != $get_request_account[2] && $request_account == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '16'");
                $true_change = 'TRUE';
                } elseif ($request_account != $get_request_account[2] && $request_account == '0') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '16'");
                    $true_change = 'TRUE';
            }
            
            //Account request (Passwort funktion an aus), falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '19'");
            $get_request_account_pw_on = mysql_fetch_array($qry);
            if ($request_account_pw_on == '') {
                $request_account_pw_on = '0';
            }
            if ($request_account_pw_on != $get_request_account_pw_on[2] && $request_account_pw_on == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '19'");
                $true_change = 'TRUE';
                } elseif ($request_account_pw_on != $get_request_account_pw_on[2] && $request_account_pw_on == '0') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '19'");
                    $true_change = 'TRUE';
            }  
                        
            //Account request (Passwort value), falls geÃ¤ndert in DB schreiben 
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '18'");
            $get_request_account_password = mysql_fetch_array($qry);
            if ($request_account_password != $get_request_account_password[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$request_account_password' WHERE id = '18'");
                $true_change = 'TRUE';
            }
            
            //request_access_page, falls geändert in DB schreiben     
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '31'");
            $get_request_access_page = mysql_fetch_array($qry);
            if ($request_access_page != $get_request_access_page[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '".$request_access_page."' WHERE id = '31'");
                $true_change = 'TRUE';
            }
            
            //Check ob nicht haken fÃ¼r DBUS und ICE auf "Ein" geschaltet wurden, ansonsten fehlermeldung. wenn okay, weiter ich check.
            if (($dbus_functions_on == '' AND $ice_functions_on == '') OR ($dbus_functions_on == '1' AND $ice_functions_on == '') OR ($dbus_functions_on == '' AND $ice_functions_on == '1')) {
                //DBUS Funktion (DBUS funktion an aus), falls geÃ¤ndert in DB schreiben            
                $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '21'");
                $get_dbus_functions_on_value = mysql_fetch_array($qry);
                if ($dbus_functions_on == '') {
                    $dbus_functions_on = '0';
                }
                if ($dbus_functions_on != $get_dbus_functions_on_value[2] && $dbus_functions_on == '1') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '21'");
                    $true_change = 'TRUE';
                    } elseif ($dbus_functions_on != $get_dbus_functions_on_value[2] && $dbus_functions_on == '0') {
                        mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '21'");
                        $true_change = 'TRUE';
                }
                //ICE Funktion (ICE funktion an aus), falls geÃ¤ndert in DB schreiben            
                $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '22'");
                $get_ice_functions_on_value = mysql_fetch_array($qry);
                if ($ice_functions_on == '') {
                    $ice_functions_on = '0';
                }
                if ($ice_functions_on != $get_ice_functions_on_value[2] && $ice_functions_on == '1') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '22'");
                    $true_change = 'TRUE';
                    } elseif ($ice_functions_on != $get_ice_functions_on_value[2] && $ice_functions_on == '0') {
                        mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '22'");
                        $true_change = 'TRUE';
                }                  
            }
            
                   
            //Slice Host, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '28'");
            $get_slice_host = mysql_fetch_array($qry);
            if ($ice_host != $get_slice_host[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$ice_host' WHERE id = '28'");
                $true_change = 'TRUE';
            }
            
                   
            //Slice Port, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '29'");
            $get_slice_port = mysql_fetch_array($qry);
            if ($ice_port != $get_slice_port[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$ice_port' WHERE id = '29'");
                $true_change = 'TRUE';
            }
            
            //Logging funktionen ein (Logging funktion an aus), falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '23'");
            $get_logging_functions_on = mysql_fetch_array($qry);
            if ($logging_functions_on == '') {
                $logging_functions_on = '0';
            }
            if ($logging_functions_on != $get_logging_functions_on[2] && $logging_functions_on == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '23'");
                $true_change = 'TRUE';
                } elseif ($logging_functions_on != $get_logging_functions_on[2] && $logging_functions_on == '0') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '0' WHERE id = '23'");
                    $true_change = 'TRUE';
            } 
            
            //Logging Priorität, falls geÃ¤ndert in DB schreiben     
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '24'");
            $get_logging_priority = mysql_fetch_array($qry);
            if ($logging_priority != $get_logging_priority[2] && $logging_priority == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '24'");
                $true_change = 'TRUE';
                } elseif ($logging_priority != $get_logging_priority[2] && $logging_priority == '2') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '2' WHERE id = '24'");
                    $true_change = 'TRUE';
            }
            
            //Logging "Show" Priorität, falls geÃ¤ndert in DB schreiben     
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '25'");
            $get_logging_show_priority = mysql_fetch_array($qry);
            if ($logging_show_priority != $get_logging_show_priority[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '".$logging_show_priority."' WHERE id = '25'");
                $true_change = 'TRUE';
            }
            
            //Logging Days, falls geÃ¤ndert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '26'");
            $get_logging_days = mysql_fetch_array($qry);
            if ($logging_days != $get_logging_days[2] && is_numeric($logging_days) == "TRUE") {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$logging_days' WHERE id = '26'");
                $true_change = 'TRUE';
            }
            
            //Logging Berechtigungen, falls geÃ¤ndert in DB schreiben     
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '27'");
            $get_logging_permissions = mysql_fetch_array($qry);
            if ($logging_show_permissions != $get_logging_permissions[2] && $logging_show_permissions == '1') {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '1' WHERE id = '27'");
                $true_change = 'TRUE';
                } elseif ($logging_show_permissions != $get_logging_permissions[2] && $logging_show_permissions == '2') {
                    mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '2' WHERE id = '27'");
                    $true_change = 'TRUE';
            }
            
        	//Paswswort vergessen Funktionen, falls geändert in DB schreiben            
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '32'");
            $get_forgot_area_on = mysql_fetch_array($qry);
       	    if ($forgot_area_on == '') {
                $forgot_area_on = '0';
            }
            if ($forgot_area_on != $get_forgot_area_on[2]) {
                mysql_query("UPDATE `".$database_prefix."map_settings` SET value_2 = '$forgot_area_on' WHERE id = '32'");
                $true_change = 'TRUE';
            }
                   
            //Abschlussmeldung
            if ($true_change != "TRUE") {
                $info = "<br><div align=\"center\"><div class='savearea'>"._settings_do_false."</div></div>";
                $autoforward1 = 'TRUE';
                } elseif ($true_change == "TRUE") {
                    $info = "<br><div align=\"center\"><div class='boxsucess'>"._settings_do_true."</div></div>";
                    $autoforward1 = 'TRUE';
            }
            
            //Loggingfunktion, Übergabe der Werte: Settings geändert
            //Definiert ob etwas geloggt werden soll
            if ($true_change == TRUE) {
				$log_values["on"] = TRUE;
			}
			//Pflichtwerte
			$log_values["user_id"] = $_COOKIE['MAP_user_id'];		//Definiert den User (die User_id) der gerade Aktiv war
			$log_values["action_id"] = "settings_db_1";				//Definiert was gerade von User gemacht wurde: (section)_(show, db)_anzahl
			$log_values["priority"] = "2";							//Definiert die Wichtigkeit dieser Section: 2=wichtig; 1=normal
			$log_values["area"] = $dir;								//Definiert die Section (für Spätere auswertung)
			//Definierbare Werte (optional)
			$log_values["server_id"] = "";							//Definiert die Server_ID (kann frei gelassen werden)
			$log_values["value_1"] = "";							//Definiert value_1, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_2"] = "";							//Definiert value_2, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_3"] = "";							//Definiert value_3, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_4"] = "";							//Definiert value_4, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_5"] = "";							//Definiert value_5, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_6"] = "";							//Definiert value_6, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_7"] = "";							//Definiert value_7, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			            
            //Weiterleitung nach 5 Sekunden
            if ($autoforward1 == 'TRUE') {
                autoforward("../settings/index.php?default",5);
            }

            //Ende definition eigentliche Funktionen dieser Section^^
            } else {
                //Meldung an MAP User, dass er fÃ¼r diesen Bereich keine Berechtigungen hat
                $info = "<br><div align=\"center\"><div class='savearea'>"._no_permissions."</div></div>";
        } 
        } else {
            //Meldung an Besucher, dass er keine Berechtigung hat und sich einloggen muss um diesen Bereich zu sehen
            $info = "<br><div align=\"center\"><div class='savearea'>"._save_area."</div></div>";
            autoforward("../start/index.php",5);
    }  
break;
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
// **ENDE**  VerÃ¤nderte Einstellungen aus dem Formular in CB schreiben
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
// **START**  Settings, Formular ausgeben
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
default:
    // Definition Seitentitel
    $seitentitel .= _pagetitel_admin_settings;

    // Check ob User eingeloggt, ansonsten wird Fehlermeldung angezeigt
    if (isset($_COOKIE['MAP_user_id'])&& isset($_COOKIE['MAP_user_pwd'])) {
        // Check ob User berechtigt ist diesen zu sehen, ansonsten wird Fehlermeldung angezeigt
        if ($perm_s_settings == "TRUE") { 
            //Start definition eigentliche Funktionen dieser Section:
            
            // Gebe Seitentitel aus
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '3'");
            $get_pagetitle = mysql_fetch_array($qry);
            
            // Zeige Versionsnummer im Seitentitel (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '8'");
            $get_pt_version_show = mysql_fetch_array($qry);
            if ($get_pt_version_show[2] == '1') {
                $get_pagetitle_version_value = ' checked';
                } elseif ($get_pt_version_show[2] == '0') {
                    $get_pagetitle_version_value = '';
            }
              
            // Definiere und gebe vorhandene Languages aus!
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '6'");
            $get_language = mysql_fetch_array($qry);
            $language_scan = scandir($language_dir);
            $i = "0";
            while($language_scan[$i]) {
                if ($language_scan[$i] == 'german.php') {
                    $lang_value = 'german';
                    $lang_name = _settings_language_value1;
                }
                if ($language_scan[$i] == 'english.php') {
                    $lang_value = 'english';
                    $lang_name = _settings_language_value2;
                }
                if ($language_scan[$i] == 'frensh.php') {
                    $lang_value = 'frensh';
                    $lang_name = _settings_language_value3;
                }
                if ($lang_value == $get_language[2] && $language_scan[$i] != '.' && $language_scan[$i] != '..') {
                    $lang_list .= "<option value=\"".$lang_value."\" selected=\"selected\">".$lang_name."</option>\n";
                } 
                if ($lang_value != $get_language[2] && $language_scan[$i] != '.' && $language_scan[$i] != '..') { 
                    $lang_list .= "<option value=\"".$lang_value."\">".$lang_name."</option>\n";
                }
                $i++;
            }
            
            // Definiere und gebe vorhandene TPL-Verzeichnisse aus!
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '5'");
            $get_tpl = mysql_fetch_array($qry);
            $template_scan = scandir($template_dir);
            $i = "0";
            while($template_scan[$i]) {
                if ($template_scan[$i] == $get_tpl[2] && $template_scan[$i] != '.' && $template_scan[$i] != '..') {
                    $tpl_list .= "<option value=\"".$template_scan[$i]."\" selected=\"selected\">".$template_scan[$i]."</option>\n";
                } 
                if ($template_scan[$i] != $get_tpl[2] && $template_scan[$i] != '.' && $template_scan[$i] != '..') { 
                    $tpl_list .= "<option value=\"".$template_scan[$i]."\">".$template_scan[$i]."</option>\n";
                }
                $i++;
            }
            
        	//Versionscheck an/aus (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '30'");
            $get_ver_chk_on = mysql_fetch_array($qry);
            if ($get_ver_chk_on[2] == '1') {
                $get_ver_chk_on_value = ' checked';
                } elseif ($get_ver_chk_on[2] == '0') {
                    $get_ver_chk_on_value = '';
            }
            
            // E-Mail an MAP-User (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '11'");
            $get_create_map_user_email_show = mysql_fetch_array($qry);
            if ($get_create_map_user_email_show[2] == '1') {
                $get_create_map_user_email_value = ' checked';
                } elseif ($get_create_map_user_email_show[2] == '0') {
                    $get_create_map_user_email_value = '';
            }
            
            // erlaube Usern das beantragen von Accounts (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '16'");
            $get_allow_request_account = mysql_fetch_array($qry);
            if ($get_allow_request_account[2] == '1') {
                $get_allow_request_account_value = ' checked';
                } elseif ($get_allow_request_account[2] == '0') {
                    $get_allow_request_account_value = '';
            }
                       
            //Selektion ob Secure_Password eingeschaltet oder secure_code (default) ein ist (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '19'");
            $get_secure = mysql_fetch_array($qry);
            if ($get_secure[2] == '1') {
                $get_secure_pw_on_value = ' checked';
                } elseif ($get_secure[2] == '0') {
                    $get_secure_pw_on_value = '';
            }
                          
            // Gebe Request_Secure_Password aus
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '18'");
            $get_secure_password = mysql_fetch_array($qry);
            
        	// Gebe request_access_page aus, sprich welches Request Formualr aktiv ist.
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '31'");
            $get_request_access_page = mysql_fetch_array($qry);
            if ($get_request_access_page[2] == "1") {
                $get_request_access_page_value .= "<option value=\"1\" selected=\"selected\">"._settings_request_access_page_value_1."</option>\n";
                $get_request_access_page_value .= "<option value=\"2\">"._settings_request_access_page_value_2."</option>\n";
                $get_request_access_page_value .= "<option value=\"3\">"._settings_request_access_page_value_3."</option>\n";
            } 
            if ($get_request_access_page[2] == "2") { 
            	$get_request_access_page_value .= "<option value=\"1\">"._settings_request_access_page_value_1."</option>\n";
            	$get_request_access_page_value .= "<option value=\"2\" selected=\"selected\">"._settings_request_access_page_value_2."</option>\n";
            	$get_request_access_page_value .= "<option value=\"3\">"._settings_request_access_page_value_3."</option>\n";
            }
            if ($get_request_access_page[2] == "3") { 
            	$get_request_access_page_value .= "<option value=\"1\">"._settings_request_access_page_value_1."</option>\n";
            	$get_request_access_page_value .= "<option value=\"2\">"._settings_request_access_page_value_2."</option>\n";
            	$get_request_access_page_value .= "<option value=\"3\" selected=\"selected\">"._settings_request_access_page_value_3."</option>\n";
            }
            
            //Selektion ob DBUS eingeschaltet ist (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '21'");
            $get_dbus_functions = mysql_fetch_array($qry);
            if ($get_dbus_functions[2] == '1') {
                $get_dbus_functions_on_value = ' checked';
                } elseif ($get_dbus_functions[2] == '0') {
                    $get_dbus_functions_on_value = '';
            }
            
            //Selektion ob ICE eingeschaltet ist (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '22'");
            $get_ice_functions = mysql_fetch_array($qry);
            if ($get_ice_functions[2] == '1') {
                $get_ice_functions_on_value = ' checked';
                } elseif ($get_ice_functions[2] == '0') {
                    $get_ice_functions_on_value = '';
            }
            
            // Gebe Slice Host aus
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '28'");
            $get_ice_host_value = mysql_fetch_array($qry);
            
            // Gebe Slice Port aus
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '29'");
            $get_ice_port_value = mysql_fetch_array($qry);
            
            //Selektion ob Logging Funktionen eingeschaltet sind (Checkbox) - Ausgabe
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '23'");
            $get_logging_functions = mysql_fetch_array($qry);
            if ($get_logging_functions[2] == '1') {
                $get_logging_functions_on_value = ' checked';
                } elseif ($get_logging_functions[2] == '0') {
                    $get_logging_functions_on_value = '';
            }
            
            // Definiere die Logging Priorität und gebe liste aus
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '24'");
            $get_logging_priority = mysql_fetch_array($qry);
            if ($get_logging_priority[2] == "1") {
                $get_logging_priority_value .= "<option value=\"1\" selected=\"selected\">"._settings_logging_priority_value_1."</option>\n";
                $get_logging_priority_value .= "<option value=\"2\">"._settings_logging_priority_value_2."</option>\n";
            } 
            if ($get_logging_priority[2] == "2") { 
            	$get_logging_priority_value .= "<option value=\"1\">"._settings_logging_priority_value_1."</option>\n";
            	$get_logging_priority_value .= "<option value=\"2\" selected=\"selected\">"._settings_logging_priority_value_2."</option>\n";
            }
            
            // Zeige an, welche Loggings angezeigt werden sollen.
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '25'");
            $get_logging_show_priority = mysql_fetch_array($qry);
            if ($get_logging_show_priority[2] == "1") {
                $get_logging_show_priority_value .= "<option value=\"1\" selected=\"selected\">"._settings_logging_show_priority_value_1."</option>\n";
                $get_logging_show_priority_value .= "<option value=\"2\">"._settings_logging_show_priority_value_2."</option>\n";
                $get_logging_show_priority_value .= "<option value=\"3\">"._settings_logging_show_priority_value_3."</option>\n";
            } 
            if ($get_logging_show_priority[2] == "2") { 
            	$get_logging_show_priority_value .= "<option value=\"1\">"._settings_logging_show_priority_value_1."</option>\n";
            	$get_logging_show_priority_value .= "<option value=\"2\" selected=\"selected\">"._settings_logging_show_priority_value_2."</option>\n";
            	$get_logging_show_priority_value .= "<option value=\"3\">"._settings_logging_show_priority_value_3."</option>\n";
            }
            if ($get_logging_show_priority[2] == "3") { 
            	$get_logging_show_priority_value .= "<option value=\"1\">"._settings_logging_show_priority_value_1."</option>\n";
            	$get_logging_show_priority_value .= "<option value=\"2\">"._settings_logging_show_priority_value_2."</option>\n";
            	$get_logging_show_priority_value .= "<option value=\"3\" selected=\"selected\">"._settings_logging_show_priority_value_3."</option>\n";
            }
            
            // Zeige Log-Days an
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '26'");
            $get_logging_days = mysql_fetch_array($qry);
            
            // Definiere die Logging "Show" Berechtigungen
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '27'");
            $get_logging_permissions = mysql_fetch_array($qry);
            if ($get_logging_permissions[2] == "1") {
                $get_logging_permissions_value .= "<option value=\"1\" selected=\"selected\">"._settings_logging_permissions_value_1."</option>\n";
                $get_logging_permissions_value .= "<option value=\"2\">"._settings_logging_permissions_value_2."</option>\n";
            } 
            if ($get_logging_permissions[2] == "2") { 
            	$get_logging_permissions_value .= "<option value=\"1\">"._settings_logging_permissions_value_1."</option>\n";
            	$get_logging_permissions_value .= "<option value=\"2\" selected=\"selected\">"._settings_logging_permissions_value_2."</option>\n";
            }
            
            // Gebe aus: Passwort vergessen Funktionen AN/AUS
            $qry = mysql_query("SELECT * FROM `".$database_prefix."map_settings` WHERE id = '32'");
            $get_forgot_area_on = mysql_fetch_array($qry);
            if ($get_forgot_area_on[2] == '1') {
                $get_forgot_area_on_value = ' checked';
                } elseif ($get_forgot_area_on[2] == '0') {
                    $get_forgot_area_on_value = '';
            }
                  
            // Lade Template mit errechnetem Inhalt
            $content_headers = array("head_on" => TRUE,
									 "head_type" => "default",
				                     "head_value" => $get_pagetitle[2] . _settings_show_head,
									 "navi_on" => TRUE,
									 "navi_type" => "default",
									 );
            $index = show("$dir/settings", array("settings_head_1" => _settings_show_head_overview_1,
                                                 "pagetitle_head" => _settings_show_pagetitle_head,
                                                 "version_cb_head" => _settings_show_version_pagetitle_1,
                                                 "version_cb_discribtion" => _settings_show_version_pagetitle_2,
                                                 "language_head" => _settings_show_language_head,
                                                 "template_head" => _settings_show_template_head,
            									 "ver_chk_on_head" => _settings_show_ver_chk_on_head,
            									 "ver_chk_on_discribtion" => _settings_show_ver_chk_on_discribtion,
                                                 "settings_head_2" => _settings_show_head_overview_2,
                                                 "create_map_user_email_head" => _settings_show_create_map_user_email_head,
                                                 "create_map_user_email_discribtion" => _settings_show_create_map_user_email_discribtion,
                                                 "settings_head_3" => _settings_show_head_overview_3,
                                                 "request_account_head" => _settings_show_request_account_head,
                                                 "request_account_discribtion" => _settings_show_request_account_discribtion,                                           
                                                 "request_account_pw_on_head" => _settings_show_request_account_pw_on_head,
                                                 "request_account_pw_on_discribtion" => _settings_show_request_account_pw_on_discribtion,
                                                 "request_account_password_head" => _settings_show_request_account_password_head,
                                                 "request_account_password_discribtion" => _settings_show_request_account_password_discribtion,
           										 "request_access_page_head" => _settings_show_request_access_page_head,
                                                 "request_access_page_discribtion" => _settings_show_request_access_page_discribtion,
                                                 "settings_head_4" => _settings_show_head_overview_4,
                                                 "dbus_functions_on_head" => _settings_dbus_functions_on_head,
                                                 "dbus_functions_on_discribtion" => _settings_dbus_functions_on_discribtion,
                                                 "ice_functions_on_head" => _settings_ice_functions_on_head,
                                                 "ice_functions_on_discribtion" => _settings_ice_functions_on_discribtion,
            									 "ice_host_head" => _settings_ice_host_head,
                                                 "ice_host_discribtion" => _settings_ice_host_discribtion,
            									 "ice_port_head" => _settings_ice_port_head,
                                                 "ice_port_discribtion" => _settings_ice_port_discribtion,
            									 "settings_head_5" => _settings_show_head_overview_5,
                                                 "logging_functions_on_head" => _settings_logging_functions_on_head,
                                                 "logging_functions_on_discribtion" => _settings_logging_functions_on_discribtion,
            									 "logging_priority_head" => _settings_logging_priority_head,
            								     "logging_priority_discribtion" => _settings_logging_priority_discribtion,
            									 "logging_show_priority_head" => _settings_logging_show_priority_head,
                                                 "logging_show_priority_discribtion" => _settings_logging_show_priority_discribtion,
            									 "logging_days_head" => _settings_logging_days_head,
            								     "logging_days_discribtion" => _settings_logging_days_discribtion,
           									     "logging_show_permissons_head" => _settings_logging_show_permissons_head,
            								     "logging_show_permissons_discribtion" => _settings_logging_show_permissons_discribtion,
            									 "settings_head_6" => _settings_show_head_overview_6,
            									 "forgot_area_on_head" => _settings_forgot_area_on_head,
                                                 "forgot_area_on_discribtion" => _settings_forgot_area_on_discribtion,
                                                 "settings_do" => _settings_show_do,
                                                 "pagetitle_value" => $get_pagetitle[2],
                                                 "pagetitle_version_checkbox_value" => $get_pagetitle_version_value,
                                                 "language_value" => $lang_list,
                                                 "template_value" => $tpl_list,
            									 "ver_chk_on_value" => $get_ver_chk_on_value,
                                                 "create_map_user_email_value" => $get_create_map_user_email_value,
                                                 "request_account_value" => $get_allow_request_account_value,
                                                 "request_account_pw_on_value" => $get_secure_pw_on_value,
                                                 "request_account_password_value" => $get_secure_password[2],
            									 "request_access_page_value" => $get_request_access_page_value,
                                                 "dbus_functions_on_value" => $get_dbus_functions_on_value,
                                                 "ice_functions_on_value" => $get_ice_functions_on_value,
									             "ice_host_value" => $get_ice_host_value[2],
									             "ice_port_value" => $get_ice_port_value[2],
            									 "logging_functions_on_value" => $get_logging_functions_on_value,
                                                 "logging_priority_value" => $get_logging_priority_value,
                                                 "logging_show_priority_value" => $get_logging_show_priority_value,
                                                 "logging_days_value" => $get_logging_days[2],
                                                 "logging_show_permissons_value" => $get_logging_permissions_value,
            									 "forgot_area_on_value" => $get_forgot_area_on_value,
                                                 ));
            
            //Loggingfunktion, Übergabe der Werte: Settings angesehen
            //Definiert ob etwas geloggt werden soll
            if (strpos($_SERVER['HTTP_REFERER'], "settings_db") != TRUE) {
				$log_values["on"] = TRUE;
			}
			//Pflichtwerte
			$log_values["user_id"] = $_COOKIE['MAP_user_id'];		//Definiert den User (die User_id) der gerade Aktiv war
			$log_values["action_id"] = "settings_show_2";			//Definiert was gerade von User gemacht wurde: (section)_(show, db)_anzahl
			$log_values["priority"] = "1";							//Definiert die Wichtigkeit dieser Section: 2=wichtig; 1=normal
			$log_values["area"] = $dir;								//Definiert die Section (für Spätere auswertung)
			//Definierbare Werte (optional)
			$log_values["server_id"] = "";							//Definiert die Server_ID (kann frei gelassen werden)
			$log_values["value_1"] = "";							//Definiert value_1, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_2"] = "";							//Definiert value_2, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_3"] = "";							//Definiert value_3, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_4"] = "";							//Definiert value_4, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_5"] = "";							//Definiert value_5, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_6"] = "";							//Definiert value_6, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
			$log_values["value_7"] = "";							//Definiert value_7, welche später durch action_id individuell aufgerufen wird! (kann frei gelassen werden)
  
            //Ende definition eigentliche Funktionen dieser Section^^
            } else {
                //Meldung an MAP User, dass er fÃ¼r diesen Bereich keine Berechtigungen hat
                $info = "<br><div align=\"center\"><div class='savearea'>"._no_permissions."</div></div>";
        } 
        } else {
            //Meldung an Besucher, dass er keine Berechtigung hat und sich einloggen muss um diesen Bereich zu sehen
            $info = "<br><div align=\"center\"><div class='savearea'>"._save_area."</div></div>";
            autoforward("../start/index.php",5);
    } 
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
// **ENDE**  Settings, Formular ausgeben
//*<>*~~**<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~*<>*~~//
}
//************************************************************************************************//
// Ende des Ausgabeinhalts
//************************************************************************************************//
//************************************************************************************************//
// **START** LÃ¤dt das Template
//************************************************************************************************//
include("../inc/layout.php");
//************************************************************************************************//
// **ENDE**  LÃ¤dt das Template
//************************************************************************************************//
//************************************************************************************************//
// **START** Lädt die Loggingfunktionen
//************************************************************************************************//
include("../inc/logging.php");
//************************************************************************************************//
// **ENDE**  Lädt die Loggingfunktionen
//************************************************************************************************//
?>