Prechádzať zdrojové kódy

Merge pull request #1218 from Arantor/release-2.1

Minor fixes
Arantor 10 rokov pred
rodič
commit
a6a77a5db6

+ 1 - 1
Sources/Admin.php

@@ -593,7 +593,7 @@ function DisplayAdminFile()
 
 	// @todo Temp
 	// Figure out if sesc is still being used.
-	if (strpos($file_data, ';sesc=') !== false)
+	if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript')
 		$file_data = '
 if (!(\'smfForum_sessionvar\' in window))
 	window.smfForum_sessionvar = \'sesc\';

+ 3 - 0
Sources/Karma.php

@@ -53,6 +53,9 @@ function ModifyKarma()
 	// Applauding or smiting?
 	$dir = $_REQUEST['sa'] != 'applaud' ? -1 : 1;
 
+	if (($dir == 1 && empty($modSettings['karmaApplaudLabel'])) || ($dir == -1 && empty($modSettings['karmaSmiteLabel'])))
+		fatal_lang_error('feature_disabled', false);
+
 	// Delete any older items from the log. (karmaWaitTime is by hour.)
 	$smcFunc['db_query']('', '
 		DELETE FROM {db_prefix}log_karma

+ 29 - 39
Sources/Subs-Editor.php

@@ -2341,6 +2341,7 @@ function AutoSuggest_Search_MemberGroups()
  */
 function AutoSuggest_Search_SMFVersions()
 {
+	global $smcFunc;
 
 	$xml_data = array(
 		'items' => array(
@@ -2349,46 +2350,35 @@ function AutoSuggest_Search_SMFVersions()
 		),
 	);
 
-	$versions = array(
-		'SMF 1.1',
-		'SMF 1.1.1',
-		'SMF 1.1.2',
-		'SMF 1.1.3',
-		'SMF 1.1.4',
-		'SMF 1.1.5',
-		'SMF 1.1.6',
-		'SMF 1.1.7',
-		'SMF 1.1.8',
-		'SMF 1.1.9',
-		'SMF 1.1.10',
-		'SMF 1.1.11',
-		'SMF 1.1.12',
-		'SMF 1.1.13',
-		'SMF 1.1.14',
-		'SMF 1.1.15',
-		'SMF 1.1.16',
-		'SMF 1.1.17',
-		'SMF 1.1.18',
-		'SMF 1.1.19',
-		'SMF 2.0 beta 1',
-		'SMF 2.0 beta 1.2',
-		'SMF 2.0 beta 2',
-		'SMF 2.0 beta 3',
-		'SMF 2.0 beta 4',
-		'SMF 2.0 RC1',
-		'SMF 2.0 RC1.2',
-		'SMF 2.0 RC2',
-		'SMF 2.0 RC3',
-		'SMF 2.0 RC4',
-		'SMF 2.0 RC5',
-		'SMF 2.0',
-		'SMF 2.0.1',
-		'SMF 2.0.2',
-		'SMF 2.0.3',
-		'SMF 2.0.4',
-		'SMF 2.0.5',
-		'SMF 2.0.6',
+	// First try and get it from the database.
+	$versions = array();
+	$request = $smcFunc['db_query']('', '
+		SELECT data
+		FROM {db_prefix}admin_info_files
+		WHERE filename = {string:latest_versions}
+			AND path = {string:path}',
+		array(
+			'latest_versions' => 'latest-versions.txt',
+			'path' => '/smf/',
+		)
 	);
+	if (($smcFunc['db_num_rows']($request) > 0) && ($row = $smcFunc['db_fetch_assoc']($request)) && !empty($row['data']))
+	{
+		// The file can be either Windows or Linux line endings, but let's ensure we clean it as best we can.
+		$possible_versions = explode("\n", $row['data']);
+		foreach ($possible_versions as $ver)
+		{
+			$ver = trim($ver);
+			if (strpos($ver, 'SMF') === 0)
+				$versions[] = $ver;
+		}
+	}
+	$smcFunc['db_free_result']($request);
+
+	// Just in case we don't have ANYthing.
+	if (empty($versions))
+		$versions = array('SMF 2.0');
+	
 
 	foreach ($versions as $id => $version)
 		if (strpos($version, strtoupper($_REQUEST['search'])) !== false)

+ 3 - 1
Themes/default/GenericList.template.php

@@ -15,7 +15,9 @@ function template_show_list($list_id = null)
 	global $context, $scripturl, $txt, $modSettings;
 
 	// Get a shortcut to the current list.
-	$list_id = $list_id === null ? $context['default_list'] : $list_id;
+	$list_id = $list_id === null ? (!empty($context['default_list']) ? $context['default_list'] : '') : $list_id;
+	if (empty($list_id) || empty($context[$list_id]))
+		return;
 	$cur_list = &$context[$list_id];
 
 	// These are the main tabs that is used all around the template.

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

@@ -26,7 +26,8 @@ VALUES
 	(1, 'current-version.js', '/smf/', 'version=%3$s', '', 'text/javascript'),
 	(2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript'),
 	(3, 'latest-news.js', '/smf/', 'language=%1$s&format=%2$s', '', 'text/javascript'),
-	(4, 'latest-smileys.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
+	(4, 'latest-smileys.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript'),
+	(5, 'latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain');
 # --------------------------------------------------------
 
 #

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

@@ -173,6 +173,7 @@ INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, d
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (3, 'latest-news.js', '/smf/', 'language=%1$s&format=%2$s', '', 'text/javascript');
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (4, 'latest-smileys.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
+INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (5, 'latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain');
 # --------------------------------------------------------
 
 #

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

@@ -29,6 +29,7 @@ INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, d
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (3, 'latest-news.js', '/smf/', 'language=%1$s&format=%2$s', '', 'text/javascript');
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (4, 'latest-smileys.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
+INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (5, 'latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain');
 COMMIT;
 
 # --------------------------------------------------------

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

@@ -29,6 +29,7 @@ INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, d
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (3, 'latest-news.js', '/smf/', 'language=%1$s&format=%2$s', '', 'text/javascript');
 INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (4, 'latest-smileys.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript');
+INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (5, 'latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain');
 COMMIT;
 
 # --------------------------------------------------------

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

@@ -671,14 +671,25 @@ WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_rep
 ---#
 
 /******************************************************************************/
---- Removing old Simple Machines files we do not need to fetch any more
+--- Updating files that fetched from simplemachines.org
 /******************************************************************************/
----# We no longer call on the latest packages list.
+---# We no longer call on several files.
 DELETE FROM {$db_prefix}admin_info_files
 WHERE filename IN ('latest-packages.js', 'latest-support.js', 'latest-themes.js')
 	AND path = '/smf/';
 ---#
 
+---# But we do need new files.
+---{
+$smcFunc['db_insert']('',
+	'{db_prefix}admin_info_files',
+	array('filename' => 'string', 'path' => 'string', 'parameters' => 'string', 'data' => 'string', 'filetype' => 'string'),
+	array('latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'),
+	array('id_file')
+);
+---}
+---#
+
 /******************************************************************************/
 --- Upgrading "verification questions" feature
 /******************************************************************************/

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

@@ -750,14 +750,25 @@ WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_rep
 ---#
 
 /******************************************************************************/
---- Removing old Simple Machines files we do not need to fetch any more
+--- Updating files that fetched from simplemachines.org
 /******************************************************************************/
----# We no longer call on the latest packages list.
+---# We no longer call on several files.
 DELETE FROM {$db_prefix}admin_info_files
 WHERE filename IN ('latest-packages.js', 'latest-support.js', 'latest-themes.js')
 	AND path = '/smf/';
 ---#
 
+---# But we do need new files.
+---{
+$smcFunc['db_insert']('',
+	'{db_prefix}admin_info_files',
+	array('filename' => 'string', 'path' => 'string', 'parameters' => 'string', 'data' => 'string', 'filetype' => 'string'),
+	array('latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'),
+	array('id_file')
+);
+---}
+---#
+
 /******************************************************************************/
 --- Upgrading "verification questions" feature
 /******************************************************************************/

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

@@ -741,14 +741,25 @@ WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_rep
 ---#
 
 /******************************************************************************/
---- Removing old Simple Machines files we do not need to fetch any more
+--- Updating files that fetched from simplemachines.org
 /******************************************************************************/
----# We no longer call on the latest packages list.
+---# We no longer call on several files.
 DELETE FROM {$db_prefix}admin_info_files
 WHERE filename IN ('latest-packages.js', 'latest-support.js', 'latest-themes.js')
 	AND path = '/smf/';
 ---#
 
+---# But we do need new files.
+---{
+$smcFunc['db_insert']('',
+	'{db_prefix}admin_info_files',
+	array('filename' => 'string', 'path' => 'string', 'parameters' => 'string', 'data' => 'string', 'filetype' => 'string'),
+	array('latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'),
+	array('id_file')
+);
+---}
+---#
+
 /******************************************************************************/
 --- Upgrading "verification questions" feature
 /******************************************************************************/