gpt4 book ai didi

PHP fatal error : Call to a member function GetFolderByType() on a non-object in

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:19:58 25 4
gpt4 key购买 nike

我的网络邮件有错误

PHP Fatal error:  Call to a member function GetFolderByType() on a non-object in /home/.../domains/.../public_html/check-mail.php on line 248

第 248 行是:

$oInboxFolder = $oFolders->GetFolderByType(FOLDERTYPE_Inbox);

我的 php 版本是 5.4完整代码是:

    <?php

@header('Content-type: text/html; charset=utf-8');

defined('WM_ROOTPATH') || define('WM_ROOTPATH', (dirname(__FILE__).'/'));
include_once WM_ROOTPATH.'application/include.php';

$oInput = new api_Http();
$iAccountId = CSession::Get(APP_SESSION_ACCOUNT_ID, false);

require_once WM_ROOTPATH.'common/inc_constants.php';
require_once WM_ROOTPATH.'common/class_convertutils.php';
require_once WM_ROOTPATH.'common/class_mailprocessor.php';

/* @var $oApiUsersManager CApiUsersManager */
$oApiUsersManager = CApi::Manager('users');

/* @var $oAccount CAccount */
$oAccount = AppGetAccount($iAccountId);
if (!$oAccount)
{
CApi::Log('check-mail: $oAccount = null');

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><meta http-equiv="Content-Script-Type" content="text/javascript" /><link rel="shortcut icon" href="favicon.ico" /></head>
<body onload="parent.CheckEndCheckMailHandler();"><script>parent.EndCheckMailHandler("session_error");</script></body></html>';

exit();
}

AppIncludeLanguage($oAccount->User->DefaultLanguage);

@ob_start();
@ob_end_flush();

$sErrorDesc = '';
$aGlobalForders4Update = array();

/**
* @global $aGlobalForders4Update
* @param int $id
* @param string $fullName
*/
function AddFolder4Update($id, $fullName)
{
global $aGlobalForders4Update;
$aGlobalForders4Update[$id] = $fullName;
}

/**
* @global $aGlobalForders4Update
* @return string
*/
function Folders4UpdateToJsArray()
{
global $aGlobalForders4Update;

$sResult = array();
if ($aGlobalForders4Update && count($aGlobalForders4Update) > 0)
{
foreach ($aGlobalForders4Update as $id => $name)
{
$sResult[] = '{id: '.((int) $id).', fullName: \''.ConvertUtils::ClearJavaScriptString($name, '\'').'\'}';
}
}

return '['.implode(',', $sResult).']';
}

/**
* @param bool $bAdd = false
* @return void
*/
function myFlush($bAdd = false)
{
if ($bAdd)
{
echo str_repeat(' ', 256);
}

@ob_flush();
@flush();
}

/**
* @param string $sFolderName
* @param int $iMessageCount
*/
function ShowDownloadedMessageNumber($sFolderName = '', $iMessageCount = -1)
{
static $msgNumber = 0;
static $msgTime = 0;

if ($sFolderName != '' && $iMessageCount != -1)
{
$msgNumber = 0;
$msgTime = 0;
echo '<script>parent.SetCheckingFolderHandler("'.$sFolderName.'", '.$iMessageCount.');</script>'.CRLF;
if ($iMessageCount == 0)
{
echo '<script>parent.SetStateTextHandler(parent.Lang.GettingMsgsNum);</script>'.CRLF;
}
myFlush(true);
}
else
{
$msgNumber++;
if (time() - $msgTime > 0)
{
echo '<script>parent.SetRetrievingMessageHandler('.$msgNumber.');</script>'.CRLF;
$msgTime = time();
myFlush(true);
}
}
}

function ShowLoggingToServer()
{
echo '<script>parent.SetStateTextHandler("'.ConvertUtils::ClearJavaScriptString(JS_LANG_LoggingToServer, '"').'");</script>'.CRLF;
myFlush(true);
}

function ShowLoggingOffFromServer()
{
echo '<script>parent.SetStateTextHandler("'.ConvertUtils::ClearJavaScriptString(LoggingOffFromServer, '"').'");</script>'.CRLF;
myFlush(true);
}

function ShowDeletingMessageNumber($resetCount = false)
{
static $msgNumber = 0;
static $msgTime = 0;

if ($resetCount)
{
$msgNumber = 0;
$msgTime = 0;
}
else
{
$msgNumber++;
if (time() - $msgTime > 0)
{
echo '<script>parent.SetDeletingMessageHandler('.$msgNumber.');</script>'.CRLF;
$msgTime = time();
myFlush(true);
}
}
}

/**
* @param string $sText
*/
function SetError($sText)
{
CSession::Set(INFORMATION, $sText);
CSession::Set(ISINFOERROR, true);
}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body onload="parent.CheckEndCheckMailHandler();">
<?php

ConvertUtils::SetLimits();

$GLOBALS['useFilters'] = true;
$type = (int) $oInput->GetPost('Type', 0);

CApi::Log('CM: Check mail type = '.$type);

if (1 === $type)
{
$aAccounts = $oApiUsersManager->GetUserIdList($oAccount->IdUser);
if (is_array($aAccounts) && 0 < count($aAccounts))
{
foreach ($aAccounts as $iAccountItemId)
{
/* @var $oListAccount CAccount */
$oListAccount = ($oAccount->IdAccount !== $iAccountItemId)
? AppGetAccount($iAccountItemId) : $oAccount;

$oProcessor = new MailProcessor($oListAccount);
if (!$oProcessor->SynchronizeFolders())
{
$sErrorDesc = getGlobalError();
$oProcessor->MailStorage->Disconnect();
break;
}

if ($oListAccount->GetMailAtLogin)
{
echo '<script>parent.SetCheckingAccountHandler("'.$oListAccount->Email.'");</script>'.CRLF;

myFlush(true);

ShowLoggingToServer();

$oFolders = null;
$oProcessor->MailStorage->DownloadedMessagesHandler = 'ShowDownloadedMessageNumber';

$oFolders =& $oProcessor->GetFolders();
if (!$oProcessor->Synchronize($oFolders))
{
$sErrorDesc = getGlobalError();
$oProcessor->MailStorage->Disconnect();
break;
}

ShowLoggingOffFromServer();

$oProcessor->MailStorage->Disconnect();

unset($oFolders, $oProcessor);
}

unset($oListAccount);
}
}

$sErrorDesc = trim($sErrorDesc);
if (strlen($sErrorDesc) > 0)
{
SetError($sErrorDesc);
}

echo '<script>parent.EndCheckMailHandler(\'\');</script>'.CRLF;
}
else if (2 === $type)
{
$oProcessor = new MailProcessor($oAccount);

$oFolders =& $oProcessor->GetFolders();

$oProcessor->MailStorage->DownloadedMessagesHandler = null;
$oProcessor->MailStorage->UpdateFolderHandler = 'AddFolder4Update';

$oInboxFolder = $oFolders->GetFolderByType(FOLDERTYPE_Inbox);

if ($oInboxFolder)
{
$oInboxFolder->SubFolders = null;
$foldersForInboxSynchronize = new FolderCollection();
$foldersForInboxSynchronize->Add($oInboxFolder);

if (!$oProcessor->Synchronize($foldersForInboxSynchronize))
{
$sErrorDesc = getGlobalError();
}

$oProcessor->MailStorage->Disconnect();
}
else
{
$sErrorDesc = '';
}

$sErrorDesc = trim($sErrorDesc);
echo '<script>
parent.SetUpdatedFolders('.Folders4UpdateToJsArray().', false);
parent.EndCheckMailHandler("'.ConvertUtils::ClearJavaScriptString($sErrorDesc, '"').'");
</script>'.CRLF;
}
else
{
ShowLoggingToServer();

$oProcessor = new MailProcessor($oAccount);

$oFolders =& $oProcessor->GetFolders();

$oProcessor->MailStorage->DownloadedMessagesHandler = 'ShowDownloadedMessageNumber';
$oProcessor->MailStorage->UpdateFolderHandler = 'AddFolder4Update';

if (!$oProcessor->Synchronize($oFolders))
{
$sErrorDesc = getGlobalError();
}

ShowLoggingOffFromServer();

$oProcessor->MailStorage->Disconnect();

$sErrorDesc = trim($sErrorDesc);
echo '<script>
parent.SetUpdatedFolders('.Folders4UpdateToJsArray().');
parent.EndCheckMailHandler("'.ConvertUtils::ClearJavaScriptString($sErrorDesc, '"').'");
</script>'.CRLF;
}

myFlush(true);
?>
</body>
</html>

最佳答案

使用 var_dump($oFolders) 获取有关 $oFolders 的更多详细信息。
请注意 $oProcessor->GetFolders();if(2 === $type) block 中不返回任何对象。

关于PHP fatal error : Call to a member function GetFolderByType() on a non-object in,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23582264/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com