Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes to clean up the error log #663

Merged
merged 5 commits into from Jul 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions sources/Subs.php
Expand Up @@ -866,7 +866,7 @@ function shorten_text($text, $len = 384, $cutword = false, $buffer = 12)
if ($cutword)
{
// Look for len - buffer characters and cut on first word boundary after
preg_match('~(.{' . ($len - $buffer) . '}.*?)\b~s', $text, $matches);
preg_match('~(.{' . ($len - $buffer) . '}.*?)\b~su', $text, $matches);

// Always one clown in the audience who likes long words or not using the spacebar
if (Util::strlen($matches[1]) > $len + $buffer)
Expand Down Expand Up @@ -2130,7 +2130,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
}

// Item codes are complicated buggers... they are implicit [li]s and can make [list]s!
if ($smileys !== false && $tag === null && isset($itemcodes[$message[$pos + 1]]) && $message[$pos + 2] == ']' && !isset($disabled['list']) && !isset($disabled['li']))
if ($smileys !== false && $tag === null && isset($message[$pos + 2]) && isset($itemcodes[$message[$pos + 1]]) && $message[$pos + 2] === ']' && !isset($disabled['list']) && !isset($disabled['li']))
{
if ($message[$pos + 1] == '0' && !in_array($message[$pos - 1], array(';', ' ', "\t", "\n", '>')))
continue;
Expand Down Expand Up @@ -2448,7 +2448,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
else
$message = strtr($message, array("\n" => ''));

if ($message[0] === ' ')
if (isset($message[0]) && $message[0] === ' ')
$message = ' ' . substr($message, 1);

// Cleanup whitespace.
Expand Down Expand Up @@ -3204,7 +3204,7 @@ function template_footer()
*
* @todo - Note that type="text/javascript" and type="text/css" are deprecated in HTML5.
* @todo - There are several occurrences in this function, and the next one.
* @todo - Full directory search for any strays should be done, then hit the lot of them.
* @todo - Full directory search for any strays should be done, then hit the lot of them.
*/
function template_javascript($do_defered = false)
{
Expand Down
2 changes: 1 addition & 1 deletion sources/controllers/Likes.controller.php
Expand Up @@ -128,7 +128,7 @@ private function prepare_like()
}

// Past the post threshold?
if (!$user_info['is_admin'] && $user_info['posts'] < $modSettings['likeDisplayLimit'])
if (!$user_info['is_admin'] && !empty($modSettings['likeDisplayLimit']) && $user_info['posts'] < $modSettings['likeDisplayLimit'])
$check = false;

return $check;
Expand Down
2 changes: 1 addition & 1 deletion sources/subs/Modlog.subs.php
Expand Up @@ -348,7 +348,7 @@ function deleteLogAction($id_log, $time, $delete = null)
$db->query('', '
DELETE FROM {db_prefix}log_actions
WHERE id_log = {int:moderate_log}
' . isset($delete) ? 'AND id_action IN ({array_string:delete_actions})' : '' . '
' . (isset($delete) ? 'AND id_action IN ({array_string:delete_actions})' : '') . '
AND log_time < {int:twenty_four_hours_wait}',
array(
'twenty_four_hours_wait' => time() - $time * 3600,
Expand Down