forked from silverstripe/silverstripe-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
462dce2
commit a591198
Showing
11 changed files
with
218 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
RewriteEngine On | ||
RewriteRule ^(.*)$ public/$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$"> | ||
Require all denied | ||
</FilesMatch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
Name: app-mimeuploadvalidator | ||
After: '#mimeuploadvalidator' | ||
Only: | ||
moduleexists: 'silverstripe/mimevalidator' | ||
--- | ||
SilverStripe\Core\Injector\Injector: | ||
SilverStripe\Assets\Upload_Validator: | ||
class: SilverStripe\MimeValidator\MimeUploadValidator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
Name: myproject | ||
--- | ||
SilverStripe\Core\Manifest\ModuleManifest: | ||
project: app | ||
|
||
# UTF8MB4 has limited support in older MySQL versions. | ||
# Remove this configuration if you experience issues. | ||
--- | ||
Name: myproject-database | ||
--- | ||
SilverStripe\ORM\Connect\MySQLDatabase: | ||
connection_charset: utf8mb4 | ||
connection_collation: utf8mb4_unicode_ci | ||
charset: utf8mb4 | ||
collation: utf8mb4_unicode_ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace { | ||
|
||
use SilverStripe\CMS\Model\SiteTree; | ||
|
||
class Page extends SiteTree | ||
{ | ||
private static $db = []; | ||
|
||
private static $has_one = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace { | ||
|
||
use SilverStripe\CMS\Controllers\ContentController; | ||
|
||
/** | ||
* @template T of Page | ||
* @extends ContentController<T> | ||
*/ | ||
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> | ||
* [ | ||
* '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 = []; | ||
|
||
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/ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
### SILVERSTRIPE START ### | ||
|
||
# Deny access to templates (but allow from localhost) | ||
<Files *.ss> | ||
Require ip 127.0.0.1 | ||
</Files> | ||
|
||
# Deny access to IIS configuration | ||
<Files web.config> | ||
Require all denied | ||
</Files> | ||
|
||
# Deny access to YAML configuration files which might include sensitive information | ||
<Files ~ "\.ya?ml$"> | ||
Require all denied | ||
</Files> | ||
|
||
# Route errors to static pages automatically generated by SilverStripe | ||
ErrorDocument 404 /assets/error-404.html | ||
ErrorDocument 500 /assets/error-500.html | ||
|
||
<IfModule mod_rewrite.c> | ||
|
||
# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4 | ||
<IfModule mod_dir.c> | ||
DirectoryIndex disabled | ||
DirectorySlash On | ||
</IfModule> | ||
|
||
SetEnv HTTP_MOD_REWRITE On | ||
RewriteEngine On | ||
|
||
# Enable HTTP Basic authentication workaround for PHP running in CGI mode | ||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | ||
|
||
# Deny access to potentially sensitive files and folders | ||
RewriteRule ^vendor(/|$) - [F,L,NC] | ||
RewriteRule ^\.env - [F,L,NC] | ||
RewriteRule silverstripe-cache(/|$) - [F,L,NC] | ||
RewriteRule composer\.(json|lock) - [F,L,NC] | ||
RewriteRule (error|silverstripe|debug)\.log - [F,L,NC] | ||
|
||
# Process through SilverStripe if no file with the requested name exists. | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule .* index.php | ||
</IfModule> | ||
### SILVERSTRIPE END ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use SilverStripe\Control\HTTPApplication; | ||
use SilverStripe\Control\HTTPRequestBuilder; | ||
use SilverStripe\Core\CoreKernel; | ||
|
||
// Find autoload.php | ||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) { | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
} elseif (file_exists(__DIR__ . '/vendor/autoload.php')) { | ||
require __DIR__ . '/vendor/autoload.php'; | ||
} else { | ||
header('HTTP/1.1 500 Internal Server Error'); | ||
echo "autoload.php not found"; | ||
exit(1); | ||
} | ||
|
||
// Build request and detect flush | ||
$request = HTTPRequestBuilder::createFromEnvironment(); | ||
|
||
// Default application | ||
$kernel = new CoreKernel(BASE_PATH); | ||
$app = new HTTPApplication($kernel); | ||
$response = $app->handle($request); | ||
$response->output(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!-- Routing configuration for Microsoft IIS web server --> | ||
<configuration> | ||
<system.webServer> | ||
<security> | ||
<requestFiltering> | ||
<hiddenSegments> | ||
<add segment=".env" /> | ||
<add segment="silverstripe-cache" /> | ||
<add segment="composer.json" /> | ||
<add segment="composer.lock" /> | ||
</hiddenSegments> | ||
<fileExtensions allowUnlisted="true" > | ||
<add fileExtension=".ss" allowed="false"/> | ||
<add fileExtension=".yml" allowed="false"/> | ||
</fileExtensions> | ||
</requestFiltering> | ||
</security> | ||
<rewrite> | ||
<rules> | ||
<rule name="SilverStripe Clean URLs" stopProcessing="true"> | ||
<match url="^(.*)$" /> | ||
<conditions> | ||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | ||
</conditions> | ||
<action type="Rewrite" url="index.php" appendQueryString="true" /> | ||
</rule> | ||
</rules> | ||
</rewrite> | ||
</system.webServer> | ||
</configuration> |