diff --git a/.htaccess b/.htaccess index 1b0b9a3c..4efdc262 100644 --- a/.htaccess +++ b/.htaccess @@ -1,7 +1,10 @@ -# Enable rewrite engine and route requests to framework +# HTTPS over SSL version +# Information: https://github.com/exodus4d/pathfinder/wiki/Apache + +# Enable rewrite engine and route requests to framework =========================================== RewriteEngine On -# HTTP to HTTPS ---------------------------------------------------------------- +# HTTP to HTTPS =================================================================================== RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ RewriteCond %{HTTP_HOST} !=localhost @@ -11,7 +14,7 @@ RewriteCond %{HTTP_HOST} !=localhost # the subsequent rule will catch it. RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -# Now, rewrite any request to the wrong domain to force www. +# Rewrite NONE www. to force www. ================================================================= RewriteCond %{HTTP_HOST} !^www\. # skip "localhost" (dev environment)... RewriteCond %{HTTP_HOST} !=localhost @@ -20,16 +23,16 @@ RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ # rewrite everything else to "https://" and "www." RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] - # Some servers require you to specify the `RewriteBase` directive # In such cases, it should be the path (relative to the document root) -# containing this .htaccess file -# -#RewriteBase /app/ +# containing this .htaccess file: +# RewriteBase /app/ +# Protect system files ============================================================================ RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteRule ^(lib|tmp)\/|\.(ini|php)$ - [R=404] +# Rewrite "everything" to index.php (dispatcher) ================================================== RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d @@ -37,18 +40,19 @@ RewriteRule .* index.php [L,QSA] RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] -# PHP global Vars +# PHP global Vars (can be set in php.ini as well,...) ============================================= php_value max_input_vars 5000 php_value suhosin.get.max_vars 5000 php_value suhosin.post.max_vars 5000 php_value suhosin.request.max_vars 5000 - -# PHP error logs +# Activate PHP error log ========================================================================== php_flag log_errors on -# php_value error_log "/www/htdocs/w0128162/www.pathfinder.exodus4d.de/logs/php_errors.log" +# php_value error_log "/www/htdocs/www.pathfinder-w.space/logs/php_errors.log" -# caching +# Cache Header ==================================================================================== +# You should not change anything in here! +# New versioned files come with a unique path (e.g. ../js/v1.0.0/..) to force client cache busting. # fonts @@ -86,6 +90,4 @@ php_flag log_errors on ExpiresActive on ExpiresDefault "access plus 1 week" - - - + \ No newline at end of file diff --git a/.htaccess_HTTP b/.htaccess_HTTP new file mode 100644 index 00000000..0063dc18 --- /dev/null +++ b/.htaccess_HTTP @@ -0,0 +1,82 @@ +# HTTP version +# Information: https://github.com/exodus4d/pathfinder/wiki/Apache + +# Enable rewrite engine and route requests to framework =========================================== +RewriteEngine On + +# Rewrite NONE www. to force www. ================================================================= +RewriteCond %{HTTP_HOST} !^www\. +# skip "localhost" (dev environment)... +RewriteCond %{HTTP_HOST} !=localhost +# skip IP calls (dev environment) e.g. 127.0.0.1 +RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ +# rewrite everything else to "http://" and "www." +RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + +# Some servers require you to specify the `RewriteBase` directive +# In such cases, it should be the path (relative to the document root) +# containing this .htaccess file: +# RewriteBase /app/ + +# Protect system files ============================================================================ +RewriteCond %{ENV:REDIRECT_STATUS} ^$ +RewriteRule ^(lib|tmp)\/|\.(ini|php)$ - [R=404] + +# Rewrite "everything" to index.php (dispatcher) ================================================== +RewriteCond %{REQUEST_FILENAME} !-l +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule .* index.php [L,QSA] +RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] + +# PHP global Vars (can be set in php.ini as well,...) ============================================= +php_value max_input_vars 5000 +php_value suhosin.get.max_vars 5000 +php_value suhosin.post.max_vars 5000 +php_value suhosin.request.max_vars 5000 + +# Activate PHP error log ========================================================================== +php_flag log_errors on +php_value error_log "/www/htdocs/w0128162/www.pathfinder-dev.exodus4d.de/logs/php_errors.log" + +# Cache Header ==================================================================================== +# You should not change anything in here! +# New versioned files come with a unique path (e.g. ../js/v1.0.0/..) to force client cache busting. + + # fonts + + ExpiresActive on + ExpiresDefault "access plus 1 month" + Header append Cache-Control "public" + + + # images/vector graphics + + ExpiresActive on + ExpiresDefault "access plus 1 year" + Header append Cache-Control "public" + FileETag None + Header unset ETag + + + # css + + ExpiresActive on + ExpiresDefault "access plus 1 month" + + + ## js/source maps + + ExpiresActive on + ExpiresDefault "access plus 1 year" + Header append Cache-Control "public" + FileETag None + Header unset ETag + + + # html templates + + ExpiresActive on + ExpiresDefault "access plus 1 week" + + \ No newline at end of file diff --git a/app/main/controller/controller.php b/app/main/controller/controller.php index c0de4f32..3f74b859 100644 --- a/app/main/controller/controller.php +++ b/app/main/controller/controller.php @@ -235,11 +235,16 @@ class Controller { static function getRequestHeaders(){ $headers = []; - if(function_exists('apache_request_headers') ){ + $serverData = self::getServerData(); + + if( + function_exists('apache_request_headers') && + $serverData->type === 'apache' + ){ // Apache Webserver $headers = apache_request_headers(); }else{ - // Other webserver, e.g. nginx + // Other webserver, e.g. Nginx // Unfortunately this "fallback" does not work for me (Apache) // Therefore we can“t use this for all servers // https://github.com/exodus4d/pathfinder/issues/58 @@ -249,10 +254,50 @@ class Controller { } } } - + return $headers; } + /** + * get some server information + * @return array + */ + static function getServerData(){ + $f3 = \Base::instance(); + $cacheKey = 'PF_SERVER_INFO'; + + if( !$f3->exists($cacheKey) ){ + $serverData = (object) []; + $serverData->type = '???'; + $serverData->version = '???'; + $serverData->requiredVersion = '???'; + + if(strpos('nginx', strtolower($_SERVER['SERVER_SOFTWARE']) ) !== 1){ + // Nginx server + $serverSoftwareArgs = explode('/', strtolower( $_SERVER['SERVER_SOFTWARE']) ); + $serverData->type = reset($serverSoftwareArgs); + $serverData->version = end($serverSoftwareArgs); + $serverData->requiredVersion = $f3->get('REQUIREMENTS.SERVER.NGINX.VERSION'); + }elseif(strpos('apache', strtolower($_SERVER['SERVER_SOFTWARE']) ) !== 1){ + // Apache server + $matches = preg_split('/[\s,\/ ]+/', strtolower( apache_get_version() ) ); + if(count($matches)){ + $serverData->type = $matches[0]; + if(count($matches) > 1){ + $serverData->version = $matches[1]; + } + } + + $serverData->requiredVersion = $f3->get('REQUIREMENTS.SERVER.APACHE.VERSION'); + } + + // cache data for one day + $f3->set($cacheKey, $serverData, 60 * 60 * 24); + } + + return $f3->get($cacheKey); + } + /** * check if the current request was send from inGame * @return bool diff --git a/app/main/controller/setup.php b/app/main/controller/setup.php index a712562b..19e0569c 100644 --- a/app/main/controller/setup.php +++ b/app/main/controller/setup.php @@ -139,68 +139,6 @@ class Setup extends Controller { $f3->set('checkDatabase', $this->checkDatabase($f3, $fixColumns)); } - /** - * import/upload table data from *.csv - * path: export/db/$tableName.svg - * @param $tableIndex - * @return array - */ - /* - protected function importTableData($tableIndex){ - $importStatus = []; - - // check if tableIndex exists as model class - if(array_key_exists($tableIndex, $this->databases['PF']['models'])){ - $db = DB\Database::instance()->getDB('PF'); - $modelClass = $this->databases['PF']['models'][$tableIndex]; - $model = new $modelClass($db); - $status = $model->importData(); - - if($status){ - $importStatus[] = [ - 'status' => $model->getTable(), - 'message' => 'Added: ' . $status['added'] . ' ' . - 'Updated: ' . $status['updated'] . ' ' . - 'Deleted: ' . $status['deleted'] - ]; - } - } - - return $importStatus; - } - */ - - /** - * export/download table data as *.csv - * target dir export/db/$tableName.svg - * @param $tableIndex - * @return array - */ - /* - protected function exportTableData($tableIndex){ - $exportStatus = []; - - // check if tableIndex exists as model class - if(array_key_exists($tableIndex, $this->databases['PF']['models'])){ - $db = DB\Database::instance()->getDB('PF'); - $modelClass = $this->databases['PF']['models'][$tableIndex]; - $model = new $modelClass($db); - $status = $model->exportData(); - - if( !$status ){ - // error - $error = (object) []; - $error->code = 503; - $error->status = $model->getTable(); - $error->message = 'No data for export found. Table empty?'; - $exportStatus[] = $error; - } - } - - return $exportStatus; - } - */ - /** * get server information * @param $f3 diff --git a/app/pathfinder.ini b/app/pathfinder.ini index be82d30a..1d0f0381 100644 --- a/app/pathfinder.ini +++ b/app/pathfinder.ini @@ -3,7 +3,7 @@ [PATHFINDER] NAME = PATHFINDER ; installed version (used for CSS/JS cache busting) -VERSION = v0.0.17 +VERSION = v1.0.0RC1 ; contact information (DO NOT CHANGE) CONTACT = https://github.com/exodus4d ; source code (DO NOT CHANGE) diff --git a/public/js/v0.0.17/app.js b/public/js/v1.0.0RC1/app.js similarity index 100% rename from public/js/v0.0.17/app.js rename to public/js/v1.0.0RC1/app.js diff --git a/public/js/v0.0.17/app.js.map b/public/js/v1.0.0RC1/app.js.map similarity index 100% rename from public/js/v0.0.17/app.js.map rename to public/js/v1.0.0RC1/app.js.map diff --git a/public/js/v0.0.17/app.js.src.js b/public/js/v1.0.0RC1/app.js.src.js similarity index 100% rename from public/js/v0.0.17/app.js.src.js rename to public/js/v1.0.0RC1/app.js.src.js diff --git a/public/js/v0.0.17/app/landingpage.js b/public/js/v1.0.0RC1/app/landingpage.js similarity index 100% rename from public/js/v0.0.17/app/landingpage.js rename to public/js/v1.0.0RC1/app/landingpage.js diff --git a/public/js/v0.0.17/app/landingpage.js.map b/public/js/v1.0.0RC1/app/landingpage.js.map similarity index 100% rename from public/js/v0.0.17/app/landingpage.js.map rename to public/js/v1.0.0RC1/app/landingpage.js.map diff --git a/public/js/v0.0.17/app/mappage.js b/public/js/v1.0.0RC1/app/mappage.js similarity index 100% rename from public/js/v0.0.17/app/mappage.js rename to public/js/v1.0.0RC1/app/mappage.js diff --git a/public/js/v0.0.17/app/mappage.js.map b/public/js/v1.0.0RC1/app/mappage.js.map similarity index 100% rename from public/js/v0.0.17/app/mappage.js.map rename to public/js/v1.0.0RC1/app/mappage.js.map diff --git a/public/js/v0.0.17/app/notification.js b/public/js/v1.0.0RC1/app/notification.js similarity index 100% rename from public/js/v0.0.17/app/notification.js rename to public/js/v1.0.0RC1/app/notification.js diff --git a/public/js/v0.0.17/app/notification.js.map b/public/js/v1.0.0RC1/app/notification.js.map similarity index 100% rename from public/js/v0.0.17/app/notification.js.map rename to public/js/v1.0.0RC1/app/notification.js.map diff --git a/public/js/v0.0.17/app/setup.js b/public/js/v1.0.0RC1/app/setup.js similarity index 100% rename from public/js/v0.0.17/app/setup.js rename to public/js/v1.0.0RC1/app/setup.js diff --git a/public/js/v0.0.17/app/setup.js.map b/public/js/v1.0.0RC1/app/setup.js.map similarity index 100% rename from public/js/v0.0.17/app/setup.js.map rename to public/js/v1.0.0RC1/app/setup.js.map diff --git a/public/js/v0.0.17/build.txt b/public/js/v1.0.0RC1/build.txt similarity index 100% rename from public/js/v0.0.17/build.txt rename to public/js/v1.0.0RC1/build.txt diff --git a/public/js/v0.0.17/lib/bootstrap-image-gallery.js b/public/js/v1.0.0RC1/lib/bootstrap-image-gallery.js similarity index 100% rename from public/js/v0.0.17/lib/bootstrap-image-gallery.js rename to public/js/v1.0.0RC1/lib/bootstrap-image-gallery.js diff --git a/public/js/v0.0.17/lib/bootstrap-image-gallery.js.map b/public/js/v1.0.0RC1/lib/bootstrap-image-gallery.js.map similarity index 100% rename from public/js/v0.0.17/lib/bootstrap-image-gallery.js.map rename to public/js/v1.0.0RC1/lib/bootstrap-image-gallery.js.map diff --git a/public/js/v0.0.17/lib/bootstrap-image-gallery.js.src.js b/public/js/v1.0.0RC1/lib/bootstrap-image-gallery.js.src.js similarity index 100% rename from public/js/v0.0.17/lib/bootstrap-image-gallery.js.src.js rename to public/js/v1.0.0RC1/lib/bootstrap-image-gallery.js.src.js diff --git a/public/js/v0.0.17/lib/datatables/dataTables.bootstrap.js b/public/js/v1.0.0RC1/lib/datatables/dataTables.bootstrap.js similarity index 100% rename from public/js/v0.0.17/lib/datatables/dataTables.bootstrap.js rename to public/js/v1.0.0RC1/lib/datatables/dataTables.bootstrap.js diff --git a/public/js/v0.0.17/lib/datatables/dataTables.bootstrap.js.map b/public/js/v1.0.0RC1/lib/datatables/dataTables.bootstrap.js.map similarity index 100% rename from public/js/v0.0.17/lib/datatables/dataTables.bootstrap.js.map rename to public/js/v1.0.0RC1/lib/datatables/dataTables.bootstrap.js.map diff --git a/public/js/v0.0.17/lib/datatables/dataTables.bootstrap.js.src.js b/public/js/v1.0.0RC1/lib/datatables/dataTables.bootstrap.js.src.js similarity index 100% rename from public/js/v0.0.17/lib/datatables/dataTables.bootstrap.js.src.js rename to public/js/v1.0.0RC1/lib/datatables/dataTables.bootstrap.js.src.js diff --git a/public/js/v0.0.17/lib/datatables/extensions/tabletools/Readme.txt b/public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/Readme.txt similarity index 100% rename from public/js/v0.0.17/lib/datatables/extensions/tabletools/Readme.txt rename to public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/Readme.txt diff --git a/public/js/v0.0.17/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js b/public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js similarity index 100% rename from public/js/v0.0.17/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js rename to public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js diff --git a/public/js/v0.0.17/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.map b/public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.map similarity index 100% rename from public/js/v0.0.17/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.map rename to public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.map diff --git a/public/js/v0.0.17/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.src.js b/public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.src.js similarity index 100% rename from public/js/v0.0.17/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.src.js rename to public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js.src.js diff --git a/public/js/v0.0.17/lib/datatables/extensions/tabletools/swf/copy_csv_xls.swf b/public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/swf/copy_csv_xls.swf similarity index 100% rename from public/js/v0.0.17/lib/datatables/extensions/tabletools/swf/copy_csv_xls.swf rename to public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/swf/copy_csv_xls.swf diff --git a/public/js/v0.0.17/lib/datatables/extensions/tabletools/swf/copy_csv_xls_pdf.swf b/public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/swf/copy_csv_xls_pdf.swf similarity index 100% rename from public/js/v0.0.17/lib/datatables/extensions/tabletools/swf/copy_csv_xls_pdf.swf rename to public/js/v1.0.0RC1/lib/datatables/extensions/tabletools/swf/copy_csv_xls_pdf.swf diff --git a/public/js/v0.0.17/lib/jquery.fullscreen.min.js b/public/js/v1.0.0RC1/lib/jquery.fullscreen.min.js similarity index 100% rename from public/js/v0.0.17/lib/jquery.fullscreen.min.js rename to public/js/v1.0.0RC1/lib/jquery.fullscreen.min.js diff --git a/public/js/v0.0.17/lib/jquery.fullscreen.min.js.map b/public/js/v1.0.0RC1/lib/jquery.fullscreen.min.js.map similarity index 100% rename from public/js/v0.0.17/lib/jquery.fullscreen.min.js.map rename to public/js/v1.0.0RC1/lib/jquery.fullscreen.min.js.map diff --git a/public/js/v0.0.17/lib/jquery.fullscreen.min.js.src.js b/public/js/v1.0.0RC1/lib/jquery.fullscreen.min.js.src.js similarity index 100% rename from public/js/v0.0.17/lib/jquery.fullscreen.min.js.src.js rename to public/js/v1.0.0RC1/lib/jquery.fullscreen.min.js.src.js diff --git a/public/js/v0.0.17/lib/require.js b/public/js/v1.0.0RC1/lib/require.js similarity index 100% rename from public/js/v0.0.17/lib/require.js rename to public/js/v1.0.0RC1/lib/require.js diff --git a/public/js/v0.0.17/lib/require.js.map b/public/js/v1.0.0RC1/lib/require.js.map similarity index 100% rename from public/js/v0.0.17/lib/require.js.map rename to public/js/v1.0.0RC1/lib/require.js.map diff --git a/public/js/v0.0.17/lib/require.js.src.js b/public/js/v1.0.0RC1/lib/require.js.src.js similarity index 100% rename from public/js/v0.0.17/lib/require.js.src.js rename to public/js/v1.0.0RC1/lib/require.js.src.js