Source for file view_text.php

Documentation is available at view_text.php

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

Documentation generated on Fri, 24 May 2013 04:23:16 +0200 by phpDocumentor 1.4.3