Skip to content

Commit 478c8a3

Browse files
bramleySam Tuke
authored andcommitted
Format dates with php instead of mysql for consistency in allowing month names to be translated.
1 parent a2ffacf commit 478c8a3

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

public_html/lists/admin/actions/bounces.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
, message_bounce.message
3333
, time
3434
, bounce
35-
, date_format(time,"%%e %%b %%Y %%T") as ftime
3635
from
3736
%s as message_bounce
3837
where
@@ -44,7 +43,7 @@
4443
$bouncels->addElement($row['bounce'],
4544
PageURL2('bounce', s('view'), 'id=' . $row['bounce']));
4645
$bouncels->addColumn($row['bounce'], s('Campaign title'), stripslashes($messagedata['campaigntitle']));
47-
$bouncels->addColumn($row['bounce'], s('time'), $row['ftime']);
46+
$bouncels->addColumn($row['bounce'], s('time'), formatDateTime($row['time'], true));
4847
}
4948
echo $bouncels->display();
5049
} else {

public_html/lists/admin/actions/mviews.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
$limit = 'limit 10';
6262

6363
$req = Sql_Query(sprintf('select msg.id as messageid,count(um.viewed) as views, count(um.status) as total,
64-
subject,date_format(sent,"%%e %%b %%Y") as sent,bouncecount as bounced from %s um,%s msg
64+
subject,sent,bouncecount as bounced from %s um,%s msg
6565
where um.messageid = msg.id and um.status = "sent" %s %s
6666
group by msg.id order by msg.entered desc limit 50', $GLOBALS['tables']['usermessage'],
6767
$GLOBALS['tables']['message'], $subselect, $timerange));
@@ -87,7 +87,7 @@
8787
$ls->setClass($element, 'row1');
8888
if (!empty($row['sent'])) {
8989
$ls->addRow($element,
90-
'<div class="listingsmall gray">'.s('date').': '.$row['sent'].'</div>', '');
90+
'<div class="listingsmall gray">'.s('date').': '.formatDate($row['sent'], true).'</div>', '');
9191
} else {
9292
$ls->addRow($element,
9393
'<div class="listingsmall gray">'.s('date').': '.s('in progress').'</div>',

public_html/lists/admin/actions/statsoverview.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@
6868
$timerange = ' and msg.entered > date_sub(now(),interval 12 month)';
6969
$timerange = '';
7070

71-
$query = sprintf('select msg.owner,msg.id as messageid,
72-
subject,date_format(sent,"%%e %%b %%Y") as sent,
73-
bouncecount as bounced from %s msg where msg.status = "sent" %s %s %s
71+
$query = sprintf('select msg.owner,msg.id as messageid, subject, sent, bouncecount as bounced
72+
from %s msg where msg.status = "sent" %s %s %s
7473
group by msg.id order by msg.entered desc',
7574
$GLOBALS['tables']['message'], $subselect, $timerange, $ownership);
7675
$req = Sql_Query($query);
@@ -132,7 +131,7 @@
132131
PageURL2('statsoverview&amp;id='.$row['messageid'])); //,PageURL2('message&amp;id='.$row['messageid']));
133132
$ls->setClass($element, 'row1');
134133
// $ls->addColumn($element,s('owner'),$row['owner']);
135-
$ls->addColumn($element, s('date'), $row['sent']);
134+
$ls->addColumn($element, s('date'), formatDate($row['sent'], true));
136135
$ls->addColumn($element, s('sent'), number_format((int)$totls[0]));
137136
$ls->addColumn($element, s('bncs').Help("bounces"), number_format((int)$row['bounced']).$percentBouncedFormatted);
138137
$ls->addColumn($element, s('fwds').Help("forwards"), number_format((int)$fwded[0]));

public_html/lists/admin/uclicks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@
9494
if ($download) {
9595
header('Content-disposition: attachment; filename="phpList URL click statistics for '.$urldata['url'].'.csv"');
9696
}
97-
$req = Sql_Query(sprintf('select messageid,firstclick,date_format(latestclick,
98-
"%%e %%b %%Y %%H:%%i") as latestclick,total,clicked from %s where forwardid = %d and firstclick is not null order by firstclick desc
99-
', $GLOBALS['tables']['linktrack_ml'], $id));
97+
$req = Sql_Query(sprintf('select messageid,firstclick,latestclick,total,clicked
98+
from %s where forwardid = %d and firstclick is not null order by firstclick desc',
99+
$GLOBALS['tables']['linktrack_ml'], $id));
100100
$summary = array();
101101
$summary['totalsent'] = 0;
102102
$summary['totalclicks'] = 0;
@@ -128,7 +128,7 @@
128128
$ls->addElement($element, PageUrl2('mclicks&amp;id='.$row['messageid']));
129129
$ls->setClass($element, 'row1');
130130
$ls->addColumn($element, $GLOBALS['I18N']->get('firstclick'), formatDateTime($row['firstclick'], 1));
131-
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), $row['latestclick']);
131+
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), formatDateTime($row['latestclick'], 1));
132132
$ls->addRow($element,
133133
'<div class="listingsmall gray">'.$GLOBALS['I18N']->get('sent').': '.$row['total'].'</div>', '');
134134
// $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>'));

public_html/lists/admin/userclicks.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
</table>';
8888
echo '<div class="fright">'.PageLinkButton('userclicks&fwdid='.$fwdid.'&msgid='.$msgid.'&dl=1',
8989
s('Download subscribers')).'</div>';
90-
$query = sprintf('select htmlclicked, textclicked, user.email,user.id as userid,firstclick,date_format(latestclick,
91-
"%%e %%b %%Y %%H:%%i") as latestclick,clicked from %s as uml_click, %s as user where uml_click.userid = user.id
90+
$query = sprintf('select htmlclicked, textclicked, user.email,user.id as userid,firstclick,latestclick,clicked
91+
from %s as uml_click, %s as user where uml_click.userid = user.id
9292
and uml_click.forwardid = %d and uml_click.messageid = %d
9393
and uml_click.clicked', $GLOBALS['tables']['linktrack_uml_click'], $GLOBALS['tables']['user'], $fwdid, $msgid);
9494
} elseif ($userid && $msgid) {
@@ -105,8 +105,8 @@
105105
<tr><td>' .$GLOBALS['I18N']->get('Entered').'<td><td>'.$messagedata['entered'].'</td></tr>
106106
<tr><td>' .$GLOBALS['I18N']->get('Sent').'<td><td>'.$messagedata['sent'].'</td></tr>
107107
</table>';
108-
$query = sprintf('select htmlclicked, textclicked,user.email,user.id as userid,firstclick,date_format(latestclick,
109-
"%%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
108+
$query = sprintf('select htmlclicked, textclicked,user.email,user.id as userid,firstclick,latestclick,
109+
clicked,messageid,forwardid,url from %s as uml_click, %s as user, %s as forward where uml_click.userid = user.id
110110
and uml_click.userid = %d and uml_click.messageid = %d and forward.id = uml_click.forwardid',
111111
$GLOBALS['tables']['linktrack_uml_click'], $GLOBALS['tables']['user'], $GLOBALS['tables']['linktrack_forward'],
112112
$userid, $msgid);
@@ -119,7 +119,7 @@
119119
SELECT user.email,
120120
user.id AS userid,
121121
MIN(firstclick) AS firstclick,
122-
DATE_FORMAT(MAX(latestclick), "%%e %%b %%Y %%H:%%i") AS latestclick,
122+
MAX(latestclick) AS latestclick,
123123
SUM(clicked) AS clicked
124124
FROM %s AS uml_click
125125
JOIN %s AS user ON uml_click.userid = user.id
@@ -149,7 +149,7 @@
149149
SELECT DISTINCT user.email,
150150
user.id AS userid,
151151
MIN(firstclick) AS firstclick,
152-
DATE_FORMAT(MAX(latestclick), "%%e %%b %%Y %%H:%%i") AS latestclick,
152+
MAX(latestclick) AS latestclick,
153153
SUM(clicked) AS clicked
154154
FROM %s AS uml_click
155155
JOIN %s AS user ON uml_click.userid = user.id
@@ -169,7 +169,7 @@
169169
user.email,
170170
user.id AS userid,
171171
MIN(firstclick) AS firstclick,
172-
DATE_FORMAT(MAX(latestclick), "%%e %%b %%Y %%H:%%i") AS latestclick,
172+
MAX(latestclick) AS latestclick,
173173
SUM(clicked) AS clicked,
174174
GROUP_CONCAT(messageid ORDER BY messageid SEPARATOR \' \') AS messageid,
175175
forwardid,
@@ -243,7 +243,7 @@ function ($matches) {
243243
$userStatus['confirmed'] && empty($userStatus['blacklisted']) ? $GLOBALS['img_tick'] : $GLOBALS['img_cross']);
244244
}
245245
$ls->addColumn($element, $GLOBALS['I18N']->get('firstclick'), formatDateTime($row['firstclick'], 1));
246-
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), $row['latestclick']);
246+
$ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), formatDateTime($row['latestclick'], 1));
247247
$ls->addColumn($element, $GLOBALS['I18N']->get('clicks'), $row['clicked'].$ls_userid);
248248
if (!empty($row['htmlclicked']) && !empty($row['textclicked'])) {
249249
$ls->addRow($element,

0 commit comments

Comments
 (0)