diff --git a/includes/session.php b/includes/session.php index 0c0f660..dac376c 100755 --- a/includes/session.php +++ b/includes/session.php @@ -6,17 +6,29 @@ ini_set("session.cookie_lifetime",60*60*24*30); session_start(); $user = new Kabano\User(); -$user->rank = "visitor"; // All users are visitors if(isset($_SESSION['userid'])) { - $user->checkID($_SESSION['userid']); if ($user->checkID($_SESSION['userid'])) { $user->updateLoginDate(); - //setlocale(LC_ALL, $config['locales'][$user->locale][4]); + $config['locale'] = $user->locale; + $config['timezone'] = $user->timezone; } else { session_destroy(); + $config['locale'] = locale_get_default(); + $config['timezone'] = date_default_timezone_get(); + $user->rank = "visitor"; // All users are visitors } } +else { + $config['locale'] = locale_get_default(); + $config['timezone'] = date_default_timezone_get(); + $user->rank = "visitor"; // All users are visitors +} + +$user->date_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::LONG, IntlDateFormatter::NONE, $config['timezone']); +$user->datetime_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::LONG, IntlDateFormatter::SHORT, $config['timezone']); +$user->datetimeshort_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $config['timezone']); + ?> \ No newline at end of file diff --git a/models/d.users.php b/models/d.users.php index d6d361d..5307af9 100755 --- a/models/d.users.php +++ b/models/d.users.php @@ -213,7 +213,7 @@ class User $this->visit_date = date('r'); $this->register_date = date('r'); $this->locale = "fr_FR"; - $this->timezone = "CEST"; + $this->timezone = "Europe/Paris"; $con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass']) or die ("Could not connect to server\n"); diff --git a/views/d.blog.list.html b/views/d.blog.list.html index cc06ecf..ebfdeeb 100755 --- a/views/d.blog.list.html +++ b/views/d.blog.list.html @@ -27,7 +27,7 @@
Lire la suite... - Le echo strftime('%e %B %G',strtotime($row->update_date)) ?> par + Le echo datefmt_format($user->date_format,strtotime($row->update_date)) ?> par if ($user->rankIsHigher("registered")) { ?> =$row->author_name?> } diff --git a/views/d.blog.view.html b/views/d.blog.view.html index 8b1935d..7bd80c1 100755 --- a/views/d.blog.view.html +++ b/views/d.blog.view.html @@ -15,7 +15,7 @@ @@ -45,7 +45,7 @@ else { ?> =$blogArticle->author_name?> } ?> - le echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($blogArticle->creation_date)) ?> UTC
+ le echo datefmt_format($user->datetime_format,strtotime($blogArticle->creation_date)) ?> @@ -83,7 +83,7 @@ } else { ?> =$comment->author_obj->name?> } ?> - le echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($comment->update_date)) ?> UTC + le echo datefmt_format($user->datetime_format,strtotime($comment->update_date)) ?> if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?> Effacer le commentaire } ?> diff --git a/views/d.user.member_list.html b/views/d.user.member_list.html index 083e01f..aadd3ab 100755 --- a/views/d.user.member_list.html +++ b/views/d.user.member_list.html @@ -45,8 +45,8 @@ =$row->name?>Langue : =$userProfile->get_locale()?>
-Inscrit le echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($userProfile->register_date)) ?> UTC
-Dernière connexion le echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($userProfile->visit_date)) ?> UTC
+Inscrit le echo datefmt_format($user->datetime_format,strtotime($userProfile->register_date)) ?>
+Dernière connexion le echo datefmt_format($user->datetime_format,strtotime($userProfile->visit_date)) ?>
=$userProfile->get_rank()?>
if ($userProfile->website != "") { ?> diff --git a/views/d.wiki.view.html b/views/d.wiki.view.html index 35a7c30..836eaca 100755 --- a/views/d.wiki.view.html +++ b/views/d.wiki.view.html @@ -15,7 +15,7 @@ @@ -38,7 +38,7 @@ =$wikiPage->content_html?>
Page mise à jour le echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($wikiPage->update_date)) ?> UTC
+Page mise à jour le echo datefmt_format($user->datetime_format,strtotime($wikiPage->update_date)) ?>