Ejemplo n.º 1
0
$mail_id = CValue::get("mail_id");
$part = CValue::get("part");
$log_pop = new CSourcePOP();
$log_pop->name = "user-pop-" . $user->_id;
$log_pop->loadMatchingObject();
if (!$log_pop) {
    CAppUI::stepAjax("Source POP indisponible", UI_MSG_ERROR);
}
if (!$mail_id) {
    CAppUI::stepAjax("CSourcePOP-error-mail_id", UI_MSG_ERROR);
}
$mail = new CUserMail();
$mail->load($mail_id);
if ($mail->_id) {
    $pop = new CPop($log_pop);
    $pop->open();
    $attach = new CMailAttachments();
    $struct = $pop->structure($mail->uid);
    $parts = explode(".", $part);
    //recursive parts
    foreach ($parts as $key => $value) {
        $struct = $struct->parts[$value];
    }
    $attach->loadFromHeader($struct);
    $attach->part = $part;
    $attach->loadContentFromPop($pop->openPart($mail->uid, $attach->getpartDL()));
    $smarty = new CSmartyDP();
    $smarty->assign("_attachment", $attach);
    $smarty->display("inc_show_attachments.tpl");
    $pop->close();
}
Ejemplo n.º 2
0
            } else {
                CAppUI::stepAjax("CMailAttachments-msg-attachmentLinked-success", UI_MSG_OK);
            }
        }
    } else {
        // pop
        $account = new CSourcePOP();
        $account->load($mail->account_id);
        $pop = new CPop($account);
        $pop->open();
        $file = new CFile();
        $file->setObject($object);
        $file->author_id = CAppUI::$user->_id;
        $pop = new CPop($account);
        $pop->open();
        $file_pop = $pop->decodeMail($attachment->encoding, $pop->openPart($mail->uid, $attachment->getpartDL()));
        $pop->close();
        $file->file_name = $attachment->name;
        $file->file_type = $attachment->getType($attachment->type, $attachment->subtype);
        $file->fillFields();
        $file->putContent($file_pop);
        if ($str = $file->store()) {
            CAppUI::stepAjax($str, UI_MSG_ERROR);
        } else {
            $attachment->file_id = $file->_id;
            $attachment->store();
        }
    }
}
//text link
if ($text_html || $text_plain) {