mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 19:08:50 +03:00
Always allow raw editing of Sieve scripts
This commit is contained in:
parent
3ed7b53f68
commit
14ba459d46
20 changed files with 59 additions and 211 deletions
|
|
@ -34,8 +34,7 @@ trait Filters
|
|||
return $this->DefaultResponse(__FUNCTION__, $aFakeFilters);
|
||||
}
|
||||
|
||||
return $this->DefaultResponse(__FUNCTION__,
|
||||
$this->FiltersProvider()->Load($oAccount, $oAccount->DomainSieveAllowRaw()));
|
||||
return $this->DefaultResponse(__FUNCTION__, $this->FiltersProvider()->Load($oAccount));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -351,7 +351,6 @@ Enables caching in the system'),
|
|||
'smtp_show_server_errors' => array(false),
|
||||
'smtp_use_auth_plain' => array(true),
|
||||
'smtp_use_auth_cram_md5' => array(false),
|
||||
'sieve_allow_raw_script' => array(false),
|
||||
'sieve_utf8_folder_name' => array(true),
|
||||
'sieve_auth_plain_initial' => array(true),
|
||||
'sieve_allow_fileinto_inbox' => array(false),
|
||||
|
|
|
|||
|
|
@ -226,11 +226,6 @@ class Account
|
|||
return $this->Domain()->SieveSecure();
|
||||
}
|
||||
|
||||
public function DomainSieveAllowRaw() : bool
|
||||
{
|
||||
return $this->Domain()->SieveAllowRaw();
|
||||
}
|
||||
|
||||
public function GetAuthToken() : string
|
||||
{
|
||||
return \RainLoop\Utils::EncodeKeyValues(array(
|
||||
|
|
|
|||
|
|
@ -83,11 +83,6 @@ class Domain implements \JsonSerializable
|
|||
*/
|
||||
private $iSieveSecure;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $bSieveAllowRaw;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
@ -122,8 +117,6 @@ class Domain implements \JsonSerializable
|
|||
$this->iSievePort = $iSievePort;
|
||||
$this->iSieveSecure = $iSieveSecure;
|
||||
|
||||
$this->bSieveAllowRaw = false;
|
||||
|
||||
$this->sWhiteList = \trim($sWhiteList);
|
||||
$this->sAliasName = '';
|
||||
}
|
||||
|
|
@ -140,7 +133,6 @@ class Domain implements \JsonSerializable
|
|||
!empty($aDomain['imap_secure']) ? $aDomain['imap_secure'] : '');
|
||||
|
||||
$bUseSieve = !empty($aDomain['sieve_use']);
|
||||
$bSieveAllowRaw = !empty($aDomain['sieve_allow_raw']);
|
||||
|
||||
$sSieveHost = empty($aDomain['sieve_host']) ? '' : (string) $aDomain['sieve_host'];
|
||||
$iSievePort = empty($aDomain['sieve_port']) ? 4190 : (int) $aDomain['sieve_port'];
|
||||
|
|
@ -164,8 +156,6 @@ class Domain implements \JsonSerializable
|
|||
$bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure,
|
||||
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
|
||||
$sWhiteList);
|
||||
|
||||
$oDomain->SetSieveAllowRaw($bSieveAllowRaw);
|
||||
}
|
||||
|
||||
return $oDomain;
|
||||
|
|
@ -208,7 +198,6 @@ class Domain implements \JsonSerializable
|
|||
'imap_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iIncSecure).'"',
|
||||
'imap_short_login = '.($this->bIncShortLogin ? 'On' : 'Off'),
|
||||
'sieve_use = '.($this->bUseSieve ? 'On' : 'Off'),
|
||||
'sieve_allow_raw = '.($this->bSieveAllowRaw ? 'On' : 'Off'),
|
||||
'sieve_host = "'.$this->encodeIniString($this->sSieveHost).'"',
|
||||
'sieve_port = '.$this->iSievePort,
|
||||
'sieve_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iSieveSecure).'"',
|
||||
|
|
@ -326,16 +315,6 @@ class Domain implements \JsonSerializable
|
|||
return $this->iSieveSecure;
|
||||
}
|
||||
|
||||
public function SieveAllowRaw() : bool
|
||||
{
|
||||
return $this->bSieveAllowRaw;
|
||||
}
|
||||
|
||||
public function SetSieveAllowRaw(bool $bSieveAllowRaw)
|
||||
{
|
||||
$this->bSieveAllowRaw = $bSieveAllowRaw;
|
||||
}
|
||||
|
||||
public function OutHost() : string
|
||||
{
|
||||
return $this->sOutHost;
|
||||
|
|
@ -413,7 +392,6 @@ class Domain implements \JsonSerializable
|
|||
'SieveHost' => $this->SieveHost(),
|
||||
'SievePort' => $this->SievePort(),
|
||||
'SieveSecure' => $this->SieveSecure(),
|
||||
'SieveAllowRaw' => $this->SieveAllowRaw(),
|
||||
'OutHost' => $this->OutHost(),
|
||||
'OutPort' => $this->OutPort(),
|
||||
'OutSecure' => $this->OutSecure(),
|
||||
|
|
@ -438,7 +416,6 @@ class Domain implements \JsonSerializable
|
|||
'SieveHost' => \MailSo\Base\Utils::IdnToUtf8($this->SieveHost()),
|
||||
'SievePort' => $this->SievePort(),
|
||||
'SieveSecure' => $this->SieveSecure(),
|
||||
'SieveAllowRaw' => $this->SieveAllowRaw(),
|
||||
'OutHost' => \MailSo\Base\Utils::IdnToUtf8($this->OutHost()),
|
||||
'OutPort' => $this->OutPort(),
|
||||
'OutSecure' => $this->OutSecure(),
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ class Domain extends AbstractProvider
|
|||
$iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
|
||||
$bIncShortLogin = '1' === (string) $oActions->GetActionParam('IncShortLogin', '0');
|
||||
$bUseSieve = '1' === (string) $oActions->GetActionParam('UseSieve', '0');
|
||||
$bSieveAllowRaw = '1' === (string) $oActions->GetActionParam('SieveAllowRaw', '0');
|
||||
$sSieveHost = (string) $oActions->GetActionParam('SieveHost', '');
|
||||
$iSievePort = (int) $oActions->GetActionParam('SievePort', 4190);
|
||||
$iSieveSecure = (int) $oActions->GetActionParam('SieveSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
|
||||
|
|
@ -147,11 +146,6 @@ class Domain extends AbstractProvider
|
|||
$sWhiteList);
|
||||
}
|
||||
}
|
||||
|
||||
if ($oDomain)
|
||||
{
|
||||
$oDomain->SetSieveAllowRaw($bSieveAllowRaw);
|
||||
}
|
||||
}
|
||||
|
||||
return $oDomain;
|
||||
|
|
@ -170,7 +164,6 @@ class Domain extends AbstractProvider
|
|||
$iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
|
||||
$bIncShortLogin = '1' === (string) $oActions->GetActionParam('IncShortLogin', '0');
|
||||
$bUseSieve = '1' === (string) $oActions->GetActionParam('UseSieve', '0');
|
||||
$bSieveAllowRaw = '1' === (string) $oActions->GetActionParam('SieveAllowRaw', '0');
|
||||
$sSieveHost = (string) $oActions->GetActionParam('SieveHost', '');
|
||||
$iSievePort = (int) $oActions->GetActionParam('SievePort', 4190);
|
||||
$iSieveSecure = (int) $oActions->GetActionParam('SieveSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
|
||||
|
|
@ -214,11 +207,6 @@ class Domain extends AbstractProvider
|
|||
$sWhiteList);
|
||||
}
|
||||
}
|
||||
|
||||
if ($oDomain)
|
||||
{
|
||||
$oDomain->SetSieveAllowRaw($bSieveAllowRaw);
|
||||
}
|
||||
}
|
||||
|
||||
return $oDomain;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ class Filters extends \RainLoop\Providers\AbstractProvider
|
|||
throw new \RainLoop\Exceptions\ClientException($defNotification, $oException);
|
||||
}
|
||||
|
||||
public function Load(\RainLoop\Model\Account $oAccount, bool $bAllowRaw = false) : array
|
||||
public function Load(\RainLoop\Model\Account $oAccount) : array
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->IsActive() ? $this->oDriver->Load($oAccount, $bAllowRaw) : array();
|
||||
return $this->IsActive() ? $this->oDriver->Load($oAccount) : array();
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace RainLoop\Providers\Filters;
|
|||
|
||||
interface FiltersInterface
|
||||
{
|
||||
public function Load(\RainLoop\Model\Account $oAccount, bool $bAllowRaw = false) : array;
|
||||
public function Load(\RainLoop\Model\Account $oAccount) : array;
|
||||
|
||||
public function Save(\RainLoop\Model\Account $oAccount, string $sScriptName, array $aFilters, string $sRaw = '') : bool;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ namespace RainLoop\Providers\Filters;
|
|||
class SieveStorage implements FiltersInterface
|
||||
{
|
||||
const SIEVE_FILE_NAME = 'rainloop.user';
|
||||
const SIEVE_FILE_NAME_RAW = 'rainloop.user.raw';
|
||||
|
||||
/**
|
||||
* @var \MailSo\Log\Logger
|
||||
|
|
@ -40,7 +39,7 @@ class SieveStorage implements FiltersInterface
|
|||
: null;
|
||||
}
|
||||
|
||||
public function Load(\RainLoop\Model\Account $oAccount, bool $bAllowRaw = false) : array
|
||||
public function Load(\RainLoop\Model\Account $oAccount) : array
|
||||
{
|
||||
$aModules = array();
|
||||
$aScripts = array();
|
||||
|
|
@ -53,14 +52,12 @@ class SieveStorage implements FiltersInterface
|
|||
$aList = $oSieveClient->ListScripts();
|
||||
|
||||
foreach ($aList as $name => $active) {
|
||||
if ($bAllowRaw || $name == self::SIEVE_FILE_NAME) {
|
||||
$aScripts[$name] = array(
|
||||
'@Object' => 'Object/SieveScript',
|
||||
'name' => $name,
|
||||
'active' => $active,
|
||||
'body' => $oSieveClient->GetScript($name)
|
||||
);
|
||||
}
|
||||
$aScripts[$name] = array(
|
||||
'@Object' => 'Object/SieveScript',
|
||||
'name' => $name,
|
||||
'active' => $active,
|
||||
'body' => $oSieveClient->GetScript($name)
|
||||
);
|
||||
}
|
||||
|
||||
$oSieveClient->LogoutAndDisconnect();
|
||||
|
|
@ -74,15 +71,6 @@ class SieveStorage implements FiltersInterface
|
|||
'filters' => []
|
||||
);
|
||||
}
|
||||
|
||||
if ($bAllowRaw && !isset($aList[self::SIEVE_FILE_NAME_RAW])) {
|
||||
$aScripts[self::SIEVE_FILE_NAME_RAW] = array(
|
||||
'@Object' => 'Object/SieveScript',
|
||||
'name' => self::SIEVE_FILE_NAME_RAW,
|
||||
'active' => false,
|
||||
'body' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
\ksort($aScripts);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ en:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "Allow sieve scripts"
|
||||
LABEL_ALLOW_USER_SCRIPT: "Allow custom user script"
|
||||
LABEL_USE_SHORT_LOGIN: "Use short login"
|
||||
LABEL_USE_AUTH: "Use authentication"
|
||||
LABEL_USE_PHP_MAIL: "Use php mail() function"
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ de_DE:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "Sieve-Skripte erlauben"
|
||||
LABEL_ALLOW_USER_SCRIPT: "Benutzerdefiniertes Skript erlauben"
|
||||
LABEL_USE_SHORT_LOGIN: "Kurze Benutzernamen verwenden"
|
||||
LABEL_USE_AUTH: "Authentifizierung verwenden"
|
||||
LABEL_USE_PHP_MAIL: "PHPs mail()-Funktion verwenden"
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ en_US:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "Allow sieve scripts"
|
||||
LABEL_ALLOW_USER_SCRIPT: "Allow custom user script"
|
||||
LABEL_USE_SHORT_LOGIN: "Use short login"
|
||||
LABEL_USE_AUTH: "Use authentication"
|
||||
LABEL_USE_PHP_MAIL: "Use php mail() function"
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ es_ES:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "Permitir scripts de filtro"
|
||||
LABEL_ALLOW_USER_SCRIPT: "Permitir scripts propios"
|
||||
LABEL_USE_SHORT_LOGIN: "Inicio de Sesión corto"
|
||||
LABEL_USE_AUTH: "Usar autenticación"
|
||||
LABEL_USE_PHP_MAIL: "Utilizar la función mail() de PHP"
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ fr_FR:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "Autoriser les scripts sieve"
|
||||
LABEL_ALLOW_USER_SCRIPT: "Autoriser les scripts personnels"
|
||||
LABEL_USE_SHORT_LOGIN: "Utiliser l'identifiant court"
|
||||
LABEL_USE_AUTH: "Utiliser l'authentification"
|
||||
LABEL_USE_PHP_MAIL: "Utiliser la fonction mail() de php"
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ nl_NL:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "Sta Sieve scripts toe"
|
||||
LABEL_ALLOW_USER_SCRIPT: "Sta gebruiker scripts toe"
|
||||
LABEL_USE_SHORT_LOGIN: "Gebruik verkorte login"
|
||||
LABEL_USE_AUTH: "Gebruik authenticatie"
|
||||
LABEL_USE_PHP_MAIL: "Gebruik php mail() functie"
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ zh_CN:
|
|||
SECURE_OPTION_SSL: "SSL/TLS"
|
||||
SECURE_OPTION_STARTTLS: "STARTTLS"
|
||||
LABEL_ALLOW_SIEVE_SCRIPTS: "可使用筛选脚本"
|
||||
LABEL_ALLOW_USER_SCRIPT: "允许用户自定义脚本"
|
||||
LABEL_USE_SHORT_LOGIN: "使用短用户名登录"
|
||||
LABEL_USE_AUTH: "使用认证"
|
||||
LABEL_USE_PHP_MAIL: "使用 php mail() 函数"
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@
|
|||
<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-bind="textInput: imapServer, hasfocus: imapServerFocus" />
|
||||
</div>
|
||||
<div class="span1">
|
||||
<div class="span2">
|
||||
<span data-i18n="POPUPS_DOMAIN/LABEL_PORT"></span>
|
||||
<br />
|
||||
<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
<input type="number" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-bind="textInput: imapPort" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -84,8 +84,6 @@
|
|||
<i class="icon-filter"></i>
|
||||
|
||||
<a href="#" class="g-ui-link" data-i18n="POPUPS_DOMAIN/BUTTON_SIEVE_CONFIGURATION"></a>
|
||||
|
||||
<span style="color:red">(<span data-i18n="HINTS/BETA"></span>)</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -103,18 +101,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div data-bind="visible: useSieve">
|
||||
<div class="row">
|
||||
<div class="span5">
|
||||
<div data-bind="component: {
|
||||
name: 'Checkbox',
|
||||
params: {
|
||||
label: 'POPUPS_DOMAIN/LABEL_ALLOW_USER_SCRIPT',
|
||||
value: sieveAllowRaw
|
||||
}
|
||||
}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="span3">
|
||||
<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
|
||||
|
|
@ -125,7 +111,7 @@
|
|||
<div class="span1">
|
||||
<span data-i18n="POPUPS_DOMAIN/LABEL_PORT"></span>
|
||||
<br />
|
||||
<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
<input type="number" class="span2" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-bind="textInput: sievePort" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -168,10 +154,10 @@
|
|||
<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-bind="textInput: smtpServer, hasfocus: smtpServerFocus" />
|
||||
</div>
|
||||
<div class="span1">
|
||||
<div class="span2">
|
||||
<span data-i18n="POPUPS_DOMAIN/LABEL_PORT"></span>
|
||||
<br />
|
||||
<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
<input type="number" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-bind="textInput: smtpPort" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue