diff options
| author | 2014-04-13 08:16:43 -0400 | |
|---|---|---|
| committer | 2014-04-13 08:16:43 -0400 | |
| commit | 3a736e902c5af7f215bbf91dc54be00bf82f8df3 (patch) | |
| tree | c816621869648d7fc541e2b21b132e6f0b45a25f /app/Models | |
| parent | 1e032608a61c29a29d418451018b3eb86843f8cf (diff) | |
Move state constants from Configuration to Entry
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Configuration.php | 10 | ||||
| -rw-r--r-- | app/Models/Entry.php | 5 | ||||
| -rw-r--r-- | app/Models/EntryDAO.php | 18 |
3 files changed, 16 insertions, 17 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index e693542e0..4b52fa05b 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -1,12 +1,6 @@ <?php class FreshRSS_Configuration { - const STATE_ALL = 0; - const STATE_READ = 1; - const STATE_NOT_READ = 2; - const STATE_FAVORITE = 4; - const STATE_NOT_FAVORITE = 8; - private $filename; private $data = array( @@ -19,7 +13,7 @@ class FreshRSS_Configuration { 'apiPasswordHash' => '', //CRYPT_BLOWFISH 'posts_per_page' => 20, 'view_mode' => 'normal', - 'default_view' => self::STATE_NOT_READ, + 'default_view' => FreshRSS_Entry::STATE_NOT_READ, 'auto_load_more' => true, 'display_posts' => false, 'onread_jump_next' => true, @@ -137,7 +131,7 @@ class FreshRSS_Configuration { } } public function _default_view ($value) { - $this->data['default_view'] = $value === self::STATE_ALL ? self::STATE_ALL : self::STATE_NOT_READ; + $this->data['default_view'] = $value === FreshRSS_Entry::STATE_ALL ? FreshRSS_Entry::STATE_ALL : FreshRSS_Entry::STATE_NOT_READ; } public function _display_posts ($value) { $this->data['display_posts'] = ((bool)$value) && $value !== 'no'; diff --git a/app/Models/Entry.php b/app/Models/Entry.php index a6c67221b..fa9066d5b 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -1,6 +1,11 @@ <?php class FreshRSS_Entry extends Minz_Model { + const STATE_ALL = 0; + const STATE_READ = 1; + const STATE_NOT_READ = 2; + const STATE_FAVORITE = 4; + const STATE_NOT_FAVORITE = 8; private $id = 0; private $guid; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 3f3cc478b..285ad431f 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -408,7 +408,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { private function sqlListWhere($type = 'a', $id = '', $state = null , $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { if (!$state) { - $state = FreshRSS_Configuration::STATE_ALL; + $state = FreshRSS_Entry::STATE_ALL; } $where = ''; $joinFeed = false; @@ -438,23 +438,23 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { throw new FreshRSS_EntriesGetter_Exception ('Bad type in Entry->listByType: [' . $type . ']!'); } - if ($state & FreshRSS_Configuration::STATE_NOT_READ) { - if (!($state & FreshRSS_Configuration::STATE_READ)) { + if ($state & FreshRSS_Entry::STATE_NOT_READ) { + if (!($state & FreshRSS_Entry::STATE_READ)) { $where .= 'AND e1.is_read = 0 '; } } - if ($state & FreshRSS_Configuration::STATE_READ) { - if (!($state & FreshRSS_Configuration::STATE_NOT_READ)) { + if ($state & FreshRSS_Entry::STATE_READ) { + if (!($state & FreshRSS_Entry::STATE_NOT_READ)) { $where .= 'AND e1.is_read = 1 '; } } - if ($state & FreshRSS_Configuration::STATE_NOT_FAVORITE) { - if (!($state & FreshRSS_Configuration::STATE_FAVORITE)) { + if ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_FAVORITE)) { $where .= 'AND e1.is_favorite = 0 '; } } - if ($state & FreshRSS_Configuration::STATE_FAVORITE) { - if (!($state & FreshRSS_Configuration::STATE_NOT_FAVORITE)) { + if ($state & FreshRSS_Entry::STATE_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { $where .= 'AND e1.is_favorite = 1 '; } } |
