本文整理汇总了PHP中Support::connectEmailServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Support::connectEmailServer方法的具体用法?PHP Support::connectEmailServer怎么用?PHP Support::connectEmailServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Support
的用法示例。
在下文中一共展示了Support::connectEmailServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: expungeEmails
/**
* Permanently removes the given support emails from the associated email
* server.
*
* @access public
* @param array $sup_ids The list of support emails
* @return integer 1 if the removal worked, -1 otherwise
*/
function expungeEmails($sup_ids)
{
$accounts = array();
$stmt = "SELECT\n sup_id,\n sup_message_id,\n sup_ema_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email\n WHERE\n sup_id IN (" . implode(', ', Misc::escapeInteger($sup_ids)) . ")";
$res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
for ($i = 0; $i < count($res); $i++) {
// don't remove emails from the imap/pop3 server if the email
// account is set to leave a copy of the messages on the server
$account_details = Email_Account::getDetails($res[$i]['sup_ema_id']);
if (!$account_details['leave_copy']) {
// try to re-use an open connection to the imap server
if (!in_array($res[$i]['sup_ema_id'], array_keys($accounts))) {
$accounts[$res[$i]['sup_ema_id']] = Support::connectEmailServer(Email_Account::getDetails($res[$i]['sup_ema_id']));
}
$mbox = $accounts[$res[$i]['sup_ema_id']];
if ($mbox !== FALSE) {
// now try to find the UID of the current message-id
$matches = @imap_search($mbox, 'TEXT "' . $res[$i]['sup_message_id'] . '"');
if (count($matches) > 0) {
for ($y = 0; $y < count($matches); $y++) {
$headers = imap_headerinfo($mbox, $matches[$y]);
// if the current message also matches the message-id header, then remove it!
if ($headers->message_id == $res[$i]['sup_message_id']) {
@imap_delete($mbox, $matches[$y]);
@imap_expunge($mbox);
break;
}
}
}
}
}
// remove the email record from the table
Support::removeEmail($res[$i]['sup_id']);
}
return 1;
}
}
示例2: fatal
if (SAPI_CLI) {
fatal('Another instance of the script is still running for the specified account.', "If this is not accurate, you may fix it by running this script with '--fix-lock'", "as the 4th parameter or you may unlock ALL accounts by running this script with '--fix-lock'", 'as the only parameter.');
} else {
fatal('Another instance of the script is still running for the specified account. ', "If this is not accurate, you may fix it by running this script with 'fix-lock=1'", "in the query string or you may unlock ALL accounts by running this script with 'fix-lock=1'", 'as the only parameter.');
}
exit;
}
// clear the lock in all cases of termination
function cleanup_lock()
{
global $account_id;
Lock::release('download_emails_' . $account_id);
}
register_shutdown_function('cleanup_lock');
$account = Email_Account::getDetails($account_id);
$mbox = Support::connectEmailServer($account);
if ($mbox == false) {
$uri = Support::getServerURI($account);
$login = $account['ema_username'];
$error = imap_last_error();
fatal("{$error}\n", "Could not connect to the email server '{$uri}' with login: '{$login}'.", 'Please verify your email account settings and try again.');
}
// if we only want new emails
if ($account['ema_get_only_new']) {
$new_emails = Support::getNewEmails($mbox);
foreach ($new_emails as $new_email) {
Support::getEmailInfo($mbox, $account, $new_email);
}
} else {
$total_emails = Support::getTotalEmails($mbox);
if ($total_emails > 0) {