Skip to content

Commit

Permalink
Fixed issue #9447: Token sending email is unusuable with a lot of token
Browse files Browse the repository at this point in the history
  • Loading branch information
Aestu committed Mar 16, 2015
1 parent 6630650 commit b131894
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions application/config/config-defaults.php
Expand Up @@ -385,6 +385,7 @@
$config['quexmlshowprintablehelp'] = false;

$config['minlengthshortimplode'] = 20; // Min length required to use short_implode instead of standard implode
$config['maxstringlengthshortimplode'] = 100; // short_implode: Max length of returned string

/**
* Statistics chart settings
Expand Down
13 changes: 10 additions & 3 deletions application/helpers/common_helper.php
Expand Up @@ -5636,7 +5636,7 @@ function isNumericInt($mStr)
* @param array $aArray
* @return string String showing array content
*/
function short_implode($sDelimeter, $aArray)
function short_implode($sDelimeter, $sHyphen, $aArray)
{
if (sizeof($aArray) < Yii::app()->getConfig('minlengthshortimplode'))
{
Expand All @@ -5656,7 +5656,14 @@ function short_implode($sDelimeter, $aArray)
}
else
{
$sResult = $sResult.', '.$aArray[$iIndexA];
if (strlen($sResult) > Yii::app()->getConfig('maxstringlengthshortimplode') - strlen($sDelimeter) - 3)
{
return $sResult.$sDelimeter.'...';
}
else
{
$sResult = $sResult.$sDelimeter.$aArray[$iIndexA];
}
}
$iIndexB = $iIndexA+1;
if ($iIndexB < sizeof($aArray))
Expand All @@ -5667,7 +5674,7 @@ function short_implode($sDelimeter, $aArray)
}
if ($iIndexA < $iIndexB - 1)
{
$sResult = $sResult.'-'.$aArray[$iIndexB-1];
$sResult = $sResult.$sHyphen.$aArray[$iIndexB-1];
}
}
$iIndexA = $iIndexB;
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/email.php
Expand Up @@ -88,7 +88,7 @@
{ ?>
<p>
<label><?php $clang->eT("Send invitation email to token ID(s):"); ?></label>
<?php echo short_implode(", ", (array) $tokenids); ?></p>
<?php echo short_implode(", ", "-", (array) $tokenids); ?></p>
<?php } ?>
<p>
<label for='bypassbademails'><?php $clang->eT("Bypass token with failing email addresses"); ?>:</label>
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/emailpost.php
Expand Up @@ -5,7 +5,7 @@
<?php
if ($tokenids)
{
echo " (" . $clang->gT("Sending to Token IDs") . ":&nbsp;" . implode(", ", $tokenids) . ")";
echo " (" . $clang->gT("Sending to Token IDs") . ":&nbsp;" . short_implode(", ", "-", $tokenids) . ")";
}
?>
<br /><br />
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/remind.php
Expand Up @@ -68,7 +68,7 @@
{ ?>
<li>
<label><?php $clang->eT("Send reminder to token ID(s):"); ?></label>
<?php echo short_implode(", ", (array) $tokenids); ?></li>
<?php echo short_implode(", ", "-", (array) $tokenids); ?></li>
<?php } ?>
<li><label for='bypassbademails'>
<?php $clang->eT("Bypass token with failing email addresses"); ?>:</label>
Expand Down

0 comments on commit b131894

Please sign in to comment.