当前位置: 首页>>代码示例>>PHP>>正文


PHP decodeHeader函数代码示例

本文整理汇总了PHP中decodeHeader函数的典型用法代码示例。如果您正苦于以下问题:PHP decodeHeader函数的具体用法?PHP decodeHeader怎么用?PHP decodeHeader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了decodeHeader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: printMessageInfo

/**
 * Displays message header row in messages list
 *
 * @param  array $aMsg contains all message related parameters
 * @return void
 */
function printMessageInfo($aMsg)
{
    // FIX ME, remove these globals as well by adding an array as argument for the user settings
    // specificly meant for header display
    global $checkall, $color, $default_use_priority, $message_highlight_list, $index_order, $truncate_sender, $email_address, $show_recipient_instead, $use_icons, $icon_theme;
    /* icons theming */
    $color_string = $color[4];
    // initialisation:
    $mailbox = $aMsg['MAILBOX'];
    $msg = $aMsg['HEADER'];
    $t = $aMsg['INDX'];
    $start_msg = $aMsg['PAGEOFFSET'];
    $last = $aMsg['LAST'];
    if (isset($aMsg['SEARCH']) && count($aMsg['SEARCH']) > 1) {
        $where = $aMsg['SEARCH'][0];
        $what = $aMsg['SEARCH'][1];
    } else {
        $where = false;
        $what = false;
    }
    $iIndent = $aMsg['INDENT'];
    $sSubject = isset($msg['SUBJECT']) && $msg['SUBJECT'] != '' ? $msg['SUBJECT'] : _("(no subject)");
    $sFrom = isset($msg['FROM']) ? $msg['FROM'] : _("Unknown sender");
    $sTo = isset($msg['TO']) ? $msg['TO'] : _("Unknown recipient");
    $sCc = isset($msg['CC']) ? $msg['CC'] : '';
    $aFlags = isset($msg['FLAGS']) ? $msg['FLAGS'] : array();
    $iPrio = isset($msg['PRIORITY']) ? $msg['PRIORITY'] : 3;
    $iSize = isset($msg['SIZE']) ? $msg['SIZE'] : 0;
    $sType0 = isset($msg['TYPE0']) ? $msg['TYPE0'] : 'text';
    $sType1 = isset($msg['TYPE1']) ? $msg['TYPE1'] : 'plain';
    if (isset($msg['INTERNALDATE'])) {
        $sDate = getDateString(getTimeStamp(explode(' ', $msg['INTERNALDATE'])));
    } else {
        $sDate = isset($msg['DATE']) ? getDateString(getTimeStamp(explode(' ', $msg['DATE']))) : '';
    }
    $iId = isset($msg['UID']) ? $msg['UID'] : false;
    if (!$iId) {
        return;
    }
    if ($GLOBALS['alt_index_colors']) {
        if (!($t % 2)) {
            if (!isset($color[12])) {
                $color[12] = '#EAEAEA';
            }
            $color_string = $color[12];
        }
    }
    $urlMailbox = urlencode($mailbox);
    // FIXME, foldertype should be set in right_main.php
    // in other words, handle as sent is obsoleted from now.
    // We replace that by providing an array to aMailbox with the to shown headers
    // that way we are free to show the user different layouts for different folders
    $bSentFolder = handleAsSent($mailbox);
    if (!$bSentFolder && $show_recipient_instead) {
        // If the From address is the same as $email_address, then handle as Sent
        $from_array = parseAddress($sFrom, 1);
        if (!isset($email_address)) {
            global $datadir, $username;
            $email_address = getPref($datadir, $username, 'email_address');
        }
        $bHandleAsSent = isset($from_array[0][0]) && $from_array[0][0] == $email_address;
    } else {
        $bHandleAsSent = $bSentFolder;
    }
    // If this is a Sent message, display To address instead of From
    if ($bHandleAsSent) {
        $sFrom = $sTo;
    }
    // Passing 1 below results in only 1 address being parsed, thus defeating the following code
    $sFrom = parseAddress($sFrom);
    /*
     * This is done in case you're looking into Sent folders,
     * because you can have multiple receivers.
     */
    $senderNames = $sFrom;
    $senderName = '';
    $senderAddress = '';
    if (sizeof($senderNames)) {
        foreach ($senderNames as $senderNames_part) {
            if ($senderName != '') {
                $senderName .= ', ';
                $senderAddress .= ', ';
            }
            $sender_address_part = htmlspecialchars($senderNames_part[0]);
            $sender_name_part = str_replace(' ', ' ', decodeHeader($senderNames_part[1]));
            if ($sender_name_part) {
                $senderName .= $sender_name_part;
                $senderAddress .= $sender_name_part . ' <' . $sender_address_part . '>';
            } else {
                $senderName .= $sender_address_part;
                $senderAddress .= $sender_address_part;
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:101,代码来源:mailbox_display.php

示例2: foreach

echo "011\n";
foreach ($header as $test) {
    echo htmlentities(decodeHeader($test, false, true, true));
    echo "\n";
}
echo "--------\n";
echo "(download) 100\n";
foreach ($header as $test) {
    echo htmlentities(decodeHeader($test, true, false, false));
    echo "\n";
}
echo "--------\n";
echo "101\n";
foreach ($header as $test) {
    echo htmlentities(decodeHeader($test, true, false, true));
    echo "\n";
}
echo "--------\n";
echo "(default) 110\n";
foreach ($header as $test) {
    echo htmlentities(decodeHeader($test, true, true, false));
    echo "\n";
}
echo "--------\n";
echo "111\n";
foreach ($header as $test) {
    echo htmlentities(decodeHeader($test, true, true, true));
    echo "\n";
}
echo "--------\n";
echo '</pre></body></html>';
开发者ID:jprice,项目名称:EHCP,代码行数:31,代码来源:decodeheader.php

示例3: printMessageInfo

function printMessageInfo($imapConnection, $t, $not_last = true, $key, $mailbox, $start_msg, $where, $what)
{
    global $checkall, $preselected, $color, $msgs, $msort, $td_str, $msg, $default_use_priority, $message_highlight_list, $index_order, $indent_array, $pos, $thread_sort_messages, $server_sort_order, $row_count, $allow_server_sort, $truncate_subject, $truncate_sender;
    $color_string = $color[4];
    if ($GLOBALS['alt_index_colors']) {
        if (!isset($row_count)) {
            $row_count = 0;
        }
        $row_count++;
        if ($row_count % 2) {
            if (!isset($color[12])) {
                $color[12] = '#EAEAEA';
            }
            $color_string = $color[12];
        }
    }
    $msg = $msgs[$key];
    if ($mailbox == 'None') {
        $boxes = sqimap_mailbox_list($imapConnection);
        $mailbox = $boxes[0]['unformatted'];
        unset($boxes);
    }
    $urlMailbox = urlencode($mailbox);
    if (handleAsSent($mailbox)) {
        $msg['FROM'] = $msg['TO'];
    }
    $msg['FROM'] = parseAddress($msg['FROM'], 1);
    /*
     * This is done in case you're looking into Sent folders,
     * because you can have multiple receivers.
     */
    $senderNames = $msg['FROM'];
    $senderName = '';
    $senderFrom = '';
    if (sizeof($senderNames)) {
        foreach ($senderNames as $senderNames_part) {
            if ($senderName != '') {
                $senderName .= ', ';
            }
            if ($senderFrom != '') {
                $senderFrom .= ', ';
            }
            if ($senderNames_part[1]) {
                $senderName .= decodeHeader($senderNames_part[1]);
            } else {
                $senderName .= htmlspecialchars($senderNames_part[0]);
            }
            $senderFrom .= htmlspecialchars($senderNames_part[0]);
        }
    }
    $senderName = str_replace('&nbsp;', ' ', $senderName);
    echo html_tag('tr', '', '', '', 'valign="top"') . "\n";
    if (isset($msg['FLAG_FLAGGED']) && $msg['FLAG_FLAGGED'] == true) {
        $flag = "<font color=\"{$color['2']}\">";
        $flag_end = '</font>';
    } else {
        $flag = '';
        $flag_end = '';
    }
    if (!isset($msg['FLAG_SEEN']) || $msg['FLAG_SEEN'] == false) {
        $bold = '<b>';
        $bold_end = '</b>';
    } else {
        $bold = '';
        $bold_end = '';
    }
    if (handleAsSent($mailbox)) {
        $italic = '<i>';
        $italic_end = '</i>';
    } else {
        $italic = '';
        $italic_end = '';
    }
    if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
        $fontstr = "<font color=\"{$color['9']}\">";
        $fontstr_end = '</font>';
    } else {
        $fontstr = '';
        $fontstr_end = '';
    }
    if ($where && $what) {
        $searchstr = '&amp;where=' . $where . '&amp;what=' . $what;
    } else {
        $searchstr = '';
    }
    if (is_array($message_highlight_list) && count($message_highlight_list)) {
        $msg['TO'] = parseAddress($msg['TO']);
        $msg['CC'] = parseAddress($msg['CC']);
        foreach ($message_highlight_list as $message_highlight_list_part) {
            if (trim($message_highlight_list_part['value']) != '') {
                $high_val = strtolower($message_highlight_list_part['value']);
                $match_type = strtoupper($message_highlight_list_part['match_type']);
                if ($match_type == 'TO_CC') {
                    $match = array('TO', 'CC');
                } else {
                    $match = array($match_type);
                }
                foreach ($match as $match_type) {
                    switch ($match_type) {
                        case 'TO':
//.........这里部分代码省略.........
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:mailbox_display.php

示例4: pf_clean_string

    // 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
    // disabled because it destroys html mail
    //    $body = pf_clean_string($body, 0);
    // clean up everything else...
    $subject = pf_clean_string($subject, $num_leading_spaces);
    $from = pf_clean_string($from, $num_leading_spaces);
    $date = pf_clean_string($date, $num_leading_spaces);
}
// end cleanup
$to = decodeHeader($to);
$cc = decodeHeader($cc);
$from = decodeHeader($from);
$subject = decodeHeader($subject);
// --end display setup--
/* --start browser output-- */
displayHtmlHeader($subject, '', FALSE);
echo '<body text="#000000" bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#000000">' . "\n" . html_tag('table', '', 'center', '', 'cellspacing="0" cellpadding="0" border="0" width="100%"') . html_tag('tr', html_tag('td', _("From") . '&nbsp;', 'left', '', 'valign="top"') . html_tag('td', $from, 'left')) . "\n" . html_tag('tr', html_tag('td', _("Subject") . '&nbsp;', 'left', '', 'valign="top"') . html_tag('td', $subject, 'left')) . "\n" . html_tag('tr', html_tag('td', _("Date") . '&nbsp;', 'left') . html_tag('td', htmlspecialchars($date), 'left')) . "\n" . html_tag('tr', html_tag('td', _("To") . '&nbsp;', 'left', '', 'valign="top"') . html_tag('td', $to, 'left')) . "\n";
if (strlen($cc) > 0) {
    /* only show Cc: if it's there... */
    echo html_tag('tr', html_tag('td', _("Cc") . '&nbsp;', 'left', '', 'valign="top"') . html_tag('td', $cc, 'left'));
}
/* body */
echo html_tag('tr', html_tag('td', '<hr noshade size="1" /><br />' . "\n" . $body, 'left', '', 'colspan="2"')) . "\n" . '</table>' . "\n" . '</body></html>';
/* --end browser output-- */
/* --start pf-specific functions-- */
/**
 * Function should clean layout of printed messages when user
 * enables "Printer Friendly Clean Display" option.
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:31,代码来源:printer_friendly_bottom.php

示例5: formatEnvheader

function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee)
{
    global $default_use_mdn, $default_use_priority, $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on, $squirrelmail_language;
    $header = $message->rfc822_header;
    $env = array();
    $env[_("Subject")] = decodeHeader($header->subject);
    $from_name = $header->getAddr_s('from');
    if (!$from_name) {
        $from_name = $header->getAddr_s('sender');
        if (!$from_name) {
            $from_name = _("Unknown sender");
        }
    }
    $env[_("From")] = decodeHeader($from_name);
    $env[_("Date")] = getLongDateString($header->date, $header->date_unparsed);
    $env[_("To")] = formatRecipientString($header->to, "to");
    $env[_("Cc")] = formatRecipientString($header->cc, "cc");
    $env[_("Bcc")] = formatRecipientString($header->bcc, "bcc");
    if ($default_use_priority) {
        $env[_("Priority")] = htmlspecialchars(getPriorityStr($header->priority));
    }
    if ($show_xmailer_default) {
        $env[_("Mailer")] = decodeHeader($header->xmailer);
    }
    if ($default_use_mdn) {
        if ($mdn_user_support) {
            if ($header->dnt) {
                if ($message->is_mdnsent) {
                    $env[_("Read receipt")] = _("sent");
                } else {
                    $env[_("Read receipt")] = _("requested");
                    if (!(handleAsSent($mailbox) || $message->is_deleted || $passed_ent_id)) {
                        $mdn_url = $PHP_SELF;
                        $mdn_url = set_url_var($mdn_url, 'mailbox', urlencode($mailbox));
                        $mdn_url = set_url_var($mdn_url, 'passed_id', $passed_id);
                        $mdn_url = set_url_var($mdn_url, 'passed_ent_id', $passed_ent_id);
                        $mdn_url = set_url_var($mdn_url, 'sendreceipt', 1);
                        if ($FirstTimeSee && $javascript_on) {
                            $script = '<script language="JavaScript" type="text/javascript">' . "\n";
                            $script .= '<!--' . "\n";
                            $script .= 'if(window.confirm("' . _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") . '")) {  ' . "\n" . '    sendMDN()' . '}' . "\n";
                            $script .= '// -->' . "\n";
                            $script .= '</script>' . "\n";
                            echo $script;
                        }
                        $env[_("Read receipt")] .= '&nbsp;<a href="' . $mdn_url . '">[' . _("Send read receipt now") . ']</a>';
                    }
                }
            }
        }
    }
    $s = '<table width="100%" cellpadding="0" cellspacing="2" border="0"';
    $s .= ' align="center" bgcolor="' . $color[0] . '">';
    foreach ($env as $key => $val) {
        if ($val) {
            $s .= '<tr>';
            $s .= html_tag('td', '<b>' . $key . ':&nbsp;&nbsp;</b>', 'right', '', 'valign="top" width="20%"') . "\n";
            $s .= html_tag('td', $val, 'left', '', 'valign="top" width="80%"') . "\n";
            $s .= '</tr>';
        }
    }
    echo '<table bgcolor="' . $color[9] . '" width="100%" cellpadding="1"' . ' cellspacing="0" border="0" align="center">' . "\n";
    echo '<tr><td height="5" colspan="2" bgcolor="' . $color[4] . '"></td></tr><tr><td align="center">' . "\n";
    echo $s;
    do_hook('read_body_header');
    formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color);
    echo '</table>';
    echo '</td></tr><tr><td height="5" colspan="2" bgcolor="' . $color[4] . '"></td></tr>' . "\n";
    echo '</table>';
}
开发者ID:jprice,项目名称:EHCP,代码行数:70,代码来源:read_body.php

示例6: pf_show_attachments

/**
 * Displays attachment information
 *
 * Stripped version of formatAttachments() function from functions/mime.php.
 * @param object $message SquirrelMail message object
 * @param array $exclude_id message parts that are not attachments.
 * @param string $mailbox mailbox name
 * @param integer $id message id
 * @since 1.5.1 and 1.4.6
 * @return string html formated attachment information.
 */
function pf_show_attachments($message, $exclude_id, $mailbox, $id)
{
    global $where, $what, $startMessage, $color, $passed_ent_id;
    $att_ar = $message->getAttachments($exclude_id);
    if (!count($att_ar)) {
        return '';
    }
    $attachments = '';
    $urlMailbox = urlencode($mailbox);
    foreach ($att_ar as $att) {
        $ent = $att->entity_id;
        $header = $att->header;
        $type0 = strtolower($header->type0);
        $type1 = strtolower($header->type1);
        $name = '';
        if ($type0 == 'message' && $type1 == 'rfc822') {
            $rfc822_header = $att->rfc822_header;
            $filename = $rfc822_header->subject;
            if (trim($filename) == '') {
                $filename = 'untitled-[' . $ent . ']';
            }
            $from_o = $rfc822_header->from;
            if (is_object($from_o)) {
                $from_name = decodeHeader($from_o->getAddress(true));
            } else {
                $from_name = _("Unknown sender");
            }
            $description = '<tr>' . html_tag('td', _("From:"), 'right') . html_tag('td', $from_name, 'left') . '</tr>';
        } else {
            $filename = $att->getFilename();
            if ($header->description) {
                $description = '<tr>' . html_tag('td', _("Info:"), 'right') . html_tag('td', decodeHeader($header->description), 'left') . '</tr>';
            } else {
                $description = '';
            }
        }
        $display_filename = $filename;
        // TODO: maybe make it nicer?
        $attachments .= '<table cellpadding="0" cellspacing="0" border="1"><tr><th colspan="2">' . decodeHeader($display_filename) . '</th></tr>' . '<tr border="0">' . html_tag('td', _("Size:"), 'right') . html_tag('td', show_readable_size($header->size), 'left') . '</tr><tr>' . html_tag('td', _("Type:"), 'right') . html_tag('td', htmlspecialchars($type0) . '/' . htmlspecialchars($type1), 'left') . '</tr>';
        if (!empty($description)) {
            $attachments .= $description;
        }
        $attachments .= "</table>\n";
    }
    return $attachments;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:57,代码来源:printer_friendly_bottom.php

示例7: getFilename

 /**
  * Get file name used for mime part
  * @return string file name
  * @since 1.3.2
  */
 function getFilename()
 {
     $filename = '';
     $header = $this->header;
     if (is_object($header->disposition)) {
         $filename = $header->disposition->getProperty('filename');
         if (trim($filename) == '') {
             $name = decodeHeader($header->disposition->getProperty('name'));
             if (!trim($name)) {
                 $name = $header->getParameter('name');
                 if (!trim($name)) {
                     if (!trim($header->id)) {
                         $filename = 'untitled-[' . $this->entity_id . ']' . '.' . strtolower($header->type1);
                     } else {
                         $filename = 'cid: ' . $header->id . '.' . strtolower($header->type1);
                     }
                 } else {
                     $filename = $name;
                 }
             } else {
                 $filename = $name;
             }
         }
     } else {
         $filename = $header->getParameter('filename');
         if (!trim($filename)) {
             $filename = $header->getParameter('name');
             if (!trim($filename)) {
                 if (!trim($header->id)) {
                     $filename = 'untitled-[' . $this->entity_id . ']' . '.' . strtolower($header->type1);
                 } else {
                     $filename = 'cid: ' . $header->id . '.' . strtolower($header->type1);
                 }
             }
         }
     }
     return $filename;
 }
开发者ID:teammember8,项目名称:roundcube,代码行数:43,代码来源:Message.class.php

示例8: array

 if ($header) {
     if (!$contentset && preg_match("/^.*(content-type:)\\s*(\\w+)\\/(\\w+).*/i", $line, $reg)) {
         if (strtolower($reg[2]) == 'message' && strtolower($reg[3]) == 'rfc822') {
             $messageheader = true;
         }
         $content[$content_indx]['type'] = "{$reg['2']}/{$reg['3']}";
         $contentset = true;
         if ($reg[2] == 'image') {
             $entities["{$entStr}"] = array();
             $entities["{$entStr}"]['entity'] = $entStr;
             $entities["{$entStr}"]['contenttype'] = $reg[2] . '/' . $reg[3];
         }
     } else {
         if (!$nameset && preg_match("/^.*(name=\\s*)\"(.*)\".*/i", $line, $reg)) {
             $name = htmlspecialchars($reg[2]);
             $content[$content_indx]['name'] = decodeHeader($name);
             $nameset = true;
             if (isset($entities["{$entStr}"])) {
                 $entities["{$entStr}"]['name'] = urlEncode($reg[2]);
             }
         } else {
             if (preg_match("/^.*(content-transfer-encoding:)\\s*(\\w+-?(\\w+)?).*/i", $line, $reg)) {
                 $encoding = $reg[2];
                 if (isset($entities["{$entStr}"])) {
                     $entities["{$entStr}"]['encoding'] = $reg[2];
                 }
                 $content[$content_indx]['encoding'] = $encoding;
                 $mimeentity = '';
             }
         }
     }
开发者ID:jin255ff,项目名称:company_website,代码行数:31,代码来源:message_details_bottom.php

示例9: sqimap_get_small_header_list


//.........这里部分代码省略.........
                                        $from = $value;
                                        break;
                                    case 'date':
                                        $date = $value;
                                        break;
                                    case 'x-priority':
                                    case 'importance':
                                    case 'priority':
                                        $priority = parsePriority($value);
                                        break;
                                    case 'subject':
                                        $subject = $value;
                                        if ($subject == "") {
                                            $subject = _("(no subject)");
                                        }
                                        break;
                                    case 'content-type':
                                        $type = strtolower($value);
                                        if ($pos = strpos($type, ";")) {
                                            $type = substr($type, 0, $pos);
                                        }
                                        $type = explode("/", $type);
                                        if (empty($type[0])) {
                                            $type[0] = 'text';
                                            // I had this added, but not committed to CVS.... did it help fix something?
                                            //                                    $type[1] = 'plain';
                                        }
                                        if (empty($type[1])) {
                                            $type[1] = 'plain';
                                        }
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }
                    break;
                default:
                    ++$i;
                    break;
            }
        }
        if (isset($date)) {
            $date = str_replace('  ', ' ', $date);
            $tmpdate = explode(' ', trim($date));
        } else {
            $tmpdate = $date = array();
        }
        if ($uid_support) {
            $msgi = "{$unique_id}";
            $messages[$msgi]['ID'] = $unique_id;
        } else {
            $msgi = "{$id}";
            $messages[$msgi]['ID'] = $id;
        }
        $messages[$msgi]['TIME_STAMP'] = getTimeStamp($tmpdate);
        $messages[$msgi]['DATE_STRING'] = getDateString($messages[$msgi]['TIME_STAMP']);
        $messages[$msgi]['FROM'] = $from;
        //parseAddress($from);
        $messages[$msgi]['SUBJECT'] = $subject;
        //        if (handleAsSent($mailbox)) {
        $messages[$msgi]['TO'] = $to;
        //parseAddress($to);
        //        }
        $messages[$msgi]['PRIORITY'] = $priority;
        $messages[$msgi]['CC'] = $cc;
        //parseAddress($cc);
        $messages[$msgi]['SIZE'] = $size;
        $messages[$msgi]['TYPE0'] = $type[0];
        $messages[$msgi]['TYPE1'] = $type[1];
        $messages[$msgi]['FLAG_DELETED'] = $flag_deleted;
        $messages[$msgi]['FLAG_ANSWERED'] = $flag_answered;
        $messages[$msgi]['FLAG_SEEN'] = $flag_seen;
        $messages[$msgi]['FLAG_FLAGGED'] = $flag_flagged;
        /* non server sort stuff */
        if (!$allow_server_sort) {
            $from = parseAddress($from);
            if ($from[0][1]) {
                $from = decodeHeader($from[0][1], true, false);
            } else {
                $from = $from[0][0];
            }
            $messages[$msgi]['FROM-SORT'] = $from;
            $subject_sort = strtolower(decodeHeader($subject, true, false));
            if (preg_match("/^(?:(?:vedr|sv|re|aw|fw|fwd|\\[\\w\\]):\\s*)*\\s*(.*)\$/si", $subject_sort, $matches)) {
                $messages[$msgi]['SUBJECT-SORT'] = $matches[1];
            } else {
                $messages[$msgi]['SUBJECT-SORT'] = $subject_sort;
            }
        }
        ++$msgi;
    }
    array_reverse($messages);
    $new_messages = array();
    foreach ($messages as $i => $message) {
        $new_messages[] = $message;
    }
    return $new_messages;
}
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:imap_messages.php

示例10: header

    require 'trackbacks.php';
    die;
}
/**
 * Si el primer valor es submit
 * entonces se muestra el formulario
 * para enviar un artículo
 */
if ($vars[0] == 'submit') {
    require 'submit.php';
    die;
}
if ($vars[0] == 'edit') {
    $vars['edit'] = $vars[1];
    require 'submit.php';
    die;
}
if ($yesquery || $vars[0] == '') {
    require 'home.php';
    die;
}
header("HTTP/1.0 404 Not Found");
if (substr(php_sapi_name(), 0, 3) == 'cgi') {
    header('Status: 404 Not Found', TRUE);
} else {
    header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
}
echo "<h1>ERROR 404. Document not Found</h1>";
die;
decodeHeader();
开发者ID:laiello,项目名称:bitcero-modules,代码行数:30,代码来源:index.php

示例11: formatAttachments

function formatAttachments($message, $exclude_id, $mailbox, $id)
{
    global $where, $what, $startMessage, $color;
    static $ShownHTML = 0;
    $att_ar = $message->getAttachments($exclude_id);
    if (!count($att_ar)) {
        return '';
    }
    $attachments = '';
    $urlMailbox = urlencode($mailbox);
    foreach ($att_ar as $att) {
        $ent = $att->entity_id;
        $header = $att->header;
        $type0 = strtolower($header->type0);
        $type1 = strtolower($header->type1);
        $name = '';
        $links['download link']['text'] = _("Download");
        $links['download link']['href'] = SM_PATH . "src/download.php?absolute_dl=true&amp;passed_id={$id}&amp;mailbox={$urlMailbox}&amp;ent_id={$ent}";
        $ImageURL = '';
        if ($type0 == 'message' && $type1 == 'rfc822') {
            $default_page = SM_PATH . 'src/read_body.php';
            $rfc822_header = $att->rfc822_header;
            $filename = $rfc822_header->subject;
            if (trim($filename) == '') {
                $filename = 'untitled-[' . $ent . ']';
            }
            $from_o = $rfc822_header->from;
            if (is_object($from_o)) {
                $from_name = decodeHeader($from_o->getAddress(false));
            } else {
                $from_name = _("Unknown sender");
            }
            $description = $from_name;
        } else {
            $default_page = SM_PATH . 'src/download.php';
            if (is_object($header->disposition)) {
                $filename = $header->disposition->getProperty('filename');
                if (trim($filename) == '') {
                    $name = decodeHeader($header->disposition->getProperty('name'));
                    if (trim($name) == '') {
                        $name = $header->getParameter('name');
                        if (trim($name) == '') {
                            if (trim($header->id) == '') {
                                $filename = 'untitled-[' . $ent . ']';
                            } else {
                                $filename = 'cid: ' . $header->id;
                            }
                        } else {
                            $filename = $name;
                        }
                    } else {
                        $filename = $name;
                    }
                }
            } else {
                $filename = $header->getParameter('name');
                if (!trim($filename)) {
                    if (trim($header->id) == '') {
                        $filename = 'untitled-[' . $ent . ']';
                    } else {
                        $filename = 'cid: ' . $header->id;
                    }
                }
            }
            if ($header->description) {
                $description = decodeHeader($header->description);
            } else {
                $description = '';
            }
        }
        $display_filename = $filename;
        if (isset($passed_ent_id)) {
            $passed_ent_id_link = '&amp;passed_ent_id=' . $passed_ent_id;
        } else {
            $passed_ent_id_link = '';
        }
        $defaultlink = $default_page . "?startMessage={$startMessage}" . "&amp;passed_id={$id}&amp;mailbox={$urlMailbox}" . '&amp;ent_id=' . $ent . $passed_ent_id_link;
        if ($where && $what) {
            $defaultlink .= '&amp;where=' . urlencode($where) . '&amp;what=' . urlencode($what);
        }
        /* This executes the attachment hook with a specific MIME-type.
         * If that doesn't have results, it tries if there's a rule
         * for a more generic type.
         */
        $hookresults = do_hook("attachment {$type0}/{$type1}", $links, $startMessage, $id, $urlMailbox, $ent, $defaultlink, $display_filename, $where, $what);
        if (count($hookresults[1]) <= 1) {
            $hookresults = do_hook("attachment {$type0}/*", $links, $startMessage, $id, $urlMailbox, $ent, $defaultlink, $display_filename, $where, $what);
        }
        $links = $hookresults[1];
        $defaultlink = $hookresults[6];
        $attachments .= '<tr><td>' . '<a href="' . $defaultlink . '">' . decodeHeader($display_filename) . '</a>&nbsp;</td>' . '<td><small><b>' . show_readable_size($header->size) . '</b>&nbsp;&nbsp;</small></td>' . '<td><small>[ ' . htmlspecialchars($type0) . '/' . htmlspecialchars($type1) . ' ]&nbsp;</small></td>' . '<td><small>';
        $attachments .= '<b>' . $description . '</b>';
        $attachments .= '</small></td><td><small>&nbsp;';
        $skipspaces = 1;
        foreach ($links as $val) {
            if ($skipspaces) {
                $skipspaces = 0;
            } else {
                $attachments .= '&nbsp;&nbsp;|&nbsp;&nbsp;';
            }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:101,代码来源:mime.php

示例12: array

    $vcard_safe['url'] = '<a href="' . $vcard_safe['url'] . '" target="_blank">' . $vcard_safe['url'] . '</a>';
}
$vcard = array();
foreach ($ShowValues as $k => $v) {
    if (isset($vcard_safe[$k]) && $vcard_safe[$k]) {
        $vcard[$v] = $vcard_safe[$k];
    }
}
$dl = '../src/download.php?absolute_dl=true&amp;passed_id=' . urlencode($passed_id) . '&amp;mailbox=' . urlencode($mailbox) . '&amp;ent_id=' . urlencode($ent_id);
if (isset($vcard_nice['email;internet'])) {
    $email = $vcard_nice['email;internet'];
} else {
    $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
    $header = $message->rfc822_header;
    $from_name = $header->getAddr_s('from');
    $email = getEmail(decodeHeader($from_name));
}
$opts = array();
if (isset($vcard_nice['url'])) {
    $opts[$vcard_nice['url']] = _("Web Page");
}
if (isset($vcard_nice['adr'])) {
    $opts[$vcard_nice['adr']] = _("Address");
}
if (isset($vcard_nice['title'])) {
    $opts[$vcard_nice['title']] = _("Title");
}
if (isset($vcard_nice['org'])) {
    $opts[$vcard_nice['org']] = _("Organization / Department");
}
if (isset($vcard_nice['title'])) {
开发者ID:teammember8,项目名称:roundcube,代码行数:31,代码来源:vcard.php

示例13: showInputForm

function showInputForm($session, $values = false)
{
    global $send_to, $send_to_cc, $send_to_bcc, $body, $startMessage, $action, $attachments, $use_signature, $signature, $prefix_sig, $session_expired, $editor_size, $editor_height, $subject, $newmail, $use_javascript_addr_book, $passed_id, $mailbox, $fwduid, $from_htmladdr_search, $location_of_buttons, $attachment_dir, $username, $data_dir, $identity, $idents, $delete_draft, $mailprio, $compose_new_win, $saved_draft, $mail_sent, $sig_first, $composeMessage, $composesession, $default_charset, $compose_onsubmit, $oTemplate, $oErrorHandler;
    if (checkForJavascript()) {
        $onfocus = ' onfocus="alreadyFocused=true;"';
        $onfocus_array = array('onfocus' => 'alreadyFocused=true;');
    } else {
        $onfocus = '';
        $onfocus_array = array();
    }
    if ($values) {
        $send_to = $values['send_to'];
        $send_to_cc = $values['send_to_cc'];
        $send_to_bcc = $values['send_to_bcc'];
        $subject = $values['subject'];
        $mailprio = $values['mailprio'];
        $body = $values['body'];
        $identity = (int) $values['identity'];
    } else {
        $send_to = decodeHeader($send_to, true, false);
        $send_to_cc = decodeHeader($send_to_cc, true, false);
        $send_to_bcc = decodeHeader($send_to_bcc, true, false);
    }
    if ($use_javascript_addr_book) {
        //FIXME: NO HTML IN CORE!
        echo "\n" . '<script type="text/javascript">' . "\n<!--\n" . 'function open_abook() { ' . "\n" . '  var nwin = window.open("addrbook_popup.php","abookpopup",' . '"width=670,height=300,resizable=yes,scrollbars=yes");' . "\n" . '  if((!nwin.opener) && (document.windows != null))' . "\n" . '    nwin.opener = document.windows;' . "\n" . "}\n" . "// -->\n</script>\n\n";
    }
    //FIXME: NO HTML IN CORE!
    echo "\n" . '<form name="compose" action="compose.php" method="post" ' . 'enctype="multipart/form-data"';
    $compose_onsubmit = array();
    global $null;
    do_hook('compose_form', $null);
    // Plugins that use compose_form hook can add an array entry
    // to the globally scoped $compose_onsubmit; we add them up
    // here and format the form tag's full onsubmit handler.
    // Each plugin should use "return false" if they need to
    // stop form submission but otherwise should NOT use "return
    // true" to give other plugins the chance to do what they need
    // to do; SquirrelMail itself will add the final "return true".
    // Onsubmit text is enclosed inside of double quotes, so plugins
    // need to quote accordingly.
    //
    // Also, plugin authors should try to retain compatibility with
    // the Compose Extras plugin by resetting its compose submit
    // counter when preventing form submit.  Use this code:
    // if (your-code-here) { submit_count = 0; return false; }
    //
    if (checkForJavascript()) {
        if (empty($compose_onsubmit)) {
            $compose_onsubmit = array();
        } else {
            if (!is_array($compose_onsubmit)) {
                $compose_onsubmit = array($compose_onsubmit);
            }
        }
        $onsubmit_text = '';
        foreach ($compose_onsubmit as $text) {
            $text = trim($text);
            if (!empty($text)) {
                if (substr($text, -1) != ';' && substr($text, -1) != '}') {
                    $text .= '; ';
                }
                $onsubmit_text .= $text;
            }
        }
        if (!empty($onsubmit_text)) {
            //FIXME: DON'T ECHO HTML FROM CORE!
            echo ' onsubmit="' . $onsubmit_text . ' return true;"';
        }
    }
    //FIXME: NO HTML IN CORE!
    echo ">\n";
    //FIXME: DON'T ECHO HTML FROM CORE!
    echo addHidden('smtoken', sm_generate_security_token());
    //FIXME: DON'T ECHO HTML FROM CORE!
    echo addHidden('startMessage', $startMessage);
    if ($action == 'draft') {
        //FIXME: DON'T ECHO HTML FROM CORE!
        echo addHidden('delete_draft', $passed_id);
    }
    if (isset($delete_draft)) {
        //FIXME: DON'T ECHO HTML FROM CORE!
        echo addHidden('delete_draft', $delete_draft);
    }
    if (isset($session)) {
        //FIXME: DON'T ECHO HTML FROM CORE!
        echo addHidden('session', $session);
    }
    if (isset($passed_id)) {
        //FIXME: DON'T ECHO HTML FROM CORE!
        echo addHidden('passed_id', $passed_id);
    }
    if (isset($fwduid)) {
        //FIXME: DON'T ECHO HTML FROM CORE!
        echo addHidden('fwduid', $fwduid);
    }
    if ($saved_draft == 'yes') {
        $oTemplate->assign('note', _("Your draft has been saved."));
        $oTemplate->display('note.tpl');
    }
//.........这里部分代码省略.........
开发者ID:teammember8,项目名称:roundcube,代码行数:101,代码来源:compose.php

示例14: buildAttachmentArray

/**
 * Generate attachments array for passing to templates.
 *
 * @since 1.5.2
 * @param object $message SquirrelMail message object
 * @param array $exclude_id message parts that are not attachments.
 * @param string $mailbox mailbox name
 * @param integer $id message id
 */
function buildAttachmentArray($message, $exclude_id, $mailbox, $id)
{
    global $where, $what, $startMessage, $color, $passed_ent_id, $base_uri;
    $att_ar = $message->getAttachments($exclude_id);
    $urlMailbox = urlencode($mailbox);
    $attachments = array();
    foreach ($att_ar as $att) {
        $ent = $att->entity_id;
        $header = $att->header;
        $type0 = strtolower($header->type0);
        $type1 = strtolower($header->type1);
        $name = '';
        $links = array();
        $links['download link']['text'] = _("Download");
        $links['download link']['href'] = $base_uri . "src/download.php?absolute_dl=true&amp;passed_id={$id}&amp;mailbox={$urlMailbox}&amp;ent_id={$ent}";
        if ($type0 == 'message' && $type1 == 'rfc822') {
            $default_page = $base_uri . 'src/read_body.php';
            $rfc822_header = $att->rfc822_header;
            $filename = $rfc822_header->subject;
            if (trim($filename) == '') {
                $filename = 'untitled-[' . $ent . ']';
            }
            $from_o = $rfc822_header->from;
            if (is_object($from_o)) {
                $from_name = decodeHeader($from_o->getAddress(false));
            } elseif (is_array($from_o) && count($from_o) && is_object($from_o[0])) {
                // something weird happens when a digest message is opened and you return to the digest
                // now the from object is part of an array. Probably the parseHeader call overwrites the info
                // retrieved from the bodystructure in a different way. We need to fix this later.
                // possible starting point, do not fetch header we already have and inspect how
                // the rfc822_header object behaves.
                $from_name = decodeHeader($from_o[0]->getAddress(false));
            } else {
                $from_name = _("Unknown sender");
            }
            $description = _("From") . ': ' . $from_name;
        } else {
            $default_page = $base_uri . 'src/download.php';
            $filename = $att->getFilename();
            if ($header->description) {
                $description = decodeHeader($header->description);
            } else {
                $description = '';
            }
        }
        $display_filename = $filename;
        if (isset($passed_ent_id)) {
            $passed_ent_id_link = '&amp;passed_ent_id=' . $passed_ent_id;
        } else {
            $passed_ent_id_link = '';
        }
        $defaultlink = $default_page . "?startMessage={$startMessage}" . "&amp;passed_id={$id}&amp;mailbox={$urlMailbox}" . '&amp;ent_id=' . $ent . $passed_ent_id_link;
        if ($where && $what) {
            $defaultlink .= '&amp;where=' . urlencode($where) . '&amp;what=' . urlencode($what);
        }
        // IE does make use of mime content sniffing. Forcing a download
        // prohibit execution of XSS inside an application/octet-stream attachment
        if ($type0 == 'application' && $type1 == 'octet-stream') {
            $defaultlink .= '&amp;absolute_dl=true';
        }
        /* This executes the attachment hook with a specific MIME-type.
         * It also allows plugins to run if there's a rule for a more
         * generic type. Finally, a hook for ALL attachment types is
         * run as well.
         */
        // First remember the default link.
        $defaultlink_orig = $defaultlink;
        /* The API for this hook has changed as of 1.5.2 so that all plugin
           arguments are passed in an array instead of each their own plugin
           argument, and arguments are passed by reference, so instead of
           returning any changes, changes should simply be made to the original
           arguments themselves. */
        $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, &$defaultlink, &$display_filename, &$where, &$what);
        do_hook("attachment {$type0}/{$type1}", $temp);
        /* The API for this hook has changed as of 1.5.2 so that all plugin
           arguments are passed in an array instead of each their own plugin
           argument, and arguments are passed by reference, so instead of
           returning any changes, changes should simply be made to the original
           arguments themselves. */
        $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, &$defaultlink, &$display_filename, &$where, &$what);
        // Do not let a generic plugin change the default link if a more
        // specialized one already did it...
        if ($defaultlink != $defaultlink_orig) {
            $dummy = '';
            $temp[5] =& $dummy;
        }
        do_hook("attachment {$type0}/*", $temp);
        /* The API for this hook has changed as of 1.5.2 so that all plugin
           arguments are passed in an array instead of each their own plugin
           argument, and arguments are passed by reference, so instead of
           returning any changes, changes should simply be made to the original
//.........这里部分代码省略.........
开发者ID:teammember8,项目名称:roundcube,代码行数:101,代码来源:mime.php

示例15: formatAttachments

function formatAttachments($message, $exclude_id, $mailbox, $id)
{
    global $where, $what, $startMessage, $color, $passed_ent_id;
    static $ShownHTML = 0;
    $att_ar = $message->getAttachments($exclude_id);
    if (!count($att_ar)) {
        return '';
    }
    $attachments = '';
    $urlMailbox = urlencode($mailbox);
    foreach ($att_ar as $att) {
        $ent = $att->entity_id;
        $header = $att->header;
        $type0 = strtolower($header->type0);
        $type1 = strtolower($header->type1);
        $name = '';
        $links['download link']['text'] = _("Download");
        $links['download link']['href'] = SM_PATH . "src/download.php?absolute_dl=true&amp;passed_id={$id}&amp;mailbox={$urlMailbox}&amp;ent_id={$ent}";
        $ImageURL = '';
        if ($type0 == 'message' && $type1 == 'rfc822') {
            $default_page = SM_PATH . 'src/read_body.php';
            $rfc822_header = $att->rfc822_header;
            $filename = $rfc822_header->subject;
            if (trim($filename) == '') {
                $filename = 'untitled-[' . $ent . ']';
            }
            $from_o = $rfc822_header->from;
            if (is_object($from_o)) {
                $from_name = $from_o->getAddress(false);
            } elseif (is_array($from_o) && count($from_o) && is_object($from_o[0])) {
                // when a digest message is opened and you return to the digest
                // now the from object is part of an array. This is a workaround.
                $from_name = $from_o[0]->getAddress(false);
            } else {
                $from_name = _("Unknown sender");
            }
            $from_name = decodeHeader($from_name);
            $description = $from_name;
        } else {
            $default_page = SM_PATH . 'src/download.php';
            if (is_object($header->disposition)) {
                $filename = $header->disposition->getProperty('filename');
                if (trim($filename) == '') {
                    $name = decodeHeader($header->disposition->getProperty('name'));
                    if (trim($name) == '') {
                        $name = $header->getParameter('name');
                        if (trim($name) == '') {
                            if (trim($header->id) == '') {
                                $filename = 'untitled-[' . $ent . ']';
                            } else {
                                $filename = 'cid: ' . $header->id;
                            }
                        } else {
                            $filename = $name;
                        }
                    } else {
                        $filename = $name;
                    }
                }
            } else {
                $filename = $header->getParameter('name');
                if (!trim($filename)) {
                    if (trim($header->id) == '') {
                        $filename = 'untitled-[' . $ent . ']';
                    } else {
                        $filename = 'cid: ' . $header->id;
                    }
                }
            }
            if ($header->description) {
                $description = decodeHeader($header->description);
            } else {
                $description = '';
            }
        }
        $display_filename = $filename;
        if (isset($passed_ent_id)) {
            $passed_ent_id_link = '&amp;passed_ent_id=' . $passed_ent_id;
        } else {
            $passed_ent_id_link = '';
        }
        $defaultlink = $default_page . "?startMessage={$startMessage}" . "&amp;passed_id={$id}&amp;mailbox={$urlMailbox}" . '&amp;ent_id=' . $ent . $passed_ent_id_link;
        if ($where && $what) {
            $defaultlink .= '&amp;where=' . urlencode($where) . '&amp;what=' . urlencode($what);
        }
        // IE does make use of mime content sniffing. Forcing a download
        // prohibit execution of XSS inside an application/octet-stream attachment
        if ($type0 == 'application' && $type1 == 'octet-stream') {
            $defaultlink .= '&amp;absolute_dl=true';
        }
        /* This executes the attachment hook with a specific MIME-type.
         * If that doesn't have results, it tries if there's a rule
         * for a more generic type. Finally, a hook for ALL attachment
         * types is run as well.
         */
        $hookresults = do_hook("attachment {$type0}/{$type1}", $links, $startMessage, $id, $urlMailbox, $ent, $defaultlink, $display_filename, $where, $what);
        if (count($hookresults[1]) <= 1) {
            $hookresults = do_hook("attachment {$type0}/*", $links, $startMessage, $id, $urlMailbox, $ent, $defaultlink, $display_filename, $where, $what);
        }
        $hookresults = do_hook("attachment */*", $hookresults[1], $startMessage, $id, $urlMailbox, $ent, $hookresults[6], $display_filename, $where, $what);
//.........这里部分代码省略.........
开发者ID:jin255ff,项目名称:company_website,代码行数:101,代码来源:mime.php


注:本文中的decodeHeader函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。