Browse code

Add site setting to enable or disable new user registrations

Clarissa Walker authored on 2026/08/18 01:56:03
Showing 8 changed files
... ...
@@ -237,12 +237,13 @@ else if(isset($_POST['submit'])) {
237 237
 		$allowed_tags = $_POST['newallowed_tags'];
238 238
 		$favorites = $_POST['newfavorites'] == 1 ? 1 : 0;
239 239
 		$multiplecats = $_POST['newmultiplecats'] == 1 ? 1 : 0;
240
+		$setreg = $_POST['newsetreg'] == 1 ? 1 : 0;
240 241
 		$newscomments = $_POST['newnewscomments'] == 1 ? 1 : 0;
241 242
 		$logging = $_POST['newlogging'] == 1 ? 1 : 0;
242 243
 		$maintenance = $_POST['newmaint'] == 1 ? 1 : 0;
243 244
 		$debug = $_POST['newdebug'] == 1 ? 1 : 0;
244 245
 		$captcha = $_POST['newcaptcha'] == 1 ? 1 : 0;
245
-		$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."'");
246
+		$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET tinyMCE = '$tinyMCE', favorites = '$favorites', multiplecats = '$multiplecats', setreg = '$setreg', allowed_tags = '$allowed_tags', newscomments = '$newscomments', logging = '$logging', maintenance = '$maintenance', debug = '$debug', captcha = '$captcha' WHERE sitekey ='".SITEKEY."'");
246 247
 	}
247 248
 	else if($sect == "display") {
248 249
 		$dateformat = $_POST['newdateformat'] ? descript(strip_tags($_POST['newdateformat'])) : descript(strip_tags($_POST['customdateformat']));
... ...
@@ -418,7 +419,7 @@ else if(isset($_POST['submit'])) {
418 419
 		<table class='acp' style='margin: 0 auto;'>
419 420
 			<tr>
420 421
 				<td><label for='newtinyMCE'>"._USETINYMCE. ": </label></td><td><select name='newtinyMCE'>
421
-				<option value=\"4\"" . ($tinyMCE == 4 ? " selected" : "") . ">tinyMCE 4</option>
422
+				<option value=\"4\"" . ($tinyMCE == 4 ? " selected" : "") . ">tinyMCE 6</option>
422 423
 				<option value=\"3\"" . ($tinyMCE == 3 ? " selected" : "") . ">tinyMCE 4</option>
423 424
 				<option value=\"2\"" . ($tinyMCE == 2 ? " selected" : "") . ">tinyMCE 3</option>
424 425
 				<option value=\"1\"" . ($tinyMCE == 1 ? " selected" : "") . ">tinyMCE 2</option>
... ...
@@ -440,6 +441,12 @@ else if(isset($_POST['submit'])) {
440 441
 				<option value='0'".($multiplecats == "0" ? "selected" : "").">"._ONLYONE."</option>
441 442
 				</select> <a href='#' class='pophelp'>[?]<span>"._HELP_NUMCATS."</span></a></td>
442 443
 			</tr>
444
+			<tr>
445
+				<td><label for='newsetreg'>"._SETREG.": </label></td><td><select name='newsetreg'>
446
+				<option value='1'".($setreg == "1" ? "selected" : "").">"._YES."</option>
447
+				<option value='0'".($setreg == "0" ? "selected" : "").">"._NO."</option>
448
+				</select> <a href='#' class='pophelp'>[?]<span>"._HELP_SETREG."</span></a></td>
449
+			</tr>
443 450
 			<tr>
444 451
 				<td><label for='newnewscomments'>"._NEWSCOMMENTS.": </label></td><td><select name='newnewscomments'>
445 452
 				<option value='1'".($newscomments == "1" ? " selected" : "").">"._YES."</option>
... ...
@@ -28,6 +28,7 @@ CREATE TABLE `fanfiction_settings` (
28 28
   `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
29 29
   `favorites` tinyint(1) NOT NULL default '0',
30 30
   `multiplecats` tinyint(1) NOT NULL default '0',
31
+  `setreg` tinyint(1) NOT NULL default '1',
31 32
   `newscomments` tinyint(1) NOT NULL default '0',
32 33
   `logging` tinyint(1) NOT NULL default '0',
33 34
   `maintenance` tinyint(1) NOT NULL default '0',
... ...
@@ -515,6 +515,7 @@ CREATE TABLE `fanfiction_settings` (
515 515
   `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
516 516
   `favorites` tinyint(1) NOT NULL default '0',
517 517
   `multiplecats` tinyint(1) NOT NULL default '0',
518
+  `setreg` tinyint(1) NOT NULL default '1',
518 519
   `newscomments` tinyint(1) NOT NULL default '0',
519 520
   `logging` tinyint(1) NOT NULL default '0',
520 521
   `maintenance` tinyint(1) NOT NULL default '0',
... ...
@@ -927,6 +927,7 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
927 927
   `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
928 928
   `favorites` tinyint(1) NOT NULL default '0',
929 929
   `multiplecats` tinyint(1) NOT NULL default '0',
930
+  `setreg` tinyint(1) NOT NULL default '1',
930 931
   `newscomments` tinyint(1) NOT NULL default '0',
931 932
   `logging` tinyint(1) NOT NULL default '0',
932 933
   `maintenance` tinyint(1) NOT NULL default '0',
... ...
@@ -303,6 +303,7 @@ define ("_PWDREQUIRED", "A password is required to access this function.");
303 303
 define ("_PENEMAILREQUIRED", "You must fill out the penname and email fields. Please <a href=\"user.php?action=newaccount\">try again</a>.");
304 304
 define ("_PENNAMEINUSE", "This penname is already in use.");
305 305
 define ("_REALNAME", "Real name");
306
+define ("_REGDISABLED", "The administrator has disabled new user registrations to this website.");
306 307
 define ("_REGISTER", "Register");
307 308
 define ("_REGLOG", "%1\$s (%2\$d) registered from IP address %3\$s.");
308 309
 define ("_SIGNUPSUBJECT", "Welcome to $sitename");
... ...
@@ -211,6 +211,7 @@ define ("_SAMEWINDOW", "Same Window");
211 211
 define ("_SECURITYDELETE", "You have not deleted the install folder! Please do so immediately to prevent a security breach.");
212 212
 define ("_SELF", "member selected");
213 213
 define ("_SELECTONE", "Select One");
214
+define ("_SETREG", "Enable New User Registrations");
214 215
 define ("_SETTINGS", "Settings");
215 216
 define ("_SITEINFO", "Site Information"); 
216 217
 define ("_SITEKEY", "Site Key");  
... ...
@@ -330,6 +331,7 @@ define ("_HELP_MINMAXWORDS", "You may set a minimum and/or maximum word count fo
330 331
 define ("_HELP_ALLOWEDTAGS", "List the tags you wish to allow in form input throughout the site.");
331 332
 define ("_HELP_FAVORITES", "Allow members to list their favorite stories, series, and authors within their profile.");
332 333
 define ("_HELP_NUMCATS", "If you have only one category, you should set this to 'only one'.  Doing so will create shortcuts in a few areas where of the site where category selection is required when there is more than one category.");
334
+define ("_HELP_SETREG", "Enables or disables user registration to your website.");
333 335
 define ("_HELP_NEWSCOMMENTS", "Defines whether or not members can make comments on news stories.");
334 336
 define ("_HELP_DATEFORMAT", "Sets the date format to be used throughout the site.  You may select one of the formats in the list or define a custom format using PHP's date( ) format options.");
335 337
 define ("_HELP_TIMEFORMAT", "Sets the time format to be used on news items.  The time format selected will be placed after the dateformat selected in the option above.  As with the date format, you may select on of the formats in the list or define your own custom format.");
... ...
@@ -286,6 +286,8 @@ elseif ($oldVersion[0] == 3 && $oldVersion[1] == 5 && $oldVersion[2] < 9)  // 3.
286 286
 {
287 287
 	if ($confirm == "yes")
288 288
 	{
289
+		if (!dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_settings LIKE 'setreg'")))
290
+			dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_settings` ADD `setreg` tinyint(1) NOT NULL DEFAULT '1' AFTER `multiplecats`");
289 291
 		if (!dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_settings LIKE 'smtp_port'")))
290 292
 			dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_settings` ADD `smtp_port` varchar(5) NOT NULL DEFAULT ''");
291 293
 		if (!dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_settings LIKE 'smtp_secure'")))
... ...
@@ -24,5 +24,9 @@
24 24
 
25 25
 if(!defined("_CHARSET")) exit( );
26 26
 
27
-include("user/editbio.php");
28
-?>
29 27
\ No newline at end of file
28
+if(isset($setreg) && $setreg == 0) {
29
+$output .= "<div align='center'>"._REGDISABLED."</div>";
30
+}
31
+
32
+else include("user/editbio.php");
33
+?>