Changeset b08caf5 in github


Ignore:
Timestamp:
Aug 31, 2011 8:49:44 AM (22 months ago)
Author:
alecpl <alec@…>
Branches:
release-0.6
Children:
853696b1
Parents:
fd6146b
Message:
  • Applied fixes from trunk up to r5150
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    rfd6146b rb08caf5  
    22=========================== 
    33 
     4- Fix imap_cache setting to values other than 'db' (#1488060) 
     5- Fix handling of attachments inside message/rfc822 parts (#1488026) 
     6- Make list of mimetypes that open in preview window configurable (#1487625) 
     7- Added plugin hook 'message_part_get' for attachment downloads 
    48- Fixed selecting identity on reply/forward (#1487981) 
    59- Fix image type check for contact photo uploads 
  • config/main.inc.php.dist

    r5c9d1ff rb08caf5  
    326326// 3 - one identity with possibility to edit all params but not email address 
    327327$rcmail_config['identities_level'] = 0; 
     328 
     329// Mimetypes supported by the browser. 
     330// attachments of these types will open in a preview window 
     331// either a comma-separated list or an array: 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/pdf' 
     332$rcmail_config['client_mimetypes'] = null;  # null == default 
    328333 
    329334// mime magic database 
  • plugins/acl/acl.js

    rb6cd452 rb08caf5  
    22 * ACL plugin script 
    33 * 
    4  * @version 0.6 
     4 * @version 0.6.1 
    55 * @author Aleksander Machniak <alec@alec.pl> 
    66 */ 
     
    1212            // enable autocomplete on user input 
    1313            if (rcmail.env.acl_users_source) { 
    14                 rcmail.init_address_input_events($('#acluser'), {action:'plugin.acl-autocomplete'}); 
     14                rcmail.init_address_input_events($('#acluser'), {action:'settings/plugin.acl-autocomplete'}); 
    1515                // fix inserted value 
    1616                rcmail.addEventListener('autocomplete_insert', function(e) { 
     
    5353 
    5454    if (users && users.length && confirm(this.get_label('acl.deleteconfirm'))) { 
    55         this.http_request('plugin.acl', '_act=delete&_user='+urlencode(users.join(',')) 
     55        this.http_request('settings/plugin.acl', '_act=delete&_user='+urlencode(users.join(',')) 
    5656            + '&_mbox='+urlencode(this.env.mailbox), 
    5757            this.set_busy(true, 'acl.deleting')); 
     
    8383    } 
    8484 
    85     this.http_request('plugin.acl', '_act=save' 
     85    this.http_request('settings/plugin.acl', '_act=save' 
    8686        + '&_user='+urlencode(user) 
    8787        + '&_acl=' +rights 
     
    121121    this.env.acl_advanced = !this.env.acl_advanced; 
    122122    this.enable_command('acl-delete', 'acl-edit', false); 
    123     this.http_request('plugin.acl', '_act=list' 
     123    this.http_request('settings/plugin.acl', '_act=list' 
    124124        + '&_mode='+(this.env.acl_advanced ? 'advanced' : 'simple') 
    125125        + '&_mbox='+urlencode(this.env.mailbox), 
  • plugins/acl/acl.php

    rb6cd452 rb08caf5  
    44 * Folders Access Control Lists Management (RFC4314, RFC2086) 
    55 * 
    6  * @version 0.6 
     6 * @version 0.6.1 
    77 * @author Aleksander Machniak <alec@alec.pl> 
    88 * 
     
    2626class acl extends rcube_plugin 
    2727{ 
    28     public $task = 'settings|addressbook'; 
     28    public $task = 'settings|addressbook|calendar'; 
    2929 
    3030    private $rc; 
     
    4545        // kolab_addressbook plugin 
    4646        $this->add_hook('addressbook_form', array($this, 'folder_form')); 
     47        $this->add_hook('calendar_form_kolab', array($this, 'folder_form')); 
    4748        // Plugin actions 
    4849        $this->register_action('plugin.acl', array($this, 'acl_actions')); 
     
    527528        $attrib    = array( 
    528529            'name' => 'rcmyrights', 
    529             'style' => 'padding: 0 15px;', 
     530            'style' => 'margin:0; padding:0 15px;', 
    530531        ); 
    531532 
  • plugins/acl/skins/default/acl.css

    r5375e84 rb08caf5  
    8282#aclform 
    8383{ 
    84   top: 100px; 
     84  top: 80px; 
    8585  width: 480px; 
    8686  padding: 10px; 
  • plugins/new_user_dialog/new_user_dialog.php

    r5375e84 rb08caf5  
    6767      ))); 
    6868 
     69      $table->add('title', $this->gettext('organization')); 
     70      $table->add(null, html::tag('input', array( 
     71        'type' => 'text', 
     72        'name' => '_organization', 
     73        'value' => $identity['organization'] 
     74      ))); 
     75 
     76      $table->add('title', $this->gettext('signature')); 
     77      $table->add(null, html::tag('textarea', array( 
     78        'name' => '_signature', 
     79        'rows' => '3', 
     80      ),$identity['signature'] 
     81      )); 
     82 
    6983      // add overlay input box to html page 
    7084      $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), 
     
    107121      'name' => get_input_value('_name', RCUBE_INPUT_POST), 
    108122      'email' => get_input_value('_email', RCUBE_INPUT_POST), 
     123      'organization' => get_input_value('_organization', RCUBE_INPUT_POST), 
     124      'signature' => get_input_value('_signature', RCUBE_INPUT_POST), 
    109125    ); 
    110126 
  • plugins/new_user_dialog/newuserdialog.css

    r5375e84 rb08caf5  
    4949} 
    5050 
    51 #newuseroverlay table td input 
     51#newuseroverlay table td input, 
     52#newuseroverlay table td textarea 
    5253{ 
    5354  width: 20em; 
  • program/include/main.inc

    r81fd879 rb08caf5  
    10221022function format_date($date, $format=NULL) 
    10231023{ 
    1024   global $CONFIG; 
     1024  global $RCMAIL, $CONFIG; 
    10251025   
    10261026  $ts = NULL; 
     
    10331033 
    10341034  // get user's timezone 
    1035   if ($CONFIG['timezone'] === 'auto') 
    1036     $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600; 
    1037   else { 
    1038     $tz = $CONFIG['timezone']; 
    1039     if ($CONFIG['dst_active']) 
    1040       $tz++; 
    1041   } 
     1035  $tz = $RCMAIL->config->get_timezone(); 
    10421036 
    10431037  // convert time to user's timezone 
     
    16601654 * @param array  $mailto     Array of recipient address strings 
    16611655 * @param array  $smtp_error SMTP error array (reference) 
    1662  * @param string $body_file  Location of file with saved message body (reference) 
     1656 * @param string $body_file  Location of file with saved message body (reference), 
     1657 *                           used when delay_file_io is enabled 
    16631658 * @param array  $smtp_opts  SMTP options (e.g. DSN request) 
    16641659 * 
    16651660 * @return boolean Send status. 
    16661661 */ 
    1667 function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file, $smtp_opts=null) 
     1662function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file=null, $smtp_opts=null) 
    16681663{ 
    16691664  global $CONFIG, $RCMAIL; 
     
    18241819function rcmail_user_date() 
    18251820{ 
    1826   global $CONFIG; 
     1821  global $RCMAIL, $CONFIG; 
    18271822 
    18281823  // get user's timezone 
    1829   if ($CONFIG['timezone'] === 'auto') { 
    1830     $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600; 
    1831   } 
    1832   else { 
    1833     $tz = $CONFIG['timezone']; 
    1834     if ($CONFIG['dst_active']) 
    1835       $tz++; 
    1836   } 
     1824  $tz = $RCMAIL->config->get_timezone(); 
    18371825 
    18381826  $date = time() + $tz * 60 * 60; 
  • program/include/rcmail.php

    rfe91e2f rb08caf5  
    414414 
    415415    // use existing instance 
    416     if (isset($this->address_books[$id]) && is_a($this->address_books[$id], 'rcube_addressbook') && (!$writeable || !$this->address_books[$id]->readonly)) { 
     416    if (isset($this->address_books[$id]) && is_object($this->address_books[$id]) 
     417      && is_a($this->address_books[$id], 'rcube_addressbook') 
     418      && (!$writeable || !$this->address_books[$id]->readonly) 
     419    ) { 
    417420      $contacts = $this->address_books[$id]; 
    418421    } 
     
    11841187 
    11851188    foreach ($this->address_books as $book) { 
    1186       if (is_a($book, 'rcube_addressbook')) 
     1189      if (is_object($book) && is_a($book, 'rcube_addressbook')) 
    11871190        $book->close(); 
    11881191    } 
  • program/include/rcube_config.php

    r18371736 rb08caf5  
    221221    } 
    222222 
     223    /** 
     224     * Special getter for user's timezone 
     225     */ 
     226    public function get_timezone() 
     227    { 
     228      $tz = $this->get('timezone'); 
     229      if ($tz == 'auto') 
     230        $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z') / 3600; 
     231      else 
     232        $tz = intval($tz) + intval($this->get('dst_active')); 
     233 
     234      return $tz; 
     235    } 
    223236 
    224237    /** 
  • program/include/rcube_html_page.php

    r909a3ac rb08caf5  
    213213            $this->add_script('$(document).ready(function(){ ' . $this->scripts['docready'] . "\n});", 'foot'); 
    214214        } 
    215          
     215 
    216216        if (is_array($this->script_files['foot'])) { 
    217217            foreach ($this->script_files['foot'] as $file) { 
     
    247247        // add page hader 
    248248        if ($hpos) { 
    249             $output = substr($output,0,$hpos) . $page_header . substr($output,$hpos,strlen($output)); 
     249            $output = substr_replace($output, $page_header, $hpos, 0); 
    250250        } 
    251251        else { 
     
    255255        // add page footer 
    256256        if (($fpos = strripos($output, '</body>')) || ($fpos = strripos($output, '</html>'))) { 
    257             $output = substr($output, 0, $fpos) . "$page_footer\n" . substr($output, $fpos); 
     257            $output = substr_replace($output, $page_footer."\n", $fpos, 0); 
    258258        } 
    259259        else { 
     
    269269                $css .= sprintf($this->link_css_file, $file); 
    270270            } 
    271             $output = substr($output, 0, $pos) . $css . substr($output, $pos); 
     271            $output = substr_replace($output, $css, $pos, 0); 
    272272        } 
    273273 
     
    290290        } 
    291291    } 
    292      
     292 
    293293    /** 
    294294     * Callback function for preg_replace_callback in write() 
  • program/include/rcube_imap.php

    rd43d4bc rb08caf5  
    30753075            $a_folders = $data['folders']; 
    30763076        } 
     3077        else if (!$this->conn->connected()) { 
     3078           return array(); 
     3079        } 
    30773080        else { 
    30783081            // Server supports LIST-EXTENDED, we can use selection options 
     
    38353838     * Enable or disable indexes caching 
    38363839     * 
    3837      * @param boolean $type Cache type (@see rcmail::get_cache) 
     3840     * @param string $type Cache type (@see rcmail::get_cache) 
    38383841     * @access public 
    38393842     */ 
     
    38413844    { 
    38423845        if ($type) { 
    3843             $this->caching = true; 
     3846            $this->caching = $type; 
    38443847        } 
    38453848        else { 
     
    38583861        if ($this->caching && !$this->cache) { 
    38593862            $rcmail = rcmail::get_instance(); 
    3860             $this->cache = $rcmail->get_cache('IMAP', $type); 
     3863            $this->cache = $rcmail->get_cache('IMAP', $this->caching); 
    38613864        } 
    38623865 
  • program/include/rcube_message.php

    rdd0ae62 rb08caf5  
    287287            $structure->type = 'content'; 
    288288            $this->parts[] = &$structure; 
    289              
     289 
    290290            // Parse simple (plain text) message body 
    291291            if ($message_ctype_secondary == 'plain') 
     
    307307            foreach ($structure->parts as $p => $sub_part) { 
    308308                $sub_mimetype = $sub_part->mimetype; 
    309          
     309 
    310310                // check if sub part is 
    311311                if ($sub_mimetype == 'text/plain') 
     
    324324                $this->parse_structure($structure->parts[$related_part], true); 
    325325                $this->parse_alternative = false; 
    326          
     326 
    327327                // if plain part was found, we should unset it if html is preferred 
    328328                if ($this->opt['prefer_html'] && count($this->parts)) 
     
    433433                } 
    434434                // part message/* 
    435                 else if ($primary_type=='message') { 
     435                else if ($primary_type == 'message') { 
    436436                    $this->parse_structure($mail_part, true); 
    437437 
     
    496496                        $this->attachments[] = $mail_part; 
    497497                    } 
     498                } 
     499                // attachment part as message/rfc822 (#1488026) 
     500                else if ($mail_part->mimetype == 'message/rfc822') { 
     501                    $this->parse_structure($mail_part); 
    498502                } 
    499503            } 
  • program/include/rcube_plugin_api.php

    r8ec1b91 rb08caf5  
    177177          // ... task, request type and framed mode 
    178178          if ((!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task)) 
    179               && (!$plugin->noajax || is_a($rcmail->output, 'rcube_template')) 
     179              && (!$plugin->noajax || (is_object($rcmail->output) && is_a($rcmail->output, 'rcube_template'))) 
    180180              && (!$plugin->noframe || empty($_REQUEST['_framed'])) 
    181181          ) { 
  • program/js/app.js

    rfd6146b rb08caf5  
    4141  this.identifier_expr = new RegExp('[^0-9a-z\-_]', 'gi'); 
    4242 
    43   // mimetypes supported by the browser (default settings) 
    44   this.mimetypes = new Array('text/plain', 'text/html', 'text/xml', 
    45     'image/jpeg', 'image/gif', 'image/png', 
    46     'application/x-javascript', 'application/pdf', 'application/x-shockwave-flash'); 
    47  
    4843  // default environment vars 
    4944  this.env.keep_alive = 60;        // seconds 
     
    9186 
    9287    this.buttons[command].push(button_prop); 
     88     
     89    if (this.loaded) 
     90      init_button(command, button_prop); 
    9391  }; 
    9492 
     
    9694  this.gui_object = function(name, id) 
    9795  { 
    98     this.gui_objects[name] = id; 
     96    this.gui_objects[name] = this.loaded ? rcube_find_object(id) : id; 
    9997  }; 
    10098 
     
    749747 
    750748        // open attachment in frame if it's of a supported mimetype 
    751         if (this.env.uid && props.mimetype && $.inArray(props.mimetype, this.mimetypes)>=0) { 
     749        if (this.env.uid && props.mimetype && this.env.mimetypes && $.inArray(props.mimetype, this.env.mimetypes)>=0) { 
    752750          if (props.mimetype == 'text/html') 
    753751            qstring += '&_safe=1'; 
     
    35063504      case 27:  // escape 
    35073505        this.ksearch_hide(); 
    3508         break; 
     3506        return; 
    35093507 
    35103508      case 37:  // left 
     
    49154913  /*********************************************************/ 
    49164914 
     4915  var init_button = function(cmd, prop) 
     4916  { 
     4917    var elm = document.getElementById(prop.id); 
     4918    if (!elm) 
     4919      return; 
     4920 
     4921    var preload = false; 
     4922    if (prop.type == 'image') { 
     4923      elm = elm.parentNode; 
     4924      preload = true; 
     4925    } 
     4926 
     4927    elm._command = cmd; 
     4928    elm._id = prop.id; 
     4929    if (prop.sel) { 
     4930      elm.onmousedown = function(e){ return rcmail.button_sel(this._command, this._id); }; 
     4931      elm.onmouseup = function(e){ return rcmail.button_out(this._command, this._id); }; 
     4932      if (preload) 
     4933        new Image().src = prop.sel; 
     4934    } 
     4935    if (prop.over) { 
     4936      elm.onmouseover = function(e){ return rcmail.button_over(this._command, this._id); }; 
     4937      elm.onmouseout = function(e){ return rcmail.button_out(this._command, this._id); }; 
     4938      if (preload) 
     4939        new Image().src = prop.over; 
     4940    } 
     4941  }; 
     4942 
    49174943  // enable/disable buttons for page shifting 
    49184944  this.set_page_buttons = function() 
     
    49304956 
    49314957      for (var i=0; i< this.buttons[cmd].length; i++) { 
    4932         var prop = this.buttons[cmd][i]; 
    4933         var elm = document.getElementById(prop.id); 
    4934         if (!elm) 
    4935           continue; 
    4936  
    4937         var preload = false; 
    4938         if (prop.type == 'image') { 
    4939           elm = elm.parentNode; 
    4940           preload = true; 
    4941         } 
    4942  
    4943         elm._command = cmd; 
    4944         elm._id = prop.id; 
    4945         if (prop.sel) { 
    4946           elm.onmousedown = function(e){ return rcmail.button_sel(this._command, this._id); }; 
    4947           elm.onmouseup = function(e){ return rcmail.button_out(this._command, this._id); }; 
    4948           if (preload) 
    4949             new Image().src = prop.sel; 
    4950         } 
    4951         if (prop.over) { 
    4952           elm.onmouseover = function(e){ return rcmail.button_over(this._command, this._id); }; 
    4953           elm.onmouseout = function(e){ return rcmail.button_out(this._command, this._id); }; 
    4954           if (preload) 
    4955             new Image().src = prop.over; 
    4956         } 
     4958        init_button(cmd, this.buttons[cmd][i]); 
    49574959      } 
    49584960    } 
     
    55675569 
    55685570    // overwrite task name 
    5569     if (query._action.match(/([a-z]+)\/([a-z-_]+)/)) { 
     5571    if (query._action.match(/([a-z]+)\/([a-z-_.]+)/)) { 
    55705572      query._action = RegExp.$2; 
    55715573      base = base.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); 
  • program/steps/mail/func.inc

    r782d859 rb08caf5  
    14491449  global $RCMAIL, $IMAP; 
    14501450 
    1451   if (!is_a($message, rcube_message)) 
     1451  if (!is_object($message) || !is_a($message, rcube_message)) 
    14521452    $message = new rcube_message($message); 
    14531453 
  • program/steps/mail/get.inc

    rf5e7b353 rb08caf5  
    8080    $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); 
    8181 
     82    // allow post-processing of the message body 
     83    $plugin = $RCMAIL->plugins->exec_hook('message_part_get', 
     84      array('id' => $part->mime_id, 'mimetype' => $mimetype, 'part' => $part, 'download' => !empty($_GET['_download']))); 
     85 
     86    if ($plugin['abort']) 
     87      exit; 
     88 
     89    // overwrite modified vars from plugin 
     90    $mimetype = $plugin['mimetype']; 
     91    list($ctype_primary, $ctype_secondary) = explode('/', $mimetype); 
     92    if ($plugin['body']) 
     93      $part->body = $plugin['body']; 
     94 
    8295    $browser = $RCMAIL->output->browser; 
    8396 
    8497    // send download headers 
    85     if ($_GET['_download']) { 
     98    if ($plugin['download']) { 
    8699      header("Content-Type: application/octet-stream"); 
    87100      if ($browser->ie) 
     
    98111 
    99112    // deliver part content 
    100     if ($ctype_primary == 'text' && $ctype_secondary == 'html' && empty($_GET['_download'])) { 
     113    if ($ctype_primary == 'text' && $ctype_secondary == 'html' && empty($plugin['download'])) { 
    101114      // get part body if not available 
    102115      if (!$part->body) 
     
    120133        $filename = addcslashes($filename, '"'); 
    121134 
    122       $disposition = !empty($_GET['_download']) ? 'attachment' : 'inline'; 
     135      $disposition = !empty($plugin['download']) ? 'attachment' : 'inline'; 
    123136 
    124137      header("Content-Disposition: $disposition; filename=\"$filename\""); 
  • program/steps/mail/show.inc

    r40a1860 rb08caf5  
    5353  $OUTPUT->set_env('mailbox', $mbox_name); 
    5454 
     55  // mimetypes supported by the browser (default settings) 
     56  $mimetypes = $RCMAIL->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/x-javascript,application/pdf,application/x-shockwave-flash'); 
     57  $OUTPUT->set_env('mimetypes', is_string($mimetypes) ? explode(',', $mimetypes) : (array)$mimetypes); 
     58 
    5559  if ($CONFIG['trash_mbox']) 
    5660    $OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']); 
  • program/steps/settings/save_prefs.inc

    r1d5779b rb08caf5  
    142142      $a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize']; 
    143143 
    144     $a_user_prefs['timezone'] = $_SESSION['timezone'] = (string) $a_user_prefs['timezone']; 
     144    $a_user_prefs['timezone'] = (string) $a_user_prefs['timezone']; 
    145145 
    146146  break; 
  • skins/default/common.css

    r7f5a849 rb08caf5  
    9797{ 
    9898  color: black; 
     99} 
     100 
     101input.button[disabled], 
     102input.button[disabled]:hover 
     103{ 
     104  color: #aaa; 
     105  border-color: #ccc; 
    99106} 
    100107 
Note: See TracChangeset for help on using the changeset viewer.