requireSecureConnection doesn't belong inside the Crypt class
authorChuck Hagenbuch <chuck@horde.org>
Mon, 6 Apr 2009 14:13:30 +0000 (10:13 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 12 Apr 2009 00:30:09 +0000 (20:30 -0400)
framework/Crypt/lib/Horde/Crypt.php

index 5fb272e..33fa119 100644 (file)
@@ -96,42 +96,6 @@ class Horde_Crypt
     }
 
     /**
-     * Throws exception if not using a secure connection.
-     *
-     * @throws Horde_Exception
-     */
-    public function requireSecureConnection()
-    {
-        if ($GLOBALS['browser']->usingSSLConnection()) {
-            return;
-        }
-
-        if (!empty($GLOBALS['conf']['safe_ips'])) {
-            if (reset($GLOBALS['conf']['safe_ips']) == '*') {
-                return;
-            }
-
-            /* $_SERVER['HTTP_X_FORWARDED_FOR'] is user data and not
-             * reliable. We dont' consult it for safe IPs. We also
-             * have to assume that if it is present, the user is
-             * coming through a proxy server. If so, we don't count
-             * any non-SSL connection as safe, no matter the source
-             * IP. */
-            if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-                $remote_addr = $_SERVER['REMOTE_ADDR'];
-                foreach ($GLOBALS['conf']['safe_ips'] as $safe_ip) {
-                    $safe_ip = preg_replace('/(\.0)*$/', '', $safe_ip);
-                    if (strpos($remote_addr, $safe_ip) === 0) {
-                        return;
-                    }
-                }
-            }
-        }
-
-        throw new Horde_Exception (_("The encryption features require a secure web connection."));
-    }
-
-    /**
      * Encrypt the requested data.
      * This method should be provided by all classes that extend Horde_Crypt.
      *