view_as_html/0000755000175000017500000000000011136672426015133 5ustar sethrandallsethrandallview_as_html/view_as_html.php0000644000175000017500000000701511136671272020326 0ustar sethrandallsethrandallrfc822_header->content_type->type0 == 'text' && $message->rfc822_header->content_type->type1 == 'html') { $message->header->type0 = 'text'; $message->header->type1 = 'html'; $message->type0 = 'text'; $message->type1 = 'html'; if (count($message->rfc822_header->content_type->properties) > 0) { $message->header->parameters = $message->rfc822_header->content_type->properties; } } } function view_as_html_link() { global $message, $show_html_default, $sort; $vars = array('passed_ent_id', 'show_more', 'override_type0', 'override_type1', 'where', 'what'); sqgetGlobalVar('mailbox', $mailbox); sqgetGlobalVar('passed_id', $passed_id); sqgetGlobalVar('startMessage', $startMessage); sqgetGlobalVar('view_as_html', $view_as_html); $startMessage = (int)$startMessage; $passed_id = (int)$passed_id; $view_as_html = (int)$view_as_html; $new_link = "read_body.php?passed_id=$passed_id&startMessage=$startMessage" . "&mailbox=" . urlencode($mailbox); foreach($vars as $var) { if(sqgetGlobalVar($var, $$var)) { $new_link .= '&' . $var . '=' . urlencode($$var); } } $has_html = 0; if ($message->header->type0 == 'message' && $message->header->type1 == 'rfc822') { $type0 = $message->rfc822_header->content_type->type0; $type1 = $message->rfc822_header->content_type->type1; } else { $type0 = $message->header->type0; $type1 = $message->header->type1; } if($type0 == 'multipart' && ($type1 == 'alternative' || $type1 == 'mixed' || $type1 == 'related')) { if ($message->findDisplayEntity(array(), array('text/html'), true)) { $has_html = 1; } } /* * Normal single part message so check its type. */ else { if($type0 == 'text' && $type1 == 'html') { $has_html = 1; } } if ($has_html == 1) { sq_change_text_domain('view_as_html'); $link = ' | '; if($show_html_default == 1) { $link .= ''; $link .= _("View as plain text"); } else { $link .= ''; $link .= _("View as HTML"); } echo $link . "\n"; sq_change_text_domain('squirrelmail'); } } view_as_html/version0000644000175000017500000000002111136670113016523 0ustar sethrandallsethrandallView as HTML 3.8 view_as_html/INSTALL0000644000175000017500000000133510773534620016165 0ustar sethrandallsethrandallInstalling View as HTML ======================= 1) Start with untaring the file into the plugins directory. Here is a example for the 3.8 version of the view_as_html plugin. $ cd plugins $ tar -xzvf view_as_html-3.8-1.4.10.tar.gz 2) Then go to your config directory and run conf.pl. Choose option 8 and move the plugin from the "Available Plugins" category to the "Installed Plugins" category. Save and exit. $ cd ../../config/ $ ./conf.pl 3) Translations are not included in this package. To get a translation, download the language pack needed from: http://www.squirrelmail.org/download.php Upgrading View as HTML ====================== 1) Follow the instructions under Installing View as HTML view_as_html/ChangeLog0000644000175000017500000001166211136672425016712 0ustar sethrandallsethrandall$Id: ChangeLog,v 1.25 2009/01/24 20:07:49 indiri69 Exp $ * Sat Jan 24 2009 Seth E. Randall - Handles emails with Content-Type: charset without a Mime-Version header (#1758486) - Removed translations as they are part of the Squirrelmail locales now * Sat Mar 29 2008 Seth E. Randall - Updated to SM Plugin standards - Added INSTALL file * Sat Mar 04 2006 Seth E. Randall - Added Dutch (nl_NL) translation from "Bram Mol" - Changed version number to 3.7a-1.4.x * Tue Feb 28 2006 Seth E. Randall - Fix link so it doesn't forget that it was part of a search result - Changed email addresses to sf.net - Changed version number to 3.7-1.4.x * Mon Jun 13 2005 Seth E. Randall - Added XSS fix - Changed version number to 3.6-1.4.x * Thu Feb 12 2004 Seth E. Randall - Added Japanese (ja_JP) translation from "Kosaku Nagasaka" - Copied the no_NO translation to nb_NO. We'll keep the old one for a while for backwards compatability. - Changed version number to 3.5a-1.4.x * Wed Jan 14 2004 Seth E. Randall - Added Italian (it_IT) translation from "Nico" * Thu Dec 18 2003 Seth E. Randall - Minor updates to some translations - Changed version number to 3.5-1.4.x * Wed Dec 17 2003 Seth E. Randall - Added French (fr_FR) translation from "Ludovic Marcotte" * Mon Oct 20 2003 Seth E. Randall - Added Catalan (ca_ES) translation from "Marc Revenga" * Tue Oct 14 2003 Seth E. Randall - Encode mailbox URL (thanks to Anders Wennerberg) - Check for more variables to pass through GET - Better handling of HTML documents inside message/rfc822 attachments - Changed version number to 3.4-1.4.x * Fri Oct 3 2003 Ruben Leote Mendes - Added Portuguese (pt_PT) translation * Thu Oct 2 2003 Seth E. Randall - Added Polish (pl_PL) translation from "Sebastian Turzynski" * Fri Sep 25 2003 Seth E. Randall - Added version support to setup.php - Added version file * Thu Sep 25 2003 Seth E. Randall - Added Spanish (es_ES) translation from "grana canal10" * Wed Jun 04 2003 Seth E. Randall - Handles emails with Content-Type: text/html without a Mime-Version header * Tue Apr 08 2003 Seth E. Randall - Now works properly with "Show HTML Version by Default" set * Mon Feb 24 2003 Seth E. Randall - Added Swedish (sv_SE) translation from "Fredrik Nilsson" * Tue Feb 18 2003 Seth E. Randall - Moved functions out of setup.php for faster loading * Mon Jan 13 2003 Seth E. Randall - Cleaned up support for latest devel series * Fri Nov 01 2002 Seth E. Randall - Added view_unsafe_images support - Added Turkish (tr_TR) translation from "Kerem Erkan" * Thu Sep 26 2002 Seth E. Randall - Added support for rg=0 * Fri Jun 21 2002 Seth E. Randall - Added Indonesian (id_ID) translation from "Arief S Fitrianto" * Wed Jun 19 2002 Seth E. Randall - Added Hebrew (he_HE) translation from "yoav" - Added Danish (da_DK) translation from "Bjarke Sørensen" - Added Czech (cs_CZ) translation from "Ivo Panacek" - Added Norwegian (no_NO) translation from "Bjarke Sørensen" after "Gustav Foseid" pointed out that it's the same as the Danish one. - Added German (de_DE) translation from "Sebastian Gingter" * Tue Jun 18 2002 Seth E. Randall - Added Lithuanian (lt_LT) translation from "Tomas Kuliavas" * Thu Jun 13 2002 Seth E. Randall - Added support for Display Unsafe Images * Mon Mar 25 2002 Seth E. Randall - Fixed interaction with Delete/Move/Next that could delete other messages * Fri Feb 22 2002 Seth E. Randall - Added support for multitype/mixed and multitype/related. - Requires SquirrelMail >= 1.2.5 for multipart/mixed. * Sun Jan 20 2002 Seth E. Randall - Added support for type text/html * Wed Jan 16 2002 Seth E. Randall - Changed to only show link when there is an alternate part * Sat Dec 01 2001 Seth E. Randall - Fixed problem where plugin ignored the user's preferences * Fri Oct 26 2001 Seth E. Randall - initial release view_as_html/setup.php0000644000175000017500000000350311136671272017003 0ustar sethrandallsethrandall * * Code for displaying link only when an HTML part exists * Ben Brillat and Pete Walker * * $Id: setup.php,v 1.11 2009/01/24 19:57:46 indiri69 Exp $ */ function squirrelmail_plugin_init_view_as_html() { global $squirrelmail_plugin_hooks; $squirrelmail_plugin_hooks['read_body_top']['view_as_html'] = 'view_as_html_read_body_top'; $squirrelmail_plugin_hooks['read_body_header_right']['view_as_html'] = 'view_as_html_read_body_header_right'; } function view_as_html_info() { return array( 'english_name' => 'View as HTML', 'authors' => array( 'Seth Randall' => array( 'email' => 'indiri69@users.sourceforge.net', 'sm_site_username' => 'randall', ), ), 'version' => '3.8', 'required_sm_version' => '1.4.10', 'requires_configuration' => 0, 'requires_source_patch' => 0, 'required_plugins' => array(), 'per_version_requirements' => array(), 'summary' => 'Switch between HTML and plain text version of emails.', 'details' => 'This plugin provides a link on the message viewing page that switches between the HTML view and the plain text view of an email.' ); } function view_as_html_version() { $info = view_as_html_info(); return $info['version']; } function view_as_html_read_body_top() { include_once(SM_PATH . 'plugins/view_as_html/view_as_html.php'); view_as_html_set(); } function view_as_html_read_body_header_right() { include_once(SM_PATH . 'plugins/view_as_html/view_as_html.php'); view_as_html_link(); } view_as_html/index.php0000644000175000017500000000050510773530447016755 0ustar sethrandallsethrandall Description =========== Allows the user to chose on an individual basis whether or not to view HTML email as HTML or plain text. If you have the option to view HTML set you can view the current email as plain text instead. Thanks ====== Thanks to Ben Brillat since I modified the README from the delete_move_next plugin and for code and ideas to show the link only when there is an HTML part. Thanks to Pete Walker for code and ideas to show the link only when there is a HTML part. Copyright ========= Copyright (C) 2001-2009 Seth E. Randall This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program ("gpl.txt"); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Contact ======= Let me know what you think: Seth Randall