From 82876c573ef9c6b85090edc69da4e59c797dffcf Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 12 Oct 2015 21:59:45 +0200 Subject: [PATCH 1/4] Set a length to comment table's name column The name column was of text type. Passed to VARCHAR(64), like the poll name column. --- admin/migration.php | 2 + .../Alter_Comment_table_for_name_length.php | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php diff --git a/admin/migration.php b/admin/migration.php index 25bc733..9eceac0 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -22,6 +22,7 @@ use Framadate\Migration\From_0_8_to_0_9_Migration; use Framadate\Migration\AddColumn_receiveNewComments_For_0_9; use Framadate\Migration\AddColumn_uniqId_In_vote_For_0_9; use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9; +use Framadate\Migration\Alter_Comment_table_for_name_length; use Framadate\Migration\Migration; use Framadate\Utils; @@ -36,6 +37,7 @@ $migrations = [ new AddColumn_receiveNewComments_For_0_9(), new AddColumn_uniqId_In_vote_For_0_9(), new AddColumn_hidden_In_poll_For_0_9(), + new Alter_Comment_table_for_name_length(), ]; // --------------------------------------- diff --git a/app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php b/app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php new file mode 100644 index 0000000..99e0adb --- /dev/null +++ b/app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php @@ -0,0 +1,72 @@ +alterCommentTable($pdo); + + return true; + } + + private function alterCommentTable(\PDO $pdo) { + $pdo->exec(' + ALTER TABLE `' . Utils::table('comment') . '` + CHANGE `name` `name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;'); + } + +} From ba9a444f33ac11c92797cc12e73a927d6dd93c77 Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 12 Oct 2015 22:26:22 +0200 Subject: [PATCH 2/4] Adding a date column in the comment table --- admin/migration.php | 2 + .../Alter_Comment_table_adding_date.php | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php diff --git a/admin/migration.php b/admin/migration.php index 9eceac0..978e690 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -23,6 +23,7 @@ use Framadate\Migration\AddColumn_receiveNewComments_For_0_9; use Framadate\Migration\AddColumn_uniqId_In_vote_For_0_9; use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9; use Framadate\Migration\Alter_Comment_table_for_name_length; +use Framadate\Migration\Alter_Comment_table_adding_date; use Framadate\Migration\Migration; use Framadate\Utils; @@ -38,6 +39,7 @@ $migrations = [ new AddColumn_uniqId_In_vote_For_0_9(), new AddColumn_hidden_In_poll_For_0_9(), new Alter_Comment_table_for_name_length(), + new Alter_Comment_table_adding_date(), ]; // --------------------------------------- diff --git a/app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php b/app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php new file mode 100644 index 0000000..fd3d34e --- /dev/null +++ b/app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php @@ -0,0 +1,72 @@ +alterCommentTable($pdo); + + return true; + } + + private function alterCommentTable(\PDO $pdo) { + $pdo->exec(' + ALTER TABLE `' . Utils::table('comment') . '` + ADD `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ;'); + } + +} From af95ceb06e21c5e0c37b700cb5612b37bcd22e3e Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 12 Oct 2015 22:28:27 +0200 Subject: [PATCH 3/4] French admin translation typo --- locale/fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/fr.json b/locale/fr.json index 7e420b5..a6b85cd 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -274,7 +274,7 @@ "Deleted the poll": "Supprimer le sondage", "Summary": "Résumé", "Success": "Réussite", - "Fail": "Échèc", + "Fail": "Échec", "Nothing": "Rien", "Succeeded:": "Réussit:", "Failed:": "Échoué:", From 6196a53a45247093baf3feadfadda468e28d04e6 Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 12 Oct 2015 23:14:21 +0200 Subject: [PATCH 4/4] Display the comment timestamp --- app/inc/i18n.php | 1 + css/style.css | 7 +++++++ locale/de.json | 3 ++- locale/en.json | 3 ++- locale/es.json | 3 ++- locale/fr.json | 3 ++- locale/it.json | 3 ++- tpl/part/comments.tpl | 1 + 8 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/inc/i18n.php b/app/inc/i18n.php index 2257286..28e7a7c 100644 --- a/app/inc/i18n.php +++ b/app/inc/i18n.php @@ -37,6 +37,7 @@ $date_format['txt_short'] = __('Date', 'SHORT'); // radio title $date_format['txt_day'] = __('Date', 'DAY'); $date_format['txt_date'] = __('Date', 'DATE'); $date_format['txt_month_year'] = __('Date', 'MONTH_YEAR'); +$date_format['txt_datetime_short'] = __('Date', 'DATETIME'); if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { //%e can't be used on Windows platform, use %#d instead foreach ($date_format as $k => $v) { $date_format[$k] = preg_replace('#(?id|html}" class="btn btn-link" title="{__('Comments', 'Remove the comment')}">{__('Generic', 'Remove')} {/if} + {$comment->date|date_format:$date_format['txt_datetime_short']} {$comment->name|html}  {$comment->comment|escape|nl2br}