From 245a6892bf5c780904ef9677f24d624ea17e0749 Mon Sep 17 00:00:00 2001 From: fidian Date: Tue, 30 Jan 2001 17:22:38 +0000 Subject: [PATCH] Removed a lot of the warnings generated when PHP has all warnings enabled. This is not done yet, but it is a VERY good start. Added $Id$ tags to a lot of the files. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@982 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 2 + functions/abook_database.php | 2 + functions/abook_ldap_server.php | 2 + functions/abook_local_file.php | 2 + functions/addressbook.php | 1 + functions/array.php | 3 +- functions/auth.php | 1 + functions/date.php | 1 + functions/display_messages.php | 1 + functions/imap.php | 2 + functions/imap_general.php | 14 ++++++- functions/imap_mailbox.php | 8 ++-- functions/imap_messages.php | 21 ++++++---- functions/imap_search.php | 3 +- functions/mailbox_display.php | 69 +++++++++++++++++++++++++++------ functions/mime.php | 30 ++++++++++---- functions/page_header.php | 1 + functions/plugin.php | 6 ++- functions/prefs.php | 2 + functions/smtp.php | 2 + functions/strings.php | 14 +++++-- functions/tree.php | 3 ++ functions/url_parser.php | 1 + src/addrbook_popup.php | 1 + src/addrbook_search.php | 2 + src/addrbook_search_html.php | 6 ++- src/addressbook.php | 25 ++++++++---- src/compose.php | 23 ++++++----- src/delete_message.php | 7 ++-- src/download.php | 2 + src/empty_trash.php | 2 + src/folders.php | 10 +++-- src/folders_create.php | 2 + src/folders_delete.php | 2 + src/folders_rename_do.php | 2 + src/folders_rename_getname.php | 2 + src/folders_subscribe.php | 2 + src/help.php | 1 + src/left_main.php | 11 ++++-- src/load_prefs.php | 3 +- src/move_messages.php | 12 +++--- src/options.php | 11 +++--- src/options_display.php | 1 + src/options_folder.php | 1 + src/options_highlight.php | 1 + src/options_order.php | 1 + src/options_personal.php | 5 ++- src/read_body.php | 8 ++-- src/redirect.php | 1 + src/right_main.php | 10 +++-- src/search.php | 11 ++++-- src/signout.php | 5 ++- src/webmail.php | 6 ++- 53 files changed, 275 insertions(+), 92 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index b454fb44..1f3b0ff8 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -3,6 +3,8 @@ # Luke Ehresman (luke@squirrelmail.org) # # A simple configure script to configure squirrelmail +# +# $Id$ ############################################################ $conf_pl_version = "x62"; diff --git a/functions/abook_database.php b/functions/abook_database.php index e885ffa4..85a0e9e1 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -23,6 +23,8 @@ ** ** NOTE. This class should not be used directly. Use the ** "AddressBook" class instead. + ** + ** $Id$ **/ require_once("DB.php"); diff --git a/functions/abook_ldap_server.php b/functions/abook_ldap_server.php index 1b9562b9..4863b7bb 100644 --- a/functions/abook_ldap_server.php +++ b/functions/abook_ldap_server.php @@ -20,6 +20,8 @@ ** ** NOTE. This class should not be used directly. Use the ** "AddressBook" class instead. + ** + ** $Id$ **/ class abook_ldap_server extends addressbook_backend { diff --git a/functions/abook_local_file.php b/functions/abook_local_file.php index 91c3e8df..ccf57b4a 100644 --- a/functions/abook_local_file.php +++ b/functions/abook_local_file.php @@ -14,6 +14,8 @@ ** ** NOTE. This class should not be used directly. Use the ** "AddressBook" class instead. + ** + ** $Id$ **/ class abook_local_file extends addressbook_backend { diff --git a/functions/addressbook.php b/functions/addressbook.php index 8779c99e..baaff51b 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -5,6 +5,7 @@ ** ** Functions and classes for the addressbook system. ** + ** $Id$ **/ $addressbook_php = true; diff --git a/functions/array.php b/functions/array.php index 9e83a195..b59f21c9 100644 --- a/functions/array.php +++ b/functions/array.php @@ -5,6 +5,7 @@ ** This contains functions that work with array manipulation. They ** will help sort, and do other types of things with arrays ** + ** $Id$ **/ $array_php = true; @@ -19,7 +20,7 @@ $GLOBALS["col"] = $col; // Column or Columns as an array $GLOBALS["dir"] = $dir; // Direction, a positive number for ascending a negative for descending - usort($ary,comp2); + usort($ary,'comp2'); return $ary; } diff --git a/functions/auth.php b/functions/auth.php index 594567fd..fec8c1b3 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -5,6 +5,7 @@ ** ** Contains functions used to do authentication. ** + ** $Id$ **/ $auth_php = true; diff --git a/functions/date.php b/functions/date.php index 6cb4b68c..c258fc94 100644 --- a/functions/date.php +++ b/functions/date.php @@ -7,6 +7,7 @@ ** 29 Jun 1999 09:52:11 -0500 (EDT) ** (as specified in RFC 822) -- "Tue" is optional ** + ** $Id$ **/ $date_php = true; diff --git a/functions/display_messages.php b/functions/display_messages.php index 242f48f6..e4a02c0e 100644 --- a/functions/display_messages.php +++ b/functions/display_messages.php @@ -5,6 +5,7 @@ ** This contains all messages, including information, error, and just ** about any other message you can think of. ** + ** $Id$ **/ $display_messages_php = true; diff --git a/functions/imap.php b/functions/imap.php index 2fa499f6..b0a24be7 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -1,6 +1,8 @@ "; + $cc = ""; + $to = ""; + $date = ""; + $type[0] = ""; + $type[1] = ""; $g = 0; for ($i = 0; $i < count($read); $i++) { @@ -128,7 +136,7 @@ $header->size = $size; $header->type0 = $type[0]; $header->type1 = $type[1]; - + return $header; } @@ -149,8 +157,7 @@ ******************************************************************************/ function sqimap_get_message ($imap_stream, $id, $mailbox) { $header = sqimap_get_message_header($imap_stream, $id, $mailbox); - $msg = sqimap_get_message_body($imap_stream, &$header); - return $msg; + return sqimap_get_message_body($imap_stream, &$header); } /****************************************************************************** @@ -291,7 +298,7 @@ /** FROM **/ else if (strtolower(substr($read[$i], 0, 5)) == "from:") { $hdr->from = trim(substr($read[$i], 5, strlen($read[$i]) - 6)); - if ($hdr->replyto == "") + if (! isset($hdr->replyto) || $hdr->replyto == "") $hdr->replyto = $hdr->from; $i++; } @@ -369,7 +376,7 @@ ******************************************************************************/ function sqimap_get_message_body ($imap_stream, &$header) { $id = $header->id; - return decodeMime($imap_stream, $body, &$header); + return decodeMime($imap_stream, &$header); } diff --git a/functions/imap_search.php b/functions/imap_search.php index d980bd19..7d497ab4 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -1,6 +1,7 @@ -\n"; - if ($msg["FLAG_FLAGGED"] == true) { $flag = ""; $flag_end = ""; } - if ($msg["FLAG_SEEN"] == false) { $bold = ""; $bold_end = ""; } - if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } - if ($msg["FLAG_DELETED"]) { $fontstr = ""; $fontstr_end = ""; } + if (isset($msg['FLAG_FLAGGED']) && $msg["FLAG_FLAGGED"] == true) + { + $flag = ""; + $flag_end = ""; + } + else + { + $flag = ""; + $flag_end = ""; + } + if (isset($msg['FLAG_SEEN']) && $msg["FLAG_SEEN"] == false) + { + $bold = ""; + $bold_end = ""; + } + else + { + $bold = ""; + $bold_end = ""; + } + if ($mailbox == $sent_folder) + { + $italic = ""; + $italic_end = ""; + } + else + { + $italic = ""; + $italic_end = ""; + } + if (isset($msg['FLAG_DELETED']) && $msg["FLAG_DELETED"]) + { + $fontstr = ""; + $fontstr_end = ""; + } + else + { + $fontstr = ""; + $fontstr_end = ""; + } for ($i=0; $i < count($message_highlight_list); $i++) { if (trim($message_highlight_list[$i]["value"]) != "") { @@ -46,7 +83,7 @@ } } - if (!$hlt_color) + if (!isset($hlt_color)) $hlt_color = $color[4]; if ($where && $what) { @@ -71,14 +108,17 @@ break; case 4: # subject echo " $bold"; - echo "$flag$subject$flag_end$bold_end\n"; + if (! isset($search_stuff)) + $search_stuff = ""; + echo "$flag$subject$flag_end$bold_end\n"; break; case 5: # flags $stuff = false; echo " \n"; - if ($msg["FLAG_ANSWERED"] == true) { + if (isset($msg['FLAG_ANSWERED']) && + $msg["FLAG_ANSWERED"] == true) { echo "A\n"; $stuff = true; } @@ -90,7 +130,7 @@ echo "!\n"; $stuff = true; } - if ($msg["FLAG_DELETED"]) { + if (isset($msg['FLAG_DELETED']) && $msg["FLAG_DELETED"]) { echo "D\n"; $stuff = true; } @@ -189,6 +229,7 @@ } else { $end = $numMessages; } + if ($end > $numMessages) $end = $numMessages; while ($j < $end) { $date[$j] = ereg_replace(" ", " ", $date[$j]); $tmpdate = explode(" ", trim($date[$j])); @@ -234,7 +275,8 @@ /* Only ignore messages flagged as deleted if we are using a * trash folder or auto_expunge */ - if (($move_to_trash || $auto_expunge) && $sort != 6) + if (((isset($move_to_trash) && $move_to_trash) + || (isset($auto_expunge) && $auto_expunge)) && $sort != 6) { /** Find and remove the ones that are deleted */ $i = 0; @@ -251,6 +293,8 @@ } $numMessages = $i; } else { + if (! isset($messages)) + $messages = array(); $msgs = $messages; } } @@ -341,6 +385,8 @@ $More .= "". _("Next") ."\n"; } + if (! isset($msg)) + $msg = ""; mail_message_listing_beginning($imapConnection, "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage", $mailbox, $sort, $Message, $More, $startMessage); @@ -370,6 +416,7 @@ else $i = 1; reset($msort); + $k = 0; do { $key = key($msort); next($msort); diff --git a/functions/mime.php b/functions/mime.php index 4ed4435a..e1dd774d 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -4,6 +4,7 @@ ** This contains the functions necessary to detect and decode MIME ** messages. ** + ** $Id$ **/ $debug_mime = false; @@ -23,10 +24,11 @@ /** msg_header contains generic variables for values that **/ /** could be in a header. **/ - var $type0, $type1, $boundary, $charset, $encoding, $size; - var $to, $from, $date, $cc, $bcc, $reply_to, $subject; - var $id, $mailbox, $description; - var $entity_id, $message_id, $charset; + var $type0 = '', $type1 = '', $boundary = '', $charset = ''; + var $encoding = '', $size = 0, $to = '', $from = '', $date = ''; + var $cc = '', $bcc = '', $reply_to = '', $subject = ''; + var $id = 0, $mailbox = '', $description = ''; + var $entity_id = 0, $message_id = 0; } class message { @@ -58,14 +60,17 @@ $id = $header->id; fputs ($imap_stream, "a001 FETCH $id BODYSTRUCTURE\r\n"); + // + // This should use sqimap_read_data instead of reading it itself + // $read = fgets ($imap_stream, 10000); $response = substr($read, 0, 4); + $bodystructure = ""; while ($response != "a001") { $bodystructure .= $read; $read = fgets ($imap_stream, 10000); $response = substr($read, 0, 4); } - // $read = strtolower($bodystructure); $read = $bodystructure; if ($debug_mime) echo "$read

\n"; @@ -168,6 +173,7 @@ // loop through until we find the matching quote, and return that as a string $pos = 1; $char = substr($structure, $pos, 1); + $text = ""; while ($char != "\"" && $pos < strlen($structure)) { $text .= $char; $pos++; @@ -178,6 +184,8 @@ // comment me $end = mime_match_parenthesis (0, $structure); $sub = substr($structure, 1, $end-1); + if (! isset($properties)) + $properties = array(); $properties = mime_get_props($properties, $sub); $structure = substr($structure, strlen($sub) + 2); } else { @@ -288,6 +296,7 @@ if ($char == "\"") { $pos = 1; $char = substr($structure, $pos, 1); + $tmp = ""; while ($char != "\"" && $pos < strlen($structure)) { $tmp .= $char; $pos++; @@ -299,6 +308,7 @@ if ($char == "\"") { $pos = 1; $char = substr($structure, $pos, 1); + $value = ""; while ($char != "\"" && $pos < strlen($structure)) { $value .= $char; $pos++; @@ -312,6 +322,8 @@ } else if ($char == "(") { $end = mime_match_parenthesis (0, $structure); $sub = substr($structure, 1, $end-1); + if (! isset($props)) + $props = array(); $props = mime_get_props($props, $sub); $structure = substr($structure, strlen($sub) + 2); } @@ -423,7 +435,7 @@ /** This is the first function called. It decides if this is a multipart message or if it should be handled as a single entity **/ - function decodeMime ($imap_stream, $body, $header) { + function decodeMime ($imap_stream, $header) { global $username, $key, $imapServerAddress, $imapPort; return mime_structure ($imap_stream, $header); } @@ -464,7 +476,9 @@ if ($message->header->type0 == "text") { if ($message->header->type1 == "plain" || $message->header->type1 == "html") { - return $message->header->entity_id; + if (isset($message->header->entity_id)) + return $message->header->entity_id; + return 0; } } else { for ($i=0; $message->entities[$i]; $i++) { @@ -507,7 +521,7 @@ /** Display the ATTACHMENTS: message if there's more than one part **/ $body .= ""; - if ($message->entities) { + if (isset($message->entities)) { $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id); } } else { diff --git a/functions/page_header.php b/functions/page_header.php index 3aeae336..28852d5d 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -4,6 +4,7 @@ ** ** Prints the page header (duh) ** + ** $Id$ **/ session_start(); diff --git a/functions/plugin.php b/functions/plugin.php index e4727f85..35dc6776 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -12,6 +12,7 @@ ** ** Documentation on how to write plugins might show up some time. ** + ** $Id$ **/ @@ -31,7 +32,8 @@ function do_hook ($name) { global $squirrelmail_plugin_hooks; $Data = func_get_args(); - if (is_array($squirrelmail_plugin_hooks[$name])) { + if (isset($squirrelmail_plugin_hooks[$name]) && + is_array($squirrelmail_plugin_hooks[$name])) { foreach ($squirrelmail_plugin_hooks[$name] as $id => $function) { // Add something to set correct gettext domain for plugin if (function_exists($function)) { @@ -46,7 +48,7 @@ } // On startup, register all plugins configured for use - if (is_array($plugins)) + if (isset($plugins) && is_array($plugins)) foreach ($plugins as $id => $name) use_plugin($name); diff --git a/functions/prefs.php b/functions/prefs.php index a8c65124..dc459926 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -3,6 +3,8 @@ ** prefs.php ** ** This contains functions for manipulating user preferences + ** + ** $Id$ **/ $prefs_php = true; diff --git a/functions/smtp.php b/functions/smtp.php index dae83a2a..b2bfef6e 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -3,6 +3,8 @@ ** ** This contains all the functions needed to send messages through ** an smtp server or sendmail. + ** + ** $Id$ **/ $smtp_php = true; diff --git a/functions/strings.php b/functions/strings.php index 266214ae..9d514b29 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -290,6 +290,7 @@ // stored in a cookie. function OneTimePadEncrypt ($string, $epad) { $pad = base64_decode($epad); + $encrypted = ""; for ($i = 0; $i < strlen ($string); $i++) { $encrypted .= chr (ord($string[$i]) ^ ord($pad[$i])); } @@ -300,7 +301,7 @@ function OneTimePadDecrypt ($string, $epad) { $pad = base64_decode($epad); $encrypted = base64_decode ($string); - + $decrypted = ""; for ($i = 0; $i < strlen ($encrypted); $i++) { $decrypted .= chr (ord($encrypted[$i]) ^ ord($pad[$i])); } @@ -375,8 +376,12 @@ // getrusage if (function_exists("getrusage")) { $dat = getrusage(); - sq_mt_seed(md5($dat["ru_nswap"] . $dat["ru_majflt"] . - $dat["ru_utime.tv_sec"] . $dat["ru_utime.tv_usec"])); + $Str = ""; + foreach ($dat as $k => $v) + { + $Str .= "$k = $v\n"; + } + sq_mt_seed(md5($Str)); } // Apache-specific @@ -387,7 +392,8 @@ function OneTimePadCreate ($length=100) { sq_mt_randomize(); - + + $pad = ""; for ($i = 0; $i < $length; $i++) { $pad .= chr(mt_rand(0,255)); } diff --git a/functions/tree.php b/functions/tree.php index 83e2a933..933897f8 100644 --- a/functions/tree.php +++ b/functions/tree.php @@ -1,4 +1,7 @@ \n"; printf(" %s\n", _("Search for")); addr_insert_hidden(); + if (! isset($addrquery)) + $addrquery = ""; printf(" \n", htmlspecialchars($addrquery)); @@ -169,7 +173,7 @@ // Show personal addressbook if(!isset($addrquery) || !empty($listall)) { - if($backend != -1 || !isset($addrquery)) { + if((isset($backend) && $backend != -1) || !isset($addrquery)) { if(!isset($addrquery)) $backend = $abook->localbackend; diff --git a/src/addressbook.php b/src/addressbook.php index c1d584b7..f8a0e49a 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -7,18 +7,19 @@ ** ** Manage personal address book. ** + ** $Id$ **/ session_start(); + if (!isset($strings_php)) + include("../functions/strings.php"); if (!isset($config_php)) include("../config/config.php"); if (!isset($array_php)) include("../functions/array.php"); if (!isset($auth_php)) include("../functions/auth.php"); - if (!isset($strings_php)) - include("../functions/strings.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($display_messages_php)) @@ -47,28 +48,38 @@ printf("". "". " %s\n", - $color[4], $name, htmlspecialchars($values["nickname"]), + $color[4], $name, + (isset($values["nickname"]))? + htmlspecialchars($values["nickname"]):"", _("Must be unique")); printf("%s:", _("E-mail address")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["email"])); + $color[4], $name, + (isset($values["email"]))? + htmlspecialchars($values["email"]):""); printf("%s:", _("First name")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["firstname"])); + $color[4], $name, + (isset($values["firstname"]))? + htmlspecialchars($values["firstname"]):""); printf("%s:", _("Last name")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["lastname"])); + $color[4], $name, + (isset($values["lastname"]))? + htmlspecialchars($values["lastname"]):""); printf("%s:", _("Additional info")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["label"])); + $color[4], $name, + (isset($values["label"]))? + htmlspecialchars($values["label"]):""); printf("\n". "\n", diff --git a/src/compose.php b/src/compose.php index 4655e381..841d0c00 100644 --- a/src/compose.php +++ b/src/compose.php @@ -11,14 +11,16 @@ ** - Start new mail ** - Add an attachment ** - Send mail + ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($imap_php)) @@ -53,7 +55,7 @@ $id = $reply_id; - if ($id) { + if (isset($id)) { sqimap_mailbox_select($imapConnection, $mailbox); $message = sqimap_get_message($imapConnection, $id, $mailbox); $orig_header = $message->header; @@ -397,11 +399,14 @@ $mailbox = "INBOX"; if(isset($send)) { - if ($HTTP_POST_FILES['attachfile']['tmp_name'] && + if (isset($HTTP_POST_FILES['attachfile']) && + $HTTP_POST_FILES['attachfile']['tmp_name'] && $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') $AttachFailure = saveAttachedFiles(); - if (checkInput(false) && ! $AttachFailure) { + if (checkInput(false) && ! isset($AttachFailure)) { $urlMailbox = urlencode ($mailbox); + if (! isset($reply_id)) + $reply_id = 0; sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id); header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1"); } else { @@ -416,7 +421,7 @@ showInputForm(); //sqimap_logout($imapConnection); } - } else if ($html_addr_search_done) { + } else if (isset($html_addr_search_done)) { is_logged_in(); displayPageHeader($color, $mailbox); @@ -437,7 +442,7 @@ } showInputForm(); - } else if ($html_addr_search) { + } else if (isset($html_addr_search)) { // I am using an include so as to elminiate an extra unnecessary click. If you // can think of a better way, please implement it. include ("./addrbook_search_html.php"); @@ -457,7 +462,7 @@ } showInputForm(); - } else if ($smtpErrors) { + } else if (isset($smtpErrors)) { $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); displayPageHeader($color, $mailbox); @@ -473,7 +478,7 @@ $newmail = true; - if ($forward_id && $ent_num) getAttachments(0); + if (isset($forward_id) && isset($ent_num)) getAttachments(0); newMail(); showInputForm(); diff --git a/src/delete_message.php b/src/delete_message.php index 4be7772f..966578e0 100644 --- a/src/delete_message.php +++ b/src/delete_message.php @@ -6,15 +6,16 @@ ** Licensed under the GNU GPL. For full terms see the file COPYING. ** ** Deletes a meesage from the IMAP server - ** + ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($display_message_php)) diff --git a/src/download.php b/src/download.php index 03505fb3..d24b9048 100644 --- a/src/download.php +++ b/src/download.php @@ -7,6 +7,8 @@ ** ** Handles attachment downloads to the users computer. ** Also allows displaying of attachments when possible. + ** + ** $Id$ **/ if (!isset($config_php)) diff --git a/src/empty_trash.php b/src/empty_trash.php index 2cec2dec..42023fe0 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -7,6 +7,8 @@ ** ** Handles deleting messages from the trash folder without ** deleting subfolders. + ** + ** $Id$ **/ session_start(); diff --git a/src/folders.php b/src/folders.php index 9699514d..69898a58 100644 --- a/src/folders.php +++ b/src/folders.php @@ -8,14 +8,16 @@ ** Handles all interaction between the user and the other folder ** scripts which do most of the work. Also handles the Special ** Folders. + ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($imap_php)) @@ -36,7 +38,9 @@ echo "
\n"; echo "\n"; - if ($success || $sent_create == "true" || $trash_create == "true") { + if ((isset($success) && $success) || + (isset($sent_create) && $sent_create == "true") || + (isset($trash_create) && $trash_create == "true")) { echo "\n"; echo "
\n"; if ($success == "subscribe") { diff --git a/src/folders_create.php b/src/folders_create.php index 96db1f15..3bbe0e66 100644 --- a/src/folders_create.php +++ b/src/folders_create.php @@ -7,6 +7,8 @@ ** ** Creates folders on the IMAP server. ** Called from folders.php + ** + ** $Id$ **/ session_start(); diff --git a/src/folders_delete.php b/src/folders_delete.php index d13b2d73..a05780ce 100644 --- a/src/folders_delete.php +++ b/src/folders_delete.php @@ -7,6 +7,8 @@ ** ** Deltes folders from the IMAP server. ** Called from the folders.php + ** + ** $Id$ **/ session_start(); diff --git a/src/folders_rename_do.php b/src/folders_rename_do.php index 78c2a112..9a355738 100644 --- a/src/folders_rename_do.php +++ b/src/folders_rename_do.php @@ -7,6 +7,8 @@ ** ** Does the actual renaming of files on the IMAP server. ** Called from the folders.php + ** + ** $Id$ **/ session_start(); diff --git a/src/folders_rename_getname.php b/src/folders_rename_getname.php index a1389550..e92f653e 100644 --- a/src/folders_rename_getname.php +++ b/src/folders_rename_getname.php @@ -7,6 +7,8 @@ ** ** Gets folder names and enables renaming ** Called from folders.php + ** + ** $Id$ **/ session_start(); diff --git a/src/folders_subscribe.php b/src/folders_subscribe.php index ef8c9847..a8993933 100644 --- a/src/folders_subscribe.php +++ b/src/folders_subscribe.php @@ -7,6 +7,8 @@ ** ** Subscribe and unsubcribe form folders. ** Called from folders.php + ** + ** $Id$ **/ session_start(); diff --git a/src/help.php b/src/help.php index 82af1cc4..09fcb1ad 100644 --- a/src/help.php +++ b/src/help.php @@ -7,6 +7,7 @@ ** ** Displays help for the user ** + ** $Id$ **/ session_start(); diff --git a/src/left_main.php b/src/left_main.php index 6a0825eb..718c0ffa 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -7,6 +7,7 @@ ** This is the code for the left bar. The left bar shows the folders ** available, and has cookie information. ** + ** $Id$ **/ session_start(); @@ -24,12 +25,12 @@ } + if (!isset($strings_php)) + include("../functions/strings.php"); if (!isset($config_php)) include("../config/config.php"); if (!isset($array_php)) include("../functions/array.php"); - if (!isset($strings_php)) - include("../functions/strings.php"); if (!isset($imap_php)) include("../functions/imap.php"); if (!isset($page_header_php)) @@ -76,7 +77,7 @@ } } - $line .= ""; + $line = ""; if ($unseen > 0) $line .= ""; @@ -99,7 +100,7 @@ if ($unseen > 0) $line .= ""; - if ($unseen_found) { + if (isset($unseen_found) && $unseen_found) { $line .= " $unseen_string"; } @@ -148,6 +149,8 @@ $line .= replace_spaces($mailbox); $line .= ""; } else { + if (! isset($boxes[$i]["unseen"])) + $boxes[$i]["unseen"] = 0; $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]); } } else { diff --git a/src/load_prefs.php b/src/load_prefs.php index 2e7f80e4..01452b1a 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -8,6 +8,7 @@ ** Loads preferences from the $username.pref file used by almost ** every other script in the source directory and alswhere. ** + ** $Id$ **/ if (!isset($config_php)) @@ -59,7 +60,7 @@ } } - if (!$download_php) session_register("theme_css"); + if (!isset($download_php)) session_register("theme_css"); $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book"); if ($use_javascript_addr_book == "") diff --git a/src/move_messages.php b/src/move_messages.php index cd1056e4..d23bf5f9 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -6,14 +6,16 @@ ** Licensed under the GNU GPL. For full terms see the file COPYING. ** ** Enables message moving between folders on the IMAP server. + ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($display_messages_php)) @@ -50,7 +52,7 @@ sqimap_mailbox_select($imapConnection, $mailbox); // expunge-on-demand if user isn't using move_to_trash or auto_expunge - if($expungeButton) { + if(isset($expungeButton)) { sqimap_mailbox_expunge($imapConnection, $mailbox, true); $location = get_location(); if ($where && $what) @@ -59,7 +61,7 @@ header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); } // undelete messages if user isn't using move_to_trash or auto_expunge - elseif($undeleteButton) { + elseif(isset($undeleteButton)) { if (is_array($msg) == 1) { // Removes \Deleted flag from selected messages $j = 0; @@ -86,7 +88,7 @@ } } // If the delete button was pressed, the moveButton variable will not be set. - elseif (!$moveButton) { + elseif (!isset($moveButton)) { if (is_array($msg) == 1) { // Marks the selected messages ad 'Deleted' $j = 0; diff --git a/src/options.php b/src/options.php index 7c684247..8b38ad2b 100644 --- a/src/options.php +++ b/src/options.php @@ -8,14 +8,15 @@ ** Displays the options page. Pulls from proper user preference files ** and config.php. Displays preferences as selected and other options. ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($display_messages_php)) @@ -46,7 +47,7 @@
"._("Successfully saved personal information!")."

"; - } else if ($submit_display) { + } else if (isset($submit_display)) { # Save display preferences setPref($data_dir, $username, "chosen_theme", $chosentheme); setPref($data_dir, $username, "show_num", $shownum); @@ -74,7 +75,7 @@ echo "
"._("Successfully saved display preferences!")."
"; echo "" . _("Refresh Page") . "

"; - } else if ($submit_folder) { + } else if (isset($submit_folder)) { # Save folder preferences if ($trash != "none") { setPref($data_dir, $username, "move_to_trash", true); diff --git a/src/options_display.php b/src/options_display.php index d8ef0eb5..d98b30e8 100644 --- a/src/options_display.php +++ b/src/options_display.php @@ -7,6 +7,7 @@ ** ** Displays all optinos about display preferences ** + ** $Id$ **/ session_start(); diff --git a/src/options_folder.php b/src/options_folder.php index bacd3eff..10da1f0e 100644 --- a/src/options_folder.php +++ b/src/options_folder.php @@ -7,6 +7,7 @@ ** ** Displays all options relating to folders ** + ** $Id$ **/ session_start(); diff --git a/src/options_highlight.php b/src/options_highlight.php index 490d24b2..6e64eaa0 100644 --- a/src/options_highlight.php +++ b/src/options_highlight.php @@ -7,6 +7,7 @@ ** ** Displays message highlighting options ** + ** $Id$ **/ session_start(); diff --git a/src/options_order.php b/src/options_order.php index 8088d798..f253b456 100644 --- a/src/options_order.php +++ b/src/options_order.php @@ -7,6 +7,7 @@ ** ** Displays message highlighting options ** + ** $Id$ **/ session_start(); diff --git a/src/options_personal.php b/src/options_personal.php index df5adea1..7db053d0 100644 --- a/src/options_personal.php +++ b/src/options_personal.php @@ -7,14 +7,15 @@ ** ** Displays all options relating to personal information ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($display_messages_php)) diff --git a/src/read_body.php b/src/read_body.php index 609635c5..d3302e3b 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -7,14 +7,16 @@ ** ** This file is used for reading the msgs array and displaying ** the resulting emails in the right frame. + ** + ** $Id$ **/ session_start(); - if (!isset($config_php)) - include("../config/config.php"); if (!isset($strings_php)) include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($imap_php)) @@ -32,7 +34,7 @@ do_hook("html_top"); displayPageHeader($color, $mailbox); - if ($view_hdr) { + if (isset($view_hdr)) { fputs ($imapConnection, "a003 FETCH $passed_id BODY[HEADER]\r\n"); $read = sqimap_read_data ($imapConnection, "a003", true, $a, $b); diff --git a/src/redirect.php b/src/redirect.php index 8a500d65..b99ad2e0 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -10,6 +10,7 @@ ** prevents users from reposting their form data after a ** successful logout ** + ** $Id$ **/ if (!isset($strings_php)) diff --git a/src/right_main.php b/src/right_main.php index 6f4d2149..11d09a53 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -8,6 +8,7 @@ ** This is where the mailboxes are listed. This controls most of what ** goes on in SquirrelMail. ** + ** $Id$ **/ if (!isset($i18n_php)) @@ -27,12 +28,12 @@ exit; } + if (!isset($strings_php)) + include("../functions/strings.php"); if (!isset($config_php)) include("../config/config.php"); if (!isset($imap_php)) include("../functions/imap.php"); - if (!isset($strings_php)) - include("../functions/strings.php"); if (!isset($date_php)) include("../functions/date.php"); if (!isset($page_header_php)) @@ -89,7 +90,8 @@ do_hook("right_main_after_header"); - if ($just_logged_in == 1 && strlen(trim($motd)) > 0) { + if (isset($just_logged_in) && $just_logged_in == 1 && + strlen(trim($motd)) > 0) { echo "

\n"; echo "
\n"; echo "\n"; echo "
\n"; @@ -107,6 +109,8 @@ // Check to see if we can use cache or not. Currently the only time when you wont use it is // when a link on the left hand frame is used. Also check to make sure we actually have the // array in the registered session data. :) + if (! isset($use_mailbox_cache)) + $use_mailbox_cache = 0; if ($use_mailbox_cache && session_is_registered("msgs")) { showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); } else { diff --git a/src/search.php b/src/search.php index 570c5c7c..3bdcbdbe 100644 --- a/src/search.php +++ b/src/search.php @@ -1,4 +1,7 @@ "; echo " \n"; + if (!isset($what)) + $what = ""; $what_disp = ereg_replace(",", " ", $what); $what_disp = str_replace("\\\\", "\\", $what_disp); $what_disp = str_replace("\\\"", "\"", $what_disp); @@ -103,7 +108,7 @@ echo ""; echo "
"; do_hook("search_after_form"); - if ($where && $what) { + if (isset($where) && $where && isset($what) && $what) { sqimap_mailbox_select($imapConnection, $mailbox); sqimap_search($imapConnection, $where, $what, $mailbox, $color); } diff --git a/src/signout.php b/src/signout.php index ebf2fa6e..c3f1f8bc 100644 --- a/src/signout.php +++ b/src/signout.php @@ -1,6 +1,4 @@