| | |
| | | //$this->assertNoPattern('/<style [^>]+>/', $html, "No style tags allowed"); |
| | | $this->assertNoPattern('/<form [^>]+>/', $html, "No form tags allowed"); |
| | | $this->assertPattern('/Subscription form/', $html, "Include <form> contents"); |
| | | $this->assertPattern('/<!-- input ignored -->/', $html, "No input elements allowed"); |
| | | $this->assertPattern('/<!-- link ignored -->/', $html, "No external links allowed"); |
| | | $this->assertPattern('/<a[^>]+ target="_blank">/', $html, "Set target to _blank"); |
| | | $this->assertTrue($GLOBALS['REMOTE_OBJECTS'], "Remote object detected"); |
| | |
| | | |
| | | $this->assertNoPattern('/alert|expression|javascript|xss/', $washed, "Remove evil style blocks"); |
| | | $this->assertNoPattern('/font-style:italic/', $washed, "Allow valid styles"); |
| | | } |
| | | |
| | | /** |
| | | * Test washtml class on non-unicode characters (#1487813) |
| | | */ |
| | | function test_washtml_utf8() |
| | | { |
| | | $part = $this->get_html_part('src/invalidchars.html'); |
| | | $washed = rcmail_print_body($part); |
| | | |
| | | $this->assertPattern('/<p>символ<\/p>/', $washed, "Remove non-unicode characters from HTML message body"); |
| | | } |
| | | |
| | | /** |
| | |
| | | $this->assertNoPattern('|<p>test2</p>|', $washed, "Conditional HTML comments"); |
| | | } |
| | | |
| | | /** |
| | | * Test URI base resolving in HTML messages |
| | | */ |
| | | function test_resolve_base() |
| | | { |
| | | $html = file_get_contents(TESTS_DIR . 'src/htmlbase.txt'); |
| | | $html = rcmail_resolve_base($html); |
| | | |
| | | $this->assertPattern('|src="http://alec\.pl/dir/img1\.gif"|', $html, "URI base resolving [1]"); |
| | | $this->assertPattern('|src="http://alec\.pl/dir/img2\.gif"|', $html, "URI base resolving [2]"); |
| | | $this->assertPattern('|src="http://alec\.pl/img3\.gif"|', $html, "URI base resolving [3]"); |
| | | } |
| | | } |