* Software Version: SMF 2.0 Beta 3 Public *
* Software Version: SMF 2.0 Beta 3.1 Public *
$forum_version = 'SMF 2.0 Beta 3 Public';
$forum_version = 'SMF 2.0 Beta 3.1 Public';
// Load the settings...
// 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...
// 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.
// 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.
* Software Version: SMF 2.0 Beta 3 Public *
* Software Version: SMF 2.0 Beta 3.1 Public *
$request = $smcFunc['db_query']('', '
SELECT t.id_member_started, ms.subject, t.approved
// 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
* Software Version: SMF 2.0 Beta 3 Public *
* Software Version: SMF 2.0 Beta 3.1 Public *
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
srand(time());
if (!function_exists('md5_file'))
if (!function_exists('md5_file'))
if (!function_exists('sha1'))
{
function sha1($str)
{
return sha1_smf($str);
}
}
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()));
}
}
* Software Version: SMF 2.0 Beta 3 Public *
* Software Version: SMF 2.0 Beta 3.1 Public *
if (!$previewing)
{
if (allowedTo('admin_forum'))
$parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \' \', \' \' => \'  \')) . \'[/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]);
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" => \' \', \' \' => \'  \')) . \'[/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]);
}
* Software Version: SMF 2.0 Beta 3 Public *
* Software Version: SMF 2.0 Beta 3.1 Public *
global $settings, $user_info, $context;
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()))));
$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;
$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;