Compare commits
176 Commits
master
...
bnet/addit
Author | SHA1 | Date |
---|---|---|
Felix Stupp | b53d1c83ce | 4 years ago |
Thomas Bruederli | 5b53161198 | 4 years ago |
Aleksander Machniak | 9905b5adaa | 4 years ago |
Thomas Bruederli | 9898599d3e | 4 years ago |
Aleksander Machniak | ccaccae665 | 4 years ago |
Aleksander Machniak | b37433b199 | 4 years ago |
Aleksander Machniak | 4beec65d40 | 4 years ago |
Aleksander Machniak | 20ae604b9f | 4 years ago |
Aleksander Machniak | 5e4195a042 | 4 years ago |
Aleksander Machniak | 31df958caf | 4 years ago |
Aleksander Machniak | bebc9ec1be | 4 years ago |
Aleksander Machniak | c25616b3b5 | 4 years ago |
Aleksander Machniak | eba6fb20cf | 4 years ago |
Aleksander Machniak | 99b20bd82a | 4 years ago |
Christopher Gurnee | 973217d960 | 4 years ago |
Aleksander Machniak | 9362bb9459 | 4 years ago |
Christopher Gurnee | a5c6bfb678 | 4 years ago |
Christopher Gurnee | 79e6042276 | 4 years ago |
Aleksander Machniak | 90afff1929 | 4 years ago |
vaaguirre | 9d0d072f36 | 4 years ago |
Aleksander Machniak | 656c706270 | 4 years ago |
Aleksander Machniak | 26d5fb1b55 | 4 years ago |
Aleksander Machniak | dff0ee3e2a | 4 years ago |
johndoh | f494cd22ce | 4 years ago |
Aleksander Machniak | 2a250d7bc3 | 4 years ago |
Aleksander Machniak | 62a0936ecc | 4 years ago |
Aleksander Machniak | d15d929167 | 4 years ago |
Thomas Bruederli | aadb13e25f | 4 years ago |
Aleksander Machniak | 9bbda422ff | 4 years ago |
Aleksander Machniak | 814eadb699 | 4 years ago |
Aleksander Machniak | fcfb099477 | 4 years ago |
Aleksander Machniak | 1c239c90d9 | 4 years ago |
Aleksander Machniak | 301670f081 | 4 years ago |
Aleksander Machniak | be68e3f679 | 4 years ago |
Aleksander Machniak | 37acfc2e03 | 4 years ago |
Aleksander Machniak | 080b0afd95 | 4 years ago |
Aleksander Machniak | ecfee7470c | 4 years ago |
Aleksander Machniak | 343da344e0 | 4 years ago |
Aleksander Machniak | 0d43c51ce1 | 4 years ago |
Aleksander Machniak | 808f374f42 | 4 years ago |
Aleksander Machniak | 15e924fd64 | 4 years ago |
Aleksander Machniak | c99e093f8a | 4 years ago |
Aleksander Machniak | 43f90d31c8 | 4 years ago |
Aleksander Machniak | 5666ae00a8 | 4 years ago |
PhilW | 2ba62d0c98 | 4 years ago |
Aleksander Machniak | 7c081d7d72 | 4 years ago |
Aleksander Machniak | a74a9e5fc2 | 4 years ago |
Aleksander Machniak | cd73ca05d8 | 4 years ago |
PhilW | 1bc41d3a5f | 4 years ago |
Aleksander Machniak | ae71f01b33 | 4 years ago |
Aleksander Machniak | 746ccb7fdf | 4 years ago |
Aleksander Machniak | 59af9944ea | 4 years ago |
dessert1 | 2005b895be | 4 years ago |
Aleksander Machniak | 734f97511a | 4 years ago |
Aleksander Machniak | ade470aac9 | 4 years ago |
Aleksander Machniak | a71b33f568 | 4 years ago |
Aleksander Machniak | 518d1aea71 | 4 years ago |
Aleksander Machniak | 3a32a1e246 | 4 years ago |
Aleksander Machniak | 7793386683 | 4 years ago |
Aleksander Machniak | edbcb03237 | 4 years ago |
Aleksander Machniak | 73e2b0584a | 4 years ago |
Aleksander Machniak | f0aafa98ee | 4 years ago |
Aleksander Machniak | 5de09e9f21 | 4 years ago |
Aleksander Machniak | 81e55f8033 | 4 years ago |
Aleksander Machniak | 1c5f83d41c | 4 years ago |
Aleksander Machniak | 233beea354 | 4 years ago |
Aleksander Machniak | 88660cd465 | 4 years ago |
Thomas Bruederli | 0c8b71059b | 4 years ago |
Thomas Bruederli | 273707f378 | 4 years ago |
Aleksander Machniak | 322ab30fb9 | 4 years ago |
Paul J. Dorn | 9cb796ee2b | 4 years ago |
Aleksander Machniak | 65d6a5aa51 | 4 years ago |
Aleksander Machniak | ab3220d046 | 4 years ago |
Aleksander Machniak | ea1260ea72 | 4 years ago |
Aleksander Machniak | bff226801d | 4 years ago |
Aleksander Machniak | b35bf87105 | 4 years ago |
Aleksander Machniak | 7f45e47f00 | 4 years ago |
Aleksander Machniak | 9d4638d94e | 4 years ago |
Aleksander Machniak | 3819e4e640 | 4 years ago |
Aleksander Machniak | 62ed219821 | 4 years ago |
Aleksander Machniak | f0dc915fd8 | 4 years ago |
Aleksander Machniak | 0aa724f73c | 4 years ago |
Max Bosse | 36aa132f51 | 4 years ago |
Aleksander Machniak | 5d68245fa5 | 4 years ago |
Aleksander Machniak | a3a260b613 | 4 years ago |
Aleksander Machniak | 229b9f5f2c | 4 years ago |
Aleksander Machniak | d14d0c5ab5 | 4 years ago |
Aleksander Machniak | 1723aa936f | 4 years ago |
Aleksander Machniak | adc08946ef | 4 years ago |
Aleksander Machniak | b470f5a9f3 | 4 years ago |
Aleksander Machniak | cd1859609b | 4 years ago |
Aleksander Machniak | fbc9219d72 | 4 years ago |
Aleksander Machniak | b5e76ab202 | 4 years ago |
Aleksander Machniak | c8ead80312 | 4 years ago |
Aleksander Machniak | ef13807f17 | 4 years ago |
Aleksander Machniak | 9ecf84e3bd | 4 years ago |
jelle van der Waa | 2edcf5b52c | 4 years ago |
Théo | b421de8416 | 4 years ago |
Aleksander Machniak | 348e557614 | 4 years ago |
Thomas Bruederli | 51b8137170 | 4 years ago |
Aleksander Machniak | 2fa6dd7ee5 | 5 years ago |
Aleksander Machniak | d6c80e4b79 | 5 years ago |
Aleksander Machniak | ca870f034e | 5 years ago |
Aleksander Machniak | 880452f84e | 5 years ago |
Aleksander Machniak | b25c649bb7 | 5 years ago |
Aleksander Machniak | d3bedca7f8 | 5 years ago |
Aleksander Machniak | 72959279e2 | 5 years ago |
Aleksander Machniak | 3bdcfc5623 | 5 years ago |
Aleksander Machniak | b47e38447c | 5 years ago |
Aleksander Machniak | d025351d64 | 5 years ago |
Aleksander Machniak | 906b223d30 | 5 years ago |
Aleksander Machniak | bd7c38be0b | 5 years ago |
Aleksander Machniak | eecd78c3a1 | 5 years ago |
Sebastiaan Lokhorst | 3a12de3fb6 | 5 years ago |
Aleksander Machniak | 5ec5ae57a5 | 5 years ago |
Aleksander Machniak | 58be50418d | 5 years ago |
Aleksander Machniak | 8127d2615f | 5 years ago |
Aleksander Machniak | 1fe448ce41 | 5 years ago |
Aleksander Machniak | e1dfd55185 | 5 years ago |
Aleksander Machniak | bd03cc4541 | 5 years ago |
Aleksander Machniak | 132be945bd | 5 years ago |
Aleksander Machniak | 38f1727515 | 5 years ago |
Aleksander Machniak | dd59b59478 | 5 years ago |
Aleksander Machniak | e0ae7765bc | 5 years ago |
Aleksander Machniak | e29d44dcc3 | 5 years ago |
Sebastiaan Lokhorst | 1800678a40 | 5 years ago |
Aleksander Machniak | a270cf593e | 5 years ago |
Aleksander Machniak | 03b3dd3389 | 5 years ago |
Aleksander Machniak | c084d69d06 | 5 years ago |
Aleksander Machniak | fbb39470d5 | 5 years ago |
Aleksander Machniak | 0e7295fce6 | 5 years ago |
Aleksander Machniak | 90bdd77ada | 5 years ago |
Aleksander Machniak | 09af79f637 | 5 years ago |
Aleksander Machniak | e25f352472 | 5 years ago |
Aleksander Machniak | a80da7f678 | 5 years ago |
Aleksander Machniak | 840437c460 | 5 years ago |
Aleksander Machniak | 55dbf40133 | 5 years ago |
johndoh | 8952e9dddb | 5 years ago |
Aleksander Machniak | 720a0a3173 | 5 years ago |
Aleksander Machniak | aeec47b9bd | 5 years ago |
Aleksander Machniak | b49d9f05aa | 5 years ago |
Aleksander Machniak | 8252bc3962 | 5 years ago |
Aleksander Machniak | 7e9405dc3e | 5 years ago |
PhilW | c7baf94531 | 5 years ago |
Thomas Bruederli | 0b1d6841f9 | 5 years ago |
Aleksander Machniak | fbc50b3791 | 5 years ago |
Aleksander Machniak | ac3ce1d713 | 5 years ago |
Aleksander Machniak | ae7429a287 | 5 years ago |
Aleksander Machniak | deee3442aa | 5 years ago |
Aleksander Machniak | ebfd0f53bf | 5 years ago |
Aleksander Machniak | 594a12b61e | 5 years ago |
Aleksander Machniak | 8ca4bf8a3a | 5 years ago |
Aleksander Machniak | 0c8e29fcbf | 5 years ago |
Aleksander Machniak | f50521a399 | 5 years ago |
Aleksander Machniak | 075803871a | 5 years ago |
Aleksander Machniak | 0467670533 | 5 years ago |
Aleksander Machniak | 90d1d58f8b | 5 years ago |
Aleksander Machniak | e3d18291ff | 5 years ago |
Aleksander Machniak | 71990b59d6 | 5 years ago |
Aleksander Machniak | 29e7c16b33 | 5 years ago |
Aleksander Machniak | 980f2b369f | 5 years ago |
Aleksander Machniak | cab4c8a39c | 5 years ago |
Aleksander Machniak | 659980923a | 5 years ago |
Aleksander Machniak | 35e41670e6 | 5 years ago |
Aleksander Machniak | 0ac39592fc | 5 years ago |
Aleksander Machniak | 392734f984 | 5 years ago |
Aleksander Machniak | 83289cce1e | 5 years ago |
Aleksander Machniak | 1ef912555d | 5 years ago |
Aleksander Machniak | 59ac1ddb64 | 5 years ago |
Aleksander Machniak | 17a6bd77a1 | 5 years ago |
Aleksander Machniak | 9a11d0e36c | 5 years ago |
Aleksander Machniak | 2464f5fed8 | 5 years ago |
Thomas Bruederli | fdbdaec998 | 5 years ago |
Thomas Bruederli | 579663e285 | 5 years ago |
Thomas Bruederli | e774209b41 | 5 years ago |
Aleksander Machniak | dba4988bbe | 5 years ago |
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
$config = array();
|
||||
|
||||
// Database configuration
|
||||
$config['db_dsnw'] = 'sqlite:////tmp/sqlite.db?mode=0646';
|
||||
|
||||
// Test user credentials
|
||||
$config['tests_username'] = 'test';
|
||||
$config['tests_password'] = 'test';
|
||||
|
||||
// GreenMail
|
||||
$config['smtp_port'] = 25;
|
||||
|
||||
// Settings required by the tests
|
||||
|
||||
$config['create_default_folders'] = true;
|
||||
$config['skin'] = 'elastic';
|
||||
$config['support_url'] = 'http://support.url';
|
||||
|
||||
// Plugins with tests
|
||||
|
||||
$config['plugins'] = [
|
||||
'archive',
|
||||
'attachment_reminder',
|
||||
'markasjunk',
|
||||
'zipdownload'
|
||||
];
|
||||
|
||||
$config['archive_mbox'] = 'Archive';
|
@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The script is intended for use on Travis with Trusty distribution
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
# Enable xdebug for code coverage
|
||||
if [ "$CODE_COVERAGE" != 1 ]; then phpenv config-rm xdebug.ini || true; fi
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
cp composer.json-dist composer.json
|
||||
|
||||
# Add laravel/dusk for Browser tests
|
||||
if [ "$BROWSER_TESTS" = 1 ]; then composer require "laravel/dusk:~5.9.1" --no-update; fi
|
||||
|
||||
# Remove qr-code as it requires php-gd which is not always available on Travis
|
||||
# and we don't really need it for tests
|
||||
composer remove endroid/qr-code --no-update
|
||||
|
||||
# Install PHP dependencies
|
||||
composer install --prefer-dist
|
@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The script is intended for use on Travis with Trusty distribution
|
||||
# It executes unit and functional tests
|
||||
|
||||
DIR=$(dirname $0)
|
||||
cd $DIR/..
|
||||
|
||||
if [ "$CODE_COVERAGE" = 1 ]
|
||||
then
|
||||
CODE_COVERAGE_ARGS="--coverage-text"
|
||||
fi
|
||||
|
||||
vendor/bin/phpunit -c tests/phpunit.xml $CODE_COVERAGE_ARGS
|
||||
|
||||
if [ "$BROWSER_TESTS" = 1 ] && [ $? = 0 ]
|
||||
then
|
||||
.ci/setup.sh \
|
||||
&& echo "TESTS_MODE: DESKTOP" \
|
||||
&& TESTS_MODE=desktop vendor/bin/phpunit -c tests/Browser/phpunit.xml \
|
||||
&& echo "TESTS_MODE: PHONE" \
|
||||
&& TESTS_MODE=phone vendor/bin/phpunit -c tests/Browser/phpunit.xml \
|
||||
&& echo "TESTS_MODE: TABLET" \
|
||||
&& TESTS_MODE=tablet vendor/bin/phpunit -c tests/Browser/phpunit.xml
|
||||
fi
|
@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The script is intended for use on Travis with Trusty distribution
|
||||
# It installs in-browser tests dependencies and prepares Roundcube instance
|
||||
|
||||
GMV=1.5.11
|
||||
CHROMEVERSION=$(google-chrome-stable --version | tr -cd [:digit:]. | cut -d . -f 1)
|
||||
GMARGS="-Dgreenmail.setup.all -Dgreenmail.users=test:test -Dgreenmail.startup.timeout=3000"
|
||||
|
||||
# Roundcube tests and instance configuration
|
||||
cp .ci/config-test.inc.php config/config-test.inc.php
|
||||
|
||||
# Make temp and logs writeable
|
||||
sudo chmod 777 temp logs
|
||||
|
||||
# Install javascript dependencies
|
||||
bin/install-jsdeps.sh
|
||||
|
||||
# Compile Elastic's styles
|
||||
lessc skins/elastic/styles/styles.less > skins/elastic/styles/styles.css
|
||||
lessc skins/elastic/styles/print.less > skins/elastic/styles/print.css
|
||||
lessc skins/elastic/styles/embed.less > skins/elastic/styles/embed.css
|
||||
|
||||
# Install proper WebDriver version for installed Chrome browser
|
||||
php tests/Browser/install.php $CHROMEVERSION
|
||||
|
||||
# GreenMail server download, setup and start
|
||||
wget https://repo1.maven.org/maven2/com/icegreen/greenmail-standalone/$GMV/greenmail-standalone-$GMV.jar \
|
||||
&& (sudo java $GMARGS -jar greenmail-standalone-$GMV.jar &) \
|
||||
&& sleep 5
|
@ -0,0 +1,6 @@
|
||||
[submodule "plugins/postfixadmin-user-identities"]
|
||||
path = plugins/postfixadmin-user-identities
|
||||
url = git@git.banananet.work:banananetwork/roundcubemail-postfixadmin-user-identities.git
|
||||
[submodule "plugins/swipe"]
|
||||
path = plugins/swipe
|
||||
url = git@git.banananet.work:banananetwork/roundcubemail-swipe.git
|
@ -1,4 +0,0 @@
|
||||
ALTER TABLE [dbo].[users] ALTER COLUMN [language] [varchar] (16) COLLATE Latin1_General_CI_AI NULL
|
||||
GO
|
||||
ALTER TABLE [dbo].[dictionary] ALTER COLUMN [language] [varchar] (16) COLLATE Latin1_General_CI_AI NOT NULL
|
||||
GO
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE `users` MODIFY `language` varchar(16);
|
||||
ALTER TABLE `dictionary` MODIFY `language` varchar(16) NOT NULL;
|
@ -1,21 +0,0 @@
|
||||
ALTER TABLE `session` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `cache` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `cache_shared` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `cache_index` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `cache_thread` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `cache_messages` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `contacts` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `contactgroups` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `identities` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `dictionary` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `searches` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `filestore` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE `system` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL;
|
||||
ALTER TABLE `cache` CHANGE `cache_key` `cache_key` varchar(128) BINARY NOT NULL;
|
||||
ALTER TABLE `cache_shared` CHANGE `cache_key` `cache_key` varchar(255) BINARY NOT NULL;
|
||||
ALTER TABLE `cache_index` CHANGE `mailbox` `mailbox` varchar(255) BINARY NOT NULL;
|
||||
ALTER TABLE `cache_thread` CHANGE `mailbox` `mailbox` varchar(255) BINARY NOT NULL;
|
||||
ALTER TABLE `cache_messages` CHANGE `mailbox` `mailbox` varchar(255) BINARY NOT NULL;
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE "users" MODIFY "language" varchar(16) NOT NULL;
|
||||
ALTER TABLE "dictionary" MODIFY "language" varchar(16);
|
@ -1 +0,0 @@
|
||||
-- empty
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE "dictionary" ALTER COLUMN "language" TYPE varchar(16);
|
||||
ALTER TABLE "users" ALTER COLUMN "language" TYPE varchar(16);
|
@ -1 +0,0 @@
|
||||
-- empty
|
@ -1,57 +0,0 @@
|
||||
CREATE TABLE tmp_users (
|
||||
user_id integer NOT NULL PRIMARY KEY,
|
||||
username varchar(128) NOT NULL default '',
|
||||
mail_host varchar(128) NOT NULL default '',
|
||||
created datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
last_login datetime DEFAULT NULL,
|
||||
failed_login datetime DEFAULT NULL,
|
||||
failed_login_counter integer DEFAULT NULL,
|
||||
language varchar(16),
|
||||
preferences text NOT NULL default ''
|
||||
);
|
||||
|
||||
INSERT INTO tmp_users (user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences)
|
||||
SELECT user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences FROM users;
|
||||
|
||||
DROP TABLE users;
|
||||
|
||||
CREATE TABLE users (
|
||||
user_id integer NOT NULL PRIMARY KEY,
|
||||
username varchar(128) NOT NULL default '',
|
||||
mail_host varchar(128) NOT NULL default '',
|
||||
created datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
last_login datetime DEFAULT NULL,
|
||||
failed_login datetime DEFAULT NULL,
|
||||
failed_login_counter integer DEFAULT NULL,
|
||||
language varchar(16),
|
||||
preferences text NOT NULL default ''
|
||||
);
|
||||
|
||||
INSERT INTO users (user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences)
|
||||
SELECT user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences FROM tmp_users;
|
||||
|
||||
CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);
|
||||
|
||||
DROP TABLE tmp_users;
|
||||
|
||||
DROP TABLE users;
|
||||
|
||||
CREATE TABLE tmp_dictionary (
|
||||
user_id integer DEFAULT NULL,
|
||||
language varchar(16) NOT NULL,
|
||||
data text NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO tmp_dictionary (user_id, language, data) SELECT user_id, language, data FROM dictionary;
|
||||
|
||||
CREATE TABLE dictionary (
|
||||
user_id integer DEFAULT NULL,
|
||||
language varchar(16) NOT NULL,
|
||||
data text NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO dictionary (user_id, language, data) SELECT user_id, language, data FROM tmp_dictionary;
|
||||
|
||||
CREATE UNIQUE INDEX ix_dictionary_user_language ON dictionary (user_id, language);
|
||||
|
||||
DROP TABLE tmp_dictionary;
|
@ -1 +0,0 @@
|
||||
-- empty
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+-----------------------------------------------------------------------+
|
||||
| Roundcube Webmail Selenium Tests Entry Point |
|
||||
| |
|
||||
| Copyright (C) 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: |
|
||||
| This is the public entry point for all HTTP requests to the |
|
||||
| Roundcube webmail application loading the 'tests' environment. |
|
||||
+-----------------------------------------------------------------------+
|
||||
| Author: Thomas Bruederli <thomas@roundcube.net> |
|
||||
+-----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
define('INSTALL_PATH', realpath(__DIR__) . '/');
|
||||
|
||||
$GLOBALS['env'] = 'test';
|
||||
|
||||
// include index.php from application root directory
|
||||
include INSTALL_PATH . 'index.php';
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 6.3 KiB |
@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Plugins\Archive;
|
||||
|
||||
use Tests\Browser\Components\Popupmenu;
|
||||
|
||||
class MailTest extends \Tests\Browser\TestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
\bootstrap::init_db();
|
||||
\bootstrap::init_imap();
|
||||
\bootstrap::purge_mailbox('INBOX');
|
||||
\bootstrap::purge_mailbox('Archive');
|
||||
|
||||
// import single email messages
|
||||
foreach (glob(TESTS_DIR . 'data/mail/list_00.eml') as $f) {
|
||||
\bootstrap::import_message($f, 'INBOX');
|
||||
}
|
||||
}
|
||||
|
||||
public function testMailUI()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('mail');
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('.back-sidebar-button');
|
||||
}
|
||||
|
||||
// Folders list
|
||||
$browser->whenAvailable('#mailboxlist', function ($browser) {
|
||||
$browser->assertVisible('li.mailbox.archive')
|
||||
->assertMissing('li.mailbox.archive .unreadcount');
|
||||
});
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('.back-list-button');
|
||||
}
|
||||
|
||||
// Toolbar menu (Archive button inactive)
|
||||
$browser->assertToolbarMenu([], ['archive']);
|
||||
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->ctrlClick('tr:last-child');
|
||||
});
|
||||
|
||||
$browser->clickToolbarMenuItem('archive')
|
||||
->waitForMessage('confirmation', 'Successfully archived')
|
||||
->closeMessage('confirmation');
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('.back-sidebar-button');
|
||||
}
|
||||
|
||||
// Folders list
|
||||
$browser->whenAvailable('#mailboxlist', function ($browser) {
|
||||
$browser->assertSeeIn('li.mailbox.archive .unreadcount', '1')
|
||||
->click('li.mailbox.archive')
|
||||
->waitUntilNotBusy();
|
||||
});
|
||||
|
||||
// Messages list contains the moved message
|
||||
$browser->assertElementsCount('#messagelist tbody tr', 1);
|
||||
|
||||
// Toolbar menu (Archive button inactive again)
|
||||
$browser->assertToolbarMenu([], ['archive']);
|
||||
|
||||
// Test archive class on folder in folder selector
|
||||
$browser->ctrlClick('#messagelist tbody tr')
|
||||
->clickToolbarMenuItem('more')
|
||||
->with(new Popupmenu('message-menu'), function ($browser) {
|
||||
$browser->clickMenuItem('move');
|
||||
})
|
||||
->with(new Popupmenu('folder-selector'), function ($browser) {
|
||||
$browser->assertVisible('li.archive')
|
||||
->assertSeeIn('li.archive', 'Archive');
|
||||
})
|
||||
->click(); // close menus
|
||||
});
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Plugins\Archive;
|
||||
|
||||
class SettingsTest extends \Tests\Browser\TestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
\bootstrap::init_db();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Folders UI
|
||||
*/
|
||||
public function testFolders()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('settings', 'folders');
|
||||
|
||||
// Folders list
|
||||
$browser->with('#subscription-table', function ($browser) {
|
||||
$browser->assertHasClass('li:nth-child(7)', 'archive')
|
||||
->assertSeeIn('li:nth-child(7)', 'Archive')
|
||||
->assertPresent('li:nth-child(7) [type=checkbox][disabled]');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Preferences UI
|
||||
*/
|
||||
public function testPreferences()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('settings');
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('#settings-menu li.preferences')
|
||||
->waitFor('#sections-table');
|
||||
}
|
||||
|
||||
$browser->click('#sections-table tr.folders');
|
||||
|
||||
if ($browser->isPhone()) {
|
||||
$browser->waitFor('#layout-content .footer a.button.submit:not(.disabled)');
|
||||
}
|
||||
|
||||
$browser->withinFrame('#preferences-frame', function ($browser) {
|
||||
if (!$browser->isPhone()) {
|
||||
$browser->waitFor('.formbuttons button.submit');
|
||||
}
|
||||
|
||||
// Main Options fieldset
|
||||
$browser->with('form.propform fieldset.main', function ($browser) {
|
||||
$browser->assertSeeIn('legend', 'Main Options');
|
||||
|
||||
$browser->assertSeeIn('label[for=_archive_mbox]', 'Archive')
|
||||
->assertVisible('select[name=_archive_mbox]')
|
||||
->assertSelected('select[name=_archive_mbox]', 'Archive');
|
||||
|
||||
$browser->select('_archive_mbox', 'Drafts');
|
||||
});
|
||||
|
||||
// Archive fieldset
|
||||
$browser->with('form.propform fieldset.archive', function ($browser) {
|
||||
$browser->assertSeeIn('legend', 'Archive');
|
||||
|
||||
$browser->assertSeeIn('label[for=ff_archive_type]', 'Divide archive by')
|
||||
->assertVisible('select[name=_archive_type]')
|
||||
->assertSelected('select[name=_archive_type]', '')
|
||||
->with('select[name=_archive_type]', function ($browser) {
|
||||
$browser->assertValue('option:nth-child(1)', '')
|
||||
->assertSeeIn('option:nth-child(1)', 'None')
|
||||
->assertValue('option:nth-child(2)', 'year')
|
||||
->assertSeeIn('option:nth-child(2)', 'Year (e.g. Archive/2012)')
|
||||
->assertValue('option:nth-child(3)', 'month')
|
||||
->assertSeeIn('option:nth-child(3)', 'Month (e.g. Archive/2012/06)')
|
||||
->assertValue('option:nth-child(4)', 'tbmonth')
|
||||
->assertSeeIn('option:nth-child(4)', 'Month - Thunderbird compatible (e.g. Archive/2012/2012-06)')
|
||||
->assertValue('option:nth-child(5)', 'sender')
|
||||
->assertSeeIn('option:nth-child(5)', 'Sender email')
|
||||
->assertValue('option:nth-child(6)', 'folder')
|
||||
->assertSeeIn('option:nth-child(6)', 'Original folder');
|
||||
});
|
||||
|
||||
$browser->select('_archive_type', 'year');
|
||||
});
|
||||
|
||||
// Submit form
|
||||
if (!$browser->isPhone()) {
|
||||
$browser->click('.formbuttons button.submit');
|
||||
}
|
||||
});
|
||||
|
||||
if ($browser->isPhone()) {
|
||||
$browser->click('#layout-content .footer a.submit');
|
||||
}
|
||||
|
||||
$browser->waitForMessage('confirmation', 'Successfully saved');
|
||||
|
||||
// Verify if every option has been updated
|
||||
$browser->withinFrame('#preferences-frame', function ($browser) {
|
||||
$browser->assertSelected('_archive_mbox', 'Drafts');
|
||||
$browser->assertSelected('_archive_type', 'year');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Preferences UI (Server Settings)
|
||||
*/
|
||||
public function testServerSettings()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('settings', 'preferences');
|
||||
|
||||
$browser->click('#sections-table tr.server');
|
||||
|
||||
$browser->withinFrame('#preferences-frame', function ($browser) {
|
||||
if (!$browser->isPhone()) {
|
||||
$browser->waitFor('.formbuttons button.submit');
|
||||
}
|
||||
|
||||
// Main Options fieldset
|
||||
$browser->with('form.propform fieldset.main', function ($browser) {
|
||||
$browser->assertSeeIn('label[for=ff_read_on_archive]', 'Mark the message as read on archive')
|
||||
->assertCheckboxState('_read_on_archive', false)
|
||||
->setCheckboxState('_read_on_archive', true);
|
||||
});
|
||||
|
||||
// Submit form
|
||||
if (!$browser->isPhone()) {
|
||||
$browser->click('.formbuttons button.submit');
|
||||
}
|
||||
});
|
||||
|
||||
if ($browser->isPhone()) {
|
||||
$browser->click('#layout-content .footer a.submit');
|
||||
}
|
||||
|
||||
$browser->waitForMessage('confirmation', 'Successfully saved');
|
||||
|
||||
// Verify if every option has been updated
|
||||
$browser->withinFrame('#preferences-frame', function ($browser) {
|
||||
$browser->assertCheckboxState('_read_on_archive', true);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Plugins\AttachmentReminder;
|
||||
|
||||
use Tests\Browser\Components\Dialog;
|
||||
|
||||
class PluginTest extends \Tests\Browser\TestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
\bootstrap::init_db();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Preferences UI (Composing Messages)
|
||||
*/
|
||||
public function testPreferences()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('settings', 'preferences');
|
||||
|
||||
$browser->click('#sections-table tr.compose');
|
||||
|
||||
$browser->withinFrame('#preferences-frame', function ($browser) {
|
||||
if (!$browser->isPhone()) {
|
||||
$browser->waitFor('.formbuttons button.submit');
|
||||
}
|
||||
|
||||
// Main Options fieldset
|
||||
$browser->with('form.propform fieldset.main', function ($browser) {
|
||||
$browser->assertSeeIn('label[for=rcmfd_attachment_reminder]', 'Remind about forgotten attachments')
|
||||
->assertCheckboxState('_attachment_reminder', false)
|
||||
->setCheckboxState('_attachment_reminder', true);
|
||||
});
|
||||
|
||||
// Submit form
|
||||
if (!$browser->isPhone()) {
|
||||
$browser->click('.formbuttons button.submit');
|
||||
}
|
||||
});
|
||||
|
||||
if ($browser->isPhone()) {
|
||||
$browser->click('#layout-content .footer a.submit');
|
||||
}
|
||||
|
||||
$browser->waitForMessage('confirmation', 'Successfully saved');
|
||||
|
||||
// Verify if every option has been updated
|
||||
$browser->withinFrame('#preferences-frame', function ($browser) {
|
||||
$browser->assertCheckboxState('_attachment_reminder', true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Mail Compose page
|
||||
*
|
||||
* @depends testPreferences
|
||||
*/
|
||||
public function testMailCompose()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$send_btn = $browser->isPhone() ? '.buttons a.send' : '.formbuttons button.send';
|
||||
|
||||
$browser->go('mail', 'compose');
|
||||
|
||||
$browser->waitFor('#compose_to')
|
||||
->type('#compose_to input', 'test@domain.tld')
|
||||
->type('#compose-subject', 'subject')
|
||||
->type('#composebody', 'File attached')
|
||||
->click($send_btn);
|
||||
|
||||
// Expect a dialog, Click "Attach a file" button
|
||||
$browser->with(new Dialog(), function ($browser) {
|
||||
$browser->assertDialogTitle('Missing attachment?')
|
||||
->assertDialogContent('Did you forget to attach a file?')
|
||||
->assertButton('mainaction.attach', 'Attach a file')
|
||||
->assertButton('send', 'Send')
|
||||
->clickButton('mainaction.attach');
|
||||
});
|
||||
|
||||
// Click the Send button again
|
||||
$browser->click($send_btn);
|
||||
|
||||
// Expect the dialog again, click Send button (in the dialog)
|
||||
$browser->with(new Dialog(), function ($browser) {
|
||||
$browser->assertDialogTitle('Missing attachment?')
|
||||
->clickButton('send');
|
||||
});
|
||||
|
||||
$browser->waitForMessage('confirmation', 'Message sent successfully.');
|
||||
});
|
||||
}
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Plugins\Markasjunk;
|
||||
|
||||
use Tests\Browser\Components\Popupmenu;
|
||||
|
||||
class MailTest extends \Tests\Browser\TestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
\bootstrap::init_db();
|
||||
\bootstrap::init_imap();
|
||||
\bootstrap::purge_mailbox('INBOX');
|
||||
\bootstrap::purge_mailbox('Junk');
|
||||
|
||||
// import single email message
|
||||
\bootstrap::import_message(TESTS_DIR . 'data/mail/list_00.eml', 'INBOX');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test plugin functionality in Mail UI
|
||||
*/
|
||||
public function testMailUI()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('mail');
|
||||
|
||||
// Toolbar menu (Spam button inactive)
|
||||
$browser->assertToolbarMenu([], ['junk']);
|
||||
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->ctrlClick('tr:last-child');
|
||||
});
|
||||
|
||||
$browser->clickToolbarMenuItem('junk')
|
||||
->waitForMessage('confirmation', 'Successfully reported as junk')
|
||||
->closeMessage('confirmation')
|
||||
->assertElementsCount('#messagelist tbody tr', 0) // empty list
|
||||
->waitForMessage('confirmation', 'Message(s) moved successfully.')
|
||||
->closeMessage('confirmation');
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('.back-sidebar-button');
|
||||
}
|
||||
|
||||
// Folders list
|
||||
$browser->whenAvailable('#mailboxlist', function ($browser) {
|
||||
$browser->assertSeeIn('li.mailbox.junk .unreadcount', '1')
|
||||
->assertMissing('li.mailbox.inbox .unreadcount')
|
||||
->click('li.mailbox.junk')
|
||||
->waitUntilNotBusy();
|
||||
});
|
||||
|
||||
// Toolbar menu (Non-Junk button inactive)
|
||||
$browser->assertToolbarMenu([], ['notjunk']);
|
||||
|
||||
// Messages list contains the moved message
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->assertElementsCount('tr', 1)
|
||||
->ctrlClick('tr:last-child');
|
||||
});
|
||||
|
||||
$browser->clickToolbarMenuItem('notjunk')
|
||||
->waitForMessage('confirmation', 'Successfully reported as not junk')
|
||||
->closeMessage('confirmation')
|
||||
->assertElementsCount('#messagelist tbody tr', 0) // empty list
|
||||
->waitForMessage('confirmation', 'Message(s) moved successfully.')
|
||||
->closeMessage('confirmation');
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('.back-sidebar-button');
|
||||
}
|
||||
|
||||
// Folders list, the message is back in INBOX
|
||||
$browser->whenAvailable('#mailboxlist', function ($browser) {
|
||||
$browser->assertMissing('li.mailbox.junk .unreadcount')
|
||||
->assertSeeIn('li.mailbox.inbox .unreadcount', '1')
|
||||
->click('li.mailbox.inbox')
|
||||
->waitUntilNotBusy();
|
||||
});
|
||||
|
||||
// Messages list contains the moved message
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->assertElementsCount('tr', 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test plugin functionality on email preview page
|
||||
*
|
||||
* @depends testMailUI
|
||||
*/
|
||||
public function testMailView()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('mail');
|
||||
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->mouseover('tr:last-child')->doubleClick();
|
||||
});
|
||||
|
||||
$browser->waitFor('#message-content');
|
||||
|
||||
// Toolbar menu (Junk button active), click it
|
||||
$browser->clickToolbarMenuItem('junk')
|
||||
->waitFor('#messagelist')
|
||||
->waitUntilNotBusy()
|
||||
->assertElementsCount('#messagelist tbody tr', 0); // empty list
|
||||
|
||||
if (!$browser->isDesktop()) {
|
||||
$browser->click('.back-sidebar-button');
|
||||
}
|
||||
|
||||
// Folders list
|
||||
$browser->whenAvailable('#mailboxlist', function ($browser) {
|
||||
$browser->click('li.mailbox.junk')
|
||||
->waitUntilNotBusy();
|
||||
});
|
||||
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->mouseover('tr:last-child')->doubleClick();
|
||||
});
|
||||
|
||||
$browser->waitFor('#message-content');
|
||||
|
||||
// Toolbar menu (Junk button active), click it
|
||||
$browser->clickToolbarMenuItem('notjunk')
|
||||
->waitFor('#messagelist')
|
||||
->waitUntilNotBusy()
|
||||
->assertElementsCount('#messagelist tbody tr', 0); // empty list
|
||||
});
|
||||
}
|
||||
}
|
@ -1,223 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Have I Been Pwned Password Strength Driver
|
||||
*
|
||||
* Driver to check passwords using HIBP:
|
||||
* https://haveibeenpwned.com/Passwords
|
||||
*
|
||||
* This driver will return a strength of:
|
||||
* 3: if the password WAS NOT found in HIBP
|
||||
* 1: if the password WAS found in HIBP
|
||||
* 2: if there was an ERROR retrieving data.
|
||||
*
|
||||
* To use this driver, configure (in ../config.inc.php):
|
||||
*
|
||||
* $config['password_strength_driver'] = 'pwned';
|
||||
* $config['password_minimum_score'] = 3;
|
||||
*
|
||||
* Set the minimum score to 3 if you want to make sure that all
|
||||
* passwords are successfully checked against HIBP (recommended).
|
||||
*
|
||||
* Set it to 2 if you still want to accept passwords in case a
|
||||
* HIBP check fails for some (technical) reason.
|
||||
*
|
||||
* Setting the minimum score to 1 or less effectively renders
|
||||
* the checks useless, as all passwords would be accepted.
|
||||
* Setting it to 4 or more will effectively reject all passwords.
|
||||
*
|
||||
* This driver will only return a maximum score of 3 because not
|
||||
* being listed in HIBP does not necessarily mean that the
|
||||
* password is a good one. It is therefore recommended to also
|
||||
* configure a minimum length for the password.
|
||||
*
|
||||
* Background reading (don't worry, your passwords are not sent anywhere):
|
||||
* https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/#cloudflareprivacyandkanonymity
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Christoph Langguth
|
||||
*
|
||||
* Copyright (C) The Roundcube Dev Team
|
||||
*
|
||||
* 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 3 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. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
class rcube_pwned_password
|
||||
{
|
||||
// API URL. Note: the trailing slash is mandatory.
|
||||
const API_URL = 'https://api.pwnedpasswords.com/range/';
|
||||
|
||||
// See https://www.troyhunt.com/enhancing-pwned-passwords-privacy-with-padding/
|
||||
const ENHANCED_PRIVACY_CURL = 1;
|
||||
|
||||
// Score constants, these directly correspond to the score that is returned.
|
||||
const SCORE_LISTED = 1;
|
||||
const SCORE_ERROR = 2;
|
||||
const SCORE_NOT_LISTED = 3;
|
||||
|
||||
/**
|
||||
* Rule description.
|
||||
*
|
||||
* @return array human-readable description of the check rule.
|
||||
*/
|
||||
function strength_rules()
|
||||
{
|
||||
$rc = rcmail::get_instance();
|
||||
return array($rc->gettext('password.pwned_mustnotbedisclosed'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Password strength check.
|
||||
* Return values:
|
||||
* 1 - if password is definitely compromised.
|
||||
* 2 - if status for password can't be determined (network failures etc.)
|
||||
* 3 - if password is not publicly known to be compromised.
|
||||
*
|
||||
* @param string $passwd Password
|
||||
*
|
||||
* @return array password score (1 to 3) and (optional) reason message
|
||||
*/
|
||||
function check_strength($passwd)
|
||||
{
|
||||
$score = $this->check_pwned($passwd);
|
||||
$message = null;
|
||||
|
||||
if ($score !== self::SCORE_NOT_LISTED) {
|
||||
$rc = rcmail::get_instance();
|
||||
if ($score === self::SCORE_LISTED) {
|
||||
$message = $rc->gettext('password.pwned_isdisclosed');
|
||||
}
|
||||
else {
|
||||
$message = $rc->gettext('password.pwned_fetcherror');
|
||||
}
|
||||
}
|
||||
|
||||
return array($score, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check password using HIBP.
|
||||
*
|
||||
* @param string $passwd
|
||||
*
|
||||
* @return int score, one of the SCORE_* constants (between 1 and 3).
|
||||
*/
|
||||
function check_pwned($passwd)
|
||||
{
|
||||
// initialize with error score
|
||||
$result = self::SCORE_ERROR;
|
||||
|
||||
if (!$this->can_retrieve()) {
|
||||
// Log the fact that we cannot check because of configuration error.
|
||||
rcube::raise_error("Need curl or allow_url_fopen to check password strength with 'pwned'", true, true);
|
||||
}
|
||||
else {
|
||||
list($prefix, $suffix) = $this->hash_split($passwd);
|
||||
|
||||
$suffixes = $this->retrieve_suffixes(self::API_URL . $prefix);
|
||||
|
||||
if ($suffixes) {
|
||||
$result = $this->check_suffix_in_list($suffix, $suffixes);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function hash_split($passwd)
|
||||
{
|
||||
$hash = strtolower(sha1($passwd));
|
||||
$prefix = substr($hash, 0, 5);
|
||||
$suffix = substr($hash, 5);
|
||||
|
||||
return array($prefix, $suffix);
|
||||
}
|
||||
|
||||
function can_retrieve()
|
||||
{
|
||||
return $this->can_curl() || $this->can_fopen();
|
||||
}
|
||||
|
||||
function can_curl()
|
||||
{
|
||||
return function_exists('curl_init');
|
||||
}
|
||||
|
||||
function can_fopen()
|
||||
{
|
||||
return ini_get('allow_url_fopen');
|
||||
}
|
||||
|
||||
function retrieve_suffixes($url)
|
||||
{
|
||||
if ($this->can_curl()) {
|
||||
return $this->retrieve_curl($url);
|
||||
}
|
||||
else {
|
||||
return $this->retrieve_fopen($url);
|
||||
}
|
||||
}
|
||||
|
||||
function retrieve_curl($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
if (self::ENHANCED_PRIVACY_CURL == 1) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Add-Padding: true'));
|
||||
}
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function retrieve_fopen($url)
|
||||
{
|
||||
$output = '';
|
||||
$ch = fopen($url, 'r');
|
||||
while (!feof($ch)) {
|
||||
$output .= fgets($ch);
|
||||
}
|
||||
fclose($ch);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function check_suffix_in_list($candidate, $list)
|
||||
{
|
||||
// initialize to error in case there are no lines at all
|
||||
$result = self::SCORE_ERROR;
|
||||
|
||||
foreach (preg_split('/[\r\n]+/', $list) as $line) {
|
||||
$line = strtolower($line);
|
||||
|
||||
if (preg_match('/^([0-9a-f]{35}):(\d+)$/', $line, $matches)) {
|
||||
if ($matches[2] > 0 && $matches[1] === $candidate) {
|
||||
// more than 0 occurrences, and suffix matches
|
||||
// -> password is compromised
|
||||
return self::SCORE_LISTED;
|
||||
}
|
||||
|
||||
// valid line, not matching the current password
|
||||
$result = self::SCORE_NOT_LISTED;
|
||||
}
|
||||
else {
|
||||
// invalid line
|
||||
return self::SCORE_ERROR;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
Subproject commit d56529721ad8a4bbfb81972c70ee697131fd89b4
|
@ -0,0 +1 @@
|
||||
Subproject commit 884c2bd51b747465a8b1d340cb4186082da1f786
|
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Plugins\Zipdownload;
|
||||
|
||||
use Tests\Browser\Components\Popupmenu;
|
||||
|
||||
class MailTest extends \Tests\Browser\TestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
\bootstrap::init_imap();
|
||||
\bootstrap::purge_mailbox('INBOX');
|
||||
|
||||
// import single email messages
|
||||
foreach (glob(TESTS_DIR . 'data/mail/list_0?.eml') as $f) {
|
||||
\bootstrap::import_message($f, 'INBOX');
|
||||
}
|
||||
}
|
||||
|
||||
public function testMailUI()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->go('mail');
|
||||
|
||||
$browser->whenAvailable('#messagelist tbody', function ($browser) {
|
||||
$browser->ctrlClick('tr:first-child');
|
||||
});
|
||||
|
||||
// Test More > Download > Source (single message selected)
|
||||
$browser->clickToolbarMenuItem('more')
|
||||
->with(new Popupmenu('message-menu'), function ($browser) {
|
||||
$browser->clickMenuItem('download');
|
||||
})
|
||||
->with(new Popupmenu('zipdownload-menu'), function ($browser) {
|
||||
$browser->assertVisible('a.download.eml:not(.disabled)')
|
||||
->assertSeeIn('a.download.eml', 'Source (.eml)')
|
||||
->assertVisible('a.download.mbox.disabled')
|
||||
->assertSeeIn('a.download.mbox', 'Mbox format (.zip)')
|
||||
->assertVisible('a.download.maildir.disabled')
|
||||
->assertSeeIn('a.download.maildir', 'Maildir format (.zip)')
|
||||
->click('a.download.eml');
|
||||
|
||||
$filename = 'Test HTML with local and remote image.eml';
|
||||
$email = $browser->readDownloadedFile($filename);
|
||||
$browser->removeDownloadedFile($filename);
|
||||
$this->assertTrue(strpos($email, 'Subject: Test HTML with local and remote image') !== false);
|
||||
});
|
||||
|
||||
// Test More > Download > Mailbox format (two messages selected)
|
||||
$browser->ctrlClick('#messagelist tbody tr:nth-of-type(2)')
|
||||
->clickToolbarMenuItem('more')
|
||||
->with(new Popupmenu('message-menu'), function ($browser) {
|
||||
$browser->clickMenuItem('download');
|
||||
})
|
||||
->with(new Popupmenu('zipdownload-menu'), function ($browser) {
|
||||
$browser->assertVisible('a.download.eml.disabled')
|
||||
->assertVisible('a.download.mbox:not(.disabled)')
|
||||
->assertVisible('a.download.maildir:not(.disabled)')
|
||||
->click('a.download.mbox');
|
||||
|
||||
$filename = 'INBOX.zip';
|
||||
$files = $this->getFilesFromZip($filename);
|
||||
$browser->removeDownloadedFile($filename);
|
||||
|
||||
$this->assertSame(['INBOX.mbox'], $files);
|
||||
});
|
||||
|
||||
// Test More > Download > Maildir format (two messages selected)
|
||||
$browser->clickToolbarMenuItem('more')
|
||||
->with(new Popupmenu('message-menu'), function ($browser) {
|
||||
$browser->clickMenuItem('download');
|
||||
})
|
||||
->with(new Popupmenu('zipdownload-menu'), function ($browser) {
|
||||
$browser->click('a.download.maildir');
|
||||
|
||||
$filename = 'INBOX.zip';
|
||||
$files = $this->getFilesFromZip($filename);
|
||||
$browser->removeDownloadedFile($filename);
|
||||
$this->assertCount(2, $files);
|
||||
});
|
||||
|
||||
// Test attachments download
|
||||
$browser->click('#messagelist tbody tr:nth-of-type(2)')
|
||||
->waitForMessage('loading', 'Loading...')
|
||||
->waitFor('#messagecontframe')
|
||||
->waitUntilMissing('#messagestack')
|
||||
->withinFrame('#messagecontframe', function ($browser) {
|
||||
$browser->waitFor('.header-links a.zipdownload')
|
||||
->click('.header-links a.zipdownload');
|
||||
});
|
||||
|
||||
$filename = 'Lines.zip';
|
||||
$files = $this->getFilesFromZip($filename);
|
||||
$browser->removeDownloadedFile($filename);
|
||||
$expected = ['lines.txt', 'lines_lf.txt'];
|
||||
$this->assertSame($expected, $files);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to extract files list from downloaded zip file
|
||||
*/
|
||||
private function getFilesFromZip($filename)
|
||||
{
|
||||
$filename = TESTS_DIR . "downloads/$filename";
|
||||
|
||||
// Give the browser a chance to finish download
|
||||
if (!file_exists($filename)) {
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
$zip = new \ZipArchive;
|
||||
$files = [];
|
||||
|
||||
if ($zip->open($filename)) {
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$files[] = $zip->getNameIndex($i);
|
||||
}
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
return $files;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue