From 42b11351497ce67e96a0465c76694632cdfb3ecb Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 07 Oct 2005 10:17:08 -0400
Subject: [PATCH] Several bugfixes and feature improvements

---
 CHANGELOG                            |    8 
 INSTALL                              |   18 +
 program/js/common.js                 |    9 
 config/db.inc.php.dist               |    5 
 program/include/main.inc             |   60 +++++-
 program/localization/nl/labels.inc   |  173 +++++++++++++++++++++
 program/lib/imap.inc                 |    2 
 UPGRADING                            |   11 +
 config/main.inc.php.dist             |    6 
 index.php                            |   17 +
 program/include/rcube_db.inc         |   50 +++--
 program/include/session.inc          |    9 
 program/localization/nl/messages.inc |   56 +++++++
 program/steps/settings/func.inc      |   13 
 SQL/postgres.initial.sql             |    1 
 SQL/mysql.initial.sql                |    4 
 program/js/app.js                    |    3 
 program/include/rcube_imap.inc       |   23 ++
 18 files changed, 397 insertions(+), 71 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 07b2069..0509973 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -26,14 +26,18 @@
 - Make list of special mailboxes configurable
 
 
-2005/10/04
+2005/10/09
 ----------
-- Added French, Italian, Spanish, Danish translation
+- Added French, Italian, Spanish, Danish, Dutch translation
+- Clearified license (Bug #1305966)
 - Fixed PHP warnings (Bug #1299403)
 - Fixed english translation bug #1295406
 - Fixed bug #1290833: Last character of email not seen
+- Fixed bug #1292199 when creating new user
+- Allow more borwsers (Bug #1285101)
 - Added setting for showing pretty dates
 - Added support for SQLite database
 - Make use of message caching configurable
 - Also add attachments when forwarding a message
 - Show nested mailboxes hieracically
+- Enable IMAPS by host
diff --git a/INSTALL b/INSTALL
index 8c94157..0729bac 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,11 +6,17 @@
 2. Make shure that the following directories are writable by the webserver
    - /temp
    - /logs
-3. Rename the files config/*.inc.php.dist to config/*.inc.php
-4. Modify the files in config/* to suit your local environment
-5. Create database tables using the queries in file 'SQL/*.initial.sql'
-   Rename tables if you like, but make shure the names are also changed in config/db.inc.php
-6. Done!
+3. Create a new database and a database user for RoundCube
+4. Create database tables using the queries in file 'SQL/*.initial.sql'
+5. Rename the files config/*.inc.php.dist to config/*.inc.php
+6. Modify the files in config/* to suit your local environment
+7. Done!
+
+
+UPGRADING
+=========
+If you already have a previous version of RoundCube installed,
+please refer to the instructions in UPGRADING guide.
 
 
 REQUIREMENTS
@@ -22,7 +28,7 @@
 * php.ini options:
    - error_reporting E_ALL & ~E_NOTICE (or lower)
    - file_uploads on (for attachment upload features)
-* A MySQL or Postgres database engine
+* A MySQL or PostgreSQL database engine or the SQLite extension for PHP
 * A database with permission to create tables
 
 
diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql
index 64d6508..7746f12 100644
--- a/SQL/mysql.initial.sql
+++ b/SQL/mysql.initial.sql
@@ -71,6 +71,7 @@
   `sess_id` varchar(32) NOT NULL default '',
   `created` datetime NOT NULL default '0000-00-00 00:00:00',
   `changed` datetime NOT NULL default '0000-00-00 00:00:00',
+  `ip` VARCHAR(15) NOT NULL default '',
   `vars` text NOT NULL,
   PRIMARY KEY  (`sess_id`)
 ) TYPE=MyISAM;
@@ -84,7 +85,8 @@
 CREATE TABLE `users` (
   `user_id` int(10) unsigned NOT NULL auto_increment,
   `username` varchar(128) NOT NULL default '',
-  `mail_host` varchar(255) NOT NULL default '',
+  `mail_host` varchar(128) NOT NULL default '',
+  `alias` varchar(128) NOT NULL default '',
   `created` datetime NOT NULL default '0000-00-00 00:00:00',
   `last_login` datetime NOT NULL default '0000-00-00 00:00:00',
   `language` varchar(5) NOT NULL default 'en',
diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql
index 0449932..1259573 100755
--- a/SQL/postgres.initial.sql
+++ b/SQL/postgres.initial.sql
@@ -147,6 +147,7 @@
     user_id integer DEFAULT nextval('user_ids'::text) NOT NULL,
     username character varying(128) DEFAULT ''::character varying NOT NULL,
     mail_host character varying(128) DEFAULT ''::character varying NOT NULL,
+    alias character varying(128) DEFAULT ''::character varying NOT NULL,
     created timestamp with time zone DEFAULT now() NOT NULL,
     last_login timestamp with time zone DEFAULT now() NOT NULL,
     "language" character varying(5) DEFAULT 'en'::character varying NOT NULL,
diff --git a/UPGRADING b/UPGRADING
index 6560a71..cbbcdcd 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -9,17 +9,28 @@
 from versions 0.1-alpha and 0.1-20050811
 ----------------------------------------
 - replace all files in folder /program/
+- rund SQL queries in order to update the database
 - add these line to /config/main.inc.php
   $rcmail_config['trash_mbox'] = 'Trash';
   $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
   $rcmail_config['prefer_html'] = TRUE;
   $rcmail_config['prettydate'] = TRUE;
   $rcmail_config['smtp_port'] = 25;
+  $rcmail_config['default_port'] = 143;
+- replace database properties (db_type, db_host, db_user, db_pass, $d_name)
+  in /config/db.inc.php with the following line:
+  $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
 
 
 from version 0.1-20050820
 ----------------------------------------
 - replace all files in folder /program/
+- rund SQL queries in order to update the database
 - add these line to /config/main.inc.php
   $rcmail_config['prettydate'] = TRUE;
   $rcmail_config['smtp_port'] = 25;
+  $rcmail_config['default_port'] = 143;
+- replace database properties (db_type, db_host, db_user, db_pass, $d_name)
+  in /config/db.inc.php with the following line:
+  $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
+  
\ No newline at end of file
diff --git a/config/db.inc.php.dist b/config/db.inc.php.dist
index 2d8888b..e1e95d1 100644
--- a/config/db.inc.php.dist
+++ b/config/db.inc.php.dist
@@ -15,13 +15,14 @@
 $rcmail_config = array();
 
 // PEAR database DSN for read/write operations
-//format is db_provider://user:password@host/databse
+// format is db_provider://user:password@host/databse
+// currentyl suported db_providers: mysql, sqlite, pgsql
 
 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
+// sqlite example: 'sqlite://./sqlite.db?mode=0646';
 
 // PEAR database DSN for read only operations (if empty write database will be used)
 // userful for database replication
-
 $rcmail_config['db_dsnr'] = '';
 
 // you can define specific table names used to store webmail data
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 86f0778..e34e2f3 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -28,9 +28,13 @@
 
 // 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 display a pulldown menu or set one host as string.
+// To use SSL connection, enter ssl://hostname:993
 $rcmail_config['default_host'] = '';
 
+// TCP port used for IMAP connections
+$rcmail_config['default_port'] = 143;
+
 // use this host for sending mails.
 // if left blank, the PHP mail() function is used
 $rcmail_config['smtp_server'] = '';
diff --git a/index.php b/index.php
index 31c39ea..6422a2e 100644
--- a/index.php
+++ b/index.php
@@ -48,9 +48,10 @@
 
 
 // set environment first
-ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'program'.PATH_SEPARATOR.'program/lib');
+ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.$INSTALL_PATH.PATH_SEPARATOR.'program'.PATH_SEPARATOR.'program/lib');
 ini_set('session.name', 'sessid');
 ini_set('session.use_cookies', 1);
+ini_set('error_reporting', E_ALL&~E_NOTICE);
 //ini_set('session.save_path', $INSTALL_PATH.'session');
 
 
@@ -72,6 +73,10 @@
 $_task = !empty($_POST['_task']) ? $_POST['_task'] : (!empty($_GET['_task']) ? $_GET['_task'] : 'mail');
 $_action = !empty($_POST['_action']) ? $_POST['_action'] : (!empty($_GET['_action']) ? $_GET['_action'] : '');
 $_framed = (!empty($_GET['_framed']) || !empty($_POST['_framed']));
+
+if (!empty($_GET['_remote']))
+  $REMOTE_REQUEST = TRUE;
+
 
 // start session with requested task
 rcmail_startup($_task);
@@ -136,7 +141,7 @@
   {
   if ($_auth !== $sess_auth || $_auth != rcmail_auth_hash($_SESSION['client_id'], $_SESSION['auth_time']))
     {
-    show_message('sessionerror', 'error');
+    $message = show_message('sessionerror', 'error');
     rcmail_kill_session();
     }
   }
@@ -156,7 +161,15 @@
 
 // not logged in -> set task to 'login
 if (empty($_SESSION['user_id']))
+  {
+  if ($REMOTE_REQUEST)
+    {
+    $message .= "setTimeout(\"location.href='\"+this.env.comm_path+\"'\", 2000);";
+    rcube_remote_response($message);
+    }
+  
   $_task = 'login';
+  }
 
 
 
diff --git a/program/include/main.inc b/program/include/main.inc
index 0a63b68..e2e7a00 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -55,9 +55,10 @@
 
   // prepare DB connection
   $DB = new rcube_db($CONFIG['db_dsnw'], $CONFIG['db_dsnr']);
+  $DB->sqlite_initials = $INSTALL_PATH.'SQL/sqlite.initial.sql';
 
   // we can use the database for storing session data
-  if (is_object($DB))
+  if (is_object($DB) && $DB->db_provider!='sqlite')
     include_once('include/session.inc');
 
 
@@ -232,26 +233,43 @@
 function rcmail_login($user, $pass, $host=NULL)
   {
   global $CONFIG, $IMAP, $DB, $sess_user_lang;
+  $user_id = NULL;
   
   if (!$host)
     $host = $CONFIG['default_host'];
 
-  // exit if IMAP login failed
-  if (!($imap_login  = $IMAP->connect($host, $user, $pass)))
-    return FALSE;
-
   // query if user already registered
-  $sql_result = $DB->query(sprintf("SELECT user_id, language, preferences
-                                    FROM %s
-                                    WHERE  username='%s' AND mail_host='%s'",
+  $sql_result = $DB->query(sprintf("SELECT user_id, username, language, preferences
+                                    FROM   %s
+                                    WHERE  mail_host='%s' AND (username='%s' OR alias='%s')",
                                    get_table_name('users'),
-                                   $user, $host));
+                                   addslashes($host),
+                                   addslashes($user),
+                                   addslashes($user)));
 
-  // user already registered
+  // user already registered -> overwrite username
   if ($sql_arr = $DB->fetch_assoc($sql_result))
     {
     $user_id = $sql_arr['user_id'];
-    
+    $user = $sql_arr['username'];
+    }
+
+  // parse $host URL
+  $a_host = parse_url($host);
+  if ($a_host['host'])
+    {
+    $host = $a_host['host'];
+    $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
+    $imap_port = isset($a_host['post']) ? $a_host['post'] : ($imap_ssl ? 993 : $CONFIG['default_port']);
+    }
+
+  // exit if IMAP login failed
+  if (!($imap_login  = $IMAP->connect($host, $user, $pass, $imap_port, $imap_ssl)))
+    return FALSE;
+
+  // user already registered
+  if ($user_id && !empty($sql_arr))
+    {
     // get user prefs
     if (strlen($sql_arr['preferences']))
       {
@@ -303,7 +321,8 @@
                       (created, last_login, username, mail_host)
                       VALUES (NOW(), NOW(), '%s', '%s')",
                      get_table_name('users'),
-                     $user, $host));
+                     addslashes($user),
+                     addslashes($host)));
 
   if ($user_id = $DB->insert_id())
     {
@@ -316,8 +335,8 @@
                         VALUES (%d, '1', '%s', '%s')",
                        get_table_name('identities'),
                        $user_id,
-                       $user_name,
-                       $user_email));
+                       addslashes($user_name),
+                       addslashes($user_email)));
                        
     // get existing mailboxes
     $a_mailboxes = $IMAP->list_mailboxes();
@@ -329,6 +348,14 @@
     // check if the configured mailbox for sent messages exists
     if ($CONFIG['trash_mbox'] && !in_array_nocase($CONFIG['trash_mbox'], $a_mailboxes))
       $IMAP->create_mailbox($CONFIG['trash_mbox'], TRUE);
+    }
+  else
+    {
+    raise_error(array('code' => 500,
+                      'type' => 'php',
+                      'line' => __LINE__,
+                      'file' => __FILE__,
+                      'message' => "Failed to create new user"), TRUE, FALSE);
     }
     
   return $user_id;
@@ -963,7 +990,10 @@
   if (is_array($CONFIG['default_host']))
     {
     $select_host = new select(array('name' => '_host'));
-    $select_host->add($CONFIG['default_host']);
+    
+    foreach ($CONFIG['default_host'] as $key => $value)
+      $select_host->add($value, (is_numeric($key) ? $value : $key));
+      
     $fields['host'] = $select_host->show($_POST['_host']);
     }
   else if (!strlen($CONFIG['default_host']))
diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc
index 9c76cb3..7d9d1bb 100755
--- a/program/include/rcube_db.inc
+++ b/program/include/rcube_db.inc
@@ -40,6 +40,9 @@
         
         $this->db_dsnw = $db_dsnw;
         $this->db_dsnr = $db_dsnr;
+        
+        $dsn_array = DB::parseDSN($db_dsnw);
+        $this->db_provider = $dsn_array['phptype'];        
     }
 
     // PHP 4 compatibility
@@ -51,22 +54,21 @@
     // Connect to specific database 
     function dsn_connect($dsn)
     {
-        $dsn_array = DB::parseDSN($dsn);
-        $this->db_provider = $dsn_array['phptype'];
-        
         // Use persistent connections if available
         $dbh = DB::connect($dsn, array('persistent' => $true));
-
+        
         if (DB::isError($dbh))
             raise_error(array('code' => 500,
                         'type' => 'db',
                         'line' => __LINE__,
                         'file' => __FILE__,
                         'message' => $dbh->getMessage()), TRUE, FALSE);
+
         else if ($this->db_provider=='sqlite')
         {
-            if (!is_file($dsn_array['database']) || !filesize($dsn_array['database']))
-                $this->_sqlite_create_database($dbh, 'SQL/sqlite.initial.sql');
+            $dsn_array = DB::parseDSN($dsn);
+            if (!filesize($dsn_array['database']) && !empty($this->sqlite_initials))
+                $this->_sqlite_create_database($dbh, $this->sqlite_initials);
         }
         
         return $dbh;
@@ -75,8 +77,9 @@
     // Connect to appropiate databse    
     function db_connect ($mode)
     {
+        $this->db_mode = $mode;
+
         // Already connected
-        
         if ($this->db_connected)
             {
             // no replication, current connection is ok
@@ -96,7 +99,6 @@
 
         $this->db_handle = $this->dsn_connect($dsn);
         $this->db_connected = true;
-        $this->db_mode = $mode;
     }
 
     // Query database (read operations)
@@ -117,7 +119,8 @@
         $result = $this->db_handle->query($query);
         
         if (DB::isError($result))
-            raise_error(array('code' => 500, 'type' => 'db',
+            raise_error(array('code' => 500,
+                              'type' => 'db',
                               'line' => __LINE__, 
                               'file' => __FILE__, 
                               'message' => $result->getMessage()), TRUE, FALSE);
@@ -127,7 +130,7 @@
 
     function db_execute ($query)
     {
-        db_connect('w');
+        $this->db_connect('w');
 
         if ($this->db_provider == 'sqlite')
             $query = $this->_sqlite_prepare_query($query);
@@ -159,7 +162,7 @@
 
     function insert_id($sequence = '')
     {
-        if (!$this->db_link || $this->db_mode=='r')
+        if (!$this->db_handle || $this->db_mode=='r')
             return FALSE;
 
         switch($this->db_provider)
@@ -167,13 +170,14 @@
             case 'pgsql':
                 // PostgreSQL uses sequences
                 $result =& $this->db_handle->getOne("SELECT CURRVAL('$sequence')");    
-                if (DB::isError($result))
+                if (DB::isError($result)) {
                     raise_error( array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 
                     'message' => $result->getMessage()), TRUE, TRUE);
+                }
                 return $result;
                 
             case 'mysql': // This is unfortuneate
-                return mysql_insert_id($this->db_handle);
+                return mysql_insert_id();
 
             case 'sqlite':
                 return sqlite_last_insert_rowid($this->db_handle->connection);
@@ -189,8 +193,11 @@
         $result = $this->_get_result($res_id);
 
         if (DB::isError($result))
+        {
             raise_error( array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
-                         'message' => $this->db_link->getMessage()), TRUE, TRUE);
+                         'message' => $this->db_link->getMessage()), TRUE, FALSE);
+            return FALSE;
+        }
                          
         return $result->fetchRow(DB_FETCHMODE_ASSOC);
     }
@@ -231,16 +238,15 @@
         if (empty($fileName) || !is_string($fileName))
             return ;
 
-        $fd = fopen($fileName, 'r');
-        if (!$fd)
-            return ;
-
         $data = '';
-        while ($line = fgets($fd, 4096))
-            $data .= $line;
+        if ($fd = fopen($fileName, 'r'))
+          {
+          $data = fread($fd, filesize($fileName));
+          fclose($fd);
+          }
 
-        fclose($fd);
-        sqlite_exec($dbh->connection, $data);
+        if (strlen($data))
+          sqlite_exec($dbh->connection, $data);
     }
 
     // transform a query so that it is sqlite2 compliant
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 127409d..2143416 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -24,9 +24,6 @@
 require_once('lib/imap.inc');
 require_once('lib/mime.inc');
 
-// check for Open-SSL support in PHP build
-//$ICL_SSL = TRUE;
-//$ICL_PORT = 993;
 
 class rcube_imap
   {
@@ -75,15 +72,29 @@
     }
 
 
-  function connect($host, $user, $pass, $port=143)
+  function connect($host, $user, $pass, $port=143, $use_ssl=FALSE)
     {
-    global $ICL_PORT;
+    global $ICL_PORT, $CONFIG;
+    
+    // check for Open-SSL support in PHP build
+    if ($use_ssl && in_array('openssl', get_loaded_extensions()))
+      $ICL_SSL = TRUE;
 
     $ICL_PORT = $port;
-    $this->conn = iil_Connect($host, $user, $pass);
+    $this->conn = iil_Connect($host, $user, $pass, array('imap' => 'check'));
     $this->host = $host;
     $this->user = $user;
     $this->pass = $pass;
+    
+    if ($this->conn && ($CONFIG['debug_level'] & 8))
+      print $this->conn->message;
+      
+    else if (!$this->conn && $GLOBALS['iil_error'])
+      {
+      raise_error(array('code' => 403,
+                       'type' => 'imap',
+                       'message' => $GLOBALS['iil_error']), TRUE, FALSE);
+      }
 
     return $this->conn ? TRUE : FALSE;
     }
diff --git a/program/include/session.inc b/program/include/session.inc
index 35970c8..ca2b0b4 100644
--- a/program/include/session.inc
+++ b/program/include/session.inc
@@ -38,7 +38,7 @@
   {
   global $DB, $SESS_CHANGED;
   
-  $sql_result = $DB->query(sprintf("SELECT vars, UNIX_TIMESTAMP(changed) AS changed
+  $sql_result = $DB->query(sprintf("SELECT vars, ip, UNIX_TIMESTAMP(changed) AS changed
                                     FROM   %s
                                     WHERE  sess_id='%s'",
                                    get_table_name('session'),
@@ -81,11 +81,12 @@
   else
     {
     $DB->query(sprintf("INSERT INTO %s
-                        (sess_id, vars, created, changed)
-                        VALUES ('%s', '%s', NOW(), NOW())",
+                        (sess_id, vars, ip, created, changed)
+                        VALUES ('%s', '%s', '%s', NOW(), NOW())",
                        get_table_name('session'),
                        $key,
-                       $vars));
+                       $vars,
+                       $_SERVER['REMOTE_ADDR']));
     }
 
   return TRUE;
diff --git a/program/js/app.js b/program/js/app.js
index 30d8704..3182ce3 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -76,7 +76,8 @@
     this.task = this.env.task;
     
     // check browser
-    if (!(bw.dom && ((bw.ie && bw.vendver>=5.5 && !bw.opera) || (bw.mz && bw.vendver>=1) || (bw.safari && bw.vendver>=125) || (bw.opera && bw.vendver>=8))))
+    if (!(bw.dom && ((bw.ie && bw.vendver>=5.5 && !bw.opera) || (bw.mz && bw.vendver>=1) || (bw.safari && bw.vendver>=125) ||
+                     (bw.opera && bw.vendver>=8) || (bw.konq && bw.vendver>=3.4))))
       {
       location.href = this.env.comm_path+'&_action=error&_code=0x199';
       return;
diff --git a/program/js/common.js b/program/js/common.js
index 5263a87..2d2c2e9 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -47,8 +47,8 @@
   this.ns4 = (this.ns && parseInt(this.ver)==4);
   this.ns6 = (this.ns && parseInt(this.vendver)==6);  // (this.mz && this.ns) ? true : false;
   this.ns7 = (this.ns && parseInt(this.vendver)==7);  // this.agent.indexOf('Netscape/7')>0);
-  this.safari = this.agent.toLowerCase().indexOf('safari')>0;
-  this.konq   = (this.agent.toLowerCase().indexOf('konqueror')>0); 
+  this.safari = (this.agent.toLowerCase().indexOf('safari')>0 || this.agent.toLowerCase().indexOf('applewebkit')>0);
+  this.konq   = (this.agent.toLowerCase().indexOf('konqueror')>0);
 
   this.opera = (window.opera) ? true : false;
   this.opera5 = (this.opera5 && this.agent.indexOf('Opera 5')>0) ? true : false;
@@ -58,11 +58,14 @@
   if(this.opera && window.RegExp)
     this.vendver = (/opera(\s|\/)([0-9\.]+)/i.test(navigator.userAgent)) ? parseFloat(RegExp.$2) : -1;
   else if(!this.vendver && this.safari)
-    this.vendver = (/safari\/([0-9]+)/i.test(this.agent)) ? parseInt(RegExp.$1) : 0;
+    this.vendver = (/(safari|applewebkit)\/([0-9]+)/i.test(this.agent)) ? parseInt(RegExp.$2) : 0;
   else if((!this.vendver && this.mz) || this.agent.indexOf('Camino')>0)
     this.vendver = (/rv:([0-9\.]+)/.test(this.agent)) ? parseFloat(RegExp.$1) : 0;
   else if(this.ie && window.RegExp)
     this.vendver = (/msie\s+([0-9\.]+)/i.test(this.agent)) ? parseFloat(RegExp.$1) : 0;
+  else if(this.konq && window.RegExp)
+    this.vendver = (/khtml\/([0-9\.]+)/i.test(this.agent)) ? parseFloat(RegExp.$1) : 0;
+
 
   // get real language out of safari's user agent
   if(this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/i.test(this.agent)))
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 9ee476e..75b0abb 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -345,6 +345,7 @@
 		fputs($conn->fp, "cp01 CAPABILITY\r\n");
 		do{
 		$line = trim(chop(iil_ReadLine($conn->fp, 100)));
+		$conn->message.="$line\n";
 			$a = explode(" ", $line);
 			if ($line[0]=="*"){
 				while ( list($k, $w) = each($a) ){
@@ -362,6 +363,7 @@
 		//do CRAM-MD5 authentication
 		fputs($conn->fp, "a000 AUTHENTICATE CRAM-MD5\r\n");
 		$line = trim(chop(iil_ReadLine($conn->fp, 1024)));
+		$conn->message.="$line\n";
 		if ($line[0]=="+"){
 			$conn->message.='Got challenge: '.htmlspecialchars($line)."\n";
 			//got a challenge string, try CRAM-5
diff --git a/program/localization/nl/labels.inc b/program/localization/nl/labels.inc
new file mode 100644
index 0000000..c200100
--- /dev/null
+++ b/program/localization/nl/labels.inc
@@ -0,0 +1,173 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | language/nl/labels.inc                                                |
+ |                                                                       |
+ | Language file of the RoundCube Webmail client                         |
+ | Copyright (C) 2005, RoundQube Dev. - Switzerland                      |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Jasper Slits <jaspersl@xs4all.nl>                             |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+$labels = array();
+
+// login page
+$labels['username']  = 'Gebruikersnaam';
+$labels['password']  = 'Wachtwoord';
+$labels['server']    = 'Server';
+$labels['login']     = 'Log in';
+
+// taskbar
+$labels['logout']   = 'Log uit';
+$labels['mail']     = 'E-Mail';
+$labels['settings'] = 'Persoonlijke Instellingen';
+$labels['addressbook'] = 'Adres boek';
+
+// mailbox names
+$labels['inbox']  = 'Inbox';
+$labels['sent']   = 'Sent';
+$labels['trash']  = 'Trash';
+$labels['drafts'] = 'Drafts';
+$labels['junk']   = 'Junk';
+
+// message listing
+$labels['subject'] = 'Onderwerp';
+$labels['from']    = 'Afzender';
+$labels['to']      = 'Ontvangen';
+$labels['cc']      = 'Copy';
+$labels['bcc']     = 'Bcc';
+$labels['replyto'] = 'Reply-To';
+$labels['date']    = 'Datum';
+$labels['size']    = 'Grootte';
+$labels['priority'] = 'Prioriiteit';
+$labels['organization'] = 'Organisatie';
+
+// aliases
+$labels['reply-to'] = $labels['replyto'];
+
+$labels['mailboxlist'] = 'Mappen';
+$labels['messagesfromto'] = 'Berichten $from tot $to van $count';
+$labels['messagenrof'] = 'Bericht $nr van $count';
+
+$labels['moveto']   = 'verplaats naar...';
+$labels['download'] = 'download';
+
+$labels['filename'] = 'Bestandsnaam';
+$labels['filesize'] = 'Bestandsgrootte';
+
+$labels['preferhtml'] = 'HTML voorkeur';
+$labels['htmlmessage'] = 'HTML Bericht';
+$labels['prettydate'] = 'Uitgebreide datum';
+
+$labels['addtoaddressbook'] = 'Toevoegen aan adresboek';
+
+// weekdays short
+$labels['sun'] = 'Zo';
+$labels['mon'] = 'Ma';
+$labels['tue'] = 'Di';
+$labels['wed'] = 'Wo';
+$labels['thu'] = 'Do';
+$labels['fri'] = 'Vr';
+$labels['sat'] = 'Za';
+
+// weekdays long
+$labels['sunday']    = 'Zondag';
+$labels['monday']    = 'Maandag';
+$labels['tuesday']   = 'Dinsdag';
+$labels['wednesday'] = 'Woensdag';
+$labels['thursday']  = 'Donderdag';
+$labels['friday']    = 'Vrijdag';
+$labels['saturday']  = 'Zaterdag';
+
+$labels['today'] = 'Vandaag';
+
+// toolbar buttons
+$labels['writenewmessage']  = 'Schrijf een nieuw bericht';
+$labels['replytomessage']   = 'Beantwoord het bericht';
+$labels['forwardmessage']   = 'Doorsturen van bericht';
+$labels['deletemessage']    = 'Verplaats bericht naar prullenbak';
+$labels['printmessage']     = 'Print dit bericht';
+$labels['previousmessages'] = 'Toon vorige lijst met berichten';
+$labels['nextmessages']     = 'Toon volgende lijst met berichten';
+$labels['backtolist']       = 'Terug naar berichtoverzicht';
+
+$labels['select'] = 'Selecteer';
+$labels['all'] = 'Alle';
+$labels['none'] = 'Geen';
+$labels['unread'] = 'Ongelezen';
+
+// message compose
+$labels['compose']  = 'Creeer een nieuw message';
+$labels['sendmessage']  = 'Verstuur het bericht nu';
+$labels['addattachment']  = 'Voeg een bijlage toe';
+
+$labels['attachments'] = 'Bijlage';
+$labels['upload'] = 'Toevoegen';
+$labels['close']  = 'Sluit';
+
+$labels['low']     = 'Laag';
+$labels['lowest']  = 'Laagste';
+$labels['normal']  = 'Normaal';
+$labels['high']    = 'Hoog';
+$labels['highest'] = 'Hoogste';
+
+$labels['showimages'] = 'Afbeeldingen weergeven';
+
+
+// address boook
+$labels['name']      = 'Weergave naam';
+$labels['firstname'] = 'Voornaam';
+$labels['surname']   = 'Achternaam';
+$labels['email']     = 'E-Mail';
+
+$labels['addcontact'] = 'Nieuw contactpersoon toevoegen';
+$labels['editcontact'] = 'Wijzig contactpersoon';
+
+$labels['edit']   = 'Wijzig';
+$labels['cancel'] = 'Annuleren';
+$labels['save']   = 'Opslaan';
+$labels['delete'] = 'Verwijder';
+
+$labels['newcontact']     = 'Creeer nieuwe contactpersoon';
+$labels['deletecontact']  = 'Verwijder geselecteerde contactpersonen';
+$labels['composeto']      = 'Verstuur bericht aan';
+$labels['contactsfromto'] = 'Contactpersonen $from tot $to van $count';
+
+
+// settings
+$labels['settingsfor']  = 'Instellingen voor';
+
+$labels['preferences']  = 'Voorkeuren';
+$labels['userpreferences']  = 'Gebruikersvoorkeuren';
+$labels['editpreferences']  = 'Wijzig gebruikersvoorkeur';
+
+$labels['identities']  = 'Identiteit';
+$labels['manageidentities']  = 'Beheer identiteiten voor dit account';
+$labels['newidentity']  = 'Nieuwe identiteit';
+
+$labels['newitem']  = 'Nieuw item';
+$labels['edititem']  = 'Wijzig item';
+
+$labels['setdefault']  = 'Standaard instelling';
+$labels['language']  = 'Taal';
+$labels['timezone']  = 'Tijd zone';
+$labels['pagesize']  = 'Berichten per pagina';
+
+
+$labels['folders']  = 'Mappen';
+$labels['foldername']  = 'Map naam';
+$labels['subscribed']  = 'Subscribed';
+$labels['create']  = 'Creeren';
+$labels['createfolder']  = 'Maak nieuwe map';
+$labels['deletefolder']  = 'Verwijder map';
+$labels['managefolders']  = 'Beheer mappen';
+
+
+?>
\ No newline at end of file
diff --git a/program/localization/nl/messages.inc b/program/localization/nl/messages.inc
new file mode 100644
index 0000000..cc5ad47
--- /dev/null
+++ b/program/localization/nl/messages.inc
@@ -0,0 +1,56 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | language/nl/messages.inc                                              |
+ |                                                                       |
+ | Language file of the RoundCube Webmail client                         |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Jasper Slits <jaspersl@xs4all.nl>                             |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+$messages = array();
+
+$messages['loginfailed']  = 'Login mislukt';
+
+$messages['cookiesdisabled'] = 'Je browser accepteert geen cookies';
+
+$messages['sessionerror'] = 'Je sessie is ongeldig of verlopen';
+
+$messages['imaperror'] = 'Verbinding met IMAP-server mislukt';
+
+$messages['nomessagesfound'] = 'Geen berichten gevonden in Postvak IN';
+
+$messages['loggedout'] = 'Je bent succesvol uitgelegd. Tot ziens!';
+
+$messages['mailboxempty'] = 'Postbak is leeg';
+
+$messages['loadingdata'] = 'Ophalen gegevens...';
+
+$messages['messagesent'] = 'Bericht succesvol verzonden';
+
+$messages['successfullysaved'] = 'Succesvol opgeslagen';
+
+$messages['addedsuccessfully'] = 'Contactpersoon succesvol toegevoegd aan het adresboek';
+
+$messages['contactexists'] = 'Een contactpersoon met dit e-mail adres bestaat al';
+
+$messages['blockedimages'] = 'Om je privacy te beschermen zijn externe afbeeldingen zijn geblokkeerd in dit bericht.';
+
+$messages['encryptedmessage'] = 'Dit is een versleuteld bericht en kan niet worden weergegeven. Sorry!';
+
+$messages['nocontactsfound'] = 'Geen contactpersonen gevonden';
+
+$messages['sendingfailed'] = 'Versturen van het bericht is mislukt';
+
+$messages['errorsaving'] = 'Er is een fout opgetreden bij het opslaan';
+
+
+?>
\ No newline at end of file
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 60b1056..4e1e345 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -57,12 +57,13 @@
   $select_lang->add('Deutsch', 'de');
   $select_lang->add('English', 'en');
   $select_lang->add('Espanol', 'es');
-  $select_lang->add('Fran�ais', 'fr');
+  $select_lang->add('Fran&ccedil;ais', 'fr');
   $select_lang->add('Italiano', 'it');
+  $select_lang->add('Nederlands', 'nl');
 
   $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
                   $field_id,
-                  rcube_label('language'),
+                  rep_specialchars_output(rcube_label('language')),
                   $select_lang->show($sess_user_lang));
 
 
@@ -99,7 +100,7 @@
   
   $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
                   $field_id,
-                  rcube_label('timezone'),
+                  rep_specialchars_output(rcube_label('timezone')),
                   $select_timezone->show($CONFIG['timezone']));
 
 
@@ -109,7 +110,7 @@
 
   $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
                   $field_id,
-                  rcube_label('pagesize'),
+                  rep_specialchars_output(rcube_label('pagesize')),
                   $input_pagesize->show($CONFIG['pagesize']));
 
   // show checkbox for HTML/plaintext messages
@@ -118,7 +119,7 @@
 
   $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
                   $field_id,
-                  rcube_label('preferhtml'),
+                  rep_specialchars_output(rcube_label('preferhtml')),
                   $input_pagesize->show($CONFIG['prefer_html']?1:0));
 
   // MM: Show checkbox for toggling 'pretty dates' 
@@ -127,7 +128,7 @@
 
   $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
                   $field_id,
-                  rcube_label('prettydate'),
+                  rep_specialchars_output(rcube_label('prettydate')),
                   $input_prettydate->show($CONFIG['prettydate']?1:0));
 
 

--
Gitblit v1.9.1