diff --git a/RestControllers/friendsController.php b/RestControllers/friendsController.php index 90b4506..801b4d3 100644 --- a/RestControllers/friendsController.php +++ b/RestControllers/friendsController.php @@ -38,7 +38,7 @@ class friendsController{ } //Update the last activity of the user - CS::get()->components->user->updateLastActivity(userID); + update_last_user_activity_if_allowed(); //Return list return $api_list; diff --git a/RestControllers/userController.php b/RestControllers/userController.php index fdb6669..b52f84e 100644 --- a/RestControllers/userController.php +++ b/RestControllers/userController.php @@ -129,7 +129,7 @@ class userController user_login_required(); //Update last user activity - CS::get()->components->user->updateLastActivity(userID); + update_last_user_activity_if_allowed(); //Return userID return array("userID" => userID); diff --git a/functions/user.php b/functions/user.php index da9c4bc..740166d 100644 --- a/functions/user.php +++ b/functions/user.php @@ -58,4 +58,21 @@ function check_post_password(int $userID, string $name) : bool { //Else the password seems to be valid return TRUE; +} + +/** + * Update last user activity if the user allows it + * + * This function do not do anything if the incognito mode + * has been enabled by the user + */ +function update_last_user_activity_if_allowed() { + + //Check if incognito mode is enabled + if(isset($_POST["incognito"])) + return; + + //Update last activity time of the user + CS::get()->components->user->updateLastActivity(userID); + } \ No newline at end of file