From 4b3f10e0f597c0191ad9aab1e6f0a64627c21557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 23 Sep 2017 13:42:50 +0200 Subject: [PATCH] Empty posts bug --- app/lang/de.ini | 1 + app/lang/en.ini | 1 + app/post.class.php | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/lang/de.ini b/app/lang/de.ini index 65340fa..afa3276 100644 --- a/app/lang/de.ini +++ b/app/lang/de.ini @@ -50,6 +50,7 @@ You are not even logged in. = "Du bist nicht mal eingeloggt." ; post.class.php You need to be logged in to perform this action. = "Du musst angemeldet sein, um diese Aktion durchzuführen." +No data. = "Keine Daten." ; log.class.php Can't write to %s.log file. = "Kann nicht in %s.log Datei schreiben." \ No newline at end of file diff --git a/app/lang/en.ini b/app/lang/en.ini index 8bf3f32..442e2c4 100644 --- a/app/lang/en.ini +++ b/app/lang/en.ini @@ -50,6 +50,7 @@ You are not even logged in. = "You are not even logged in." ; post.class.php You need to be logged in to perform this action. = "You need to be logged in to perform this action." +No data. = "No data." ; log.class.php Can't write to %s.log file. = "Can't write to %s.log file." \ No newline at end of file diff --git a/app/post.class.php b/app/post.class.php index a554c3c..058c24c 100644 --- a/app/post.class.php +++ b/app/post.class.php @@ -69,9 +69,13 @@ private static function raw_data($raw_input){ public static function insert($r){ self::login_protected(); - + $data = self::raw_data($r); + if(empty($data['text'])){ + throw new Exception(__("No data.")); + } + $data['plain_text'] = $data['text']; $data['text'] = self::parse_content($data['text']); $data['datetime'] = 'NOW()';