mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
BUGFIX Encoding multibyte characters in custom X-Status HTTP headers used in CMS (headers don't allow multibyte data)
This commit is contained in:
parent
c3735ec666
commit
73e5c34896
@ -478,7 +478,7 @@ JS
|
|||||||
*/
|
*/
|
||||||
public function doSync() {
|
public function doSync() {
|
||||||
$message = Filesystem::sync();
|
$message = Filesystem::sync();
|
||||||
$this->response->addHeader('X-Status', $message);
|
$this->response->addHeader('X-Status', rawurlencode($message));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -512,7 +512,7 @@ JS
|
|||||||
'{count} unused thumbnails have been deleted',
|
'{count} unused thumbnails have been deleted',
|
||||||
array('count' => $count)
|
array('count' => $count)
|
||||||
);
|
);
|
||||||
$this->response->addHeader('X-Status', $message);
|
$this->response->addHeader('X-Status', rawurlencode($message));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,15 +796,15 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$this->response->addHeader(
|
$this->response->addHeader(
|
||||||
'X-Status',
|
'X-Status',
|
||||||
_t(
|
rawurlencode(_t(
|
||||||
'LeftAndMain.STATUSPUBLISHEDSUCCESS',
|
'LeftAndMain.STATUSPUBLISHEDSUCCESS',
|
||||||
"Published '{title}' successfully",
|
"Published '{title}' successfully",
|
||||||
'Status message after publishing a page, showing the page title',
|
'Status message after publishing a page, showing the page title',
|
||||||
array('title' => $record->Title)
|
array('title' => $record->Title)
|
||||||
)
|
))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->response->addHeader('X-Status', _t('LeftAndMain.SAVEDUP'));
|
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP')));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
@ -891,7 +891,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$this->response->addHeader(
|
$this->response->addHeader(
|
||||||
'X-Status',
|
'X-Status',
|
||||||
sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved)
|
rawurlencode(sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
||||||
@ -936,12 +936,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$this->response->addHeader(
|
$this->response->addHeader(
|
||||||
'X-Status',
|
'X-Status',
|
||||||
_t(
|
rawurlencode(_t(
|
||||||
'CMSMain.RESTORED',
|
'CMSMain.RESTORED',
|
||||||
"Restored '{title}' successfully",
|
"Restored '{title}' successfully",
|
||||||
'Param %s is a title',
|
'Param %s is a title',
|
||||||
array('title' => $record->Title)
|
array('title' => $record->Title)
|
||||||
)
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
@ -966,7 +966,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$this->response->addHeader(
|
$this->response->addHeader(
|
||||||
'X-Status',
|
'X-Status',
|
||||||
sprintf(_t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '%s' from the draft site"), $record->Title)
|
rawurlencode(sprintf(_t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '%s' from the draft site"), $record->Title))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
||||||
@ -990,7 +990,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$this->response->addHeader(
|
$this->response->addHeader(
|
||||||
'X-Status',
|
'X-Status',
|
||||||
_t('CMSMain.REMOVEDPAGE',"Removed '{title}' from the published site", array('title' => $record->Title))
|
rawurlencode(_t('CMSMain.REMOVEDPAGE',"Removed '{title}' from the published site", array('title' => $record->Title)))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
@ -1038,7 +1038,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->addHeader('X-Status', $message);
|
$this->response->addHeader('X-Status', rawurlencode($message));
|
||||||
|
|
||||||
// Can be used in different contexts: In normal page edit view, in which case the redirect won't have any effect.
|
// Can be used in different contexts: In normal page edit view, in which case the redirect won't have any effect.
|
||||||
// Or in history view, in which case a revert causes the CMS to re-load the edit view.
|
// Or in history view, in which case a revert causes the CMS to re-load the edit view.
|
||||||
@ -1187,11 +1187,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$this->response->addHeader(
|
$this->response->addHeader(
|
||||||
'X-Status',
|
'X-Status',
|
||||||
_t(
|
rawurlencode(_t(
|
||||||
'CMSMain.RESTORED',
|
'CMSMain.RESTORED',
|
||||||
"Restored '{title}' successfully",
|
"Restored '{title}' successfully",
|
||||||
array('title' => $restoredPage->TreeTitle)
|
array('title' => $restoredPage->TreeTitle)
|
||||||
)
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
|
@ -45,7 +45,7 @@ class CMSSettingsController extends CMSMain {
|
|||||||
$form->saveInto($siteConfig);
|
$form->saveInto($siteConfig);
|
||||||
$siteConfig->write();
|
$siteConfig->write();
|
||||||
|
|
||||||
$this->response->addHeader('X-Status', _t('LeftAndMain.SAVEDUP'));
|
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP')));
|
||||||
|
|
||||||
return $form->forTemplate();
|
return $form->forTemplate();
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ class ErrorPage extends Page {
|
|||||||
"Error opening file \"{filename}\" for writing. Please check file permissions.",
|
"Error opening file \"{filename}\" for writing. Please check file permissions.",
|
||||||
array('filename' => $errorFile)
|
array('filename' => $errorFile)
|
||||||
);
|
);
|
||||||
$this->response->addHeader('X-Status', $fileErrorText);
|
$this->response->addHeader('X-Status', rawurlencode($fileErrorText));
|
||||||
return $this->httpError(405);
|
return $this->httpError(405);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user