Revert changes in revision 14302. Revision 14302 should only have changed functions...
[squirrelmail.git] / functions / prefs.php
index 5b618d5623d6d57fb933e4b3376b7a03756ddeda..80de4f044de5a4a94115dcc0b7f75f65b10df4a5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This contains functions for filebased user prefs locations
  *
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2012 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -117,8 +117,15 @@ function getHashedDir($username, $dir, $hash_dirs = '') {
  * @since 1.2.0
  */
 function computeHashDirs($username) {
-    /* Compute the hash for this user and extract the hash directories. */
-    $hash = base_convert(crc32($username), 10, 16);
+    /* Compute the hash for this user and extract the hash directories.  */ 
+    /* Note that the crc32() function result will be different on 32 and */ 
+    /* 64 bit systems, thus the hack below.                              */
+    $crc = crc32($username);
+    if ($crc & 0x80000000) {
+        $crc ^= 0xffffffff;
+        $crc += 1;
+    }
+    $hash = base_convert($crc, 10, 16);
     $hash_dirs = array();
     for ($h = 0; $h < 4; ++ $h) {
         $hash_dirs[] = substr($hash, $h, 1);