diff options
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Category.php | 7 | ||||
| -rw-r--r-- | app/Models/ConfigurationSetter.php | 8 | ||||
| -rw-r--r-- | app/Models/Context.php | 13 | ||||
| -rw-r--r-- | app/Models/LogDAO.php | 5 |
4 files changed, 31 insertions, 2 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php index 37cb44dc3..9a44a2d09 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -6,6 +6,7 @@ class FreshRSS_Category extends Minz_Model { private $nbFeed = -1; private $nbNotRead = -1; private $feeds = null; + private $hasFeedsWithError = false; public function __construct($name = '', $feeds = null) { $this->_name($name); @@ -16,6 +17,7 @@ class FreshRSS_Category extends Minz_Model { foreach ($feeds as $feed) { $this->nbFeed++; $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } } @@ -51,12 +53,17 @@ class FreshRSS_Category extends Minz_Model { foreach ($this->feeds as $feed) { $this->nbFeed++; $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } return $this->feeds; } + public function hasFeedsWithError() { + return $this->hasFeedsWithError; + } + public function _id($value) { $this->id = $value; } diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index 5c8a1ce29..250c14c39 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -378,4 +378,12 @@ class FreshRSS_ConfigurationSetter { private function _unsafe_autologin_enabled(&$data, $value) { $data['unsafe_autologin_enabled'] = $this->handleBool($value); } + + private function _auto_update_url(&$data, $value) { + if (!$value) { + return; + } + + $data['auto_update_url'] = $value; + } } diff --git a/app/Models/Context.php b/app/Models/Context.php index dbdbfaa69..2a58bd4ba 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -10,6 +10,7 @@ class FreshRSS_Context { public static $categories = array(); public static $name = ''; + public static $description = ''; public static $total_unread = 0; public static $total_starred = array( @@ -94,6 +95,13 @@ class FreshRSS_Context { } /** + * Return true if the current request targets a feed (and not a category or all articles), false otherwise. + */ + public static function isFeed() { + return self::$current_get['feed'] != false; + } + + /** * Return true if $get parameter correspond to the $current_get attribute. */ public static function isCurrentGet($get) { @@ -146,8 +154,8 @@ class FreshRSS_Context { self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE; break; case 'f': - // We try to find the corresponding feed. - $feed = FreshRSS_CategoryDAO::findFeed(self::$categories, $id); + // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description + $feed = FreshRSS_Context::$system_conf->allow_robots ? null : FreshRSS_CategoryDAO::findFeed(self::$categories, $id); if ($feed === null) { $feedDAO = FreshRSS_Factory::createFeedDao(); $feed = $feedDAO->searchById($id); @@ -160,6 +168,7 @@ class FreshRSS_Context { self::$current_get['feed'] = $id; self::$current_get['category'] = $feed->category(); self::$name = $feed->name(); + self::$description = $feed->description(); self::$get_unread = $feed->nbNotRead(); break; case 'c': diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php index 4c56e3150..ab258cd58 100644 --- a/app/Models/LogDAO.php +++ b/app/Models/LogDAO.php @@ -21,5 +21,10 @@ class FreshRSS_LogDAO { public static function truncate() { file_put_contents(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), ''); + if (FreshRSS_Auth::hasAccess('admin')) { + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log.txt'), ''); + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_api.txt'), ''); + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_pshb.txt'), ''); + } } } |
