Source for file view_text.php

Documentation is available at view_text.php

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

Documentation generated on Mon, 13 Jan 2020 04:23:45 +0100 by phpDocumentor 1.4.3