mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FIX: Fixes #1054 By preventing errors in the CMS _only_.
MINOR Boyscouting: Addition of missing braces, default return and missing types in @return annotation.
This commit is contained in:
parent
4571779213
commit
10e06dce50
@ -358,7 +358,7 @@ class CMSPageHistoryController extends CMSMain {
|
||||
/**
|
||||
* @param int $versionID
|
||||
* @param int $otherVersionID
|
||||
* @return Form
|
||||
* @return mixed
|
||||
*/
|
||||
public function CompareVersionsForm($versionID, $otherVersionID) {
|
||||
if($versionID > $otherVersionID) {
|
||||
@ -369,16 +369,20 @@ class CMSPageHistoryController extends CMSMain {
|
||||
$fromVersion = $versionID;
|
||||
}
|
||||
|
||||
if(!$toVersion || !$toVersion) return false;
|
||||
if(!$toVersion || !$toVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $this->currentPageID();
|
||||
$page = DataObject::get_by_id("SiteTree", $id);
|
||||
|
||||
if($page && !$page->canView()) {
|
||||
return Security::permissionFailure($this);
|
||||
}
|
||||
if($page && $page->exists()) {
|
||||
if(!$page->canView()) {
|
||||
return Security::permissionFailure($this);
|
||||
}
|
||||
|
||||
$record = $page->compareVersions($fromVersion, $toVersion);
|
||||
$record = $page->compareVersions($fromVersion, $toVersion);
|
||||
}
|
||||
|
||||
$fromVersionRecord = Versioned::get_version('SiteTree', $id, $fromVersion);
|
||||
$toVersionRecord = Versioned::get_version('SiteTree', $id, $toVersion);
|
||||
@ -391,7 +395,7 @@ class CMSPageHistoryController extends CMSMain {
|
||||
user_error("Can't find version $toVersion of page $id", E_USER_ERROR);
|
||||
}
|
||||
|
||||
if($record) {
|
||||
if(isset($record)) {
|
||||
$form = $this->getEditForm($id, null, null, true);
|
||||
$form->setActions(new FieldList());
|
||||
$form->addExtraClass('compare');
|
||||
@ -414,6 +418,8 @@ class CMSPageHistoryController extends CMSMain {
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function Breadcrumbs($unlinked = false) {
|
||||
|
Loading…
Reference in New Issue
Block a user