alecpl
2012-04-23 a57f9e2c64a8495ccb89a8b79eba6052483a0ede
- Applied fixes from trunk up to r6118


8 files modified
154 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
plugins/password/drivers/directadmin.php 26 ●●●● patch | view | raw | blame | history
plugins/show_additional_headers/package.xml 6 ●●●● patch | view | raw | blame | history
plugins/show_additional_headers/show_additional_headers.php 5 ●●●●● patch | view | raw | blame | history
program/include/rcube_imap.php 2 ●●●●● patch | view | raw | blame | history
program/include/rcube_imap_generic.php 2 ●●● patch | view | raw | blame | history
program/include/rcube_result_index.php 8 ●●●●● patch | view | raw | blame | history
program/js/app.js 104 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -12,6 +12,7 @@
- Fix invisible cursor when replying to a html message (#1487073)
- Reset IP stored in session when destroying session data (#1488056)
- Fix bug where memory_limit = -1 wasn't handled properly
- Support mutliple name/email pairs for Bcc and Reply-To identity settings (#1488445)
- Support LDAP RFC2256's country object class read/write (#1488123)
- Upgraded to jQuery 1.7.2
- Image resize with GD extension (#1488383)
plugins/password/drivers/directadmin.php
@@ -5,7 +5,7 @@
 *
 * Driver to change passwords via DirectAdmin Control Panel
 *
 * @version 2.0
 * @version 2.1
 * @author Victor Benincasa <vbenincasa@gmail.com>
 *
 */
@@ -62,16 +62,17 @@
 *
 * Very, very basic usage:
 *   $Socket = new HTTPSocket;
 *   echo $Socket->get('http://user:pass@somesite.com/somedir/some.file?query=string&this=that');
 *   echo $Socket->get('http://user:pass@somehost.com:2222/CMD_API_SOMEAPI?query=string&this=that');
 *
 * @author Phi1 'l0rdphi1' Stier <l0rdphi1@liquenox.net>
 * @updates 2.7 and 2.8 by Victor Benincasa <vbenincasa @ gmail.com>
 * @package HTTPSocket
 * @version 2.7 (Updated by Victor Benincasa <vbenincasa@gmail.com>)
 * @version 2.8
 */
class HTTPSocket {
    var $version = '2.7';
    var $version = '2.8';
    /* all vars are private except $error, $query_cache, and $doFollowLocationHeader */
    var $method = 'GET';
@@ -107,7 +108,7 @@
    {
        if (!is_numeric($port))
        {
            $port = 80;
            $port = 2222;
        }
        $this->remote_host = $host;
@@ -166,13 +167,13 @@
        $this->error = $this->warn = array();
        $this->result_status_code = NULL;
        // is our request a http:// ... ?
        if (preg_match('!^http://!i',$request))
        // is our request a http(s):// ... ?
        if (preg_match('/^(http|https):\/\//i',$request))
        {
            $location = parse_url($request);
            $this->connect($location['host'],$location['port']);
            $this->set_login($location['user'],$location['pass']);
            $request = $location['path'];
            $content = $location['query'];
@@ -185,7 +186,7 @@
        $array_headers = array(
            'User-Agent' => "HTTPSocket/$this->version",
            'Host' => ( $this->remote_port == 80 ? $this->remote_host : "$this->remote_host:$this->remote_port" ),
            'Host' => ( $this->remote_port == 80 ? parse_url($this->remote_host,PHP_URL_HOST) : parse_url($this->remote_host,PHP_URL_HOST).":".$this->remote_port ),
            'Accept' => '*/*',
            'Connection' => 'Close' );
@@ -325,7 +326,7 @@
            }
        }
        list($this->result_header,$this->result_body) = preg_split("/\r\n\r\n/",$this->result,2);
        if ($this->bind_host)
@@ -364,6 +365,7 @@
                $this->query($headers['location']);
            }
        }
    }
    function getTransferSpeed()
@@ -447,7 +449,7 @@
    function fetch_header( $header = '' )
    {
        $array_headers = preg_split("/\r\n/",$this->result_header);
        $array_return = array( 0 => $array_headers[0] );
        unset($array_headers[0]);
plugins/show_additional_headers/package.xml
@@ -15,10 +15,10 @@
        <email>roundcube@gmail.com</email>
        <active>yes</active>
    </lead>
    <date>2011-11-21</date>
    <date>2012-04-23</date>
    <version>
        <release>1.1</release>
        <api>1.1</api>
        <release>2.0</release>
        <api>2.0</api>
    </version>
    <stability>
        <release>stable</release>
plugins/show_additional_headers/show_additional_headers.php
@@ -42,9 +42,8 @@
  {
    $rcmail = rcmail::get_instance();
    foreach ((array)$rcmail->config->get('show_additional_headers', array()) as $header) {
      $key = strtolower($header);
      if ($value = $p['headers']->others[$key])
        $p['output'][$key] = array('title' => $header, 'value' => Q($value));
      if ($value = $p['headers']->get($header))
        $p['output'][$header] = array('title' => $header, 'value' => Q($value));
    }
    return $p;
program/include/rcube_imap.php
@@ -1213,7 +1213,9 @@
        }
        // use message index sort as default sorting
        else if (!$sort_field) {
            // use search result from count() if possible
            if ($this->options['skip_deleted'] && !empty($this->icache['undeleted_idx'])
                && $this->icache['undeleted_idx']->get_parameters('ALL') !== null
                && $this->icache['undeleted_idx']->get_parameters('MAILBOX') == $folder
            ) {
                $index = $this->icache['undeleted_idx'];
program/include/rcube_imap_generic.php
@@ -1650,7 +1650,7 @@
        // If ESEARCH is supported always use ALL
        // but not when items are specified or using simple id2uid search
        if (empty($items) && ((int) $criteria != $criteria)) {
        if (empty($items) && preg_match('/[^0-9]/', $criteria)) {
            $items = array('ALL');
        }
program/include/rcube_result_index.php
@@ -89,18 +89,18 @@
                        $param = strtoupper($m[1]);
                        $value = $m[2];
                        $this->params[strtoupper($m[1])] = $value;
                        $this->params[$param] = $value;
                        $data_item = substr($data_item, strlen($m[0]));
                        if (in_array($param, array('COUNT', 'MIN', 'MAX'))) {
                            $this->meta[strtolower($param)] = (int) $m[2];
                            $this->meta[strtolower($param)] = (int) $value;
                        }
                    }
// @TODO: Implement compression using compressMessageSet() in __sleep() and __wakeup() ?
// @TODO: work with compressed result?!
                    if (isset($this->params['ALL'])) {
                        $data[$idx] = implode(self::SEPARATOR_ELEMENT,
                        $data_item = implode(self::SEPARATOR_ELEMENT,
                            rcube_imap_generic::uncompressMessageSet($this->params['ALL']));
                    }
                }
@@ -111,6 +111,8 @@
            unset($data[$i]);
        }
        $data = array_filter($data);
        if (empty($data)) {
            return;
        }
program/js/app.js
@@ -273,7 +273,7 @@
        // show printing dialog
        else if (this.env.action == 'print' && this.env.uid)
          if (bw.safari)
            window.setTimeout('window.print()', 10);
            setTimeout('window.print()', 10);
          else
            window.print();
@@ -770,7 +770,7 @@
      case 'always-load':
        if (this.env.uid && this.env.sender) {
          this.add_contact(urlencode(this.env.sender));
          window.setTimeout(function(){ ref.command('load-images'); }, 300);
          setTimeout(function(){ ref.command('load-images'); }, 300);
          break;
        }
@@ -788,7 +788,7 @@
            qstring += '&_safe=1';
          this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment');
          if (this.attachment_win) {
            window.setTimeout(function(){ ref.attachment_win.focus(); }, 10);
            setTimeout(function(){ ref.attachment_win.focus(); }, 10);
            break;
          }
        }
@@ -911,19 +911,25 @@
        break;
      case 'savedraft':
        var form = this.gui_objects.messageform, msgid;
        // Reset the auto-save timer
        self.clearTimeout(this.save_timer);
        clearTimeout(this.save_timer);
        if (!this.gui_objects.messageform)
        // saving Drafts is disabled
        if (!form)
          break;
        // if saving Drafts is disabled in main.inc.php
        // or if compose form did not change
        if (!this.env.drafts_mailbox || this.cmp_hash == this.compose_field_hash())
        // compose form did not change
        if (this.cmp_hash == this.compose_field_hash()) {
          this.auto_save_start();
          break;
        }
        var form = this.gui_objects.messageform,
          msgid = this.set_busy(true, 'savingmessage');
        // re-set keep-alive timeout
        this.start_keepalive();
        msgid = this.set_busy(true, 'savingmessage');
        form.target = "savetarget";
        form._draft.value = '1';
@@ -939,7 +945,7 @@
          break;
        // Reset the auto-save timer
        self.clearTimeout(this.save_timer);
        clearTimeout(this.save_timer);
        // all checks passed, send message
        var lang = this.spellcheck_lang(),
@@ -958,7 +964,7 @@
      case 'send-attachment':
        // Reset the auto-save timer
        self.clearTimeout(this.save_timer);
        clearTimeout(this.save_timer);
        this.upload_file(props || this.gui_objects.uploadform);
        break;
@@ -1005,7 +1011,7 @@
        if (uid = this.get_single_uid()) {
          ref.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : ''));
          if (this.printwin) {
            window.setTimeout(function(){ ref.printwin.focus(); }, 20);
            setTimeout(function(){ ref.printwin.focus(); }, 20);
            if (this.env.action != 'show')
              this.mark_message('read', uid);
          }
@@ -1016,7 +1022,7 @@
        if (uid = this.get_single_uid()) {
          ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox));
          if (this.sourcewin)
            window.setTimeout(function(){ ref.sourcewin.focus(); }, 20);
            setTimeout(function(){ ref.sourcewin.focus(); }, 20);
          }
        break;
@@ -1161,7 +1167,7 @@
    // set timer for requests
    if (a && this.env.request_timeout)
      this.request_timer = window.setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000);
      this.request_timer = setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000);
    return id;
  };
@@ -1213,7 +1219,7 @@
    if (this.is_framed())
      parent.rcmail.reload(delay);
    else if (delay)
      window.setTimeout(function(){ rcmail.reload(); }, delay);
      setTimeout(function(){ rcmail.reload(); }, delay);
    else if (window.location)
      location.href = this.env.comm_path + (this.env.action ? '&_action='+this.env.action : '');
  };
@@ -1346,7 +1352,7 @@
    this.env.last_folder_target = null;
    if (this.folder_auto_timer) {
      window.clearTimeout(this.folder_auto_timer);
      clearTimeout(this.folder_auto_timer);
      this.folder_auto_timer = null;
      this.folder_auto_expand = null;
    }
@@ -1399,15 +1405,15 @@
            // if the folder is collapsed, expand it after 1sec and restart the drag & drop process.
            if (div.hasClass('collapsed')) {
              if (this.folder_auto_timer)
                window.clearTimeout(this.folder_auto_timer);
                clearTimeout(this.folder_auto_timer);
              this.folder_auto_expand = this.env.mailboxes[k].id;
              this.folder_auto_timer = window.setTimeout(function() {
              this.folder_auto_timer = setTimeout(function() {
                rcmail.command('collapse-folder', rcmail.folder_auto_expand);
                rcmail.drag_start(null);
              }, 1000);
            } else if (this.folder_auto_timer) {
              window.clearTimeout(this.folder_auto_timer);
              clearTimeout(this.folder_auto_timer);
              this.folder_auto_timer = null;
              this.folder_auto_expand = null;
            }
@@ -1559,7 +1565,7 @@
    // start timer for message preview (wait for double click)
    if (selected && this.env.contentframe && !list.multi_selecting && !this.dummy_select)
      this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200);
      this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, 200);
    else if (this.env.contentframe)
      this.show_contentframe(false);
  };
@@ -1576,7 +1582,7 @@
          clearTimeout(this.preview_timer);
        if (this.preview_read_timer)
          clearTimeout(this.preview_read_timer);
        this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200);
        this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, 200);
      }
    }
  };
@@ -1962,7 +1968,7 @@
      // mark as read and change mbox unread counter
      if (action == 'preview' && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread && this.env.preview_pane_mark_read >= 0) {
        this.preview_read_timer = window.setTimeout(function() {
        this.preview_read_timer = setTimeout(function() {
          ref.set_message(id, 'unread', false);
          ref.update_thread_root(id, 'read');
          if (ref.env.unread_counts[ref.env.mailbox]) {
@@ -3142,7 +3148,7 @@
      tinyMCE.execCommand('mceAddControl', false, props.id);
      if (this.env.default_font)
        window.setTimeout(function() {
        setTimeout(function() {
          $(tinyMCE.get(props.id).getBody()).css('font-family', rcmail.env.default_font);
        }, 500);
    }
@@ -3241,7 +3247,7 @@
  this.auto_save_start = function()
  {
    if (this.env.draft_autosave)
      this.save_timer = self.setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000);
      this.save_timer = setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000);
    // Unlock interface now that saving is complete
    this.busy = false;
@@ -3250,20 +3256,11 @@
  this.compose_field_hash = function(save)
  {
    // check input fields
    var ed, str = '',
      value_to = $("[name='_to']").val(),
      value_cc = $("[name='_cc']").val(),
      value_bcc = $("[name='_bcc']").val(),
      value_subject = $("[name='_subject']").val();
    var ed, i, val, str = '', hash_fields = ['to', 'cc', 'bcc', 'subject'];
    if (value_to)
      str += value_to+':';
    if (value_cc)
      str += value_cc+':';
    if (value_bcc)
      str += value_bcc+':';
    if (value_subject)
      str += value_subject+':';
    for (i=0; i<hash_fields.length; i++)
      if (val = $('[name="_' + hash_fields[i] + '"]').val())
        str += val + ':';
    if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)))
      str += ed.getContent();
@@ -3526,7 +3523,7 @@
  this.upload_progress_start = function(action, name)
  {
    window.setTimeout(function() { rcmail.http_request(action, {_progress: name}); },
    setTimeout(function() { rcmail.http_request(action, {_progress: name}); },
      this.env.upload_progress_time * 1000);
  };
@@ -3626,7 +3623,7 @@
  {
    this.display_message(msg, type);
    // before redirect we need to wait some time for Chrome (#1486177)
    window.setTimeout(function(){ ref.list_mailbox(); }, 500);
    setTimeout(function(){ ref.list_mailbox(); }, 500);
  };
@@ -3684,11 +3681,11 @@
      case 37:  // left
      case 39:  // right
        if (mod != SHIFT_KEY)
          return;
          return;
    }
    // start timer
    this.ksearch_timer = window.setTimeout(function(){ ref.ksearch_get_results(props); }, 200);
    this.ksearch_timer = setTimeout(function(){ ref.ksearch_get_results(props); }, 200);
    this.ksearch_input = obj;
    return true;
@@ -3995,7 +3992,7 @@
      source = this.env.source ? this.env.address_sources[this.env.source] : null;
    if (id = list.get_single_selection())
      this.preview_timer = window.setTimeout(function(){ ref.load_contact(id, 'show'); }, 200);
      this.preview_timer = setTimeout(function(){ ref.load_contact(id, 'show'); }, 200);
    else if (this.env.contentframe)
      this.show_contentframe(false);
@@ -4598,6 +4595,14 @@
          if (colprop.type == 'date' && $.datepicker)
            input.datepicker();
        }
        else if (colprop.type == 'textarea') {
          input = $('<textarea>')
            .addClass('ff_'+col)
            .attr({ name: '_'+col+name_suffix, cols:colprop.size, rows:colprop.rows })
            .appendTo(cell);
          this.init_edit_field(col, input);
        }
        else if (colprop.type == 'composite') {
          var childcol, cp, first, templ, cols = [], suffices = [];
@@ -5524,7 +5529,7 @@
      }
      // add element and set timeout
      this.messages[key].elements.push(id);
      window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
      setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
      return id;
    }
@@ -5544,7 +5549,7 @@
    this.triggerEvent('message', { message:msg, type:type, timeout:timeout, object:obj });
    if (timeout > 0)
      window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
      setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
    return id;
  };
@@ -6196,12 +6201,15 @@
  // starts interval for keep-alive/check-recent signal
  this.start_keepalive = function()
  {
    if (!this.env.keep_alive || this.env.framed)
      return;
    if (this._int)
      clearInterval(this._int);
    if (this.env.keep_alive && !this.env.framed && this.task == 'mail' && this.gui_objects.mailboxlist)
    if (this.task == 'mail' && this.gui_objects.mailboxlist)
      this._int = setInterval(function(){ ref.check_for_recent(false); }, this.env.keep_alive * 1000);
    else if (this.env.keep_alive && !this.env.framed && this.task != 'login' && this.env.action != 'print')
    else if (this.task != 'login' && this.env.action != 'print')
      this._int = setInterval(function(){ ref.keep_alive(); }, this.env.keep_alive * 1000);
  };
@@ -6262,7 +6270,7 @@
      return obj.selectionEnd;
    else if (document.selection && document.selection.createRange) {
      var range = document.selection.createRange();
      if (range.parentElement()!=obj)
      if (range.parentElement() != obj)
        return 0;
      var gm = range.duplicate();