]> 91.132.146.200 Git - selfpaste.git/commitdiff
basics
authorBanana <banana@mirage>
Thu, 19 Dec 2019 21:39:26 +0000 (22:39 +0100)
committerBanana <banana@mirage>
Thu, 19 Dec 2019 21:39:26 +0000 (22:39 +0100)
webroot/.htaccess [new file with mode: 0644]
webroot/index.php
webroot/logs/.gitignore [new file with mode: 0644]

diff --git a/webroot/.htaccess b/webroot/.htaccess
new file mode 100644 (file)
index 0000000..b66643c
--- /dev/null
@@ -0,0 +1,10 @@
+AddDefaultCharset utf-8
+
+<FilesMatch "\.(log)$">
+  Require all denied
+</FilesMatch>
+
+<IfModule mod_deflate.c>
+    SetOutputFilter DEFLATE
+    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
+</IfModule>
\ No newline at end of file
index ca72d159ebc281d558b32ffd1c5f83733386854d..d7a617290089b16dd602c369c5f0f63dae42b15d 100644 (file)
@@ -8,3 +8,34 @@
 
 # 2019 https://www.bananas-playground.net/projekt/selfpaste
 
+# global debug setting
+define('DEBUG',true);
+
+# Encoding and error reporting setting
+mb_http_output('UTF-8');
+mb_internal_encoding('UTF-8');
+ini_set('error_reporting',-1); // E_ALL & E_STRICT
+
+# default time setting
+date_default_timezone_set('Europe/Berlin');
+
+# check request
+$_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
+if(!empty($_urlToParse)) {
+    # see http://de2.php.net/manual/en/regexp.reference.unicode.php
+    if(preg_match('/[\p{C}\p{M}\p{Sc}\p{Sk}\p{So}\p{Zl}\p{Zp}]/u',$_urlToParse) === 1) {
+        die('Malformed request. Make sure you know what you are doing.');
+    }
+}
+
+ini_set('log_errors',true);
+ini_set('error_log','./logs/error.log');
+if(DEBUG === true) {
+    ini_set('display_errors',true);
+}
+else {
+    ini_set('display_errors',false);
+}
+
+# header information
+header('Content-type: text/html; charset=UTF-8');
\ No newline at end of file
diff --git a/webroot/logs/.gitignore b/webroot/logs/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore