diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-11-20 04:07:17 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-11-20 04:07:17 +1100 |
| commit | 457e4745201f47d32942f7ec31cd1c533d0d0972 (patch) | |
| tree | dc3db491838bb555cc2e1f717329db08f656159f | |
| parent | 5fce70d703cc662486a48cabc9c2f28a29a822c2 (diff) | |
Use strftime() instead of date() to respect other languages.
| -rw-r--r-- | inc/config.php | 5 | ||||
| -rw-r--r-- | inc/contrib/Twig/Extensions/Extension/Tinyboard.php | 2 | ||||
| -rw-r--r-- | mod.php | 22 | ||||
| -rw-r--r-- | templates/post_reply.html | 2 | ||||
| -rw-r--r-- | templates/post_thread.html | 2 |
5 files changed, 17 insertions, 16 deletions
diff --git a/inc/config.php b/inc/config.php index c85ca039..eaeac0b0 100644 --- a/inc/config.php +++ b/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'; diff --git a/inc/contrib/Twig/Extensions/Extension/Tinyboard.php b/inc/contrib/Twig/Extensions/Extension/Tinyboard.php index 3540c1a3..93bda9f3 100644 --- a/inc/contrib/Twig/Extensions/Extension/Tinyboard.php +++ b/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) { @@ -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"> — 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>' . diff --git a/templates/post_reply.html b/templates/post_reply.html index b051bd6b..14ce611c 100644 --- a/templates/post_reply.html +++ b/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) }}
diff --git a/templates/post_thread.html b/templates/post_thread.html index f04ad283..1fe65cad 100644 --- a/templates/post_thread.html +++ b/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) }}
|
