Przeglądaj źródła

! A bunch more documentation changes
! fixed a couple of places that have been missing some globalizations for a long time
! Credits for next version. (WIP)
! Porting fix from 2.0 for online list filter.
! Thanks to Zend Studio, I found a bunch of bugs/notices/issues and @todo commented them
! Small change to ManageSearchEngines to fix a bug
! Remove legacy gif support.
! Document on the fly the wiki task before I forget... (yes, I forget things.)
! Remove some unused query. We'll know if we miss it. :P
! Cleaning: removing several PHP4 pre 4.3 compatibility if_exists(). debug_print_backtrace() and debug_backtrace() can be defined in Subs-Compat

Spuds 12 lat temu
rodzic
commit
663e6db2b4

+ 2 - 1
Sources/Admin.php

@@ -831,7 +831,7 @@ function AdminSearchInternal()
 					'url' => (strpos($item[1], 'area') === 0 ? $scripturl . '?action=admin;' . $item[1] : $item[1]) . ';' . $context['session_var'] . '=' . $context['session_id'] . ((strpos($item[1], 'area') === 0 && $section == 'settings' ? '#' . $item[0][0] : '')),
 					'name' => $name,
 					'type' => $section,
-					'help' => shorten_subject(isset($item[2]) ? strip_tags($helptxt[$item2]) : (isset($helptxt[$found]) ? strip_tags($helptxt[$found]) : ''), 255),
+					'help' => shorten_subject(isset($item[2]) ? strip_tags($helptxt[$item[2]]) : (isset($helptxt[$found]) ? strip_tags($helptxt[$found]) : ''), 255),
 				);
 			}
 		}
@@ -855,6 +855,7 @@ function AdminSearchMember()
 
 /**
  * This file allows the user to search the SM online manual for a little of help.
+ * @todo wiki search
  */
 function AdminSearchOM()
 {

+ 10 - 20
Sources/Class-Package.php

@@ -145,16 +145,11 @@ class xmlArray
 					return $array[$el];
 				else
 				{
-					if (function_exists('debug_backtrace'))
-					{
-						$trace = debug_backtrace();
-						$i = 0;
-						while ($i < count($trace) && isset($trace[$i]['class']) && $trace[$i]['class'] == get_class($this))
-							$i++;
-						$debug = ' from ' . $trace[$i - 1]['file'] . ' on line ' . $trace[$i - 1]['line'];
-					}
-					else
-						$debug = '';
+					$trace = debug_backtrace();
+					$i = 0;
+					while ($i < count($trace) && isset($trace[$i]['class']) && $trace[$i]['class'] == get_class($this))
+						$i++;
+					$debug = ' from ' . $trace[$i - 1]['file'] . ' on line ' . $trace[$i - 1]['line'];
 
 					// Cause an error.
 					if ($this->debug_level & E_NOTICE)
@@ -669,16 +664,11 @@ class xmlArray
 		// No results found...
 		if (empty($results))
 		{
-			if (function_exists('debug_backtrace'))
-			{
-				$trace = debug_backtrace();
-				$i = 0;
-				while ($i < count($trace) && isset($trace[$i]['class']) && $trace[$i]['class'] == get_class($this))
-					$i++;
-				$debug = ' from ' . $trace[$i - 1]['file'] . ' on line ' . $trace[$i - 1]['line'];
-			}
-			else
-				$debug = '';
+			$trace = debug_backtrace();
+			$i = 0;
+			while ($i < count($trace) && isset($trace[$i]['class']) && $trace[$i]['class'] == get_class($this))
+				$i++;
+			$debug = ' from ' . $trace[$i - 1]['file'] . ' on line ' . $trace[$i - 1]['line'];
 
 			// Cause an error.
 			if ($this->debug_level & E_NOTICE && !$no_error)

+ 12 - 17
Sources/Errors.php

@@ -194,25 +194,20 @@ function error_handler($error_level, $error_string, $file, $line)
 
 	if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename']))
 	{
-		if (function_exists('debug_backtrace'))
+		$array = debug_backtrace();
+		for ($i = 0; $i < count($array); $i++)
 		{
-			$array = debug_backtrace();
-			for ($i = 0; $i < count($array); $i++)
-			{
-				if ($array[$i]['function'] != 'loadSubTemplate')
-					continue;
-
-				// This is a bug in PHP, with eval, it seems!
-				if (empty($array[$i]['args']))
-					$i++;
-				break;
-			}
-
-			if (isset($array[$i]) && !empty($array[$i]['args']))
-				$file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)';
-			else
-				$file = realpath($settings['current_include_filename']) . ' (eval?)';
+			if ($array[$i]['function'] != 'loadSubTemplate')
+				continue;
+
+			// This is a bug in PHP, with eval, it seems!
+			if (empty($array[$i]['args']))
+				$i++;
+			break;
 		}
+
+		if (isset($array[$i]) && !empty($array[$i]['args']))
+			$file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)';
 		else
 			$file = realpath($settings['current_include_filename']) . ' (eval?)';
 	}

+ 1 - 1
Sources/Groups.php

@@ -18,7 +18,7 @@ if (!defined('SMF'))
 
 /**
  * Entry point function, permission checks, admin bars, etc.
- *  It allows moderators and users to access the group showing functions.
+ * It allows moderators and users to access the group showing functions.
  * It handles permission checks, and puts the moderation bar on as required.
  */
 function Groups()

+ 4 - 4
Sources/Load.php

@@ -1018,6 +1018,7 @@ function loadMemberData($users, $is_name = false, $set = 'normal')
  *
  * @param int $user
  * @param bool $display_custom_fields = false
+ * @return bool
  */
 function loadMemberContext($user, $display_custom_fields = false)
 {
@@ -1516,6 +1517,7 @@ function loadTheme($id_theme = 0, $initialize = true)
 	$context['header_logo_url_html_safe'] = empty($settings['header_logo_url']) ? '' : $smcFunc['htmlspecialchars']($settings['header_logo_url']);
 	$context['current_action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
 	$context['current_subaction'] = isset($_REQUEST['sa']) ? $_REQUEST['sa'] : null;
+	$context['can_register'] = empty($modSettings['registration_method']) || $modSettings['registration_method'] != 3;
 	if (isset($modSettings['load_average']))
 		$context['load_average'] = $modSettings['load_average'];
 
@@ -1677,9 +1679,7 @@ function loadTheme($id_theme = 0, $initialize = true)
 	{
 		if (isBrowser('possibly_robot'))
 		{
-			/**
-			 * @todo Maybe move this somewhere better?!
-			 */
+			// @todo Maybe move this somewhere better?!
 			require_once($sourcedir . '/ScheduledTasks.php');
 
 			// What to do, what to do?!
@@ -2273,7 +2273,7 @@ function template_include($filename, $once = false)
 			require_once($sourcedir . '/Subs-Package.php');
 
 			$error = fetch_web_data($boardurl . strtr($filename, array($boarddir => '', strtr($boarddir, '\\', '/') => '')));
-			if (empty($error))
+			if (empty($error) && ini_get('track_errors'))
 				$error = $php_errormsg;
 
 			$error = strtr($error, array('<b>' => '<strong>', '</b>' => '</strong>'));

+ 1 - 0
Sources/ManageLanguages.php

@@ -43,6 +43,7 @@ function ManageLanguages()
 		'editlang' => 'ModifyLanguage',
 	);
 
+	$config_vars = array();
 	call_integration_hook('integrate_manage_languages', array(&$config_vars));
 
 	// By default we're managing languages.

+ 1 - 0
Sources/ManageMembers.php

@@ -1237,6 +1237,7 @@ function AdminApprove()
 		}
 	}
 
+	// @todo current_language is never set, no idea what this is for. Remove?
 	// Back to the user's language!
 	if (isset($current_language) && $current_language != $user_info['language'])
 	{

+ 3 - 4
Sources/ManageSearchEngines.php

@@ -484,8 +484,7 @@ function SpiderCheck()
 			$spider_data[] = $row;
 		$smcFunc['db_free_result']($request);
 
-		if (!empty($modSettings['cache_enable']))
-			cache_put_data('spider_search', $spider_data, 300);
+		cache_put_data('spider_search', $spider_data, 300);
 	}
 
 	if (empty($spider_data))
@@ -495,7 +494,7 @@ function SpiderCheck()
 	$ci_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
 
 	// Always attempt IPv6 first.
-	if (empty($ip_parts) && strpos($_SERVER['REMOTE_ADDR'], ':') !== false)
+	if (strpos($_SERVER['REMOTE_ADDR'], ':') !== false)
 		$ip_parts = convertIPv6toInts($_SERVER['REMOTE_ADDR']);
 	else
 		preg_match('/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $_SERVER['REMOTE_ADDR'], $ip_parts);
@@ -518,7 +517,7 @@ function SpiderCheck()
 					{
 						if ($value['low'] > $ip_parts[$key + 1] || $value['high'] < $ip_parts[$key + 1])
 							break;
-						elseif ($key == 3)
+						elseif (($key == 7 && strpos($_SERVER['REMOTE_ADDR'], ':') !== false) || ($key == 3 && strpos($_SERVER['REMOTE_ADDR'], ':') === false))
 							$_SESSION['id_robot'] = $spider['id_spider'];
 					}
 				}

+ 1 - 0
Sources/ManageSmileys.php

@@ -624,6 +624,7 @@ function AddSmiley()
 		// What about uploading several files?
 		elseif ($_POST['method'] != 'existing')
 		{
+			$newName = '';
 			foreach ($_FILES as $name => $data)
 			{
 				if ($_FILES[$name]['name'] == '')

+ 73 - 0
Sources/Memberlist.php

@@ -590,4 +590,77 @@ function printMemberListRows($request)
 	}
 }
 
+
+/**
+ * Used as a popup for searching members.
+ * Uses sub template find_members of the Help template.
+ * Also used to add members for PM's sent using wap2/imode protocol.
+ */
+function JSMembers()
+{
+	global $context, $scripturl, $user_info, $smcFunc;
+
+	checkSession('get');
+
+	if (WIRELESS)
+		$context['sub_template'] = WIRELESS_PROTOCOL . '_pm';
+	else
+	{
+		// Why is this in the Help template, you ask?  Well, erm... it helps you.  Does that work?
+		loadTemplate('Help');
+
+		$context['template_layers'] = array();
+		$context['sub_template'] = 'find_members';
+	}
+
+	if (isset($_REQUEST['search']))
+		$context['last_search'] = $smcFunc['htmlspecialchars']($_REQUEST['search'], ENT_QUOTES);
+	else
+		$_REQUEST['start'] = 0;
+
+	// Allow the user to pass the input to be added to to the box.
+	$context['input_box_name'] = isset($_REQUEST['input']) && preg_match('~^[\w-]+$~', $_REQUEST['input']) === 1 ? $_REQUEST['input'] : 'to';
+
+	// Take the delimiter over GET in case it's \n or something.
+	$context['delimiter'] = isset($_REQUEST['delim']) ? ($_REQUEST['delim'] == 'LB' ? "\n" : $_REQUEST['delim']) : ', ';
+	$context['quote_results'] = !empty($_REQUEST['quote']);
+
+	// List all the results.
+	$context['results'] = array();
+
+	// Some buddy related settings ;)
+	$context['show_buddies'] = !empty($user_info['buddies']);
+	$context['buddy_search'] = isset($_REQUEST['buddies']);
+
+	// If the user has done a search, well - search.
+	if (isset($_REQUEST['search']))
+	{
+		loadFile('Subs-Members.php');
+		$_REQUEST['search'] = $smcFunc['htmlspecialchars']($_REQUEST['search'], ENT_QUOTES);
+
+		$context['results'] = findMembers(array($_REQUEST['search']), true, $context['buddy_search']);
+		$total_results = count($context['results']);
+
+		$context['page_index'] = constructPageIndex($scripturl . '?action=findmember;search=' . $context['last_search'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';input=' . $context['input_box_name'] . ($context['quote_results'] ? ';quote=1' : '') . ($context['buddy_search'] ? ';buddies' : ''), $_REQUEST['start'], $total_results, 7);
+
+		// Determine the navigation context (especially useful for the wireless template).
+		$base_url = $scripturl . '?action=findmember;search=' . urlencode($context['last_search']) . (empty($_REQUEST['u']) ? '' : ';u=' . $_REQUEST['u']) . ';' . $context['session_var'] . '=' . $context['session_id'];
+		$context['links'] = array(
+			'first' => $_REQUEST['start'] >= 7 ? $base_url . ';start=0' : '',
+			'prev' => $_REQUEST['start'] >= 7 ? $base_url . ';start=' . ($_REQUEST['start'] - 7) : '',
+			'next' => $_REQUEST['start'] + 7 < $total_results ? $base_url . ';start=' . ($_REQUEST['start'] + 7) : '',
+			'last' => $_REQUEST['start'] + 7 < $total_results ? $base_url . ';start=' . (floor(($total_results - 1) / 7) * 7) : '',
+			'up' => $scripturl . '?action=pm;sa=send' . (empty($_REQUEST['u']) ? '' : ';u=' . $_REQUEST['u']),
+		);
+		$context['page_info'] = array(
+			'current_page' => $_REQUEST['start'] / 7 + 1,
+			'num_pages' => floor(($total_results - 1) / 7) + 1
+		);
+
+		$context['results'] = array_slice($context['results'], $_REQUEST['start'], 7);
+	}
+	else
+		$context['links']['up'] = $scripturl . '?action=pm;sa=send' . (empty($_REQUEST['u']) ? '' : ';u=' . $_REQUEST['u']);
+}
+
 ?>

+ 4 - 7
Sources/Post.php

@@ -2179,8 +2179,8 @@ function AnnouncementSelectMembergroup()
 	$context['sub_template'] = 'announce';
 }
 
-// Send the announcement in chunks.
 /**
+ * Send the announcement in chunks.
  * splits the members to be sent a topic announcement into chunks.
  * composes notification messages in all languages needed.
  * does the actual sending of the topic announcements in chunks.
@@ -2193,9 +2193,7 @@ function AnnouncementSend()
 
 	checkSession();
 
-	/**
-	 * @todo Might need an interface?
-	 */
+	// @todo Might need an interface?
 	$chunkSize = empty($modSettings['mail_queue']) ? 50 : 500;
 
 	$context['start'] = empty($_REQUEST['start']) ? 0 : (int) $_REQUEST['start'];
@@ -2265,6 +2263,7 @@ function AnnouncementSend()
 			redirectexit('board=' . $board . '.0');
 	}
 
+	$announcements = array();
 	// Loop through all members that'll receive an announcement in this batch.
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
@@ -2309,14 +2308,12 @@ function AnnouncementSend()
 		loadLanguage('Post');
 }
 
-// Notify members of a new post.
 /**
  * notifies members who have requested notification for new topics
  * * posted on a board of said posts.
  * receives data on the topics to send out notifications to by the passed in array.
  * only sends notifications to those who can *currently* see the topic (it doesn't matter if they could when they requested notification.)
- * loads the Post language file multiple times for each language if the
- * * userLanguage setting is set.
+ * loads the Post language file multiple times for each language if the userLanguage setting is set.
  * @param array &$topicData
  */
 function notifyMembersBoard(&$topicData)

+ 1 - 0
Sources/Profile-View.php

@@ -831,6 +831,7 @@ function tracking($memID)
 
 	$context['tracking_area'] = isset($_GET['sa']) && isset($subActions[$_GET['sa']]) ? $_GET['sa'] : 'activity';
 
+	// @todo what is $types? it is never set so this will never be true
 	if (isset($types[$context['tracking_area']][1]))
 		require_once($sourcedir . '/' . $types[$context['tracking_area']][1]);
 

+ 1 - 0
Sources/Reports.php

@@ -66,6 +66,7 @@ function ReportsMain()
 	foreach ($context['report_types'] as $k => $temp)
 		$context['report_types'][$k] = array(
 			'id' => $k,
+			// @todo what is $type? It is never set!
 			'title' => isset($txt['gr_type_' . $k]) ? $txt['gr_type_' . $k] : $type['id'],
 			'description' => isset($txt['gr_type_desc_' . $k]) ? $txt['gr_type_desc_' . $k] : null,
 			'function' => $temp,

+ 3 - 1
Sources/ScheduledTasks.php

@@ -511,7 +511,9 @@ function scheduled_auto_optimize()
 	return true;
 }
 
-// Send out a daily email of all subscribed topics.
+/**
+ * Send out a daily email of all subscribed topics.
+ */
 function scheduled_daily_digest()
 {
 	global $is_weekly, $txt, $mbname, $scripturl, $sourcedir, $smcFunc, $context, $modSettings;

+ 6 - 0
Sources/SplitTopics.php

@@ -533,6 +533,10 @@ function splitTopic($split1_ID_TOPIC, $splitMessages, $new_subject)
 	// You can't select ALL the messages!
 	if ($smcFunc['db_num_rows']($request) == 0)
 		fatal_lang_error('selected_all_posts', false);
+
+	$split1_first_msg = null;
+	$split1_last_msg = null;
+
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		// Get the right first and last message dependant on approved state...
@@ -1024,6 +1028,7 @@ function MergeExecute($topics = array())
 	$boardTotals = array();
 	$boards = array();
 	$polls = array();
+	$firstTopic = 0;
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		// Make a note for the board counts...
@@ -1214,6 +1219,7 @@ function MergeExecute($topics = array())
 		)
 	);
 	$topic_approved = 1;
+	$first_msg = 0;
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		// If this is approved, or is fully unapproved.

+ 4 - 4
Sources/Subs-Auth.php

@@ -2,7 +2,7 @@
 
 /**
  * This file has functions in it to do with authentication, user handling, and the like.
- * 
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -22,8 +22,8 @@ if (!defined('SMF'))
  * logs the user out if id_member is zero.
  * sets the cookie and session to last the number of seconds specified by cookie_length.
  * when logging out, if the globalCookies setting is enabled, attempts to clear the subdomain's cookie too.
- * @param int $cookie_length, 
- * @param int $id The id of the member 
+ * @param int $cookie_length,
+ * @param int $id The id of the member
  * @param string $password = ''
  */
 function setLoginCookie($cookie_length, $id, $password = '')
@@ -121,7 +121,7 @@ if (!function_exists('session_regenerate_id'))
  * Get the domain and path for the cookie
  * normally, local and global should be the localCookies and globalCookies settings, respectively.
  * uses boardurl to determine these two things.
- * @param bool $local, 
+ * @param bool $local,
  * @param bool $global
  * @return array an array to set the cookie on with domain and path in it, in that order
  */

+ 14 - 12
Sources/Subs-BoardIndex.php

@@ -1,6 +1,9 @@
 <?php
 
 /**
+ * This file currently only contains one function to collect the data needed to
+ * show a list of boards for the board index and the message index.
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -14,18 +17,17 @@
 if (!defined('SMF'))
 	die('Hacking attempt...');
 
-/*	This file currently only contains one function to collect the data needed to
-	show a list of boards for the board index and the message index.
-
-	array getBoardIndex(array boardIndexOptions)
-		- Fetches a list of boards and (optional) categories including
-		  statistical information, child boards and moderators.
-		- Used by both the board index (main data) and the message index (child
-		  boards).
-		- Depending on the include_categories setting returns an associative
-		  array with categories->boards->child_boards or an associative array
-		  with boards->child_boards.
-*/
+/**
+ * Fetches a list of boards and (optional) categories including
+ * statistical information, child boards and moderators.
+ * 	- Used by both the board index (main data) and the message index (child
+ * boards).
+ * 	- Depending on the include_categories setting returns an associative
+ * array with categories->boards->child_boards or an associative array
+ * with boards->child_boards.
+ * @param array $boardIndexOptions
+ * @return array
+ */
 
 function getBoardIndex($boardIndexOptions)
 {

+ 10 - 6
Sources/Subs-Calendar.php

@@ -2,7 +2,7 @@
 
 /**
  * This file contains several functions for retrieving and manipulating calendar events, birthdays and holidays.
- * 
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -36,7 +36,7 @@ if (!defined('SMF'))
  * @param int $event_id
 */
 
-/** 
+/**
  * Get all birthdays within the given time range.
  * finds all the birthdays in the specified range of days.
  * works with birthdays set for no year, or any other year, and respects month and year boundaries.
@@ -807,7 +807,7 @@ function validateEventPost()
 
 /**
  * Get the event's poster.
- * 
+ *
  * @param int $event_id
  * @return int|bool the id of the poster or false if the event was not found
  */
@@ -838,7 +838,7 @@ function getEventPoster($event_id)
 
 /**
  * Consolidating the various INSERT statements into this function.
- * 
+ *
  * @param array $eventOptions
  */
 function insertEvent(&$eventOptions)
@@ -852,10 +852,12 @@ function insertEvent(&$eventOptions)
 	$eventOptions['span'] = isset($eventOptions['span']) && $eventOptions['span'] > 0 ? (int) $eventOptions['span'] : 0;
 
 	// Make sure the start date is in ISO order.
+	// @todo $year, $month, and $day are not set
 	if (($num_results = sscanf($eventOptions['start_date'], '%d-%d-%d', $year, $month, $day)) !== 3)
 		trigger_error('modifyEvent(): invalid start date format given', E_USER_ERROR);
 
 	// Set the end date (if not yet given)
+	// @todo $year, $month, and $day are not set
 	if (!isset($eventOptions['end_date']))
 		$eventOptions['end_date'] = strftime('%Y-%m-%d', mktime(0, 0, 0, $month, $day, $year) + $eventOptions['span'] * 86400);
 
@@ -898,6 +900,7 @@ function modifyEvent($event_id, &$eventOptions)
 	$eventOptions['title'] = $smcFunc['htmlspecialchars']($eventOptions['title'], ENT_QUOTES);
 
 	// Scan the start date for validity and get its components.
+	// @todo $year, $month, and $day are not set
 	if (($num_results = sscanf($eventOptions['start_date'], '%d-%d-%d', $year, $month, $day)) !== 3)
 		trigger_error('modifyEvent(): invalid start date format given', E_USER_ERROR);
 
@@ -906,6 +909,7 @@ function modifyEvent($event_id, &$eventOptions)
 
 	// Set the end date to the start date + span (if the end date wasn't already given).
 	if (!isset($eventOptions['end_date']))
+		// @todo $year, $month, and $day are not set
 		$eventOptions['end_date'] = strftime('%Y-%m-%d', mktime(0, 0, 0, $month, $day, $year) + $eventOptions['span'] * 86400);
 
 	$smcFunc['db_query']('', '
@@ -1006,7 +1010,7 @@ function getEventProperties($event_id)
 }
 
 /**
- * 
+ *
  * @param int $start
  * @param int $items_per_page
  * @param string $sort
@@ -1053,7 +1057,7 @@ function list_getNumHolidays()
 }
 
 /**
- * @param array $holiday_ids An array of 
+ * @param array $holiday_ids An array of
  */
 function removeHolidays($holiday_ids)
 {

+ 10 - 13
Sources/Subs-Db-mysql.php

@@ -721,22 +721,19 @@ function smf_db_error_backtrace($error_message, $log_message = '', $error_type =
 	if (empty($log_message))
 		$log_message = $error_message;
 
-	if (function_exists('debug_backtrace'))
+	foreach (debug_backtrace() as $step)
 	{
-		foreach (debug_backtrace() as $step)
+		// Found it?
+		if (strpos($step['function'], 'query') === false && !in_array(substr($step['function'], 0, 7), array('smf_db_', 'preg_re', 'db_erro', 'call_us')) && strpos($step['function'], '__') !== 0)
 		{
-			// Found it?
-			if (strpos($step['function'], 'query') === false && !in_array(substr($step['function'], 0, 7), array('smf_db_', 'preg_re', 'db_erro', 'call_us')) && strpos($step['function'], '__') !== 0)
-			{
-				$log_message .= '<br />Function: ' . $step['function'];
-				break;
-			}
+			$log_message .= '<br />Function: ' . $step['function'];
+			break;
+		}
 
-			if (isset($step['line']))
-			{
-				$file = $step['file'];
-				$line = $step['line'];
-			}
+		if (isset($step['line']))
+		{
+			$file = $step['file'];
+			$line = $step['line'];
 		}
 	}
 

+ 11 - 14
Sources/Subs-Db-postgresql.php

@@ -75,6 +75,7 @@ function smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, &$db_prefix
 /**
  * Extend the database functionality. It calls the respective file's init
  * to add the implementations in that file to $smcFunc array.
+ * @param string $type = 'extra'
  */
 function db_extend ($type = 'extra')
 {
@@ -88,7 +89,6 @@ function db_extend ($type = 'extra')
 /**
  * Fix the database prefix if necessary.
  * Do nothing on postgreSQL
- *
  */
 function db_fix_prefix (&$db_prefix, $db_name)
 {
@@ -782,22 +782,19 @@ function smf_db_error_backtrace($error_message, $log_message = '', $error_type =
 	if (empty($log_message))
 		$log_message = $error_message;
 
-	if (function_exists('debug_backtrace'))
+	foreach (debug_backtrace() as $step)
 	{
-		foreach (debug_backtrace() as $step)
+		// Found it?
+		if (strpos($step['function'], 'query') === false && !in_array(substr($step['function'], 0, 7), array('smf_db_', 'preg_re', 'db_erro', 'call_us')) && strpos($step['function'], '__') !== 0)
 		{
-			// Found it?
-			if (strpos($step['function'], 'query') === false && !in_array(substr($step['function'], 0, 7), array('smf_db_', 'preg_re', 'db_erro', 'call_us')) && strpos($step['function'], '__') !== 0)
-			{
-				$log_message .= '<br />Function: ' . $step['function'];
-				break;
-			}
+			$log_message .= '<br />Function: ' . $step['function'];
+			break;
+		}
 
-			if (isset($step['line']))
-			{
-				$file = $step['file'];
-				$line = $step['line'];
-			}
+		if (isset($step['line']))
+		{
+			$file = $step['file'];
+			$line = $step['line'];
 		}
 	}
 

+ 11 - 15
Sources/Subs-Db-sqlite.php

@@ -90,8 +90,7 @@ function smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix,
  * Extend the database functionality. It calls the respective file's init
  * to add the implementations in that file to $smcFunc array.
  *
- * @param string $type, indicated which additional file to load.
- * ('extra', 'packages')
+ * @param string $type, indicated which additional file to load. ('extra', 'packages')
  */
 function db_extend($type = 'extra')
 {
@@ -657,22 +656,19 @@ function smf_db_error_backtrace($error_message, $log_message = '', $error_type =
 	if (empty($log_message))
 		$log_message = $error_message;
 
-	if (function_exists('debug_backtrace'))
+	foreach (debug_backtrace() as $step)
 	{
-		foreach (debug_backtrace() as $step)
+		// Found it?
+		if (strpos($step['function'], 'query') === false && !in_array(substr($step['function'], 0, 7), array('smf_db_', 'preg_re', 'db_erro', 'call_us')) && strpos($step['function'], '__') !== 0)
 		{
-			// Found it?
-			if (strpos($step['function'], 'query') === false && !in_array(substr($step['function'], 0, 7), array('smf_db_', 'preg_re', 'db_erro', 'call_us')) && strpos($step['function'], '__') !== 0)
-			{
-				$log_message .= '<br />Function: ' . $step['function'];
-				break;
-			}
+			$log_message .= '<br />Function: ' . $step['function'];
+			break;
+		}
 
-			if (isset($step['line']))
-			{
-				$file = $step['file'];
-				$line = $step['line'];
-			}
+		if (isset($step['line']))
+		{
+			$file = $step['file'];
+			$line = $step['line'];
 		}
 	}
 

+ 1 - 27
Sources/Subs-Graphics.php

@@ -218,15 +218,8 @@ function resizeImageFile($source, $destination, $max_width, $max_height, $prefer
 	else
 		$sizes = array(-1, -1, -1);
 
-	// Gif? That might mean trouble if gif support is not available.
-	if ($sizes[2] == 1 && !function_exists('imagecreatefromgif') && function_exists('imagecreatefrompng'))
-	{
-		// Download it to the temporary file... use the special gif library... and save as png.
-		if ($img = @gif_loadFile($destination) && gif_outputAsPng($img, $destination))
-			$sizes[2] = 3;
-	}
-
 	// A known and supported format?
+	// @todo test PSD and gif.
 	if (isset($default_formats[$sizes[2]]) && function_exists('imagecreatefrom' . $default_formats[$sizes[2]]))
 	{
 		$imagecreatefrom = 'imagecreatefrom' . $default_formats[$sizes[2]];
@@ -551,25 +544,6 @@ if (!function_exists('imagecreatefrombmp'))
 	}
 }
 
-/**
- * Loads a gif file with the Yamasoft GIF utility class.
- *
- * @param string $lpszFileName
- * @param int $iIndex
- * @return resource, a new GD image.
- */
-function gif_loadFile($lpszFileName, $iIndex = 0)
-{
-	// The classes needed are in this file.
-	loadClassFile('Class-Graphics.php');
-	$gif = new gif_file();
-
-	if (!$gif->loadFile($lpszFileName, $iIndex))
-		return false;
-
-	return $gif;
-}
-
 /**
  * Writes a gif file to disk as a png file.
 

+ 5 - 5
Sources/Subs-Membergroups.php

@@ -2,7 +2,7 @@
 
 /**
  * This file contains functions regarding manipulation of and information about membergroups.
- * 
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -425,11 +425,11 @@ function removeMembersFromGroups($members, $groups = null, $permissionCheckDone
 
 /**
  * Add one or more members to a membergroup
- * 
+ *
  * Requires the manage_membergroups permission.
  * Function has protection against adding members to implicit groups.
  * Non-admins are not able to add members to the admin group.
- * 
+ *
  * @param string|array $members
  * @param int $group
  * @param string $type = 'auto' specifies whether the group is added as primary or as additional group.
@@ -592,13 +592,13 @@ function addMembersToGroup($members, $group, $type = 'auto', $permissionCheckDon
 			array('id_action')
 		);
 
-	call_integration_hook('integrate_add_members_to_group', array($log_inserts));	
+	call_integration_hook('integrate_add_members_to_group', array($log_inserts));
 
 	return true;
 }
 
 /**
- * 
+ *
  * @param array &$members
  * @param int $membergroup
  * @param int $limit = null

+ 2 - 0
Sources/Subs-Package.php

@@ -494,6 +494,7 @@ function create_chmod_control($chmodFiles = array(), $chmodOptions = array(), $r
 				if ($do_change && isset($_POST['restore_files']) && in_array($file, $_POST['restore_files']))
 				{
 					// Use FTP if we have it.
+					// @todo where does $package_ftp get set?
 					if (!empty($package_ftp))
 					{
 						$ftp_file = strtr($file, array($_SESSION['pack_ftp']['root'] => ''));
@@ -1515,6 +1516,7 @@ function deltree($dir, $delete_dir = true)
 		if ($delete_dir && isset($package_ftp))
 		{
 			$ftp_file = strtr($dir, array($_SESSION['pack_ftp']['root'] => ''));
+			// @todo $entryname is never set
 			if (!is_writable($dir . '/' . $entryname))
 				$package_ftp->chmod($ftp_file, 0777);
 			$package_ftp->unlink($ftp_file);

+ 5 - 4
Sources/Subs-Post.php

@@ -1620,6 +1620,7 @@ function sendNotifications($topics, $type, $exclude = array(), $members_only = a
 		)
 	);
 	$sent = 0;
+	$current_language = '';
 	while ($row = $smcFunc['db_fetch_assoc']($members))
 	{
 		// Don't do the excluded...
@@ -2385,9 +2386,9 @@ function createAttachment(&$attachmentOptions)
 /**
  * Modifying a post...
  *
- * @param array $msgOptions
- * @param array $topicOptions
- * @param array $posterOptions
+ * @param array &$msgOptions
+ * @param array &$topicOptions
+ * @param array &$posterOptions
  */
 function modifyPost(&$msgOptions, &$topicOptions, &$posterOptions)
 {
@@ -3203,7 +3204,7 @@ function adminNotify($type, $memberID, $member_name = null)
 }
 
 /**
- * Load a template from EmaulTemplates language file.
+ * Load a template from EmailTemplates language file.
  *
  * @param string $template
  * @param array $replacements = array()

+ 11 - 52
Sources/Who.php

@@ -72,8 +72,8 @@ function Who()
 		$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
 		$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
 	}
-	elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_sort_by']) && $_SESSION['who_online_sort_by'] == 'spiders')
-		unset($_SESSION['who_online_sort_by']);
+	elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders')
+		unset($_SESSION['who_online_filter']);
 
 	// Does the user prefer a different sort direction?
 	if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']]))
@@ -535,9 +535,6 @@ function Credits($in_admin = false)
 					'title' => $txt['credits_groups_ps'],
 					'members' => array(
 						'Michael &quot;Oldiesmann&quot; Eshom',
-						'Amacythe',
-						'Jeremy &quot;SleePy&quot; Darwood',
-						'Justin &quot;metallica48423&quot; O\'Leary',
 					),
 				),
 				array(
@@ -561,38 +558,18 @@ function Credits($in_admin = false)
 				array(
 					'title' => $txt['credits_groups_support'],
 					'members' => array(
+						'Aleksi &quot;Lex&quot; Kilpinen',
 						'JimM',
 						'Adish &quot;(F.L.A.M.E.R)&quot; Patel',
-						'Aleksi &quot;Lex&quot; Kilpinen',
-						'Ben Scott',
 						'Bigguy',
 						'CapadY',
 						'Chas Large',
 						'Duncan85',
-						'Eliana Tamerin',
-						'Fiery',
 						'gbsothere',
-						'Harro',
-						'Huw',
-						'Jan-Olof &quot;Owdy&quot; Eriksson',
-						'Jeremy &quot;jerm&quot; Strike',
 						'Jessica &quot;Miss All Sunday&quot; Gonzales',
-						'K@',
 						'Kevin &quot;greyknight17&quot; Hou',
-						'KGIII',
-						'Kill Em All',
-						'Mattitude',
 						'Mashby',
-						'Mick G.',
 						'Michele &quot;Illori&quot; Davis',
-						'MrPhil',
-						'Nick &quot;Fizzy&quot; Dyer',
-						'Nick &quot;Ha&sup2;&quot;',
-						'Paul_Pauline',
-						'Piro &quot;Sarge&quot; Dhima',
-						'Rumbaar',
-						'Pitti',
-						'RedOne',
 						'S-Ace',
 						'Wade &quot;s&eta;&sigma;&omega;&quot; Poulsen',
 						'xenovanis',
@@ -602,28 +579,13 @@ function Credits($in_admin = false)
 					'title' => $txt['credits_groups_customize'],
 					'members' => array(
 						'Brad &quot;IchBin&trade;&quot; Grow',
-						'&#12487;&#12451;&#12531;1031',
 						'Brannon &quot;B&quot; Hall',
 						'Bryan &quot;Runic&quot; Deakin',
-						'Bulakbol',
-						'Colin &quot;Shadow82x&quot; Blaber',
-						'Daniel15',
-						'Eren Yasarkurt',
 						'Gary M. Gadsdon',
-						'Jason &quot;JBlaze&quot; Clemons',
-						'Jerry',
 						'Jonathan &quot;vbgamer45&quot; Valentin',
 						'Kays',
-						'Killer Possum',
-						'Kirby',
-						'Matt &quot;SlammedDime&quot; Zuba',
 						'Matthew &quot;Labradoodle-360&quot; Kerle',
-						'Nibogo',
-						'Niko',
-						'Peter &quot;Arantor&quot; Spicer',
-						'snork13',
 						'Spuds',
-						'Steven &quot;Fustrate&quot; Hoffman',
 						'Joey &quot;Tyrsson&quot; Smith',
 					),
 				),
@@ -632,13 +594,14 @@ function Credits($in_admin = false)
 					'members' => array(
 						'Joshua &quot;groundup&quot; Dickerson',
 						'AngellinaBelle',
-						'Daniel Diehl',
-						'Dannii Willis',
 						'emanuele',
 						'Graeme Spence',
-						'Jack &quot;akabugeyes&quot; Thorsen',
-						'Jade Elizabeth Trainor',
-						'Peter Duggan',
+					),
+				),
+				array(
+					'title' => $txt['credits_groups_internationalizers'],
+					'members' => array(
+						'Relyana',
 					),
 				),
 				array(
@@ -647,16 +610,12 @@ function Credits($in_admin = false)
 						'Kindred',
 						'Marcus &quot;c&sigma;&sigma;&#1082;&iota;&#1108; &#1084;&sigma;&eta;&#1109;&#1090;&#1108;&#1103;&quot; Forsberg',
 						'Ralph &quot;[n3rve]&quot; Otowo',
-						'rickC',
-						'Tony Reid',
 					),
 				),
 				array(
-					'title' => $txt['credits_groups_internationalizers'],
+					'title' => $txt['credits_groups_site'],
 					'members' => array(
-						'Relyana',
-						'Akyhne',
-						'GravuTrad',
+						'Jeremy &quot;SleePy&quot; Darwood',
 					),
 				),
 				array(