* Auto-detects if form is 'compose.php' and if PHP is giving us bad form
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 7 Feb 2001 04:24:43 +0000 (04:24 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 7 Feb 2001 04:24:43 +0000 (04:24 +0000)
  data and will only trim when appropriate (the multipart/form-data form)
* Trimming method doesn't eliminate extra newlines -- just the first one.
* Cleaned up the code a bit.

* This code should be removed somewhat soon after RedHat officially releases
  a good binary package and after Konqueror works.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1069 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/strings.php

index d467018ce66c394949192e07135d4b292ac5e374..d343228029c10a1a35c0cb1702fbe147f341c7a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 Version 1.0.2 -- DEVELOPMENT
 ----------------------------
-- Added $fix_form_endlines option in strings.php to workaround 
-    Konq/PHP4.0.3 problems
+- Added a workaround for RedHat's 4.0.4pl1-3 binary package  (It's also 
+  the same workaround for Konqueror and other PHP installations?)
 - Select All works through the search
 - Better escaped string handling from POST variables
 - Many more code cleanups and optimizations
index e1a352825b230246939413beb5a61f71c32fae14..8425c4105389d58ff344a204af2527e3e3385a9b 100644 (file)
             RemoveSlashes($HTTP_GET_VARS);
        }
    }
-   
-   if (isset($fix_form_endlines) && $fix_form_endlines) {
+
+   // Auto-detection
+   //
+   // if $send (the form button's name) contains "\n" as the first char
+   // and the script is compose.php, then trim everything.  Otherwise,
+   // we don't have to worry.
+   global $send, $PHP_SELF;
+   if (isset($send) && substr($send, 0, 1) == "\n" &&
+       substr($PHP_SELF, -12) == "/compose.php")
+   {
       if ($REQUEST_METHOD == "POST") {
          TrimArray($HTTP_POST_VARS);
       } else {
    }
 
    //**************************************************************************
-   // Trims every element in the array and returns a  new array.  
+   // Trims every element in the array
    //**************************************************************************
    function TrimArray(&$array) {
       foreach ($array as $k => $v) {
          global $$k;
          if (is_array($$k)) {
             foreach ($$k as $k2 => $v2) {
-               $newArray[trim($k2)] = trim($v2);
+              $$k[$k2] = substr($v2, 1);
             }
-            $$k = $newArray;
          } else {
-            $$k = trim($v);
+            $$k = substr($v, 1);
          }
       }
    }