Update to SMF 1.1.6 - Installation Instructions for 1.1.5

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

File Edits ALT + Click to collapse all the operations

./index.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$forum_version = 'SMF 1.1.5';
Replace With: Select
$forum_version = 'SMF 1.1.6';
Find: Select
// Seed the random generator for PHP < 4.2.0.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
Replace With: Select
// Seed the random generator?
if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
Find: Select
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', '.xml', 'verificationcode'))))
Replace With: Select
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', '.xml', 'verificationcode'))))

./Sources/Admin.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
function Admin()
{
global $sourcedir, $db_prefix, $forum_version, $txt, $scripturl, $context, $modSettings;
global $user_info, $_PHPA, $boardurl;
Replace With: Select
function Admin()
{
global $sourcedir, $db_prefix, $forum_version, $txt, $scripturl, $context, $modSettings;
global $user_info, $_PHPA, $boardurl, $memcached;
Find: Select
$request = db_query("
SELECT VERSION()", __FILE__, __LINE__);
list ($context['current_versions']['mysql']['version']) = mysql_fetch_row($request);
mysql_free_result($request);
Replace With: Select
$request = db_query("
SELECT VERSION()", __FILE__, __LINE__);
list ($context['current_versions']['mysql']['version']) = mysql_fetch_row($request);
mysql_free_result($request);

// If we're using memcache we need the server info.
if (empty($memcached) && function_exists('memcache_get') && isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '')
get_memcached_server();
Find: Select
$context['current_versions']['memcache'] = array('title' => 'Memcached', 'version' => memcache_get_version());
Replace With: Select
$context['current_versions']['memcache'] = array('title' => 'Memcached', 'version' => empty($memcached) ? '???' : memcache_get_version($memcached));

./Sources/Load.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$_REQUEST[session_name()] = md5(md5('smf_sess_' . time()) . rand());
$_GET[session_name()] = md5(md5('smf_sess_' . time()) . rand());
$_POST[session_name()] = md5(md5('smf_sess_' . time()) . rand());
Replace With: Select
$_REQUEST[session_name()] = md5(md5('smf_sess_' . time()) . mt_rand());
$_GET[session_name()] = md5(md5('smf_sess_' . time()) . mt_rand());
$_POST[session_name()] = md5(md5('smf_sess_' . time()) . mt_rand());
Find: Select
// While PHP 4.1.x should use $_SESSION, it seems to need this to do it right.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
$HTTP_SESSION_VARS['php_412_bugfix'] = true;

// Set the randomly generated code.
if (!isset($_SESSION['rand_code']))
$_SESSION['rand_code'] = md5(session_id() . rand());
$sc = $_SESSION['rand_code'];
Replace With: Select
// Set the randomly generated code.
if (!isset($_SESSION['rand_code']))
$_SESSION['rand_code'] = md5(session_id() . mt_rand() . (string) microtime() . $modSettings['rand_seed']);
$sc = $_SESSION['rand_code'];

// While PHP 4.1.x should use $_SESSION, it seems to need this to do it right. Also reseed the random generator.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
{
$HTTP_SESSION_VARS['php_412_bugfix'] = true;
mt_srand((float) microtime() * 10000010 + $modSettings['rand_seed']);
}
else
mt_srand();
Find: Select
// eAccelerator...
elseif (function_exists('eaccelerator_put'))
{
if (rand(0, 10) == 1)
Replace With: Select
// eAccelerator...
elseif (function_exists('eaccelerator_put'))
{
if (mt_rand(0, 10) == 1)
Find: Select
// Turck MMCache?
elseif (function_exists('mmcache_put'))
{
if (rand(0, 10) == 1)
Replace With: Select
// Turck MMCache?
elseif (function_exists('mmcache_put'))
{
if (mt_rand(0, 10) == 1)

./Sources/LogInOut.php

Find: Select
* Software Version: SMF 1.1.3 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$user_settings['passwordSalt'] = substr(md5(rand()), 0, 4);
updateMemberData($ID_MEMBER, array('passwordSalt' => '\'' . $user_settings['passwordSalt'] . '\''));
Replace With: Select
$user_settings['passwordSalt'] = substr(md5(mt_rand()), 0, 4);
updateMemberData($ID_MEMBER, array('passwordSalt' => '\'' . $user_settings['passwordSalt'] . '\''));
Find: Select
$user_settings['passwd'] = $sha_passwd;
$user_settings['passwordSalt'] = substr(md5(rand()), 0, 4);
Replace With: Select
$user_settings['passwd'] = $sha_passwd;
$user_settings['passwordSalt'] = substr(md5(mt_rand()), 0, 4);
Find: Select
$user_settings['passwordSalt'] = substr(md5(rand()), 0, 4);
updateMemberData($user_settings['ID_MEMBER'], array('passwordSalt' => '\'' . $user_settings['passwordSalt'] . '\''));
Replace With: Select
$user_settings['passwordSalt'] = substr(md5(mt_rand()), 0, 4);
updateMemberData($user_settings['ID_MEMBER'], array('passwordSalt' => '\'' . $user_settings['passwordSalt'] . '\''));

./Sources/ManageMembers.php

Find: Select
* Software Version: SMF 1.1 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
"$txt[admin_approve_accept_desc] $txt[719] $member[name]\n\n" .
Replace With: Select
"$txt[admin_approve_accept_desc] $txt[719] $member[username]\n\n" .
Find: Select
// We have to do this for each member I'm afraid.
foreach ($member_info as $member)
{
// Generate a random activation code.
$validation_code = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);
Replace With: Select
require_once($sourcedir . '/Subs-Members.php');

// We have to do this for each member I'm afraid.
foreach ($member_info as $member)
{
// Generate a random activation code.
$validation_code = generateValidationCode();

./Sources/ManageRegistration.php

Find: Select
* Software Version: SMF 1.1.2 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());
Replace With: Select
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(mt_rand());

./Sources/PersonalMessage.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$context['visual_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());

// Skip I, J, L, O, Q, S and Z.
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z'));

// Generate a new code.
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 5; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
}
Replace With: Select
$context['visual_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(mt_rand());

// Skip I, J, L, O, Q, S and Z.
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z'));

// Generate a new code.
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 5; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
}
Find: Select
// Check whether we need to show the code again.
$context['visual_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());
}
Replace With: Select
// Check whether we need to show the code again.
$context['visual_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(mt_rand());
}

./Sources/Profile.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$validationCode = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);
Replace With: Select
require_once($sourcedir . '/Subs-Members.php');
$validationCode = generateValidationCode();
Find: Select
// Get some totals for pagination.
$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}messages
WHERE posterIP $dbip", __FILE__, __LINE__);
Replace With: Select
// Get some totals for pagination.
$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}messages AS m
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
WHERE $user_info[query_see_board]
AND m.posterIP $dbip", __FILE__, __LINE__);
Find: Select
// !!!SLOW This query is using a filesort.
$request = db_query("
SELECT
m.ID_MSG, m.posterIP, IFNULL(mem.realName, m.posterName) AS display_name, mem.ID_MEMBER,
m.subject, m.posterTime, m.ID_TOPIC, m.ID_BOARD
FROM {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.posterIP $dbip
ORDER BY m.ID_MSG DESC
LIMIT $context[message_start], 20", __FILE__, __LINE__);
Replace With: Select
// !!!SLOW This query is using a filesort.
$request = db_query("
SELECT
m.ID_MSG, m.posterIP, IFNULL(mem.realName, m.posterName) AS display_name, mem.ID_MEMBER,
m.subject, m.posterTime, m.ID_TOPIC, m.ID_BOARD
FROM {$db_prefix}messages AS m
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE $user_info[query_see_board]
AND m.posterIP $dbip
ORDER BY m.ID_MSG DESC
LIMIT $context[message_start], 20", __FILE__, __LINE__);

./Sources/Register.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());
Replace With: Select
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(mt_rand());
Find: Select
$regOptions['theme_vars'] = isset($_POST['options']) && is_array($_POST['options']) ? $_POST['options'] : array();
Replace With: Select
$regOptions['theme_vars'] = isset($_POST['options']) && is_array($_POST['options']) ? htmlspecialchars__recursive($_POST['options']) : array();
Find: Select
$context['verificiation_sound_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand()) . ';format=.wav';
Replace With: Select
$context['verificiation_sound_href'] = $scripturl . '?action=verificationcode;rand=' . md5(mt_rand()) . ';format=.wav';

./Sources/Reminder.php

Find: Select
* Software Version: SMF 1.1.2 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
// Randomly generate a new password, with only alpha numeric characters that is a max length of 10 chars.
$password = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);
Replace With: Select
// Randomly generate a new password, with only alpha numeric characters that is a max length of 10 chars.
require_once($sourcedir . '/Subs-Members.php');
$password = generateValidationCode();

./Sources/Security.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
// Use the kick_guest sub template...
$context['kick_message'] = $message;
$context['sub_template'] = 'kick_guest';
$context['page_title'] = $txt[34];
Replace With: Select
// Use the kick_guest sub template...
$context['kick_message'] = $message;
$context['page_title'] = $txt[34];
Find: Select
$context['form_sequence_number'] = 0;
while (empty($context['form_sequence_number']) || in_array($context['form_sequence_number'], $_SESSION['forms']))
$context['form_sequence_number'] = rand(1, 16000000);
Replace With: Select
$context['form_sequence_number'] = 0;
while (empty($context['form_sequence_number']) || in_array($context['form_sequence_number'], $_SESSION['forms']))
$context['form_sequence_number'] = mt_rand(1, 16000000);
Find: Select
// Don't check, just free the stack number.
elseif ($action == 'free' && isset($_REQUEST['seqnum']) && in_array($_REQUEST['seqnum'], $_SESSION['forms']))
Replace With: Select
// Don't check, just free the stack number.
elseif ($action == 'free' && isset($_REQUEST['seqnum']) && in_array($_REQUEST['seqnum'], $_SESSION['forms']))

./Sources/SplitTopics.php

Find: Select
* Software Version: SMF 1.1.2 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$_REQUEST['targetboard'] = isset($_REQUEST['targetboard']) ? (int) $_REQUEST['targetboard'] : $board;
$context['target_board'] = $_REQUEST['targetboard'];
Replace With: Select
$_REQUEST['targetboard'] = isset($_REQUEST['targetboard']) ? (int) $_REQUEST['targetboard'] : $board;
$context['target_board'] = $_REQUEST['targetboard'];

if (!isset($_GET['from']))
fatal_lang_error(1);
$_GET['from'] = (int) $_GET['from'];
Find: Select
// Handle URLs from MergeIndex.
if (!empty($_GET['from']) && !empty($_GET['to']))
$topics = array($_GET['from'], $_GET['to']);
Replace With: Select
// Handle URLs from MergeIndex.
if (!empty($_GET['from']) && !empty($_GET['to']))
$topics = array((int) $_GET['from'], (int) $_GET['to']);
Find: Select
// Make sure the template knows everything...
$context['target_board'] = $_GET['targetboard'];
$context['target_topic'] = $_GET['to'];
Replace With: Select
// Make sure the template knows everything...
$context['target_board'] = (int) $_GET['targetboard'];
$context['target_topic'] = (int) $_GET['to'];

./Sources/Stats.php

Find: Select
* Software Version: SMF 1.1 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
// Topic poster top 10.
$members_result = db_query("
SELECT ID_MEMBER, realName
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', array_keys($members)) . ")
GROUP BY ID_MEMBER
ORDER BY FIND_IN_SET(ID_MEMBER, '" . implode(',', array_keys($members)) . "')
LIMIT 10", __FILE__, __LINE__);
Replace With: Select
// Topic poster top 10.
$members_result = db_query("
SELECT ID_MEMBER, realName
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', array_keys($members)) . ")
ORDER BY FIND_IN_SET(ID_MEMBER, '" . implode(',', array_keys($members)) . "')
LIMIT 10", __FILE__, __LINE__);
Find: Select
$out .= "Content-Length: $length\r\n\r\n";
$out .= "$stats_to_send\r\n";
$out .= "Connection: Close\r\n\r\n";
Replace With: Select
$out .= "Content-Length: $length\r\n\r\n";
$out .= "$stats_to_send\r\n";
$out .= "Connection: Close\r\n\r\n";

./Sources/Subs.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$context['random_news_line'] = $context['news_lines'][rand(0, count($context['news_lines']) - 1)];
Replace With: Select
$context['random_news_line'] = $context['news_lines'][mt_rand(0, count($context['news_lines']) - 1)];
Find: Select
// Naughty, naughty.
if (rand(0, 2) == 1)
Replace With: Select
// Naughty, naughty.
if (mt_rand(0, 2) == 1)
Find: Select
// Try the Linux host command, perhaps?
if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && rand(0, 1) == 1)
Replace With: Select
// Try the Linux host command, perhaps?
if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && mt_rand(0, 1) == 1)
Find: Select
// This is nslookup; usually only Windows, but possibly some Unix?
if (!isset($host) && strpos(strtolower(PHP_OS), 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && rand(0, 1) == 1)
Replace With: Select
// This is nslookup; usually only Windows, but possibly some Unix?
if (!isset($host) && strpos(strtolower(PHP_OS), 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && mt_rand(0, 1) == 1)
Find: Select

?>
Replace With: Select
// Generate a random seed and ensure it's stored in settings.
function smf_seed_generator()
{
global $modSettings;

// Never existed?
if (empty($modSettings['rand_seed']))
{
$modSettings['rand_seed'] = microtime() * 1000000;
updateSettings(array('rand_seed' => $modSettings['rand_seed']));
}

if (@version_compare(PHP_VERSION, '4.2.0') == -1)
{
$seed = ($modSettings['rand_seed'] + ((double) microtime() * 1000003)) & 0x7fffffff;
mt_srand($seed);
}

// Change the seed.
updateSettings(array('rand_seed' => mt_rand()));
}

?>

./Sources/Subs-Auth.php

Find: Select
* Software Version: SMF 1.1.3 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
session_id(strtolower(md5(uniqid(rand(), true))));
Replace With: Select
session_id(strtolower(md5(uniqid(mt_rand(), true))));
Find: Select
// Generate a random password.
$newPassword = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);
$newPassword_sha1 = sha1(strtolower($user) . $newPassword);
Replace With: Select
// Generate a random password.
require_once($sourcedir . '/Subs-Members.php');
$newPassword = generateValidationCode();
$newPassword_sha1 = sha1(strtolower($user) . $newPassword);

./Sources/Subs-Compat.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
// Make sure random means random.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
{
function smf_seed_generator()
{
global $modSettings;

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()));
}
}

?>
Replace With: Select

?>

./Sources/Subs-Graphics.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$foreground_color[$i] = rand(max($foreground_color[$i] - 3, 0), min($foreground_color[$i] + 3, 255));
Replace With: Select
$foreground_color[$i] = mt_rand(max($foreground_color[$i] - 3, 0), min($foreground_color[$i] + 3, 255));
Find: Select
$dotbgcolor[$i] = $background_color[$i] < $foreground_color[$i] ? rand(0, max($foreground_color[$i] - 20, 0)) : rand(min($foreground_color[$i] + 20, 255), 255);
Replace With: Select
$dotbgcolor[$i] = $background_color[$i] < $foreground_color[$i] ? mt_rand(0, max($foreground_color[$i] - 20, 0)) : mt_rand(min($foreground_color[$i] + 20, 255), 255);
Find: Select
$angle = rand(-100, 100) / ($rotationType == 'high' ? 6 : 10);
Replace With: Select
$angle = mt_rand(-100, 100) / ($rotationType == 'high' ? 6 : 10);
Find: Select
$new_index = rand(0, count($colours) - 1);
Replace With: Select
$new_index = mt_rand(0, count($colours) - 1);
Find: Select
$char_fg_color = array(rand(max($foreground_color[0] - 2, 0), $foreground_color[0]), rand(max($foreground_color[1] - 2, 0), $foreground_color[1]), rand(max($foreground_color[2] - 2, 0), $foreground_color[2]));
Replace With: Select
$char_fg_color = array(mt_rand(max($foreground_color[0] - 2, 0), $foreground_color[0]), mt_rand(max($foreground_color[1] - 2, 0), $foreground_color[1]), mt_rand(max($foreground_color[2] - 2, 0), $foreground_color[2]));
Find: Select
$font_size = $gd2 ? rand(17, 19) : rand(18, 25);
Replace With: Select
$font_size = $gd2 ? mt_rand(17, 19) : mt_rand(18, 25);
Find: Select
$font_y = $max_height - ($fontVerPos == 'vrandom' ? rand(2, 8) : ($fontVerPos == 'random' ? rand(3, 5) : 5));
Replace With: Select
$font_y = $max_height - ($fontVerPos == 'vrandom' ? mt_rand(2, 8) : ($fontVerPos == 'random' ? mt_rand(3, 5) : 5));
Find: Select
$fontface = $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[rand(0, count($ttfont_list) - 1)];
Replace With: Select
$fontface = $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[mt_rand(0, count($ttfont_list) - 1)];
Find: Select
$is_reverse = $showReverseChars ? rand(0, 1) : false;
Replace With: Select
$is_reverse = $showReverseChars ? mt_rand(0, 1) : false;
Find: Select
$rotated_char = imagerotate($char_image, rand(-100, 100) / 10, $char_bgcolor);
Replace With: Select
$rotated_char = imagerotate($char_image, mt_rand(-100, 100) / 10, $char_bgcolor);
Find: Select
for ($i = rand(0, 2); $i < $max_height; $i += rand(1, 2))
for ($j = rand(0, 10); $j < $total_width; $j += rand(1, 15))
imagesetpixel($code_image, $j, $i, rand(0, 1) ? $fg_color : $randomness_color);
Replace With: Select
for ($i = mt_rand(0, 2); $i < $max_height; $i += mt_rand(1, 2))
for ($j = mt_rand(0, 10); $j < $total_width; $j += mt_rand(1, 15))
imagesetpixel($code_image, $j, $i, mt_rand(0, 1) ? $fg_color : $randomness_color);
Find: Select
if (rand(0, 1))
{
$x1 = rand(0, $total_width);
$x2 = rand(0, $total_width);
$y1 = 0; $y2 = $max_height;
}
else
{
$y1 = rand(0, $max_height);
$y2 = rand(0, $max_height);
$x1 = 0; $x2 = $total_width;
}

imageline($code_image, $x1, $y1, $x2, $y2, rand (0, 1) ? $fg_color : $randomness_color);
Replace With: Select
if (mt_rand(0, 1))
{
$x1 = mt_rand(0, $total_width);
$x2 = mt_rand(0, $total_width);
$y1 = 0; $y2 = $max_height;
}
else
{
$y1 = mt_rand(0, $max_height);
$y2 = mt_rand(0, $max_height);
$x1 = 0; $x2 = $total_width;
}

imageline($code_image, $x1, $y1, $x2, $y2, mt_rand(0, 1) ? $fg_color : $randomness_color);

./Sources/Subs-Members.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
$validation_code = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);
Replace With: Select
$validation_code = generateValidationCode();
Find: Select
srand(time() + 1277);
$regOptions['password'] = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);
Replace With: Select
mt_srand(time() + 1277);
$regOptions['password'] = generateValidationCode();
Find: Select
'passwordSalt' => '\'' . substr(md5(rand()), 0, 4) . '\'',
Replace With: Select
'passwordSalt' => '\'' . substr(md5(mt_rand()), 0, 4) . '\'',
Find: Select

?>
Replace With: Select
// Generate a random validation code.
function generateValidationCode()
{
global $modSettings;

$request = db_query('
SELECT RAND()', __FILE__, __LINE__);

list ($dbRand) = mysql_fetch_row($request);
mysql_free_result($request);

return substr(preg_replace('/\W/', '', sha1(microtime() . mt_rand() . $dbRand . $modSettings['rand_seed'])), 0, 10);
}

?>

./Sources/Subs-Sound.php

Find: Select
* Software Version: SMF 1.1.5 *
Replace With: Select
* Software Version: SMF 1.1.6 *
Find: Select
srand(end(unpack('n', md5($word . session_id()))));
Replace With: Select
mt_srand(end(unpack('n', md5($word . session_id()))));
Find: Select
switch ($word{$i} === 's' ? 0 : rand(0, 2))
Replace With: Select
switch ($word{$i} === 's' ? 0 : mt_rand(0, 2))
Find: Select
for ($k = 0, $m = round(rand(15, 25) / 10); $k < $m; $k++)
$sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF)));
Replace With: Select
for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
$sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF)));
Find: Select
$sound_word .= (rand(0, 3) == 0 ? '' : $sound_letter{$j}) . (rand(0, 3) === 0 ? $sound_letter{$j + 1} : $sound_letter{$j}) . (rand(0, 3) === 0 ? $sound_letter{$j} : $sound_letter{$j + 1}) . $sound_letter{$j + 1} . (rand(0, 3) == 0 ? $sound_letter{$j + 1} : '');
Replace With: Select
$sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j + 1} : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j} : $sound_letter{$j + 1}) . $sound_letter{$j + 1} . (mt_rand(0, 3) == 0 ? $sound_letter{$j + 1} : '');
Find: Select
if (rand(0, 10) === 0)
$shift += rand(-3, 3);
for ($k = 0, $m = round(rand(15, 25) / 10); $k < $m; $k++)
Replace With: Select
if (mt_rand(0, 10) === 0)
$shift += mt_rand(-3, 3);
for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
Find: Select
$sound_word .= str_repeat(chr(0x80), rand(10000, 10500));
Replace With: Select
$sound_word .= str_repeat(chr(0x80), mt_rand(10000, 10500));

./SSI.php

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

* Software Version: SMF 1.1.5 *
Replace With: Select

* Software Version: SMF 1.1.6 *
This operation isn't vital to the installation of this mod.
Find: Select

// Load installed 'Mods' settings.
reloadSettings();
// Clean the request variables.
cleanRequest();
Replace With: Select

// Load installed 'Mods' settings.
reloadSettings();
// Clean the request variables.
cleanRequest();

// Seed the random generator?
if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
smf_seed_generator();
Advertisement: