summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-11-05 20:48:46 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-11-05 20:48:46 +0100
commitaeda49a7d271c2196fcba0d3b2b15d31ad0b33b5 (patch)
tree5913bdb716f5e3025963bcc9dc93c34c4d521601 /app
parent28bb2813f3121a7c992eba279d0c566269d619aa (diff)
Add CLI for user information + Fix last user activity
https://github.com/FreshRSS/FreshRSS/issues/1345
Diffstat (limited to 'app')
-rwxr-xr-xapp/Controllers/feedController.php4
-rw-r--r--app/Models/Auth.php2
-rw-r--r--app/Models/EntryDAO.php5
-rw-r--r--app/Models/UserDAO.php6
4 files changed, 15 insertions, 2 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index c4115584a..f71f26a4e 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -27,6 +27,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
public static function addFeed($url, $title = '', $cat_id = 0, $new_cat_name = '', $http_auth = '') {
+ FreshRSS_UserDAO::touch();
@set_time_limit(300);
$catDAO = new FreshRSS_CategoryDAO();
@@ -484,6 +485,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if ($feed_id <= 0 || $feed_name == '') {
return false;
}
+ FreshRSS_UserDAO::touch();
$feedDAO = FreshRSS_Factory::createFeedDao();
return $feedDAO->updateFeed($feed_id, array('name' => $feed_name));
}
@@ -492,6 +494,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if ($feed_id <= 0 || ($cat_id <= 0 && $new_cat_name == '')) {
return false;
}
+ FreshRSS_UserDAO::touch();
$catDAO = new FreshRSS_CategoryDAO();
if ($cat_id > 0) {
@@ -540,6 +543,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
public static function deleteFeed($feed_id) {
+ FreshRSS_UserDAO::touch();
$feedDAO = FreshRSS_Factory::createFeedDao();
if ($feedDAO->deleteFeed($feed_id)) {
// TODO: Delete old favicon
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index b93942e19..3313fdf3f 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -25,7 +25,7 @@ class FreshRSS_Auth {
self::giveAccess();
} elseif (self::accessControl()) {
self::giveAccess();
- FreshRSS_UserDAO::touch($current_user);
+ FreshRSS_UserDAO::touch();
} else {
// Be sure all accesses are removed!
self::removeAccess();
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 58f2c1a79..d8a4a486d 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -241,6 +241,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
if (count($ids) < 1) {
return 0;
}
+ FreshRSS_UserDAO::touch();
$sql = 'UPDATE `' . $this->prefix . 'entry` '
. 'SET is_favorite=? '
. 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
@@ -315,6 +316,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @return integer affected rows
*/
public function markRead($ids, $is_read = true) {
+ FreshRSS_UserDAO::touch();
if (is_array($ids)) { //Many IDs at once (used by API)
if (count($ids) < 6) { //Speed heuristics
$affected = 0;
@@ -379,6 +381,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @return integer affected rows
*/
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) {
+ FreshRSS_UserDAO::touch();
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
@@ -421,6 +424,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @return integer affected rows
*/
public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) {
+ FreshRSS_UserDAO::touch();
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
@@ -458,6 +462,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @return integer affected rows
*/
public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) {
+ FreshRSS_UserDAO::touch();
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadFeed(0) is deprecated!');
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
index a95ee6bc4..190954b1a 100644
--- a/app/Models/UserDAO.php
+++ b/app/Models/UserDAO.php
@@ -84,7 +84,11 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
return is_dir(join_path(DATA_PATH , 'users', $username));
}
- public static function touch($username) {
+ public static function touch($username = '') {
+ if (($username == '') || (!ctype_alnum($username))) {
+ $username = Minz_Session::param('currentUser', '_');
+ }
+ Minz_Log::debug('touch ' . $username);
return touch(join_path(DATA_PATH , 'users', $username, 'config.php'));
}