From f435778e5dabea883d6394d5ab43ae72d51dfd50 Mon Sep 17 00:00:00 2001 From: fidian Date: Thu, 19 Apr 2001 17:58:10 +0000 Subject: [PATCH] * Got bored and copied all the validate.php and define() stuff to 1.1 * Cleaned up some code * Fixed some typos * Added a few files (documentation, translations) * EAGERLY awaiting 1.1 to come out * Made all global stuff "global $varname" so the new define() method we use will work properly (methinks) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1257 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 3 + config/config_default.php | 6 + functions/abook_database.php | 2 +- functions/addressbook.php | 4 +- functions/array.php | 5 +- functions/auth.php | 22 +- functions/date.php | 8 +- functions/db_prefs.php | 5 +- functions/display_messages.php | 4 +- functions/i18n.php | 776 +++++++++++++++++---------------- functions/imap.php | 4 +- functions/imap_general.php | 28 +- functions/imap_mailbox.php | 12 +- functions/imap_messages.php | 4 +- functions/imap_search.php | 31 +- functions/mailbox_display.php | 6 +- functions/mime.php | 18 +- functions/page_header.php | 16 +- functions/plugin.php | 6 +- functions/prefs.php | 7 +- functions/smtp.php | 15 +- functions/strings.php | 99 +---- functions/tree.php | 12 +- functions/url_parser.php | 7 +- 24 files changed, 534 insertions(+), 566 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index ab645573..1c03facb 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -1547,6 +1547,9 @@ sub save_data { print FILE "\n\n"; - exit; - } else { - return true; - } + if (session_is_registered('user_is_logged_in')) + return; + + echo "\n"; + echo "

"; + echo "
"; + echo ""._("You must be logged in to access this page.")."
"; + echo ""._("Go to the login page")."\n"; + echo "
"; + echo "\n"; + exit; } ?> diff --git a/functions/date.php b/functions/date.php index 1b281153..59a10dca 100644 --- a/functions/date.php +++ b/functions/date.php @@ -10,8 +10,10 @@ ** $Id$ **/ - $date_php = true; - + if (defined ('date_php')) + return; + define ('date_php', true); + // corrects a time stamp to be the local time function getGMTSeconds($stamp, $gmt) { global $invert_time; @@ -37,6 +39,8 @@ $gmt = '+0200'; else if ($gmt == 'JST') $gmt = '+0900'; + else if ($gmt == 'KST') + $gmt = "+0900"; else if ($gmt == 'MET') $gmt = '+0100'; else if ($gmt == 'MET DST' || $gmt == 'METDST') diff --git a/functions/db_prefs.php b/functions/db_prefs.php index b15747a5..3d478cf3 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -28,7 +28,10 @@ ** $Id$ **/ - $prefs_php = true; + if (defined('prefs_php')) + return; + define('prefs_php', true); + require_once('DB.php'); class dbPrefs { diff --git a/functions/display_messages.php b/functions/display_messages.php index 54e9b243..89305b72 100644 --- a/functions/display_messages.php +++ b/functions/display_messages.php @@ -8,7 +8,9 @@ ** $Id$ **/ - $display_messages_php = true; + if (defined ('display_messages_php')) + return; + define ('display_messages_php', true); function error_username_password_incorrect($color) { echo '
'; diff --git a/functions/i18n.php b/functions/i18n.php index b3e54477..3aec6c9c 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -12,7 +12,11 @@ ** $Id$ **/ - $i18n_php = true; + if (defined ('i18n_php')) + return; + define ('i18n_php', true); + + global $squirrelmail_language, $languages; if (! isset($squirrelmail_language)) { $squirrelmail_language = ''; } // This array specifies the available languages. @@ -260,205 +264,206 @@ function charset_decode_iso_8859_2 ($string) { global $default_charset; - if (strtolower($default_charset) == 'iso-8859-2') { + if (strtolower($default_charset) == 'iso-8859-2') return $string; - } else { - // Only do the slow convert if there are 8-bit characters - if (ereg("[\200-\377]", $string)) { - // NO-BREAK SPACE - $string = str_replace("\240", ' ', $string); - // LATIN CAPITAL LETTER A WITH OGONEK - $string = str_replace("\241", 'Ą', $string); - // BREVE - $string = str_replace("\242", '˘', $string); - // LATIN CAPITAL LETTER L WITH STROKE - $string = str_replace("\243", 'Ł', $string); - // CURRENCY SIGN - $string = str_replace("\244", '¤', $string); - // LATIN CAPITAL LETTER L WITH CARON - $string = str_replace("\245", 'Ľ', $string); - // LATIN CAPITAL LETTER S WITH ACUTE - $string = str_replace("\246", 'Ś', $string); - // SECTION SIGN - $string = str_replace("\247", '§', $string); - // DIAERESIS - $string = str_replace("\250", '¨', $string); - // LATIN CAPITAL LETTER S WITH CARON - $string = str_replace("\251", 'Š', $string); - // LATIN CAPITAL LETTER S WITH CEDILLA - $string = str_replace("\252", 'Ş', $string); - // LATIN CAPITAL LETTER T WITH CARON - $string = str_replace("\253", 'Ť', $string); - // LATIN CAPITAL LETTER Z WITH ACUTE - $string = str_replace("\254", 'Ź', $string); - // SOFT HYPHEN - $string = str_replace("\255", '­', $string); - // LATIN CAPITAL LETTER Z WITH CARON - $string = str_replace("\256", 'Ž', $string); - // LATIN CAPITAL LETTER Z WITH DOT ABOVE - $string = str_replace("\257", 'Ż', $string); - // DEGREE SIGN - $string = str_replace("\260", '°', $string); - // LATIN SMALL LETTER A WITH OGONEK - $string = str_replace("\261", 'ą', $string); - // OGONEK - $string = str_replace("\262", '˛', $string); - // LATIN SMALL LETTER L WITH STROKE - $string = str_replace("\263", 'ł', $string); - // ACUTE ACCENT - $string = str_replace("\264", '´', $string); - // LATIN SMALL LETTER L WITH CARON - $string = str_replace("\265", 'ľ', $string); - // LATIN SMALL LETTER S WITH ACUTE - $string = str_replace("\266", 'ś', $string); - // CARON - $string = str_replace("\267", 'ˇ', $string); - // CEDILLA - $string = str_replace("\270", '¸', $string); - // LATIN SMALL LETTER S WITH CARON - $string = str_replace("\271", 'š', $string); - // LATIN SMALL LETTER S WITH CEDILLA - $string = str_replace("\272", 'ş', $string); - // LATIN SMALL LETTER T WITH CARON - $string = str_replace("\273", 'ť', $string); - // LATIN SMALL LETTER Z WITH ACUTE - $string = str_replace("\274", 'ź', $string); - // DOUBLE ACUTE ACCENT - $string = str_replace("\275", '˝', $string); - // LATIN SMALL LETTER Z WITH CARON - $string = str_replace("\276", 'ž', $string); - // LATIN SMALL LETTER Z WITH DOT ABOVE - $string = str_replace("\277", 'ż', $string); - // LATIN CAPITAL LETTER R WITH ACUTE - $string = str_replace("\300", 'Ŕ', $string); - // LATIN CAPITAL LETTER A WITH ACUTE - $string = str_replace("\301", 'Á', $string); - // LATIN CAPITAL LETTER A WITH CIRCUMFLEX - $string = str_replace("\302", 'Â', $string); - // LATIN CAPITAL LETTER A WITH BREVE - $string = str_replace("\303", 'Ă', $string); - // LATIN CAPITAL LETTER A WITH DIAERESIS - $string = str_replace("\304", 'Ä', $string); - // LATIN CAPITAL LETTER L WITH ACUTE - $string = str_replace("\305", 'Ĺ', $string); - // LATIN CAPITAL LETTER C WITH ACUTE - $string = str_replace("\306", 'Ć', $string); - // LATIN CAPITAL LETTER C WITH CEDILLA - $string = str_replace("\307", 'Ç', $string); - // LATIN CAPITAL LETTER C WITH CARON - $string = str_replace("\310", 'Č', $string); - // LATIN CAPITAL LETTER E WITH ACUTE - $string = str_replace("\311", 'É', $string); - // LATIN CAPITAL LETTER E WITH OGONEK - $string = str_replace("\312", 'Ę', $string); - // LATIN CAPITAL LETTER E WITH DIAERESIS - $string = str_replace("\313", 'Ë', $string); - // LATIN CAPITAL LETTER E WITH CARON - $string = str_replace("\314", 'Ě', $string); - // LATIN CAPITAL LETTER I WITH ACUTE - $string = str_replace("\315", 'Í', $string); - // LATIN CAPITAL LETTER I WITH CIRCUMFLEX - $string = str_replace("\316", 'Î', $string); - // LATIN CAPITAL LETTER D WITH CARON - $string = str_replace("\317", 'Ď', $string); - // LATIN CAPITAL LETTER D WITH STROKE - $string = str_replace("\320", 'Đ', $string); - // LATIN CAPITAL LETTER N WITH ACUTE - $string = str_replace("\321", 'Ń', $string); - // LATIN CAPITAL LETTER N WITH CARON - $string = str_replace("\322", 'Ň', $string); - // LATIN CAPITAL LETTER O WITH ACUTE - $string = str_replace("\323", 'Ó', $string); - // LATIN CAPITAL LETTER O WITH CIRCUMFLEX - $string = str_replace("\324", 'Ô', $string); - // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - $string = str_replace("\325", 'Ő', $string); - // LATIN CAPITAL LETTER O WITH DIAERESIS - $string = str_replace("\326", 'Ö', $string); - // MULTIPLICATION SIGN - $string = str_replace("\327", '×', $string); - // LATIN CAPITAL LETTER R WITH CARON - $string = str_replace("\330", 'Ř', $string); - // LATIN CAPITAL LETTER U WITH RING ABOVE - $string = str_replace("\331", 'Ů', $string); - // LATIN CAPITAL LETTER U WITH ACUTE - $string = str_replace("\332", 'Ú', $string); - // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - $string = str_replace("\333", 'Ű', $string); - // LATIN CAPITAL LETTER U WITH DIAERESIS - $string = str_replace("\334", 'Ü', $string); - // LATIN CAPITAL LETTER Y WITH ACUTE - $string = str_replace("\335", 'Ý', $string); - // LATIN CAPITAL LETTER T WITH CEDILLA - $string = str_replace("\336", 'Ţ', $string); - // LATIN SMALL LETTER SHARP S - $string = str_replace("\337", 'ß', $string); - // LATIN SMALL LETTER R WITH ACUTE - $string = str_replace("\340", 'ŕ', $string); - // LATIN SMALL LETTER A WITH ACUTE - $string = str_replace("\341", 'á', $string); - // LATIN SMALL LETTER A WITH CIRCUMFLEX - $string = str_replace("\342", 'â', $string); - // LATIN SMALL LETTER A WITH BREVE - $string = str_replace("\343", 'ă', $string); - // LATIN SMALL LETTER A WITH DIAERESIS - $string = str_replace("\344", 'ä', $string); - // LATIN SMALL LETTER L WITH ACUTE - $string = str_replace("\345", 'ĺ', $string); - // LATIN SMALL LETTER C WITH ACUTE - $string = str_replace("\346", 'ć', $string); - // LATIN SMALL LETTER C WITH CEDILLA - $string = str_replace("\347", 'ç', $string); - // LATIN SMALL LETTER C WITH CARON - $string = str_replace("\350", 'č', $string); - // LATIN SMALL LETTER E WITH ACUTE - $string = str_replace("\351", 'é', $string); - // LATIN SMALL LETTER E WITH OGONEK - $string = str_replace("\352", 'ę', $string); - // LATIN SMALL LETTER E WITH DIAERESIS - $string = str_replace("\353", 'ë', $string); - // LATIN SMALL LETTER E WITH CARON - $string = str_replace("\354", 'ě', $string); - // LATIN SMALL LETTER I WITH ACUTE - $string = str_replace("\355", 'í', $string); - // LATIN SMALL LETTER I WITH CIRCUMFLEX - $string = str_replace("\356", 'î', $string); - // LATIN SMALL LETTER D WITH CARON - $string = str_replace("\357", 'ď', $string); - // LATIN SMALL LETTER D WITH STROKE - $string = str_replace("\360", 'đ', $string); - // LATIN SMALL LETTER N WITH ACUTE - $string = str_replace("\361", 'ń', $string); - // LATIN SMALL LETTER N WITH CARON - $string = str_replace("\362", 'ň', $string); - // LATIN SMALL LETTER O WITH ACUTE - $string = str_replace("\363", 'ó', $string); - // LATIN SMALL LETTER O WITH CIRCUMFLEX - $string = str_replace("\364", 'ô', $string); - // LATIN SMALL LETTER O WITH DOUBLE ACUTE - $string = str_replace("\365", 'ő', $string); - // LATIN SMALL LETTER O WITH DIAERESIS - $string = str_replace("\366", 'ö', $string); - // DIVISION SIGN - $string = str_replace("\367", '÷', $string); - // LATIN SMALL LETTER R WITH CARON - $string = str_replace("\370", 'ř', $string); - // LATIN SMALL LETTER U WITH RING ABOVE - $string = str_replace("\371", 'ů', $string); - // LATIN SMALL LETTER U WITH ACUTE - $string = str_replace("\372", 'ú', $string); - // LATIN SMALL LETTER U WITH DOUBLE ACUTE - $string = str_replace("\373", 'ű', $string); - // LATIN SMALL LETTER U WITH DIAERESIS - $string = str_replace("\374", 'ü', $string); - // LATIN SMALL LETTER Y WITH ACUTE - $string = str_replace("\375", 'ý', $string); - // LATIN SMALL LETTER T WITH CEDILLA - $string = str_replace("\376", 'ţ', $string); - // DOT ABOVE - $string = str_replace("\377", '˙', $string); - } - } + + // Only do the slow convert if there are 8-bit characters + if (! ereg("[\200-\377]", $string)) + return $string; + + // NO-BREAK SPACE + $string = str_replace("\240", ' ', $string); + // LATIN CAPITAL LETTER A WITH OGONEK + $string = str_replace("\241", 'Ą', $string); + // BREVE + $string = str_replace("\242", '˘', $string); + // LATIN CAPITAL LETTER L WITH STROKE + $string = str_replace("\243", 'Ł', $string); + // CURRENCY SIGN + $string = str_replace("\244", '¤', $string); + // LATIN CAPITAL LETTER L WITH CARON + $string = str_replace("\245", 'Ľ', $string); + // LATIN CAPITAL LETTER S WITH ACUTE + $string = str_replace("\246", 'Ś', $string); + // SECTION SIGN + $string = str_replace("\247", '§', $string); + // DIAERESIS + $string = str_replace("\250", '¨', $string); + // LATIN CAPITAL LETTER S WITH CARON + $string = str_replace("\251", 'Š', $string); + // LATIN CAPITAL LETTER S WITH CEDILLA + $string = str_replace("\252", 'Ş', $string); + // LATIN CAPITAL LETTER T WITH CARON + $string = str_replace("\253", 'Ť', $string); + // LATIN CAPITAL LETTER Z WITH ACUTE + $string = str_replace("\254", 'Ź', $string); + // SOFT HYPHEN + $string = str_replace("\255", '­', $string); + // LATIN CAPITAL LETTER Z WITH CARON + $string = str_replace("\256", 'Ž', $string); + // LATIN CAPITAL LETTER Z WITH DOT ABOVE + $string = str_replace("\257", 'Ż', $string); + // DEGREE SIGN + $string = str_replace("\260", '°', $string); + // LATIN SMALL LETTER A WITH OGONEK + $string = str_replace("\261", 'ą', $string); + // OGONEK + $string = str_replace("\262", '˛', $string); + // LATIN SMALL LETTER L WITH STROKE + $string = str_replace("\263", 'ł', $string); + // ACUTE ACCENT + $string = str_replace("\264", '´', $string); + // LATIN SMALL LETTER L WITH CARON + $string = str_replace("\265", 'ľ', $string); + // LATIN SMALL LETTER S WITH ACUTE + $string = str_replace("\266", 'ś', $string); + // CARON + $string = str_replace("\267", 'ˇ', $string); + // CEDILLA + $string = str_replace("\270", '¸', $string); + // LATIN SMALL LETTER S WITH CARON + $string = str_replace("\271", 'š', $string); + // LATIN SMALL LETTER S WITH CEDILLA + $string = str_replace("\272", 'ş', $string); + // LATIN SMALL LETTER T WITH CARON + $string = str_replace("\273", 'ť', $string); + // LATIN SMALL LETTER Z WITH ACUTE + $string = str_replace("\274", 'ź', $string); + // DOUBLE ACUTE ACCENT + $string = str_replace("\275", '˝', $string); + // LATIN SMALL LETTER Z WITH CARON + $string = str_replace("\276", 'ž', $string); + // LATIN SMALL LETTER Z WITH DOT ABOVE + $string = str_replace("\277", 'ż', $string); + // LATIN CAPITAL LETTER R WITH ACUTE + $string = str_replace("\300", 'Ŕ', $string); + // LATIN CAPITAL LETTER A WITH ACUTE + $string = str_replace("\301", 'Á', $string); + // LATIN CAPITAL LETTER A WITH CIRCUMFLEX + $string = str_replace("\302", 'Â', $string); + // LATIN CAPITAL LETTER A WITH BREVE + $string = str_replace("\303", 'Ă', $string); + // LATIN CAPITAL LETTER A WITH DIAERESIS + $string = str_replace("\304", 'Ä', $string); + // LATIN CAPITAL LETTER L WITH ACUTE + $string = str_replace("\305", 'Ĺ', $string); + // LATIN CAPITAL LETTER C WITH ACUTE + $string = str_replace("\306", 'Ć', $string); + // LATIN CAPITAL LETTER C WITH CEDILLA + $string = str_replace("\307", 'Ç', $string); + // LATIN CAPITAL LETTER C WITH CARON + $string = str_replace("\310", 'Č', $string); + // LATIN CAPITAL LETTER E WITH ACUTE + $string = str_replace("\311", 'É', $string); + // LATIN CAPITAL LETTER E WITH OGONEK + $string = str_replace("\312", 'Ę', $string); + // LATIN CAPITAL LETTER E WITH DIAERESIS + $string = str_replace("\313", 'Ë', $string); + // LATIN CAPITAL LETTER E WITH CARON + $string = str_replace("\314", 'Ě', $string); + // LATIN CAPITAL LETTER I WITH ACUTE + $string = str_replace("\315", 'Í', $string); + // LATIN CAPITAL LETTER I WITH CIRCUMFLEX + $string = str_replace("\316", 'Î', $string); + // LATIN CAPITAL LETTER D WITH CARON + $string = str_replace("\317", 'Ď', $string); + // LATIN CAPITAL LETTER D WITH STROKE + $string = str_replace("\320", 'Đ', $string); + // LATIN CAPITAL LETTER N WITH ACUTE + $string = str_replace("\321", 'Ń', $string); + // LATIN CAPITAL LETTER N WITH CARON + $string = str_replace("\322", 'Ň', $string); + // LATIN CAPITAL LETTER O WITH ACUTE + $string = str_replace("\323", 'Ó', $string); + // LATIN CAPITAL LETTER O WITH CIRCUMFLEX + $string = str_replace("\324", 'Ô', $string); + // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + $string = str_replace("\325", 'Ő', $string); + // LATIN CAPITAL LETTER O WITH DIAERESIS + $string = str_replace("\326", 'Ö', $string); + // MULTIPLICATION SIGN + $string = str_replace("\327", '×', $string); + // LATIN CAPITAL LETTER R WITH CARON + $string = str_replace("\330", 'Ř', $string); + // LATIN CAPITAL LETTER U WITH RING ABOVE + $string = str_replace("\331", 'Ů', $string); + // LATIN CAPITAL LETTER U WITH ACUTE + $string = str_replace("\332", 'Ú', $string); + // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + $string = str_replace("\333", 'Ű', $string); + // LATIN CAPITAL LETTER U WITH DIAERESIS + $string = str_replace("\334", 'Ü', $string); + // LATIN CAPITAL LETTER Y WITH ACUTE + $string = str_replace("\335", 'Ý', $string); + // LATIN CAPITAL LETTER T WITH CEDILLA + $string = str_replace("\336", 'Ţ', $string); + // LATIN SMALL LETTER SHARP S + $string = str_replace("\337", 'ß', $string); + // LATIN SMALL LETTER R WITH ACUTE + $string = str_replace("\340", 'ŕ', $string); + // LATIN SMALL LETTER A WITH ACUTE + $string = str_replace("\341", 'á', $string); + // LATIN SMALL LETTER A WITH CIRCUMFLEX + $string = str_replace("\342", 'â', $string); + // LATIN SMALL LETTER A WITH BREVE + $string = str_replace("\343", 'ă', $string); + // LATIN SMALL LETTER A WITH DIAERESIS + $string = str_replace("\344", 'ä', $string); + // LATIN SMALL LETTER L WITH ACUTE + $string = str_replace("\345", 'ĺ', $string); + // LATIN SMALL LETTER C WITH ACUTE + $string = str_replace("\346", 'ć', $string); + // LATIN SMALL LETTER C WITH CEDILLA + $string = str_replace("\347", 'ç', $string); + // LATIN SMALL LETTER C WITH CARON + $string = str_replace("\350", 'č', $string); + // LATIN SMALL LETTER E WITH ACUTE + $string = str_replace("\351", 'é', $string); + // LATIN SMALL LETTER E WITH OGONEK + $string = str_replace("\352", 'ę', $string); + // LATIN SMALL LETTER E WITH DIAERESIS + $string = str_replace("\353", 'ë', $string); + // LATIN SMALL LETTER E WITH CARON + $string = str_replace("\354", 'ě', $string); + // LATIN SMALL LETTER I WITH ACUTE + $string = str_replace("\355", 'í', $string); + // LATIN SMALL LETTER I WITH CIRCUMFLEX + $string = str_replace("\356", 'î', $string); + // LATIN SMALL LETTER D WITH CARON + $string = str_replace("\357", 'ď', $string); + // LATIN SMALL LETTER D WITH STROKE + $string = str_replace("\360", 'đ', $string); + // LATIN SMALL LETTER N WITH ACUTE + $string = str_replace("\361", 'ń', $string); + // LATIN SMALL LETTER N WITH CARON + $string = str_replace("\362", 'ň', $string); + // LATIN SMALL LETTER O WITH ACUTE + $string = str_replace("\363", 'ó', $string); + // LATIN SMALL LETTER O WITH CIRCUMFLEX + $string = str_replace("\364", 'ô', $string); + // LATIN SMALL LETTER O WITH DOUBLE ACUTE + $string = str_replace("\365", 'ő', $string); + // LATIN SMALL LETTER O WITH DIAERESIS + $string = str_replace("\366", 'ö', $string); + // DIVISION SIGN + $string = str_replace("\367", '÷', $string); + // LATIN SMALL LETTER R WITH CARON + $string = str_replace("\370", 'ř', $string); + // LATIN SMALL LETTER U WITH RING ABOVE + $string = str_replace("\371", 'ů', $string); + // LATIN SMALL LETTER U WITH ACUTE + $string = str_replace("\372", 'ú', $string); + // LATIN SMALL LETTER U WITH DOUBLE ACUTE + $string = str_replace("\373", 'ű', $string); + // LATIN SMALL LETTER U WITH DIAERESIS + $string = str_replace("\374", 'ü', $string); + // LATIN SMALL LETTER Y WITH ACUTE + $string = str_replace("\375", 'ý', $string); + // LATIN SMALL LETTER T WITH CEDILLA + $string = str_replace("\376", 'ţ', $string); + // DOT ABOVE + $string = str_replace("\377", '˙', $string); + return $string; } @@ -466,59 +471,59 @@ function charset_decode_iso_8859_7 ($string) { global $default_charset; - if (strtolower($default_charset) == 'iso-8859-7') { + if (strtolower($default_charset) == 'iso-8859-7') return $string; - } else { - // Only do the slow convert if there are 8-bit characters - if (ereg("[\200-\377]", $string)) { - // Some diverse characters in the beginning - $string = str_replace("\240", ' ', $string); - $string = str_replace("\241", '‘', $string); - $string = str_replace("\242", '’', $string); - $string = str_replace("\243", '£', $string); - $string = str_replace("\246", '¦', $string); - $string = str_replace("\247", '§', $string); - $string = str_replace("\250", '¨', $string); - $string = str_replace("\251", '©', $string); - $string = str_replace("\253", '«', $string); - $string = str_replace("\254", '¬', $string); - $string = str_replace("\255", '­', $string); - $string = str_replace("\257", '―', $string); - $string = str_replace("\260", '°', $string); - $string = str_replace("\261", '±', $string); - $string = str_replace("\262", '²', $string); - $string = str_replace("\263", '³', $string); - - // Horizontal bar (parentheki pavla) - $string = str_replace ("\257", '―', $string); - - // ISO-8859-7 characters from 11/04 (0xB4) to 11/06 (0xB6) - // These are Unicode 900-902 - while (ereg("([\264-\266])", $string, $res)) { - $replace = '&#' . (ord($res[1])+720) . ';'; - $string = str_replace($res[1], $replace, $string); - } - - // 11/07 (0xB7) Middle dot is the same in iso-8859-1 - $string = str_replace("\267", '·', $string); + + // Only do the slow convert if there are 8-bit characters + if (!ereg("[\200-\377]", $string)) + return $string; + + // Some diverse characters in the beginning + $string = str_replace("\240", ' ', $string); + $string = str_replace("\241", '‘', $string); + $string = str_replace("\242", '’', $string); + $string = str_replace("\243", '£', $string); + $string = str_replace("\246", '¦', $string); + $string = str_replace("\247", '§', $string); + $string = str_replace("\250", '¨', $string); + $string = str_replace("\251", '©', $string); + $string = str_replace("\253", '«', $string); + $string = str_replace("\254", '¬', $string); + $string = str_replace("\255", '­', $string); + $string = str_replace("\257", '―', $string); + $string = str_replace("\260", '°', $string); + $string = str_replace("\261", '±', $string); + $string = str_replace("\262", '²', $string); + $string = str_replace("\263", '³', $string); + + // Horizontal bar (parentheki pavla) + $string = str_replace ("\257", '―', $string); + + // ISO-8859-7 characters from 11/04 (0xB4) to 11/06 (0xB6) + // These are Unicode 900-902 + while (ereg("([\264-\266])", $string, $res)) { + $replace = '&#' . (ord($res[1])+720) . ';'; + $string = str_replace($res[1], $replace, $string); + } - // ISO-8859-7 characters from 11/08 (0xB8) to 11/10 (0xBA) - // These are Unicode 900-902 - while (ereg("([\270-\272])", $string, $res)) { - $replace = '&#' . (ord($res[1])+720) . ";"; - $string = str_replace($res[1], $replace, $string); - } + // 11/07 (0xB7) Middle dot is the same in iso-8859-1 + $string = str_replace("\267", '·', $string); + + // ISO-8859-7 characters from 11/08 (0xB8) to 11/10 (0xBA) + // These are Unicode 900-902 + while (ereg("([\270-\272])", $string, $res)) { + $replace = '&#' . (ord($res[1])+720) . ";"; + $string = str_replace($res[1], $replace, $string); + } - // 11/11 (0xBB) Right angle quotation mark is the same as in - // iso-8859-1 - $string = str_replace("\273", '»', $string); + // 11/11 (0xBB) Right angle quotation mark is the same as in + // iso-8859-1 + $string = str_replace("\273", '»', $string); - // And now the rest of the charset - while (ereg("([\274-\376])", $string, $res)) { - $replace = '&#' . (ord($res[1])+720) . ';'; - $string = str_replace($res[1], $replace, $string); - } - } + // And now the rest of the charset + while (ereg("([\274-\376])", $string, $res)) { + $replace = '&#' . (ord($res[1])+720) . ';'; + $string = str_replace($res[1], $replace, $string); } return $string; @@ -591,142 +596,141 @@ function charset_decode_koi8r ($string) { global $default_charset; - if ($default_charset == 'koi8-r') { + if ($default_charset == 'koi8-r') return $string; - } else { - // Convert to Unicode HTML entities. - // This code is rather ineffective. - $string = str_replace("\200", '─', $string); - $string = str_replace("\201", '│', $string); - $string = str_replace("\202", '┌', $string); - $string = str_replace("\203", '┐', $string); - $string = str_replace("\204", '└', $string); - $string = str_replace("\205", '┘', $string); - $string = str_replace("\206", '├', $string); - $string = str_replace("\207", '┤', $string); - $string = str_replace("\210", '┬', $string); - $string = str_replace("\211", '┴', $string); - $string = str_replace("\212", '┼', $string); - $string = str_replace("\213", '▀', $string); - $string = str_replace("\214", '▄', $string); - $string = str_replace("\215", '█', $string); - $string = str_replace("\216", '▌', $string); - $string = str_replace("\217", '▐', $string); - $string = str_replace("\220", '░', $string); - $string = str_replace("\221", '▒', $string); - $string = str_replace("\222", '▓', $string); - $string = str_replace("\223", '⌠', $string); - $string = str_replace("\224", '■', $string); - $string = str_replace("\225", '∙', $string); - $string = str_replace("\226", '√', $string); - $string = str_replace("\227", '≈', $string); - $string = str_replace("\230", '≤', $string); - $string = str_replace("\231", '≥', $string); - $string = str_replace("\232", ' ', $string); - $string = str_replace("\233", '⌡', $string); - $string = str_replace("\234", '°', $string); - $string = str_replace("\235", '²', $string); - $string = str_replace("\236", '·', $string); - $string = str_replace("\237", '÷', $string); - $string = str_replace("\240", '═', $string); - $string = str_replace("\241", '║', $string); - $string = str_replace("\242", '╒', $string); - $string = str_replace("\243", 'ё', $string); - $string = str_replace("\244", '╓', $string); - $string = str_replace("\245", '╔', $string); - $string = str_replace("\246", '╕', $string); - $string = str_replace("\247", '╖', $string); - $string = str_replace("\250", '╗', $string); - $string = str_replace("\251", '╘', $string); - $string = str_replace("\252", '╙', $string); - $string = str_replace("\253", '╚', $string); - $string = str_replace("\254", '╛', $string); - $string = str_replace("\255", '╜', $string); - $string = str_replace("\256", '╝', $string); - $string = str_replace("\257", '╞', $string); - $string = str_replace("\260", '╟', $string); - $string = str_replace("\261", '╠', $string); - $string = str_replace("\262", '╡', $string); - $string = str_replace("\263", 'Ё', $string); - $string = str_replace("\264", '╢', $string); - $string = str_replace("\265", '╣', $string); - $string = str_replace("\266", '╤', $string); - $string = str_replace("\267", '╥', $string); - $string = str_replace("\270", '╦', $string); - $string = str_replace("\271", '╧', $string); - $string = str_replace("\272", '╨', $string); - $string = str_replace("\273", '╩', $string); - $string = str_replace("\274", '╪', $string); - $string = str_replace("\275", '╫', $string); - $string = str_replace("\276", '╬', $string); - $string = str_replace("\277", '©', $string); - $string = str_replace("\300", 'ю', $string); - $string = str_replace("\301", 'а', $string); - $string = str_replace("\302", 'б', $string); - $string = str_replace("\303", 'ц', $string); - $string = str_replace("\304", 'д', $string); - $string = str_replace("\305", 'е', $string); - $string = str_replace("\306", 'ф', $string); - $string = str_replace("\307", 'г', $string); - $string = str_replace("\310", 'х', $string); - $string = str_replace("\311", 'и', $string); - $string = str_replace("\312", 'й', $string); - $string = str_replace("\313", 'к', $string); - $string = str_replace("\314", 'л', $string); - $string = str_replace("\315", 'м', $string); - $string = str_replace("\316", 'н', $string); - $string = str_replace("\317", 'о', $string); - $string = str_replace("\320", 'п', $string); - $string = str_replace("\321", 'я', $string); - $string = str_replace("\322", 'р', $string); - $string = str_replace("\323", 'с', $string); - $string = str_replace("\324", 'т', $string); - $string = str_replace("\325", 'у', $string); - $string = str_replace("\326", 'ж', $string); - $string = str_replace("\327", 'в', $string); - $string = str_replace("\330", 'ь', $string); - $string = str_replace("\331", 'ы', $string); - $string = str_replace("\332", 'з', $string); - $string = str_replace("\333", 'ш', $string); - $string = str_replace("\334", 'э', $string); - $string = str_replace("\335", 'щ', $string); - $string = str_replace("\336", 'ч', $string); - $string = str_replace("\337", 'ъ', $string); - $string = str_replace("\340", 'Ю', $string); - $string = str_replace("\341", 'А', $string); - $string = str_replace("\342", 'Б', $string); - $string = str_replace("\343", 'Ц', $string); - $string = str_replace("\344", 'Д', $string); - $string = str_replace("\345", 'Е', $string); - $string = str_replace("\346", 'Ф', $string); - $string = str_replace("\347", 'Г', $string); - $string = str_replace("\350", 'Х', $string); - $string = str_replace("\351", 'И', $string); - $string = str_replace("\352", 'Й', $string); - $string = str_replace("\353", 'К', $string); - $string = str_replace("\354", 'Л', $string); - $string = str_replace("\355", 'М', $string); - $string = str_replace("\356", 'Н', $string); - $string = str_replace("\357", 'О', $string); - $string = str_replace("\360", 'П', $string); - $string = str_replace("\361", 'Я', $string); - $string = str_replace("\362", 'Р', $string); - $string = str_replace("\363", 'С', $string); - $string = str_replace("\364", 'Т', $string); - $string = str_replace("\365", 'У', $string); - $string = str_replace("\366", 'Ж', $string); - $string = str_replace("\367", 'В', $string); - $string = str_replace("\370", 'Ь', $string); - $string = str_replace("\371", 'Ы', $string); - $string = str_replace("\372", 'З', $string); - $string = str_replace("\373", 'Ш', $string); - $string = str_replace("\374", 'Э', $string); - $string = str_replace("\375", 'Щ', $string); - $string = str_replace("\376", 'Ч', $string); - $string = str_replace("\377", 'Ъ', $string); - - return $string; - } + + // Convert to Unicode HTML entities. + // This code is rather ineffective. + $string = str_replace("\200", '─', $string); + $string = str_replace("\201", '│', $string); + $string = str_replace("\202", '┌', $string); + $string = str_replace("\203", '┐', $string); + $string = str_replace("\204", '└', $string); + $string = str_replace("\205", '┘', $string); + $string = str_replace("\206", '├', $string); + $string = str_replace("\207", '┤', $string); + $string = str_replace("\210", '┬', $string); + $string = str_replace("\211", '┴', $string); + $string = str_replace("\212", '┼', $string); + $string = str_replace("\213", '▀', $string); + $string = str_replace("\214", '▄', $string); + $string = str_replace("\215", '█', $string); + $string = str_replace("\216", '▌', $string); + $string = str_replace("\217", '▐', $string); + $string = str_replace("\220", '░', $string); + $string = str_replace("\221", '▒', $string); + $string = str_replace("\222", '▓', $string); + $string = str_replace("\223", '⌠', $string); + $string = str_replace("\224", '■', $string); + $string = str_replace("\225", '∙', $string); + $string = str_replace("\226", '√', $string); + $string = str_replace("\227", '≈', $string); + $string = str_replace("\230", '≤', $string); + $string = str_replace("\231", '≥', $string); + $string = str_replace("\232", ' ', $string); + $string = str_replace("\233", '⌡', $string); + $string = str_replace("\234", '°', $string); + $string = str_replace("\235", '²', $string); + $string = str_replace("\236", '·', $string); + $string = str_replace("\237", '÷', $string); + $string = str_replace("\240", '═', $string); + $string = str_replace("\241", '║', $string); + $string = str_replace("\242", '╒', $string); + $string = str_replace("\243", 'ё', $string); + $string = str_replace("\244", '╓', $string); + $string = str_replace("\245", '╔', $string); + $string = str_replace("\246", '╕', $string); + $string = str_replace("\247", '╖', $string); + $string = str_replace("\250", '╗', $string); + $string = str_replace("\251", '╘', $string); + $string = str_replace("\252", '╙', $string); + $string = str_replace("\253", '╚', $string); + $string = str_replace("\254", '╛', $string); + $string = str_replace("\255", '╜', $string); + $string = str_replace("\256", '╝', $string); + $string = str_replace("\257", '╞', $string); + $string = str_replace("\260", '╟', $string); + $string = str_replace("\261", '╠', $string); + $string = str_replace("\262", '╡', $string); + $string = str_replace("\263", 'Ё', $string); + $string = str_replace("\264", '╢', $string); + $string = str_replace("\265", '╣', $string); + $string = str_replace("\266", '╤', $string); + $string = str_replace("\267", '╥', $string); + $string = str_replace("\270", '╦', $string); + $string = str_replace("\271", '╧', $string); + $string = str_replace("\272", '╨', $string); + $string = str_replace("\273", '╩', $string); + $string = str_replace("\274", '╪', $string); + $string = str_replace("\275", '╫', $string); + $string = str_replace("\276", '╬', $string); + $string = str_replace("\277", '©', $string); + $string = str_replace("\300", 'ю', $string); + $string = str_replace("\301", 'а', $string); + $string = str_replace("\302", 'б', $string); + $string = str_replace("\303", 'ц', $string); + $string = str_replace("\304", 'д', $string); + $string = str_replace("\305", 'е', $string); + $string = str_replace("\306", 'ф', $string); + $string = str_replace("\307", 'г', $string); + $string = str_replace("\310", 'х', $string); + $string = str_replace("\311", 'и', $string); + $string = str_replace("\312", 'й', $string); + $string = str_replace("\313", 'к', $string); + $string = str_replace("\314", 'л', $string); + $string = str_replace("\315", 'м', $string); + $string = str_replace("\316", 'н', $string); + $string = str_replace("\317", 'о', $string); + $string = str_replace("\320", 'п', $string); + $string = str_replace("\321", 'я', $string); + $string = str_replace("\322", 'р', $string); + $string = str_replace("\323", 'с', $string); + $string = str_replace("\324", 'т', $string); + $string = str_replace("\325", 'у', $string); + $string = str_replace("\326", 'ж', $string); + $string = str_replace("\327", 'в', $string); + $string = str_replace("\330", 'ь', $string); + $string = str_replace("\331", 'ы', $string); + $string = str_replace("\332", 'з', $string); + $string = str_replace("\333", 'ш', $string); + $string = str_replace("\334", 'э', $string); + $string = str_replace("\335", 'щ', $string); + $string = str_replace("\336", 'ч', $string); + $string = str_replace("\337", 'ъ', $string); + $string = str_replace("\340", 'Ю', $string); + $string = str_replace("\341", 'А', $string); + $string = str_replace("\342", 'Б', $string); + $string = str_replace("\343", 'Ц', $string); + $string = str_replace("\344", 'Д', $string); + $string = str_replace("\345", 'Е', $string); + $string = str_replace("\346", 'Ф', $string); + $string = str_replace("\347", 'Г', $string); + $string = str_replace("\350", 'Х', $string); + $string = str_replace("\351", 'И', $string); + $string = str_replace("\352", 'Й', $string); + $string = str_replace("\353", 'К', $string); + $string = str_replace("\354", 'Л', $string); + $string = str_replace("\355", 'М', $string); + $string = str_replace("\356", 'Н', $string); + $string = str_replace("\357", 'О', $string); + $string = str_replace("\360", 'П', $string); + $string = str_replace("\361", 'Я', $string); + $string = str_replace("\362", 'Р', $string); + $string = str_replace("\363", 'С', $string); + $string = str_replace("\364", 'Т', $string); + $string = str_replace("\365", 'У', $string); + $string = str_replace("\366", 'Ж', $string); + $string = str_replace("\367", 'В', $string); + $string = str_replace("\370", 'Ь', $string); + $string = str_replace("\371", 'Ы', $string); + $string = str_replace("\372", 'З', $string); + $string = str_replace("\373", 'Ш', $string); + $string = str_replace("\374", 'Э', $string); + $string = str_replace("\375", 'Щ', $string); + $string = str_replace("\376", 'Ч', $string); + $string = str_replace("\377", 'Ъ', $string); + + return $string; } @@ -742,7 +746,7 @@ $use_gettext = true; - // Avoid warnings/errors + // Avoid warnings/errors if gettext is not installed if (! function_exists('_')) { function _($str) { return $str; }; } @@ -760,10 +764,12 @@ function set_up_language($sm_language, $do_search = false) { static $SetupAlready = 0; - global $HTTP_ACCEPT_LANGUAGE, $use_gettext, $languages, $squirrelmail_language; + global $HTTP_ACCEPT_LANGUAGE, $use_gettext, $languages, + $squirrelmail_language; if ($SetupAlready) return; + $SetupAlready = 1; $charset_headers_sent=false; diff --git a/functions/imap.php b/functions/imap.php index 7c4e4165..824501ce 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -5,7 +5,9 @@ ** $Id$ **/ - $imap_php = true; + if (defined ('imap_php')) + return; + define ('imap_php', true); $imap_backend = 'imap'; diff --git a/functions/imap_general.php b/functions/imap_general.php index 8e2dc16b..b1d0b752 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -7,6 +7,11 @@ ** $Id$ **/ + if (defined ('imap_general_php')) + return; + define ('imap_general_php', true); + + global $imap_general_debug; $imap_general_debug = false; /****************************************************************************** @@ -213,7 +218,7 @@ fputs ($imap_stream, "a001 LOGOUT\r\n"); } -function sqimap_capability($imap_stream, $capability) { + function sqimap_capability($imap_stream, $capability) { global $sqimap_capabilities; global $imap_general_debug; @@ -236,18 +241,17 @@ function sqimap_capability($imap_stream, $capability) { /****************************************************************************** ** Returns the delimeter between mailboxes: INBOX/Test, or INBOX.Test... ******************************************************************************/ -function sqimap_get_delimiter ($imap_stream = false) { - global $imap_general_debug; - global $sqimap_delimiter; - global $optional_delimiter; + function sqimap_get_delimiter ($imap_stream = false) { + global $imap_general_debug; + global $sqimap_delimiter; + global $optional_delimiter; - /* Use configured delimiter if set */ - if((!empty($optional_delimiter)) && $optional_delimiter != "detect") { - return $optional_delimiter; - } + /* Use configured delimiter if set */ + if((!empty($optional_delimiter)) && $optional_delimiter != "detect") + return $optional_delimiter; - /* Do some caching here */ - if (!$sqimap_delimiter) { + /* Do some caching here */ + if (!$sqimap_delimiter) { if (sqimap_capability($imap_stream, "NAMESPACE")) { /* According to something that I can't find, this is supposed to work on all systems OS: This won't work in Courier IMAP. @@ -280,7 +284,7 @@ function sqimap_get_delimiter ($imap_stream = false) { } } return $sqimap_delimiter; -} + } /****************************************************************************** diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index b1219784..fe1baee5 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -7,6 +7,10 @@ ** $Id$ **/ + if (defined ('imap_mailbox_php')) + return; + define ('imap_mailbox_php', true); + /****************************************************************************** ** Expunges a mailbox ******************************************************************************/ @@ -191,17 +195,15 @@ ** See comment on sqimap_mailbox_parse() for info about the returned array. ******************************************************************************/ function sqimap_mailbox_list ($imap_stream) { - global $load_prefs_php, $prefs_php, $config_php; global $data_dir, $username, $list_special_folders_first; global $trash_folder, $sent_folder; - global $move_to_trash, $move_to_sent; + global $move_to_trash, $move_to_sent, $folder_prefix; $inbox_in_list = false; $inbox_subscribed = false; - if (!isset($load_prefs_php)) include "../src/load_prefs.php"; - else global $folder_prefix; - if (!function_exists ("ary_sort")) include "../functions/array.php"; + include "../src/load_prefs.php"; + include "../functions/array.php"; $dm = sqimap_get_delimiter ($imap_stream); diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 123b4e56..2c47d5ab 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -7,7 +7,9 @@ ** $Id$ **/ - if (!isset($mime_php)) include "../functions/mime.php"; + if (defined ('imap_messages_php')) + return; + define ('imap_messages_php', true); /****************************************************************************** ** Copies specified messages to specified folder diff --git a/functions/imap_search.php b/functions/imap_search.php index a86ddc7b..d6284461 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -1,20 +1,19 @@ '; echo ""; - echo ""; + echo "
"; echo ""; $urlMailbox=urlencode($mailbox); diff --git a/functions/mime.php b/functions/mime.php index 90b8b37a..5958d90c 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -6,17 +6,17 @@ ** ** $Id$ **/ + + if (defined('mime_php')) + return; + define('mime_php', true); + global $debug_mime; $debug_mime = false; - $mime_php = true; - - if (!isset($i18n_php)) - include "../functions/i18n.php"; - if (!isset($imap_php)) - include "../functions/imap.php"; - if (!isset($config_php)) - include "../config/config.php"; - + + include "../functions/i18n.php"; + include "../functions/imap.php"; + include "../config/config.php"; /** Setting up the objects that have the structure for the message **/ diff --git a/functions/page_header.php b/functions/page_header.php index 9e95b3b3..a9fbdd3b 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -7,16 +7,14 @@ ** $Id$ **/ - session_start(); + if (defined('page_header_php')) + return; + define('page_header_php', true); - $page_header_php = true; - - if (!isset($prefs_php)) - include ("../functions/prefs.php"); - if (!isset($i18n_php)) - include ("../functions/i18n.php"); - if (!isset($plugin_php)) - include ("../functions/plugin.php"); + include('../src/validate.php'); + include("../functions/prefs.php"); + include("../functions/i18n.php"); + include("../functions/plugin.php"); // Check to see if gettext is installed $headers_sent=set_up_language(getPref($data_dir, $username, "language")); diff --git a/functions/plugin.php b/functions/plugin.php index 46cc9eef..a6371dfa 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -16,7 +16,11 @@ **/ - $plugin_php = true; + if (defined('plugin_php')) + return; + define('plugin_php', true); + + global $plugin_general_debug, $squirrelmail_plugin_hooks; $plugin_general_debug = false; $squirrelmail_plugin_hooks = array(); diff --git a/functions/prefs.php b/functions/prefs.php index aadbcb3f..aaa263b2 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -7,8 +7,11 @@ ** $Id$ **/ - $prefs_php = true; - + if (defined('prefs_php')) + return; + define('prefs_php', true); + + global $prefs_are_cached, $prefs_cache; $prefs_are_cached = false; $prefs_cache = array(); diff --git a/functions/smtp.php b/functions/smtp.php index 99fc019a..3b9e6579 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -7,9 +7,13 @@ ** $Id$ **/ - $smtp_php = true; - if (!isset($addressbook_php)) - include('../functions/addressbook.php'); + if (defined('smtp_php')) + return; + define('smtp_php', true); + + include('../functions/addressbook.php'); + + global $username, $popuser, $domain; // This should most probably go to some initialization... if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) { @@ -415,11 +419,8 @@ function errorCheck($line, $smtpConnection) { - global $page_header_php; global $color; - if (!isset($page_header_php)) { - include '../functions/page_header.php'; - } + include '../functions/page_header.php'; // Read new lines on a multiline response $lines = $line; diff --git a/functions/strings.php b/functions/strings.php index 1cf6be0d..dea7319a 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -2,91 +2,9 @@ /* $Id$ */ - $strings_php = true; - $fix_form_endlines = false; - - // Remove all slashes for form values - if (get_magic_quotes_gpc()) - { - global $REQUEST_METHOD; - if ($REQUEST_METHOD == "POST") - { - global $HTTP_POST_VARS; - RemoveSlashes($HTTP_POST_VARS); - } - elseif ($REQUEST_METHOD == "GET") - { - global $HTTP_GET_VARS; - RemoveSlashes($HTTP_GET_VARS); - } - } - - // Auto-detection - // - // if $send (the form button's name) contains "\n" as the first char - // or "\r\n" as the first two (compensating for RedHat's flawed package - // and Konqueror, respectively), and the script is compose.php, then - // trim everything. Otherwise, we don't have to worry. - // - // If RedHat ever gets PHP officially upgraded past package php-4.0.4pl1-3 - // or if Konqueror and PHP start working together, modify/remove this hack - global $send, $PHP_SELF; - $trimChars = 0; - if (isset($send) && substr($PHP_SELF, -12) == "/compose.php") - { - if (substr($send, 0, 1) == "\n") - $trimChars = 1; - if (substr($send, 0, 2) == "\r\n") - $trimChars = 2; - } - if ($trimChars) - { - if ($REQUEST_METHOD == "POST") { - TrimArray($HTTP_POST_VARS, $trimChars); - } else { - TrimArray($HTTP_GET_VARS, $trimChars); - } - } - - //************************************************************************** - // Trims every element in the array - //************************************************************************** - function TrimArray(&$array, $trimChars) { - foreach ($array as $k => $v) { - global $$k; - if (is_array($$k)) { - foreach ($$k as $k2 => $v2) { - $$k[$k2] = substr($v2, $trimChars); - } - } else { - $$k = substr($v, $trimChars); - } - } - } - - - //************************************************************************** - // Removes slashes from every element in the array - //************************************************************************** - function RemoveSlashes($array) - { - foreach ($array as $k => $v) - { - global $$k; - if (is_array($$k)) - { - foreach ($$k as $k2 => $v2) - { - $newArray[stripslashes($k2)] = stripslashes($v2); - } - $$k = $newArray; - } - else - { - $$k = stripslashes($v); - } - } - } + if (defined('strings_php')) + return; + define('strings_php', true); //************************************************************************* @@ -252,11 +170,8 @@ function translateText(&$body, $wrap_at, $charset) { global $where, $what; // from searching - global $url_parser_php; - if (!isset($url_parser_php)) { - include '../functions/url_parser.php'; - } + include '../functions/url_parser.php'; $body_ary = explode("\n", $body); $PriorQuotes = 0; @@ -300,6 +215,7 @@ } /* SquirrelMail version number -- DO NOT CHANGE */ + global $version; $version = '1.1.0 [cvs]'; @@ -311,11 +227,6 @@ } - // Depreciated. :-) I always wanted to say that. - function replace_spaces ($string) { - return str_replace(' ', ' ', $string); - } - function get_location () { # This determines the location to forward to relative # to your server. If this doesnt work correctly for diff --git a/functions/tree.php b/functions/tree.php index 9871d45a..01e318da 100644 --- a/functions/tree.php +++ b/functions/tree.php @@ -2,12 +2,12 @@ /* $Id$ */ - $tree_php = true; + if (defined('tree_php')) + return; + define('tree_php', true); - if (!isset($imap_php)) - include('../functions/imap.php'); - if (!isset($config_php)) - include('../config/config.php'); + include('../functions/imap.php'); + include('../config/config.php'); // Recursive function to find the correct parent for a new node function findParentForChild($value, $treeIndexToStart, $tree) { @@ -127,4 +127,4 @@ echo $tree[$index]['value'] . '
'; } } -?> \ No newline at end of file +?> diff --git a/functions/url_parser.php b/functions/url_parser.php index 6a9e7d41..2fb2d3a6 100644 --- a/functions/url_parser.php +++ b/functions/url_parser.php @@ -2,7 +2,9 @@ /* URL Passing code to allow links from with in emails */ /* $Id$ */ - $url_parser_php = true; + if (defined('url_parser_php')) + return; + define('url_parser_php', true); function replaceBlock (&$in, $replace, $start, $end) { $begin = substr($in,0,$start); @@ -19,6 +21,7 @@ // $IPMatch = '\[?' . $IPMatch . '(\.' . $IPMatch . '){3}\]?'; // // Here's enough: + global $IP_RegExp_Match, $Host_RegExp_Match, $Email_RegExp_Match; $IP_RegExp_Match = '\\[?[0-9]{1,3}(\\.[0-9]{1,3}){3}\\]?'; $Host_RegExp_Match = '(' . $IP_RegExp_Match . '|[0-9a-z]([-.]?[0-9a-z])*\\.[a-z][a-z]+)'; @@ -56,6 +59,7 @@ // We don't want to re-initialize this stuff for every line. Save work // and just do it once here. + global $url_parser_url_tokens; $url_parser_url_tokens = array( 'http://', 'https://', @@ -64,6 +68,7 @@ 'gopher://', 'news://'); + global $url_parser_poss_ends; $url_parser_poss_ends = array(' ', "\n", "\r", '<', '>', ".\r", ".\n", '. ', ' ', ')', '(', '"', '<', '>', '.<', ']', '[', '{', '}', "\240"); -- 2.25.1