diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..adbd7c8d --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine On +RewriteRule ^(.*)$ public/$1 diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 00000000..35254d52 --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,3 @@ + + Require all denied + diff --git a/app/_config/mimevalidator.yml b/app/_config/mimevalidator.yml new file mode 100644 index 00000000..42d44210 --- /dev/null +++ b/app/_config/mimevalidator.yml @@ -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 diff --git a/app/_config/mysite.yml b/app/_config/mysite.yml new file mode 100644 index 00000000..f786c18c --- /dev/null +++ b/app/_config/mysite.yml @@ -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 diff --git a/app/src/Page.php b/app/src/Page.php new file mode 100644 index 00000000..d5d11e7c --- /dev/null +++ b/app/src/Page.php @@ -0,0 +1,13 @@ + + */ + 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. + * + * + * [ + * '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 = []; + + 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/ + } + } +} diff --git a/composer.json b/composer.json index ad80f48d..2cbf5340 100644 --- a/composer.json +++ b/composer.json @@ -10,10 +10,10 @@ "silverstripe-themes/simple": "3.x-dev", "silverstripe/login-forms": "5.x-dev", "dnadesign/silverstripe-elemental": "dev-pulls/5/inline-validation as 5.x-dev", - "silverstripe/frameworktest": "1.x-dev", "silverstripe/recipe-testing": "^3", "mikey179/vfsstream": "^1.6.10", - "silverstripe/admin": "dev-pulls/2/bypass-entwine as 2.x-dev" + "silverstripe/admin": "dev-pulls/2/bypass-entwine as 2.x-dev", + "silverstripe/frameworktest": "dev-pulls/1/elemental as 1.x-dev" }, "require-dev": { "phpunit/phpunit": "^9.6" @@ -27,6 +27,19 @@ "public-files": [ "assets/*", "favicon.ico" + ], + "project-files-installed": [ + ".htaccess", + "app/.htaccess", + "app/_config/mimevalidator.yml", + "app/_config/mysite.yml", + "app/src/Page.php", + "app/src/PageController.php" + ], + "public-files-installed": [ + ".htaccess", + "index.php", + "web.config" ] }, "config": { @@ -50,6 +63,10 @@ "x1": { "type": "vcs", "url": "git@github.com:creative-commoners/silverstripe-admin" + }, + "x3": { + "type": "vcs", + "url": "git@github.com:creative-commoners/silverstripe-frameworktest" } }, "conflict": { @@ -59,4 +76,4 @@ "symfony/service-contracts": "3.2.1", "symfony/translation-contracts": "3.2.1" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index c421fc48..e3b93056 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "acc41258127c726ee2944aaf7c2b76e1", + "content-hash": "1e30a9e8f4af6a54dbedef84255ec868", "packages": [ { "name": "behat/behat", @@ -5090,16 +5090,16 @@ }, { "name": "silverstripe/frameworktest", - "version": "1.x-dev", + "version": "dev-pulls/1/elemental", "source": { "type": "git", - "url": "https://github.com/silverstripe/silverstripe-frameworktest.git", - "reference": "7ef543a24fa86c0161486567f855b0f581a50db8" + "url": "https://github.com/creative-commoners/silverstripe-frameworktest.git", + "reference": "5bc4ed80c37ba8bfcb4a6471c90f3787fc6aa161" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silverstripe/silverstripe-frameworktest/zipball/7ef543a24fa86c0161486567f855b0f581a50db8", - "reference": "7ef543a24fa86c0161486567f855b0f581a50db8", + "url": "https://api.github.com/repos/creative-commoners/silverstripe-frameworktest/zipball/5bc4ed80c37ba8bfcb4a6471c90f3787fc6aa161", + "reference": "5bc4ed80c37ba8bfcb4a6471c90f3787fc6aa161", "shasum": "" }, "require": { @@ -5110,7 +5110,6 @@ "silverstripe/framework": "^5", "silverstripe/vendor-plugin": "^2" }, - "default-branch": true, "type": "silverstripe-vendormodule", "extra": { "expose": [ @@ -5124,7 +5123,6 @@ "SSilverStripe\\FrameworkTest\\": "code/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -5141,10 +5139,9 @@ "testing" ], "support": { - "issues": "https://github.com/silverstripe/silverstripe-frameworktest/issues", - "source": "https://github.com/silverstripe/silverstripe-frameworktest/tree/1" + "source": "https://github.com/creative-commoners/silverstripe-frameworktest/tree/pulls/1/elemental" }, - "time": "2024-03-12T00:34:45+00:00" + "time": "2024-03-06T03:15:41+00:00" }, { "name": "silverstripe/graphql", @@ -8820,6 +8817,12 @@ "version": "dev-pulls/2/bypass-entwine", "alias": "2.x-dev", "alias_normalized": "2.9999999.9999999.9999999-dev" + }, + { + "package": "silverstripe/frameworktest", + "version": "dev-pulls/1/elemental", + "alias": "1.x-dev", + "alias_normalized": "1.9999999.9999999.9999999-dev" } ], "minimum-stability": "dev", @@ -8830,8 +8833,8 @@ "silverstripe-themes/simple": 20, "silverstripe/login-forms": 20, "dnadesign/silverstripe-elemental": 20, - "silverstripe/frameworktest": 20, - "silverstripe/admin": 20 + "silverstripe/admin": 20, + "silverstripe/frameworktest": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 00000000..79ce9829 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,47 @@ +### SILVERSTRIPE START ### + +# Deny access to templates (but allow from localhost) + + Require ip 127.0.0.1 + + +# Deny access to IIS configuration + + Require all denied + + +# Deny access to YAML configuration files which might include sensitive information + + Require all denied + + +# Route errors to static pages automatically generated by SilverStripe +ErrorDocument 404 /assets/error-404.html +ErrorDocument 500 /assets/error-500.html + + + + # Turn off index.php handling requests to the homepage fixes issue in apache >=2.4 + + DirectoryIndex disabled + DirectorySlash On + + + 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 + +### SILVERSTRIPE END ### diff --git a/public/index.php b/public/index.php new file mode 100644 index 00000000..5ee1af10 --- /dev/null +++ b/public/index.php @@ -0,0 +1,25 @@ +handle($request); +$response->output(); diff --git a/public/web.config b/public/web.config new file mode 100644 index 00000000..7651c15e --- /dev/null +++ b/public/web.config @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +