[Hastymail-cvs] SF.net SVN: hastymail:[592] trunk/hastymail2/lib
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2008-11-14 04:35:44
|
Revision: 592 http://hastymail.svn.sourceforge.net/hastymail/?rev=592&view=rev Author: sailfrog Date: 2008-11-14 04:35:42 +0000 (Fri, 14 Nov 2008) Log Message: ----------- The latest removal of some htmlentities and htmlspecialchars calls fixed some problems with non-ascii characters, but caused w3c validation problems. Now pages are passing as valid xhtml transitional. Modified Paths: -------------- trunk/hastymail2/lib/site_page_class.php trunk/hastymail2/lib/utility_classes.php Modified: trunk/hastymail2/lib/site_page_class.php =================================================================== --- trunk/hastymail2/lib/site_page_class.php 2008-11-14 03:06:18 UTC (rev 591) +++ trunk/hastymail2/lib/site_page_class.php 2008-11-14 04:35:42 UTC (rev 592) @@ -95,7 +95,7 @@ $data .= 'var do_new_page_refresh = 0;'; } if ($this->pd['settings']['dropdown_ajax']) { - $data .= 'var do_folder_dropdown = \''.$this->pd['mailbox'].'\';'; + $data .= 'var do_folder_dropdown = \''.$this->user->user_action->hm_htmlentities($this->pd['mailbox']).'\';'; } else { $data .= 'var do_folder_dropdown = 0;'; @@ -223,7 +223,7 @@ if (!isset($this->pd['settings']['mailbox_freeze']) || !$this->pd['settings']['mailbox_freeze']) { return; } - $data = '<complex-'.$page_id.'><form method="post" action=""><input type="hidden" name="mailbox" value="'.urlencode($this->pd['mailbox']).'" /> + $data = '<complex-'.$page_id.'><form method="post" action=""><input type="hidden" name="mailbox" value="'.$this->user->htmlsafe($this->pd['mailbox']).'" />  '; if (isset($this->pd['frozen_folders'][$this->pd['mailbox']])) { $data .= '<input type="submit" name="unfreeze_mailbox" value="'.$this->user->str[30].'" />'; @@ -646,8 +646,7 @@ $data .= '<form method="post" action="">'; $data .= '<input type="hidden" name="uid" value="'.$this->pd['message_uid'].'" />'; $data .= '<input type="hidden" name="prev_uid" value="'.$this->pd['previous_uid'].'" />'; - $data .= '<input type="hidden" name="mailbox" value="'.$this->pd['mailbox'].'" />'; - $data .= '<input type="hidden" name="mailbox" value="'.$this->pd['mailbox'].'" />'; + $data .= '<input type="hidden" name="mailbox" value="'.$this->user->htmlsafe($this->pd['mailbox']).'" />'; $data .= '<input type="hidden" name="next_uid" value="'.$this->pd['next_uid'].'" />'; $data .= '<input type="hidden" name="sort_by" value="'.$this->pd['sort_by'].'" />'; $data .= '<input type="hidden" name="filter_by" value="'.$this->pd['filter_by'].'" />'; Modified: trunk/hastymail2/lib/utility_classes.php =================================================================== --- trunk/hastymail2/lib/utility_classes.php 2008-11-14 03:06:18 UTC (rev 591) +++ trunk/hastymail2/lib/utility_classes.php 2008-11-14 04:35:42 UTC (rev 592) @@ -262,9 +262,14 @@ } return $this->utf8_to_html(filter_html($string, $tags)); } + function hm_htmlentities($string) { + $chars = array('<', '>', '& ', '"', "'" ); + $ents = array('<', '>', '& ', '"', '''); + return str_replace($chars, $ents, $string); + } function html_safe($string) { //return $this->utf8_to_html(str_replace(array('<', '>'), array('<', '>'), htmlentities($string, ENT_QUOTES, 'UTF-8'))); - return $this->utf8_to_html(str_replace(array('<', '>'), array('<', '>'), $string)); + return $this->utf8_to_html($this->hm_htmlentities($string)); } function is_utf($string) { return preg_match('%(?: @@ -1152,16 +1157,16 @@ if ($decode) { //$string = htmlentities($this->decode_fld($string, $charset), false, 'UTF-8'); $string = $this->decode_fld($string, $charset); - $string = $this->user_action->utf8_to_html(str_replace(array('<', '>'), array('<', '>'), ($string))); + $string = $this->user_action->utf8_to_html($this->user_action->hm_htmlentities($string)); } elseif ($charset && $charset != 'us-ascii') { list ($entities, $string) = $this->user_action->utf8_convert($string, $charset, $interface_str); if ($entities) { - $string = $this->user_action->utf8_to_html(str_replace(array('<', '>'), array('<', '>'), $string)); + $string = $this->user_action->utf8_to_html($this->user_action->hm_htmlentities($string)); } else { //$string = $this->user_action->utf8_to_html(str_replace(array('<', '>'), array('<', '>'), (htmlspecialchars($string, false, 'UTF-8')))); - $string = $this->user_action->utf8_to_html(str_replace(array('<', '>'), array('<', '>'), ($string))); + $string = $this->user_action->utf8_to_html($this->user_action->hm_htmlentities($string)); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |