| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
// Run includes |
|---|
| 6 |
require("../includes.php"); |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
run("profile:init"); |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
global $page_owner; |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
define("context", "weblog"); |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
protect(1); |
|---|
| 19 |
|
|---|
| 20 |
$title = run("profile:display:name") . " :: " . gettext("Recent activity"); |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 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 |
$body .= "<h2>" . gettext("Activity on your weblog posts") . "</h2>"; |
|---|
| 40 |
|
|---|
| 41 |
$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"); |
|---|
| 42 |
if (is_array($activities) && sizeof($activities) > 0) { |
|---|
| 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> posted on weblog post '%s'"),stripslashes($activity->postedname), stripslashes($activity->weblogtitle)); |
|---|
| 47 |
$body .= run("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 |
$activities = db_query("select distinct users.username, users.name as weblogname, weblog_comments.*, weblog_posts.weblog, weblog_posts.ident as weblogpost, weblog_posts.title as weblogtitle, weblog_posts.weblog as weblog from weblog_watchlist left join weblog_comments on weblog_comments.post_id = weblog_watchlist.weblog_post left join weblog_posts on weblog_posts.ident = weblog_comments.post_id left join users on users.ident = weblog_posts.weblog where weblog_watchlist.owner = $page_owner and weblog_comments.posted >= $starttime order by weblog_comments.posted desc"); |
|---|
| 61 |
if (is_array($activities) && sizeof($activities) > 0) { |
|---|
| 62 |
foreach($activities as $activity) { |
|---|
| 63 |
$commentbody = stripslashes($activity->body); |
|---|
| 64 |
$commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . gettext("Read more") . "</a>"; |
|---|
| 65 |
$commentposter = sprintf(gettext("<b>%s</b> commented on weblog post '%s' in %s:"),stripslashes($activity->postedname), stripslashes($activity->weblogtitle), stripslashes($activity->weblogname)); |
|---|
| 66 |
$body .= run("templates:draw", array( |
|---|
| 67 |
'context' => 'databox1', |
|---|
| 68 |
'name' => $commentposter, |
|---|
| 69 |
'column1' => $commentbody |
|---|
| 70 |
) |
|---|
| 71 |
); |
|---|
| 72 |
} |
|---|
| 73 |
} else { |
|---|
| 74 |
$body .= "<p>" . gettext("No activity during this time period.") . "</p>"; |
|---|
| 75 |
} |
|---|
| 76 |
|
|---|
| 77 |
$body = run("templates:draw", array( |
|---|
| 78 |
'context' => 'contentholder', |
|---|
| 79 |
'title' => $title, |
|---|
| 80 |
'body' => $body |
|---|
| 81 |
) |
|---|
| 82 |
); |
|---|
| 83 |
|
|---|
| 84 |
echo run("templates:draw:page", array( |
|---|
| 85 |
$title, $body |
|---|
| 86 |
) |
|---|
| 87 |
); |
|---|
| 88 |
|
|---|
| 89 |
?> |
|---|