diff --git a/index.php b/index.php index 122a677..e922363 100644 --- a/index.php +++ b/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'); diff --git a/install.php b/install.php index 837e3a9..269842a 100644 --- a/install.php +++ b/install.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'); } diff --git a/mysite/code/Page.php b/mysite/code/Page.php index 9437a93..df4f8fe 100755 --- a/mysite/code/Page.php +++ b/mysite/code/Page.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( + + ); } diff --git a/mysite/code/PageController.php b/mysite/code/PageController.php index 9dd464f..5a0adf9 100644 --- a/mysite/code/PageController.php +++ b/mysite/code/PageController.php @@ -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. - * - * - * 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 - * ); - * - * - * @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. + * + * + * 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 + * ); + * + * + * @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/ + } }