Update to SMF 1.0.11 - Installation Instructions for 1.0.10

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

File Edits ALT + Click to collapse all the operations

./index.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.11 *
Find: Select
$forum_version = 'SMF 1.0.10';
Replace With: Select
$forum_version = 'SMF 1.0.11';

./Sources/Subs-Auth.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.11 *
Find: Select
$_SESSION['login_' . $cookiename] = $data;
Replace With: Select

// Make sure the user logs in with a new session ID.
if (!isset($_SESSION['login_' . $cookiename]) || $_SESSION['login_' . $cookiename] !== $data)
{
// Backup and remove the old session.
$oldSessionData = $_SESSION;
$_SESSION = array();
session_destroy();

// Recreate and restore the new session.
loadSession();
session_regenerate_id();
$_SESSION = $oldSessionData;

// Version 4.3.2 didn't store the cookie of the new session.
if (version_compare(PHP_VERSION, '4.3.2') === 0)
setcookie(session_name(), session_id(), time() + $cookie_length, $cookie_url[1], '', 0);

$_SESSION['login_' . $cookiename] = $data;
}
}

// PHP < 4.3.2 doesn't have this function
if (!function_exists('session_regenerate_id'))
{
function session_regenerate_id()
{
// Too late to change the session now.
if (headers_sent())
return false;

session_id(strtolower(md5(uniqid(rand(), true))));
return true;
}
Find: Select
// Globalize cookies across domains (filter out IP-addresses)?
if (!empty($modSettings['globalCookies']) && !preg_match('~^\d{1,3}(\.\d{1,3}){3}$~', $parsed_url['host']))
{
// If we can't figure it out, just skip it.
if (preg_match('~(?:[^\.]+\.)?([^\.]{2,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
$parsed_url['host'] = '.' . $parts[1];
}
// We shouldn't use a host at all if both options are off.
elseif (empty($modSettings['localCookies']))
$parsed_url['host'] = '';
Replace With: Select
// Globalize cookies across domains (filter out IP-addresses)?
if (!empty($modSettings['globalCookies']) && preg_match('~^\d{1,3}(\.\d{1,3}){3}$~', $parsed_url['host']) == 0 && preg_match('~(?:[^\.]+\.)?([^\.]{2,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
$parsed_url['host'] = '.' . $parts[1];

// We shouldn't use a host at all if both options are off.
elseif (empty($modSettings['localCookies']) && empty($modSettings['globalCookies']))
$parsed_url['host'] = '';

// The host also shouldn't be set if there aren't any dots in it.
elseif (!isset($parsed_url['host']) || strpos($parsed_url['host'], '.') === false)
$parsed_url['host'] = '';

./Sources/Subs-Package.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.11 *
Find: Select

if (!mktree(dirname($strPath), $mode))
Replace With: Select
// Is this an invalid path and/or we can't make the directory?
if ($strPath == dirname($strPath) || !mktree(dirname($strPath), $mode))
Find: Select
// Set the debug level.
Replace With: Select
// If we're using this try to get some more memory.
@ini_set('memory_limit', '32M');

// Set the debug level.
Find: Select
$tag = preg_quote($match[1], '/');
$reg = '/\A(.*?(<' . $tag . ' .*?>.*?<\/' . $tag . '>.*?)*?)<\/' . $tag . '>/s';

// Remove the element and fetch the inner data.
preg_match($reg, $data, $inner_match);
$data = preg_replace($reg, '', $data, 1);

if (!isset($inner_match[1]))
continue;

// Parse the inner data.
if (strpos($inner_match[1], '<') !== false)
$el += $this->_parse($inner_match[1]);
elseif (trim($inner_match[1]) != '')
{
$text_value = $this->_from_cdata($inner_match[1]);
if ($text_value != '')
$el[] = array(
'name' => '!',
'value' => $text_value
);
Replace With: Select
// Because PHP 5.2.0+ seems to croak using regex, we'll have to do this the less fun way.
$last_tag_end = strpos($data, '</' . $match[1]. '>');
if ($last_tag_end === false)
continue;

$offset = 0;
while (1 == 1)
{
// Where is the next start tag?
$next_tag_start = strpos($data, '<' . $match[1], $offset);
// If the next start tag is after the last end tag then we've found the right close.
if ($next_tag_start === false || $next_tag_start > $last_tag_end)
break;

// If not then find the next ending tag.
$next_tag_end = strpos($data, '</' . $match[1]. '>', $offset);

// Didn't find one? Then just use the last and sod it.
if ($next_tag_end === false)
break;
else
{
$last_tag_end = $next_tag_end;
$offset = $next_tag_start + 1;
}
}
// Parse the insides.
$inner_match = substr($data, 0, $last_tag_end);
// Data now starts from where this section ends.
$data = substr($data, $last_tag_end + strlen('</' . $match[1]. '>'));

if (!empty($inner_match))
{
// Parse the inner data.
if (strpos($inner_match, '<') !== false)
$el += $this->_parse($inner_match);
elseif (trim($inner_match) != '')
{
$text_value = $this->_from_cdata($inner_match);
if ($text_value != '')
$el[] = array(
'name' => '!',
'value' => $text_value
);
}

./Sources/QueryString.php

Find: Select
* Software Version: SMF 1.0.10 *
Replace With: Select
* Software Version: SMF 1.0.11 *
Find: Select
function addslashes__recursive($var)
Replace With: Select
function addslashes__recursive($var, $level = 0)
Find: Select
$new_var[addslashes($k)] = addslashes__recursive($v);
Replace With: Select
$new_var[addslashes($k)] = $level > 25 ? null : addslashes__recursive($v, $level + 1);
Find: Select
function htmlspecialchars__recursive($var)
Replace With: Select
function htmlspecialchars__recursive($var, $level = 0)
Find: Select
foreach ($var as $k => $v)
$var[$k] = htmlspecialchars__recursive($v);
Replace With: Select
foreach ($var as $k => $v)
$var[$k] = $level > 25 ? null : htmlspecialchars__recursive($v, $level + 1);
Find: Select
function urldecode__recursive($var)
Replace With: Select
function urldecode__recursive($var, $level = 0)
Find: Select
$new_var[urldecode($k)] = urldecode__recursive($v);
Replace With: Select
$new_var[urldecode($k)] = $level > 25 ? null : urldecode__recursive($v, $level + 1);
Find: Select
function stripslashes__recursive($var)
Replace With: Select
function stripslashes__recursive($var, $level = 0)
Find: Select
$new_var[stripslashes($k)] = stripslashes__recursive($v);
Replace With: Select
$new_var[stripslashes($k)] = $level > 25 ? null : stripslashes__recursive($v, $level + 1);
Find: Select
function htmltrim__recursive($var)
Replace With: Select
function htmltrim__recursive($var, $level = 0)
Find: Select
foreach ($var as $k => $v)
$var[$k] = htmltrim__recursive($v);
Replace With: Select
foreach ($var as $k => $v)
$var[$k] = $level > 25 ? null : htmltrim__recursive($v, $level + 1);
Advertisement: