From 83f72ae901cb27d6e963c41e24030285f552cc2a Mon Sep 17 00:00:00 2001 From: Mischa Spelt Date: Fri, 1 Sep 2017 19:49:31 +0200 Subject: [PATCH] stripslashes op velden uit database --- api/app/Http/Controllers/NewsController.php | 6 +++--- common/classes/Model.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/app/Http/Controllers/NewsController.php b/api/app/Http/Controllers/NewsController.php index f06dfae..f7988cc 100644 --- a/api/app/Http/Controllers/NewsController.php +++ b/api/app/Http/Controllers/NewsController.php @@ -56,7 +56,7 @@ QUERY; $result = array(); foreach($newsItems as $newsItem) { // Note: content is stored in the database with an additional addslashes() - don't ask why, just remove it :) - $newsItem->content = stripslashes($newsItem->content); + $newsItem->content = $newsItem->content; $pictures = app('db')->select(self::$LOAD_IMAGES, ['newsId' => $newsItem->id]); $result[] = new \Model\NewsItem($newsItem, $pictures); } @@ -76,7 +76,7 @@ QUERY; $result = array(); foreach($agendaItems as $agendaItem) { // Note: content is stored in the database with an additional addslashes() - don't ask why, just remove it :) - $agendaItem->content = stripslashes($agendaItem->content); + $agendaItem->content = $agendaItem->content; $pictures = app('db')->select(self::$LOAD_IMAGES, ['newsId' => $agendaItem->id]); $result[] = new \Model\CalendarEvent($agendaItem, $pictures); } @@ -109,7 +109,7 @@ QUERY; return null; } else { // Note: content is stored in the database with an additional addslashes() - don't ask why, just remove it :) - $newsItem[0]->content = stripslashes($newsItem[0]->content); + $newsItem[0]->content = $newsItem[0]->content; $images = app('db')->select(self::$LOAD_IMAGES, ['newsId' => $id]); $podcast = null; if($newsItem[0]->podcast_id > 0) diff --git a/common/classes/Model.php b/common/classes/Model.php index 60f2fb3..768cb91 100644 --- a/common/classes/Model.php +++ b/common/classes/Model.php @@ -30,7 +30,7 @@ class Model { $class = get_class($this); foreach($data as $key => $val) { if(property_exists($class, $key)) { - $this->$key = $val; + $this->$key = is_string($val) ? stripslashes($val) : $val; } } }