News & Public Relation > Announcement

ดำเนินการ Update ระบบ SMF 2.0.11 to 2.0.12 patched

(1/1)

Nick:
http://custom.simplemachines.org/upgrades/index.php?action=upgrade;file=smf_patch_2.0.12.zip;smf_version=2.0.11
ดำเนินการ Update ระบบ SMF 2.0.11 to 2.0.12 patched
This patch will provide important security and bug fixes to your 2.0.11 forum.

Changelog
=========
- Fixed word censor injection by disallowing an empty 'proper word'
- Fixed vulnerable unserialize() code by converting all instances to safe_unserialize()
- Added a more thorough safe_unserialize() function to prevent object injection
- Fixed bug where leaving a custom profile field blank on registration that has an email mask would throw an error
- Fixed PayPal integration to comply with their new forced SSL policy
- Fixed bug where notifications were sent for messages in inaccessible boards
- Fixed editor to make the editor work with Microsoft Edge
- Fixed issue where smiley popup window is blank on iOS 9 devices
- Fixed WYSIWYG editor in mobile devices
- Fixed an undefined $_POST['icon'] in Sources/Post.php
- Fixed a minor bug in Login2()
- Fixed an issue where SMF doesn't recognize new domain names and considers these as invalid
- Fixed an issue where SMF would allow empty BBC
- Fixed an issue where theme variants could not be selected
- Fixed an issue where the file version of Subs-Post.php could have been 2.0.8 or 2.0.11. It will be updated to 2.0.12 in either case.


--- Quote ---File Edits
./index.php
Operation #1
Find:
* @version 2.0.11
Replace With:
* @version 2.0.12

Operation #2
Find:
$forum_version = 'SMF 2.0.11';
Replace With:
$forum_version = 'SMF 2.0.12';

./Themes/default/languages/index.english.php
Operation #1
Find:
// Version: 2.0.10; index
Replace With:
// Version: 2.0.12; index
This operation isn't vital to the installation of this mod.

Operation #2
Find:
 <a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF &copy; 2015</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
Replace With:
 <a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF &copy; 2016</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
This operation isn't vital to the installation of this mod.

./Themes/default/languages/index.english-utf8.php
Operation #1
Find:
// Version: 2.0.10; index
Replace With:
// Version: 2.0.12; index
This operation isn't vital to the installation of this mod.

Operation #2
Find:
 <a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF &copy; 2015</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
Replace With:
 <a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF &copy; 2016</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
This operation isn't vital to the installation of this mod.

./Sources/Admin.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
$context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
Replace With:
$context['admin_preferences'] = !empty($options['admin_preferences']) ? safe_unserialize($options['admin_preferences']) : array();

./Sources/Calendar.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.11

Operation #2
Find:
$context['clockicons'] = unserialize(base64_decode('YTo2OntzOjI6ImgxIjthOjI6e2k6MDtpOjI7aToxO2k6MTt9czoyOiJoMiI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjI6Im0xIjthOjM6e2k6MDtpOjQ7aToxO2k6MjtpOjI7aToxO31zOjI6Im0yIjthOjQ6e2k6MDtpOjg7aToxO2k6NDtpOjI7aToyO2k6MztpOjE7fXM6MjoiczEiO2E6Mzp7aTowO2k6NDtpOjE7aToyO2k6MjtpOjE7fXM6MjoiczIiO2E6NDp7aTowO2k6ODtpOjE7aTo0O2k6MjtpOjI7aTozO2k6MTt9fQ=='));
Replace With:
$context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjI6ImgxIjthOjI6e2k6MDtpOjI7aToxO2k6MTt9czoyOiJoMiI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjI6Im0xIjthOjM6e2k6MDtpOjQ7aToxO2k6MjtpOjI7aToxO31zOjI6Im0yIjthOjQ6e2k6MDtpOjg7aToxO2k6NDtpOjI7aToyO2k6MztpOjE7fXM6MjoiczEiO2E6Mzp7aTowO2k6NDtpOjE7aToyO2k6MjtpOjE7fXM6MjoiczIiO2E6NDp7aTowO2k6ODtpOjE7aTo0O2k6MjtpOjI7aTozO2k6MTt9fQ=='));

Operation #3
Find:
$context['clockicons'] = unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319'));
Replace With:
$context['clockicons'] = safe_unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319'));

Operation #4
Find:
$context['clockicons'] = unserialize(base64_decode('YTo2OntzOjQ6InllYXIiO2E6Nzp7aTowO2k6NjQ7aToxO2k6MzI7aToyO2k6MTY7aTozO2k6ODtpOjQ7aTo0O2k6NTtpOjI7aTo2O2k6MTt9czo1OiJtb250aCI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjM6ImRheSI7YTo1OntpOjA7aToxNjtpOjE7aTo4O2k6MjtpOjQ7aTozO2k6MjtpOjQ7aToxO31zOjQ6ImhvdXIiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czozOiJtaW4iO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9czozOiJzZWMiO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9fQ=='));
Replace With:
$context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjQ6InllYXIiO2E6Nzp7aTowO2k6NjQ7aToxO2k6MzI7aToyO2k6MTY7aTozO2k6ODtpOjQ7aTo0O2k6NTtpOjI7aTo2O2k6MTt9czo1OiJtb250aCI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjM6ImRheSI7YTo1OntpOjA7aToxNjtpOjE7aTo4O2k6MjtpOjQ7aTozO2k6MjtpOjQ7aToxO31zOjQ6ImhvdXIiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czozOiJtaW4iO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9czozOiJzZWMiO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9fQ=='));

./Sources/DbPackages-mysql.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column['unsigned']) ? 'unsigned ' : '';
Replace With:
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';

Operation #3
Find:
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
Replace With:
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';

Operation #4
Find:
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
Replace With:
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';

./Sources/Display.php
Operation #1
Find:
@version 2.0.9
Replace With:
@version 2.0.11

Operation #2
Find:
$modSettings['attachmentUploadDir'] = @unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

./Sources/Load.php
Operation #1
Find:
@version 2.0.11
Replace With:
@version 2.0.12

Operation #2
Find:
$integration_settings = unserialize(SMF_INTEGRATION_SETTINGS);
Replace With:
$integration_settings = safe_unserialize(SMF_INTEGRATION_SETTINGS);

Operation #3
Find:
$context['display_fields'] = unserialize($modSettings['displayFields']);
Replace With:
$context['display_fields'] = safe_unserialize($modSettings['displayFields']);

Operation #4
Find:
return @unserialize($value);
Replace With:
return safe_unserialize($value);

./Sources/LogInOut.php
Operation #1
Find:
@version 2.0.11
Replace With:
@version 2.0.12

Operation #2
Find:
elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 || $_POST['cookielength'] <= 525600))
Replace With:
elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 && $_POST['cookielength'] <= 525600))

./Sources/ManageAttachments.php
Operation #1
Find:
@version 2.0.10
Replace With:
@version 2.0.12

Operation #2
Find:
$attach_dirs = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$attach_dirs = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #3
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #4
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #5
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

./Sources/ManagePaid.php
Operation #1
Find:
@version 2.0.3
Replace With:
@version 2.0.12

Operation #2
Find:
'cost' => @unserialize($row['cost']),
Replace With:
'cost' => safe_unserialize($row['cost']),

Operation #3
Find:
$pending_details = @unserialize($row['pending_details']);
Replace With:
$pending_details = safe_unserialize($row['pending_details']);

Operation #4
Find:
$costs = @unserialize($context['current_subscription']['real_cost']);
Replace With:
$costs = safe_unserialize($context['current_subscription']['real_cost']);

Operation #5
Find:
$costs = @unserialize($row['cost']);
Replace With:
$costs = safe_unserialize($row['cost']);

./Sources/ManagePosts.php
Operation #1
Find:
      if (empty($censor_vulgar[$i]))
         continue;
Add After:

      if (empty($censor_proper[$i]))
         continue;

./Sources/ManageSearch.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
$context['index_settings'] = unserialize($modSettings['search_custom_index_resume']);
Replace With:
$context['index_settings'] = safe_unserialize($modSettings['search_custom_index_resume']);

./Sources/ManageServer.php
Operation #1
Find:
@version 2.0.10
Replace With:
@version 2.0.12

Operation #2
Find:
$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:
$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? safe_unserialize($context['config_vars'][$config_var[1]]['value']) : array();

./Sources/Memberlist.php
Operation #1
Find:
@version 2.0.8
Replace With:
@version 2.0.12

Operation #2
Find:
$memberlist_cache = @unserialize($modSettings['memberlist_cache']);
Replace With:
$memberlist_cache = safe_unserialize($modSettings['memberlist_cache']);

./Sources/ModerationCenter.php
Operation #1
Find:
@version 2.0.1
Replace With:
@version 2.0.12

Operation #2
Find:
$context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
Replace With:
$context['admin_preferences'] = !empty($options['admin_preferences']) ? safe_unserialize($options['admin_preferences']) : array();

./Sources/Modlog.php
Operation #1
Find:
@version 2.0.11
Replace With:
@version 2.0.12

Operation #2
Find:
$row['extra'] = @unserialize($row['extra']);
Replace With:
$row['extra'] = safe_unserialize($row['extra']);

./Sources/Packages.php
Operation #1
Find:
@version 2.0.11
Replace With:
@version 2.0.12

Operation #2
Find:
$db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
Replace With:
$db_changes = empty($row['db_changes']) ? array() : safe_unserialize($row['db_changes']);

Operation #3
Find:
$theme_data = unserialize(base64_decode($change));
Replace With:
$theme_data = safe_unserialize(base64_decode($change));

Operation #4
Find:
$db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
Replace With:
$db_changes = empty($row['db_changes']) ? array() : safe_unserialize($row['db_changes']);

Operation #5
Find:
$old_db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
Replace With:
$old_db_changes = empty($row['db_changes']) ? array() : safe_unserialize($row['db_changes']);

Operation #6
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

./Sources/PersonalMessage.php
Operation #1
Find:
@version 2.0.5
Replace With:
@version 2.0.12

Operation #2
Find:
'criteria' => unserialize($row['criteria']),
Replace With:
'criteria' => safe_unserialize($row['criteria']),

Operation #3
Find:
'actions' => unserialize($row['actions']),
Replace With:
'actions' => safe_unserialize($row['actions']),

./Sources/Post.php
Operation #1
Find:
@version 2.0.10
Replace With:
@version 2.0.12

Operation #2
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #3
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

./Sources/Profile-Actions.php
Operation #1
Find:
@version 2.0.6
Replace With:
@version 2.0.12

Operation #2
Find:
$costs = @unserialize($sub['real_cost']);
Replace With:
$costs = safe_unserialize($sub['real_cost']);

Operation #3
Find:
$current_pending = @unserialize($context['current'][$_GET['sub_id']]['pending_details']);
Replace With:
$current_pending = safe_unserialize($context['current'][$_GET['sub_id']]['pending_details']);

Operation #4
Find:
$current_pending = @unserialize($context['current'][$context['sub']['id']]['pending_details']);
Replace With:
$current_pending = safe_unserialize($context['current'][$context['sub']['id']]['pending_details']);

./Sources/Profile-Modify.php
Operation #1
Find:
@version 2.0.7
Replace With:
@version 2.0.12

Operation #2
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

./Sources/Profile-View.php
Operation #1
Find:
@version 2.0.5
Replace With:
@version 2.0.12

Operation #2
Find:
$extra = @unserialize($row['extra']);
Replace With:
$extra = safe_unserialize($row['extra']);

./Sources/Register.php
Operation #1
Find:
if ($row['mask'] == 'email' && (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $value) === 0 || strlen($value) > 255))
Replace With:
if ($row['mask'] == 'email' && !empty($value) && (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $value) === 0 || strlen($value) > 255))

./Sources/RemoveTopic.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
Replace With:
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);

Operation #3
Find:
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
Replace With:
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);

./Sources/SearchAPI-Custom.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
$this->indexSettings = unserialize($modSettings['search_custom_index_config']);
Replace With:
$this->indexSettings = safe_unserialize($modSettings['search_custom_index_config']);

./Sources/Subs-Charset.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1)
Replace With:
if (safe_unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1)

./Sources/Subs-Graphics.php
Operation #1
Find:
@version 2.0.9
Replace With:
@version 2.0.12

Operation #2
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

./Sources/Subs-Members.php
Operation #1
Find:
@version 2.0.7
Replace With:
@version 2.0.12

Operation #2
Find:
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $regOptions['email'])
Replace With:
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,15})$~', $regOptions['email'])

./Sources/Subs-MembersOnline.php
Operation #1
Find:
@version 2.0
Replace With:
@version 2.0.12

Operation #2
Find:
$spiders = unserialize($modSettings['spider_name_cache']);
Replace With:
$spiders = safe_unserialize($modSettings['spider_name_cache']);

./Sources/Subs-Menu.php
Operation #1
Find:
@version 2.0.1
Replace With:
@version 2.0.12

Operation #2
Find:
$menu_context['sections'][$section_id]['areas'][$area_id] = unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9'));
Replace With:
$menu_context['sections'][$section_id]['areas'][$area_id] = safe_unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9'));

./Sources/Subs-Post.php
Operation #1
Find:
@version 2.0.8
Replace With:
@version 2.0.12
This operation isn't vital to the installation of this mod.

Operation #2
Find:
@version 2.0.10
Replace With:
@version 2.0.12
This operation isn't vital to the installation of this mod.

Operation #3
Find:
$criteria = unserialize($row['criteria']);
Replace With:
$criteria = safe_unserialize($row['criteria']);

Operation #4
Find:
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
Replace With:
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);

Operation #5
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #6
Find:
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
Replace With:
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);

Operation #7
Find:

   $message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', 'nobbc__preg_callback', $message);
Replace With:

   $message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', 'nobbc__preg_callback', $message);

   // Remove empty bbc.
   $message = preg_replace('~\[([^\]=\s]+)[^\]]*\](?' . '>\s|(?R))*?\[/\1\]\s?~i', '', $message);

./Sources/Subs.php
Operation #1
Find:
@version 2.0.11
Replace With:
@version 2.0.12

Operation #2
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #3
Find:
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
Replace With:
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);

Operation #4
Find:
function safe_unserialize($data)
{
   // There's no reason input should contain an object,
   // user is up to no good...
   if (preg_match('/(^|;|{|})O:([0-9]|\+|\-)+/', $data) === 0)
      return @unserialize($data);
}
Replace With:
/**
 * Safe serialize() and unserialize() replacements
 *
 * @license Public Domain
 *
 * @author anthon (dot) pang (at) gmail (dot) com
 */

/**
 * Safe serialize() replacement. Recursive
 * - output a strict subset of PHP's native serialized representation
 * - does not serialize objects
 *
 * @param mixed $value
 * @return string
 */
function _safe_serialize($value)
{
   if(is_null($value))
      return 'N;';

   if(is_bool($value))
      return 'b:'. (int) $value .';';

   if(is_int($value))
      return 'i:'. $value .';';

   if(is_float($value))
      return 'd:'. str_replace(',', '.', $value) .';';

   if(is_string($value))
      return 's:'. strlen($value) .':"'. $value .'";';

   if(is_array($value))
   {
      $out = '';
      foreach($value as $k => $v)
         $out .= _safe_serialize($k) . _safe_serialize($v);

      return 'a:'. count($value) .':{'. $out .'}';
   }

   // safe_serialize cannot serialize resources or objects.
   return false;
}
/**
 * Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issues.
 *
 * @param mixed $value
 * @return string
 */
function safe_serialize($value)
{
   // Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
   if (function_exists('mb_internal_encoding') &&
      (((int) ini_get('mbstring.func_overload')) & 2))
   {
      $mbIntEnc = mb_internal_encoding();
      mb_internal_encoding('ASCII');
   }

   $out = _safe_serialize($value);

   if (isset($mbIntEnc))
      mb_internal_encoding($mbIntEnc);

   return $out;
}

/**
 * Safe unserialize() replacement
 * - accepts a strict subset of PHP's native serialized representation
 * - does not unserialize objects
 *
 * @param string $str
 * @return mixed
 * @throw Exception if $str is malformed or contains unsupported types (e.g., resources, objects)
 */
function _safe_unserialize($str)
{
   // Input exceeds 4096.
   if(strlen($str) > 4096)
      return false;

   // Input  is not a string.
   if(empty($str) || !is_string($str))
      return false;

   $stack = array();
   $expected = array();

   /*
    * states:
    *   0 - initial state, expecting a single value or array
    *   1 - terminal state
    *   2 - in array, expecting end of array or a key
    *   3 - in array, expecting value or another array
    */
   $state = 0;
   while($state != 1)
   {
      $type = isset($str[0]) ? $str[0] : '';
      if($type == '}')
         $str = substr($str, 1);

      else if($type == 'N' && $str[1] == ';')
      {
         $value = null;
         $str = substr($str, 2);
      }
      else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
      {
         $value = $matches[1] == '1' ? true : false;
         $str = substr($str, 4);
      }
      else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
      {
         $value = (int)$matches[1];
         $str = $matches[2];
      }
      else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
      {
         $value = (float)$matches[1];
         $str = $matches[3];
      }
      else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
      {
         $value = substr($matches[2], 0, (int)$matches[1]);
         $str = substr($matches[2], (int)$matches[1] + 2);
      }
      else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < 256)
      {
         $expectedLength = (int)$matches[1];
         $str = $matches[2];
      }

      // Object or unknown/malformed type.
      else
         return false;

      switch($state)
      {
         case 3: // In array, expecting value or another array.
            if($type == 'a')
            {
               // Array nesting exceeds 3.
               if(count($stack) >= 3)
                  return false;

               $stack[] = &$list;
               $list[$key] = array();
               $list = &$list[$key];
               $expected[] = $expectedLength;
               $state = 2;
               break;
            }
            if($type != '}')
            {
               $list[$key] = $value;
               $state = 2;
               break;
            }

            // Missing array value.
            return false;

         case 2: // in array, expecting end of array or a key
            if($type == '}')
            {
               // Array size is less than expected.
               if(count($list) < end($expected))
                  return false;

               unset($list);
               $list = &$stack[count($stack)-1];
               array_pop($stack);

               // Go to terminal state if we're at the end of the root array.
               array_pop($expected);

               if(count($expected) == 0)
                  $state = 1;

               break;
            }

            if($type == 'i' || $type == 's')
            {
               // Array size exceeds 256.
               if(count($list) >= 256)
                  return false;

               // Array size exceeds expected length.
               if(count($list) >= end($expected))
                  return false;

               $key = $value;
               $state = 3;
               break;
            }

            // Illegal array index type.
            return false;

         // Expecting array or value.
         case 0:
            if($type == 'a')
            {
               // Array nesting exceeds 3.
               if(count($stack) >= 3)
                  return false;

               $data = array();
               $list = &$data;
               $expected[] = $expectedLength;
               $state = 2;
               break;
            }

            if($type != '}')
            {
               $data = $value;
               $state = 1;
               break;
            }

            // Not in array.
            return false;
      }
   }

   // Trailing data in input.
   if(!empty($str))
      return false;

   return $data;
}

/**
 * Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue
 *
 * @param string $str
 * @return mixed
 */
function safe_unserialize($str)
{
   // Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
   if (function_exists('mb_internal_encoding') &&
      (((int) ini_get('mbstring.func_overload')) & 0x02))
   {
      $mbIntEnc = mb_internal_encoding();
      mb_internal_encoding('ASCII');
   }

   $out = _safe_unserialize($str);

   if (isset($mbIntEnc))
      mb_internal_encoding($mbIntEnc);

   return $out;
}

./Sources/Subscriptions-PayPal.php
Operation #1
Find:
if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'http://www.') . 'paypal.com/cgi-bin/webscr'))
Replace With:
      if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr'))

Operation #2
Find:
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
Replace With:
$fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);

./Sources/Themes.php
Operation #1
Find:
@version 2.0.4
Replace With:
@version 2.0.12

Operation #2
Find:
$install_info += unserialize($match[1]);
Replace With:
$install_info += safe_unserialize($match[1]);

Operation #3
Find:
$options['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
Replace With:
$options['admin_preferences'] = !empty($options['admin_preferences']) ? safe_unserialize($options['admin_preferences']) : array();

Operation #4
Find:
updateMemberData((int) $_REQUEST['u'], array('id_theme' => (int) $_GET['th']));
Replace With:
if (isset($_GET['th']) && $_GET['th'] == 0)
            $_GET['th'] = $modSettings['theme_guests'];

         updateMemberData((int) $_REQUEST['u'], array('id_theme' => (int) $_GET['th']));

./Sources/Who.php
Operation #1
Find:
@version 2.0.2
Replace With:
@version 2.0.12

Operation #2
Find:
$actions = @unserialize($row['url']);
Replace With:
$actions = safe_unserialize($row['url']);

Operation #3
Find:
foreach (unserialize($modSettings['spider_name_cache']) as $id => $name)
Replace With:
foreach (safe_unserialize($modSettings['spider_name_cache']) as $id => $name)

Operation #4
Find:
$actions = @unserialize($url[0]);
Replace With:
$actions = safe_unserialize($url[0]);

./subscriptions.php
Operation #1
Find:
@version 2.0.2
Replace With:
@version 2.0.12

Operation #2
Find:
$cost = unserialize($subscription_info['cost']);
Replace With:
$cost = safe_unserialize($subscription_info['cost']);

Operation #3
Find:
$real_details = @unserialize($subscription_info['pending_details']);
Replace With:
$real_details = safe_unserialize($subscription_info['pending_details']);

./Themes/default/scripts/editor.js
Operation #1
Find:
         oMyStyle.styleSheet.cssText = document.styleSheets['editor_ie_css'] ? document.styleSheets['editor_ie_css'].cssText : document.styleSheets['editor_css'].cssText;
Replace With:

         if (oMyStyle.styleSheet)
            oMyStyle.styleSheet.cssText = document.styleSheets['editor_ie_css'] ? document.styleSheets['editor_ie_css'].cssText : document.styleSheets['editor_css'].cssText;
         else
            oMyStyle.sheet.cssText = document.styleSheets['editor_ie_css'] ? document.styleSheets['editor_ie_css'].cssText : document.styleSheets['editor_css'].cssText;

Operation #2
Find:
this.oSmileyPopupWindow = window.open('about:blank', this.opt.sUniqueId + '_addMoreSmileysPopup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes');
Replace With:
this.oSmileyPopupWindow = window.open('', this.opt.sUniqueId + '_addMoreSmileysPopup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes');

Operation #3
Find:
this.bRichTextPossible = !this.opt.bRichEditOff && ((is_ie5up && !is_ie50) || is_ff || is_opera95up || is_safari || is_chrome) && !(is_iphone || is_android);
Replace With:
this.bRichTextPossible = !this.opt.bRichEditOff && ((is_ie5up && !is_ie50) || is_ff || is_opera95up || is_safari || is_chrome);

./Themes/default/Themes.template.php
Operation #1
Find:
@version 2.0.7
Replace With:
@version 2.0.12
This operation isn't vital to the installation of this mod.

Operation #2
Find:
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $theme['name'], '</a>
Replace With:
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $theme['name'], (!empty($theme['variants']) ? ';vrt=' . $theme['selected_variant'] : ''), '</a>

Operation #3
Find:
                  <li>
                     <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '" id="theme_use_', $theme['id'], '">[', $txt['theme_set'], ']</a>
                  </li>
                  <li>
                     <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';theme=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '" id="theme_preview_', $theme['id'], '">[', $txt['theme_preview'], ']</a>
                  </li>
Replace With:
                  <li>
                     <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], (!empty($theme['variants']) ? ';vrt=' . $theme['selected_variant'] : ''), '" id="theme_use_', $theme['id'], '">[', $txt['theme_set'], ']</a>
                  </li>
                  <li>
                     <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';theme=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'],  (!empty($theme['variants']) ? ';vrt=' . $theme['selected_variant'] : ''), '" id="theme_preview_', $theme['id'], '">[', $txt['theme_preview'], ']</a>
                  </li>
--- End quote ---

Navigation

[0] Message Index

Go to full version