diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 46ef5799..20ac9e85 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -187,7 +187,7 @@ class CalDAVRequest $this->content_type = $matches[1]; } if ( isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 7 ) { - if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' ) { + if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' || $this->method == 'PROPPATCH' || $this->method == 'BIND' || $this->method == 'MKTICKET' || $this->method == 'ACL' ) { if ( !preg_match( '{^(text|application)/xml$}', $this->content_type ) ) { @dbg_error_log( "LOG request", 'Request is "%s" but client set content-type to "%s". Assuming they meant XML!', $request->method, $this->content_type ); @@ -198,6 +198,13 @@ class CalDAVRequest $this->CoerceContentType(); } } + else if ( !preg_match( '{^(text|application)/xml$}', $this->content_type ) ) { + if ( $this->method == 'GET' || $this->method == 'HEAD' || $this->method == 'OPTIONS' || $this->method == 'MKCALENDAR' || $this->method == 'MKCOL' ) { + @dbg_error_log( "LOG request", '%s Request specified %s content type but none is present. Assuming null content-type.', + $request->method, $this->content_type ); + $this->content_type = 'text/plain'; + } + } $this->user_agent = ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Probably Mulberry")); /** diff --git a/inc/HTTPAuthSession.php b/inc/HTTPAuthSession.php index 12cf9c07..d4c19efd 100644 --- a/inc/HTTPAuthSession.php +++ b/inc/HTTPAuthSession.php @@ -101,6 +101,8 @@ class HTTPAuthSession { /** * Get HTTP Auth to work with PHP+FastCGI */ + if ( !isset($_SERVER["AUTHORIZATION"]) && isset($_SERVER["HTTP_AUTHORIZATION"]) && !empty($_SERVER["HTTP_AUTHORIZATION"])) + $_SERVER["AUTHORIZATION"] = $_SERVER["HTTP_AUTHORIZATION"]; if (isset($_SERVER["AUTHORIZATION"]) && !empty($_SERVER["AUTHORIZATION"])) { list ($type, $cred) = split (" ", $_SERVER['AUTHORIZATION']); if ($type == 'Basic') { diff --git a/inc/Principal.php b/inc/Principal.php index 46a43e58..5e44ee33 100644 --- a/inc/Principal.php +++ b/inc/Principal.php @@ -532,20 +532,19 @@ class Principal { $sql_params = array(); foreach( self::updateableFields() AS $k ) { if ( !isset($field_values->{$k}) && !isset($this->{$k}) ) continue; + $param_name = ':'.$k; + $sql_params[$param_name] = (isset($field_values->{$k}) ? $field_values->{$k} : $this->{$k}); + if ( $k == 'default_privileges' ) { + $sql_params[$param_name] = sprintf('%024s',decbin($sql_params[$param_name])); + $param_name = 'cast('.$param_name.' as text)::BIT(24)'; + } if ( $inserting ) { - $param_names[] = ':'.$k; + $param_names[] = $param_name; $insert_fields[] = $k; } else { - if ($k == 'default_privileges') { - $update_list[] = $k.'=cast(:'.$k.' as text)::BIT(24)'; - } - else { - $update_list[] = $k.'=:'.$k; - } + $update_list[] = $k.'='.$param_name; } - - $sql_params[':'.$k] = (isset($field_values->{$k}) ? $field_values->{$k} : $this->{$k}); } if ( $inserting && isset(self::$db_mandatory_fields) ) { diff --git a/inc/external-fetch.php b/inc/external-fetch.php index b5d5366d..d86483a6 100644 --- a/inc/external-fetch.php +++ b/inc/external-fetch.php @@ -39,7 +39,7 @@ function create_external ( $path,$is_calendar,$is_addressbook ) } } -function fetch_external ( $bind_id, $min_age ) +function fetch_external ( $bind_id, $min_age = '1 hour' ) { if ( ! function_exists ( "curl_init" ) ) { dbg_error_log("external", "external resource cannot be fetched without curl, please install curl");