Browse Source

Merge pull request #257 from emanuele45/master

few bits taken here and there

Signed-off-by: emanuele <[email protected]>
emanuele45 12 years ago
parent
commit
3dbbcd5f58
53 changed files with 187 additions and 154 deletions
  1. 1 1
      Sources/Admin.php
  2. 1 1
      Sources/Class-CurlFetchWeb.php
  3. 1 1
      Sources/DbExtra-sqlite.php
  4. 1 1
      Sources/Drafts.php
  5. 1 1
      Sources/Errors.php
  6. 1 1
      Sources/LogInOut.php
  7. 8 8
      Sources/ManageAttachments.php
  8. 1 1
      Sources/ManageBoards.php
  9. 2 3
      Sources/ManageLanguages.php
  10. 1 1
      Sources/ManageNews.php
  11. 1 1
      Sources/ManageServer.php
  12. 1 1
      Sources/ManageSettings.php
  13. 1 1
      Sources/ManageSmileys.php
  14. 2 2
      Sources/MessageIndex.php
  15. 1 1
      Sources/ModerationCenter.php
  16. 26 10
      Sources/PersonalMessage.php
  17. 3 3
      Sources/Post.php
  18. 1 1
      Sources/PostModeration.php
  19. 28 22
      Sources/Profile-View.php
  20. 2 0
      Sources/SearchAPI-Custom.php
  21. 23 9
      Sources/Security.php
  22. 2 2
      Sources/Subs-Attachments.php
  23. 3 3
      Sources/Subs-Boards.php
  24. 5 3
      Sources/Subs-Charset.php
  25. 1 1
      Sources/Subs-Editor.php
  26. 1 1
      Sources/Subs-List.php
  27. 1 1
      Sources/Subs-Package.php
  28. 15 15
      Sources/Subs.php
  29. 3 0
      Sources/Themes.php
  30. 1 2
      Themes/default/Admin.template.php
  31. 1 2
      Themes/default/ManageAttachments.template.php
  32. 3 4
      Themes/default/ManageBans.template.php
  33. 4 4
      Themes/default/ManageBoards.template.php
  34. 3 3
      Themes/default/ManagePermissions.template.php
  35. 0 1
      Themes/default/ManageSearch.template.php
  36. 1 4
      Themes/default/ManageSmileys.template.php
  37. 1 1
      Themes/default/Memberlist.template.php
  38. 1 3
      Themes/default/Packages.template.php
  39. 2 3
      Themes/default/PersonalMessage.template.php
  40. 1 2
      Themes/default/Profile.template.php
  41. 0 2
      Themes/default/Register.template.php
  42. 0 1
      Themes/default/Search.template.php
  43. 0 1
      Themes/default/SplitTopics.template.php
  44. 9 3
      Themes/default/Themes.template.php
  45. 2 2
      Themes/default/languages/ManagePaid.english.php
  46. 6 6
      other/Settings.php
  47. 3 3
      other/install.php
  48. 1 1
      other/install_2-1_mysql.sql
  49. 2 2
      other/upgrade.php
  50. 1 1
      other/upgrade_2-1_mysql.sql
  51. 2 2
      other/upgrade_2-1_postgresql.sql
  52. 1 1
      other/upgrade_2-1_sqlite.sql
  53. 4 4
      subscriptions.php

+ 1 - 1
Sources/Admin.php

@@ -996,4 +996,4 @@ function AdminEndSession()
 	redirectexit('action=admin');
 }
 
-?>
+?>

+ 1 - 1
Sources/Class-CurlFetchWeb.php

@@ -306,4 +306,4 @@ class curl_fetch_web_data
 	}
 }
 
-?>
+?>

+ 1 - 1
Sources/DbExtra-sqlite.php

@@ -158,7 +158,7 @@ function smf_db_optimize_table($table)
 /**
  * This function lists all tables in the database.
  * The listing could be filtered according to $filter.
- * 
+ *
  * @param mixed $db string holding the table name, or false, default false
  * @param mixed $filter string to filter by, or false, default false
  * @return array an array of table names. (strings)

+ 1 - 1
Sources/Drafts.php

@@ -878,7 +878,7 @@ function ModifyDraftSettings($return_config = false)
 		saveDBSettings($config_vars);
 		redirectexit('action=admin;area=managedrafts');
 	}
-	
+
 	// some javascript to enable / disable the frequency input box
 	$context['settings_post_javascript'] = '
 		var autosave = document.getElementById(\'drafts_autosave_enabled\');

+ 1 - 1
Sources/Errors.php

@@ -259,7 +259,7 @@ function error_handler($error_level, $error_string, $file, $line)
 /**
  * It is called by fatal_error() and fatal_lang_error().
  * @uses Errors template, fatal_error sub template, or Wireless template, error sub template.
- * 
+ *
  * @param string $error_message
  * @param type $error_code
  */

+ 1 - 1
Sources/LogInOut.php

@@ -758,4 +758,4 @@ function validatePasswordFlood($id_member, $password_flood_value = false, $was_c
 
 }
 
-?>
+?>

+ 8 - 8
Sources/ManageAttachments.php

@@ -102,7 +102,7 @@ function ManageAttachmentSettings($return_config = false)
 	// If not set, show a default path for the base directory
 	if (!isset($_GET['save']) && empty($modSettings['basedirectory_for_attachments']))
 		if (is_dir($modSettings['attachmentUploadDir'][1]))
-			$modSettings['basedirectory_for_attachments'] = $modSettings['attachmentUploadDir'][1];		
+			$modSettings['basedirectory_for_attachments'] = $modSettings['attachmentUploadDir'][1];
 		else
 			$modSettings['basedirectory_for_attachments'] = $context['attachmentUploadDir'];
 
@@ -244,7 +244,7 @@ function ManageAttachmentSettings($return_config = false)
 					));
 
 					$_POST['use_subdirectories_for_attachments'] = 1;
-					$_POST['attachmentUploadDir'] = serialize($modSettings['attachmentUploadDir']);	
+					$_POST['attachmentUploadDir'] = serialize($modSettings['attachmentUploadDir']);
 
 				}
 			}
@@ -738,7 +738,7 @@ function MaintainFiles()
 	if (!empty($modSettings['attachmentDirFileLimit']))
 		$context['attachment_files'] = comma_format(max($modSettings['attachmentDirFileLimit'] - $current_dir_files, 0), 0);
 	$context['attachment_current_files'] = comma_format($current_dir_files, 0);
-	
+
 	$context['attach_multiple_dirs'] = count($attach_dirs) > 1 ? true : false;
 	$context['attach_dirs'] = $attach_dirs;
 	$context['base_dirs'] = !empty($modSettings['attachment_basedirectories']) ? unserialize($modSettings['attachment_basedirectories']) : array();
@@ -2070,7 +2070,7 @@ function ManageAttachmentPaths()
 			if (!is_array($modSettings['last_attachments_directory']))
 				$modSettings['last_attachments_directory'] = unserialize($modSettings['last_attachments_directory']);
 			$num = substr(strrchr($modSettings['attachmentUploadDir'][$_POST['current_dir']], '_'), 1);
-			
+
 			if (is_numeric($num))
 			{
 				// Need to find the base folder.
@@ -2234,7 +2234,7 @@ function ManageAttachmentPaths()
 			if (!empty($_SESSION['errors']['dir']))
 				foreach($_SESSION['errors']['dir'] as $error)
 					$errors['dir'][] = $smcFunc['htmlspecialchars']($error, ENT_QUOTES);
-			
+
 			if (!empty($_SESSION['errors']['base']))
 				foreach($_SESSION['errors']['base'] as $error)
 					$errors['base'][] = $smcFunc['htmlspecialchars']($error, ENT_QUOTES);
@@ -2586,9 +2586,9 @@ function attachDirStatus($dir, $expected_files)
 function TransferAttachments()
 {
 	global $modSettings, $context, $smcFunc, $sourcedir, $txt, $boarddir;
-	
+
 	checkSession();
-	
+
 	$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
 	if (!empty($modSettings['attachment_basedirectories']))
 		$modSettings['attachment_basedirectories'] = unserialize($modSettings['attachment_basedirectories']);
@@ -2606,7 +2606,7 @@ function TransferAttachments()
 	$current_progress = 0;
 	$total_moved = 0;
 	$total_not_moved = 0;
-	
+
 	if (empty($_POST['from']) || (empty($_POST['auto']) && empty($_POST['to'])))
 		$results[] = $txt['attachment_transfer_no_dir'];
 

+ 1 - 1
Sources/ManageBoards.php

@@ -848,4 +848,4 @@ function EditBoardSettings($return_config = false)
 	prepareDBSettingContext($config_vars);
 }
 
-?>
+?>

+ 2 - 3
Sources/ManageLanguages.php

@@ -43,8 +43,7 @@ function ManageLanguages()
 		'editlang' => 'ModifyLanguage',
 	);
 
-	$config_vars = array();
-	call_integration_hook('integrate_manage_languages', array($config_vars));
+	call_integration_hook('integrate_manage_languages', array($subActions));
 
 	// By default we're managing languages.
 	$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'edit';
@@ -812,7 +811,7 @@ function ModifyLanguageSettings($return_config = false)
 	{
 		checkSession();
 
-		call_integration_hook('integrate_save_language_settings');
+		call_integration_hook('integrate_save_language_settings', array($config_vars));
 
 		saveSettings($config_vars);
 		redirectexit('action=admin;area=languages;sa=settings');

+ 1 - 1
Sources/ManageNews.php

@@ -1086,4 +1086,4 @@ function ModifyNewsSettings($return_config = false)
 	prepareDBSettingContext($config_vars);
 }
 
-?>
+?>

+ 1 - 1
Sources/ManageServer.php

@@ -340,7 +340,7 @@ function ModifyCacheSettings($return_config = false)
 		$detected['xcache'] = $txt['xcache_cache'];
 	if (function_exists('file_put_contents'))
 		$detected['smf'] = $txt['default_cache'];
-		
+
 	// set our values to show what, if anything, we found
 	if (empty($detected))
 	{

+ 1 - 1
Sources/ManageSettings.php

@@ -2607,7 +2607,7 @@ function get_integration_hooks_count()
 
 /**
  * Parses modSettings to create integration hook array
- * 
+ *
  * @staticvar type $integration_hooks
  * @return type
  */

+ 1 - 1
Sources/ManageSmileys.php

@@ -2036,4 +2036,4 @@ function sortSmileyTable()
 	$smcFunc['db_remove_column']('{db_prefix}smileys', 'temp_order');
 }
 
-?>
+?>

+ 2 - 2
Sources/MessageIndex.php

@@ -79,7 +79,7 @@ function MessageIndex()
 	// We only know these.
 	if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post')))
 		$_REQUEST['sort'] = 'last_post';
-		
+
 	// Make sure the starting place makes sense and construct the page index.
 	if (isset($_REQUEST['sort']))
 		$context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%1$d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['total_topics'], $maxindex, true);
@@ -1151,7 +1151,7 @@ function QuickModeration()
 		$smcFunc['db_query']('', '
 			SELECT id_topic, disregarded
 			FROM {db_prefix}log_topics
-			WHERE id_topic IN ({array_int:selected_topics}
+			WHERE id_topic IN ({array_int:selected_topics})
 				AND id_member = {int:current_user}',
 			array(
 				'selected_topics' => $markCache,

+ 1 - 1
Sources/ModerationCenter.php

@@ -2150,4 +2150,4 @@ function ModEndSession()
 	redirectexit('action=moderate');
 }
 
-?>
+?>

+ 26 - 10
Sources/PersonalMessage.php

@@ -177,7 +177,7 @@ function MessageMain()
 	// Are PM drafts enabled?
 	$context['drafts_pm_save'] = !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
 	$context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
-	
+
 	// Build the linktree for all the actions...
 	$context['linktree'][] = array(
 		'url' => $scripturl . '?action=pm',
@@ -837,6 +837,18 @@ function MessageFolder()
 				'id_member' => $context['folder'] == 'sent' ? 'pmr.id_member' : 'pm.id_member_from',
 			)
 		);
+
+		// Build the conversation button array.
+		if ($context['display_mode'] == 2)
+		{
+			$context['conversation_buttons'] = array(
+				'reply' => array('text' => 'reply_to_all', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=send;f=' . $context['folder'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';pmsg=' . $context['current_pm'] . ';u=all', 'active' => true),
+				'delete' => array('text' => 'delete_conversation', 'image' => 'delete.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=pmactions;pm_actions[' . $context['current_pm'] . ']=delete;conversation;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'], 'custom' => 'onclick="return confirm(\'' . addslashes($txt['remove_message']) . '?\');"'),
+			);
+	
+			// Allow mods to add additional buttons here
+			call_integration_hook('integrate_conversation_buttons');
+		}
 	}
 	else
 		$messages_request = false;
@@ -857,18 +869,20 @@ function MessageFolder()
 		elseif (!empty($context['current_pm']))
 			markMessages($display_pms, $context['current_label_id']);
 	}
+<<<<<<< HEAD
 
 	// Build the conversation button array.
 	if ($context['display_mode'] == 2)
 	{
 		$context['conversation_buttons'] = array(
-			'reply' => array('text' => 'reply_to_all', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=send;f=' . $context['folder'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';pmsg=' . $context['current_pm'] . ';u=all', 'active' => true),
 			'delete' => array('text' => 'delete_conversation', 'image' => 'delete.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=pmactions;pm_actions[' . $context['current_pm'] . ']=delete;conversation;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'], 'custom' => 'onclick="return confirm(\'' . addslashes($txt['remove_message']) . '?\');"'),
 		);
 
 		// Allow mods to add additional buttons here
 		call_integration_hook('integrate_conversation_buttons');
 	}
+=======
+>>>>>>> 62e562d... Undefined: current_pm
 }
 
 /**
@@ -955,6 +969,7 @@ function prepareMessageContext($type = 'subject', $reset = false)
 	{
 		$memberContext[$message['id_member_from']]['name'] = $message['from_name'];
 		$memberContext[$message['id_member_from']]['id'] = 0;
+
 		// Sometimes the forum sends messages itself (Warnings are an example) - in this case don't label it from a guest.
 		$memberContext[$message['id_member_from']]['group'] = $message['from_name'] == $context['forum_name'] ? '' : $txt['guest_title'];
 		$memberContext[$message['id_member_from']]['link'] = $message['from_name'];
@@ -968,7 +983,7 @@ function prepareMessageContext($type = 'subject', $reset = false)
 		$memberContext[$message['id_member_from']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member_from']]['warning_status'] && ($context['user']['can_mod'] || (!empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member_from'] == $user_info['id'])));
 	}
 
-		$memberContext[$message['id_member_from']]['show_profile_buttons'] = $settings['show_profile_buttons'] && (!empty($memberContext[$message['id_member_from']]['can_view_profile']) || (!empty($memberContext[$message['id_member_from']]['website']['url']) && !isset($context['disabled_fields']['website'])) || (in_array($memberContext[$message['id_member_from']]['show_email'], array('yes', 'yes_permission_override', 'no_through_forum'))) || $context['can_send_pm']);
+	$memberContext[$message['id_member_from']]['show_profile_buttons'] = $settings['show_profile_buttons'] && (!empty($memberContext[$message['id_member_from']]['can_view_profile']) || (!empty($memberContext[$message['id_member_from']]['website']['url']) && !isset($context['disabled_fields']['website'])) || (in_array($memberContext[$message['id_member_from']]['show_email'], array('yes', 'yes_permission_override', 'no_through_forum'))) || $context['can_send_pm']);
 
 	// Censor all the important text...
 	censorText($message['body']);
@@ -996,7 +1011,7 @@ function prepareMessageContext($type = 'subject', $reset = false)
 		'is_selected' => !empty($temp_pm_selected) && in_array($message['id_pm'], $temp_pm_selected),
 		'is_message_author' => $message['id_member_from'] == $user_info['id'],
 		'can_report' => !empty($modSettings['enableReportPM']),
-		'can_see_ip' => allowedTo('moderate_forum') || ($message['id_member'] == $user_info['id'] && !empty($user_info['id'])),
+		'can_see_ip' => allowedTo('moderate_forum') || ($message['id_member_from'] == $user_info['id'] && !empty($user_info['id'])),
 	);
 
 	$counter++;
@@ -1803,7 +1818,7 @@ function MessagePost()
 	$editorOptions = array(
 		'id' => 'message',
 		'value' => $context['message'],
-		'height' => '175px',
+		'height' => '250px',
 		'width' => '100%',
 		'labels' => array(
 			'post_button' => $txt['send_message'],
@@ -1836,7 +1851,7 @@ function MessagePost()
  */
 function MessageDrafts()
 {
-	global $context, $sourcedir, $user_info, $modSettings;
+	global $sourcedir, $user_info;
 
 	// validate with loadMemberData()
 	$memberResult = loadMemberData($user_info['id'], false);
@@ -1997,6 +2012,7 @@ function messagePostError($error_types, $named_recipients, $recipient_ids = arra
 		'id' => 'message',
 		'value' => $context['message'],
 		'width' => '90%',
+		'height' => '250px',
 		'labels' => array(
 			'post_button' => $txt['send_message'],
 		),
@@ -2039,8 +2055,8 @@ function MessagePost2()
 
 	isAllowedTo('pm_send');
 	require_once($sourcedir . '/Subs-Auth.php');
-	
-	// PM Drafts enabled and needed? 
+
+	// PM Drafts enabled and needed?
 	if ($context['drafts_pm_save'] && (isset($_POST['save_draft']) || isset($_POST['id_pm_draft'])))
 		require_once($sourcedir . '/Drafts.php');
 
@@ -2310,7 +2326,7 @@ function MessagePost2()
 	if (!empty($context['send_log']) && empty($context['send_log']['failed']))
 	{
 		$context['current_label_redirect'] = $context['current_label_redirect'] . ';done=sent';
-		
+
 		// If we had a PM draft for this one, then its time to remove it since it was just sent
 		if ($context['drafts_pm_save'] && !empty($_POST['id_pm_draft']))
 			DeleteDraft($_POST['id_pm_draft']);
@@ -3710,4 +3726,4 @@ function isAccessiblePM($pmID, $validFor = 'in_or_outbox')
 	}
 }
 
-?>
+?>

+ 3 - 3
Sources/Post.php

@@ -1829,7 +1829,7 @@ function Post2()
 		if (isset($topicOptions['id']))
 			$topic = $topicOptions['id'];
 	}
-	
+
 	// If we had a draft for this, its time to remove it since it was just posted
 	if (!empty($modSettings['drafts_enabled']) && !empty($_POST['id_draft']))
 		DeleteDraft($_POST['id_draft']);
@@ -2031,7 +2031,7 @@ function Post2()
 		$context['linktree'][] = array(
 			'url' => $scripturl . '?topic=' . $topic . '.0',
 			'name' => $_POST['subject'],
-			'extra_before' => $settings['linktree_inline'] ? $txt['topic'] . ': ' : ''
+			'extra_before' => !empty($settings['linktree_inline']) ? $txt['topic'] . ': ' : ''
 		);
 
 		if (isset($_REQUEST['msg']))
@@ -2879,4 +2879,4 @@ function JavaScriptModify()
 		obExit(false);
 }
 
-?>
+?>

+ 1 - 1
Sources/PostModeration.php

@@ -295,7 +295,7 @@ function UnapprovedPosts()
 			'category' => array(
 				'id' => $row['id_cat'],
 				'name' => $row['cat_name'],
-				'link' => '<a href="', $scripturl, '#c', $row['id_cat'], '">', $row['cat_name'], '</a>',
+				'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cat_name'] . '</a>',
 			),
 			'can_delete' => $can_delete,
 		);

+ 28 - 22
Sources/Profile-View.php

@@ -627,12 +627,12 @@ function showAttachments($memID)
 /**
  * Get a list of attachments for this user
  *
- * @param type $start
- * @param type $items_per_page
- * @param type $sort
- * @param type $boardsAllowed
- * @param type $memID
- * @return type
+ * @param int $start
+ * @param int $items_per_page
+ * @param string $sort
+ * @param array $boardsAllowed
+ * @param ing $memID
+ * @return array
  */
 function list_getAttachments($start, $items_per_page, $sort, $boardsAllowed, $memID)
 {
@@ -879,28 +879,34 @@ function list_getDisregarded($start, $items_per_page, $sort, $memID)
 
 	$smcFunc['db_free_result']($request);
 
-	$request = $smcFunc['db_query']('', '
-		SELECT mf.subject, mf.poster_time as started_on, IFNULL(memf.real_name, mf.poster_name) as started_by, ml.poster_time as last_post_on, IFNULL(meml.real_name, ml.poster_name) as last_post_by, t.id_topic
-		FROM {db_prefix}topics AS t
-			INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
-			INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
-			LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
-			LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)
-		WHERE t.id_topic IN ({array_int:topics})',
-		array(
-			'topics' => $topics,
-		)
-	);
+	// Any topics found?
 	$topicsInfo = array();
-	while ($row = $smcFunc['db_fetch_assoc']($request))
-		$topicsInfo[] = $row;
-	$smcFunc['db_free_result']($request);
+	if (!empty($topics))
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT mf.subject, mf.poster_time as started_on, IFNULL(memf.real_name, mf.poster_name) as started_by, ml.poster_time as last_post_on, IFNULL(meml.real_name, ml.poster_name) as last_post_by, t.id_topic
+			FROM {db_prefix}topics AS t
+				INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
+				INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
+				LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
+				LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)
+			WHERE t.id_topic IN ({array_int:topics})',
+			array(
+				'topics' => $topics,
+			)
+		);
+		while ($row = $smcFunc['db_fetch_assoc']($request))
+			$topicsInfo[] = $row;
+		$smcFunc['db_free_result']($request);
+	}
 
 	return $topicsInfo;
 }
 
 /**
- * Count the topics in the disregarded list
+ * Count the number of topics in the disregarded list
+ *
+ * @param int $memID
  */
 function list_getNumDisregarded($memID)
 {

+ 2 - 0
Sources/SearchAPI-Custom.php

@@ -351,3 +351,5 @@ class custom_search
 		}
 	}
 }
+
+?>

+ 23 - 9
Sources/Security.php

@@ -751,7 +751,7 @@ function createToken($action, $type = 'post')
 	$context[$action . '_token'] = $token;
 	$context[$action . '_token_var'] = $token_var;
 
-	return array($token_var, $token);
+	return array($action . '_token_var' => $token_var, $action . '_token' => $token);
 }
 
 /**
@@ -1036,7 +1036,8 @@ function boardsAllowedTo($permissions, $check_access = true, $simple = true)
 	global $user_info, $modSettings, $smcFunc;
 
 	// Arrays are nice, most of the time.
-	$permissions = (array) $permissions;
+	if (!is_array($permissions))
+		$permissions = array($permissions);
 
 	/*
 	 * Set $simple to true to use this function as it were in SMF 2.0.x.
@@ -1052,11 +1053,11 @@ function boardsAllowedTo($permissions, $check_access = true, $simple = true)
 			return array(0);
 		else
 		{
-			$result = array();
+			$boards = array();
 			foreach ($permissions as $permission)
-				$result[$permission] = array(0);
+				$boards[$permission] = array(0);
 
-			return $result;
+			return $boards;
 		}
 	}
 
@@ -1079,7 +1080,8 @@ function boardsAllowedTo($permissions, $check_access = true, $simple = true)
 			'permissions' => $permissions,
 		)
 	);
-	$boards = $deny_boards = $result = array();
+	$boards = array();
+	$deny_boards = array();
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		if ($simple)
@@ -1100,12 +1102,24 @@ function boardsAllowedTo($permissions, $check_access = true, $simple = true)
 	$smcFunc['db_free_result']($request);
 
 	if ($simple)
-		$result = array_unique(array_values(array_diff($boards, $deny_boards)));
+		$boards = array_unique(array_values(array_diff($boards, $deny_boards)));
 	else
+	{
 		foreach ($permissions as $permission)
-			$result[$permission] = array_unique(array_values(array_diff($boards[$permission], $deny_boards[$permission])));
+		{
+			// never had it to start with
+			if (empty($boards[$permission]))
+				$boards[$permission] = array();
+			else
+			{
+				// Or it may have been removed
+				$deny_boards[$permission] = isset($deny_boards[$permission]) ? $deny_boards[$permission] : array();
+				$boards[$permission] = array_unique(array_values(array_diff($boards[$permission], $deny_boards[$permission])));
+			}
+		}
+	}
 
-	return $result;
+	return $boards;
 }
 
 /**

+ 2 - 2
Sources/Subs-Attachments.php

@@ -139,7 +139,7 @@ function automanage_attachments_create_directory($updir)
 		// Maybe it's just the folder name
 		$tree = get_directory_tree_elements($boarddir . DIRECTORY_SEPARATOR . $updir);
 		$count = count($tree);
-	
+
 		$directory = attachments_init_dir($tree, $count);
 		if ($directory === false)
 			return false;
@@ -285,7 +285,7 @@ function get_directory_tree_elements ($directory)
 /**
  * Return the first part of a path (i.e. c:\ or / + the first directory), used by automanage_attachments_create_directory
  *
- * @param $tree an array 
+ * @param $tree an array
  * @param $count the number of elements in $tree
  *
  * @return (string)

+ 3 - 3
Sources/Subs-Boards.php

@@ -181,7 +181,7 @@ function MarkRead()
 		$smcFunc['db_query']('', '
 			SELECT id_topic, disregarded
 			FROM {db_prefix}log_topics
-			WHERE id_topic IN ({array_int:selected_topics}
+			WHERE id_topic IN ({array_int:selected_topics})
 				AND id_member = {int:current_user}',
 			array(
 				'selected_topics' => $topics,
@@ -736,7 +736,7 @@ function modifyBoard($board_id, &$boardOptions)
  * Allows (almost) the same options as the modifyBoard() function.
  * With the option inherit_permissions set, the parent board permissions
  * will be inherited.
- * 
+ *
  * @param array $boardOptions
  * @return int The new board id
  */
@@ -1176,7 +1176,7 @@ function getBoardTree()
 
 /**
  * Recursively get a list of boards.
- * Used by getBoardTree 
+ * Used by getBoardTree
  *
  * @param array &$_boardList
  * @param array &$_tree

+ 5 - 3
Sources/Subs-Charset.php

@@ -14,10 +14,10 @@
 if (!defined('SMF'))
 	die('Hacking attempt...');
 
-/** 
+/**
  * Converts the given UTF-8 string into lowercase.
  * equivalent to mb_strtolower($string, 'UTF-8')
- * 
+ *
  * @param string $string
  * @return string
  */
@@ -286,7 +286,7 @@ function utf8_strtolower($string)
 /**
  * Convert the given UTF-8 string to uppercase.
  * equivalent to mb_strtoupper($string, 'UTF-8')
- * 
+ *
  * @param string $string
  * @return string
  */
@@ -588,3 +588,5 @@ function fix_serialized_columns()
 	));
 
 }
+
+?>

+ 1 - 1
Sources/Subs-Editor.php

@@ -2236,7 +2236,7 @@ function AutoSuggest_Search_Member()
 
 /**
  * Provides a list of possible SMF versions to use in emulation
- * 
+ *
  * @return string
  */
 function AutoSuggest_Search_SMFVersions()

+ 1 - 1
Sources/Subs-List.php

@@ -110,7 +110,7 @@ function createList($listOptions)
 	// Call the function and include which items we want and in what order.
 	$list_items = call_user_func_array($listOptions['get_items']['function'], array_merge(array($list_context['start'], $list_context['items_per_page'], $sort), empty($listOptions['get_items']['params']) ? array() : $listOptions['get_items']['params']));
 	$list_items = empty($list_items) ? array() : $list_items;
-	
+
 	// Loop through the list items to be shown and construct the data values.
 	$list_context['rows'] = array();
 	foreach ($list_items as $item_id => $list_item)

+ 1 - 1
Sources/Subs-Package.php

@@ -3191,7 +3191,7 @@ if (!function_exists('smf_crc32'))
 	/**
 	 * crc32 doesn't work as expected on 64-bit functions - make our own.
 	 * http://www.php.net/crc32#79567
-	 * 
+	 *
 	 * @param type $number
 	 * @return type
 	 */

+ 15 - 15
Sources/Subs.php

@@ -1813,12 +1813,12 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 			$pos2 = strpos($message, ']', $pos + 1);
 			if ($pos2 == $pos + 2)
 				continue;
-			
+
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
 
 			$to_close = array();
 			$block_level = null;
-			
+
 			do
 			{
 				$tag = array_pop($open_tags);
@@ -1915,7 +1915,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 		foreach ($bbc_codes[$tags] as $possible)
 		{
 			$pt_strlen = strlen($possible['tag']);
-			
+
 			// Not a match?
 			if (strtolower(substr($message, $pos + 1, $pt_strlen)) != $possible['tag'])
 				continue;
@@ -2037,7 +2037,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 		{
 			if ($message[$pos + 1] == '0' && !in_array($message[$pos - 1], array(';', ' ', "\t", '>')))
 				continue;
-			
+
 			$tag = $itemcodes[$message[$pos + 1]];
 
 			// First let's set up the tree: it needs to be in a list, or after an li.
@@ -2130,7 +2130,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 			else
 				$tag['content'] = $tag['disabled_content'];
 		}
-		
+
 		// we use this alot
 		$tag_strlen = strlen($tag['tag']);
 
@@ -2208,7 +2208,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 			$pos2 = strpos($message, $quoted == false ? ']' : '&quot;]', $pos1);
 			if ($pos2 === false)
 				continue;
-			
+
 			$pos3 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos2);
 			if ($pos3 === false)
 				continue;
@@ -2242,7 +2242,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 			$pos2 = strpos($message, ']', $pos1);
 			if ($pos2 === false)
 				continue;
-				
+
 			$pos3 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos2);
 			if ($pos3 === false)
 				continue;
@@ -2444,7 +2444,7 @@ function parsesmileys(&$message)
 		$smileyPregReplacements = array();
 		$searchParts = array();
 		$smileys_path = htmlspecialchars($modSettings['smileys_url'] . '/' . $user_info['smiley_set'] . '/');
-		
+
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
 		{
 			$specialChars = htmlspecialchars($smileysfrom[$i], ENT_QUOTES);
@@ -4072,7 +4072,7 @@ function call_integration_hook($hook, $parameters = array())
 					$absPath = strtr(trim($file), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
 				if (file_exists($absPath))
 					require_once($absPath);
-				$call = $function;
+				$call = $func;
 			}
 		}
 
@@ -4260,16 +4260,16 @@ function sanitizeMSCutPaste($string)
 function replaceEntities__callback($matches)
 {
 	global $context;
-	
+
 	if (!isset($matches[2]))
 		return '';
 
 	$num = $matches[2][0] === 'x' ? hexdec(substr($matches[2], 1)) : (int) $matches[2];
-	
+
 	// remove left to right / right to left overrides
 	if ($num === 0x202D || $num === 0x202E)
 		return '';
-	
+
 	// Quote, Ampersand, Apostrophe, Less/Greater Than get html replaced
 	if (in_array($num, array(0x22, 0x26, 0x27, 0x3C, 0x3E)))
 		return '&#' . $num . ';';
@@ -4321,7 +4321,7 @@ function fixchar__callback($matches)
 {
 	if (!isset($matches[1]))
 		return '';
-	
+
 	$num = $matches[1][0] === 'x' ? hexdec(substr($matches[1], 1)) : (int) $matches[1];
 
 	// <0x20 are control characters, > 0x10FFFF is past the end of the utf8 character set
@@ -4355,9 +4355,9 @@ function entity_fix__callback($matches)
 {
 	if (!isset($matches[2]))
 		return '';
-	
+
 	$num = $matches[2][0] === 'x' ? hexdec(substr($matches[2], 1)) : (int) $matches[2];
-	
+
 	// we don't allow control characters, characters out of range, byte markers, etc
 	if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202D || $num == 0x202E)
 		return '';

+ 3 - 0
Sources/Themes.php

@@ -1924,6 +1924,9 @@ function EditTheme()
 			// You were able to submit it, so it's reasonable to assume you are allowed to save.
 			$context['allow_save'] = true;
 
+			// Re-create the token so that it can be used
+			createToken('admin-te-' . md5($_GET['th'] . '-' . $_REQUEST['filename']));
+
 			return;
 		}
 	}

+ 1 - 2
Themes/default/Admin.template.php

@@ -1380,7 +1380,6 @@ function template_core_features()
 				<h3 class="catbg">
 					', $txt['core_settings_title'], '
 				</h3>
-				
 			</div>
 			<p class="description">', $txt['core_settings_desc'], '</p>
 			<form id="core_features" action="', $scripturl, '?action=admin;area=corefeatures" method="post" accept-charset="', $context['character_set'], '">
@@ -1575,7 +1574,7 @@ function template_php_info()
 			</h3>
 		</div>
 		<br />';
-	
+
 	// for each php info area
 	foreach ($context['pinfo'] as $area => $php_area)
 	{

+ 1 - 2
Themes/default/ManageAttachments.template.php

@@ -92,7 +92,6 @@ function template_maintenance()
 				</form>
 			</div>
 		</div>
-		
 		<div class="cat_bar">
 			<h3 class="catbg">', $txt['attachment_pruning'], '</h3>
 		</div>
@@ -128,7 +127,7 @@ function template_maintenance()
 			</div>
 		</div>
 	</div>';
-	
+
 	echo '
 			<div id="transfer" class="cat_bar">
 				<h3 class="catbg">', $txt['attachment_transfer'], '</h3>

+ 3 - 4
Themes/default/ManageBans.template.php

@@ -22,11 +22,11 @@ function template_ban_edit()
 					', $context['ban']['is_new'] ? $txt['ban_add_new'] : $txt['ban_edit'] . ' \'' . $context['ban']['name'] . '\'', '
 				</h3>
 			</div>';
-			
+
 	if ($context['ban']['is_new'])
 		echo '
 			<div class="information">', $txt['ban_add_notes'], '</div>';
-		
+
 	echo '
 			<div class="content">
 				<dl class="settings">
@@ -184,7 +184,7 @@ function template_ban_edit()
 						</tr>
 					</thead>
 					<tbody>';
-		
+
 		if (empty($context['ban_items']))
 			echo '
 						<tr class="windowbg2">
@@ -219,7 +219,6 @@ function template_ban_edit()
 		echo '
 					</tbody>
 				</table>
-				
 				<div class="flow_auto">
 					<br />
 					<input type="submit" name="remove_selection" value="', $txt['ban_remove_selected_triggers'], '" class="button_submit" />

+ 4 - 4
Themes/default/ManageBoards.template.php

@@ -99,7 +99,7 @@ function template_main()
 			</div>
 		</form>';
 	}
-	
+
 	echo '
 	</div>';
 }
@@ -122,7 +122,7 @@ function template_modify_category()
 				<div class="windowbg">
 					<div class="content">
 						<dl class="settings">';
-	
+
 	// If this isn't the only category, let the user choose where this category should be positioned down the board index.
 	if (count($context['category_order']) > 1)
 	{
@@ -130,7 +130,7 @@ function template_modify_category()
 						<dt><strong>', $txt['order'], ':</strong></dt>
 						<dd>
 							<select name="cat_order">';
-	
+
 		// Print every existing category into a select box.
 		foreach ($context['category_order'] as $order)
 			echo '
@@ -139,7 +139,7 @@ function template_modify_category()
 							</select>
 						</dd>';
 	}
-	
+
 	// Allow the user to edit the category name and/or choose whether you can collapse the category.
 	echo '
 						<dt>

+ 3 - 3
Themes/default/ManagePermissions.template.php

@@ -278,7 +278,7 @@ function template_by_board()
 			<div class="information">
 				', $txt['permissions_boards_desc'], '
 			</div>
-			
+
 			<div class="title_bar">
 				<h3 id="board_permissions" class="titlebg flow_hidden">
 					<span class="perm_name floatleft">', $txt['board_name'], '</span>
@@ -318,7 +318,7 @@ function template_by_board()
 								<a href="', $scripturl, '?action=admin;area=manageboards;sa=board;boardid=', $board['id'], ';rid=permissions;', $context['session_var'], '=', $context['session_id'], '">', str_repeat('-', $board['child_level']), ' ', $board['name'], '</a>
 							</span>
 							<span class="perm_boardprofile floatleft">';
-			
+
 			if ($context['edit_all'])
 			{
 				echo '
@@ -356,7 +356,7 @@ function template_by_board()
 	else
 		echo '
 				<a class="button_link" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>';
-	
+
 	echo '
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 				<input type="hidden" name="', $context['admin-mpb_token_var'], '" value="', $context['admin-mpb_token'], '" />

+ 0 - 1
Themes/default/ManageSearch.template.php

@@ -100,7 +100,6 @@ function template_select_search_method()
 		<div class="information">
 			<div class="smalltext" style="font-weight: normal;"><a href="', $scripturl, '?action=helpadmin;help=search_why_use_index" onclick="return reqOverlayDiv(this.href);">', $txt['search_create_index_why'], '</a></div>
 		</div>
-			
 		<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=managesearch;sa=method" method="post" accept-charset="', $context['character_set'], '">
 			<div class="cat_bar">
 				<h3 class="catbg">', $txt['search_method'], '</h3>

+ 1 - 4
Themes/default/ManageSmileys.template.php

@@ -31,7 +31,6 @@ function template_editsets()
 			</div>
 		</div>
 	</div>
-	
 	<script type="text/javascript"><!-- // --><![CDATA[
 		window.smfForum_scripturl = smf_scripturl;
 		window.smfForum_sessionid = smf_session_id;
@@ -237,7 +236,6 @@ function template_modifysmiley()
 			<input type="hidden" name="smiley" value="', $context['current_smiley']['id'], '" />
 		</form>
 	</div>
-	
 	<script type="text/javascript"><!-- // --><![CDATA[
 		function updatePreview()
 		{
@@ -339,7 +337,6 @@ function template_addsmiley()
 					</dl>
 				</div>
 			</div>
-			
 			<div class="cat_bar">
 				<h3 class="catbg">', $txt['smiley_new'], '</h3>
 			</div>
@@ -431,7 +428,7 @@ function template_setorder()
 		<input type="hidden" name="reorder" value="1" />
 	</form>';
 	}
-	
+
 	echo '
 	</div>';
 }

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

@@ -191,7 +191,7 @@ function template_search()
 							<label for="fields-', $id, '"><input type="checkbox" name="fields[]" id="fields-', $id, '" value="', $id, '" ', in_array($id, $context['search_defaults']) ? 'checked="checked"' : '', ' class="input_check floatright" />', $title, '</label>
 						</dd>';
 	}
-	
+
 	echo '
 					</dl>
 					<div class="flow_auto">

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

@@ -619,7 +619,6 @@ function template_browse()
 
 	echo '
 	</div>
-	
 	<script type="text/javascript"><!-- // --><![CDATA[
 		var oAdvancedPanelToggle = new smc_Toggle({
 			bToggleEnabled: true,
@@ -1528,7 +1527,6 @@ function template_file_permissions()
 	foreach ($context['file_tree'] as $name => $dir)
 	{
 		echo '
-			
 				<tr class="windowbg2">
 					<td width="30%"><strong>';
 
@@ -1616,7 +1614,7 @@ function template_permission_show_contents($ident, $contents, $level, $has_more
 {
 	global $settings, $txt, $scripturl, $context;
 	$js_ident = preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident);
-	
+
 	// Have we actually done something?
 	$drawn_div = false;
 

+ 2 - 3
Themes/default/PersonalMessage.template.php

@@ -426,7 +426,7 @@ function template_folder()
 				if (!$message['member']['is_guest'])
 				{
 					// Is there than more than one recipient you can reply to?
-					if ($message['number_recipients'] > 1 && $context['display_mode'] != 2)
+					if ($message['number_recipients'] > 1)
 						echo '
 					<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all" class="reply_all_button">', $txt['reply_to_all'], '</a></li>';
 
@@ -1876,7 +1876,6 @@ function template_add_rule()
 					<a href="#" onclick="addActionOption(); return false;" id="addonjs2" style="display: none;">(', $txt['pm_rule_add_action'], ')</a>
 				</fieldset>
 			</div>
-		
 			<div class="cat_bar">
 				<h3 class="catbg">', $txt['pm_rule_description'], '</h3>
 			</div>
@@ -1984,4 +1983,4 @@ function template_showPMDrafts()
 			<span>', $context['page_index'], '</span>
 		</div>';
 }
-?>
+?>

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

@@ -105,7 +105,7 @@ function template_summary()
 	if (!$context['user']['is_owner'] && $context['can_send_pm'])
 		echo '
 					<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '">', $txt['profile_sendpm_short'], '</a><br />';
-	
+
 	echo '
 					<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a><br />';
 
@@ -608,7 +608,6 @@ function template_editBuddies()
 
 	echo '
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
-				
 			</div>
 		</div>
 	</form>

+ 0 - 2
Themes/default/Register.template.php

@@ -345,7 +345,6 @@ function template_registration_form()
 			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '" />
 			<input type="hidden" name="step" value="2" />
 		</form>
-		
 		<script type="text/javascript"><!-- // --><![CDATA[
 			var regTextStrings = {
 				"username_valid": "', $txt['registration_username_available'], '",
@@ -585,7 +584,6 @@ function template_admin_register()
 						<input type="hidden" name="', $context['admin-regc_token_var'], '" value="', $context['admin-regc_token'], '" />
 					</div>
 				</div>
-				
 			</form>
 		</div>
 	</div>

+ 0 - 1
Themes/default/Search.template.php

@@ -122,7 +122,6 @@ function template_main()
 						$txt['search_between'], '</label><input type="text" name="minage" id="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;<label for="maxage">', $txt['search_and'], '&nbsp;</label><input type="text" name="maxage" id="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '
 					</dd>
 				</dl>
-				
 				<script type="text/javascript"><!-- // --><![CDATA[
 					createEventListener(window);
 					window.addEventListener("load", initSearch, false);

+ 0 - 1
Themes/default/SplitTopics.template.php

@@ -154,7 +154,6 @@ function template_select()
 			</div>
 		</form>
 	</div>
-	
 	<script type="text/javascript"><!-- // --><![CDATA[
 		var start = new Array();
 		start[0] = ', $context['not_selected']['start'], ';

+ 9 - 3
Themes/default/Themes.template.php

@@ -202,7 +202,6 @@ function template_list_themes()
 		<div class="information">
 			', $txt['themeadmin_list_tip'], '
 		</div>
-		
 		<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=theme;', $context['session_var'], '=', $context['session_id'], ';sa=list" method="post" accept-charset="', $context['character_set'], '">
 			<div class="cat_bar">
 				<h3 class="catbg">', $txt['theme_settings'], '</h3>
@@ -1082,7 +1081,14 @@ function template_edit_template()
 					<div class="padding righttext">
 						<input type="submit" name="save" value="', $txt['theme_edit_save'], '"', $context['allow_save'] ? '' : ' disabled="disabled"', ' class="button_submit" />
 						<input type="hidden" name="filename" value="', $context['edit_filename'], '" />
-						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
+						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />';
+
+	// Hopefully it exists.
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
+		echo '
+						<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '" />';
+
+	echo '
 					</div>
 				</div>
 			</div>
@@ -1124,7 +1130,7 @@ function template_edit_file()
 	// Hopefully it exists.
 	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
 		echo '
-					<input type="text" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '" />';
+					<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '" />';
 
 	echo '
 				</div>

+ 2 - 2
Themes/default/languages/ManagePaid.english.php

@@ -23,7 +23,7 @@ $txt['paid_subs_view_desc'] = 'From this section you can view all the subscripti
 
 // Setting type strings.
 $txt['paid_enabled'] = 'Enable Paid Subscriptions';
-$txt['paid_enabled_desc'] = 'This must be checked the paid subscriptions to be used on the forum.';
+$txt['paid_enabled_desc'] = 'This must be checked for the paid subscriptions to be used on the forum.';
 $txt['paid_email'] = 'Send Notification Emails';
 $txt['paid_email_desc'] = 'Inform the admin when a subscription automatically changes.';
 $txt['paid_email_to'] = 'Email for Correspondence';
@@ -205,4 +205,4 @@ $txt['pending_payments_value'] = 'Value';
 $txt['pending_payments_accept'] = 'Accept';
 $txt['pending_payments_remove'] = 'Remove';
 
-?>
+?>

+ 6 - 6
other/Settings.php

@@ -2,7 +2,7 @@
 
 /**
  * The settings file contains all of the basic settings that need to be present when a database/cache is not available.
- * 
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -111,15 +111,15 @@ $db_prefix = 'smf_';
  */
 $db_persist = 0;
 /**
- * 
+ *
  * @var int|bool
  */
 $db_error_send = 0;
 
 ########## Cache Info ##########
 /**
- * Select a cache system. You want to leave this up to the cache area of the admin panel for 
- * proper detection of apc, eaccelerator, memcache, mmcache, output_cache, smf, or xcache 
+ * Select a cache system. You want to leave this up to the cache area of the admin panel for
+ * proper detection of apc, eaccelerator, memcache, mmcache, output_cache, smf, or xcache
  * (you can add more with a mod).
  * @var string
  */
@@ -157,13 +157,13 @@ $sourcedir = dirname(__FILE__) . '/Sources';
 ########## Error-Catching ##########
 # Note: You shouldn't touch these settings.
 if (file_exists(dirname(__FILE__) . '/db_last_error.php'))
-	include(dirname(__FILE__) . '/db_last_error.php'); 
+	include(dirname(__FILE__) . '/db_last_error.php');
 
 if (!isset($db_last_error))
 {
 	// File does not exist so lets try to create it
 	file_put_contents(dirname(__FILE__) . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>');
-	$db_last_error = 0; 
+	$db_last_error = 0;
 }
 
 if (file_exists(dirname(__FILE__) . '/install.php'))

+ 3 - 3
other/install.php

@@ -1962,11 +1962,11 @@ function updateSettingsFile($vars)
 	return true;
 }
 
-function updateDbLastError() 
+function updateDbLastError()
 {
-	// Write out the db_last_error file with the error timestamp 
+	// Write out the db_last_error file with the error timestamp
 	file_put_contents(dirname(__FILE__) . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>');
-	
+
 	return true;
 }
 

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

@@ -1643,7 +1643,7 @@ VALUES
 	(11, 0, 120, 1, 'd', 1, 'remove_temp_attachments'),
 	(12, 0, 180, 1, 'd', 1, 'remove_topic_redirect'),
 	(13, 0, 240, 1, 'd', 1, 'remove_old_drafts');
-	
+
 # --------------------------------------------------------
 
 #

+ 2 - 2
other/upgrade.php

@@ -69,7 +69,7 @@ $upcontext['database_step'] = 3;
 @set_time_limit(600);
 if (!ini_get('safe_mode'))
 {
-	ini_set('mysql.connect_timeout', -1); 
+	ini_set('mysql.connect_timeout', -1);
 	ini_set('default_socket_timeout', 900);
 }
 // Clean the upgrade path if this is from the client.
@@ -2171,7 +2171,7 @@ function changeSettings($config_vars)
 	fwrite($fp, rtrim($settingsArray[$i]));
 	fclose($fp);
 }
-function updateLastError() 
+function updateLastError()
 {
 	// clear out the db_last_error file
 	file_put_contents(dirname(__FILE__) . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>');

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

@@ -257,7 +257,7 @@ if (@$modSettings['smfVersion'] < '2.1')
 				(id_group, id_board, permission, add_deny)
 			VALUES
 				" . implode(',', $inserts));
-				
+
 	// Next we find people who can send PM's, and assume they can save pm_drafts as well
 	$request = upgrade_query("
 		SELECT id_group, add_deny, permission

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

@@ -174,7 +174,7 @@ upgrade_query("
 
 	ALTER TABLE {$db_prefix}sessions
 	ALTER COLUMN session_id type char(64);");
-	
+
 upgrade_query("
 	ALTER TABLE {$db_prefix}log_online
 	ALTER COLUMN session SET DEFAULT '';
@@ -311,7 +311,7 @@ if (@$modSettings['smfVersion'] < '2.1')
 				(id_group, id_board, permission, add_deny)
 			VALUES
 				" . implode(',', $inserts));
-				
+
 	// Next we find people who can send PM's, and assume they can save pm_drafts as well
 	$request = upgrade_query("
 		SELECT id_group, add_deny, permission

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

@@ -294,7 +294,7 @@ if (@$modSettings['smfVersion'] < '2.1')
 				(id_group, id_board, permission, add_deny)
 			VALUES
 				" . implode(',', $inserts));
-				
+
 	// Next we find people who can send PM's, and assume they can save pm_drafts as well
 	$request = upgrade_query("
 		SELECT id_group, add_deny, permission

+ 4 - 4
subscriptions.php

@@ -190,7 +190,7 @@ elseif ($gatewayClass->isPayment() || $gatewayClass->isSubscription())
 		$real_details = @unserialize($subscription_info['pending_details']);
 		if (empty($real_details))
 			generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
-		
+
 		// Now we just try to find anything pending.
 		// We don't really care which it is as security happens later.
 		foreach ($real_details as $id => $detail)
@@ -200,7 +200,7 @@ elseif ($gatewayClass->isPayment() || $gatewayClass->isSubscription())
 				$subscription_info['payments_pending']--;
 			break;
 		}
-		
+
 		$subscription_info['pending_details'] = empty($real_details) ? '' : serialize($real_details);
 
 		$smcFunc['db_query']('', '
@@ -219,7 +219,7 @@ elseif ($gatewayClass->isPayment() || $gatewayClass->isSubscription())
 	if ($subscription_info['length'] == 'F')
 	{
 		$found_duration = 0;
-		
+
 		// This is a little harder, can we find the right duration?
 		foreach ($cost as $duration => $value)
 		{
@@ -239,7 +239,7 @@ elseif ($gatewayClass->isPayment() || $gatewayClass->isSubscription())
 	else
 	{
 		$actual_cost = $cost['fixed'];
-		
+
 		// It must be at least the right amount.
 		if ($total_cost != 0 && $total_cost >= $actual_cost)
 		{