X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplatalpage.php;h=d96d41598b30a5768504056bb5c38c201e90f877;hb=06db561e25dcd609e824d1461fd2814d1e46d807;hp=ab830665982f105feb8606419168b5383a1cd41f;hpb=2456ea61eabd3791d810516c615afa0ad967b86c;p=platal.git diff --git a/classes/platalpage.php b/classes/platalpage.php index ab83066..d96d415 100644 --- a/classes/platalpage.php +++ b/classes/platalpage.php @@ -55,6 +55,7 @@ class PlatalPage extends Smarty $this->register_prefilter('at_to_globals'); $this->register_prefilter('trimwhitespace'); + $this->register_prefilter('form_force_encodings'); $this->addJsLink('xorg.js'); } @@ -96,6 +97,7 @@ class PlatalPage extends Smarty } $this->register_outputfilter('hide_emails'); $this->addJsLink('wiki.js'); + header("Accept-Charset: iso-8859-15, latin9, us-ascii, ascii"); if (!$globals->debug) { error_reporting(0); @@ -262,10 +264,21 @@ function trimwhitespace($source, &$smarty) } // }}} +// {{{ + +function form_force_encodings($source, &$smarty) +{ + return preg_replace('/Nix.decode("' . addslashes(str_rot13($source)) . '");'; } @@ -284,8 +297,8 @@ function hide_emails($source, &$smarty) $source = preg_replace("!]+href=[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?!is", '&&&ahref&&&', $source); //prevant replacement in tag attributes - preg_match_all("!<[^>]+[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>!is", $source, $misc); - $source = preg_replace("!<[^>]+[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>!is", '&&&misc&&&', $source); + preg_match_all("!<[^>]+[-a-z0-9_.]+@[-a-z0-9_.]+[^>]+>!is", $source, $misc); + $source = preg_replace("!<[^>]+[-a-z0-9_.]+@[-a-z0-9_.]+[^>]+>!is", '&&&misc&&&', $source); //catch ! $source = preg_replace('!([-a-z0-9_.]+@[-a-z0-9_.]+)!ie', '_hide_email("\1")', $source);