diff --git a/README.md b/README.md index ff9d9d9a1..4d86c0e84 100644 --- a/README.md +++ b/README.md @@ -36,50 +36,59 @@ This fork has the following changes: * Admin uses password_hash/password_verify * Auth failed attempts written to syslog * Added Fail2ban instructions -* ES2015 (removed polyfills and Modernizr) +* ES2015 * PHP 7.3+ required * PHP mbstring extension required * PHP replaced pclZip with ZipArchive * PHP yaml extension else use the old Spyc * Removed BackwardCapability (class \RainLoop\Account) * Removed ChangePassword (plugins won't work) -* Removed JS nanoscroll, jquery-scrollstop, jquery-mousewheel, matchmedia-polyfill * Removed OAuth support * Removed POP3 support * Removed background video support * Removed Sentry (Application Monitoring and Error Tracking Software) * Replaced gulp-uglify with gulp-terser * CRLF => LF line endings -* Converted underscore.js to native code * Ongoing removal of old JavaScript code (things are native these days) ### Removal of old JavaScript -This fork uses jQuery.slim, downsized/simplified versions of scripts and has no support for Internet Explorer. +This fork uses downsized/simplified versions of scripts and has no support for Internet Explorer. The result is faster and smaller download code (good for mobile networks). Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyfill for array.flat(). -|js/* |1.14.0 |native | -|----------- |--------: |--------: | -|admin.js |2.130.942 |1.222.392 | -|app.js |4.184.455 |2.984.765 | -|boot.js | 671.522 | 94.230 | -|libs.js | 647.614 | 507.015 | -|polyfills.js | 325.834 | 0 | -|TOTAL js |7.960.367 |4.808.402 | +* Replaced jQuery with jQuery.slim +* Removed pikaday +* Removed underscore +* Removed polyfills +* Removed Modernizr +* Removed nanoscroll +* Removed jquery-scrollstop +* Removed jquery-mousewheel +* Removed matchmedia-polyfill -|js/min/* |1.14.0 |native | -|--------------- |--------: |--------: | -|admin.min.js | 252.147 | 157.533 | -|app.min.js | 511.202 | 389.339 | -|boot.min.js | 66.007 | 11.575 | -|libs.min.js | 572.545 | 464.161 | -|polyfills.min.js | 32.452 | 0 | -|TOTAL js/min |1.434.353 |1.022.608 | +|js/* |1.14.0 |native |gzip 1.14 |gzip | +|----------- |--------: |--------: |--------: |--------: | +|admin.js |2.130.942 |1.221.247 | 485.481 | 299.073 | +|app.js |4.184.455 |2.984.765 | 932.725 | 697.869 | +|boot.js | 671.522 | 94.230 | 169.502 | 28.386 | +|libs.js | 647.614 | 507.015 | 194.728 | 153.918 | +|polyfills.js | 325.834 | 0 | 71.825 | 0 | +|TOTAL js |7.960.367 |4.807.257 |1.854.261 |1.179.246 | + +|js/min/* |1.14.0 |native |gzip 1.14 |gzip | +|--------------- |--------: |--------: |--------: |--------: | +|admin.min.js | 252.147 | 157.523 | 73.657 | 45.136 | +|app.min.js | 511.202 | 389.339 |140.462 |102.945 | +|boot.min.js | 66.007 | 11.575 | 22.567 | 4.461 | +|libs.min.js | 572.545 | 464.161 |176.720 |143.916 | +|polyfills.min.js | 32.452 | 0 | 11.312 | 0 | +|TOTAL js/min |1.434.353 |1.022.598 |424.718 |296.458 | + +411.755 bytes (128.260 gzip) is not much, but it feels faster. -411.745 bytes is not much, but it feels faster. |css/* |1.14.0 |native | |-------------- |--------: |--------: | diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php index 783a4ab54..8e20157fe 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php @@ -215,7 +215,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient foreach ($aResponse as $sLine) { $aTokens = $this->parseLine($sLine); - if (false === $aTokens) + if (!$aTokens) { continue; } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index c3b9089b4..3cc3c517f 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -635,7 +635,7 @@ class ServiceActions $sThemeValuesFile = APP_VERSION_ROOT_PATH.'app/templates/Themes/values.less'; $sThemeTemplateFile = APP_VERSION_ROOT_PATH.'app/templates/Themes/template.less'; - if (\file_exists($sThemeFile) && \file_exists($sThemeTemplateFile) && \file_exists($sThemeValuesFile)) + if (\is_file($sThemeFile) && \is_file($sThemeTemplateFile) && \is_file($sThemeValuesFile)) { $aResult[] = '@base: "'. ($bCustomTheme ? Utils::WebPath() : Utils::WebVersionPath()). @@ -645,7 +645,7 @@ class ServiceActions $aResult[] = \file_get_contents($sThemeFile); $aResult[] = \file_get_contents($sThemeTemplateFile); - if (\file_exists($sThemeExtFile)) + if (\is_file($sThemeExtFile)) { $aResult[] = \file_get_contents($sThemeExtFile); } @@ -1037,7 +1037,7 @@ class ServiceActions $sMomentFileName = APP_VERSION_ROOT_PATH.'app/localization/moment/'. $this->convertLanguageNameToMomentLanguageName($sLanguage).'.js'; - if (\file_exists($sMomentFileName)) + if (\is_file($sMomentFileName)) { $sMoment = \file_get_contents($sMomentFileName); $sMoment = \preg_replace('/\/\/[^\n]+\n/', '', $sMoment); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/UserAgent.php b/rainloop/v/0.0.0/app/libraries/RainLoop/UserAgent.php index 8eea3a229..05ebc28ee 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/UserAgent.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/UserAgent.php @@ -150,8 +150,10 @@ class UserAgent public static function getHeader() : string { static $agent; - if (null === $agent && isset($_SERVER['HTTP_USER_AGENT'])) { - $agent = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 500)); + if (null === $agent) { + $agent = isset($_SERVER['HTTP_USER_AGENT']) + ? strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 500)) + : ''; } return $agent; } diff --git a/rainloop/v/0.0.0/app/templates/Index.html b/rainloop/v/0.0.0/app/templates/Index.html index a8af1e87e..3fd0f8b2f 100644 --- a/rainloop/v/0.0.0/app/templates/Index.html +++ b/rainloop/v/0.0.0/app/templates/Index.html @@ -22,6 +22,7 @@
+
diff --git a/rainloop/v/0.0.0/include.php b/rainloop/v/0.0.0/include.php index 0444ad6a5..0537eb0d2 100644 --- a/rainloop/v/0.0.0/include.php +++ b/rainloop/v/0.0.0/include.php @@ -28,7 +28,7 @@ define('APP_DEFAULT_PRIVATE_DATA_NAME', '_default_'); - $sPrivateDataFolderInternalName = file_exists(APP_INDEX_ROOT_PATH.'MULTIPLY') ? APP_SITE : ''; + $sPrivateDataFolderInternalName = is_file(APP_INDEX_ROOT_PATH.'MULTIPLY') ? APP_SITE : ''; define('APP_PRIVATE_DATA_NAME', 0 === strlen($sPrivateDataFolderInternalName) ? APP_DEFAULT_PRIVATE_DATA_NAME : $sPrivateDataFolderInternalName); define('APP_MULTIPLY', 0 < strlen($sPrivateDataFolderInternalName) && APP_DEFAULT_PRIVATE_DATA_NAME !== APP_PRIVATE_DATA_NAME); @@ -40,7 +40,7 @@ $sCustomDataPath = ''; $sCustomConfiguration = ''; - if (file_exists(APP_INDEX_ROOT_PATH.'include.php')) + if (is_file(APP_INDEX_ROOT_PATH.'include.php')) { include_once APP_INDEX_ROOT_PATH.'include.php'; } @@ -55,9 +55,9 @@ define('APP_DATA_FOLDER_PATH_UNIX', str_replace('\\', '/', APP_DATA_FOLDER_PATH)); - $sSalt = file_get_contents(APP_DATA_FOLDER_PATH.'SALT.php'); - $sData = file_exists(APP_DATA_FOLDER_PATH.'DATA.php') ? file_get_contents(APP_DATA_FOLDER_PATH.'DATA.php') : ''; - $sInstalled = file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED'); + $sSalt = is_file(APP_DATA_FOLDER_PATH.'SALT.php') ? file_get_contents(APP_DATA_FOLDER_PATH.'SALT.php') : ''; + $sData = is_file(APP_DATA_FOLDER_PATH.'DATA.php') ? file_get_contents(APP_DATA_FOLDER_PATH.'DATA.php') : ''; + $sInstalled = is_file(APP_DATA_FOLDER_PATH.'INSTALLED') ? file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED') : ''; // installation checking data folder if (APP_VERSION !== $sInstalled) @@ -68,8 +68,8 @@ $sCheckFolder = APP_DATA_FOLDER_PATH.$sCheckName; $sCheckFilePath = APP_DATA_FOLDER_PATH.$sCheckName.'/'.$sCheckName.'.file'; - unlink($sCheckFilePath); - rmdir($sCheckFolder); + is_file($sCheckFilePath) && unlink($sCheckFilePath); + is_dir($sCheckFolder) && rmdir($sCheckFolder); if (!is_dir(APP_DATA_FOLDER_PATH)) { @@ -136,9 +136,9 @@ file_put_contents(APP_DATA_FOLDER_PATH.'index.html', 'Forbidden'); file_put_contents(APP_DATA_FOLDER_PATH.'index.php', 'Forbidden'); - if (!file_exists(APP_DATA_FOLDER_PATH.'.htaccess') && file_exists(APP_VERSION_ROOT_PATH.'app/.htaccess')) + if (!is_file(APP_DATA_FOLDER_PATH.'.htaccess') && is_file(APP_VERSION_ROOT_PATH.'app/.htaccess')) { - file_put_contents(APP_DATA_FOLDER_PATH.'.htaccess', file_get_contents(APP_VERSION_ROOT_PATH.'app/.htaccess')); + copy(APP_VERSION_ROOT_PATH.'app/.htaccess', APP_DATA_FOLDER_PATH.'.htaccess'); } if (!is_dir(APP_PRIVATE_DATA))