block imap function from spitting out errors to the page

This commit is contained in:
Friendika 2011-09-10 03:14:00 -07:00
parent ebb9af8946
commit 0c0a604396

View file

@ -4,7 +4,7 @@ function email_connect($mailbox,$username,$password) {
if(! function_exists('imap_open')) if(! function_exists('imap_open'))
return false; return false;
$mbox = imap_open($mailbox,$username,$password); $mbox = @imap_open($mailbox,$username,$password);
return $mbox; return $mbox;
} }
@ -14,19 +14,19 @@ function email_poll($mbox,$email_addr) {
if(! ($mbox && $email_addr)) if(! ($mbox && $email_addr))
return array(); return array();
$search1 = imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID); $search1 = @imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID);
if(! $search1) if(! $search1)
$search1 = array(); $search1 = array();
$search2 = imap_search($mbox,'TO "' . $email_addr . '"', SE_UID); $search2 = @imap_search($mbox,'TO "' . $email_addr . '"', SE_UID);
if(! $search2) if(! $search2)
$search2 = array(); $search2 = array();
$search3 = imap_search($mbox,'CC "' . $email_addr . '"', SE_UID); $search3 = @imap_search($mbox,'CC "' . $email_addr . '"', SE_UID);
if(! $search3) if(! $search3)
$search3 = array(); $search3 = array();
$search4 = imap_search($mbox,'BCC "' . $email_addr . '"', SE_UID); $search4 = @imap_search($mbox,'BCC "' . $email_addr . '"', SE_UID);
if(! $search4) if(! $search4)
$search4 = array(); $search4 = array();
@ -45,12 +45,12 @@ function construct_mailbox_name($mailacct) {
function email_msg_meta($mbox,$uid) { function email_msg_meta($mbox,$uid) {
$ret = (($mbox && $uid) ? imap_fetch_overview($mbox,$uid,FT_UID) : array(array())); $ret = (($mbox && $uid) ? @imap_fetch_overview($mbox,$uid,FT_UID) : array(array()));
return ((count($ret)) ? $ret[0] : array()); return ((count($ret)) ? $ret[0] : array());
} }
function email_msg_headers($mbox,$uid) { function email_msg_headers($mbox,$uid) {
$raw_header = (($mbox && $uid) ? imap_fetchheader($mbox,$uid,FT_UID) : ''); $raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
$raw_header = str_replace("\r",'',$raw_header); $raw_header = str_replace("\r",'',$raw_header);
$ret = array(); $ret = array();
$h = split("\n",$raw_header); $h = split("\n",$raw_header);
@ -74,7 +74,7 @@ function email_msg_headers($mbox,$uid) {
function email_get_msg($mbox,$uid) { function email_get_msg($mbox,$uid) {
$ret = array(); $ret = array();
$struc = (($mbox && $uid) ? imap_fetchstructure($mbox,$uid,FT_UID) : null); $struc = (($mbox && $uid) ? @imap_fetchstructure($mbox,$uid,FT_UID) : null);
if(! $struc) if(! $struc)
return $ret; return $ret;
@ -103,8 +103,8 @@ function email_get_part($mbox,$uid,$p,$partno) {
// DECODE DATA // DECODE DATA
$data = ($partno) $data = ($partno)
? imap_fetchbody($mbox,$uid,$partno, FT_UID|FT_PEEK) ? @imap_fetchbody($mbox,$uid,$partno, FT_UID|FT_PEEK)
: imap_body($mbox,$uid,FT_UID|FT_PEEK); : @imap_body($mbox,$uid,FT_UID|FT_PEEK);
// Any part may be encoded, even plain text messages, so check everything. // Any part may be encoded, even plain text messages, so check everything.
if ($p->encoding==4) if ($p->encoding==4)