- if (!isset($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/magic-envelope+xml') {
- // TRANS: Client error. Do not translate "application/magic-envelope+xml".
- $this->clientError(_m('Salmon requires "application/magic-envelope+xml".'));
+ if (!isset($_SERVER['CONTENT_TYPE'])) {
+ // TRANS: Client error. Do not translate "Content-type"
+ $this->clientError(_m('Salmon requires a Content-type header.'));
+ }
+ $envxml = null;
+ switch ($_SERVER['CONTENT_TYPE']) {
+ case 'application/magic-envelope+xml':
+ $envxml = file_get_contents('php://input');
+ break;
+ case 'application/x-www-form-urlencoded':
+ $envxml = Magicsig::base64_url_decode($this->trimmed('xml'));
+ break;
+ default:
+ // TRANS: Client error. Do not translate the quoted "application/[type]" strings.
+ $this->clientError(_m('Salmon requires "application/magic-envelope+xml". For Diaspora we also accept "application/x-www-form-urlencoded" with an "xml" parameter.', 415));