[Svn] r6073 - in trunk/roundcubemail: . bin installer plugins program/include program/steps/addressbook program/steps/mail program/steps/utils

trac at roundcube.net trac at roundcube.net
Fri Apr 13 10:52:03 CEST 2012


Author: alec
Date: 2012-04-13 03:52:02 -0500 (Fri, 13 Apr 2012)
New Revision: 6073

Added:
   trunk/roundcubemail/program/include/rcube.php
   trunk/roundcubemail/program/include/rcube_base_replacer.php
   trunk/roundcubemail/program/include/rcube_message_header.php
   trunk/roundcubemail/program/include/rcube_message_part.php
   trunk/roundcubemail/program/include/rcube_output.php
   trunk/roundcubemail/program/include/rcube_output_html.php
   trunk/roundcubemail/program/include/rcube_output_json.php
   trunk/roundcubemail/program/include/rcube_ui.php
Removed:
   trunk/roundcubemail/program/include/rcube_html_page.php
   trunk/roundcubemail/program/include/rcube_json_output.php
   trunk/roundcubemail/program/include/rcube_sqlite.inc
   trunk/roundcubemail/program/include/rcube_template.php
Modified:
   trunk/roundcubemail/
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/bin/msgexport.sh
   trunk/roundcubemail/index.php
   trunk/roundcubemail/installer/index.php
   trunk/roundcubemail/installer/utils.php
   trunk/roundcubemail/plugins/
   trunk/roundcubemail/program/include/clisetup.php
   trunk/roundcubemail/program/include/html.php
   trunk/roundcubemail/program/include/iniset.php
   trunk/roundcubemail/program/include/main.inc
   trunk/roundcubemail/program/include/rcmail.php
   trunk/roundcubemail/program/include/rcube_addressbook.php
   trunk/roundcubemail/program/include/rcube_cache.php
   trunk/roundcubemail/program/include/rcube_config.php
   trunk/roundcubemail/program/include/rcube_contacts.php
   trunk/roundcubemail/program/include/rcube_imap.php
   trunk/roundcubemail/program/include/rcube_imap_cache.php
   trunk/roundcubemail/program/include/rcube_imap_generic.php
   trunk/roundcubemail/program/include/rcube_ldap.php
   trunk/roundcubemail/program/include/rcube_mdb2.php
   trunk/roundcubemail/program/include/rcube_message.php
   trunk/roundcubemail/program/include/rcube_plugin.php
   trunk/roundcubemail/program/include/rcube_plugin_api.php
   trunk/roundcubemail/program/include/rcube_session.php
   trunk/roundcubemail/program/include/rcube_shared.inc
   trunk/roundcubemail/program/include/rcube_smtp.php
   trunk/roundcubemail/program/include/rcube_spellchecker.php
   trunk/roundcubemail/program/include/rcube_storage.php
   trunk/roundcubemail/program/include/rcube_string_replacer.php
   trunk/roundcubemail/program/include/rcube_user.php
   trunk/roundcubemail/program/include/rcube_vcard.php
   trunk/roundcubemail/program/steps/addressbook/func.inc
   trunk/roundcubemail/program/steps/mail/compose.inc
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/get.inc
   trunk/roundcubemail/program/steps/mail/show.inc
   trunk/roundcubemail/program/steps/utils/error.inc
Log:
- Merge devel-framework branch, resolved conflicts



Property changes on: trunk/roundcubemail
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/devel-addressbook:4193-4422
/branches/devel-framework/roundcubemail:5747-5779
/branches/devel-mcache/roundcubemail:5017-5232
/branches/devel-saved-search/roundcubemail:5070-5181
/branches/devel-spellcheck/roundcubemail:5133-5180
/branches/devel-threads:3067-3364
   + /branches/devel-addressbook:4193-4422
/branches/devel-framework/roundcubemail:5747-5994
/branches/devel-mcache/roundcubemail:5017-5232
/branches/devel-saved-search/roundcubemail:5070-5181
/branches/devel-spellcheck/roundcubemail:5133-5180
/branches/devel-threads:3067-3364

Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/CHANGELOG	2012-04-13 08:52:02 UTC (rev 6073)
@@ -1,6 +1,17 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Roundcube Framework:
+    Add possibility to replace IMAP driver with custom class
+    Add IMAP auto-connection feature, improving performance with caching enabled
+    Replace imap_init hook with storage_init (with additional 'driver' argument)
+    Improved performance by caching IMAP server's capabilities in session
+    Unified global functions naming (rcube_ prefix)
+    Move global functions from main.inc and rcube_shared.inc into classes
+    Better classes separation
+
+RELEASE 0.8-rc
+----------------
 - Set flexible width to login form fields (#1488418)
 - Fix re-draw bug on list columns change in IE8 (#1487822)
 - Allow mass-removal of addresses from a group (#1487748)

Modified: trunk/roundcubemail/bin/msgexport.sh
===================================================================
--- trunk/roundcubemail/bin/msgexport.sh	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/bin/msgexport.sh	2012-04-13 08:52:02 UTC (rev 6073)
@@ -34,7 +34,7 @@
 	$IMAP->set_folder($mbox);
 
     $index = $IMAP->index($mbox, null, 'ASC');
-    $count = $index->countMessages();
+    $count = $index->count();
     $index = $index->get();
 
 	vputs("Getting message list of {$mbox}...");

Modified: trunk/roundcubemail/index.php
===================================================================
--- trunk/roundcubemail/index.php	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/index.php	2012-04-13 08:52:02 UTC (rev 6073)
@@ -2,7 +2,7 @@
 /*
  +-------------------------------------------------------------------------+
  | Roundcube Webmail IMAP Client                                           |
- | Version 0.8-svn                                                         |
+ | Version 0.9-svn                                                         |
  |                                                                         |
  | Copyright (C) 2005-2012, The Roundcube Dev Team                         |
  |                                                                         |
@@ -45,7 +45,7 @@
 $RCMAIL = rcmail::get_instance();
 
 // Make the whole PHP output non-cacheable (#1487797)
-send_nocacheing_headers();
+$RCMAIL->output->nocacheing_headers();
 
 // turn on output buffering
 ob_start();
@@ -67,14 +67,14 @@
 }
 
 // error steps
-if ($RCMAIL->action=='error' && !empty($_GET['_code'])) {
+if ($RCMAIL->action == 'error' && !empty($_GET['_code'])) {
   raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE);
 }
 
 // check if https is required (for login) and redirect if necessary
 if (empty($_SESSION['user_id']) && ($force_https = $RCMAIL->config->get('force_https', false))) {
   $https_port = is_bool($force_https) ? 443 : $force_https;
-  if (!rcube_https_check($https_port)) {
+  if (!rcube_ui::https_check($https_port)) {
     $host  = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
     $host .= ($https_port != 443 ? ':' . $https_port : '');
     header('Location: https://' . $host . $_SERVER['REQUEST_URI']);
@@ -89,15 +89,15 @@
 
 // try to log in
 if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') {
-  $request_valid = $_SESSION['temp'] && $RCMAIL->check_request(RCUBE_INPUT_POST, 'login');
+  $request_valid = $_SESSION['temp'] && $RCMAIL->check_request(rcube_ui::INPUT_POST, 'login');
 
   // purge the session in case of new login when a session already exists 
   $RCMAIL->kill_session();
 
   $auth = $RCMAIL->plugins->exec_hook('authenticate', array(
     'host' => $RCMAIL->autoselect_host(),
-    'user' => trim(get_input_value('_user', RCUBE_INPUT_POST)),
-    'pass' => get_input_value('_pass', RCUBE_INPUT_POST, true,
+    'user' => trim(rcube_ui::get_input_value('_user', rcube_ui::INPUT_POST)),
+    'pass' => rcube_ui::get_input_value('_pass', rcube_ui::INPUT_POST, true,
        $RCMAIL->config->get('password_charset', 'ISO-8859-1')),
     'cookiecheck' => true,
     'valid' => $request_valid,
@@ -119,11 +119,11 @@
     $RCMAIL->session->set_auth_cookie();
 
     // log successful login
-    rcmail_log_login();
+    $RCMAIL->log_login();
 
     // restore original request parameters
     $query = array();
-    if ($url = get_input_value('_url', RCUBE_INPUT_POST)) {
+    if ($url = rcube_ui::get_input_value('_url', rcube_ui::INPUT_POST)) {
       parse_str($url, $query);
 
       // prevent endless looping on login page
@@ -149,7 +149,7 @@
 }
 
 // end session (after optional referer check)
-else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL->config->get('referer_check') || rcube_check_referer())) {
+else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL->config->get('referer_check') || rcmail::check_referer())) {
   $userdata = array(
     'user' => $_SESSION['username'],
     'host' => $_SESSION['storage_host'],
@@ -172,7 +172,8 @@
 // not logged in -> show login page
 if (empty($RCMAIL->user->ID)) {
   // log session failures
-  if (($task = get_input_value('_task', RCUBE_INPUT_GPC)) && !in_array($task, array('login','logout')) && !$session_error && ($sess_id = $_COOKIE[ini_get('session.name')])) {
+  $task = rcube_ui::get_input_value('_task', rcube_ui::INPUT_GPC);
+  if ($task && !in_array($task, array('login','logout')) && !$session_error && ($sess_id = $_COOKIE[ini_get('session.name')])) {
     $RCMAIL->session->log("Aborted session " . $sess_id . "; no valid session data found");
     $session_error = true;
   }
@@ -208,7 +209,7 @@
 
   // check client X-header to verify request origin
   if ($OUTPUT->ajax_call) {
-    if (rc_request_header('X-Roundcube-Request') != $RCMAIL->get_request_token() && !$RCMAIL->config->get('devel_mode')) {
+    if (rcube_request_header('X-Roundcube-Request') != $RCMAIL->get_request_token() && !$RCMAIL->config->get('devel_mode')) {
       header('HTTP/1.1 403 Forbidden');
       die("Invalid Request");
     }
@@ -220,7 +221,7 @@
   }
 
   // check referer if configured
-  if (!$request_check_whitelist[$RCMAIL->action] && $RCMAIL->config->get('referer_check') && !rcube_check_referer()) {
+  if (!$request_check_whitelist[$RCMAIL->action] && $RCMAIL->config->get('referer_check') && !rcmail::check_referer()) {
     raise_error(array(
       'code' => 403,
       'type' => 'php',

Modified: trunk/roundcubemail/installer/index.php
===================================================================
--- trunk/roundcubemail/installer/index.php	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/installer/index.php	2012-04-13 08:52:02 UTC (rev 6073)
@@ -53,6 +53,8 @@
 set_include_path($include_path);
 
 require_once 'utils.php';
+require_once 'rcube_shared.inc';
+// deprecated aliases (to be removed)
 require_once 'main.inc';
 
 session_start();

Modified: trunk/roundcubemail/installer/utils.php
===================================================================
--- trunk/roundcubemail/installer/utils.php	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/installer/utils.php	2012-04-13 08:52:02 UTC (rev 6073)
@@ -45,26 +45,16 @@
     include_once $filename. '.php';
 }
 
-
 /**
- * Fake internal error handler to catch errors
- */
-function raise_error($p)
-{
-    $rci = rcube_install::get_instance();
-    $rci->raise_error($p);
-}
-
-/**
  * Local callback function for PEAR errors
  */
-function rcube_pear_error($err)
+function __pear_error($err)
 {
-    raise_error(array(
+    rcmail::raise_error(array(
         'code' => $err->getCode(),
         'message' => $err->getMessage(),
     ));
 }
 
 // set PEAR error handling (will also load the PEAR main class)
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
+PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, '__pear_error');


Property changes on: trunk/roundcubemail/plugins
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/devel-mcache/plugins:5017-5232
/branches/devel-saved-search/plugins:5070-5181
/branches/devel-threads/plugins:3067-3364
   + /branches/devel-framework/roundcubemail/plugins:5780-5994
/branches/devel-mcache/plugins:5017-5232
/branches/devel-saved-search/plugins:5070-5181
/branches/devel-threads/plugins:3067-3364

Modified: trunk/roundcubemail/program/include/clisetup.php
===================================================================
--- trunk/roundcubemail/program/include/clisetup.php	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/program/include/clisetup.php	2012-04-13 08:52:02 UTC (rev 6073)
@@ -55,7 +55,7 @@
 			continue;
 
 		$args[$key] = preg_replace(array('/^["\']/', '/["\']$/'), '', $value);
-		
+
 		if ($alias = $aliases[$key])
 			$args[$alias] = $args[$key];
 	}

Modified: trunk/roundcubemail/program/include/html.php
===================================================================
--- trunk/roundcubemail/program/include/html.php	2012-04-12 16:38:15 UTC (rev 6072)
+++ trunk/roundcubemail/program/include/html.php	2012-04-13 08:52:02 UTC (rev 6073)
@@ -277,7 +277,7 @@
         $attrib_arr = array();
         foreach ($attrib as $key => $value) {
             // skip size if not numeric
-            if (($key=='size' && !is_numeric($value))) {
+            if ($key == 'size' && !is_numeric($value)) {
                 continue;
             }
 
@@ -297,17 +297,57 @@
                     $attrib_arr[] = $key . '="' . $key . '"';
                 }
             }
-            else if ($key=='value') {
-                $attrib_arr[] = $key . '="' . Q($value, 'strict', false) . '"';
-            }
             else {
-                $attrib_arr[] = $key . '="' . Q($value) . '"';
+                $attrib_arr[] = $key . '="' . self::quote($value) . '"';
             }
         }
+
         return count($attrib_arr) ? ' '.implode(' ', $attrib_arr) : '';
     }
+
+    /**
+     * Convert a HTML attribute string attributes to an associative array (name => value)
+     *
+     * @param string Input string
+     * @return array Key-value pairs of parsed attributes
+     */
+    public static function parse_attrib_string($str)
+    {
+        $attrib = array();
+        $regexp = '/\s*([-_a-z]+)=(["\'])??(?(2)([^\2]*)\2|(\S+?))/Ui';
+
+        preg_match_all($regexp, stripslashes($str), $regs, PREG_SET_ORDER);
+
+        // convert attributes to an associative array (name => value)
+        if ($regs) {
+            foreach ($regs as $attr) {
+                $attrib[strtolower($attr[1])] = html_entity_decode($attr[3] . $attr[4]);
+            }
+