First support for timezones on date displays
This commit is contained in:
parent
af4103c31c
commit
507bf492a0
|
@ -3,6 +3,8 @@
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
locale_set_default("fr_FR");
|
||||||
|
date_default_timezone_set("UTC"); // Default tz for date manipulation is UTC. Display tz is in session.php
|
||||||
|
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
|
|
|
@ -15,14 +15,14 @@ if(isset($_SESSION['userid'])) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
$config['locale'] = locale_get_default();
|
$config['locale'] = "fr_FR";
|
||||||
$config['timezone'] = date_default_timezone_get();
|
$config['timezone'] = "Europe/Paris";
|
||||||
$user->rank = "visitor"; // All users are visitors
|
$user->rank = "visitor"; // All users are visitors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$config['locale'] = locale_get_default();
|
$config['locale'] = "fr_FR";
|
||||||
$config['timezone'] = date_default_timezone_get();
|
$config['timezone'] = "Europe/Paris";
|
||||||
$user->rank = "visitor"; // All users are visitors
|
$user->rank = "visitor"; // All users are visitors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<p class="article_legend">
|
<p class="article_legend">
|
||||||
<a class="article_link" href="<?=$config['rel_root_folder']?>blog/<?=$row->permalink?>">Lire la suite...</a>
|
<a class="article_link" href="<?=$config['rel_root_folder']?>blog/<?=$row->permalink?>">Lire la suite...</a>
|
||||||
<span class="article_infos">
|
<span class="article_infos">
|
||||||
Le <? echo datefmt_format($user->date_format,strtotime($row->update_date)) ?> par
|
<? echo datefmt_format($user->date_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?> par
|
||||||
<? if ($user->rankIsHigher("registered")) { ?>
|
<? if ($user->rankIsHigher("registered")) { ?>
|
||||||
<a href="<?=$config['rel_root_folder']?>user/p/<?=$row->author?>"><?=$row->author_name?></a>
|
<a href="<?=$config['rel_root_folder']?>user/p/<?=$row->author?>"><?=$row->author_name?></a>
|
||||||
<? }
|
<? }
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<select id="bloghistory">
|
<select id="bloghistory">
|
||||||
<? $i = 0;
|
<? $i = 0;
|
||||||
foreach ($blogHistory->objs as $row) { ?>
|
foreach ($blogHistory->objs as $row) { ?>
|
||||||
<option <?=$row->version_id==$blogArticle->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'• ':''?><? echo datefmt_format($user->datetimeshort_format,strtotime($row->update_date)) ?></option>
|
<option <?=$row->version_id==$blogArticle->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'• ':''?><? echo datefmt_format($user->datetimeshort_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?></option>
|
||||||
<? $i++;
|
<? $i++;
|
||||||
} ?>
|
} ?>
|
||||||
</select>
|
</select>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
else { ?>
|
else { ?>
|
||||||
<?=$blogArticle->author_name?>
|
<?=$blogArticle->author_name?>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
le <? echo datefmt_format($user->datetime_format,strtotime($blogArticle->creation_date)) ?></p>
|
le <? echo datefmt_format($user->datetime_format,date_create($blogArticle->creation_date, new DateTimeZone("UTC"))) ?></p>
|
||||||
|
|
||||||
<!-- COMMENTS -->
|
<!-- COMMENTS -->
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<?=$comment->author_obj->name?>
|
<?=$comment->author_obj->name?>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
le <? echo datefmt_format($user->datetime_format,strtotime($comment->update_date)) ?></p>
|
le <? echo datefmt_format($user->datetime_format,date_create($comment->update_date, new DateTimeZone("UTC"))) ?></p>
|
||||||
<? if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?>
|
<? if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?>
|
||||||
<span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete_comment/<?=$comment->id?>"><i class="fas fa-trash"></i> Effacer le commentaire</a></span>
|
<span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete_comment/<?=$comment->id?>"><i class="fas fa-trash"></i> Effacer le commentaire</a></span>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
<a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$row->id?>"><?=$row->name?></a>
|
<a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$row->id?>"><?=$row->name?></a>
|
||||||
</td>
|
</td>
|
||||||
<td><?=$row->get_rank()?></td>
|
<td><?=$row->get_rank()?></td>
|
||||||
<td><? echo datefmt_format($user->date_format,strtotime($row->register_date)) ?></td>
|
<td><? echo datefmt_format($user->date_format,date_create($row->register_date, new DateTimeZone("UTC"))) ?></td>
|
||||||
<td><? echo datefmt_format($user->date_format,strtotime($row->visit_date)) ?></td>
|
<td><? echo datefmt_format($user->date_format,date_create($row->visit_date, new DateTimeZone("UTC"))) ?></td>
|
||||||
<td>
|
<td>
|
||||||
<? if ($row->website != "") { ?>
|
<? if ($row->website != "") { ?>
|
||||||
<a target="_blank" href="<?=$row->website?>">Site internet <span class="external-link"><i class="fas fa-external-link-alt"></i></span></a>
|
<a target="_blank" href="<?=$row->website?>">Site internet <span class="external-link"><i class="fas fa-external-link-alt"></i></span></a>
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
</aside>
|
</aside>
|
||||||
<div id="description">
|
<div id="description">
|
||||||
<p>Langue : <?=$userProfile->get_locale()?></p>
|
<p>Langue : <?=$userProfile->get_locale()?></p>
|
||||||
<p>Inscrit le <? echo datefmt_format($user->datetime_format,strtotime($userProfile->register_date)) ?></p>
|
<p>Inscrit le <? echo datefmt_format($user->datetime_format,date_create($userProfile->register_date, new DateTimeZone("UTC"))) ?></p>
|
||||||
<p>Dernière connexion le <? echo datefmt_format($user->datetime_format,strtotime($userProfile->visit_date)) ?></p>
|
<p>Dernière connexion le <? echo datefmt_format($user->datetime_format,date_create($userProfile->visit_date, new DateTimeZone("UTC"))) ?></p>
|
||||||
<p><?=$userProfile->get_rank()?></p>
|
<p><?=$userProfile->get_rank()?></p>
|
||||||
<p>
|
<p>
|
||||||
<? if ($userProfile->website != "") { ?>
|
<? if ($userProfile->website != "") { ?>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<select id="wikihistory">
|
<select id="wikihistory">
|
||||||
<? $i = 0;
|
<? $i = 0;
|
||||||
foreach ($wikiHistory->objs as $row) { ?>
|
foreach ($wikiHistory->objs as $row) { ?>
|
||||||
<option <?=$row->version_id==$wikiPage->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'• ':''?><? echo datefmt_format($user->datetimeshort_format,strtotime($row->update_date)) ?></option>
|
<option <?=$row->version_id==$wikiPage->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'• ':''?><? echo datefmt_format($user->datetimeshort_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?></option>
|
||||||
<? $i++;
|
<? $i++;
|
||||||
} ?>
|
} ?>
|
||||||
</select>
|
</select>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<?=$wikiPage->content_html?>
|
<?=$wikiPage->content_html?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p id="wikiTimestamp">Page mise à jour le <? echo datefmt_format($user->datetime_format,strtotime($wikiPage->update_date)) ?></p>
|
<p id="wikiTimestamp">Page mise à jour le <? echo datefmt_format($user->datetime_format,date_create($wikiPage->update_date, new DateTimeZone("UTC"))) ?></p>
|
||||||
|
|
||||||
<div style="clear: both;"> </div>
|
<div style="clear: both;"> </div>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in New Issue