Fix empty posts error

This commit is contained in:
Gregorio Chiko Putra 2017-09-11 09:05:32 +07:00
parent 70a4c80143
commit aec3b73730

View File

@ -88,22 +88,22 @@ class Posts
$status = 'admin';
}
if (array_key_exists(0, $post)) {
$posts = $post;
} else {
$posts[] = $post;
}
if ($post !== false) {
if (array_key_exists(0, $post)) {
$posts = $post;
} else {
$posts[] = $post;
}
// Replace \n or \r with <br />
for ($i=0; $i < count($posts); $i++) {
$posts[$i]['content'] = preg_replace('/\r\n/', '<br />', $posts[$i]['content']);
// Replace \n or \r with <br />
for ($i=0; $i < count($posts); $i++) {
$posts[$i]['content'] = preg_replace('/\r\n/', '<br />', $posts[$i]['content']);
}
}
View::render($url, [
'posts' => $posts,
'status' => $status
]);
die();
}
public function entry()