stripslashes op velden uit database

This commit is contained in:
2017-09-01 19:49:31 +02:00
parent ec122e1d9a
commit 83f72ae901
2 changed files with 4 additions and 4 deletions

View File

@@ -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)

View File

@@ -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;
}
}
}