From e9192b3d42660a5781101df4357d276318151e8a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:41 -0500 Subject: cgi-bin & lib --- cgi-bin/inbox | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100755 cgi-bin/inbox (limited to 'cgi-bin/inbox') 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 "

"; + 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!
!; + + print < +message center +
+
+ + +userbox + + foreach my $b (@$boxes) + { + my $count = $b->{mcount} || 0; + my $bn = $b->{mbox}; + $bn =~ s/^$USER->{username}\.//; + print qq!! . + qq!!; + } + + print < + +
+ +Compose New Mail + +
+ +need to find someone?
+check the userlist +
+ +userbox + + print qq!
Foldersmsgs
$bn!.hushnull($count, undef, 1).qq!
!; + + message_list($messages, $box); + + if (@$messages == $limit) + { + print qq!

!; + $oldest = $messages->[-1]->{date}; + print qq(next $limit messages >>); + print qq!
\n!; + } + + print qq!
!; + + footer(); + } + +$dbh->disconnect (); + +print "Inbox: " . &report_time() . "\n" if $timer; -- cgit v1.2.3-70-g09d2