aboutsummaryrefslogtreecommitdiff
path: root/app/Models/CategoryDAO.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-29 20:18:57 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-29 20:18:57 +0100
commit9ea3819402746d8425d4a608f2d5f3c0f5bc29fb (patch)
treea4836c792d14e5489ebabe6e5d9f46e9b098ce93 /app/Models/CategoryDAO.php
parent7676a197a4767f735dabae6ad9cf40ef65e91aa7 (diff)
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)
Diffstat (limited to 'app/Models/CategoryDAO.php')
-rw-r--r--app/Models/CategoryDAO.php12
1 files changed, 12 insertions, 0 deletions
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);