Skip to content

Commit

Permalink
Merge pull request #4848 from jdarwood007/fixes2205
Browse files Browse the repository at this point in the history
Ensure signature image limit don't break the forum
  • Loading branch information
jdarwood007 committed Jul 22, 2018
2 parents e7ba5cd + e52004f commit 784b500
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,17 @@ function Display()
$context['signature_enabled'] = substr($modSettings['signature_settings'], 0, 1) == 1;
$context['disabled_fields'] = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();

// Prevent signature images from going outside the box.
if ($context['signature_enabled'])
{
list ($sig_limits, $sig_bbc) = explode(':', $modSettings['signature_settings']);
$sig_limits = explode(',', $sig_limits);

if (!empty($sig_limits[5]) || !empty($sig_limits[6]))
addInlineCss('
.signature img { ' . (!empty($sig_limits[5]) ? 'max-width: ' . (int) $sig_limits[5] . 'px; ' : '') . (!empty($sig_limits[6]) ? 'max-height: ' . (int) $sig_limits[6] . 'px; ' : '') . '}');
}

// Censor the title...
censorText($context['topicinfo']['subject']);
$context['page_title'] = $context['topicinfo']['subject'];
Expand Down
11 changes: 11 additions & 0 deletions Sources/PersonalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,17 @@ function MessageFolder()
$context['signature_enabled'] = substr($modSettings['signature_settings'], 0, 1) == 1;
$context['disabled_fields'] = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();

// Prevent signature images from going outside the box.
if ($context['signature_enabled'])
{
list ($sig_limits, $sig_bbc) = explode(':', $modSettings['signature_settings']);
$sig_limits = explode(',', $sig_limits);

if (!empty($sig_limits[5]) || !empty($sig_limits[6]))
addInlineCss('
.signature img { ' . (!empty($sig_limits[5]) ? 'max-width: ' . (int) $sig_limits[5] . 'px; ' : '') . (!empty($sig_limits[6]) ? 'max-height: ' . (int) $sig_limits[6] . 'px; ' : '') . '}');
}

$labelJoin = '';
$labelQuery = '';
$labelQuery2 = '';
Expand Down
11 changes: 11 additions & 0 deletions Sources/Profile-View.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ function summary($memID)
// Is the signature even enabled on this forum?
$context['signature_enabled'] = substr($modSettings['signature_settings'], 0, 1) == 1;

// Prevent signature images from going outside the box.
if ($context['signature_enabled'])
{
list ($sig_limits, $sig_bbc) = explode(':', $modSettings['signature_settings']);
$sig_limits = explode(',', $sig_limits);

if (!empty($sig_limits[5]) || !empty($sig_limits[6]))
addInlineCss('
.signature img { ' . (!empty($sig_limits[5]) ? 'max-width: ' . (int) $sig_limits[5] . 'px; ' : '') . (!empty($sig_limits[6]) ? 'max-height: ' . (int) $sig_limits[6] . 'px; ' : '') . '}');
}

// How about, are they banned?
$context['member']['bans'] = array();
if (allowedTo('moderate_forum'))
Expand Down

0 comments on commit 784b500

Please sign in to comment.