* Got bored and copied all the validate.php and define() stuff to 1.1
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 19 Apr 2001 17:58:10 +0000 (17:58 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 19 Apr 2001 17:58:10 +0000 (17:58 +0000)
* 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

24 files changed:
config/conf.pl
config/config_default.php
functions/abook_database.php
functions/addressbook.php
functions/array.php
functions/auth.php
functions/date.php
functions/db_prefs.php
functions/display_messages.php
functions/i18n.php
functions/imap.php
functions/imap_general.php
functions/imap_mailbox.php
functions/imap_messages.php
functions/imap_search.php
functions/mailbox_display.php
functions/mime.php
functions/page_header.php
functions/plugin.php
functions/prefs.php
functions/smtp.php
functions/strings.php
functions/tree.php
functions/url_parser.php

index ab645573a43065ed97dee59508d78dd84101af34..1c03facb70acdd002a53c91592546245d704e2c1 100755 (executable)
@@ -1547,6 +1547,9 @@ sub save_data {
 
    print FILE "<?php\n\t/** SquirrelMail configuration\n";
    print FILE "\t ** Created using the configure script, conf.pl\n\t **/\n\n";
+   
+   print FILE "if (defined('config_php'))\n   return;\n";
+   print FILE "define('config_php', true);\n\n";
 
    if ($print_config_version) {
       print FILE "\t\$config_version = \"$print_config_version\";\n";
index 0528defc19fbe4da2243617efde0ecdb25fa6f38..6e8fc5c4ddd7ab0c7172a50e0ad18d8a0b4bbbdd 100644 (file)
@@ -8,6 +8,12 @@
 //  to configure.
 //
 
+    // This makes sure we don't load it dozens of times
+    // don't change this
+    if (defined('config_php'))
+       return;
+    define('config_php', true);
+
     // don't change
     $config_version = "x62";
 
index 8fcb5170a000d6794bcbb79b8c463ebac1316dc7..0964a85273a5b1463431e8eb75d75f511a43cd4c 100644 (file)
@@ -4,7 +4,7 @@
     **  abook_database.php
     **
     **  Backend for personal addressbook stored in a database,
-    **  accessed using the DB-casses in PEAR.
+    **  accessed using the DB-classes in PEAR.
     **
     **  IMPORTANT:  The PEAR modules must be in the include path
     **  for this class to work.
index 8385ca3c4c2982fcf288b027fe6718d25e246fe1..26b6aed3a8c71a1f0f17db38c4ace99f4eb5959a 100644 (file)
@@ -8,7 +8,9 @@
    **  $Id$
    **/
     
-   $addressbook_php = true;
+   if (defined ('addressbook_php'))
+      return; 
+   define ('addressbook_php', true); 
 
    // Include backends here.
    include('../functions/abook_local_file.php');
index a64eb60779d60515a5381ed635a3031abb4ee558..638153ab4f3ac8920e711792c000bc14a3fd3de6 100644 (file)
@@ -8,7 +8,10 @@
     **  $Id$
     **/
 
-   $array_php = true;
+
+   if (defined ('array_php'))
+       return; 
+   define ('array_php', true); 
 
    function ary_sort($ary,$col, $dir = 1){
       // The globals are used because USORT determines what is passed to comp2
index f302a496e021bdb2ddb3f6d2d23f25a1489a0c23..86e2182920264e0d458671e3a3763bb5442d96a8 100644 (file)
@@ -8,16 +8,22 @@
  ** $Id$
  **/
 
-   $auth_php = true;
+   if (defined ('auth_php'))
+      return; 
+   define ('auth_php', true); 
 
    function is_logged_in () {
-      if (!session_is_registered('user_is_logged_in')) {
-         echo _("You must login first.");
-         echo "</body></html>\n\n";
-         exit;
-      } else {
-         return true;
-      }
+      if (session_is_registered('user_is_logged_in'))
+         return;
+        
+      echo "<html><body bgcolor=\"ffffff\">\n";
+      echo "<br><br>";
+      echo "<center>";
+      echo "<b>"._("You must be logged in to access this page.")."</b><br>";
+      echo "<a href=\"../src/login.php\">"._("Go to the login page")."</a>\n";
+      echo "</center>";
+      echo "</body></html>\n";
+      exit;
    }
 
 ?>
index 1b2811532289370eef75cbbac0fb97c5a10bab0f..59a10dca4e67860b32f84bf16c314e14789c5c2a 100644 (file)
     **  $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')
index b15747a579858cd538e82e02912ce089b2dbe9f6..3d478cf3b51148b313576975db77cd2e06704f19 100644 (file)
     **  $Id$
     **/
 
-   $prefs_php = true;
+   if (defined('prefs_php'))
+       return;
+   define('prefs_php', true);
+
    require_once('DB.php');
 
    class dbPrefs {
index 54e9b24329ab3b81675c606c5dfb4c899b05ed8a..89305b7299f280f7ab6158b66a36fde24035b966 100644 (file)
@@ -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 '<BR>';
index b3e54477d582d5e12b9f95941918e60bfec2e32e..3aec6c9c6cd9ccde75f75cca43e85369a696ff9e 100644 (file)
  ** $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.
    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", '&#160;', $string);
-            // LATIN CAPITAL LETTER A WITH OGONEK
-            $string = str_replace("\241", '&#260;', $string);
-            // BREVE
-            $string = str_replace("\242", '&#728;', $string);
-            // LATIN CAPITAL LETTER L WITH STROKE
-            $string = str_replace("\243", '&#321;', $string);
-            // CURRENCY SIGN
-            $string = str_replace("\244", '&#164;', $string);
-            // LATIN CAPITAL LETTER L WITH CARON
-            $string = str_replace("\245", '&#317;', $string);
-            // LATIN CAPITAL LETTER S WITH ACUTE
-            $string = str_replace("\246", '&#346;', $string);
-            // SECTION SIGN
-            $string = str_replace("\247", '&#167;', $string);
-            // DIAERESIS
-            $string = str_replace("\250", '&#168;', $string);
-            // LATIN CAPITAL LETTER S WITH CARON
-            $string = str_replace("\251", '&#352;', $string);
-            // LATIN CAPITAL LETTER S WITH CEDILLA
-            $string = str_replace("\252", '&#350;', $string);
-            // LATIN CAPITAL LETTER T WITH CARON
-            $string = str_replace("\253", '&#356;', $string);
-            // LATIN CAPITAL LETTER Z WITH ACUTE
-            $string = str_replace("\254", '&#377;', $string);
-            // SOFT HYPHEN
-            $string = str_replace("\255", '&#173;', $string);
-            // LATIN CAPITAL LETTER Z WITH CARON
-            $string = str_replace("\256", '&#381;', $string);
-            // LATIN CAPITAL LETTER Z WITH DOT ABOVE
-            $string = str_replace("\257", '&#379;', $string);
-            // DEGREE SIGN
-            $string = str_replace("\260", '&#176;', $string);
-            // LATIN SMALL LETTER A WITH OGONEK
-            $string = str_replace("\261", '&#261;', $string);
-            // OGONEK
-            $string = str_replace("\262", '&#731;', $string);
-            // LATIN SMALL LETTER L WITH STROKE
-            $string = str_replace("\263", '&#322;', $string);
-            // ACUTE ACCENT
-            $string = str_replace("\264", '&#180;', $string);
-            // LATIN SMALL LETTER L WITH CARON
-            $string = str_replace("\265", '&#318;', $string);
-            // LATIN SMALL LETTER S WITH ACUTE
-            $string = str_replace("\266", '&#347;', $string);
-            // CARON
-            $string = str_replace("\267", '&#711;', $string);
-            // CEDILLA
-            $string = str_replace("\270", '&#184;', $string);
-            // LATIN SMALL LETTER S WITH CARON
-            $string = str_replace("\271", '&#353;', $string);
-            // LATIN SMALL LETTER S WITH CEDILLA
-            $string = str_replace("\272", '&#351;', $string);
-            // LATIN SMALL LETTER T WITH CARON
-            $string = str_replace("\273", '&#357;', $string);
-            // LATIN SMALL LETTER Z WITH ACUTE
-            $string = str_replace("\274", '&#378;', $string);
-            // DOUBLE ACUTE ACCENT
-            $string = str_replace("\275", '&#733;', $string);
-            // LATIN SMALL LETTER Z WITH CARON
-            $string = str_replace("\276", '&#382;', $string);
-            // LATIN SMALL LETTER Z WITH DOT ABOVE
-            $string = str_replace("\277", '&#380;', $string);
-            // LATIN CAPITAL LETTER R WITH ACUTE
-            $string = str_replace("\300", '&#340;', $string);
-            // LATIN CAPITAL LETTER A WITH ACUTE
-            $string = str_replace("\301", '&#193;', $string);
-            // LATIN CAPITAL LETTER A WITH CIRCUMFLEX
-            $string = str_replace("\302", '&#194;', $string);
-            // LATIN CAPITAL LETTER A WITH BREVE
-            $string = str_replace("\303", '&#258;', $string);
-            // LATIN CAPITAL LETTER A WITH DIAERESIS
-            $string = str_replace("\304", '&#196;', $string);
-            // LATIN CAPITAL LETTER L WITH ACUTE
-            $string = str_replace("\305", '&#313;', $string);
-            // LATIN CAPITAL LETTER C WITH ACUTE
-            $string = str_replace("\306", '&#262;', $string);
-            // LATIN CAPITAL LETTER C WITH CEDILLA
-            $string = str_replace("\307", '&#199;', $string);
-            // LATIN CAPITAL LETTER C WITH CARON
-            $string = str_replace("\310", '&#268;', $string);
-            // LATIN CAPITAL LETTER E WITH ACUTE
-            $string = str_replace("\311", '&#201;', $string);
-            // LATIN CAPITAL LETTER E WITH OGONEK
-            $string = str_replace("\312", '&#280;', $string);
-            // LATIN CAPITAL LETTER E WITH DIAERESIS
-            $string = str_replace("\313", '&#203;', $string);
-            // LATIN CAPITAL LETTER E WITH CARON
-            $string = str_replace("\314", '&#282;', $string);
-            // LATIN CAPITAL LETTER I WITH ACUTE
-            $string = str_replace("\315", '&#205;', $string);
-            // LATIN CAPITAL LETTER I WITH CIRCUMFLEX
-            $string = str_replace("\316", '&#206;', $string);
-            // LATIN CAPITAL LETTER D WITH CARON
-            $string = str_replace("\317", '&#270;', $string);
-            // LATIN CAPITAL LETTER D WITH STROKE
-            $string = str_replace("\320", '&#272;', $string);
-            // LATIN CAPITAL LETTER N WITH ACUTE
-            $string = str_replace("\321", '&#323;', $string);
-            // LATIN CAPITAL LETTER N WITH CARON
-            $string = str_replace("\322", '&#327;', $string);
-            // LATIN CAPITAL LETTER O WITH ACUTE
-            $string = str_replace("\323", '&#211;', $string);
-            // LATIN CAPITAL LETTER O WITH CIRCUMFLEX
-            $string = str_replace("\324", '&#212;', $string);
-            // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
-            $string = str_replace("\325", '&#336;', $string);
-            // LATIN CAPITAL LETTER O WITH DIAERESIS
-            $string = str_replace("\326", '&#214;', $string);
-            // MULTIPLICATION SIGN
-            $string = str_replace("\327", '&#215;', $string);
-            // LATIN CAPITAL LETTER R WITH CARON
-            $string = str_replace("\330", '&#344;', $string);
-            // LATIN CAPITAL LETTER U WITH RING ABOVE
-            $string = str_replace("\331", '&#366;', $string);
-            // LATIN CAPITAL LETTER U WITH ACUTE
-            $string = str_replace("\332", '&#218;', $string);
-            // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
-            $string = str_replace("\333", '&#368;', $string);
-            // LATIN CAPITAL LETTER U WITH DIAERESIS
-            $string = str_replace("\334", '&#220;', $string);
-            // LATIN CAPITAL LETTER Y WITH ACUTE
-            $string = str_replace("\335", '&#221;', $string);
-            // LATIN CAPITAL LETTER T WITH CEDILLA
-            $string = str_replace("\336", '&#354;', $string);
-            // LATIN SMALL LETTER SHARP S
-            $string = str_replace("\337", '&#223;', $string);
-            // LATIN SMALL LETTER R WITH ACUTE
-            $string = str_replace("\340", '&#341;', $string);
-            // LATIN SMALL LETTER A WITH ACUTE
-            $string = str_replace("\341", '&#225;', $string);
-            // LATIN SMALL LETTER A WITH CIRCUMFLEX
-            $string = str_replace("\342", '&#226;', $string);
-            // LATIN SMALL LETTER A WITH BREVE
-            $string = str_replace("\343", '&#259;', $string);
-            // LATIN SMALL LETTER A WITH DIAERESIS
-            $string = str_replace("\344", '&#228;', $string);
-            // LATIN SMALL LETTER L WITH ACUTE
-            $string = str_replace("\345", '&#314;', $string);
-            // LATIN SMALL LETTER C WITH ACUTE
-            $string = str_replace("\346", '&#263;', $string);
-            // LATIN SMALL LETTER C WITH CEDILLA
-            $string = str_replace("\347", '&#231;', $string);
-            // LATIN SMALL LETTER C WITH CARON
-            $string = str_replace("\350", '&#269;', $string);
-            // LATIN SMALL LETTER E WITH ACUTE
-            $string = str_replace("\351", '&#233;', $string);
-            // LATIN SMALL LETTER E WITH OGONEK
-            $string = str_replace("\352", '&#281;', $string);
-            // LATIN SMALL LETTER E WITH DIAERESIS
-            $string = str_replace("\353", '&#235;', $string);
-            // LATIN SMALL LETTER E WITH CARON
-            $string = str_replace("\354", '&#283;', $string);
-            // LATIN SMALL LETTER I WITH ACUTE
-            $string = str_replace("\355", '&#237;', $string);
-            // LATIN SMALL LETTER I WITH CIRCUMFLEX
-            $string = str_replace("\356", '&#238;', $string);
-            // LATIN SMALL LETTER D WITH CARON
-            $string = str_replace("\357", '&#271;', $string);
-            // LATIN SMALL LETTER D WITH STROKE
-            $string = str_replace("\360", '&#273;', $string);
-            // LATIN SMALL LETTER N WITH ACUTE
-            $string = str_replace("\361", '&#324;', $string);
-            // LATIN SMALL LETTER N WITH CARON
-            $string = str_replace("\362", '&#328;', $string);
-            // LATIN SMALL LETTER O WITH ACUTE
-            $string = str_replace("\363", '&#243;', $string);
-            // LATIN SMALL LETTER O WITH CIRCUMFLEX
-            $string = str_replace("\364", '&#244;', $string);
-            // LATIN SMALL LETTER O WITH DOUBLE ACUTE
-            $string = str_replace("\365", '&#337;', $string);
-            // LATIN SMALL LETTER O WITH DIAERESIS
-            $string = str_replace("\366", '&#246;', $string);
-            // DIVISION SIGN
-            $string = str_replace("\367", '&#247;', $string);
-            // LATIN SMALL LETTER R WITH CARON
-            $string = str_replace("\370", '&#345;', $string);
-            // LATIN SMALL LETTER U WITH RING ABOVE
-            $string = str_replace("\371", '&#367;', $string);
-            // LATIN SMALL LETTER U WITH ACUTE
-            $string = str_replace("\372", '&#250;', $string);
-            // LATIN SMALL LETTER U WITH DOUBLE ACUTE
-            $string = str_replace("\373", '&#369;', $string);
-            // LATIN SMALL LETTER U WITH DIAERESIS
-            $string = str_replace("\374", '&#252;', $string);
-            // LATIN SMALL LETTER Y WITH ACUTE
-            $string = str_replace("\375", '&#253;', $string);
-            // LATIN SMALL LETTER T WITH CEDILLA
-            $string = str_replace("\376", '&#355;', $string);
-            // DOT ABOVE
-            $string = str_replace("\377", '&#729;', $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", '&#160;', $string);
+      // LATIN CAPITAL LETTER A WITH OGONEK
+      $string = str_replace("\241", '&#260;', $string);
+      // BREVE
+      $string = str_replace("\242", '&#728;', $string);
+      // LATIN CAPITAL LETTER L WITH STROKE
+      $string = str_replace("\243", '&#321;', $string);
+      // CURRENCY SIGN
+      $string = str_replace("\244", '&#164;', $string);
+      // LATIN CAPITAL LETTER L WITH CARON
+      $string = str_replace("\245", '&#317;', $string);
+      // LATIN CAPITAL LETTER S WITH ACUTE
+      $string = str_replace("\246", '&#346;', $string);
+      // SECTION SIGN
+      $string = str_replace("\247", '&#167;', $string);
+      // DIAERESIS
+      $string = str_replace("\250", '&#168;', $string);
+      // LATIN CAPITAL LETTER S WITH CARON
+      $string = str_replace("\251", '&#352;', $string);
+      // LATIN CAPITAL LETTER S WITH CEDILLA
+      $string = str_replace("\252", '&#350;', $string);
+      // LATIN CAPITAL LETTER T WITH CARON
+      $string = str_replace("\253", '&#356;', $string);
+      // LATIN CAPITAL LETTER Z WITH ACUTE
+      $string = str_replace("\254", '&#377;', $string);
+      // SOFT HYPHEN
+      $string = str_replace("\255", '&#173;', $string);
+      // LATIN CAPITAL LETTER Z WITH CARON
+      $string = str_replace("\256", '&#381;', $string);
+      // LATIN CAPITAL LETTER Z WITH DOT ABOVE
+      $string = str_replace("\257", '&#379;', $string);
+      // DEGREE SIGN
+      $string = str_replace("\260", '&#176;', $string);
+      // LATIN SMALL LETTER A WITH OGONEK
+      $string = str_replace("\261", '&#261;', $string);
+      // OGONEK
+      $string = str_replace("\262", '&#731;', $string);
+      // LATIN SMALL LETTER L WITH STROKE
+      $string = str_replace("\263", '&#322;', $string);
+      // ACUTE ACCENT
+      $string = str_replace("\264", '&#180;', $string);
+      // LATIN SMALL LETTER L WITH CARON
+      $string = str_replace("\265", '&#318;', $string);
+      // LATIN SMALL LETTER S WITH ACUTE
+      $string = str_replace("\266", '&#347;', $string);
+      // CARON
+      $string = str_replace("\267", '&#711;', $string);
+      // CEDILLA
+      $string = str_replace("\270", '&#184;', $string);
+      // LATIN SMALL LETTER S WITH CARON
+      $string = str_replace("\271", '&#353;', $string);
+      // LATIN SMALL LETTER S WITH CEDILLA
+      $string = str_replace("\272", '&#351;', $string);
+      // LATIN SMALL LETTER T WITH CARON
+      $string = str_replace("\273", '&#357;', $string);
+      // LATIN SMALL LETTER Z WITH ACUTE
+      $string = str_replace("\274", '&#378;', $string);
+      // DOUBLE ACUTE ACCENT
+      $string = str_replace("\275", '&#733;', $string);
+      // LATIN SMALL LETTER Z WITH CARON
+      $string = str_replace("\276", '&#382;', $string);
+      // LATIN SMALL LETTER Z WITH DOT ABOVE
+      $string = str_replace("\277", '&#380;', $string);
+      // LATIN CAPITAL LETTER R WITH ACUTE
+      $string = str_replace("\300", '&#340;', $string);
+      // LATIN CAPITAL LETTER A WITH ACUTE
+      $string = str_replace("\301", '&#193;', $string);
+      // LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+      $string = str_replace("\302", '&#194;', $string);
+      // LATIN CAPITAL LETTER A WITH BREVE
+      $string = str_replace("\303", '&#258;', $string);
+      // LATIN CAPITAL LETTER A WITH DIAERESIS
+      $string = str_replace("\304", '&#196;', $string);
+      // LATIN CAPITAL LETTER L WITH ACUTE
+      $string = str_replace("\305", '&#313;', $string);
+      // LATIN CAPITAL LETTER C WITH ACUTE
+      $string = str_replace("\306", '&#262;', $string);
+      // LATIN CAPITAL LETTER C WITH CEDILLA
+      $string = str_replace("\307", '&#199;', $string);
+      // LATIN CAPITAL LETTER C WITH CARON
+      $string = str_replace("\310", '&#268;', $string);
+      // LATIN CAPITAL LETTER E WITH ACUTE
+      $string = str_replace("\311", '&#201;', $string);
+      // LATIN CAPITAL LETTER E WITH OGONEK
+      $string = str_replace("\312", '&#280;', $string);
+      // LATIN CAPITAL LETTER E WITH DIAERESIS
+      $string = str_replace("\313", '&#203;', $string);
+      // LATIN CAPITAL LETTER E WITH CARON
+      $string = str_replace("\314", '&#282;', $string);
+      // LATIN CAPITAL LETTER I WITH ACUTE
+      $string = str_replace("\315", '&#205;', $string);
+      // LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+      $string = str_replace("\316", '&#206;', $string);
+      // LATIN CAPITAL LETTER D WITH CARON
+      $string = str_replace("\317", '&#270;', $string);
+      // LATIN CAPITAL LETTER D WITH STROKE
+      $string = str_replace("\320", '&#272;', $string);
+      // LATIN CAPITAL LETTER N WITH ACUTE
+      $string = str_replace("\321", '&#323;', $string);
+      // LATIN CAPITAL LETTER N WITH CARON
+      $string = str_replace("\322", '&#327;', $string);
+      // LATIN CAPITAL LETTER O WITH ACUTE
+      $string = str_replace("\323", '&#211;', $string);
+      // LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+      $string = str_replace("\324", '&#212;', $string);
+      // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+      $string = str_replace("\325", '&#336;', $string);
+      // LATIN CAPITAL LETTER O WITH DIAERESIS
+      $string = str_replace("\326", '&#214;', $string);
+      // MULTIPLICATION SIGN
+      $string = str_replace("\327", '&#215;', $string);
+      // LATIN CAPITAL LETTER R WITH CARON
+      $string = str_replace("\330", '&#344;', $string);
+      // LATIN CAPITAL LETTER U WITH RING ABOVE
+      $string = str_replace("\331", '&#366;', $string);
+      // LATIN CAPITAL LETTER U WITH ACUTE
+      $string = str_replace("\332", '&#218;', $string);
+      // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+      $string = str_replace("\333", '&#368;', $string);
+      // LATIN CAPITAL LETTER U WITH DIAERESIS
+      $string = str_replace("\334", '&#220;', $string);
+      // LATIN CAPITAL LETTER Y WITH ACUTE
+      $string = str_replace("\335", '&#221;', $string);
+      // LATIN CAPITAL LETTER T WITH CEDILLA
+      $string = str_replace("\336", '&#354;', $string);
+      // LATIN SMALL LETTER SHARP S
+      $string = str_replace("\337", '&#223;', $string);
+      // LATIN SMALL LETTER R WITH ACUTE
+      $string = str_replace("\340", '&#341;', $string);
+      // LATIN SMALL LETTER A WITH ACUTE
+      $string = str_replace("\341", '&#225;', $string);
+      // LATIN SMALL LETTER A WITH CIRCUMFLEX
+      $string = str_replace("\342", '&#226;', $string);
+      // LATIN SMALL LETTER A WITH BREVE
+      $string = str_replace("\343", '&#259;', $string);
+      // LATIN SMALL LETTER A WITH DIAERESIS
+      $string = str_replace("\344", '&#228;', $string);
+      // LATIN SMALL LETTER L WITH ACUTE
+      $string = str_replace("\345", '&#314;', $string);
+      // LATIN SMALL LETTER C WITH ACUTE
+      $string = str_replace("\346", '&#263;', $string);
+      // LATIN SMALL LETTER C WITH CEDILLA
+      $string = str_replace("\347", '&#231;', $string);
+      // LATIN SMALL LETTER C WITH CARON
+      $string = str_replace("\350", '&#269;', $string);
+      // LATIN SMALL LETTER E WITH ACUTE
+      $string = str_replace("\351", '&#233;', $string);
+      // LATIN SMALL LETTER E WITH OGONEK
+      $string = str_replace("\352", '&#281;', $string);
+      // LATIN SMALL LETTER E WITH DIAERESIS
+      $string = str_replace("\353", '&#235;', $string);
+      // LATIN SMALL LETTER E WITH CARON
+      $string = str_replace("\354", '&#283;', $string);
+      // LATIN SMALL LETTER I WITH ACUTE
+      $string = str_replace("\355", '&#237;', $string);
+      // LATIN SMALL LETTER I WITH CIRCUMFLEX
+      $string = str_replace("\356", '&#238;', $string);
+      // LATIN SMALL LETTER D WITH CARON
+      $string = str_replace("\357", '&#271;', $string);
+      // LATIN SMALL LETTER D WITH STROKE
+      $string = str_replace("\360", '&#273;', $string);
+      // LATIN SMALL LETTER N WITH ACUTE
+      $string = str_replace("\361", '&#324;', $string);
+      // LATIN SMALL LETTER N WITH CARON
+      $string = str_replace("\362", '&#328;', $string);
+      // LATIN SMALL LETTER O WITH ACUTE
+      $string = str_replace("\363", '&#243;', $string);
+      // LATIN SMALL LETTER O WITH CIRCUMFLEX
+      $string = str_replace("\364", '&#244;', $string);
+      // LATIN SMALL LETTER O WITH DOUBLE ACUTE
+      $string = str_replace("\365", '&#337;', $string);
+      // LATIN SMALL LETTER O WITH DIAERESIS
+      $string = str_replace("\366", '&#246;', $string);
+      // DIVISION SIGN
+      $string = str_replace("\367", '&#247;', $string);
+      // LATIN SMALL LETTER R WITH CARON
+      $string = str_replace("\370", '&#345;', $string);
+      // LATIN SMALL LETTER U WITH RING ABOVE
+      $string = str_replace("\371", '&#367;', $string);
+      // LATIN SMALL LETTER U WITH ACUTE
+      $string = str_replace("\372", '&#250;', $string);
+      // LATIN SMALL LETTER U WITH DOUBLE ACUTE
+      $string = str_replace("\373", '&#369;', $string);
+      // LATIN SMALL LETTER U WITH DIAERESIS
+      $string = str_replace("\374", '&#252;', $string);
+      // LATIN SMALL LETTER Y WITH ACUTE
+      $string = str_replace("\375", '&#253;', $string);
+      // LATIN SMALL LETTER T WITH CEDILLA
+      $string = str_replace("\376", '&#355;', $string);
+      // DOT ABOVE
+      $string = str_replace("\377", '&#729;', $string);
+
       return $string;
    }
 
    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", '&#160;', $string);
-            $string = str_replace("\241", '&#8216;', $string);
-            $string = str_replace("\242", '&#8217;', $string);
-            $string = str_replace("\243", '&#163;', $string);
-            $string = str_replace("\246", '&#166;', $string);
-            $string = str_replace("\247", '&#167;', $string);
-            $string = str_replace("\250", '&#168;', $string);
-            $string = str_replace("\251", '&#169;', $string);
-            $string = str_replace("\253", '&#171;', $string);
-            $string = str_replace("\254", '&#172;', $string);
-            $string = str_replace("\255", '&#173;', $string);
-            $string = str_replace("\257", '&#8213;', $string);
-            $string = str_replace("\260", '&#176;', $string);
-            $string = str_replace("\261", '&#177;', $string);
-            $string = str_replace("\262", '&#178;', $string);
-            $string = str_replace("\263", '&#179;', $string);
-         
-            // Horizontal bar (parentheki pavla)
-            $string = str_replace ("\257", '&#8213;', $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", '&#183;', $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", '&#160;', $string);
+      $string = str_replace("\241", '&#8216;', $string);
+      $string = str_replace("\242", '&#8217;', $string);
+      $string = str_replace("\243", '&#163;', $string);
+      $string = str_replace("\246", '&#166;', $string);
+      $string = str_replace("\247", '&#167;', $string);
+      $string = str_replace("\250", '&#168;', $string);
+      $string = str_replace("\251", '&#169;', $string);
+      $string = str_replace("\253", '&#171;', $string);
+      $string = str_replace("\254", '&#172;', $string);
+      $string = str_replace("\255", '&#173;', $string);
+      $string = str_replace("\257", '&#8213;', $string);
+      $string = str_replace("\260", '&#176;', $string);
+      $string = str_replace("\261", '&#177;', $string);
+      $string = str_replace("\262", '&#178;', $string);
+      $string = str_replace("\263", '&#179;', $string);
+      
+      // Horizontal bar (parentheki pavla)
+      $string = str_replace ("\257", '&#8213;', $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", '&#183;', $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", '&#187;', $string);
+      // 11/11 (0xBB) Right angle quotation mark is the same as in
+      // iso-8859-1
+      $string = str_replace("\273", '&#187;', $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;
    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", '&#9472;', $string);
-         $string = str_replace("\201", '&#9474;', $string);
-         $string = str_replace("\202", '&#9484;', $string);
-         $string = str_replace("\203", '&#9488;', $string);
-         $string = str_replace("\204", '&#9492;', $string);
-         $string = str_replace("\205", '&#9496;', $string);
-         $string = str_replace("\206", '&#9500;', $string);
-         $string = str_replace("\207", '&#9508;', $string);
-         $string = str_replace("\210", '&#9516;', $string);
-         $string = str_replace("\211", '&#9524;', $string);
-         $string = str_replace("\212", '&#9532;', $string);
-         $string = str_replace("\213", '&#9600;', $string);
-         $string = str_replace("\214", '&#9604;', $string);
-         $string = str_replace("\215", '&#9608;', $string);
-         $string = str_replace("\216", '&#9612;', $string);
-         $string = str_replace("\217", '&#9616;', $string);
-         $string = str_replace("\220", '&#9617;', $string);
-         $string = str_replace("\221", '&#9618;', $string);
-         $string = str_replace("\222", '&#9619;', $string);
-         $string = str_replace("\223", '&#8992;', $string);
-         $string = str_replace("\224", '&#9632;', $string);
-         $string = str_replace("\225", '&#8729;', $string);
-         $string = str_replace("\226", '&#8730;', $string);
-         $string = str_replace("\227", '&#8776;', $string);
-         $string = str_replace("\230", '&#8804;', $string);
-         $string = str_replace("\231", '&#8805;', $string);
-         $string = str_replace("\232", '&#160;', $string);
-         $string = str_replace("\233", '&#8993;', $string);
-         $string = str_replace("\234", '&#176;', $string);
-         $string = str_replace("\235", '&#178;', $string);
-         $string = str_replace("\236", '&#183;', $string);
-         $string = str_replace("\237", '&#247;', $string);
-         $string = str_replace("\240", '&#9552;', $string);
-         $string = str_replace("\241", '&#9553;', $string);
-         $string = str_replace("\242", '&#9554;', $string);
-         $string = str_replace("\243", '&#1105;', $string);
-         $string = str_replace("\244", '&#9555;', $string);
-         $string = str_replace("\245", '&#9556;', $string);
-         $string = str_replace("\246", '&#9557;', $string);
-         $string = str_replace("\247", '&#9558;', $string);
-         $string = str_replace("\250", '&#9559;', $string);
-         $string = str_replace("\251", '&#9560;', $string);
-         $string = str_replace("\252", '&#9561;', $string);
-         $string = str_replace("\253", '&#9562;', $string);
-         $string = str_replace("\254", '&#9563;', $string);
-         $string = str_replace("\255", '&#9564;', $string);
-         $string = str_replace("\256", '&#9565;', $string);
-         $string = str_replace("\257", '&#9566;', $string);
-         $string = str_replace("\260", '&#9567;', $string);
-         $string = str_replace("\261", '&#9568;', $string);
-         $string = str_replace("\262", '&#9569;', $string);
-         $string = str_replace("\263", '&#1025;', $string);
-         $string = str_replace("\264", '&#9570;', $string);
-         $string = str_replace("\265", '&#9571;', $string);
-         $string = str_replace("\266", '&#9572;', $string);
-         $string = str_replace("\267", '&#9573;', $string);
-         $string = str_replace("\270", '&#9574;', $string);
-         $string = str_replace("\271", '&#9575;', $string);
-         $string = str_replace("\272", '&#9576;', $string);
-         $string = str_replace("\273", '&#9577;', $string);
-         $string = str_replace("\274", '&#9578;', $string);
-         $string = str_replace("\275", '&#9579;', $string);
-         $string = str_replace("\276", '&#9580;', $string);
-         $string = str_replace("\277", '&#169;', $string);
-         $string = str_replace("\300", '&#1102;', $string);
-         $string = str_replace("\301", '&#1072;', $string);
-         $string = str_replace("\302", '&#1073;', $string);
-         $string = str_replace("\303", '&#1094;', $string);
-         $string = str_replace("\304", '&#1076;', $string);
-         $string = str_replace("\305", '&#1077;', $string);
-         $string = str_replace("\306", '&#1092;', $string);
-         $string = str_replace("\307", '&#1075;', $string);
-         $string = str_replace("\310", '&#1093;', $string);
-         $string = str_replace("\311", '&#1080;', $string);
-         $string = str_replace("\312", '&#1081;', $string);
-         $string = str_replace("\313", '&#1082;', $string);
-         $string = str_replace("\314", '&#1083;', $string);
-         $string = str_replace("\315", '&#1084;', $string);
-         $string = str_replace("\316", '&#1085;', $string);
-         $string = str_replace("\317", '&#1086;', $string);
-         $string = str_replace("\320", '&#1087;', $string);
-         $string = str_replace("\321", '&#1103;', $string);
-         $string = str_replace("\322", '&#1088;', $string);
-         $string = str_replace("\323", '&#1089;', $string);
-         $string = str_replace("\324", '&#1090;', $string);
-         $string = str_replace("\325", '&#1091;', $string);
-         $string = str_replace("\326", '&#1078;', $string);
-         $string = str_replace("\327", '&#1074;', $string);
-         $string = str_replace("\330", '&#1100;', $string);
-         $string = str_replace("\331", '&#1099;', $string);
-         $string = str_replace("\332", '&#1079;', $string);
-         $string = str_replace("\333", '&#1096;', $string);
-         $string = str_replace("\334", '&#1101;', $string);
-         $string = str_replace("\335", '&#1097;', $string);
-         $string = str_replace("\336", '&#1095;', $string);
-         $string = str_replace("\337", '&#1098;', $string);
-         $string = str_replace("\340", '&#1070;', $string);
-         $string = str_replace("\341", '&#1040;', $string);
-         $string = str_replace("\342", '&#1041;', $string);
-         $string = str_replace("\343", '&#1062;', $string);
-         $string = str_replace("\344", '&#1044;', $string);
-         $string = str_replace("\345", '&#1045;', $string);
-         $string = str_replace("\346", '&#1060;', $string);
-         $string = str_replace("\347", '&#1043;', $string);
-         $string = str_replace("\350", '&#1061;', $string);
-         $string = str_replace("\351", '&#1048;', $string);
-         $string = str_replace("\352", '&#1049;', $string);
-         $string = str_replace("\353", '&#1050;', $string);
-         $string = str_replace("\354", '&#1051;', $string);
-         $string = str_replace("\355", '&#1052;', $string);
-         $string = str_replace("\356", '&#1053;', $string);
-         $string = str_replace("\357", '&#1054;', $string);
-         $string = str_replace("\360", '&#1055;', $string);
-         $string = str_replace("\361", '&#1071;', $string);
-         $string = str_replace("\362", '&#1056;', $string);
-         $string = str_replace("\363", '&#1057;', $string);
-         $string = str_replace("\364", '&#1058;', $string);
-         $string = str_replace("\365", '&#1059;', $string);
-         $string = str_replace("\366", '&#1046;', $string);
-         $string = str_replace("\367", '&#1042;', $string);
-         $string = str_replace("\370", '&#1068;', $string);
-         $string = str_replace("\371", '&#1067;', $string);
-         $string = str_replace("\372", '&#1047;', $string);
-         $string = str_replace("\373", '&#1064;', $string);
-         $string = str_replace("\374", '&#1069;', $string);
-         $string = str_replace("\375", '&#1065;', $string);
-         $string = str_replace("\376", '&#1063;', $string);
-         $string = str_replace("\377", '&#1066;', $string);
-
-         return $string;
-      }
+        
+      // Convert to Unicode HTML entities.
+      // This code is rather ineffective.
+      $string = str_replace("\200", '&#9472;', $string);
+      $string = str_replace("\201", '&#9474;', $string);
+      $string = str_replace("\202", '&#9484;', $string);
+      $string = str_replace("\203", '&#9488;', $string);
+      $string = str_replace("\204", '&#9492;', $string);
+      $string = str_replace("\205", '&#9496;', $string);
+      $string = str_replace("\206", '&#9500;', $string);
+      $string = str_replace("\207", '&#9508;', $string);
+      $string = str_replace("\210", '&#9516;', $string);
+      $string = str_replace("\211", '&#9524;', $string);
+      $string = str_replace("\212", '&#9532;', $string);
+      $string = str_replace("\213", '&#9600;', $string);
+      $string = str_replace("\214", '&#9604;', $string);
+      $string = str_replace("\215", '&#9608;', $string);
+      $string = str_replace("\216", '&#9612;', $string);
+      $string = str_replace("\217", '&#9616;', $string);
+      $string = str_replace("\220", '&#9617;', $string);
+      $string = str_replace("\221", '&#9618;', $string);
+      $string = str_replace("\222", '&#9619;', $string);
+      $string = str_replace("\223", '&#8992;', $string);
+      $string = str_replace("\224", '&#9632;', $string);
+      $string = str_replace("\225", '&#8729;', $string);
+      $string = str_replace("\226", '&#8730;', $string);
+      $string = str_replace("\227", '&#8776;', $string);
+      $string = str_replace("\230", '&#8804;', $string);
+      $string = str_replace("\231", '&#8805;', $string);
+      $string = str_replace("\232", '&#160;', $string);
+      $string = str_replace("\233", '&#8993;', $string);
+      $string = str_replace("\234", '&#176;', $string);
+      $string = str_replace("\235", '&#178;', $string);
+      $string = str_replace("\236", '&#183;', $string);
+      $string = str_replace("\237", '&#247;', $string);
+      $string = str_replace("\240", '&#9552;', $string);
+      $string = str_replace("\241", '&#9553;', $string);
+      $string = str_replace("\242", '&#9554;', $string);
+      $string = str_replace("\243", '&#1105;', $string);
+      $string = str_replace("\244", '&#9555;', $string);
+      $string = str_replace("\245", '&#9556;', $string);
+      $string = str_replace("\246", '&#9557;', $string);
+      $string = str_replace("\247", '&#9558;', $string);
+      $string = str_replace("\250", '&#9559;', $string);
+      $string = str_replace("\251", '&#9560;', $string);
+      $string = str_replace("\252", '&#9561;', $string);
+      $string = str_replace("\253", '&#9562;', $string);
+      $string = str_replace("\254", '&#9563;', $string);
+      $string = str_replace("\255", '&#9564;', $string);
+      $string = str_replace("\256", '&#9565;', $string);
+      $string = str_replace("\257", '&#9566;', $string);
+      $string = str_replace("\260", '&#9567;', $string);
+      $string = str_replace("\261", '&#9568;', $string);
+      $string = str_replace("\262", '&#9569;', $string);
+      $string = str_replace("\263", '&#1025;', $string);
+      $string = str_replace("\264", '&#9570;', $string);
+      $string = str_replace("\265", '&#9571;', $string);
+      $string = str_replace("\266", '&#9572;', $string);
+      $string = str_replace("\267", '&#9573;', $string);
+      $string = str_replace("\270", '&#9574;', $string);
+      $string = str_replace("\271", '&#9575;', $string);
+      $string = str_replace("\272", '&#9576;', $string);
+      $string = str_replace("\273", '&#9577;', $string);
+      $string = str_replace("\274", '&#9578;', $string);
+      $string = str_replace("\275", '&#9579;', $string);
+      $string = str_replace("\276", '&#9580;', $string);
+      $string = str_replace("\277", '&#169;', $string);
+      $string = str_replace("\300", '&#1102;', $string);
+      $string = str_replace("\301", '&#1072;', $string);
+      $string = str_replace("\302", '&#1073;', $string);
+      $string = str_replace("\303", '&#1094;', $string);
+      $string = str_replace("\304", '&#1076;', $string);
+      $string = str_replace("\305", '&#1077;', $string);
+      $string = str_replace("\306", '&#1092;', $string);
+      $string = str_replace("\307", '&#1075;', $string);
+      $string = str_replace("\310", '&#1093;', $string);
+      $string = str_replace("\311", '&#1080;', $string);
+      $string = str_replace("\312", '&#1081;', $string);
+      $string = str_replace("\313", '&#1082;', $string);
+      $string = str_replace("\314", '&#1083;', $string);
+      $string = str_replace("\315", '&#1084;', $string);
+      $string = str_replace("\316", '&#1085;', $string);
+      $string = str_replace("\317", '&#1086;', $string);
+      $string = str_replace("\320", '&#1087;', $string);
+      $string = str_replace("\321", '&#1103;', $string);
+      $string = str_replace("\322", '&#1088;', $string);
+      $string = str_replace("\323", '&#1089;', $string);
+      $string = str_replace("\324", '&#1090;', $string);
+      $string = str_replace("\325", '&#1091;', $string);
+      $string = str_replace("\326", '&#1078;', $string);
+      $string = str_replace("\327", '&#1074;', $string);
+      $string = str_replace("\330", '&#1100;', $string);
+      $string = str_replace("\331", '&#1099;', $string);
+      $string = str_replace("\332", '&#1079;', $string);
+      $string = str_replace("\333", '&#1096;', $string);
+      $string = str_replace("\334", '&#1101;', $string);
+      $string = str_replace("\335", '&#1097;', $string);
+      $string = str_replace("\336", '&#1095;', $string);
+      $string = str_replace("\337", '&#1098;', $string);
+      $string = str_replace("\340", '&#1070;', $string);
+      $string = str_replace("\341", '&#1040;', $string);
+      $string = str_replace("\342", '&#1041;', $string);
+      $string = str_replace("\343", '&#1062;', $string);
+      $string = str_replace("\344", '&#1044;', $string);
+      $string = str_replace("\345", '&#1045;', $string);
+      $string = str_replace("\346", '&#1060;', $string);
+      $string = str_replace("\347", '&#1043;', $string);
+      $string = str_replace("\350", '&#1061;', $string);
+      $string = str_replace("\351", '&#1048;', $string);
+      $string = str_replace("\352", '&#1049;', $string);
+      $string = str_replace("\353", '&#1050;', $string);
+      $string = str_replace("\354", '&#1051;', $string);
+      $string = str_replace("\355", '&#1052;', $string);
+      $string = str_replace("\356", '&#1053;', $string);
+      $string = str_replace("\357", '&#1054;', $string);
+      $string = str_replace("\360", '&#1055;', $string);
+      $string = str_replace("\361", '&#1071;', $string);
+      $string = str_replace("\362", '&#1056;', $string);
+      $string = str_replace("\363", '&#1057;', $string);
+      $string = str_replace("\364", '&#1058;', $string);
+      $string = str_replace("\365", '&#1059;', $string);
+      $string = str_replace("\366", '&#1046;', $string);
+      $string = str_replace("\367", '&#1042;', $string);
+      $string = str_replace("\370", '&#1068;', $string);
+      $string = str_replace("\371", '&#1067;', $string);
+      $string = str_replace("\372", '&#1047;', $string);
+      $string = str_replace("\373", '&#1064;', $string);
+      $string = str_replace("\374", '&#1069;', $string);
+      $string = str_replace("\375", '&#1065;', $string);
+      $string = str_replace("\376", '&#1063;', $string);
+      $string = str_replace("\377", '&#1066;', $string);
+      
+      return $string;
    }
 
 
        $use_gettext = true;
           
 
-   // Avoid warnings/errors   
+   // Avoid warnings/errors if gettext is not installed
    if (! function_exists('_')) {
       function _($str) { return $str; };
    }
    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;
index 7c4e41653f063782b402dddaeeff9abd71be43bd..824501ce3a4352b770a9df654186cf6eba7e015c 100644 (file)
@@ -5,7 +5,9 @@
     **  $Id$
     **/
 
-   $imap_php = true;
+   if (defined ('imap_php'))
+      return; 
+   define ('imap_php', true); 
 
    $imap_backend = 'imap';
    
index 8e2dc16b2b9b9af100ea4d5fd50e7c1834618730..b1d0b752f7b94ceb43f822f303b1cd364bd0809d 100755 (executable)
@@ -7,6 +7,11 @@
     **  $Id$
     **/
 
+   if (defined ('imap_general_php'))
+      return;
+   define ('imap_general_php', true);
+
+   global $imap_general_debug;
    $imap_general_debug = false;
 
    /******************************************************************************
       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;
-}
+   }
 
 
    /******************************************************************************
index b121978433b4d65180d0d1e4191034a79c6f3258..fe1baee55e4ae43cdcd735b0b571c1672ed9694f 100755 (executable)
@@ -7,6 +7,10 @@
     **  $Id$
     **/
 
+   if (defined ('imap_mailbox_php'))
+      return;
+   define ('imap_mailbox_php', true);
+
    /******************************************************************************
     **  Expunges a mailbox 
     ******************************************************************************/
     **  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);
 
index 123b4e560b965902883cc077d74ce2f2c0738384..2c47d5abf5ae5f80dbb2ae67875176eea3225fa9 100755 (executable)
@@ -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
index a86ddc7b190a4d656c89c97ad127b34b3311c9af..d628446146432564cfc9aad319900a42b296459c 100644 (file)
@@ -1,20 +1,19 @@
 <?php 
-/******************************************************************
- ** IMAP SEARCH ROUTIES
- ** $Id$
- *****************************************************************/
-   if (!isset($imap_php))
-      include("../functions/imap.php");
-   if (!isset($date_php))
-      include("../functions/date.php");
-   if (!isset($array_php))
-      include("../functions/array.php");
-   if (!isset($mailbox_display_php))
-      include("../functions/mailbox_display.php");
-   if (!isset($mime_php))
-      include("../functions/mime.php");
-
-   $imap_search_php = true;
+   /******************************************************************
+    ** IMAP SEARCH ROUTIES
+    ** $Id$
+    *****************************************************************/
+    
+   if (defined ('imap_search_php'))
+      return;
+   define ('imap_search_php', true);
+   
+   include("../functions/imap.php");
+   include("../functions/date.php");
+   include("../functions/array.php");
+   include("../functions/mailbox_display.php");
+   include("../functions/mime.php");
+
 
 function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) {
    global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order;
index 5014a54ec6d98958ccac0ccdf4b37a40d954a882..750edfdb859112c2d8b0866342c9b7a7610d7f01 100644 (file)
@@ -9,7 +9,9 @@
     **  $Id$
     **/
 
-   $mailbox_display_php = true;
+   if (defined('mailbox_display_php'))
+       return;
+   define('mailbox_display_php', true);
 
    function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, $where, $what) {
       global $checkall;
       echo '</TD></TR>';
 
       echo "<TR><TD BGCOLOR=\"$color[0]\">";
-      echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=\"$color[0]\">";
+      echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">";
       echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
 
       $urlMailbox=urlencode($mailbox);
index 90b8b37a0a8e6e7e4d137fc63a5e9b1d76175209..5958d90c082ffa82874230e012e655f17f32a9d5 100644 (file)
@@ -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 **/
 
index 9e95b3b364f6ac63f1ffff24e3f02e257a9e36df..a9fbdd3b33d2d2bfc84128089265f921fd849212 100644 (file)
@@ -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"));
index 46cc9eef46ac37bad10da5b87cbfe88eb0c2d4b0..a6371dfa62e1c744e720e055451b2051090fe31e 100644 (file)
  **/
 
 
-   $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();
index aadbcb3f68a6ab6a4358401cc51396d5af181363..aaa263b2aa4550a3407b37f5c3c37eed44757dd1 100644 (file)
@@ -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();
 
index 99fc019acb61c0212de384c33c9de738bffeed55..3b9e657911483b6bb39b18b66d598f02cbd18b0d 100644 (file)
@@ -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)) {
 
 
    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;
index 1cf6be0d74acb36f46161f7e33b6679a68757e63..dea7319aa1730b1431b3ed1fddd77e582e62c2db 100644 (file)
@@ -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);
 
 
    //*************************************************************************
 
    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;
    }
 
    /* SquirrelMail version number -- DO NOT CHANGE */
+   global $version;
    $version = '1.1.0 [cvs]';
 
 
 
    }
 
-   // Depreciated.  :-)  I always wanted to say that.
-   function replace_spaces ($string) {
-      return str_replace(' ', '&nbsp;', $string);
-   }
-
    function get_location () {
       # This determines the location to forward to relative
       # to your server.  If this doesnt work correctly for
index 9871d45a6e30d907446b29eea764a55f88371033..01e318daf4566c547eccc2be3d9d0717bae86d00 100644 (file)
@@ -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) {
          echo $tree[$index]['value'] . '<br>';
       }
    }
-?>
\ No newline at end of file
+?>
index 6a9e7d41d9bfe2fd1155d9383c0d6955ef79b021..2fb2d3a67450725354f0384b08b6023a9fea1257 100644 (file)
@@ -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", 
        '.&nbsp;', '&nbsp;', ')', '(', '&quot;', '&lt;', '&gt;', '.<', 
        ']', '[', '{', '}', "\240");