Update to SMF 1.0.13 - Installation Instructions for 1.0.12

Update to SMF 1.0.13
This patch file will update your forum to SMF 1.0.13.

File Edits ALT + Click to collapse all the operations

./index.php

Find: Select
* Software Version: SMF 1.0.12 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
$forum_version = 'SMF 1.0.12';
Replace With: Select
$forum_version = 'SMF 1.0.13';
Find: Select
// Determine if this is should be using WAP, WAP2, or imode.
Replace With: Select
// Seed the random generator for PHP < 4.2.0.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
{
if (empty($modSettings['rand_seed']))
{
$modSettings['rand_seed'] = microtime() * 1000000;
updateSettings(array('rand_seed' => $modSettings['rand_seed']));
}
$seed = ($modSettings['rand_seed'] + ((double) microtime() * 1000003)) & 0x7fffffff;
srand($seed);
// Change the seed?
if (rand(1, 250) == 69)
updateSettings(array('rand_seed' => rand()));
}

// Determine if this is should be using WAP, WAP2, or imode.

./Sources/Calendar.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
if (!isset($board))
fatal_lang_error('calendar38', false);
if (!isset($topic))
fatal_lang_error('calendar39', false);
Replace With: Select
if (empty($board))
fatal_lang_error('calendar38', false);
if (empty($topic))
fatal_lang_error('calendar39', false);

./Sources/Karma.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
// Figure out where to go back to.... the topic?
if (isset($topic))
Replace With: Select
// Figure out where to go back to.... the topic?
if (!empty($topic))

./Sources/ManageBoards.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
db_query("
INSERT IGNORE INTO {$db_prefix}board_permissions
(ID_BOARD, ID_GROUP, permission, addDeny)
VALUES
(" . implode('), (', $boardPerms) . ")", __FILE__, __LINE__);
Replace With: Select
if (!empty($boardPerms))
db_query("
INSERT IGNORE INTO {$db_prefix}board_permissions
(ID_BOARD, ID_GROUP, permission, addDeny)
VALUES
(" . implode('), (', $boardPerms) . ")", __FILE__, __LINE__);

./Sources/ManageMembers.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['display_name'] . '</a>'
Replace With: Select
'link' => empty($row['ID_MEMBER']) ? $row['display_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['display_name'] . '</a>'

./Sources/Post.php

Find: Select
* Software Version: SMF 1.0.12 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
if (isset($topic))
getTopic();
Replace With: Select
if (!empty($topic))
getTopic();
Find: Select
if (isset($topic) && !isset($_REQUEST['msg']))
fatal_lang_error(1, false);
Replace With: Select
if (!empty($topic) && !isset($_REQUEST['msg']))
fatal_lang_error(1, false);

./Sources/Profile.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
if (!empty($_POST['dateRegistered']) && allowedTo('moderate_forum'))
Replace With: Select
if (!empty($_POST['dateRegistered']) && allowedTo('admin_forum'))

./Sources/QueryString.php

Find: Select
* Software Version: SMF 1.0.12 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
if (get_magic_quotes_gpc() != 0)
$_GET = stripslashes__recursive($_GET);
Replace With: Select
if (@get_magic_quotes_gpc() != 0)
$_GET = stripslashes__recursive($_GET);
Find: Select
if (get_magic_quotes_gpc() == 0)
Replace With: Select
if (@get_magic_quotes_gpc() == 0)
Find: Select
// Now make sure the online log gets the right number.
$_GET['topic'] = $topic;
}
Replace With: Select
// Now make sure the online log gets the right number.
$_GET['topic'] = $topic;
}
else
$topic = 0;

./Sources/Security.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.13 *
Find: Select
// Load the Login template and language file.
loadTemplate('Login');
loadLanguage('Login');
Replace With: Select
// Load the Login template and language file.
loadLanguage('Login');

// Are we in wireless mode?
if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL . '_login';
else
{
loadTemplate('Login');
$context['sub_template'] = 'kick_guest';
}

./Sources/Subs-Package.php

Find: Select
if ($crc['crc32'] != crc32($data))
Replace With: Select
if ($crc['crc32'] != smf_crc32($data))
Find: Select
fclose($this->connection);

return true;
}
}
Replace With: Select
fclose($this->connection);

return true;
}
}

// crc32 doesn't work as expected on 64-bit functions - make our own.
// http://www.php.net/crc32#79567
if (!function_exists('smf_crc32'))
{
function smf_crc32($number)
{
$crc = crc32($number);

if($crc & 0x80000000){
$crc ^= 0xffffffff;
$crc += 1;
$crc = -$crc;
}

return $crc;
}
}

./Sources/ManageAttachments.php

This operation isn't vital to the installation of this mod.
Find: Select

'id' => $row['ID_ATTACH'],
'size' => round($row['filesize'] / 1024, 2),
'name' => htmlspecialchars($row['filename']),
'downloads' => $row['downloads'],
'href' => $row['attachmentType'] == 1 ? $modSettings['custom_avatar_url'] . '/' . $row['filename'] : ($scripturl . '?action=dlattach;' . ($context['browse_type'] == 'avatars' ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH']),
'link' => '<a href="' . ($row['attachmentType'] == 1 ? $modSettings['custom_avatar_url'] . '/' . $row['filename'] : ($scripturl . '?action=dlattach;' . ($context['browse_type'] == 'avatars' ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'])) . '"' . (empty($row['width']) || empty($row['height']) ? '' : ' onclick="return reqWin(this.href + \';image\', ' . ($row['width'] + 20) . ', ' . ($row['height'] + 20) . ', true);"') . '>' . htmlspecialchars($row['filename']) . '</a>'
Replace With: Select

'id' => $row['ID_ATTACH'],
'size' => round($row['filesize'] / 1024, 2),
'name' => htmlspecialchars($row['filename']),
'downloads' => $row['downloads'],
'href' => $scripturl . '?action=dlattach;' . ($context['browse_avatars'] ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'],
'link' => '<a href="' . $scripturl . '?action=dlattach;' . ($context['browse_avatars'] ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'] . '">' . htmlspecialchars($row['filename']) . '</a>'
This operation isn't vital to the installation of this mod.
Find: Select

'id' => $row['ID_ATTACH'],
'size' => round($row['filesize'] / 1024, 2),
'name' => $row['filename'],
'downloads' => $row['downloads'],
'href' => $scripturl . '?action=dlattach;' . ($context['browse_avatars'] ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'],
'link' => '<a href="' . $scripturl . '?action=dlattach;' . ($context['browse_avatars'] ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'] . '">' . $row['filename'] . '</a>'
Replace With: Select

'id' => $row['ID_ATTACH'],
'size' => round($row['filesize'] / 1024, 2),
'name' => htmlspecialchars($row['filename']),
'downloads' => $row['downloads'],
'href' => $scripturl . '?action=dlattach;' . ($context['browse_avatars'] ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'],
'link' => '<a href="' . $scripturl . '?action=dlattach;' . ($context['browse_avatars'] ? 'type=avatar;' : 'topic=' . $row['ID_TOPIC'] . '.0;') . 'id=' . $row['ID_ATTACH'] . '">' . htmlspecialchars($row['filename']) . '</a>'
Advertisement: