Update to SMF 2.0.2 - Installation Instructions for 2.0.1

Update to SMF 2.0.2
This patch file will provide security and bug fixes to your SMF 2.0.1 forum.

File Edits ALT + Click to collapse all the operations

./index.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.1
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
$forum_version = 'SMF 2.0.1';
Replace With: Select
$forum_version = 'SMF 2.0.2';
Find: Select
if (isset($GLOBALS[$variable]))
unset($GLOBALS[$variable]);
Replace With: Select
if (isset($GLOBALS[$variable]))
unset($GLOBALS[$variable], $GLOBALS[$variable]);

./Sources/Packages.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
global $txt, $scripturl, $context, $sourcedir, $modSettings;

if (isset($_POST['submit']))
Replace With: Select
global $txt, $scripturl, $context, $sourcedir, $modSettings, $smcFunc;

if (isset($_POST['submit']))
Find: Select
updateSettings(array(
'package_server' => $_POST['pack_server'],
'package_port' => $_POST['pack_port'],
'package_username' => $_POST['pack_user'],
'package_make_backups' => !empty($_POST['package_make_backups'])
));
Replace With: Select
updateSettings(array(
'package_server' => trim($smcFunc['htmlspecialchars']($_POST['pack_server'])),
'package_port' => trim($smcFunc['htmlspecialchars']($_POST['pack_port'])),
'package_username' => trim($smcFunc['htmlspecialchars']($_POST['pack_user'])),
'package_make_backups' => !empty($_POST['package_make_backups'])
));

./Sources/Memberlist.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
'down' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) ASC, real_name ASC' : 'IF(mem.show_online, IFNULL(lo.log_time, 1), 1) ASC, real_name ASC',
'up' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) DESC, real_name DESC' : 'IF(mem.show_online, IFNULL(lo.log_time, 1), 1) DESC, real_name DESC'
Replace With: Select
'down' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) ASC, real_name ASC' : 'CASE WHEN mem.show_online THEN IFNULL(lo.log_time, 1) ELSE 1 END ASC, real_name ASC',
'up' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) DESC, real_name DESC' : 'CASE WHEN mem.show_online THEN IFNULL(lo.log_time, 1) ELSE 1 END DESC, real_name DESC'

./subscriptions.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
// Start things rolling by getting SMF alive...
if (!file_exists(dirname(__FILE__) . '/SSI.php'))
Replace With: Select
// Start things rolling by getting SMF alive...
$ssi_guest_access = true;
if (!file_exists(dirname(__FILE__) . '/SSI.php'))

./Sources/Profile-Modify.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
if (isset($context[\'profile_languages\'][$value]))
{
if ($context[\'user\'][\'is_owner\'])
Replace With: Select
if (isset($context[\'profile_languages\'][$value]))
{
if ($context[\'user\'][\'is_owner\'] && empty($context[\'password_auth_failed\']))

./Sources/Load.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.1
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
// If it is detected as a robot, and we are restricting permissions as a special group - then implement this.
$spider_restrict = $user_info['possibly_robot'] && !empty($modSettings['spider_group']) ? ' OR (id_group = {int:spider_group} && add_deny = 0)' : '';
Replace With: Select
// If it is detected as a robot, and we are restricting permissions as a special group - then implement this.
$spider_restrict = $user_info['possibly_robot'] && !empty($modSettings['spider_group']) ? ' OR (id_group = {int:spider_group} AND add_deny = 0)' : '';

./Sources/Who.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
}

// Does the user prefer a different sort direction?
Replace With: Select
}
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?

./Sources/ManagePaid.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
<div class="floatleft">
<input type="submit" name="add" value="' . $txt['paid_add_subscription'] . '" class="button_submit" />
</div>
Replace With: Select
<div class="floatleft">
<input type="submit" name="add" value="' . $txt['add_subscriber'] . '" class="button_submit" />
</div>

./Themes/core/PersonalMessage.template.php

This operation isn't vital to the installation of this mod.
Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
This operation isn't vital to the installation of this mod.
Find: Select
<li><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';
Replace With: Select
<li><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $message['member']['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a></li>';

./Sources/MessageIndex.php

Find: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0
Replace With: Select
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.2
Find: Select
$context['unapproved_posts_message'] = sprintf($txt['there_are_unapproved_topics'], $untopics, $unposts, $scripturl . '?action=moderate;area=postmod;sa=' . ($board_info['unapproved_topics'] ? 'topics' : 'posts') . ';brd=' . $board);
}

// Make sure the starting place makes sense and construct the page index.
Replace With: Select
$context['unapproved_posts_message'] = sprintf($txt['there_are_unapproved_topics'], $untopics, $unposts, $scripturl . '?action=moderate;area=postmod;sa=' . ($board_info['unapproved_topics'] ? 'topics' : 'posts') . ';brd=' . $board);
}

// We only know these.
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post')))
$_REQUEST['sort'] = 'last_post';

// Make sure the starting place makes sense and construct the page index.
Advertisement: