Aleksander Machniak
2012-11-27 a92beb6bdb9cb857e8cee6606033691f11692230
Define RCUBE_CHARSET in place of RCMAIL_CHARSET for naming consistency
14 files modified
63 ■■■■ changed files
program/include/bc.php 1 ●●●● patch | view | raw | blame | history
program/include/rcmail.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/bootstrap.php 6 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/html.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_charset.php 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_config.php 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_contacts.php 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_csv2vcard.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_mime.php 10 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_output.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_output_html.php 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_spellchecker.php 10 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_vcard.php 10 ●●●● patch | view | raw | blame | history
program/include/bc.php
@@ -32,6 +32,7 @@
define('RCUBE_INPUT_GPC',  rcube_utils::INPUT_GPC);
define('JS_OBJECT_NAME',   rcmail::JS_OBJECT_NAME);
define('RCMAIL_CHARSET',   RCUBE_CHARSET);
function get_table_name($table)
{
program/include/rcmail.php
@@ -345,7 +345,7 @@
    $this->output->set_env('task', $this->task);
    $this->output->set_env('action', $this->action);
    $this->output->set_env('comm_path', $this->comm_path);
    $this->output->set_charset(RCMAIL_CHARSET);
    $this->output->set_charset(RCUBE_CHARSET);
    // add some basic labels to client
    $this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing');
program/lib/Roundcube/bootstrap.php
@@ -49,7 +49,7 @@
// framework constants
define('RCUBE_VERSION', '0.9-git');
define('RCMAIL_CHARSET', 'UTF-8');
define('RCUBE_CHARSET', 'UTF-8');
if (!defined('RCUBE_LIB_DIR')) {
    define('RCUBE_LIB_DIR', dirname(__FILE__).'/');
@@ -73,8 +73,8 @@
// set internal encoding for mbstring extension
if (extension_loaded('mbstring')) {
    mb_internal_encoding(RCMAIL_CHARSET);
    @mb_regex_encoding(RCMAIL_CHARSET);
    mb_internal_encoding(RCUBE_CHARSET);
    @mb_regex_encoding(RCUBE_CHARSET);
}
// Register autoloader
program/lib/Roundcube/html.php
@@ -335,7 +335,7 @@
     */
    public static function quote($str)
    {
        return @htmlspecialchars($str, ENT_COMPAT, RCMAIL_CHARSET);
        return @htmlspecialchars($str, ENT_COMPAT, RCUBE_CHARSET);
    }
}
program/lib/Roundcube/rcube.php
@@ -379,7 +379,7 @@
    {
        $storage = $this->get_storage();
        $storage->set_charset($this->config->get('default_charset', RCMAIL_CHARSET));
        $storage->set_charset($this->config->get('default_charset', RCUBE_CHARSET));
        if ($default_folders = $this->config->get('default_folders')) {
            $storage->set_default_folders($default_folders);
program/lib/Roundcube/rcube_charset.php
@@ -169,7 +169,7 @@
     *
     * @param  string Input string
     * @param  string Suspected charset of the input string
     * @param  string Target charset to convert to; defaults to RCMAIL_CHARSET
     * @param  string Target charset to convert to; defaults to RCUBE_CHARSET
     *
     * @return string Converted string
     */
@@ -180,7 +180,7 @@
        static $mbstring_sch    = null;
        static $conv            = null;
        $to   = empty($to) ? RCMAIL_CHARSET : $to;
        $to   = empty($to) ? RCUBE_CHARSET : $to;
        $from = self::parse_charset($from);
        // It is a common case when UTF-16 charset is used with US-ASCII content (#1488654)
program/lib/Roundcube/rcube_config.php
@@ -101,11 +101,11 @@
        // fix default imap folders encoding
        foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder)
            $this->prop[$folder] = rcube_charset::convert($this->prop[$folder], RCMAIL_CHARSET, 'UTF7-IMAP');
            $this->prop[$folder] = rcube_charset::convert($this->prop[$folder], RCUBE_CHARSET, 'UTF7-IMAP');
        if (!empty($this->prop['default_folders']))
            foreach ($this->prop['default_folders'] as $n => $folder)
                $this->prop['default_folders'][$n] = rcube_charset::convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
                $this->prop['default_folders'][$n] = rcube_charset::convert($folder, RCUBE_CHARSET, 'UTF7-IMAP');
        // set PHP error logging according to config
        if ($this->prop['debug_level'] & 1) {
program/lib/Roundcube/rcube_contacts.php
@@ -698,7 +698,7 @@
        if ($sql_arr['vcard']) {
            unset($sql_arr['email']);
            $vcard = new rcube_vcard($sql_arr['vcard'], RCMAIL_CHARSET, false, $this->vcard_fieldmap);
            $vcard = new rcube_vcard($sql_arr['vcard'], RCUBE_CHARSET, false, $this->vcard_fieldmap);
            $record += $vcard->get_assoc() + $sql_arr;
        }
        else {
@@ -717,7 +717,7 @@
        $words = '';
        // copy values into vcard object
        $vcard = new rcube_vcard($record['vcard'] ? $record['vcard'] : $save_data['vcard'], RCMAIL_CHARSET, false, $this->vcard_fieldmap);
        $vcard = new rcube_vcard($record['vcard'] ? $record['vcard'] : $save_data['vcard'], RCUBE_CHARSET, false, $this->vcard_fieldmap);
        $vcard->reset();
        foreach ($save_data as $key => $values) {
            list($field, $section) = explode(':', $key);
program/lib/Roundcube/rcube_csv2vcard.php
@@ -265,7 +265,7 @@
        // convert to UTF-8
        $head     = substr($csv, 0, 4096);
        $fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1'); // fallback to Latin-1?
        $charset  = rcube_charset::detect($head, RCMAIL_CHARSET);
        $charset  = rcube_charset::detect($head, RCUBE_CHARSET);
        $csv      = rcube_charset::convert($csv, $charset);
        $head     = '';
program/lib/Roundcube/rcube_mime.php
@@ -59,7 +59,7 @@
            return $charset;
        }
        return RCMAIL_CHARSET;
        return RCUBE_CHARSET;
    }
@@ -572,8 +572,9 @@
     */
    public static function wordwrap($string, $width=75, $break="\n", $cut=false, $charset=null)
    {
        if ($charset && function_exists('mb_internal_encoding'))
        if ($charset && function_exists('mb_internal_encoding')) {
            mb_internal_encoding($charset);
        }
        $para   = preg_split('/\r?\n/', $string);
        $string = '';
@@ -629,8 +630,9 @@
            }
        }
        if ($charset && function_exists('mb_internal_encoding'))
            mb_internal_encoding(RCMAIL_CHARSET);
        if ($charset && function_exists('mb_internal_encoding')) {
            mb_internal_encoding(RCUBE_CHARSET);
        }
        return $string;
    }
program/lib/Roundcube/rcube_output.php
@@ -34,7 +34,7 @@
    protected $app;
    protected $config;
    protected $charset = RCMAIL_CHARSET;
    protected $charset = RCUBE_CHARSET;
    protected $env = array();
    protected $pagetitle = '';
    protected $object_handlers = array();
program/lib/Roundcube/rcube_output_html.php
@@ -1364,8 +1364,8 @@
        // trigger hook with final HTML content to be sent
        $hook = $this->app->plugins->exec_hook("send_page", array('content' => $output));
        if (!$hook['abort']) {
            if ($this->charset != RCMAIL_CHARSET) {
                echo rcube_charset::convert($hook['content'], RCMAIL_CHARSET, $this->charset);
            if ($this->charset != RCUBE_CHARSET) {
                echo rcube_charset::convert($hook['content'], RCUBE_CHARSET, $this->charset);
            }
            else {
                echo $hook['content'];
program/lib/Roundcube/rcube_spellchecker.php
@@ -150,7 +150,7 @@
    function get_xml()
    {
        // send output
        $out = '<?xml version="1.0" encoding="'.RCMAIL_CHARSET.'"?><spellresult charschecked="'.mb_strlen($this->content).'">';
        $out = '<?xml version="1.0" encoding="'.RCUBE_CHARSET.'"?><spellresult charschecked="'.mb_strlen($this->content).'">';
        foreach ($this->matches as $item) {
            $out .= '<c o="'.$item[1].'" l="'.$item[2].'">';
@@ -178,7 +178,7 @@
                $word = $item[0];
            }
            else {
                $word = mb_substr($this->content, $item[1], $item[2], RCMAIL_CHARSET);
                $word = mb_substr($this->content, $item[1], $item[2], RCUBE_CHARSET);
            }
            $result[$word] = is_array($item[4]) ? implode("\t", $item[4]) : $item[4];
        }
@@ -326,7 +326,7 @@
                return;
            }
            $this->plink = pspell_new($this->lang, null, null, RCMAIL_CHARSET, PSPELL_FAST);
            $this->plink = pspell_new($this->lang, null, null, RCUBE_CHARSET, PSPELL_FAST);
        }
        if (!$this->plink) {
@@ -387,7 +387,7 @@
            || !empty($this->options['ignore_caps']) || !empty($this->options['dictionary'])
        ) {
            foreach ($matches as $idx => $m) {
                $word = mb_substr($text, $m[1], $m[2], RCMAIL_CHARSET);
                $word = mb_substr($text, $m[1], $m[2], RCUBE_CHARSET);
                // skip  exceptions
                if ($this->is_exception($word)) {
                    unset($matches[$idx]);
@@ -416,7 +416,7 @@
        $result = array();
        foreach ($matches as $m) {
            $result[] = mb_substr($text, $m[1], $m[2], RCMAIL_CHARSET);
            $result[] = mb_substr($text, $m[1], $m[2], RCUBE_CHARSET);
        }
        return $result;
program/lib/Roundcube/rcube_vcard.php
@@ -70,7 +70,7 @@
  /**
   * Constructor
   */
  public function __construct($vcard = null, $charset = RCMAIL_CHARSET, $detect = false, $fieldmap = array())
  public function __construct($vcard = null, $charset = RCUBE_CHARSET, $detect = false, $fieldmap = array())
  {
    if (!empty($fielmap))
      $this->extend_fieldmap($fieldmap);
@@ -87,7 +87,7 @@
   * @param string Charset of string values
   * @param boolean True if loading a 'foreign' vcard and extra heuristics for charset detection is required
   */
  public function load($vcard, $charset = RCMAIL_CHARSET, $detect = false)
  public function load($vcard, $charset = RCUBE_CHARSET, $detect = false)
  {
    self::$values_decoded = false;
    $this->raw = self::vcard_decode($vcard);
@@ -98,7 +98,7 @@
    }
    // vcard has encoded values and charset should be detected
    else if ($detect && self::$values_decoded &&
      ($detected_charset = self::detect_encoding(self::vcard_encode($this->raw))) && $detected_charset != RCMAIL_CHARSET) {
      ($detected_charset = self::detect_encoding(self::vcard_encode($this->raw))) && $detected_charset != RCUBE_CHARSET) {
        $this->raw = self::charset_convert($this->raw, $detected_charset);
    }
@@ -436,10 +436,10 @@
    if (preg_match('/charset=/i', substr($data, 0, 2048)))
      $charset = null;
    // detect charset and convert to utf-8
    else if (($charset = self::detect_encoding($data)) && $charset != RCMAIL_CHARSET) {
    else if (($charset = self::detect_encoding($data)) && $charset != RCUBE_CHARSET) {
      $data = rcube_charset::convert($data, $charset);
      $data = preg_replace(array('/^[\xFE\xFF]{2}/', '/^\xEF\xBB\xBF/', '/^\x00+/'), '', $data); // also remove BOM
      $charset = RCMAIL_CHARSET;
      $charset = RCUBE_CHARSET;
    }
    $vcard_block = '';