2003-12-21 05:55:48 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
2014-04-18 22:54:28 +00:00
|
|
|
// Copyright (C) 2014 University of California
|
2008-08-05 22:43:14 +00:00
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2004-12-27 03:42:11 +00:00
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once('../inc/util.inc');
|
|
|
|
require_once('../inc/time.inc');
|
|
|
|
require_once('../inc/forum.inc');
|
2005-01-23 10:04:39 +00:00
|
|
|
require_once('../inc/user.inc');
|
2004-12-27 03:42:11 +00:00
|
|
|
|
2014-04-18 22:54:28 +00:00
|
|
|
if (DISABLE_FORUMS) error_page("Forums are disabled");
|
|
|
|
|
2011-02-09 22:11:34 +00:00
|
|
|
check_get_args(array("userid", "offset"));
|
|
|
|
|
2005-02-13 21:33:02 +00:00
|
|
|
$userid = get_int("userid");
|
|
|
|
$offset = get_int("offset", true);
|
2004-01-06 22:09:19 +00:00
|
|
|
if (!$offset) $offset=0;
|
2012-07-13 21:10:38 +00:00
|
|
|
$items_per_page = 20;
|
2003-12-21 05:55:48 +00:00
|
|
|
|
2014-04-24 16:41:59 +00:00
|
|
|
$user = BoincUser::lookup_id($userid);
|
2005-01-23 10:04:39 +00:00
|
|
|
$logged_in_user = get_logged_in_user(false);
|
2014-08-16 23:31:30 +00:00
|
|
|
BoincForumPrefs::lookup($logged_in_user);
|
2003-12-21 05:55:48 +00:00
|
|
|
|
2011-07-18 17:49:07 +00:00
|
|
|
// Policy for what to show:
|
|
|
|
// Team message board posts:
|
|
|
|
// if requesting user is a member of team
|
|
|
|
// if post is hidden
|
|
|
|
// show only if requesting user is team admin
|
|
|
|
// else don't show
|
|
|
|
// Other posts
|
|
|
|
// if post is hidden
|
|
|
|
// show only if requesting user is project admin
|
|
|
|
//
|
|
|
|
|
|
|
|
$show_all = false;
|
|
|
|
$show_hidden = false;
|
|
|
|
$teamid = 0;
|
|
|
|
$show_team = false;
|
|
|
|
$show_team_hidden = false;
|
|
|
|
|
|
|
|
if ($logged_in_user) {
|
|
|
|
if ($user->id == $logged_in_user->id) {
|
2011-07-31 05:09:08 +00:00
|
|
|
$show_all = true;
|
2011-07-18 17:49:07 +00:00
|
|
|
} else {
|
|
|
|
if ($logged_in_user->prefs->privilege(0)) {
|
|
|
|
$show_hidden = true;
|
|
|
|
}
|
|
|
|
$teamid = $logged_in_user->teamid;
|
|
|
|
if ($teamid) {
|
|
|
|
$team = BoincTeam::lookup_id($teamid);
|
|
|
|
if ($team) {
|
|
|
|
$show_team = true;
|
|
|
|
if (is_team_admin($logged_in_user, $team)) {
|
|
|
|
$show_team_hidden = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$teamid = 0;
|
|
|
|
}
|
|
|
|
}
|
2005-02-13 21:33:02 +00:00
|
|
|
}
|
2005-01-23 10:04:39 +00:00
|
|
|
}
|
2011-08-25 22:12:48 +00:00
|
|
|
page_head(tra("Posts by %1", $user->name));
|
2005-01-23 10:04:39 +00:00
|
|
|
|
2011-09-06 04:34:29 +00:00
|
|
|
$posts = BoincPost::enum("user=$userid order by id desc limit 10000");
|
2004-01-06 22:09:19 +00:00
|
|
|
$n = 0;
|
2004-01-10 01:08:50 +00:00
|
|
|
start_table();
|
2007-11-20 19:23:26 +00:00
|
|
|
$options = get_output_options($logged_in_user);
|
|
|
|
|
2011-07-18 18:10:23 +00:00
|
|
|
$show_next = false;
|
2007-11-12 20:57:15 +00:00
|
|
|
foreach ($posts as $post) {
|
2007-11-14 21:55:05 +00:00
|
|
|
$thread = BoincThread::lookup_id($post->thread);
|
2007-11-20 19:23:26 +00:00
|
|
|
if (!$thread) continue;
|
2007-11-15 22:51:05 +00:00
|
|
|
$forum = BoincForum::lookup_id($thread->forum);
|
2007-11-20 19:23:26 +00:00
|
|
|
if (!$forum) continue;
|
2011-07-18 17:49:07 +00:00
|
|
|
if (!$show_all) {
|
|
|
|
if ($forum->parent_type == 1) {
|
|
|
|
// post to team msg board
|
|
|
|
if ($forum->category == $teamid) {
|
2011-09-27 07:35:26 +00:00
|
|
|
if ($thread->hidden && !$show_team_hidden) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-07-18 17:49:07 +00:00
|
|
|
if ($post->hidden && !$show_team_hidden) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2011-09-27 07:35:26 +00:00
|
|
|
if ($thread->hidden && !$show_hidden) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-07-18 17:49:07 +00:00
|
|
|
if ($post->hidden && !$show_hidden) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-13 21:10:38 +00:00
|
|
|
if ($n == $offset + $items_per_page) {
|
2011-07-18 18:10:23 +00:00
|
|
|
$show_next = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($n >= $offset) {
|
|
|
|
show_post_and_context($post, $thread, $forum, $options, $n+1);
|
2011-07-18 17:49:07 +00:00
|
|
|
}
|
2003-12-21 05:55:48 +00:00
|
|
|
$n++;
|
|
|
|
}
|
2011-07-18 18:10:23 +00:00
|
|
|
echo "</table><br><br>\n";
|
2003-12-21 05:55:48 +00:00
|
|
|
|
2011-07-18 18:10:23 +00:00
|
|
|
if ($offset) {
|
2012-07-13 21:10:38 +00:00
|
|
|
$x = $offset - $items_per_page;
|
2011-07-18 18:10:23 +00:00
|
|
|
echo "<a href=forum_user_posts.php?userid=$userid&offset=$x>
|
2012-07-13 21:10:38 +00:00
|
|
|
<b>".tra("Previous %1", $items_per_page)."</b>
|
2011-07-18 18:10:23 +00:00
|
|
|
</a>
|
|
|
|
";
|
2012-12-19 00:38:40 +00:00
|
|
|
if ($show_next) echo " · ";
|
2011-07-18 18:10:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($show_next) {
|
2012-07-13 21:10:38 +00:00
|
|
|
$offset += $items_per_page;
|
2011-07-18 18:10:23 +00:00
|
|
|
echo "<a href=forum_user_posts.php?userid=$userid&offset=$offset>
|
2012-07-13 21:10:38 +00:00
|
|
|
<b>".tra("Next %1", $items_per_page)."</b>
|
2011-07-18 18:10:23 +00:00
|
|
|
</a>
|
2004-01-06 22:09:19 +00:00
|
|
|
";
|
|
|
|
}
|
2004-01-10 01:08:50 +00:00
|
|
|
|
|
|
|
page_tail();
|
2003-12-21 05:55:48 +00:00
|
|
|
?>
|