From e2d4f1a7214591a47a46272a7a62e320eea029ce Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 18 Nov 2013 23:04:43 +0100 Subject: SQL : identifiant entier automatique pour les catégories et les flux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémentation de https://github.com/marienfressinaud/FreshRSS/issues/262 La catégorie par défaut à le numéro 1. Les numéros de catégories et de flux sont automatiques (1, 2, 3...) L'installeur semble marcher. --- app/models/Category.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'app/models/Category.php') diff --git a/app/models/Category.php b/app/models/Category.php index 6e61b5a0e..1ae324ace 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -1,7 +1,7 @@ id) { - return small_hash ($this->name . time () . Configuration::selApplication ()); - } else { - return $this->id; - } + return $this->id; } public function name () { return $this->name; @@ -90,11 +86,10 @@ class Category extends Model { class CategoryDAO extends Model_pdo { public function addCategory ($valuesTmp) { - $sql = 'INSERT INTO ' . $this->prefix . 'category (id, name, color) VALUES(?, ?, ?)'; + $sql = 'INSERT INTO ' . $this->prefix . 'category (name, color) VALUES(?, ?)'; $stm = $this->bd->prepare ($sql); $values = array ( - $valuesTmp['id'], substr($valuesTmp['name'], 0, 255), substr($valuesTmp['color'], 0, 7), ); @@ -196,7 +191,7 @@ class CategoryDAO extends Model_pdo { } public function getDefault () { - $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE id="000000"'; + $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE id=1'; $stm = $this->bd->prepare ($sql); $stm->execute (); @@ -210,11 +205,11 @@ class CategoryDAO extends Model_pdo { } } public function checkDefault () { - $def_cat = $this->searchById ('000000'); + $def_cat = $this->searchById (1); if ($def_cat === false) { $cat = new Category (Translate::t ('default_category')); - $cat->_id ('000000'); + $cat->_id (1); $values = array ( 'id' => $cat->id (), -- cgit v1.2.3