Update to SMF 1.0.3 - Installation Instructions for 1.0.2

Update to SMF 1.0.3

File Edits ALT + Click to collapse all the operations

./changelog.txt

Find: Select
Changes go downward, months go upward. Please scroll to the bottom for a legend.
Changelog started January 1, 2004; Currently at $Revision: 1.1040.2.310 $.
Replace With: Select
Changes go downward, months go upward. Please scroll to the bottom for a legend.
Changelog started January 1, 2004; Currently at $Revision: 1.1040.2.323 $.

SMF 1.0.3 March 28, 2005
================================================================================
March 2005:
--------------------------------------------------------------------------------
! Fix lacnic whois server link. (ManageMembers.php)
! Sometimes (much of the time), using multiple search conditions could cause your add code to be miffed up. (Subs-Package.php)
! The RSS feeds were using overly unique links. (News.php)
! Try to parse blank URLs and a few other things more correctly. (Subs-Post.php)
! Don't give an error when you try to delete nothing from the news. (Admin.php)
* Fixed a small HTML typo. (Search template)
! Don't kill the installer if session.save_handler is set strangely. (install.php)
! The database error email message just wasn't sending. (Subs-Auth.php)
! Clean up better after multiple spaces/etc. in usernames. (Register.php)
! Handle single quotes in email addresses from the profile better. (Profile.php)
! Fixed a case where calendar events wouldn't be handled properly. (Calendar.php)


February 2005:
--------------------------------------------------------------------------------
! Fixed new poll choices sometimes getting messed up after editing polls. (Poll.php)
! Send the automatically generated password properly on administrative registrations. (Register.php)
! Validate any choices for lngfile on registration. (Register.php)
* When editing polls, the choice ordering could be messed up. (Poll template)
* Automatic notification was still being turned off sometimes on replies with quick reply. (Display template)

./index.php

Find: Select
* Software Version: SMF 1.0.2 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
$forum_version = 'SMF 1.0.2';
Replace With: Select
$forum_version = 'SMF 1.0.3';

./Sources/Admin.php

Find: Select
* Software Version: SMF 1.0.2 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
{
// Store the news temporarily in this array.
Replace With: Select
{
if (empty($_POST['remove']))
redirectexit('action=editnews');

// Store the news temporarily in this array.

./Sources/ManageMembers.php

Find: Select
* Software Version: SMF 1.0.2 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
'name' => &$txt['whois_lacnic'],
'url' => 'http://lacnic.net/cgi-bin/lacnic/whois?lg=EN&qr=' . $searchip
),
Replace With: Select
'name' => &$txt['whois_lacnic'],
'url' => 'http://lacnic.net/cgi-bin/lacnic/whois?lg=EN&query=' . $searchip
),

./Sources/Calendar.php

Find: Select
* Software Version: SMF 1.0.1 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
$allyear_part = "birthdate BETWEEN '0000-" . substr($low_date, 4) . "' AND '0000-12-31'
OR birthdate BETWEEN '0000-01-01' AND '0000-" . substr($high_date, 4) . "'";
Replace With: Select
$allyear_part = "birthdate BETWEEN '0000" . substr($low_date, 4) . "' AND '0000-12-31'
OR birthdate BETWEEN '0000-01-01' AND '0000" . substr($high_date, 4) . "'";
Find: Select
$allyear_part = "birthdate BETWEEN '0000-" . substr($low_date, 4) . "' AND '0000-" . substr($high_date, 4) . "'";
Replace With: Select
$allyear_part = "birthdate BETWEEN '0000" . substr($low_date, 4) . "' AND '0000" . substr($high_date, 4) . "'";
Find: Select
if (substr($low_date, 0, 4) != substr($high_date, 0, 4))
$allyear_part = "eventDate BETWEEN '0000-" . substr($low_date, 4) . "' AND '0000-12-31'
OR eventDate BETWEEN '0000-01-01' AND '0000-" . substr($high_date, 4) . "'";
else
$allyear_part = "eventDate BETWEEN '0000-" . substr($low_date, 4) . "' AND '0000-" . substr($high_date, 4) . "'";
Replace With: Select
if (substr($low_date, 0, 4) != substr($high_date, 0, 4))
$allyear_part = "eventDate BETWEEN '0000" . substr($low_date, 4) . "' AND '0000-12-31'
OR eventDate BETWEEN '0000-01-01' AND '0000" . substr($high_date, 4) . "'";
else
$allyear_part = "eventDate BETWEEN '0000" . substr($low_date, 4) . "' AND '0000" . substr($high_date, 4) . "'";

./Sources/News.php

Find: Select
* Software Version: SMF 1.0.2 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
'title' => '<![CDATA[' . $row['subject'] . ']]>',
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . '#msg' . $row['ID_MSG'],
'description' => "<![CDATA[\n" . $row['body'] . ']]>',
Replace With: Select
'title' => '<![CDATA[' . $row['subject'] . ']]>',
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'description' => "<![CDATA[\n" . $row['body'] . ']]>',
Find: Select
),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . '#msg' . $row['ID_MSG']
);
Replace With: Select
),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG']
);

./Sources/Poll.php

Find: Select
* Software Version: SMF 1.0 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by: Lewis Media (http://www.lewismedia.com) *
Replace With: Select
* Software Version: SMF 1.0.3 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by: Lewis Media (http://www.lewismedia.com) *
Find: Select
{
$context['choices'][] = array(
'id' => $row['ID_CHOICE'],
Replace With: Select
{
$context['choices'][$row['ID_CHOICE']] = array(
'id' => $row['ID_CHOICE'],

./Sources/Profile.php

Find: Select
* Software Version: SMF 1.0.2 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
{
// Prepare the new password, or check if they want to change their own.
Replace With: Select
{
$_POST['emailAddress'] = strtr($_POST['emailAddress'], array('&#039;' => '\\\''));

// Prepare the new password, or check if they want to change their own.

./Sources/Register.php

Find: Select
* Software Version: SMF 1.0 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by: Lewis Media (http://www.lewismedia.com) *
Replace With: Select
* Software Version: SMF 1.0.3 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by: Lewis Media (http://www.lewismedia.com) *
Find: Select
// Trim any whitespace from the username.
$_POST['user'] = trim($_POST['user']);
Replace With: Select
// Trim any whitespace from the username.
$_POST['user'] = trim(preg_replace('~[\t\n\r\x0B\0\xA0]+~', ' ', $_POST['user']));
Find: Select
if (strlen($_POST['user']) > 25)
$_POST['user'] = substr($_POST['user'], 0, 25);
Replace With: Select
if (strlen($_POST['user']) > 25)
$_POST['user'] = trim(substr($_POST['user'], 0, 25));
Find: Select

foreach ($possible_strings as $var)
Replace With: Select

if (isset($_POST['lngfile']) && !empty($modSettings['userLanguage']))
{
$language_directories = array(
$settings['default_theme_dir'] . '/languages',
$settings['actual_theme_dir'] . '/languages',
);
if (!empty($settings['base_theme_dir']))
$language_directories[] = $settings['base_theme_dir'] . '/languages';
$language_directories = array_unique($language_directories);

foreach ($language_directories as $language_dir)
{
if (!file_exists($language_dir))
continue;

$dir = dir($language_dir);
while ($entry = $dir->read())
if (preg_match('~^index\.(.+)\.php$~', $entry, $matches) && $matches[1] == $_POST['lngfile'])
{
$found = true;
$_SESSION['language'] = $_POST['lngfile'];
break;
}
$dir->close();
}

if (empty($found))
unset($_POST['lngfile']);
}
else
unset($_POST['lngfile']);

foreach ($possible_strings as $var)
Find: Select
"$txt[hello_guest] $_POST[user]!\n\n" .
"$txt[719] $_POST[user], $txt[492] $_POST[password]\n\n" .
"$txt[activate_mail]:\n\n" .
Replace With: Select
"$txt[hello_guest] $_POST[user]!\n\n" .
"$txt[719] $_POST[user], $txt[492] $_POST[passwrd1]\n\n" .
"$txt[activate_mail]:\n\n" .
Find: Select
"$txt[hello_guest] $_POST[user]!\n\n" .
"$txt[719] $_POST[user], $txt[492] $_POST[password]\n\n" .
"$txt[701]\n" .
Replace With: Select
"$txt[hello_guest] $_POST[user]!\n\n" .
"$txt[719] $_POST[user], $txt[492] $_POST[passwrd1]\n\n" .
"$txt[701]\n" .

./Sources/Subs-Auth.php

Find: Select
* Software Version: SMF 1.0.1 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
{
global $db_last_error, $sourcedir, $mbname, $maintenance, $mtitle, $mmessage, $db_error_send, $db_connection;
Replace With: Select
{
global $db_last_error, $sourcedir, $mbname, $maintenance, $mtitle, $mmessage, $db_error_send, $db_connection, $webmaster_email;

./Sources/Subs-Package.php

Find: Select
* Software Version: SMF 1.0.2 *
Replace With: Select
* Software Version: SMF 1.0.3 *
Find: Select
$working_search = '';
$replace_with = $operation->exists('add') ? $operation->fetch('add') : '';

$temp_searches = $operation->set('search');
if (count($temp_searches) > 1)
{
// Resort the list so replace comes first - it must.
$searches = array();
foreach ($temp_searches as $i => $v)
if (!$v->exists('@position') || ($v->fetch('@position') != 'before' && $v->fetch('@position') != 'after'))
{
$searches[] = $v;
unset($temp_searches[$i]);
}

// Add on the rest, in the order they were in.
$searches = array_merge($searches, $temp_searches);
}
else
$searches = $temp_searches;

// Go through all the search conditions.
foreach ($searches as $search)
Replace With: Select
$working_search = '';
$replace_with = $operation->exists('add') ? $operation->fetch('add') : '';

// Are we doing a fancy-shmancy regexp search?
$regexp = false;

$temp_searches = $operation->set('search');
if (count($temp_searches) > 1)
{
// Resort the list so replace comes first - it must.
$searches = array();
foreach ($temp_searches as $i => $v)
{
// A quick check on whether it's a regular expression search...
if (!$undo && $temp_searches[$i]->exists('@regexp') && trim($temp_searches[$i]->fetch('@regexp')) == 'true')
$regexp = true;

if (!$v->exists('@position') || ($v->fetch('@position') != 'before' && $v->fetch('@position') != 'after'))
{
$searches[] = $v;
unset($temp_searches[$i]);
}
}

// Add on the rest, in the order they were in.
$searches = array_merge($searches, $temp_searches);
}
else
{
$searches = $temp_searches;
$regexp = !$undo && $searches[0]->exists('@regexp') && trim($searches[0]->fetch('@regexp')) == 'true';
}

// If we're not using regular expression search, replace out any $'s and \'s!
if (!$regexp)
{
// Shuzzup. This is done so we can safely use a regular expression. ($0 is bad!!)
if (!$undo)
$replace_with = strtr($replace_with, array('$' => '[$PACK' . 'AGE1$]', '\\' => '[$PACK' . 'AGE2$]'));
else
$replace_with = preg_quote($replace_with, '~');
}

// Go through all the search conditions.
foreach ($searches as $search)
Find: Select
$this_clean_search = $search->fetch('.');

// Are we not using regular expressions explicitly?
if (!$search->exists('@regexp') || trim($search->fetch('@regexp') != 'true') && !$undo)
{
$this_search = preg_quote($this_clean_search, '~');

// Remember, can't have whitespace correction and regexp on at the same time.
if ($search->exists('@whitespace') && trim($search->fetch('@whitespace') != 'loose'))
$this_search = preg_replace('~[ \t]+~', '[ \t]+', $this_search);

// Shuzzup. This is done so we can safely use a regular expression. ($0 is bad!!)
if (!$undo)
$replace_with = strtr($replace_with, array('$' => '[$PACK' . 'AGE1$]', '\\' => '[$PACK' . 'AGE2$]'));
else
{
$replace_with = preg_quote($replace_with, '~');
$working_search = strtr($working_search, array('$' => '[$PACK' . 'AGE1$]', '\\' => '[$PACK' . 'AGE2$]'));
}
}
else
$this_search = $this_clean_search;
Replace With: Select
$this_clean_search = $search->fetch('.');

// Are we not using regular expressions explicitly?
if (!$regexp)
{
$this_search = preg_quote($this_clean_search, '~');

// Remember, can't have whitespace correction and regexp on at the same time.
if ($search->exists('@whitespace') && trim($search->fetch('@whitespace')) != 'loose')
$this_search = preg_replace('~[ \t]+~', '[ \t]+', $this_search);

// Shuzzup again. Read the comment above a few lines where this is done to $replace_with...
if ($undo)
$working_search = strtr($working_search, array('$' => '[$PACK' . 'AGE1$]', '\\' => '[$PACK' . 'AGE2$]'));
}
else
$this_search = $this_clean_search;
Find: Select

if ($position == 'before')
{
if (!$search->exists('@regexp') || trim($search->fetch('@regexp') != 'true'))
{
if (!$undo)
{
Replace With: Select

if ($position == 'before')
{
if (!$regexp)
{
if (!$undo)
{
Find: Select
}
elseif ($position == 'after')
{
if (!$search->exists('@regexp') || trim($search->fetch('@regexp') != 'true'))
{
if (!$undo)
{
Replace With: Select
}
elseif ($position == 'after')
{
if (!$regexp)
{
if (!$undo)
{
Find: Select
$working_data = strtr($working_data, array('[$PACK' . 'AGE1$]' => '$', '[$PACK' . 'AGE2$]' => '\\'));

if (file_exists($working_file) && !is_writable($working_file))
@chmod($working_file, 0777);
elseif (!file_exists($working_file) && !is_writable(dirname($working_file)))
@chmod(dirname($working_file), 0777);

if ((file_exists($working_file) && !is_writable($working_file)) || !is_writable(dirname($working_file)))
Replace With: Select
$working_data = strtr($working_data, array('[$PACK' . 'AGE1$]' => '$', '[$PACK' . 'AGE2$]' => '\\'));

if (file_exists($working_file) && !is_writable($working_file))
@chmod($working_file, 0755);
if (file_exists($working_file) && !is_writable($working_file))
@chmod($working_file, 0777);

if (!file_exists($working_file) && !is_writable(dirname($working_file)))
@chmod(dirname($working_file), 0755);
if (!file_exists($working_file) && !is_writable(dirname($working_file)))
@chmod(dirname($working_file), 0777);

if ((file_exists($working_file) && !is_writable($working_file)) || !is_writable(dirname($working_file)))

./Sources/Subs-Post.php

Find: Select
* Software Version: SMF 1.0 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by: Lewis Media (http://www.lewismedia.com) *
Replace With: Select
* Software Version: SMF 1.0.3 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by: Lewis Media (http://www.lewismedia.com) *
Find: Select
{
while (preg_match('/\[(' . $myTag . ($hasExtra ? '(?:[^\]]*?)' : '') . ')' . ($hasEqualSign ? '(=(.+?))' : '(())') . '\](.+?)\[\/(' . $myTag . ')\]/is', $message, $matches))
{
Replace With: Select
{
while (preg_match('/\[(' . $myTag . ($hasExtra ? '(?:[^\]]*?)' : '') . ')' . ($hasEqualSign ? '(=([^\]]*?))' : '(())') . '\](.+?)\[\/(' . $myTag . ')\]/is', $message, $matches))
{

./SSI.php

Find: Select
* Software Version: SMF 1.0 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by: Lewis Media (http://www.lewismedia.com) *
Replace With: Select
* Software Version: SMF 1.0.3 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by: Lewis Media (http://www.lewismedia.com) *
Find: Select

if ($output_method != 'echo' || empty($return))
return $return;

foreach ($return as $mday => $array)
$return[$mday][count($array) - 1]['is_last'] = true;
Replace With: Select

foreach ($return as $mday => $array)
$return[$mday][count($array) - 1]['is_last'] = true;

if ($output_method != 'echo' || empty($return))
return $return;

./Themes/classic/Display.template.php

Find: Select
// Version: 1.0; Display
Replace With: Select
// Version: 1.0.3; Display
Find: Select
<input type="hidden" name="icon" value="xx" />
<input type="hidden" name="notify" value="', $context['is_marked_notify'] || empty($options['auto_notify']) ? '0' : '1', '" />
<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
Replace With: Select
<input type="hidden" name="icon" value="xx" />
<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />

./Themes/default/Display.template.php

Find: Select
// Version: 1.0; Display
Replace With: Select
// Version: 1.0.3; Display
Find: Select
<input type="hidden" name="icon" value="xx" />
<input type="hidden" name="notify" value="', $context['is_marked_notify'] || empty($options['auto_notify']) ? '0' : '1', '" />
<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
Replace With: Select
<input type="hidden" name="icon" value="xx" />
<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />

./Themes/default/Poll.template.php

Find: Select
// Version: 1.0; Poll
Replace With: Select
// Version: 1.0.3; Poll
Find: Select

setOuterHTML(document.getElementById("pollMoreOptions"), \'<br /><label for="options[\' + pollOptionNum + \']">', $txt['smf22'], ' \' + pollOptionNum + \'</label>: <input type="text" name="options[\' + pollOptionNum + \']" id="options[\' + pollOptionNum + \']" value="" size="25" /><span id="pollMoreOptions"></span>\');
}
Replace With: Select

setOuterHTML(document.getElementById("pollMoreOptions"), \'<br /><label for="options[\' + pollOptionNum + \']">', $txt['smf22'], ' \' + pollOptionNum + \'</label>: <input type="text" name="options[\' + (pollOptionNum - 1) + \']" id="options[\' + (pollOptionNum - 1) + \']" value="" size="25" /><span id="pollMoreOptions"></span>\');
}

./Themes/default/Search.template.php

Find: Select
</tr><tr>
<td style="padding-top: 2ex; colspan="2"><b>', $txt['search_order'], ':</b></td>
<td></td>
Replace With: Select
</tr><tr>
<td style="padding-top: 2ex;" colspan="2"><b>', $txt['search_order'], ':</b></td>
<td></td>
Advertisement: