function moveImapMessage($id, $target_folders_id) { $message = toC_Email_Accounts_Admin::getCachedMessage($id); $src_folder = toC_Email_Accounts_Admin::getFolderData($message['folders_id']); $target_folder = toC_Email_Accounts_Admin::getFolderData($target_folders_id); if ($this->connectMailServer($src_folder['folders_name'])) { if ($this->_inbox->move(imap::utf7_imap_encode($target_folder['folders_name']), array($message['uid']))) { $this->closeMailServer(); return $this->moveCachedMessage($id, $target_folders_id); } } $this->closeMailServer(); return false; }
function getMailBoxNodes($accounts_id, $folders_id) { $folders = toC_Email_Accounts_Admin::getSubscribedFolders($accounts_id, $folders_id); $nodes = array(); foreach ($folders as $folder) { $children = toC_Email_Accounts_Admin::getMailBoxNodes($accounts_id, $folder['folders_id']); $pos = strrpos($folder['folders_name'], $folder['delimiter']); if ($pos > 0 && $folder['delimiter'] != '') { $folders_name = substr($folder['folders_name'], $pos + 1); } else { $folders_name = $folder['folders_name']; } switch ($folder['folders_flag']) { case EMAIL_FOLDER_INBOX: $iconCls = 'icon-folder-inbox-record'; break; case EMAIL_FOLDER_SENTBOX: $iconCls = 'icon-folder-sent-record'; break; case EMAIL_FOLDER_DRAFT: $iconCls = 'icon-folder-drafts-record'; break; case EMAIL_FOLDER_TRASH: $iconCls = 'icon-folder-trash-record'; break; case EMAIL_FOLDER_SPAM: $iconCls = 'icon-folder-spam-record '; break; default: $iconCls = 'icon-folder-default-record '; } $unseen = toC_Email_Accounts_Admin::getNewMessagesAmount($accounts_id, $folder['folders_id']); if ($unseen > 0) { $text = '<b>' . $folders_name . ' (' . $unseen . ')' . '</b>'; } else { $text = $folders_name; } $node = array('id' => $accounts_id . '_' . $folder['folders_id'], 'text' => $text, 'name' => $folders_name, 'iconCls' => $iconCls, 'parent_id' => $folder['parent_id'], 'type' => 'folder'); if (sizeof($children) > 0) { $node['expanded'] = true; $node['children'] = $children; } else { $node['leaf'] = true; } $nodes[] = $node; } return $nodes; }
function printMessage() { global $osC_Language; $accounts_id = $_REQUEST['accounts_id']; $id = $_REQUEST['id']; $fetch_time = $_REQUEST['fetch_time']; $number = $_REQUEST['number']; $account = toC_Email_Accounts_Admin::getData($accounts_id); $file = DIR_FS_CACHE_ADMIN . 'emails/' . md5($accounts_id . $account['accounts_email']) . '/messages' . '/' . md5($id . $fetch_time) . '.php'; if (file_exists($file)) { require $file; $output = '<table>'; if ($cacheFile) { $output .= '<tr><td><b>' . $osC_Language->get('field_from') . '</b></td><td>' . $cacheFile['from'] . htmlspecialchars(' <') . $cacheFile['sender'] . htmlspecialchars('>') . '</td></tr>'; $output .= '<tr><td><b>' . $osC_Language->get('field_Subject') . '</b></td><td>' . $cacheFile['subject'] . '</td></tr>'; if (sizeof($cacheFile['to']) > 0) { $output .= '<tr><td><b>' . $osC_Language->get('field_to') . '</b></td><td>'; $to = array(); for ($i = 0; $i < sizeof($cacheFile['to']); $i++) { $to[] = $cacheFile['to'][$i]['name'] . htmlspecialchars(' <') . $cacheFile['to'][$i]['email'] . htmlspecialchars('>'); } $output .= implode(' ;', $to) . '</td></tr>'; } if (sizeof($cacheFile['cc']) > 0) { $output .= '<tr><td><b>' . $osC_Language->get('field_message_cc') . '</b></td><td>'; $cc = array(); for ($i = 0; $i < sizeof($cacheFile['cc']); $i++) { $cc[] = $cacheFile['cc'][$i]['name'] . htmlspecialchars(' <') . $cacheFile['cc'][$i]['email'] . htmlspecialchars('>'); } $output .= implode(' ;', $cc) . '</td></tr>'; } if (sizeof($cacheFile['bcc']) > 0) { $output .= '<tr><td><b>' . $osC_Language->get('field_message_bcc') . '</b></td><td>' . ':'; $bcc = array(); for ($i = 0; $i < sizeof($cacheFile['bcc']); $i++) { $bcc[] = $cacheFile['bcc'][$i]['name'] . htmlspecialchars('<') . $cacheFile['bcc'][$i]['email'] . htmlspecialchars('>'); } $output .= implode(' ;', $bcc) . '</td></tr>'; } $output .= '<tr><td><b>' . $osC_Language->get('field_date_received') . '</b></td><td>' . $cacheFile['date'] . '</td></tr>'; if (is_array($cacheFile['attachments']) && sizeof($cacheFile['attachments']) > 0) { $output .= '<tr><td><b>' . $osC_Language->get('field_attachments') . '</b></td><td>'; $attachments = array(); foreach ($cacheFile['attachments'] as $attachment) { $attachments[] = $attachment['name']; } $output .= implode(' ;', $attachments) . '</td></tr>'; } $output .= '</table>'; $output .= '<p>' . $cacheFile['body'] . '</p>'; } } echo $output; }