function do_inbox($logged_in_user) { page_head(tra("Private messages") . ": " . tra("Inbox")); make_script(); if (get_int("sent", true) == 1) { echo "<div class=\"notice\">" . tra("Your message has been sent.") . "</div>\n"; } $options = get_output_options($logged_in_user); BoincNotify::delete_aux("userid={$logged_in_user->id} and type=" . NOTIFY_PM); $msgs = BoincPrivateMessage::enum("userid={$logged_in_user->id} ORDER BY date DESC"); if (count($msgs) == 0) { echo tra("You have no private messages."); } else { echo "<form name=msg_list action=pm.php method=post>\n <input type=hidden name=action value=delete_selected>\n "; echo form_tokens($logged_in_user->authenticator); start_table(); echo "<tr><th>" . tra("Subject") . "</th><th>" . tra("Sender and date") . "</th><th>" . tra("Message") . "</th></tr>\n"; $i = 0; foreach ($msgs as $msg) { $sender = BoincUser::lookup_id($msg->senderid); if (!$sender) { $msg->delete(); continue; } $i++; $class = $i % 2 ? "row0" : "row1"; echo "<tr class={$class}>\n"; $checkbox = "<input type=checkbox name=pm_select_{$msg->id}>"; if (!$msg->opened) { $msg->update("opened=1"); } echo "<td valign=top> {$checkbox} {$msg->subject} </td>\n"; echo "<td valign=top>" . user_links($sender, BADGE_HEIGHT_SMALL); show_block_link($msg->senderid); echo "<br>" . time_str($msg->date) . "</td>\n"; echo "<td valign=top>" . output_transform($msg->content, $options) . "<p>"; $tokens = url_tokens($logged_in_user->authenticator); show_button("pm.php?action=new&replyto={$msg->id}", tra("Reply"), tra("Reply to this message")); show_button("pm.php?action=delete&id={$msg->id}&{$tokens}", tra("Delete"), tra("Delete this message")); echo "</ul></td></tr>\n"; } echo "\n <tr><td>\n <a href=\"javascript:set_all(1)\">" . tra("Select all") . "</a>\n |\n <a href=\"javascript:set_all(0)\">" . tra("Unselect all") . "</a>\n </td>\n <td colspan=2>\n <input class=\"btn btn-danger\" type=submit value=\"" . tra("Delete selected messages") . "\">\n </td></tr>\n "; end_table(); echo "</form>\n"; } page_tail(); }
if ($thread->hidden) { continue; } show_thread_and_context($thread, $logged_in_user, $i++); } end_table(); echo "<br /><br />"; } // Look in a post content as well // $posts = search_post_content($search_list, $forum, $user, $min_timestamp, $limit, $search_sort, $show_hidden_posts); if (count($posts)) { echo "<span class=title>" . tra("Messages matching your query:") . "</span>"; start_table(); $n = 1; $options = get_output_options($logged_in_user); $options->setHighlightTerms($search_list); foreach ($posts as $post) { $thread = BoincThread::lookup_id($post->thread); if (!$thread) { continue; } $forum = BoincForum::lookup_id($thread->forum); if (!$forum) { continue; } if (!is_forum_visible_to_user($forum, $logged_in_user)) { continue; } if (!$show_hidden_posts) { if ($thread->hidden) {