Page MenuHomePhorge

No OneTemporary

diff --git a/INSTALL b/INSTALL
index 0e8ae08ce..5b1c21dac 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,233 +1,236 @@
INTRODUCTION
============
This file describes the basic steps to install Roundcube Webmail on your
web server. For additional information, please also consult the project's
wiki page at http://trac.roundcube.net/wiki
REQUIREMENTS
============
* The Apache, Lighttpd, Cherokee or Hiawatha web server
* .htaccess support allowing overrides for DirectoryIndex
* PHP Version 5.2.1 or greater including
- PCRE, DOM, JSON, XML, Session, Sockets (required)
- PHP Data Objects (PDO) with driver for either MySQL, PostgreSQL or SQLite (required)
Note: MySQL database driver requires PHP 5.3 or newer.
- Libiconv, Zip (recommended)
- Fileinfo, Mcrypt, mbstring (optional)
* PEAR packages distributed with Roundcube or external:
- Mail_Mime 1.8.1 or newer
- Mail_mimeDecode 1.5.5 or newer
- Net_SMTP (latest from https://github.com/pear/Net_SMTP/)
- Net_IDNA2 0.1.1 or newer
- Auth_SASL 1.0.6 or newer
* php.ini options (see .htaccess file):
- error_reporting E_ALL & ~E_NOTICE (or lower)
- memory_limit > 16MB (increase as suitable to support large attachments)
- file_uploads enabled (for attachment upload features)
- session.auto_start disabled
- zend.ze1_compatibility_mode disabled
- suhosin.session.encrypt disabled
- mbstring.func_overload disabled
- magic_quotes_runtime disabled
- magic_quotes_sybase disabled
* PHP compiled with OpenSSL to connect to IMAPS and to use the spell checker
* A MySQL (4.0.8 or newer), PostgreSQL, MS SQL Server (2005 or newer) database engine
or SQLite support in PHP
* One of the above databases with permission to create tables
* An SMTP server (recommended) or PHP configured for mail delivery
INSTALLATION
============
1. Decompress and put this folder somewhere inside your document root
2. Make sure that the following directories (and the files within)
are writable by the webserver
- /temp
- /logs
3. Create a new database and a database user for Roundcube (see DATABASE SETUP)
4. Point your browser to http://url-to-roundcube/installer/
5. Follow the instructions of the install script (or see MANUAL CONFIGURATION)
6. After creating and testing the configuration, remove the installer directory
7. Check Known Issues section of this file
8. Done!
CONFIGURATION HINTS
===================
Roundcube writes internal errors to the 'errors' log file located in the logs
-directory which can be configured in config/main.inc.php. If you want ordinary
+directory which can be configured in config/config.inc.php. If you want ordinary
PHP errors to be logged there as well, enable the 'php_value error_log' line
in the .htaccess file and set the path to the log file accordingly.
By default the session_path settings of PHP are not modified by Roundcube.
However if you want to limit the session cookies to the directory where
Roundcube resides you can uncomment and configure the according line
in the .htaccess file.
DATABASE SETUP
==============
Note: Database for Roundcube must use UTF-8 character set.
* MySQL
-------
Setting up the mysql database can be done by creating an empty database,
importing the table layout and granting the proper permissions to the
roundcube user. Here is an example of that procedure:
# mysql
> CREATE DATABASE roundcubemail /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost
IDENTIFIED BY 'password';
> quit
# mysql roundcubemail < SQL/mysql.initial.sql
Note 1: 'password' is the master password for the roundcube user. It is strongly
recommended you replace this with a more secure password. Please keep in
mind: You need to specify this password later in 'config/db.inc.php'.
* SQLite
--------
Versions of sqlite database engine older than 3 aren't supported.
Database file and structure is created automatically by Roundcube.
Make sure your configuration points to some file location and that the
webserver can write to the file and the directory containing the file.
* PostgreSQL
------------
To use Roundcube with PostgreSQL support you have to follow these
simple steps, which have to be done as the postgres system user (or
which ever is the database superuser):
$ createuser -P roundcube
$ createdb -O roundcube -E UNICODE roundcubemail
$ psql -U roundcube -f SQL/postgres.initial.sql roundcubemail
Note: in some system configurations you might need to add '-U postgres' to
createuser and createdb commands.
* Microsoft SQL Server
----------------------
Language/locale of the database must be set to us_english (1033). More info
on this at http://trac.roundcube.net/ticket/1488918.
Database cleaning
-----------------
To keep your database slick and clean we recommend to periodically execute
bin/cleandb.sh which finally removes all records that are marked as deleted.
Best solution is to install a cronjob running this script daily.
MANUAL CONFIGURATION
====================
-First of all, rename the files config/*.inc.php.dist to config/*.inc.php.
-You can then change these files according to your environment and your needs.
-Details about the config parameters can be found in the config files.
-See http://trac.roundcube.net/wiki/Howto_Install for even more guidance.
+First of all, copy the sample configuration file config/config.inc.php.sample
+to config/config.inc.php and make the necessary adjustments according to your
+environment and your needs. More configuration options can be copied from the
+config/defaults.inc.php file into your local config.inc.php file as needed.
+Read the comments above the individual configuration options to find out what
+they do or read http://trac.roundcube.net/wiki/Howto_Install for even more
+guidance.
You can also modify the default .htaccess file. This is necessary to
increase the allowed size of file attachments, for example:
php_value upload_max_filesize 2M
UPGRADING
=========
If you already have a previous version of Roundcube installed,
please refer to the instructions in UPGRADING guide.
OPTIMISING
==========
There are two forms of optimisation here, compression and caching, both aimed
at increasing an end user's experience using Roundcube Webmail. Compression
allows the static web pages to be delivered with less bandwidth. The index.php
of Roundcube Webmail already enables compression on its output. The settings
below allow compression to occur for all static files. Caching sets HTTP
response headers that enable a user's web client to understand what is static
and how to cache it.
The caching directives used are:
* Etags - sets at tag so the client can request is the page has changed
* Cache-control - defines the age of the page and that the page is 'public'
This enables clients to cache javascript files that don't have private
information between sessions even if using HTTPS. It also allows proxies
to share the same cached page between users.
* Expires - provides another hint to increase the lifetime of static pages.
For more information refer to RFC 2616.
Side effects:
-------------
These directives are designed for production use. If you are using this in
a development environment you may get horribly confused if your webclient
is caching stuff that you changed on the server. Disabling the expires
parts below should save you some grief.
If you are changing the skins, it is recommended that you copy content to
a different directory apart from 'default'.
Apache:
-------
To enable these features in apache the following modules need to be enabled:
* mod_deflate
* mod_expires
* mod_headers
The optimisation is already included in the .htaccess file in the top
directory of your installation.
If you are using Apache version 2.2.9 and later, in the .htaccess file
change the 'append' word to 'merge' for a more correct response. Keeping
as 'append' shouldn't cause any problems though changing to merge will
eliminate the possibility of duplicate 'public' headers in Cache-control.
Lighttpd:
---------
With Lightty the addition of Expire: tags by mod_expire is incompatible with
the addition of "Cache-control: public". Using Cache-control 'public' is
used below as it is assumed to give a better caching result.
Enable modules in server.modules:
"mod_setenv"
"mod_compress"
Mod_compress is a server side cache of compressed files to improve its performance.
$HTTP["host"] == "www.example.com" {
static-file.etags = "enable"
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Etag.use-mtimeDetails
etag.use-mtime = "enable"
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModSetEnv
$HTTP["url"] =~ "^/roundcubemail/(plugins|skins|program)" {
setenv.add-response-header = ( "Cache-Control" => "public, max-age=2592000")
}
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModCompress
# set compress.cache-dir to somewhere outside the docroot.
compress.cache-dir = var.statedir + "/cache/compress"
compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml", "image/gif", "image/png")
}
KNOWN ISSUES
============
Installations with uw-imap server should set imap_disabled_caps = array('ESEARCH')
in main configuration file. ESEARCH implementation in this server is broken (#1489184).
diff --git a/UPGRADING b/UPGRADING
index 03d549920..4ac0ca3b5 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -1,65 +1,65 @@
UPGRADING instructions
======================
Follow these instructions if upgrading from a previous version
of Roundcube Webmail. We recommend to carefully backup the existing
installation as well as the database before going through the following steps.
Using the update script
-----------------------
There is a shell script (for unix based systems) that does the job for you.
To use it, unpack the archive of the new Roundcube version to a temporary location
(don't replace the Roundcube installation you want to update)
and cd into that directory. From there, run the following command in a shell:
./bin/installto.sh <TARGET-FOLDER>
For <TARGET-FOLDER> you specify the path to the Roundcube installation
which should be updated. The update script will then copy all new files to the
target location and check and update the configuration and database schema.
After all is done, the temporary folder with the new Roundcube files can be
removed again.
WARNING: See Post-Upgrade Activities section below.
Updating manually
-----------------
If you don't have shell access to the Roundcube installation or if not running
it on a unix system, you need to do the following operations by hand:
1. Replace index.php and all files in
- ./bin/
- ./SQL/
- ./program/
2. rsync the contents of the following folders from your installation
directory into the target folder:
./skins/
./plugins/
3. Run ./bin/update.sh from the commandline OR
open http://url-to-roundcube/installer/ in a browser and choose "3 Test config".
To enable the latter one, you have to temporary set 'enable_installer'
- to true in your local config/main.inc.php file.
+ to true in your local config/config.inc.php file.
WARNING: See SQLite database upgrade below.
4. Let the update script/installer check your configuration and
update your config files and database schema as suggested by the updater.
5. Make sure 'enable_installer' is set to false again.
6. See Post-Upgrade Activities section.
Post-Upgrade Activities
-----------------------
1. Check .htaccess settings (some php settings could become required)
2. If you're using build-in addressbook, run indexing script /bin/indexcontacts.sh.
3. When upgrading from version older than 0.6-beta you should make sure
your folder settings contain namespace prefix. For example Courier users
should add INBOX. prefix to folder names in main configuration file.
4. Check system requirements in INSTALL file.
SQLite database upgrade
-----------------------
Versions older than 0.9 were supporting SQLite v2 only. Newer versions require
database in v3 format. The best what you can do is to convert database file
to the new format using command line tools:
sqlite OLD.DB .dump | sqlite3 NEW.DB
diff --git a/bin/installto.sh b/bin/installto.sh
index 8e1ab1fbf..269a5dc06 100755
--- a/bin/installto.sh
+++ b/bin/installto.sh
@@ -1,81 +1,81 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| bin/installto.sh |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2012, 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: |
| Update an existing Roundcube installation with files from |
| this version |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
$target_dir = unslashify($_SERVER['argv'][1]);
if (empty($target_dir) || !is_dir(realpath($target_dir)))
rcube::raise_error("Invalid target: not a directory\nUsage: installto.sh <TARGET>", false, true);
// read version from iniset.php
$iniset = @file_get_contents($target_dir . '/program/include/iniset.php');
if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m))
rcube::raise_error("No valid Roundcube installation found at $target_dir", false, true);
$oldversion = $m[1];
if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>='))
rcube::raise_error("Installation at target location is up-to-date!", false, true);
echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
$input = trim(fgets(STDIN));
if (strtolower($input) == 'y') {
$err = false;
echo "Copying files to target location...";
foreach (array('program','installer','bin','SQL','plugins','skins') as $dir) {
if (!system("rsync -avC " . INSTALL_PATH . "$dir/* $target_dir/$dir/")) {
$err = true;
break;
}
}
- foreach (array('index.php','.htaccess','config/main.inc.php.dist','config/db.inc.php.dist','CHANGELOG','README.md','UPGRADING','LICENSE') as $file) {
+ foreach (array('index.php','.htaccess','config/defaults.inc.php','CHANGELOG','README.md','UPGRADING','LICENSE') as $file) {
if (!system("rsync -av " . INSTALL_PATH . "$file $target_dir/$file")) {
$err = true;
break;
}
}
echo "done.\n\n";
if (is_dir("$target_dir/skins/default")) {
echo "Removing old default skin...";
system("rm -rf $target_dir/skins/default $target_dir/plugins/jqueryui/themes/default");
foreach (glob(INSTALL_PATH . "plugins/*/skins") as $plugin_skin_dir) {
$plugin_skin_dir = preg_replace('!^.*' . INSTALL_PATH . '!', '', $plugin_skin_dir);
if (is_dir("$target_dir/$plugin_skin_dir/classic"))
system("rm -rf $target_dir/$plugin_skin_dir/default");
}
echo "done.\n\n";
}
if (!$err) {
echo "Running update script at target...\n";
system("cd $target_dir && bin/update.sh --version=$oldversion");
echo "All done.\n";
}
}
else
echo "Update cancelled. See ya!\n";
?>
diff --git a/bin/update.sh b/bin/update.sh
index 15edc2880..71e2c630a 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -1,180 +1,181 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| bin/update.sh |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2010-2011, The Roundcube Dev Team |
+ | Copyright (C) 2010-2013, 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: |
| Check local configuration and database schema after upgrading |
| to a new version |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
require_once INSTALL_PATH . 'installer/rcube_install.php';
// get arguments
-$opts = rcube_utils::get_opt(array('v' => 'version'));
+$opts = rcube_utils::get_opt(array('v' => 'version', 'y' => 'accept'));
// ask user if no version is specified
if (!$opts['version']) {
echo "What version are you upgrading from? Type '?' if you don't know.\n";
if (($input = trim(fgets(STDIN))) && preg_match('/^[0-9.]+[a-z-]*$/', $input))
$opts['version'] = $input;
else
$opts['version'] = RCMAIL_VERSION;
}
-if ($opts['version'] && version_compare(version_parse($opts['version']), version_parse(RCMAIL_VERSION), '>='))
- die("Nothing to be done here. Bye!\n");
-
-
$RCI = rcube_install::get_instance();
$RCI->load_config();
if ($RCI->configured) {
$success = true;
-
- if ($messages = $RCI->check_config()) {
+
+ if (($messages = $RCI->check_config()) || $RCI->legacy_config) {
$success = false;
$err = 0;
- // list missing config options
- if (is_array($messages['missing'])) {
- echo "WARNING: Missing config options:\n";
- echo "(These config options should be present in the current configuration)\n";
-
- foreach ($messages['missing'] as $msg) {
- echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
- $err++;
- }
- echo "\n";
- }
-
// list old/replaced config options
if (is_array($messages['replaced'])) {
echo "WARNING: Replaced config options:\n";
echo "(These config options have been replaced or renamed)\n";
foreach ($messages['replaced'] as $msg) {
echo "- '" . $msg['prop'] . "' was replaced by '" . $msg['replacement'] . "'\n";
$err++;
}
echo "\n";
}
// list obsolete config options (just a notice)
if (is_array($messages['obsolete'])) {
echo "NOTICE: Obsolete config options:\n";
echo "(You still have some obsolete or inexistent properties set. This isn't a problem but should be noticed)\n";
foreach ($messages['obsolete'] as $msg) {
echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
$err++;
}
echo "\n";
}
+ if (!$err && $RCI->legacy_config) {
+ echo "WARNING: Your configuration needs to be migrated!\n";
+ echo "We changed the configuration files structure and your two config files main.inc.php and db.inc.php have to be merged into one single file.\n";
+ $err++;
+ }
+
// ask user to update config files
if ($err) {
- echo "Do you want me to fix your local configuration? (y/N)\n";
- $input = trim(fgets(STDIN));
+ if (!$opts['accept']) {
+ echo "Do you want me to fix your local configuration? (y/N)\n";
+ $input = trim(fgets(STDIN));
+ }
// positive: let's merge the local config with the defaults
- if (strtolower($input) == 'y') {
- $copy1 = $copy2 = $write1 = $write2 = false;
-
+ if ($opts['accept'] || strtolower($input) == 'y') {
+ $error = $written = false;
+
// backup current config
- echo ". backing up the current config files...\n";
- $copy1 = copy(RCMAIL_CONFIG_DIR . '/main.inc.php', RCMAIL_CONFIG_DIR . '/main.old.php');
- $copy2 = copy(RCMAIL_CONFIG_DIR . '/db.inc.php', RCMAIL_CONFIG_DIR . '/db.old.php');
-
- if ($copy1 && $copy2) {
+ echo ". backing up the current config file(s)...\n";
+
+ foreach (array('config', 'main', 'db') as $file) {
+ if (file_exists(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php')) {
+ if (!copy(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php', RCMAIL_CONFIG_DIR . '/' . $file . '.old.php')) {
+ $error = true;
+ }
+ }
+ }
+
+ if (!$error) {
$RCI->merge_config();
-
- echo ". writing " . RCMAIL_CONFIG_DIR . "/main.inc.php...\n";
- $write1 = file_put_contents(RCMAIL_CONFIG_DIR . '/main.inc.php', $RCI->create_config('main', true));
- echo ". writing " . RCMAIL_CONFIG_DIR . "/main.db.php...\n";
- $write2 = file_put_contents(RCMAIL_CONFIG_DIR . '/db.inc.php', $RCI->create_config('db', true));
+ echo ". writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n";
+ $written = file_put_contents(RCMAIL_CONFIG_DIR . '/config.inc.php', $RCI->create_config());
}
-
+
// Success!
- if ($write1 && $write2) {
+ if ($written) {
echo "Done.\n";
echo "Your configuration files are now up-to-date!\n";
if ($messages['missing']) {
echo "But you still need to add the following missing options:\n";
foreach ($messages['missing'] as $msg)
echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
}
+
+ if ($RCI->legacy_config) {
+ foreach (array('main', 'db') as $file) {
+ @unlink(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php');
+ }
+ }
}
else {
- echo "Failed to write config files!\n";
+ echo "Failed to write config file(s)!\n";
echo "Grant write privileges to the current user or update the files manually according to the above messages.\n";
}
}
else {
echo "Please update your config files manually according to the above messages.\n";
}
}
// check dependencies based on the current configuration
if (is_array($messages['dependencies'])) {
echo "WARNING: Dependency check failed!\n";
echo "(Some of your configuration settings require other options to be configured or additional PHP modules to be installed)\n";
foreach ($messages['dependencies'] as $msg) {
echo "- " . $msg['prop'] . ': ' . $msg['explain'] . "\n";
}
echo "Please fix your config files and run this script again!\n";
echo "See ya.\n";
}
}
// check file type detection
if ($RCI->check_mime_detection()) {
echo "WARNING: File type detection doesn't work properly!\n";
echo "Please check the 'mime_magic' config option or the finfo functions of PHP andrun this script again.\n";
}
if ($RCI->check_mime_extensions()) {
echo "WARNING: Mimetype to file extension mapping doesn't work properly!\n";
echo "Please check the 'mime_types' config option and run this script again.\n";
}
// check database schema
if ($RCI->config['db_dsnw']) {
echo "Executing database schema update.\n";
system(INSTALL_PATH . "bin/updatedb.sh --package=roundcube --version=" . $opts['version']
. " --dir=" . INSTALL_PATH . DIRECTORY_SEPARATOR . "SQL", $res);
$success = !$res;
}
// index contacts for fulltext searching
- if (version_compare(version_parse($opts['version']), '0.6.0', '<')) {
+ if ($opts['version'] && version_compare(version_parse($opts['version']), '0.6.0', '<')) {
system(INSTALL_PATH . 'bin/indexcontacts.sh');
}
if ($success) {
echo "This instance of Roundcube is up-to-date.\n";
echo "Have fun!\n";
}
}
else {
echo "This instance of Roundcube is not yet configured!\n";
echo "Open http://url-to-roundcube/installer/ in your browser and follow the instuctions.\n";
}
?>
diff --git a/config/config.inc.php.sample b/config/config.inc.php.sample
new file mode 100644
index 000000000..9a42ba9f5
--- /dev/null
+++ b/config/config.inc.php.sample
@@ -0,0 +1,85 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | Local configuration for the Roundcube Webmail installation. |
+ | |
+ | This is a sample configuration file only containing the minumum |
+ | setup required for a functional installation. Copy more options |
+ | from defaults.inc.php to this file to override the defaults. |
+ | |
+ | This file is part of the Roundcube Webmail client |
+ | Copyright (C) 2005-2013, 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. |
+ +-----------------------------------------------------------------------+
+*/
+
+$config = array();
+
+// Database connection string (DSN) for read+write operations
+// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
+// Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv
+// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
+// NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646'
+$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
+
+// The mail host chosen to perform the log-in.
+// Leave blank to show a textbox at login, give a list of hosts
+// to display a pulldown menu or set one host as string.
+// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
+// Supported replacement variables:
+// %n - hostname ($_SERVER['SERVER_NAME'])
+// %t - hostname without the first part
+// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
+// %s - domain name after the '@' from e-mail address provided at login screen
+// For example %n = mail.domain.tld, %t = domain.tld
+$config['default_host'] = 'localhost';
+
+// SMTP server host (for sending mails).
+// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
+// If left blank, the PHP mail() function is used
+// Supported replacement variables:
+// %h - user's IMAP hostname
+// %n - hostname ($_SERVER['SERVER_NAME'])
+// %t - hostname without the first part
+// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
+// %z - IMAP domain (IMAP hostname without the first part)
+// For example %n = mail.domain.tld, %t = domain.tld
+$config['smtp_server'] = '';
+
+// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
+// deprecated SSL over SMTP (aka SMTPS))
+$config['smtp_port'] = 25;
+
+// SMTP username (if required) if you use %u as the username Roundcube
+// will use the current username for login
+$config['smtp_user'] = '';
+
+// SMTP password (if required) if you use %p as the password Roundcube
+// will use the current user's password for login
+$config['smtp_pass'] = '';
+
+// provide an URL where a user can get support for this Roundcube installation
+// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
+$config['support_url'] = '';
+
+// Name your service. This is displayed on the login screen and in the window title
+$config['product_name'] = 'Roundcube Webmail';
+
+// this key is used to encrypt the users imap password which is stored
+// in the session record (and the client cookie if remember password is enabled).
+// please provide a string of exactly 24 chars.
+// YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
+$config['des_key'] = 'rcmail-!24ByteDESkey*Str';
+
+// List of active plugins (in plugins/ directory)
+$config['plugins'] = array(
+ 'archive',
+ 'zipdownload',
+);
+
+// skin name: folder from skins/
+$config['skin'] = 'larry';
diff --git a/config/db.inc.php.dist b/config/db.inc.php.dist
deleted file mode 100644
index b1f142e56..000000000
--- a/config/db.inc.php.dist
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/*
- +-----------------------------------------------------------------------+
- | Configuration file for database access |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2013, 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. |
- +-----------------------------------------------------------------------+
-*/
-
-$rcmail_config = array();
-
-// Database connection string (DSN) for read+write operations
-// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
-// Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv
-// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
-// NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646'
-$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
-
-// Database DSN for read-only operations (if empty write database will be used)
-// useful for database replication
-$rcmail_config['db_dsnr'] = '';
-
-// use persistent db-connections
-// beware this will not "always" work as expected
-// see: http://www.php.net/manual/en/features.persistent-connections.php
-$rcmail_config['db_persistent'] = FALSE;
-
-// you can define specific table (and sequence) names prefix
-$rcmail_config['db_prefix'] = '';
diff --git a/config/main.inc.php.dist b/config/defaults.inc.php
similarity index 79%
rename from config/main.inc.php.dist
rename to config/defaults.inc.php
index 2c2b55327..042170437 100644
--- a/config/main.inc.php.dist
+++ b/config/defaults.inc.php
@@ -1,947 +1,969 @@
<?php
/*
+-----------------------------------------------------------------------+
- | Main configuration file |
+ | Main configuration file with default settings |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2011, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, 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. |
- | |
+-----------------------------------------------------------------------+
-
*/
-$rcmail_config = array();
+$config = array();
+
+// ----------------------------------
+// SQL DATABASE
+// ----------------------------------
+
+// Database connection string (DSN) for read+write operations
+// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
+// Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv
+// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
+// NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646'
+$config['db_dsnw'] = 'mysql://roundcube:@localhost/roundcubemail';
+
+// Database DSN for read-only operations (if empty write database will be used)
+// useful for database replication
+$config['db_dsnr'] = '';
+
+// use persistent db-connections
+// beware this will not "always" work as expected
+// see: http://www.php.net/manual/en/features.persistent-connections.php
+$config['db_persistent'] = false;
+
+// you can define specific table (and sequence) names prefix
+$config['db_prefix'] = '';
+
// ----------------------------------
// LOGGING/DEBUGGING
// ----------------------------------
// system error reporting, sum of: 1 = log; 4 = show, 8 = trace
-$rcmail_config['debug_level'] = 1;
+$config['debug_level'] = 1;
// log driver: 'syslog' or 'file'.
-$rcmail_config['log_driver'] = 'file';
+$config['log_driver'] = 'file';
// date format for log entries
// (read http://php.net/manual/en/function.date.php for all format characters)
-$rcmail_config['log_date_format'] = 'd-M-Y H:i:s O';
+$config['log_date_format'] = 'd-M-Y H:i:s O';
// Syslog ident string to use, if using the 'syslog' log driver.
-$rcmail_config['syslog_id'] = 'roundcube';
+$config['syslog_id'] = 'roundcube';
// Syslog facility to use, if using the 'syslog' log driver.
// For possible values see installer or http://php.net/manual/en/function.openlog.php
-$rcmail_config['syslog_facility'] = LOG_USER;
+$config['syslog_facility'] = LOG_USER;
// Log sent messages to <log_dir>/sendmail or to syslog
-$rcmail_config['smtp_log'] = true;
+$config['smtp_log'] = true;
// Log successful logins to <log_dir>/userlogins or to syslog
-$rcmail_config['log_logins'] = false;
+$config['log_logins'] = false;
// Log session authentication errors to <log_dir>/session or to syslog
-$rcmail_config['log_session'] = false;
+$config['log_session'] = false;
// Log SQL queries to <log_dir>/sql or to syslog
-$rcmail_config['sql_debug'] = false;
+$config['sql_debug'] = false;
// Log IMAP conversation to <log_dir>/imap or to syslog
-$rcmail_config['imap_debug'] = false;
+$config['imap_debug'] = false;
// Log LDAP conversation to <log_dir>/ldap or to syslog
-$rcmail_config['ldap_debug'] = false;
+$config['ldap_debug'] = false;
// Log SMTP conversation to <log_dir>/smtp or to syslog
-$rcmail_config['smtp_debug'] = false;
+$config['smtp_debug'] = false;
// ----------------------------------
// IMAP
// ----------------------------------
// The mail host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
// required to match old user data records with the new host.
-$rcmail_config['default_host'] = '';
+$config['default_host'] = 'localhost';
// TCP port used for IMAP connections
-$rcmail_config['default_port'] = 143;
+$config['default_port'] = 143;
// IMAP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or null to use
// best server supported one)
-$rcmail_config['imap_auth_type'] = null;
+$config['imap_auth_type'] = null;
// If you know your imap's folder delimiter, you can specify it here.
// Otherwise it will be determined automatically
-$rcmail_config['imap_delimiter'] = null;
+$config['imap_delimiter'] = null;
// If IMAP server doesn't support NAMESPACE extension, but you're
// using shared folders or personal root folder is non-empty, you'll need to
// set these options. All can be strings or arrays of strings.
// Folders need to be ended with directory separator, e.g. "INBOX."
// (special directory "~" is an exception to this rule)
// These can be used also to overwrite server's namespaces
-$rcmail_config['imap_ns_personal'] = null;
-$rcmail_config['imap_ns_other'] = null;
-$rcmail_config['imap_ns_shared'] = null;
+$config['imap_ns_personal'] = null;
+$config['imap_ns_other'] = null;
+$config['imap_ns_shared'] = null;
// By default IMAP capabilities are readed after connection to IMAP server
// In some cases, e.g. when using IMAP proxy, there's a need to refresh the list
// after login. Set to True if you've got this case.
-$rcmail_config['imap_force_caps'] = false;
+$config['imap_force_caps'] = false;
// By default list of subscribed folders is determined using LIST-EXTENDED
// extension if available. Some servers (dovecot 1.x) returns wrong results
// for shared namespaces in this case. http://trac.roundcube.net/ticket/1486225
// Enable this option to force LSUB command usage instead.
// Deprecated: Use imap_disabled_caps = array('LIST-EXTENDED')
-$rcmail_config['imap_force_lsub'] = false;
+$config['imap_force_lsub'] = false;
// Some server configurations (e.g. Courier) doesn't list folders in all namespaces
// Enable this option to force listing of folders in all namespaces
-$rcmail_config['imap_force_ns'] = false;
+$config['imap_force_ns'] = false;
// List of disabled imap extensions.
// Use if your IMAP server has broken implementation of some feature
// and you can't remove it from CAPABILITY string on server-side.
// For example UW-IMAP server has broken ESEARCH.
// Note: Because the list is cached, re-login is required after change.
$rcmail_config['imap_disabled_caps'] = array();
// IMAP connection timeout, in seconds. Default: 0 (no limit)
-$rcmail_config['imap_timeout'] = 0;
+$config['imap_timeout'] = 0;
// Optional IMAP authentication identifier to be used as authorization proxy
-$rcmail_config['imap_auth_cid'] = null;
+$config['imap_auth_cid'] = null;
// Optional IMAP authentication password to be used for imap_auth_cid
-$rcmail_config['imap_auth_pw'] = null;
+$config['imap_auth_pw'] = null;
// Type of IMAP indexes cache. Supported values: 'db', 'apc' and 'memcache'.
-$rcmail_config['imap_cache'] = null;
+$config['imap_cache'] = null;
// Enables messages cache. Only 'db' cache is supported.
-$rcmail_config['messages_cache'] = false;
+$config['messages_cache'] = false;
// Lifetime of IMAP indexes cache. Possible units: s, m, h, d, w
-$rcmail_config['imap_cache_ttl'] = '10d';
+$config['imap_cache_ttl'] = '10d';
// Lifetime of messages cache. Possible units: s, m, h, d, w
-$rcmail_config['messages_cache_ttl'] = '10d';
+$config['messages_cache_ttl'] = '10d';
// ----------------------------------
// SMTP
// ----------------------------------
// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
-$rcmail_config['smtp_server'] = '';
+$config['smtp_server'] = '';
// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
-$rcmail_config['smtp_port'] = 25;
+$config['smtp_port'] = 25;
// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
-$rcmail_config['smtp_user'] = '';
+$config['smtp_user'] = '';
// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
-$rcmail_config['smtp_pass'] = '';
+$config['smtp_pass'] = '';
// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
-$rcmail_config['smtp_auth_type'] = '';
+$config['smtp_auth_type'] = '';
// Optional SMTP authentication identifier to be used as authorization proxy
-$rcmail_config['smtp_auth_cid'] = null;
+$config['smtp_auth_cid'] = null;
// Optional SMTP authentication password to be used for smtp_auth_cid
-$rcmail_config['smtp_auth_pw'] = null;
+$config['smtp_auth_pw'] = null;
// SMTP HELO host
// Hostname to give to the remote server for SMTP 'HELO' or 'EHLO' messages
// Leave this blank and you will get the server variable 'server_name' or
// localhost if that isn't defined.
-$rcmail_config['smtp_helo_host'] = '';
+$config['smtp_helo_host'] = '';
// SMTP connection timeout, in seconds. Default: 0 (no limit)
// Note: There's a known issue where using ssl connection with
// timeout > 0 causes connection errors (https://bugs.php.net/bug.php?id=54511)
-$rcmail_config['smtp_timeout'] = 0;
+$config['smtp_timeout'] = 0;
// ----------------------------------
// LDAP
// ----------------------------------
// Type of LDAP cache. Supported values: 'db', 'apc' and 'memcache'.
-$rcmail_config['ldap_cache'] = 'db';
+$config['ldap_cache'] = 'db';
// Lifetime of LDAP cache. Possible units: s, m, h, d, w
-$rcmail_config['ldap_cache_ttl'] = '10m';
+$config['ldap_cache_ttl'] = '10m';
// ----------------------------------
// SYSTEM
// ----------------------------------
// THIS OPTION WILL ALLOW THE INSTALLER TO RUN AND CAN EXPOSE SENSITIVE CONFIG DATA.
// ONLY ENABLE IT IF YOU'RE REALLY SURE WHAT YOU'RE DOING!
-$rcmail_config['enable_installer'] = false;
+$config['enable_installer'] = false;
// don't allow these settings to be overriden by the user
-$rcmail_config['dont_override'] = array();
+$config['dont_override'] = array();
// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
-$rcmail_config['support_url'] = '';
+$config['support_url'] = '';
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
-$rcmail_config['skin_logo'] = null;
+$config['skin_logo'] = null;
// automatically create a new Roundcube user when log-in the first time.
// a new user will be created once the IMAP login succeeds.
// set to false if only registered users can use this service
-$rcmail_config['auto_create_user'] = true;
+$config['auto_create_user'] = true;
// Enables possibility to log in using email address from user identities
-$rcmail_config['user_aliases'] = false;
+$config['user_aliases'] = false;
// use this folder to store log files (must be writeable for apache user)
// This is used by the 'file' log driver.
-$rcmail_config['log_dir'] = 'logs/';
+$config['log_dir'] = 'logs/';
// use this folder to store temp files (must be writeable for apache user)
-$rcmail_config['temp_dir'] = 'temp/';
+$config['temp_dir'] = 'temp/';
// enforce connections over https
// with this option enabled, all non-secure connections will be redirected.
// set the port for the ssl connection as value of this option if it differs from the default 443
-$rcmail_config['force_https'] = false;
+$config['force_https'] = false;
// tell PHP that it should work as under secure connection
// even if it doesn't recognize it as secure ($_SERVER['HTTPS'] is not set)
// e.g. when you're running Roundcube behind a https proxy
// this option is mutually exclusive to 'force_https' and only either one of them should be set to true.
-$rcmail_config['use_https'] = false;
+$config['use_https'] = false;
// Allow browser-autocompletion on login form.
// 0 - disabled, 1 - username and host only, 2 - username, host, password
-$rcmail_config['login_autocomplete'] = 0;
+$config['login_autocomplete'] = 0;
// Forces conversion of logins to lower case.
// 0 - disabled, 1 - only domain part, 2 - domain and local part.
// If users authentication is case-insensitive this must be enabled.
// Note: After enabling it all user records need to be updated, e.g. with query:
// UPDATE users SET username = LOWER(username);
-$rcmail_config['login_lc'] = 2;
+$config['login_lc'] = 2;
// Includes should be interpreted as PHP files
-$rcmail_config['skin_include_php'] = false;
+$config['skin_include_php'] = false;
// display software version on login screen
-$rcmail_config['display_version'] = false;
+$config['display_version'] = false;
// Session lifetime in minutes
-$rcmail_config['session_lifetime'] = 10;
+$config['session_lifetime'] = 10;
// Session domain: .example.org
-$rcmail_config['session_domain'] = '';
+$config['session_domain'] = '';
// Session name. Default: 'roundcube_sessid'
-$rcmail_config['session_name'] = null;
+$config['session_name'] = null;
// Session path. Defaults to PHP session.cookie_path setting.
-$rcmail_config['session_path'] = null;
+$config['session_path'] = null;
// Backend to use for session storage. Can either be 'db' (default), 'memcache' or 'php'
// If set to 'memcache', a list of servers need to be specified in 'memcache_hosts'
// Make sure the Memcache extension (http://pecl.php.net/package/memcache) version >= 2.0.0 is installed
// Setting this value to 'php' will use the default session save handler configured in PHP
-$rcmail_config['session_storage'] = 'db';
+$config['session_storage'] = 'db';
// Use these hosts for accessing memcached
// Define any number of hosts in the form of hostname:port or unix:///path/to/socket.file
-$rcmail_config['memcache_hosts'] = null; // e.g. array( 'localhost:11211', '192.168.1.12:11211', 'unix:///var/tmp/memcached.sock' );
+$config['memcache_hosts'] = null; // e.g. array( 'localhost:11211', '192.168.1.12:11211', 'unix:///var/tmp/memcached.sock' );
// check client IP in session athorization
-$rcmail_config['ip_check'] = false;
+$config['ip_check'] = false;
// check referer of incoming requests
-$rcmail_config['referer_check'] = false;
+$config['referer_check'] = false;
// X-Frame-Options HTTP header value sent to prevent from Clickjacking.
// Possible values: sameorigin|deny. Set to false in order to disable sending them
-$rcmail_config['x_frame_options'] = 'sameorigin';
+$config['x_frame_options'] = 'sameorigin';
// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
-$rcmail_config['des_key'] = 'rcmail-!24ByteDESkey*Str';
+$config['des_key'] = 'rcmail-!24ByteDESkey*Str';
// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
-$rcmail_config['username_domain'] = '';
+$config['username_domain'] = '';
// This domain will be used to form e-mail addresses of new users
// Specify an array with 'host' => 'domain' values to support multiple hosts
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
-$rcmail_config['mail_domain'] = '';
+$config['mail_domain'] = '';
// Password charset.
// Use it if your authentication backend doesn't support UTF-8.
// Defaults to ISO-8859-1 for backward compatibility
-$rcmail_config['password_charset'] = 'ISO-8859-1';
+$config['password_charset'] = 'ISO-8859-1';
// How many seconds must pass between emails sent by a user
-$rcmail_config['sendmail_delay'] = 0;
+$config['sendmail_delay'] = 0;
// Maximum number of recipients per message. Default: 0 (no limit)
-$rcmail_config['max_recipients'] = 0;
+$config['max_recipients'] = 0;
// Maximum allowednumber of members of an address group. Default: 0 (no limit)
// If 'max_recipients' is set this value should be less or equal
-$rcmail_config['max_group_members'] = 0;
+$config['max_group_members'] = 0;
-// add this user-agent to message headers when sending
-$rcmail_config['useragent'] = 'Roundcube Webmail/'.RCMAIL_VERSION;
+// Name your service. This is displayed on the login screen and in the window title
+$config['product_name'] = 'Roundcube Webmail';
-// use this name to compose page titles
-$rcmail_config['product_name'] = 'Roundcube Webmail';
+// Add this user-agent to message headers when sending
+$config['useragent'] = 'Roundcube Webmail/'.RCMAIL_VERSION;
// try to load host-specific configuration
// see http://trac.roundcube.net/wiki/Howto_Config for more details
-$rcmail_config['include_host_config'] = false;
+$config['include_host_config'] = false;
// path to a text file which will be added to each sent message
// paths are relative to the Roundcube root folder
-$rcmail_config['generic_message_footer'] = '';
+$config['generic_message_footer'] = '';
// path to a text file which will be added to each sent HTML message
// paths are relative to the Roundcube root folder
-$rcmail_config['generic_message_footer_html'] = '';
+$config['generic_message_footer_html'] = '';
// add a received header to outgoing mails containing the creators IP and hostname
-$rcmail_config['http_received_header'] = false;
+$config['http_received_header'] = false;
// Whether or not to encrypt the IP address and the host name
// these could, in some circles, be considered as sensitive information;
// however, for the administrator, these could be invaluable help
// when tracking down issues.
-$rcmail_config['http_received_header_encrypt'] = false;
+$config['http_received_header_encrypt'] = false;
// This string is used as a delimiter for message headers when sending
// a message via mail() function. Leave empty for auto-detection
-$rcmail_config['mail_header_delimiter'] = NULL;
+$config['mail_header_delimiter'] = NULL;
// number of chars allowed for line when wrapping text.
// text wrapping is done when composing/sending messages
-$rcmail_config['line_length'] = 72;
+$config['line_length'] = 72;
// send plaintext messages as format=flowed
-$rcmail_config['send_format_flowed'] = true;
+$config['send_format_flowed'] = true;
// According to RFC2298, return receipt envelope sender address must be empty.
// If this option is true, Roundcube will use user's identity as envelope sender for MDN responses.
-$rcmail_config['mdn_use_from'] = false;
+$config['mdn_use_from'] = false;
// Set identities access level:
// 0 - many identities with possibility to edit all params
// 1 - many identities with possibility to edit all params but not email address
// 2 - one identity with possibility to edit all params
// 3 - one identity with possibility to edit all params but not email address
// 4 - one identity with possibility to edit only signature
-$rcmail_config['identities_level'] = 0;
+$config['identities_level'] = 0;
// Mimetypes supported by the browser.
// attachments of these types will open in a preview window
// either a comma-separated list or an array: 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/pdf'
-$rcmail_config['client_mimetypes'] = null; # null == default
+$config['client_mimetypes'] = null; # null == default
// Path to a local mime magic database file for PHPs finfo extension.
// Set to null if the default path should be used.
-$rcmail_config['mime_magic'] = null;
+$config['mime_magic'] = null;
// Absolute path to a local mime.types mapping table file.
// This is used to derive mime-types from the filename extension or vice versa.
// Such a file is usually part of the apache webserver. If you don't find a file named mime.types on your system,
// download it from http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
-$rcmail_config['mime_types'] = null;
+$config['mime_types'] = null;
// path to imagemagick identify binary
-$rcmail_config['im_identify_path'] = null;
+$config['im_identify_path'] = null;
// path to imagemagick convert binary
-$rcmail_config['im_convert_path'] = null;
+$config['im_convert_path'] = null;
// Size of thumbnails from image attachments displayed below the message content.
// Note: whether images are displayed at all depends on the 'inline_images' option.
// Set to 0 to display images in full size.
-$rcmail_config['image_thumbnail_size'] = 240;
+$config['image_thumbnail_size'] = 240;
// maximum size of uploaded contact photos in pixel
-$rcmail_config['contact_photo_size'] = 160;
+$config['contact_photo_size'] = 160;
// Enable DNS checking for e-mail address validation
-$rcmail_config['email_dns_check'] = false;
+$config['email_dns_check'] = false;
// Disables saving sent messages in Sent folder (like gmail) (Default: false)
// Note: useful when SMTP server stores sent mail in user mailbox
-$rcmail_config['no_save_sent_messages'] = false;
+$config['no_save_sent_messages'] = false;
// ----------------------------------
// PLUGINS
// ----------------------------------
// List of active plugins (in plugins/ directory)
-$rcmail_config['plugins'] = array();
+$config['plugins'] = array();
// ----------------------------------
// USER INTERFACE
// ----------------------------------
// default messages sort column. Use empty value for default server's sorting,
// or 'arrival', 'date', 'subject', 'from', 'to', 'fromto', 'size', 'cc'
-$rcmail_config['message_sort_col'] = '';
+$config['message_sort_col'] = '';
// default messages sort order
-$rcmail_config['message_sort_order'] = 'DESC';
+$config['message_sort_order'] = 'DESC';
// These cols are shown in the message list. Available cols are:
// subject, from, to, fromto, cc, replyto, date, size, status, flag, attachment, 'priority'
-$rcmail_config['list_cols'] = array('subject', 'status', 'fromto', 'date', 'size', 'flag', 'attachment');
+$config['list_cols'] = array('subject', 'status', 'fromto', 'date', 'size', 'flag', 'attachment');
// the default locale setting (leave empty for auto-detection)
// RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
-$rcmail_config['language'] = null;
+$config['language'] = null;
// use this format for date display (date or strftime format)
-$rcmail_config['date_format'] = 'Y-m-d';
+$config['date_format'] = 'Y-m-d';
// give this choice of date formats to the user to select from
-$rcmail_config['date_formats'] = array('Y-m-d', 'd-m-Y', 'Y/m/d', 'm/d/Y', 'd/m/Y', 'd.m.Y', 'j.n.Y');
+$config['date_formats'] = array('Y-m-d', 'd-m-Y', 'Y/m/d', 'm/d/Y', 'd/m/Y', 'd.m.Y', 'j.n.Y');
// use this format for time display (date or strftime format)
-$rcmail_config['time_format'] = 'H:i';
+$config['time_format'] = 'H:i';
// give this choice of time formats to the user to select from
-$rcmail_config['time_formats'] = array('G:i', 'H:i', 'g:i a', 'h:i A');
+$config['time_formats'] = array('G:i', 'H:i', 'g:i a', 'h:i A');
// use this format for short date display (derived from date_format and time_format)
-$rcmail_config['date_short'] = 'D H:i';
+$config['date_short'] = 'D H:i';
// use this format for detailed date/time formatting (derived from date_format and time_format)
-$rcmail_config['date_long'] = 'Y-m-d H:i';
+$config['date_long'] = 'Y-m-d H:i';
// store draft message is this mailbox
// leave blank if draft messages should not be stored
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['drafts_mbox'] = 'Drafts';
+$config['drafts_mbox'] = 'Drafts';
// store spam messages in this mailbox
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['junk_mbox'] = 'Junk';
+$config['junk_mbox'] = 'Junk';
// store sent message is this mailbox
// leave blank if sent messages should not be stored
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['sent_mbox'] = 'Sent';
+$config['sent_mbox'] = 'Sent';
// move messages to this folder when deleting them
// leave blank if they should be deleted directly
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['trash_mbox'] = 'Trash';
+$config['trash_mbox'] = 'Trash';
// display these folders separately in the mailbox list.
// these folders will also be displayed with localized names
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
+$config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
// Disable localization of the default folder names listed above
-$rcmail_config['show_real_foldernames'] = false;
+$config['show_real_foldernames'] = false;
// automatically create the above listed default folders on first login
-$rcmail_config['create_default_folders'] = false;
+$config['create_default_folders'] = false;
// protect the default folders from renames, deletes, and subscription changes
-$rcmail_config['protect_default_folders'] = true;
+$config['protect_default_folders'] = true;
// if in your system 0 quota means no limit set this option to true
-$rcmail_config['quota_zero_as_unlimited'] = false;
+$config['quota_zero_as_unlimited'] = false;
// Make use of the built-in spell checker. It is based on GoogieSpell.
// Since Google only accepts connections over https your PHP installatation
// requires to be compiled with Open SSL support
-$rcmail_config['enable_spellcheck'] = true;
+$config['enable_spellcheck'] = true;
// Enables spellchecker exceptions dictionary.
// Setting it to 'shared' will make the dictionary shared by all users.
-$rcmail_config['spellcheck_dictionary'] = false;
+$config['spellcheck_dictionary'] = false;
// Set the spell checking engine. 'googie' is the default.
// 'pspell' and 'enchant' are also available, but they require
// PHP Pspell or Enchant extensions. When using Nox Spell Server, also set 'googie' here.
-$rcmail_config['spellcheck_engine'] = 'googie';
+$config['spellcheck_engine'] = 'googie';
// For a locally installed Nox Spell Server, please specify the URI to call it.
// Get Nox Spell Server from http://orangoo.com/labs/?page_id=72
// Leave empty to use the Google spell checking service, what means
// that the message content will be sent to Google in order to check spelling
-$rcmail_config['spellcheck_uri'] = '';
+$config['spellcheck_uri'] = '';
// These languages can be selected for spell checking.
// Configure as a PHP style hash array: array('en'=>'English', 'de'=>'Deutsch');
// Leave empty for default set of available language.
-$rcmail_config['spellcheck_languages'] = NULL;
+$config['spellcheck_languages'] = NULL;
// Makes that words with all letters capitalized will be ignored (e.g. GOOGLE)
-$rcmail_config['spellcheck_ignore_caps'] = false;
+$config['spellcheck_ignore_caps'] = false;
// Makes that words with numbers will be ignored (e.g. g00gle)
-$rcmail_config['spellcheck_ignore_nums'] = false;
+$config['spellcheck_ignore_nums'] = false;
// Makes that words with symbols will be ignored (e.g. g@@gle)
-$rcmail_config['spellcheck_ignore_syms'] = false;
+$config['spellcheck_ignore_syms'] = false;
// Use this char/string to separate recipients when composing a new message
-$rcmail_config['recipients_separator'] = ',';
+$config['recipients_separator'] = ',';
// don't let users set pagesize to more than this value if set
-$rcmail_config['max_pagesize'] = 200;
+$config['max_pagesize'] = 200;
// Minimal value of user's 'refresh_interval' setting (in seconds)
-$rcmail_config['min_refresh_interval'] = 60;
+$config['min_refresh_interval'] = 60;
// Enables files upload indicator. Requires APC installed and enabled apc.rfc1867 option.
// By default refresh time is set to 1 second. You can set this value to true
// or any integer value indicating number of seconds.
-$rcmail_config['upload_progress'] = false;
+$config['upload_progress'] = false;
// Specifies for how many seconds the Undo button will be available
// after object delete action. Currently used with supporting address book sources.
// Setting it to 0, disables the feature.
-$rcmail_config['undo_timeout'] = 0;
+$config['undo_timeout'] = 0;
// ----------------------------------
// ADDRESSBOOK SETTINGS
// ----------------------------------
// This indicates which type of address book to use. Possible choises:
// 'sql' (default), 'ldap' and ''.
// If set to 'ldap' then it will look at using the first writable LDAP
// address book as the primary address book and it will not display the
// SQL address book in the 'Address Book' view.
// If set to '' then no address book will be displayed or only the
// addressbook which is created by a plugin (like CardDAV).
-$rcmail_config['address_book_type'] = 'sql';
+$config['address_book_type'] = 'sql';
// In order to enable public ldap search, configure an array like the Verisign
// example further below. if you would like to test, simply uncomment the example.
// Array key must contain only safe characters, ie. a-zA-Z0-9_
-$rcmail_config['ldap_public'] = array();
+$config['ldap_public'] = array();
// If you are going to use LDAP for individual address books, you will need to
// set 'user_specific' to true and use the variables to generate the appropriate DNs to access it.
//
// The recommended directory structure for LDAP is to store all the address book entries
// under the users main entry, e.g.:
//
// o=root
// ou=people
// uid=user@domain
// mail=contact@contactdomain
//
// So the base_dn would be uid=%fu,ou=people,o=root
// The bind_dn would be the same as based_dn or some super user login.
/*
* example config for Verisign directory
*
-$rcmail_config['ldap_public']['Verisign'] = array(
+$config['ldap_public']['Verisign'] = array(
'name' => 'Verisign.com',
// Replacement variables supported in host names:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
'hosts' => array('directory.verisign.com'),
'port' => 389,
'use_tls' => false,
'ldap_version' => 3, // using LDAPv3
'network_timeout' => 10, // The timeout (in seconds) for connect + bind arrempts. This is only supported in PHP >= 5.3.0 with OpenLDAP 2.x
'user_specific' => false, // If true the base_dn, bind_dn and bind_pass default to the user's IMAP login.
// %fu - The full username provided, assumes the username is an email
// address, uses the username_domain value if not an email address.
// %u - The username prior to the '@'.
// %d - The domain name after the '@'.
// %dc - The domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
// %dn - DN found by ldap search when search_filter/search_base_dn are used
'base_dn' => '',
'bind_dn' => '',
'bind_pass' => '',
// It's possible to bind for an individual address book
// The login name is used to search for the DN to bind with
'search_base_dn' => '',
'search_filter' => '', // e.g. '(&(objectClass=posixAccount)(uid=%u))'
// DN and password to bind as before searching for bind DN, if anonymous search is not allowed
'search_bind_dn' => '',
'search_bind_pw' => '',
// Default for %dn variable if search doesn't return DN value
'search_dn_default' => '',
// Optional authentication identifier to be used as SASL authorization proxy
// bind_dn need to be empty
'auth_cid' => '',
// SASL authentication method (for proxy auth), e.g. DIGEST-MD5
'auth_method' => '',
// Indicates if the addressbook shall be hidden from the list.
// With this option enabled you can still search/view contacts.
'hidden' => false,
// Indicates if the addressbook shall not list contacts but only allows searching.
'searchonly' => false,
// Indicates if we can write to the LDAP directory or not.
// If writable is true then these fields need to be populated:
// LDAP_Object_Classes, required_fields, LDAP_rdn
'writable' => false,
// To create a new contact these are the object classes to specify
// (or any other classes you wish to use).
'LDAP_Object_Classes' => array('top', 'inetOrgPerson'),
// The RDN field that is used for new entries, this field needs
// to be one of the search_fields, the base of base_dn is appended
// to the RDN to insert into the LDAP directory.
'LDAP_rdn' => 'cn',
// The required fields needed to build a new contact as required by
// the object classes (can include additional fields not required by the object classes).
'required_fields' => array('cn', 'sn', 'mail'),
'search_fields' => array('mail', 'cn'), // fields to search in
// mapping of contact fields to directory attributes
// for every attribute one can specify the number of values (limit) allowed.
// default is 1, a wildcard * means unlimited
'fieldmap' => array(
// Roundcube => LDAP:limit
'name' => 'cn',
'surname' => 'sn',
'firstname' => 'givenName',
'jobtitle' => 'title',
'email' => 'mail:*',
'phone:home' => 'homePhone',
'phone:work' => 'telephoneNumber',
'phone:mobile' => 'mobile',
'phone:pager' => 'pager',
'phone:workfax' => 'facsimileTelephoneNumber',
'street' => 'street',
'zipcode' => 'postalCode',
'region' => 'st',
'locality' => 'l',
// if you country is a complex object, you need to configure 'sub_fields' below
'country' => 'c',
'organization' => 'o',
'department' => 'ou',
'jobtitle' => 'title',
'notes' => 'description',
'photo' => 'jpegPhoto',
// these currently don't work:
// 'manager' => 'manager',
// 'assistant' => 'secretary',
),
// Map of contact sub-objects (attribute name => objectClass(es)), e.g. 'c' => 'country'
'sub_fields' => array(),
// Generate values for the following LDAP attributes automatically when creating a new record
'autovalues' => array(
// 'uid' => 'md5(microtime())', // You may specify PHP code snippets which are then eval'ed
// 'mail' => '{givenname}.{sn}@mydomain.com', // or composite strings with placeholders for existing attributes
),
'sort' => 'cn', // The field to sort the listing by.
'scope' => 'sub', // search mode: sub|base|list
'filter' => '(objectClass=inetOrgPerson)', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
'fuzzy_search' => true, // server allows wildcard search
'vlv' => false, // Enable Virtual List View to more efficiently fetch paginated data (if server supports it)
'vlv_search' => false, // Use Virtual List View functions for autocompletion searches (if server supports it)
'numsub_filter' => '(objectClass=organizationalUnit)', // with VLV, we also use numSubOrdinates to query the total number of records. Set this filter to get all numSubOrdinates attributes for counting
'config_root_dn' => 'cn=config', // Root DN to search config entries (e.g. vlv indexes)
'sizelimit' => '0', // Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
'timelimit' => '0', // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.
'referrals' => false, // Sets the LDAP_OPT_REFERRALS option. Mostly used in multi-domain Active Directory setups
// definition for contact groups (uncomment if no groups are supported)
// for the groups base_dn, the user replacements %fu, %u, $d and %dc work as for base_dn (see above)
// if the groups base_dn is empty, the contact base_dn is used for the groups as well
// -> in this case, assure that groups and contacts are separated due to the concernig filters!
'groups' => array(
'base_dn' => '',
'scope' => 'sub', // Search mode: sub|base|list
'filter' => '(objectClass=groupOfNames)',
'object_classes' => array("top", "groupOfNames"),
'member_attr' => 'member', // Name of the member attribute, e.g. uniqueMember
'name_attr' => 'cn', // Attribute to be used as group name
'member_filter' => '(objectclass=*)', // Optional filter to use when querying for group members
'vlv' => false, // Use VLV controls to list groups
),
// this configuration replaces the regular groups listing in the directory tree with
// a hard-coded list of groups, each listing entries with the configured base DN and filter.
// if the 'groups' option from above is set, it'll be shown as the first entry with the name 'Groups'
'group_filters' => array(
'departments' => array(
'name' => 'Company Departments',
'scope' => 'list',
'base_dn' => 'ou=Groups,dc=mydomain,dc=com',
'filter' => '(|(objectclass=groupofuniquenames)(objectclass=groupofurls))',
'name_attr' => 'cn',
),
'customers' => array(
'name' => 'Customers',
'scope' => 'sub',
'base_dn' => 'ou=Customers,dc=mydomain,dc=com',
'filter' => '(objectClass=inetOrgPerson)',
'name_attr' => 'sn',
),
),
);
*/
// An ordered array of the ids of the addressbooks that should be searched
// when populating address autocomplete fields server-side. ex: array('sql','Verisign');
-$rcmail_config['autocomplete_addressbooks'] = array('sql');
+$config['autocomplete_addressbooks'] = array('sql');
// The minimum number of characters required to be typed in an autocomplete field
// before address books will be searched. Most useful for LDAP directories that
// may need to do lengthy results building given overly-broad searches
-$rcmail_config['autocomplete_min_length'] = 1;
+$config['autocomplete_min_length'] = 1;
// Number of parallel autocomplete requests.
// If there's more than one address book, n parallel (async) requests will be created,
// where each request will search in one address book. By default (0), all address
// books are searched in one request.
-$rcmail_config['autocomplete_threads'] = 0;
+$config['autocomplete_threads'] = 0;
// Max. numer of entries in autocomplete popup. Default: 15.
-$rcmail_config['autocomplete_max'] = 15;
+$config['autocomplete_max'] = 15;
// show address fields in this order
// available placeholders: {street}, {locality}, {zipcode}, {country}, {region}
-$rcmail_config['address_template'] = '{street}<br/>{locality} {zipcode}<br/>{country} {region}';
+$config['address_template'] = '{street}<br/>{locality} {zipcode}<br/>{country} {region}';
// Matching mode for addressbook search (including autocompletion)
// 0 - partial (*abc*), default
// 1 - strict (abc)
// 2 - prefix (abc*)
// Note: For LDAP sources fuzzy_search must be enabled to use 'partial' or 'prefix' mode
-$rcmail_config['addressbook_search_mode'] = 0;
+$config['addressbook_search_mode'] = 0;
// ----------------------------------
// USER PREFERENCES
// ----------------------------------
// Use this charset as fallback for message decoding
-$rcmail_config['default_charset'] = 'ISO-8859-1';
+$config['default_charset'] = 'ISO-8859-1';
// skin name: folder from skins/
-$rcmail_config['skin'] = 'larry';
+$config['skin'] = 'larry';
// Enables using standard browser windows (that can be handled as tabs)
// instead of popup windows
-$rcmail_config['standard_windows'] = false;
+$config['standard_windows'] = false;
// show up to X items in messages list view
-$rcmail_config['mail_pagesize'] = 50;
+$config['mail_pagesize'] = 50;
// show up to X items in contacts list view
-$rcmail_config['addressbook_pagesize'] = 50;
+$config['addressbook_pagesize'] = 50;
// sort contacts by this col (preferably either one of name, firstname, surname)
-$rcmail_config['addressbook_sort_col'] = 'surname';
+$config['addressbook_sort_col'] = 'surname';
// the way how contact names are displayed in the list
// 0: display name
// 1: (prefix) firstname middlename surname (suffix)
// 2: (prefix) surname firstname middlename (suffix)
// 3: (prefix) surname, firstname middlename (suffix)
-$rcmail_config['addressbook_name_listing'] = 0;
+$config['addressbook_name_listing'] = 0;
// use this timezone to display date/time
// valid timezone identifers are listed here: php.net/manual/en/timezones.php
// 'auto' will use the browser's timezone settings
-$rcmail_config['timezone'] = 'auto';
+$config['timezone'] = 'auto';
// prefer displaying HTML messages
-$rcmail_config['prefer_html'] = true;
+$config['prefer_html'] = true;
// display remote inline images
// 0 - Never, always ask
// 1 - Ask if sender is not in address book
// 2 - Always show inline images
-$rcmail_config['show_images'] = 0;
+$config['show_images'] = 0;
// open messages in new window
-$rcmail_config['message_extwin'] = false;
+$config['message_extwin'] = false;
// open message compose form in new window
-$rcmail_config['compose_extwin'] = false;
+$config['compose_extwin'] = false;
// compose html formatted messages by default
// 0 - never, 1 - always, 2 - on reply to HTML message, 3 - on forward or reply to HTML message
-$rcmail_config['htmleditor'] = 0;
+$config['htmleditor'] = 0;
// show pretty dates as standard
-$rcmail_config['prettydate'] = true;
+$config['prettydate'] = true;
// save compose message every 300 seconds (5min)
-$rcmail_config['draft_autosave'] = 300;
+$config['draft_autosave'] = 300;
// default setting if preview pane is enabled
-$rcmail_config['preview_pane'] = false;
+$config['preview_pane'] = false;
// Mark as read when viewed in preview pane (delay in seconds)
// Set to -1 if messages in preview pane should not be marked as read
-$rcmail_config['preview_pane_mark_read'] = 0;
+$config['preview_pane_mark_read'] = 0;
// Clear Trash on logout
-$rcmail_config['logout_purge'] = false;
+$config['logout_purge'] = false;
// Compact INBOX on logout
-$rcmail_config['logout_expunge'] = false;
+$config['logout_expunge'] = false;
// Display attached images below the message body
-$rcmail_config['inline_images'] = true;
+$config['inline_images'] = true;
// Encoding of long/non-ascii attachment names:
// 0 - Full RFC 2231 compatible
// 1 - RFC 2047 for 'name' and RFC 2231 for 'filename' parameter (Thunderbird's default)
// 2 - Full 2047 compatible
-$rcmail_config['mime_param_folding'] = 1;
+$config['mime_param_folding'] = 1;
// Set true if deleted messages should not be displayed
// This will make the application run slower
-$rcmail_config['skip_deleted'] = false;
+$config['skip_deleted'] = false;
// Set true to Mark deleted messages as read as well as deleted
// False means that a message's read status is not affected by marking it as deleted
-$rcmail_config['read_when_deleted'] = true;
+$config['read_when_deleted'] = true;
// Set to true to never delete messages immediately
// Use 'Purge' to remove messages marked as deleted
-$rcmail_config['flag_for_deletion'] = false;
+$config['flag_for_deletion'] = false;
// Default interval for auto-refresh requests (in seconds)
// These are requests for system state updates e.g. checking for new messages, etc.
// Setting it to 0 disables the feature.
-$rcmail_config['refresh_interval'] = 60;
+$config['refresh_interval'] = 60;
// If true all folders will be checked for recent messages
-$rcmail_config['check_all_folders'] = false;
+$config['check_all_folders'] = false;
// If true, after message delete/move, the next message will be displayed
-$rcmail_config['display_next'] = true;
+$config['display_next'] = true;
// 0 - Do not expand threads
// 1 - Expand all threads automatically
// 2 - Expand only threads with unread messages
-$rcmail_config['autoexpand_threads'] = 0;
+$config['autoexpand_threads'] = 0;
// When replying:
// -1 - don't cite the original message
// 0 - place cursor below the original message
// 1 - place cursor above original message (top posting)
-$rcmail_config['reply_mode'] = 0;
+$config['reply_mode'] = 0;
// When replying strip original signature from message
-$rcmail_config['strip_existing_sig'] = true;
+$config['strip_existing_sig'] = true;
// Show signature:
// 0 - Never
// 1 - Always
// 2 - New messages only
// 3 - Forwards and Replies only
-$rcmail_config['show_sig'] = 1;
+$config['show_sig'] = 1;
// Use MIME encoding (quoted-printable) for 8bit characters in message body
-$rcmail_config['force_7bit'] = false;
+$config['force_7bit'] = false;
// Defaults of the search field configuration.
// The array can contain a per-folder list of header fields which should be considered when searching
// The entry with key '*' stands for all folders which do not have a specific list set.
-// Please note that folder names should to be in sync with $rcmail_config['default_folders']
-$rcmail_config['search_mods'] = null; // Example: array('*' => array('subject'=>1, 'from'=>1), 'Sent' => array('subject'=>1, 'to'=>1));
+// Please note that folder names should to be in sync with $config['default_folders']
+$config['search_mods'] = null; // Example: array('*' => array('subject'=>1, 'from'=>1), 'Sent' => array('subject'=>1, 'to'=>1));
// Defaults of the addressbook search field configuration.
-$rcmail_config['addressbook_search_mods'] = null; // Example: array('name'=>1, 'firstname'=>1, 'surname'=>1, 'email'=>1, '*'=>1);
+$config['addressbook_search_mods'] = null; // Example: array('name'=>1, 'firstname'=>1, 'surname'=>1, 'email'=>1, '*'=>1);
// 'Delete always'
// This setting reflects if mail should be always deleted
// when moving to Trash fails. This is necessary in some setups
// when user is over quota and Trash is included in the quota.
-$rcmail_config['delete_always'] = false;
+$config['delete_always'] = false;
// Directly delete messages in Junk instead of moving to Trash
-$rcmail_config['delete_junk'] = false;
+$config['delete_junk'] = false;
// Behavior if a received message requests a message delivery notification (read receipt)
// 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask)
// 3 = send automatically if sender is in addressbook, otherwise ask the user
// 4 = send automatically if sender is in addressbook, otherwise ignore
-$rcmail_config['mdn_requests'] = 0;
+$config['mdn_requests'] = 0;
// Return receipt checkbox default state
-$rcmail_config['mdn_default'] = 0;
+$config['mdn_default'] = 0;
// Delivery Status Notification checkbox default state
-$rcmail_config['dsn_default'] = 0;
+$config['dsn_default'] = 0;
// Place replies in the folder of the message being replied to
-$rcmail_config['reply_same_folder'] = false;
+$config['reply_same_folder'] = false;
// Sets default mode of Forward feature to "forward as attachment"
-$rcmail_config['forward_attachment'] = false;
+$config['forward_attachment'] = false;
// Defines address book (internal index) to which new contacts will be added
// By default it is the first writeable addressbook.
// Note: Use '0' for built-in address book.
-$rcmail_config['default_addressbook'] = null;
+$config['default_addressbook'] = null;
// Enables spell checking before sending a message.
-$rcmail_config['spellcheck_before_send'] = false;
+$config['spellcheck_before_send'] = false;
// Skip alternative email addresses in autocompletion (show one address per contact)
-$rcmail_config['autocomplete_single'] = false;
+$config['autocomplete_single'] = false;
// Default font for composed HTML message.
// Supported values: Andale Mono, Arial, Arial Black, Book Antiqua, Courier New,
// Georgia, Helvetica, Impact, Tahoma, Terminal, Times New Roman, Trebuchet MS, Verdana
-$rcmail_config['default_font'] = 'Verdana';
+$config['default_font'] = 'Verdana';
// Enables display of email address with name instead of a name (and address in title)
-$rcmail_config['message_show_email'] = false;
+$config['message_show_email'] = false;
diff --git a/installer/config.php b/installer/config.php
index bfeb677ee..f990fc23f 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -1,667 +1,664 @@
<?php
if (!class_exists('rcube_install') || !is_object($RCI)) {
die("Not allowed! Please open installer/index.php instead.");
}
?>
<form action="index.php" method="post">
<input type="hidden" name="_step" value="2" />
<?php
-// also load the default config to fill in the fields
-$RCI->load_defaults();
-
// register these boolean fields
$RCI->bool_config_props = array(
'ip_check' => 1,
'enable_spellcheck' => 1,
'auto_create_user' => 1,
'smtp_log' => 1,
'prefer_html' => 1,
'preview_pane' => 1,
'debug_level' => 1,
);
// allow the current user to get to the next step
$_SESSION['allowinstaller'] = true;
if (!empty($_POST['submit'])) {
-
- echo '<p class="notice">Copy or download the following configurations and save them in two files';
- echo ' (names above the text box) within the <tt>'.RCMAIL_CONFIG_DIR.'</tt> directory of your Roundcube installation.';
+ echo '<p class="notice">Copy or download the following configuration and save it';
+ echo ' as <tt><b>config.inc.php</b></tt> within the <tt>'.RCUBE_CONFIG_DIR.'</tt> directory of your Roundcube installation.<br/>';
+ echo ' Make sure that there are no characters outside the <tt>&lt;?php ?&gt;</tt> brackets when saving the file.';
+ echo '&nbsp;<input type="button" onclick="location.href=\'index.php?_getconfig=1\'" value="Download" />';
+ if ($RCI->legacy_config) {
+ echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files <tt>main.inc.php</tt> and <tt>db.inc.php</tt>';
+ echo ' from the config directory.';
+ }
echo '</p>';
-
+
$textbox = new html_textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile"));
-
- echo '<div><em>main.inc.php (<a href="index.php?_getfile=main">download</a>)</em></div>';
- echo $textbox->show(($_SESSION['main.inc.php'] = $RCI->create_config('main')));
-
- echo '<div style="margin-top:1em"><em>db.inc.php (<a href="index.php?_getfile=db">download</a>)</em></div>';
- echo $textbox->show($_SESSION['db.inc.php'] = $RCI->create_config('db'));
+ echo $textbox->show(($_SESSION['config'] = $RCI->create_config()));
echo '<p class="hint">Of course there are more options to configure.
- Have a look at the config files or visit <a href="http://trac.roundcube.net/wiki/Howto_Config">Howto_Config</a> to find out.</p>';
+ Have a look at the defaults.inc.php file or visit <a href="http://trac.roundcube.net/wiki/Howto_Config">Howto_Config</a> to find out.</p>';
echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>';
-
+
// echo '<style type="text/css"> .configblock { display:none } </style>';
echo "\n<hr style='margin-bottom:1.6em' />\n";
}
?>
<fieldset>
<legend>General configuration</legend>
<dl class="configblock">
<dt class="propname">product_name</dt>
<dd>
<?php
$input_prodname = new html_inputfield(array('name' => '_product_name', 'size' => 30, 'id' => "cfgprodname"));
echo $input_prodname->show($RCI->getprop('product_name'));
?>
<div>The name of your service (used to compose page titles)</div>
</dd>
<dt class="propname">support_url</dt>
<dd>
<?php
$input_support = new html_inputfield(array('name' => '_support_url', 'size' => 50, 'id' => "cfgsupporturl"));
echo $input_support->show($RCI->getprop('support_url'));
?>
<div>Provide an URL where a user can get support for this Roundcube installation.<br/>PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!</div>
<p class="hint">Enter an absolute URL (inculding http://) to a support page/form or a mailto: link.</p>
</dd>
<dt class="propname">skin_logo</dt>
<dd>
<?php
$input_skin = new html_inputfield(array('name' => '_skin_logo', 'size' => 50, 'id' => "cfgskinlogo"));
echo $input_skin->show($RCI->getprop('skin_logo'));
?>
<div>Custom image to display instead of the Roundcube logo.</div>
<p class="hint">Enter a URL relative to the document root of this Roundcube installation.</p>
</dd>
<dt class="propname">temp_dir</dt>
<dd>
<?php
$input_tempdir = new html_inputfield(array('name' => '_temp_dir', 'size' => 30, 'id' => "cfgtempdir"));
echo $input_tempdir->show($RCI->getprop('temp_dir'));
?>
<div>Use this folder to store temp files (must be writeable for webserver)</div>
</dd>
<dt class="propname">des_key</dt>
<dd>
<?php
$input_deskey = new html_inputfield(array('name' => '_des_key', 'size' => 30, 'id' => "cfgdeskey"));
echo $input_deskey->show($RCI->getprop('des_key'));
?>
<div>This key is used to encrypt the users imap password before storing in the session record</div>
<p class="hint">It's a random generated string to ensure that every installation has its own key.
If you enter it manually please provide a string of exactly 24 chars.</p>
</dd>
<dt class="propname">ip_check</dt>
<dd>
<?php
$check_ipcheck = new html_checkbox(array('name' => '_ip_check', 'id' => "cfgipcheck"));
echo $check_ipcheck->show(intval($RCI->getprop('ip_check')), array('value' => 1));
?>
<label for="cfgipcheck">Check client IP in session authorization</label><br />
<p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changing IPs.</p>
</dd>
<dt class="propname">enable_spellcheck</dt>
<dd>
<?php
$check_spell = new html_checkbox(array('name' => '_enable_spellcheck', 'id' => "cfgspellcheck"));
echo $check_spell->show(intval($RCI->getprop('enable_spellcheck')), array('value' => 1));
?>
<label for="cfgspellcheck">Make use of the spell checker</label><br />
</dd>
<dt class="propname">spellcheck_engine</dt>
<dd>
<?php
$select_spell = new html_select(array('name' => '_spellcheck_engine', 'id' => "cfgspellcheckengine"));
if (extension_loaded('pspell'))
$select_spell->add('pspell', 'pspell');
$select_spell->add('Googie', 'googie');
echo $select_spell->show($RCI->is_post ? $_POST['_spellcheck_engine'] : 'pspell');
?>
<label for="cfgspellcheckengine">Which spell checker to use</label><br />
<p class="hint">GoogieSpell implies that the message content will be sent to Google in order to check the spelling.</p>
</dd>
<dt class="propname">identities_level</dt>
<dd>
<?php
$input_ilevel = new html_select(array('name' => '_identities_level', 'id' => "cfgidentitieslevel"));
$input_ilevel->add('many identities with possibility to edit all params', 0);
$input_ilevel->add('many identities with possibility to edit all params but not email address', 1);
$input_ilevel->add('one identity with possibility to edit all params', 2);
$input_ilevel->add('one identity with possibility to edit all params but not email address', 3);
echo $input_ilevel->show($RCI->getprop('identities_level'), 0);
?>
<div>Level of identities access</div>
<p class="hint">Defines what users can do with their identities.</p>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>Logging & Debugging</legend>
<dl class="loggingblock">
<dt class="propname">debug_level</dt>
<dd>
<?php
$value = $RCI->getprop('debug_level');
$check_debug = new html_checkbox(array('name' => '_debug_level[]'));
echo $check_debug->show(($value & 1) ? 1 : 0 , array('value' => 1, 'id' => 'cfgdebug1'));
echo '<label for="cfgdebug1">Log errors</label><br />';
echo $check_debug->show(($value & 4) ? 4 : 0, array('value' => 4, 'id' => 'cfgdebug4'));
echo '<label for="cfgdebug4">Print errors (to the browser)</label><br />';
echo $check_debug->show(($value & 8) ? 8 : 0, array('value' => 8, 'id' => 'cfgdebug8'));
echo '<label for="cfgdebug8">Verbose display (enables debug console)</label><br />';
?>
</dd>
<dt class="propname">log_driver</dt>
<dd>
<?php
$select_log_driver = new html_select(array('name' => '_log_driver', 'id' => "cfglogdriver"));
$select_log_driver->add(array('file', 'syslog'), array('file', 'syslog'));
echo $select_log_driver->show($RCI->getprop('log_driver', 'file'));
?>
<div>How to do logging? 'file' - write to files in the log directory, 'syslog' - use the syslog facility.</div>
</dd>
<dt class="propname">log_dir</dt>
<dd>
<?php
$input_logdir = new html_inputfield(array('name' => '_log_dir', 'size' => 30, 'id' => "cfglogdir"));
echo $input_logdir->show($RCI->getprop('log_dir'));
?>
<div>Use this folder to store log files (must be writeable for webserver). Note that this only applies if you are using the 'file' log_driver.</div>
</dd>
<dt class="propname">syslog_id</dt>
<dd>
<?php
$input_syslogid = new html_inputfield(array('name' => '_syslog_id', 'size' => 30, 'id' => "cfgsyslogid"));
echo $input_syslogid->show($RCI->getprop('syslog_id', 'roundcube'));
?>
<div>What ID to use when logging with syslog. Note that this only applies if you are using the 'syslog' log_driver.</div>
</dd>
<dt class="propname">syslog_facility</dt>
<dd>
<?php
$input_syslogfacility = new html_select(array('name' => '_syslog_facility', 'id' => "cfgsyslogfacility"));
$input_syslogfacility->add('user-level messages', LOG_USER);
$input_syslogfacility->add('mail subsystem', LOG_MAIL);
$input_syslogfacility->add('local level 0', LOG_LOCAL0);
$input_syslogfacility->add('local level 1', LOG_LOCAL1);
$input_syslogfacility->add('local level 2', LOG_LOCAL2);
$input_syslogfacility->add('local level 3', LOG_LOCAL3);
$input_syslogfacility->add('local level 4', LOG_LOCAL4);
$input_syslogfacility->add('local level 5', LOG_LOCAL5);
$input_syslogfacility->add('local level 6', LOG_LOCAL6);
$input_syslogfacility->add('local level 7', LOG_LOCAL7);
echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), LOG_USER);
?>
<div>What ID to use when logging with syslog. Note that this only applies if you are using the 'syslog' log_driver.</div>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>Database setup</legend>
<dl class="configblock" id="cgfblockdb">
<dt class="propname">db_dsnw</dt>
<dd>
<p>Database settings for read/write operations:</p>
<?php
$select_dbtype = new html_select(array('name' => '_dbtype', 'id' => "cfgdbtype"));
foreach ($RCI->supported_dbs as $database => $ext) {
if (extension_loaded($ext)) {
$select_dbtype->add($database, substr($ext, 4));
}
}
$input_dbhost = new html_inputfield(array('name' => '_dbhost', 'size' => 20, 'id' => "cfgdbhost"));
$input_dbname = new html_inputfield(array('name' => '_dbname', 'size' => 20, 'id' => "cfgdbname"));
$input_dbuser = new html_inputfield(array('name' => '_dbuser', 'size' => 20, 'id' => "cfgdbuser"));
$input_dbpass = new html_passwordfield(array('name' => '_dbpass', 'size' => 20, 'id' => "cfgdbpass"));
$dsnw = rcube_db::parse_dsn($RCI->getprop('db_dsnw'));
echo $select_dbtype->show($RCI->is_post ? $_POST['_dbtype'] : $dsnw['phptype']);
echo '<label for="cfgdbtype">Database type</label><br />';
echo $input_dbhost->show($RCI->is_post ? $_POST['_dbhost'] : $dsnw['hostspec']);
echo '<label for="cfgdbhost">Database server (omit for sqlite)</label><br />';
echo $input_dbname->show($RCI->is_post ? $_POST['_dbname'] : $dsnw['database']);
echo '<label for="cfgdbname">Database name (use absolute path and filename for sqlite)</label><br />';
echo $input_dbuser->show($RCI->is_post ? $_POST['_dbuser'] : $dsnw['username']);
echo '<label for="cfgdbuser">Database user name (needs write permissions)(omit for sqlite)</label><br />';
echo $input_dbpass->show($RCI->is_post ? $_POST['_dbpass'] : $dsnw['password']);
echo '<label for="cfgdbpass">Database password (omit for sqlite)</label><br />';
?>
</dd>
<dt class="propname">db_prefix</dt>
<dd>
<?php
$input_prefix = new html_inputfield(array('name' => '_db_prefix', 'size' => 20, 'id' => "cfgdbprefix"));
echo $input_prefix->show($RCI->getprop('db_prefix'));
?>
<div>Optional prefix that will be added to database object names (tables and sequences).</div>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>IMAP Settings</legend>
<dl class="configblock" id="cgfblockimap">
<dt class="propname">default_host</dt>
<dd>
<div>The IMAP host(s) chosen to perform the log-in</div>
<div id="defaulthostlist">
<?php
$text_imaphost = new html_inputfield(array('name' => '_default_host[]', 'size' => 30));
$default_hosts = $RCI->get_hostlist();
if (empty($default_hosts))
$default_hosts = array('');
$i = 0;
foreach ($default_hosts as $host) {
echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
if ($i++ > 0)
echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
echo '</div>';
}
?>
</div>
<div><a href="javascript:addhostfield()" class="addlink" title="Add another field">add</a></div>
<p class="hint">Leave blank to show a textbox at login. To use SSL/IMAPS connection, type ssl://hostname</p>
</dd>
<dt class="propname">default_port</dt>
<dd>
<?php
$text_imapport = new html_inputfield(array('name' => '_default_port', 'size' => 6, 'id' => "cfgimapport"));
echo $text_imapport->show($RCI->getprop('default_port'));
?>
<div>TCP port used for IMAP connections</div>
</dd>
<dt class="propname">username_domain</dt>
<dd>
<?php
$text_userdomain = new html_inputfield(array('name' => '_username_domain', 'size' => 30, 'id' => "cfguserdomain"));
echo $text_userdomain->show($RCI->getprop('username_domain'));
?>
<div>Automatically add this domain to user names for login</div>
<p class="hint">Only for IMAP servers that require full e-mail addresses for login</p>
</dd>
<dt class="propname">auto_create_user</dt>
<dd>
<?php
$check_autocreate = new html_checkbox(array('name' => '_auto_create_user', 'id' => "cfgautocreate"));
echo $check_autocreate->show(intval($RCI->getprop('auto_create_user')), array('value' => 1));
?>
<label for="cfgautocreate">Automatically create a new Roundcube user when log-in the first time</label><br />
<p class="hint">A user is authenticated by the IMAP server but it requires a local record to store settings
and contacts. With this option enabled a new user record will automatically be created once the IMAP login succeeds.</p>
<p class="hint">If this option is disabled, the login only succeeds if there's a matching user-record in the local Roundcube database
what means that you have to create those records manually or disable this option after the first login.</p>
</dd>
<dt class="propname">sent_mbox</dt>
<dd>
<?php
$text_sentmbox = new html_inputfield(array('name' => '_sent_mbox', 'size' => 20, 'id' => "cfgsentmbox"));
echo $text_sentmbox->show($RCI->getprop('sent_mbox'));
?>
<div>Store sent messages in this folder</div>
<p class="hint">Leave blank if sent messages should not be stored. Note: folder must include namespace prefix if any.</p>
</dd>
<dt class="propname">trash_mbox</dt>
<dd>
<?php
$text_trashmbox = new html_inputfield(array('name' => '_trash_mbox', 'size' => 20, 'id' => "cfgtrashmbox"));
echo $text_trashmbox->show($RCI->getprop('trash_mbox'));
?>
<div>Move messages to this folder when deleting them</div>
<p class="hint">Leave blank if they should be deleted directly. Note: folder must include namespace prefix if any.</p>
</dd>
<dt class="propname">drafts_mbox</dt>
<dd>
<?php
$text_draftsmbox = new html_inputfield(array('name' => '_drafts_mbox', 'size' => 20, 'id' => "cfgdraftsmbox"));
echo $text_draftsmbox->show($RCI->getprop('drafts_mbox'));
?>
<div>Store draft messages in this folder</div>
<p class="hint">Leave blank if they should not be stored. Note: folder must include namespace prefix if any.</p>
</dd>
<dt class="propname">junk_mbox</dt>
<dd>
<?php
$text_junkmbox = new html_inputfield(array('name' => '_junk_mbox', 'size' => 20, 'id' => "cfgjunkmbox"));
echo $text_junkmbox->show($RCI->getprop('junk_mbox'));
?>
<div>Store spam messages in this folder</div>
<p class="hint">Note: folder must include namespace prefix if any.</p>
</dd>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>SMTP Settings</legend>
<dl class="configblock" id="cgfblocksmtp">
<dt class="propname">smtp_server</dt>
<dd>
<?php
$text_smtphost = new html_inputfield(array('name' => '_smtp_server', 'size' => 30, 'id' => "cfgsmtphost"));
echo $text_smtphost->show($RCI->getprop('smtp_server'));
?>
<div>Use this host for sending mails</div>
<p class="hint">To use SSL connection, set ssl://smtp.host.com. If left blank, the PHP mail() function is used</p>
</dd>
<dt class="propname">smtp_port</dt>
<dd>
<?php
$text_smtpport = new html_inputfield(array('name' => '_smtp_port', 'size' => 6, 'id' => "cfgsmtpport"));
echo $text_smtpport->show($RCI->getprop('smtp_port'));
?>
<div>SMTP port (default is 25; 465 for SSL; 587 for submission)</div>
</dd>
<dt class="propname">smtp_user/smtp_pass</dt>
<dd>
<?php
$text_smtpuser = new html_inputfield(array('name' => '_smtp_user', 'size' => 20, 'id' => "cfgsmtpuser"));
$text_smtppass = new html_passwordfield(array('name' => '_smtp_pass', 'size' => 20, 'id' => "cfgsmtppass"));
echo $text_smtpuser->show($RCI->getprop('smtp_user'));
echo $text_smtppass->show($RCI->getprop('smtp_pass'));
?>
<div>SMTP username and password (if required)</div>
<p>
<?php
$check_smtpuser = new html_checkbox(array('name' => '_smtp_user_u', 'id' => "cfgsmtpuseru"));
echo $check_smtpuser->show($RCI->getprop('smtp_user') == '%u' || $_POST['_smtp_user_u'] ? 1 : 0, array('value' => 1));
?>
<label for="cfgsmtpuseru">Use the current IMAP username and password for SMTP authentication</label>
</p>
</dd>
<!--
<dt class="propname">smtp_auth_type</dt>
<dd>
<?php
/*
$select_smtpauth = new html_select(array('name' => '_smtp_auth_type', 'id' => "cfgsmtpauth"));
$select_smtpauth->add(array('(auto)', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'), array('0', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'));
echo $select_smtpauth->show(intval($RCI->getprop('smtp_auth_type')));
*/
?>
<div>Method to authenticate at the SMTP server. Choose (auto) if you don't know what this is</div>
</dd>
-->
<dt class="propname">smtp_log</dt>
<dd>
<?php
$check_smtplog = new html_checkbox(array('name' => '_smtp_log', 'id' => "cfgsmtplog"));
echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1));
?>
<label for="cfgsmtplog">Log sent messages in <tt>{log_dir}/sendmail</tt> or to syslog.</label><br />
</dd>
</dl>
</fieldset>
<fieldset>
<legend>Display settings &amp; user prefs</legend>
<dl class="configblock" id="cgfblockdisplay">
<dt class="propname">language <span class="userconf">*</span></dt>
<dd>
<?php
$input_locale = new html_inputfield(array('name' => '_language', 'size' => 6, 'id' => "cfglocale"));
echo $input_locale->show($RCI->getprop('language'));
?>
<div>The default locale setting. This also defines the language of the login screen.<br/>Leave it empty to auto-detect the user agent language.</div>
<p class="hint">Enter a <a href="http://www.faqs.org/rfcs/rfc1766">RFC1766</a> formatted language name. Examples: en_US, de_DE, de_CH, fr_FR, pt_BR</p>
</dd>
<dt class="propname">skin <span class="userconf">*</span></dt>
<dd>
<?php
$input_skin = new html_select(array('name' => '_skin', 'id' => "cfgskin"));
$input_skin->add($RCI->list_skins());
echo $input_skin->show($RCI->getprop('skin'));
?>
<div>Name of interface skin (folder in /skins)</div>
</dd>
<dt class="propname">mail_pagesize <span class="userconf">*</span></dt>
<dd>
<?php
$pagesize = $RCI->getprop('mail_pagesize');
if (!$pagesize) {
$pagesize = $RCI->getprop('pagesize');
}
$input_pagesize = new html_inputfield(array('name' => '_mail_pagesize', 'size' => 6, 'id' => "cfgmailpagesize"));
echo $input_pagesize->show($pagesize);
?>
<div>Show up to X items in the mail messages list view.</div>
</dd>
<dt class="propname">addressbook_pagesize <span class="userconf">*</span></dt>
<dd>
<?php
$pagesize = $RCI->getprop('addressbook_pagesize');
if (!$pagesize) {
$pagesize = $RCI->getprop('pagesize');
}
$input_pagesize = new html_inputfield(array('name' => '_addressbook_pagesize', 'size' => 6, 'id' => "cfgabookpagesize"));
echo $input_pagesize->show($pagesize);
?>
<div>Show up to X items in the contacts list view.</div>
</dd>
<dt class="propname">prefer_html <span class="userconf">*</span></dt>
<dd>
<?php
$check_htmlview = new html_checkbox(array('name' => '_prefer_html', 'id' => "cfghtmlview", 'value' => 1));
echo $check_htmlview->show(intval($RCI->getprop('prefer_html')));
?>
<label for="cfghtmlview">Prefer displaying HTML messages</label><br />
</dd>
<dt class="propname">preview_pane <span class="userconf">*</span></dt>
<dd>
<?php
$check_prevpane = new html_checkbox(array('name' => '_preview_pane', 'id' => "cfgprevpane", 'value' => 1));
echo $check_prevpane->show(intval($RCI->getprop('preview_pane')));
?>
<label for="cfgprevpane">If preview pane is enabled</label><br />
</dd>
<dt class="propname">htmleditor <span class="userconf">*</span></dt>
<dd>
<label for="cfghtmlcompose">Compose HTML formatted messages</label>
<?php
$select_htmlcomp = new html_select(array('name' => '_htmleditor', 'id' => "cfghtmlcompose"));
$select_htmlcomp->add('never', 0);
$select_htmlcomp->add('always', 1);
$select_htmlcomp->add('on reply to HTML message only', 2);
echo $select_htmlcomp->show(intval($RCI->getprop('htmleditor')));
?>
</dd>
<dt class="propname">draft_autosave <span class="userconf">*</span></dt>
<dd>
<label for="cfgautosave">Save compose message every</label>
<?php
$select_autosave = new html_select(array('name' => '_draft_autosave', 'id' => 'cfgautosave'));
$select_autosave->add('never', 0);
foreach (array(1, 3, 5, 10) as $i => $min)
$select_autosave->add("$min min", $min*60);
echo $select_autosave->show(intval($RCI->getprop('draft_autosave')));
?>
</dd>
<dt class="propname">mdn_requests <span class="userconf">*</span></dt>
<dd>
<?php
$mdn_opts = array(
0 => 'ask the user',
1 => 'send automatically',
3 => 'send receipt to user contacts, otherwise ask the user',
4 => 'send receipt to user contacts, otherwise ignore',
2 => 'ignore',
);
$select_mdnreq = new html_select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq"));
$select_mdnreq->add(array_values($mdn_opts), array_keys($mdn_opts));
echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests')));
?>
<div>Behavior if a received message requests a message delivery notification (read receipt)</div>
</dd>
<dt class="propname">mime_param_folding <span class="userconf">*</span></dt>
<dd>
<?php
$select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => "cfgmimeparamfolding"));
$select_param_folding->add('Full RFC 2231 (Roundcube, Thunderbird)', '0');
$select_param_folding->add('RFC 2047/2231 (MS Outlook, OE)', '1');
$select_param_folding->add('Full RFC 2047 (deprecated)', '2');
-echo $select_param_folding->show(intval($RCI->getprop('mime_param_folding')));
+echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
?>
<div>How to encode attachment long/non-ascii names</div>
</dd>
</dl>
<p class="hint"><span class="userconf">*</span>&nbsp; These settings are defaults for the user preferences</p>
</fieldset>
<?php
echo '<p><input type="submit" name="submit" value="' . ($RCI->configured ? 'UPDATE' : 'CREATE') . ' CONFIG" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
?>
</form>
diff --git a/installer/index.php b/installer/index.php
index 0e80b1cd6..d084c8aa5 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -1,166 +1,175 @@
<?php
/*
+-------------------------------------------------------------------------+
| Roundcube Webmail setup tool |
| Version 0.9-git |
| |
- | Copyright (C) 2009-2012, The Roundcube Dev Team |
+ | Copyright (C) 2009-2013, 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 (with exceptions |
| for skins & plugins) as published by the Free Software Foundation, |
| either version 3 of the License, or (at your option) any later version. |
| |
| This file forms part of the Roundcube Webmail Software for which the |
| following exception is added: Plugins and Skins which merely make |
| function calls to the Roundcube Webmail Software, and for that purpose |
| include it by reference shall not be considered modifications of |
| the software. |
| |
| If you wish to use this file in another project or create a modified |
| version that will not be part of the Roundcube Webmail Software, you |
| may remove the exception above and use this source code under the |
| original version of the license. |
| |
| 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/. |
| |
+-------------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-------------------------------------------------------------------------+
*/
ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
ini_set('display_errors', 1);
define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
define('RCUBE_INSTALL_PATH', INSTALL_PATH);
define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/');
$include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
$include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
$include_path .= ini_get('include_path');
set_include_path($include_path);
require_once 'Roundcube/bootstrap.php';
require_once 'rcube_install.php';
// deprecated aliases (to be removed)
require_once 'bc.php';
-session_start();
+if (function_exists('session_start'))
+ session_start();
$RCI = rcube_install::get_instance();
$RCI->load_config();
-if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) {
- $filename = $_GET['_getfile'] . '.inc.php';
- if (!empty($_SESSION[$filename])) {
+if (isset($_GET['_getconfig'])) {
+ $filename = 'config.inc.php';
+ if (!empty($_SESSION['config'])) {
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="'.$filename.'"');
- echo $_SESSION[$filename];
+ echo $_SESSION['config'];
exit;
}
else {
header('HTTP/1.0 404 Not found');
die("The requested configuration was not found. Please run the installer from the beginning.");
}
}
if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
- isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) {
- $filename = $_GET['_mergeconfig'] . '.inc.php';
+ !empty($_GET['_mergeconfig'])) {
+ $filename = 'config.inc.php';
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="'.$filename.'"');
$RCI->merge_config();
- echo $RCI->create_config($_GET['_mergeconfig'], true);
+ echo $RCI->create_config();
exit;
}
// go to 'check env' step if we have a local configuration
if ($RCI->configured && empty($_REQUEST['_step'])) {
header("Location: ./?_step=1");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Roundcube Webmail Installer</title>
<meta name="Robots" content="noindex,nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript" src="client.js"></script>
</head>
<body>
<div id="banner">
<div class="banner-bg"></div>
<div class="banner-logo"><a href="http://roundcube.net"><img src="images/roundcube_logo.png" width="210" height="55" border="0" alt="Roundcube - open source webmail software" /></a></div>
</div>
<div id="topnav">
<a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a>
</div>
<div id="content">
<?php
// exit if installation is complete
if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
// header("HTTP/1.0 404 Not Found");
- echo '<h2 class="error">The installer is disabled!</h2>';
- echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/main.inc.php</p>';
+ if ($RCI->configured && $RCI->legacy_config) {
+ echo '<h2 class="error">Your configuration needs to be migrated!</h2>';
+ echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
+ echo '<p>Please run the <tt>bin/update.sh</tt> script from the command line or set <p>&nbsp; <tt>$rcmail_config[\'enable_installer\'] = true;</tt></p>';
+ echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
+ }
+ else {
+ echo '<h2 class="error">The installer is disabled!</h2>';
+ echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
+ }
echo '</div></body></html>';
exit;
}
?>
<h1>Roundcube Webmail Installer</h1>
<ol id="progress">
<?php
$include_steps = array(
1 => './check.php',
2 => './config.php',
3 => './test.php',
);
if (!in_array($RCI->step, array_keys($include_steps))) {
$RCI->step = 1;
}
foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
$j = $i + 1;
$link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item);
printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
}
?>
</ol>
<?php
include $include_steps[$RCI->step];
?>
</div>
<div id="footer">
Installer by the Roundcube Dev Team. Copyright &copy; 2008-2012 – Published under the GNU Public License;&nbsp;
Icons by <a href="http://famfamfam.com">famfamfam</a>
</div>
</body>
</html>
diff --git a/installer/rcube_install.php b/installer/rcube_install.php
index ab7967708..600db34ab 100644
--- a/installer/rcube_install.php
+++ b/installer/rcube_install.php
@@ -1,786 +1,818 @@
<?php
/*
+-----------------------------------------------------------------------+
| rcube_install.php |
| |
| This file is part of the Roundcube Webmail package |
| Copyright (C) 2008-2012, 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. |
+-----------------------------------------------------------------------+
*/
/**
* Class to control the installation process of the Roundcube Webmail package
*
* @category Install
* @package Roundcube
* @author Thomas Bruederli
*/
class rcube_install
{
var $step;
var $is_post = false;
var $failures = 0;
var $config = array();
var $configured = false;
+ var $legacy_config = false;
var $last_error = null;
var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])';
var $bool_config_props = array();
+ var $local_config = array('db_dsnw', 'default_host', 'support_url', 'des_key', 'plugins');
var $obsolete_config = array('db_backend', 'double_auth');
var $replaced_config = array(
'skin_path' => 'skin',
'locale_string' => 'language',
'multiple_identities' => 'identities_level',
'addrbook_show_images' => 'show_images',
'imap_root' => 'imap_ns_personal',
'pagesize' => 'mail_pagesize',
'default_imap_folders' => 'default_folders',
'top_posting' => 'reply_mode',
);
- // these config options are required for a working system
- var $required_config = array(
- 'db_dsnw', 'des_key', 'session_lifetime',
- );
-
// list of supported database drivers
var $supported_dbs = array(
'MySQL' => 'pdo_mysql',
'PostgreSQL' => 'pdo_pgsql',
'SQLite' => 'pdo_sqlite',
'SQLite (v2)' => 'pdo_sqlite2',
'SQL Server (SQLSRV)' => 'pdo_sqlsrv',
'SQL Server (DBLIB)' => 'pdo_dblib',
);
/**
* Constructor
*/
function __construct()
{
$this->step = intval($_REQUEST['_step']);
$this->is_post = $_SERVER['REQUEST_METHOD'] == 'POST';
}
/**
* Singleton getter
*/
static function get_instance()
{
static $inst;
if (!$inst)
$inst = new rcube_install();
return $inst;
}
- /**
- * Read the default config files and store properties
- */
- function load_defaults()
- {
- $this->_load_config('.php.dist');
- }
-
-
/**
* Read the local config files and store properties
*/
function load_config()
{
- $this->config = array();
- $this->_load_config('.php');
- $this->configured = !empty($this->config);
+ // defaults
+ if ($config = $this->load_config_file(RCUBE_CONFIG_DIR . 'defaults.inc.php')) {
+ $this->config = (array) $config;
+ $this->defaults = $this->config;
+ }
+
+ $config = null;
+
+ // config
+ if ($config = $this->load_config_file(RCUBE_CONFIG_DIR . 'config.inc.php')) {
+ $this->config = array_merge($this->config, $config);
+ }
+ else {
+ if ($config = $this->load_config_file(RCUBE_CONFIG_DIR . 'main.inc.php')) {
+ $this->config = array_merge($this->config, $config);
+ $this->legacy_config = true;
+ }
+ if ($config = $this->load_config_file(RCUBE_CONFIG_DIR . 'db.inc.php')) {
+ $this->config = array_merge($this->config, $config);
+ $this->legacy_config = true;
+ }
+ }
+
+ $this->configured = !empty($config);
}
/**
* Read the default config file and store properties
- * @access private
*/
- function _load_config($suffix)
+ public function load_config_file($file)
{
- if (is_readable($main_inc = RCUBE_CONFIG_DIR . 'main.inc' . $suffix)) {
- include($main_inc);
- if (is_array($rcmail_config))
- $this->config += $rcmail_config;
- }
- if (is_readable($db_inc = RCUBE_CONFIG_DIR . 'db.inc'. $suffix)) {
- include($db_inc);
- if (is_array($rcmail_config))
- $this->config += $rcmail_config;
+ if (is_readable($file)) {
+ include $file;
+
+ // read comments from config file
+ if (function_exists('token_get_all')) {
+ $tokens = token_get_all(file_get_contents($file));
+ $in_config = false;
+ $buffer = '';
+ for ($i=0; $i < count($tokens); $i++) {
+ $token = $tokens[$i];
+ if ($token[0] == T_VARIABLE && $token[1] == '$config' || $token[1] == '$rcmail_config') {
+ $in_config = true;
+ if ($buffer && $tokens[$i+1] == '[' && $tokens[$i+2][0] == T_CONSTANT_ENCAPSED_STRING) {
+ $propname = trim($tokens[$i+2][1], "'\"");
+ $this->comments[$propname] = $buffer;
+ $buffer = '';
+ $i += 3;
+ }
+ }
+ else if ($in_config && $token[0] == T_COMMENT) {
+ $buffer .= strtr($token[1], array('\n' => "\n"));
+ }
+ }
+ }
+
+ // deprecated name of config variable
+ if (is_array($rcmail_config)) {
+ return $rcmail_config;
+ }
+
+ return $config;
}
}
-
/**
* Getter for a certain config property
*
* @param string Property name
* @param string Default value
* @return string The property value
*/
function getprop($name, $default = '')
{
$value = $this->config[$name];
if ($name == 'des_key' && !$this->configured && !isset($_REQUEST["_$name"]))
$value = rcube_install::random_key(24);
return $value !== null && $value !== '' ? $value : $default;
}
/**
- * Take the default config file and replace the parameters
- * with the submitted form data
+ * Create configuration file that contains parameters
+ * that differ from default values.
*
- * @param string Which config file (either 'main' or 'db')
* @return string The complete config file content
*/
- function create_config($which, $force = false)
+ function create_config()
{
- $out = @file_get_contents(RCUBE_CONFIG_DIR . $which . '.inc.php.dist');
-
- if (!$out)
- return '[Warning: could not read the config template file]';
+ $config = array();
foreach ($this->config as $prop => $default) {
-
$is_default = !isset($_POST["_$prop"]);
$value = !$is_default || $this->bool_config_props[$prop] ? $_POST["_$prop"] : $default;
+ if ($prop == 'enable_installer')
+ $value = false;
+
// convert some form data
if ($prop == 'debug_level' && !$is_default) {
if (is_array($value)) {
$val = 0;
foreach ($value as $dbgval)
$val += intval($dbgval);
$value = $val;
}
}
- else if ($which == 'db' && $prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
+ else if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
if ($_POST['_dbtype'] == 'sqlite')
$value = sprintf('%s://%s?mode=0646', $_POST['_dbtype'], $_POST['_dbname']{0} == '/' ? '/' . $_POST['_dbname'] : $_POST['_dbname']);
else if ($_POST['_dbtype'])
$value = sprintf('%s://%s:%s@%s/%s', $_POST['_dbtype'],
rawurlencode($_POST['_dbuser']), rawurlencode($_POST['_dbpass']), $_POST['_dbhost'], $_POST['_dbname']);
}
else if ($prop == 'smtp_auth_type' && $value == '0') {
$value = '';
}
else if ($prop == 'default_host' && is_array($value)) {
$value = rcube_install::_clean_array($value);
if (count($value) <= 1)
$value = $value[0];
}
else if ($prop == 'mail_pagesize' || $prop == 'addressbook_pagesize') {
$value = max(2, intval($value));
}
else if ($prop == 'smtp_user' && !empty($_POST['_smtp_user_u'])) {
$value = '%u';
}
else if ($prop == 'smtp_pass' && !empty($_POST['_smtp_user_u'])) {
$value = '%p';
}
else if ($prop == 'default_folders') {
$value = array();
foreach ($this->config['default_folders'] as $_folder) {
switch ($_folder) {
case 'Drafts': $_folder = $this->config['drafts_mbox']; break;
case 'Sent': $_folder = $this->config['sent_mbox']; break;
case 'Junk': $_folder = $this->config['junk_mbox']; break;
case 'Trash': $_folder = $this->config['trash_mbox']; break;
}
if (!in_array($_folder, $value))
$value[] = $_folder;
}
}
else if (is_bool($default)) {
$value = (bool)$value;
}
else if (is_numeric($value)) {
$value = intval($value);
}
// skip this property
- if (!$force && !$this->configured && ($value == $default))
+ if ((!array_key_exists($prop, $this->defaults) || ($value == $this->defaults[$prop])) && !in_array($prop, $this->local_config)) {
continue;
+ }
// save change
$this->config[$prop] = $value;
+ $config[$prop] = $value;
+ }
- $dump = self::_dump_var($value, $prop);
-
- // replace the matching line in config file
- $out = preg_replace(
- '/(\$rcmail_config\[\''.preg_quote($prop).'\'\])\s+=\s+(.+);/Ui',
- "\\1 = $dump;",
- $out);
+ $out = "<?php\n\n";
+ $out .= "/* Local configuration for Roundcube Webmail */\n\n";
+ foreach ($config as $prop => $value) {
+ // copy option descriptions from existing config or defaults.inc.php
+ $out .= $this->comments[$prop];
+ $out .= "\$config['$prop'] = " . rcube_install::_dump_var($value, $prop) . ";\n\n";
}
- return trim($out);
+ return $out;
}
/**
* Check the current configuration for missing properties
* and deprecated or obsolete settings
*
* @return array List with problems detected
*/
function check_config()
{
- $this->config = array();
- $this->load_defaults();
- $defaults = $this->config;
-
$this->load_config();
- if (!$this->configured)
+
+ if (!$this->configured) {
return null;
+ }
$out = $seen = array();
- $required = array_flip($this->required_config);
// iterate over the current configuration
foreach ($this->config as $prop => $value) {
if ($replacement = $this->replaced_config[$prop]) {
$out['replaced'][] = array('prop' => $prop, 'replacement' => $replacement);
$seen[$replacement] = true;
}
else if (!$seen[$prop] && in_array($prop, $this->obsolete_config)) {
$out['obsolete'][] = array('prop' => $prop);
$seen[$prop] = true;
}
}
// the old default mime_magic reference is obsolete
if ($this->config['mime_magic'] == '/usr/share/misc/magic') {
$out['obsolete'][] = array('prop' => 'mime_magic', 'explain' => "Set value to null in order to use system default");
}
- // iterate over default config
- foreach ($defaults as $prop => $value) {
- if (!isset($seen[$prop]) && isset($required[$prop]) && !(is_bool($this->config[$prop]) || strlen($this->config[$prop])))
- $out['missing'][] = array('prop' => $prop);
- }
-
// check config dependencies and contradictions
if ($this->config['enable_spellcheck'] && $this->config['spellcheck_engine'] == 'pspell') {
if (!extension_loaded('pspell')) {
$out['dependencies'][] = array('prop' => 'spellcheck_engine',
'explain' => 'This requires the <tt>pspell</tt> extension which could not be loaded.');
}
else if (!empty($this->config['spellcheck_languages'])) {
foreach ($this->config['spellcheck_languages'] as $lang => $descr)
if (!@pspell_new($lang))
$out['dependencies'][] = array('prop' => 'spellcheck_languages',
'explain' => "You are missing pspell support for language $lang ($descr)");
}
}
if ($this->config['log_driver'] == 'syslog') {
if (!function_exists('openlog')) {
$out['dependencies'][] = array('prop' => 'log_driver',
'explain' => 'This requires the <tt>syslog</tt> extension which could not be loaded.');
}
if (empty($this->config['syslog_id'])) {
$out['dependencies'][] = array('prop' => 'syslog_id',
'explain' => 'Using <tt>syslog</tt> for logging requires a syslog ID to be configured');
}
}
// check ldap_public sources having global_search enabled
if (is_array($this->config['ldap_public']) && !is_array($this->config['autocomplete_addressbooks'])) {
foreach ($this->config['ldap_public'] as $ldap_public) {
if ($ldap_public['global_search']) {
$out['replaced'][] = array('prop' => 'ldap_public::global_search', 'replacement' => 'autocomplete_addressbooks');
break;
}
}
}
return $out;
}
/**
* Merge the current configuration with the defaults
* and copy replaced values to the new options.
*/
function merge_config()
{
$current = $this->config;
$this->config = array();
- $this->load_defaults();
foreach ($this->replaced_config as $prop => $replacement) {
if (isset($current[$prop])) {
if ($prop == 'skin_path')
$this->config[$replacement] = preg_replace('#skins/(\w+)/?$#', '\\1', $current[$prop]);
else if ($prop == 'multiple_identities')
$this->config[$replacement] = $current[$prop] ? 2 : 0;
else
$this->config[$replacement] = $current[$prop];
}
unset($current[$prop]);
}
foreach ($this->obsolete_config as $prop) {
unset($current[$prop]);
}
// add all ldap_public sources having global_search enabled to autocomplete_addressbooks
if (is_array($current['ldap_public'])) {
foreach ($current['ldap_public'] as $key => $ldap_public) {
if ($ldap_public['global_search']) {
$this->config['autocomplete_addressbooks'][] = $key;
unset($current['ldap_public'][$key]['global_search']);
}
}
}
- $this->config = array_merge($this->config, $current);
+ $this->config = array_merge($this->config, $current);
foreach (array_keys((array)$current['ldap_public']) as $key) {
$this->config['ldap_public'][$key] = $current['ldap_public'][$key];
}
}
/**
* Compare the local database schema with the reference schema
* required for this version of Roundcube
*
* @param rcube_db Database object
*
* @return boolean True if the schema is up-to-date, false if not or an error occured
*/
function db_schema_check($DB)
{
if (!$this->configured)
return false;
// read reference schema from mysql.initial.sql
$db_schema = $this->db_read_schema(INSTALL_PATH . 'SQL/mysql.initial.sql');
$errors = array();
// check list of tables
$existing_tables = $DB->list_tables();
foreach ($db_schema as $table => $cols) {
$table = $this->config['db_prefix'] . $table;
if (!in_array($table, $existing_tables)) {
$errors[] = "Missing table '".$table."'";
}
else { // compare cols
$db_cols = $DB->list_cols($table);
$diff = array_diff(array_keys($cols), $db_cols);
if (!empty($diff))
$errors[] = "Missing columns in table '$table': " . join(',', $diff);
}
}
return !empty($errors) ? $errors : false;
}
/**
* Utility function to read database schema from an .sql file
*/
private function db_read_schema($schemafile)
{
$lines = file($schemafile);
$table_block = false;
$schema = array();
foreach ($lines as $line) {
if (preg_match('/^\s*create table `?([a-z0-9_]+)`?/i', $line, $m)) {
$table_block = $m[1];
}
else if ($table_block && preg_match('/^\s*`?([a-z0-9_-]+)`?\s+([a-z]+)/', $line, $m)) {
$col = $m[1];
if (!in_array(strtoupper($col), array('PRIMARY','KEY','INDEX','UNIQUE','CONSTRAINT','REFERENCES','FOREIGN'))) {
$schema[$table_block][$col] = $m[2];
}
}
}
return $schema;
}
/**
* Try to detect some file's mimetypes to test the correct behavior of fileinfo
*/
function check_mime_detection()
{
$files = array(
'installer/images/roundcube_logo.png' => 'image/png',
'program/resources/blank.tif' => 'image/tiff',
'skins/larry/templates/login.html' => 'text/html',
);
$errors = array();
foreach ($files as $path => $expected) {
$mimetype = rcube_mime::file_content_type(INSTALL_PATH . $path, basename($path));
if ($mimetype != $expected) {
$errors[] = array($path, $mimetype, $expected);
}
}
return $errors;
}
/**
* Check the correct configuration of the 'mime_types' mapping option
*/
function check_mime_extensions()
{
$types = array(
'application/zip' => 'zip',
'application/x-tar' => 'tar',
'application/java-archive' => 'jar',
'image/bmp' => 'bmp',
'image/svg+xml' => 'svg',
);
$errors = array();
foreach ($types as $mimetype => $expected) {
$ext = rcube_mime::get_mime_extensions($mimetype);
if ($ext[0] != $expected) {
$errors[] = array($mimetype, $ext, $expected);
}
}
return $errors;
}
/**
* Getter for the last error message
*
* @return string Error message or null if none exists
*/
function get_error()
{
return $this->last_error['message'];
}
/**
* Return a list with all imap hosts configured
*
* @return array Clean list with imap hosts
*/
function get_hostlist()
{
$default_hosts = (array)$this->getprop('default_host');
$out = array();
foreach ($default_hosts as $key => $name) {
if (!empty($name))
$out[] = rcube_parse_host(is_numeric($key) ? $name : $key);
}
return $out;
}
/**
* Create a HTML dropdown to select a previous version of Roundcube
*/
function versions_select($attrib = array())
{
$select = new html_select($attrib);
$select->add(array(
'0.1-stable', '0.1.1',
'0.2-alpha', '0.2-beta', '0.2-stable',
'0.3-stable', '0.3.1',
'0.4-beta', '0.4.2',
'0.5-beta', '0.5', '0.5.1', '0.5.2', '0.5.3', '0.5.4',
'0.6-beta', '0.6',
'0.7-beta', '0.7', '0.7.1', '0.7.2', '0.7.3', '0.7.4',
'0.8-beta', '0.8-rc', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6',
'0.9-beta', '0.9-rc', '0.9-rc2',
// Note: Do not add newer versions here
));
return $select;
}
/**
* Return a list with available subfolders of the skin directory
*/
function list_skins()
{
$skins = array();
$skindir = INSTALL_PATH . 'skins/';
foreach (glob($skindir . '*') as $path) {
if (is_dir($path) && is_readable($path)) {
$skins[] = substr($path, strlen($skindir));
}
}
return $skins;
}
/**
* Display OK status
*
* @param string Test name
* @param string Confirm message
*/
function pass($name, $message = '')
{
echo Q($name) . ':&nbsp; <span class="success">OK</span>';
$this->_showhint($message);
}
/**
* Display an error status and increase failure count
*
* @param string Test name
* @param string Error message
* @param string URL for details
* @param bool Do not count this failure
*/
function fail($name, $message = '', $url = '', $optional=false)
{
if (!$optional) {
$this->failures++;
}
echo Q($name) . ':&nbsp; <span class="fail">NOT OK</span>';
$this->_showhint($message, $url);
}
/**
* Display an error status for optional settings/features
*
* @param string Test name
* @param string Error message
* @param string URL for details
*/
function optfail($name, $message = '', $url = '')
{
echo Q($name) . ':&nbsp; <span class="na">NOT OK</span>';
$this->_showhint($message, $url);
}
/**
* Display warning status
*
* @param string Test name
* @param string Warning message
* @param string URL for details
*/
function na($name, $message = '', $url = '')
{
echo Q($name) . ':&nbsp; <span class="na">NOT AVAILABLE</span>';
$this->_showhint($message, $url);
}
function _showhint($message, $url = '')
{
$hint = Q($message);
if ($url)
$hint .= ($hint ? '; ' : '') . 'See <a href="' . Q($url) . '" target="_blank">' . Q($url) . '</a>';
if ($hint)
echo '<span class="indent">(' . $hint . ')</span>';
}
static function _clean_array($arr)
{
$out = array();
foreach (array_unique($arr) as $k => $val) {
if (!empty($val)) {
if (is_numeric($k))
$out[] = $val;
else
$out[$k] = $val;
}
}
return $out;
}
- static function _dump_var($var, $name=null) {
+ static function _dump_var($var, $name=null)
+ {
// special values
switch ($name) {
case 'syslog_facility':
$list = array(32 => 'LOG_AUTH', 80 => 'LOG_AUTHPRIV', 72 => ' LOG_CRON',
24 => 'LOG_DAEMON', 0 => 'LOG_KERN', 128 => 'LOG_LOCAL0',
136 => 'LOG_LOCAL1', 144 => 'LOG_LOCAL2', 152 => 'LOG_LOCAL3',
160 => 'LOG_LOCAL4', 168 => 'LOG_LOCAL5', 176 => 'LOG_LOCAL6',
184 => 'LOG_LOCAL7', 48 => 'LOG_LPR', 16 => 'LOG_MAIL',
56 => 'LOG_NEWS', 40 => 'LOG_SYSLOG', 8 => 'LOG_USER', 64 => 'LOG_UUCP');
if ($val = $list[$var])
return $val;
break;
- }
+ case 'mail_header_delimiter':
+ $var = str_replace(array("\r", "\n"), array('\r', '\n'), $var);
+ return '"' . $var. '"';
+ break;
+/*
+ // RCMAIL_VERSION is undefined here
+ case 'useragent':
+ if (preg_match('|^(.*)/('.preg_quote(RCMAIL_VERSION, '|').')$|i', $var, $m)) {
+ return '"' . addcslashes($var, '"') . '/" . RCMAIL_VERSION';
+ }
+ break;
+*/
+ }
if (is_array($var)) {
if (empty($var)) {
return 'array()';
}
else { // check if all keys are numeric
$isnum = true;
foreach (array_keys($var) as $key) {
if (!is_numeric($key)) {
$isnum = false;
break;
}
}
if ($isnum)
return 'array(' . join(', ', array_map(array('rcube_install', '_dump_var'), $var)) . ')';
}
}
return var_export($var, true);
}
/**
* Initialize the database with the according schema
*
* @param object rcube_db Database connection
* @return boolen True on success, False on error
*/
function init_db($DB)
{
$engine = $DB->db_provider;
// read schema file from /SQL/*
$fname = INSTALL_PATH . "SQL/$engine.initial.sql";
if ($sql = @file_get_contents($fname)) {
$this->exec_sql($sql, $DB);
}
else {
$this->fail('DB Schema', "Cannot read the schema file: $fname");
return false;
}
if ($err = $this->get_error()) {
$this->fail('DB Schema', "Error creating database schema: $err");
return false;
}
return true;
}
/**
* Update database schema
*
* @param string Version to update from
*
* @return boolen True on success, False on error
*/
function update_db($version)
{
system(INSTALL_PATH . "bin/updatedb.sh --package=roundcube"
. " --version=" . escapeshellarg($version)
. " --dir=" . INSTALL_PATH . "SQL"
. " 2>&1", $result);
return !$result;
}
/**
* Execute the given SQL queries on the database connection
*
* @param string SQL queries to execute
* @param object rcube_db Database connection
* @return boolen True on success, False on error
*/
function exec_sql($sql, $DB)
{
$sql = $this->fix_table_names($sql, $DB);
$buff = '';
foreach (explode("\n", $sql) as $line) {
if (preg_match('/^--/', $line) || trim($line) == '')
continue;
$buff .= $line . "\n";
if (preg_match('/(;|^GO)$/', trim($line))) {
$DB->query($buff);
$buff = '';
if ($DB->is_error())
break;
}
}
return !$DB->is_error();
}
/**
* Parse SQL file and fix table names according to db_prefix
* Note: This need to be a complete database initial file
*/
private function fix_table_names($sql, $DB)
{
if (empty($this->config['db_prefix'])) {
return $sql;
}
// replace table names
if (preg_match_all('/CREATE TABLE (\[dbo\]\.|IF NOT EXISTS )?[`"\[\]]*([^`"\[\] \r\n]+)/i', $sql, $matches)) {
foreach ($matches[2] as $table) {
$real_table = $this->config['db_prefix'] . $table;
$sql = preg_replace("/([^a-zA-Z0-9_])$table([^a-zA-Z0-9_])/", "\\1$real_table\\2", $sql);
}
}
// replace sequence names
if ($DB->db_provider == 'postgres' && preg_match_all('/CREATE SEQUENCE (IF NOT EXISTS )?"?([^" \n\r]+)/i', $sql, $matches)) {
foreach ($matches[2] as $sequence) {
$real_sequence = $this->config['db_prefix'] . $sequence;
$sql = preg_replace("/([^a-zA-Z0-9_])$sequence([^a-zA-Z0-9_])/", "\\1$real_sequence\\2", $sql);
}
}
return $sql;
}
/**
* Handler for Roundcube errors
*/
function raise_error($p)
{
$this->last_error = $p;
}
/**
* Generarte a ramdom string to be used as encryption key
*
* @param int Key length
* @return string The generated random string
* @static
*/
function random_key($length)
{
$alpha = 'ABCDEFGHIJKLMNOPQERSTUVXYZabcdefghijklmnopqrtsuvwxyz0123456789+*%&?!$-_=';
$out = '';
for ($i=0; $i < $length; $i++)
$out .= $alpha{rand(0, strlen($alpha)-1)};
return $out;
}
}
diff --git a/installer/test.php b/installer/test.php
index 75dac47aa..f834308ad 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -1,472 +1,454 @@
<?php
if (!class_exists('rcube_install') || !is_object($RCI)) {
die("Not allowed! Please open installer/index.php instead.");
}
?>
<form action="index.php?_step=3" method="post">
-<h3>Check config files</h3>
+<h3>Check config file</h3>
<?php
-$read_main = is_readable(RCUBE_CONFIG_DIR . 'main.inc.php');
-$read_db = is_readable(RCUBE_CONFIG_DIR . 'db.inc.php');
-
-if ($read_main && !empty($RCI->config)) {
- $RCI->pass('main.inc.php');
-}
-else if ($read_main) {
- $RCI->fail('main.inc.php', 'Syntax error');
+if ($read_config = is_readable(RCUBE_CONFIG_DIR . 'defaults.inc.php')) {
+ $config = $RCI->load_config_file(RCUBE_CONFIG_DIR . 'defaults.inc.php');
+ if (!empty($config)) {
+ $RCI->pass('defaults.inc.php');
+ }
+ else {
+ $RCI->fail('defaults.inc.php', 'Syntax error');
+ }
}
-else if (!$read_main) {
- $RCI->fail('main.inc.php', 'Unable to read file. Did you create the config files?');
+else {
+ $RCI->fail('defaults.inc.php', 'Unable to read default config file?');
}
echo '<br />';
-if ($read_db && !empty($RCI->config['db_dsnw'])) {
- $RCI->pass('db.inc.php');
-}
-else if ($read_db) {
- $RCI->fail('db.inc.php', 'Syntax error');
+if ($read_config = is_readable(RCUBE_CONFIG_DIR . 'config.inc.php')) {
+ $config = $RCI->load_config_file(RCUBE_CONFIG_DIR . 'config.inc.php');
+ if (!empty($config)) {
+ $RCI->pass('config.inc.php');
+ }
+ else {
+ $RCI->fail('config.inc.php', 'Syntax error');
+ }
}
-else if (!$read_db) {
- $RCI->fail('db.inc.php', 'Unable to read file. Did you create the config files?');
+else {
+ $RCI->fail('config.inc.php', 'Unable to read file. Did you create the config file?');
}
+echo '<br />';
-if ($RCI->configured && ($messages = $RCI->check_config())) {
-
- if (is_array($messages['missing'])) {
- echo '<h3 class="warning">Missing config options</h3>';
- echo '<p class="hint">The following config options are not set (not present or empty) in the current configuration.<br/>';
- echo 'Please check the default config files and set the missing properties in your local config files.</p>';
-
- echo '<ul class="configwarnings">';
- foreach ($messages['missing'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ':&nbsp;' . $msg['name'] : ''));
- }
- echo '</ul>';
- }
+if ($RCI->configured && ($messages = $RCI->check_config())) {
if (is_array($messages['replaced'])) {
echo '<h3 class="warning">Replaced config options</h3>';
echo '<p class="hint">The following config options have been replaced or renamed. ';
echo 'Please update them accordingly in your config files.</p>';
-
+
echo '<ul class="configwarings">';
foreach ($messages['replaced'] as $msg) {
echo html::tag('li', null, html::span('propname', $msg['prop']) .
' was replaced by ' . html::span('propname', $msg['replacement']));
}
echo '</ul>';
}
if (is_array($messages['obsolete'])) {
echo '<h3>Obsolete config options</h3>';
echo '<p class="hint">You still have some obsolete or inexistent properties set. This isn\'t a problem but should be noticed.</p>';
-
+
echo '<ul class="configwarings">';
foreach ($messages['obsolete'] as $msg) {
echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ':&nbsp;' . $msg['name'] : ''));
}
echo '</ul>';
}
-
- echo '<p class="suggestion">OK, lazy people can download the updated config files here: ';
- echo html::a(array('href' => './?_mergeconfig=main'), 'main.inc.php') . ' &nbsp;';
- echo html::a(array('href' => './?_mergeconfig=db'), 'db.inc.php');
+
+ echo '<p class="suggestion">OK, lazy people can download the updated config file here: ';
+ echo html::a(array('href' => './?_mergeconfig=1'), 'config.inc.php') . ' &nbsp;';
echo "</p>";
-
-
+
if (is_array($messages['dependencies'])) {
echo '<h3 class="warning">Dependency check failed</h3>';
echo '<p class="hint">Some of your configuration settings require other options to be configured or additional PHP modules to be installed</p>';
-
+
echo '<ul class="configwarings">';
foreach ($messages['dependencies'] as $msg) {
echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
}
echo '</ul>';
}
-
-
}
?>
<h3>Check if directories are writable</h3>
<p>Roundcube may need to write/save files into these directories</p>
<?php
-if ($RCI->configured) {
- $pass = false;
-
- $dirs[] = $RCI->config['temp_dir'] ? $RCI->config['temp_dir'] : 'temp';
- if($RCI->config['log_driver'] != 'syslog')
- $dirs[] = $RCI->config['log_dir'] ? $RCI->config['log_dir'] : 'logs';
+$dirs[] = $RCI->config['temp_dir'] ? $RCI->config['temp_dir'] : 'temp';
+if ($RCI->config['log_driver'] != 'syslog')
+ $dirs[] = $RCI->config['log_dir'] ? $RCI->config['log_dir'] : 'logs';
- foreach ($dirs as $dir) {
- $dirpath = $dir[0] == '/' ? $dir : INSTALL_PATH . $dir;
- if (is_writable(realpath($dirpath))) {
- $RCI->pass($dir);
- $pass = true;
- }
- else {
- $RCI->fail($dir, 'not writeable for the webserver');
- }
- echo '<br />';
+foreach ($dirs as $dir) {
+ $dirpath = $dir[0] == '/' ? $dir : INSTALL_PATH . $dir;
+ if (is_writable(realpath($dirpath))) {
+ $RCI->pass($dir);
+ $pass = true;
}
-
- if (!$pass)
- echo '<p class="hint">Use <tt>chmod</tt> or <tt>chown</tt> to grant write privileges to the webserver</p>';
+ else {
+ $RCI->fail($dir, 'not writeable for the webserver');
+ }
+ echo '<br />';
}
-else {
- $RCI->fail('Config', 'Could not read config files');
+
+if (!$pass) {
+ echo '<p class="hint">Use <tt>chmod</tt> or <tt>chown</tt> to grant write privileges to the webserver</p>';
}
?>
<h3>Check DB config</h3>
<?php
$db_working = false;
if ($RCI->configured) {
if (!empty($RCI->config['db_dsnw'])) {
$DB = rcube_db::factory($RCI->config['db_dsnw'], '', false);
$DB->db_connect('w');
if (!($db_error_msg = $DB->is_error())) {
$RCI->pass('DSN (write)');
echo '<br />';
$db_working = true;
}
else {
$RCI->fail('DSN (write)', $db_error_msg);
echo '<p class="hint">Make sure that the configured database exists and that the user has write privileges<br />';
echo 'DSN: ' . $RCI->config['db_dsnw'] . '</p>';
}
}
else {
$RCI->fail('DSN (write)', 'not set');
}
}
else {
- $RCI->fail('Config', 'Could not read config files');
+ $RCI->fail('DSN (write)', 'Could not read config file');
}
// initialize db with schema found in /SQL/*
if ($db_working && $_POST['initdb']) {
if (!($success = $RCI->init_db($DB))) {
$db_working = false;
echo '<p class="warning">Please try to inizialize the database manually as described in the INSTALL guide.
Make sure that the configured database extists and that the user as write privileges</p>';
}
}
else if ($db_working && $_POST['updatedb']) {
if (!($success = $RCI->update_db($_POST['version']))) {
echo '<p class="warning">Database schema update failed.</p>';
}
}
// test database
if ($db_working) {
$db_read = $DB->query("SELECT count(*) FROM {$RCI->config['db_prefix']}users");
if ($DB->is_error()) {
$RCI->fail('DB Schema', "Database not initialized");
echo '<p><input type="submit" name="initdb" value="Initialize database" /></p>';
$db_working = false;
}
else if ($err = $RCI->db_schema_check($DB, $update = !empty($_POST['updatedb']))) {
$RCI->fail('DB Schema', "Database schema differs");
echo '<ul style="margin:0"><li>' . join("</li>\n<li>", $err) . "</li></ul>";
$select = $RCI->versions_select(array('name' => 'version'));
$select->add('0.9 or newer', '');
echo '<p class="suggestion">You should run the update queries to get the schema fixed.<br/><br/>Version to update from: ' . $select->show() . '&nbsp;<input type="submit" name="updatedb" value="Update" /></p>';
$db_working = false;
}
else {
$RCI->pass('DB Schema');
echo '<br />';
}
}
// more database tests
if ($db_working) {
// write test
$insert_id = md5(uniqid());
$db_write = $DB->query("INSERT INTO {$RCI->config['db_prefix']}session (sess_id, created, ip, vars) VALUES (?, ".$DB->now().", '127.0.0.1', 'foo')", $insert_id);
if ($db_write) {
$RCI->pass('DB Write');
$DB->query("DELETE FROM {$RCI->config['db_prefix']}session WHERE sess_id=?", $insert_id);
}
else {
$RCI->fail('DB Write', $RCI->get_error());
}
echo '<br />';
// check timezone settings
$tz_db = 'SELECT ' . $DB->unixtimestamp($DB->now()) . ' AS tz_db';
$tz_db = $DB->query($tz_db);
$tz_db = $DB->fetch_assoc($tz_db);
$tz_db = (int) $tz_db['tz_db'];
$tz_local = (int) time();
$tz_diff = $tz_local - $tz_db;
// sometimes db and web servers are on separate hosts, so allow a 30 minutes delta
if (abs($tz_diff) > 1800) {
$RCI->fail('DB Time', "Database time differs {$td_ziff}s from PHP time");
}
else {
$RCI->pass('DB Time');
}
}
?>
<h3>Test filetype detection</h3>
<p>
<?php
if ($errors = $RCI->check_mime_detection()) {
$RCI->fail('Fileinfo/mime_content_type configuration');
if (!empty($RCI->config['mime_magic'])) {
echo '<p class="hint">Try setting the <tt>mime_magic</tt> config option to <tt>null</tt>.</p>';
}
else {
echo '<p class="hint">Check the <a href="http://www.php.net/manual/en/function.finfo-open.php">Fileinfo functions</a> of your PHP installation.<br/>';
echo 'The path to the magic.mime file can be set using the <tt>mime_magic</tt> config option in Roundcube.</p>';
}
}
else {
$RCI->pass('Fileinfo/mime_content_type configuration');
}
?>
</p>
<p>
<?php
if ($errors = $RCI->check_mime_extensions()) {
$RCI->fail('Mimetype to file extension mapping');
echo '<p class="hint">Please set a valid path to your webserver\'s mime.types file to the <tt>mime_types</tt> config option.<br/>';
echo 'If you can\'t find such a file, download it from <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types">svn.apache.org</a>.</p>';
}
else {
$RCI->pass('Mimetype to file extension mapping');
}
?>
<h3>Test SMTP config</h3>
<p>
Server: <?php echo rcube_parse_host($RCI->getprop('smtp_server', 'PHP mail()')); ?><br />
Port: <?php echo $RCI->getprop('smtp_port'); ?><br />
<?php
if ($RCI->getprop('smtp_server')) {
$user = $RCI->getprop('smtp_user', '(none)');
$pass = $RCI->getprop('smtp_pass', '(none)');
if ($user == '%u') {
$user_field = new html_inputfield(array('name' => '_smtp_user'));
$user = $user_field->show($_POST['_smtp_user']);
}
if ($pass == '%p') {
$pass_field = new html_passwordfield(array('name' => '_smtp_pass'));
$pass = $pass_field->show();
}
echo "User: $user<br />";
echo "Password: $pass<br />";
}
$from_field = new html_inputfield(array('name' => '_from', 'id' => 'sendmailfrom'));
$to_field = new html_inputfield(array('name' => '_to', 'id' => 'sendmailto'));
?>
</p>
<?php
if (isset($_POST['sendmail'])) {
echo '<p>Trying to send email...<br />';
$from = idn_to_ascii(trim($_POST['_from']));
$to = idn_to_ascii(trim($_POST['_to']));
if (preg_match('/^' . $RCI->email_pattern . '$/i', $from) &&
preg_match('/^' . $RCI->email_pattern . '$/i', $to)
) {
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => 'Test message from Roundcube',
);
$body = 'This is a test to confirm that Roundcube can send email.';
$smtp_response = array();
// send mail using configured SMTP server
if ($RCI->getprop('smtp_server')) {
$CONFIG = $RCI->config;
if (!empty($_POST['_smtp_user'])) {
$CONFIG['smtp_user'] = $_POST['_smtp_user'];
}
if (!empty($_POST['_smtp_pass'])) {
$CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
}
$mail_object = new Mail_mime();
$send_headers = $mail_object->headers($headers);
$SMTP = new rcube_smtp();
$SMTP->connect(rcube_parse_host($RCI->getprop('smtp_server')),
$RCI->getprop('smtp_port'), $CONFIG['smtp_user'], $CONFIG['smtp_pass']);
$status = $SMTP->send_mail($headers['From'], $headers['To'],
($foo = $mail_object->txtHeaders($send_headers)), $body);
$smtp_response = $SMTP->get_response();
}
else { // use mail()
$header_str = 'From: ' . $headers['From'];
if (ini_get('safe_mode'))
$status = mail($headers['To'], $headers['Subject'], $body, $header_str);
else
$status = mail($headers['To'], $headers['Subject'], $body, $header_str, '-f'.$headers['From']);
if (!$status)
$smtp_response[] = 'Mail delivery with mail() failed. Check your error logs for details';
}
if ($status) {
$RCI->pass('SMTP send');
}
else {
$RCI->fail('SMTP send', join('; ', $smtp_response));
}
}
else {
$RCI->fail('SMTP send', 'Invalid sender or recipient');
}
echo '</p>';
}
?>
<table>
<tbody>
<tr>
<td><label for="sendmailfrom">Sender</label></td>
<td><?php echo $from_field->show($_POST['_from']); ?></td>
</tr>
<tr>
<td><label for="sendmailto">Recipient</label></td>
<td><?php echo $to_field->show($_POST['_to']); ?></td>
</tr>
</tbody>
</table>
<p><input type="submit" name="sendmail" value="Send test mail" /></p>
<h3>Test IMAP config</h3>
<?php
$default_hosts = $RCI->get_hostlist();
if (!empty($default_hosts)) {
$host_field = new html_select(array('name' => '_host', 'id' => 'imaphost'));
$host_field->add($default_hosts);
}
else {
$host_field = new html_inputfield(array('name' => '_host', 'id' => 'imaphost'));
}
$user_field = new html_inputfield(array('name' => '_user', 'id' => 'imapuser'));
$pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'));
?>
<table>
<tbody>
<tr>
<td><label for="imaphost">Server</label></td>
<td><?php echo $host_field->show($_POST['_host']); ?></td>
</tr>
<tr>
<td>Port</td>
<td><?php echo $RCI->getprop('default_port'); ?></td>
</tr>
<tr>
<td><label for="imapuser">Username</label></td>
<td><?php echo $user_field->show($_POST['_user']); ?></td>
</tr>
<tr>
<td><label for="imappass">Password</label></td>
<td><?php echo $pass_field->show(); ?></td>
</tr>
</tbody>
</table>
<?php
if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user'])) {
echo '<p>Connecting to ' . Q($_POST['_host']) . '...<br />';
$imap_host = trim($_POST['_host']);
$imap_port = $RCI->getprop('default_port');
$a_host = parse_url($imap_host);
if ($a_host['host']) {
$imap_host = $a_host['host'];
$imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
if (isset($a_host['port']))
$imap_port = $a_host['port'];
else if ($imap_ssl && $imap_ssl != 'tls' && (!$imap_port || $imap_port == 143))
$imap_port = 993;
}
$imap_host = idn_to_ascii($imap_host);
$imap_user = idn_to_ascii($_POST['_user']);
$imap = new rcube_imap(null);
if ($imap->connect($imap_host, $imap_user, $_POST['_pass'], $imap_port, $imap_ssl)) {
$RCI->pass('IMAP connect', 'SORT capability: ' . ($imap->get_capability('SORT') ? 'yes' : 'no'));
$imap->close();
}
else {
$RCI->fail('IMAP connect', $RCI->get_error());
}
}
?>
<p><input type="submit" name="imaptest" value="Check login" /></p>
</form>
<hr />
<p class="warning">
After completing the installation and the final tests please <b>remove</b> the whole
installer folder from the document root of the webserver or make sure that
-<tt>enable_installer</tt> option in config/main.inc.php is disabled.<br />
+<tt>enable_installer</tt> option in <tt>config.inc.php</tt> is disabled.<br />
<br />
These files may expose sensitive configuration data like server passwords and encryption keys
to the public. Make sure you cannot access this installer from your browser.
</p>
diff --git a/plugins/additional_message_headers/additional_message_headers.php b/plugins/additional_message_headers/additional_message_headers.php
index 80c58d58b..a43018176 100644
--- a/plugins/additional_message_headers/additional_message_headers.php
+++ b/plugins/additional_message_headers/additional_message_headers.php
@@ -1,43 +1,41 @@
<?php
/**
* Additional Message Headers
*
* Very simple plugin which will add additional headers
* to or remove them from outgoing messages.
*
- * Enable the plugin in config/main.inc.php and add your desired headers:
+ * Enable the plugin in config.inc.php and add your desired headers:
* $rcmail_config['additional_message_headers'] = array('User-Agent');
*
* @version @package_version@
* @author Ziba Scott
* @website http://roundcube.net
*/
class additional_message_headers extends rcube_plugin
{
public $task = 'mail';
function init()
{
$this->add_hook('message_outgoing_headers', array($this, 'message_headers'));
}
function message_headers($args)
{
- $this->load_config();
+ $this->load_config();
// additional email headers
$additional_headers = rcmail::get_instance()->config->get('additional_message_headers',array());
foreach($additional_headers as $header=>$value){
if (null === $value) {
unset($args['headers'][$header]);
} else {
$args['headers'][$header] = $value;
}
}
return $args;
}
}
-
-?>
diff --git a/plugins/debug_logger/debug_logger.php b/plugins/debug_logger/debug_logger.php
index 87a163785..deb6deb91 100644
--- a/plugins/debug_logger/debug_logger.php
+++ b/plugins/debug_logger/debug_logger.php
@@ -1,150 +1,150 @@
<?php
/**
* Debug Logger
*
* Enhanced logging for debugging purposes. It is not recommened
* to be enabled on production systems without testing because of
* the somewhat increased memory, cpu and disk i/o overhead.
*
* Debug Logger listens for existing console("message") calls and
* introduces start and end tags as well as free form tagging
* which can redirect messages to files. The resulting log files
* provide timing and tag quantity results.
*
- * Enable the plugin in config/main.inc.php and add your desired
+ * Enable the plugin in config.inc.php and add your desired
* log types and files.
*
* @version @package_version@
* @author Ziba Scott
* @website http://roundcube.net
*
* Example:
*
- * config/main.inc.php:
+ * config.inc.php:
*
* // $rcmail_config['debug_logger'][type of logging] = name of file in log_dir
* // The 'master' log includes timing information
* $rcmail_config['debug_logger']['master'] = 'master';
* // If you want sql messages to also go into a separate file
* $rcmail_config['debug_logger']['sql'] = 'sql';
*
* index.php (just after $RCMAIL->plugins->init()):
*
* console("my test","start");
* console("my message");
* console("my sql calls","start");
* console("cp -r * /dev/null","shell exec");
* console("select * from example","sql");
* console("select * from example","sql");
* console("select * from example","sql");
* console("end");
* console("end");
*
*
* logs/master (after reloading the main page):
*
* [17-Feb-2009 16:51:37 -0500] start: Task: mail.
* [17-Feb-2009 16:51:37 -0500] start: my test
* [17-Feb-2009 16:51:37 -0500] my message
* [17-Feb-2009 16:51:37 -0500] shell exec: cp -r * /dev/null
* [17-Feb-2009 16:51:37 -0500] start: my sql calls
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
* [17-Feb-2009 16:51:37 -0500] end: my sql calls - 0.0018 seconds shell exec: 1, sql: 3,
* [17-Feb-2009 16:51:37 -0500] end: my test - 0.0055 seconds shell exec: 1, sql: 3,
* [17-Feb-2009 16:51:38 -0500] end: Task: mail. - 0.8854 seconds shell exec: 1, sql: 3,
*
* logs/sql (after reloading the main page):
*
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
*/
class debug_logger extends rcube_plugin
{
function init()
{
require_once(dirname(__FILE__).'/runlog/runlog.php');
$this->runlog = new runlog();
if(!rcmail::get_instance()->config->get('log_dir')){
rcmail::get_instance()->config->set('log_dir',INSTALL_PATH.'logs');
}
$log_config = rcmail::get_instance()->config->get('debug_logger',array());
foreach($log_config as $type=>$file){
$this->runlog->set_file(rcmail::get_instance()->config->get('log_dir').'/'.$file, $type);
}
$start_string = "";
$action = rcmail::get_instance()->action;
$task = rcmail::get_instance()->task;
if($action){
$start_string .= "Action: ".$action.". ";
}
if($task){
$start_string .= "Task: ".$task.". ";
}
$this->runlog->start($start_string);
$this->add_hook('console', array($this, 'console'));
$this->add_hook('authenticate', array($this, 'authenticate'));
}
function authenticate($args){
$this->runlog->note('Authenticating '.$args['user'].'@'.$args['host']);
return $args;
}
function console($args){
$note = $args[0];
$type = $args[1];
if(!isset($args[1])){
// This could be extended to detect types based on the
// file which called console. For now only rcube_imap/rcube_storage is supported
$bt = debug_backtrace();
$file = $bt[3]['file'];
switch(basename($file)){
case 'rcube_imap.php':
$type = 'imap';
break;
case 'rcube_storage.php':
$type = 'storage';
break;
default:
$type = FALSE;
break;
}
}
switch($note){
case 'end':
$type = 'end';
break;
}
switch($type){
case 'start':
$this->runlog->start($note);
break;
case 'end':
$this->runlog->end();
break;
default:
$this->runlog->note($note, $type);
break;
}
return $args;
}
function __destruct()
{
if ($this->runlog)
$this->runlog->end();
}
}
diff --git a/plugins/password/README b/plugins/password/README
index 9286bee7b..af70156a6 100644
--- a/plugins/password/README
+++ b/plugins/password/README
@@ -1,311 +1,311 @@
-----------------------------------------------------------------------
Password Plugin for Roundcube
-----------------------------------------------------------------------
Plugin that adds a possibility to change user password using many
methods (drivers) via Settings/Password tab.
-----------------------------------------------------------------------
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/.
@version @package_version@
@author Aleksander Machniak <alec@alec.pl>
@author <see driver files for driver authors>
-----------------------------------------------------------------------
1. Configuration
2. Drivers
2.1. Database (sql)
2.2. Cyrus/SASL (sasl)
2.3. Poppassd/Courierpassd (poppassd)
2.4. LDAP (ldap)
2.5. DirectAdmin Control Panel (directadmin)
2.6. cPanel (cpanel)
2.7. XIMSS/Communigate (ximms)
2.8. Virtualmin (virtualmin)
2.9. hMailServer (hmail)
2.10. PAM (pam)
2.11. Chpasswd (chpasswd)
2.12. LDAP - no PEAR (ldap_simple)
2.13. XMail (xmail)
2.14. Pw (pw_usermod)
2.15. domainFACTORY (domainfactory)
2.16. DBMail (dbmail)
2.17. Expect (expect)
2.18. Samba (smb)
3. Driver API
1. Configuration
----------------
Copy config.inc.php.dist to config.inc.php and set the options as described
within the file.
2. Drivers
----------
Password plugin supports many password change mechanisms which are
handled by included drivers. Just pass driver name in 'password_driver' option.
2.1. Database (sql)
-------------------
You can specify which database to connect by 'password_db_dsn' option and
- what SQL query to execute by 'password_query'. See main.inc.php.dist file for
+ what SQL query to execute by 'password_query'. See config.inc.php.dist file for
more info.
Example implementations of an update_passwd function:
- This is for use with LMS (http://lms.org.pl) database and postgres:
CREATE OR REPLACE FUNCTION update_passwd(hash text, account text) RETURNS integer AS $$
DECLARE
res integer;
BEGIN
UPDATE passwd SET password = hash
WHERE login = split_part(account, '@', 1)
AND domainid = (SELECT id FROM domains WHERE name = split_part(account, '@', 2))
RETURNING id INTO res;
RETURN res;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
- This is for use with a SELECT update_passwd(%o,%c,%u) query
Updates the password only when the old password matches the MD5 password
in the database
CREATE FUNCTION update_password (oldpass text, cryptpass text, user text) RETURNS text
MODIFIES SQL DATA
BEGIN
DECLARE currentsalt varchar(20);
DECLARE error text;
SET error = 'incorrect current password';
SELECT substring_index(substr(user.password,4),_latin1'$',1) INTO currentsalt FROM users WHERE username=user;
SELECT '' INTO error FROM users WHERE username=user AND password=ENCRYPT(oldpass,currentsalt);
UPDATE users SET password=cryptpass WHERE username=user AND password=ENCRYPT(oldpass,currentsalt);
RETURN error;
END
Example SQL UPDATEs:
- Plain text passwords:
UPDATE users SET password=%p WHERE username=%u AND password=%o AND domain=%h LIMIT 1
- Crypt text passwords:
UPDATE users SET password=%c WHERE username=%u LIMIT 1
- Use a MYSQL crypt function (*nix only) with random 8 character salt
UPDATE users SET password=ENCRYPT(%p,concat(_utf8'$1$',right(md5(rand()),8),_utf8'$')) WHERE username=%u LIMIT 1
- MD5 stored passwords:
UPDATE users SET password=MD5(%p) WHERE username=%u AND password=MD5(%o) LIMIT 1
2.2. Cyrus/SASL (sasl)
----------------------
Cyrus SASL database authentication allows your Cyrus+Roundcube
installation to host mail users without requiring a Unix Shell account!
This driver only covers the "sasldb" case when using Cyrus SASL. Kerberos
and PAM authentication mechanisms will require other techniques to enable
user password manipulations.
Cyrus SASL includes a shell utility called "saslpasswd" for manipulating
user passwords in the "sasldb" database. This plugin attempts to use
this utility to perform password manipulations required by your webmail
users without any administrative interaction. Unfortunately, this
scheme requires that the "saslpasswd" utility be run as the "cyrus"
user - kind of a security problem since we have chosen to SUID a small
script which will allow this to happen.
This driver is based on the Squirrelmail Change SASL Password Plugin.
See http://www.squirrelmail.org/plugin_view.php?id=107 for details.
Installation:
Change into the helpers directory. Edit the chgsaslpasswd.c file as is
documented within it.
Compile the wrapper program:
gcc -o chgsaslpasswd chgsaslpasswd.c
Chown the compiled chgsaslpasswd binary to the cyrus user and group
that your browser runs as, then chmod them to 4550.
For example, if your cyrus user is 'cyrus' and the apache server group is
'nobody' (I've been told Redhat runs Apache as user 'apache'):
chown cyrus:nobody chgsaslpasswd
chmod 4550 chgsaslpasswd
Stephen Carr has suggested users should try to run the scripts on a test
account as the cyrus user eg;
su cyrus -c "./chgsaslpasswd -p test_account"
This will allow you to make sure that the script will work for your setup.
Should the script not work, make sure that:
1) the user the script runs as has access to the saslpasswd|saslpasswd2
file and proper permissions
2) make sure the user in the chgsaslpasswd.c file is set correctly.
This could save you some headaches if you are the paranoid type.
2.3. Poppassd/Courierpassd (poppassd)
-------------------------------------
You can specify which host to connect to via 'password_pop_host' and
what port via 'password_pop_port'. See config.inc.php.dist file for more info.
2.4. LDAP (ldap)
----------------
See config.inc.php.dist file. Requires PEAR::Net_LDAP2 package.
2.5. DirectAdmin Control Panel (directadmin)
--------------------------------------------
You can specify which host to connect to via 'password_directadmin_host' (don't
forget to use tcp:// or ssl://) and what port via 'password_direactadmin_port'.
The password enforcement with plenty customization can be done directly by
DirectAdmin, please see http://www.directadmin.com/features.php?id=910
See config.inc.php.dist file for more info.
2.6. cPanel (cpanel)
--------------------
Install cPanel XMLAPI Client Class into Roundcube program/lib directory
or any other place in PHP include path. You can get the class from
https://raw.github.com/CpanelInc/xmlapi-php/master/xmlapi.php
You can configure parameters for connection to cPanel's API interface.
See config.inc.php.dist file for more info.
2.7. XIMSS/Communigate (ximms)
------------------------------
You can specify which host and port to connect to via 'password_ximss_host'
and 'password_ximss_port'. See config.inc.php.dist file for more info.
2.8. Virtualmin (virtualmin)
----------------------------
As in sasl driver this one allows to change password using shell
utility called "virtualmin". See helpers/chgvirtualminpasswd.c for
installation instructions. See also config.inc.php.dist file.
2.9. hMailServer (hmail)
------------------------
Requires PHP COM (Windows only). For access to hMail server on remote host
you'll need to define 'hmailserver_remote_dcom' and 'hmailserver_server'.
See config.inc.php.dist file for more info.
2.10. PAM (pam)
---------------
This driver is for changing passwords of shell users authenticated with PAM.
Requires PECL's PAM exitension to be installed (http://pecl.php.net/package/PAM).
2.11. Chpasswd (chpasswd)
-------------------------
Driver that adds functionality to change the systems user password via
the 'chpasswd' command. See config.inc.php.dist file.
Attached wrapper script (helpers/chpass-wrapper.py) restricts password changes
to uids >= 1000 and can deny requests based on a blacklist.
2.12. LDAP - no PEAR (ldap_simple)
-----------------------------------
It's rewritten ldap driver that doesn't require the Net_LDAP2 PEAR extension.
It uses directly PHP's ldap module functions instead (as Roundcube does).
This driver is fully compatible with the ldap driver, but
does not require (or uses) the
$rcmail_config['password_ldap_force_replace'] variable.
Other advantages:
* Connects only once with the LDAP server when using the search user.
* Does not read the DN, but only replaces the password within (that is
why the 'force replace' is always used).
2.13. XMail (xmail)
-----------------------------------
Driver for XMail (www.xmailserver.org). See config.inc.php.dist file
for configuration description.
2.14. Pw (pw_usermod)
-----------------------------------
Driver to change the systems user password via the 'pw usermod' command.
See config.inc.php.dist file for configuration description.
2.15. domainFACTORY (domainfactory)
-----------------------------------
Driver for the hosting provider domainFACTORY (www.df.eu).
No configuration options.
2.16. DBMail (dbmail)
-----------------------------------
Driver that adds functionality to change the users DBMail password.
It only works with dbmail-users on the same host where Roundcube runs
and requires shell access and gcc in order to compile the binary
(see instructions in chgdbmailusers.c file).
See config.inc.php.dist file for configuration description.
Note: DBMail users can also use sql driver.
2.17. Expect (expect)
-----------------------------------
Driver to change user password via the 'expect' command.
See config.inc.php.dist file for configuration description.
2.18. Samba (smb)
-----------------------------------
Driver to change Samba user password via the 'smbpasswd' command.
See config.inc.php.dist file for configuration description.
3. Driver API
-------------
Driver file (<driver_name>.php) must define 'password_save' function with
two arguments. First - current password, second - new password. Function
should return PASSWORD_SUCCESS on success or any of PASSWORD_CONNECT_ERROR,
PASSWORD_CRYPT_ERROR, PASSWORD_ERROR when driver was unable to change password.
Extended result (as a hash-array with 'message' and 'code' items) can be returned
too. See existing drivers in drivers/ directory for examples.
diff --git a/plugins/show_additional_headers/show_additional_headers.php b/plugins/show_additional_headers/show_additional_headers.php
index dcc384be8..c2b0ca1d3 100644
--- a/plugins/show_additional_headers/show_additional_headers.php
+++ b/plugins/show_additional_headers/show_additional_headers.php
@@ -1,51 +1,51 @@
<?php
/**
* Show additional message headers
*
* Proof-of-concept plugin which will fetch additional headers
* and display them in the message view.
*
- * Enable the plugin in config/main.inc.php and add your desired headers:
+ * Enable the plugin in config.inc.php and add your desired headers:
* $rcmail_config['show_additional_headers'] = array('User-Agent');
*
* @version @package_version@
* @author Thomas Bruederli
* @license GNU GPLv3+
*/
class show_additional_headers extends rcube_plugin
{
public $task = 'mail';
function init()
{
$rcmail = rcmail::get_instance();
if ($rcmail->action == 'show' || $rcmail->action == 'preview') {
$this->add_hook('storage_init', array($this, 'storage_init'));
$this->add_hook('message_headers_output', array($this, 'message_headers'));
} else if ($rcmail->action == '') {
// with enabled_caching we're fetching additional headers before show/preview
$this->add_hook('storage_init', array($this, 'storage_init'));
}
}
function storage_init($p)
{
$rcmail = rcmail::get_instance();
if ($add_headers = (array)$rcmail->config->get('show_additional_headers', array()))
$p['fetch_headers'] = trim($p['fetch_headers'].' ' . strtoupper(join(' ', $add_headers)));
return $p;
}
function message_headers($p)
{
$rcmail = rcmail::get_instance();
foreach ((array)$rcmail->config->get('show_additional_headers', array()) as $header) {
if ($value = $p['headers']->get($header))
$p['output'][$header] = array('title' => $header, 'value' => $value);
}
return $p;
}
}
diff --git a/plugins/subscriptions_option/subscriptions_option.php b/plugins/subscriptions_option/subscriptions_option.php
index 49adc377b..284c048df 100644
--- a/plugins/subscriptions_option/subscriptions_option.php
+++ b/plugins/subscriptions_option/subscriptions_option.php
@@ -1,93 +1,93 @@
<?php
/**
* Subscription Options
*
* A plugin which can enable or disable the use of imap subscriptions.
* It includes a toggle on the settings page under "Server Settings".
* The preference can also be locked
*
- * Add it to the plugins list in config/main.inc.php to enable the user option
+ * Add it to the plugins list in config.inc.php to enable the user option
* The user option can be hidden and set globally by adding 'use_subscriptions'
* to the 'dont_override' configure line:
* $rcmail_config['dont_override'] = array('use_subscriptions');
* and then set the global preference
* $rcmail_config['use_subscriptions'] = true; // or false
*
* Roundcube caches folder lists. When a user changes this option or visits
* their folder list, this cache is refreshed. If the option is on the
* 'dont_override' list and the global option has changed, don't expect
* to see the change until the folder list cache is refreshed.
*
* @version @package_version@
* @author Ziba Scott
* @license GNU GPLv3+
*/
class subscriptions_option extends rcube_plugin
{
public $task = 'mail|settings';
function init()
{
$this->add_texts('localization/', false);
$dont_override = rcmail::get_instance()->config->get('dont_override', array());
if (!in_array('use_subscriptions', $dont_override)) {
$this->add_hook('preferences_list', array($this, 'settings_blocks'));
$this->add_hook('preferences_save', array($this, 'save_prefs'));
}
$this->add_hook('storage_folders', array($this, 'mailboxes_list'));
$this->add_hook('folders_list', array($this, 'folders_list'));
}
function settings_blocks($args)
{
if ($args['section'] == 'server') {
$use_subscriptions = rcmail::get_instance()->config->get('use_subscriptions');
$field_id = 'rcmfd_use_subscriptions';
$checkbox = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1));
$args['blocks']['main']['options']['use_subscriptions'] = array(
'title' => html::label($field_id, rcube::Q($this->gettext('useimapsubscriptions'))),
'content' => $checkbox->show($use_subscriptions?1:0),
);
}
return $args;
}
function save_prefs($args)
{
if ($args['section'] == 'server') {
$rcmail = rcmail::get_instance();
$use_subscriptions = $rcmail->config->get('use_subscriptions');
$args['prefs']['use_subscriptions'] = isset($_POST['_use_subscriptions']) ? true : false;
// if the use_subscriptions preference changes, flush the folder cache
if (($use_subscriptions && !isset($_POST['_use_subscriptions'])) ||
(!$use_subscriptions && isset($_POST['_use_subscriptions']))) {
$storage = $rcmail->get_storage();
$storage->clear_cache('mailboxes');
}
}
return $args;
}
function mailboxes_list($args)
{
$rcmail = rcmail::get_instance();
if (!$rcmail->config->get('use_subscriptions', true)) {
$args['folders'] = $rcmail->get_storage()->list_folders_direct();
}
return $args;
}
function folders_list($args)
{
$rcmail = rcmail::get_instance();
if (!$rcmail->config->get('use_subscriptions', true)) {
$args['table']->remove_column('subscribed');
}
return $args;
}
}
diff --git a/plugins/virtuser_file/virtuser_file.php b/plugins/virtuser_file/virtuser_file.php
index 974f33d3d..ed0eba189 100644
--- a/plugins/virtuser_file/virtuser_file.php
+++ b/plugins/virtuser_file/virtuser_file.php
@@ -1,105 +1,105 @@
<?php
/**
* File based User-to-Email and Email-to-User lookup
*
- * Add it to the plugins list in config/main.inc.php and set
+ * Add it to the plugins list in config.inc.php and set
* path to a virtuser table file to resolve user names and e-mail
* addresses
* $rcmail_config['virtuser_file'] = '';
*
* @version @package_version@
* @license GNU GPLv3+
* @author Aleksander Machniak
*/
class virtuser_file extends rcube_plugin
{
private $file;
private $app;
function init()
{
$this->app = rcmail::get_instance();
$this->file = $this->app->config->get('virtuser_file');
if ($this->file) {
$this->add_hook('user2email', array($this, 'user2email'));
$this->add_hook('email2user', array($this, 'email2user'));
}
}
/**
* User > Email
*/
function user2email($p)
{
$r = $this->findinvirtual('/\s' . preg_quote($p['user'], '/') . '\s*$/');
$result = array();
for ($i=0; $i<count($r); $i++) {
$arr = preg_split('/\s+/', $r[$i]);
if (count($arr) > 0 && strpos($arr[0], '@')) {
$result[] = rcube_utils::idn_to_ascii(trim(str_replace('\\@', '@', $arr[0])));
if ($p['first']) {
$p['email'] = $result[0];
break;
}
}
}
$p['email'] = empty($result) ? NULL : $result;
return $p;
}
/**
* Email > User
*/
function email2user($p)
{
$r = $this->findinvirtual('/^' . preg_quote($p['email'], '/') . '\s/');
for ($i=0; $i<count($r); $i++) {
$arr = preg_split('/\s+/', trim($r[$i]));
if (count($arr) > 0) {
$p['user'] = trim($arr[count($arr)-1]);
break;
}
}
return $p;
}
/**
* Find matches of the given pattern in virtuser file
*
* @param string Regular expression to search for
* @return array Matching entries
*/
private function findinvirtual($pattern)
{
$result = array();
$virtual = null;
if ($this->file)
$virtual = file($this->file);
if (empty($virtual))
return $result;
// check each line for matches
foreach ($virtual as $line) {
$line = trim($line);
if (empty($line) || $line[0]=='#')
continue;
if (preg_match($pattern, $line))
$result[] = $line;
}
return $result;
}
}
diff --git a/plugins/virtuser_query/virtuser_query.php b/plugins/virtuser_query/virtuser_query.php
index db3c5197b..04dcaf131 100644
--- a/plugins/virtuser_query/virtuser_query.php
+++ b/plugins/virtuser_query/virtuser_query.php
@@ -1,146 +1,146 @@
<?php
/**
* DB based User-to-Email and Email-to-User lookup
*
- * Add it to the plugins list in config/main.inc.php and set
+ * Add it to the plugins list in config.inc.php and set
* SQL queries to resolve usernames, e-mail addresses and hostnames from the database
* %u will be replaced with the current username for login.
* %m will be replaced with the current e-mail address for login.
*
* Queries should select the user's e-mail address, username or the imap hostname as first column
* The email query could optionally select identity data columns in specified order:
* name, organization, reply-to, bcc, signature, html_signature
*
* $rcmail_config['virtuser_query'] = array('email' => '', 'user' => '', 'host' => '');
*
* The email query can return more than one record to create more identities.
* This requires identities_level option to be set to value less than 2.
*
* By default Roundcube database is used. To use different database (or host)
* you can specify DSN string in $rcmail_config['virtuser_query_dsn'] option.
*
* @version @package_version@
* @author Aleksander Machniak <alec@alec.pl>
* @author Steffen Vogel
* @license GNU GPLv3+
*/
class virtuser_query extends rcube_plugin
{
private $config;
private $app;
private $db;
function init()
{
$this->app = rcmail::get_instance();
$this->config = $this->app->config->get('virtuser_query');
if (!empty($this->config)) {
if (is_string($this->config)) {
$this->config = array('email' => $this->config);
}
if ($this->config['email']) {
$this->add_hook('user2email', array($this, 'user2email'));
}
if ($this->config['user']) {
$this->add_hook('email2user', array($this, 'email2user'));
}
if ($this->config['host']) {
$this->add_hook('authenticate', array($this, 'user2host'));
}
}
}
/**
* User > Email
*/
function user2email($p)
{
$dbh = $this->get_dbh();
$sql_result = $dbh->query(preg_replace('/%u/', $dbh->escape($p['user']), $this->config['email']));
while ($sql_arr = $dbh->fetch_array($sql_result)) {
if (strpos($sql_arr[0], '@')) {
if ($p['extended'] && count($sql_arr) > 1) {
$result[] = array(
'email' => rcube_utils::idn_to_ascii($sql_arr[0]),
'name' => $sql_arr[1],
'organization' => $sql_arr[2],
'reply-to' => rcube_utils::idn_to_ascii($sql_arr[3]),
'bcc' => rcube_utils::idn_to_ascii($sql_arr[4]),
'signature' => $sql_arr[5],
'html_signature' => (int)$sql_arr[6],
);
}
else {
$result[] = $sql_arr[0];
}
if ($p['first']) {
break;
}
}
}
$p['email'] = $result;
return $p;
}
/**
* EMail > User
*/
function email2user($p)
{
$dbh = $this->get_dbh();
$sql_result = $dbh->query(preg_replace('/%m/', $dbh->escape($p['email']), $this->config['user']));
if ($sql_arr = $dbh->fetch_array($sql_result)) {
$p['user'] = $sql_arr[0];
}
return $p;
}
/**
* User > Host
*/
function user2host($p)
{
$dbh = $this->get_dbh();
$sql_result = $dbh->query(preg_replace('/%u/', $dbh->escape($p['user']), $this->config['host']));
if ($sql_arr = $dbh->fetch_array($sql_result)) {
$p['host'] = $sql_arr[0];
}
return $p;
}
/**
* Initialize database handler
*/
function get_dbh()
{
if (!$this->db) {
if ($dsn = $this->app->config->get('virtuser_query_dsn')) {
// connect to the virtuser database
$this->db = rcube_db::factory($dsn);
$this->db->set_debug((bool)$this->app->config->get('sql_debug'));
$this->db->db_connect('r'); // connect in read mode
}
else {
$this->db = $this->app->get_dbh();
}
}
return $this->db;
}
}
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 18055f77d..90bb85348 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -1,454 +1,468 @@
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2008-2012, 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: |
| Class to read configuration settings |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
/**
* Configuration class for Roundcube
*
* @package Framework
* @subpackage Core
*/
class rcube_config
{
const DEFAULT_SKIN = 'larry';
private $prop = array();
private $errors = array();
private $userprefs = array();
/**
* Renamed options
*
* @var array
*/
private $legacy_props = array(
// new name => old name
'default_folders' => 'default_imap_folders',
'mail_pagesize' => 'pagesize',
'addressbook_pagesize' => 'pagesize',
'reply_mode' => 'top_posting',
'refresh_interval' => 'keep_alive',
'min_refresh_interval' => 'min_keep_alive',
'messages_cache_ttl' => 'message_cache_lifetime',
'redundant_attachments_cache_ttl' => 'redundant_attachments_memcache_ttl',
);
/**
* Object constructor
*/
public function __construct()
{
$this->load();
// Defaults, that we do not require you to configure,
// but contain information that is used in various
// locations in the code:
$this->set('contactlist_fields', array('name', 'firstname', 'surname', 'email'));
}
/**
* Load config from local config file
*
* @todo Remove global $CONFIG
*/
private function load()
{
- // load main config file
- if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php'))
- $this->errors[] = 'main.inc.php was not found.';
+ // Load default settings
+ if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'defaults.inc.php')) {
+ $this->errors[] = 'defaults.inc.php was not found.';
+ }
- // load database config
- if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php'))
- $this->errors[] = 'db.inc.php was not found.';
+ // load main config file
+ if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'config.inc.php')) {
+ // Old configuration files
+ if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php') ||
+ !$this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php')) {
+ $this->errors[] = 'config.inc.php was not found.';
+ }
+ else if (rand(1,100) == 10) { // log warning on every 100th request (average)
+ trigger_error("config.inc.php was not found. Please migrate your config by running bin/update.sh", E_USER_WARNING);
+ }
+ }
// load host-specific configuration
$this->load_host_config();
// set skin (with fallback to old 'skin_path' property)
if (empty($this->prop['skin'])) {
if (!empty($this->prop['skin_path'])) {
$this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
}
else {
$this->prop['skin'] = self::DEFAULT_SKIN;
}
}
// larry is the new default skin :-)
if ($this->prop['skin'] == 'default')
$this->prop['skin'] = self::DEFAULT_SKIN;
// fix paths
$this->prop['log_dir'] = $this->prop['log_dir'] ? realpath(unslashify($this->prop['log_dir'])) : RCUBE_INSTALL_PATH . 'logs';
$this->prop['temp_dir'] = $this->prop['temp_dir'] ? realpath(unslashify($this->prop['temp_dir'])) : RCUBE_INSTALL_PATH . 'temp';
// fix default imap folders encoding
foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder)
$this->prop[$folder] = rcube_charset::convert($this->prop[$folder], RCUBE_CHARSET, 'UTF7-IMAP');
if (!empty($this->prop['default_folders']))
foreach ($this->prop['default_folders'] as $n => $folder)
$this->prop['default_folders'][$n] = rcube_charset::convert($folder, RCUBE_CHARSET, 'UTF7-IMAP');
// set PHP error logging according to config
if ($this->prop['debug_level'] & 1) {
ini_set('log_errors', 1);
if ($this->prop['log_driver'] == 'syslog') {
ini_set('error_log', 'syslog');
}
else {
ini_set('error_log', $this->prop['log_dir'].'/errors');
}
}
// enable display_errors in 'show' level, but not for ajax requests
ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4)));
// set timezone auto settings values
if ($this->prop['timezone'] == 'auto') {
$this->prop['_timezone_value'] = $this->client_timezone();
}
else if (is_numeric($this->prop['timezone']) && ($tz = timezone_name_from_abbr("", $this->prop['timezone'] * 3600, 0))) {
$this->prop['timezone'] = $tz;
}
else if (empty($this->prop['timezone'])) {
$this->prop['timezone'] = 'UTC';
}
// remove deprecated properties
unset($this->prop['dst_active']);
// export config data
$GLOBALS['CONFIG'] = &$this->prop;
}
/**
* Load a host-specific config file if configured
* This will merge the host specific configuration with the given one
*/
private function load_host_config()
{
$fname = null;
if (is_array($this->prop['include_host_config'])) {
$fname = $this->prop['include_host_config'][$_SERVER['HTTP_HOST']];
}
else if (!empty($this->prop['include_host_config'])) {
$fname = preg_replace('/[^a-z0-9\.\-_]/i', '', $_SERVER['HTTP_HOST']) . '.inc.php';
}
if ($fname) {
$this->load_from_file(RCUBE_CONFIG_DIR . $fname);
}
}
/**
* Read configuration from a file
* and merge with the already stored config values
*
* @param string $fpath Full path to the config file to be loaded
* @return booelan True on success, false on failure
*/
public function load_from_file($fpath)
{
if (is_file($fpath) && is_readable($fpath)) {
// use output buffering, we don't need any output here
ob_start();
include($fpath);
ob_end_clean();
- if (is_array($rcmail_config)) {
+ if (is_array($config)) {
+ $this->merge($config);
+ return true;
+ }
+ // deprecated name of config variable
+ else if (is_array($rcmail_config)) {
$this->merge($rcmail_config);
return true;
}
}
return false;
}
/**
* Getter for a specific config parameter
*
* @param string $name Parameter name
* @param mixed $def Default value if not set
* @return mixed The requested config value
*/
public function get($name, $def = null)
{
if (isset($this->prop[$name])) {
$result = $this->prop[$name];
}
else {
$result = $def;
}
$rcube = rcube::get_instance();
if ($name == 'timezone' && isset($this->prop['_timezone_value'])) {
$result = $this->prop['_timezone_value'];
}
else if ($name == 'client_mimetypes') {
if ($result == null && $def == null)
$result = 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,image/bmp,image/tiff,application/x-javascript,application/pdf,application/x-shockwave-flash';
if ($result && is_string($result))
$result = explode(',', $result);
}
$plugin = $rcube->plugins->exec_hook('config_get', array(
'name' => $name, 'default' => $def, 'result' => $result));
return $plugin['result'];
}
/**
* Setter for a config parameter
*
* @param string $name Parameter name
* @param mixed $value Parameter value
*/
public function set($name, $value)
{
$this->prop[$name] = $value;
}
/**
* Override config options with the given values (eg. user prefs)
*
* @param array $prefs Hash array with config props to merge over
*/
public function merge($prefs)
{
$this->prop = array_merge($this->prop, $prefs, $this->userprefs);
$this->fix_legacy_props();
}
/**
* Merge the given prefs over the current config
* and make sure that they survive further merging.
*
* @param array $prefs Hash array with user prefs
*/
public function set_user_prefs($prefs)
{
// Honor the dont_override setting for any existing user preferences
$dont_override = $this->get('dont_override');
if (is_array($dont_override) && !empty($dont_override)) {
foreach ($dont_override as $key) {
unset($prefs[$key]);
}
}
// convert user's timezone into the new format
if (is_numeric($prefs['timezone']) && ($tz = timezone_name_from_abbr('', $prefs['timezone'] * 3600, 0))) {
$prefs['timezone'] = $tz;
}
// larry is the new default skin :-)
if ($prefs['skin'] == 'default') {
$prefs['skin'] = self::DEFAULT_SKIN;
}
$this->userprefs = $prefs;
$this->prop = array_merge($this->prop, $prefs);
$this->fix_legacy_props();
// override timezone settings with client values
if ($this->prop['timezone'] == 'auto') {
$this->prop['_timezone_value'] = isset($_SESSION['timezone']) ? $this->client_timezone() : $this->prop['_timezone_value'];
}
else if (isset($this->prop['_timezone_value']))
unset($this->prop['_timezone_value']);
}
/**
* Getter for all config options
*
* @return array Hash array containg all config properties
*/
public function all()
{
return $this->prop;
}
/**
* Special getter for user's timezone offset including DST
*
* @return float Timezone offset (in hours)
* @deprecated
*/
public function get_timezone()
{
if ($tz = $this->get('timezone')) {
try {
$tz = new DateTimeZone($tz);
return $tz->getOffset(new DateTime('now')) / 3600;
}
catch (Exception $e) {
}
}
return 0;
}
/**
* Return requested DES crypto key.
*
* @param string $key Crypto key name
* @return string Crypto key
*/
public function get_crypto_key($key)
{
// Bomb out if the requested key does not exist
if (!array_key_exists($key, $this->prop)) {
rcube::raise_error(array(
'code' => 500, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Request for unconfigured crypto key \"$key\""
), true, true);
}
$key = $this->prop[$key];
// Bomb out if the configured key is not exactly 24 bytes long
if (strlen($key) != 24) {
rcube::raise_error(array(
'code' => 500, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Configured crypto key '$key' is not exactly 24 bytes long"
), true, true);
}
return $key;
}
/**
* Try to autodetect operating system and find the correct line endings
*
* @return string The appropriate mail header delimiter
*/
public function header_delimiter()
{
// use the configured delimiter for headers
if (!empty($this->prop['mail_header_delimiter'])) {
$delim = $this->prop['mail_header_delimiter'];
if ($delim == "\n" || $delim == "\r\n")
return $delim;
else
rcube::raise_error(array(
'code' => 500, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Invalid mail_header_delimiter setting"
), true, false);
}
$php_os = strtolower(substr(PHP_OS, 0, 3));
if ($php_os == 'win')
return "\r\n";
if ($php_os == 'mac')
return "\r\n";
return "\n";
}
/**
* Return the mail domain configured for the given host
*
* @param string $host IMAP host
* @param boolean $encode If true, domain name will be converted to IDN ASCII
* @return string Resolved SMTP host
*/
public function mail_domain($host, $encode=true)
{
$domain = $host;
if (is_array($this->prop['mail_domain'])) {
if (isset($this->prop['mail_domain'][$host]))
$domain = $this->prop['mail_domain'][$host];
}
else if (!empty($this->prop['mail_domain'])) {
$domain = rcube_utils::parse_host($this->prop['mail_domain']);
}
if ($encode) {
$domain = rcube_utils::idn_to_ascii($domain);
}
return $domain;
}
/**
* Getter for error state
*
* @return mixed Error message on error, False if no errors
*/
public function get_error()
{
return empty($this->errors) ? false : join("\n", $this->errors);
}
/**
* Internal getter for client's (browser) timezone identifier
*/
private function client_timezone()
{
if (isset($_SESSION['timezone']) && is_numeric($_SESSION['timezone'])
&& ($ctz = timezone_name_from_abbr("", $_SESSION['timezone'] * 3600, 0))) {
return $ctz;
}
else if (!empty($_SESSION['timezone'])) {
try {
$tz = timezone_open($_SESSION['timezone']);
return $tz->getName();
}
catch (Exception $e) { /* gracefully ignore */ }
}
// fallback to server's timezone
return date_default_timezone_get();
}
/**
* Convert legacy options into new ones
*/
private function fix_legacy_props()
{
foreach ($this->legacy_props as $new => $old) {
if (isset($this->prop[$old])) {
if (!isset($this->prop[$new])) {
$this->prop[$new] = $this->prop[$old];
}
unset($this->prop[$old]);
}
}
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Mar 1, 4:47 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
165857
Default Alt Text
(200 KB)

Event Timeline