diff --git a/web/concrete/src/Page/Controller/DashboardPageController.php b/web/concrete/src/Page/Controller/DashboardPageController.php index 829078ae55f..d181f615d4e 100644 --- a/web/concrete/src/Page/Controller/DashboardPageController.php +++ b/web/concrete/src/Page/Controller/DashboardPageController.php @@ -11,6 +11,10 @@ class DashboardPageController extends PageController /** @var Error */ protected $error; + protected $restrictedMethods = array( + 'enableNativeMobile' + ); + /** @var Token */ public $token; protected $helpers = array('form'); diff --git a/web/concrete/src/Page/Controller/PageController.php b/web/concrete/src/Page/Controller/PageController.php index 9f0d5257f55..6cf1a03cc1a 100644 --- a/web/concrete/src/Page/Controller/PageController.php +++ b/web/concrete/src/Page/Controller/PageController.php @@ -20,6 +20,12 @@ class PageController extends Controller protected $passThruBlocks = array(); protected $parameters = array(); + /** + * array of method names that can't be called through the url + * @var array + */ + protected $restrictedMethods = array(); + public function supportsPageCache() { return $this->supportsPageCache; @@ -166,11 +172,24 @@ public function setupRequestActionAndParameters(Request $request) } $foundTask = false; + $restrictedControllers = array( + 'Concrete\Core\Controller\Controller', + 'Concrete\Core\Controller\AbstractController', + 'Concrete\Core\Page\Controller\PageController' + + ); try { $r = new \ReflectionMethod(get_class($this), $method); $cl = $r->getDeclaringClass(); if (is_object($cl)) { - if ($cl->getName() != 'Concrete\Core\Controller\Controller' && strpos($method, 'on_') !== 0 && strpos($method, '__') !== 0 && $r->isPublic()) { + if ( + !in_array($cl->getName(), $restrictedControllers) + && strpos($method, 'on_') !== 0 + && strpos($method, '__') !== 0 + && $r->isPublic() + && !$r->isConstructor() + && (is_array($this->restrictedMethods) && !in_array($method, $this->restrictedMethods)) + ) { $foundTask = true; } }