From 355861846a51d35efe50848869d680fd3b4a5316 Mon Sep 17 00:00:00 2001 From: thomppj Date: Sun, 2 Dec 2001 09:33:02 +0000 Subject: [PATCH] Code cleanup brigage... git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1825 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/abook_database.php | 76 +++++++++++++++++------------ functions/abook_global_file.php | 60 ++++++++++++++--------- functions/abook_ldap_server.php | 72 ++++++++++++++++----------- functions/abook_local_file.php | 60 ++++++++++++++--------- functions/addressbook.php | 77 +++++++++++++++++------------ functions/array.php | 39 ++++++++++----- functions/attachment_common.php | 42 +++++++++++----- functions/auth.php | 40 ++++++++++----- functions/constants.php | 52 +++++++++++++------- functions/date.php | 50 ++++++++++++------- functions/db_prefs.php | 86 +++++++++++++++++++-------------- functions/display_messages.php | 43 +++++++++++------ functions/gettext.php | 50 ++++++++++++------- functions/i18n.php | 52 +++++++++++++------- functions/imap.php | 34 ++++++------- functions/imap_general.php | 54 +++++++++++++-------- functions/imap_mailbox.php | 46 ++++++++++++------ functions/imap_messages.php | 46 ++++++++++++------ functions/imap_search.php | 51 ++++++++++++------- functions/index.php | 32 ++++++------ functions/mailbox_display.php | 46 ++++++++++++------ functions/mime.php | 71 ++++++++++++++++----------- functions/options.php | 20 ++++---- functions/page_header.php | 46 ++++++++++++------ functions/plugin.php | 49 ++++++++++++------- functions/prefs.php | 50 ++++++++++++------- functions/smtp.php | 48 ++++++++++++------ functions/strings.php | 50 ++++++++++++------- functions/tree.php | 52 ++++++++++++-------- functions/url_parser.php | 48 ++++++++++++------ index.php | 31 ++++++------ src/addrbook_popup.php | 53 ++++++++++---------- src/addrbook_search.php | 50 ++++++++++++------- src/addrbook_search_html.php | 62 +++++++++++++++--------- src/addressbook.php | 48 ++++++++++++------ src/compose.php | 64 +++++++++++++++--------- src/delete_message.php | 44 +++++++++++------ src/download.php | 54 +++++++++++++-------- src/draft_actions.php | 37 +++++++++----- src/empty_trash.php | 50 ++++++++++++------- src/folders.php | 52 +++++++++++++------- src/folders_create.php | 46 ++++++++++++------ src/folders_delete.php | 46 ++++++++++++------ src/folders_rename_do.php | 42 +++++++++++----- src/folders_rename_getname.php | 42 +++++++++++----- src/folders_subscribe.php | 44 +++++++++++------ src/help.php | 48 ++++++++++++------ src/image.php | 45 +++++++++++------ src/index.php | 26 +++++----- src/left_main.php | 52 +++++++++++++------- src/load_prefs.php | 48 ++++++++++-------- src/login.php | 44 +++++++++++------ src/move_messages.php | 42 +++++++++++----- src/options.php | 24 ++++----- src/options_display.php | 20 ++++---- src/options_folder.php | 20 ++++---- src/options_identities.php | 44 +++++++++++------ src/options_order.php | 50 ++++++++++++------- src/options_personal.php | 20 ++++---- src/printer_friendly_bottom.php | 57 ++++++++++++++-------- src/printer_friendly_main.php | 36 ++++++++++---- src/printer_friendly_top.php | 50 ++++++++++++------- src/read_body.php | 50 ++++++++++++------- src/redirect.php | 54 +++++++++++++-------- src/retrievalerror.php | 54 +++++++++++++-------- src/search.php | 41 +++++++++++----- src/signout.php | 43 +++++++++++------ src/validate.php | 41 ++++++++++------ src/vcard.php | 46 ++++++++++++------ 69 files changed, 2092 insertions(+), 1170 deletions(-) diff --git a/functions/abook_database.php b/functions/abook_database.php index b5b2e001..f7162fac 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -1,36 +1,52 @@ database DNS (see PEAR for syntax) - * table => table to store addresses in (must exist) - * owner => current user (owner of address data) - * ? writeable => set writeable flag (true/false) - * - * The table used should have the following columns: - * owner, nickname, firstname, lastname, email, label - * The pair (owner,nickname) should be unique (primary key). - * - * NOTE. This class should not be used directly. Use the - * "AddressBook" class instead. - * - * $Id$ - */ +/** + * 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. + * + * IMPORTANT: The PEAR modules must be in the include path + * for this class to work. + * + * An array with the following elements must be passed to + * the class constructor (elements marked ? are optional): + * + * dsn => database DNS (see PEAR for syntax) + * table => table to store addresses in (must exist) + * owner => current user (owner of address data) + * ? writeable => set writeable flag (true/false) + * + * The table used should have the following columns: + * owner, nickname, firstname, lastname, email, label + * The pair (owner,nickname) should be unique (primary key). + * + * NOTE. This class should not be used directly. Use the + * "AddressBook" class instead. + * + * $Id$ + */ - require_once('DB.php'); +/*****************************************************************/ +/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ +/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ +/*** + Base level indent should begin at left margin, as ***/ +/*** the require_once below looks. ***/ +/*** + All identation should consist of four space blocks ***/ +/*** + Tab characters are evil. ***/ +/*** + all comments should use "slash-star ... star-slash" ***/ +/*** style -- no pound characters, no slash-slash style ***/ +/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ +/*** ALWAYS USE { AND } CHARACTERS!!! ***/ +/*** + Please use ' instead of ", when possible. Note " ***/ +/*** should always be used in _( ) function calls. ***/ +/*** Thank you for your help making the SM code more readable. ***/ +/*****************************************************************/ + +require_once('DB.php'); class abook_database extends addressbook_backend { var $btype = 'local'; diff --git a/functions/abook_global_file.php b/functions/abook_global_file.php index f1805425..b90f58d3 100644 --- a/functions/abook_global_file.php +++ b/functions/abook_global_file.php @@ -1,27 +1,43 @@ 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 { +/** + * 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$ + */ + +/*****************************************************************/ +/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ +/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ +/*** + Base level indent should begin at left margin, as ***/ +/*** the first line of the class definition below. ***/ +/*** + All identation should consist of four space blocks ***/ +/*** + Tab characters are evil. ***/ +/*** + all comments should use "slash-star ... star-slash" ***/ +/*** style -- no pound characters, no slash-slash style ***/ +/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ +/*** ALWAYS USE { AND } CHARACTERS!!! ***/ +/*** + Please use ' instead of ", when possible. Note " ***/ +/*** should always be used in _( ) function calls. ***/ +/*** Thank you for your help making the SM code more readable. ***/ +/*****************************************************************/ + +class abook_ldap_server extends addressbook_backend { var $btype = 'remote'; var $bname = 'ldap_server'; diff --git a/functions/abook_local_file.php b/functions/abook_local_file.php index 5dd93948..7863fa7c 100644 --- a/functions/abook_local_file.php +++ b/functions/abook_local_file.php @@ -1,27 +1,43 @@ 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 { +/** + * 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$ + */ + +/*****************************************************************/ +/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ +/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ +/*** + Base level indent should begin at left margin, as ***/ +/*** the first line of the class definition below. ***/ +/*** + All identation should consist of four space blocks ***/ +/*** + Tab characters are evil. ***/ +/*** + all comments should use "slash-star ... star-slash" ***/ +/*** style -- no pound characters, no slash-slash style ***/ +/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ +/*** ALWAYS USE { AND } CHARACTERS!!! ***/ +/*** + Please use ' instead of ", when possible. Note " ***/ +/*** should always be used in _( ) function calls. ***/ +/*** Thank you for your help making the SM code more readable. ***/ +/*****************************************************************/ + +class abook_local_file extends addressbook_backend { var $btype = 'local'; var $bname = 'local_file'; diff --git a/functions/addressbook.php b/functions/addressbook.php index a2991d43..6a45f348 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -1,37 +1,50 @@ in main directory) - // - // If you don't want a global site-wide addressbook, comment these - // two lines out. (They are disabled by default.) - // - // The global addressbook is unmodifiable by anyone. You must actually - // use a shell script or whatnot to modify the contents. - // - //global $data_dir; - //$address_book_global_filename = "$data_dir/global.abook"; - - - - // Include backends here. - require_once('../functions/abook_local_file.php'); - require_once('../functions/abook_ldap_server.php'); +/** + * addressbook.php + * + * Copyright (c) 1999-2001 The Squirrelmail Development Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Functions and classes for the addressbook system. + * + * $Id$ + */ + +/*****************************************************************/ +/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ +/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ +/*** + Base level indent should begin at left margin, as ***/ +/*** the require_once below looks. ***/ +/*** + All identation should consist of four space blocks ***/ +/*** + Tab characters are evil. ***/ +/*** + all comments should use "slash-star ... star-slash" ***/ +/*** style -- no pound characters, no slash-slash style ***/ +/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ +/*** ALWAYS USE { AND } CHARACTERS!!! ***/ +/*** + Please use ' instead of ", when possible. Note " ***/ +/*** should always be used in _( ) function calls. ***/ +/*** Thank you for your help making the SM code more readable. ***/ +/*****************************************************************/ + +// This is the path to the global site-wide addressbook. +// It looks and feels just like a user's .abook file +// If this is in the data directory, use "$data_dir/global.abook" +// If not, specify the path as though it was accessed from the +// src/ directory ("../global.abook" -> in main directory) +// +// If you don't want a global site-wide addressbook, comment these +// two lines out. (They are disabled by default.) +// +// The global addressbook is unmodifiable by anyone. You must actually +// use a shell script or whatnot to modify the contents. +// +//global $data_dir; +//$address_book_global_filename = "$data_dir/global.abook"; + +// Include backends here. +require_once('../functions/abook_local_file.php'); +require_once('../functions/abook_ldap_server.php'); // Use this if you wanna have a global address book if (isset($address_book_global_filename)) diff --git a/functions/array.php b/functions/array.php index f65b8f86..2ff83b41 100644 --- a/functions/array.php +++ b/functions/array.php @@ -1,19 +1,34 @@ col and $this->dir in a class // Would beat using globals diff --git a/functions/attachment_common.php b/functions/attachment_common.php index b6b1dbf6..019af14b 100644 --- a/functions/attachment_common.php +++ b/functions/attachment_common.php @@ -1,18 +1,34 @@ 'image/x-bitmap', diff --git a/functions/auth.php b/functions/auth.php index 47e6c04c..61fe9cf1 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -1,17 +1,33 @@ 29 Jun 1999 09:52:11 -0500 (EDT) - * (as specified in RFC 822) -- 'Tue' is optional - * - * $Id$ - */ - - // corrects a time stamp to be the local time - function getGMTSeconds($stamp, $gmt) { +/** + * date.php + * + * Copyright (c) 1999-2001 The SquirrelMail Development Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Takes a date and parses it into a usable format. The form that a + * date SHOULD arrive in is: + * 29 Jun 1999 09:52:11 -0500 (EDT) + * (as specified in RFC 822) -- 'Tue' is optional + * + * $Id$ + */ + +/*****************************************************************/ +/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ +/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ +/*** + Base level indent should begin at left margin, as ***/ +/*** the first line of the function definition below. ***/ +/*** + All identation should consist of four space blocks ***/ +/*** + Tab characters are evil. ***/ +/*** + all comments should use "slash-star ... star-slash" ***/ +/*** style -- no pound characters, no slash-slash style ***/ +/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ +/*** ALWAYS USE { AND } CHARACTERS!!! ***/ +/*** + Please use ' instead of ", when possible. Note " ***/ +/*** should always be used in _( ) function calls. ***/ +/*** Thank you for your help making the SM code more readable. ***/ +/*****************************************************************/ + +// corrects a time stamp to be the local time +function getGMTSeconds($stamp, $gmt) { global $invert_time; if (($gmt == 'Pacific') || ($gmt == 'PST')) $gmt = '-0800'; @@ -252,4 +268,4 @@ return ($mtime); } */ -?> \ No newline at end of file +?> diff --git a/functions/db_prefs.php b/functions/db_prefs.php index 5243649f..442e9d26 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -1,39 +1,55 @@ '. +function error_username_password_incorrect($color) { + echo '
'. "". ''. "'; echo '
". @@ -91,4 +106,4 @@ echo '
'; } -?> \ No newline at end of file +?> diff --git a/functions/gettext.php b/functions/gettext.php index 6d18d8e5..2bbf221d 100644 --- a/functions/gettext.php +++ b/functions/gettext.php @@ -1,23 +1,39 @@ \ No newline at end of file +?> diff --git a/functions/imap.php b/functions/imap.php index 7930cf6e..6f0b54da 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -1,22 +1,22 @@ \ No newline at end of file +?> diff --git a/functions/imap_general.php b/functions/imap_general.php index 617c2937..49095439 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -1,24 +1,40 @@ \ No newline at end of file +?> diff --git a/functions/index.php b/functions/index.php index 28bb0695..bc641e5f 100644 --- a/functions/index.php +++ b/functions/index.php @@ -1,21 +1,21 @@ \ No newline at end of file +?> diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 8d1e5be3..20c740c1 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1,20 +1,36 @@ "; } -?> \ No newline at end of file +?> diff --git a/functions/plugin.php b/functions/plugin.php index 59e8d2e9..df8d3709 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -1,21 +1,36 @@ \ No newline at end of file +?> diff --git a/functions/prefs.php b/functions/prefs.php index 8b069242..4430a191 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -1,21 +1,37 @@ \ No newline at end of file +?> diff --git a/functions/smtp.php b/functions/smtp.php index 78b983cd..4ef0c611 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -1,21 +1,37 @@ \ No newline at end of file +$location = get_location(); +header("Location: $location/src/login.php\n\n"); +exit(); + +?> diff --git a/src/addrbook_popup.php b/src/addrbook_popup.php index 4c82a648..b5e3ed41 100644 --- a/src/addrbook_popup.php +++ b/src/addrbook_popup.php @@ -1,34 +1,35 @@ - -<?php - echo "$org_title: " . _("Address Book"); -?> - - - - - - - - \ No newline at end of file + + <?php echo "$org_title: " . _("Address Book"); ?> + + + + + + diff --git a/src/addrbook_search.php b/src/addrbook_search.php index f9ae4ab8..f347abac 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -1,21 +1,37 @@ \n"; -?> \ No newline at end of file +?> diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index 6aa64625..c7062491 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -1,28 +1,44 @@ - \ No newline at end of file + diff --git a/src/compose.php b/src/compose.php index 5dc425d6..fef3d070 100644 --- a/src/compose.php +++ b/src/compose.php @@ -1,29 +1,45 @@ \ No newline at end of file +?> diff --git a/src/download.php b/src/download.php index dd0b65aa..f0a31f58 100644 --- a/src/download.php +++ b/src/download.php @@ -1,23 +1,39 @@ \ No newline at end of file +?> diff --git a/src/draft_actions.php b/src/draft_actions.php index 7512e15d..e20e3f03 100644 --- a/src/draft_actions.php +++ b/src/draft_actions.php @@ -1,16 +1,31 @@ - \ No newline at end of file + diff --git a/src/folders_create.php b/src/folders_create.php index ce8d9643..9af11417 100644 --- a/src/folders_create.php +++ b/src/folders_create.php @@ -1,20 +1,36 @@   - \ No newline at end of file + diff --git a/src/image.php b/src/image.php index 11093805..7aa89caf 100644 --- a/src/image.php +++ b/src/image.php @@ -1,21 +1,36 @@ diff --git a/src/left_main.php b/src/left_main.php index 3416c314..ba36ec71 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -1,22 +1,38 @@ \n"; -?> \ No newline at end of file +?> diff --git a/src/load_prefs.php b/src/load_prefs.php index 4c4f1003..0e411c2b 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -1,24 +1,34 @@ \n"; } -?> \ No newline at end of file +?> diff --git a/src/options_display.php b/src/options_display.php index 2e03483e..c4da9aa2 100644 --- a/src/options_display.php +++ b/src/options_display.php @@ -1,15 +1,15 @@ '. ' '; } -?> \ No newline at end of file +?> diff --git a/src/options_order.php b/src/options_order.php index 5af14210..042048a7 100644 --- a/src/options_order.php +++ b/src/options_order.php @@ -1,21 +1,37 @@ - \ No newline at end of file + diff --git a/src/options_personal.php b/src/options_personal.php index 9bfdd5e0..988ccb2c 100644 --- a/src/options_personal.php +++ b/src/options_personal.php @@ -1,15 +1,15 @@ \n". @@ -41,4 +57,4 @@ ''. "\n"; -?> \ No newline at end of file +?> diff --git a/src/read_body.php b/src/read_body.php index d44373ae..6e02591c 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -1,22 +1,38 @@ - ** - ** Copyright (c) 1999-2001 The Squirrelmail Development Team - ** Licensed under the GNU GPL. For full terms see the file COPYING. - ** - ** Prevents users from reposting their form data after a successful logout. - ** - ** $Id$ - **/ - - require_once('../functions/i18n.php'); - require_once('../functions/strings.php'); - require_once('../config/config.php'); - require_once('../functions/prefs.php'); - require_once('../functions/imap.php'); - require_once('../functions/plugin.php'); - require_once('../functions/constants.php'); +/** + * redirect.php + * Derived from webmail.php by Ralf Kraudelt + * + * Copyright (c) 1999-2001 The Squirrelmail Development Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Prevents users from reposting their form data after a successful logout. + * + * $Id$ + */ + +/*****************************************************************/ +/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ +/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ +/*** + Base level indent should begin at left margin, as ***/ +/*** the require_once below looks. ***/ +/*** + All identation should consist of four space blocks ***/ +/*** + Tab characters are evil. ***/ +/*** + all comments should use "slash-star ... star-slash" ***/ +/*** style -- no pound characters, no slash-slash style ***/ +/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ +/*** ALWAYS USE { AND } CHARACTERS!!! ***/ +/*** + Please use ' instead of ", when possible. Note " ***/ +/*** should always be used in _( ) function calls. ***/ +/*** Thank you for your help making the SM code more readable. ***/ +/*****************************************************************/ + +require_once('../functions/i18n.php'); +require_once('../functions/strings.php'); +require_once('../config/config.php'); +require_once('../functions/prefs.php'); +require_once('../functions/imap.php'); +require_once('../functions/plugin.php'); +require_once('../functions/constants.php'); function attachment_common_parse($str, $debug) { global $attachment_common_types, $attachment_common_types_parsed; diff --git a/src/retrievalerror.php b/src/retrievalerror.php index bd1fb1df..d2623abd 100644 --- a/src/retrievalerror.php +++ b/src/retrievalerror.php @@ -1,24 +1,40 @@ - \ No newline at end of file + diff --git a/src/signout.php b/src/signout.php index c0f90204..ed82aeb2 100644 --- a/src/signout.php +++ b/src/signout.php @@ -1,20 +1,35 @@