mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-05 09:11:25 +02:00
BUG Fix up test regressions FIX director references to request object API Move all middlewares to common namespace API Implement RequestHandlerMiddlewareAdapter ENHANCEMENT Improve IP address parsing Fix up PHPDoc / psr2 linting BUG Fix property parsing in TrustedProxyMiddleware BUG Fix Director::is_https()
66 lines
1.4 KiB
PHP
66 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Control\Tests\DirectorTest;
|
|
|
|
use SilverStripe\Control\Controller;
|
|
use SilverStripe\Control\Director;
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
class TestController extends Controller implements TestOnly
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
if (Controller::has_curr()) {
|
|
$this->setRequest(Controller::curr()->getRequest());
|
|
}
|
|
}
|
|
|
|
private static $url_segment = 'TestController';
|
|
|
|
private static $allowed_actions = array(
|
|
'returnGetValue',
|
|
'returnPostValue',
|
|
'returnRequestValue',
|
|
'returnCookieValue',
|
|
'returnIsSSL',
|
|
);
|
|
|
|
public function returnGetValue($request)
|
|
{
|
|
if (isset($_GET['somekey'])) {
|
|
return $_GET['somekey'];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public function returnPostValue($request)
|
|
{
|
|
if (isset($_POST['somekey'])) {
|
|
return $_POST['somekey'];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public function returnRequestValue($request)
|
|
{
|
|
if (isset($_REQUEST['somekey'])) {
|
|
return $_REQUEST['somekey'];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public function returnCookieValue($request)
|
|
{
|
|
if (isset($_COOKIE['somekey'])) {
|
|
return $_COOKIE['somekey'];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public function returnIsSSL()
|
|
{
|
|
return Director::is_https() ? 'yes': 'no';
|
|
}
|
|
}
|