if (!set_mainsetting('links_per_page', isnum($_POST['links_per_page']) ? $_POST['links_per_page'] : "15")) {
        $error = 1;
    }
    if (!set_mainsetting('posts_per_page', isnum($_POST['posts_per_page']) ? $_POST['posts_per_page'] : "20")) {
        $error = 1;
    }
    if (!set_mainsetting('threads_per_page', isnum($_POST['threads_per_page']) ? $_POST['threads_per_page'] : "20")) {
        $error = 1;
    }
    if (!set_mainsetting('numofshouts', isnum($_POST['numofshouts']) ? $_POST['numofshouts'] : "10")) {
        $error = 1;
    }
    if (!set_mainsetting('last_seen_users_show', isnum($_POST['last_seen_users_show']) ? $_POST['last_seen_users_show'] : "10")) {
        $error = 1;
    }
    if (!set_mainsetting('last_seen_users_show_more', isnum($_POST['last_seen_users_show_more']) ? $_POST['last_seen_users_show_more'] : "10")) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_ipp_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
opentable($locale['400']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['669'] . ":</td>\n";
echo "<td width='50%' class='tbl'><input type='text' name='newsperpage' value='" . $settings2['newsperpage'] . "' maxlength='2' class='textbox' style='width:50px;' /> (" . $locale['670'] . ")</td>\n";
    } elseif ($_GET['error'] == 1) {
        $message = $locale['901'];
    } elseif ($_GET['error'] == 2) {
        $message = $locale['global_182'];
    }
    if (isset($message)) {
        echo "<div id='close-message'><div class='admin-message'>" . $message . "</div></div>\n";
    }
}
if (isset($_POST['savesettings'])) {
    $error = 0;
    if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
        if (!set_mainsetting('download_max_b', isnum($_POST['download_max_b']) ? $_POST['download_max_b'] : "150000")) {
            $error = 1;
        }
        if (!set_mainsetting('download_types', stripinput($_POST['download_types']))) {
            $error = 1;
        }
        log_admin_action("admin-4", "admin_settings_dl_save");
        set_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "");
        redirect(FUSION_SELF . $aidlink . "&error=" . $error, true);
    } else {
        redirect(FUSION_SELF . $aidlink . "&error=2");
    }
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
opentable($locale['400']);
    if (!set_mainsetting('avatar_filesize', isnum($_POST['avatar_filesize']) ? $_POST['avatar_filesize'] : "15000")) {
        $error = 1;
    }
    if (!set_mainsetting('extern_avatar_upload', isnum($_POST['extern_avatar_upload']) ? $_POST['extern_avatar_upload'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('avatar_width', isnum($_POST['avatar_width']) ? $_POST['avatar_width'] : "100")) {
        $error = 1;
    }
    if (!set_mainsetting('avatar_height', isnum($_POST['avatar_height']) ? $_POST['avatar_height'] : "100")) {
        $error = 1;
    }
    if (!set_mainsetting('avatar_ratio', isnum($_POST['avatar_ratio']) ? $_POST['avatar_ratio'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('userthemes', isnum($_POST['userthemes']) ? $_POST['userthemes'] : "0")) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_users_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
opentable($locale['1000']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
echo "<td class='tbl2' align='center' colspan='2'>" . $locale['1015'] . "</td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='70%' class='tbl'>" . $locale['1002'] . "</td>\n";
echo "<td class='tbl' width='30%'><select name='enable_deactivation' class='textbox'>\n";
echo "<option value='0'" . ($settings['enable_deactivation'] == "0" ? " selected='selected'" : "") . ">" . $locale['519'] . "</option>\n";
echo "<option value='1'" . ($settings['enable_deactivation'] == "1" ? " selected='selected'" : "") . ">" . $locale['518'] . "</option>\n";
echo "</select></td>\n";
         if (!set_mainsetting('forum_show_age', isnum($_POST['forum_show_age']) ? $_POST['forum_show_age'] : "0")) {
             $error = 1;
         }
         if (!set_mainsetting('forum_show_sex', isnum($_POST['forum_show_sex']) ? $_POST['forum_show_sex'] : "0")) {
             $error = 1;
         }
         if (!set_mainsetting('forum_show_onoff', isnum($_POST['forum_show_onoff']) ? $_POST['forum_show_onoff'] : "0")) {
             $error = 1;
         }
         if (!set_mainsetting('forum_show_onoff_color_on', preg_match("/([0-9A-F]){6}/i", $_POST['forum_show_onoff_color_on']) ? $_POST['forum_show_onoff_color_on'] : "FFFFFF")) {
             $error = 1;
         }
         if (!set_mainsetting('forum_show_onoff_color_re', preg_match("/([0-9A-F]){6}/i", $_POST['forum_show_onoff_color_re']) ? $_POST['forum_show_onoff_color_re'] : "FFFFFF")) {
             $error = 1;
         }
         if (!set_mainsetting('forum_show_onoff_color_off', preg_match("/([0-9A-F]){6}/i", $_POST['forum_show_onoff_color_off']) ? $_POST['forum_show_onoff_color_off'] : "FFFFFF")) {
             $error = 1;
         }
         log_admin_action("admin-4", "admin_settings_forum_save");
         set_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "");
         redirect(FUSION_SELF . $aidlink . "&amp;page=3&error=" . $error, true);
     } else {
         redirect(FUSION_SELF . $aidlink . "&amp;page=3&amp;error=2");
     }
 }
 opentable($locale['542']);
 echo $navigation;
 echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "&amp;page=3'>\n";
 echo "<table cellpadding='0' cellspacing='0' class='center' style='width:70%; max-width:500px;'>\n<tr>\n";
 echo "<td width='50%' class='tbl'>" . "Show next/prev Thread?" . "</td>\n";
 // localize
    if (!set_mainsetting('news_thumb_h', isnum($_POST['news_thumb_h']) ? $_POST['news_thumb_h'] : "100")) {
        $error = 1;
    }
    if (!set_mainsetting('news_photo_w', isnum($_POST['news_photo_w']) ? $_POST['news_photo_w'] : "400")) {
        $error = 1;
    }
    if (!set_mainsetting('news_photo_h', isnum($_POST['news_photo_h']) ? $_POST['news_photo_h'] : "300")) {
        $error = 1;
    }
    if (!set_mainsetting('news_photo_max_w', isnum($_POST['news_photo_max_w']) ? $_POST['news_photo_max_w'] : "1800")) {
        $error = 1;
    }
    if (!set_mainsetting('news_photo_max_h', isnum($_POST['news_photo_max_h']) ? $_POST['news_photo_max_h'] : "1600")) {
        $error = 1;
    }
    if (!set_mainsetting('news_photo_max_b', isnum($_POST['news_photo_max_b']) ? $_POST['news_photo_max_b'] : "150000")) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_news_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
opentable($locale['400']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['414'] . "</td>\n";
echo "<td width='50%' class='tbl'><select name='news_style' class='textbox'>\n";
}
if (isset($_POST['savesettings'])) {
    $error = 0;
    if (!set_mainsetting('flood_interval', isnum($_POST['flood_interval']) ? $_POST['flood_interval'] : "15")) {
        $error = 1;
    }
    if (!set_mainsetting('flood_autoban', isnum($_POST['flood_autoban']) ? $_POST['flood_autoban'] : "1")) {
        $error = 1;
    }
    if (!set_mainsetting('maintenance_level', isnum($_POST['maintenance_level']) ? $_POST['maintenance_level'] : nADMIN)) {
        $error = 1;
    }
    if (!set_mainsetting('maintenance', isnum($_POST['maintenance']) ? $_POST['maintenance'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('maintenance_message', addslash(descript($_POST['maintenance_message'])))) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_security_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
opentable($locale['secu100']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
echo "<td class='tbl2' align='center' colspan='2'>" . $locale['secu101'] . "</td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['secu102'] . "</td>\n";
echo "<td width='50%' class='tbl'><input type='text' name='flood_interval' value='" . $settings['flood_interval'] . "' maxlength='2' class='textbox' style='width:50px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['secu103'] . "</td>\n";
echo "<td width='50%' class='tbl'><select name='flood_autoban' class='textbox'>\n";
} elseif ($_GET['page'] == 2) {
    if (isset($_POST['savesettings'])) {
        $error = 0;
        if (!set_mainsetting('welcome_pm', $_POST['welcome_pm'] == "1" ? "1" : "0")) {
            $error = 1;
        }
        if (!set_mainsetting('welcome_pm_from', isnum($_POST['welcome_pm_from']) ? $_POST['welcome_pm_from'] : "1")) {
            $error = 1;
        }
        if (!set_mainsetting('welcome_pm_subject', $_POST['welcome_pm_subject'])) {
            $error = 1;
        }
        if (!set_mainsetting('welcome_pm_message', $_POST['welcome_pm_message'])) {
            $error = 1;
        }
        if (!set_mainsetting('welcome_pm_smiley', $_POST['welcome_pm_smiley'] == "n" ? "n" : "y")) {
            $error = 1;
        }
        log_admin_action("admin-4", "admin_settings_welcome_pm_save");
        redirect(FUSION_SELF . $aidlink . "&error=" . $error . "&amp;page=2");
    }
    opentable($locale['welpm100']);
    require_once INCLUDES . "bbcode_include.php";
    echo $navigation;
    function create_opts($level, $label)
    {
        global $settings;
        $option = '';
        $result = dbquery("SELECT user_id, user_name FROM " . DB_USERS . " WHERE user_level='" . (int) $level . "' and user_status='0' ORDER BY user_name ASC");
        if (dbrows($result) != 0) {
            $option .= "<optgroup label='" . $label . "'>\n";
    if (!set_mainsetting('photo_watermark_image', stripinput($_POST['photo_watermark_image']))) {
        $error = 1;
    }
    if (!set_mainsetting('photo_watermark_text', isnum($_POST['photo_watermark_text']) ? $_POST['photo_watermark_text'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('photo_watermark_text_color1', preg_match("/([0-9A-F]){6}/i", $_POST['photo_watermark_text_color1']) ? $_POST['photo_watermark_text_color1'] : "FF6600")) {
        $error = 1;
    }
    if (!set_mainsetting('photo_watermark_text_color2', preg_match("/([0-9A-F]){6}/i", $_POST['photo_watermark_text_color2']) ? $_POST['photo_watermark_text_color2'] : "FFFF00")) {
        $error = 1;
    }
    if (!set_mainsetting('photo_watermark_text_color3', preg_match("/([0-9A-F]){6}/i", $_POST['photo_watermark_text_color3']) ? $_POST['photo_watermark_text_color3'] : "FFFFFF")) {
        $error = 1;
    }
    if (!set_mainsetting('enable_lightbox', isnum($_POST['enable_lightbox']) ? $_POST['enable_lightbox'] : "0")) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_photo_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
opentable($locale['400']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='700' class='center'>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['601'] . "<br /><span class='small2'>" . $locale['604'] . "</span></td>\n";
echo "<td width='50%' class='tbl'><input type='text' name='thumb_w' value='" . $settings2['thumb_w'] . "' maxlength='3' class='textbox' style='width:40px;' /> x\n";
     if (!set_mainsetting('recaptcha_publickey', $_POST['recaptcha_publickey'])) {
         $error = 1;
     }
     if (!set_mainsetting('recaptcha_privatekey', $_POST['recaptcha_privatekey'])) {
         $error = 1;
     }
     if (!set_mainsetting('login_method', $_POST['login_method'] == "cookies" ? "cookies" : "sessions")) {
         $error = 1;
     }
     if (!set_mainsetting('enable_terms', isnum($_POST['enable_terms']) ? $_POST['enable_terms'] : "0")) {
         $error = 1;
     }
     if (!set_mainsetting('license_agreement', $license_agreement)) {
         $error = 1;
     }
     if (!set_mainsetting('license_lastupdate', $license_lastupdate)) {
         $error = 1;
     }
     log_admin_action("admin-4", "admin_settings_registration_save");
     redirect(FUSION_SELF . $aidlink . "&error=" . $error);
 }
 opentable($locale['400']);
 echo $navigation;
 echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
 echo "<table cellpadding='0' cellspacing='0' width='650' class='center'>\n<tr>\n";
 echo "<td width='50%' class='tbl'>" . $locale['551'] . "</td>\n";
 echo "<td width='50%' class='tbl'><select name='enable_registration' class='textbox'>\n";
 echo "<option value='1'" . ($settings2['enable_registration'] == "1" ? " selected='selected'" : "") . ">" . $locale['518'] . "</option>\n";
 echo "<option value='0'" . ($settings2['enable_registration'] == "0" ? " selected='selected'" : "") . ">" . $locale['519'] . "</option>\n";
 echo "</select></td>\n";
 echo "</tr>\n<tr>\n";
    if (substr($new_locale_content, -1) == ",") {
        $new_locale_content = substr($new_locale_content, 0, -1);
    }
    if (!set_mainsetting('locale', $localeset)) {
        $error = 1;
    }
    if (!set_mainsetting('locale_multi', isnum($_POST['multilanguage']) ? $_POST['multilanguage'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('locale_multi_forum', isnum($_POST['multilanguage_forum']) ? $_POST['multilanguage_forum'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('locale_multi_shout', isnum($_POST['multilanguage_shout']) ? $_POST['multilanguage_shout'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('locale_content', $new_locale_content)) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_language_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
$locale_files = makefilelist(LOCALE, ".|..", true, "folders");
opentable($locale['lang100']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['lang101'] . "</td>\n";
    if (!set_mainsetting('adminmenue_icons', isnum($_POST['adminmenue_icons']) ? $_POST['adminmenue_icons'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('adminmenue_notes', isnum($_POST['adminmenue_notes']) ? $_POST['adminmenue_notes'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('adminmenue_userinfo', isnum($_POST['adminmenue_userinfo']) ? $_POST['adminmenue_userinfo'] : "0")) {
        $error = 1;
    }
    if (!set_mainsetting('adminmenue_nav', isset($_POST['adminmenue_nav']) ? stripinput($_POST['adminmenue_nav']) : "1")) {
        $error = 1;
    }
    if (!set_mainsetting('adminmenue_color', isset($_POST['adminmenue_color']) ? stripinput($_POST['adminmenue_color']) : "blue")) {
        $error = 1;
    }
    if (!set_mainsetting('adminmenue_version', isnum($_POST['adminmenue_version']) ? $_POST['adminmenue_version'] : "0")) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_adminmenue_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
opentable($locale['adme100']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['adme101'] . "</td>\n";
echo "<td width='50%' class='tbl'><select name='adminmenue_userinfo' class='textbox'>\n";
echo "<option value='1'" . ($settings['adminmenue_userinfo'] == "1" ? " selected='selected'" : "") . ">" . $locale['518'] . "</option>\n";
echo "<option value='0'" . ($settings['adminmenue_userinfo'] == "0" ? " selected='selected'" : "") . ">" . $locale['519'] . "</option>\n";
echo "</select></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='50%' class='tbl'>" . $locale['adme102'] . "</td>\n";
if (isset($_GET['error']) && (isnum($_GET['error']) || $_GET['error'] == "pw") && !isset($message)) {
    if ($_GET['error'] == "0") {
        $message = $locale['con900'];
    } elseif ($_GET['error'] == "1") {
        $message = $locale['con901'];
    } elseif ($_GET['error'] == "pw") {
        $message = $locale['con903'];
    }
    if (isset($message)) {
        echo "<div id='close-message'><div class='admin-message'>" . $message . "</div></div>\n";
    }
}
if (isset($_POST['savesettings'])) {
    if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
        $error = 0;
        if (!set_mainsetting('contact_site', addslashes(descript(stripslash($_POST['contact_site']))))) {
            $error = 1;
        }
        set_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "");
        log_admin_action("admin-1", "admin_contact_page");
        redirect(FUSION_SELF . $aidlink . "&error=" . $error);
    } else {
        redirect(FUSION_SELF . $aidlink . "&error=pw");
    }
}
opentable($locale['con100']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='90%' class='center'>\n<tr>\n";
echo "<td valign='top' width='15%' class='tbl'>" . $locale['con101'] . "<br /><span class='small2'>" . $locale['con102'] . "</span></td>\n";
echo "<td width='50%' class='tbl'><textarea name='contact_site' cols='80' rows='20' class='textbox'>" . phpentities(stripslashes($settings['contact_site'])) . "</textarea></td>\n";
echo "</tr>\n";
if (!checkrights("FPR") || !defined("iAUTH") || $_GET['aid'] != iAUTH) {
    redirect("../index.php");
}
if (isset($_GET['error']) && isnum($_GET['error']) && !isset($message)) {
    if ($_GET['error'] == 0) {
        $message = $locale['forpr101'];
    } elseif ($_GET['error'] == 1) {
        $message = $locale['forpr102'];
    }
    if (isset($message)) {
        echo "<div id='close-message'><div class='admin-message'>" . $message . "</div></div>\n";
    }
}
if (isset($_POST['savesettings'])) {
    $error = 0;
    if (!set_mainsetting('forum_post_ratings', stripinput($_POST['forum_post_ratings']))) {
        $error = 1;
    }
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
if (isset($_POST['goRating'])) {
    $error = 0;
    $type_name = stripinput($_POST['type_name']);
    $type_icon = stripinput($_POST['type_icon']);
    if ($type_name != "" && $type_icon != "") {
        if (isset($_GET['update']) && isnum($_GET['update'])) {
            $result = dbquery("SELECT type_name FROM " . DB_POST_RATING_TYPES . " WHERE type_id='" . (int) $_GET['update'] . "'");
            if (!dbrows($result)) {
                redirect(FUSION_SELF . $aidlink . "&error=1");
            }
            $result = dbquery("UPDATE " . DB_POST_RATING_TYPES . " SET type_name='" . $type_name . "', type_icon='" . $type_icon . "'\r\n\t\t\tWHERE type_id='" . (int) $_GET['update'] . "'");
    if (!set_mainsetting('shortdate', $_POST['shortdate'])) {
        $error = 1;
    }
    if (!set_mainsetting('longdate', $_POST['longdate'])) {
        $error = 1;
    }
    if (!set_mainsetting('forumdate', $_POST['forumdate'])) {
        $error = 1;
    }
    if (!set_mainsetting('newsdate', $_POST['newsdate'])) {
        $error = 1;
    }
    if (!set_mainsetting('subheaderdate', $_POST['subheaderdate'])) {
        $error = 1;
    }
    if (!set_mainsetting('timeoffset', $_POST['timeoffset'])) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_time_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
// Get original Settings to fix bug with Time Offset
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
$offsetlist = '
<option value="-12.0"' . ($settings2['timeoffset'] == "-12.0" ? " selected" : "") . '>(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11.0"' . ($settings2['timeoffset'] == "-12.0" ? " selected" : "") . '>(GMT -11:00) Midway Island, Samoa</option>
<option value="-10.0"' . ($settings2['timeoffset'] == "-10.0" ? " selected" : "") . '>(GMT -10:00) Hawaii</option>
        echo "<div id='close-message'><div class='admin-message'>" . $message . "</div></div>\n";
    }
}
if (isset($_POST['savesettings'])) {
    if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
        $error = 0;
        if (!set_mainsetting('siteintro', addslashes(descript(stripslash($_POST['intro']))))) {
            $error = 1;
        }
        if (!set_mainsetting('siteintro_collapse', isset($_POST['siteintro_collapse']) ? "1" : "0")) {
            $error = 1;
        }
        if (!set_mainsetting('siteintro_collapse_state', isset($_POST['siteintro_collapse_state']) ? "on" : "off")) {
            $error = 1;
        }
        if (!set_mainsetting('welome_panel_dis', isnum($_POST['welome_panel_dis']) ? $_POST['welome_panel_dis'] : "0")) {
            $error = 1;
        }
        set_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "");
        log_admin_action("admin-1", "admin_wel_panel_edited");
        redirect(FUSION_SELF . $aidlink . "&error=" . $error);
    } else {
        redirect(FUSION_SELF . $aidlink . "&error=pw");
    }
}
opentable($locale['welc100']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='90%' class='center'>\n<tr>\n";
echo "<td valign='top' width='15%' class='tbl'>" . $locale['welc101'] . "<br /><span class='small2'>" . $locale['welc102'] . "<br />" . $locale['welc103'] . "</span></td>\n";
echo "<td width='50%' class='tbl'><textarea name='intro' cols='80' rows='20' class='textbox'>" . phpentities(stripslashes($settings['siteintro'])) . "</textarea></td>\n";
echo "</tr>\n<tr>\n";
    }
    echo "<td colspan='2' align='center' class='tbl'><input type='submit' class='button' name='ads_save' value='" . $locale['ads_save'] . "' /></td></tr>\n";
    echo "</table>\n";
    echo "</form>\n";
    closetable();
} elseif ($_GET['page'] == 2) {
    if (isset($_POST['ads_save'])) {
        $error = 0;
        if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
            if (!set_mainsetting('ads_in_name', stripinput($_POST['ads_in_name']))) {
                $error = 1;
            }
            if (!set_mainsetting('ads_in_show', isnum($_POST['ads_in_show']) ? $_POST['ads_in_show'] : "0")) {
                $error = 1;
            }
            if (!set_mainsetting('ads_in_code', addslashes(stripslash($_POST['ads_in_code'])))) {
                $error = 1;
            }
            log_admin_action("admin-3", "admin_adssystem_in_save");
            set_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "");
            redirect(FUSION_SELF . $aidlink . "&amp;page=2&amp;error=" . $error);
        } else {
            redirect(FUSION_SELF . $aidlink . "&amp;page=2&amp;error=2");
        }
    }
    opentable($locale['ads_title']);
    echo $navigation;
    echo "<form name='ads_form' method='post' action='" . FUSION_SELF . $aidlink . "&amp;page=2'>\n";
    echo "<table cellpadding='0' cellspacing='0' width='450' align='center'>\n";
    echo "<tr>\n";
    echo "<td class='tbl'>" . $locale['ads_name'] . "</td>";
if (!checkrights("SEO") || !defined("iAUTH") || $_GET['aid'] != iAUTH) {
    redirect("../index.php");
}
if (isset($_GET['error']) && isnum($_GET['error']) && !isset($message)) {
    if ($_GET['error'] == 0) {
        $message = $locale['seo900'];
    } elseif ($_GET['error'] == 1) {
        $message = $locale['seo901'];
    }
    if (isset($message)) {
        echo "<div id='close-message'><div class='admin-message'>" . $message . "</div></div>\n";
    }
}
if (isset($_POST['savesettings'])) {
    $error = 0;
    if (!set_mainsetting('seo_url_rewrite', stripinput($_POST['seo_url_rewrite']))) {
        $error = 1;
    }
    log_admin_action("admin-3", "admin_seo_settings_saved");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
opentable($locale['seo200']);
if (MOD_REWRITE_ABLE) {
    echo "<div class='tbl2'>" . $locale['seo201'] . "<br />\r\n" . $locale['seo202'] . "<br />\r\n" . $locale['seo203'] . "<br />\r\n" . $locale['seo204'] . "</div><br /><br />";
} elseif (!file_exists(BASEDIR . ".htaccess")) {
    echo "<div class='tbl2'>" . $locale['seo201'] . "<br />\r\n" . $locale['seo205'] . "<br />\r\n" . $locale['seo206'] . "</div><br /><br />";
    if (!set_mainsetting('theme', stripinput($_POST['theme']))) {
        $error = 1;
    }
    if (!set_mainsetting('default_search', stripinput($_POST['default_search']))) {
        $error = 1;
    }
    if (!set_mainsetting('exclude_left', stripinput($_POST['exclude_left']))) {
        $error = 1;
    }
    if (!set_mainsetting('exclude_upper', stripinput($_POST['exclude_upper']))) {
        $error = 1;
    }
    if (!set_mainsetting('exclude_lower', stripinput($_POST['exclude_lower']))) {
        $error = 1;
    }
    if (!set_mainsetting('exclude_right', stripinput($_POST['exclude_right']))) {
        $error = 1;
    }
    log_admin_action("admin-4", "admin_settings_main_save");
    redirect(FUSION_SELF . $aidlink . "&error=" . $error);
}
$settings2 = array();
$result = dbquery("SELECT settings_name, settings_value FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
    $settings2[$data['settings_name']] = $data['settings_value'];
}
$theme_files = makefilelist(THEMES, ".|..|templates", true, "folders");
ob_start();
opentable($locale['400']);
echo "<form name='settingsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
echo "<table cellpadding='0' cellspacing='0' width='500' class='center'>\n<tr>\n";
    } elseif ($_GET['error'] == 1) {
        $message = $locale['901'];
    } elseif ($_GET['error'] == 2) {
        $message = $locale['global_182'];
    }
    if (isset($message)) {
        echo "<div id='close-message'><div class='admin-message'>" . $message . "</div></div>\n";
    }
}
if (isset($_POST['save_banners'])) {
    $error = 0;
    if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
        if (!set_mainsetting('sitebanner1', addslashes(stripslash($_POST['sitebanner1'])))) {
            $error = 1;
        }
        if (!set_mainsetting('sitebanner2', addslashes(stripslash($_POST['sitebanner2'])))) {
            $error = 1;
        }
        set_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "");
        log_admin_action("admin-3", "admin_banners_save");
        redirect(FUSION_SELF . $aidlink . "&error=" . $error, true);
    } else {
        redirect(FUSION_SELF . $aidlink . "&error=2");
    }
}
if (isset($_POST['preview_banners'])) {
    $sitebanner1 = "";
    $sitebanner2 = "";
    if (check_admin_pass(isset($_POST['admin_password']) ? stripinput($_POST['admin_password']) : "")) {
        $sitebanner1 = stripslash($_POST['sitebanner1']);
        $sitebanner2 = stripslash($_POST['sitebanner2']);