Skip to content

Commit

Permalink
Actualizar a SMF 2.0.19
Browse files Browse the repository at this point in the history
Actualizada la versión base del foro a la última disponible.
  • Loading branch information
xaabi6 committed Dec 24, 2021
1 parent b94d023 commit defbf85
Show file tree
Hide file tree
Showing 57 changed files with 2,786 additions and 872 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion Packages/installed.list
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1639080853
1640301346
Binary file added Packages/smf_patch_2.0.19.tar.gz
Binary file not shown.
6 changes: 5 additions & 1 deletion Sources/Errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.16
* @version 2.0.19
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -216,6 +216,10 @@ function error_handler($error_level, $error_string, $file, $line)
if (strpos($error_string, 'create_function()') !== false)
return true;

// Also ignore these deprecation warnings introduced in PHP 8.1.
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID >= 80100 && strpos($error_string, 'strftime()') !== false)
return true;

if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename']))
{
if (function_exists('debug_backtrace'))
Expand Down
17 changes: 13 additions & 4 deletions Sources/Errors.php~
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.4
* @version 2.0.16
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -203,9 +203,18 @@ function error_handler($error_level, $error_string, $file, $line)
{
global $settings, $modSettings, $db_show_debug;

// Ignore errors if we're ignoring them or they are strict notices from PHP 5 (which cannot be solved without breaking PHP 4.)
if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && (empty($modSettings['enableErrorLogging']) || $modSettings['enableErrorLogging'] != 2)))
return;
// Error was suppressed with the @-operator.
if (error_reporting() == 0)
return true;

// Ignore errors that should should not be logged.
$error_match = error_reporting() & $error_level;
if (empty($error_match) || empty($modSettings['enableErrorLogging']))
return false;

// Send these notices introduced by PHP 7.2 to where the sun don't shine!
if (strpos($error_string, 'create_function()') !== false)
return true;

if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename']))
{
Expand Down
10 changes: 5 additions & 5 deletions Sources/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.18
* @version 2.0.19
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -172,10 +172,10 @@ function reloadSettings()
$utf8 = (empty($modSettings['global_character_set']) ? (!empty($txt['lang_character_set']) ? $txt['lang_character_set'] : '') : $modSettings['global_character_set']) === 'UTF-8' && (strpos(strtolower(PHP_OS), 'win') === false || @version_compare(PHP_VERSION, '4.2.3') != -1);

// Set a list of common functions.
$ent_list = empty($modSettings['disableEntityCheck']) ? '&(#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(#021|quot|amp|lt|gt|nbsp);';
$ent_check = empty($modSettings['disableEntityCheck']) ? function($string)
$ent_list = empty($modSettings['disableEntityCheck']) ? '&(?>#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(?>#021|quot|amp|lt|gt|nbsp);';
$ent_check = empty($modSettings['disableEntityCheck']) ? function($string, $double = false)
{
$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
$string = preg_replace_callback('~(&' . (!empty($double) ? '(?:amp;)?' : '') . '#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
return $string;
} : function($string)
{
Expand Down Expand Up @@ -232,7 +232,7 @@ function reloadSettings()
},
'htmlspecialchars' => function($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4)
{
return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset)));
return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset), true));
},
'fix_utf8mb4' => $fix_utf8mb4,
'htmltrim' => function($string) use ($utf8, $ent_check)
Expand Down
20 changes: 1 addition & 19 deletions Sources/Load.php~
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ function loadUserSettings()
$user_info += array(
'id' => $id_member,
'username' => $username,
'adk_notes' => isset($user_settings['adk_notes']) ? $user_settings['adk_notes'] : '',
'name' => isset($user_settings['real_name']) ? $user_settings['real_name'] : '',
'email' => isset($user_settings['email_address']) ? $user_settings['email_address'] : '',
'passwd' => isset($user_settings['passwd']) ? $user_settings['passwd'] : '',
Expand Down Expand Up @@ -826,16 +825,11 @@ function loadBoard()
if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
$board_info['error'] = 'access';

//Adk Portal
global $adkportal;
$adk_enable = $scripturl . '?action=forum#c' . $board_info['cat']['id'];
$adk_disable = $scripturl . '#c' . $board_info['cat']['id'];

// Build up the linktree.
$context['linktree'] = array_merge(
$context['linktree'],
array(array(
'url' => $adkportal['adk_enable'] == 1 ? $adk_enable : $adk_disable,
'url' => $scripturl . '#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
)),
array_reverse($board_info['parent_boards']),
Expand Down Expand Up @@ -1719,18 +1713,6 @@ function loadTheme($id_theme = 0, $initialize = true)
// Detect the browser. This is separated out because it's also used in attachment downloads
detectBrowser();

//Adk Portal Modifications
global $adkportal;
if((!empty($_REQUEST['topic']) || !empty($_REQUEST['board'])) && !empty($adkportal['adk_enable'])){

$url = $adkportal['adk_enable'] == 1 ? $scripturl.'?action=forum' : $scripturl;
array_unshift($context['linktree'], array(
'url' => $url,
'name' => $txt['foro']
));
}

//Modified by lucas-ruroken
// Set the top level linktree up.
array_unshift($context['linktree'], array(
'url' => $scripturl,
Expand Down
14 changes: 7 additions & 7 deletions Sources/ManageMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.16
* @version 2.0.19
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -825,20 +825,20 @@ function ConvertEntities()
if (empty($primary_key) || empty($columns))
continue;

// Get the maximum value for the primary key.
// Get the count of records.
$request = $smcFunc['db_query']('', '
SELECT MAX(' . $primary_key . ')
SELECT COUNT(*)
FROM {db_prefix}' . $cur_table,
array(
)
);
list($max_value) = $smcFunc['db_fetch_row']($request);
list($rec_count) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

if (empty($max_value))
if (empty($rec_count))
continue;

while ($context['start'] <= $max_value)
while ($context['start'] <= $rec_count)
{
// Retrieve a list of rows that has at least one entity to convert.
$request = $smcFunc['db_query']('', '
Expand Down Expand Up @@ -892,7 +892,7 @@ function ConvertEntities()
if (time() - $context['start_time'] > 10)
{
// Calculate an approximation of the percentage done.
$context['continue_percent'] = round(100 * ($context['table'] + ($context['start'] / $max_value)) / $context['num_tables'], 1);
$context['continue_percent'] = round(100 * ($context['table'] + ($context['start'] / $rec_count)) / $context['num_tables'], 1);
$context['continue_get_data'] = '?action=admin;area=maintain;sa=database;activity=convertentities;table=' . $context['table'] . ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'];
return;
}
Expand Down
9 changes: 2 additions & 7 deletions Sources/ManageMaintenance.php~
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.7
* @version 2.0.16
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -778,11 +778,6 @@ function ConvertEntities()
);
$context['num_tables'] = count($tables);

// This function will do the conversion later on.
$entity_replace = create_function('$string', '
$num = substr($string, 0, 1) === \'x\' ? hexdec(substr($string, 1)) : (int) $string;
return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) ? \'\' : ($num < 0x80 ? \'&#\' . $num . \';\' : ($num < 0x800 ? chr(192 | $num >> 6) . chr(128 | $num & 63) : ($num < 0x10000 ? chr(224 | $num >> 12) . chr(128 | $num >> 6 & 63) . chr(128 | $num & 63) : chr(240 | $num >> 18) . chr(128 | $num >> 12 & 63) . chr(128 | $num >> 6 & 63) . chr(128 | $num & 63))));');

// Loop through all tables that need converting.
for (; $context['table'] < $context['num_tables']; $context['table']++)
{
Expand Down Expand Up @@ -869,7 +864,7 @@ function ConvertEntities()
if ($column_name !== $primary_key && strpos($column_value, '&#') !== false)
{
$changes[] = $column_name . ' = {string:changes_' . $column_name . '}';
$insertion_variables['changes_' . $column_name] = preg_replace_callback('~&#(\d{1,7}|x[0-9a-fA-F]{1,6});~', 'fixchar__callback', $column_value);
$insertion_variables['changes_' . $column_name] = preg_replace_callback('~&#(\d{1,7}|x[0-9a-fA-F]{1,6});~', 'fixchardb__callback', $column_value);
}

$where = array();
Expand Down
3 changes: 2 additions & 1 deletion Sources/ModerationCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.18
* @version 2.0.19
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -1446,6 +1446,7 @@ function ViewWarnings()
function ViewWarningLog()
{
global $smcFunc, $modSettings, $context, $txt, $scripturl, $sourcedir;
global $settings;

// Setup context as always.
$context['page_title'] = $txt['mc_warning_log_title'];
Expand Down
60 changes: 27 additions & 33 deletions Sources/ModerationCenter.php~
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.12
* @version 2.0.18
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -1144,11 +1144,10 @@ function ViewWatchedUsers()
'value' => $txt['mc_watched_users_warning'],
),
'data' => array(
'function' => create_function('$member', '
global $scripturl;

return allowedTo(\'issue_warning\') ? \'<a href="\' . $scripturl . \'?action=profile;area=issuewarning;u=\' . $member[\'id\'] . \'">\' . $member[\'warning\'] . \'%</a>\' : $member[\'warning\'] . \'%\';
'),
'function' => function($member) use ($scripturl)
{
return allowedTo('issue_warning') ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $member['id'] . '">' . $member['warning'] . '%</a>' : $member['warning'] . '%';
},
),
'sort' => array(
'default' => 'warning',
Expand Down Expand Up @@ -1190,14 +1189,13 @@ function ViewWatchedUsers()
'value' => $txt['mc_watched_users_last_post'],
),
'data' => array(
'function' => create_function('$member', '
global $scripturl;

if ($member[\'last_post_id\'])
return \'<a href="\' . $scripturl . \'?msg=\' . $member[\'last_post_id\'] . \'">\' . $member[\'last_post\'] . \'</a>\';
'function' => function($member) use ($scripturl)
{
if ($member['last_post_id'])
return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>';
else
return $member[\'last_post\'];
'),
return $member['last_post'];
},
),
),
),
Expand Down Expand Up @@ -1226,9 +1224,10 @@ function ViewWatchedUsers()
$listOptions['columns'] = array(
'posts' => array(
'data' => array(
'function' => create_function('$post', '
'function' => function($post)
{
return template_user_watch_post_callback($post);
'),
},
),
),
);
Expand Down Expand Up @@ -1510,22 +1509,18 @@ function ViewWarningLog()
'value' => $txt['profile_warning_previous_reason'],
),
'data' => array(
'function' => create_function('$warning', '
global $scripturl, $settings, $txt;

$output = \'
'function' => function($rowData) use ($scripturl, $txt, $settings)
{
$output = '
<div class="floatleft">
\' . $warning[\'reason\'] . \'
</div>\';

if (!empty($warning[\'id_notice\']))
$output .= \'
<div class="floatright">
<a href="\' . $scripturl . \'?action=moderate;area=notice;nid=\' . $warning[\'id_notice\'] . \'" onclick="window.open(this.href, \\\'\\\', \\\'scrollbars=yes,resizable=yes,width=400,height=250\\\');return false;" target="_blank" class="new_win" title="\' . $txt[\'profile_warning_previous_notice\'] . \'"><img src="\' . $settings[\'default_images_url\'] . \'/filter.gif" alt="\' . $txt[\'profile_warning_previous_notice\'] . \'" /></a>
</div>\';
' . $rowData['reason'] . '
</div>';

if (!empty($rowData['id_notice']))
$output .= '
&nbsp;<a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $rowData['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" rel="noopener" class="new_win" title="' . $txt['profile_warning_previous_notice'] . '"><img src="' . $settings['default_images_url'] . '/filter.gif" alt="' . $txt['profile_warning_previous_notice'] . '" /></a>';
return $output;
'),
},
),
),
'points' => array(
Expand Down Expand Up @@ -1713,11 +1708,10 @@ function ViewWarningTemplates()
'style' => 'width: 4%;',
),
'data' => array(
'function' => create_function('$rowData', '
global $context, $txt, $scripturl;

return \'<input type="checkbox" name="deltpl[]" value="\' . $rowData[\'id_comment\'] . \'" class="input_check" />\';
'),
'function' => function($rowData)
{
return '<input type="checkbox" name="deltpl[]" value="' . $rowData['id_comment'] . '">';
},
'style' => 'text-align: center;',
),
),
Expand Down
4 changes: 2 additions & 2 deletions Sources/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.18
* @version 2.0.19
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -65,7 +65,7 @@ function ShowXmlFeed()
global $query_this_board, $smcFunc, $forum_version, $cdata_override;

// If it's not enabled, die.
if (empty($modSettings['xmlnews_enable']) && ($_GET['sa'] !== 'profile' || $_GET['u'] !== $user_info['id']))
if (empty($modSettings['xmlnews_enable']) && (empty($_GET['sa']) || empty($_GET['u']) || $_GET['sa'] !== 'profile' || $_GET['u'] !== $user_info['id']))
obExit(false);

loadLanguage('Stats');
Expand Down
8 changes: 4 additions & 4 deletions Sources/News.php~
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.17
* @version 2.0.18
*/

if (!defined('SMF'))
Expand Down Expand Up @@ -65,7 +65,7 @@ function ShowXmlFeed()
global $query_this_board, $smcFunc, $forum_version, $cdata_override;

// If it's not enabled, die.
if (empty($modSettings['xmlnews_enable']))
if (empty($modSettings['xmlnews_enable']) && ($_GET['sa'] !== 'profile' || $_GET['u'] !== $user_info['id']))
obExit(false);

loadLanguage('Stats');
Expand Down Expand Up @@ -904,7 +904,7 @@ function getXmlProfile($xml_format)
'summary' => cdata_parse(isset($profile['group']) ? $profile['group'] : $profile['post_group']),
'author' => array(
'name' => $profile['real_name'],
'email' => in_array(showEmailAddress(!empty($profile['hide_email']), $profile['id']), array('yes', 'yes_permission_override')) ? $profile['email'] : null,
'email' => $user_info['id'] == $profile['id'] || in_array($profile['show_email'], array('yes', 'yes_permission_override')) ? $profile['email'] : null,
'uri' => !empty($profile['website']) ? $profile['website']['url'] : ''
),
'published' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', $user_profile[$profile['id']]['date_registered']),
Expand Down Expand Up @@ -969,7 +969,7 @@ function getXmlProfile($xml_format)
'bad' => $profile['karma']['bad']
);

if (in_array($profile['show_email'], array('yes', 'yes_permission_override')))
if ($user_info['id'] == $profile['id'] || in_array($profile['show_email'], array('yes', 'yes_permission_override')))
$data['email'] = $profile['email'];

if (!empty($profile['birth_date']) && substr($profile['birth_date'], 0, 4) != '0000')
Expand Down
Loading

0 comments on commit defbf85

Please sign in to comment.