summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-04-13 12:25:46 +0000
committerthomascube <thomas@roundcube.net>2012-04-13 12:25:46 +0000
commit9456eacbec25fac99d0b13f574aa45575a44b27b (patch)
treec7e595510be50e781c94a1195c898a2cde95078e
parentd5520d1f47cd66387eccd1b9c5c4751cb9a8ba9a (diff)
cleanup release branch; update versions
-rw-r--r--README8
-rwxr-xr-xbin/dumpschema.sh101
-rwxr-xr-xbin/makedoc.sh25
-rw-r--r--index.php2
-rw-r--r--program/include/iniset.php2
-rw-r--r--tests/html_to_text.php61
-rw-r--r--tests/maildecode.php130
-rw-r--r--tests/mailfunc.php173
-rw-r--r--tests/modcss.php45
-rwxr-xr-xtests/runtests.sh57
-rw-r--r--tests/src/BID-26800.txt53
-rw-r--r--tests/src/apple.vcf49
-rw-r--r--tests/src/htmlbase.txt12
-rw-r--r--tests/src/htmlbody.txt51
-rw-r--r--tests/src/htmlcom.txt16
-rw-r--r--tests/src/htmlxss.txt22
-rw-r--r--tests/src/invalidchars.html1
-rw-r--r--tests/src/johndoe.vcf11
-rw-r--r--tests/src/mailto.txt8
-rw-r--r--tests/src/plainbody.txt38
-rw-r--r--tests/src/thebat.vcf8
-rwxr-xr-xtests/src/utf-16_sample.vcfbin460 -> 0 bytes
-rw-r--r--tests/src/valid.css30
-rw-r--r--tests/vcards.php65
24 files changed, 2 insertions, 966 deletions
diff --git a/README b/README
index 105f2557c..818ccdba5 100644
--- a/README
+++ b/README
@@ -1,14 +1,6 @@
Roundcube Webmail (http://roundcube.net)
-ATTENTION
----------
-This is just a snapshot of the current SVN repository and is NOT A STABLE
-version of Roundcube. It's not recommended to replace an existing installation
-of Roundcube with this version. Also using a separate database for this
-installation is highly recommended.
-
-
INTRODUCTION
------------
Roundcube Webmail is a browser-based multilingual IMAP client with an
diff --git a/bin/dumpschema.sh b/bin/dumpschema.sh
deleted file mode 100755
index e44b292a8..000000000
--- a/bin/dumpschema.sh
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env php
-<?php
-/*
-
- +-----------------------------------------------------------------------+
- | bin/dumpschema.sh |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
- | |
- | Licensed under the GNU General Public License version 3 or |
- | any later version with exceptions for skins & plugins. |
- | See the README file for a full license statement. |
- | |
- | PURPOSE: |
- | Dumps database schema in XML format using MDB2_Schema |
- | |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-
- $Id$
-
-*/
-
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
-
-require INSTALL_PATH.'program/include/clisetup.php';
-
-/** callback function for schema dump **/
-function print_schema($dump)
-{
- foreach ((array)$dump as $part)
- echo $dump . "\n";
-}
-
-$config = new rcube_config();
-
-// don't allow public access if not in devel_mode
-if (!$config->get('devel_mode') && $_SERVER['REMOTE_ADDR']) {
- header("HTTP/1.0 401 Access denied");
- die("Access denied!");
-}
-
-$options = array(
- 'use_transactions' => false,
- 'log_line_break' => "\n",
- 'idxname_format' => '%s',
- 'debug' => false,
- 'quote_identifier' => true,
- 'force_defaults' => false,
- 'portability' => false,
-);
-
-$dsnw = $config->get('db_dsnw');
-$dsn_array = MDB2::parseDSN($dsnw);
-
-// set options for postgres databases
-if ($dsn_array['phptype'] == 'pgsql') {
- $options['disable_smart_seqname'] = true;
- $options['seqname_format'] = '%s';
-}
-
-$schema =& MDB2_Schema::factory($dsnw, $options);
-$schema->db->supported['transactions'] = false;
-
-
-// send as text/xml when opened in browser
-if ($_SERVER['REMOTE_ADDR'])
- header('Content-Type: text/xml');
-
-
-if (PEAR::isError($schema)) {
- $error = $schema->getMessage() . ' ' . $schema->getUserInfo();
-}
-else {
- $dump_config = array(
- // 'output_mode' => 'file',
- 'output' => 'print_schema',
- );
-
- $definition = $schema->getDefinitionFromDatabase();
- $definition['charset'] = 'utf8';
-
- if (PEAR::isError($definition)) {
- $error = $definition->getMessage() . ' ' . $definition->getUserInfo();
- }
- else {
- $operation = $schema->dumpDatabase($definition, $dump_config, MDB2_SCHEMA_DUMP_STRUCTURE);
- if (PEAR::isError($operation)) {
- $error = $operation->getMessage() . ' ' . $operation->getUserInfo();
- }
- }
-}
-
-$schema->disconnect();
-
-if ($error && !$_SERVER['REMOTE_ADDR'])
- fputs(STDERR, $error);
-
-?>
diff --git a/bin/makedoc.sh b/bin/makedoc.sh
deleted file mode 100755
index 40c75bf47..000000000
--- a/bin/makedoc.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-TITLE="Roundcube Classes"
-PACKAGES="Core"
-
-INSTALL_PATH="`dirname $0`/.."
-PATH_PROJECT=$INSTALL_PATH/program/include
-PATH_DOCS=$INSTALL_PATH/doc/phpdoc
-BIN_PHPDOC="`/usr/bin/which phpdoc`"
-
-if [ ! -x "$BIN_PHPDOC" ]
-then
- echo "phpdoc not found: $BIN_PHPDOC"
- exit 1
-fi
-
-OUTPUTFORMAT=HTML
-CONVERTER=frames
-TEMPLATE=earthli
-PRIVATE=off
-
-# make documentation
-$BIN_PHPDOC -d $PATH_PROJECT -t $PATH_DOCS -ti "$TITLE" -dn $PACKAGES \
--o $OUTPUTFORMAT:$CONVERTER:$TEMPLATE -pp $PRIVATE
-
diff --git a/index.php b/index.php
index beed3881d..41f62bb8a 100644
--- a/index.php
+++ b/index.php
@@ -2,7 +2,7 @@
/*
+-------------------------------------------------------------------------+
| Roundcube Webmail IMAP Client |
- | Version 0.8-svn |
+ | Version 0.8-rc |
| |
| Copyright (C) 2005-2012, The Roundcube Dev Team |
| |
diff --git a/program/include/iniset.php b/program/include/iniset.php
index 5feca7d9c..a54cf45a7 100644
--- a/program/include/iniset.php
+++ b/program/include/iniset.php
@@ -40,7 +40,7 @@ foreach ($crit_opts as $optname => $optval) {
}
// application constants
-define('RCMAIL_VERSION', '0.8-svn');
+define('RCMAIL_VERSION', '0.8-rc');
define('RCMAIL_CHARSET', 'UTF-8');
define('JS_OBJECT_NAME', 'rcmail');
define('RCMAIL_START', microtime(true));
diff --git a/tests/html_to_text.php b/tests/html_to_text.php
deleted file mode 100644
index aabc1a800..000000000
--- a/tests/html_to_text.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-/**
- * Test class to test html2text class
- *
- * @package Tests
- */
-class rcube_test_html2text extends UnitTestCase
-{
-
- function __construct()
- {
- $this->UnitTestCase("HTML-to-Text conversion tests");
-
- }
-
- function test_html2text()
- {
- $data = array(
- 0 => array(
- 'title' => 'Test entry',
- 'in' => '',
- 'out' => '',
- ),
- 1 => array(
- 'title' => 'Basic HTML entities',
- 'in' => '&quot;&amp;',
- 'out' => '"&',
- ),
- 2 => array(
- 'title' => 'HTML entity string',
- 'in' => '&amp;quot;',
- 'out' => '&quot;',
- ),
- 3 => array(
- 'title' => 'HTML entity in STRONG tag',
- 'in' => '<strong>&#347;</strong>', // ś
- 'out' => 'Ś', // upper ś
- ),
- 4 => array(
- 'title' => 'STRONG tag to upper-case conversion',
- 'in' => '<strong>ś</strong>',
- 'out' => 'Ś',
- ),
- 5 => array(
- 'title' => 'STRONG inside B tag',
- 'in' => '<b><strong>&#347;</strong></b>',
- 'out' => 'Ś',
- ),
- );
-
- $ht = new html2text(null, false, false);
-
- foreach ($data as $idx => $item) {
- $ht->set_html($item['in']);
- $res = $ht->get_text();
- $this->assertEqual($item['out'], $res, $item['title'] . "($idx)");
- }
- }
-
-}
diff --git a/tests/maildecode.php b/tests/maildecode.php
deleted file mode 100644
index 4ac499360..000000000
--- a/tests/maildecode.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-/**
- * Test class to test messages decoding functions
- *
- * @package Tests
- */
-class rcube_test_maildecode extends UnitTestCase
-{
- private $app;
-
- function __construct()
- {
- $this->UnitTestCase('Mail headers decoding tests');
- }
-
- /**
- * Test decoding of single e-mail address strings
- * Uses rcube_mime::decode_address_list()
- */
- function test_decode_single_address()
- {
- $headers = array(
- 0 => 'test@domain.tld',
- 1 => '<test@domain.tld>',
- 2 => 'Test <test@domain.tld>',
- 3 => 'Test Test <test@domain.tld>',
- 4 => 'Test Test<test@domain.tld>',
- 5 => '"Test Test" <test@domain.tld>',
- 6 => '"Test Test"<test@domain.tld>',
- 7 => '"Test \\" Test" <test@domain.tld>',
- 8 => '"Test<Test" <test@domain.tld>',
- 9 => '=?ISO-8859-1?B?VGVzdAo=?= <test@domain.tld>',
- 10 => '=?ISO-8859-1?B?VGVzdAo=?=<test@domain.tld>', // #1487068
- // comments in address (#1487673)
- 11 => 'Test (comment) <test@domain.tld>',
- 12 => '"Test" (comment) <test@domain.tld>',
- 13 => '"Test (comment)" (comment) <test@domain.tld>',
- 14 => '(comment) <test@domain.tld>',
- 15 => 'Test <test@(comment)domain.tld>',
- 16 => 'Test Test ((comment)) <test@domain.tld>',
- 17 => 'test@domain.tld (comment)',
- 18 => '"Test,Test" <test@domain.tld>',
- // 1487939
- 19 => 'Test <"test test"@domain.tld>',
- 20 => '<"test test"@domain.tld>',
- 21 => '"test test"@domain.tld',
- );
-
- $results = array(
- 0 => array(1, '', 'test@domain.tld'),
- 1 => array(1, '', 'test@domain.tld'),
- 2 => array(1, 'Test', 'test@domain.tld'),
- 3 => array(1, 'Test Test', 'test@domain.tld'),
- 4 => array(1, 'Test Test', 'test@domain.tld'),
- 5 => array(1, 'Test Test', 'test@domain.tld'),
- 6 => array(1, 'Test Test', 'test@domain.tld'),
- 7 => array(1, 'Test " Test', 'test@domain.tld'),
- 8 => array(1, 'Test<Test', 'test@domain.tld'),
- 9 => array(1, 'Test', 'test@domain.tld'),
- 10 => array(1, 'Test', 'test@domain.tld'),
- 11 => array(1, 'Test', 'test@domain.tld'),
- 12 => array(1, 'Test', 'test@domain.tld'),
- 13 => array(1, 'Test (comment)', 'test@domain.tld'),
- 14 => array(1, '', 'test@domain.tld'),
- 15 => array(1, 'Test', 'test@domain.tld'),
- 16 => array(1, 'Test Test', 'test@domain.tld'),
- 17 => array(1, '', 'test@domain.tld'),
- 18 => array(1, 'Test,Test', 'test@domain.tld'),
- 19 => array(1, 'Test', '"test test"@domain.tld'),
- 20 => array(1, '', '"test test"@domain.tld'),
- 21 => array(1, '', '"test test"@domain.tld'),
- );
-
- foreach ($headers as $idx => $header) {
- $res = rcube_mime::decode_address_list($header);
-
- $this->assertEqual($results[$idx][0], count($res), "Rows number in result for header: " . $header);
- $this->assertEqual($results[$idx][1], $res[1]['name'], "Name part decoding for header: " . $header);
- $this->assertEqual($results[$idx][2], $res[1]['mailto'], "Email part decoding for header: " . $header);
- }
- }
-
- /**
- * Test decoding of header values
- * Uses rcube_mime::decode_mime_string()
- */
- function test_header_decode_qp()
- {
- $test = array(
- // #1488232: invalid character "?"
- 'quoted-printable (1)' => array(
- 'in' => '=?utf-8?Q?Certifica=C3=A7=C3=A3??=',
- 'out' => 'Certifica=C3=A7=C3=A3?',
- ),
- 'quoted-printable (2)' => array(
- 'in' => '=?utf-8?Q?Certifica=?= =?utf-8?Q?C3=A7=C3=A3?=',
- 'out' => 'Certifica=C3=A7=C3=A3',
- ),
- 'quoted-printable (3)' => array(
- 'in' => '=?utf-8?Q??= =?utf-8?Q??=',
- 'out' => '',
- ),
- 'quoted-printable (4)' => array(
- 'in' => '=?utf-8?Q??= a =?utf-8?Q??=',
- 'out' => ' a ',
- ),
- 'quoted-printable (5)' => array(
- 'in' => '=?utf-8?Q?a?= =?utf-8?Q?b?=',
- 'out' => 'ab',
- ),
- 'quoted-printable (6)' => array(
- 'in' => '=?utf-8?Q? ?= =?utf-8?Q?a?=',
- 'out' => ' a',
- ),
- 'quoted-printable (7)' => array(
- 'in' => '=?utf-8?Q?___?= =?utf-8?Q?a?=',
- 'out' => ' a',
- ),
- );
-
- foreach ($test as $idx => $item) {
- $res = rcube_mime::decode_mime_string($item['in'], 'UTF-8');
- $res = quoted_printable_encode($res);
-
- $this->assertEqual($item['out'], $res, "Header decoding for: " . $idx);
- }
-
- }
-}
diff --git a/tests/mailfunc.php b/tests/mailfunc.php
deleted file mode 100644
index ed637884e..000000000
--- a/tests/mailfunc.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-
-/**
- * Test class to test steps/mail/func.inc functions
- *
- * @package Tests
- */
-class rcube_test_mailfunc extends UnitTestCase
-{
-
- function __construct()
- {
- $this->UnitTestCase('Mail body rendering tests');
-
- // simulate environment to successfully include func.inc
- $GLOBALS['RCMAIL'] = $RCMAIL = rcmail::get_instance();
- $GLOBALS['OUTPUT'] = $OUTPUT = $RCMAIL->load_gui();
- $RCMAIL->action = 'autocomplete';
- $RCMAIL->storage_init(false);
-
- require_once INSTALL_PATH . 'program/steps/mail/func.inc';
-
- $GLOBALS['EMAIL_ADDRESS_PATTERN'] = $EMAIL_ADDRESS_PATTERN;
- }
-
- /**
- * Helper method to create a HTML message part object
- */
- function get_html_part($body)
- {
- $part = new rcube_message_part;
- $part->ctype_primary = 'text';
- $part->ctype_secondary = 'html';
- $part->body = file_get_contents(TESTS_DIR . $body);
- $part->replaces = array();
- return $part;
- }
-
- /**
- * Test sanitization of a "normal" html message
- */
- function test_html()
- {
- $part = $this->get_html_part('src/htmlbody.txt');
- $part->replaces = array('ex1.jpg' => 'part_1.2.jpg', 'ex2.jpg' => 'part_1.2.jpg');
-
- // render HTML in normal mode
- $html = rcmail_html4inline(rcmail_print_body($part, array('safe' => false)), 'foo');
-
- $this->assertPattern('/src="'.$part->replaces['ex1.jpg'].'"/', $html, "Replace reference to inline image");
- $this->assertPattern('#background="./program/blocked.gif"#', $html, "Replace external background image");
- $this->assertNoPattern('/ex3.jpg/', $html, "No references to external images");
- $this->assertNoPattern('/<meta [^>]+>/', $html, "No meta tags allowed");
- //$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('/<!-- 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");
-
- // render HTML in safe mode
- $html2 = rcmail_html4inline(rcmail_print_body($part, array('safe' => true)), 'foo');
-
- $this->assertPattern('/<style [^>]+>/', $html2, "Allow styles in safe mode");
- $this->assertPattern('#src="http://evilsite.net/mailings/ex3.jpg"#', $html2, "Allow external images in HTML (safe mode)");
- $this->assertPattern("#url\('?http://evilsite.net/newsletter/image/bg/bg-64.jpg'?\)#", $html2, "Allow external images in CSS (safe mode)");
- $css = '<link rel="stylesheet" .+_u=tmp-[a-z0-9]+\.css.+_action=modcss';
- $this->assertPattern('#'.$css.'#Ui', $html2, "Filter (anonymized) external styleseehts with utils/modcss.inc");
- }
-
- /**
- * Test the elimination of some trivial XSS vulnerabilities
- */
- function test_html_xss()
- {
- $part = $this->get_html_part('src/htmlxss.txt');
- $washed = rcmail_print_body($part, array('safe' => true));
-
- $this->assertNoPattern('/src="skins/', $washed, "Remove local references");
- $this->assertNoPattern('/\son[a-z]+/', $washed, "Remove on* attributes");
-
- $html = rcmail_html4inline($washed, 'foo');
- $this->assertNoPattern('/onclick="return rcmail.command(\'compose\',\'xss@somehost.net\',this)"/', $html, "Clean mailto links");
- $this->assertNoPattern('/alert/', $html, "Remove alerts");
- }
-
- /**
- * Test HTML sanitization to fix the CSS Expression Input Validation Vulnerability
- * reported at http://www.securityfocus.com/bid/26800/
- */
- function test_html_xss2()
- {
- $part = $this->get_html_part('src/BID-26800.txt');
- $washed = rcmail_html4inline(rcmail_print_body($part, array('safe' => true)), 'dabody', '', $attr, true);
-
- $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");
- }
-
- /**
- * Test links pattern replacements in plaintext messages
- */
- function test_plaintext()
- {
- $part = new rcube_message_part;
- $part->ctype_primary = 'text';
- $part->ctype_secondary = 'plain';
- $part->body = quoted_printable_decode(file_get_contents(TESTS_DIR . 'src/plainbody.txt'));
- $html = rcmail_print_body($part, array('safe' => true));
-
- $this->assertPattern('/<a href="mailto:nobody@roundcube.net" onclick="return rcmail.command\(\'compose\',\'nobody@roundcube.net\',this\)">nobody@roundcube.net<\/a>/', $html, "Mailto links with onclick");
- $this->assertPattern('#<a href="http://www.apple.com/legal/privacy" target="_blank">http://www.apple.com/legal/privacy</a>#', $html, "Links with target=_blank");
- $this->assertPattern('#\\[<a href="http://example.com/\\?tx\\[a\\]=5" target="_blank">http://example.com/\\?tx\\[a\\]=5</a>\\]#', $html, "Links with square brackets");
- }
-
- /**
- * Test mailto links in html messages
- */
- function test_mailto()
- {
- $part = $this->get_html_part('src/mailto.txt');
-
- // render HTML in normal mode
- $html = rcmail_html4inline(rcmail_print_body($part, array('safe' => false)), 'foo');
-
- $mailto = '<a href="mailto:me@me.com?subject=this is the subject&amp;body=this is the body"'
- .' onclick="return rcmail.command(\'compose\',\'me@me.com?subject=this is the subject&amp;body=this is the body\',this)">e-mail</a>';
-
- $this->assertPattern('|'.preg_quote($mailto, '|').'|', $html, "Extended mailto links");
- }
-
- /**
- * Test the elimination of HTML comments
- */
- function test_html_comments()
- {
- $part = $this->get_html_part('src/htmlcom.txt');
- $washed = rcmail_print_body($part, array('safe' => true));
-
- // #1487759
- $this->assertPattern('|<p>test1</p>|', $washed, "Buggy HTML comments");
- // but conditional comments (<!--[if ...) should be removed
- $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]");
-
- // base resolving exceptions
- $this->assertPattern('|src="cid:theCID"|', $html, "URI base resolving exception [1]");
- $this->assertPattern('|src="http://other\.domain\.tld/img3\.gif"|', $html, "URI base resolving exception [2]");
- }
-}
diff --git a/tests/modcss.php b/tests/modcss.php
deleted file mode 100644
index 945cac318..000000000
--- a/tests/modcss.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Test class to test rcmail_mod_css_styles and XSS vulnerabilites
- *
- * @package Tests
- */
-class rcube_test_modcss extends UnitTestCase
-{
-
- function __construct()
- {
- $this->UnitTestCase('CSS modification and vulnerability tests');
- }
-
- function test_modcss()
- {
- $css = file_get_contents(TESTS_DIR . 'src/valid.css');
- $mod = rcmail_mod_css_styles($css, 'rcmbody');
-
- $this->assertPattern('/#rcmbody\s+\{/', $mod, "Replace body style definition");
- $this->assertPattern('/#rcmbody h1\s\{/', $mod, "Prefix tag styles (single)");
- $this->assertPattern('/#rcmbody h1, #rcmbody h2, #rcmbody h3, #rcmbody textarea\s+\{/', $mod, "Prefix tag styles (multiple)");
- $this->assertPattern('/#rcmbody \.noscript\s+\{/', $mod, "Prefix class styles");
- }
-
- function test_xss()
- {
- $mod = rcmail_mod_css_styles("body.main2cols { background-image: url('../images/leftcol.png'); }", 'rcmbody');
- $this->assertEqual("/* evil! */", $mod, "No url() values allowed");
-
- $mod = rcmail_mod_css_styles("@import url('http://localhost/somestuff/css/master.css');", 'rcmbody');
- $this->assertEqual("/* evil! */", $mod, "No import statements");
-
- $mod = rcmail_mod_css_styles("left:expression(document.body.offsetWidth-20)", 'rcmbody');
- $this->assertEqual("/* evil! */", $mod, "No expression properties");
-
- $mod = rcmail_mod_css_styles("left:exp/* */ression( alert(&#039;xss3&#039;) )", 'rcmbody');
- $this->assertEqual("/* evil! */", $mod, "Don't allow encoding quirks");
-
- $mod = rcmail_mod_css_styles("background:\\0075\\0072\\006c( javascript:alert(&#039;xss&#039;) )", 'rcmbody');
- $this->assertEqual("/* evil! */", $mod, "Don't allow encoding quirks (2)");
- }
-
-}
diff --git a/tests/runtests.sh b/tests/runtests.sh
deleted file mode 100755
index 58cd40918..000000000
--- a/tests/runtests.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-/*
- +-----------------------------------------------------------------------+
- | tests/runtests.sh |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2009, The Roundcube Dev Team |
- | |
- | Licensed under the GNU General Public License version 3 or |
- | any later version with exceptions for skins & plugins. |
- | See the README file for a full license statement. |
- | |
- | PURPOSE: |
- | Run-script for unit tests based on http://simpletest.org |
- | All .php files in this folder will be treated as tests |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-
- $Id: $
-
-*/
-
-if (php_sapi_name() != 'cli')
- die("Not in shell mode (php-cli)");
-
-if (!defined('SIMPLETEST')) define('SIMPLETEST', '/www/simpletest/');
-if (!defined('INSTALL_PATH')) define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
-
-define('TESTS_DIR', dirname(__FILE__) . '/');
-define('RCMAIL_CONFIG_DIR', TESTS_DIR . 'config');
-
-require_once(SIMPLETEST . 'unit_tester.php');
-require_once(SIMPLETEST . 'reporter.php');
-require_once(INSTALL_PATH . 'program/include/iniset.php');
-
-if (count($_SERVER['argv']) > 1) {
- $testfiles = array();
- for ($i=1; $i < count($_SERVER['argv']); $i++)
- $testfiles[] = realpath('./' . $_SERVER['argv'][$i]);
-}
-else {
- $testfiles = glob(TESTS_DIR . '*.php');
-}
-
-$test = new TestSuite('Roundcube unit tests');
-$reporter = new TextReporter();
-
-foreach ($testfiles as $fn) {
- $test->addTestFile($fn);
-}
-
-$test->run($reporter);
-
-?>
diff --git a/tests/src/BID-26800.txt b/tests/src/BID-26800.txt
deleted file mode 100644
index e4e2fe795..000000000
--- a/tests/src/BID-26800.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-<h1>1 test</h1>
-<p>&lt;style&gt; block</p>
-<style>input { left:expression( alert(&#039;expression!&#039;) ) }</style>
-<style>div { background:url(alert(&#039;URL!&#039;) ) }</style>
-
-<h1>2 test</h1>
-<p>&lt;div&gt; block</p>
-<div style="font-style:italic">valid css</div>
-<div style="color:red; background:url('//somedomain.com/somepath/somefile.png')">
-<div style="{ left:expression( alert(&#039;expression!&#039;) ) }">
-<div style="{ background:url( alert(&#039;URL!&#039;) ) }">
-
-<h1>3 test</h1>
-<p>Inject comment text</p>
-<div style="{ left:exp/* */ression( alert(&#039;xss3&#039;) ) }">
-<div style=" background:u/* */rl( alert(&#039;xssurl3&#039;) ) ">
-
-<h1>4 test</h1>
-<p>Using reverse solid to directe the codepoint</p>
-<div style="{ left:\0065\0078pression( alert(&#039;xss4&#039;) ) }">
-<div style="{ background:\0075rl( alert(&#039;xssurl4&#039;) ) }">
-
-<h1>5 test</h1>
-<p>Character entity references</p>
-<p>Character entity references is acceptable in "inline styles"</p>
-<div style="{ left:&#x0065;xpression( alert(&#039;xss&#039;) ) }">
-<div style="{ left:&#101;xpression( alert(&#039;xss&#039;) ) }">
-<div style="{ background:&#x0075;rl( alert(&#039;URL!&#039;) ) }">
-<div style="{ background:&#117;rl( alert(&#039;URL!&#039;) ) }">
-<div style="{ left:&#x0065xpression( alert(&#039;xss&#039;) ) }">
-
-<div style="{ left:..p.....o.( alert(&#039;xss&#039;) ) }">
-<div style="{ left:..&#x2f;**/pression( alert(&#039;xss&#039;) ) }">
-<div style="{ left:exp&#x0280;essio&#x0274;( alert(&#039;xss&#039;) ) }">
-<div style="{ left:&#x5c;0065&#x5c;0078pression( alert(&#039;xss&#039;) ) }">
-<div style="{ left:ex p ression( alert(&#039;xss&#039;) ) }">
-
-<div style="{ background:...( javascript:alert(&#039;xss&#039;) ) }">
-<div style="{ background:&#x0075;/**/rl( javascript:alert(&#039;xss&#039;) ) }">
-<div style="{ background:\0075\0072\006c( javascript:alert(&#039;xss&#039;) ) }">
-<div style="{ background:u&#x0280;&#x029F;( javascript:alert(&#039;xss&#039;) )
-}">
-<div style="{ background:&#x5c;0075&#x5c;0280l( javascript:alert(&#039;xss&#039;)
-) }">
-<div style="{ background:u r l( javascript:alert(&#039;xss&#039;) ) }">
-
-</body>
-</html>
-
diff --git a/tests/src/apple.vcf b/tests/src/apple.vcf
deleted file mode 100644
index 856eaf328..000000000
--- a/tests/src/apple.vcf
+++ /dev/null
@@ -1,49 +0,0 @@
-BEGIN:VCARD
-VERSION:3.0
-N:;;;;
-FN:Apple Computer AG
-ORG:Apple Computer AG;
-item1.ADR;type=WORK;type=pref:;;Birgistrasse 4a;Wallisellen-Zürich;;8304;Switzerland
-item1.X-ABADR:ch
-item2.URL;type=pref:http\://www.apple.ch
-item2.X-ABLabel:_$!<HomePage>!$_
-PHOTO;BASE64:
- /9j/4AAQSkZJRgABAQAAAQABAAD/7QAcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAD/2wBDAAEB
- AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
- AQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
- AQEBAQEBAQEBAQEBAQEBAQH/wAARCAAwADADAREAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAA
- AAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEI
- I0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlq
- c3R1dnd4eXqDhI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MeGvEtsLLxF4e0PX7MMGFprWk2Gq2wZe
- jCC+t54tw7HZkdqUZzg7wlKL7xk4v700OUIT0lCMl2lFS/NMuaXpOlaHZQ6Zoumafo+nW4It9P0u
- yttPsoATkiG1tI4oIgTyQkagnmk5Sk7ybk+7bb+96jjGMVaMVFdopJfcjQpDP//Z
-X-ABShowAs:COMPANY
-X-ABUID:2E4CB084-4767-4C85-BBCA-805B1DCB1C8E\:ABPerson
-END:VCARD
diff --git a/tests/src/htmlbase.txt b/tests/src/htmlbase.txt
deleted file mode 100644
index eb590748b..000000000
--- a/tests/src/htmlbase.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-<html>
-<head>
-<base href="http://alec.pl/dir/" />
-</head>
-<body>
-<img src="img1.gif" />
-<img src="./img2.gif" />
-<img src="../img3.gif" />
-<img src="cid:theCID" />
-<img src="http://other.domain.tld/img3.gif" />
-</body>
-</html>
diff --git a/tests/src/htmlbody.txt b/tests/src/htmlbody.txt
deleted file mode 100644
index 66286e61d..000000000
--- a/tests/src/htmlbody.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-<title>Roundcube Test Message</title>
-<link rel="stylesheet" type="text/css" href="http://anysite.net/styles/mail.css">
-<style type="text/css">
-
-p, a {
- font-family: Arial, 'Bitstream Vera Sans', Helvetica;
- margin-top: 0px;
- margin-bottom: 0px;
- padding-top: 0px;
- padding-bottom: 0px;
-}
-
-</style>
-</head>
-<body style="margin: 0 0 0 0;">
-
-<table width="100%" cellpadding="0" cellspacing="20" style="background-image:url(http://evilsite.net/newsletter/image/bg/bg-64.jpg);background-attachment:fixed;" background="http://evilsite.net/newsletter/image/bg/bg-64.jpg" border="0">
-<tr>
-<td>
-
-<h1>This is a HTML message</h1>
-
-<p>See nice pictures like the following:</p>
-
-<div>
- <img src="ex1.jpg" width="320" height="320" alt="Example 1">
- <img src="ex2.jpg" width="320" height="320" alt="Example 2">
- <img src="http://evilsite.net/mailings/ex3.jpg" width="320" height="320" alt="Example 3">
-</div>
-
-<form action="http://evilsite.net/subscribe.php">
- <p>Subscription form</p>
-
- E-Mail: <input type="text" name="mail" value=""><br/>
- <input type="submit" value="Subscribe">
-
-</form>
-
-<p>To unsubscribe click here <a href="http://evilsite.net/unsubscribe.php?mail=foo@bar.com"> or
- send a mail to <a href="mailto:unsubscribe@evilsite.net">unsubscribe@evilsite.net</a></p>
-
-</td>
-</tr>
-</table>
-
-</body>
-</html> \ No newline at end of file
diff --git a/tests/src/htmlcom.txt b/tests/src/htmlcom.txt
deleted file mode 100644
index b3eb1de79..000000000
--- a/tests/src/htmlcom.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-<head>
-<title>Roundcube Test Message</title>
-</head>
-<body>
-
-<!--REF>
-<p>test1</p>
-<!--DEREF>
-
-<!--[if gte mso 9]><xml>
- <p>test2</p>
-</xml><![endif]-->
-
-</body>
-</html> \ No newline at end of file
diff --git a/tests/src/htmlxss.txt b/tests/src/htmlxss.txt
deleted file mode 100644
index f6c43e353..000000000
--- a/tests/src/htmlxss.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-<html>
-<body>
-
-<p><img onLoad.="alert(document.cookie)" src="skins/default/images/roundcube_logo.png" /></p>
-
-<p><a href="mailto:xss@somehost.net') && alert(document.cookie) || ignore('">mail me!</a>
-<a href="http://roundcube.net" target="_self">roundcube.net</a>
-<a href="http://roundcube.net" \onmouseover="alert('XSS')">roundcube.net (2)</a>
-
-</p>
-
-<div>Brilliant!</div>
-
-<table><tbody><tr><td background="javascript:alert('XSS')">BBBBBB</td></tr></tbody></table>
-
-<p>
-Have a nice Christmas time.<br />
-Thomas
-</p>
-
-</body>
-</html>
diff --git a/tests/src/invalidchars.html b/tests/src/invalidchars.html
deleted file mode 100644
index bd460eab1..000000000
--- a/tests/src/invalidchars.html
+++ /dev/null
@@ -1 +0,0 @@
-<p>символ</p>
diff --git a/tests/src/johndoe.vcf b/tests/src/johndoe.vcf
deleted file mode 100644
index 67b649df3..000000000
--- a/tests/src/johndoe.vcf
+++ /dev/null
@@ -1,11 +0,0 @@
-BEGIN:VCARD
-VERSION:2.1
-N;CHARSET=windows-1252:Do;John;;;
-FN;CHARSET=windows-1252:John Do
-ORG:roundcube.net;
-EMAIL;INTERNET;WORK:inbox@roundcube.net
-EMAIL;INTERNET;HOME;TYPE=pref:roundcube@gmail.com
-TEL;WORK:+123456789
-ADR;WORK:;;The street;Hometown;;5555;Cayman Islands
-NOTE:The notes...
-END:VCARD
diff --git a/tests/src/mailto.txt b/tests/src/mailto.txt
deleted file mode 100644
index e70b12de8..000000000
--- a/tests/src/mailto.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<head></head>
-<body>
-
-<a href="mailto:me@me.com?subject=this is the subject&body=this is the body">e-mail</a>
-
-</body>
-</html> \ No newline at end of file
diff --git a/tests/src/plainbody.txt b/tests/src/plainbody.txt
deleted file mode 100644
index 7fba94f86..000000000
--- a/tests/src/plainbody.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-From: iPhone Developer Program <noreply-iphonedev@apple.com>
-To: nobody@roundcube.net
-
-*iPhone Developer Program*
-
------------------------------------
-iPhone SDK 2.2.1 is now available
-https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/wa/login?appIdKey=3D=
-D635F5C417E087A3B9864DAC5D25920C4E9442C9339FA9277951628F0291F620&path=3D//i=
-phone/login.action
-
-Log in to the iPhone Dev Center to download iPhone SDK for iPhone OS 2.2.1.=
- Installation of iPhone SDK 2.2.1 is required for development with devices =
-updated to iPhone OS 2.2.1. Please view the Read Me before installing the n=
-ew version of the iPhone SDK.
-
-Log in now
-https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/wa/login?appIdKey=3D=
-D635F5C417E087A3B9864DAC5D25920C4E9442C9339FA9277951628F0291F620&path=3D//i=
-phone/login.action
-
------------------------------------
-Copyright (c) 2009 Apple Inc. 1 Infinite Loop, MS 303-3DM, Cupertino, CA 95=
-014.
-
-All Rights Reserved
-http://www.apple.com/legal/default.html
-
-Keep Informed
-http://www.apple.com/enews/subscribe/
-
-Privacy Policy
-http://www.apple.com/legal/privacy.
-
-My Info
-https://myinfo.apple.com/cgi-bin/WebObjects/MyInfo
-
--[http://example.com/?tx[a]=5]-
diff --git a/tests/src/thebat.vcf b/tests/src/thebat.vcf
deleted file mode 100644
index 8179f788d..000000000
--- a/tests/src/thebat.vcf
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN:VCARD
-VERSION:2.1
-N;ENCODING=QUOTED-PRINTABLE:Iksi=F1ski;Piotr
-FN;ENCODING=QUOTED-PRINTABLE:Piotr Iksi=F1ski
-EMAIL;PREF;INTERNET:piotr.iksinski@somedomain.com
-X-GENDER:Male
-REV:20080716T203548Z
-END:VCARD
diff --git a/tests/src/utf-16_sample.vcf b/tests/src/utf-16_sample.vcf
deleted file mode 100755
index 22f54618a..000000000
--- a/tests/src/utf-16_sample.vcf
+++ /dev/null
Binary files differ
diff --git a/tests/src/valid.css b/tests/src/valid.css
deleted file mode 100644
index 340fa9a87..000000000
--- a/tests/src/valid.css
+++ /dev/null
@@ -1,30 +0,0 @@
-/** Master style definitions **/
-
-body, p, div, h1, h2, h3, textarea {
- font-family: "Lucida Grande", Helvetica, sans-serif;
- font-size: 8.8pt;
- color: #333;
-}
-
-body {
- background-color: white;
- margin: 0;
-}
-
-h1 {
- color: #1F519A;
- font-size: 1.7em;
- font-weight: normal;
- margin-top: 0;
- margin-bottom: 1em;
-}
-
-.noscript {
- display: none;
-}
-
-.hint, .username {
- color: #999;
-}
-
-
diff --git a/tests/vcards.php b/tests/vcards.php
deleted file mode 100644
index ba5ce2bef..000000000
--- a/tests/vcards.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/**
- * Unit tests for class rcube_vcard
- *
- * @package Tests
- */
-class rcube_test_vcards extends UnitTestCase
-{
-
- function __construct()
- {
- $this->UnitTestCase('Vcard encoding/decoding tests');
- }
-
- function _srcpath($fn)
- {
- return realpath(dirname(__FILE__) . '/src/' . $fn);
- }
-
- function test_parse_one()
- {
- $vcard = new rcube_vcard(file_get_contents($this->_srcpath('apple.vcf')));
-
- $this->assertEqual(true, $vcard->business, "Identify as business record");
- $this->assertEqual("Apple Computer AG", $vcard->displayname, "FN => displayname");
- $this->assertEqual("", $vcard->firstname, "No person name set");
- }
-
- function test_parse_two()
- {
- $vcard = new rcube_vcard(file_get_contents($this->_srcpath('johndoe.vcf')), null);
-
- $this->assertEqual(false, $vcard->business, "Identify as private record");
- $this->assertEqual("John Doë", $vcard->displayname, "Decode according to charset attribute");
- $this->assertEqual("roundcube.net", $vcard->organization, "Test organization field");
- $this->assertEqual(2, count($vcard->email), "List two e-mail addresses");
- $this->assertEqual("roundcube@gmail.com", $vcard->email[0], "Use PREF e-mail as primary");
- }
-
- function test_import()
- {
- $input = file_get_contents($this->_srcpath('apple.vcf'));
- $input .= file_get_contents($this->_srcpath('johndoe.vcf'));
-
- $vcards = rcube_vcard::import($input);
-
- $this->assertEqual(2, count($vcards), "Detected 2 vcards");
- $this->assertEqual("Apple Computer AG", $vcards[0]->displayname, "FN => displayname");
- $this->assertEqual("John Doë", $vcards[1]->displayname, "Displayname with correct charset");
-
- // http://trac.roundcube.net/ticket/1485542
- $vcards2 = rcube_vcard::import(file_get_contents($this->_srcpath('thebat.vcf')));
- $this->assertEqual("Iksiñski", $vcards2[0]->surname, "Detect charset in encoded values");
- }
-
- function test_encodings()
- {
- $input = file_get_contents($this->_srcpath('utf-16_sample.vcf'));
-
- $vcards = rcube_vcard::import($input);
- $this->assertEqual("Ǽgean ĽdaMonté", $vcards[0]->displayname, "Decoded from UTF-16");
- }
-
-}