Advertisement:

Navigation

Readme

This patch file will provide important stability fixes to your SMF 2.0.9 forum.

File Edits

./index.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]

$forum_version = 'SMF 2.0.9';
Replace With: [Select]

$forum_version = 'SMF 2.0.10';

./Themes/default/languages/index.english.php

Operation #1
Find: [Select]
// Version: 2.0.8;
Replace With: [Select]
// Version: 2.0.10;
Operation #2
Find: [Select]
2014
Replace With: [Select]
2015

./Themes/default/scripts/script.js

Operation #1
Find: [Select]
var is_ff = (ua.indexOf('firefox') != -1 || ua.indexOf('iceweasel') != -1 || ua.indexOf('icecat') != -1 || ua.indexOf('shiretoko') != -1 || ua.indexOf('minefield') != -1) && !is_opera;
Replace With: [Select]
var is_ff = (ua.indexOf('firefox') != -1 || ua.indexOf('iceweasel') != -1 || ua.indexOf('icecat') != -1 || ua.indexOf('shiretoko') != -1 || ua.indexOf('minefield') != -1 || ua.indexOf('PaleMoon') != -1) && !is_opera;
Operation #2
Find: [Select]
if ('oThemeOptions' in this.opt && this.opt.oThemeOptions.bUseThemeSettings)
Replace With: [Select]
if (!bInit && 'oThemeOptions' in this.opt && this.opt.oThemeOptions.bUseThemeSettings)

./Themes/default/Search.template.php

Operation #1
Find: [Select]

* @version 2.0
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

                        <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
                           <label for="brd', $board['id'], '"><input type="checkbox" id="brd', $board['id'], '" name="brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '</label>
                        </li>';
Replace With: [Select]

                        <li class="board">
                           <label for="brd', $board['id'], '" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"><input type="checkbox" id="brd', $board['id'], '" name="brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '</label>
                        </li>';

./Sources/ManageServer.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]

               $context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);
               $context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();
Replace With: [Select]

               $context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();
This operation isn't vital to the installation of this mod.

./Sources/Subs-Post.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

                  $htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'&#13;\', \' \' => \' &#32;\', \'[\' => \'&#91;\', \']\' => \'&#93;\')) . \'[/html]\';');
Replace With: [Select]

                  $htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'&#13;\', \' \' => \' &#32;\', \'[\' => \'&#91;\', \']\' => \'&#93;\')) . \'[/html]\';');
This operation isn't vital to the installation of this mod.

./Sources/ManageAttachments.php

Operation #1
Find: [Select]

* @version 2.0
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]
$date .= sprintf(\'<br />%1$s <a href="%2$s?topic=%3$d.0.msg%4$d#msg%4$d">%5$s</a>\', $txt[\'in\'], $scripturl, $rowData[\'id_topic\'], $rowData[\'id_msg\'], $rowData[\'subject\']);
Replace With: [Select]
$date .= sprintf(\'<br />%1$s <a href="%2$s?topic=%3$d.msg%4$d#msg%4$d">%5$s</a>\', $txt[\'in\'], $scripturl, $rowData[\'id_topic\'], $rowData[\'id_msg\'], $rowData[\'subject\']);

./Sources/Subs-Package.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

      // Windows doesn't seem to care about the memory_limit.
      if (!empty($modSettings['package_disable_cache']) || ini_set('memory_limit', '128M') !== false || strpos(strtolower(PHP_OS), 'win') !== false)
Replace With: [Select]

      // Windows doesn't seem to care about the memory_limit.
      if (!empty($modSettings['package_disable_cache']) || @ini_set('memory_limit', '128M') !== false || strpos(strtolower(PHP_OS), 'win') !== false)

Operation #3
Find: [Select]

      // Try to increase the memory limit - we don't want to run out of ram!
      if (!empty($modSettings['package_disable_cache']) || ini_set('memory_limit', '128M') !== false || strpos(strtolower(PHP_OS), 'win') !== false)
Replace With: [Select]

      // Try to increase the memory limit - we don't want to run out of ram!
      if (!empty($modSettings['package_disable_cache']) || @ini_set('memory_limit', '128M') !== false || strpos(strtolower(PHP_OS), 'win') !== false)

Operation #4
Find: [Select]

      if ($current['type'] == 5 && substr($current['filename'], -1) != '/')
         $current['filename'] .= '/';

      foreach ($current as $k => $v)
      {
         if (in_array($k, $octdec))
            $current[$k] = octdec(trim($v));
         else
            $current[$k] = trim($v);
      }
Replace With: [Select]

      foreach ($current as $k => $v)
      {
         if (in_array($k, $octdec))
            $current[$k] = octdec(trim($v));
         else
            $current[$k] = trim($v);
      }

      if ($current['type'] == 5 && substr($current['filename'], -1) != '/')
         $current['filename'] .= '/';

./Sources/Post.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

   if (isset($_REQUEST['preview']))
   {
      checkSession();
      return Post();
   }
Replace With: [Select]

   if (isset($_REQUEST['preview']))
   {
      if (checkSession('post', '', false) != '')
      {
         loadLanguage('Errors');
         $context['post_errors']['message'][] = $txt['error_session_timeout'];
         unset ($_POST['preview'], $_REQUEST['xml']); // just in case
      }
      return Post();
   }
This operation isn't vital to the installation of this mod.

./Themes/default/scripts/fader.js

Operation #1
Find: [Select]

   // Try to find the fore- and background colors.
   if ('currentStyle' in this.oFaderHandle)
Replace With: [Select]

   // Try to find the fore- and background colors.
   var modern_browser = 'MozOpacity' in this.oFaderHandle.style || 'Opacity' in this.oFaderHandle.style || 'filter' in this.oFaderHandle.style;
   if ('currentStyle' in this.oFaderHandle && !modern_browser)

Operation #2
Find: [Select]

   else if (!('opera' in window) && 'defaultView' in document)
Replace With: [Select]

   else if (!('opera' in window) && 'defaultView' in document && !modern_browser)

./Themes/default/Post.template.php

Operation #1
Find: [Select]

* @version 2.0
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]
\'question\', \'topic\'
Replace With: [Select]
\'question\', \'topic\', ', JavaScriptEscape($context['session_var']), '

./Sources/Subscriptions-PayPal.php

Operation #1
Find: [Select]

* @version 2.0.3
Replace With: [Select]

* @version 2.0.10
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

      $setting_data = array(
         array('text', 'paypal_email', 'subtext' => $txt['paypal_email_desc']),
      );
Replace With: [Select]

      /// We add email and additional emails (the latter for recurring payments)
      $setting_data = array(
         array('text', 'paypal_email', 'subtext' => $txt['paypal_email_desc']),
         array('text', 'paypal_additional_emails', 'subtext' => $txt['paypal_additional_emails_desc']),
      );

Operation #3
Find: [Select]

      if (strtolower($_POST['mc_currency']) != $modSettings['paid_currency_code'])
Replace With: [Select]

      if (strtolower($_POST['mc_currency']) != strtolower($modSettings['paid_currency_code']))

Operation #4
Find: [Select]

      if ($modSettings['paypal_email'] != $_POST['business'] && (empty($modSettings['paypal_additional_emails']) || !in_array($_POST['business'], explode(',', $modSettings['paypal_additional_emails']))))
         return false;
Replace With: [Select]

      if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
         return false;

Operation #5
Find: [Select]

      // Check that this is intended for us.
      if ($modSettings['paypal_email'] != $_POST['business'] && (empty($modSettings['paypal_additional_emails']) || !in_array($_POST['business'], explode(',', $modSettings['paypal_additional_emails']))))
Replace With: [Select]

      // Check that this is intended for us.
      if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))

./Themes/default/languages/ManagePaid.english.php

Operation #1
Find: [Select]

// Version: 2.0; ManagePaid
Replace With: [Select]

// Version: 2.0.10; ManagePaid
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

$txt['paid_note'] = '<strong class="alert">Note:</strong><br />For subscriptions to be automatically updated for your users, you
   will need to setup a return URL for each of your payment methods. For all payment types, this return URL should be set as:<br /><br />
   &nbsp;&nbsp;&bull;&nbsp;&nbsp;<strong>' . $boardurl . '/subscriptions.php</strong><br /><br />
   You can edit the link for paypal directly, by clicking <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_profile-ipn-notify" target="_blank">here</a>.<br />
   For the other gateways (If installed) you can normally find it in your customer panels, usually under the term &quot;Return URL&quot; or &quot;Callback URL&quot;.';

Replace With: [Select]

$txt['paid_note'] = '<strong class="alert">Note:</strong><br />
SMF currently supports <strong>PayPal</strong> as the installed payment method.<br />
   &nbsp;&nbsp;&bull;&nbsp;&nbsp;It is not necessary to enable IPN in your PayPal account; if you do, the forum will receive payment notifications for all payments made to your account, and this will generate Paid Subscriptions errors for payments that are not subscription related.<br />
   &nbsp;&nbsp;&bull;&nbsp;&nbsp;You must have a business or premier account to use recurring payments.<br />
   &nbsp;&nbsp;&bull;&nbsp;&nbsp;You must provide your primary PayPal email address for validation purposes.<br /><br />

If you install a different payment gateway, you may need to set up a return URL for payment notification. For all payment types, this return URL should be set as:<br /><br />
   &nbsp;&nbsp;&bull;&nbsp;&nbsp;<strong>' . $boardurl . '/subscriptions.php</strong><br /><br />
You can normally find it in your customer panels, usually under the term &quot;Return URL&quot; or &quot;Callback URL&quot;.<br /><br /><br />';


Operation #3
Find: [Select]

// View subscription strings.
Replace With: [Select]

$txt['paypal_additional_emails'] = 'Primary PayPal email address';
$txt['paypal_additional_emails_desc'] = 'If different (for business account)';

// View subscription strings.

./Themes/default/languages/ManagePaid.english-utf8.php

Operation #1
Find: [Select]

// Version: 2.0; ManagePaid
Replace With: [Select]

// Version: 2.0.10; ManagePaid
This operation isn't vital to the installation of this mod.

Operation #2
Find: [Select]

// View subscription strings.
Replace With: [Select]

$txt['paypal_additional_emails'] = 'Primary PayPal email address';
$txt['paypal_additional_emails_desc'] = 'If different (for business account)';

// View subscription strings.
This operation isn't vital to the installation of this mod.

./Sources/Packages.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]
$context['redirect_text'] = !empty($action['filename']) && file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']) ? file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']) : ($context['uninstalling'] ? $txt['package_uninstall_done'] : $txt['package_installed_done']);
Replace With: [Select]
$context['redirect_text'] = !empty($action['filename']) && file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']) ? $smcFunc['htmlspecialchars'](file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename'])) : ($context['uninstalling'] ? $txt['package_uninstall_done'] : $txt['package_installed_done']);

./SSI.php

Operation #1
Find: [Select]

* @version 2.0.7
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]

   // Check if they can vote.
Replace With: [Select]

   // Check if they can vote.
   $already_voted = false;

Operation #3
Find: [Select]

   elseif ($user_info['is_guest'] && $row['guest_vote'] && (!isset($_COOKIE['guest_poll_vote']) || !in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))
      $allow_vote = true;
   elseif ($user_info['is_guest'])
      $allow_vote = false;
Replace With: [Select]

   elseif ($user_info['is_guest'])
   {
      // There's a difference between "allowed to vote" and "already voted"...
      $allow_vote = $row['guest_vote'];

      // Did you already vote?
      if (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))
      {
         $already_voted = true;
      }
   }

Operation #4
Find: [Select]

      $allow_vote = $smcFunc['db_num_rows']($request) == 0;
Replace With: [Select]

      $allow_vote = $smcFunc['db_num_rows']($request) == 0;
      $already_voted = $allow_vote;

Operation #5
Find: [Select]

   $allow_view_results = allowedTo('moderate_board') || $row['hide_results'] == 0 || ($row['hide_results'] == 1 && !$allow_vote) || $is_expired;
Replace With: [Select]

   $allow_view_results = allowedTo('moderate_board') || $row['hide_results'] == 0 || ($row['hide_results'] == 1 && $already_voted) || $is_expired;

Operation #6
Find: [Select]

   elseif ($return['allow_view_results'])
Replace With: [Select]

   else

Operation #7
Find: [Select]

      foreach ($return['options'] as $option)
         echo '
               <dt>', $option['option'], '</dt>
               <dd>
Replace With: [Select]

      foreach ($return['options'] as $option)
      {
         echo '
               <dt>', $option['option'], '</dt>
               <dd>';

         if ($return['allow_view_results'])
         {
            echo '

Operation #8
Find: [Select]

                  ', $option['votes'], ' (', $option['percent'], '%)
               </dd>';
      echo '
            </dl>
            <strong>', $txt['poll_total_voters'], ': ', $return['total_votes'], '</strong>
Replace With: [Select]

                  ', $option['votes'], ' (', $option['percent'], '%)';
         }

         echo '
               </dd>';
      }

      echo '
            </dl>', ($return['allow_view_results'] ? '
            <strong>'. $txt['poll_total_voters'] .': '. $return['total_votes'] .'</strong>' : ''), '

Operation #9
Find: [Select]

   }
   // Cannot see it I'm afraid!
   else
      echo $txt['poll_cannot_see'];
Replace With: [Select]

   }

./Sources/Load.php

Operation #1
Find: [Select]

* @version 2.0.9
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]
return ' . strtr($ent_check[0], array('&' => '&amp;')) . 'htmlspecialchars($string, $quote_style, ' . ($utf8 ? '\'UTF-8\'' : '$charset') . ')' . $ent_check[1] . ';'),
Replace With: [Select]
return ' . ($utf8 ? '$smcFunc[\'fix_utf8mb4\'](' : '') . strtr($ent_check[0], array('&' => '&amp;')) . 'htmlspecialchars($string, $quote_style, ' . ($utf8 ? '\'UTF-8\'' : '$charset') . ')' . $ent_check[1] . ($utf8 ? ')' : '') . ';'),
      'fix_utf8mb4' => create_function('$string', '
         $i = 0;
         $len = strlen($string);
         $new_string = \'\';
         while ($i < $len)
         {
            $ord = ord($string[$i]);
            if ($ord < 128)
            {
               $new_string .= $string[$i];
               $i++;
            }
            elseif ($ord < 224)
            {
               $new_string .= $string[$i] . $string[$i+1];
               $i += 2;
            }
            elseif ($ord < 240)
            {
               $new_string .= $string[$i] . $string[$i+1] . $string[$i+2];
               $i += 3;
            }
            elseif ($ord < 248)
            {
               // Magic happens.
               $val = (ord($string[$i]) & 0x07) << 18;
               $val += (ord($string[$i+1]) & 0x3F) << 12;
               $val += (ord($string[$i+2]) & 0x3F) << 6;
               $val += (ord($string[$i+3]) & 0x3F);
               $new_string .= \'&#\' . $val . \';\';
               $i += 4;
            }
         }
         return $new_string;'),

./Sources/ManageNews.php

Operation #1
Find: [Select]

* @version 2.0.5
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]

         AND (COALESCE(bg.expire_time, 1=1) OR bg.expire_time > {int:current_time})
Replace With: [Select]

         AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})

./Sources/DbPackages-postgresql.php

Operation #1
Find: [Select]

* @version 2.0
Replace With: [Select]

* @version 2.0.10

Operation #2
Find: [Select]

         $setTo = isset($column_info['default']) ? $column_info['default'] : '';
Replace With: [Select]

         $setTo = isset($column_info['default']) ? $column_info['default'] : (strpos($old_info['type'], 'int') !== false ? 0 : '');

Operation #3
Find: [Select]

            WHERE ' . $column_info['name'] . ' = NULL',
Replace With: [Select]

            WHERE ' . $column_info['name'] . ' IS NULL',