More PHP7 strict typing

This commit is contained in:
djmaze 2020-03-11 11:49:45 +01:00
parent 3a7ec4ecb0
commit e8d38a6870
6 changed files with 13 additions and 30 deletions

View file

@ -7,10 +7,6 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
\define('RAINLOOP_INCLUDE_AS_API_DEF', isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']); \define('RAINLOOP_INCLUDE_AS_API_DEF', isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']);
if (!\function_exists('mb_strtoupper')) {
exit('PHP mbstring required');
}
function rainLoopSplAutoloadNamespaces() : array function rainLoopSplAutoloadNamespaces() : array
{ {
return RAINLOOP_INCLUDE_AS_API_DEF ? array('RainLoop', 'Predis') : return RAINLOOP_INCLUDE_AS_API_DEF ? array('RainLoop', 'Predis') :

View file

@ -218,7 +218,7 @@ class Service
} }
$sResult .= '<!--'; $sResult .= '<!--';
$sResult .= '[time:'.\substr(\microtime(true) - APP_START, 0, 6); $sResult .= '[time:'.\substr(\microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], 0, 6);
$sResult .= '][AGPLv3'; $sResult .= '][AGPLv3';
$sResult .= '][cached:'.($bCached ? 'true' : 'false'); $sResult .= '][cached:'.($bCached ? 'true' : 'false');
// $sResult .= '][hash:'.$aTemplateParameters['{{BaseHash}}']; // $sResult .= '][hash:'.$aTemplateParameters['{{BaseHash}}'];

View file

@ -170,6 +170,11 @@ class ServiceActions
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
error_log($oException->getMessage());
if ($e = $oException->getPrevious()) {
error_log("\t".$e->getMessage());
}
$aResponseItem = $this->oActions->ExceptionResponse( $aResponseItem = $this->oActions->ExceptionResponse(
empty($sAction) ? 'Unknown' : $sAction, $oException); empty($sAction) ? 'Unknown' : $sAction, $oException);
@ -193,7 +198,7 @@ class ServiceActions
if (\is_array($aResponseItem)) if (\is_array($aResponseItem))
{ {
$aResponseItem['Time'] = (int) ((\microtime(true) - APP_START) * 1000); $aResponseItem['Time'] = (int) ((\microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000);
$sUpdateToken = $this->oActions->GetUpdateAuthToken(); $sUpdateToken = $this->oActions->GetUpdateAuthToken();
if ($sUpdateToken) if ($sUpdateToken)

View file

@ -47,10 +47,7 @@ class Utils
\RainLoop\Utils::$RsaKey = \is_string(\RainLoop\Utils::$RsaKey) ? \RainLoop\Utils::$RsaKey : ''; \RainLoop\Utils::$RsaKey = \is_string(\RainLoop\Utils::$RsaKey) ? \RainLoop\Utils::$RsaKey : '';
} }
/** static public function EncryptStringRSA(string $sString, string $sKey = '') : string
* @return string|false
*/
static public function EncryptStringRSA(string $sString, string $sKey = '')
{ {
$sResult = ''; $sResult = '';
$sKey = \md5($sKey); $sKey = \md5($sKey);
@ -87,10 +84,7 @@ class Utils
return $sResult; return $sResult;
} }
/** static public function DecryptStringRSA(string $sString, string $sKey = '') : string
* @return string|false
*/
static public function DecryptStringRSA(string $sString, string $sKey = '')
{ {
$sResult = ''; $sResult = '';
$sKey = \md5($sKey); $sKey = \md5($sKey);
@ -425,6 +419,7 @@ class Utils
$sAppPath = ''; $sAppPath = '';
return $sAppPath; return $sAppPath;
} }
public static function WebVersionPath() : string public static function WebVersionPath() : string
{ {
return self::WebPath().'rainloop/v/'.APP_VERSION.'/'; return self::WebPath().'rainloop/v/'.APP_VERSION.'/';

View file

@ -137,15 +137,6 @@
</a> </a>
</span> </span>
</div> </div>
<div class="e-languages thm-languages plugin-mark-Login-BottomFooter"
data-bind="visible: allowLanguagesOnLogin()">
<label class="flag-selector">
<i data-bind="css: langRequest() ? 'icon-spinner animated' : 'icon-world'"></i>
&nbsp;&nbsp;
<span class="flag-name" tabindex="0"
data-bind="text: languageFullName, click: selectLanguage, onSpace: selectLanguage, onEnter: selectLanguage, onTab: selectLanguageOnTab"></span>
</label>
</div>
{{INCLUDE/BottomFooter/PLACE}} {{INCLUDE/BottomFooter/PLACE}}
</center> </center>
</div> </div>

View file

@ -2,17 +2,15 @@
if (defined('APP_VERSION')) if (defined('APP_VERSION'))
{ {
if (!defined('APP_START')) if (!defined('APP_START_TIME'))
{ {
define('APP_START', microtime(true));
@ini_set('register_globals', 0); @ini_set('register_globals', 0);
@ini_set('zend.ze1_compatibility_mode', 0); @ini_set('zend.ze1_compatibility_mode', 0);
@ini_set('magic_quotes_gpc', 0); @ini_set('magic_quotes_gpc', 0);
@ini_set('magic_quotes_runtime', 0); @ini_set('magic_quotes_runtime', 0);
define('APP_START_TIME', time()); define('APP_START_TIME', time());
define('APP_REQUEST_RND', md5(APP_START.rand(10000, 99999).APP_START)); define('APP_REQUEST_RND', function_exists('uuid_create') ? md5(uuid_create(UUID_TYPE_DEFAULT)) : bin2hex(random_bytes(16)));
define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/'); define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/');
define('APP_USE_APC_CACHE', true); define('APP_USE_APC_CACHE', true);
@ -123,9 +121,7 @@
if (false === $sSalt) if (false === $sSalt)
{ {
// random salt // random salt
$sSalt = '<'.'?php //'.bin2hex(random_bytes(48)); file_put_contents(APP_DATA_FOLDER_PATH.'SALT.php', '<'.'?php //'.bin2hex(random_bytes(48)));
@file_put_contents(APP_DATA_FOLDER_PATH.'SALT.php', $sSalt);
} }
define('APP_SALT', md5($sSalt.APP_PRIVATE_DATA_NAME.$sSalt)); define('APP_SALT', md5($sSalt.APP_PRIVATE_DATA_NAME.$sSalt));