Fixed issues with duplicate ban groups
jdarwood007

jdarwood007 commited on 2019-12-08 13:12:23
Showing 1 changed files, with 4 additions and 4 deletions.

... ...
@@ -292,7 +292,7 @@ class SFS
292 292
 			checkSession();
293 293
 
294 294
 			// If we are automatically banning IPs, make sure we have a ban group.
295
-			if (isset($_POST['sfs_ipcheck_autoban']) || empty($modSettings['sfs_ipcheck_autoban_group']))
295
+			if (isset($_POST['sfs_ipcheck_autoban']) && empty($modSettings['sfs_ipcheck_autoban_group']))
296 296
 				$this->createBanGroup(true);
297 297
 
298 298
 			saveDBSettings($config_vars);
... ...
@@ -1621,10 +1621,10 @@ class SFS
1621 1621
 		$request = $smcFunc['db_query']('', '
1622 1622
 			SELECT id_ban_group
1623 1623
 			FROM {db_prefix}ban_groups
1624
-			WHERE name = {string:new_ban_name}' . '
1624
+			WHERE name = {string:new_ban_name}
1625 1625
 			LIMIT 1',
1626 1626
 			array(
1627
-				'new_ban_name' => $txt['sfs_ban_group_name'],
1627
+				'new_ban_name' => substr($txt['sfs_ban_group_name'], 0, 20),
1628 1628
 			)
1629 1629
 		);
1630 1630
 		if ($smcFunc['db_num_rows']($request) == 1)
... ...
@@ -1644,7 +1644,7 @@ class SFS
1644 1644
 
1645 1645
 		// Ban Information, this follows the format from the function.
1646 1646
 		$ban_info = array(
1647
-			'name' => $txt['sfs_ban_group_name'],
1647
+			'name' => substr($txt['sfs_ban_group_name'], 0, 20),
1648 1648
 			'cannot' => array(
1649 1649
 				'access' => 1,
1650 1650
 				'register' => 1,
1651 1651