mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Use SiteTree instead of Page class in more places
This commit is contained in:
parent
6d8defcc1e
commit
0cf477d36e
@ -1457,7 +1457,7 @@ class LeftAndMain extends Controller implements PermissionProvider
|
|||||||
$id = $request->requestVar('ID');
|
$id = $request->requestVar('ID');
|
||||||
$parentID = $request->requestVar('ParentID');
|
$parentID = $request->requestVar('ParentID');
|
||||||
|
|
||||||
if ($className == 'SilverStripe\\CMS\\Model\\SiteTree' && $page = DataObject::get_by_id('Page', $id)) {
|
if ($className == 'SilverStripe\\CMS\\Model\\SiteTree' && $page = DataObject::get_by_id(SiteTree::class, $id)) {
|
||||||
$root = $page->getParentType();
|
$root = $page->getParentType();
|
||||||
if (($parentID == '0' || $root == 'root') && !SiteConfig::current_site_config()->canCreateTopLevel()) {
|
if (($parentID == '0' || $root == 'root') && !SiteConfig::current_site_config()->canCreateTopLevel()) {
|
||||||
$this->getResponse()->setStatusCode(
|
$this->getResponse()->setStatusCode(
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Forms\HTMLEditor;
|
namespace SilverStripe\Forms\HTMLEditor;
|
||||||
|
|
||||||
use Page;
|
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Assets\Upload;
|
use SilverStripe\Assets\Upload;
|
||||||
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\RequestHandler;
|
use SilverStripe\Control\RequestHandler;
|
||||||
@ -516,7 +516,7 @@ class HTMLEditorField_Toolbar extends RequestHandler
|
|||||||
$id = (int)$this->getRequest()->getVar('PageID');
|
$id = (int)$this->getRequest()->getVar('PageID');
|
||||||
$anchors = array();
|
$anchors = array();
|
||||||
|
|
||||||
if (($page = Page::get()->byID($id)) && !empty($page)) {
|
if (($page = SiteTree::get()->byID($id)) && !empty($page)) {
|
||||||
if (!$page->canView()) {
|
if (!$page->canView()) {
|
||||||
throw new HTTPResponse_Exception(
|
throw new HTTPResponse_Exception(
|
||||||
_t(
|
_t(
|
||||||
|
@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Security;
|
namespace SilverStripe\Security;
|
||||||
|
|
||||||
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Control\Session;
|
use SilverStripe\Control\Session;
|
||||||
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Core\ClassInfo;
|
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Dev\Deprecation;
|
use SilverStripe\Dev\Deprecation;
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
@ -18,16 +20,14 @@ use SilverStripe\Forms\FieldList;
|
|||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\Forms\FormAction;
|
use SilverStripe\Forms\FormAction;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataObject;
|
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\ORM\ValidationResult;
|
use SilverStripe\ORM\ValidationResult;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
use SilverStripe\View\SSViewer;
|
use SilverStripe\View\SSViewer;
|
||||||
use SilverStripe\View\TemplateGlobalProvider;
|
use SilverStripe\View\TemplateGlobalProvider;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Page;
|
|
||||||
use Page_Controller;
|
|
||||||
use Subsite;
|
use Subsite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -515,14 +515,14 @@ class Security extends Controller implements TemplateGlobalProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use sitetree pages to render the security page
|
// Use sitetree pages to render the security page
|
||||||
$tmpPage = new Page();
|
$tmpPage = new SiteTree();
|
||||||
$tmpPage->Title = $title;
|
$tmpPage->Title = $title;
|
||||||
/** @skipUpgrade */
|
/** @skipUpgrade */
|
||||||
$tmpPage->URLSegment = "Security";
|
$tmpPage->URLSegment = "Security";
|
||||||
// Disable ID-based caching of the log-in page by making it a random number
|
// Disable ID-based caching of the log-in page by making it a random number
|
||||||
$tmpPage->ID = -1 * rand(1, 10000000);
|
$tmpPage->ID = -1 * rand(1, 10000000);
|
||||||
|
|
||||||
$controller = Page_Controller::create($tmpPage);
|
$controller = ContentController::create($tmpPage);
|
||||||
$controller->setDataModel($this->model);
|
$controller->setDataModel($this->model);
|
||||||
$controller->doInit();
|
$controller->doInit();
|
||||||
return $controller;
|
return $controller;
|
||||||
|
Loading…
Reference in New Issue
Block a user