From 268dfc987664416db099761d51a5c007eb926904 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 28 May 2024 21:03:16 -0400 Subject: [PATCH] fix date --- src/web/_model/format.php | 10 ---------- src/web/_model/main.php | 10 ++++++++++ src/web/_views/apps/profile/main.php | 6 +++--- src/web/_views/template/comment.php | 2 +- src/web/_views/template/post.php | 2 +- src/web/index.php | 19 ++++++++++++------- src/web/lang/en_US/common_lang.php | 2 +- 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/web/_model/format.php b/src/web/_model/format.php index d2a3700..d2b7316 100644 --- a/src/web/_model/format.php +++ b/src/web/_model/format.php @@ -33,14 +33,4 @@ class Format_model extends Model { return $name; } - /** - * Formats a date - * @param string $date - the data in RFC3999 format - * @returns the formatted date - */ - public function date($date) { - $date=date_create($date); - return date_format($date, "Y-m-d H:i"); - } - } diff --git a/src/web/_model/main.php b/src/web/_model/main.php index 58ae307..cd34740 100644 --- a/src/web/_model/main.php +++ b/src/web/_model/main.php @@ -104,6 +104,16 @@ class Main_model { return NULL; } + /** + * Formats a date + * @param string $date - the data in RFC3999 format + * @returns the formatted date + */ + public function date($date) { + $date=date_create($date); + return date_format($date, "Y-m-d D H:m"); + } + } ?> diff --git a/src/web/_views/apps/profile/main.php b/src/web/_views/apps/profile/main.php index 922ce64..6d25c98 100644 --- a/src/web/_views/apps/profile/main.php +++ b/src/web/_views/apps/profile/main.php @@ -181,7 +181,7 @@ - + main->date($user['birth_date'])?>

@@ -204,11 +204,11 @@ - + main->date($user['created'])?> - + main->date($user['seen'])?> diff --git a/src/web/_views/template/comment.php b/src/web/_views/template/comment.php index cf2c0b4..72bcedf 100644 --- a/src/web/_views/template/comment.php +++ b/src/web/_views/template/comment.php @@ -8,7 +8,7 @@
name($user)?> - date($comment['created'])?> + main->date($comment['created'])?>
diff --git a/src/web/_views/template/post.php b/src/web/_views/template/post.php index 3dcae8f..b8ea69a 100644 --- a/src/web/_views/template/post.php +++ b/src/web/_views/template/post.php @@ -5,7 +5,7 @@
- + main->date($post['created'])?>

diff --git a/src/web/index.php b/src/web/index.php index e032ef2..75c1b62 100644 --- a/src/web/index.php +++ b/src/web/index.php @@ -19,14 +19,19 @@ require($webroot . '/core/loader.php'); require($webroot . '/core/router.php'); session_save_path('/var/lib/php/session'); -session_set_cookie_params( - 60 * 60 * 24 * 365, // lifetime (seconds), - '/', // path - NULL, // domain, - FALSE, // secure, - FALSE // http only -); session_start(); +setcookie( + session_name(), + session_id(), + array( + 'expires' => time() + 60*60*24*7, + 'path' => '/', + 'domain' => NULL, + 'secure' => FALSE, + 'httponly' => FALSE, + 'samesite' => 'Lax' + ) +); function __init() { $load = new Loader(); diff --git a/src/web/lang/en_US/common_lang.php b/src/web/lang/en_US/common_lang.php index 12de662..7bf9510 100644 --- a/src/web/lang/en_US/common_lang.php +++ b/src/web/lang/en_US/common_lang.php @@ -1,6 +1,6 @@