Commit Graph

86 Commits

Author SHA1 Message Date
Laurent Dinclaux
b9e16f186d PSR-12 coding standards compliance
Add phpcs/phpcbf tooling (composer require-dev, scripts, .phpcs.xml).
Auto-fix tabs to spaces across all PHP files (phpcbf).
Add missing doc comments for classes and constructors.
Add missing @param tags on public/private methods.
2026-02-10 23:34:38 +11:00
Laurent Dinclaux
05a7a2967f Fixes: centralize helpers, remove dead code, fix JS issues 2026-02-10 23:34:38 +11:00
Laurent Dinclaux
0dbba36345 Filter compose From dropdown by active account
When composing, only show identities belonging to the active account
and its aliases. Prevents sending from wrong SMTP and saving drafts/sent
to wrong folders.
2026-02-10 22:29:04 +11:00
Laurent Dinclaux
08673a4399 Add alias SMTP/Sieve resolution, debug logging, and exclude aliases from switcher
SMTP and Sieve hooks follow parent_id to resolve alias config from parent
account. Aliases excluded from account switcher dropdown and background
mail checker. Debug logging behind ident_switch.debug config flag.
Fix double ssl:// prefix in switch_account host parsing.
2026-02-10 22:28:56 +11:00
Laurent Dinclaux
fd9836c7ae Add custom auth, connection testing, preconfig_only, and security fixes
Major form improvements:
- Custom SMTP/Sieve credentials (separate username/password per protocol)
- Connection testing on save (IMAP, SMTP, Sieve) with localized errors
- preconfig_only mode to restrict domains to preconfigured entries
- Form POST value preservation on save errors (auth selects, passwords)
- Smart host placeholders (SMTP/Sieve default to IMAP host)

Security and bug:
- Fix password re-encryption bug (was comparing raw vs encrypted values)
- Fix XSS: escape label output in special folders form
- Fix parse_url() return value not checked for false
- Fix decrypt() failures not handled (fallback to empty string)
- Sanitize log output (remove raw POST data from log messages)
- Replace weak == comparisons with strict === (PHP and JS)

SQL changes:
- Consolidate 4 migrations (2026021000-03) into single 2026021000
- Remove now unused notify_sound_url column
- Add smtp_username, smtp_password, sieve_username, sieve_password columns
2026-02-10 20:50:05 +11:00
Laurent Dinclaux
12572b563d Add background mail checking and new mail notifications 2026-02-10 17:13:57 +11:00
Laurent Dinclaux
6ea4aee0a7 Add managesieve (Sieve) support for remote accounts
When switching identities, the managesieve plugin still connected to
the default sieve server. Hook into managesieve_connect to redirect
the sieve connection to the remote account's server.

Adds sieve_host, sieve_port and sieve_auth columns to the database,
a Sieve section to the identity settings form, preconfig support for
sieve_host, and localized labels for all 7 languages.
2026-02-10 14:03:47 +11:00
Laurent Dinclaux
651bb19d05 Split ident_switch.php into focused classes
Extract business logic into dedicated classes under lib/:
- IdentSwitchForm: form building, validation, and persistence
- IdentSwitchSwitcher: account switching, SMTP config, special folders
- IdentSwitchPreconfig: domain-based preconfiguration

The main plugin class remains the orchestrator, registering hooks
and delegating to the appropriate handler. Constants changed from
private to public to allow cross-class access.
2026-02-10 14:02:49 +11:00
Laurent Dinclaux
85ed8815f1 Modernize ident_switch.php for PHP 8.2+ and Roundcube 1.6+
- Add docblocks to all classes, methods, and constants
- Add type declarations to all parameters and return types
- Add visibility modifiers to all methods and constants
- Use PHP 8.0+ syntax: match expression, named arguments,
  str_contains(), str_starts_with(), str_ends_with()
- Replace array() with short array syntax []
- Use null coalescing operator ?? instead of isset ternaries
- Use early returns instead of deeply nested if/else
- Remove Roundcube < 1.6 compatibility code (smtp_server/smtp_port)
- Fix unreferenced $config variable in on_switch default restore
- Use union type array|false for get_preconfig return
2026-02-10 10:00:22 +11:00
Laurent Dinclaux
6a4a4e09df Add copyright headers and contributors list
Add proper copyright notices to all source files with accurate date
ranges per contributor based on git history. Add contributors to
composer.json authors and README.
2026-02-10 10:00:22 +11:00
Boris Gulay
5577699dae Fix incompatibility introduced in PR #4.
Closes #88.
2022-08-01 21:55:30 +03:00
Gergely Papp
3e803f65a2 Merged BoresExpress/ident_switch into master 2022-02-01 13:07:49 +01:00
Boris Gulay
ad97f4bfd0 Use identity from field. Thanx Daniel Haag.
Closes #44.
2022-01-17 19:30:39 +03:00
Mickael
ae7b905824 ident_switch.php - Solve the issue that don't set the good configuration variable for the smtp_host on the latest version + dev of roundcube 2022-01-15 21:48:55 +00:00
Gergely Papp
5aed4c9947 fixes #74 2021-12-28 16:11:48 +00:00
Gergely Papp
46eba62185 Fixes #82 2021-12-28 16:10:23 +00:00
Boris Gulay
6fa82d6ba5 Fix missing comma 2020-06-06 23:27:58 +03:00
Boris Gulay
33555a94d4 Remove debug logging 2020-06-01 17:21:12 +03:00
Boris Gulay
5f6f2eb095 Render selector with only one query 2020-06-01 17:20:12 +03:00
Boris Gulay
2e09a92bc3 ender account selector in a modern way 2020-06-01 16:50:15 +03:00
Boris Gulay
072ef65fdf Add option to disable SMTP auth
Closes #61
2020-06-01 16:34:19 +03:00
Boris Gulay
cb7936bf71 Handle hosts with protocol correctly.
Closes #68
2020-05-31 15:43:39 +03:00
Christian Landvogt
0342dd4975 display identity label at folder selection 2019-12-13 12:35:01 +01:00
Christian Landvogt
98e0f16836 fix special folder not updated for main identity 2019-12-13 12:20:06 +01:00
Christian Landvogt
f1d2e3193a save special folders from normal dialog 2019-12-13 12:16:16 +01:00
Christian Landvogt
f30f72099b load and set special folders from db 2019-12-13 10:49:50 +01:00
Christian Landvogt
67fc6b8b66 fix imap delimiter switching 2019-12-13 09:35:08 +01:00
Boris Gulay
abc3c9ea5f Fix SMTP settings do not apply.
Closes #40, closes #51.
Thanx to sooslaca, J.P.
2019-11-24 18:51:36 +03:00
Boris Gulay
148052a6d0 Add delimiter to account setup. Closes #50 2019-11-24 18:48:25 +03:00
Boris Gulay
ac32196fc0 Better string handling. 2019-09-04 23:30:47 +03:00
Boris Gulay
ebc4324ecd Fixed login problem when server requires TLS.
Closes #47
Closes #45
2019-09-04 23:21:46 +03:00
Boris Gulay
6f86e64442 Make preconfig work for SMTP host and port too.
Closes # 37
2019-04-16 00:20:06 +03:00
Boris Gulay
080a2ee591 Fixed non-html chars ware stripped from password.
Closes #17
2019-04-14 19:19:30 +03:00
Boris Gulay
f1bd9679da Added SMTP server TLS connection. 2018-12-22 17:31:58 +03:00
Boris Gulay
68164414c2 Fix saving label. 2018-12-22 16:55:30 +03:00
Boris Gulay
d8ea3d5539 Fix setting flags on form load. 2018-12-22 16:50:46 +03:00
Boris Gulay
a4dc73c6a7 Fix password saving. 2018-12-22 16:36:55 +03:00
Boris Gulay
f796334126 Add ability to specify SMTP server directly.
Closes #32.
Closes #30.
2018-12-22 13:31:25 +03:00
Boris Gulay
24a9584d6f Fixed typo in field name. Closes #25 (thanx Dariusz Bijoś) 2018-08-27 22:24:48 +03:00
Boris Gulay
bcea012af0 Finally works correct for SMTP too. Closes #24. 2018-07-16 20:30:48 +03:00
Boris Gulay
8b2798e412 Show account selection only for MAIL task.
Optimize JS scripts.
2018-03-17 23:03:42 +03:00
Boris Gulay
c28305509f Fix identity form.
Closes #22.
2018-03-17 22:10:00 +03:00
Boris Gulay
e4aeef2e07 Fixed bug with identity updating. 2018-03-12 23:14:06 +03:00
Boris Gulay
e19b33a842 Return error message in a modern way. 2018-03-11 01:11:24 +03:00
Boris Gulay
d540de77ff Some code cleanup. 2018-03-10 00:44:12 +03:00
Boris Gulay
913065548b New member fuction to write to log. Make code easy to understand. 2018-03-10 00:30:58 +03:00
Boris Gulay
683b02027b Change some class variables to constants. Better style and more readable. 2018-03-10 00:26:57 +03:00
Boris Gulay
7111e9e759 Fixed saving IMAP data for new identity (now cound I miss this?!). 2018-03-10 00:12:38 +03:00
Boris Gulay
17044fe501 Fixed strange layout in FF because of special styles for Mozilla. Should not affect anything else. Closes #11. 2016-10-16 22:00:37 +03:00
Boris Gulay
dd2d8e10a4 Rewrite all git_input_value to single syntax. 2016-10-16 13:44:51 +03:00