Advertisement:

Navigation

Readme

This patch file will update your forum to SMF 1.1.12.

File Edits

./index.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1.11 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]
$forum_version = 'SMF 1.1.11';
Replace With: [Select]
$forum_version = 'SMF 1.1.12';

./Sources/DumpDatabase.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]
   @set_time_limit(600);
   @ini_set('memory_limit', '128M');
Replace With: [Select]
   @set_time_limit(600);
   if (@ini_get('memory_limit') < 256)
      @ini_set('memory_limit', '256M');

Operation #3
Find: [Select]
      // Tell the client to save this file, even though it's text.
      header('Content-Type: application/octetstream');
Replace With: [Select]
      // Tell the client to save this file, even though it's text.
      header('Content-Type: ' . ($context['browser']['is_ie'] || $context['browser']['is_opera'] ? 'application/octetstream' : 'application/octet-stream'));

Operation #4
Find: [Select]
   // Probably MyISAM.... and it might have a comment.
Replace With: [Select]
   // MySQL users below 4.0 can not use Engine
   if (version_compare('4', preg_replace('~\-.+?$~', '', min(mysql_get_server_info(), mysql_get_client_info()))) > 0)
      $schema_type = 'TYPE=';
   else
      $schema_type = 'ENGINE=';
   
   // Probably MyISAM.... and it might have a comment.

Operation #5
Find: [Select]
   // Probably MyISAM.... and it might have a comment.
   $schema_create .= $crlf . ') TYPE=' . (isset($row['Type']) ? $row['Type'] : $row['Engine']) . ($row['Comment'] != '' ? ' COMMENT="' . $row['Comment'] . '"' : '');
Replace With: [Select]
   // Probably MyISAM.... and it might have a comment.
   $schema_create .= $crlf . ') ' . $schema_type . (isset($row['Type']) ? $row['Type'] : $row['Engine']) . ($row['Comment'] != '' ? ' COMMENT="' . $row['Comment'] . '"' : '');

./Sources/ManageSearch.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1.2 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]
         db_query("
            CREATE TABLE {$db_prefix}log_search_words (
               ID_WORD " . $index_properties[$context['index_settings']['bytes_per_word']]['column_definition'] . " unsigned NOT NULL default '0',
Replace With: [Select]
         // MySQL users below 4.0 can not use Engine
         if (version_compare('4', preg_replace('~\-.+?$~', '', min(mysql_get_server_info(), mysql_get_client_info()))) > 0)
            $schema_type = 'TYPE=';
         else
            $schema_type = 'ENGINE=';

         db_query("
            CREATE TABLE {$db_prefix}log_search_words (
               ID_WORD " . $index_properties[$context['index_settings']['bytes_per_word']]['column_definition'] . " unsigned NOT NULL default '0',

Operation #3
Find: [Select]
            ) TYPE=MyISAM", __FILE__, __LINE__);
         
Replace With: [Select]
            ) " . $schema_type . "MyISAM", __FILE__, __LINE__);

./Sources/ManageSmileys.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1.11 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]
*/

function ManageSmileys()
Replace With: [Select]

   void EditMessageIcons()
      // !!!

   void sortSmileyTable()
      // !!!
*/

function ManageSmileys()

Operation #3
Find: [Select]
      updateSettings(array(
         'smiley_sets_default' => empty($context['smiley_sets'][$_POST['default_smiley_set']]) ? 'default' : $context['smiley_sets'][$_POST['default_smiley_set']],
         'smiley_sets_enable' => isset($_POST['smiley_sets_enable']) ? '1' : '0',
Replace With: [Select]
      // Make sure that the smileys are in the right order after enabling them.
      if (isset($_POST['smiley_enable']))
         sortSmileyTable();

      updateSettings(array(
         'smiley_sets_default' => empty($context['smiley_sets'][$_POST['default_smiley_set']]) ? 'default' : $context['smiley_sets'][$_POST['default_smiley_set']],
         'smiley_sets_enable' => isset($_POST['smiley_sets_enable']) ? '1' : '0',

Operation #4
Find: [Select]
         // Sort all smiley codes for more accurate parsing (longest code first).
         db_query("
            ALTER TABLE {$db_prefix}smileys
            ORDER BY LENGTH(code) DESC", __FILE__, __LINE__);
Replace With: [Select]
         // Sort all smiley codes for more accurate parsing (longest code first).
         sortSmileyTable();

Operation #5
Find: [Select]
      // Make sure the smiley codes are still in the right order.
      db_query("
         ALTER TABLE {$db_prefix}smileys
         ORDER BY LENGTH(code) DESC", __FILE__, __LINE__);
Replace With: [Select]
      // Make sure the smiley codes are still in the right order.
      sortSmileyTable();

Operation #6
Find: [Select]
      while ($row = mysql_fetch_assoc($request))
         $context['boards'][$row['ID_BOARD']] = $row['name'];
      mysql_free_result($request);
   }
}

?>
Replace With: [Select]
      while ($row = mysql_fetch_assoc($request))
         $context['boards'][$row['ID_BOARD']] = $row['name'];
      mysql_free_result($request);
   }
}

// This function sorts the smiley table by code length, it is needed as MySQL withdrew support for functions in order by.
function sortSmileyTable()
{
   global $db_prefix;

   // Add a sorting column.
   db_query("
      ALTER TABLE {$db_prefix}smileys
      ADD temp_order mediumint(8) not null", __FILE__, __LINE__);

   // Set the contents of this column.
   db_query("
      UPDATE {$db_prefix}smileys
      SET temp_order = LENGTH(code)", __FILE__, __LINE__);

   // Order the table by this column.
   db_query("
      ALTER TABLE {$db_prefix}smileys
      ORDER BY temp_order DESC", __FILE__, __LINE__);

   // Remove the sorting column.
   db_query("
      ALTER TABLE {$db_prefix}smileys
      DROP temp_order", __FILE__, __LINE__);
}

?>

./Sources/News.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]
   // Find the most recent members.
Replace With: [Select]
   if (!allowedTo('view_mlist'))
      return array();

   // Find the most recent members.

Operation #3
Find: [Select]
   // Load the member's contextual information!
   if (!loadMemberContext($_GET['u']))
Replace With: [Select]
   // Load the member's contextual information!
   if (!loadMemberContext($_GET['u']) || !allowedTo('profile_view_any'))

./Sources/PackageGet.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1.11 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]
         'name' => htmlspecialchars($row['name']),
         'url' => htmlspecialchars($row['url']),
Replace With: [Select]
         'name' => $row['name'],
         'url' => $row['url'],

Operation #3
Find: [Select]
      $_POST['serverurl'] = substr($_POST['serverurl'], 0, -1);
Replace With: [Select]
      $_POST['serverurl'] = substr($_POST['serverurl'], 0, -1);
   $servername = htmlspecialchars($_POST['servername']);
   $serverurl = htmlspecialchars($_POST['serverurl']);

   // Make sure the URL has the correct prefix.
   if (strpos($serverurl, 'http://') !== 0 && strpos($serverurl, 'https://') !== 0)
      $serverurl = 'http://' . $serverurl;

Operation #4
Find: [Select]
         (name, url)
      VALUES (SUBSTRING('$_POST[servername]', 1, 255), SUBSTRING('$_POST[serverurl]', 1, 255))", __FILE__, __LINE__);
Replace With: [Select]
         (name, url)
      VALUES (SUBSTRING('$servername', 1, 255), SUBSTRING('$serverurl', 1, 255))", __FILE__, __LINE__);

./Sources/Subs-Package.php

Operation #1
Find: [Select]
* Software Version: SMF 1.1.5 *
Replace With: [Select]
* Software Version: SMF 1.1.12 *
Operation #2
Find: [Select]

      if (trim($lower) <= $version && trim($upper) >= $version)
         return true;
Replace With: [Select]
      $lower = explode('.', $lower);
      $upper = explode('.', $upper);
      $version = explode('.', $version);

      foreach ($upper as $key => $high)
      {
         // Let's check that this is at or below the upper... obviously.
         if (isset($version[$key]) && trim($version[$key]) > trim($high))
            return false;

         // OK, let's check it's above the lower key... if it exists!
         if (isset($lower[$key]))
         {
            // The version either needs to have something here (i.e. can't be 1.0 on a 1.0.11) AND needs to be greater or equal to.
            // Note that if it's a range lower[key] might be blank, in that case version can not be set!
            if (!empty($lower[$key]) && (!isset($version[$key]) || trim($version[$key]) < trim($lower[$key])))
               return false;
         }
      }
      return true;

Operation #3
Find: [Select]

   preg_match('~^(http|ftp)(s)?://([^/:]+)(:(\d))?(.+)$~', $url, $match);
Replace With: [Select]

   preg_match('~^(http|ftp)(s)?://([^/:]+)(:(\d+))?(.+)$~', $url, $match);

./Themes/babylon/Display.template.php

Operation #1
Find: [Select]
<?php
// Version: 1.1; Display
Replace With: [Select]
<?php
// Version: 1.1.12; Display

Operation #2
Find: [Select]
   if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
Replace With: [Select]
   if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';

./Themes/classic/Display.template.php

Operation #1
Find: [Select]
<?php
// Version: 1.1; Display
Replace With: [Select]
<?php
// Version: 1.1.12; Display

Operation #2
Find: [Select]
   if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
Replace With: [Select]
   if ($context['can_remove_poll'])
      $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';

./Themes/default/Admin.template.php

Operation #1
Find: [Select]
<?php
// Version: 1.1.1; Admin
Replace With: [Select]
<?php
// Version: 1.1.12; Admin

Operation #2
Find: [Select]
         function smfDetermineVersions()
         {
            var highYour = {"Sources": "??", "Default" : "??", "Languages": "??", "Templates": "??"};
Replace With: [Select]
         function compareVersions(current, target)
         {
            // Are they equal, maybe?
            if (current == target)
               return false;

            var currentVersion = current.split(".");
            var targetVersion = target.split(".");

            for (var i = 0, n = (currentVersion.length > targetVersion.length ? currentVersion.length : targetVersion.length); i < n; i++)
            {
               // Make sure both are set.
               if (typeof(currentVersion[i]) == "undefined")
                  currentVersion[i] = "0";
               else if (typeof(targetVersion[i]) == "undefined")
                  targetVersion[i] = "0";

               // If they are same, move to the next set.
               if (currentVersion[i] == targetVersion[i])
                  continue;
               // Otherwise a simple comparison...
               else
                  return (parseInt(currentVersion[i]) < parseInt(targetVersion[i]));
            }

            return false;
         }

         function smfDetermineVersions()
         {
            var highYour = {"Sources": "??", "Default" : "??", "Languages": "??", "Templates": "??"};

Operation #3
Find: [Select]
               if (typeof(versionType) != "undefined")
               {
                  if ((highYour[versionType] < yourVersion || highYour[versionType] == "??") && !lowVersion[versionType])
Replace With: [Select]
               if (typeof(versionType) != "undefined")
               {
                  if ((compareVersions(highYour[versionType], yourVersion) || highYour[versionType] == "??") && !lowVersion[versionType])

Operation #4
Find: [Select]
                     highYour[versionType] = yourVersion;
                  if (highCurrent[versionType] < smfVersions[filename] || highCurrent[versionType] == "??")
Replace With: [Select]
                     highYour[versionType] = yourVersion;
                  if (compareVersions(highCurrent[versionType], smfVersions[filename]) || highCurrent[versionType] == "??")

Operation #5
Find: [Select]

                  if (yourVersion < smfVersions[filename])
Replace With: [Select]

                  if (compareVersions(yourVersion, smfVersions[filename]))

Operation #6
Find: [Select]
                  }
               }
               else if (yourVersion < smfVersions[filename])
Replace With: [Select]
                  }
               }
               else if (compareVersions(yourVersion, smfVersions[filename]))

Operation #7
Find: [Select]

                  if ((highYour["Languages"] < yourVersion || highYour["Languages"] == "??") && !lowVersion["Languages"])
Replace With: [Select]

                  if ((compareVersions(highYour["Languages"], yourVersion) || highYour["Languages"] == "??") && !lowVersion["Languages"])

Operation #8
Find: [Select]
                     highYour["Languages"] = yourVersion;
                  if (highCurrent["Languages"] < smfLanguageVersions[filename] || highCurrent["Languages"] == "??")
Replace With: [Select]
                     highYour["Languages"] = yourVersion;
                  if (compareVersions(highCurrent["Languages"], smfLanguageVersions[filename]) || highCurrent["Languages"] == "??")

Operation #9
Find: [Select]

                  if (yourVersion < smfLanguageVersions[filename])
Replace With: [Select]

                  if (compareVersions(yourVersion, smfLanguageVersions[filename]))

./Themes/default/Display.template.php

Operation #1
Find: [Select]
<?php
// Version: 1.1; Display
Replace With: [Select]
<?php
// Version: 1.1.12; Display

Operation #2
Find: [Select]
      'merge' => array('test' => 'can_merge', 'text' => 'smf252', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),
      'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start']),
Replace With: [Select]
      'merge' => array('test' => 'can_merge', 'text' => 'smf252', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),
      'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),