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 &copy; 1999-2006 The SquirrelMail Project Team
  11.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  12.  * @version $Id: view_text.php,v 1.17.2.11 2006/09/29 08:48:50 kink Exp $
  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);
  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. $message &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
  52. $message_ent $message->getEntity($ent_id);
  53. if ($passed_ent_id{
  54.     $message &$message->getEntity($passed_ent_id);
  55. }
  56. $header   $message_ent->header;
  57. $type0    $header->type0;
  58. $type1    $header->type1;
  59. $charset  $header->getParameter('charset');
  60. $encoding strtolower($header->encoding);
  61.  
  62. $msg_url   'read_body.php?' $QUERY_STRING;
  63. $msg_url   set_url_var($msg_url'ent_id'0);
  64. $dwnld_url '../src/download.php?' $QUERY_STRING '&amp;absolute_dl=true';
  65. $unsafe_url 'view_text.php?' $QUERY_STRING;
  66. $unsafe_url set_url_var($unsafe_url'view_unsafe_images'1);
  67.  
  68. $body mime_fetch_body($imapConnection$passed_id$ent_id);
  69. $body decodeBody($body$encoding);
  70.  
  71. if (isset($languages[$squirrelmail_language]['XTRA_CODE']&&
  72.     function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
  73.     if (mb_detect_encoding($body!= 'ASCII'{
  74.         $body $languages[$squirrelmail_language]['XTRA_CODE']('decode'$body);
  75.     }
  76. }
  77.  
  78. if ($type1 == 'html' || (isset($override_type1&&  $override_type1 == 'html')) {
  79.     $ishtml TRUE;
  80.     $body MagicHTML$body$passed_id$message$mailbox);
  81.     // html attachment with character set information
  82.         if (empty($charset))
  83.         $body charset_decode($charset,$body,false,true);
  84. else {
  85.     $ishtml FALSE;
  86.     translateText($body$wrap_at$charset);
  87. }
  88.  
  89. displayPageHeader($color'None');
  90. ?>
  91. <br /><table width="100%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php echo $color[0]?>">
  92. <b><center>
  93. <?php
  94. echo _("Viewing a text attachment"' - ' .
  95.     '<a href="'.$msg_url.'">' _("View message"'</a>';
  96. ?>
  97. </b></td><tr><tr><td><center>
  98. <?php
  99. if $ishtml {
  100.     echo '<a href="' $unsafe_url '">' _("View Unsafe Images"'</a> | ';
  101. }
  102. echo '<a href="' $dwnld_url '">' _("Download this as a file"'</a>';
  103. ?>
  104. </center><br />
  105. </center></b>
  106. </td></tr></table>
  107. <table width="98%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php echo $color[0]?>">
  108. <tr><td bgcolor="<?php echo $color[4]?>"><tt>
  109. <?php echo $body?>
  110. </tt></td></tr></table>
  111. </body></html>

Documentation generated on Sat, 07 Oct 2006 16:34:05 +0300 by phpDocumentor 1.3.0RC6