/**
  * @see parent::doStore()
  */
 function doStore()
 {
     if (isset($_FILES['attachment'])) {
         $mail_id = CValue::post('mail_id');
         $mail = new CUserMail();
         $mail->load($mail_id);
         $files = array();
         foreach ($_FILES['attachment']['error'] as $key => $file_error) {
             if (isset($_FILES['attachment']['name'][$key])) {
                 $files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
             }
         }
         foreach ($files as $_key => $_file) {
             if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
                 continue;
             }
             if ($_file['error'] != 0) {
                 CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
                 continue;
             }
             $attachment = new CMailAttachments();
             $attachment->name = $_file['name'];
             $content_type = mime_content_type($_file['tmp_name']);
             $attachment->type = $attachment->getTypeInt($content_type);
             $attachment->bytes = $_file['size'];
             $attachment->mail_id = $mail_id;
             $content_type = explode('/', $content_type);
             $attachment->subtype = strtoupper($content_type[1]);
             $attachment->disposition = 'ATTACHMENT';
             $attachment->extension = substr(strrchr($attachment->name, '.'), 1);
             $attachment->part = $mail->countBackRefs('mail_attachments') + 1;
             $attachment->store();
             $file = new CFile();
             $file->setObject($attachment);
             $file->author_id = CAppUI::$user->_id;
             $file->file_name = $attachment->name;
             $file->file_date = CMbDT::dateTime();
             $file->fillFields();
             $file->updateFormFields();
             $file->doc_size = $attachment->bytes;
             $file->file_type = mime_content_type($_file['tmp_name']);
             $file->moveFile($_file, true);
             if ($msg = $file->store()) {
                 CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
                 CApp::rip();
             }
             $attachment->file_id = $file->_id;
             if ($msg = $attachment->store()) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 CApp::rip();
             }
         }
         CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
     } else {
         parent::doStore();
     }
 }
Ejemplo n.º 2
0
/** $Id$ **/
/**
 * @package    Mediboard
 * @subpackage messagerie
 * @version    $Revision$
 * @author     SARL OpenXtrem
 */
CCanDo::checkRead();
$mail_id = CValue::get("mail_id", 0);
$pat_id = CValue::get("pat_id");
//apicrypt & search
$patient = new CPatient();
$dossier = new CSejour();
//looking for apicrypt => patient
$mail = new CUserMail();
$mail->load($mail_id);
$mail->loadContentPlain();
$mail->checkHprim();
$mail->checkApicrypt();
//apicrypt case
if ($mail->_is_apicrypt || $mail->_is_hprim) {
    $lines = explode("\n", $mail->_text_plain->content);
    $fl = $lines[0] != "[apicrypt]" ? 0 : 1;
    //first line
    //cleanup line 1 to 13
    for ($a = $fl; $a < $fl + 12; $a++) {
        $lines[$a] = trim($lines[$a]);
    }
    //init
    $ipp = $lines[$fl];
Ejemplo n.º 3
0
        break;
    case 'archived':
        $nb_mails = CUserMail::countArchived($account_id);
        $mails = CUserMail::loadArchived($account_id, $page, $limit_list);
        break;
    case 'favorites':
        $nb_mails = CUserMail::countFavorites($account_id);
        $mails = CUserMail::loadFavorites($account_id, $page, $limit_list);
        break;
    case 'sentbox':
        $nb_mails = CUserMail::countSent($account_id);
        $mails = CUserMail::loadSent($account_id, $page, $limit_list);
        break;
    case 'drafts':
        $nb_mails = CUserMail::countDrafted($account_id);
        $mails = CUserMail::loadDrafted($account_id, $page, $limit_list);
        break;
}
/** @var $mails CUserMail[] */
foreach ($mails as $_mail) {
    $_mail->loadReadableHeader();
    $_mail->loadRefsFwd();
    $_mail->checkApicrypt();
}
//smarty
$smarty = new CSmartyDP();
$smarty->assign("mails", $mails);
$smarty->assign("page", $page);
$smarty->assign("nb_mails", $nb_mails);
$smarty->assign("account_id", $account_id);
$smarty->assign("user", $user);
Ejemplo n.º 4
0
<?php

/** $Id$ **/
/**
 * @package    Mediboard
 * @subpackage messagerie
 * @version    $Revision$
 * @author     SARL OpenXtrem
 */
// Open a contentHTML from an email_id
CCanDo::checkRead();
$mail_id = CValue::get("mail_id");
$mail = new CUserMail();
$mail->load($mail_id);
if ($mail->_id) {
    $mail->loadRefsFwd();
    $mail->checkInlineAttachments();
    //inline attachment
}
if (strpos($mail->_text_html->content, '<') === false) {
    echo nl2br($mail->_text_html->content);
} else {
    echo $mail->_text_html->content;
}
Ejemplo n.º 5
0
<?php

/** $Id$ **/
/**
 * @package Mediboard
 * @subpackage messagerie
 * @version $Revision$
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
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();
Ejemplo n.º 6
0
 /**
  * Load the drafted mails for an account
  *
  * @param int $account_id The account id
  * @param int $start      The start
  * @param int $limit      The number of mails to load
  *
  * @return CUserMail[]
  */
 public static function loadDrafted($account_id, $start, $limit)
 {
     $where['account_id'] = "= '{$account_id}'";
     $where['account_class'] = "= 'CSourcePOP'";
     $where['draft'] = "= '1' ";
     $order = "date_inbox DESC";
     $limit = "{$start}, {$limit}";
     $mail = new CUserMail();
     return $mail->loadList($where, $order, $limit);
 }
Ejemplo n.º 7
0
    $mail->load($mail_id);
    if ($mail->text_html_id) {
        $mail->loadContentHTML();
        $mail->_content = $mail->_text_html->content;
    } elseif ($mail->text_plain_id) {
        $mail->loadContentPlain();
        $mail->_content = $mail->_text_plain->content;
    }
} else {
    $mail->from = $account->user;
    $mail->account_class = $account->_class;
    $mail->account_id = $account->_id;
    $mail->draft = '1';
    if ($reply_to_id) {
        $mail->in_reply_to_id = $reply_to_id;
        $reply_to = new CUserMail();
        $reply_to->load($reply_to_id);
        $mail->to = $reply_to->from;
        strpos($reply_to->subject, 'Re:') === false ? $mail->subject = "Re: {$reply_to->subject}" : ($mail->subject = $reply_to->subject);
        if ($answer_to_all) {
            $mail->cc = $reply_to->cc;
        }
    }
    $mail->store();
}
$mail->loadAttachments();
foreach ($mail->_attachments as $_attachment) {
    $_attachment->loadFiles();
}
// Initialisation de CKEditor
$templateManager = new CTemplateManager();
Ejemplo n.º 8
0
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
CCanDo::checkRead();
$user = CMediusers::get();
$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();
Ejemplo n.º 9
0
/**
 * $Id$
 *  
 * @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::checkRead();
$user_connected = CMediusers::get();
$account_id = CValue::get("account_id");
$selected_folder = CValue::get('selected_folder', 'inbox');
$account = new CSourcePOP();
$account->load($account_id);
if ($account_id) {
    CValue::setSession("account_id", $account_id);
}
//user is atempting to see an account private from another medisuers
if ($account->object_id != $user_connected->_id && $account->is_private) {
    CAppUI::stepAjax("CSourcePOP-error-private_account", UI_MSG_ERROR);
}
$folders = array('inbox' => CUserMail::countUnread($account_id), 'archived' => CUserMail::countArchived($account_id), 'favorites' => CUserMail::countFavorites($account_id), 'sentbox' => CUserMail::countSent($account_id), 'drafts' => CUserMail::countDrafted($account_id));
//smarty
$smarty = new CSmartyDP();
$smarty->assign("account", $account);
$smarty->assign('folders', $folders);
$smarty->assign('selected_folder', $selected_folder);
$smarty->display("vw_account_mail.tpl");
Ejemplo n.º 10
0
 function createUserMail($user_id, $object = null, $apicrypt = false)
 {
     if (CModule::getActive('messagerie')) {
         $mail = new CUserMail();
         $mail->account_id = $this->_id;
         $mail->account_class = $this->_class;
         $mail->sent = 1;
         $mail->subject = $this->_mail->Subject;
         $mail->from = $this->_mail->From;
         $mail->to = $this->_to['address'];
         $mail->date_inbox = CMbDT::dateTime();
         if ($this->_mail->ContentType == 'text/html') {
             $mail->_text_html = $this->_mail->Body;
             if ($apicrypt) {
                 $mail->_is_apicrypt = 'html';
             }
             $mail->getHtmlText($user_id);
         } else {
             $mail->_text_plain = $this->_mail->Body;
             if ($apicrypt) {
                 $mail->_is_apicrypt = 'plain';
             }
             $mail->getPlainText($user_id);
         }
         $mail->store();
         if ($object) {
             $file = null;
             switch ($object->_class) {
                 case "CCompteRendu":
                     $file = $object->_ref_file;
                     break;
                 case "CFile":
                     $file = $object;
                     break;
             }
             if ($file && $file->_id) {
                 $attachment = new CMailAttachments();
                 $attachment->mail_id = $mail->_id;
                 list($type, $subtype) = explode('/', $file->file_type);
                 $attachment->type = $attachment->getTypeInt($type);
                 $attachment->part = 1;
                 $attachment->subtype = $subtype;
                 $attachment->bytes = $file->doc_size;
                 list($file_name, $extension) = explode('.', $file->file_name);
                 $attachment->name = $file_name;
                 $attachment->extension = $extension;
                 $attachment->file_id = $file->_id;
                 $attachment->store();
             }
         }
     }
 }
Ejemplo n.º 11
0
 */
CCanDo::checkRead();
$user = CMediusers::get();
$object_id = CValue::get("object_id");
$object_class = CValue::get("object_class");
$attach_list = CValue::get("attach_list");
$text_plain = CValue::get("text_plain_id");
$text_html = CValue::get("text_html_id");
$rename_text = CValue::get("rename_text");
$category_id = CValue::get("category_id");
$mail_id = CValue::get("mail_id");
//load object
/** @var CMbObject $object */
$object = new $object_class();
$object->load($object_id);
$mail = new CUserMail();
$mail->load($mail_id);
if (!$object->_id) {
    CAppUI::stepAjax("CUserMail-link-objectNull", UI_MSG_ERROR);
}
if (str_replace("-", "", $attach_list) == "" && !$text_plain && !$text_html) {
    CAppUI::stepAjax("CMailAttachments-msg-no_object_to_attach", UI_MSG_ERROR);
}
$attachments = trim($attach_list) ? explode("-", $attach_list) : array();
foreach ($attachments as $_attachment) {
    //no attachment value
    if (!$_attachment) {
        continue;
    }
    $attachment = new CMailAttachments();
    if ($_attachment != "") {
Ejemplo n.º 12
0
 * @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
 */
CCanDo::checkRead();
$usermail_ids = json_decode(stripslashes(CValue::get('usermail_ids', '[]')));
$action = CValue::get('action');
if (empty($usermail_ids)) {
    CAppUI::stepAjax('CUserMail-msg-no_mail_selected', UI_MSG_WARNING);
    CApp::rip();
}
foreach ($usermail_ids as $usermail_id) {
    $mail = new CUserMail();
    $mail->load($usermail_id);
    switch ($action) {
        case 'unarchive':
            $mail->archived = 0;
            if (!$mail->date_read) {
                $mail->date_read = CMbDT::dateTime();
            }
            break;
        case 'archive':
            $mail->archived = 1;
            if (!$mail->date_read) {
                $mail->date_read = CMbDT::dateTime();
            }
            break;
        case 'unfavour':
Ejemplo n.º 13
0
<?php

/**
 * Toggle favorite 1 or 0 for a specificated email
 *
 * @category Messagerie
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$mail_id = CValue::get("mail_id");
$mail = new CUserMail();
$mail->load($mail_id);
if (!$mail->_id) {
    CAppUI::stepAjax("CUserMail-mail-notfound-number%d", UI_MSG_ERROR, $mail->_id);
}
$arch = $mail->archived = $mail->archived ? 0 : 1;
if (!$mail->date_read) {
    $mail->date_read = CMbDT::dateTime();
}
if ($msg = $mail->store()) {
    CAppUI::stepAjax($msg, UI_MSG_ERROR);
} else {
    CAppUI::stepAjax("CUserMail-toggle-archive-{$arch}", UI_MSG_OK);
}
Ejemplo n.º 14
0
<?php

/** $Id$ **/
/**
 * @package Mediboard
 * @subpackage messagerie
 * @version $Revision$
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
CCanDo::checkRead();
$user = CMediusers::get();
$mail_id = CValue::get("mail_id");
$attachment_id = CValue::get("attachment_id");
//load email
$mail = new CUserMail();
$mail->load($mail_id);
//connection log
$log_pop = new CSourcePOP();
$log_pop->_id = $mail->account_id;
$log_pop->loadMatchingObject();
if ($attachment_id != 0) {
    //je récupère LA pièce jointe
    //load attachment
    $attachment = new CMailAttachments();
    $attachment->load($attachment_id);
    //CFile
    $file = new CFile();
    $file->setObject($attachment);
    $file->author_id = $user->_id;
    $file->loadMatchingObject();
Ejemplo n.º 15
0
 /**
  * @see parent::doStore()
  */
 function doStore()
 {
     /** @var CUserMail $mail */
     $mail = $this->_obj;
     $mail->date_inbox = CMbDT::dateTime();
     $mail->date_read = $mail->date_inbox;
     $content_html = new CContentHTML();
     $mail->_content = CUserMail::purifyHTML($mail->_content);
     $content_html->content = $mail->_content;
     if (!($msg = $content_html->store())) {
         $mail->text_html_id = $content_html->_id;
         $mail->_text_html = $content_html;
     }
     $content_plain = new CContentAny();
     $content_plain->content = strip_tags($mail->_content);
     if (!($msg = $content_plain->store())) {
         $mail->text_plain_id = $content_plain->_id;
     }
     $hash = CMbSecurity::hash(CMbSecurity::SHA256, "==FROM==\n{$mail->from}\n==TO==\n{$mail->to}\n==SUBJECT==\n{$mail->subject}\n==CONTENT==\n{$mail->_content}");
     if ($msg = $mail->store()) {
         CAppUI::setMsg($msg, UI_MSG_ERROR);
         return parent::doStore();
     }
     $action = CValue::post('action');
     switch ($action) {
         case 'draft':
             $mail->draft = '1';
             CAppUI::setMsg('CUserMail-msg-drafted', UI_MSG_OK);
             break;
         case 'send':
             $mail->sent = '1';
             $mail->draft = '0';
             $account = $mail->loadAccount();
             if ($mail->_is_apicrypt) {
                 /** @var CSourceSMTP $smtp */
                 $smtp = CExchangeSource::get("mediuser-{$account->object_id}-apicrypt", 'smtp');
             } else {
                 /** @var CSourceSMTP $smtp */
                 $smtp = CExchangeSource::get("mediuser-{$account->object_id}", 'smtp');
             }
             $smtp->init();
             foreach (explode(',', $mail->to) as $_address) {
                 $smtp->addTo($_address);
             }
             if ($mail->cc != '') {
                 foreach (explode(',', $mail->cc) as $_address) {
                     $smtp->addCc($_address);
                 }
             }
             if ($mail->bcc != '') {
                 foreach (explode(',', $mail->bcc) as $_address) {
                     $smtp->addBcc($_address);
                 }
             }
             $smtp->setSubject($mail->subject);
             if ($mail->_is_apicrypt) {
                 $receiver = explode(',', $mail->to);
                 $body = CApicrypt::encryptBody($account->object_id, $receiver[0], $mail->_content);
                 $smtp->setBody($body);
             } else {
                 $smtp->setBody($mail->_content);
             }
             /** @var CMailAttachments[] $attachments */
             $attachments = $mail->loadAttachments();
             foreach ($attachments as $_attachment) {
                 $file = $_attachment->loadFiles();
                 $smtp->addAttachment($file->_file_path, $file->file_name);
             }
             try {
                 $smtp->send();
                 CAppUI::setMsg('CUserMail-msg-sent', UI_MSG_OK);
             } catch (phpmailerException $e) {
                 CAppUI::setMsg($e->errorMessage(), UI_MSG_ERROR);
             } catch (CMbException $e) {
                 $e->stepAjax();
             }
             break;
         default:
     }
     $mail->store();
     if (CAppUI::isMsgOK() && $this->redirectStore) {
         $this->redirect =& $this->redirectStore;
     }
     if (!CAppUI::isMsgOK() && $this->redirectError) {
         $this->redirect =& $this->redirectError;
     }
 }
Ejemplo n.º 16
0
/**
 * open a mail by its UID, directly from server
 *
 * $Id$
 *  
 * @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);
<?php

/**
 * $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
 */
$mail_id = CValue::get('mail_id');
$mail = new CUserMail();
$mail->load($mail_id);
$mail->loadAttachments();
foreach ($mail->_attachments as $_attachment) {
    $_attachment->loadFiles();
}
$smarty = new CSmartyDP();
$smarty->assign('attachments', $mail->_attachments);
$smarty->display('inc_mail_attachments.tpl');
Ejemplo n.º 18
0
     foreach ($unseen as $key => $_unseen) {
       if ($_unseen < $mbMailUid) {
         unset($unseen[$key]);
       }
     }
   }*/
 array_splice($unseen, $limitMail);
 if (count($unseen) > 0) {
     $unread = 0;
     //unseen mail
     $loop = 0;
     //loop of foreach
     $created = 0;
     foreach ($unseen as $_mail) {
         $pop->cleanTemp();
         $mail_unseen = new CUserMail();
         $mail_unseen->account_id = $_source->_id;
         $mail_unseen->account_class = $_source->_class;
         //mail non existant
         $header = $pop->header($_mail);
         $content = $pop->getFullBody($_mail, false, false, true);
         $hash = $mail_unseen->makeHash($header, $content);
         if (!$mail_unseen->loadMatchingFromHash($hash)) {
             $mail_unseen->setHeaderFromSource($header);
             $mail_unseen->setContentFromSource($pop->getFullBody($_mail, false, false, true));
             //text plain
             $mail_unseen->getPlainText($_source->object_id);
             //text html
             $mail_unseen->getHtmlText($_source->object_id);
             //sent ?
             if (strpos($mail_unseen->from, $_source->user) !== false) {
<?php

/**
 * $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
 */
CCando::checkRead();
$account_id = Cvalue::get('account_id');
$counts = array(array('name' => 'inbox', 'count' => CUserMail::countUnread($account_id)), array('name' => 'archived', 'count' => CUserMail::countArchived($account_id)), array('name' => 'sentbox', 'count' => CUserMail::countSent($account_id)), array('name' => 'favorites', 'count' => CUserMail::countFavorites($account_id)), array('name' => 'drafts', 'count' => CUserMail::countDrafted($account_id)));
echo json_encode($counts);
Ejemplo n.º 20
0
/** $Id$ **/
/**
 * @package    Mediboard
 * @subpackage messagerie
 * @version    $Revision$
 * @author     SARL OpenXtrem
 */
CCanDo::checkRead();
CPop::checkImapLib();
$account_id = CValue::get("account_id");
$user = CMediusers::get();
//get account
$account_pop = new CSourcePOP();
$account_pop->load($account_id);
//get the list
$mail = new CUserMail();
$where = array();
$where[] = "date_read IS NULL AND account_id = '{$account_id}' AND account_class = 'CSourcePOP'";
$mails = $mail->loadList($where);
$pop = new CPop($account_pop);
$pop->open();
$count = 0;
/** @var $mails CUserMail[] */
foreach ($mails as $_mail) {
    if ($pop->setflag($_mail->uid, "\\Seen")) {
        $_mail->date_read = CMbDT::dateTime();
        if (!($msg = $_mail->store())) {
            $count++;
        }
    }
}
Ejemplo n.º 21
0
$user = CMediusers::get();
$mail_id = CValue::get("mail_id");
$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);
}
//pop init
$pop = new CPop($log_pop);
$pop->open();
//mail
$mail = new CUserMail();
$head = $pop->header($mail_id);
$content = $pop->getFullBody($_mail, false, false, true);
$hash = $mail_unseen->makeHash($head, $content);
$mail->loadMatchingFromHash($hash);
if ($mail->_id && !$mail->text_plain_id) {
    $mail->setHeaderFromSource($head);
    $mail->setContentFromSource($pop->getFullBody($_mail, false, false, true));
    $mail->date_read = CMbDT::dateTime();
    $mail->user_id = $user->_id;
    //text plain
    if ($mail->_text_plain) {
        $textP = new CContentAny();
        $textP->content = $mail->_text_plain;
        if ($msg = $textP->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
Ejemplo n.º 22
0
<?php

/**
 * list of attachment with radio button
 *
 * @category Messagerie
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$mail_id = CValue::get("mail_id");
$rename = CValue::get("rename", 0);
$mail = new CUserMail();
$mail->load($mail_id);
$mail->loadRefsFwd();
//load files
foreach ($mail->_attachments as $_att) {
    $_att->loadFiles();
}
$cat = new CFilesCategory();
$cats = $cat->loadListWithPerms();
//check for inline attachment
$mail->checkInlineAttachments();
$smarty = new CSmartyDP();
$smarty->assign("mail", $mail);
$smarty->assign("cats", $cats);
$smarty->assign("rename", $rename);
$smarty->display("inc_vw_list_attachment.tpl");