Browse Source

! Send the old_body to the search API
! Old typo (empty($salveageCatID)) should have been (empty($salvageCatID))
! Another one $locked == 1 should have been $row['locked'] == 1
! css to Lighten up "last edit"
! Missing global in list_getGroups
! empty($sticky) should have been empty($topicinfo['is_sticky'])
! Added a hook for $user_info
! Fatal error in paid subscriptions if a backup file is present (http://dev.simplemachines.org/mantis/view.php?id=4896)

Spuds 13 years ago
parent
commit
943ee77ad2

+ 2 - 0
Sources/Display.php

@@ -143,6 +143,8 @@ function Display()
 		$_SESSION['last_read_topic'] = $topic;
 	}
 
+	// @todo Why isn't this cached?
+	// @todo if we get id_board in this query, we can save a query on posting
 	// Get all the important topic info.
 	$request = $smcFunc['db_query']('', '
 		SELECT

+ 2 - 0
Sources/Load.php

@@ -462,6 +462,8 @@ function loadUserSettings()
 	// Ok I guess they don't want to see all the boards
 	else
 		$user_info['query_wanna_see_board'] = '(' . $user_info['query_see_board'] . ' AND b.id_board NOT IN (' . implode(',', $user_info['ignoreboards']) . '))';
+
+	call_integration_hook('integrate_user_info');
 }
 
 /**

+ 8 - 13
Sources/ManagePaid.php

@@ -26,7 +26,7 @@ if (!defined('SMF'))
  */
 function ManagePaidSubscriptions()
 {
-	global $context, $txt, $scripturl, $sourcedir, $smcFunc, $modSettings;
+	global $context, $txt, $scripturl, $smcFunc, $modSettings;
 
 	// Load the required language and template.
 	loadLanguage('ManagePaid');
@@ -79,7 +79,7 @@ function ManagePaidSubscriptions()
  */
 function ModifySubscriptionSettings($return_config = false)
 {
-	global $context, $txt, $modSettings, $sourcedir, $smcFunc, $scripturl;
+	global $context, $txt, $modSettings, $smcFunc, $scripturl;
 
 	// If the currency is set to something different then we need to set it to other for this to work and set it back shortly.
 	$modSettings['paid_currency'] = !empty($modSettings['paid_currency_code']) ? $modSettings['paid_currency_code'] : '';
@@ -114,9 +114,6 @@ function ModifySubscriptionSettings($return_config = false)
 	if ($return_config)
 		return $config_vars;
 
-	// Get the settings template fired up.
-	require_once($sourcedir . '/ManageServer.php');
-
 	// Some important context stuff
 	$context['page_title'] = $txt['settings'];
 	$context['sub_template'] = 'show_settings';
@@ -190,7 +187,7 @@ function ModifySubscriptionSettings($return_config = false)
  */
 function ViewSubscriptions()
 {
-	global $context, $txt, $modSettings, $smcFunc, $sourcedir, $scripturl;
+	global $context, $txt, $modSettings, $smcFunc, $scripturl;
 
 	// Not made the settings yet?
 	if (empty($modSettings['paid_currency_symbol']))
@@ -320,7 +317,7 @@ function ViewSubscriptions()
 		),
 	);
 
-	require_once($sourcedir . '/Subs-List.php');
+	loadFile('Subs-List.php');
 	createList($listOptions);
 
 	$context['sub_template'] = 'show_list';
@@ -594,7 +591,7 @@ function ModifySubscription()
  */
 function ViewSubscribedUsers()
 {
-	global $context, $txt, $modSettings, $scripturl, $options, $smcFunc, $sourcedir;
+	global $context, $txt, $modSettings, $scripturl, $options, $smcFunc;
 
 	// Setup the template.
 	$context['page_title'] = $txt['viewing_users_subscribed'];
@@ -780,7 +777,7 @@ function ViewSubscribedUsers()
 		),
 	);
 
-	require_once($sourcedir . '/Subs-List.php');
+	loadFile('Subs-List.php');
 	createList($listOptions);
 
 	$context['sub_template'] = 'show_list';
@@ -1782,7 +1779,7 @@ function loadPaymentGateways()
 	{
 		while (($file = readdir($dh)) !== false)
 		{
-			if (is_file($sourcedir .'/'. $file) && preg_match('~Subscriptions-([A-Za-z\d]+)\.php~', $file, $matches))
+			if (is_file($sourcedir .'/'. $file) && preg_match('~^Subscriptions-([A-Za-z\d]+)\.php$~', $file, $matches))
 			{
 				// Check this is definitely a valid gateway!
 				$fp = fopen($sourcedir . '/' . $file, 'rb');
@@ -1808,6 +1805,4 @@ function loadPaymentGateways()
 	closedir($dh);
 
 	return $gateways;
-}
-
-?>
+}

+ 1 - 1
Sources/ManageSearch.php

@@ -760,7 +760,7 @@ function loadSearchAPIs()
 	{
 		while (($file = readdir($dh)) !== false)
 		{
-			if (is_file($sourcedir . '/' . $file) && preg_match('~SearchAPI-([A-Za-z\d_]+)\.php~', $file, $matches))
+			if (is_file($sourcedir . '/' . $file) && preg_match('~^SearchAPI-([A-Za-z\d_]+)\.php$~', $file, $matches))
 			{
 				// Check this is definitely a valid API!
 				$fp = fopen($sourcedir . '/' . $file, 'rb');

+ 3 - 2
Sources/MessageIndex.php

@@ -637,7 +637,7 @@ function MessageIndex()
  */
 function QuickModeration()
 {
-	global $sourcedir, $board, $user_info, $modSettings, $sourcedir, $smcFunc, $context;
+	global $sourcedir, $board, $user_info, $modSettings, $smcFunc, $context;
 
 	// Check the session = get or post.
 	checkSession('request');
@@ -779,7 +779,8 @@ function QuickModeration()
 					unset($_REQUEST['actions'][$row['id_topic']]);
 				elseif ($_REQUEST['actions'][$row['id_topic']] == 'remove' && !in_array(0, $boards_can['remove_any']) && !in_array($row['id_board'], $boards_can['remove_any']) && ($row['id_member_started'] != $user_info['id'] || (!in_array(0, $boards_can['remove_own']) && !in_array($row['id_board'], $boards_can['remove_own']))))
 					unset($_REQUEST['actions'][$row['id_topic']]);
-				elseif ($_REQUEST['actions'][$row['id_topic']] == 'lock' && !in_array(0, $boards_can['lock_any']) && !in_array($row['id_board'], $boards_can['lock_any']) && ($row['id_member_started'] != $user_info['id'] || $locked == 1 || (!in_array(0, $boards_can['lock_own']) && !in_array($row['id_board'], $boards_can['lock_own']))))
+				// @todo $locked is not set, what are you trying to do? (taking the change it is supposed to be $row['locked'])
+				elseif ($_REQUEST['actions'][$row['id_topic']] == 'lock' && !in_array(0, $boards_can['lock_any']) && !in_array($row['id_board'], $boards_can['lock_any']) && ($row['id_member_started'] != $user_info['id'] || $row['locked'] == 1 || (!in_array(0, $boards_can['lock_own']) && !in_array($row['id_board'], $boards_can['lock_own']))))
 					unset($_REQUEST['actions'][$row['id_topic']]);
 				// If the topic is approved then you need permission to approve the posts within.
 				elseif ($_REQUEST['actions'][$row['id_topic']] == 'approve' && (!$row['unapproved_posts'] || (!in_array(0, $boards_can['approve_posts']) && !in_array($row['id_board'], $boards_can['approve_posts']))))

+ 1 - 1
Sources/RepairBoards.php

@@ -1583,7 +1583,7 @@ function createSalvageArea()
 		list ($salvageCatID) = $smcFunc['db_fetch_row']($result);
 	$smcFunc['db_free_result']($result);
 
-	if (empty($salveageCatID))
+	if (empty($salvageCatID))
 	{
 		$smcFunc['db_insert']('',
 			'{db_prefix}categories',

+ 1 - 0
Sources/Reports.php

@@ -596,6 +596,7 @@ function GroupPermissionsReport()
 		)
 	);
 	$lastPermission = null;
+	$curData = array();
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		// If this is a new permission flush the last row.

+ 5 - 5
Sources/SearchAPI-Custom.php

@@ -211,9 +211,9 @@ class custom_search
 		return $ignoreRequest;
 	}
 
-	/*
+	/**
 	 * After a post is made, we update the database.
-	*/
+	 */
 	public function postCreated($msgOptions, $topicOptions, $posterOptions)
 	{
 		global $modSettings, $smcFunc;
@@ -233,9 +233,9 @@ class custom_search
 			);
 	}
 
-	/*
+	/**
 	 * After a post is modified, we update the database.
-	*/
+	 */
 	public function postModified($msgOptions, $topicOptions, $posterOptions)
 	{
 		global $modSettings, $smcFunc;
@@ -243,7 +243,7 @@ class custom_search
 		$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
 
 		$stopwords = empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']);
-		$old_index = text2words($old_body, $customIndexSettings['bytes_per_word'], true);
+		$old_index = text2words($msgOptions['old_body'], $customIndexSettings['bytes_per_word'], true);
 		$new_index = text2words($msgOptions['body'], $customIndexSettings['bytes_per_word'], true);
 
 		// Calculate the words to be added and removed from the index.

+ 5 - 1
Sources/Subs-Post.php

@@ -2422,7 +2422,7 @@ function modifyPost(&$msgOptions, &$topicOptions, &$posterOptions)
 					'id_msg' => $msgOptions['id'],
 				)
 			);
-			list ($old_body) = $smcFunc['db_fetch_row']($request);
+			list ($msgOptions['old_body']) = $smcFunc['db_fetch_row']($request);
 			$smcFunc['db_free_result']($request);
 		}
 	}
@@ -2898,6 +2898,8 @@ function sendApprovalNotifications(&$topicData)
 		)
 	);
 	$sent = 0;
+
+	$current_language = $user_info['language'];
 	while ($row = $smcFunc['db_fetch_assoc']($members))
 	{
 		if ($row['id_group'] != 1)
@@ -3177,6 +3179,8 @@ function adminNotify($type, $memberID, $member_name = null)
 			'group_array_implode' => implode(', additional_groups) != 0 OR FIND_IN_SET(', $groups),
 		)
 	);
+
+	$current_language = $user_info['language'];
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		$replacements = array(

+ 3 - 3
Sources/Subs.php

@@ -633,7 +633,7 @@ function comma_format($number, $override_decimal_count = false)
 function timeformat($log_time, $show_today = true, $offset_type = false)
 {
 	global $context, $user_info, $txt, $modSettings, $smcFunc;
-	static $non_twelve_hour;
+	static $non_twelve_hour = null;
 
 	// Offset the time.
 	if (!$offset_type)
@@ -720,7 +720,7 @@ function timeformat($log_time, $show_today = true, $offset_type = false)
  */
 function un_htmlspecialchars($string)
 {
-	static $translation;
+	static $translation = '';
 
 	if (!isset($translation))
 		$translation = array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)) + array(''' => '\'', ' ' => ' ');
@@ -826,7 +826,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
 {
 	global $txt, $scripturl, $context, $modSettings, $user_info, $smcFunc;
 	static $bbc_codes = array(), $itemcodes = array(), $no_autolink_tags = array();
-	static $disabled;
+	static $disabled = array();
 
 	// Don't waste cycles
 	if ($message === '')

+ 1 - 1
Themes/default/css/index.css

@@ -2094,7 +2094,7 @@ img.smiley
 #forumposts .modified
 {
 	float: left;
-	color: #999;
+	color: #333;
 }
 #forumposts .reportlinks
 {