mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 15:05:33 +00:00
Merge pull request #177 from nfauchelle/psr-2-adjustments
Update the PHP files to PSR-2 spec
This commit is contained in:
commit
d9f28b2017
56
index.php
56
index.php
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// This is the URL of the script that everything must be viewed with.
|
// 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']);
|
$ruLen = strlen($_SERVER['REQUEST_URI']);
|
||||||
$snLen = strlen($_SERVER['SCRIPT_NAME']);
|
$snLen = strlen($_SERVER['SCRIPT_NAME']);
|
||||||
@ -23,26 +23,30 @@ $snLen = strlen($_SERVER['SCRIPT_NAME']);
|
|||||||
$isIIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false);
|
$isIIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false);
|
||||||
|
|
||||||
// IIS will populate server variables using one of these two ways
|
// IIS will populate server variables using one of these two ways
|
||||||
if($isIIS) {
|
if ($isIIS) {
|
||||||
if($_SERVER['REQUEST_URI'] == $_SERVER['SCRIPT_NAME']) {
|
if ($_SERVER['REQUEST_URI'] == $_SERVER['SCRIPT_NAME']) {
|
||||||
$url = "";
|
$url = "";
|
||||||
} else if($ruLen > $snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
} else {
|
||||||
$url = substr($_SERVER['REQUEST_URI'],$snLen+1);
|
if ($ruLen > $snLen && substr($_SERVER['REQUEST_URI'], 0, $snLen + 1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
||||||
$url = strtok($url, '?');
|
$url = substr($_SERVER['REQUEST_URI'], $snLen + 1);
|
||||||
} else {
|
$url = strtok($url, '?');
|
||||||
$url = $_SERVER['REQUEST_URI'];
|
} else {
|
||||||
if($url[0] == '/') $url = substr($url,1);
|
$url = $_SERVER['REQUEST_URI'];
|
||||||
$url = strtok($url, '?');
|
if ($url[0] == '/') {
|
||||||
}
|
$url = substr($url, 1);
|
||||||
|
}
|
||||||
|
$url = strtok($url, '?');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Apache will populate the server variables this way
|
// Apache will populate the server variables this way
|
||||||
} else {
|
} else {
|
||||||
if($ruLen > $snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
if ($ruLen > $snLen && substr($_SERVER['REQUEST_URI'], 0, $snLen + 1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
|
||||||
$url = substr($_SERVER['REQUEST_URI'],$snLen+1);
|
$url = substr($_SERVER['REQUEST_URI'], $snLen + 1);
|
||||||
$url = strtok($url, '?');
|
$url = strtok($url, '?');
|
||||||
} else {
|
} else {
|
||||||
$url = "";
|
$url = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_GET['url'] = $_REQUEST['url'] = $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
|
* This code is a very simple wrapper for sending files
|
||||||
* Very quickly pass through references to files
|
* Very quickly pass through references to files
|
||||||
*/
|
*/
|
||||||
if($url && file_exists($fileName)) {
|
if ($url && file_exists($fileName)) {
|
||||||
$fileURL = (dirname($_SERVER['SCRIPT_NAME'])=='/'?'':dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url;
|
$fileURL = (dirname($_SERVER['SCRIPT_NAME']) == '/' ? '' : dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url;
|
||||||
if(isset($_SERVER['QUERY_STRING'])) {
|
if (isset($_SERVER['QUERY_STRING'])) {
|
||||||
$fileURL .= '?' . $_SERVER['QUERY_STRING'];
|
$fileURL .= '?' . $_SERVER['QUERY_STRING'];
|
||||||
}
|
}
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
|
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
|
||||||
header("Location: $fileURL");
|
header("Location: $fileURL");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('framework/main.php');
|
require_once('framework/main.php');
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
if (!file_exists('framework') || !file_exists('framework/_config.php')) {
|
if (!file_exists('framework') || !file_exists('framework/_config.php')) {
|
||||||
include "install-frameworkmissing.html";
|
include "install-frameworkmissing.html";
|
||||||
} else {
|
} 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
|
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
|
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
|
* 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.
|
* permissions or conditions required to allow the user to access it.
|
||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* array (
|
* array (
|
||||||
* 'action', // anyone can access this action
|
* 'action', // anyone can access this action
|
||||||
* 'action' => true, // same as above
|
* 'action' => true, // same as above
|
||||||
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
|
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
|
||||||
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
|
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
|
||||||
* );
|
* );
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
);
|
|
||||||
|
|
||||||
protected function init()
|
);
|
||||||
{
|
|
||||||
parent::init();
|
protected function init()
|
||||||
// You can include any CSS or JS required by your project here.
|
{
|
||||||
// See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/
|
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