Advertisement:

Navigation

Readme

This patch file will update your forum to SMF 2.0 beta 3.1.

File Edits

./index.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
$forum_version = 'SMF 2.0 Beta 3 Public';
Replace With: [Select]
$forum_version = 'SMF 2.0 Beta 3.1 Public';
Operation #3
Find: [Select]
// Load the settings...
Replace With: [Select]
// Make sure some things simply do not exist.
foreach (array('db_character_set') as $variable)
if (isset($GLOBALS[$variable]))
unset($GLOBALS[$variable]);

// Load the settings...

Operation #4
Find: [Select]
// Determine if this is using WAP, WAP2, or imode. Technically, we should check that wap comes before application/xhtml or text/html, but this doesn't work in practice as much as it should.
Replace With: [Select]
// Seed the random generator for PHP < 4.2.0.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
smf_seed_generator();

// Determine if this is using WAP, WAP2, or imode. Technically, we should check that wap comes before application/xhtml or text/html, but this doesn't work in practice as much as it should.

./Sources/Karma.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
if (isset($topic))
Replace With: [Select]
if (!empty($topic))

./Sources/Post.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
if (isset($topic) && !empty($modSettings['topicSummaryPosts']))
getTopic();
Replace With: [Select]
if (!empty($topic) && !empty($modSettings['topicSummaryPosts']))
getTopic();

Operation #3
Find: [Select]
if (isset($topic) && !isset($_REQUEST['msg']))
fatal_lang_error('no_access', false);
Replace With: [Select]
if (!empty($topic) && !isset($_REQUEST['msg']))
fatal_lang_error('no_access', false);

./Sources/Profile-Modify.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
'label' => $txt['date_registered'],
'log_change' => true,
'permission' => 'moderate_forum',
Replace With: [Select]
'label' => $txt['date_registered'],
'log_change' => true,
'permission' => 'admin_forum',

./Sources/QueryString.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
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/Register.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
if (!isset($_POST['new_email']))
Replace With: [Select]
if (!isset($_POST['new_email']) && $row['is_activated'] != 2)

./Sources/RemoveTopic.php

Operation #1
Find: [Select]
$request = $smcFunc['db_query']('', '
SELECT t.id_member_started, ms.subject, t.approved
Replace With: [Select]
// Is $topic set?
if (empty($topic) && isset($_REQUEST['topic']))
$topic = (int) $_REQUEST['topic'];

$request = $smcFunc['db_query']('', '
SELECT t.id_member_started, ms.subject, t.approved

./Sources/Subs-Compat.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
srand(time());

if (!function_exists('md5_file'))
Replace With: [Select]
if (!function_exists('md5_file'))
Operation #3
Find: [Select]
if (!function_exists('sha1'))
{
function sha1($str)
{
return sha1_smf($str);
}
}
Replace With: [Select]
if (!function_exists('sha1'))
{
function sha1($str)
{
return sha1_smf($str);
}
}

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

./Sources/Subs-Post.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
if (!$previewing)
{
if (allowedTo('admin_forum'))
$parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'&#13;\', \' \' => \' &#32;\')) . \'[/html]\'', $parts[$i]);
// We should edit them out, or else if an admin edits the message they will get shown...
else
$parts[$i] = preg_replace('~\[[/]?html\]~i', '', $parts[$i]);
Replace With: [Select]
if (!$previewing && strpos($parts[$i], '[html]') !== false)
{
if (allowedTo('admin_forum'))
$parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'&#13;\', \' \' => \' &#32;\')) . \'[/html]\'', $parts[$i]);
// We should edit them out, or else if an admin edits the message they will get shown...
else
{
while (strpos($parts[$i], '[html]') !== false)
$parts[$i] = preg_replace('~\[[/]?html\]~i', '', $parts[$i]);
}

./Sources/Subs-Sound.php

Operation #1
Find: [Select]
* Software Version: SMF 2.0 Beta 3 Public *
Replace With: [Select]
* Software Version: SMF 2.0 Beta 3.1 Public *
Operation #2
Find: [Select]
global $settings, $user_info, $context;
Replace With: [Select]
global $settings, $user_info, $context;

// Allow max 2 requests per 20 seconds.
if (($ip = cache_get_data('wave_file/' . $user_info['ip'], 20)) > 2 || ($ip2 = cache_get_data('wave_file/' . $user_info['ip2'], 20)) > 2)
die(header('HTTP/1.1 400 Bad Request'));
cache_put_data('wave_file/' . $user_info['ip'], $ip ? $ip + 1 : 1, 20);
if (!empty($user_info['ip2']) && $user_info['ip2'] != $user_info['ip'])
cache_put_data('wave_file/' . $user_info['ip2'], $ip2 ? $ip2 + 1 : 1, 20);

// Fixate randomization for this word.
srand(end(unpack('n', md5($word . session_id()))));

Operation #3
Find: [Select]
$sound_word .= substr($sound_letter, strpos($sound_letter, 'data') + 8) . str_repeat(chr(0x80), rand(700, 710) * 8);
}

// The .wav header.
$sound_header = array(
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
0x40, 0x1F, 0x00, 0x00, 0x40, 0x1F, 0x00, 0x00,
0x01, 0x00, 0x08, 0x00, 0x64, 0x61, 0x74, 0x61,
);

$data_size = strlen($sound_word);
$file_size = $data_size + 0x24;

// Add a little randomness.
for ($i = 0; $i < $data_size; $i += rand(1, 10))
$sound_word{$i} = chr(ord($sound_word{$i}) + rand(-1, 1));

// Output the wav.
header('Content-type: audio/x-wav');
if (empty($context['browser']['is_ie']))
header('Content-Length: ' . $file_size);
echo 'RIFF', chr($file_size & 0xFF), chr(($file_size & 0xFF00) >> 8), chr(($file_size & 0xFF0000) >> 16), chr(($file_size & 0xFF000000) >> 24), 'WAVEfmt ';
foreach ($sound_header as $char)
echo chr($char);
echo chr($data_size & 0xFF), chr(($data_size & 0xFF00) >> 8), chr(($data_size & 0xFF0000) >> 16), chr(($data_size & 0xFF000000) >> 24), $sound_word;
Replace With: [Select]

$sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8);
switch ($word{$i} === 's' ? 0 : rand(0, 2))
{
case 0:
for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
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)));
break;

case 1:
for ($j = 0, $n = strlen($sound_letter) - 1; $j < $n; $j += 2)
$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} : '');
$sound_word .= str_repeat($sound_letter{$n}, 2);
break;

case 2:
$shift = 0;
for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
{
if (rand(0, 10) === 0)
$shift += rand(-3, 3);
for ($k = 0, $m = round(rand(15, 25) / 10); $k < $m; $k++)
$sound_word .= chr(min(max(ord($sound_letter{$j}) + $shift, 0x00), 0xFF));
}
break;

}

$sound_word .= str_repeat(chr(0x80), rand(10000, 10500));
}

$data_size = strlen($sound_word);
$file_size = $data_size + 0x24;
$sample_rate = 16000;

// Disable compression.
ob_end_clean();
header('Content-Encoding: none');

// Output the wav.
header('Content-type: audio/x-wav');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
header('Content-Length: ' . ($file_size + 0x08));

echo pack('nnVnnnnnnnnVVnnnnV', 0x5249, 0x4646, $file_size, 0x5741, 0x5645, 0x666D, 0x7420, 0x1000, 0x0000, 0x0100, 0x0100, $sample_rate, $sample_rate, 0x0100, 0x0800, 0x6461, 0x7461, $data_size), $sound_word;