forked from GithubBackups/vichan
Merge pull request #713 from Zankaria/update-template-datetime
Update template datetime
This commit is contained in:
commit
34a3dcac24
@ -996,11 +996,11 @@
|
|||||||
|
|
||||||
// Timezone to use for displaying dates/times.
|
// Timezone to use for displaying dates/times.
|
||||||
$config['timezone'] = 'America/Los_Angeles';
|
$config['timezone'] = 'America/Los_Angeles';
|
||||||
// The format string passed to strftime() for displaying dates.
|
// The format string passed to DateTime::format() for displaying dates. ISO 8601-like by default.
|
||||||
// http://www.php.net/manual/en/function.strftime.php
|
// https://www.php.net/manual/en/datetime.format.php
|
||||||
$config['post_date'] = '%m/%d/%y (%a) %H:%M:%S';
|
$config['post_date'] = 'd-m-Y (D) H:i:s';
|
||||||
// Same as above, but used for "you are banned' pages.
|
// Same as above, but used for "you are banned' pages.
|
||||||
$config['ban_date'] = '%A %e %B, %Y';
|
$config['ban_date'] = 'l j F, Y';
|
||||||
|
|
||||||
// The names on the post buttons. (On most imageboards, these are both just "Post").
|
// The names on the post buttons. (On most imageboards, these are both just "Post").
|
||||||
$config['button_newtopic'] = _('New Topic');
|
$config['button_newtopic'] = _('New Topic');
|
||||||
|
@ -60,7 +60,7 @@ function Element($templateFile, array $options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the template file
|
// Read the template file
|
||||||
if (@file_get_contents("{$config['dir']['template']}/${templateFile}")) {
|
if (@file_get_contents("{$config['dir']['template']}/{$templateFile}")) {
|
||||||
$body = $twig->render($templateFile, $options);
|
$body = $twig->render($templateFile, $options);
|
||||||
|
|
||||||
if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) {
|
if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) {
|
||||||
@ -69,7 +69,7 @@ function Element($templateFile, array $options) {
|
|||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!");
|
throw new Exception("Template file '{$templateFile}' does not exist or is empty in '{$config['dir']['template']}'!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,6 @@ class Tinyboard extends Twig\Extension\AbstractExtension
|
|||||||
return array(
|
return array(
|
||||||
new Twig\TwigFunction('time', 'time'),
|
new Twig\TwigFunction('time', 'time'),
|
||||||
new Twig\TwigFunction('floor', 'floor'),
|
new Twig\TwigFunction('floor', 'floor'),
|
||||||
new Twig\TwigFunction('timezone', 'twig_timezone_function'),
|
|
||||||
new Twig\TwigFunction('hiddenInputs', 'hiddenInputs'),
|
new Twig\TwigFunction('hiddenInputs', 'hiddenInputs'),
|
||||||
new Twig\TwigFunction('hiddenInputsHash', 'hiddenInputsHash'),
|
new Twig\TwigFunction('hiddenInputsHash', 'hiddenInputsHash'),
|
||||||
new Twig\TwigFunction('ratio', 'twig_ratio_function'),
|
new Twig\TwigFunction('ratio', 'twig_ratio_function'),
|
||||||
@ -162,17 +161,14 @@ class Tinyboard extends Twig\Extension\AbstractExtension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function twig_timezone_function() {
|
|
||||||
return 'Z';
|
|
||||||
}
|
|
||||||
|
|
||||||
function twig_push_filter($array, $value) {
|
function twig_push_filter($array, $value) {
|
||||||
array_push($array, $value);
|
array_push($array, $value);
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
function twig_date_filter($date, $format) {
|
function twig_date_filter($date, $format) {
|
||||||
return gmstrftime($format, $date);
|
$date = new DateTime($date, new DateTimeZone('UTC'));
|
||||||
|
return $date->format($format);
|
||||||
}
|
}
|
||||||
|
|
||||||
function twig_hasPermission_filter($mod, $permission, $board = null) {
|
function twig_hasPermission_filter($mod, $permission, $board = null) {
|
||||||
|
@ -1 +1 @@
|
|||||||
<time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time>
|
<time datetime="{{ post.time|date('Y-m-d\\TH:i:s\Z') }}">{{ post.time|date(config.post_date) }}</time>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<em>no subject</em>
|
<em>no subject</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="unimportant"> — by {{ entry.name }} at {{ entry.time|date(config.post_date, config.timezone) }}</span>
|
<span class="unimportant"> — by {{ entry.name }} at {{ entry.time|date(config.post_date) }}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<p>{{ entry.body }}</p>
|
<p>{{ entry.body }}</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -19,24 +19,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<span>{% trans 'Sort by' %}: </span>
|
<span>{% trans 'Sort by' %}: </span>
|
||||||
<select id="sort_by" style="display: inline-block">
|
<select id="sort_by" style="display: inline-block">
|
||||||
<option selected value="bump:desc">{% trans 'Bump order' %}</option>
|
<option selected value="bump:desc">{% trans 'Bump order' %}</option>
|
||||||
<option value="time:desc">{% trans 'Creation date' %}</option>
|
<option value="time:desc">{% trans 'Creation date' %}</option>
|
||||||
<option value="reply:desc">{% trans 'Reply count' %}</option>
|
<option value="reply:desc">{% trans 'Reply count' %}</option>
|
||||||
<option value="random:desc">{% trans 'Random' %}</option>
|
<option value="random:desc">{% trans 'Random' %}</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<span>{% trans 'Image size' %}: </span>
|
<span>{% trans 'Image size' %}: </span>
|
||||||
<select id="image_size" style="display: inline-block">
|
<select id="image_size" style="display: inline-block">
|
||||||
<option value="vsmall">{% trans 'Very small' %}</option>
|
<option value="vsmall">{% trans 'Very small' %}</option>
|
||||||
<option selected value="small">{% trans 'Small' %}</option>
|
<option selected value="small">{% trans 'Small' %}</option>
|
||||||
<option value="large">{% trans 'Large' %}</option>
|
<option value="large">{% trans 'Large' %}</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="threads">
|
<div class="threads">
|
||||||
<div id="Grid">
|
<div id="Grid">
|
||||||
{% for post in recent_posts %}
|
{% for post in recent_posts %}
|
||||||
<div class="mix"
|
<div class="mix"
|
||||||
data-reply="{{ post.reply_count }}"
|
data-reply="{{ post.reply_count }}"
|
||||||
data-bump="{{ post.bump }}"
|
data-bump="{{ post.bump }}"
|
||||||
data-time="{{ post.time }}"
|
data-time="{{ post.time }}"
|
||||||
@ -44,18 +44,18 @@
|
|||||||
data-sticky="{% if post.sticky %}true{% else %}false{% endif %}"
|
data-sticky="{% if post.sticky %}true{% else %}false{% endif %}"
|
||||||
data-locked="{% if post.locked %}true{% else %}false{% endif %}"
|
data-locked="{% if post.locked %}true{% else %}false{% endif %}"
|
||||||
>
|
>
|
||||||
<div class="thread grid-li grid-size-small">
|
<div class="thread grid-li grid-size-small">
|
||||||
<a href="{{post.link}}">
|
<a href="{{post.link}}">
|
||||||
{% if post.youtube %}
|
{% if post.youtube %}
|
||||||
<img src="//img.youtube.com/vi/{{ post.youtube }}/0.jpg"
|
<img src="//img.youtube.com/vi/{{ post.youtube }}/0.jpg"
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{post.file}}"
|
<img src="{{post.file}}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}">
|
id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('M d H:i')}}">
|
||||||
</a>
|
</a>
|
||||||
<div class="replies">
|
<div class="replies">
|
||||||
<strong>R: {{ post.reply_count }} / I: {{ post.image_count }}{% if post.sticky %} (sticky){% endif %}</strong>
|
<strong>R: {{ post.reply_count }} / I: {{ post.image_count }}{% if post.sticky %} (sticky){% endif %}</strong>
|
||||||
{% if post.subject %}
|
{% if post.subject %}
|
||||||
<p class="intro">
|
<p class="intro">
|
||||||
<span class="subject">
|
<span class="subject">
|
||||||
{{ post.subject|e }}
|
{{ post.subject|e }}
|
||||||
@ -66,12 +66,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ post.body }}
|
{{ post.body }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
{% include 'footer.html' %}
|
{% include 'footer.html' %}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{% for thread in thread_list %}
|
{% for thread in thread_list %}
|
||||||
<url>
|
<url>
|
||||||
<loc>{{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ link_for(thread) }}</loc>
|
<loc>{{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ link_for(thread) }}</loc>
|
||||||
<lastmod>{{ thread.lastmod | date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}</lastmod>
|
<lastmod>{{ thread.lastmod | date('Y-m-d\\TH:i:s\Z') }}</lastmod>
|
||||||
<changefreq>{{ settings.changefreq }}</changefreq>
|
<changefreq>{{ settings.changefreq }}</changefreq>
|
||||||
</url>
|
</url>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user