@@ -37,17 +37,17 @@ class BlogManager extends Base
$link=htmlspecialchars($link);
$title=str_replace("-"," ",$link);
$title=str_replace('-',' ',$link);
$db=$this->dbConnect();
$req=$db->prepare('SELECT * FROM l3m_blog WHERE title = ?');
$req->execute(array($title));
$req->execute([$title]);
$post=$req->fetch();
if($post==false)
returnfalse;
$post["link"]=urlencode($link);
$post['link']=urlencode($link);
$post['datetime']=newDateTime($post['time']);
return$post;
...
...
@@ -57,48 +57,48 @@ class BlogManager extends Base
publicfunctionupdate(){
$db=$this->dbConnect();
$req=$db->prepare('UPDATE l3m_blog SET time = :time, title = :title, content = :content, shortContent = :shortContent, comments = :comments WHERE id = :id');
$req->execute(array(
$req->execute([
'time'=>$this->time,
'title'=>$this->title,
'content'=>$this->content,
'shortContent'=>$this->shortContent,
'comments'=>$this->comments,
'id'=>$this->id
));
]);
}
publicfunctionsend(){
if($this->time==""){
if($this->time==''){
$this->time=newdatetime();
$this->time=$this->time->format('Y-m-d H:i:s');
}
if(strlen($this->title)<1){
header("Location:/patate");
header('Location:/patate');
exit();
}
if(strlen($this->shortContent)<1){
$this->shortContent="Ce billet de blog ne dispose d'aucune description.";
$this->shortContent='Ce billet de blog ne dispose d\'aucune description.';