aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-23 01:46:14 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-23 01:46:14 +0200
commit1b8eb6c7e732f1eda4fc8f22e847b363b016f857 (patch)
tree509c9024d8a31f70f1f76e6a9c93cad5b13a2713 /app/Models
parent5b1b43ab57da6a7bc1599c224d47455b2e56d53d (diff)
CLI import ZIP/OPML/JSON for user
https://github.com/FreshRSS/FreshRSS/issues/1095 https://github.com/FreshRSS/FreshRSS/issues/851
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/CategoryDAO.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 45fdcb5af..c2d57c241 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -1,6 +1,9 @@
<?php
class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
+
+ const defaultCategoryId = 1;
+
public function addCategory($valuesTmp) {
$sql = 'INSERT INTO `' . $this->prefix . 'category`(name) VALUES(?)';
$stm = $this->bd->prepare($sql);
@@ -50,7 +53,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
}
public function deleteCategory($id) {
- if ($id <= 1) {
+ if ($id <= self::defaultCategoryId) {
return false;
}
$sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?';
@@ -120,7 +123,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
}
public function getDefault() {
- $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=1';
+ $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=' . self::defaultCategoryId;
$stm = $this->bd->prepare($sql);
$stm->execute();
@@ -134,11 +137,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
}
}
public function checkDefault() {
- $def_cat = $this->searchById(1);
+ $def_cat = $this->searchById(self::defaultCategoryId);
if ($def_cat == null) {
$cat = new FreshRSS_Category(_t('gen.short.default_category'));
- $cat->_id(1);
+ $cat->_id(self::defaultCategoryId);
$values = array(
'id' => $cat->id(),