Cleanup some code

This commit is contained in:
the-djmaze 2022-03-04 23:46:37 +01:00
parent 2a3e22344e
commit f44507a69b
4 changed files with 6 additions and 41 deletions

View file

@ -919,10 +919,9 @@ class Actions
$aResult['Language'] = $this->ValidateLanguage($sLanguage, '', false);
$aResult['UserLanguage'] = $this->ValidateLanguage($UserLanguageRaw, '', false, true);
$aResult['PluginsLink'] = '';
if (0 < $this->oPlugins->Count() && $this->oPlugins->HaveJs($bAdmin)) {
$aResult['PluginsLink'] = './?/Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $sStaticCache . '/';
}
$aResult['PluginsLink'] = $this->oPlugins->HaveJs($bAdmin)
? './?/Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $sStaticCache . '/'
: '';
$bAppJsDebug = $this->oConfig->Get('labs', 'use_app_debug_js', false);

View file

@ -116,7 +116,7 @@ class Manager
}
else
{
$this->Actions()->Logger()->Write('Cannot get installed plugins from '.APP_PLUGINS_PATH,
$this->oActions->Logger()->Write('Cannot get installed plugins from '.APP_PLUGINS_PATH,
\MailSo\Log\Enumerations\Type::ERROR);
}

View file

@ -262,38 +262,4 @@ abstract class Repository
return $bResult;
}
private static function pluginEnable(string $sName, bool $bEnable = true) : bool
{
if (!\strlen($sName))
{
return false;
}
$oConfig = \RainLoop\Api::Config();
$sEnabledPlugins = $oConfig->Get('plugins', 'enabled_list', '');
$aEnabledPlugins = \explode(',', \strtolower($sEnabledPlugins));
$aEnabledPlugins = \array_map('trim', $aEnabledPlugins);
$aNewEnabledPlugins = array();
if ($bEnable)
{
$aNewEnabledPlugins = $aEnabledPlugins;
$aNewEnabledPlugins[] = $sName;
}
else
{
foreach ($aEnabledPlugins as $sPlugin)
{
if ($sName !== $sPlugin && \strlen($sPlugin))
{
$aNewEnabledPlugins[] = $sPlugin;
}
}
}
$oConfig->Set('plugins', 'enabled_list', \trim(\implode(',', \array_unique($aNewEnabledPlugins)), ' ,'));
return $oConfig->Save();
}
}

View file

@ -146,13 +146,13 @@ abstract class Upgrade
/**
* Decodes old less secure data
*/
private static function DecodeKeyValues(string $sData, string $sCustomKey = '') : array
private static function DecodeKeyValues(string $sData) : array
{
$sData = \MailSo\Base\Utils::UrlSafeBase64Decode($sData);
if (!\strlen($sData)) {
return '';
}
$sKey = \md5(APP_SALT . $sCustomKey);
$sKey = \md5(APP_SALT);
$sData = \is_callable('xxtea_decrypt')
? \xxtea_decrypt($sData, $sKey)
: \MailSo\Base\Xxtea::decrypt($sData, $sKey);