Skip to content
Permalink
Browse files

Preparations

  • Loading branch information
Thoulah committed Nov 2, 2019
1 parent 879e9fc commit cd6c1f3aee292e49f03b846543fbd938821737e2
Showing with 180 additions and 41 deletions.
  1. +2 −2 .gitignore
  2. +1 −1 App.php
  3. +4 −0 assets/.gitignore
  4. +60 −0 assets/.htaccess
  5. +3 −0 assets/pi/.gitignore
  6. +26 −0 assets/pi/.htaccess
  7. +0 −7 composer.json
  8. +2 −2 mister42/Common.php
  9. +28 −29 mister42/views/calculator/weeknumbers.php
  10. +54 −0 webroot/.htaccess
@@ -1,10 +1,10 @@
/components/
/html/
/mister42/Secrets.php
/mister42/controllers/TestController.php
/mister42/models/test/
/mister42/views/test/
/webroot/.htaccess
/vendor/
/webroot/php.ini
/.buildpath
/.php_cs.cache
/composer.lock
@@ -32,7 +32,7 @@ private function getConfig(): array
switch (yii\helpers\ArrayHelper::getValue($_SERVER, 'SERVER_NAME')) :
case 'mister42.me':
return $this->loadConfig(['mister42'], 'Web');
default:
default:
return $this->loadConfig(['mister42', 'mr42'], 'Web');
endswitch;
}
@@ -0,0 +1,4 @@
*
!.htaccess
!.gitignore
!pi/
@@ -0,0 +1,60 @@
Options -Indexes -MultiViews +FollowSymlinks
AddDefaultCharset UTF-8
SetEnv TZ Europe/Berlin
Header set Connection keep-alive

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . https://www.mister42.me/

# http://www.htaccesstools.com/hotlink-protection/
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?m(iste)?r42.me [NC]
RewriteRule .*\.(jpe?g|png|gif)$ nohotlink.png [L]
</IfModule>

# Caching
FileETag All

<IfModule mod_headers.c>
# http://www.fontsquirrel.com/blog/2010/11/troubleshooting-font-face-problems
<FilesMatch "\.(eot|otf|woff2?|ttf)$">
SetEnvIf Origin "^https?://(.+\.)?m(iste)?r42\.me$" ORIGIN=$0
Header always set Access-Control-Allow-Origin %{ORIGIN}e env=ORIGIN
</FilesMatch>

<FilesMatch "\.(jpe?g|png|gif|eot|otf|woff2?|ttf)$">
Header set Cache-Control "max-age=31557600, public, must-revalidate"
</FilesMatch>

<FilesMatch "\.(css|js)$">
Header set Cache-Control "max-age=31557600, must-revalidate, proxy-revalidate"
</FilesMatch>

<FilesMatch "\.(ico)$">
Header set Cache-Control "max-age=900, private, must-revalidate"
</FilesMatch>

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

# Charsets
AddCharset UTF-8 .css
AddCharset UTF-8 .js

# Compression
SetOutputFilter DEFLATE

# Don't compress images
SetEnvIfNoCase Request_URI .(?:jpe?g|png|gif)$ no-gzip dont-vary

# Don't compress binaries
SetEnvIfNoCase Request_URI .(?:exe|t?gz2?|zip|sit|rar)$ no-gzip dont-vary
@@ -0,0 +1,3 @@
*
!.htaccess
!.gitignore
@@ -0,0 +1,26 @@
ExpiresActive On

<FilesMatch "^(day-.*)\.(jpe?g|png|gif)$">
ExpiresDefault "modification plus 5 minutes"
Header set Cache-Control "max-age=300, must-revalidate"
</FilesMatch>

<FilesMatch "^(week-.*)\.(jpe?g|png|gif)$">
ExpiresDefault "modification plus 30 minutes"
Header set Cache-Control "max-age=1800, must-revalidate"
</FilesMatch>

<FilesMatch "^(month-.*)\.(jpe?g|png|gif)$">
ExpiresDefault "modification plus 1 hour"
Header set Cache-Control "max-age=3600, must-revalidate"
</FilesMatch>

<FilesMatch "^(year-.*)\.(jpe?g|png|gif)$">
ExpiresDefault "modification plus 6 hours"
Header set Cache-Control "max-age=21600, must-revalidate"
</FilesMatch>

<FilesMatch "^(lustrum-.*)\.(jpe?g|png|gif)$">
ExpiresDefault "modification plus 1 day"
Header set Cache-Control "max-age=86400, must-revalidate"
</FilesMatch>
@@ -5,13 +5,6 @@
"license": "GPL-3.0-only",
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"component-dir": "../vendor-components",
"vendor-dir": "../vendor",
"platform": {
"php": "7.3.6"
}
},
"require": {
"php": ">=7.3.0",
"ext-dom": "*",
@@ -18,7 +18,7 @@ public function getValues(): array
return [
'aliases' => [
'@assets' => '//s.mr42.me',
'@assetsroot' => __DIR__ . '/../../webassets/me.mr42.s',
'@assetsroot' => __DIR__ . '/../assets',
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
@@ -29,7 +29,7 @@ public function getValues(): array
'params' => $this->params,
'runtimePath' => __DIR__ . '/../../../.cache/yii/mister42',
'timeZone' => 'Europe/Berlin',
'vendorPath' => __DIR__ . '/../../vendor',
'vendorPath' => __DIR__ . '/../vendor',
];
}
@@ -17,24 +17,41 @@
echo Html::beginTag('div', ['class' => 'row']);
echo Html::beginTag('div', ['class' => 'col']);
echo Html::beginTag('div', ['class' => 'card mb-3']);
echo Html::tag('div', Yii::t('mr42', 'Current Week'), ['class' => 'card-header']);
echo Html::tag('h6', Yii::t('mr42', 'Current Week'), ['class' => 'card-header']);
echo Html::beginTag('div', ['class' => 'card-body']);
echo Html::tag('h2', (int) ($date->format('W')), ['class' => 'card-title display-1 font-weight-bold text-center']);
echo Html::beginTag('div', ['class' => 'card-text text-center']);
echo Yii::t('mr42', 'This week starts at {start} and ends at {end}.', [
'start' => Html::tag('span', Yii::$app->formatter->asDate($startWeek, 'full'), ['class' => 'font-weight-bold']),
'end' => Html::tag('span', Yii::$app->formatter->asDate($endWeek, 'full'), ['class' => 'font-weight-bold'])
]);
echo Html::endTag('div');
echo Html::tag('h2', Yii::t('mr42', 'Week {number}', ['number' => (int) ($date->format('W'))]), ['class' => 'card-title display-1 font-weight-bold text-center mb-0']);
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'card-footer text-center']);
echo Yii::t('mr42', 'This week starts at {start} and ends at {end}.', [
'start' => Html::tag('span', Yii::$app->formatter->asDate($startWeek, 'full'), ['class' => 'font-weight-bold text-nowrap']),
'end' => Html::tag('span', Yii::$app->formatter->asDate($endWeek, 'full'), ['class' => 'font-weight-bold text-nowrap'])
]);
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'row']);
echo Html::beginTag('div', ['class' => 'col-xl']);
echo Html::beginTag('div', ['class' => 'col-xl order-xl-last']);
echo Html::beginTag('div', ['class' => 'card mb-3']);
echo Html::tag('h6', Yii::t('mr42', 'Calendar'), ['class' => 'card-header']);
echo Html::beginTag('div', ['class' => 'card-body mx-auto p-0']);
echo DatePicker::widget([
'clientOptions' => [
'firstDay' => 1,
'numberOfMonths' => 2,
'showWeek' => true,
],
'inline' => true,
'language' => Yii::$app->language,
]);
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'col-xl order-xl-first']);
echo Html::beginTag('div', ['class' => 'card mb-3']);
echo Html::tag('div', Yii::t('mr42', 'Upcoming Weeks'), ['class' => 'card-header']);
echo Html::tag('h6', Yii::t('mr42', 'Upcoming Weeks'), ['class' => 'card-header']);
echo Html::beginTag('ul', ['class' => 'list-group list-group-flush']);
for ($x = 1; $x <= 6; $x++) {
echo Html::beginTag('li', ['class' => 'list-group-item']);
@@ -52,25 +69,7 @@
}
echo Html::endTag('ul');
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'col-xl']);
echo Html::beginTag('div', ['class' => 'card mb-3']);
echo Html::tag('div', Yii::t('mr42', 'Calendar'), ['class' => 'card-header']);
echo Html::beginTag('div', ['class' => 'card-body mx-auto p-0']);
echo DatePicker::widget([
'clientOptions' => [
'firstDay' => 1,
'numberOfMonths' => 2,
'showWeek' => true,
],
'inline' => true,
'language' => Yii::$app->language,
]);
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('div');
$this->registerJs("$('.ui-datepicker').addClass('border-0 p-0');");
$this->registerJs("$('.ui-datepicker').addClass('border-0 p-0');");
@@ -0,0 +1,54 @@
Options -Indexes -MultiViews +FollowSymlinks
AddDefaultCharset UTF-8
SetEnv TZ Europe/Berlin
Header always set Strict-Transport-Security "max-age=10886400; includeSubDomains; preload" env=HTTPS
Header set Connection keep-alive

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^(www.)?mr42.me [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+?).mister42.me [NC]
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

Rewritecond %{HTTP_HOST} !^mr42.me [NC]
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^(.*)$ %{REQUEST_SCHEME}://www.%{HTTP_HOST}/$1 [R=301,L]

Redirect 301 /lyrics /music/lyrics
RedirectMatch 301 ^/(de|en|ru)/lyrics$ /$1/music/lyrics
RedirectMatch 301 ^/(raspberry)?pi$ /my/pi
RedirectMatch 301 ^/(de|en|ru)/(raspberry)?pi$ /$1/my/pi
RedirectMatch 301 ^/contact$ /my/contact
RedirectMatch 301 ^/(de|en|ru)/contact$ /$1/my/contact

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

RewriteCond %{THE_REQUEST} ^GET.*index.php [NC]
RewriteRule (.*?)index.php/*(.*) /$1$2 [R=301,NE,L]
</IfModule>

# Caching
FileETag All

<IfModule mod_headers.c>
<FilesMatch "\.(ico)$">
Header set Cache-Control "max-age=900, private, must-revalidate"
</FilesMatch>

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

# Compression
SetOutputFilter DEFLATE

# Don't compress images
SetEnvIfNoCase Request_URI .(?:jpe?g|png|gif)$ no-gzip dont-vary

# Don't compress binaries
SetEnvIfNoCase Request_URI .(?:exe|t?gz2?|zip|sit|rar)$ no-gzip dont-vary

0 comments on commit cd6c1f3

Please sign in to comment.
You can’t perform that action at this time.