Bläddra i källkod

Merge pull request #1173 from Arantor/release-2.1

Odds and ends
Arantor 11 år sedan
förälder
incheckning
c60504ba7c

+ 3 - 1
Sources/ManageLanguages.php

@@ -940,7 +940,9 @@ function ModifyLanguage()
 		if (!empty($modSettings['package_make_backups']) && (!isset($_SESSION['last_backup_for']) || $_SESSION['last_backup_for'] != $context['lang_id'] . '$$$'))
 		{
 			$_SESSION['last_backup_for'] = $context['lang_id'] . '$$$';
-			package_create_backup('backup_lang_' . $context['lang_id']);
+			$result = package_create_backup('backup_lang_' . $context['lang_id']);
+			if (!$result)
+				fatal_lang_error('could_not_language_backup', false);
 		}
 
 		// Second, loop through the array to remove the files.

+ 1 - 1
Sources/ManageMembergroups.php

@@ -692,7 +692,7 @@ function EditMembergroup()
 		validateToken('admin-mmg');
 
 		// Can they really inherit from this group?
-		if (isset($_POST['group_inherit']) && $_POST['group_inherit'] != -2 && !allowedTo('admin_forum'))
+		if ($_REQUEST['group'] > 1 && $_REQUEST['group'] != 3 && isset($_POST['group_inherit']) && $_POST['group_inherit'] != -2 && !allowedTo('admin_forum'))
 		{
 			$request = $smcFunc['db_query']('', '
 				SELECT group_type

+ 3 - 1
Sources/Packages.php

@@ -891,7 +891,9 @@ function PackageInstall()
 	{
 		$_SESSION['last_backup_for'] = $context['filename'] . ($context['uninstalling'] ? '$$' : '$');
 		// @todo Internationalize this?
-		package_create_backup(($context['uninstalling'] ? 'backup_' : 'before_') . strtok($context['filename'], '.'));
+		$result = package_create_backup(($context['uninstalling'] ? 'backup_' : 'before_') . strtok($context['filename'], '.'));
+		if (!$result)
+			fatal_lang_error('could_not_language_backup', false);
 	}
 
 	// The mod isn't installed.... unless proven otherwise.

+ 9 - 2
Sources/Subs-Package.php

@@ -2952,15 +2952,20 @@ function package_create_backup($id = 'backup')
 	{
 		$fwrite = 'gzwrite';
 		$fclose = 'gzclose';
-		$output = gzopen($output_file, 'wb');
+		$output = @gzopen($output_file, 'wb');
 	}
 	else
 	{
 		$fwrite = 'fwrite';
 		$fclose = 'fclose';
-		$output = fopen($output_file, 'wb');
+		$output = @fopen($output_file, 'wb');
 	}
 
+	// If we don't have a file handle, that means for whatever reason the file could not be opened.
+	// Could be permissions, could be a file already exists that shouldn't, etc.
+	if (!$output)
+		return false;
+
 	foreach ($files as $real_file => $file)
 	{
 		if (!file_exists($real_file))
@@ -2996,6 +3001,8 @@ function package_create_backup($id = 'backup')
 
 	$fwrite($output, pack('a1024', ''));
 	$fclose($output);
+
+	return true;
 }
 
 /**

+ 1 - 1
Sources/Subs-Post.php

@@ -581,7 +581,7 @@ function sendmail($to, $subject, $message, $from = null, $message_id = null, $se
 	list (, $subject) = mimespecialchars($subject, true, $hotmail_fix, $line_break);
 
 	// Construct the mail headers...
-	$headers = 'From: "' . $from_name . '" <' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . '>' . $line_break;
+	$headers = 'From: ' . $from_name . ' <' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . '>' . $line_break;
 	$headers .= $from !== null ? 'Reply-To: <' . $from . '>' . $line_break : '';
 	$headers .= 'Return-Path: ' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . $line_break;
 	$headers .= 'Date: ' . gmdate('D, d M Y H:i:s') . ' -0000' . $line_break;

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

@@ -404,7 +404,7 @@ function template_ic_block_stats()
 			</div>
 			<p class="inline">
 				', $context['common_stats']['boardindex_total_posts'], '', !empty($settings['show_latest_member']) ? ' - '. $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br />
-				', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )<br />' : ''), '
+				', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  (' . $context['latest_post']['time'] . ')<br />' : ''), '
 				<a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>
 			</p>';
 }

+ 1 - 0
Themes/default/languages/Admin.english.php

@@ -603,6 +603,7 @@ $txt['language_description'] = 'This section allows you to edit languages instal
 $txt['language_edit'] = 'Edit Languages';
 $txt['language_add'] = 'Add Language';
 $txt['language_settings'] = 'Settings';
+$txt['could_not_language_backup'] = 'A backup could not be made before removing this language pack. No changes have been made at this time as a result (either change the permissions so Packages/backup can be written to, or turn off backups - not recommended)';
 
 $txt['advanced'] = 'Advanced';
 $txt['simple'] = 'Simple';

+ 2 - 0
Themes/default/languages/Packages.english.php

@@ -34,6 +34,8 @@ $txt['package_delete_list_warning'] = 'Are you sure you wish to clear the instal
 $txt['php_safe_mode'] = 'Sorry, your server currently has PHP set to run in SAFE MODE.  This feature is not compatible with SAFE MODE.';
 $txt['lets_try_anyway'] = 'Let me try anyway.';
 
+$txt['could_not_package_backup'] = 'A backup could not be made before making changes. No changes have been made at this time as a result (either change the permissions so Packages/backup can be written to, or turn off backups - not recommended)';
+
 $txt['package_manager_desc'] = 'From this easy to use interface, you can download and install modifications for use on your forum.';
 $txt['installed_packages_desc'] = 'You can use the interface below to view those packages currently installed on the forum, and remove the ones you no longer require.';
 $txt['download_packages_desc'] = 'From this section you can choose to either download new packages from package servers, or upload a package file directly to the forum.';

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

@@ -1834,7 +1834,6 @@ VALUES ('smfVersion', '{$smf_version}'),
 	('recycle_board', '0'),
 	('maxMsgID', '1'),
 	('enableAllMessages', '0'),
-	('fixLongWords', '0'),
 	('knownThemes', '1'),
 	('enableThemes', '1'),
 	('who_enabled', '1'),

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

@@ -2345,7 +2345,6 @@ INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_enable', '0'
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_board', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('maxMsgID', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableAllMessages', '0');
-INSERT INTO {$db_prefix}settings (variable, value) VALUES ('fixLongWords', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('knownThemes', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableThemes', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('who_enabled', '1');

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

@@ -1977,7 +1977,6 @@ INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_enable', '0'
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_board', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('maxMsgID', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableAllMessages', '0');
-INSERT INTO {$db_prefix}settings (variable, value) VALUES ('fixLongWords', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('knownThemes', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableThemes', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('who_enabled', '1');

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

@@ -1977,7 +1977,6 @@ INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_enable', '0'
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_board', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('maxMsgID', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableAllMessages', '0');
-INSERT INTO {$db_prefix}settings (variable, value) VALUES ('fixLongWords', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('knownThemes', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableThemes', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('who_enabled', '1');

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

@@ -602,7 +602,7 @@ WHERE variable = 'avatar_action_too_large'
 
 ---# Cleaning up old settings.
 DELETE FROM {$db_prefix}settings
-WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts');
+WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts', 'fixLongWords');
 ---#
 
 ---# Cleaning up old theme settings.

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

@@ -681,7 +681,7 @@ WHERE variable = 'avatar_action_too_large'
 
 ---# Cleaning up old settings.
 DELETE FROM {$db_prefix}settings
-WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts');
+WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts', 'fixLongWords');
 ---#
 
 ---# Cleaning up old theme settings.

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

@@ -672,7 +672,7 @@ WHERE variable = 'avatar_action_too_large'
 
 ---# Cleaning up old settings.
 DELETE FROM {$db_prefix}settings
-WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts');
+WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts', 'fixLongWords');
 ---#
 
 ---# Cleaning up old theme settings.