Browse Source

! Clean up some of the stuff surrounding word censoring; there's no need to declare the theme setting for censoring in new installs, the wrong name was used for upgrades, SQLite tried to do it twice, and we had some undefined variables kicking around. Fixes #656 and #602 looks done to me too.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 11 years ago
parent
commit
04537b5264

+ 2 - 2
Sources/Profile-Modify.php

@@ -575,13 +575,13 @@ function loadProfileFields($force_reload = false)
 			'permission' => 'profile_extra',
 			'is_dummy' => true,
 			'preload' => create_function('', '
-				global $context, $user_info;
+				global $context, $user_info, $modSettings;
 
 				loadLanguage(\'Settings\');
 
 				$context[\'allow_no_censored\'] = false;
 				if ($user_info[\'is_admin\'] || $context[\'user\'][\'is_owner\'])
-					$context[\'allow_no_censored\'] = $modSettings[\'allow_no_censored\'];
+					$context[\'allow_no_censored\'] = !empty($modSettings[\'allow_no_censored\']);
 
 				return true;
 			'),

+ 1 - 1
Themes/default/Profile.template.php

@@ -1547,7 +1547,7 @@ function template_profile_theme_settings()
 								<input type="checkbox" name="default_options[show_no_signatures]" id="show_no_signatures" value="1"', !empty($context['member']['options']['show_no_signatures']) ? ' checked="checked"' : '', ' class="input_check" />
 							</dd>';
 
-	if ($modSettings['allow_no_censored'])
+	if (!empty($modSettings['allow_no_censored']))
 		echo '
 							<dt>
 								<label for="show_no_censored">' . $txt['show_no_censored'] . '</label>

+ 0 - 1
other/install_2-1_mysql.sql

@@ -2026,7 +2026,6 @@ VALUES (1, 'name', '{$default_theme_name}'),
 	(1, 'show_stats_index', '1'),
 	(1, 'show_board_desc', '1'),
 	(1, 'newsfader_time', '5000'),
-	(1, 'allow_no_censored', '0'),
 	(1, 'additional_options_collapsable', '1'),
 	(1, 'use_image_buttons', '1'),
 	(1, 'enable_news', '1'),

+ 0 - 1
other/install_2-1_postgresql.sql

@@ -2548,7 +2548,6 @@ INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_mark
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_stats_index', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_board_desc', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'newsfader_time', '5000');
-INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'allow_no_censored', '0');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'additional_options_collapsable', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'use_image_buttons', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'enable_news', '1');

+ 0 - 1
other/install_2-1_sqlite.sql

@@ -2181,7 +2181,6 @@ INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_mark
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_stats_index', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_board_desc', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'newsfader_time', '5000');
-INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'allow_no_censored', '0');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'additional_options_collapsable', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'use_image_buttons', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'enable_news', '1');

+ 0 - 1
other/install_2-1_sqlite3.sql

@@ -2181,7 +2181,6 @@ INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_mark
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_stats_index', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_board_desc', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'newsfader_time', '5000');
-INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'allow_no_censored', '0');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'additional_options_collapsable', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'use_image_buttons', '1');
 INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'enable_news', '1');

+ 3 - 3
other/upgrade_2-1_mysql.sql

@@ -30,12 +30,12 @@ if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['pac
 
 ---# Copying the current "allow users to disable word censor" setting...
 ---{
-if (!isset($modSettings['allow_no_censor']))
+if (!isset($modSettings['allow_no_censored']))
 {
 	$request = upgrade_query("
 		SELECT value
 		FROM {$db_prefix}themes
-		WHERE variable='allow_no_censor'
+		WHERE variable='allow_no_censored'
 		AND id_theme = 1 OR id_theme = '$modSettings[theme_default]'
 	");
 	
@@ -46,7 +46,7 @@ if (!isset($modSettings['allow_no_censor']))
 		{
 			upgrade_query("
 				INSERT INTO {$db_prefix}settings
-				VALUES ('allow_no_censor', 1)
+				VALUES ('allow_no_censored', 1)
 			");
 			
 			// Don't do this twice...

+ 3 - 3
other/upgrade_2-1_postgresql.sql

@@ -32,12 +32,12 @@ if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['pac
 
 ---# Copying the current "allow users to disable word censor" setting...
 ---{
-if (!isset($modSettings['allow_no_censor']))
+if (!isset($modSettings['allow_no_censored']))
 {
 	$request = upgrade_query("
 		SELECT value
 		FROM {$db_prefix}themes
-		WHERE variable='allow_no_censor'
+		WHERE variable='allow_no_censored'
 		AND id_theme = 1 OR id_theme = '$modSettings[theme_default]'
 	");
 	
@@ -48,7 +48,7 @@ if (!isset($modSettings['allow_no_censor']))
 		{
 			upgrade_query("
 				INSERT INTO {$db_prefix}settings
-				VALUES ('allow_no_censor', 1)
+				VALUES ('allow_no_censored', 1)
 			");
 			
 			// Don't do this twice...

+ 3 - 33
other/upgrade_2-1_sqlite.sql

@@ -30,12 +30,12 @@ if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['pac
 
 ---# Copying the current "allow users to disable word censor" setting...
 ---{
-if (!isset($modSettings['allow_no_censor']))
+if (!isset($modSettings['allow_no_censored']))
 {
 	$request = upgrade_query("
 		SELECT value
 		FROM {$db_prefix}settings
-		WHERE variable='allow_no_censor'
+		WHERE variable='allow_no_censored'
 		AND id_theme = 1 OR id_theme = '$modSettings[theme_default]'
 	");
 	
@@ -46,7 +46,7 @@ if (!isset($modSettings['allow_no_censor']))
 		{
 			upgrade_query("
 				INSERT INTO {$db_prefix}settings
-				VALUES ('allow_no_censor', 1)
+				VALUES ('allow_no_censored', 1)
 			");
 			
 			// Don't do this twice...
@@ -370,36 +370,6 @@ if (file_exists($GLOBALS['boarddir'] . '/Themes/core'))
 	}
 }
 
-/******************************************************************************/
---- Moving "allow users to disable word censor" setting...
-/******************************************************************************/
----#
----{
-	$request = upgrade_query("
-		SELECT value
-		FROM {$db_prefix}themes
-		WHERE variable='allow_no_censor'
-		AND id_theme = 1 OR id_theme = '$modSettings[theme_default]'
-	");
-	
-	// Is it set for either "default" or the one they've set as default?
-	while ($row = mysql_fetch_assoc($request))
-	{
-		if ($row['value'] == 1)
-		{
-			upgrade_query("
-				INSERT INTO {$db_prefix}settings
-				VALUES ('allow_no_censor', 1)
-			");
-			
-			// Don't do this multiple twice...
-			break;
-		}
-	}
-}
----}
----#
-
 /******************************************************************************/
 --- Adding support for drafts
 /******************************************************************************/