mirror of
https://github.com/friendica/friendica
synced 2024-11-09 23:42:53 +00:00
Merge pull request #11294 from annando/fix-mail-setting
Fix storing mail settings
This commit is contained in:
commit
285ff75482
2 changed files with 21 additions and 20 deletions
|
@ -108,7 +108,7 @@ function settings_post(App $a)
|
|||
'port' => $mail_port,
|
||||
'ssltype' => $mail_ssl,
|
||||
'user' => $mail_user,
|
||||
`action` => $mail_action,
|
||||
'action' => $mail_action,
|
||||
'movetofolder' => $mail_movetofolder,
|
||||
'mailbox' => 'INBOX',
|
||||
'reply_to' => $mail_replyto,
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Util\Strings;
|
||||
use \IMAP\Connection;
|
||||
|
||||
/**
|
||||
* Email class
|
||||
|
@ -37,10 +38,10 @@ class Email
|
|||
* @param string $mailbox The mailbox name
|
||||
* @param string $username The username
|
||||
* @param string $password The password
|
||||
* @return resource
|
||||
* @return Connection
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function connect($mailbox, $username, $password)
|
||||
public static function connect($mailbox, $username, $password): Connection
|
||||
{
|
||||
if (!function_exists('imap_open')) {
|
||||
return false;
|
||||
|
@ -50,7 +51,7 @@ class Email
|
|||
|
||||
$errors = imap_errors();
|
||||
if (!empty($errors)) {
|
||||
Logger::notice('IMAP Errors occured', ['errora' => $errors]);
|
||||
Logger::notice('IMAP Errors occured', ['errors' => $errors]);
|
||||
}
|
||||
|
||||
$alerts = imap_alerts();
|
||||
|
@ -62,12 +63,12 @@ class Email
|
|||
}
|
||||
|
||||
/**
|
||||
* @param resource $mbox mailbox
|
||||
* @param Connection $mbox mailbox
|
||||
* @param string $email_addr email
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function poll($mbox, $email_addr)
|
||||
public static function poll(Connection $mbox, $email_addr): array
|
||||
{
|
||||
if (!$mbox || !$email_addr) {
|
||||
return [];
|
||||
|
@ -112,24 +113,24 @@ class Email
|
|||
}
|
||||
|
||||
/**
|
||||
* @param resource $mbox mailbox
|
||||
* @param Connection $mbox mailbox
|
||||
* @param integer $uid user id
|
||||
* @return mixed
|
||||
*/
|
||||
public static function messageMeta($mbox, $uid)
|
||||
public static function messageMeta(Connection $mbox, $uid)
|
||||
{
|
||||
$ret = (($mbox && $uid) ? @imap_fetch_overview($mbox, $uid, FT_UID) : [[]]); // POSSIBLE CLEANUP --> array(array()) is probably redundant now
|
||||
return (count($ret)) ? $ret : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $mbox mailbox
|
||||
* @param Connection $mbox mailbox
|
||||
* @param integer $uid user id
|
||||
* @param string $reply reply
|
||||
* @return array
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getMessage($mbox, $uid, $reply, $item)
|
||||
public static function getMessage(Connection $mbox, $uid, $reply, $item): array
|
||||
{
|
||||
$ret = $item;
|
||||
|
||||
|
@ -210,14 +211,14 @@ class Email
|
|||
/**
|
||||
* fetch the specified message part number with the specified subtype
|
||||
*
|
||||
* @param resource $mbox mailbox
|
||||
* @param Connection $mbox mailbox
|
||||
* @param integer $uid user id
|
||||
* @param object $p parts
|
||||
* @param integer $partno part number
|
||||
* @param string $subtype sub type
|
||||
* @return string
|
||||
*/
|
||||
private static function messageGetPart($mbox, $uid, $p, $partno, $subtype)
|
||||
private static function messageGetPart(Connection $mbox, $uid, $p, $partno, $subtype)
|
||||
{
|
||||
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
|
||||
global $htmlmsg,$plainmsg,$charset,$attachments;
|
||||
|
|
Loading…
Reference in a new issue