Exemplo n.º 1
0
/** Show the translation for a message you're reading */
function translate_read_form()
{
    global $color, $translate_server;
    global $message, $translate_dir;
    global $translate_show_read;
    global $imapConnection, $wrap_at, $passed_id, $mailbox;
    if (!$translate_show_read) {
        return;
    }
    $translate_dir = 'to';
    $trans_ar = $message->findDisplayEntity(array(), array('text/plain'));
    $body = '';
    if (!empty($trans_ar[0])) {
        for ($i = 0; $i < count($trans_ar); $i++) {
            $body .= formatBody($imapConnection, $message, $color, $wrap_at, $trans_ar[$i], $passed_id, $mailbox, true);
        }
        $hookResults = do_hook('message_body', $body);
        $body = $hookResults[1];
    } else {
        $body = 'Message can\'t be translated';
    }
    $new_body = $body;
    $trans = get_html_translation_table(HTML_ENTITIES);
    $trans[' '] = '&nbsp;';
    $trans = array_flip($trans);
    $new_body = strtr($new_body, $trans);
    $new_body = urldecode($new_body);
    $new_body = strip_tags($new_body);
    /* I really don't like this next part ... */
    $new_body = str_replace('"', "''", $new_body);
    $new_body = strtr($new_body, "\n", ' ');
    $function = 'translate_form_' . $translate_server;
    $function($new_body);
}
/* From and Date are usually fine as they are... */
$from = $rfc822_header->getAddr_s('from');
$date = getLongDateString($rfc822_header->date, $rfc822_header->date_unparsed);
$subject = trim($rfc822_header->subject);
/* we can clean these up if the list is too long... */
$cc = $rfc822_header->getAddr_s('cc');
$to = $rfc822_header->getAddr_s('to');
if ($show_html_default == 1) {
    $ent_ar = $message->findDisplayEntity(array());
} else {
    $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
}
$body = '';
if ($ent_ar[0] != '') {
    for ($i = 0; $i < count($ent_ar); $i++) {
        $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox, true);
        $body .= '<hr noshade size="1" />';
    }
    $hookResults = do_hook('message_body', $body);
    $body = $hookResults[1];
} else {
    $body = _("Message not printable");
}
/* now, if they choose to, we clean up the display a bit... */
if ($pf_cleandisplay) {
    $num_leading_spaces = 9;
    // nine leading spaces for indentation
    // sometimes I see ',,' instead of ',' seperating addresses *shrug*
    $cc = pf_clean_string(str_replace(',,', ',', $cc), $num_leading_spaces);
    $to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces);
    // the body should have no leading zeros
Exemplo n.º 3
0
if ($Session->checkPermission('Garden.PersonalInfo.View')) {
    echo wrap(ipAnchor($Discussion->InsertIPAddress), 'span', array('class' => 'MItem IPAddress'));
}
$this->fireEvent('DiscussionInfo');
$this->fireEvent('AfterDiscussionMeta');
// DEPRECATED
?>
            </div>
        </div>
        <?php 
$this->fireEvent('BeforeDiscussionBody');
?>
        <div class="Item-BodyWrap">
            <div class="Item-Body">
                <div class="Message">
                    <?php 
echo formatBody($Discussion);
?>
                </div>
                <?php 
$this->fireEvent('AfterDiscussionBody');
writeReactions($Discussion);
if (val('Attachments', $Discussion)) {
    writeAttachments($Discussion->Attachments);
}
?>
            </div>
        </div>
    </div>
</div>
Exemplo n.º 4
0
 /**
  *
  *
  * @param $Comment
  * @return string|void
  */
 function formatMeAction($Comment)
 {
     if (!isMeAction($Comment) || !c('Garden.Format.MeActions')) {
         return;
     }
     // Maxlength (don't let people blow up the forum)
     $Comment->Body = substr($Comment->Body, 4);
     $Maxlength = c('Vanilla.MeAction.MaxLength', 100);
     $Body = formatBody($Comment);
     if (strlen($Body) > $Maxlength) {
         $Body = substr($Body, 0, $Maxlength) . '...';
     }
     return '<div class="AuthorAction">' . $Body . '</div>';
 }
Exemplo n.º 5
0
    }
}
if (isset($aMailbox['MSG_HEADERS'][$uid]['MESSAGE_OBJECT'])) {
    $message = $aMailbox['MSG_HEADERS'][$uid]['MESSAGE_OBJECT'];
    $FirstTimeSee = !$message->is_seen;
} else {
    $message = sqimap_get_message($imapConnection, $uid, $mailbox);
    $FirstTimeSee = !$message->is_seen;
    $message->is_seen = true;
    $aMailbox['MSG_HEADERS'][$uid]['MESSAGE_OBJECT'] = $message;
}
$header = $message->header;
$ent_ar = $message->findDisplayEntity(array());
$cnt = count($ent_ar);
for ($i = 0; $i < $cnt; $i++) {
    $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $uid, $mailbox);
    if ($i != $cnt - 1) {
        $messagebody .= '<hr noshade size="1" />';
    }
}
require $GO_THEME->theme_path . "header.inc";
echo $messagebody;
require $GO_THEME->theme_path . "footer.inc";
sqimap_logout($imapConnection);
function email_error()
{
    global $imapConnection;
    require $GO_THEME->theme_path . 'header.inc';
    echo '<table border="0" cellpadding="10" width="100%"><tr><td>';
    echo '<p class="Error">' . $ml_connect_failed . ' \'' . $account['host'] . '\' ' . $ml_at_port . ': ' . $account['port'] . '</p>';
    echo '<p class="Error">' . imap_last_error() . '</p>';