本文整理汇总了PHP中Folder::SetFolderSync方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::SetFolderSync方法的具体用法?PHP Folder::SetFolderSync怎么用?PHP Folder::SetFolderSync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::SetFolderSync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateAccount
//.........这里部分代码省略.........
} else {
$result = true;
}
$folders =& $mailStorage->GetFolders();
if ($folders == null) {
if (USE_DB) {
$dbStorage->DeleteAccountData($account->Id);
}
setGlobalError(PROC_ERROR_ACCT_CREATE);
return false;
}
$inb =& $folders->GetFolderByType(FOLDERTYPE_Inbox);
if ($inb === null) {
if (USE_DB) {
$dbStorage->DeleteAccountData($account->Id);
}
setGlobalError(PROC_ERROR_ACCT_CREATE);
return false;
}
$folders->SetSyncTypeToAll($inboxSyncType);
if (!$result) {
return false;
}
$s = $d = $t = $sp = null;
$s =& $folders->GetFolderByType(FOLDERTYPE_SentItems);
$d =& $folders->GetFolderByType(FOLDERTYPE_Drafts);
$sp =& $folders->GetFolderByType(FOLDERTYPE_Spam);
if ($settings->Imap4DeleteLikePop3) {
$t =& $folders->GetFolderByType(FOLDERTYPE_Trash);
}
$account->NameSpace = $mailStorage->GetNameSpacePrefix();
$account->UpdateNameSpace();
$createSystemFoldersInInbox = 0 === strpos($account->NameSpace, $inb->FullName);
$createFoldersIfNotExist = $account->IsInternal ? true : CREATE_FOLDERS_IF_NOT_EXIST;
/* custom class */
wm_Custom::StaticUseMethod('ChangeValueOfSystemFoldersInInbox', array(&$createSystemFoldersInInbox));
wm_Custom::StaticUseMethod('ChangeValueOfCreateFolderIfNotExist', array(&$createFoldersIfNotExist));
$folderPrefix = '';
if ($createSystemFoldersInInbox) {
$folderPrefix = $inb->FullName . $account->Delimiter;
$inb->SubFolders = $inb->SubFolders ? $inb->SubFolders : new FolderCollection();
$addFolders =& $inb->SubFolders;
} else {
$addFolders =& $folders;
}
if ($s === null) {
$sentFolder = new Folder($account->Id, -1, $folderPrefix . FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync);
if ($createFoldersIfNotExist) {
$sentFolder->SetFolderSync($inboxSyncType);
$mailStorage->CreateFolder($sentFolder);
}
$addFolders->Add($sentFolder);
}
if ($d === null) {
$draftsFolder = new Folder($account->Id, -1, $folderPrefix . FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync);
if ($createFoldersIfNotExist) {
$draftsFolder->SetFolderSync($inboxSyncType);
$mailStorage->CreateFolder($draftsFolder);
}
$addFolders->Add($draftsFolder);
}
if ($sp === null) {
$spamFolder = new Folder($account->Id, -1, $folderPrefix . FOLDERNAME_Spam, FOLDERNAME_Spam, FOLDERSYNC_DontSync);
if ($createFoldersIfNotExist) {
$spamFolder->SetFolderSync($inboxSyncType);
$mailStorage->CreateFolder($spamFolder);
}
$addFolders->Add($spamFolder);
}
if ($settings->Imap4DeleteLikePop3 && $t === null) {
$trashFolder = new Folder($account->Id, -1, $folderPrefix . FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync);
if ($createFoldersIfNotExist) {
$trashFolder->SetFolderSync($inboxSyncType);
$mailStorage->CreateFolder($trashFolder);
}
$addFolders->Add($trashFolder);
}
$mailStorage->Disconnect();
} else {
return false;
}
break;
default:
return false;
}
if ($result && $folders) {
$folders = $folders->SortRootTree();
if (USE_DB) {
$result &= $dbStorage->CreateFolders($folders);
}
}
}
if ($result) {
setGlobalError('');
if ($account && $account->MailProtocol == MAILPROTOCOL_IMAP4 && $account->ImapQuota === 1) {
$account->UpdateMailBoxLimit();
}
}
return $result;
}
示例2: checkSystemFolderAndCreate
function checkSystemFolderAndCreate(&$_settings, &$_newprocessor, &$_account, &$folders, $folderType, $folderName)
{
$createSystemFoldersInInbox = 0 === strpos($_account->NameSpace, 'INBOX');
$createFoldersIfNotExist = CREATE_FOLDERS_IF_NOT_EXIST;
/* custom class */
wm_Custom::StaticUseMethod('ChangeValueOfSystemFoldersInInbox', array(&$createSystemFoldersInInbox));
wm_Custom::StaticUseMethod('ChangeValueOfCreateFolderIfNotExist', array(&$createFoldersIfNotExist));
$folderByName = $folders->GetFolderByName($folderName);
$folderByType = $folders->GetFolderByType($folderType);
if ($folderByName && !$folderByType) {
if ($folderByName->Type !== $folderType) {
$folderByName->Type = $folderType;
if ($createFoldersIfNotExist && $folderByName->SyncType == FOLDERSYNC_DontSync) {
$folderByName->SetFolderSync($_account->GetDefaultFolderSync($_settings));
$_newprocessor->CreateFolder($folderByName);
} else {
if ($_newprocessor->DbStorage->Connect()) {
$_newprocessor->DbStorage->UpdateFolder($folderByName);
}
}
}
} else {
if (!$folderByType) {
$prefix = '';
if ($createSystemFoldersInInbox) {
$inboxFolder = $folders->GetFolderByType(FOLDERTYPE_Inbox);
if ($inboxFolder) {
$prefix = $inboxFolder->FullName . $_account->Delimiter;
}
}
$folder = new Folder($_account->Id, -1, $prefix . $folderName, $folderName, FOLDERSYNC_DontSync, $folderType);
if ($createFoldersIfNotExist) {
$folder->SetFolderSync($_account->GetDefaultFolderSync($_settings));
}
$_newprocessor->CreateFolder($folder);
}
}
}
示例3: CreateAccount
//.........这里部分代码省略.........
$accountDelimiter = $account->Delimiter;
$folders =& $this->MailStorage->GetFolders($accountDelimiter);
if ($accountDelimiter != $account->Delimiter) {
$account->Delimiter = $accountDelimiter;
$this->DbStorage->UpdateAccountDelimiter($account->Id, $accountDelimiter);
}
$result &= $folders != null;
if ($result) {
$inb =& $folders->GetFolderByType(WM_FOLDERTYPE_Inbox);
if ($inb === null) {
$result = false;
break;
}
$inboxSyncType = $sync !== null ? $sync : WM_FOLDERSYNC_AllHeadersOnly;
if ($account->_settings->AllowDirectMode && $account->_settings->DirectModeIsDefault) {
$inboxSyncType = WM_FOLDERSYNC_DirectMode;
}
$folders->SetSyncTypeToAll($inboxSyncType);
$account->NameSpace = $this->MailStorage->GetNameSpacePrefix();
$this->DbStorage->UpdateAccountNameSpace($account->Id, $account->NameSpace);
$createSystemFoldersInInbox = 0 === strpos($account->NameSpace, $inb->FullName);
$createFoldersIfNotExist = $account->IsInternal;
/* custom class */
ap_Custom::StaticUseMethod('wm_ChangeValueOfSystemFoldersInInbox', array(&$createSystemFoldersInInbox));
ap_Custom::StaticUseMethod('wm_ChangeValueOfCreateFolderIfNotExist', array(&$createFoldersIfNotExist));
$folderPrefix = '';
if ($createSystemFoldersInInbox) {
$folderPrefix = $inb->FullName . $account->Delimiter;
$inb->SubFolders = $inb->SubFolders ? $inb->SubFolders : new FolderCollection();
$addFolders =& $inb->SubFolders;
} else {
$addFolders =& $folders;
}
$s = $d = $t = $sp = null;
$s =& $folders->GetFolderByType(WM_FOLDERTYPE_SentItems);
$d =& $folders->GetFolderByType(WM_FOLDERTYPE_Drafts);
if ($account->_settings->Imap4DeleteLikePop3) {
$t =& $folders->GetFolderByType(WM_FOLDERTYPE_Trash);
}
$sp =& $folders->GetFolderByType(WM_FOLDERTYPE_Spam);
if ($s === null) {
$sentFolder = new Folder($account->Id, -1, $folderPrefix . WM_FOLDERNAME_SentItems, WM_FOLDERNAME_SentItems, WM_FOLDERSYNC_DontSync, WM_FOLDERTYPE_SentItems);
if ($createFoldersIfNotExist) {
$sentFolder->SetFolderSync($inboxSyncType);
$this->MailStorage->CreateFolder($sentFolder);
}
$addFolders->Add($sentFolder);
}
if ($d === null) {
$draftsFolder = new Folder($account->Id, -1, $folderPrefix . WM_FOLDERNAME_Drafts, WM_FOLDERNAME_Drafts, WM_FOLDERSYNC_DontSync, WM_FOLDERTYPE_Drafts);
if ($createFoldersIfNotExist) {
$draftsFolder->SetFolderSync($inboxSyncType);
$this->MailStorage->CreateFolder($draftsFolder);
}
$addFolders->Add($draftsFolder);
}
if ($sp === null) {
$spamFolder = new Folder($account->Id, -1, $folderPrefix . WM_FOLDERNAME_Spam, WM_FOLDERNAME_Spam, WM_FOLDERSYNC_DontSync, WM_FOLDERTYPE_Spam);
if ($createFoldersIfNotExist) {
$spamFolder->SetFolderSync($inboxSyncType);
$this->MailStorage->CreateFolder($spamFolder);
}
$addFolders->Add($spamFolder);
}
if ($account->_settings->Imap4DeleteLikePop3 && $t === null) {
$trashFolder = new Folder($account->Id, -1, $folderPrefix . WM_FOLDERNAME_Trash, WM_FOLDERNAME_Trash, WM_FOLDERSYNC_DontSync, WM_FOLDERTYPE_Trash);
if ($createFoldersIfNotExist) {
$trashFolder->SetFolderSync($inboxSyncType);
$this->MailStorage->CreateFolder($trashFolder);
}
$addFolders->Add($trashFolder);
}
} else {
$this->DbStorage->DeleteUserData($account->IdUser, $account->Id);
}
$this->MailStorage->Disconnect();
break;
}
} else {
$result = false;
$this->DbStorage->DeleteUserData($account->IdUser);
}
if ($result && $folders && $folders->Count() > 0) {
$folders = $folders->SortRootTree();
$this->DbStorage->CreateFolders($folders);
}
}
}
} else {
$result = false;
}
if ($result && $account->IsInternal) {
$this->DbStorage->SaveMailAliases($account);
$this->DbStorage->SaveMailForwards($account);
}
if (!$result) {
$this->SetError(ap_Utils::TakePhrase('WM_CANT_CREATE_ACCOUNT'));
}
return $result;
}