From e6436444db9e1bcc13c02c132f327e80d6584df0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 10 Apr 2013 20:55:12 +0200 Subject: Fix bug #49 : les flux sans auteur sont traités normalement désormais MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Entry.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'app/models/Entry.php') diff --git a/app/models/Entry.php b/app/models/Entry.php index ae207069c..4c672bcf3 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -49,7 +49,11 @@ class Entry extends Model { return $this->title; } public function author () { - return $this->author; + if (is_null ($this->author)) { + return ''; + } else { + return $this->author; + } } public function content () { return $this->content; @@ -212,7 +216,7 @@ class Entry extends Model { class EntryDAO extends Model_pdo { public function addEntry ($valuesTmp) { - $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, annotation, tags, lastUpdate) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; + $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, lastUpdate) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; $stm = $this->bd->prepare ($sql); $values = array ( @@ -227,14 +231,14 @@ class EntryDAO extends Model_pdo { $valuesTmp['is_favorite'], $valuesTmp['is_public'], $valuesTmp['id_feed'], - $valuesTmp['annotation'], - $valuesTmp['tags'], $valuesTmp['lastUpdate'], ); if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -261,6 +265,8 @@ class EntryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -274,6 +280,8 @@ class EntryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -286,6 +294,8 @@ class EntryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -298,6 +308,8 @@ class EntryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -323,6 +335,8 @@ class EntryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -339,6 +353,8 @@ class EntryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -356,6 +372,8 @@ class EntryDAO extends Model_pdo { if (isset ($entry[0])) { return $entry[0]; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } -- cgit v1.2.3