Aleksander Machniak
2014-01-01 0301d9347f8c59882cdd7b6ed59686b286a77876
CS fixes
8 files modified
221 ■■■■ changed files
index.php 39 ●●●●● patch | view | raw | blame | history
program/include/clisetup.php patch | view | raw | blame | history
program/include/iniset.php 1 ●●●● patch | view | raw | blame | history
program/include/rcmail.php 161 ●●●● patch | view | raw | blame | history
program/include/rcmail_html_page.php 3 ●●●● patch | view | raw | blame | history
program/include/rcmail_output_html.php 3 ●●●● patch | view | raw | blame | history
program/include/rcmail_string_replacer.php 7 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube.php 7 ●●●●● patch | view | raw | blame | history
index.php
@@ -32,6 +32,7 @@
 |                                                                         |
 +-------------------------------------------------------------------------+
 | Author: Thomas Bruederli <roundcube@gmail.com>                          |
 | Author: Aleksander Machniak <alec@alec.pl>                              |
 +-------------------------------------------------------------------------+
*/
@@ -71,9 +72,11 @@
// 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_utils::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']);
    exit;
  }
@@ -101,8 +104,8 @@
  ));
  // Login
  if ($auth['valid'] && !$auth['abort'] &&
    $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'], $auth['cookiecheck'])
    if ($auth['valid'] && !$auth['abort']
        && $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'], $auth['cookiecheck'])
  ) {
    // create new session ID, don't destroy the current session
    // it was destroyed already by $RCMAIL->kill_session() above
@@ -121,12 +124,14 @@
      parse_str($url, $query);
      // prevent endless looping on login page
      if ($query['_task'] == 'login')
            if ($query['_task'] == 'login') {
        unset($query['_task']);
            }
      // prevent redirect to compose with specified ID (#1488226)
      if ($query['_action'] == 'compose' && !empty($query['_id']))
            if ($query['_action'] == 'compose' && !empty($query['_id'])) {
        $query = array();
            }
    }
    // allow plugins to control the redirect url after login success
@@ -153,24 +158,30 @@
    $error_message = $error_labels[$error_code] ? $error_labels[$error_code] : 'loginfailed';
        $OUTPUT->show_message($error_message, 'warning');
    // log failed login
    $RCMAIL->log_login($auth['user'], true, $error_code);
    $OUTPUT->show_message($error_message, 'warning');
    $RCMAIL->plugins->exec_hook('login_failed', array(
      'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user']));
    $RCMAIL->kill_session();
  }
}
// end session (after optional referer check)
else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL->config->get('referer_check') || rcube_utils::check_referer())) {
else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id'])
    && (!$RCMAIL->config->get('referer_check') || rcube_utils::check_referer())
) {
  $userdata = array(
    'user' => $_SESSION['username'],
    'host' => $_SESSION['storage_host'],
    'lang' => $RCMAIL->user->language,
  );
  $OUTPUT->show_message('loggedout');
  $RCMAIL->logout_actions();
  $RCMAIL->kill_session();
  $RCMAIL->plugins->exec_hook('logout_after', $userdata);
@@ -188,8 +199,11 @@
if (empty($RCMAIL->user->ID)) {
  // log session failures
  $task = rcube_utils::get_input_value('_task', rcube_utils::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");
    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;
  }
@@ -201,8 +215,7 @@
      html::p(null, "Please <b>remove</b> the whole <tt>installer</tt> folder from the Roundcube directory because .
        these files may expose sensitive configuration data like server passwords and encryption keys
        to the public. Make sure you cannot access the <a href=\"./installer/\">installer script</a> from your browser.")
      )
    );
        ));
  }
  if ($session_error || $_REQUEST['_err'] == 'session') {
@@ -217,6 +230,7 @@
  $plugin = $RCMAIL->plugins->exec_hook('unauthenticated', array('task' => 'login', 'error' => $session_error));
  $RCMAIL->set_task($plugin['task']);
  $OUTPUT->send($plugin['task']);
}
// CSRF prevention
@@ -264,8 +278,9 @@
// include task specific functions
if (is_file($incfile = INSTALL_PATH . 'program/steps/'.$RCMAIL->task.'/func.inc'))
if (is_file($incfile = INSTALL_PATH . 'program/steps/'.$RCMAIL->task.'/func.inc')) {
  include_once $incfile;
}
// allow 5 "redirects" to another action
$redirects = 0; $incstep = null;
@@ -300,7 +315,6 @@
// parse main template (default)
$OUTPUT->send($RCMAIL->task);
// if we arrive here, something went wrong
rcmail::raise_error(array(
  'code' => 404,
@@ -308,4 +322,3 @@
  'line' => __LINE__,
  'file' => __FILE__,
  'message' => "Invalid request"), true, true);
program/include/clisetup.php
program/include/iniset.php
@@ -84,4 +84,3 @@
    return false;
}
program/include/rcmail.php
@@ -5,8 +5,8 @@
 | program/include/rcmail.php                                            |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2008-2012, The Roundcube Dev Team                       |
 | Copyright (C) 2011-2012, Kolab Systems AG                             |
 | Copyright (C) 2008-2013, The Roundcube Dev Team                       |
 | Copyright (C) 2011-2013, Kolab Systems AG                             |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -20,7 +20,6 @@
 | Author: Aleksander Machniak <alec@alec.pl>                            |
 +-----------------------------------------------------------------------+
*/
/**
 * Application class of Roundcube Webmail
@@ -67,18 +66,19 @@
   * This implements the 'singleton' design pattern
   *
   * @param string Environment name to run (e.g. live, dev, test)
     *
   * @return rcmail The one and only instance
   */
  static function get_instance($env = '')
  {
    if (!self::$instance || !is_a(self::$instance, 'rcmail')) {
      self::$instance = new rcmail($env);
      self::$instance->startup();  // init AFTER object was linked with self::$instance
            // init AFTER object was linked with self::$instance
            self::$instance->startup();
    }
    return self::$instance;
  }
  /**
   * Initial startup function
@@ -89,8 +89,9 @@
    $this->init(self::INIT_WITH_DB | self::INIT_WITH_PLUGINS);
    // set filename if not index.php
    if (($basename = basename($_SERVER['SCRIPT_FILENAME'])) && $basename != 'index.php')
        if (($basename = basename($_SERVER['SCRIPT_FILENAME'])) && $basename != 'index.php') {
      $this->filename = $basename;
        }
    // start session
    $this->session_init();
@@ -107,8 +108,10 @@
      // we reset list page when switching to another task
      // but only to the main task interface - empty action (#1489076)
      // this will prevent from unintentional page reset on cross-task requests
      if ($this->session && $_SESSION['task'] != $this->task && empty($this->action))
            if ($this->session && $_SESSION['task'] != $this->task && empty($this->action)) {
        $this->session->remove('page');
            }
      // set current task to session
      $_SESSION['task'] = $this->task;
    }
@@ -121,9 +124,9 @@
    // load plugins
    $this->plugins->init($this, $this->task);
    $this->plugins->load_plugins((array)$this->config->get('plugins', array()), array('filesystem_attachments', 'jqueryui'));
        $this->plugins->load_plugins((array)$this->config->get('plugins', array()),
            array('filesystem_attachments', 'jqueryui'));
  }
  /**
   * Setter for application task
@@ -142,10 +145,10 @@
    $this->task = $task;
    $this->comm_path = $this->url(array('task' => $this->task));
    if ($this->output)
        if ($this->output) {
      $this->output->set_env('task', $this->task);
  }
    }
  /**
   * Setter for system user object
@@ -173,7 +176,6 @@
    }
  }
  /**
   * Return instance of the internal address book class
   *
@@ -200,7 +202,8 @@
      $contacts = $this->address_books[$id];
    }
    else if ($id && $ldap_config[$id]) {
      $contacts = new rcube_ldap($ldap_config[$id], $this->config->get('ldap_debug'), $this->config->mail_domain($_SESSION['storage_host']));
            $domain   = $this->config->mail_domain($_SESSION['storage_host']);
            $contacts = new rcube_ldap($ldap_config[$id], $this->config->get('ldap_debug'), $domain);
    }
    else if ($id === '0') {
      $contacts = new rcube_contacts($this->db, $this->get_user_id());
@@ -240,9 +243,11 @@
      }
      self::raise_error(array(
        'code' => 700, 'type' => 'php',
        'file' => __FILE__, 'line' => __LINE__,
        'message' => "Addressbook source ($id) not found!"),
                    'code'    => 700,
                    'file'    => __FILE__,
                    'line'    => __LINE__,
                    'message' => "Addressbook source ($id) not found!"
                ),
        true, true);
    }
@@ -261,7 +266,6 @@
    return $contacts;
  }
  /**
   * Return identifier of the address book object
   *
@@ -277,7 +281,6 @@
      }
    }
  }
  /**
   * Return address books list
@@ -296,15 +299,17 @@
    // We are using the DB address book or a plugin address book
    if (!empty($abook_type) && strtolower($abook_type) != 'ldap') {
      if (!isset($this->address_books['0']))
            if (!isset($this->address_books['0'])) {
        $this->address_books['0'] = new rcube_contacts($this->db, $this->get_user_id());
            }
      $list['0'] = array(
        'id'       => '0',
        'name'     => $this->gettext('personaladrbook'),
        'groups'   => $this->address_books['0']->groups,
        'readonly' => $this->address_books['0']->readonly,
        'autocomplete' => in_array('sql', $autocomplete),
        'undelete' => $this->address_books['0']->undelete && $this->config->get('undo_timeout'),
                'autocomplete' => in_array('sql', $autocomplete),
      );
    }
@@ -314,6 +319,7 @@
        if (empty($prop) || !is_array($prop)) {
          continue;
        }
        $list[$id] = array(
          'id'       => $id,
          'name'     => html::quote($prop['name']),
@@ -352,6 +358,7 @@
   *
   * @param boolean True to sort the list alphabetically
   * @param boolean True if only this user's responses shall be listed
     *
   * @return array List of the current user's stored responses
   */
  public function get_compose_responses($sorted = false, $user_only = false)
@@ -360,18 +367,23 @@
    if (!$user_only) {
      foreach ($this->config->get('compose_responses_static', array()) as $response) {
        if (empty($response['key']))
                if (empty($response['key'])) {
          $response['key'] = substr(md5($response['name']), 0, 16);
                }
        $response['static'] = true;
        $response['class'] = 'readonly';
        $k = $sorted ? '0000-' . strtolower($response['name']) : $response['key'];
        $responses[$k] = $response;
      }
    }
    foreach ($this->config->get('compose_responses', array()) as $response) {
      if (empty($response['key']))
            if (empty($response['key'])) {
        $response['key'] = substr(md5($response['name']), 0, 16);
            }
      $k = $sorted ? strtolower($response['name']) : $response['key'];
      $responses[$k] = $response;
    }
@@ -384,20 +396,21 @@
    return array_values($responses);
  }
  /**
   * Init output object for GUI and add common scripts.
   * This will instantiate a rcmail_output_html object and set
   * environment vars according to the current session and configuration
   *
   * @param boolean True if this request is loaded in a (i)frame
     *
   * @return rcube_output Reference to HTML output object
   */
  public function load_gui($framed = false)
  {
    // init output page
    if (!($this->output instanceof rcmail_output_html))
        if (!($this->output instanceof rcmail_output_html)) {
      $this->output = new rcmail_output_html($this->task, $framed);
        }
    // set refresh interval
    $this->output->set_env('refresh_interval', $this->config->get('refresh_interval', 0));
@@ -413,15 +426,15 @@
    $this->output->set_env('comm_path', $this->comm_path);
    $this->output->set_charset(RCUBE_CHARSET);
    if ($this->user && $this->user->ID)
        if ($this->user && $this->user->ID) {
      $this->output->set_env('user_id', $this->user->get_hash());
        }
    // add some basic labels to client
    $this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing');
    return $this->output;
  }
  /**
   * Create an output object for JSON responses
@@ -430,12 +443,12 @@
   */
  public function json_init()
  {
    if (!($this->output instanceof rcmail_output_json))
        if (!($this->output instanceof rcmail_output_json)) {
      $this->output = new rcmail_output_json($this->task);
        }
    return $this->output;
  }
  /**
   * Create session object and start the session.
@@ -445,14 +458,15 @@
    parent::session_init();
    // set initial session vars
    if (!$_SESSION['user_id'])
        if (!$_SESSION['user_id']) {
      $_SESSION['temp'] = true;
    // restore skin selection after logout
    if ($_SESSION['temp'] && !empty($_SESSION['skin']))
      $this->config->set('skin', $_SESSION['skin']);
  }
        // restore skin selection after logout
        if ($_SESSION['temp'] && !empty($_SESSION['skin'])) {
            $this->config->set('skin', $_SESSION['skin']);
        }
    }
  /**
   * Perfom login to the mail server and to the webmail service.
@@ -480,20 +494,24 @@
    $config = $this->config->all();
    if (!$host)
        if (!$host) {
      $host = $config['default_host'];
        }
    // Validate that selected host is in the list of configured hosts
    if (is_array($config['default_host'])) {
      $allowed = false;
      foreach ($config['default_host'] as $key => $host_allowed) {
        if (!is_numeric($key))
                if (!is_numeric($key)) {
          $host_allowed = $key;
                }
        if ($host == $host_allowed) {
          $allowed = true;
          break;
        }
      }
      if (!$allowed) {
        $host = null;
      }
@@ -512,6 +530,7 @@
    if ($a_host['host']) {
      $host = $a_host['host'];
      $ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
      if (!empty($a_host['port']))
        $port = $a_host['port'];
      else if ($ssl && $ssl != 'tls' && (!$config['default_port'] || $config['default_port'] == 143))
@@ -591,18 +610,22 @@
      }
      else {
        self::raise_error(array(
          'code' => 620, 'type' => 'php',
          'file' => __FILE__, 'line' => __LINE__,
                        'code'    => 620,
                        'file'    => __FILE__,
                        'line'    => __LINE__,
          'message' => "Failed to create a user record. Maybe aborted by a plugin?"
          ), true, false);
                    ),
                    true, false);
      }
    }
    else {
      self::raise_error(array(
        'code' => 621, 'type' => 'php',
        'file' => __FILE__, 'line' => __LINE__,
                    'code'    => 621,
                    'file'    => __FILE__,
                    'line'    => __LINE__,
        'message' => "Access denied for new user $username. 'auto_create_user' is disabled"
        ), true, false);
                ),
                true, false);
    }
    // login succeeded
@@ -628,8 +651,9 @@
      $_SESSION['password']     = $this->encrypt($pass);
      $_SESSION['login_time']   = time();
      if (isset($_REQUEST['_timezone']) && $_REQUEST['_timezone'] != '_default_')
            if (isset($_REQUEST['_timezone']) && $_REQUEST['_timezone'] != '_default_') {
        $_SESSION['timezone'] = rcube_utils::get_input_value('_timezone', rcube_utils::INPUT_GPC);
            }
      // force reloading complete list of subscribed mailboxes
      $storage->clear_cache('mailboxes', true);
@@ -639,7 +663,6 @@
    return false;
  }
    /**
     * Returns error code of last login operation
@@ -656,7 +679,6 @@
            return self::ERROR_STORAGE;
        }
    }
  /**
   * Auto-select IMAP host based on the posted login information
@@ -701,12 +723,12 @@
    else if (empty($default_host)) {
      $host = rcube_utils::get_input_value('_host', rcube_utils::INPUT_POST);
    }
    else
        else {
      $host = rcube_utils::parse_host($default_host);
        }
    return $host;
  }
  /**
   * Destroy session data and remove cookie
@@ -719,7 +741,6 @@
    $_SESSION = array('language' => $this->user->language, 'temp' => true, 'skin' => $this->config->get('skin'));
    $this->user->reset();
  }
  /**
   * Do server side actions on logout
@@ -743,7 +764,6 @@
    }
  }
  /**
   * Generate a unique token to be used in a form request
   *
@@ -752,7 +772,10 @@
  public function get_request_token()
  {
    $sess_id = $_COOKIE[ini_get('session.name')];
    if (!$sess_id) $sess_id = session_id();
        if (!$sess_id) {
            $sess_id = session_id();
        }
    $plugin = $this->plugins->exec_hook('request_token', array(
        'value' => md5('RT' . $this->get_user_id() . $this->config->get('des_key') . $sess_id)));
@@ -760,20 +783,20 @@
    return $plugin['value'];
  }
  /**
   * Check if the current request contains a valid token
   *
   * @param int Request method
     *
   * @return boolean True if request token is valid false if not
   */
  public function check_request($mode = rcube_utils::INPUT_POST)
  {
    $token = rcube_utils::get_input_value('_token', $mode);
    $sess_id = $_COOKIE[ini_get('session.name')];
    return !empty($sess_id) && $token == $this->get_request_token();
  }
  /**
   * Build a valid URL to this instance of Roundcube
@@ -785,8 +808,9 @@
  public function url($p)
  {
    if (!is_array($p)) {
      if (strpos($p, 'http') === 0)
            if (strpos($p, 'http') === 0) {
        return $p;
            }
      $p = array('_action' => @func_get_arg(0));
    }
@@ -797,6 +821,7 @@
    $url = './' . $this->filename;
    $delm = '?';
    foreach (array_reverse($p) as $key => $val) {
      if ($val !== '' && $val !== null) {
        $par = $key[0] == '_' ? $key : '_'.$key;
@@ -804,9 +829,9 @@
        $delm = '&';
      }
    }
    return $url;
  }
  /**
   * Function to be executed in script shutdown
@@ -828,13 +853,13 @@
        $mem .= '/'.$this->show_bytes(memory_get_peak_usage());
      $log = $this->task . ($this->action ? '/'.$this->action : '') . ($mem ? " [$mem]" : '');
      if (defined('RCMAIL_START'))
        self::print_timer(RCMAIL_START, $log);
      else
        self::console($log);
    }
  }
  /**
   * Registers action aliases for current task
@@ -850,7 +875,6 @@
    }
  }
  /**
   * Returns current action filename
   *
@@ -864,7 +888,6 @@
    return strtr($this->action, '-', '_') . '.inc';
  }
  /**
   * Fixes some user preferences according to namespace handling change.
@@ -926,6 +949,7 @@
        }
        $folders[$idx] = $value;
      }
      $prefs['search_mods'] = $folders;
    }
@@ -937,6 +961,7 @@
        }
        $folders[$prefix.$idx] = $value;
      }
      $prefs['message_threading'] = $folders;
    }
@@ -956,6 +981,7 @@
        }
        $folders_str .= '&'.$value.'&';
      }
      $prefs['collapsed_folders'] = $folders_str;
    }
@@ -965,7 +991,6 @@
    $user->save_prefs($prefs);
    $this->set_storage_prop();
  }
    /**
     * Overwrite action variable
@@ -978,7 +1003,6 @@
        $this->output->set_env('action', $action);
    }
    /**
     * Set environment variables for specified config options
     */
@@ -990,7 +1014,6 @@
            }
        }
    }
    /**
     * Returns RFC2822 formatted current date in user's timezone
@@ -1010,7 +1033,6 @@
        return $date->format('r');
    }
    /**
     * Write login data (name, ID, IP address) to the 'userlogins' log file.
@@ -1042,7 +1064,6 @@
        // log login
        self::write_log('userlogins', $message);
    }
    /**
     * Create a HTML table based on the given data
@@ -1092,7 +1113,6 @@
        return $table->show($attrib);
    }
    /**
     * Convert the given date to a human readable form
@@ -1223,7 +1243,6 @@
        return $out;
    }
    /**
     * Return folders list in HTML
     *
@@ -1316,7 +1335,6 @@
        return $out;
    }
    /**
     * Return folders list as html_select object
     *
@@ -1359,7 +1377,6 @@
        return $select;
    }
    /**
     * Create a hierarchical array of the mailbox list
@@ -1417,7 +1434,6 @@
            $this->build_folder_tree($arrFolders[$currentFolder]['folders'], $subFolders, $delm, $path.$delm);
        }
    }
    /**
     * Return html for a structured list &lt;ul&gt; for the mailbox tree
@@ -1513,7 +1529,6 @@
        return $out;
    }
    /**
     * Return html for a flat list <select> for the mailbox tree
     */
@@ -1558,7 +1573,6 @@
        return $out;
    }
    /**
     * Return internal name for the given folder if it matches the configured special folders
     */
@@ -1576,7 +1590,6 @@
            }
        }
    }
    /**
     * Try to localize the given IMAP folder name.
@@ -1695,7 +1708,6 @@
        return $quota_result;
    }
    /**
     * Outputs error message according to server error/response codes
     *
@@ -1749,7 +1761,6 @@
        }
    }
    /**
     * Output HTML editor scripts
     *
@@ -1790,7 +1801,6 @@
        $this->output->add_script("rcmail_editor_init($script)", 'docready');
    }
    /**
     * Replaces TinyMCE's emoticon images with plain-text representation
     *
@@ -1828,7 +1838,6 @@
        return preg_replace($search, $replace, $html);
    }
    /**
     * File upload progress handler.
     */
@@ -1860,7 +1869,6 @@
        $this->output->send();
    }
    /**
     * Initializes file uploading interface.
     */
@@ -1878,6 +1886,7 @@
        // find max filesize value
        $max_filesize = parse_bytes(ini_get('upload_max_filesize'));
        $max_postsize = parse_bytes(ini_get('post_max_size'));
        if ($max_postsize && $max_postsize < $max_filesize) {
            $max_filesize = $max_postsize;
        }
@@ -1889,7 +1898,6 @@
        return $max_filesize;
    }
    /**
     * Initializes client-side autocompletion.
@@ -1916,7 +1924,6 @@
        $this->output->set_env('autocomplete_min_length', $this->config->get('autocomplete_min_length'));
        $this->output->add_label('autocompletechars', 'autocompletemore');
    }
    /**
     * Returns supported font-family specifications
@@ -1950,7 +1957,6 @@
        return $fonts;
    }
    /**
     * Create a human readable string for a number of bytes
     *
@@ -1977,7 +1983,6 @@
        return $str;
    }
    /**
     * Returns real size (calculated) of the message part
program/include/rcmail_html_page.php
@@ -38,7 +38,8 @@
        }
        else {  // set default styles for warning blocks inside the attachment part frame
            $this->add_header(html::tag('style', array('type' => 'text/css'),
                ".rcmail-inline-message { font-family: sans-serif; border:2px solid #ffdf0e; background:#fef893; padding:0.6em 1em; margin-bottom:0.6em }\n" .
                ".rcmail-inline-message { font-family: sans-serif; border:2px solid #ffdf0e;"
                                        . "background:#fef893; padding:0.6em 1em; margin-bottom:0.6em }\n" .
                ".rcmail-inline-buttons { margin-bottom:0 }"
            ));
        }
program/include/rcmail_output_html.php
@@ -5,7 +5,7 @@
 | program/include/rcmail_output_html.php                                |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2006-2012, The Roundcube Dev Team                       |
 | Copyright (C) 2006-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -119,6 +119,7 @@
    public function set_env($name, $value, $addtojs = true)
    {
        $this->env[$name] = $value;
        if ($addtojs || isset($this->js_env[$name])) {
            $this->js_env[$name] = $value;
        }
program/include/rcmail_string_replacer.php
@@ -5,7 +5,7 @@
 | program/include/rcmail_string_replacer.php                            |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2012, The Roundcube Dev Team                            |
 | Copyright (C) 2012-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -18,7 +18,6 @@
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+
*/
/**
 * Helper class for turning URLs and email addresses in plaintext content
@@ -46,9 +45,9 @@
      $i = $this->add(html::a(array(
          'href' => 'mailto:' . $href,
          'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('compose','".rcube::JQ($href)."',this)",
        ), rcube::Q($href)) . $suffix);
            ),
            rcube::Q($href)) . $suffix);
      return $i >= 0 ? $this->get_replacement($i) : '';
    }
}
program/lib/Roundcube/rcube.php
@@ -1152,7 +1152,6 @@
        // handle PHP exceptions
        if (is_object($arg) && is_a($arg, 'Exception')) {
            $arg = array(
                'type' => 'php',
                'code' => $arg->getCode(),
                'line' => $arg->getLine(),
                'file' => $arg->getFile(),
@@ -1160,7 +1159,7 @@
            );
        }
        else if (is_string($arg)) {
            $arg = array('message' => $arg, 'type' => 'php');
            $arg = array('message' => $arg);
        }
        if (empty($arg['code'])) {
@@ -1176,7 +1175,7 @@
        $cli = php_sapi_name() == 'cli';
        if (($log || $terminate) && !$cli && $arg['type'] && $arg['message']) {
        if (($log || $terminate) && !$cli && $arg['message']) {
            $arg['fatal'] = $terminate;
            self::log_bug($arg);
        }
@@ -1204,7 +1203,7 @@
     */
    public static function log_bug($arg_arr)
    {
        $program = strtoupper($arg_arr['type']);
        $program = strtoupper(!empty($arg_arr['type']) ? $arg_arr['type'] : 'php');
        $level   = self::get_instance()->config->get('debug_level');
        // disable errors for ajax requests, write to log instead (#1487831)