mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 15:05:33 +00:00
Update the PHP files to PSR-2 spec
This commit is contained in:
parent
f54ff29a02
commit
d3ed3f7476
56
index.php
56
index.php
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
// This is the URL of the script that everything must be viewed with.
|
||||
define('BASE_SCRIPT_URL','index.php/');
|
||||
define('BASE_SCRIPT_URL', 'index.php/');
|
||||
|
||||
$ruLen = strlen($_SERVER['REQUEST_URI']);
|
||||
$snLen = strlen($_SERVER['SCRIPT_NAME']);
|
||||
@ -23,26 +23,30 @@ $snLen = strlen($_SERVER['SCRIPT_NAME']);
|
||||
$isIIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false);
|
||||
|
||||
// IIS will populate server variables using one of these two ways
|
||||
if($isIIS) {
|
||||
if($_SERVER['REQUEST_URI'] == $_SERVER['SCRIPT_NAME']) {
|
||||
$url = "";
|
||||
} else if($ruLen > $snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
||||
$url = substr($_SERVER['REQUEST_URI'],$snLen+1);
|
||||
$url = strtok($url, '?');
|
||||
} else {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
if($url[0] == '/') $url = substr($url,1);
|
||||
$url = strtok($url, '?');
|
||||
}
|
||||
if ($isIIS) {
|
||||
if ($_SERVER['REQUEST_URI'] == $_SERVER['SCRIPT_NAME']) {
|
||||
$url = "";
|
||||
} else {
|
||||
if ($ruLen > $snLen && substr($_SERVER['REQUEST_URI'], 0, $snLen + 1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
||||
$url = substr($_SERVER['REQUEST_URI'], $snLen + 1);
|
||||
$url = strtok($url, '?');
|
||||
} else {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
if ($url[0] == '/') {
|
||||
$url = substr($url, 1);
|
||||
}
|
||||
$url = strtok($url, '?');
|
||||
}
|
||||
}
|
||||
|
||||
// Apache will populate the server variables this way
|
||||
} else {
|
||||
if($ruLen > $snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
||||
$url = substr($_SERVER['REQUEST_URI'],$snLen+1);
|
||||
$url = strtok($url, '?');
|
||||
} else {
|
||||
$url = "";
|
||||
}
|
||||
if ($ruLen > $snLen && substr($_SERVER['REQUEST_URI'], 0, $snLen + 1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
||||
$url = substr($_SERVER['REQUEST_URI'], $snLen + 1);
|
||||
$url = strtok($url, '?');
|
||||
} else {
|
||||
$url = "";
|
||||
}
|
||||
}
|
||||
|
||||
$_GET['url'] = $_REQUEST['url'] = $url;
|
||||
@ -53,14 +57,14 @@ $fileName = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $url;
|
||||
* This code is a very simple wrapper for sending files
|
||||
* Very quickly pass through references to files
|
||||
*/
|
||||
if($url && file_exists($fileName)) {
|
||||
$fileURL = (dirname($_SERVER['SCRIPT_NAME'])=='/'?'':dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url;
|
||||
if(isset($_SERVER['QUERY_STRING'])) {
|
||||
$fileURL .= '?' . $_SERVER['QUERY_STRING'];
|
||||
}
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
|
||||
header("Location: $fileURL");
|
||||
die();
|
||||
if ($url && file_exists($fileName)) {
|
||||
$fileURL = (dirname($_SERVER['SCRIPT_NAME']) == '/' ? '' : dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url;
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$fileURL .= '?' . $_SERVER['QUERY_STRING'];
|
||||
}
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
|
||||
header("Location: $fileURL");
|
||||
die();
|
||||
}
|
||||
|
||||
require_once('framework/main.php');
|
||||
|
@ -10,7 +10,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
if (!file_exists('framework') || !file_exists('framework/_config.php')) {
|
||||
include "install-frameworkmissing.html";
|
||||
include "install-frameworkmissing.html";
|
||||
} else {
|
||||
include('./framework/src/Dev/Install/install.php');
|
||||
include('./framework/src/Dev/Install/install.php');
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ use SilverStripe\CMS\Model\SiteTree;
|
||||
|
||||
class Page extends SiteTree
|
||||
{
|
||||
private static $db = array(
|
||||
);
|
||||
private static $db = array(
|
||||
|
||||
private static $has_one = array(
|
||||
);
|
||||
);
|
||||
|
||||
private static $has_one = array(
|
||||
|
||||
);
|
||||
}
|
||||
|
@ -4,28 +4,29 @@ use SilverStripe\CMS\Controllers\ContentController;
|
||||
|
||||
class PageController extends ContentController
|
||||
{
|
||||
/**
|
||||
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
|
||||
* permissions or conditions required to allow the user to access it.
|
||||
*
|
||||
* <code>
|
||||
* array (
|
||||
* 'action', // anyone can access this action
|
||||
* 'action' => true, // same as above
|
||||
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
|
||||
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array(
|
||||
);
|
||||
/**
|
||||
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
|
||||
* permissions or conditions required to allow the user to access it.
|
||||
*
|
||||
* <code>
|
||||
* array (
|
||||
* 'action', // anyone can access this action
|
||||
* 'action' => true, // same as above
|
||||
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
|
||||
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array(
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
// You can include any CSS or JS required by your project here.
|
||||
// See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/
|
||||
}
|
||||
);
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
// You can include any CSS or JS required by your project here.
|
||||
// See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user