Define RCUBE_CHARSET in place of RCMAIL_CHARSET for naming consistency

pull/66/head
Aleksander Machniak 12 years ago
parent 581fe08a05
commit a92beb6bdb

@ -32,6 +32,7 @@ define('RCUBE_INPUT_POST', rcube_utils::INPUT_POST);
define('RCUBE_INPUT_GPC', rcube_utils::INPUT_GPC); define('RCUBE_INPUT_GPC', rcube_utils::INPUT_GPC);
define('JS_OBJECT_NAME', rcmail::JS_OBJECT_NAME); define('JS_OBJECT_NAME', rcmail::JS_OBJECT_NAME);
define('RCMAIL_CHARSET', RCUBE_CHARSET);
function get_table_name($table) function get_table_name($table)
{ {

@ -345,7 +345,7 @@ class rcmail extends rcube
$this->output->set_env('task', $this->task); $this->output->set_env('task', $this->task);
$this->output->set_env('action', $this->action); $this->output->set_env('action', $this->action);
$this->output->set_env('comm_path', $this->comm_path); $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 // add some basic labels to client
$this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing'); $this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing');

@ -49,7 +49,7 @@ foreach ($config as $optname => $optval) {
// framework constants // framework constants
define('RCUBE_VERSION', '0.9-git'); define('RCUBE_VERSION', '0.9-git');
define('RCMAIL_CHARSET', 'UTF-8'); define('RCUBE_CHARSET', 'UTF-8');
if (!defined('RCUBE_LIB_DIR')) { if (!defined('RCUBE_LIB_DIR')) {
define('RCUBE_LIB_DIR', dirname(__FILE__).'/'); define('RCUBE_LIB_DIR', dirname(__FILE__).'/');
@ -73,8 +73,8 @@ if (!defined('RCUBE_LOCALIZATION_DIR')) {
// set internal encoding for mbstring extension // set internal encoding for mbstring extension
if (extension_loaded('mbstring')) { if (extension_loaded('mbstring')) {
mb_internal_encoding(RCMAIL_CHARSET); mb_internal_encoding(RCUBE_CHARSET);
@mb_regex_encoding(RCMAIL_CHARSET); @mb_regex_encoding(RCUBE_CHARSET);
} }
// Register autoloader // Register autoloader

@ -335,7 +335,7 @@ class html
*/ */
public static function quote($str) public static function quote($str)
{ {
return @htmlspecialchars($str, ENT_COMPAT, RCMAIL_CHARSET); return @htmlspecialchars($str, ENT_COMPAT, RCUBE_CHARSET);
} }
} }

@ -379,7 +379,7 @@ class rcube
{ {
$storage = $this->get_storage(); $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')) { if ($default_folders = $this->config->get('default_folders')) {
$storage->set_default_folders($default_folders); $storage->set_default_folders($default_folders);

@ -169,7 +169,7 @@ class rcube_charset
* *
* @param string Input string * @param string Input string
* @param string Suspected charset of the 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 * @return string Converted string
*/ */
@ -180,7 +180,7 @@ class rcube_charset
static $mbstring_sch = null; static $mbstring_sch = null;
static $conv = null; static $conv = null;
$to = empty($to) ? RCMAIL_CHARSET : $to; $to = empty($to) ? RCUBE_CHARSET : $to;
$from = self::parse_charset($from); $from = self::parse_charset($from);
// It is a common case when UTF-16 charset is used with US-ASCII content (#1488654) // It is a common case when UTF-16 charset is used with US-ASCII content (#1488654)

@ -101,11 +101,11 @@ class rcube_config
// fix default imap folders encoding // fix default imap folders encoding
foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) 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'])) if (!empty($this->prop['default_folders']))
foreach ($this->prop['default_folders'] as $n => $folder) 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 // set PHP error logging according to config
if ($this->prop['debug_level'] & 1) { if ($this->prop['debug_level'] & 1) {

@ -698,7 +698,7 @@ class rcube_contacts extends rcube_addressbook
if ($sql_arr['vcard']) { if ($sql_arr['vcard']) {
unset($sql_arr['email']); 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; $record += $vcard->get_assoc() + $sql_arr;
} }
else { else {
@ -717,7 +717,7 @@ class rcube_contacts extends rcube_addressbook
$words = ''; $words = '';
// copy values into vcard object // 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(); $vcard->reset();
foreach ($save_data as $key => $values) { foreach ($save_data as $key => $values) {
list($field, $section) = explode(':', $key); list($field, $section) = explode(':', $key);

@ -265,7 +265,7 @@ class rcube_csv2vcard
// convert to UTF-8 // convert to UTF-8
$head = substr($csv, 0, 4096); $head = substr($csv, 0, 4096);
$fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1'); // fallback to Latin-1? $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); $csv = rcube_charset::convert($csv, $charset);
$head = ''; $head = '';

@ -59,7 +59,7 @@ class rcube_mime
return $charset; return $charset;
} }
return RCMAIL_CHARSET; return RCUBE_CHARSET;
} }
@ -572,8 +572,9 @@ class rcube_mime
*/ */
public static function wordwrap($string, $width=75, $break="\n", $cut=false, $charset=null) 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); mb_internal_encoding($charset);
}
$para = preg_split('/\r?\n/', $string); $para = preg_split('/\r?\n/', $string);
$string = ''; $string = '';
@ -629,8 +630,9 @@ class rcube_mime
} }
} }
if ($charset && function_exists('mb_internal_encoding')) if ($charset && function_exists('mb_internal_encoding')) {
mb_internal_encoding(RCMAIL_CHARSET); mb_internal_encoding(RCUBE_CHARSET);
}
return $string; return $string;
} }

@ -34,7 +34,7 @@ abstract class rcube_output
protected $app; protected $app;
protected $config; protected $config;
protected $charset = RCMAIL_CHARSET; protected $charset = RCUBE_CHARSET;
protected $env = array(); protected $env = array();
protected $pagetitle = ''; protected $pagetitle = '';
protected $object_handlers = array(); protected $object_handlers = array();

@ -1364,8 +1364,8 @@ class rcube_output_html extends rcube_output
// trigger hook with final HTML content to be sent // trigger hook with final HTML content to be sent
$hook = $this->app->plugins->exec_hook("send_page", array('content' => $output)); $hook = $this->app->plugins->exec_hook("send_page", array('content' => $output));
if (!$hook['abort']) { if (!$hook['abort']) {
if ($this->charset != RCMAIL_CHARSET) { if ($this->charset != RCUBE_CHARSET) {
echo rcube_charset::convert($hook['content'], RCMAIL_CHARSET, $this->charset); echo rcube_charset::convert($hook['content'], RCUBE_CHARSET, $this->charset);
} }
else { else {
echo $hook['content']; echo $hook['content'];

@ -150,7 +150,7 @@ class rcube_spellchecker
function get_xml() function get_xml()
{ {
// send output // 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) { foreach ($this->matches as $item) {
$out .= '<c o="'.$item[1].'" l="'.$item[2].'">'; $out .= '<c o="'.$item[1].'" l="'.$item[2].'">';
@ -178,7 +178,7 @@ class rcube_spellchecker
$word = $item[0]; $word = $item[0];
} }
else { 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]; $result[$word] = is_array($item[4]) ? implode("\t", $item[4]) : $item[4];
} }
@ -326,7 +326,7 @@ class rcube_spellchecker
return; 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) { if (!$this->plink) {
@ -387,7 +387,7 @@ class rcube_spellchecker
|| !empty($this->options['ignore_caps']) || !empty($this->options['dictionary']) || !empty($this->options['ignore_caps']) || !empty($this->options['dictionary'])
) { ) {
foreach ($matches as $idx => $m) { 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 // skip exceptions
if ($this->is_exception($word)) { if ($this->is_exception($word)) {
unset($matches[$idx]); unset($matches[$idx]);
@ -416,7 +416,7 @@ class rcube_spellchecker
$result = array(); $result = array();
foreach ($matches as $m) { 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; return $result;

@ -70,7 +70,7 @@ class rcube_vcard
/** /**
* Constructor * 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)) if (!empty($fielmap))
$this->extend_fieldmap($fieldmap); $this->extend_fieldmap($fieldmap);
@ -87,7 +87,7 @@ class rcube_vcard
* @param string Charset of string values * @param string Charset of string values
* @param boolean True if loading a 'foreign' vcard and extra heuristics for charset detection is required * @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; self::$values_decoded = false;
$this->raw = self::vcard_decode($vcard); $this->raw = self::vcard_decode($vcard);
@ -98,7 +98,7 @@ class rcube_vcard
} }
// vcard has encoded values and charset should be detected // vcard has encoded values and charset should be detected
else if ($detect && self::$values_decoded && 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); $this->raw = self::charset_convert($this->raw, $detected_charset);
} }
@ -436,10 +436,10 @@ class rcube_vcard
if (preg_match('/charset=/i', substr($data, 0, 2048))) if (preg_match('/charset=/i', substr($data, 0, 2048)))
$charset = null; $charset = null;
// detect charset and convert to utf-8 // 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 = rcube_charset::convert($data, $charset);
$data = preg_replace(array('/^[\xFE\xFF]{2}/', '/^\xEF\xBB\xBF/', '/^\x00+/'), '', $data); // also remove BOM $data = preg_replace(array('/^[\xFE\xFF]{2}/', '/^\xEF\xBB\xBF/', '/^\x00+/'), '', $data); // also remove BOM
$charset = RCMAIL_CHARSET; $charset = RCUBE_CHARSET;
} }
$vcard_block = ''; $vcard_block = '';

Loading…
Cancel
Save