/** * @param string $query * @return mixed */ function Execute($query) { $query = ConvertUtils::mainClear($query); $this->_log->WriteLine('SQL Query: ' . $query); $ti = getmicrotime(); $this->_resultId = @mssql_query($query, $this->_conectionHandle); $this->_log->WriteLine('>> Execute TIME - ' . (getmicrotime() - $ti)); if ($this->_resultId === false) { $this->_setSqlError(); return false; } else { return $this->_resultId; } }
/** * @param XmlDomNode $xmlTree * @param array $mainArray */ protected function initFromXmlRoot(&$xmlTree) { if ($xmlTree && $xmlTree->Children && count($xmlTree->Children) > 0) { if ('Folders' === $xmlTree->TagName) { foreach ($xmlTree->Children as $node) { if ('Folder' == $node->TagName) { $this->_main[] = ConvertUtils::WMBackHtmlSpecialChars($node->Value); } } } else { foreach ($xmlTree->Children as $node) { $this->initFromXmlRoot($node); } } } }
/** * @access protected * @param string $str * @return string */ protected function _escapeString($str, $nullable = FALSE) { if ($nullable && is_null($str)) { return 'NULL'; } if (is_null($str) || $str === '') { return "''"; } $str = ConvertUtils::ClearUtf8($str); switch ($this->_escapeType) { case QUOTE_DOUBLE: return "'" . str_replace("'", "''", $str) . "'"; case QUOTE_ESCAPE: default: return "'" . addslashes($str) . "'"; } }
/** * @return string */ function ToString($doEncode = false) { $value = $this->Value; if ($doEncode) { if (!ConvertUtils::IsLatin($value)) { $value = ConvertUtils::EncodeHeaderString($value, $GLOBALS[MailInputCharset], $GLOBALS[MailOutputCharset], true); } } if ($this->Attribute != '' && $this->Value != '') { return sprintf('%s="%s"', $this->Attribute, $value); } elseif ($this->Attribute != '') { return $this->Attribute; } elseif ($this->Value != '') { return $value; } return ''; }
/** * @access public * @param string $basePath * @param string $email * @return WMserverFS */ function WMserverFS($basePath, $email) { $parsedEmail = ConvertUtils::ParseEmail($email); $this->userName = trim($parsedEmail[0]); $this->domain = trim($parsedEmail[1]); $this->basePath = rtrim($basePath, '/\\'); if (is_dir($this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/mailbox/')) { $this->path = $this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/mailbox/'; $this->isUnix = false; } else { $this->path = $this->basePath . '/domains/' . $this->domain . '/' . $this->userName . '/Maildir/'; $this->pathnew = $this->path . 'new/'; $this->pathcur = $this->path . 'cur/'; $this->isUnix = true; } $this->_log =& CLog::CreateInstance(); }
public function InitDriver() { $this->_pabURI = isset($this->_account->CustomValues['paburi']) ? $this->_account->CustomValues['paburi'] : ''; $this->_link = null; $this->_search = null; $this->WriteLog('ldap: parse pbaURI = ' . $this->_pabURI); $uriParseResult = ConvertUtils::LdapUriParse($this->_pabURI); $this->_host = $uriParseResult['host']; $this->_port = $uriParseResult['port']; $this->_search_dn = $uriParseResult['search_dn']; $this->_objectMap = LdapHandlerClass::GetLdapObjectMap(); $this->_contactObject = LdapHandlerClass::GetLdapContactObjectEntry(); $this->_groupObject = LdapHandlerClass::GetLdapGroupObjectEntry(); $this->_memberofpab = ''; if (isset($this->_account->CustomValues['memberofpab']) && strlen($this->_account->CustomValues['memberofpab']) > 0) { $this->_contactObject['memberofpab'] = $this->_account->CustomValues['memberofpab']; $this->_groupObject['memberofpab'] = $this->_account->CustomValues['memberofpab']; $this->_memberofpab = $this->_account->CustomValues['memberofpab']; } }
/** * @return string */ function GetEncodedValue() { if ($this->IsParsed) { if ($this->IsEmailAddress()) { $addressCollection = new EmailAddressCollection($this->Value); return $addressCollection->ToString(); } if ($this->IsSubject()) { return ConvertUtils::EncodeHeaderString($this->Value, $GLOBALS[MailInputCharset], $GLOBALS[MailOutputCharset], true); } if ($this->IsWithParameters()) { $parameterCollection = new HeaderParameterCollection($this->Value); return $parameterCollection->ToString(true); } } if (ConvertUtils::IsLatin($this->Value)) { return $this->Value; } else { return ConvertUtils::EncodeHeaderString($this->Value, $GLOBALS[MailInputCharset], $GLOBALS[MailOutputCharset]); } }
header('Pragma: public'); header('Content-type: application/octet-stream; charset=utf-8'); //header('Content-Type: application/force-download'); header('Content-Type: application/download'); header('Accept-Ranges: bytes'); header('Content-Disposition: attachment; filename="' . $fileNameToSave . '.eml"'); header('Content-Transfer-Encoding: binary'); } elseif (isset($_SESSION[ACCOUNT_ID], $_GET['tn'])) { $fs =& new FileSystem(INI_DIR . '/temp', $account->Email, $_SESSION[ACCOUNT_ID]); $folder =& new Folder($_SESSION[ACCOUNT_ID], -1, $_SESSION['attachtempdir']); $tempName = ConvertUtils::ClearFileName($_GET['tn']); $data = $fs->LoadBinaryAttach($folder, $tempName); if (isset($_GET['filename'])) { $filename = ConvertUtils::ClearFileName(urldecode($_GET['filename'])); $filename = $filename ? $filename : 'attachmentname'; // IE header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Type: application/octet-stream; charset=' . $account->GetUserCharset()); header('Content-Type: application/download'); header('Accept-Ranges: bytes'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Content-Transfer-Encoding: binary'); } else { header('Content-Type: ' . ConvertUtils::GetContentTypeFromFileName($tempName)); } } else { exit; } echo $data;
function ToHTML() { return ' <table id="iftare_table" width="100%"> <tr> <td> <iframe name="iframe_container" width="100%" frameborder="0" id="iframe_container"></iframe> </td> </tr> </table> <form name="messform" id="messform" action="base-iframe.php?mode=full" target="iframe_container" method="POST"> <input type="hidden" name="m_id" id="m_id" value="' . ConvertUtils::AttributeQuote(Post::val('m_id', '')) . '" /> <input type="hidden" name="m_uid" id="m_uid" value="' . ConvertUtils::AttributeQuote(Post::val('m_uid', '')) . '" /> <input type="hidden" name="f_id" id="f_id" value="' . ConvertUtils::AttributeQuote(Post::val('f_id', '')) . '" /> <input type="hidden" name="f_name" id="f_name" value="' . ConvertUtils::AttributeQuote(Post::val('f_name', '')) . '" /> <input type="hidden" name="charset" id="charset" value="' . ConvertUtils::AttributeQuote(Post::val('charset', '')) . '" /> <input type="hidden" name="plain" id="plain" value="' . ConvertUtils::AttributeQuote(Post::val('plain', '-1')) . '" /> <input type="hidden" name="mtype" id="mtype" value="msg" /> </form> '; }
/** * @param string $nputCharset */ function ReparseAllHeader($inputCharset) { for ($i = 0, $c = $this->Headers->Count(); $i < $c; $i++) { $header =& $this->Headers->Get($i); if (!ConvertUtils::IsLatin($header->Value)) { $header->Value = ConvertUtils::ConvertEncoding($header->Value, $inputCharset, $GLOBALS[MailOutputCharset]); $header->IsParsed = true; } } }
} else if (self.innerWidth) { w = self.innerWidth; } return w; } var infoCont = document.getElementById('info_cont'); if (infoCont) { infoCont.style.right = 'auto'; infoCont.style.left = Math.round((GetWidth() - infoCont.offsetWidth)/2) + 'px'; } </script> <script type="text/javascript" src="langs.js.php?v=<?php echo JS_VERS; ?> &lang=<?php echo ConvertUtils::AttributeQuote($account->DefaultLanguage); ?> "></script> <?php if (USE_JS_GZIP && IS_SUPPORT_GZIP) { ?> <script type="text/javascript" src="cache-loader.php?v=<?php echo JS_VERS; ?> &t=def"></script> <script type="text/javascript" src="cache-loader.php?v=<?php echo JS_VERS; ?> &t=wm"></script> <script type="text/javascript" src="cache-loader.php?v=<?php echo JS_VERS;
function GetFolderFullName($account) { return ConvertUtils::IsLatin($this->FullName) ? ConvertUtils::ConvertEncoding($this->FullName, CPAGE_UTF7_Imap, $account->GetUserCharset()) : ConvertUtils::ConvertEncoding($this->FullName, $account->DefaultIncCharset, $account->GetUserCharset()); }
function AddFromBodyStructure($attachname, $idx, $size, $encode, $contentId = null) { $attachname = ConvertUtils::EncodeHeaderString($attachname, $GLOBALS[MailInputCharset], 'utf-8'); $mimetype = ConvertUtils::GetContentTypeFromFileName($attachname); $mimePart = new MimePart(); $mimePart->BodyStructureIndex = $idx; $mimePart->BodyStructureSize = $size; $mimePart->BodyStructureEncode = $encode; $mimePart->Headers->SetHeaderByName(MIMEConst_ContentType, $mimetype . ';' . CRLF . "\t" . MIMEConst_NameLower . '="' . $attachname . '"', false); $mimePart->Headers->SetHeaderByName(MIMEConst_ContentTransferEncoding, MIMEConst_Base64Lower, false); $mimePart->Headers->SetHeaderByName(MIMEConst_ContentDisposition, MIMEConst_AttachmentLower . ';' . CRLF . "\t" . MIMEConst_FilenameLower . '="' . $attachname . '"', false); if (null !== $contentId) { $mimePart->Headers->SetHeaderByName(MIMEConst_ContentID, '<' . $contentId . '>', false); } $this->List->Add(new Attachment($mimePart, null !== $contentId)); return true; }
<tr> <td align="right"> </td> <td colspan="2"> <input type="checkbox" style="vertical-align: middle" name="intDirectModeIsDefault" onchange="change();" id="intDirectModeIsDefault" <?php echo (int) $settings->DirectModeIsDefault == 1 ? 'checked="checked"' : ''; ?> value="1" /> <label for="intDirectModeIsDefault">Direct mode is default</label> </td> </tr> <tr> <td align="right">Attachment size limit: </td> <td colspan="2"> <input type="text" class="wm_input" name="intAttachmentSizeLimit" id="intAttachmentSizeLimit" onchange="change();" style="width: 85px" value="<?php echo ConvertUtils::AttributeQuote($settings->AttachmentSizeLimit); ?> " maxlength="10"> bytes <input type="checkbox" style="vertical-align: middle" onchange="change();" onclick="DoIt();" name="intEnableAttachSizeLimit" id="intEnableAttachSizeLimit" value="1" <?php echo (int) $settings->EnableAttachmentSizeLimit == 0 ? '' : 'checked="checked"'; ?> /> <label for="intEnableAttachSizeLimit">Enable Attachment size limit</label> </td> </tr> <tr> <td align="right">Mailbox size limit: </td> <td colspan="2"> <input type="text" class="wm_input" name="intMailboxSizeLimit" id="intMailboxSizeLimit" onchange="change();" style="width: 85px" value="<?php echo (int) $settings->MailboxSizeLimit;
/** * @return string/bool */ function ValidateData() { if (empty($this->Name)) { return JS_LANG_WarningEmptyFolderName; } elseif (!ConvertUtils::CheckDefaultWordsFileName($this->Name) || Validate::HasSpecSymbols($this->Name)) { return WarningCorrectFolderName; } return true; }
function GetMessageNode(&$_xmlRes, &$_message, &$_folder, &$_processor, &$_account, &$_settings, $_mode, $_charsetNum, $_isFromSave) { $_safety = true; $_messageNode = new XmlDomNode('message'); $_msgId = $_message->IdMsg; $_msgUid = $_message->Uid; $_messageInfo = new CMessageInfo(); $_messageInfo->SetInfo($_msgId, $_msgUid, $_folder->IdDb, $_folder->FullName); $_messageClassType = $_message->TextBodies->ClassType(); $_messageNode->AppendAttribute('id', $_msgId); $_messageNode->AppendAttribute('size', $_message->GetMailSize()); $_messageNode->AppendAttribute('html', (int) (($_messageClassType & 2) == 2)); $_messageNode->AppendAttribute('plain', (int) (($_messageClassType & 1) == 1)); $_messageNode->AppendAttribute('priority', $_message->GetPriorityStatus()); $_messageNode->AppendAttribute('mode', $_mode); $_messageNode->AppendAttribute('charset', $_charsetNum); $_messageNode->AppendAttribute('has_charset', (int) $_message->HasCharset); $_messageNode->AppendAttribute('downloaded', (int) $_message->Downloaded); $_messageNode->AppendAttribute('sensivity', $_message->GetSensitivity()); $maf =& MessageActionFilters::CreateInstance(); $mafNoReply = $maf->GetNoReplyEmails(); $mafNoReplyAll = $maf->GetNoReplyAllEmails(); $mafNoForward = $maf->GetNoForwardEmails(); $fromEmail = $_message->GetFrom(); $fromEmail = $fromEmail->Email; $_textCharset = $_message->GetTextCharset(); $_rtl = 0; if (null !== $_textCharset) { switch (ConvertUtils::GetCodePageNumber($_textCharset)) { case 1255: case 1256: case 28596: case 28598: $_rtl = 1; break; } } $_messageNode->AppendAttribute('rtl', $_rtl); $_messageNode->AppendChild(new XmlDomNode('uid', $_msgUid, true)); $_folderNode = new XmlDomNode('folder', $_folder->FullName, true); $_folderNode->AppendAttribute('id', $_folder->IdDb); $_messageNode->AppendChild($_folderNode); $_signature_html = ''; $_signature_plain = ''; if ($_account->SignatureOptions == SIGNATURE_OPTION_AddToAll) { if ($_account->SignatureType == 1) { $_signature_html = '<br />' . $_account->Signature; require_once WM_ROOTPATH . 'libs/class_converthtml.php'; $_pars = new convertHtml($_account->Signature, false); $_signature_plain = CRLF . $_pars->get_text(); } else { $_signature_plain = CRLF . $_account->Signature; $_signature_html = '<br />' . nl2br($_account->Signature); } $_signature_plain = ConvertUtils::WMHtmlSpecialChars($_signature_plain); } $_accountOffset = $_settings->AllowUsersChangeTimeZone ? $_account->GetDefaultTimeOffset() : $_account->GetDefaultTimeOffset($_settings->DefaultTimeZone); if (($_mode & 1) == 1) { $_headersNode = new XmlDomNode('headers'); $_fromNode = new XmlDomNode('from'); $_id_addr = -1; $_from4search =& $_message->GetFrom(); if ($_from4search && USE_DB) { $_id_addr = $_processor->DbStorage->GetContactIdByEmail($_from4search->Email, $_account->IdUser); } if ($_id_addr > 0) { $_fromNode->AppendAttribute('contact_id', $_id_addr); $_bigContactNode = CXmlProcessing::GetContactNodeFromAddressBookRecord($_account, $_settings, $_id_addr); if (null != $_bigContactNode) { $_xmlRes->XmlRoot->AppendChild($_bigContactNode); } } $_fromNode->AppendChild(new XmlDomNode('short', WebMailMessage::ClearForSend(trim($_from4search->DisplayName)), true)); $_fromNode->AppendChild(new XmlDomNode('full', $_from4search->ToDecodedString(), true)); $_headersNode->AppendChild($_fromNode); $_headersNode->AppendChild(new XmlDomNode('to', $_message->GetToAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('cc', $_message->GetCcAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('bcc', $_message->GetBccAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('reply_to', $_message->GetReplyToAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('subject', $_message->GetSubject(true), true)); $_mailConfirmation = $_message->GetReadMailConfirmationAsString(); if (strlen($_mailConfirmation) > 0) { $_headersNode->AppendChild(new XmlDomNode('mailconfirmation', $_mailConfirmation, true)); } $_date =& $_message->GetDate(); $_date->FormatString = $_account->DefaultDateFormat; $_date->TimeFormat = $_account->DefaultTimeFormat; $_headersNode->AppendChild(new XmlDomNode('short_date', $_date->GetFormattedShortDate($_accountOffset), true)); $_headersNode->AppendChild(new XmlDomNode('full_date', $_date->GetFormattedFullDate($_accountOffset), true)); $_headersNode->AppendChild(new XmlDomNode('time', $_date->GetFormattedTime($_accountOffset), true)); $_messageNode->AppendChild($_headersNode); } $html_part = ''; if (($_mode & 2) == 2 && ($_messageClassType & 2) == 2) { $html_part = ConvertUtils::ReplaceJSMethod($_message->GetCensoredHtmlWithImageLinks(true, $_messageInfo)); if (($_account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $_account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) && !$_isFromSave) { $html_part = ConvertUtils::HtmlBodyWithoutImages($html_part); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $_safety = false; } } } $modified_plain_text = ''; if (($_mode & 4) == 4 || ($_mode & 2) == 2 && ($_messageClassType & 2) != 2) { $modified_plain_text = $_message->GetCensoredTextBody(true); } if (($_mode & 8) == 8) { if (($_account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $_account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) && !$_isFromSave) { $_messageNode->AppendChild(new XmlDomNode('reply_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::HtmlBodyWithoutImages(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo)))), true, true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $_safety = false; } } else { $_messageNode->AppendChild(new XmlDomNode('reply_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo))), true, true)); } } if (($_mode & 16) == 16) { $_messageNode->AppendChild(new XmlDomNode('reply_plain', ConvertUtils::AddToLinkMailToCheck($_signature_plain . $_message->GetRelpyAsPlain(true, $_accountOffset)), true, true)); } if (($_mode & 32) == 32) { if (($_account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $_account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) && !$_isFromSave) { $_messageNode->AppendChild(new XmlDomNode('forward_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::HtmlBodyWithoutImages(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo)))), true, true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $_safety = false; } } else { $_messageNode->AppendChild(new XmlDomNode('forward_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo))), true, true)); } } if (($_mode & 64) == 64) { $_messageNode->AppendChild(new XmlDomNode('forward_plain', ConvertUtils::AddToLinkMailToCheck($_signature_plain . $_message->GetRelpyAsPlain(true, $_accountOffset)), true, true)); } if (($_mode & 128) == 128) { $_messageNode->AppendChild(new XmlDomNode('full_headers', $_message->ClearForSend(ConvertUtils::ConvertEncoding($_message->OriginalHeaders, $GLOBALS[MailInputCharset], $_account->GetUserCharset())), true, true)); } $_messageNode->AppendAttribute('safety', (int) $_safety); $_msqAttachLine = 'msg_id=' . $_msgId . '&msg_uid=' . urlencode($_msgUid) . '&folder_id=' . $_folder->IdDb . '&folder_fname=' . urlencode($_folder->FullName); $addAttachArray = array(); if (($_mode & 256) == 256 || ($_mode & 8) == 8 || ($_mode & 16) == 16 || ($_mode & 32) == 32 || ($_mode & 64) == 64) { $_attachments =& $_message->Attachments; if ($_attachments && $_attachments->Count() > 0) { $tempFiles =& CTempFiles::CreateInstance($_account); $_attachmentsNode = new XmlDomNode('attachments'); $_attachmentsKeys = array_keys($_attachments->Instance()); foreach ($_attachmentsKeys as $_key) { $attachArray = array(); $_attachment =& $_attachments->Get($_key); $_tempname = $_message->IdMsg . '-' . $_key . '_' . ConvertUtils::ClearFileName($_attachment->GetTempName()); $_filename = ConvertUtils::ClearFileName(ConvertUtils::ClearUtf8($_attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $_account->GetUserCharset())); $_size = 0; $_isBodyStructureAttachment = false; if ($_attachment->MimePart && $_attachment->MimePart->BodyStructureIndex !== null && $_attachment->MimePart->BodyStructureSize !== null) { $_isBodyStructureAttachment = true; $_size = $_attachment->MimePart->BodyStructureSize; } else { $_size = $tempFiles->SaveFile($_tempname, $_attachment->GetBinaryBody()); $_size = $_size < 0 ? 0 : $_size; } $attachArray['name'] = $_filename; $attachArray['tempname'] = $_tempname; $attachArray['size'] = $_size; $_bodyStructureUrlAdd = ''; if ($_isBodyStructureAttachment) { $_bodyStructureUrlAdd = 'bsi=' . urlencode($_attachment->MimePart->BodyStructureIndex); if ($_attachment->MimePart->BodyStructureEncode !== null && strlen($_attachment->MimePart->BodyStructureEncode) > 0) { $_bodyStructureUrlAdd .= '&bse=' . urlencode(ConvertUtils::GetBodyStructureEncodeType($_attachment->MimePart->BodyStructureEncode)); } } $_attachNode = new XmlDomNode('attachment'); $_attachNode->AppendAttribute('size', $_size); $_attachNode->AppendAttribute('inline', $_attachment->IsInline ? '1' : '0'); $_attachNode->AppendChild(new XmlDomNode('filename', $_filename, true)); $viewUrl = substr(strtolower($_filename), -4) == '.eml' ? 'message-view.php?type=' . MESSAGE_VIEW_TYPE_ATTACH . '&tn=' . urlencode($_tempname) : 'view-image.php?img&tn=' . urlencode($_tempname) . '&filename=' . urlencode($_filename); if ($_isBodyStructureAttachment) { $viewUrl .= '&' . $_bodyStructureUrlAdd . '&' . $_msqAttachLine; } $_attachNode->AppendChild(new XmlDomNode('view', $viewUrl, true)); $linkUrl = 'attach.php?tn=' . urlencode($_tempname); if ($_isBodyStructureAttachment) { $linkUrl .= '&' . $_bodyStructureUrlAdd . '&' . $_msqAttachLine; } $downloadUrl = $linkUrl . '&filename=' . urlencode($_filename); $attachArray['download'] = $downloadUrl; $attachArray['link'] = $linkUrl; $_attachNode->AppendChild(new XmlDomNode('download', $downloadUrl, true)); $_attachNode->AppendChild(new XmlDomNode('tempname', $_tempname, true)); $mime_type = ConvertUtils::GetContentTypeFromFileName($_filename); $_attachNode->AppendChild(new XmlDomNode('mime_type', $mime_type, true)); $attachArray['mime_type'] = $mime_type; $attachArray['download'] = $downloadUrl; $addAttachArray[] = $attachArray; $_attachmentsNode->AppendChild($_attachNode); unset($_attachment, $_attachNode, $attachArray); } $_messageNode->AppendChild($_attachmentsNode); } } ChangeHtmlTextFromAttachment($html_part, $modified_plain_text, $addAttachArray); if (($_mode & 2) == 2 && ($_messageClassType & 2) == 2) { $_messageNode->AppendChild(new XmlDomNode('html_part', ConvertUtils::AddToLinkMailToCheck($html_part), true, true)); } if (($_mode & 4) == 4 || ($_mode & 2) == 2 && ($_messageClassType & 2) != 2) { $_messageNode->AppendChild(new XmlDomNode('modified_plain_text', ConvertUtils::AddToLinkMailToCheck($modified_plain_text), true, true)); } if (($_mode & 512) == 512) { $_messageNode->AppendChild(new XmlDomNode('unmodified_plain_text', $_message->GetNotCensoredTextBody(true), true, true)); } $_messageNode->AppendChild(new XmlDomNode('save_link', 'attach.php?' . $_msqAttachLine, true)); $_messageNode->AppendChild(new XmlDomNode('print_link', 'message-view.php?type=' . MESSAGE_VIEW_TYPE_PRINT . '&' . $_msqAttachLine . '&charset=' . $_charsetNum, true)); $_messageNode->AppendAttribute('no_reply', count($mafNoReply) > 0 && in_array($fromEmail, $mafNoReply) ? '1' : '0'); $_messageNode->AppendAttribute('no_reply_all', count($mafNoReplyAll) > 0 && in_array($fromEmail, $mafNoReplyAll) ? '1' : '0'); $_messageNode->AppendAttribute('no_forward', count($mafNoForward) > 0 && in_array($fromEmail, $mafNoForward) ? '1' : '0'); $_xmlRes->XmlRoot->AppendChild($_messageNode); }
$result['dairy'] = ConvertUtils::convertWorkDairy($fromWork, $toWork, $co_list, $uid); //기초 마스터 -> 덮어쓰는 것 가능 echo "--> convertGichoMaster<br>"; $result['gichom'] = ConvertUtils::convertGichoMaster($fromWork, $toWork, $co_list, $uid); //기초 디테일 -> 덮어쓰는 것 가능 echo "--> convertGichoDetail<br>"; $result['gichod'] = ConvertUtils::convertGichoDetail($fromWork, $toWork, $co_list, $uid); //전표 echo "--> convertJunpyo<br>"; $result['junpyo'] = ConvertUtils::convertJunpyo($fromWork, $toWork, $co_list, $uid); //수정 쿼리 echo "--> fixedJunpyo<br>"; $result['junpyofix'] = ConvertUtils::fixedJunpyo($toWork, $co_list, $uid); //아이디랑 회사 연결 echo "--> connectMyCom<br>"; $result['mycom'] = ConvertUtils::connectMyCom($toWork, $co_list, $uid); //1번만 // 시스템 계정 ->덮어쓰는 것 가능 //$result['gycode']=ConvertUtils::convertSystemGycode($fromWork,$toWork); /* echo "---> result <---"; foreach ($result as $key => $value) { echo "$key -> $value <br/>"; } */ echo "---> my company <---"; foreach ($co_list as $key => $value) { echo "{$value} 회사 등록 <br/>"; } $fromWork->destoryWork(); $toWork->destoryWork();
<td class="wm_print_content" style="border-width: 0px 0px 1px 1px"> <?php echo ConvertUtils::WMHtmlSpecialChars($message->PrintDate()); ?> </td> </tr> <tr> <td class="wm_print_content" style="border-width: 0px 1px 1px 0px" width="60px"> <?php echo JS_LANG_Subject; ?> : </td> <td class="wm_print_content" style="border-width: 0px 0px 1px 1px"> <?php echo ConvertUtils::WMHtmlSpecialChars($message->PrintSubject(true)); ?> </td> </tr> <tr> <td colspan="2" class="wm_print_content" style="border-width: 1px 0px 0px 0px"> <div class="wm_space_before"> <?php echo $fullBodyText; ?> </div> </td> </tr> </table> </div> </body>
/** * @param string $query * @return mixed */ function Execute($query) { $query = ConvertUtils::mainClear($query); if ($this->_log->Enabled) { $this->_log->WriteLine('MySQL Query: ' . $query); } if (is_resource($this->_conectionHandle)) { $this->_resultId = @mysql_query($query, $this->_conectionHandle); } else { $this->_log->WriteLine('MySQL Error: not connected', LOG_LEVEL_ERROR); } if ($this->_resultId) { return $this->_resultId; } else { $this->_setSqlError(); return false; } }
/** * @param string $name * @param bool $isCDATA optional * @return string */ function GetParamTagValueByName($name, $decode = false) { $keys = array_keys($this->XmlRoot->Children); foreach ($keys as $nodeKey) { if ($this->XmlRoot->Children[$nodeKey]->TagName == 'param' && isset($this->XmlRoot->Children[$nodeKey]->Attributes['name']) && $this->XmlRoot->Children[$nodeKey]->Attributes['name'] == $name) { return $decode ? $this->XmlRoot->Children[$nodeKey]->Value : ConvertUtils::WMBackHtmlSpecialChars($this->XmlRoot->Children[$nodeKey]->Value); } } return ''; }
/** * Gets the e-mail address details as a string. * @return string */ function ToDecodedString() { $result = ''; if ($this->Email != '') { $NewDisplayName = substr($this->DisplayName, 0, 2) != '=?' ? $this->DisplayName : ConvertUtils::DecodeHeaderString($this->DisplayName, $GLOBALS[MailInputCharset], $GLOBALS[MailOutputCharset]); $NewRemarks = substr($this->Remarks, 0, 2) != '=?' ? $this->Remarks : ConvertUtils::DecodeHeaderString($this->Remarks, $GLOBALS[MailInputCharset], $GLOBALS[MailOutputCharset]); if ($this->DisplayName != '' && $this->Remarks != '') { $result = sprintf('"%s" <%s> (%s)', $NewDisplayName, $this->Email, $NewRemarks); } elseif ($this->DisplayName != '') { $result = sprintf('"%s" <%s>', $NewDisplayName, $this->Email); } elseif ($this->Remarks != '') { $result = sprintf('%s (%s)', $this->Email, $NewRemarks); } else { $result = $this->Email; } } return $result; }
/** * @param string $email * @param string $login * @param int $startPage * @param string $password optional * @return bool */ function UserLoginByEmail($email, $login, $startPage = START_PAGE_IS_MAILBOX, $password = null, $toEmail = null, $separated = false) { $newAccount = new Account(); $settings =& Settings::CreateInstance(); if (!$settings || !$settings->isLoad) { $this->SetError(PROC_CANT_GET_SETTINGS); return false; } $url = 'webmail.php?check=1'; switch ($startPage) { default: $url .= '&start=' . START_PAGE_IS_MAILBOX; break; case START_PAGE_IS_NEW_MESSAGE: $url .= '&start=' . START_PAGE_IS_NEW_MESSAGE; if ($toEmail && strlen($toEmail) > 0) { $url .= '&to=' . $toEmail; } break; case START_PAGE_IS_MAILBOX: case START_PAGE_IS_SETTINGS: case START_PAGE_IS_CONTACTS: $url .= '&start=' . $startPage; break; case START_PAGE_IS_CALENDAR: if ($separated) { $url = 'calendar.php'; } else { $url .= '&start=' . $startPage; } break; } $loginArray =& Account::LoadFromDbByLogin($email, $login); if ($loginArray != null) { if ($loginArray[2] == '1') { if ($password === null) { $this->SetLoginInfo($loginArray[0], $loginArray[3], null, $separated); $this->ChangeLocation($url); return true; } else { if ($password == ConvertUtils::DecodePassword($loginArray[1], $newAccount)) { $this->SetLoginInfo($loginArray[0], $loginArray[3], null, $separated); $this->ChangeLocation($url); return true; } else { $account =& Account::LoadFromDb($loginArray[0]); $account->MailIncPassword = $password; $newprocessor = new MailProcessor($account); if ($newprocessor->MailStorage->Connect(true)) { if ($account->Update()) { $this->SetLoginInfo($account->Id, $account->IdUser, $account->DefaultLanguage, $separated); $this->ChangeLocation($url); return true; } else { $this->SetError(getGlobalError()); } } else { $this->SetError(PROC_WRONG_ACCT_PWD); } } } } else { $this->SetError(PROC_CANT_LOG_NONDEF); } } else { $this->SetError(ErrorPOP3IMAP4Auth); } return false; }
/** * @access private * @param string $mailRootpath * @return bool */ function _parse($mailRootpath) { $result = true; $wmtab = $mailRootpath . '/' . WEBMAILCONFIGTAB; $ctrtab = $mailRootpath . '/ctrlaccounts.tab'; if (@file_exists($wmtab)) { $file = @file($wmtab); if ($file && count($file) > 0) { foreach ($file as $fileLine) { $fileLine = trim($fileLine); if (strlen($fileLine) == 0 || $fileLine[0] == '#') { continue; } $array = explode("\t", trim($fileLine)); if (is_array($array) && count($array) > 1) { $name = trim($array[0], '"'); $value = trim($array[1], '"'); switch ($name) { case 'CtrlPort': $this->AdminPort = (int) $value; break; case 'SmtpPort': $this->OutPort = (int) $value; break; } } } } else { $result = false; setGlobalError('Empty file: ' . $wmtab); } } else { $result = false; setGlobalError('Can\'t find file: ' . $wmtab); } if ($result) { if (@file_exists($ctrtab)) { $file = @file($ctrtab); if ($file && count($file) > 0) { foreach ($file as $fileLine) { $fileLine = trim($fileLine); if (strlen($fileLine) == 0 || $fileLine[0] == '#') { continue; } $array = explode("\t", trim($fileLine)); if (is_array($array) && count($array) == 2) { $this->AdminLogin = trim($array[0], '"'); $this->AdminPassword = ConvertUtils::WmServerDeCrypt(trim($array[1], '"')); break; } } } else { $result = false; setGlobalError('Empty file: ' . $ctrtab); } } else { $result = false; setGlobalError('Can\'t find file: ' . $ctrtab); } } return $result; }
/** * @param bool $isClear optional * @return string */ function GetRelpyAsHtml($isClear = false) { $result = '<br /><blockquote style="border-left: solid 2px #000000; margin-left: 5px; padding-left: 5px">'; $result .= '---- Original Message ----<br />'; $result .= '<b>From</b>: ' . ConvertUtils::WMHtmlSpecialChars($this->GetFromAsString()) . '<br />'; $result .= '<b>To</b>: ' . ConvertUtils::WMHtmlSpecialChars($this->GetToAsString()) . '<br />'; $cc = ConvertUtils::WMHtmlSpecialChars($this->GetCcAsString()); if ($cc) { $result .= '<b>Cc</b>: ' . $cc . '<br />'; } $date =& $this->GetDate(); $result .= '<b>Sent</b>: ' . $date->GetAsStr() . '<br />'; $result .= '<b>Subject</b>: ' . ConvertUtils::WMHtmlSpecialChars($this->GetSubject()) . '<br /><br />'; if ($this->HasHtmlText()) { $result .= $this->GetCensoredHtmlWithImageLinks(true) . '</blockquote>'; } else { $result .= nl2br(ConvertUtils::WMHtmlSpecialChars($this->TextBodies->PlainTextBodyPart)) . '</blockquote>'; } return $isClear ? $this->ClearForSend($result) : $result; }
/** * @param int $size * @return string */ function Truncate($size) { if (!array_key_exists($this->TextCodePage, $this->_text)) { $this->GetText(); } if (strlen($this->_text[$this->TextCodePage]) <= $size) { return $this->TextCodePage == CPAGE_UTF8 ? ConvertUtils::ClearUtf8($this->_text[$this->TextCodePage]) : $this->_text[$this->TextCodePage]; } if ($this->TextCodePage == CPAGE_UTF8) { while (ord($this->_text[CPAGE_UTF8][$size]) >> 6 == 2) { $size--; } return ConvertUtils::ClearUtf8(substr($this->_text[CPAGE_UTF8], 0, $size)); } return substr($this->_text[$this->TextCodePage], 0, $size); }
/** * @param Account $account * @param XmlDocument $xmlObj * @return WebMailMessage */ function &CreateMessage(&$account, &$xmlObj) { global $log; $messageNode =& $xmlObj->XmlRoot->GetChildNodeByTagName('message'); $headersNode =& $messageNode->GetChildNodeByTagName('headers'); $message =& new WebMailMessage(); $GLOBALS[MailDefaultCharset] = $account->GetUserCharset(); $GLOBALS[MailInputCharset] = $account->GetUserCharset(); $GLOBALS[MailOutputCharset] = $account->GetDefaultOutCharset(); $message->Headers->SetHeaderByName(MIMEConst_MimeVersion, '1.0'); $message->Headers->SetHeaderByName(MIMEConst_XMailer, 'MailBee WebMail Pro PHP'); $message->Headers->SetHeaderByName(MIMEConst_XOriginatingIp, isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'); $message->IdMsg = $messageNode->GetAttribute('id', -1); $message->SetPriority($messageNode->GetAttribute('priority', 3)); $message->Uid = $messageNode->GetChildValueByTagName('uid'); $serverAddr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['SERVER_NAME'] : 'cantgetservername'; $message->Headers->SetHeaderByName(MIMEConst_MessageID, '<' . substr(session_id(), 0, 7) . '.' . md5(time()) . '@' . $serverAddr . '>'); $temp = $headersNode->GetChildValueByTagName('from'); if ($temp) { $message->SetFromAsString(ConvertUtils::WMBackHtmlSpecialChars($temp)); } $temp = $headersNode->GetChildValueByTagName('to'); if ($temp) { $message->SetToAsString(ConvertUtils::WMBackHtmlSpecialChars($temp)); } $temp = $headersNode->GetChildValueByTagName('cc'); if ($temp) { $message->SetCcAsString(ConvertUtils::WMBackHtmlSpecialChars($temp)); } $temp = $headersNode->GetChildValueByTagName('bcc'); if ($temp) { $message->SetBccAsString(ConvertUtils::WMBackHtmlSpecialChars($temp)); } $message->SetSubject(ConvertUtils::WMBackHtmlSpecialChars($headersNode->GetChildValueByTagName('subject'))); $message->SetDate(new CDateTime(time())); $bodyNode =& $messageNode->GetChildNodeByTagName('body'); if ($bodyNode->Attributes['is_html']) { $message->TextBodies->HtmlTextBodyPart = str_replace("\n", CRLF, str_replace("\r", '', ConvertUtils::WMBackHtmlNewCode($bodyNode->Value))); } else { $message->TextBodies->PlainTextBodyPart = str_replace("\n", CRLF, str_replace("\r", '', ConvertUtils::WMBackHtmlNewCode($bodyNode->Value))); } $attachmentsNode =& $messageNode->GetChildNodeByTagName('attachments'); if ($attachmentsNode != null) { $fs =& new FileSystem(INI_DIR . '/temp', $account->Email, $account->Id); $attfolder =& new Folder($_SESSION[ACCOUNT_ID], -1, $_SESSION['attachtempdir']); foreach (array_keys($attachmentsNode->Children) as $key) { $attachNode =& $attachmentsNode->Children[$key]; $attachCid = 'attach.php?tn=' . $attachNode->GetChildValueByTagName('temp_name'); $replaceCid = md5(time() . $attachNode->GetChildValueByTagName('name')); $mime_type = $attachNode->GetChildValueByTagName('mime_type'); if ($mime_type == '') { $mime_type = ConvertUtils::GetContentTypeFromFileName($attachNode->GetChildValueByTagName('name')); } if (!$message->Attachments->AddFromFile($fs->GetFolderFullPath($attfolder) . '/' . $attachNode->GetChildValueByTagName('temp_name'), $attachNode->GetChildValueByTagName('name'), $mime_type, (bool) $attachNode->Attributes['inline'])) { $log->WriteLine('Error Get tempfile for Attachment: ' . getGlobalError()); } if ($bodyNode->Attributes['is_html']) { if (strpos($message->TextBodies->HtmlTextBodyPart, $attachCid) !== false) { $attachment =& $message->Attachments->GetLast(); $attachment->MimePart->Headers->SetHeaderByName(MIMEConst_ContentID, '<' . $replaceCid . '>'); $message->TextBodies->HtmlTextBodyPart = str_replace($attachCid, 'cid:' . $replaceCid, $message->TextBodies->HtmlTextBodyPart); $attachname = ConvertUtils::EncodeHeaderString($attachNode->GetChildValueByTagName('name'), $account->GetUserCharset(), $GLOBALS[MailOutputCharset]); $attachment->MimePart->Headers->SetHeaderByName(MIMEConst_ContentDisposition, MIMEConst_InlineLower . ';' . CRLF . "\t" . MIMEConst_FilenameLower . '="' . $attachname . '"', false); } } } } return $message; }
/** * @param WebMailMessage $message * @param Folder $folder * @param bool $downloaded * @param Account $account * @return string */ function SaveMessageHeader(&$message, &$folder, $downloaded, &$account) { //save message header $sql = 'INSERT INTO %sawm_messages (id_msg, id_acct, id_folder_srv, id_folder_db, %s, from_msg, to_msg, cc_msg, bcc_msg, subject, msg_date, attachments, size, downloaded, x_spam, seen, flagged, deleted, replied, grayed, flags, priority, body_text) VALUES (%d, %d, %d, %d, %s, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %s)'; $date =& $message->GetDate(); $from =& new I18nString($message->GetFromAsString(), $account->DbCharset); $to =& new I18nString($message->GetToAsString(), $account->DbCharset); $cc =& new I18nString($message->GetCcAsString(), $account->DbCharset); $bcc =& new I18nString($message->GetBccAsString(), $account->DbCharset); $subject =& new I18nString($message->GetSubject(), $account->DbCharset); $uid = $account->MailProtocol == MAILPROTOCOL_IMAP4 ? (int) $message->Uid : $this->_escapeString($message->Uid); return sprintf($sql, $this->_settings->DbPrefix, $this->_getMsgIdUidFieldName(true, $account->MailProtocol), $message->IdMsg, $account->Id, $folder->IdDb, $folder->IdDb, $uid, $this->_escapeString($from->Truncate(255)), $this->_escapeString($to->Truncate(255)), $this->_escapeString($cc->Truncate(255)), $this->_escapeString($bcc->Truncate(255)), $this->_escapeString($subject->Truncate(255)), $this->_escapeString($date->ToANSI()), $this->Bool2Bool((int) $message->HasAttachments()), (int) $message->GetMailSize(), $this->Bool2Bool((int) $downloaded), $this->Bool2Bool((int) $message->GetXSpamStatus()), (int) (($message->Flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen), (int) (($message->Flags & MESSAGEFLAGS_Flagged) == MESSAGEFLAGS_Flagged), (int) (($message->Flags & MESSAGEFLAGS_Deleted) == MESSAGEFLAGS_Deleted), (int) (($message->Flags & MESSAGEFLAGS_Answered) == MESSAGEFLAGS_Answered), (int) (($message->Flags & MESSAGEFLAGS_Grayed) == MESSAGEFLAGS_Grayed), $message->Flags, $message->GetPriorityStatus(), $this->_escapeString(ConvertUtils::mainClear(substr($message->GetPlainLowerCaseBodyText(), 0, 500000)))); }
/** * @param Account $account * @param short $pop3InboxSyncType optional * @return bool */ function CreateAccount(&$account, $inboxSyncType = FOLDERSYNC_NewEntireMessages) { $account->IdUser = $this->Id; $result = false; setGlobalError(PROC_ERROR_ACCT_CREATE); $dbStorage =& DbStorageCreator::CreateDatabaseStorage($account); if ($dbStorage->Connect()) { $defaultAccount =& $dbStorage->SelectAccountDataByLogin($account->Email, $account->MailIncLogin, true); if ($account->DefaultAccount && $defaultAccount != null && $defaultAccount[2] == 1) { setGlobalError(ACCT_CANT_ADD_DEF_ACCT); return false; } $settings =& Settings::CreateInstance(); //Load or create folder tree here switch ($account->MailProtocol) { case MAILPROTOCOL_WMSERVER: if (!$settings->EnableWmServer) { setGlobalError(PROC_ERROR_ACCT_CREATE); return false; } $emailArray = ConvertUtils::ParseEmail($account->Email); if (!$emailArray) { setGlobalError(JS_LANG_WarningCorrectEmail); return false; } $WMConsole = new CWmServerConsole(); if (!$WMConsole->Connect()) { setGlobalError(PROC_ERROR_ACCT_CREATE . '<br />' . $WMConsole->GetError()); return false; } if ($settings->WmAllowManageXMailAccounts) { if ($WMConsole->DomainExist($emailArray[1])) { if (!$WMConsole->UserExist($emailArray[1], $account->MailIncLogin)) { if (!$WMConsole->AddUser($emailArray[1], EmailAddress::GetAccountNameFromEmail($account->MailIncLogin), $account->MailIncPassword)) { setGlobalError(PROC_ERROR_ACCT_CREATE . '<br />' . $WMConsole->GetError()); return false; } } if (!$WMConsole->ChangeUserMaxMailBoxSize($emailArray[1], EmailAddress::GetAccountNameFromEmail($account->MailIncLogin), $account->MailboxLimit)) { setGlobalError(PROC_ERROR_ACCT_CREATE . '<br />' . $WMConsole->GetError()); return false; } } else { setGlobalError(DomainDosntExist . '<br />' . $WMConsole->GetError()); return false; } } $result = $dbStorage->InsertAccountData($account); $folders =& new FolderCollection(); if ($result) { $inboxFolder =& new Folder($account->Id, -1, FOLDERNAME_Inbox, FOLDERNAME_Inbox); if ($settings->AllowDirectMode && $settings->DirectModeIsDefault) { $inboxSyncType = FOLDERSYNC_DirectMode; } $inboxFolder->SyncType = $inboxSyncType; $folders->Add($inboxFolder); $folders->Add(new Folder($account->Id, -1, FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync)); $folders->Add(new Folder($account->Id, -1, FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync)); $folders->Add(new Folder($account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync)); } break; case MAILPROTOCOL_POP3: $result = $dbStorage->InsertAccountData($account); $folders =& new FolderCollection(); if ($result) { $inboxFolder =& new Folder($account->Id, -1, FOLDERNAME_Inbox, FOLDERNAME_Inbox); if ($settings->AllowDirectMode && $settings->DirectModeIsDefault) { $inboxSyncType = FOLDERSYNC_DirectMode; } $inboxFolder->SyncType = $inboxSyncType; $folders->Add($inboxFolder); $folders->Add(new Folder($account->Id, -1, FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync)); $folders->Add(new Folder($account->Id, -1, FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync)); $folders->Add(new Folder($account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync)); } break; case MAILPROTOCOL_IMAP4: setGlobalError(ACCT_CANT_CREATE_IMAP_ACCT); $mailStorage =& new ImapStorage($account); if ($mailStorage->Connect()) { $result = $dbStorage->InsertAccountData($account); if (!$result) { return false; } $folders =& $mailStorage->GetFolders(); $folders->SetSyncTypeToAll($inboxSyncType); if ($folders && $settings->AllowDirectMode && $settings->DirectModeIsDefault) { $folders->SetSyncTypeToAll(FOLDERSYNC_DirectMode); } $result &= $account->Update(); $result &= $folders != null; $mailStorage->Disconnect(); if (!$result) { return false; } $hasSentItems = false; $hasDrafts = false; $hasTrash = false; $s = $d = $t = null; $s =& $folders->GetFolderByType(FOLDERTYPE_SentItems); $d =& $folders->GetFolderByType(FOLDERTYPE_Drafts); if (USEIMAPTRASH) { $t =& $folders->GetFolderByType(FOLDERTYPE_Trash); } /* for ($i = 0, $c = $folders->Count(); $i < $c; $i++) { $folder = &$folders->Get($i); if (strtolower($folder->FullName) == strtolower(FOLDERNAME_Inbox) && $folder->SubFolders != null) { for ($j = 0, $k = $folder->SubFolders->Count(); $j < $k; $j++) { $inboxFolder =& $folder->SubFolders->Get($j); switch(strtolower($inboxFolder->Name)) { case strtolower(FOLDERNAME_Sent): case strtolower(FOLDERNAME_SentItems): $hasSentItems = true; break; case strtolower(FOLDERNAME_Drafts): $hasDrafts = true; break; case strtolower(FOLDERNAME_Trash): $hasTrash = true; break; } } } switch(strtolower($folder->FullName)) { case strtolower(FOLDERNAME_Sent): case strtolower(FOLDERNAME_SentItems): $hasSentItems = true; break; case strtolower(FOLDERNAME_Drafts): $hasDrafts = true; break; case strtolower(FOLDERNAME_Trash): $hasTrash = true; break; } if ($hasSentItems && $hasDrafts) { if (USEIMAPTRASH) { if ($hasTrash) { break; } } else { break; } } } if (!$hasSentItems) { $sentFolder =& new Folder($account->Id, -1, FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync); $folders->Add($sentFolder); } if (!$hasDrafts) { $draftsFolder =& new Folder($account->Id, -1, FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync); $folders->Add($draftsFolder); } if (USEIMAPTRASH && !$hasTrash) { $draftsFolder =& new Folder($account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync); $folders->Add($draftsFolder); }*/ if ($s === null) { $sentFolder =& new Folder($account->Id, -1, FOLDERNAME_SentItems, FOLDERNAME_SentItems, FOLDERSYNC_DontSync); $folders->Add($sentFolder); } if ($d === null) { $draftsFolder =& new Folder($account->Id, -1, FOLDERNAME_Drafts, FOLDERNAME_Drafts, FOLDERSYNC_DontSync); $folders->Add($draftsFolder); } if (USEIMAPTRASH && $t === null) { $trashFolder =& new Folder($account->Id, -1, FOLDERNAME_Trash, FOLDERNAME_Trash, FOLDERSYNC_DontSync); $folders->Add($trashFolder); } } else { return false; } break; default: return false; } if ($result) { $folders = $folders->SortRootTree(); $result &= $dbStorage->CreateFolders($folders); } } if ($result) { setGlobalError(''); } return $result; }
function ToHTML() { $swicther = $this->_proc->account->AllowDhtmlEditor ? ' <tr> <td></td> <td class="wm_html_editor_switcher"> <a href="#" id="mode_switcher">' . JS_LANG_SwitchToPlainMode . '</a> </td> </tr>' : ''; $senders = !$this->isSafety ? '<table class="wm_view_message" id="showpicturestable"> <tr> <td class="wm_safety_info"> <span class=""> <span>' . PicturesBlocked . ' </span> <a href="#" onclick="ShowPictures()">' . ShowPictures . '</a>.</span> </span> </td> </tr> </table>' : ''; $ahref = array('', '', ''); $aend = ''; if ($this->_proc->settings->AllowContacts) { $ahref[0] = '<a href="#" onclick="PopupContacts(\'contactlist.php?f=1\');">'; $ahref[1] = '<a href="#" onclick="PopupContacts(\'contactlist.php?f=2\');">'; $ahref[2] = '<a href="#" onclick="PopupContacts(\'contactlist.php?f=3\');">'; $aend = '</a>'; } return $senders . ' <form action="" method="POST" id="messageForm"> <table class="wm_new_message"> <tr> <td class="wm_new_message_title">' . JS_LANG_From . ': </td> <td> <input class="wm_input" tabindex="1" type="text" size="93" name="from" value="' . ConvertUtils::AttributeQuote($this->From) . '" /> <input type="hidden" name="priority_input" id="priority_input" value="" /> <input type="hidden" name="ishtml" id="ishtml" value=""> ' . $this->inputs . ' </td> </tr> <tr> <td class="wm_new_message_title">' . $ahref[0] . JS_LANG_To . $aend . ': </td> <td> <input class="wm_input" autocomplete="on" tabindex="2" type="text" size="93" id="toemail" name="toemail" value="' . ConvertUtils::AttributeQuote($this->To) . '" /> </td> </tr> <tr> <td class="wm_new_message_title">' . $ahref[1] . JS_LANG_CC . $aend . ': </td> <td><nobr> <input class="wm_input" tabindex="3" type="text" size="93" id="toCC" name="toCC" value="' . ConvertUtils::AttributeQuote($this->CC) . '" /><span> </span> <a href="#" onClick="ChangeBCCMode(); return false;" id="bcc_mode_switcher">' . JS_LANG_ShowBCC . '</a><nobr> </td> </tr> <tr class="wm_hide" id="bcc"> <td class="wm_new_message_title">' . $ahref[2] . JS_LANG_BCC . $aend . ': </td> <td> <input class="wm_input" tabindex="4" type="text" size="93" name="toBCC" id="toBCC" value="" /> </td> </tr> <tr> <td class="wm_new_message_title">' . JS_LANG_Subject . ': </td> <td> <input class="wm_input" tabindex="5" type="text" size="93" name="subject" id="subject" value="' . ConvertUtils::AttributeQuote($this->Subject) . '" /> </td> </tr> <tr id="plain_mess"> <td colspan="2"> <div id="editor_cont" class="wm_input" style="width: 684px; height: 330px;"> <textarea id="editor_area" style="width: 680px; height: 328px; border: 0px; border-left: solid 1px white;" name="message">' . $this->Body . '</textarea> </div> </td> </tr> ' . $swicther . ' </table> <table class="wm_new_message" id="attachmentTable"> ' . $this->attacmentsHtml . ' </table> </form> <table class="wm_new_message"> <tr> <td colspan="2" class="wm_attach"> <iframe class="wm_hide" src="" id="uploadIframe" name="uploadIframe"></iframe> <form action="upload.php" target="uploadIframe" method="POST" enctype="multipart/form-data"> ' . JS_LANG_AttachFile . ': <input class="wm_file" type="file" name="fileupload" /> <input class="wm_button" type="submit" name="attachbtn" value="' . ConvertUtils::AttributeQuote(JS_LANG_Attach) . '" /> </form> </td> </tr> </table> '; }
function __fputs($sLine) { $sLine .= "\r\n"; $this->WriteLog('> ' . ConvertUtils::ShowCRLF($sLine)); return fputs($this->fp, $sLine); }