"._SETTINGS."
".htmlspecialchars($debug).""; } } else if(isset($_POST['submit'])) { if($sect == "main") { if(!preg_match("!^[a-z0-9_]{3,30}$!i", $_POST['newsitekey'])) $output .= write_error(_BADSITEKEY); else { $oldsitekey = $sitekey; $sitekey = descript($_POST['newsitekey']); $sitename = escapestring(descript(strip_tags($_POST['newsitename']))); $slogan = escapestring(descript(strip_tags($_POST['newslogan']))); $url = escapestring(descript(strip_tags($_POST['newsiteurl']))); // if the https:// is missing add it. if(substr($url, 0, 8) != "https://" && substr($url, 0, 7) != "http://") $url = "https://".$url; // we also want to check for a trailing slash. if(substr($url, -1, 1) == "/") $url = substr($url, 0, strlen($url) - 1); $tableprefix = escapestring(descript(strip_tags($_POST['newtableprefix']))); $siteemail = escapestring(descript(strip_tags($_POST['newsiteemail']))); $skin = escapestring(descript(strip_tags($_POST['newskin']))); $language = escapestring(descript(strip_tags($_POST['newlanguage']))); if(empty($sitekey)) $output .= write_message(_SITEKEYREQUIRED); else { if($sitekey != $oldsitekey) $output .= write_message(_SITEKEYCHANGED); $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET sitekey = '$sitekey', sitename = '$sitename', slogan = '$slogan', url = '$url', tableprefix = '$tableprefix', siteemail = '$siteemail', skin = '$skin', language = '$language' WHERE sitekey = '$oldsitekey'"); } } } else if($sect == "submissions") { $submissionsoff = $_POST['newsubmissionsoff'] == 1 ? 1 : 0; $autovalidate = $_POST['newautovalidate'] == 1 ? 1 : 0; $coauthallowed = $_POST['newcoauthallowed'] == 1 ? 1 : 0; $store = !empty($_POST['newstore']) ? ($_POST['newstore'] == "files" ? "files" : "mysql" ) : $store; $storiespath = descript($_POST['newstoriespath']); $minwords = isNumber($_POST['newminwords']) ? $_POST['newminwords'] : 0; $maxwords = isNumber($_POST['newmaxwords']) ? $_POST['newmaxwords'] : 0; $roundrobins = $_POST['newroundrobins'] == 1 ? 1 : 0; $allowseries = $_POST['newallowseries'] && isNumber($_POST['newallowseries']) ? $_POST['newallowseries'] : 0; $imageupload = $_POST['newimageupload'] == 1 ? 1 : 0; $imageheight = isNumber($_POST['newimageheight']) ? $_POST['newimageheight'] : 0; $imagewidth = isNumber($_POST['newimagewidth']) ? $_POST['newimagewidth'] : 0; $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET submissionsoff = '$submissionsoff', autovalidate = '$autovalidate', coauthallowed = '$coauthallowed', store = '$store', storiespath = '$storiespath', minwords = '$minwords', maxwords = '$maxwords', imageupload = '$imageupload', imageheight = '$imageheight', imagewidth = '$imagewidth', roundrobins = '$roundrobins', allowseries = '$allowseries' WHERE sitekey ='".SITEKEY."'"); if($action == "settings") { dbquery("UPDATE ".TABLEPREFIX."fanfiction_panels SET panel_hidden = '".($imageupload ? "0" : "1")."' WHERE panel_name LIKE 'manageimages'"); dbquery("UPDATE ".TABLEPREFIX."fanfiction_panels SET panel_hidden = '".($allowseries ? "0" : "1")."' WHERE (panel_name LIKE '%series%' OR panel_title LIKE '%series%') AND panel_type != 'A' AND panel_type != 'B'"); updatePanelOrder( ); } } else if($sect == "sitesettings") { $tinyMCE = ($_POST['newtinyMCE'] == 1 OR $_POST['newtinyMCE'] == 2) ? $_POST['newtinyMCE'] : 0; $allowed_tags = $_POST['newallowed_tags']; $favorites = $_POST['newfavorites'] == 1 ? 1 : 0; $multiplecats = $_POST['newmultiplecats'] == 1 ? 1 : 0; $newscomments = $_POST['newnewscomments'] == 1 ? 1 : 0; $logging = $_POST['newlogging'] == 1 ? 1 : 0; $maintenance = $_POST['newmaint'] == 1 ? 1 : 0; $debug = $_POST['newdebug'] == 1 ? 1 : 0; $captcha = $_POST['newcaptcha'] == 1 ? 1 : 0; $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET tinyMCE = '$tinyMCE', favorites = '$favorites', multiplecats = '$multiplecats', allowed_tags = '$allowed_tags', newscomments = '$newscomments', logging = '$logging', maintenance = '$maintenance', debug = '$debug', captcha = '$captcha' WHERE sitekey ='".SITEKEY."'"); } else if($sect == "display") { $dateformat = $_POST['newdateformat'] ? descript(strip_tags($_POST['newdateformat'])) : descript(strip_tags($_POST['customdateformat'])); $timeformat = $_POST['newtimeformat'] ? descript(strip_tags($_POST['newtimeformat'])) : descript(strip_tags($_POST['customtimeformat'])); $extendcats = $_POST['newextendcats'] == 1 ? 1 : 0; if(isset($_POST['newdisplaycolumns']) && isNumber($_POST['newdisplaycolumns'])) $displaycolumns = $_POST['newdisplaycolumns']; if(isset($_POST['newitemsperpage']) && isNumber($_POST['newitemsperpage'])) $itemsperpage = $_POST['newitemsperpage']; if(isset($_POST['newlinkstyle']) && isNumber($_POST['newlinkstyle'])) $linkstyle = $_POST['newlinkstyle']; if(isset($_POST['newlinkrange']) && isNumber($_POST['newlinkrange'])) $linkrange = $_POST['newlinkrange']; $displayindex = $_POST['newstoryindex'] == 1 ? 1 : 0; $displayprofile = $_POST['newdisplayprofile'] == 1 ? 1 : 0; $defaultsort = $_POST['newdefaultsort'] == 1 ? 1 : 0; if(isNumber($_POST['newrecentdays'])) $recentdays = $_POST['newrecentdays']; $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET dateformat = '$dateformat', timeformat = '$timeformat', extendcats = '$extendcats', displaycolumns = '$displaycolumns', itemsperpage = '$itemsperpage', displayindex = '$displayindex', defaultsort = '$defaultsort', recentdays = '$recentdays', displayprofile = '$displayprofile', linkstyle = '$linkstyle', linkrange = '$linkrange' WHERE sitekey ='".SITEKEY."'"); } else if($sect == "reviews") { $reviewsallowed = $_POST['newreviewsallowed'] == 1 ? 1 : 0; $anonreviews = $_POST['newanonreviews'] == 1 ? 1 : 0; $rateonly = $_POST['newrateonly'] == 1 ? 1 : 0; $ratings = isset($_POST['newratings']) && isNumber($_POST['newratings']) ? $_POST['newratings'] : 0; $revdelete = isset($_POST['newrevdelete']) && isNumber($_POST['newrevdelete']) ? $_POST['newrevdelete'] : 0; $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET reviewsallowed = '$reviewsallowed', anonreviews = '$anonreviews', rateonly = '$rateonly', ratings = '$ratings', revdelete = '$revdelete' WHERE sitekey ='".SITEKEY."'"); } else if($sect == "useropts") { $alertson = $_POST['newalertson'] == 1 ? 1 : 0; $disablepopups = $_POST['newdisablepops'] == 1 ? 1 : 0; $agestatement = $_POST['newagestatement'] == 1 ? 1 : 0; $pwdsetting = $_POST['newpwdsetting'] == 1 ? 1 : 0; $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET alertson = '$alertson', disablepopups = '$disablepopups', agestatement = '$agestatement', pwdsetting = '$pwdsetting' WHERE sitekey ='".SITEKEY."'"); } else if($sect == "email") { $smtp_host = escapestring(descript(strip_tags($_POST['newsmtp_host']))); $smtp_username = escapestring(descript(strip_tags($_POST['newsmtp_username']))); $smtp_password = escapestring(descript(strip_tags($_POST['newsmtp_password']))); $smtp_port = !empty($_POST['newsmtp_port']) ? (int) $_POST['newsmtp_port'] : ''; $smtp_secure = in_array($_POST['newsmtp_secure'], array('', 'tls', 'ssl'), true) ? $_POST['newsmtp_secure'] : ''; $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password', smtp_port = '$smtp_port', smtp_secure = '$smtp_secure' WHERE sitekey ='".SITEKEY."'"); } if ($result) { $output .= write_message(_ACTIONSUCCESSFUL); // The section-advance wizard is for the INSTALLER only (install/install.php // includes this file and steps through sections). In admin, "email" is the // last entry in $sects, so advancing would wrap to 0 and jump back to the // first tab while the URL still says sect=email. $action is undefined in the // installer include context, so guard with isset() to avoid a PHP 8 warning. if (!isset($action) || $action != "settings") { $idx = array_search($sect, $sects); if ($idx !== false) { $next_idx = $idx + 1; if ($next_idx >= count($sects)) { $next_idx = 0; } $sect = $sects[$next_idx]; } } } else { $output .= write_error(_ERROR); } $settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey ='".SITEKEY."'"); $settings = dbassoc($settingsresults); foreach($settings as $var => $val) { if(is_NULL($val)) $val = ''; $$var = stripslashes($val ); } } $output .= "