summaryrefslogtreecommitdiff
path: root/cgi-bin/inbox
diff options
context:
space:
mode:
Diffstat (limited to 'cgi-bin/inbox')
-rwxr-xr-xcgi-bin/inbox125
1 files changed, 125 insertions, 0 deletions
diff --git a/cgi-bin/inbox b/cgi-bin/inbox
new file mode 100755
index 0000000..9760a54
--- /dev/null
+++ b/cgi-bin/inbox
@@ -0,0 +1,125 @@
+#!/usr/bin/perl
+#########################################
+# inbox
+# deal with inboxing, message display
+#########################################
+
+use localbucky;
+
+$dbh = DBI->connect ($dsn);
+
+our ($USER, $lastlog) = checkin();
+logout() unless ($USER != -1);
+
+if ( defined($input->{object_from_uri}) )
+ {
+ if ( $input->{object_from_uri} =~ /^[0-9]+$/ )
+ {
+ $input->{id} ||= $input->{object_from_uri};
+ }
+ else
+ {
+ $input->{box} ||= $input->{object_from_uri};
+ }
+
+ }
+#$input->{id} ||= $input->{object_from_uri} if defined($input->{object_from_uri}) && ($input->{object_from_uri} =~ /^[0-9]+$/);
+#$input->{box} ||= $input->{object_from_uri} if defined($input->{object_from_uri}) && (
+if (exists($input->{id}))
+ {
+ # display message
+
+ my $message = get_message($input->{id});
+ my $bn = $b->{mbox};
+ $bn =~ s/^$USER->{username}\.//;
+ if ($message == -1)
+ { error("No such message!"); }
+ if ($USER->{username} ne $message->{recipient} && $USER->{username} ne $message->{sender})
+ { error("You are not the recipient of this message."); }
+ unflag_message($input->{id});
+ my $header_args= {};
+ $header_args->{'title'} = $message->{'subject'};
+ if ($message->{'body'} =~ /body bgcolor="?([#0-9a-fA-F]+)/)
+ {
+ $header_args->{'color'} = $1;
+ }
+
+ header($header_args);
+ menu();
+ print "<br><br>";
+ display_message($message);
+ footer();
+ }
+
+elsif ($input->{c} eq "f")
+ {
+ # folder_management_form();
+ }
+
+else
+ {
+ my $box = exists($input->{box}) ? $input->{box} : "inbox";
+ my $limit = exists($input->{limit}) ? int($input->{limit}) : 50;
+ my $date = exists($input->{start}) ? int($input->{start}) : "now";
+
+ header("your $box");
+ menu();
+
+ my $messages = get_messages("$USER->{username}.$box", $limit, $date);
+ my $boxes = get_boxes($USER->{username});
+
+ print qq!<center>!;
+
+ print <<userbox;
+<div class="bluebox" style="float: right;">
+<b>message center</b>
+<hr noshade color="$BUCKY_COLOR_HR">
+<center>
+<table border=0 cellspacing=2 width=100>
+<tr><td align=left><small><b>Folders</b></small></td><td align=center><small>msgs</small></td></tr>
+userbox
+
+ foreach my $b (@$boxes)
+ {
+ my $count = $b->{mcount} || 0;
+ my $bn = $b->{mbox};
+ $bn =~ s/^$USER->{username}\.//;
+ print qq!<tr><td align=left><small><a href="$BUCKY/inbox/$bn"><b>$bn</b></a></small></td>! .
+ qq!<td align=center>!.hushnull($count, undef, 1).qq!</td></tr>!;
+ }
+
+ print <<userbox;
+</table>
+</center>
+<hr noshade color="$BUCKY_COLOR_HR">
+<small>
+<a href="$BUCKY/message"><b>Compose New Mail</b></a>
+</small>
+<hr noshade color="$BUCKY_COLOR_HR">
+<small>
+need to find someone?<br>
+<a href="$BUCKY/users"><u>check the userlist</u></a>
+</small>
+</div>
+userbox
+
+ print qq!<table width="100%" cellpadding=0 cellspacing=0 border=0><tr><td align=left valign=top>!;
+
+ message_list($messages, $box);
+
+ if (@$messages == $limit)
+ {
+ print qq!<div align="right"><big><br>!;
+ $oldest = $messages->[-1]->{date};
+ print qq(<a href="$BUCKY/inbox/$box&limit=$limit&start=$oldest">next <b>$limit</b> messages &gt;&gt;</a>);
+ print qq!</big></div>\n!;
+ }
+
+ print qq!</td></tr></table>!;
+
+ footer();
+ }
+
+$dbh->disconnect ();
+
+print "Inbox: " . &report_time() . "\n" if $timer;