From 2ba138034e8cf69a80201035e0abdb51af93083d Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Wed, 21 Nov 2001 18:38:12 +0000 Subject: [PATCH] Added (c) stuff and some formatting. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1785 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/abook_database.php | 3 + functions/abook_global_file.php | 33 ++-- functions/abook_ldap_server.php | 49 ++--- functions/abook_local_file.php | 37 ++-- functions/addressbook.php | 17 +- functions/array.php | 17 +- functions/attachment_common.php | 17 +- functions/auth.php | 12 +- functions/constants.php | 23 +-- functions/date.php | 3 + functions/db_prefs.php | 3 + functions/display_messages.php | 29 +-- functions/gettext.php | 25 +-- functions/i18n.php | 25 +-- functions/imap.php | 8 +- functions/imap_general.php | 1 + functions/imap_mailbox.php | 1 + functions/imap_messages.php | 3 + functions/imap_search.php | 304 ++++++++++++++++---------------- functions/index.php | 16 +- functions/mailbox_display.php | 94 +++++----- functions/mime.php | 4 + functions/options.php | 1 + functions/page_header.php | 34 ++-- functions/plugin.php | 16 +- functions/prefs.php | 4 + functions/smtp.php | 4 + functions/strings.php | 17 +- functions/tree.php | 17 +- functions/url_parser.php | 19 +- 30 files changed, 462 insertions(+), 374 deletions(-) diff --git a/functions/abook_database.php b/functions/abook_database.php index 0964a852..3788bfe5 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -3,6 +3,9 @@ /** ** abook_database.php ** + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** ** Backend for personal addressbook stored in a database, ** accessed using the DB-classes in PEAR. ** diff --git a/functions/abook_global_file.php b/functions/abook_global_file.php index c59b6bc7..2317948f 100644 --- a/functions/abook_global_file.php +++ b/functions/abook_global_file.php @@ -1,20 +1,23 @@ LDAP server hostname/IP-address - ** base => LDAP server root (base dn). Empty string allowed. - ** ? port => LDAP server TCP port number (default: 389) - ** ? charset => LDAP server charset (default: utf-8) - ** ? name => Name for LDAP server (default "LDAP: hostname") - ** Used to tag the result data - ** ? maxrows => Maximum # of rows in search result - ** ? timeout => Timeout for LDAP operations (in seconds, default: 30) - ** Might not work for all LDAP libraries or servers. - ** - ** NOTE. This class should not be used directly. Use the - ** "AddressBook" class instead. - ** - ** $Id$ - **/ + /** + ** abook_ldap_server.php + ** + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** + ** Address book backend for LDAP server + ** + ** An array with the following elements must be passed to + ** the class constructor (elements marked ? are optional): + ** + ** host => LDAP server hostname/IP-address + ** base => LDAP server root (base dn). Empty string allowed. + ** ? port => LDAP server TCP port number (default: 389) + ** ? charset => LDAP server charset (default: utf-8) + ** ? name => Name for LDAP server (default "LDAP: hostname") + ** Used to tag the result data + ** ? maxrows => Maximum # of rows in search result + ** ? timeout => Timeout for LDAP operations (in seconds, default: 30) + ** Might not work for all LDAP libraries or servers. + ** + ** NOTE. This class should not be used directly. Use the + ** "AddressBook" class instead. + ** + ** $Id$ + **/ class abook_ldap_server extends addressbook_backend { var $btype = 'remote'; diff --git a/functions/abook_local_file.php b/functions/abook_local_file.php index d4731695..b5c7c8d7 100644 --- a/functions/abook_local_file.php +++ b/functions/abook_local_file.php @@ -1,22 +1,25 @@ path to addressbook file - ** ? create => if true: file is created if it does not exist. - ** ? umask => umask set before opening file. - ** - ** NOTE. This class should not be used directly. Use the - ** "AddressBook" class instead. - ** - ** $Id$ - **/ + /** + ** abook_local_file.php + ** + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** + ** Backend for addressbook as a pipe separated file + ** + ** An array with the following elements must be passed to + ** the class constructor (elements marked ? are optional): + ** + ** filename => path to addressbook file + ** ? create => if true: file is created if it does not exist. + ** ? umask => umask set before opening file. + ** + ** NOTE. This class should not be used directly. Use the + ** "AddressBook" class instead. + ** + ** $Id$ + **/ class abook_local_file extends addressbook_backend { var $btype = 'local'; diff --git a/functions/addressbook.php b/functions/addressbook.php index ca57150e..08246cd6 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -1,12 +1,15 @@ 'image/x-bitmap', diff --git a/functions/auth.php b/functions/auth.php index 7dd58a7a..5b3f31e5 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -3,11 +3,15 @@ /** ** auth.php ** + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** ** Contains functions used to do authentication. ** ** $Id$ **/ + require_once( '../functions/page_header.php' ); function is_logged_in () { global $squirrelmail_language; @@ -17,9 +21,11 @@ set_up_language($squirrelmail_language, true); - echo "\n" . - '

echo "
'. - _("You must be logged in to access this page.").'
'. + displayHtmlHeader( 'SquirrelMail', '', FALSE ); + + echo "\n" . + '

'. + _("You must be logged in to access this page.").'

'. ""._("Go to the login page")."\n". "
\n"; exit; diff --git a/functions/constants.php b/functions/constants.php index c2b4ec26..2a3620f8 100644 --- a/functions/constants.php +++ b/functions/constants.php @@ -1,16 +1,17 @@ 29 Jun 1999 09:52:11 -0500 (EDT) diff --git a/functions/db_prefs.php b/functions/db_prefs.php index e23f320f..b4f07f5d 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -2,6 +2,9 @@ /** ** db_prefs.php ** + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** ** This contains functions for manipulating user preferences ** stored in a database, accessed though the Pear DB layer. ** diff --git a/functions/display_messages.php b/functions/display_messages.php index 06bc2fcb..e59a3c46 100644 --- a/functions/display_messages.php +++ b/functions/display_messages.php @@ -1,7 +1,11 @@ '; - echo " "; - echo ' '; - echo " '; - echo '
"; - echo '
ERROR
'; - echo '
'; - echo '

' . _("Unknown user or password incorrect.") . '
' . _("Click here to try again") . '.
'; - echo '
'; - echo ''; + + echo '
'. + "". + ''. + "'. + '
". + '
ERROR
'. + '
'. + '

' . _("Unknown user or password incorrect.") . + '
' . + _("Click here to try again") . + '.
'. + '
'. + ''; + } function general_info($motd, $org_logo, $version, $org_name, $color) { diff --git a/functions/gettext.php b/functions/gettext.php index 90da1db6..48fec079 100644 --- a/functions/gettext.php +++ b/functions/gettext.php @@ -1,15 +1,20 @@
No Messages Found
"; - return; - } else if (isset($errors)) { - echo ""; - } - - # HACKED CODED FROM ANOTHER FUNCTION, Could Probably dump this and mondify - # exsitising code with a search true/false varible. - - - global $sent_folder; - for ($q = 0; $q < count($messagelist); $q++) { - $id[$q] = trim($messagelist[$q]); - } - $issent = ($mailbox == $sent_folder); - $hdr_list = sqimap_get_small_header_list($imapConnection, $id, $issent); - $flags = sqimap_get_flags_list($imapConnection, $id, $issent); - foreach ($hdr_list as $hdr) { - $from[] = $hdr->from; - $date[] = $hdr->date; - $subject[] = $hdr->subject; - $to[] = $hdr->to; - $priority[] = $hdr->priority; - $cc[] = $hdr->cc; - $size[] = $hdr->size; - $type[] = $hdr->type0; - } - - $j = 0; - while ($j < count($messagelist)) { - $date[$j] = ereg_replace(' ', ' ', $date[$j]); - $tmpdate = explode(" ", trim($date[$j])); - - $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate); - $messages[$j]["DATE_STRING"] = getDateString($messages[$j]["TIME_STAMP"]); - $messages[$j]["ID"] = $id[$j]; - $messages[$j]["FROM"] = decodeHeader($from[$j]); - $messages[$j]["FROM-SORT"] = strtolower(sqimap_find_displayable_name(decodeHeader($from[$j]))); - $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]); - $messages[$j]["SUBJECT-SORT"] = strtolower(decodeHeader($subject[$j])); - $messages[$j]["TO"] = decodeHeader($to[$j]); - $messages[$j]["PRIORITY"] = $priority[$j]; - $messages[$j]["CC"] = $cc[$j]; - $messages[$j]["SIZE"] = $size[$j]; - $messages[$j]["TYPE0"] = $type[$j]; - - $num = 0; - while ($num < count($flags[$j])) { - if ($flags[$j][$num] == "Deleted") { - $messages[$j]["FLAG_DELETED"] = true; - } - else if ($flags[$j][$num] == "Answered") { - $messages[$j]["FLAG_ANSWERED"] = true; - } - else if ($flags[$j][$num] == "Seen") { - $messages[$j]["FLAG_SEEN"] = true; + **/ + + + require_once('../functions/imap.php'); + require_once('../functions/date.php'); + require_once('../functions/array.php'); + require_once('../functions/mailbox_display.php'); + require_once('../functions/mime.php'); + + + function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) { + + global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order; + + $urlMailbox = urlencode($mailbox); + $isid = sqimap_session_id(); + + /* Construct the Search QuERY */ + $ss = $isid; + if (isset($languages[$squirrelmail_language]['CHARSET']) && + $languages[$squirrelmail_language]['CHARSET']) { + $ss .= " SEARCH CHARSET ".$languages[$squirrelmail_language]['CHARSET']." ALL $search_where \"$search_what\"\r\n"; + } else { + $ss .= " SEARCH ALL $search_where \"$search_what\"\r\n"; + } + fputs($imapConnection,$ss); + + # Read Data Back From IMAP + $readin = sqimap_read_data ($imapConnection, $isid, false, $result, $message); + if (isset($languages[$squirrelmail_language]['CHARSET']) && strtolower($result) == 'no') { + $ss = $isid . " SEARCH CHARSET \"US-ASCII\" ALL $search_where \"$search_what\"\r\n"; + fputs ($imapConnection, $ss); + $readin = sqimap_read_data ($imapConnection, $isid, true, $result, $message); + } + + unset($messagelist); $msgs=""; $c = 0; + + /* Keep going till we find the SEARCH responce */ + while ($c < count( $readin )) { + + /* Check to see if a SEARCH Responce was recived */ + if (substr($readin[$c],0,9) == "* SEARCH ") + $messagelist = explode(" ",substr($readin[$c],9)); + else if (isset($errors)) + $errors = $errors.$readin[$c]; + else + $errors = $readin[$c]; + $c++; + } + + #If nothing is found * SEARCH should be the first error else echo errors + if (isset($errors) && strstr($errors,"* SEARCH")) { + echo '
' . _("No Messages Found") . '
'; + return; + } else if (isset($errors)) { + echo ""; + } + + # HACKED CODED FROM ANOTHER FUNCTION, Could Probably dump this and mondify + # exsitising code with a search true/false varible. + + + global $sent_folder; + for ($q = 0; $q < count($messagelist); $q++) { + $id[$q] = trim($messagelist[$q]); + } + $issent = ($mailbox == $sent_folder); + $hdr_list = sqimap_get_small_header_list($imapConnection, $id, $issent); + $flags = sqimap_get_flags_list($imapConnection, $id, $issent); + foreach ($hdr_list as $hdr) { + $from[] = $hdr->from; + $date[] = $hdr->date; + $subject[] = $hdr->subject; + $to[] = $hdr->to; + $priority[] = $hdr->priority; + $cc[] = $hdr->cc; + $size[] = $hdr->size; + $type[] = $hdr->type0; + } + + $j = 0; + while ($j < count($messagelist)) { + $date[$j] = ereg_replace(' ', ' ', $date[$j]); + $tmpdate = explode(" ", trim($date[$j])); + + $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate); + $messages[$j]["DATE_STRING"] = getDateString($messages[$j]["TIME_STAMP"]); + $messages[$j]["ID"] = $id[$j]; + $messages[$j]["FROM"] = decodeHeader($from[$j]); + $messages[$j]["FROM-SORT"] = strtolower(sqimap_find_displayable_name(decodeHeader($from[$j]))); + $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]); + $messages[$j]["SUBJECT-SORT"] = strtolower(decodeHeader($subject[$j])); + $messages[$j]["TO"] = decodeHeader($to[$j]); + $messages[$j]["PRIORITY"] = $priority[$j]; + $messages[$j]["CC"] = $cc[$j]; + $messages[$j]["SIZE"] = $size[$j]; + $messages[$j]["TYPE0"] = $type[$j]; + + $num = 0; + while ($num < count($flags[$j])) { + if ($flags[$j][$num] == 'Deleted') { + $messages[$j]['FLAG_DELETED'] = true; + } else if ($flags[$j][$num] == 'Answered') { + $messages[$j]['FLAG_ANSWERED'] = true; + } else if ($flags[$j][$num] == 'Seen') { + $messages[$j]['FLAG_SEEN'] = true; + } else if ($flags[$j][$num] == 'Flagged') { + $messages[$j]['FLAG_FLAGGED'] = true; + } + $num++; + } + $j++; + } + + /** Find and remove the ones that are deleted */ + $i = 0; + $j = 0; + while ($j < count($messagelist)) { + if (isset($messages[$j]["FLAG_DELETED"]) && $messages[$j]["FLAG_DELETED"] == true) { + $j++; + continue; } - else if ($flags[$j][$num] == "Flagged") { - $messages[$j]["FLAG_FLAGGED"] = true; - } - $num++; - } - $j++; - } - - /** Find and remove the ones that are deleted */ - $i = 0; - $j = 0; - while ($j < count($messagelist)) { - if (isset($messages[$j]["FLAG_DELETED"]) && $messages[$j]["FLAG_DELETED"] == true) { - $j++; - continue; - } - $msgs[$i] = $messages[$j]; - - $i++; - $j++; - } - $numMessages = $i; - - // There's gotta be messages in the array for it to sort them. - - if (count($messagelist) > 0) { - $j=0; - if (!isset ($msg)) { $msg = ""; } - mail_message_listing_beginning($imapConnection, - "move_messages.php?msg=$msg&mailbox=$urlMailbox&where=".urlencode($search_where)."&what=".urlencode($search_what), - $mailbox, -1, '' . _("Found") . ' ' . count($messagelist) . ' ' . _("messages") . '', - ' '); - - - while ($j < count($msgs)) { - printMessageInfo($imapConnection, $msgs[$j]["ID"], 0, $j, $mailbox, "", 0, $search_where, $search_what); + $msgs[$i] = $messages[$j]; + + $i++; $j++; - } - echo ''; - } - } + } + $numMessages = $i; + + // There's gotta be messages in the array for it to sort them. + + if (count($messagelist) > 0) { + $j=0; + if (!isset ($msg)) { $msg = ""; } + mail_message_listing_beginning($imapConnection, + "move_messages.php?msg=$msg&mailbox=$urlMailbox&where=".urlencode($search_where)."&what=".urlencode($search_what), + $mailbox, -1, '' . _("Found") . ' ' . count($messagelist) . ' ' . _("messages") . '', + ' '); + + + while ($j < count($msgs)) { + printMessageInfo($imapConnection, $msgs[$j]["ID"], 0, $j, $mailbox, "", 0, $search_where, $search_what); + $j++; + } + echo ''; + } + } -?> +?> \ No newline at end of file diff --git a/functions/index.php b/functions/index.php index a7e26508..ac36ecda 100644 --- a/functions/index.php +++ b/functions/index.php @@ -2,13 +2,19 @@ /** ** index.php ** - ** This file simply takes any attempt to view source files - ** and sends those people to the login screen. At this - ** point no attempt is made to see if the person is logged - ** or not. + ** Copyright (c) 1999-2001 The Squirrelmail Development Team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** + ** This file simply takes any attempt to view source files + ** and sends those people to the login screen. At this + ** point no attempt is made to see if the person is logged + ** or not. + ** + ** $Id$ **/ header("Location:../index.php"); /** pretty impressive huh? **/ -?> + +?> \ No newline at end of file diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index d0f62013..aeb5285b 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1,15 +1,16 @@ \n"; - echo "

". _("THIS FOLDER IS EMPTY") ."
 
\n"; - echo ""; + echo "\n". + "

". _("THIS FOLDER IS EMPTY") ."
 
\n". + ""; } else if ($start_msg == $end_msg) { /* If there's only one message in the box, handle it differently. */ if ($sort != 6) { @@ -438,8 +439,8 @@ } while ($i && $i < $endVar); } - echo ''; - echo "" . + echo '
'. + "" . "" . "
". "
$paginator_str$msg_cnt_str
". @@ -472,23 +473,18 @@ * This is the beginning of the message list table. * * It wraps around all messages * ****************************************************/ - echo "\n"; - - echo ""; - - /** The delete and move options */ - echo "'; + echo ''. - echo "
"; - echo " \n"; - echo " \n"; - echo ' \n"; - echo " \n"; - echo "
$paginator' . get_selectall_link($start_msg, $sort) . "$msg_cnt_str
\n"; - echo "
"; - - echo "\n
\n"; - echo "\n"; - - echo " \n" . + echo "
\n". + "'. + "\n". + " \n". + "
". + "\n". + " \n". + ' \n". + " \n". + "
$paginator' . get_selectall_link($start_msg, $sort) . "$msg_cnt_str
\n". + '
\n". + "\n". + "\n". + " \n" . " \n" . @@ -508,31 +504,31 @@ echo " \n"; } } - echo ' '; - echo " \n"; - echo " \n"; - echo " \n". + " \n"; - echo " \n"; - echo "
\n" . '  ' . _("Move selected to:") . "\n" . "    \n"; + echo ' '. + "\n". + "    \n"; if (!$auto_expunge) { echo '  '. _("mailbox") ." \n"; } - echo " \n"; - echo " \n"; - echo "  \n"; - echo "
\n"; + echo " \n". + " \n". + "  \n". + "
\n"; do_hook('mailbox_form_before'); - echo '
"; - echo "
". + ""; - echo ""; + echo " BGCOLOR=\"$color[0]\">". + ""; /* Print the headers. */ for ($i=1; $i <= count($index_order); $i++) { @@ -550,7 +546,7 @@ echo ' \n"; break; @@ -756,4 +752,4 @@ return substr($subject, 0, $trim_val) . '...'; } -?> +?> \ No newline at end of file diff --git a/functions/mime.php b/functions/mime.php index 750a48ae..a790fb20 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -1,5 +1,9 @@ \n"; - // echo "
'. _("From") .''; } - ShowSortButton($sort, $mailbox, 2, 3); + ShowSortButton($sort, $mailbox, 2, 3); echo "
"; - echo "\n"; - echo " \n"; - echo "
\n"; + echo "\n". + // "\n". + " \n". + "
". + "\n". + " \n". + " \n"; - echo " \n"; - echo " \n"; - echo " \n". + " \n". + " \n". + " \n"; - echo " \n"; - echo "
\n"; displayInternalLink ("src/signout.php", _("Sign Out"), "_top"); - echo " \n"; - echo ' ' . _("Current Folder") . ": $shortBoxName \n"; - echo "
\n"; + echo " \n". + ' ' . _("Current Folder") . ": $shortBoxName \n". + "
\n"; $urlMailbox = urlencode($mailbox); displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), "right"); echo "  \n"; @@ -76,9 +79,10 @@ echo " \n"; echo ($hide_sm_attributions ? ' ' : "SquirrelMail\n"); - echo "
\n\n"; + echo "
\n\n"; // echo "
"; } -?> + +?> \ No newline at end of file diff --git a/functions/plugin.php b/functions/plugin.php index 7d209e84..bb77c068 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -1,18 +1,16 @@