Skip to content

Commit

Permalink
Bounces' subscriber' status indicator + allowing to confirm right fro…
Browse files Browse the repository at this point in the history
…m bounces (#1029)

* Update listbounces.php

Added support for confirmed/blacklisted indicator

* Update bounces.php

Added confirmed/blacklisted indicator

* Update bounce.php

1. Added confirmed/blacklisted indicator
1. Added support for confirming user from a bounce

* Update bounce.php

1. Avoided ternary if because translation system doesn't support it
1. Used the newer s() function

* Update listbounces.php

Added curly brackets

* Used potential translation
  • Loading branch information
lwcorp authored Mar 30, 2024
1 parent 15b07a7 commit 3cf5693
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
29 changes: 23 additions & 6 deletions public_html/lists/admin/bounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$deletebounce = isset($_GET['deletebounce']); //BUGFIX #15286 - nickyoung
$amount = isset($_GET['amount']) ? sprintf('%d', $_GET['amount']) : ''; //BUGFIX #15286 - CS2
$unconfirm = isset($_GET['unconfirm']); //BUGFIX #15286 - CS2
$confirm = isset($_GET['confirm']);
$maketext = isset($_GET['maketext']); //BUGFIX #15286 - CS2
$deleteuser = isset($_GET['deleteuser']); //BUGFIX #15286 - CS2

Expand Down Expand Up @@ -76,10 +77,14 @@
}
}

if (!empty($userid) && $unconfirm) {
Sql_Query(sprintf('update %s set confirmed = 0 where id = %d',
if (!empty($userid) && ($unconfirm || $confirm)) {
Sql_Query(sprintf('update %s set confirmed = ' . ($confirm ? '1' : '0') . ' where id = %d',
$tables['user'], $userid));
$actionresult .= sprintf($GLOBALS['I18N']->get('Made subscriber %s unconfirmed').'<br />', $userid);
if ($confirm) {
$actionresult .= sprintf(s('Made subscriber %s confirmed').'<br />', $userid);
} else {
$actionresult .= sprintf(s('Made subscriber %s unconfirmed').'<br />', $userid);
}
}

if (!empty($userid) && $maketext) {
Expand Down Expand Up @@ -164,16 +169,28 @@
$GLOBALS['I18N']->get('Memo for this rule'));
$newruleform .= '<tr><td colspan="2"><p class="submit"><input type="submit" name="add" value="'.$GLOBALS['I18N']->get('Add new Rule').'" /></p></td></tr>';
$newruleform .= '</table></form>';

$actionpanel = '';
$actionpanel .= '<form method="get" action="">';
$actionpanel .= '<input type="hidden" name="page" value="'.$page.'" />';
$actionpanel .= '<input type="hidden" name="id" value="'.$id.'" />';
$actionpanel .= '<input type="hidden" name="type" value="'.$type.'" />';
$actionpanel .= '<table class="bounceActions">';
$actionpanel .= '<tr><td>'.$GLOBALS['I18N']->get('For subscriber with email').'</td><td><input type="text" name="useremail" value="'.$guessedemail.'" size="35" /></td></tr>';
list($msgDetails, $userDetails, $furtherDetails) = array('', '', '');
if (preg_match("#bounced list message ([\d]+)#", $bounce['status'], $regs))
$msgDetails = s('Campaign') . '&nbsp;' . PageLink2('message&id='.$regs[1], shortenTextDisplay(campaignTitle($regs[1]), 30));
if (isset($guessedid)) {
$userDetails = Sql_Fetch_Assoc_Query(sprintf('select confirmed from %s where id = %d', $tables['user'], $guessedid));
if ($userDetails['confirmed'] && !isBlackListed(htmlspecialchars($guessedemail)))
$ls_confirmed = $GLOBALS['img_tick'];
else
$ls_confirmed = $GLOBALS['img_cross'];
$userDetails = s('User') . '&nbsp' . PageLink2('user&id='.$guessedid, $guessedid) . '&nbsp' . $ls_confirmed . '<br />(' . s('Subscribers with a red icon are either unconfirmed or blacklisted or both') . ')';
}
if (!empty($msgDetails) || !empty($userDetails))
$furtherDetails = '<br />' . $msgDetails . (empty($msgDetails) ? '' : '&nbsp') . $userDetails;
$actionpanel .= '<tr><td>'.s('For subscriber with email').$furtherDetails.'</td><td><input type="text" name="useremail" value="'.$guessedemail.'" size="35" /></td></tr>';
$actionpanel .= '<tr><td>'.$GLOBALS['I18N']->get('Increase bouncecount with').'<br />'.$GLOBALS['I18N']->get('(use negative numbers to decrease)').'</td><td><input type="text" name="amount" value="0" size="5" /></td></tr>';
$actionpanel .= '<tr><td>'.$GLOBALS['I18N']->get('Mark subscriber as unconfirmed').'<br />'.$GLOBALS['I18N']->get('(so you can resend the request for confirmation)').' </td><td><input type="checkbox" name="unconfirm" value="1" /></td></tr>';
$actionpanel .= '<tr><td>'.s('Mark subscriber as unconfirmed').'<br />'.s('(so you can resend the request for confirmation)').'<br />'.s('or confirmed').'<br />'.s('(so you can revert possible auto unconfirmation)'). ' </td><td>'.s('unconfirmed').'<input onclick="if (this.checked && form.confirm.checked) form.confirm.checked=false" type="checkbox" name="unconfirm" value="1" />'.s('confirmed').'<input onclick="if (this.checked && form.unconfirm.checked) form.unconfirm.checked=false" type="checkbox" name="confirm" value="1" /></td></tr>';
$actionpanel .= '<tr><td>'.$GLOBALS['I18N']->get('Set subscriber to receive text instead of HTML').' </td><td><input type="checkbox" name="maketext" value="1" /></td></tr>';
$actionpanel .= '<tr><td>'.$GLOBALS['I18N']->get('Delete subscriber').' </td><td><input type="checkbox" name="deleteuser" value="1" /></td></tr>';
if (ALLOW_DELETEBOUNCE) {
Expand Down
11 changes: 9 additions & 2 deletions public_html/lists/admin/bounces.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@
break;

}
}
} elseif ($status == 'processed')
echo s('Subscribers with a red icon are either unconfirmed or blacklisted or both');

$ls = new WebblerListing(s($status).' '.s('bounces'));
$ls->setElementHeading('Bounce ID');
Expand Down Expand Up @@ -195,7 +196,13 @@
preg_match("#([\d]+) bouncecount increased#", $bounce['comment'], $regs)
OR preg_match("#([\d]+) marked unconfirmed#", $bounce['comment'], $regs)
) {
$userIdLink = PageLink2('user&id='.$regs[1], getUserEmail($regs[1]));
$userIdLink = PageLink2('user&id='.$regs[1], ($regs[1]));
$userDetails = Sql_Fetch_Assoc_Query(sprintf('select email, confirmed from %s where id = %d', $tables['user'], $regs[1]));
if ($userDetails['confirmed'] && !isBlackListed(htmlspecialchars($userDetails['email'])))
$ls_confirmed = $GLOBALS['img_tick'];
else
$ls_confirmed = $GLOBALS['img_cross'];
$userIdLink .= '&nbsp;' . $ls_confirmed;
} elseif ($bounce['comment'] == 'not processed') {
$userIdLink = $GLOBALS['I18N']->get('Unknown');
} else {
Expand Down
10 changes: 9 additions & 1 deletion public_html/lists/admin/listbounces.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,22 @@
if ($download) {
echo $userdata['email']."\n";
} else {
if ($userdata['confirmed'] && !isBlackListed(htmlspecialchars($userdata['email']))) {
$ls_confirmed = $GLOBALS['img_tick'];
} else {
$ls_confirmed = $GLOBALS['img_cross'];
}
$ls->addElement($row['userid'], PageUrl2('user&amp;id='.$row['userid']));
$ls->addColumn($row['userid'], s('Subscriber address'), PageLink2('user&id='.$row['userid'], $userdata['email']));
$ls->addColumn($row['userid'], s('Subscriber address'), PageLink2('user&id='.$row['userid'], $userdata['email']) . '&nbsp;' . $ls_confirmed);
$ls->addColumn($row['userid'], s('Total bounces'),
PageLink2('user&id='.$row['userid'], $row['numbounces']));
}
}
}
if (!$download) {
if ($total) {
echo s('Subscribers with a red icon are either unconfirmed or blacklisted or both');
}
echo $ls->display();
} else {
exit;
Expand Down

0 comments on commit 3cf5693

Please sign in to comment.