mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 06:57:03 +03:00
Improvements of message displaying (internal styles)
This commit is contained in:
parent
0bba7146a6
commit
4457cdbc23
46 changed files with 1967 additions and 359 deletions
|
|
@ -411,16 +411,17 @@ class Actions
|
|||
/**
|
||||
* @param string $sLine
|
||||
* @param \RainLoop\Model\Account $oAccount = null
|
||||
* @param bool $bUrlEncode = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function compileLogParams($sLine, $oAccount = null)
|
||||
private function compileLogParams($sLine, $oAccount = null, $bUrlEncode = false)
|
||||
{
|
||||
if (false !== \strpos($sLine, '{date:'))
|
||||
{
|
||||
$iTimeOffset = (int) $this->Config()->Get('logs', 'time_offset', 0);
|
||||
$sLine = \preg_replace_callback('/\{date:([^}]+)\}/', function ($aMatch) use ($iTimeOffset) {
|
||||
return \MailSo\Log\Logger::DateHelper($aMatch[1], $iTimeOffset);
|
||||
$sLine = \preg_replace_callback('/\{date:([^}]+)\}/', function ($aMatch) use ($iTimeOffset, $bUrlEncode) {
|
||||
return \RainLoop\Utils::UrlEncode(\MailSo\Log\Logger::DateHelper($aMatch[1], $iTimeOffset), $bUrlEncode);
|
||||
}, $sLine);
|
||||
|
||||
$sLine = \preg_replace('/\{date:([^}]*)\}/', 'date', $sLine);
|
||||
|
|
@ -436,37 +437,38 @@ class Actions
|
|||
|
||||
if ($oAccount)
|
||||
{
|
||||
$sLine = \str_replace('{imap:login}', $oAccount->IncLogin(), $sLine);
|
||||
$sLine = \str_replace('{imap:host}', $oAccount->DomainIncHost(), $sLine);
|
||||
$sLine = \str_replace('{imap:port}', $oAccount->DomainIncPort(), $sLine);
|
||||
$sLine = \str_replace('{imap:login}', \RainLoop\Utils::UrlEncode($oAccount->IncLogin(), $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{imap:host}', \RainLoop\Utils::UrlEncode($oAccount->DomainIncHost(), $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{imap:port}', \RainLoop\Utils::UrlEncode($oAccount->DomainIncPort(), $bUrlEncode), $sLine);
|
||||
|
||||
$sLine = \str_replace('{smtp:login}', $oAccount->OutLogin(), $sLine);
|
||||
$sLine = \str_replace('{smtp:host}', $oAccount->DomainOutHost(), $sLine);
|
||||
$sLine = \str_replace('{smtp:port}', $oAccount->DomainOutPort(), $sLine);
|
||||
$sLine = \str_replace('{smtp:login}', \RainLoop\Utils::UrlEncode($oAccount->OutLogin(), $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{smtp:host}', \RainLoop\Utils::UrlEncode($oAccount->DomainOutHost(), $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{smtp:port}', \RainLoop\Utils::UrlEncode($oAccount->DomainOutPort(), $bUrlEncode), $sLine);
|
||||
}
|
||||
|
||||
$sLine = \preg_replace('/\{imap:([^}]*)\}/i', 'imap', $sLine);
|
||||
$sLine = \preg_replace('/\{smtp:([^}]*)\}/i', 'imap', $sLine);
|
||||
$sLine = \preg_replace('/\{smtp:([^}]*)\}/i', 'smtp', $sLine);
|
||||
}
|
||||
|
||||
if (false !== \strpos($sLine, '{request:'))
|
||||
{
|
||||
if (false !== \strpos($sLine, '{request:ip}'))
|
||||
{
|
||||
$sLine = \str_replace('{request:ip}', $this->Http()->GetClientIp(
|
||||
$this->Config()->Get('labs', 'http_client_ip_check_proxy', false)), $sLine);
|
||||
$sLine = \str_replace('{request:ip}', \RainLoop\Utils::UrlEncode($this->Http()->GetClientIp(
|
||||
$this->Config()->Get('labs', 'http_client_ip_check_proxy', false)), $bUrlEncode), $sLine);
|
||||
}
|
||||
|
||||
if (false !== \strpos($sLine, '{request:domain}'))
|
||||
{
|
||||
$sLine = \str_replace('{request:domain}',
|
||||
$this->Http()->GetHost(false, true, true), $sLine);
|
||||
\RainLoop\Utils::UrlEncode($this->Http()->GetHost(false, true, true), $bUrlEncode), $sLine);
|
||||
}
|
||||
|
||||
if (false !== \strpos($sLine, '{request:domain-clear}'))
|
||||
{
|
||||
$sLine = \str_replace('{request:domain-clear}',
|
||||
\MailSo\Base\Utils::GetClearDomainName($this->Http()->GetHost(false, true, true)), $sLine);
|
||||
\RainLoop\Utils::UrlEncode(
|
||||
\MailSo\Base\Utils::GetClearDomainName($this->Http()->GetHost(false, true, true)), $bUrlEncode), $sLine);
|
||||
}
|
||||
|
||||
$sLine = \preg_replace('/\{request:([^}]*)\}/i', 'request', $sLine);
|
||||
|
|
@ -477,15 +479,16 @@ class Actions
|
|||
if (false !== \strpos($sLine, '{user:uid}'))
|
||||
{
|
||||
$sLine = \str_replace('{user:uid}',
|
||||
\base_convert(\sprintf('%u', \crc32(\md5(\RainLoop\Utils::GetConnectionToken()))), 10, 32),
|
||||
\RainLoop\Utils::UrlEncode(\base_convert(\sprintf('%u',
|
||||
\crc32(\md5(\RainLoop\Utils::GetConnectionToken()))), 10, 32), $bUrlEncode),
|
||||
$sLine
|
||||
);
|
||||
}
|
||||
|
||||
if (false !== \strpos($sLine, '{user:ip}'))
|
||||
{
|
||||
$sLine = \str_replace('{user:ip}', $this->Http()->GetClientIp(
|
||||
$this->Config()->Get('labs', 'http_client_ip_check_proxy', false)), $sLine);
|
||||
$sLine = \str_replace('{user:ip}', \RainLoop\Utils::UrlEncode($this->Http()->GetClientIp(
|
||||
$this->Config()->Get('labs', 'http_client_ip_check_proxy', false)), $bUrlEncode), $sLine);
|
||||
}
|
||||
|
||||
if (\preg_match('/\{user:(email|login|domain)\}/i', $sLine))
|
||||
|
|
@ -499,13 +502,15 @@ class Actions
|
|||
if ($oAccount)
|
||||
{
|
||||
$sEmail = $oAccount->Email();
|
||||
$sLine = \str_replace('{user:email}', $sEmail, $sLine);
|
||||
$sLine = \str_replace('{user:login}',
|
||||
\MailSo\Base\Utils::GetAccountNameFromEmail($sEmail), $sLine);
|
||||
$sLine = \str_replace('{user:domain}',
|
||||
\MailSo\Base\Utils::GetDomainFromEmail($sEmail), $sLine);
|
||||
$sLine = \str_replace('{user:domain-clear}',
|
||||
\MailSo\Base\Utils::GetClearDomainName(\MailSo\Base\Utils::GetDomainFromEmail($sEmail)), $sLine);
|
||||
|
||||
$sLine = \str_replace('{user:email}', \RainLoop\Utils::UrlEncode($sEmail, $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{user:login}', \RainLoop\Utils::UrlEncode(
|
||||
\MailSo\Base\Utils::GetAccountNameFromEmail($sEmail), $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{user:domain}', \RainLoop\Utils::UrlEncode(
|
||||
\MailSo\Base\Utils::GetDomainFromEmail($sEmail), $bUrlEncode), $sLine);
|
||||
$sLine = \str_replace('{user:domain-clear}', \RainLoop\Utils::UrlEncode(
|
||||
\MailSo\Base\Utils::GetClearDomainName(
|
||||
\MailSo\Base\Utils::GetDomainFromEmail($sEmail)), $bUrlEncode), $sLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -997,6 +1002,18 @@ class Actions
|
|||
|
||||
if (!!$this->Config()->Get('logs', 'enable', false))
|
||||
{
|
||||
$sSessionFilter = (string) $this->Config()->Get('logs', 'session_filter', '');
|
||||
if (!empty($sSessionFilter))
|
||||
{
|
||||
$aSessionParts = \explode(':', $sSessionFilter, 2);
|
||||
|
||||
if (empty($aSessionParts[0]) || empty($aSessionParts[1]) ||
|
||||
(string) $aSessionParts[1] !== (string) \RainLoop\Utils::GetCookie($aSessionParts[0], ''))
|
||||
{
|
||||
return $this->oLogger;
|
||||
}
|
||||
}
|
||||
|
||||
$iTimeOffset = (int) $this->Config()->Get('logs', 'time_offset', 0);
|
||||
|
||||
$this->oLogger->SetShowSecter(!$this->Config()->Get('logs', 'hide_passwords', true));
|
||||
|
|
@ -1370,6 +1387,7 @@ class Actions
|
|||
'LoginDefaultDomain' => $oConfig->Get('login', 'default_domain', ''),
|
||||
'DetermineUserLanguage' => (bool) $oConfig->Get('login', 'determine_user_language', true),
|
||||
'DetermineUserDomain' => (bool) $oConfig->Get('login', 'determine_user_domain', false),
|
||||
'UseLoginWelcomePage' => (bool) $oConfig->Get('login', 'welcome_page', false),
|
||||
'ForgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')),
|
||||
'RegistrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
||||
'ContactsIsAllowed' => false,
|
||||
|
|
@ -1382,6 +1400,7 @@ class Actions
|
|||
'MaterialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true),
|
||||
'FolderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
|
||||
'StartupUrl' => \trim(\ltrim(\trim($oConfig->Get('labs', 'startup_url', '')), '#/')),
|
||||
'Filtered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
|
||||
'Community' => true,
|
||||
'PremType' => false,
|
||||
'Admin' => array(),
|
||||
|
|
@ -1397,7 +1416,7 @@ class Actions
|
|||
$aResult['AttachmentsActions'][] = 'zip';
|
||||
}
|
||||
|
||||
if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('\\OCP\\Files'))
|
||||
if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('OCP\Files'))
|
||||
{
|
||||
$aResult['AttachmentsActions'][] = 'owncloud';
|
||||
}
|
||||
|
|
@ -1523,7 +1542,15 @@ class Actions
|
|||
$aResult['WelcomePageDisplay'] = '';
|
||||
}
|
||||
|
||||
$aResult['StartupUrl'] = $this->compileLogParams($aResult['StartupUrl'], $oAccount);
|
||||
if (!empty($aResult['StartupUrl']))
|
||||
{
|
||||
$aResult['StartupUrl'] = $this->compileLogParams($aResult['StartupUrl'], $oAccount, true);
|
||||
}
|
||||
|
||||
if (!empty($aResult['UserIframeMessage']))
|
||||
{
|
||||
$aResult['UserIframeMessage'] = $this->compileLogParams($aResult['UserIframeMessage'], $oAccount, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1543,6 +1570,7 @@ class Actions
|
|||
|
||||
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
||||
$aResult['AllowGoogleSocialAuth'] = (bool) $oConfig->Get('social', 'google_enable_auth', true);
|
||||
$aResult['AllowGoogleSocialAuthFast'] = (bool) $oConfig->Get('social', 'google_enable_auth_fast', true);
|
||||
$aResult['AllowGoogleSocialDrive'] = (bool) $oConfig->Get('social', 'google_enable_drive', true);
|
||||
$aResult['AllowGoogleSocialPreview'] = (bool) $oConfig->Get('social', 'google_enable_preview', true);
|
||||
|
||||
|
|
@ -1553,6 +1581,7 @@ class Actions
|
|||
'' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', '')))))
|
||||
{
|
||||
$aResult['AllowGoogleSocialAuth'] = false;
|
||||
$aResult['AllowGoogleSocialAuthFast'] = false;
|
||||
$aResult['AllowGoogleSocialDrive'] = false;
|
||||
$aResult['GoogleClientID'] = '';
|
||||
$aResult['GoogleApiKey'] = '';
|
||||
|
|
@ -1563,7 +1592,9 @@ class Actions
|
|||
$aResult['AllowGoogleSocialPreview'] = false;
|
||||
}
|
||||
|
||||
if ($aResult['AllowGoogleSocial'] && !$aResult['AllowGoogleSocialAuth'] && !$aResult['AllowGoogleSocialDrive'] && !$aResult['AllowGoogleSocialPreview'])
|
||||
if ($aResult['AllowGoogleSocial'] &&
|
||||
!$aResult['AllowGoogleSocialAuth'] && !$aResult['AllowGoogleSocialAuthFast'] &&
|
||||
!$aResult['AllowGoogleSocialDrive'] && !$aResult['AllowGoogleSocialPreview'])
|
||||
{
|
||||
$aResult['AllowGoogleSocial'] = false;
|
||||
}
|
||||
|
|
@ -1639,6 +1670,7 @@ class Actions
|
|||
|
||||
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
||||
$aResult['AllowGoogleSocialAuth'] = (bool) $oConfig->Get('social', 'google_enable_auth', true);
|
||||
$aResult['AllowGoogleSocialAuthFast'] = (bool) $oConfig->Get('social', 'google_enable_auth_fast', true);
|
||||
$aResult['AllowGoogleSocialDrive'] = (bool) $oConfig->Get('social', 'google_enable_drive', true);
|
||||
$aResult['AllowGoogleSocialPreview'] = (bool) $oConfig->Get('social', 'google_enable_preview', true);
|
||||
|
||||
|
|
@ -2882,7 +2914,7 @@ class Actions
|
|||
|
||||
$mResult = false;
|
||||
|
||||
if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('\\OCP\\Files'))
|
||||
if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('OCP\Files'))
|
||||
{
|
||||
$sSaveFolder = $this->Config()->Get('labs', 'owncloud_save_folder', '');
|
||||
if (empty($sSaveFolder))
|
||||
|
|
@ -3644,6 +3676,7 @@ class Actions
|
|||
|
||||
$this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool');
|
||||
$this->setConfigFromParams($oConfig, 'GoogleEnableAuth', 'social', 'google_enable_auth', 'bool');
|
||||
$this->setConfigFromParams($oConfig, 'GoogleEnableAuthFast', 'social', 'google_enable_auth_fast', 'bool');
|
||||
$this->setConfigFromParams($oConfig, 'GoogleEnableDrive', 'social', 'google_enable_drive', 'bool');
|
||||
$this->setConfigFromParams($oConfig, 'GoogleEnablePreview', 'social', 'google_enable_preview', 'bool');
|
||||
$this->setConfigFromParams($oConfig, 'GoogleClientID', 'social', 'google_client_id', 'string');
|
||||
|
|
@ -4092,7 +4125,7 @@ class Actions
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function rainloopRepo()
|
||||
private function rainLoopRepo()
|
||||
{
|
||||
$sUrl = APP_REP_PATH;
|
||||
if ('' !== $sUrl)
|
||||
|
|
@ -4281,7 +4314,7 @@ class Actions
|
|||
{
|
||||
$bRainLoopUpdatable = $this->rainLoopUpdatable();
|
||||
|
||||
$aResult = $this->getRepositoryDataByUrl($this->rainloopRepo(), $bReal);
|
||||
$aResult = $this->getRepositoryDataByUrl($this->rainLoopRepo(), $bReal);
|
||||
|
||||
$aSub = array();
|
||||
if (\is_array($aResult))
|
||||
|
|
@ -4555,7 +4588,7 @@ class Actions
|
|||
$bResult = false;
|
||||
if ('' !== $sRealFile)
|
||||
{
|
||||
$sUrl = $this->rainloopRepo().$sRealFile;
|
||||
$sUrl = $this->rainLoopRepo().$sRealFile;
|
||||
$sTmp = $this->downloadRemotePackageByUrl($sUrl);
|
||||
}
|
||||
|
||||
|
|
@ -6424,7 +6457,12 @@ class Actions
|
|||
*/
|
||||
public function DoQuota()
|
||||
{
|
||||
$this->initMailClientConnection();
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
|
||||
if (!$this->GetCapa(false, \RainLoop\Enumerations\Capa::QUOTA, $oAccount))
|
||||
{
|
||||
return $this->DefaultResponse(__FUNCTION__, array(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -7960,6 +7998,11 @@ class Actions
|
|||
$aResult[] = \RainLoop\Enumerations\Capa::RELOAD;
|
||||
}
|
||||
|
||||
if ($oConfig->Get('capa', 'quota', true))
|
||||
{
|
||||
$aResult[] = \RainLoop\Enumerations\Capa::QUOTA;
|
||||
}
|
||||
|
||||
if ($oConfig->Get('capa', 'settings', true))
|
||||
{
|
||||
$aResult[] = \RainLoop\Enumerations\Capa::SETTINGS;
|
||||
|
|
@ -9453,6 +9496,24 @@ class Actions
|
|||
$mResult['InReplyTo'] = $mResponse->InReplyTo();
|
||||
$mResult['References'] = $mResponse->References();
|
||||
|
||||
$fAdditionalDomReader = null;
|
||||
if (0 < \strlen($sHtml) && $this->Config()->Get('labs', 'emogrifier', false))
|
||||
{
|
||||
if (!\class_exists('Pelago\Emogrifier', false))
|
||||
{
|
||||
include_once APP_VERSION_ROOT_PATH.'app/libraries/emogrifier/Emogrifier.php';
|
||||
}
|
||||
|
||||
if (\class_exists('Pelago\Emogrifier', false))
|
||||
{
|
||||
$fAdditionalDomReader = function ($oDom) {
|
||||
$oEmogrifier = new \Pelago\Emogrifier();
|
||||
$oEmogrifier->preserveEncoding = false;
|
||||
return $oEmogrifier->emogrify($oDom);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$fAdditionalExternalFilter = null;
|
||||
if (!!$this->Config()->Get('labs', 'use_local_proxy_for_external_images', false))
|
||||
{
|
||||
|
|
@ -9465,9 +9526,13 @@ class Actions
|
|||
};
|
||||
}
|
||||
|
||||
// $this->Logger()->Write('---');
|
||||
// $this->Logger()->Write($sHtml);
|
||||
|
||||
$mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml(
|
||||
$sHtml, $bHasExternals, $mFoundedCIDs, $aContentLocationUrls, $mFoundedContentLocationUrls, false, false,
|
||||
$fAdditionalExternalFilter
|
||||
$fAdditionalExternalFilter, $fAdditionalDomReader,
|
||||
!!$this->Config()->Get('labs', 'try_to_detect_hidden_images', false)
|
||||
);
|
||||
|
||||
$mResult['ExternalProxy'] = null !== $fAdditionalExternalFilter;
|
||||
|
|
@ -9669,6 +9734,7 @@ class Actions
|
|||
'UidNext' => $mResponse->UidNext,
|
||||
'ThreadUid' => $mResponse->ThreadUid,
|
||||
'NewMessages' => $this->responseObject($mResponse->NewMessages),
|
||||
'Filtered' => $mResponse->Filtered,
|
||||
'Offset' => $mResponse->Offset,
|
||||
'Limit' => $mResponse->Limit,
|
||||
'Search' => $mResponse->Search
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class Api
|
|||
if ($bOne)
|
||||
{
|
||||
\RainLoop\Api::SetupDefaultMailSoConfig();
|
||||
|
||||
$bOne = \RainLoop\Api::RunResult();
|
||||
}
|
||||
}
|
||||
|
|
@ -97,6 +98,7 @@ class Api
|
|||
\MailSo\Config::$LargeThreadLimit =
|
||||
(int) \RainLoop\Api::Config()->Get('labs', 'imap_large_thread_limit', 50);
|
||||
|
||||
\MailSo\Config::$BoundaryPrefix = '_RainLoop_';
|
||||
|
||||
\MailSo\Config::$SystemLogger = \RainLoop\Api::Logger();
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
|||
'composer' => array(true),
|
||||
'contacts' => array(true),
|
||||
'settings' => array(true),
|
||||
'quota' => array(true),
|
||||
'help' => array(true),
|
||||
'reload' => array(true),
|
||||
'search' => array(true),
|
||||
|
|
@ -164,6 +165,8 @@ class Application extends \RainLoop\Config\AbstractConfig
|
|||
'determine_user_language' => array(true, ''),
|
||||
'determine_user_domain' => array(false, ''),
|
||||
|
||||
'welcome_page' => array(false, ''),
|
||||
|
||||
'forgot_password_link_url' => array('', ''),
|
||||
'registration_link_url' => array('', ''),
|
||||
|
||||
|
|
@ -184,7 +187,7 @@ Values:
|
|||
|
||||
'defaults' => array(
|
||||
'view_editor_type' => array('Html', 'Editor mode used by default (Plain, Html, HtmlForced or PlainForced)'),
|
||||
'view_layout' => array(1, 'layout: 0 - no preview, 1 - side preview, 3 - bottom preview'),
|
||||
'view_layout' => array(1, 'layout: 0 - no preview, 1 - side preview, 2 - bottom preview'),
|
||||
'view_use_checkboxes' => array(true),
|
||||
'autologout' => array(30),
|
||||
'show_images' => array(false),
|
||||
|
|
@ -205,6 +208,7 @@ Values:
|
|||
Disabling this option is not recommended.'),
|
||||
|
||||
'time_offset' => array(0),
|
||||
'session_filter' => array(''),
|
||||
|
||||
'filename' => array('log-{date:Y-m-d}.txt',
|
||||
'Log filename.
|
||||
|
|
@ -246,6 +250,7 @@ Examples:
|
|||
'social' => array(
|
||||
'google_enable' => array(false, 'Google'),
|
||||
'google_enable_auth' => array(false),
|
||||
'google_enable_auth_fast' => array(false),
|
||||
'google_enable_drive' => array(false),
|
||||
'google_enable_preview' => array(false),
|
||||
'google_client_id' => array(''),
|
||||
|
|
@ -298,6 +303,7 @@ Enables caching in the system'),
|
|||
'allow_html_editor_source_button' => array(false),
|
||||
'allow_html_editor_biti_buttons' => array(false),
|
||||
'allow_ctrl_enter_on_compose' => array(false),
|
||||
'try_to_detect_hidden_images' => array(false),
|
||||
'hide_dangerous_actions' => array(false),
|
||||
'use_app_debug_js' => array(false),
|
||||
'use_app_debug_css' => array(false),
|
||||
|
|
@ -340,6 +346,7 @@ Enables caching in the system'),
|
|||
'fast_cache_memcache_expire' => array(43200),
|
||||
'use_local_proxy_for_external_images' => array(false),
|
||||
'startup_url' => array(''),
|
||||
'emogrifier' => array(true),
|
||||
'dev_email' => array(''),
|
||||
'dev_password' => array('')
|
||||
),
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Capa
|
|||
const SEARCH = 'SEARCH';
|
||||
const SEARCH_ADV = 'SEARCH_ADV';
|
||||
const SETTINGS = 'SETTINGS';
|
||||
const QUOTA = 'QUOTA';
|
||||
const HELP = 'HELP';
|
||||
const TEMPLATES = 'TEMPLATES';
|
||||
const MESSAGE_ACTIONS = 'MESSAGE_ACTIONS';
|
||||
|
|
|
|||
|
|
@ -304,6 +304,22 @@ abstract class AbstractPlugin
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sFile
|
||||
* @param bool $bAdminScope = false
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
protected function replaceTemplate($sFile, $bAdminScope = false)
|
||||
{
|
||||
if ($this->oPluginManager)
|
||||
{
|
||||
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sActionName
|
||||
* @param string $sFunctionName
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class Manager
|
|||
public function HaveJs($bAdminScope = false)
|
||||
{
|
||||
$bResult = false;
|
||||
|
||||
|
||||
if ($this->bIsEnabled)
|
||||
{
|
||||
$bResult = $bAdminScope ? 0 < \count($this->aAdminJs) : 0 < \count($this->aJs);
|
||||
|
|
@ -274,27 +274,24 @@ class Manager
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $aList
|
||||
* @param bool $bAdminScope = false
|
||||
* @return string
|
||||
*/
|
||||
public function CompileTemplate($bAdminScope = false)
|
||||
public function CompileTemplate(&$aList, $bAdminScope = false)
|
||||
{
|
||||
$sResult = '';
|
||||
if ($this->bIsEnabled)
|
||||
{
|
||||
$aTemplates = $bAdminScope ? $this->aAdminTemplates : $this->aTemplates;
|
||||
foreach ($aTemplates as $sFile)
|
||||
{
|
||||
if (file_exists($sFile))
|
||||
if (\file_exists($sFile))
|
||||
{
|
||||
$sTemplateName = substr(basename($sFile), 0, -5);
|
||||
$sResult .= '<script id="'.preg_replace('/[^a-zA-Z0-9]/', '', $sTemplateName).'" type="text/html" data-cfasync="false">'.
|
||||
$this->Actions()->ProcessTemplate($sTemplateName, file_get_contents($sFile)).'</script>';
|
||||
$sTemplateName = \substr(\basename($sFile), 0, -5);
|
||||
$aList[$sTemplateName] = $sFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestion
|
|||
try
|
||||
{
|
||||
if ('' === $sQuery || !$oAccount || !\RainLoop\Utils::IsOwnCloudLoggedIn() ||
|
||||
!\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled()
|
||||
!\class_exists('OCP\Contacts') || !\OCP\Contacts::isEnabled()
|
||||
)
|
||||
{
|
||||
return $aResult;
|
||||
|
|
|
|||
|
|
@ -1220,11 +1220,23 @@ class ServiceActions
|
|||
*/
|
||||
public function compileTemplates($bAdmin = false, $bJsOutput = true)
|
||||
{
|
||||
$sHtml =
|
||||
\RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH.'app/templates/Views/Components', $this->oActions, 'Component').
|
||||
\RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH.'app/templates/Views/'.($bAdmin ? 'Admin' : 'User'), $this->oActions).
|
||||
\RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH.'app/templates/Views/Common', $this->oActions).
|
||||
$this->oActions->Plugins()->CompileTemplate($bAdmin);
|
||||
$aTemplates = array();
|
||||
|
||||
\RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/Components', 'Component');
|
||||
\RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/'.($bAdmin ? 'Admin' : 'User'));
|
||||
\RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/Common');
|
||||
|
||||
$this->oActions->Plugins()->CompileTemplate($aTemplates, $bAdmin);
|
||||
|
||||
$sHtml = '';
|
||||
foreach ($aTemplates as $sName => $sFile)
|
||||
{
|
||||
$sName = \preg_replace('/[^a-zA-Z0-9]/', '', $sName);
|
||||
$sHtml .= '<script id="'.$sName.'" type="text/html" data-cfasync="false">'.
|
||||
$this->oActions->ProcessTemplate($sName, \file_get_contents($sFile)).'</script>';
|
||||
}
|
||||
|
||||
unset($aTemplates);
|
||||
|
||||
return $bJsOutput ? 'window.rainloopTEMPLATES='.\MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()).';' : $sHtml;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Utils
|
|||
define('_phpseclib_', true);
|
||||
}
|
||||
|
||||
if (!\class_exists('Crypt_RSA'))
|
||||
if (!\class_exists('Crypt_RSA', false))
|
||||
{
|
||||
include_once 'Crypt/RSA.php';
|
||||
\defined('CRYPT_RSA_MODE') || \define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||
|
|
@ -470,30 +470,22 @@ class Utils
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $aList
|
||||
* @param string $sDirName
|
||||
* @param \RainLoop\Actions $oAction
|
||||
* @param string $sNameSuffix = ''
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function CompileTemplates($sDirName, $oAction, $sNameSuffix = '')
|
||||
public static function CompileTemplates(&$aList, $sDirName, $sNameSuffix = '')
|
||||
{
|
||||
$sResult = '';
|
||||
if (\file_exists($sDirName))
|
||||
{
|
||||
$aList = \RainLoop\Utils::FolderFiles($sDirName, '.html');
|
||||
$aFileList = \RainLoop\Utils::FolderFiles($sDirName, '.html');
|
||||
|
||||
foreach ($aList as $sName)
|
||||
foreach ($aFileList as $sName)
|
||||
{
|
||||
$sTemplateName = \substr($sName, 0, -5).$sNameSuffix;
|
||||
$sResult .= '<script id="'.\preg_replace('/[^a-zA-Z0-9]/', '', $sTemplateName).'" type="text/html" data-cfasync="false">'.
|
||||
$oAction->ProcessTemplate($sTemplateName, \file_get_contents($sDirName.'/'.$sName)).'</script>';
|
||||
$aList[$sTemplateName] = $sDirName.'/'.$sName;
|
||||
}
|
||||
|
||||
$sResult = \trim($sResult);
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -539,14 +531,25 @@ class Utils
|
|||
public static function IsOwnCloud()
|
||||
{
|
||||
return isset($_ENV['RAINLOOP_OWNCLOUD']) && $_ENV['RAINLOOP_OWNCLOUD'] &&
|
||||
\class_exists('\\OC');
|
||||
\class_exists('OC');
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsOwnCloudLoggedIn()
|
||||
{
|
||||
return self::IsOwnCloud() && \class_exists('\\OCP\\User') && \OCP\User::isLoggedIn();
|
||||
return self::IsOwnCloud() && \class_exists('OCP\User') && \OCP\User::isLoggedIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sV
|
||||
* @param bool $bEncode = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function UrlEncode($sV, $bEncode = false)
|
||||
{
|
||||
return $bEncode ? \urlencode($sV) : $sV;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -557,7 +560,7 @@ class Utils
|
|||
$sAppPath = '';
|
||||
if (\RainLoop\Utils::IsOwnCloud())
|
||||
{
|
||||
if (\class_exists('\\OC_App'))
|
||||
if (\class_exists('OC_App'))
|
||||
{
|
||||
$sAppPath = \rtrim(\trim(\OC_App::getAppWebPath('rainloop')), '\\/').'/app/';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue