root/releases/0.6rc2/_activity/index.php

Revision 296, 4.7 kB (checked in by carmartin, 3 years ago)

Includes should use full path given that we know where things are. Patch 1.

  • Property svn:eol-style set to native
Line 
1 <?php
2 global $CFG;
3 //    ELGG recent activity page
4
5 // Run includes
6 require_once(dirname(dirname(__FILE__))."/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 templates_page_setup();
21
22 $title = run("profile:display:name") . " :: " . gettext("Recent activity");
23
24 // If we haven't specified a start time, start time = 1 day ago
25 $starttime = optional_param('starttime',time()-86400,PARAM_INT);
26
27 $body = "<p>" . gettext("Currently viewing recent activity since ") . gmdate("F d, Y",$starttime) . ".</p>";
28
29 $body .= "<p>" . gettext("You may view recent activity during the following time-frames:") . "</p>";
30
31 $body .= "<ul><li><a href=\"index.php?starttime=" . (time() - 86400) . "\">" . gettext("The last 24 hours") . "</a></li>";
32 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 2)) . "\">" . gettext("The last 48 hours") . "</a></li>";
33 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 7)) . "\">" . gettext("The last week") . "</a></li>";
34 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 30)) . "\">" . gettext("The last month") . "</a></li></ul>";
35
36 $body .= "<h2>" . gettext("Activity on your weblog posts") . "</h2>";
37
38 if ($activities = get_records_sql('SELECT u.username,wc.*,wp.ident AS weblogpost,wp.title AS weblogtitle, wp.weblog AS weblog
39                                    FROM '.$CFG->prefix.'weblog_comments wc LEFT JOIN '.$CFG->prefix.'weblog_posts wp ON wp.ident = wc.post_id
40                                    LEFT JOIN '.$CFG->prefix.'users u on u.ident = wp.weblog
41                                    WHERE wc.posted >= ? AND wp.owner = ?
42                                    ORDER BY wc.posted DESC',array($starttime,$page_owner))) {
43     foreach($activities as $activity) {
44         $commentbody = stripslashes($activity->body);
45         $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . gettext("Read more") . "</a>";
46         $commentposter = sprintf(gettext("<b>%s</b> commented on weblog post '%s' in %s:"),stripslashes($activity->postedname), stripslashes($activity->weblogtitle), stripslashes($activity->weblogname));
47         $body .= templates_draw(array(
48                                       'context' => 'databox1',
49                                       'name' => $commentposter,
50                                       'column1' => $commentbody
51                                       )
52                                 );
53     }
54 } else {
55     $body .= "<p>" . gettext("No activity during this time period.") . "</p>";
56 }
57
58 $body .= "<h2>" . gettext("Activity on weblog posts you have marked as interesting") . "</h2>";
59
60 if ($activities = get_records_sql('SELECT DISTINCT u.username,u.name as weblogname, wc.*,wp.weblog, wp.ident AS weblogpost, wp.title AS weblogtitle, wp.weblog AS weblog
61                                    FROM '.$CFG->prefix.'weblog_watchlist wl LEFT JOIN '.$CFG->prefix.'weblog_comments wc ON wc.post_id = wl.weblog_post
62                                    LEFT JOIN '.$CFG->prefix.'weblog_posts wp ON wp.ident = wc.post_id
63                                    LEFT JOIN '.$CFG->prefix.'users u ON u.ident = wp.weblog
64                                    WHERE wl.owner = ? AND wc.posted >= ? ORDER BY wc.posted DESC',array($page_owner,$starttime))) {
65     foreach($activities as $activity) {
66         $commentbody = stripslashes($activity->body);
67         $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . gettext("Read more") . "</a>";
68         $commentposter = sprintf(gettext("<b>%s</b> posted on weblog post '%s'"),stripslashes($activity->postedname), stripslashes($activity->weblogtitle));
69         $body .= templates_draw( array(
70                                              'context' => 'databox1',
71                                              'name' => $commentposter,
72                                              'column1' => $commentbody
73                                              )
74                      );
75     }
76 } else {
77     $body .= "<p>" . gettext("No activity during this time period.") . "</p>";
78 }
79
80 $body = templates_draw(array(
81                              'context' => 'contentholder',
82                              'title' => $title,
83                              'body' => $body
84                              )
85                        );
86                       
87 echo templates_page_draw( array(
88                                       $title, $body
89                                       )
90          );
91         
92 ?>
Note: See TracBrowser for help on using the browser.