Initialize a new silverstripe website

This commit is contained in:
Manuel Thalmann 2019-03-27 08:55:08 +01:00
parent 599bb7bd6d
commit 1fc0328a8b
22 changed files with 4387 additions and 4 deletions

14
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,14 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"felixfbecker.php-pack",
"neilbrayfield.php-docblocker"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
]
}

33
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,33 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Lint Website",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/Website"
},
"command": "composer",
"args": [
"lint"
],
"problemMatcher": {
"owner": "phpcs",
"fileLocation": "absolute",
"pattern": [
{
"regexp": "^\"(.*)\",(\\d+),(\\d+),(.*),\"(.*)\",(.*),(\\d+),(\\d+)",
"file": 1,
"line": 2,
"column": 3,
"message": 5,
"code": 6
}
],
"severity": "warning"
}
}
]
}

6
Website/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/silverstripe-cache/
/.env
/vendor/
/themes/simple/
/resources/
/public/resources/

2
Website/.htaccess Normal file
View file

@ -0,0 +1,2 @@
RewriteEngine On
RewriteRule ^(.*)$ public/$1

3
Website/app/.htaccess Normal file
View file

@ -0,0 +1,3 @@
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$">
Deny from all
</FilesMatch>

9
Website/app/_config.php Normal file
View file

@ -0,0 +1,9 @@
<?php
use SilverStripe\Security\PasswordValidator;
use SilverStripe\Security\Member;
// remove PasswordValidator for SilverStripe 5.0
$validator = PasswordValidator::create();
// Settings are registered via Injector configuration - see passwords.yml in framework
Member::set_password_validator($validator);

View file

@ -0,0 +1,5 @@
---
Name: m@nuth
---
SilverStripe\Core\Manifest\ModuleManifest:
project: app

View file

@ -0,0 +1,8 @@
---
Name: mytheme
---
SilverStripe\View\SSViewer:
themes:
- '$public'
- 'simple'
- '$default'

15
Website/app/src/Page.php Normal file
View file

@ -0,0 +1,15 @@
<?php
namespace
{
use SilverStripe\CMS\Model\SiteTree;
class Page extends SiteTree
{
private static $db = [];
private static $has_one = [];
}
}
?>

View file

@ -0,0 +1,33 @@
<?php
namespace {
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.
*
* ```php
* [
* '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/
}
}
}

39
Website/composer.json Normal file
View file

@ -0,0 +1,39 @@
{
"name": "silverstripe/installer",
"type": "silverstripe-recipe",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.6.0",
"silverstripe/recipe-plugin": "^1.2",
"silverstripe/recipe-cms": "4.3.3@stable",
"silverstripe-themes/simple": "~3.2.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "*"
},
"scripts": {
"lint": "phpcs --report=csv ."
},
"extra": {
"project-files-installed": [
"app/.htaccess",
"app/_config.php",
"app/_config/mysite.yml",
"app/src/Page.php",
"app/src/PageController.php"
],
"public-files-installed": [
".htaccess",
"index.php",
"install-frameworkmissing.html",
"install.php",
"web.config"
]
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}

4021
Website/composer.lock generated Normal file

File diff suppressed because it is too large Load diff

25
Website/phpcs.xml.dist Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<ruleset name="SS3">
<description>Coding standard for SilverStripe 4.x</description>
<!-- Don't sniff third party libraries -->
<exclude-pattern>*/themes/simple/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/thirdparty/*</exclude-pattern>
<!-- Show progress and output sniff names on violation, and add colours -->
<arg value="sp"/>
<arg name="colors"/>
<!-- Use PSR-2 as a base standard -->
<rule ref="PSR2">
<!-- Allow classes to not declare a namespace -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
<!-- Allow underscores in class names -->
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
<!-- Allow non camel cased method names -->
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
</rule>
</ruleset>

54
Website/public/.htaccess Normal file
View file

@ -0,0 +1,54 @@
### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
# Deny access to IIS configuration
<Files web.config>
Order deny,allow
Deny from all
</Files>
# Deny access to YAML configuration files which might include sensitive information
<Files ~ "\.ya?ml$">
Order allow,deny
Deny from all
</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.
# Pass through the original path as a query parameter, and retain the existing parameters.
# Try finding framework in the vendor folder first
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
</IfModule>
### SILVERSTRIPE END ###

4
Website/public/assets/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
/**/*
!.gitignore
!.htaccess
!web.config

View file

@ -0,0 +1,35 @@
#
# Whitelist appropriate assets files.
# This file is automatically generated via File.allowed_extensions configuration
# See AssetAdapter::renderTemplate() for reference.
#
# We disable PHP via several methods
# Replace the handler with the default plaintext handler
AddHandler default-handler php phtml php3 php4 php5 inc
<IfModule mod_php5.c>
# Turn the PHP engine off
php_flag engine off
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine On
# Allow error pages
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule error[^\\/]*\.html$ - [L]
# Block invalid file extensions
RewriteCond %{REQUEST_URI} !^[^.]*\.(?i:css|js|ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|csv|dmg|doc|docx|dotx|flv|gif|gpx|gz|hqx|ico|jpeg|jpg|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|png|pps|ppt|pptx|potx|ra|ram|rm|rtf|sit|sitx|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xls|xlsx|xltx|zip|zipx)$
RewriteRule .* - [F]
# Non existant files passed to requesthandler
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ../index.php [QSA]
</IfModule>

BIN
Website/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

27
Website/public/index.php Normal file
View file

@ -0,0 +1,27 @@
<?php
use SilverStripe\Control\HTTPApplication;
use SilverStripe\Control\HTTPRequestBuilder;
use SilverStripe\Core\CoreKernel;
use SilverStripe\Core\Startup\ErrorControlChainMiddleware;
// 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);
$app->addMiddleware(new ErrorControlChainMiddleware($app));
$response = $app->handle($request);
$response->output();

View file

@ -0,0 +1,34 @@
<html>
<head>
<title>The SilverStripe Framework is missing</title>
</head>
<body>
<div id="BgContainer">
<div id="Container">
<div id="Header">
<h1>SilverStripe CMS Installation</h1>
</div>
<div id="Navigation">&nbsp;</div>
<div class="clear"><!-- --></div>
<div id="Layout">
<div class="typography">
<p><strong>The SilverStripe Framework is missing</strong> - To run the installer, at least the <strong>framework</strong> module is required.</p>
<p>If you downloaded a pre-packaged zip or tar.gz, something might have gone wrong with the packaging
process. Please try re-downloading, or try an older version.</p>
<p>If you downloaded this from <a href="https://github.com/silverstripe">GitHub</a>, you need to install the <strong>framework</strong> module. You can do this manually, or by running the tools/new-project script from the command line.</p>
</div>
</div>
<div class="clear"><!-- --></div>
</div>
<div id="Footer">
<div class="footerTop"><!-- --></div>
<p><a href="http://silverstripe.org">SilverStripe Open Source CMS</a> | Copyright &copy; 2008-2011 SilverStripe Limited</p>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,18 @@
<?php
/************************************************************************************
************************************************************************************
** **
** If you can read this text in your browser then you don't have PHP installed. **
** Please install PHP 5.6.0 or higher. **
** **
************************************************************************************
************************************************************************************/
if (file_exists(__DIR__ . '/vendor/silverstripe/framework/src/Dev/Install/install.php')) {
include __DIR__ . '/vendor/silverstripe/framework/src/Dev/Install/install.php';
} elseif (file_exists(__DIR__ . '/../vendor/silverstripe/framework/src/Dev/Install/install.php')) {
include __DIR__ . '/../vendor/silverstripe/framework/src/Dev/Install/install.php';
} else {
include 'install-frameworkmissing.html';
}

View file

@ -2,7 +2,8 @@
cd $(dirname $0)
cd ..
tempDir=$(mktemp -d)
find . -name "*" -and -not -name "." -and -not -path "./src/*" -and -not -path "./src" -exec rm -rf {} +
sourceDir="./Website"
find . -name "*" -and -not -name "." -and -not -path "$sourceDir/*" -and -not -path $sourceDir -exec rm -rf {} +
rsync -a --delete ./src/ $tempDir
rsync -a --delete $tempDir/ .
rm -rf $tempDir

View file

@ -1,3 +0,0 @@
<?php
echo "This is a test";
?>