From f923b93d9dfa36c30ee37e77b6117940ef2c5977 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sun, 22 Apr 2001 05:16:45 +0000 Subject: [PATCH] * added signout_page option to redirect after signout * added hook in compose git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1285 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 4 ++- config/conf.pl | 21 ++++++++++++++ config/config_default.php | 8 ++++++ functions/imap_mailbox.php | 2 +- src/compose.php | 56 ++++++++++++++++++-------------------- src/signout.php | 6 ++++ 6 files changed, 66 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f8cd0b8..87ae563a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ Version 1.1.0 -- DEVELOPMENT ---------------------------- -- Much improved SMTP error handling (patch by Jeff Evans) +- Added option to have signout page redirect to another page (patch from Scott Bronson) + This can be configured in conf.pl (Org Prefs) +- Much improved SMTP error handling (patch from Jeff Evans) - Preferences are now cached instead of read in every page load. - Improved URL parser - Added ability to read HTML messages by default instead of plain text (Display Options) diff --git a/config/conf.pl b/config/conf.pl index 1f221145..bc811a3f 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -282,6 +282,7 @@ while (($command ne "q") && ($command ne "Q")) { print "1. Organization Name : $WHT$org_name$NRM\n"; print "2. Organization Logo : $WHT$org_logo$NRM\n"; print "3. Organization Title : $WHT$org_title$NRM\n"; + print "4. Signout Page : $WHT$signout_page$NRM\n"; print "\n"; print "R Return to Main Menu\n"; } elsif ($menu == 2) { @@ -450,6 +451,7 @@ while (($command ne "q") && ($command ne "Q")) { if ($command == 1) { $org_name = command1 (); } elsif ($command == 2) { $org_logo = command2 (); } elsif ($command == 3) { $org_title = command3 (); } + elsif ($command == 4) { $signout_page = command4 (); } } elsif ($menu == 2) { if ($command == 1) { $domain = command11 (); } elsif ($command == 2) { $imapServerAddress = command12 (); } @@ -548,6 +550,24 @@ sub command3 { return $new_org_title; } +# signout_page +sub command4 { + print "When users click the Sign Out button they will be logged out and\n"; + print "then sent to signout_page. If signout_page is left empty,\n"; + print "(hit space and then return) they will be taken, as normal,\n"; + print "to the default and rather sparse SquirrelMail signout page.\n"; + print "\n"; + print "[$WHT$signout_page$NRM]: $WHT"; + $new_signout_page = ; + if ($new_signout_page eq "\n") { + $new_signout_page = $signout_page; + } else { + $new_signout_page =~ s/[\r|\n]//g; + $new_signout_page =~ s/^\s+$//g; + } + return $new_signout_page; +} + #################################################################################### # domain @@ -1563,6 +1583,7 @@ sub save_data { print FILE "\t\$org_name = \"$org_name\";\n"; print FILE "\t\$org_logo = \"$org_logo\";\n"; print FILE "\t\$org_title = \"$org_title\";\n"; + print FILE "\t\$signout_page = \"$signout_page\";\n"; print FILE "\n"; diff --git a/config/config_default.php b/config/config_default.php index 6c227599..085f92b3 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -73,6 +73,14 @@ global $imap_server_type; $imap_server_type = "cyrus"; +// Rather than going to the signout.php page (which only allows you +// to sign back in), setting signout_page allows you to sign +// the user out and then redirect to whatever page you want. +// For instance, the following would return the user to your +// home page: $signout_page = "/"; +// Set to the empty string to continue to use the default signout page. + $signout_page = ""; + // Many servers store mail in your home directory. With this, they // store them in a subdirectory: mail/ or Mail/, etc. If your // server does this, please set this to what the default mail folder diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 1a67ae51..d0252d68 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -207,7 +207,7 @@ /** LSUB array **/ $inbox_subscribed = false; - fputs ($imap_stream, "a001 LSUB \"\" \"*\"\r\n"); + fputs ($imap_stream, "a001 LSUB \"\" \"*%\"\r\n"); $lsub_ary = sqimap_read_data ($imap_stream, "a001", true, $response, $message); /** OS: we don't want to parse last element of array, 'cause it is OK command, so we unset it **/ diff --git a/src/compose.php b/src/compose.php index 1389e1ff..222851ee 100644 --- a/src/compose.php +++ b/src/compose.php @@ -64,7 +64,7 @@ } else { $body = ""; } - + if ($message->header->type1 == "html") $body = strip_tags($body); @@ -90,7 +90,7 @@ } sqWordWrap($body_ary[$i], $editor_size - 1); $body .= $body_ary[$i] . "\n"; - unset($body_ary[$i]); + unset($body_ary[$i]); } if ($forward_id) { @@ -150,7 +150,7 @@ if (!$message) { sqimap_mailbox_select($imapConnection, $mailbox); $message = sqimap_get_message($imapConnection, $forward_id, - $mailbox); + $mailbox); } if (count($message->entities) == 0) { @@ -161,19 +161,19 @@ $filename = "untitled-".$message->header->entity_id; $localfilename = GenerateRandomString(32, '', 7); - while (file_exists($attachment_dir . $localfilename)) - $localfilename = GenerateRandomString(32, '', 7); + while (file_exists($attachment_dir . $localfilename)) + $localfilename = GenerateRandomString(32, '', 7); $newAttachment['localfilename'] = $localfilename; - $newAttachment['remotefilename'] = $filename; - $newAttachment['type'] = strtolower($message->header->type0 . - '/' . $message->header->type1); + $newAttachment['remotefilename'] = $filename; + $newAttachment['type'] = strtolower($message->header->type0 . + '/' . $message->header->type1); // Write Attachment to file $fp = fopen ($attachment_dir.$localfilename, 'w'); fputs ($fp, decodeBody(mime_fetch_body($imapConnection, - $forward_id, $message->header->entity_id), - $message->header->encoding)); + $forward_id, $message->header->entity_id), + $message->header->encoding)); fclose ($fp); $attachments[] = $newAttachment; @@ -210,7 +210,7 @@ echo "\n
\n"; + echo ">\n"; if ($reply_id) { echo "\n"; } @@ -305,11 +305,11 @@ echo "\n"; echo " "; echo ""; - foreach ($attachments as $key => $info) { + foreach ($attachments as $key => $info) { echo "\n"; - echo $info['remotefilename'] . " - " . $info['type'] . " ("; - echo show_readable_size(filesize($attachment_dir . - $info['localfilename'])) . ")
\n"; + echo $info['remotefilename'] . " - " . $info['type'] . " ("; + echo show_readable_size(filesize($attachment_dir . + $info['localfilename'])) . ")
\n"; } echo "\n"; @@ -390,9 +390,9 @@ // global $CHARSET, $SOURCE_CHARSET, $send_to, $send_to_cc, $send_to_bcc, $subject, $body; $charset_ary = array("koi8-r" => "k", - "windows-1251" => "w", - "ibm866" => "a", - "ISO-8859-5" => "i"); + "windows-1251" => "w", + "ibm866" => "a", + "ISO-8859-5" => "i"); $body = convert_cyr_string($body, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]); $send_to = convert_cyr_string($send_to, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]); $send_to_cc = convert_cyr_string($send_to_cc, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]); @@ -422,10 +422,11 @@ if (! isset($reply_id)) $reply_id = 0; // Set $default_charset to correspond with the user's selection - // of language interface. - set_my_charset(); + // of language interface. + set_my_charset(); + do_hook("compose_send"); + if (sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id) == 0) {showInputForm(); exit();} -// header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1"); } else { //$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); displayPageHeader($color, $mailbox); @@ -494,7 +495,7 @@ { unlink ($attachment_dir.$attachments[$index]['localfilename']); unset ($attachments[$index]); - } + } } showInputForm(); @@ -520,16 +521,13 @@ - function ClearAttachments() - { + function ClearAttachments() { global $attachments, $attachment_dir; - foreach ($attachments as $info) - { - if (file_exists($attachment_dir . $info['localfilename'])) - { + foreach ($attachments as $info) { + if (file_exists($attachment_dir . $info['localfilename'])) { unlink($attachment_dir . $info['localfilename']); - } + } } $attachments = array(); diff --git a/src/signout.php b/src/signout.php index 09c195dc..a30910d2 100644 --- a/src/signout.php +++ b/src/signout.php @@ -42,6 +42,12 @@ setcookie('key', '', 0, $base_uri); setcookie('logged_in', '', 0, $base_uri); session_destroy(); + + if ($signout_page) { + header("Status: 303 See Other"); + header("Location: $signout_page"); + exit; /* we send no content if we're redirecting. */ + } ?> -- 2.25.1