From 9ea3819402746d8425d4a608f2d5f3c0f5bc29fb Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 29 Mar 2014 20:18:57 +0100 Subject: Better OPML import / export - use a new OPML library (https://github.com/marienfressinaud/lib_opml) - import has been completely rewritten (far better!) - introduce addFeedObject and addCategoryObject (in DAO for the moment). Permit to add easily feeds and categories (check if they already exist in DB) - introduce html_chars_utf8 (wrap htmlspecialchars for UTF-8) --- app/Models/CategoryDAO.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/Models/CategoryDAO.php') diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index f3c02e3e4..8be732b98 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -18,6 +18,18 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { } } + public function addCategoryObject($category) { + if (!$this->searchByName($category->name())) { + // Category does not exist yet in DB so we add it before continue + $values = array( + 'name' => $category->name(), + ); + return $this->addCategory($values); + } + + return false; + } + public function updateCategory ($id, $valuesTmp) { $sql = 'UPDATE `' . $this->prefix . 'category` SET name=? WHERE id=?'; $stm = $this->bd->prepare ($sql); -- cgit v1.2.3