summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-09-27 14:11:12 -0700
committerZach Copley <zach@status.net>2009-09-27 14:11:12 -0700
commitdfa955bfda67ee9fd254e97abf9dc29f2b51a857 (patch)
treeb18427c8ff1ba9ace008bcc402f427543135c2cc
parentccc7caf932735a5ba245db5df36615b02e0af9e3 (diff)
- Output entity tag
- More comments for function blocks
-rw-r--r--actions/apifriendstimeline.php56
1 files changed, 50 insertions, 6 deletions
diff --git a/actions/apifriendstimeline.php b/actions/apifriendstimeline.php
index 2eb00e23a..dd89f44fe 100644
--- a/actions/apifriendstimeline.php
+++ b/actions/apifriendstimeline.php
@@ -76,11 +76,27 @@ class ApiFriendsTimelineAction extends ApiBareAuthAction
return true;
}
+ /**
+ * Handle the request
+ *
+ * Just show the notices
+ *
+ * @param array $args $_REQUEST data (unused)
+ *
+ * @return void
+ */
+
function handle($args) {
parent::handle($args);
$this->showTimeline();
}
+ /**
+ * Show the timeline of notices
+ *
+ * @return void
+ */
+
function showTimeline()
{
$profile = $this->user->getProfile();
@@ -124,6 +140,12 @@ class ApiFriendsTimelineAction extends ApiBareAuthAction
}
}
+ /**
+ * Get notices
+ *
+ * @return array notices
+ */
+
function getNotices()
{
$notices = array();
@@ -163,15 +185,37 @@ class ApiFriendsTimelineAction extends ApiBareAuthAction
function lastModified()
{
- if (empty($this->notices)) {
- return null;
+ if (!empty($this->notices) && (count($this->notices) > 0)) {
+ return strtotime($this->notices[0]->created);
}
- if (count($this->notices) == 0) {
- return null;
+ return null;
+ }
+
+ /**
+ * An entity tag for this page
+ *
+ * Returns an Etag based on the action name, language, user ID, and
+ * timestamps of the first and last notice in the timeline
+ *
+ * @return string etag
+ */
+
+ function etag()
+ {
+ if (!empty($this->notices) && (count($this->notices) > 0)) {
+
+ $last = count($this->notices) - 1;
+
+ return implode(':',
+ array($this->arg('action'),
+ common_language(),
+ $this->user->id,
+ strtotime($this->notices[0]->created),
+ strtotime($this->notices[$last]->created))) . '"';
}
- return strtotime($this->notices[0]->created);
+ return null;
}
-} \ No newline at end of file
+}