Browse Source

Use strftime() instead of date() to respect other languages.

pull/40/head
Savetheinternet 13 years ago
parent
commit
457e474520
  1. 5
      inc/config.php
  2. 2
      inc/contrib/Twig/Extensions/Extension/Tinyboard.php
  3. 22
      mod.php
  4. 2
      templates/post_reply.html
  5. 2
      templates/post_thread.html

5
inc/config.php

@ -443,9 +443,10 @@
// Inline expanding of images with Javascript
$config['inline_expanding'] = true;
// The string passed to date() for post times
// http://php.net/manual/en/function.date.php
// The format string passed to strftime() for post times
// http://www.php.net/manual/en/function.strftime.php
$config['post_date'] = 'm/d/y (D) H:i:s';
$config['post_date'] = '%m/%d/%y (%a) %H:%M:%S';
// The names on the post buttons. (On most imageboards, these are both "Post")
$config['button_newtopic'] = 'New Topic';

2
inc/contrib/Twig/Extensions/Extension/Tinyboard.php

@ -40,7 +40,7 @@ function twig_remove_whitespace_filter($data) {
}
function twig_date_filter($date, $format) {
return date($format, $date);
return strftime($format, $date);
}
function twig_hasPermission_filter($mod, $permission, $board) {

22
mod.php

@ -105,7 +105,7 @@
utf8tohtml($notice['username'])
: '<em>???</em>') .
' at ' .
date($config['post_date'], $notice['time']) .
strftime($config['post_date'], $notice['time']) .
'</span></li>';
}
if(!empty($_body)) {
@ -597,7 +597,7 @@
'<em>???</em>'
) .
' at ' .
date($config['post_date'], $notice['time']) .
strftime($config['post_date'], $notice['time']) .
'</span></h2><p>' . $notice['body'] . '</p></div>';
}
@ -679,7 +679,7 @@
'<span class="unimportant"> &mdash; by ' .
$news['name'] .
' at ' .
date($config['post_date'], $news['time']) .
strftime($config['post_date'], $news['time']) .
'</span></h2><p>' . $news['body'] . '</p></div>';
}
@ -706,7 +706,7 @@
$body .= '<tr' . ($pm['unread'] ? ' style="font-weight:bold"' : '') . '>' .
'<td class="minimal"><a href="?/PM/' . $pm['id'] . '">' . $pm['id'] . '</a></td>' .
'<td class="minimal"><a href="?/new_PM/' . $pm['sender'] . '">' . $pm['username'] . '</a></td>' .
'<td class="minimal">' . date($config['post_date'], $pm['time']) . '</td>' .
'<td class="minimal">' . strftime($config['post_date'], $pm['time']) . '</td>' .
'<td><a href="?/PM/' . $pm['id'] . '">' . pm_snippet($pm['message']) . '</a></td>' .
'</tr>';
@ -791,7 +791,7 @@
'</td></tr>'
: '') .
'<tr><th>Date</th><td> ' . date($config['post_date'], $pm['time']) . '</td></tr>' .
'<tr><th>Date</th><td> ' . strftime($config['post_date'], $pm['time']) . '</td></tr>' .
'<tr><th>Message</th><td> ' . $pm['message'] . '</td></tr>' .
@ -1327,7 +1327,7 @@
'<hr/>' .
'Board: <a href="?/' . $report['uri'] . '/' . $config['file_index'] . '">' . sprintf($config['board_abbreviation'], $report['uri']) . '</a><br/>' .
'Reason: ' . $report['reason'] . '<br/>' .
'Report date: ' . date($config['post_date'], $report['time']) . '<br/>' .
'Report date: ' . strftime($config['post_date'], $report['time']) . '<br/>' .
(hasPermission($config['mod']['show_ip']) ?
'Reported by: <a href="?/IP/' . $report['ip'] . '">' . $report['ip'] . '</a><br/>'
: '') .
@ -1559,14 +1559,14 @@
) . '</td>' .
// Set
'<td style="white-space: nowrap">' . date($config['post_date'], $ban['set']) . '</td>' .
'<td style="white-space: nowrap">' . strftime($config['post_date'], $ban['set']) . '</td>' .
// Expires
'<td style="white-space: nowrap">' .
($ban['expires'] == 0 ?
'<em>Never</em>'
:
date($config['post_date'], $ban['expires'])
strftime($config['post_date'], $ban['expires'])
) .
'</td>' .
@ -2481,7 +2481,7 @@
'</td><td>' .
$note['body'] .
'</td><td class="minimal">' .
date($config['post_date'], $note['time']) .
strftime($config['post_date'], $note['time']) .
'</td>' .
(hasPermission($config['mod']['remove_notes']) ?
'<td class="minimal"><a class="unimportant" href="?/IP/' . $ip . '/deletenote/' . $note['id'] . '">[delete]</a></td>'
@ -2550,14 +2550,14 @@
'</td></tr>' .
// Set
'<tr><th>Set</th><td>' . date($config['post_date'], $ban['set']) . '</td></tr>' .
'<tr><th>Set</th><td>' . strftime($config['post_date'], $ban['set']) . '</td></tr>' .
// Expires
'<tr><th>Expires</th><td>' .
($ban['expires'] == 0 ?
'<em>Never</em>'
:
date($config['post_date'], $ban['expires'])
strftime($config['post_date'], $ban['expires'])
) .
'</td></tr>' .

2
templates/post_reply.html

@ -29,7 +29,7 @@
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %}
<time itemprop="commentTime" datetime="{{ post.time|date('c') }}">{{ post.time|date(config.post_date) }}</time>
<time itemprop="commentTime" datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S%z') }}">{{ post.time|date(config.post_date) }}</time>
</label>
{% if config.poster_ids %}
ID: {{ post.ip|poster_id(post.thread) }}

2
templates/post_thread.html

@ -73,7 +73,7 @@
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %}
<time itemprop="dateCreated" datetime="{{ post.time|date('c') }}">{{ post.time|date(config.post_date) }}</time>
<time itemprop="dateCreated" datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S%z') }}">{{ post.time|date(config.post_date) }}</time>
</label>
{% if config.poster_ids %}
ID: {{ post.ip|poster_id(post.id) }}

Loading…
Cancel
Save