@@ -364,7 +364,9 @@ public function register($username, $password, $email, $birthday) {
364
364
/**
365
365
* Retrieves general user, friend, and snap updates.
366
366
*
367
- * @param $stories (optional) Retrieve story updates. Defaults to false.
367
+ * @todo Add separate story function.
368
+ *
369
+ * @param $stories (optional) Whether to retrieve story updates. Defaults to FALSE.
368
370
* @return The data returned by the service or FALSE on failure.
369
371
*/
370
372
public function getUpdates ($ stories = FALSE ) {
@@ -386,16 +388,17 @@ public function getUpdates($stories = FALSE) {
386
388
)
387
389
);
388
390
389
- if ($ stories ) {
390
- if (!empty ($ result ->stories_response )) {
391
+ if ($ stories ) {
392
+ if (!empty ($ result ->stories_response )) {
391
393
return $ result ->stories_response ;
392
394
}
393
- } else if (!empty ($ result ->updates_response )) {
395
+ }
396
+ elseif (!empty ($ result ->updates_response )) {
394
397
$ this ->auth_token = $ result ->updates_response ->auth_token ;
395
398
return $ result ->updates_response ;
396
399
}
397
400
398
- return $ result ;
401
+ return $ result ;
399
402
}
400
403
401
404
@@ -1036,29 +1039,35 @@ public function getStoryThumb($media_id, $key, $iv) {
1036
1039
* @returns TRUE on success or FALSE on failure.
1037
1040
*/
1038
1041
public function markStoryViewed ($ id , $ screenshot_count = 0 ) {
1039
- // Make sure we're logged in and have a valid access token.
1042
+ // Make sure we're logged in and have a valid access token.
1040
1043
if (!$ this ->auth_token || !$ this ->username ) {
1041
1044
return FALSE ;
1045
+ }
1046
+
1047
+ // Mark story as viewed.
1048
+ $ timestamp = self ::timestamp ();
1049
+ $ result = self ::post (
1050
+ '/update_stories ' ,
1051
+ array (
1052
+ 'friend_stories ' => json_encode (array (
1053
+ array (
1054
+ 'id ' => $ id ,
1055
+ 'screenshot_count ' => $ screenshot_count ,
1056
+ 'timestamp ' => $ timestamp ,
1057
+ ),
1058
+ )),
1059
+ 'timestamp ' => $ timestamp ,
1060
+ 'username ' => $ this ->username ,
1061
+ ),
1062
+ array (
1063
+ $ this ->auth_token ,
1064
+ $ timestamp ,
1065
+ )
1066
+ );
1067
+
1068
+ return is_null ($ result );
1042
1069
}
1043
-
1044
- // Mark story as viewed.
1045
- $ timestamp = self ::timestamp ();
1046
- $ result = self ::post (
1047
- '/update_stories ' ,
1048
- array (
1049
- 'friend_stories ' => '[{"id":" ' .$ id .'","screenshot_count": ' .$ screenshot_count .',"timestamp": ' .$ timestamp .'}] ' ,
1050
- 'timestamp ' => $ timestamp ,
1051
- 'username ' => $ this ->username ,
1052
- ),
1053
- array (
1054
- $ this ->auth_token ,
1055
- $ timestamp ,
1056
- )
1057
- );
1058
-
1059
- return is_null ($ result );
1060
- }
1061
-
1070
+
1062
1071
1063
1072
/**
1064
1073
* Gets the best friends and scores of the specified users.
@@ -1189,5 +1198,3 @@ public function updateEmail($email) {
1189
1198
}
1190
1199
1191
1200
}
1192
-
1193
- ?>
0 commit comments