Browse Source

! Our str_ireplace function can support the argument as we support PHP 4.1.0+ (Subs-Compat.php)
! Move our custom search to its API (SearchAPI-Custom.php, Search.php)
! Added some more search API locations for better API support and bumped API version (Subs-Post.php, SplitTopics.php, Search.php, SearchAPI-*.php, ManageSearch.php)
! Starting doc changes in Subs.php
! Version changes

Spuds 12 years ago
parent
commit
c3f6282f89
100 changed files with 780 additions and 169 deletions
  1. 1 1
      SSI.php
  2. 1 1
      Sources/Admin.php
  3. 1 1
      Sources/BoardIndex.php
  4. 1 1
      Sources/Calendar.php
  5. 1 1
      Sources/Class-Graphics.php
  6. 1 1
      Sources/Class-Package.php
  7. 1 1
      Sources/DbExtra-mysql.php
  8. 1 1
      Sources/DbExtra-postgresql.php
  9. 1 1
      Sources/DbExtra-sqlite.php
  10. 1 1
      Sources/DbPackages-mysql.php
  11. 1 1
      Sources/DbPackages-postgresql.php
  12. 1 1
      Sources/DbPackages-sqlite.php
  13. 1 1
      Sources/DbSearch-mysql.php
  14. 1 1
      Sources/DbSearch-postgresql.php
  15. 1 1
      Sources/DbSearch-sqlite.php
  16. 1 1
      Sources/Display.php
  17. 1 1
      Sources/DumpDatabase.php
  18. 1 1
      Sources/Errors.php
  19. 1 1
      Sources/Groups.php
  20. 1 1
      Sources/Help.php
  21. 4 7
      Sources/Karma.php
  22. 1 1
      Sources/Load.php
  23. 1 1
      Sources/LogInOut.php
  24. 520 0
      Sources/Logging.php
  25. 1 1
      Sources/ManageAttachments.php
  26. 1 1
      Sources/ManageBans.php
  27. 1 1
      Sources/ManageBoards.php
  28. 1 1
      Sources/ManageCalendar.php
  29. 1 1
      Sources/ManageErrors.php
  30. 1 1
      Sources/ManageLanguages.php
  31. 1 1
      Sources/ManageMail.php
  32. 1 1
      Sources/ManageMaintenance.php
  33. 1 1
      Sources/ManageMembergroups.php
  34. 1 1
      Sources/ManageMembers.php
  35. 1 1
      Sources/ManageNews.php
  36. 1 1
      Sources/ManagePaid.php
  37. 1 1
      Sources/ManagePermissions.php
  38. 1 1
      Sources/ManagePosts.php
  39. 1 1
      Sources/ManageRegistration.php
  40. 1 1
      Sources/ManageScheduledTasks.php
  41. 7 10
      Sources/ManageSearch.php
  42. 1 1
      Sources/ManageSearchEngines.php
  43. 1 1
      Sources/ManageServer.php
  44. 1 1
      Sources/ManageSettings.php
  45. 1 1
      Sources/ManageSmileys.php
  46. 1 1
      Sources/Memberlist.php
  47. 1 1
      Sources/MessageIndex.php
  48. 1 1
      Sources/ModerationCenter.php
  49. 1 1
      Sources/Modlog.php
  50. 1 1
      Sources/MoveTopic.php
  51. 1 1
      Sources/News.php
  52. 1 1
      Sources/Notify.php
  53. 1 1
      Sources/PackageGet.php
  54. 1 1
      Sources/Packages.php
  55. 1 1
      Sources/PersonalMessage.php
  56. 1 1
      Sources/Poll.php
  57. 1 1
      Sources/Post.php
  58. 1 1
      Sources/PostModeration.php
  59. 1 1
      Sources/Printpage.php
  60. 1 1
      Sources/Profile-Actions.php
  61. 1 1
      Sources/Profile-Modify.php
  62. 1 1
      Sources/Profile-View.php
  63. 1 1
      Sources/Profile.php
  64. 1 1
      Sources/QueryString.php
  65. 1 1
      Sources/Recent.php
  66. 4 4
      Sources/Register.php
  67. 1 1
      Sources/Reminder.php
  68. 1 1
      Sources/RepairBoards.php
  69. 1 1
      Sources/Reports.php
  70. 1 1
      Sources/ScheduledTasks.php
  71. 46 25
      Sources/Search.php
  72. 74 7
      Sources/SearchAPI-Custom.php
  73. 4 3
      Sources/SearchAPI-Fulltext.php
  74. 3 3
      Sources/SearchAPI-Standard.php
  75. 1 2
      Sources/Security.php
  76. 1 1
      Sources/SendTopic.php
  77. 1 1
      Sources/Session.php
  78. 25 1
      Sources/SplitTopics.php
  79. 1 1
      Sources/Stats.php
  80. 1 1
      Sources/Subs-Admin.php
  81. 1 1
      Sources/Subs-Auth.php
  82. 1 1
      Sources/Subs-BoardIndex.php
  83. 1 1
      Sources/Subs-Boards.php
  84. 1 1
      Sources/Subs-Calendar.php
  85. 1 1
      Sources/Subs-Categories.php
  86. 1 3
      Sources/Subs-Charset.php
  87. 3 7
      Sources/Subs-Compat.php
  88. 1 1
      Sources/Subs-Db-mysql.php
  89. 1 1
      Sources/Subs-Db-postgresql.php
  90. 1 1
      Sources/Subs-Db-sqlite.php
  91. 1 1
      Sources/Subs-Editor.php
  92. 1 1
      Sources/Subs-Graphics.php
  93. 1 1
      Sources/Subs-List.php
  94. 1 1
      Sources/Subs-Membergroups.php
  95. 1 1
      Sources/Subs-Members.php
  96. 1 1
      Sources/Subs-MembersOnline.php
  97. 1 1
      Sources/Subs-Menu.php
  98. 1 1
      Sources/Subs-MessageIndex.php
  99. 1 1
      Sources/Subs-OpenID.php
  100. 1 10
      Sources/Subs-Package.php

+ 1 - 1
SSI.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 // Don't do anything if SMF is already loaded.

+ 1 - 1
Sources/Admin.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/BoardIndex.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Calendar.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Class-Graphics.php

@@ -16,7 +16,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Class-Package.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbExtra-mysql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbExtra-postgresql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbExtra-sqlite.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbPackages-mysql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbPackages-postgresql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbPackages-sqlite.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbSearch-mysql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbSearch-postgresql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DbSearch-sqlite.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Display.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/DumpDatabase.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Errors.php

@@ -12,7 +12,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Groups.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Help.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 4 - 7
Sources/Karma.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -38,9 +38,8 @@ function ModifyKarma()
 	checkSession('get');
 
 	// If you don't have enough posts, tough luck.
-	/**
-	 * @todo Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
-	 */
+	// @todo Should this be dropped in favor of post group permissions?
+	// Should this apply to the member you are smiting/applauding?
 	if (!$user_info['is_admin'] && $user_info['posts'] < $modSettings['karmaMinPosts'])
 		fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));
 
@@ -152,9 +151,7 @@ function ModifyKarma()
 	}
 }
 
-/**
- *  What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No sir.
- */
+//  What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No sir.
 function BookOfUnknown()
 {
 	global $context;

+ 1 - 1
Sources/Load.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/LogInOut.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 520 - 0
Sources/Logging.php

@@ -0,0 +1,520 @@
+<?php
+
+/**
+ * This file concerns itself with logging, whether in the database or files.
+ *
+ * Simple Machines Forum (SMF)
+ *
+ * @package SMF
+ * @author Simple Machines http://www.simplemachines.org
+ * @copyright 2011 Simple Machines
+ * @license http://www.simplemachines.org/about/smf/license.php BSD
+ *
+ * @version 2.1 Alpha 1
+ */
+
+if (!defined('SMF'))
+	die('Hacking attempt...');
+
+/**
+ * Put this user in the online log.
+ *
+ * @param bool $force = false
+ */
+function writeLog($force = false)
+{
+	global $user_info, $user_settings, $context, $modSettings, $settings, $topic, $board, $smcFunc, $sourcedir;
+
+	// If we are showing who is viewing a topic, let's see if we are, and force an update if so - to make it accurate.
+	if (!empty($settings['display_who_viewing']) && ($topic || $board))
+	{
+		// Take the opposite approach!
+		$force = true;
+		// Don't update for every page - this isn't wholly accurate but who cares.
+		if ($topic)
+		{
+			if (isset($_SESSION['last_topic_id']) && $_SESSION['last_topic_id'] == $topic)
+				$force = false;
+			$_SESSION['last_topic_id'] = $topic;
+		}
+	}
+
+	// Are they a spider we should be tracking? Mode = 1 gets tracked on its spider check...
+	if (!empty($user_info['possibly_robot']) && !empty($modSettings['spider_mode']) && $modSettings['spider_mode'] > 1)
+	{
+		require_once($sourcedir . '/ManageSearchEngines.php');
+		logSpider();
+	}
+
+	// Don't mark them as online more than every so often.
+	if (!empty($_SESSION['log_time']) && $_SESSION['log_time'] >= (time() - 8) && !$force)
+		return;
+
+	if (!empty($modSettings['who_enabled']))
+	{
+		$serialized = $_GET + array('USER_AGENT' => $_SERVER['HTTP_USER_AGENT']);
+
+		// In the case of a dlattach action, session_var may not be set.
+		if (!isset($context['session_var']))
+			$context['session_var'] = $_SESSION['session_var'];
+
+		unset($serialized['sesc'], $serialized[$context['session_var']]);
+		$serialized = serialize($serialized);
+	}
+	else
+		$serialized = '';
+
+	// Guests use 0, members use their session ID.
+	$session_id = $user_info['is_guest'] ? 'ip' . $user_info['ip'] : session_id();
+
+	// Grab the last all-of-SMF-specific log_online deletion time.
+	$do_delete = cache_get_data('log_online-update', 30) < time() - 30;
+
+	// If the last click wasn't a long time ago, and there was a last click...
+	if (!empty($_SESSION['log_time']) && $_SESSION['log_time'] >= time() - $modSettings['lastActive'] * 20)
+	{
+		if ($do_delete)
+		{
+			$smcFunc['db_query']('delete_log_online_interval', '
+				DELETE FROM {db_prefix}log_online
+				WHERE log_time < {int:log_time}
+					AND session != {string:session}',
+				array(
+					'log_time' => time() - $modSettings['lastActive'] * 60,
+					'session' => $session_id,
+				)
+			);
+
+			// Cache when we did it last.
+			cache_put_data('log_online-update', time(), 30);
+		}
+
+		$smcFunc['db_query']('', '
+			UPDATE {db_prefix}log_online
+			SET log_time = {int:log_time}, ip = IFNULL(INET_ATON({string:ip}), 0), url = {string:url}
+			WHERE session = {string:session}',
+			array(
+				'log_time' => time(),
+				'ip' => $user_info['ip'],
+				'url' => $serialized,
+				'session' => $session_id,
+			)
+		);
+
+		// Guess it got deleted.
+		if ($smcFunc['db_affected_rows']() == 0)
+			$_SESSION['log_time'] = 0;
+	}
+	else
+		$_SESSION['log_time'] = 0;
+
+	// Otherwise, we have to delete and insert.
+	if (empty($_SESSION['log_time']))
+	{
+		if ($do_delete || !empty($user_info['id']))
+			$smcFunc['db_query']('', '
+				DELETE FROM {db_prefix}log_online
+				WHERE ' . ($do_delete ? 'log_time < {int:log_time}' : '') . ($do_delete && !empty($user_info['id']) ? ' OR ' : '') . (empty($user_info['id']) ? '' : 'id_member = {int:current_member}'),
+				array(
+					'current_member' => $user_info['id'],
+					'log_time' => time() - $modSettings['lastActive'] * 60,
+				)
+			);
+
+		$smcFunc['db_insert']($do_delete ? 'ignore' : 'replace',
+			'{db_prefix}log_online',
+			array('session' => 'string', 'id_member' => 'int', 'id_spider' => 'int', 'log_time' => 'int', 'ip' => 'raw', 'url' => 'string'),
+			array($session_id, $user_info['id'], empty($_SESSION['id_robot']) ? 0 : $_SESSION['id_robot'], time(), 'IFNULL(INET_ATON(\'' . $user_info['ip'] . '\'), 0)', $serialized),
+			array('session')
+		);
+	}
+
+	// Mark your session as being logged.
+	$_SESSION['log_time'] = time();
+
+	// Well, they are online now.
+	if (empty($_SESSION['timeOnlineUpdated']))
+		$_SESSION['timeOnlineUpdated'] = time();
+
+	// Set their login time, if not already done within the last minute.
+	if (SMF != 'SSI' && !empty($user_info['last_login']) && $user_info['last_login'] < time() - 60)
+	{
+		// Don't count longer than 15 minutes.
+		if (time() - $_SESSION['timeOnlineUpdated'] > 60 * 15)
+			$_SESSION['timeOnlineUpdated'] = time();
+
+		$user_settings['total_time_logged_in'] += time() - $_SESSION['timeOnlineUpdated'];
+		updateMemberData($user_info['id'], array('last_login' => time(), 'member_ip' => $user_info['ip'], 'member_ip2' => $_SERVER['BAN_CHECK_IP'], 'total_time_logged_in' => $user_settings['total_time_logged_in']));
+
+		if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
+			cache_put_data('user_settings-' . $user_info['id'], $user_settings, 60);
+
+		$user_info['total_time_logged_in'] += time() - $_SESSION['timeOnlineUpdated'];
+		$_SESSION['timeOnlineUpdated'] = time();
+	}
+}
+
+/**
+ * Logs the last database error into a file.
+ * Attempts to use the backup file first, to store the last database error
+ * and only update Settings.php if the first was successful.
+ */
+function logLastDatabaseError()
+{
+	global $boarddir;
+
+	// Find out this way if we can even write things on this filesystem.
+	// In addition, store things first in the backup file
+
+	$last_settings_change = @filemtime($boarddir . '/Settings.php');
+
+	// Make sure the backup file is there...
+	$file = $boarddir . '/Settings_bak.php';
+	if ((!file_exists($file) || filesize($file) == 0) && !copy($boarddir . '/Settings.php', $file))
+			return false;
+
+	// ...and writable!
+	if (!is_writable($file))
+	{
+		chmod($file, 0755);
+		if (!is_writable($file))
+		{
+			chmod($file, 0775);
+			if (!is_writable($file))
+			{
+				chmod($file, 0777);
+				if (!is_writable($file))
+						return false;
+			}
+		}
+	}
+
+	// Put the new timestamp.
+	$data = file_get_contents($file);
+	$data = preg_replace('~\$db_last_error = \d+;~', '$db_last_error = ' . time() . ';', $data);
+
+	// Open the backup file for writing
+	if ($fp = @fopen($file, 'w'))
+	{
+		// Reset the file buffer.
+		set_file_buffer($fp, 0);
+
+		// Update the file.
+		$t = flock($fp, LOCK_EX);
+		$bytes = fwrite($fp, $data);
+		flock($fp, LOCK_UN);
+		fclose($fp);
+
+		// Was it a success?
+		// ...only relevant if we're still dealing with the same good ole' settings file.
+		clearstatcache();
+		if (($bytes == strlen($data)) && (filemtime($boarddir . '/Settings.php') === $last_settings_change))
+		{
+			// This is our new Settings file...
+			// At least this one is an atomic operation
+			@copy($file, $boarddir . '/Settings.php');
+			return true;
+		}
+		else
+		{
+			// Oops. Someone might have been faster
+			// or we have no more disk space left, troubles, troubles...
+			// Copy the file back and run for your life!
+			@copy($boarddir . '/Settings.php', $file);
+		}
+	}
+
+	return false;
+}
+
+/**
+ * This function shows the debug information tracked when $db_show_debug = true
+ * in Settings.php
+ */
+function displayDebug()
+{
+	global $context, $scripturl, $boarddir, $modSettings, $boarddir;
+	global $db_cache, $db_count, $db_show_debug, $cache_count, $cache_hits, $txt;
+
+	// Add to Settings.php if you want to show the debugging information.
+	if (!isset($db_show_debug) || $db_show_debug !== true || (isset($_GET['action']) && $_GET['action'] == 'viewquery') || WIRELESS)
+		return;
+
+	if (empty($_SESSION['view_queries']))
+		$_SESSION['view_queries'] = 0;
+	if (empty($context['debug']['language_files']))
+		$context['debug']['language_files'] = array();
+	if (empty($context['debug']['sheets']))
+		$context['debug']['sheets'] = array();
+
+	$files = get_included_files();
+	$total_size = 0;
+	for ($i = 0, $n = count($files); $i < $n; $i++)
+	{
+		if (file_exists($files[$i]))
+			$total_size += filesize($files[$i]);
+		$files[$i] = strtr($files[$i], array($boarddir => '.'));
+	}
+
+	$warnings = 0;
+	if (!empty($db_cache))
+	{
+		foreach ($db_cache as $q => $qq)
+		{
+			if (!empty($qq['w']))
+				$warnings += count($qq['w']);
+		}
+
+		$_SESSION['debug'] = &$db_cache;
+	}
+
+	// Gotta have valid HTML ;).
+	$temp = ob_get_contents();
+	if (function_exists('ob_clean'))
+		ob_clean();
+	else
+	{
+		ob_end_clean();
+		ob_start('ob_sessrewrite');
+	}
+
+	echo preg_replace('~</body>\s*</html>~', '', $temp), '
+<div class="smalltext" style="text-align: left; margin: 1ex;">
+	', $txt['debug_templates'], count($context['debug']['templates']), ': <em>', implode('</em>, <em>', $context['debug']['templates']), '</em>.<br />
+	', $txt['debug_subtemplates'], count($context['debug']['sub_templates']), ': <em>', implode('</em>, <em>', $context['debug']['sub_templates']), '</em>.<br />
+	', $txt['debug_language_files'], count($context['debug']['language_files']), ': <em>', implode('</em>, <em>', $context['debug']['language_files']), '</em>.<br />
+	', $txt['debug_stylesheets'], count($context['debug']['sheets']), ': <em>', implode('</em>, <em>', $context['debug']['sheets']), '</em>.<br />
+	', $txt['debug_files_included'], count($files), ' - ', round($total_size / 1024), $txt['debug_kb'], ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_include_info" style="display: none;"><em>', implode('</em>, <em>', $files), '</em></span>)<br />';
+
+	if (!empty($modSettings['cache_enable']) && !empty($cache_hits))
+	{
+		$entries = array();
+		$total_t = 0;
+		$total_s = 0;
+		foreach ($cache_hits as $cache_hit)
+		{
+			$entries[] = $cache_hit['d'] . ' ' . $cache_hit['k'] . ': ' . sprintf($txt['debug_cache_seconds_bytes'], comma_format($cache_hit['t'], 5), $cache_hit['s']);
+			$total_t += $cache_hit['t'];
+			$total_s += $cache_hit['s'];
+		}
+
+		echo '
+	', $txt['debug_cache_hits'], $cache_count, ': ', sprintf($txt['debug_cache_seconds_bytes_total'], comma_format($total_t, 5), comma_format($total_s)), ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_cache_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_cache_info" style="display: none;"><em>', implode('</em>, <em>', $entries), '</em></span>)<br />';
+	}
+
+	echo '
+	<a href="', $scripturl, '?action=viewquery" target="_blank" class="new_win">', $warnings == 0 ? sprintf($txt['debug_queries_used'], (int) $db_count) : sprintf($txt['debug_queries_used_and_warnings'], (int) $db_count, $warnings), '</a><br />
+	<br />';
+
+	if ($_SESSION['view_queries'] == 1 && !empty($db_cache))
+		foreach ($db_cache as $q => $qq)
+		{
+			$is_select = substr(trim($qq['q']), 0, 6) == 'SELECT' || preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+SELECT .+$~s', trim($qq['q'])) != 0;
+			// Temporary tables created in earlier queries are not explainable.
+			if ($is_select)
+			{
+				foreach (array('log_topics_unread', 'topics_posted_in', 'tmp_log_search_topics', 'tmp_log_search_messages') as $tmp)
+					if (strpos(trim($qq['q']), $tmp) !== false)
+					{
+						$is_select = false;
+						break;
+					}
+			}
+			// But actual creation of the temporary tables are.
+			elseif (preg_match('~^CREATE TEMPORARY TABLE .+?SELECT .+$~s', trim($qq['q'])) != 0)
+				$is_select = true;
+
+			// Make the filenames look a bit better.
+			if (isset($qq['f']))
+				$qq['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $qq['f']);
+
+			echo '
+	<strong>', $is_select ? '<a href="' . $scripturl . '?action=viewquery;qq=' . ($q + 1) . '#qq' . $q . '" target="_blank" class="new_win" style="text-decoration: none;">' : '', nl2br(str_replace("\t", '&nbsp;&nbsp;&nbsp;', htmlspecialchars(ltrim($qq['q'], "\n\r")))) . ($is_select ? '</a></strong>' : '</strong>') . '<br />
+	&nbsp;&nbsp;&nbsp;';
+			if (!empty($qq['f']) && !empty($qq['l']))
+				echo sprintf($txt['debug_query_in_line'], $qq['f'], $qq['l']);
+
+			if (isset($qq['s'], $qq['t']) && isset($txt['debug_query_which_took_at']))
+				echo sprintf($txt['debug_query_which_took_at'], round($qq['t'], 8), round($qq['s'], 8)) . '<br />';
+			elseif (isset($qq['t']))
+				echo sprintf($txt['debug_query_which_took'], round($qq['t'], 8)) . '<br />';
+			echo '
+	<br />';
+		}
+
+	echo '
+	<a href="' . $scripturl . '?action=viewquery;sa=hide">', $txt['debug_' . (empty($_SESSION['view_queries']) ? 'show' : 'hide') . '_queries'], '</a>
+</div></body></html>';
+}
+
+/**
+ * Track Statistics.
+ * Caches statistics changes, and flushes them if you pass nothing.
+ * If '+' is used as a value, it will be incremented.
+ * It does not actually commit the changes until the end of the page view.
+ * It depends on the trackStats setting.
+ *
+ * @param array $stats = array()
+ */
+function trackStats($stats = array())
+{
+	global $modSettings, $smcFunc;
+	static $cache_stats = array();
+
+	if (empty($modSettings['trackStats']))
+		return false;
+	if (!empty($stats))
+		return $cache_stats = array_merge($cache_stats, $stats);
+	elseif (empty($cache_stats))
+		return false;
+
+	$setStringUpdate = '';
+	$insert_keys = array();
+	$date = strftime('%Y-%m-%d', forum_time(false));
+	$update_parameters = array(
+		'current_date' => $date,
+	);
+	foreach ($cache_stats as $field => $change)
+	{
+		$setStringUpdate .= '
+			' . $field . ' = ' . ($change === '+' ? $field . ' + 1' : '{int:' . $field . '}') . ',';
+
+		if ($change === '+')
+			$cache_stats[$field] = 1;
+		else
+			$update_parameters[$field] = $change;
+		$insert_keys[$field] = 'int';
+	}
+
+	$smcFunc['db_query']('', '
+		UPDATE {db_prefix}log_activity
+		SET' . substr($setStringUpdate, 0, -1) . '
+		WHERE date = {date:current_date}',
+		$update_parameters
+	);
+	if ($smcFunc['db_affected_rows']() == 0)
+	{
+		$smcFunc['db_insert']('ignore',
+			'{db_prefix}log_activity',
+			array_merge($insert_keys, array('date' => 'date')),
+			array_merge($cache_stats, array($date)),
+			array('date')
+		);
+	}
+
+	// Don't do this again.
+	$cache_stats = array();
+
+	return true;
+}
+
+/**
+ * This function logs an action in the respective log. (database log)
+ * @example logAction('remove', array('starter' => $id_member_started));
+ *
+ * @param string $action
+ * @param array $extra = array()
+ * @param string $log_type, options 'moderate', 'admin', ...etc.
+ */
+function logAction($action, $extra = array(), $log_type = 'moderate')
+{
+	global $modSettings, $user_info, $smcFunc, $sourcedir;
+
+	$log_types = array(
+		'moderate' => 1,
+		'user' => 2,
+		'admin' => 3,
+	);
+
+	if (!is_array($extra))
+		trigger_error('logAction(): data is not an array with action \'' . $action . '\'', E_USER_NOTICE);
+
+	// Pull out the parts we want to store separately, but also make sure that the data is proper
+	if (isset($extra['topic']))
+	{
+		if (!is_numeric($extra['topic']))
+			trigger_error('logAction(): data\'s topic is not a number', E_USER_NOTICE);
+		$topic_id = empty($extra['topic']) ? '0' : (int)$extra['topic'];
+		unset($extra['topic']);
+	}
+	else
+		$topic_id = '0';
+
+	if (isset($extra['message']))
+	{
+		if (!is_numeric($extra['message']))
+			trigger_error('logAction(): data\'s message is not a number', E_USER_NOTICE);
+		$msg_id = empty($extra['message']) ? '0' : (int)$extra['message'];
+		unset($extra['message']);
+	}
+	else
+		$msg_id = '0';
+
+	// Is there an associated report on this?
+	if (in_array($action, array('move', 'remove', 'split', 'merge')))
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT id_report
+			FROM {db_prefix}log_reported
+			WHERE {raw:column_name} = {int:reported}
+			LIMIT 1',
+			array(
+				'column_name' => !empty($msg_id) ? 'id_msg' : 'id_topic',
+				'reported' => !empty($msg_id) ? $msg_id : $topic_id,
+		));
+
+		// Alright, if we get any result back, update open reports.
+		if ($smcFunc['db_num_rows']($request) > 0)
+		{
+			require_once($sourcedir . '/ModerationCenter.php');
+			updateSettings(array('last_mod_report_action' => time()));
+			recountOpenReports();
+		}
+		$smcFunc['db_free_result']($request);
+	}
+
+	// No point in doing anything else, if the log isn't even enabled.
+	if (empty($modSettings['modlog_enabled']) || !isset($log_types[$log_type]))
+		return false;
+
+	if (isset($extra['member']) && !is_numeric($extra['member']))
+		trigger_error('logAction(): data\'s member is not a number', E_USER_NOTICE);
+
+	if (isset($extra['board']))
+	{
+		if (!is_numeric($extra['board']))
+			trigger_error('logAction(): data\'s board is not a number', E_USER_NOTICE);
+		$board_id = empty($extra['board']) ? '0' : (int)$extra['board'];
+		unset($extra['board']);
+	}
+	else
+		$board_id = '0';
+
+	if (isset($extra['board_to']))
+	{
+		if (!is_numeric($extra['board_to']))
+			trigger_error('logAction(): data\'s board_to is not a number', E_USER_NOTICE);
+		if (empty($board_id))
+		{
+			$board_id = empty($extra['board_to']) ? '0' : (int)$extra['board_to'];
+			unset($extra['board_to']);
+		}
+	}
+
+	$smcFunc['db_insert']('',
+		'{db_prefix}log_actions',
+		array(
+			'log_time' => 'int', 'id_log' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'action' => 'string',
+			'id_board' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'extra' => 'string-65534',
+		),
+		array(
+			time(), $log_types[$log_type], $user_info['id'], $user_info['ip'], $action,
+			$board_id, $topic_id, $msg_id, serialize($extra),
+		),
+		array('id_action')
+	);
+
+	return $smcFunc['db_insert_id']('{db_prefix}log_actions', 'id_action');
+}
+
+?>

+ 1 - 1
Sources/ManageAttachments.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageBans.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageBoards.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageCalendar.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageErrors.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageLanguages.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageMail.php

@@ -12,7 +12,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageMaintenance.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageMembergroups.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageMembers.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageNews.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManagePaid.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManagePermissions.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManagePosts.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageRegistration.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageScheduledTasks.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 7 - 10
Sources/ManageSearch.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -105,15 +105,10 @@ function EditSearchSettings($return_config = false)
 	call_integration_hook('integrate_modify_search_settings', array(&$config_vars));
 
 	// Perhaps the search method wants to add some settings?
-	$modSettings['search_index'] = empty($modSettings['search_index']) ? 'standard' : $modSettings['search_index'];
-	if (file_exists($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php'))
-	{
-		loadClassFile('SearchAPI-' . ucwords($modSettings['search_index']) . '.php');
-
-		$method_call = array($modSettings['search_index'] . '_search', 'searchSettings');
-		if (is_callable($method_call))
-			call_user_func_array($method_call, array(&$config_vars));
-	}
+	require_once($sourcedir . '/Search.php');
+	$searchAPI = findSearchAPI();
+	if (is_callable(array($searchAPI, 'searchSettings')))
+		call_user_func_array($searchAPI->searchSettings, array(&$config_vars));
 
 	if ($return_config)
 		return $config_vars;
@@ -121,6 +116,8 @@ function EditSearchSettings($return_config = false)
 	$context['page_title'] = $txt['search_settings_title'];
 	$context['sub_template'] = 'show_settings';
 
+	call_integration_hook('integrate_modify_search_weights', array(&$factors));
+
 	// We'll need this for the settings.
 	require_once($sourcedir . '/ManageServer.php');
 

+ 1 - 1
Sources/ManageSearchEngines.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageServer.php

@@ -61,7 +61,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageSettings.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ManageSmileys.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Memberlist.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/MessageIndex.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ModerationCenter.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Modlog.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/MoveTopic.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/News.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Notify.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/PackageGet.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Packages.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/PersonalMessage.php

@@ -12,7 +12,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Poll.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Post.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/PostModeration.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Printpage.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Profile-Actions.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Profile-Modify.php

@@ -12,7 +12,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Profile-View.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Profile.php

@@ -12,7 +12,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/QueryString.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Recent.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 4 - 4
Sources/Register.php

@@ -4,7 +4,7 @@
  * This file has two main jobs, but they really are one.  It registers new
  * members, and it helps the administrator moderate member registrations.
  * Similarly, it handles account activation as well.
- * 
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -12,7 +12,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -20,7 +20,7 @@ if (!defined('SMF'))
 
 /**
  * Begin the registration process.
- * 
+ *
  * @param array $reg_errors = array()
  */
 function Register($reg_errors = array())
@@ -197,7 +197,7 @@ function Register($reg_errors = array())
 
 /**
  * Actually register the member.
- * 
+ *
  * @param bool $verifiedOpenID = false
  */
 function Register2($verifiedOpenID = false)

+ 1 - 1
Sources/Reminder.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/RepairBoards.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Reports.php

@@ -14,7 +14,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/ScheduledTasks.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 46 - 25
Sources/Search.php

@@ -2,7 +2,7 @@
 
 /**
  * Handle all of the searching from here.
- * 
+ *
  * Simple Machines Forum (SMF)
  *
  * @package SMF
@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -19,9 +19,9 @@ if (!defined('SMF'))
 // This defines two version types for checking the API's are compatible with this version of SMF.
 $GLOBALS['search_versions'] = array(
 	// This is the forum version but is repeated due to some people rewriting $forum_version.
-	'forum_version' => 'SMF 2.0',
+	'forum_version' => 'SMF 2.1 Alpha 1',
 	// This is the minimum version of SMF that an API could have been written for to work. (strtr to stop accidentally updating version on release)
-	'search_version' => strtr('SMF 2+0=Beta=2', array('+' => '.', '=' => ' ')),
+	'search_version' => strtr('SMF 2+1=Alpha=1', array('+' => '.', '=' => ' ')),
 );
 
 /**
@@ -246,7 +246,7 @@ function PlushSearch2()
 {
 	global $scripturl, $modSettings, $sourcedir, $txt, $db_connection;
 	global $user_info, $context, $options, $messages_request, $boards_can;
-	global $excludedWords, $participants, $smcFunc, $search_versions, $searchAPI;
+	global $excludedWords, $participants, $smcFunc;
 
 	if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search'])
 		fatal_lang_error('loadavg_search_disabled', false);
@@ -311,23 +311,7 @@ function PlushSearch2()
 	db_extend('search');
 
 	// Load up the search API we are going to use.
-	$modSettings['search_index'] = empty($modSettings['search_index']) ? 'standard' : $modSettings['search_index'];
-	if (!file_exists($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php'))
-		fatal_lang_error('search_api_missing');
-	loadClassFile('SearchAPI-' . ucwords($modSettings['search_index']) . '.php');
-
-	// Create an instance of the search API and check it is valid for this version of SMF.
-	$search_class_name = $modSettings['search_index'] . '_search';
-	$searchAPI = new $search_class_name();
-	if (!$searchAPI || ($searchAPI->supportsMethod('isValid') && !$searchAPI->isValid()) || !matchPackageVersion($search_versions['forum_version'], $searchAPI->min_smf_version . '-' . $searchAPI->version_compatible))
-	{
-		// Log the error.
-		loadLanguage('Errors');
-		log_error(sprintf($txt['search_api_not_compatible'], 'SearchAPI-' . ucwords($modSettings['search_index']) . '.php'), 'critical');
-
-		loadClassFile('SearchAPI-Standard.php');
-		$searchAPI = new standard_search();
-	}
+	$searchAPI = findSearchAPI();
 
 	// $search_params will carry all settings that differ from the default search parameters.
 	// That way, the URLs involved in a search page will be kept as short as possible.
@@ -592,7 +576,7 @@ function PlushSearch2()
 	/**
 	 * @todo Setting to add more here?
 	 * @todo Maybe only blacklist if they are the only word, or "any" is used?
-	 */ 
+	 */
 	$blacklisted_words = array('img', 'url', 'quote', 'www', 'http', 'the', 'is', 'it', 'are', 'if');
 
 	// What are we searching for?
@@ -1831,11 +1815,11 @@ function PlushSearch2()
  * Note that the call to loadAttachmentContext() doesn't work:
  * this function doesn't fulfill the pre-condition to fill $attachments global...
  * So all it does is to fallback and return.
- * 
+ *
  * What it does:
  * - callback function for the results sub template.
 		- loads the necessary contextual data to show a search result.
- * 
+ *
  * @param $reset = false
  * @return array
  */
@@ -2098,6 +2082,43 @@ function prepareSearchContext($reset = false)
 	return $output;
 }
 
+/*
+ * Creates a search API and returns the object.
+ *
+*/
+function findSearchAPI()
+{
+	global $sourcedir, $modSettings, $search_versions, $searchAPI, $txt;
+
+	require_once($sourcedir . '/Subs-Package.php');
+
+	// Search has a special database set.
+	db_extend('search');
+
+	// Load up the search API we are going to use.
+	$modSettings['search_index'] = empty($modSettings['search_index']) ? 'standard' : $modSettings['search_index'];
+	if (!file_exists($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php'))
+		fatal_lang_error('search_api_missing');
+	loadClassFile('SearchAPI-' . ucwords($modSettings['search_index']) . '.php');
+
+	// Create an instance of the search API and check it is valid for this version of SMF.
+	$search_class_name = $modSettings['search_index'] . '_search';
+	$searchAPI = new $search_class_name();
+
+	// An invalid Search API.
+	if (!$searchAPI || ($searchAPI->supportsMethod('isValid') && !$searchAPI->isValid()) || !matchPackageVersion($search_versions['forum_version'], $searchAPI->min_smf_version . '-' . $searchAPI->version_compatible))
+	{
+		// Log the error.
+		loadLanguage('Errors');
+		log_error(sprintf($txt['search_api_not_compatible'], 'SearchAPI-' . ucwords($modSettings['search_index']) . '.php'), 'critical');
+
+		loadClassFile('SearchAPI-Standard.php');
+		$searchAPI = new standard_search();
+	}
+
+	return $searchAPI;
+}
+
 /**
  * This function compares the length of two strings plus a little.
  * What it does:

+ 74 - 7
Sources/SearchAPI-Custom.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -24,9 +24,9 @@ if (!defined('SMF'))
 class custom_search
 {
 	// This is the last version of SMF that this was tested on, to protect against API changes.
-	public $version_compatible = 'SMF 2.0';
+	public $version_compatible = 'SMF 2.1 Alpha 1';
 	// This won't work with versions of SMF less than this.
-	public $min_smf_version = 'SMF 2.0 Beta 2';
+	public $min_smf_version = 'SMF 2.1 Alpha 1';
 	// Is it supported?
 	public $is_supported = true;
 
@@ -67,12 +67,13 @@ class custom_search
 			case 'searchSort':
 			case 'prepareIndexes':
 			case 'indexedWordQuery':
+			case 'postCreated':
+			case 'postModified':
 				return true;
 			break;
 
+			// All other methods, too bad dunno you.
 			default:
-
-				// All other methods, too bad dunno you.
 				return false;
 			return;
 		}
@@ -209,6 +210,72 @@ class custom_search
 
 		return $ignoreRequest;
 	}
-}
 
-?>
+	/*
+	 * After a post is made, we update the database.
+	*/
+	public function postCreated($msgOptions, $topicOptions, $posterOptions)
+	{
+		global $modSettings, $smcFunc;
+
+		$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
+
+		$inserts = array();
+		foreach (text2words($msgOptions['body'], $customIndexSettings['bytes_per_word'], true) as $word)
+			$inserts[] = array($word, $msgOptions['id']);
+
+		if (!empty($inserts))
+			$smcFunc['db_insert']('ignore',
+				'{db_prefix}log_search_words',
+				array('id_word' => 'int', 'id_msg' => 'int'),
+				$inserts,
+				array('id_word', 'id_msg')
+			);
+	}
+
+	/*
+	 * After a post is modified, we update the database.
+	*/
+	public function postModified($msgOptions, $topicOptions, $posterOptions)
+	{
+		global $modSettings, $smcFunc;
+
+		$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);
+		$new_index = text2words($msgOptions['body'], $customIndexSettings['bytes_per_word'], true);
+
+		// Calculate the words to be added and removed from the index.
+		$removed_words = array_diff(array_diff($old_index, $new_index), $stopwords);
+		$inserted_words = array_diff(array_diff($new_index, $old_index), $stopwords);
+		// Delete the removed words AND the added ones to avoid key constraints.
+		if (!empty($removed_words))
+		{
+			$removed_words = array_merge($removed_words, $inserted_words);
+			$smcFunc['db_query']('', '
+				DELETE FROM {db_prefix}log_search_words
+				WHERE id_msg = {int:id_msg}
+					AND id_word IN ({array_int:removed_words})',
+				array(
+					'removed_words' => $removed_words,
+					'id_msg' => $msgOptions['id'],
+				)
+			);
+		}
+
+		// Add the new words to be indexed.
+		if (!empty($inserted_words))
+		{
+			$inserts = array();
+			foreach ($inserted_words as $word)
+				$inserts[] = array($word, $msgOptions['id']);
+			$smcFunc['db_insert']('insert',
+				'{db_prefix}log_search_words',
+				array('id_word' => 'string', 'id_msg' => 'int'),
+				$inserts,
+				array('id_word', 'id_msg')
+			);
+		}
+	}
+}

+ 4 - 3
Sources/SearchAPI-Fulltext.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -24,9 +24,9 @@ if (!defined('SMF'))
 class fulltext_search
 {
 	// This is the last version of SMF that this was tested on, to protect against API changes.
-	public $version_compatible = 'SMF 2.0';
+	public $version_compatible = 'SMF 2.1 Alpha 1';
 	// This won't work with versions of SMF less than this.
-	public $min_smf_version = 'SMF 2.0 Beta 2';
+	public $min_smf_version = 'SMF 2.1 Alpha 1';
 	// Is it supported?
 	public $is_supported = true;
 
@@ -68,6 +68,7 @@ class fulltext_search
 				return true;
 			break;
 
+			// All other methods, too bad dunno you.
 			default:
 				return false;
 			break;

+ 3 - 3
Sources/SearchAPI-Standard.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -17,10 +17,10 @@ if (!defined('SMF'))
 class standard_search
 {
 	// This is the last version of SMF that this was tested on, to protect against API changes.
-	public $version_compatible = 'SMF 2.0';
+	public $version_compatible = 'SMF 2.1 ALpha';
 
 	// This won't work with versions of SMF less than this.
-	public $min_smf_version = 'SMF 2.0 Beta 2';
+	public $min_smf_version = 'SMF 2.1 Alpha 1';
 
 	// Standard search is supported by default.
 	public $is_supported = true;

+ 1 - 2
Sources/Security.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -1113,5 +1113,4 @@ function spamProtection($error_type)
 	return false;
 }
 
-
 ?>

+ 1 - 1
Sources/SendTopic.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Session.php

@@ -14,7 +14,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 25 - 1
Sources/SplitTopics.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 // Original module by Mach8 - We'll never forget you.
@@ -813,6 +813,12 @@ function splitTopic($split1_ID_TOPIC, $splitMessages, $new_subject)
 	// Notify people that this topic has been split?
 	sendNotifications($split1_ID_TOPIC, 'split');
 
+	// If there's a search index that needs updating, update it...
+	require_once($sourcedir . '/Search.php');
+	$searchAPI = findSearchAPI();
+	if (is_callable(array($searchAPI, 'topicSplit')))
+		$searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages);
+
 	// Return the ID of the newly created topic.
 	return $split2_ID_TOPIC;
 }
@@ -1290,6 +1296,19 @@ function MergeExecute($topics = array())
 
 	$smcFunc['db_free_result']($request);
 
+	// Obtain all the message ids we are going to affect.
+	$affected_msgs = array();
+	$request = $smcFunc['db_query']('', '
+		SELECT id_msg
+		FROM {db_prefix}messages
+		WHERE id_topic IN ({array_int:topic_list})',
+		array(
+			'topic_list' => $topics,
+	));
+	while ($row = $smcFunc['db_fetch_row']($request))
+		$affected_msgs[] = $row[0];
+	$smcFunc['db_free_result']($request);
+	
 	// Assign the first topic ID to be the merged topic.
 	$id_topic = min($topics);
 
@@ -1556,6 +1575,11 @@ function MergeExecute($topics = array())
 	// Notify people that these topics have been merged?
 	sendNotifications($id_topic, 'merge');
 
+	// If there's a search index that needs updating, update it...
+	require_once($sourcedir . '/Search.php');
+	$searchAPI = findSearchAPI();
+	if (is_callable(array($searchAPI, 'topicMerge')))
+		$searchAPI->topicMerge($id_topic, $topics, $affected_msgs, empty($_POST['enforce_subject']) ? null : array($context['response_prefix'], $target_subject));
 	// Send them to the all done page.
 	redirectexit('action=mergetopics;sa=done;to=' . $id_topic . ';targetboard=' . $target_board);
 }

+ 1 - 1
Sources/Stats.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Admin.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Auth.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-BoardIndex.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Boards.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Calendar.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Categories.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 3
Sources/Subs-Charset.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -588,5 +588,3 @@ function fix_serialized_columns()
 	));
 
 }
-
-?>

+ 3 - 7
Sources/Subs-Compat.php

@@ -13,7 +13,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -292,14 +292,10 @@ if (!function_exists('session_regenerate_id'))
 // @link http://www.simplemachines.org/community/index.php?msg=2420295
 if (!function_exists('str_ireplace'))
 {
-	function str_ireplace($search, $replace, $subject)
+	function str_ireplace($search, $replace, $subject, $count = -1)
 	{
 		global $context;
 
-		// While preg_replace() has this too, it's also not in PHP 4.
-		if (func_num_args() == 4)
-			trigger_error('str_ireplace(): $count parameter not supported.', E_USER_WARNING);
-
 		// @todo Using preg should give us better Unicode support for case folding.
 		// But technically, this doesn't do the same thing that str_ireplace() does in PHP 5.
 		// Might be better to always omit the u parameter.
@@ -310,7 +306,7 @@ if (!function_exists('str_ireplace'))
 		else
 			$search = '~' . preg_quote($search, '~') . $endu;
 
-		return preg_replace($search, $replace, $subject);
+		return preg_replace($search, $replace, $subject, $count > 0 ? $count : -1);
 	}
 }
 ?>

+ 1 - 1
Sources/Subs-Db-mysql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Db-postgresql.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Db-sqlite.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Editor.php

@@ -11,7 +11,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Graphics.php

@@ -15,7 +15,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-List.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Membergroups.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Members.php

@@ -10,7 +10,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-MembersOnline.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-Menu.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-MessageIndex.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 1
Sources/Subs-OpenID.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))

+ 1 - 10
Sources/Subs-Package.php

@@ -8,7 +8,7 @@
  * @copyright 2011 Simple Machines
  * @license http://www.simplemachines.org/about/smf/license.php BSD
  *
- * @version 2.0
+ * @version 2.1 Alpha 1
  */
 
 if (!defined('SMF'))
@@ -79,7 +79,6 @@ if (!defined('SMF'))
 		- in the array returned, an xmlArray is available in 'xml'.
 
 	void packageRequireFTP(string destination_url, array files = none, bool return = false)
-		// !!!
 
 	array parsePackageInfo(xmlArray &package, bool testing_only = true,
 			string method = 'install', string previous_version = '')
@@ -126,7 +125,6 @@ if (!defined('SMF'))
 		- requires the destination to be writable.
 
 	void listtree(string path, string sub_path = none)
-		// !!!
 
 	array parseModification(string file, bool testing = true, bool undo = false, array theme_paths = array())
 		- parses a xml-style modification file (file).
@@ -142,8 +140,6 @@ if (!defined('SMF'))
 		  undone.
 		- returns an array of those changes made.
 
-	// !!!
-
 	int package_put_contents(string filename, string data)
 		- writes data to a file, almost exactly like the file_put_contents()
 		  function.
@@ -152,22 +148,17 @@ if (!defined('SMF'))
 		- returns the number of bytes written.
 
 	void package_chmod(string filename)
-		// !!!
 
 	string package_crypt(string password)
-		// !!!
 
 	string fetch_web_data(string url, string post_data = '',
 			bool keep_alive = false)
-		// !!!
 
 	Creating your own package server:
 	---------------------------------------------------------------------------
-		// !!!
 
 	Creating your own package:
 	---------------------------------------------------------------------------
-		// !!!
 */
 
 // Get the data from the file and extract it.

Some files were not shown because too many files changed in this diff