]> git.mxchange.org Git - friendica.git/commitdiff
bug #87 alert if email settings don't open mailbox, also display last email connect...
authorFriendika <info@friendika.com>
Mon, 30 May 2011 04:20:50 +0000 (21:20 -0700)
committerFriendika <info@friendika.com>
Mon, 30 May 2011 04:20:50 +0000 (21:20 -0700)
mod/settings.php
view/settings.tpl

index 0550429161f492ac50792c96bc4c3ebbe3f3a1b1..f898f171cc34c7735d0aee33c0d9e73a3d650b2a 100644 (file)
@@ -111,6 +111,22 @@ function settings_post(&$a) {
                        intval($mail_pubmail),
                        intval(local_user())
                );
+               $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+                       intval(local_user())
+               );
+               if(count($r)) {
+                       $eacct = $r[0];
+                       require_once('include/email.php');
+                       $mb = construct_mailbox_name($eacct);
+                       if(strlen($eacct['server'])) {
+                               $dcrpass = '';
+                               openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
+                               $mbox = email_connect($mb,$mail_user,$dcrpass);
+                               unset($dcrpass);
+                               if(! $mbox)
+                                       notice( t('Failed to connect with email account using the settings provided.') . EOL);
+                       }
+               }
        }
 
        $notify = 0;
@@ -308,7 +324,7 @@ function settings_content(&$a) {
        $mail_user    = ((count($r)) ? $r[0]['user'] : '');
        $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
        $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
-
+       $mail_chk     = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
 
        $pageset_tpl = get_markup_template('pagetypes.tpl');
        $pagetype = replace_macros($pageset_tpl,array(
@@ -484,6 +500,8 @@ function settings_content(&$a) {
                '$lbl_imap6' => t("Reply-to address \x28Optional\x29:"),
                '$imap_replyto' => $mail_replyto,
                '$lbl_imap7' => t('Send public posts to all email contacts:'),
+               '$lbl_imap8' => t('Last successful email check:'),
+               '$lbl_imap9' => (($mail_chk === '0000-00-00 00:00:00') ? t('never') : datetime_convert('UTC', date_default_timezone_get(), $mail_chk, t('g A l F d Y'))), 
                '$pubmail_checked' => (($mail_pubmail) ? ' checked="checked" ' : ''),
                '$mail_disabled' => (($mail_disabled) ? '<div class="info-message">' . t('Email access is disabled on this site.') . '</div>' : ''),
                '$imap_disabled' => $imap_disabled
index 25f570be6e155220a7673e5242fa1da8ba093cc2..077840ba43e4278191ae882ebe1c943a5b8be9cb 100644 (file)
@@ -169,6 +169,9 @@ $profile_in_net_dir
 $imap_desc
 $mail_disabled
 </p>
+<p>
+$lbl_imap8 $lbl_imap9
+</p>
 <label for="imap-server" id="settings-label-imap1">$lbl_imap1</label>
 <input type="text" id="imap-server" name="mail_server" value="$imap_server" $imap_disabled />
 <div id="imap-server-end"></div>