Skip to content

Commit 2753569

Browse files
committed
Added incognito mode
1 parent 4e0b5c5 commit 2753569

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

RestControllers/friendsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getFriendsList(){
3838
}
3939

4040
//Update the last activity of the user
41-
CS::get()->components->user->updateLastActivity(userID);
41+
update_last_user_activity_if_allowed();
4242

4343
//Return list
4444
return $api_list;

RestControllers/userController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function getCurrentUserID(){
129129
user_login_required();
130130

131131
//Update last user activity
132-
CS::get()->components->user->updateLastActivity(userID);
132+
update_last_user_activity_if_allowed();
133133

134134
//Return userID
135135
return array("userID" => userID);

functions/user.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,21 @@ function check_post_password(int $userID, string $name) : bool {
5858

5959
//Else the password seems to be valid
6060
return TRUE;
61+
}
62+
63+
/**
64+
* Update last user activity if the user allows it
65+
*
66+
* This function do not do anything if the incognito mode
67+
* has been enabled by the user
68+
*/
69+
function update_last_user_activity_if_allowed() {
70+
71+
//Check if incognito mode is enabled
72+
if(isset($_POST["incognito"]))
73+
return;
74+
75+
//Update last activity time of the user
76+
CS::get()->components->user->updateLastActivity(userID);
77+
6178
}

0 commit comments

Comments
 (0)