fixed IGB HTTP_HEADER Bug on Nginx servers
fixed PHP warnings in STRICT mode added .htaccess for HTTP or HTTPS server configuration added *.js files for v1.1.1RC1
This commit is contained in:
32
.htaccess
32
.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.
|
||||
<ifmodule mod_expires.c>
|
||||
# fonts
|
||||
<Filesmatch "\.(eot|woff2|woff|ttf|ttf|svg)$">
|
||||
@@ -86,6 +90,4 @@ php_flag log_errors on
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 week"
|
||||
</Filesmatch>
|
||||
</ifmodule>
|
||||
|
||||
|
||||
</ifmodule>
|
||||
82
.htaccess_HTTP
Normal file
82
.htaccess_HTTP
Normal file
@@ -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.
|
||||
<ifmodule mod_expires.c>
|
||||
# fonts
|
||||
<Filesmatch "\.(eot|woff2|woff|ttf|ttf|svg)$">
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 month"
|
||||
Header append Cache-Control "public"
|
||||
</Filesmatch>
|
||||
|
||||
# images/vector graphics
|
||||
<Filesmatch "\.(jpg|jpeg|png|gif|swf|ico|svg)$">
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 year"
|
||||
Header append Cache-Control "public"
|
||||
FileETag None
|
||||
Header unset ETag
|
||||
</Filesmatch>
|
||||
|
||||
# css
|
||||
<Filesmatch "\.(css)$">
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 month"
|
||||
</Filesmatch>
|
||||
|
||||
## js/source maps
|
||||
<Filesmatch "\.(js|map)$">
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 year"
|
||||
Header append Cache-Control "public"
|
||||
FileETag None
|
||||
Header unset ETag
|
||||
</Filesmatch>
|
||||
|
||||
# html templates
|
||||
<Filesmatch "\.(htm|html)$">
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 week"
|
||||
</Filesmatch>
|
||||
</ifmodule>
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user