root/releases/0.301/_activity/index.php

Revision 10, 2.7 kB (checked in by sven, 3 years ago)

importing elgg-0.301

Line 
1 <?php
2
3     //    ELGG recent activity page
4
5     // Run includes
6         require("../includes.php");
7         
8     // Initialise functions for user details, icon management and profile management
9         run("profile:init");
10
11     // Whose friends are we looking at?
12         global $page_owner;
13         
14     // Weblog context
15         define("context", "weblog");
16         
17     // You must be logged on to view this!
18         protect(1);
19         
20         $title = run("profile:display:name") . " :: Recent activity";
21
22     // If we haven't specified a start time, start time = 1 day ago
23     
24         if (!isset($_REQUEST['starttime'])) {
25             $starttime = time() - 86400;
26         } else {
27             $starttime = (int) $_REQUEST['starttime'];
28         }
29         
30         $body = "<p>" . gettext("Currently viewing recent activity since ") . gmdate("F d, Y",$starttime) . ".</p>";
31         
32         $body .= "<p>" . gettext("You may view recent activity during the following time-frames:") . "</p>";
33         
34         $body .= "<ul><li><a href=\"index.php?starttime=" . (time() - 86400) . "\">" . gettext("The last 24 hours") . "</a></li>";
35         $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 2)) . "\">" . gettext("The last 48 hours") . "</a></li>";
36         $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 7)) . "\">" . gettext("The last week") . "</a></li>";
37         $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 30)) . "\">" . gettext("The last month") . "</a></li></ul>";
38                 
39         $activities = db_query("select users.username, weblog_comments.*, weblog_posts.ident as weblogpost, weblog_posts.title as weblogtitle, weblog_posts.weblog as weblog from weblog_comments left join weblog_posts on weblog_posts.ident = weblog_comments.post_id left join users on users.ident = weblog_posts.weblog where weblog_comments.posted >= $starttime and weblog_posts.owner = $page_owner order by weblog_comments.posted desc");
40         if (sizeof($activities) > 0) {
41             foreach($activities as $activity) {
42                 $commentbody = stripslashes($activity->body);
43                 $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . gettext("Read more") . "</a>";
44                 $commentposter = sprintf(gettext("<b>$s</b> posted on weblog post:"),stripslashes($activity->postedname)) . " " . stripslashes($activity->weblogtitle);
45                 $body .= run("templates:draw", array(
46                                     'context' => 'databox1',
47                                     'name' => $commentposter,
48                                     'column1' => $commentbody
49                                 )
50                                 );
51             }
52         } else {
53             $body .= "<p>" . gettext("No activity during this time period.") . "</p>";
54         }
55         
56         $body = run("templates:draw", array(
57                         'context' => 'contentholder',
58                         'title' => $title,
59                         'body' => $body
60                     )
61                     );
62         
63         echo run("templates:draw:page", array(
64                     $title, $body
65                 )
66                 );
67
68 ?>
Note: See TracBrowser for help on using the browser.