Source for file view_text.php

Documentation is available at view_text.php

  1. <?php
  2. /**
  3. * view_text.php -- View a text attachment
  4. *
  5. * Used by attachment_common code.
  6. *
  7. * @copyright 1999-2020 The SquirrelMail Project Team
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @version $Id: view_text.php 14845 2020年01月07日 08:09:34Z pdontthink $
  10. * @package squirrelmail
  11. */
  12. /** This is the view_text page */
  13. define ('PAGE_NAME', 'view_text');
  14. /** SquirrelMail required files. */
  15. include('../include/init.php');
  16. include(SM_PATH . 'functions/imap_general.php');
  17. include(SM_PATH . 'functions/imap_messages.php');
  18. include(SM_PATH . 'functions/mime.php');
  19. include(SM_PATH . 'functions/date.php');
  20. include(SM_PATH . 'functions/url_parser.php');
  21. sqgetGlobalVar ('messages', $messages, SQ_SESSION );
  22. sqgetGlobalVar ('mailbox', $mailbox, SQ_GET );
  23. sqgetGlobalVar ('ent_id', $ent_id, SQ_GET );
  24. sqgetGlobalVar ('passed_ent_id', $passed_ent_id, SQ_GET );
  25. sqgetGlobalVar ('QUERY_STRING', $QUERY_STRING, SQ_SERVER );
  26. sqgetGlobalVar ('passed_id', $passed_id, SQ_GET , NULL, SQ_TYPE_BIGINT );
  27. global $imap_stream_options; // in case not defined in config
  28. $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
  29. $mbx_response = sqimap_mailbox_select ($imapConnection, $mailbox);
  30. $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
  31. if (!is_object ($message)) {
  32. $message = sqimap_get_message ($imapConnection, $passed_id, $mailbox);
  33. }
  34. $message_ent = $message->getEntity ($ent_id);
  35. if ($passed_ent_id) {
  36. $message = &$message->getEntity ($passed_ent_id);
  37. }
  38. $header = $message_ent->header ;
  39. $type0 = $header->type0;
  40. $type1 = $header->type1;
  41. $charset = $header->getParameter('charset');
  42. $encoding = strtolower ($header->encoding);
  43. $msg_url = 'read_body.php?' . $QUERY_STRING;
  44. $msg_url = set_url_var ($msg_url, 'ent_id', 0);
  45. $dwnld_url = '../src/download.php?' . $QUERY_STRING . '&amp;absolute_dl=true';
  46. $unsafe_url = 'view_text.php?' . $QUERY_STRING;
  47. $unsafe_url = set_url_var ($unsafe_url, 'view_unsafe_images', 1);
  48. $body = mime_fetch_body ($imapConnection, $passed_id, $ent_id);
  49. $body = decodeBody ($body, $encoding);
  50. do_hook ('message_body', $body);
  51. if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
  52. function_exists ($languages[$squirrelmail_language]['XTRA_CODE'].'_decode')) {
  53. if (mb_detect_encoding ($body) != 'ASCII') {
  54. $body = call_user_func ($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode', $body);
  55. }
  56. }
  57. if ($type1 == 'html' || (isset($override_type1) && $override_type1 == 'html')) {
  58. $ishtml = TRUE;
  59. // html attachment with character set information
  60. if (! empty($charset)) {
  61. $body = charset_decode ($charset,$body,false,true);
  62. }
  63. $body = MagicHTML( $body, $passed_id, $message, $mailbox);
  64. } else {
  65. $ishtml = FALSE;
  66. translateText ($body, $wrap_at, $charset);
  67. }
  68. $oTemplate->assign('view_message_href', $msg_url);
  69. $oTemplate->assign('download_href', $dwnld_url);
  70. $oTemplate->assign('view_unsafe_image_href', $ishtml ? $unsafe_url : '');
  71. $oTemplate->assign('body', $body);
  72. $oTemplate->display('view_text.tpl');
  73. $oTemplate->display('footer.tpl');

Documentation generated on 2020年1月13日 04:23:45 +0100 by phpDocumentor 1.4.3

AltStyle によって変換されたページ (->オリジナル) /