Skip to content

Commit

Permalink
Format dates with php instead of mysql for consistency in allowing mo…
Browse files Browse the repository at this point in the history
…nth names to be translated.
  • Loading branch information
bramley authored and Sam Tuke committed Jan 7, 2019
1 parent a2ffacf commit 478c8a3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
3 changes: 1 addition & 2 deletions public_html/lists/admin/actions/bounces.php
Expand Up @@ -32,7 +32,6 @@
, message_bounce.message
, time
, bounce
, date_format(time,"%%e %%b %%Y %%T") as ftime
from
%s as message_bounce
where
Expand All @@ -44,7 +43,7 @@
$bouncels->addElement($row['bounce'],
PageURL2('bounce', s('view'), 'id=' . $row['bounce']));
$bouncels->addColumn($row['bounce'], s('Campaign title'), stripslashes($messagedata['campaigntitle']));
$bouncels->addColumn($row['bounce'], s('time'), $row['ftime']);
$bouncels->addColumn($row['bounce'], s('time'), formatDateTime($row['time'], true));
}
echo $bouncels->display();
} else {
Expand Down
4 changes: 2 additions & 2 deletions public_html/lists/admin/actions/mviews.php
Expand Up @@ -61,7 +61,7 @@
$limit = 'limit 10';

$req = Sql_Query(sprintf('select msg.id as messageid,count(um.viewed) as views, count(um.status) as total,
subject,date_format(sent,"%%e %%b %%Y") as sent,bouncecount as bounced from %s um,%s msg
subject,sent,bouncecount as bounced from %s um,%s msg
where um.messageid = msg.id and um.status = "sent" %s %s
group by msg.id order by msg.entered desc limit 50', $GLOBALS['tables']['usermessage'],
$GLOBALS['tables']['message'], $subselect, $timerange));
Expand All @@ -87,7 +87,7 @@
$ls->setClass($element, 'row1');
if (!empty($row['sent'])) {
$ls->addRow($element,
'<div class="listingsmall gray">'.s('date').': '.$row['sent'].'</div>', '');
'<div class="listingsmall gray">'.s('date').': '.formatDate($row['sent'], true).'</div>', '');
} else {
$ls->addRow($element,
'<div class="listingsmall gray">'.s('date').': '.s('in progress').'</div>',
Expand Down
7 changes: 3 additions & 4 deletions public_html/lists/admin/actions/statsoverview.php
Expand Up @@ -68,9 +68,8 @@
$timerange = ' and msg.entered > date_sub(now(),interval 12 month)';
$timerange = '';

$query = sprintf('select msg.owner,msg.id as messageid,
subject,date_format(sent,"%%e %%b %%Y") as sent,
bouncecount as bounced from %s msg where msg.status = "sent" %s %s %s
$query = sprintf('select msg.owner,msg.id as messageid, subject, sent, bouncecount as bounced
from %s msg where msg.status = "sent" %s %s %s
group by msg.id order by msg.entered desc',
$GLOBALS['tables']['message'], $subselect, $timerange, $ownership);
$req = Sql_Query($query);
Expand Down Expand Up @@ -132,7 +131,7 @@
PageURL2('statsoverview&amp;id='.$row['messageid'])); //,PageURL2('message&amp;id='.$row['messageid']));
$ls->setClass($element, 'row1');
// $ls->addColumn($element,s('owner'),$row['owner']);
$ls->addColumn($element, s('date'), $row['sent']);
$ls->addColumn($element, s('date'), formatDate($row['sent'], true));
$ls->addColumn($element, s('sent'), number_format((int)$totls[0]));
$ls->addColumn($element, s('bncs').Help("bounces"), number_format((int)$row['bounced']).$percentBouncedFormatted);
$ls->addColumn($element, s('fwds').Help("forwards"), number_format((int)$fwded[0]));
Expand Down
8 changes: 4 additions & 4 deletions public_html/lists/admin/uclicks.php
Expand Up @@ -94,9 +94,9 @@
if ($download) {
header('Content-disposition: attachment; filename="phpList URL click statistics for '.$urldata['url'].'.csv"');
}
$req = Sql_Query(sprintf('select messageid,firstclick,date_format(latestclick,
"%%e %%b %%Y %%H:%%i") as latestclick,total,clicked from %s where forwardid = %d and firstclick is not null order by firstclick desc
', $GLOBALS['tables']['linktrack_ml'], $id));
$req = Sql_Query(sprintf('select messageid,firstclick,latestclick,total,clicked
from %s where forwardid = %d and firstclick is not null order by firstclick desc',
$GLOBALS['tables']['linktrack_ml'], $id));
$summary = array();
$summary['totalsent'] = 0;
$summary['totalclicks'] = 0;
Expand Down Expand Up @@ -128,7 +128,7 @@
$ls->addElement($element, PageUrl2('mclicks&amp;id='.$row['messageid']));
$ls->setClass($element, 'row1');
$ls->addColumn($element, $GLOBALS['I18N']->get('firstclick'), formatDateTime($row['firstclick'], 1));
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), $row['latestclick']);
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), formatDateTime($row['latestclick'], 1));
$ls->addRow($element,
'<div class="listingsmall gray">'.$GLOBALS['I18N']->get('sent').': '.$row['total'].'</div>', '');
// $ls->addColumn($element,$GLOBALS['I18N']->get('clicks'),$row['clicked'].'<span class="viewusers"><a class="button" href="'.PageUrl2('userclicks&amp;msgid='.$row['messageid'].'&amp;fwdid='.$id.'" title="'.$GLOBALS['I18N']->get('view users').'"></a></span>'));
Expand Down
16 changes: 8 additions & 8 deletions public_html/lists/admin/userclicks.php
Expand Up @@ -87,8 +87,8 @@
</table>';
echo '<div class="fright">'.PageLinkButton('userclicks&fwdid='.$fwdid.'&msgid='.$msgid.'&dl=1',
s('Download subscribers')).'</div>';
$query = sprintf('select htmlclicked, textclicked, user.email,user.id as userid,firstclick,date_format(latestclick,
"%%e %%b %%Y %%H:%%i") as latestclick,clicked from %s as uml_click, %s as user where uml_click.userid = user.id
$query = sprintf('select htmlclicked, textclicked, user.email,user.id as userid,firstclick,latestclick,clicked
from %s as uml_click, %s as user where uml_click.userid = user.id
and uml_click.forwardid = %d and uml_click.messageid = %d
and uml_click.clicked', $GLOBALS['tables']['linktrack_uml_click'], $GLOBALS['tables']['user'], $fwdid, $msgid);
} elseif ($userid && $msgid) {
Expand All @@ -105,8 +105,8 @@
<tr><td>' .$GLOBALS['I18N']->get('Entered').'<td><td>'.$messagedata['entered'].'</td></tr>
<tr><td>' .$GLOBALS['I18N']->get('Sent').'<td><td>'.$messagedata['sent'].'</td></tr>
</table>';
$query = sprintf('select htmlclicked, textclicked,user.email,user.id as userid,firstclick,date_format(latestclick,
"%%e %%b %%Y %%H:%%i") as latestclick,clicked,messageid,forwardid,url from %s as uml_click, %s as user, %s as forward where uml_click.userid = user.id
$query = sprintf('select htmlclicked, textclicked,user.email,user.id as userid,firstclick,latestclick,
clicked,messageid,forwardid,url from %s as uml_click, %s as user, %s as forward where uml_click.userid = user.id
and uml_click.userid = %d and uml_click.messageid = %d and forward.id = uml_click.forwardid',
$GLOBALS['tables']['linktrack_uml_click'], $GLOBALS['tables']['user'], $GLOBALS['tables']['linktrack_forward'],
$userid, $msgid);
Expand All @@ -119,7 +119,7 @@
SELECT user.email,
user.id AS userid,
MIN(firstclick) AS firstclick,
DATE_FORMAT(MAX(latestclick), "%%e %%b %%Y %%H:%%i") AS latestclick,
MAX(latestclick) AS latestclick,
SUM(clicked) AS clicked
FROM %s AS uml_click
JOIN %s AS user ON uml_click.userid = user.id
Expand Down Expand Up @@ -149,7 +149,7 @@
SELECT DISTINCT user.email,
user.id AS userid,
MIN(firstclick) AS firstclick,
DATE_FORMAT(MAX(latestclick), "%%e %%b %%Y %%H:%%i") AS latestclick,
MAX(latestclick) AS latestclick,
SUM(clicked) AS clicked
FROM %s AS uml_click
JOIN %s AS user ON uml_click.userid = user.id
Expand All @@ -169,7 +169,7 @@
user.email,
user.id AS userid,
MIN(firstclick) AS firstclick,
DATE_FORMAT(MAX(latestclick), "%%e %%b %%Y %%H:%%i") AS latestclick,
MAX(latestclick) AS latestclick,
SUM(clicked) AS clicked,
GROUP_CONCAT(messageid ORDER BY messageid SEPARATOR \' \') AS messageid,
forwardid,
Expand Down Expand Up @@ -243,7 +243,7 @@ function ($matches) {
$userStatus['confirmed'] && empty($userStatus['blacklisted']) ? $GLOBALS['img_tick'] : $GLOBALS['img_cross']);
}
$ls->addColumn($element, $GLOBALS['I18N']->get('firstclick'), formatDateTime($row['firstclick'], 1));
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), $row['latestclick']);
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), formatDateTime($row['latestclick'], 1));
$ls->addColumn($element, $GLOBALS['I18N']->get('clicks'), $row['clicked'].$ls_userid);
if (!empty($row['htmlclicked']) && !empty($row['textclicked'])) {
$ls->addRow($element,
Expand Down

0 comments on commit 478c8a3

Please sign in to comment.