Source for file view_text.php

Documentation is available at view_text.php

  1. <?php
  2. /**
  3. * view_text.php -- Displays the main frameset
  4. *
  5. * Who knows what this file does. Whoever PUT IT HERE DID NOT PUT
  6. * A SINGLE FREAKING COMMENT IN! Whoever is responsible for this,
  7. * be very ashamed.
  8. *
  9. * @copyright 1999-2020 The SquirrelMail Project Team
  10. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11. * @version $Id: view_text.php 14840 2020年01月07日 07:42:38Z pdontthink $
  12. * @package squirrelmail
  13. */
  14. /** This is the view_text page */
  15. define ('PAGE_NAME', 'view_text');
  16. /**
  17. * Path for SquirrelMail required files.
  18. * @ignore
  19. */
  20. define ('SM_PATH','../');
  21. /* SquirrelMail required files. */
  22. require_once(SM_PATH . 'include/validate.php');
  23. require_once(SM_PATH . 'functions/global.php');
  24. require_once(SM_PATH . 'functions/imap.php');
  25. require_once(SM_PATH . 'functions/mime.php');
  26. require_once(SM_PATH . 'functions/html.php');
  27. sqgetGlobalVar ('key', $key, SQ_COOKIE );
  28. sqgetGlobalVar ('username', $username, SQ_SESSION );
  29. sqgetGlobalVar ('onetimepad', $onetimepad, SQ_SESSION );
  30. sqgetGlobalVar ('delimiter', $delimiter, SQ_SESSION );
  31. sqgetGlobalVar ('QUERY_STRING', $QUERY_STRING, SQ_SERVER );
  32. sqgetGlobalVar ('messages', $messages, SQ_SESSION );
  33. sqgetGlobalVar ('passed_id', $passed_id, SQ_GET );
  34. if ( sqgetGlobalVar ('mailbox', $temp, SQ_GET ) ) {
  35. $mailbox = $temp;
  36. }
  37. if ( !sqgetGlobalVar ('ent_id', $ent_id, SQ_GET ) ) {
  38. $ent_id = '';
  39. }
  40. if ( !sqgetGlobalVar ('passed_ent_id', $passed_ent_id, SQ_GET ) ) {
  41. $passed_ent_id = '';
  42. }
  43. global $imap_stream_options; // in case not defined in config
  44. $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
  45. $mbx_response = sqimap_mailbox_select ($imapConnection, $mailbox);
  46. // were we using a reference here just to save memory?
  47. // problem is that below if $passed_ent_id is given,
  48. // the message cache now points to that entity and not
  49. // the original message (corrupts the cache)
  50. //
  51. //$message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
  52. //
  53. $message = $messages[$mbx_response['UIDVALIDITY']][$passed_id];
  54. $message_ent = $message->getEntity ($ent_id);
  55. if ($passed_ent_id) {
  56. $message = &$message->getEntity ($passed_ent_id);
  57. }
  58. $header = $message_ent->header ;
  59. $type0 = $header->type0;
  60. $type1 = $header->type1;
  61. $charset = $header->getParameter('charset');
  62. $encoding = strtolower ($header->encoding);
  63. $msg_url = 'read_body.php?' . $QUERY_STRING;
  64. $msg_url = set_url_var ($msg_url, 'ent_id', 0);
  65. $dwnld_url = '../src/download.php?' . $QUERY_STRING . '&amp;absolute_dl=true';
  66. $unsafe_url = 'view_text.php?' . $QUERY_STRING;
  67. $unsafe_url = set_url_var ($unsafe_url, 'view_unsafe_images', 1);
  68. $body = mime_fetch_body ($imapConnection, $passed_id, $ent_id);
  69. $body = decodeBody ($body, $encoding);
  70. if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
  71. function_exists ($languages[$squirrelmail_language]['XTRA_CODE'])) {
  72. if (mb_detect_encoding ($body) != 'ASCII') {
  73. $body = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $body);
  74. }
  75. }
  76. if ($type1 == 'html' || (isset($override_type1) && $override_type1 == 'html')) {
  77. $ishtml = TRUE;
  78. // html attachment with character set information
  79. if (! empty($charset))
  80. $body = charset_decode ($charset,$body,false,true);
  81. $body = magicHTML ( $body, $passed_id, $message, $mailbox);
  82. } else {
  83. $ishtml = FALSE;
  84. translateText ($body, $wrap_at, $charset);
  85. }
  86. displayPageHeader ($color, 'None');
  87. ?>
  88. <br /><table width="100%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php echo $color[0]; ?>">
  89. <b><center>
  90. <?php
  91. echo _ ("Viewing a text attachment") . ' - ' .
  92. '<a href="'.$msg_url.'">' . _ ("View message") . '</a>';
  93. ?>
  94. </b></td><tr><tr><td><center>
  95. <?php
  96. if ( $ishtml ) {
  97. echo '<a href="' . $unsafe_url . '" style="white-space: nowrap;">' . _ ("View Unsafe Images") . '</a>&nbsp;| ';
  98. }
  99. echo '<a href="' . $dwnld_url . '" style="white-space: nowrap;">' . _ ("Download this as a file") . '</a>';
  100. ?>
  101. </center><br />
  102. </center></b>
  103. </td></tr></table>
  104. <table width="98%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php echo $color[0]; ?>">
  105. <tr><td bgcolor="<?php echo $color[4]; ?>"><tt>
  106. <?php echo $body; ?>
  107. </tt></td></tr></table>
  108. </body></html>

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

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