diff options
| author | 2013-03-17 15:13:19 +0100 | |
|---|---|---|
| committer | 2013-03-17 15:13:19 +0100 | |
| commit | fd171e8f9517dd5a046d4f7f159cde3002e7706a (patch) | |
| tree | b236935155c0da7e61ddd9f73bce6474fc581f4b /app/models | |
| parent | 001c425acd3345e363fe36c014f776069dd587dc (diff) | |
Fix bug #31 : catégorie par défaut ne peut plus être supprimée mais peut être renommée. Ajout gestion flux tronqués directement dans l'interface (+ intégré en base de données). Attention, la BDD a changé (+ 4 champs : 2 pour feed, 2 pour entry)
Diffstat (limited to 'app/models')
| -rwxr-xr-x | app/models/Category.php | 11 | ||||
| -rw-r--r-- | app/models/Feed.php | 20 |
2 files changed, 22 insertions, 9 deletions
diff --git a/app/models/Category.php b/app/models/Category.php index a7f900880..d7db8ee65 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -13,7 +13,7 @@ class Category extends Model { public function id () { if (!$this->id) { - return small_hash ($this->name . Configuration::selApplication ()); + return small_hash ($this->name . time () . Configuration::selApplication ()); } else { return $this->id; } @@ -152,11 +152,12 @@ class CategoryDAO extends Model_pdo { return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); } - public function getDefault () { - $def_cat = $this->searchByName ('Sans catégorie'); + public function checkDefault () { + $def_cat = $this->searchById ('000000'); if (!$def_cat) { $cat = new Category ('Sans catégorie'); + $cat->_id ('000000'); $values = array ( 'id' => $cat->id (), @@ -165,11 +166,7 @@ class CategoryDAO extends Model_pdo { ); $this->addCategory ($values); - - $def_cat = $cat; } - - return $def_cat; } public function count () { diff --git a/app/models/Feed.php b/app/models/Feed.php index 046e5af92..2f471f0a4 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -3,12 +3,14 @@ class Feed extends Model { private $id = null; private $url; - private $category = ''; + private $category = '000000'; private $entries = null; private $name = ''; private $website = ''; private $description = ''; private $lastUpdate = 0; + private $pathEntries = ''; + private $httpAuth = ''; public function __construct ($url) { $this->_url ($url); @@ -46,6 +48,12 @@ class Feed extends Model { public function lastUpdate () { return $this->lastUpdate; } + public function pathEntries () { + return $this->pathEntries; + } + public function httpAuth () { + return $this->httpAuth; + } public function nbEntries () { $feedDAO = new FeedDAO (); return $feedDAO->countEntries ($this->id ()); @@ -89,6 +97,12 @@ class Feed extends Model { public function _lastUpdate ($value) { $this->lastUpdate = $value; } + public function _pathEntries ($value) { + $this->pathEntries = $value; + } + public function _httpAuth ($value) { + $this->httpAuth = $value; + } public function load () { if (!is_null ($this->url)) { @@ -122,7 +136,7 @@ class Feed extends Model { // Gestion du contenu // On cherche à récupérer les articles en entier... même si le flux ne le propose pas - $path = get_path ($this->website ()); + $path = $this->pathEntries (); if ($path) { try { $content = get_content_by_parsing ($item->get_permalink (), $path); @@ -306,6 +320,8 @@ class HelperFeed { $list[$key]->_website ($dao['website']); $list[$key]->_description ($dao['description']); $list[$key]->_lastUpdate ($dao['lastUpdate']); + $list[$key]->_pathEntries ($dao['pathEntries']); + $list[$key]->_httpAuth ($dao['httpAuth']); if (isset ($dao['id'])) { $list[$key]->_id ($dao['id']); |
