| | |
| | | const ERROR_INVALID_REQUEST = 1; |
| | | const ERROR_INVALID_HOST = 2; |
| | | const ERROR_COOKIES_DISABLED = 3; |
| | | const ERROR_RATE_LIMIT = 4; |
| | | |
| | | |
| | | /** |
| | |
| | | // user already registered -> overwrite username |
| | | if ($user = rcube_user::query($username, $host)) { |
| | | $username = $user->data['username']; |
| | | |
| | | // Brute-force prevention |
| | | if ($user->is_locked()) { |
| | | $this->login_error = self::ERROR_RATE_LIMIT; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | $storage = $this->get_storage(); |
| | | |
| | | // try to log in |
| | | if (!$storage->connect($host, $username, $password, $port, $ssl)) { |
| | | if ($user) { |
| | | $user->failed_login(); |
| | | } |
| | | |
| | | // Wait a second to slow down brute-force attacks (#1490549) |
| | | sleep(1); |
| | | return false; |
| | |
| | | // this need to be full url to make redirects work |
| | | $absolute = true; |
| | | } |
| | | else if ($secure && ($token = $this->get_request_token())) |
| | | $url .= $delm . '_token=' . urlencode($token); |
| | | |
| | | if ($absolute || $full) { |
| | | // add base path to this Roundcube installation |
| | |
| | | /** |
| | | * Returns supported font-family specifications |
| | | * |
| | | * @param string $font Font name |
| | | * @param string $font Font name |
| | | * |
| | | * @param string|array Font-family specification array or string (if $font is used) |
| | | */ |
| | |
| | | /** |
| | | * Create a human readable string for a number of bytes |
| | | * |
| | | * @param int Number of bytes |
| | | * @param string Size unit |
| | | * @param int $bytes Number of bytes |
| | | * @param string &$unit Size unit |
| | | * |
| | | * @return string Byte string |
| | | */ |
| | |
| | | /** |
| | | * Returns real size (calculated) of the message part |
| | | * |
| | | * @param rcube_message_part Message part |
| | | * @param rcube_message_part $part Message part |
| | | * |
| | | * @return string Part size (and unit) |
| | | */ |
| | |
| | | $size = $this->show_bytes((int)$part->d_parameters['size']); |
| | | } |
| | | else { |
| | | $size = $part->size; |
| | | if ($part->encoding == 'base64') { |
| | | $size = $size / 1.33; |
| | | } |
| | | $size = $part->size; |
| | | if ($part->encoding == 'base64') { |
| | | $size = $size / 1.33; |
| | | } |
| | | |
| | | $size = '~' . $this->show_bytes($size); |
| | | $size = '~' . $this->show_bytes($size); |
| | | } |
| | | |
| | | return $size; |
| | |
| | | * Get resource file content (with assets_dir support) |
| | | * |
| | | * @param string $name File name |
| | | * |
| | | * @return string File content |
| | | */ |
| | | public function get_resource_content($name) |
| | | { |
| | |
| | | } |
| | | |
| | | return $options['body']; |
| | | } |
| | | |
| | | |
| | | /************************************************************************ |
| | | ********* Deprecated methods (to be removed) ********* |
| | | ***********************************************************************/ |
| | | |
| | | public static function setcookie($name, $value, $exp = 0) |
| | | { |
| | | rcube_utils::setcookie($name, $value, $exp); |
| | | } |
| | | |
| | | public function imap_connect() |
| | | { |
| | | return $this->storage_connect(); |
| | | } |
| | | |
| | | public function imap_init() |
| | | { |
| | | return $this->storage_init(); |
| | | } |
| | | |
| | | /** |