Esempio n. 1
0
/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage messagerie
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$account_id = CValue::get('account_id');
$mail_id = Cvalue::get('mail_id');
$reply_to_id = CValue::get('reply_to_id');
$answer_to_all = CValue::get('answer_to_all');
$account = new CSourcePOP();
$account->load($account_id);
$smtp = CExchangeSource::get("mediuser-{$account->object_id}", 'smtp');
if (!$smtp->_id) {
    $smarty = new CSmartyDP();
    $smarty->assign('msg', CAppUI::tr('CUserMail-msg-no_smtp_source_linked_to_pop_account'));
    $smarty->assign('type', 'error');
    $smarty->assign('modal', 1);
    $smarty->assign('close_modal', 1);
    $smarty->display('inc_display_msg.tpl');
    CApp::rip();
}
$mail = new CUserMail();
if ($mail_id) {
    $mail->load($mail_id);
    if ($mail->text_html_id) {
        $mail->loadContentHTML();
Esempio n. 2
0
 * @subpackage messagerie
 * @version    $Revision$
 * @author     SARL OpenXtrem
 */
CCanDo::checkRead();
$account_id = CValue::get("account_id");
//user connected
$user = CMediusers::get();
//filters
$mode = CValue::get("mode", "inbox");
//others
$page = CValue::get("page", 0);
$limit_list = CAppUI::pref("nbMailList", 20);
//account POP
$account_pop = new CSourcePOP();
$account_pop->load($account_id);
if ($account_pop->object_id != $user->_id && $account_pop->is_private) {
    CAppUI::stepAjax("CSourcePOP-error-private_account", UI_MSG_ERROR);
}
//no account_id, first of account of user
$where = array();
$where["object_class"] = " = 'CMediusers'";
$where["object_id"] = " = '{$user->_id}'";
$account_pop->loadObject($where);
$where = array();
//mails
$mail = new CUserMail();
switch ($mode) {
    case 'inbox':
        $nb_mails = CUserMail::countInbox($account_id);
        $mails = CUserMail::loadInbox($account_id, $page, $limit_list);
Esempio n. 3
0
 * @category Messagerie
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$mail_id = CValue::get("id");
//usermail
$mail = new CUserMail();
$mail->load($mail_id);
$mail->loadAttachments();
//client POP
$clientPOP = new CSourcePOP();
$clientPOP->load($mail->account_id);
$pop = new CPop($clientPOP);
if (!$pop->open()) {
    return;
}
//overview
$overview = $pop->header($mail->uid);
$msgno = $overview->msgno;
$infos = $pop->infos($msgno);
//structure
$structure = $pop->structure($mail->uid);
//content
$content = $pop->getFullBody($mail->uid);
//attachments
$attachments = array();
$_attachments = $pop->getListAttachments($mail->uid);
 */
CCanDo::checkRead();
$user = CMediusers::get();
$mail_id = CValue::get("mail_id");
//pop init
//mail
$mail = new CUserMail();
$mail->load($mail_id);
$mail->loadRefsFwd();
$mail->checkHprim();
//HprimMedecin
$mail->checkApicrypt();
//HprimMedecin
//pop account
$log_pop = new CSourcePOP();
$log_pop->load($mail->account_id);
//if not read email, send the seen flag to server
if (!$mail->date_read && !CAppUI::pref("markMailOnServerAsRead")) {
    $pop = new CPop($log_pop);
    $pop->open();
    $pop->setflag($mail->uid, "\\Seen");
    $pop->close();
}
$mail->date_read = CMbDT::dateTime();
$mail->store();
//get the CFile attachments
$nbAttachPicked = 0;
$nbAttach = count($mail->_attachments);
foreach ($mail->_attachments as $_att) {
    $_att->loadRefsFwd();
    if ($_att->_file->_id) {
 if ($attachment->_file->_id) {
     $attachment->_file->setObject($object);
     if ($msg = $attachment->_file->store()) {
         CAppUI::setMsg($msg, UI_MSG_ERROR);
     } else {
         $attachment->file_id = $attachment->_file->_id;
         if ($msg = $attachment->store()) {
             CAppUI::setMsg($msg, UI_MSG_ERROR);
         } 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);