diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-12-22 14:12:15 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-12-22 14:12:15 +0100 |
commit | 6b2b2eca5fa48720c4e5b31b9aae200a185dfc0e (patch) | |
tree | 255d57cd06d970857334b3bdda21e5c511965ae1 | |
parent | 54029ea959b5f59447e3f0a01a453fd5fe0ba8fa (diff) |
Remove deprecated functions (these listed in bc.php file) usage
58 files changed, 883 insertions, 869 deletions
diff --git a/bin/cleandb.sh b/bin/cleandb.sh index ea905c873..3a3c2572e 100755 --- a/bin/cleandb.sh +++ b/bin/cleandb.sh @@ -48,7 +48,7 @@ $threshold = date('Y-m-d 00:00:00', time() - $days * 86400); foreach (array('contacts','contactgroups','identities') as $table) { - $sqltable = get_table_name($table); + $sqltable = $db->table_name($table); // also delete linked records // could be skipped for databases which respect foreign key constraints diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index 4a00d5f58..a0fd2efa9 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -268,7 +268,7 @@ class archive extends rcube_plugin $archive_type->add($this->gettext('archivetypefolder'), 'folder'); $args['blocks']['archive'] = array( - 'name' => Q(rcube_label('settingstitle', 'archive')), + 'name' => Q($this->gettext('settingstitle')), 'options' => array('archive_type' => array( 'title' => $this->gettext('archivetype'), 'content' => $archive_type->show($rcmail->config->get('archive_type')) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index cefbc4d14..dbf56e55f 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1870,7 +1870,7 @@ class rcmail extends rcube } $this->output->set_env('max_filesize', $max_filesize); - $max_filesize = self::show_bytes($max_filesize); + $max_filesize = $this->show_bytes($max_filesize); $this->output->set_env('filesizeerror', $this->gettext(array( 'name' => 'filesizeerror', 'vars' => array('size' => $max_filesize)))); diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 2d4aa0838..0da3e2c87 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -1618,11 +1618,12 @@ class rcube_ldap extends rcube_addressbook // special case: list groups from 'group_filters' config if ($vlv_page === null && !empty($this->prop['group_filters'])) { $groups = array(); + $rcube = rcube::get_instance(); // list regular groups configuration as special filter if (!empty($this->prop['groups']['filter'])) { $id = '__groups__'; - $groups[$id] = array('ID' => $id, 'name' => rcube_label('groups'), 'virtual' => true) + $this->prop['groups']; + $groups[$id] = array('ID' => $id, 'name' => $rcube->gettext('groups'), 'virtual' => true) + $this->prop['groups']; } foreach ($this->prop['group_filters'] as $id => $prop) { diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc index d4387194a..9af22ec35 100644 --- a/program/steps/addressbook/copy.inc +++ b/program/steps/addressbook/copy.inc @@ -25,8 +25,8 @@ if (!$OUTPUT->ajax_call) $cids = rcmail_get_cids(); -$target = get_input_value('_to', RCUBE_INPUT_POST); -$target_group = get_input_value('_togid', RCUBE_INPUT_POST); +$target = rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST); +$target_group = rcube_utils::get_input_value('_togid', rcube_utils::INPUT_POST); $success = 0; $errormsg = 'copyerror'; diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc index e8aafe5a9..b2aac8a71 100644 --- a/program/steps/addressbook/delete.inc +++ b/program/steps/addressbook/delete.inc @@ -61,8 +61,8 @@ foreach ($cids as $source => $cid) $error = 'contactdelerror'; } - $source = get_input_value('_source', RCUBE_INPUT_GPC); - $group = get_input_value('_gid', RCUBE_INPUT_GPC); + $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); + $group = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC); $OUTPUT->show_message($error, 'error'); $OUTPUT->command('list_contacts', $source, $group); @@ -126,8 +126,8 @@ $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result)); if (!empty($_SESSION['contact_undo'])) { $_SESSION['contact_undo']['ts'] = time(); - $msg = html::span(null, rcube_label('contactdeleted')) - . ' ' . html::a(array('onclick' => JS_OBJECT_NAME.".command('undo', '', this)"), rcube_label('undo')); + $msg = html::span(null, $RCMAIL->gettext('contactdeleted')) + . ' ' . html::a(array('onclick' => rcmail_output::JS_OBJECT_NAME.".command('undo', '', this)"), $RCMAIL->gettext('undo')); $OUTPUT->show_message($msg, 'confirmation', null, true, $undo_time); } diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index de78baa1b..b5f51d883 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -36,12 +36,12 @@ if ($RCMAIL->action == 'edit') { // editing not allowed here if ($CONTACTS->readonly || $record['readonly']) { $OUTPUT->show_message('sourceisreadonly'); - rcmail_overwrite_action('show'); + $RCMAIL->overwrite_action('show'); return; } } else { - $source = get_input_value('_source', RCUBE_INPUT_GPC); + $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); if (strlen($source)) { $CONTACTS = $RCMAIL->get_address_book($source, true); @@ -125,7 +125,7 @@ function rcmail_contact_editform($attrib) $form = array( 'contact' => array( - 'name' => rcube_label('properties'), + 'name' => $RCMAIL->gettext('properties'), 'content' => array( 'email' => array('size' => $i_size, 'visible' => true), 'phone' => array('size' => $i_size, 'visible' => true), @@ -135,7 +135,7 @@ function rcmail_contact_editform($attrib) ), ), 'personal' => array( - 'name' => rcube_label('personalinfo'), + 'name' => $RCMAIL->gettext('personalinfo'), 'content' => array( 'gender' => array('visible' => true), 'maidenname' => array('size' => $i_size), @@ -150,7 +150,7 @@ function rcmail_contact_editform($attrib) if (isset($CONTACT_COLTYPES['notes'])) { $form['notes'] = array( - 'name' => rcube_label('notes'), + 'name' => $RCMAIL->gettext('notes'), 'content' => array( 'notes' => array('size' => $t_cols, 'rows' => $t_rows, 'label' => false, 'visible' => true, 'limit' => 1), ), @@ -169,7 +169,7 @@ function rcmail_contact_editform($attrib) function rcmail_upload_photo_form($attrib) { - global $OUTPUT; + global $RCMAIL, $OUTPUT; // set defaults $attrib += array('id' => 'rcmUploadform', 'buttons' => 'yes'); @@ -179,7 +179,7 @@ function rcmail_upload_photo_form($attrib) $max_postsize = parse_bytes(ini_get('post_max_size')); if ($max_postsize && $max_postsize < $max_filesize) $max_filesize = $max_postsize; - $max_filesize = show_bytes($max_filesize); + $max_filesize = $RCMAIL->show_bytes($max_filesize); $hidden = new html_hiddenfield(array('name' => '_cid', 'value' => $GLOBALS['cid'])); $input = new html_inputfield(array('type' => 'file', 'name' => '_photo', 'size' => $attrib['size'])); @@ -189,10 +189,10 @@ function rcmail_upload_photo_form($attrib) $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'), $hidden->show() . html::div(null, $input->show()) . - html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . - (get_boolean($attrib['buttons']) ? html::div('buttons', - $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . - $button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('upload-photo', this.form)")) + html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . + (rcube_utils::get_boolean($attrib['buttons']) ? html::div('buttons', + $button->show($RCMAIL->gettext('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . + $button->show($RCMAIL->gettext('upload'), array('class' => 'button mainaction', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".command('upload-photo', this.form)")) ) : '') ) ); @@ -247,7 +247,7 @@ function rcmail_source_selector($attrib) $attrib['name'] = '_source'; $attrib['is_escaped'] = true; - $attrib['onchange'] = JS_OBJECT_NAME . ".command('save', 'reload', this.form)"; + $attrib['onchange'] = rcmail_output::JS_OBJECT_NAME . ".command('save', 'reload', this.form)"; $select = new html_select($attrib); diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc index 1e988feab..c112f08a3 100644 --- a/program/steps/addressbook/export.inc +++ b/program/steps/addressbook/export.inc @@ -140,7 +140,7 @@ else { } // send downlaod headers -header('Content-Type: text/x-vcard; charset='.RCMAIL_CHARSET); +header('Content-Type: text/x-vcard; charset='.RCUBE_CHARSET); header('Content-Disposition: attachment; filename="contacts.vcf"'); while ($result && ($row = $result->next())) { diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index f94d15338..db21be290 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -23,36 +23,36 @@ $SEARCH_MODS_DEFAULT = array('name'=>1, 'firstname'=>1, 'surname'=>1, 'email'=>1 // general definition of contact coltypes $CONTACT_COLTYPES = array( - 'name' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('name'), 'category' => 'main'), - 'firstname' => array('type' => 'text', 'size' => 19, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('firstname'), 'category' => 'main'), - 'surname' => array('type' => 'text', 'size' => 19, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('surname'), 'category' => 'main'), - 'email' => array('type' => 'text', 'size' => 40, 'maxlength' => 254, 'label' => rcube_label('email'), 'subtypes' => array('home','work','other'), 'category' => 'main'), - 'middlename' => array('type' => 'text', 'size' => 19, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('middlename'), 'category' => 'main'), - 'prefix' => array('type' => 'text', 'size' => 8, 'maxlength' => 20, 'limit' => 1, 'label' => rcube_label('nameprefix'), 'category' => 'main'), - 'suffix' => array('type' => 'text', 'size' => 8, 'maxlength' => 20, 'limit' => 1, 'label' => rcube_label('namesuffix'), 'category' => 'main'), - 'nickname' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('nickname'), 'category' => 'main'), - 'jobtitle' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('jobtitle'), 'category' => 'main'), - 'organization' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('organization'), 'category' => 'main'), - 'department' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('department'), 'category' => 'main'), - 'gender' => array('type' => 'select', 'limit' => 1, 'label' => rcube_label('gender'), 'options' => array('male' => rcube_label('male'), 'female' => rcube_label('female')), 'category' => 'personal'), - 'maidenname' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('maidenname'), 'category' => 'personal'), - 'phone' => array('type' => 'text', 'size' => 40, 'maxlength' => 20, 'label' => rcube_label('phone'), 'subtypes' => array('home','home2','work','work2','mobile','main','homefax','workfax','car','pager','video','assistant','other'), 'category' => 'main'), - 'address' => array('type' => 'composite', 'label' => rcube_label('address'), 'subtypes' => array('home','work','other'), 'childs' => array( - 'street' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('street'), 'category' => 'main'), - 'locality' => array('type' => 'text', 'size' => 28, 'maxlength' => 50, 'label' => rcube_label('locality'), 'category' => 'main'), - 'zipcode' => array('type' => 'text', 'size' => 8, 'maxlength' => 15, 'label' => rcube_label('zipcode'), 'category' => 'main'), - 'region' => array('type' => 'text', 'size' => 12, 'maxlength' => 50, 'label' => rcube_label('region'), 'category' => 'main'), - 'country' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('country'), 'category' => 'main'), + 'name' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('name'), 'category' => 'main'), + 'firstname' => array('type' => 'text', 'size' => 19, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('firstname'), 'category' => 'main'), + 'surname' => array('type' => 'text', 'size' => 19, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('surname'), 'category' => 'main'), + 'email' => array('type' => 'text', 'size' => 40, 'maxlength' => 254, 'label' => $RCMAIL->gettext('email'), 'subtypes' => array('home','work','other'), 'category' => 'main'), + 'middlename' => array('type' => 'text', 'size' => 19, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('middlename'), 'category' => 'main'), + 'prefix' => array('type' => 'text', 'size' => 8, 'maxlength' => 20, 'limit' => 1, 'label' => $RCMAIL->gettext('nameprefix'), 'category' => 'main'), + 'suffix' => array('type' => 'text', 'size' => 8, 'maxlength' => 20, 'limit' => 1, 'label' => $RCMAIL->gettext('namesuffix'), 'category' => 'main'), + 'nickname' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('nickname'), 'category' => 'main'), + 'jobtitle' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('jobtitle'), 'category' => 'main'), + 'organization' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('organization'), 'category' => 'main'), + 'department' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('department'), 'category' => 'main'), + 'gender' => array('type' => 'select', 'limit' => 1, 'label' => $RCMAIL->gettext('gender'), 'options' => array('male' => $RCMAIL->gettext('male'), 'female' => $RCMAIL->gettext('female')), 'category' => 'personal'), + 'maidenname' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('maidenname'), 'category' => 'personal'), + 'phone' => array('type' => 'text', 'size' => 40, 'maxlength' => 20, 'label' => $RCMAIL->gettext('phone'), 'subtypes' => array('home','home2','work','work2','mobile','main','homefax','workfax','car','pager','video','assistant','other'), 'category' => 'main'), + 'address' => array('type' => 'composite', 'label' => $RCMAIL->gettext('address'), 'subtypes' => array('home','work','other'), 'childs' => array( + 'street' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => $RCMAIL->gettext('street'), 'category' => 'main'), + 'locality' => array('type' => 'text', 'size' => 28, 'maxlength' => 50, 'label' => $RCMAIL->gettext('locality'), 'category' => 'main'), + 'zipcode' => array('type' => 'text', 'size' => 8, 'maxlength' => 15, 'label' => $RCMAIL->gettext('zipcode'), 'category' => 'main'), + 'region' => array('type' => 'text', 'size' => 12, 'maxlength' => 50, 'label' => $RCMAIL->gettext('region'), 'category' => 'main'), + 'country' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => $RCMAIL->gettext('country'), 'category' => 'main'), ), 'category' => 'main'), - 'birthday' => array('type' => 'date', 'size' => 12, 'maxlength' => 16, 'label' => rcube_label('birthday'), 'limit' => 1, 'render_func' => 'rcmail_format_date_col', 'category' => 'personal'), - 'anniversary' => array('type' => 'date', 'size' => 12, 'maxlength' => 16, 'label' => rcube_label('anniversary'), 'limit' => 1, 'render_func' => 'rcmail_format_date_col', 'category' => 'personal'), - 'website' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('website'), 'subtypes' => array('homepage','work','blog','profile','other'), 'category' => 'main'), - 'im' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('instantmessenger'), 'subtypes' => array('aim','icq','msn','yahoo','jabber','skype','other'), 'category' => 'main'), - 'notes' => array('type' => 'textarea', 'size' => 40, 'rows' => 15, 'maxlength' => 500, 'label' => rcube_label('notes'), 'limit' => 1), + 'birthday' => array('type' => 'date', 'size' => 12, 'maxlength' => 16, 'label' => $RCMAIL->gettext('birthday'), 'limit' => 1, 'render_func' => 'rcmail_format_date_col', 'category' => 'personal'), + 'anniversary' => array('type' => 'date', 'size' => 12, 'maxlength' => 16, 'label' => $RCMAIL->gettext('anniversary'), 'limit' => 1, 'render_func' => 'rcmail_format_date_col', 'category' => 'personal'), + 'website' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => $RCMAIL->gettext('website'), 'subtypes' => array('homepage','work','blog','profile','other'), 'category' => 'main'), + 'im' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => $RCMAIL->gettext('instantmessenger'), 'subtypes' => array('aim','icq','msn','yahoo','jabber','skype','other'), 'category' => 'main'), + 'notes' => array('type' => 'textarea', 'size' => 40, 'rows' => 15, 'maxlength' => 500, 'label' => $RCMAIL->gettext('notes'), 'limit' => 1), 'photo' => array('type' => 'image', 'limit' => 1, 'category' => 'main'), - 'assistant' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('assistant'), 'category' => 'personal'), - 'manager' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('manager'), 'category' => 'personal'), - 'spouse' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => rcube_label('spouse'), 'category' => 'personal'), + 'assistant' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('assistant'), 'category' => 'personal'), + 'manager' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('manager'), 'category' => 'personal'), + 'spouse' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('spouse'), 'category' => 'personal'), // TODO: define fields for vcards like GEO, KEY ); @@ -83,12 +83,12 @@ if (!$RCMAIL->action && !$OUTPUT->ajax_call) { $OUTPUT->set_env('writable_source', $writeable); $OUTPUT->set_env('compose_extwin', $RCMAIL->config->get('compose_extwin',false)); - $OUTPUT->set_pagetitle(rcube_label('addressbook')); + $OUTPUT->set_pagetitle($RCMAIL->gettext('addressbook')); $_SESSION['addressbooks_count'] = $count; $_SESSION['addressbooks_count_writeable'] = $writeable; // select address book - $source = get_input_value('_source', RCUBE_INPUT_GPC); + $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); // use first directory by default if (!strlen($source) || !isset($js_list[$source])) { @@ -115,7 +115,7 @@ function rcmail_contact_source($source=null, $init_env=false, $writable=false) global $RCMAIL, $OUTPUT, $CONTACT_COLTYPES, $PAGE_SIZE; if (!strlen($source)) { - $source = get_input_value('_source', RCUBE_INPUT_GPC); + $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); } // Get object @@ -129,7 +129,7 @@ function rcmail_contact_source($source=null, $init_env=false, $writable=false) $CONTACTS->set_page(isset($_SESSION['page']) ? $_SESSION['page'] : 1); if (!empty($_REQUEST['_gid'])) - $CONTACTS->set_group(get_input_value('_gid', RCUBE_INPUT_GPC)); + $CONTACTS->set_group(rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC)); if (!$init_env) return $CONTACTS; @@ -162,13 +162,13 @@ function rcmail_contact_source($source=null, $init_env=false, $writable=false) function rcmail_set_sourcename($abook) { - global $OUTPUT; + global $OUTPUT, $RCMAIL; // get address book name (for display) if ($abook && $_SESSION['addressbooks_count'] > 1) { $name = $abook->get_name(); if (!$name) { - $name = rcube_label('personaladrbook'); + $name = $RCMAIL->gettext('personaladrbook'); } $OUTPUT->set_env('sourcename', html_entity_decode($name, ENT_COMPAT, 'UTF-8')); } @@ -189,17 +189,17 @@ function rcmail_directory_list($attrib) 'id' => 'rcmli%s', 'class' => '%s', 'noclose' => true), html::a(array('href' => '%s', 'rel' => '%s', - 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); + 'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); $sources = (array) $OUTPUT->get_env('address_sources'); reset($sources); // currently selected source - $current = get_input_value('_source', RCUBE_INPUT_GPC); + $current = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); foreach ($sources as $j => $source) { $id = strval(strlen($source['id']) ? $source['id'] : $j); - $js_id = JQ($id); + $js_id = rcube::JQ($id); // set class name(s) $class_name = 'addressbook'; @@ -214,7 +214,7 @@ function rcmail_directory_list($attrib) $out .= sprintf($line_templ, rcube_utils::html_identifier($id, true), $class_name, - Q(rcmail_url(null, array('_source' => $id))), + rcube::Q($RCMAIL->url(array('_source' => $id))), $source['id'], $js_id, $name); @@ -229,13 +229,13 @@ function rcmail_directory_list($attrib) $line_templ = html::tag('li', array( 'id' => 'rcmli%s', 'class' => '%s'), html::a(array('href' => '#', 'rel' => 'S%s', - 'onclick' => "return ".JS_OBJECT_NAME.".command('listsearch', '%s', this)"), '%s')); + 'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('listsearch', '%s', this)"), '%s')); // Saved searches $sources = $RCMAIL->user->list_searches(rcube_user::SEARCH_ADDRESSBOOK); foreach ($sources as $j => $source) { $id = $source['id']; - $js_id = JQ($id); + $js_id = rcube::JQ($id); // set class name(s) $class_name = 'contactsearch'; @@ -248,7 +248,7 @@ function rcmail_directory_list($attrib) rcube_utils::html_identifier('S'.$id, true), $class_name, $id, - $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); + $js_id, (!empty($source['name']) ? rcube::Q($source['name']) : rcube::Q($id))); } $OUTPUT->set_env('contactgroups', $jsdata); @@ -275,7 +275,7 @@ function rcmail_contact_groups($args) 'id' => 'rcmli%s', 'class' => 'contactgroup'), html::a(array('href' => '#', 'rel' => '%s:%s', - 'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s')); + 'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s')); // append collapse/expand toggle and open a new <ul> $is_collapsed = strpos($RCMAIL->config->get('collapsed_abooks',''), '&'.rawurlencode($args['source']).'&') !== false; @@ -285,7 +285,7 @@ function rcmail_contact_groups($args) $groups_html .= sprintf($line_templ, rcube_utils::html_identifier('G' . $args['source'] . $group['ID'], true), $args['source'], $group['ID'], - $args['source'], $group['ID'], Q($group['name']) + $args['source'], $group['ID'], rcube::Q($group['name']) ); $args['jsdata']['G'.$args['source'].$group['ID']] = array( 'source' => $args['source'], 'id' => $group['ID'], @@ -304,7 +304,7 @@ function rcmail_contact_groups($args) // return the contacts list as HTML table function rcmail_contacts_list($attrib) { - global $CONTACTS, $OUTPUT; + global $RCMAIL, $CONTACTS, $OUTPUT; // define list of cols to be displayed $a_show_cols = array('name','action'); @@ -314,7 +314,7 @@ function rcmail_contacts_list($attrib) $attrib['id'] = 'rcmAddressList'; // create XHTML table - $out = rcube_table_output($attrib, array(), $a_show_cols, $CONTACTS->primary_key); + $out = $RCMAIL->table_output($attrib, array(), $a_show_cols, $CONTACTS->primary_key); // set client env $OUTPUT->add_gui_object('contactslist', $attrib['id']); @@ -330,7 +330,7 @@ function rcmail_contacts_list($attrib) function rcmail_js_contacts_list($result, $prefix='') { - global $OUTPUT; + global $OUTPUT, $RCMAIL; if (empty($result) || $result->count == 0) return; @@ -357,7 +357,7 @@ function rcmail_js_contacts_list($result, $prefix='') $val = ''; switch ($col) { case 'name': - $val = Q(rcube_addressbook::compose_list_name($row)); + $val = rcube::Q(rcube_addressbook::compose_list_name($row)); break; case 'action': @@ -365,8 +365,8 @@ function rcmail_js_contacts_list($result, $prefix='') $val = html::a(array( 'href' => '#list', 'rel' => $row['ID'], - 'title' => rcube_label('listgroup'), - 'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", JS_OBJECT_NAME, $source_id, $row['CID']), + 'title' => $RCMAIL->gettext('listgroup'), + 'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", rcmail_output::JS_OBJECT_NAME, $source_id, $row['CID']), ), '»'); } else @@ -374,7 +374,7 @@ function rcmail_js_contacts_list($result, $prefix='') break; default: - $val = Q($row[$col]); + $val = rcube::Q($row[$col]); break; } @@ -391,7 +391,7 @@ function rcmail_js_contacts_list($result, $prefix='') function rcmail_contacts_list_title($attrib) { - global $OUTPUT; + global $OUTPUT, $RCMAIL; $attrib += array('label' => 'contacts', 'id' => 'rcmabooklisttitle', 'tag' => 'span'); unset($attrib['name']); @@ -399,7 +399,7 @@ function rcmail_contacts_list_title($attrib) $OUTPUT->add_gui_object('addresslist_title', $attrib['id']); $OUTPUT->add_label('contacts'); - return html::tag($attrib['tag'], $attrib, rcube_label($attrib['label']), html::$common_attrib); + return html::tag($attrib['tag'], $attrib, $RCMAIL->gettext($attrib['label']), html::$common_attrib); } @@ -417,23 +417,23 @@ function rcmail_contact_frame($attrib) function rcmail_rowcount_display($attrib) { - global $OUTPUT; + global $RCMAIL; if (!$attrib['id']) $attrib['id'] = 'rcmcountdisplay'; - $OUTPUT->add_gui_object('countdisplay', $attrib['id']); + $RCMAIL->output->add_gui_object('countdisplay', $attrib['id']); if ($attrib['label']) $_SESSION['contactcountdisplay'] = $attrib['label']; - return html::span($attrib, rcube_label('loading')); + return html::span($attrib, $RCMAIL->gettext('loading')); } function rcmail_get_rowcount_text($result=null) { - global $CONTACTS, $PAGE_SIZE; + global $RCMAIL, $CONTACTS, $PAGE_SIZE; // read nr of contacts if (!$result) { @@ -441,9 +441,9 @@ function rcmail_get_rowcount_text($result=null) } if ($result->count == 0) - $out = rcube_label('nocontactsfound'); + $out = $RCMAIL->gettext('nocontactsfound'); else - $out = rcube_label(array( + $out = $RCMAIL->gettext(array( 'name' => $_SESSION['contactcountdisplay'] ? $_SESSION['contactcountdisplay'] : 'contactsfromto', 'vars' => array( 'from' => $result->first + 1, @@ -457,13 +457,15 @@ function rcmail_get_rowcount_text($result=null) function rcmail_get_type_label($type) { + global $RCMAIL; + $label = 'type'.$type; - if (rcube_label_exists($label, '*', $domain)) - return rcube_label($label, $domain); + if ($RCMAIL->text_exists($label, '*', $domain)) + return $RCMAIL->gettext($label, $domain); else if (preg_match('/\w+(\d+)$/', $label, $m) && ($label = preg_replace('/(\d+)$/', '', $label)) - && rcube_label_exists($label, '*', $domain)) - return rcube_label($label, $domain) . ' ' . $m[1]; + && $RCMAIL->text_exists($label, '*', $domain)) + return $RCMAIL->gettext($label, $domain) . ' ' . $m[1]; return ucfirst($type); } @@ -480,7 +482,7 @@ function rcmail_contact_form($form, $record, $attrib = null) $form = $plugin['form']; $record = $plugin['record']; $edit_mode = $RCMAIL->action != 'show'; - $del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => rcube_label('delete'))) : rcube_label('delete'); + $del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => $RCMAIL->gettext('delete'))) : $RCMAIL->gettext('delete'); unset($attrib['deleteicon']); $out = ''; @@ -507,7 +509,7 @@ function rcmail_contact_form($form, $record, $attrib = null) continue; $select_add = new html_select(array('class' => 'addfieldmenu', 'rel' => $section)); - $select_add->add(rcube_label('addfield'), ''); + $select_add->add($RCMAIL->gettext('addfield'), ''); // render head section with name fields (not a regular list of rows) if ($section == 'head') { @@ -539,7 +541,7 @@ function rcmail_contact_form($form, $record, $attrib = null) if ($RCMAIL->action == 'show') { if (!empty($record[$col])) - $fields .= html::span('namefield ' . $col, Q($record[$col])) . " "; + $fields .= html::span('namefield ' . $col, rcube::Q($record[$col])) . " "; } else { $colprop = (array)$fieldset['content'][$col] + (array)$coltypes[$col]; @@ -548,7 +550,7 @@ function rcmail_contact_form($form, $record, $attrib = null) $colprop['style'] = 'display:none'; $select_add->add($colprop['label'], $col); } - $fields .= rcmail_get_edit_field($col, $record[$col], $colprop, $colprop['type']); + $fields .= rcube_output::get_edit_field($col, $record[$col], $colprop, $colprop['type']); } } $content .= html::div($blockname, $fields); @@ -557,7 +559,7 @@ function rcmail_contact_form($form, $record, $attrib = null) if ($edit_mode) $content .= html::p('addfield', $select_add->show(null)); - $out .= html::tag('fieldset', $attrib, (!empty($fieldset['name']) ? html::tag('legend', null, Q($fieldset['name'])) : '') . $content) ."\n"; + $out .= html::tag('fieldset', $attrib, (!empty($fieldset['name']) ? html::tag('legend', null, rcube::Q($fieldset['name'])) : '') . $content) ."\n"; continue; } @@ -575,7 +577,7 @@ function rcmail_contact_form($form, $record, $attrib = null) // merge colprop with global coltype configuration $colprop += $coltypes[$field]; - $label = isset($colprop['label']) ? $colprop['label'] : rcube_label($col); + $label = isset($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col); // prepare subtype selector in edit mode if ($edit_mode && is_array($colprop['subtypes'])) { @@ -636,10 +638,10 @@ function rcmail_contact_form($form, $record, $attrib = null) if ($edit_mode) { if ($colprop['subtypes'] || $colprop['limit'] != 1) $cp['array'] = true; - $composite['{'.$childcol.'}'] = rcmail_get_edit_field($childcol, $childvalue, $cp, $cp['type']) . " "; + $composite['{'.$childcol.'}'] = rcube_output::get_edit_field($childcol, $childvalue, $cp, $cp['type']) . " "; } else { - $childval = $cp['render_func'] ? call_user_func($cp['render_func'], $childvalue, $childcol) : Q($childvalue); + $childval = $cp['render_func'] ? call_user_func($cp['render_func'], $childvalue, $childcol) : rcube::Q($childvalue); $composite['{'.$childcol.'}'] = html::span('data ' . $childcol, $childval) . " "; } $j++; @@ -666,7 +668,7 @@ function rcmail_contact_form($form, $record, $attrib = null) $val = rcmail_format_date_col($val); } - $val = rcmail_get_edit_field($col, $val, $colprop, $colprop['type']); + $val = rcube_output::get_edit_field($col, $val, $colprop, $colprop['type']); $coltypes[$field]['count']++; } else if ($colprop['render_func']) @@ -674,7 +676,7 @@ function rcmail_contact_form($form, $record, $attrib = null) else if (is_array($colprop['options']) && isset($colprop['options'][$val])) $val = $colprop['options'][$val]; else - $val = Q($val); + $val = rcube::Q($val); // use subtype as label if ($colprop['subtypes']) @@ -682,12 +684,12 @@ function rcmail_contact_form($form, $record, $attrib = null) // add delete button/link if ($edit_mode && !($colprop['visible'] && $colprop['limit'] == 1)) - $val .= html::a(array('href' => '#del', 'class' => 'contactfieldbutton deletebutton', 'title' => rcube_label('delete'), 'rel' => $col), $del_button); + $val .= html::a(array('href' => '#del', 'class' => 'contactfieldbutton deletebutton', 'title' => $RCMAIL->gettext('delete'), 'rel' => $col), $del_button); // display row with label if ($label) { $rows .= html::div('row', - html::div('contactfieldlabel label', $select_subtype ? $select_subtype->show($subtype) : Q($label)) . + html::div('contactfieldlabel label', $select_subtype ? $select_subtype->show($subtype) : rcube::Q($label)) . html::div('contactfieldcontent '.$colprop['type'], $val)); } else // row without label @@ -703,7 +705,7 @@ function rcmail_contact_form($form, $record, $attrib = null) // wrap rows in fieldgroup container if ($rows) { $content .= html::tag('fieldset', array('class' => 'contactfieldgroup ' . ($colprop['subtypes'] ? 'contactfieldgroupmulti ' : '') . 'contactcontroller' . $col, 'style' => ($rows ? null : 'display:none')), - ($colprop['subtypes'] ? html::tag('legend', null, Q($colprop['label'])) : ' ') . + ($colprop['subtypes'] ? html::tag('legend', null, rcube::Q($colprop['label'])) : ' ') . $rows); } } @@ -722,7 +724,7 @@ function rcmail_contact_form($form, $record, $attrib = null) } if ($content) - $out .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $content) ."\n"; + $out .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($fieldset['name'])) . $content) ."\n"; } if ($edit_mode) { @@ -792,7 +794,7 @@ function rcmail_contact_photo($attrib) function rcmail_format_date_col($val) { global $RCMAIL; - return format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false); + return $RCMAIL->format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false); } /** @@ -855,8 +857,8 @@ function rcmail_get_cids($filter = null) // forms. If _source is an empty string then the ID is a string // containing contact ID and source name in form: <ID>-<SOURCE> - $cid = get_input_value('_cid', RCUBE_INPUT_GPC); - $source = (string) get_input_value('_source', RCUBE_INPUT_GPC); + $cid = rcube_utils::get_input_value('_cid', rcube_utils::INPUT_GPC); + $source = (string) rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); if (is_array($cid)) { return $cid; diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc index 3b9288a2b..900e7ff9f 100644 --- a/program/steps/addressbook/groups.inc +++ b/program/steps/addressbook/groups.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -$source = get_input_value('_source', RCUBE_INPUT_GPC); +$source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); $CONTACTS = rcmail_contact_source($source); if ($CONTACTS->readonly || !$CONTACTS->groups) { @@ -28,7 +28,7 @@ if ($CONTACTS->readonly || !$CONTACTS->groups) { } if ($RCMAIL->action == 'group-addmembers') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = rcmail_get_cids($source))) { + if (($gid = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_POST)) && ($ids = rcmail_get_cids($source))) { $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source)); $CONTACTS->set_group($gid); @@ -55,7 +55,7 @@ if ($RCMAIL->action == 'group-addmembers') { } else if ($RCMAIL->action == 'group-delmembers') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = rcmail_get_cids($source))) { + if (($gid = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_POST)) && ($ids = rcmail_get_cids($source))) { $plugin = $RCMAIL->plugins->exec_hook('group_delmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source)); if (!$plugin['abort']) @@ -74,7 +74,7 @@ else if ($RCMAIL->action == 'group-delmembers') { } else if ($RCMAIL->action == 'group-create') { - if ($name = trim(get_input_value('_name', RCUBE_INPUT_POST, true))) { + if ($name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true))) { $plugin = $RCMAIL->plugins->exec_hook('group_create', array('name' => $name, 'source' => $source)); if (!$plugin['abort']) @@ -84,7 +84,7 @@ else if ($RCMAIL->action == 'group-create') { } if ($created && $OUTPUT->ajax_call) { - $created['name'] = Q($created['name']); + $created['name'] = rcube::Q($created['name']); $OUTPUT->show_message('groupcreated', 'confirmation'); $OUTPUT->command('insert_contact_group', array('source' => $source) + $created); } @@ -94,7 +94,7 @@ else if ($RCMAIL->action == 'group-create') { } else if ($RCMAIL->action == 'group-rename') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($name = trim(get_input_value('_name', RCUBE_INPUT_POST, true)))) { + if (($gid = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_POST)) && ($name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)))) { $plugin = $RCMAIL->plugins->exec_hook('group_rename', array('group_id' => $gid, 'name' => $name, 'source' => $source)); if (!$plugin['abort']) @@ -106,14 +106,14 @@ else if ($RCMAIL->action == 'group-rename') { if ($newname && $OUTPUT->ajax_call) { $OUTPUT->show_message('grouprenamed', 'confirmation'); $OUTPUT->command('update_contact_group', array( - 'source' => $source, 'id' => $gid, 'name' => Q($newname), 'newid' => $newgid)); + 'source' => $source, 'id' => $gid, 'name' => rcube::Q($newname), 'newid' => $newgid)); } else if (!$newname) $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); } else if ($RCMAIL->action == 'group-delete') { - if ($gid = get_input_value('_gid', RCUBE_INPUT_POST)) { + if ($gid = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_POST)) { $plugin = $RCMAIL->plugins->exec_hook('group_delete', array('group_id' => $gid, 'source' => $source)); if (!$plugin['abort']) diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 4cfa94778..c56ddf8f2 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -26,7 +26,7 @@ function rcmail_import_form($attrib) { global $RCMAIL, $OUTPUT; - $target = get_input_value('_target', RCUBE_INPUT_GPC); + $target = rcube_utils::get_input_value('_target', rcube_utils::INPUT_GPC); $attrib += array('id' => "rcmImportForm"); @@ -39,7 +39,7 @@ function rcmail_import_form($attrib) 'size' => 40, 'multiple' => 'multiple', )); - $form = html::p(null, html::label('rcmimportfile', rcube_label('importfromfile')) . $upload->show()); + $form = html::p(null, html::label('rcmimportfile', $RCMAIL->gettext('importfromfile')) . $upload->show()); $table = new html_table(array('cols' => 2)); // addressbook selector @@ -49,7 +49,7 @@ function rcmail_import_form($attrib) foreach ($writable_books as $book) $select->add($book['name'], $book['id']); - $table->add('title', html::label('rcmimporttarget', rcube_label('importtarget'))); + $table->add('title', html::label('rcmimporttarget', $RCMAIL->gettext('importtarget'))); $table->add(null, $select->show($target)); } else { @@ -60,18 +60,18 @@ function rcmail_import_form($attrib) // selector for group import options if (count($writable_books) >= 1 || $writable_books[0]->groups) { $select = new html_select(array('name' => '_groups', 'id' => 'rcmimportgroups', 'is_escaped' => true)); - $select->add(rcube_label('none'), '0'); - $select->add(rcube_label('importgroupsall'), '1'); - $select->add(rcube_label('importgroupsexisting'), '2'); + $select->add($RCMAIL->gettext('none'), '0'); + $select->add($RCMAIL->gettext('importgroupsall'), '1'); + $select->add($RCMAIL->gettext('importgroupsexisting'), '2'); - $table->add('title', html::label('rcmimportgroups', rcube_label('importgroups'))); - $table->add(null, $select->show(get_input_value('_groups', RCUBE_INPUT_GPC))); + $table->add('title', html::label('rcmimportgroups', $RCMAIL->gettext('importgroups'))); + $table->add(null, $select->show(rcube_utils::get_input_value('_groups', rcube_utils::INPUT_GPC))); } // checkbox to replace the entire address book $check_replace = new html_checkbox(array('name' => '_replace', 'value' => 1, 'id' => 'rcmimportreplace')); - $table->add('title', html::label('rcmimportreplace', rcube_label('importreplace'))); - $table->add(null, $check_replace->show(get_input_value('_replace', RCUBE_INPUT_GPC))); + $table->add('title', html::label('rcmimportreplace', $RCMAIL->gettext('importreplace'))); + $table->add(null, $check_replace->show(rcube_utils::get_input_value('_replace', rcube_utils::INPUT_GPC))); $form .= $table->show(array('id' => null) + $attrib); @@ -79,7 +79,7 @@ function rcmail_import_form($attrib) $OUTPUT->add_label('selectimportfile','importwait'); $OUTPUT->add_gui_object('importform', $attrib['id']); - $out = html::p(null, Q(rcube_label('importdesc'), 'show')); + $out = html::p(null, rcube::Q($RCMAIL->gettext('importdesc'), 'show')); $out .= $OUTPUT->form_tag(array( 'action' => $RCMAIL->url('import'), @@ -96,12 +96,12 @@ function rcmail_import_form($attrib) */ function rcmail_import_confirm($attrib) { - global $IMPORT_STATS; + global $IMPORT_STATS, $RCMAIL; $vars = get_object_vars($IMPORT_STATS); $vars['names'] = $vars['skipped_names'] = ''; - $content = html::p(null, rcube_label(array( + $content = html::p(null, $RCMAIL->gettext(array( 'name' => 'importconfirm', 'nr' => $IMPORT_STATS->inserted, 'vars' => $vars, @@ -111,7 +111,7 @@ function rcmail_import_confirm($attrib) $content .= html::p('em', join(', ', array_map('Q', $IMPORT_STATS->names))); if ($IMPORT_STATS->skipped) { - $content .= html::p(null, rcube_label(array( + $content .= html::p(null, $RCMAIL->gettext(array( 'name' => 'importconfirmskipped', 'nr' => $IMPORT_STATS->skipped, 'vars' => $vars, @@ -129,7 +129,7 @@ function rcmail_import_confirm($attrib) function rcmail_import_buttons($attrib) { global $IMPORT_STATS, $OUTPUT; - $target = get_input_value('_target', RCUBE_INPUT_GPC); + $target = rcube_utils::get_input_value('_target', rcube_utils::INPUT_GPC); $attrib += array('type' => 'input'); unset($attrib['name']); @@ -180,9 +180,9 @@ function rcmail_import_group_id($group_name, $CONTACTS, $create, &$import_groups $importstep = 'rcmail_import_form'; if (is_array($_FILES['_file'])) { - $replace = (bool)get_input_value('_replace', RCUBE_INPUT_GPC); - $target = get_input_value('_target', RCUBE_INPUT_GPC); - $with_groups = intval(get_input_value('_groups', RCUBE_INPUT_GPC)); + $replace = (bool)rcube_utils::get_input_value('_replace', rcube_utils::INPUT_GPC); + $target = rcube_utils::get_input_value('_target', rcube_utils::INPUT_GPC); + $with_groups = intval(rcube_utils::get_input_value('_groups', rcube_utils::INPUT_GPC)); $vcards = array(); $upload_error = null; @@ -232,7 +232,8 @@ if (is_array($_FILES['_file'])) { // no vcards detected if (!count($vcards)) { if ($upload_error == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { - $OUTPUT->show_message('filesizeerror', 'error', array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize'))))); + $size = $RCMAIL->show_bytes(parse_bytes(ini_get('upload_max_filesize'))); + $OUTPUT->show_message('filesizeerror', 'error', array('size' => $size)); } else if ($upload_error) { $OUTPUT->show_message('fileuploaderror', 'error'); @@ -276,7 +277,7 @@ if (is_array($_FILES['_file'])) { // We're using UTF8 internally $email = $vcard->email[0]; - $email = rcube_idn_to_utf8($email); + $email = rcube_utils::idn_to_utf8($email); if (!$replace) { $existing = null; @@ -330,7 +331,7 @@ if (is_array($_FILES['_file'])) { } -$OUTPUT->set_pagetitle(rcube_label('importcontacts')); +$OUTPUT->set_pagetitle($RCMAIL->gettext('importcontacts')); $OUTPUT->add_handlers(array( 'importstep' => $importstep, diff --git a/program/steps/addressbook/mailto.inc b/program/steps/addressbook/mailto.inc index c3cbcadca..fc6a38dc9 100644 --- a/program/steps/addressbook/mailto.inc +++ b/program/steps/addressbook/mailto.inc @@ -37,10 +37,10 @@ foreach ($cids as $source => $cid) if (!empty($_REQUEST['_gid']) && isset($_REQUEST['_source'])) { - $source = get_input_value('_source', RCUBE_INPUT_GPC); + $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); $CONTACTS = $RCMAIL->get_address_book($source); - $group_id = get_input_value('_gid', RCUBE_INPUT_GPC); + $group_id = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC); $group_data = $CONTACTS->get_group($group_id); // group has an email address assigned: use that diff --git a/program/steps/addressbook/move.inc b/program/steps/addressbook/move.inc index f8204e9ee..6a70e7bda 100644 --- a/program/steps/addressbook/move.inc +++ b/program/steps/addressbook/move.inc @@ -25,8 +25,8 @@ if (!$OUTPUT->ajax_call) { } $cids = rcmail_get_cids(); -$target = get_input_value('_to', RCUBE_INPUT_POST); -$target_group = get_input_value('_togid', RCUBE_INPUT_POST); +$target = rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST); +$target_group = rcube_utils::get_input_value('_togid', rcube_utils::INPUT_POST); $all = 0; $deleted = 0; diff --git a/program/steps/addressbook/photo.inc b/program/steps/addressbook/photo.inc index 658027de4..482185735 100644 --- a/program/steps/addressbook/photo.inc +++ b/program/steps/addressbook/photo.inc @@ -26,7 +26,7 @@ $source = key($cids); $cid = $cids ? array_shift($cids[$source]) : null; // read the referenced file -if (($file_id = get_input_value('_photo', RCUBE_INPUT_GPC)) && ($tempfile = $_SESSION['contacts']['files'][$file_id])) { +if (($file_id = rcube_utils::get_input_value('_photo', rcube_utils::INPUT_GPC)) && ($tempfile = $_SESSION['contacts']['files'][$file_id])) { $tempfile = $RCMAIL->plugins->exec_hook('attachment_display', $tempfile); if ($tempfile['status']) { if ($tempfile['data']) @@ -37,7 +37,7 @@ if (($file_id = get_input_value('_photo', RCUBE_INPUT_GPC)) && ($tempfile = $_SE } else { // by email, search for contact first - if ($email = get_input_value('_email', RCUBE_INPUT_GPC)) { + if ($email = rcube_utils::get_input_value('_email', rcube_utils::INPUT_GPC)) { foreach ($RCMAIL->get_address_sources() as $s) { $abook = $RCMAIL->get_address_book($s['id']); $result = $abook->search(array('email'), $email, 1, true, true, 'photo'); @@ -77,7 +77,7 @@ else { } // deliver alt image -if (!$data && ($alt_img = get_input_value('_alt', RCUBE_INPUT_GPC)) && is_file($alt_img)) { +if (!$data && ($alt_img = rcube_utils::get_input_value('_alt', rcube_utils::INPUT_GPC)) && is_file($alt_img)) { $data = file_get_contents($alt_img); } @@ -86,6 +86,6 @@ if (!$cid && $email) { $RCMAIL->output->future_expire_header(86400); } -header('Content-Type: ' . rc_image_content_type($data)); +header('Content-Type: ' . rcube_mime::image_content_type($data)); echo $data ? $data : file_get_contents('program/resources/blank.gif'); exit; diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index 7911802b9..c4935b7e7 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -20,19 +20,19 @@ */ $CONTACTS = rcmail_contact_source(null, true, true); -$cid = get_input_value('_cid', RCUBE_INPUT_POST); +$cid = rcube_utils::get_input_value('_cid', rcube_utils::INPUT_POST); $return_action = empty($cid) ? 'add' : 'edit'; // Source changed, display the form again if (!empty($_GET['_reload'])) { - rcmail_overwrite_action($return_action); + $RCMAIL->overwrite_action($return_action); return; } // cannot edit record if ($CONTACTS->readonly) { $OUTPUT->show_message('contactreadonly', 'error'); - rcmail_overwrite_action($return_action); + $RCMAIL->overwrite_action($return_action); return; } @@ -46,11 +46,11 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) { if ($colprop['childs']) { $values = array(); foreach ($colprop['childs'] as $childcol => $cp) { - $vals = get_input_value('_'.$childcol, RCUBE_INPUT_POST, true); + $vals = rcube_utils::get_input_value('_'.$childcol, rcube_utils::INPUT_POST, true); foreach ((array)$vals as $i => $val) $values[$i][$childcol] = $val; } - $subtypes = isset($_REQUEST['_subtype_' . $col]) ? (array)get_input_value('_subtype_' . $col, RCUBE_INPUT_POST) : array(''); + $subtypes = isset($_REQUEST['_subtype_' . $col]) ? (array)rcube_utils::get_input_value('_subtype_' . $col, rcube_utils::INPUT_POST) : array(''); foreach ($subtypes as $i => $subtype) { $suffix = $subtype ? ':'.$subtype : ''; if ($values[$i]) @@ -59,8 +59,8 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) { } // assign values and subtypes else if (is_array($_POST[$fname])) { - $values = get_input_value($fname, RCUBE_INPUT_POST, true); - $subtypes = get_input_value('_subtype_' . $col, RCUBE_INPUT_POST); + $values = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true); + $subtypes = rcube_utils::get_input_value('_subtype_' . $col, rcube_utils::INPUT_POST); foreach ($values as $i => $val) { if ($col == 'email') { @@ -76,7 +76,7 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) { } } else if (isset($_POST[$fname])) { - $a_record[$col] = get_input_value($fname, RCUBE_INPUT_POST, true); + $a_record[$col] = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true); // normalize the submitted date strings if ($colprop['type'] == 'date') { @@ -103,9 +103,9 @@ if (empty($a_record['name'])) { // do input checks (delegated to $CONTACTS instance) if (!$CONTACTS->validate($a_record)) { $err = (array)$CONTACTS->get_error(); - $OUTPUT->show_message($err['message'] ? Q($err['message']) : 'formincomplete', 'warning'); + $OUTPUT->show_message($err['message'] ? rcube::Q($err['message']) : 'formincomplete', 'warning'); $GLOBALS['EDIT_RECORD'] = $a_record; // store submitted data to be used in edit form - rcmail_overwrite_action($return_action); + $RCMAIL->overwrite_action($return_action); return; } @@ -127,7 +127,7 @@ if (isset($a_record['photo'])) { $RCMAIL->session->remove('contacts'); } -$source = get_input_value('_source', RCUBE_INPUT_GPC); +$source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); // update an existing contact if (!empty($cid)) @@ -156,27 +156,27 @@ if (!empty($cid)) $record['name'] = rcube_addressbook::compose_list_name($record); foreach (array('name') as $col) - $a_js_cols[] = Q((string)$record[$col]); + $a_js_cols[] = rcube::Q((string)$record[$col]); // update the changed col in list $OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source, $record); // show confirmation $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); - rcmail_overwrite_action('show'); + $RCMAIL->overwrite_action('show'); } else { // show error message $err = $CONTACTS->get_error(); $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($err['message'] ? $err['message'] : 'errorsaving'), 'error', null, false); - rcmail_overwrite_action('show'); + $RCMAIL->overwrite_action('show'); } } // insert a new contact else { // Name of the addressbook already selected on the list - $orig_source = get_input_value('_orig_source', RCUBE_INPUT_GPC); + $orig_source = rcube_utils::get_input_value('_orig_source', rcube_utils::INPUT_GPC); if (!strlen($source)) $source = $orig_source; @@ -225,7 +225,7 @@ else { $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id); rcmail_js_contacts_list($result, 'parent.'); - $OUTPUT->command('parent.contact_list.select', html_identifier($insert_id)); + $OUTPUT->command('parent.contact_list.select', rcube_utils::html_identifier($insert_id)); // update record count display $CONTACTS->reset(); @@ -244,6 +244,6 @@ else { // show error message $err = $CONTACTS->get_error(); $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($err['message'] ? $err['message'] : 'errorsaving'), 'error', null, false); - rcmail_overwrite_action('add'); + $RCMAIL->overwrite_action('add'); } } diff --git a/program/steps/addressbook/search.inc b/program/steps/addressbook/search.inc index d153c255a..bb22ec139 100644 --- a/program/steps/addressbook/search.inc +++ b/program/steps/addressbook/search.inc @@ -22,8 +22,8 @@ */ if ($RCMAIL->action == 'search-create') { - $id = get_input_value('_search', RCUBE_INPUT_POST); - $name = get_input_value('_name', RCUBE_INPUT_POST, true); + $id = rcube_utils::get_input_value('_search', rcube_utils::INPUT_POST); + $name = rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true); if (($params = $_SESSION['search_params']) && $params['id'] == $id) { @@ -46,7 +46,7 @@ if ($RCMAIL->action == 'search-create') { if ($result) { $OUTPUT->show_message('savedsearchcreated', 'confirmation'); - $OUTPUT->command('insert_saved_search', Q($name), Q($result)); + $OUTPUT->command('insert_saved_search', rcube::Q($name), rcube::Q($result)); } else $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'savedsearchcreateerror', 'error'); @@ -55,7 +55,7 @@ if ($RCMAIL->action == 'search-create') { } if ($RCMAIL->action == 'search-delete') { - $id = get_input_value('_sid', RCUBE_INPUT_POST); + $id = rcube_utils::get_input_value('_sid', rcube_utils::INPUT_POST); $plugin = $RCMAIL->plugins->exec_hook('saved_search_delete', array('id' => $id)); @@ -66,9 +66,9 @@ if ($RCMAIL->action == 'search-delete') { if ($result) { $OUTPUT->show_message('savedsearchdeleted', 'confirmation'); - $OUTPUT->command('remove_search_item', Q($id)); + $OUTPUT->command('remove_search_item', rcube::Q($id)); // contact list will be cleared, clear also page counter - $OUTPUT->command('set_rowcount', rcube_label('nocontactsfound')); + $OUTPUT->command('set_rowcount', $RCMAIL->gettext('nocontactsfound')); $OUTPUT->set_env('pagecount', 0); } else @@ -91,7 +91,7 @@ function rcmail_contact_search() global $RCMAIL, $OUTPUT, $SEARCH_MODS_DEFAULT, $PAGE_SIZE; $adv = isset($_POST['_adv']); - $sid = get_input_value('_sid', RCUBE_INPUT_GET); + $sid = rcube_utils::get_input_value('_sid', rcube_utils::INPUT_GET); // get search criteria from saved search if ($sid && ($search = $RCMAIL->user->get_search($sid))) { @@ -101,7 +101,7 @@ function rcmail_contact_search() // get fields/values from advanced search form else if ($adv) { foreach (array_keys($_POST) as $key) { - $s = trim(get_input_value($key, RCUBE_INPUT_POST, true)); + $s = trim(rcube_utils::get_input_value($key, rcube_utils::INPUT_POST, true)); if (strlen($s) && preg_match('/^_search_([a-zA-Z0-9_-]+)$/', $key, $m)) { $search[] = $s; $fields[] = $m[1]; @@ -115,8 +115,8 @@ function rcmail_contact_search() } // quick-search else { - $search = trim(get_input_value('_q', RCUBE_INPUT_GET, true)); - $fields = explode(',', get_input_value('_headers', RCUBE_INPUT_GET)); + $search = trim(rcube_utils::get_input_value('_q', rcube_utils::INPUT_GET, true)); + $fields = explode(',', rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET)); if (empty($fields)) { $fields = array_keys($SEARCH_MODS_DEFAULT); @@ -257,17 +257,17 @@ function rcmail_contact_search_form($attrib) $form = array( 'main' => array( - 'name' => rcube_label('properties'), + 'name' => $RCMAIL->gettext('properties'), 'content' => array( ), ), 'personal' => array( - 'name' => rcube_label('personalinfo'), + 'name' => $RCMAIL->gettext('personalinfo'), 'content' => array( ), ), 'other' => array( - 'name' => rcube_label('other'), + 'name' => $RCMAIL->gettext('other'), 'content' => array( ), ), @@ -297,7 +297,7 @@ function rcmail_contact_search_form($attrib) if ($colprop['type'] != 'image' && !$colprop['nosearch']) { $ftype = $colprop['type'] == 'select' ? 'select' : 'text'; - $label = isset($colprop['label']) ? $colprop['label'] : rcube_label($col); + $label = isset($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col); $category = $colprop['category'] ? $colprop['category'] : 'other'; // load jquery UI datepicker for date fields @@ -307,8 +307,8 @@ function rcmail_contact_search_form($attrib) $colprop['size'] = $i_size; - $content = html::div('row', html::div('contactfieldlabel label', Q($label)) - . html::div('contactfieldcontent', rcmail_get_edit_field('search_'.$col, '', $colprop, $ftype))); + $content = html::div('row', html::div('contactfieldlabel label', rcube::Q($label)) + . html::div('contactfieldcontent', rcube_output::get_edit_field('search_'.$col, '', $colprop, $ftype))); $form[$category]['content'][] = $content; } @@ -332,7 +332,7 @@ function rcmail_contact_search_form($attrib) $content = html::div('contactfieldgroup', join("\n", $f['content'])); $out .= html::tag('fieldset', $attrib, - html::tag('legend', null, Q($f['name'])) + html::tag('legend', null, rcube::Q($f['name'])) . $content) . "\n"; } } diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc index 840023990..e6a515bd6 100644 --- a/program/steps/addressbook/show.inc +++ b/program/steps/addressbook/show.inc @@ -79,7 +79,7 @@ function rcmail_contact_details($attrib) $form = array( 'contact' => array( - 'name' => rcube_label('properties'), + 'name' => $RCMAIL->gettext('properties'), 'content' => array( 'email' => array('size' => $i_size, 'render_func' => 'rcmail_render_email_value'), 'phone' => array('size' => $i_size), @@ -89,7 +89,7 @@ function rcmail_contact_details($attrib) ), ), 'personal' => array( - 'name' => rcube_label('personalinfo'), + 'name' => $RCMAIL->gettext('personalinfo'), 'content' => array( 'gender' => array('size' => $i_size), 'maidenname' => array('size' => $i_size), @@ -101,19 +101,19 @@ function rcmail_contact_details($attrib) ), ), ); - + if (isset($CONTACT_COLTYPES['notes'])) { $form['notes'] = array( - 'name' => rcube_label('notes'), + 'name' => $RCMAIL->gettext('notes'), 'content' => array( 'notes' => array('type' => 'textarea', 'label' => false), ), ); } - + if ($CONTACTS->groups) { $form['groups'] = array( - 'name' => rcube_label('groups'), + 'name' => $RCMAIL->gettext('groups'), 'content' => rcmail_contact_record_groups($record['ID']), ); } @@ -124,12 +124,14 @@ function rcmail_contact_details($attrib) function rcmail_render_email_value($email) { + global $RCMAIL; + return html::a(array( 'href' => 'mailto:' . $email, - 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($email)), - 'title' => rcube_label('composeto'), + 'onclick' => sprintf("return %s.command('compose','%s',this)", rcmail_output::JS_OBJECT_NAME, rcube::JQ($email)), + 'title' => $RCMAIL->gettext('composeto'), 'class' => 'email', - ), Q($email)); + ), rcube::Q($email)); } @@ -140,7 +142,7 @@ function rcmail_render_url_value($url) 'href' => $prefix . $url, 'target' => '_blank', 'class' => 'url', - ), Q($url)); + ), rcube::Q($url)); } @@ -163,10 +165,10 @@ function rcmail_contact_record_groups($contact_id) $gid = $group['ID']; $table->add(null, $checkbox->show($members[$gid] ? $gid : null, array('value' => $gid, 'id' => 'ff_gid' . $gid))); - $table->add(null, html::label('ff_gid' . $gid, Q($group['name']))); + $table->add(null, html::label('ff_gid' . $gid, rcube::Q($group['name']))); } - $hiddenfields = new html_hiddenfield(array('name' => '_source', 'value' => get_input_value('_source', RCUBE_INPUT_GPC))); + $hiddenfields = new html_hiddenfield(array('name' => '_source', 'value' => rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC))); $hiddenfields->add(array('name' => '_cid', 'value' => $contact_id)); $form_start = $RCMAIL->output->request_form(array( diff --git a/program/steps/addressbook/upload_photo.inc b/program/steps/addressbook/upload_photo.inc index 035d67e83..dbb76d229 100644 --- a/program/steps/addressbook/upload_photo.inc +++ b/program/steps/addressbook/upload_photo.inc @@ -54,7 +54,7 @@ if ($filepath = $_FILES['_photo']['tmp_name']) { )); } else { - $attachment['error'] = rcube_label('invalidimageformat'); + $attachment['error'] = $RCMAIL->gettext('invalidimageformat'); } if ($attachment['status'] && !$attachment['abort']) { @@ -63,14 +63,16 @@ if ($filepath = $_FILES['_photo']['tmp_name']) { $OUTPUT->command('replace_contact_photo', $file_id); } else { // upload failed - $err = $_FILES['_photo']['error']; + $err = $_FILES['_photo']['error']; + $size = $RCMAIL->show_bytes(parse_bytes(ini_get('upload_max_filesize'))); + if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) - $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); + $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $size))); else if ($attachment['error']) $msg = $attachment['error']; else - $msg = rcube_label('fileuploaderror'); - + $msg = $RCMAIL->gettext('fileuploaderror'); + $OUTPUT->command('display_message', $msg, 'error'); } } @@ -78,9 +80,9 @@ else if ($_SERVER['REQUEST_METHOD'] == 'POST') { // if filesize exceeds post_max_size then $_FILES array is empty, // show filesizeerror instead of fileuploaderror if ($maxsize = ini_get('post_max_size')) - $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes($maxsize))))); + $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $RCMAIL->show_bytes(parse_bytes($maxsize))))); else - $msg = rcube_label('fileuploaderror'); + $msg = $RCMAIL->gettext('fileuploaderror'); $OUTPUT->command('display_message', $msg, 'error'); } diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc index 380557766..9d16e094b 100644 --- a/program/steps/mail/addcontact.inc +++ b/program/steps/mail/addcontact.inc @@ -28,7 +28,7 @@ $CONTACTS = $RCMAIL->get_address_book(-1, true); if (!empty($_POST['_address']) && is_object($CONTACTS)) { - $contact_arr = rcube_mime::decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false); + $contact_arr = rcube_mime::decode_address_list(rcube_utils::get_input_value('_address', rcube_utils::INPUT_POST, true), 1, false); if (!empty($contact_arr[1]['mailto'])) { $contact = array( @@ -42,13 +42,13 @@ if (!empty($_POST['_address']) && is_object($CONTACTS)) $OUTPUT->send(); } - $email = rcube_idn_to_ascii($contact['email']); - if (!check_email($email, false)) { + $email = rcube_utils::idn_to_ascii($contact['email']); + if (!rcube_utils::check_email($email, false)) { $OUTPUT->show_message('emailformaterror', 'error', array('email' => $contact['email'])); $OUTPUT->send(); } - $contact['email'] = rcube_idn_to_utf8($contact['email']); + $contact['email'] = rcube_utils::idn_to_utf8($contact['email']); $contact = $RCMAIL->plugins->exec_hook('contact_displayname', $contact); if (empty($contact['firstname']) || empty($contact['surname'])) diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc index 85aa9542b..f0ad97d20 100644 --- a/program/steps/mail/attachments.inc +++ b/program/steps/mail/attachments.inc @@ -21,10 +21,10 @@ // Upload progress update if (!empty($_GET['_progress'])) { - rcube_upload_progress(); + $RCMAIL->upload_progress(); } -$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC); +$COMPOSE_ID = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC); $COMPOSE = null; if ($COMPOSE_ID && $_SESSION['compose_data_' . $COMPOSE_ID]) { @@ -84,7 +84,7 @@ if ($RCMAIL->action=='display-attachment') // clear all stored output properties (like scripts and env vars) $OUTPUT->reset(); -$uploadid = get_input_value('_uploadid', RCUBE_INPUT_GET); +$uploadid = rcube_utils::get_input_value('_uploadid', rcube_utils::INPUT_GET); if (is_array($_FILES['_attachments']['tmp_name'])) { $multiple = count($_FILES['_attachments']['tmp_name']) > 1; @@ -98,7 +98,7 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { 'path' => $filepath, 'size' => $_FILES['_attachments']['size'][$i], 'name' => $_FILES['_attachments']['name'][$i], - 'mimetype' => rc_mime_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]), + 'mimetype' => rcube_mime::file_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]), 'group' => $COMPOSE_ID, ); @@ -115,11 +115,11 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { if (($icon = $COMPOSE['deleteicon']) && is_file($icon)) { $button = html::img(array( 'src' => $icon, - 'alt' => rcube_label('delete') + 'alt' => $RCMAIL->gettext('delete') )); } else if ($COMPOSE['textbuttons']) { - $button = Q(rcube_label('delete')); + $button = rcube::Q($RCMAIL->gettext('delete')); } else { $button = ''; @@ -127,29 +127,30 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { $content = html::a(array( 'href' => "#delete", - 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id), - 'title' => rcube_label('delete'), + 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", rcmail_output::JS_OBJECT_NAME, $id), + 'title' => $RCMAIL->gettext('delete'), 'class' => 'delete', ), $button); - $content .= Q($attachment['name']); + $content .= rcube::Q($attachment['name']); $OUTPUT->command('add2attachment_list', "rcmfile$id", array( 'html' => $content, 'name' => $attachment['name'], 'mimetype' => $attachment['mimetype'], - 'classname' => rcmail_filetype2classname($attachment['mimetype'], $attachment['name']), + 'classname' => rcube_utils::file2class($attachment['mimetype'], $attachment['name']), 'complete' => true), $uploadid); } else { // upload failed if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { - $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); + $size = $RCMAIL->show_bytes(parse_bytes(ini_get('upload_max_filesize'))); + $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $size))); } else if ($attachment['error']) { $msg = $attachment['error']; } else { - $msg = rcube_label('fileuploaderror'); + $msg = $RCMAIL->gettext('fileuploaderror'); } if ($attachment['error'] || $err != UPLOAD_ERR_NO_FILE) { @@ -163,9 +164,9 @@ else if ($_SERVER['REQUEST_METHOD'] == 'POST') { // if filesize exceeds post_max_size then $_FILES array is empty, // show filesizeerror instead of fileuploaderror if ($maxsize = ini_get('post_max_size')) - $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes($maxsize))))); + $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $RCMAIL->show_bytes(parse_bytes($maxsize))))); else - $msg = rcube_label('fileuploaderror'); + $msg = $RCMAIL->gettext('fileuploaderror'); $OUTPUT->command('display_message', $msg, 'error'); $OUTPUT->command('remove_from_attachment_list', $uploadid); } diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc index baf45f287..acc86229f 100644 --- a/program/steps/mail/autocomplete.inc +++ b/program/steps/mail/autocomplete.inc @@ -21,8 +21,8 @@ */ if ($RCMAIL->action == 'group-expand') { - $abook = $RCMAIL->get_address_book(get_input_value('_source', RCUBE_INPUT_GPC)); - if ($gid = get_input_value('_gid', RCUBE_INPUT_GPC)) { + $abook = $RCMAIL->get_address_book(rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC)); + if ($gid = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC)) { $members = array(); $abook->set_group($gid); $abook->set_pagesize(1000); // TODO: limit number of group members by config @@ -45,9 +45,9 @@ if ($RCMAIL->action == 'group-expand') { $MAXNUM = (int) $RCMAIL->config->get('autocomplete_max', 15); $mode = (int) $RCMAIL->config->get('addressbook_search_mode'); $single = (bool) $RCMAIL->config->get('autocomplete_single'); -$search = get_input_value('_search', RCUBE_INPUT_GPC, true); -$source = get_input_value('_source', RCUBE_INPUT_GPC); -$sid = get_input_value('_id', RCUBE_INPUT_GPC); +$search = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC, true); +$source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); +$sid = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC); if (strlen($source)) $book_types = array($source); diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index 8c0b1ffc0..3aa7b3e9c 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -65,7 +65,7 @@ foreach ($a_mailboxes as $mbox_name) { if ($status && $is_current) { // refresh saved search set - $search_request = get_input_value('_search', RCUBE_INPUT_GPC); + $search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC); if ($search_request && isset($_SESSION['search']) && $_SESSION['search_request'] == $search_request ) { @@ -73,7 +73,7 @@ foreach ($a_mailboxes as $mbox_name) { } if (!empty($_GET['_quota'])) - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS')); diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index aee31bb21..d5154ffed 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -26,7 +26,7 @@ define('RCUBE_COMPOSE_DRAFT', 'draft'); define('RCUBE_COMPOSE_EDIT', 'edit'); $MESSAGE_FORM = null; -$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GET); +$COMPOSE_ID = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GET); $COMPOSE = null; if ($COMPOSE_ID && $_SESSION['compose_data_'.$COMPOSE_ID]) @@ -47,14 +47,14 @@ if (!is_array($COMPOSE)) { // Infinite redirect prevention in case of broken session (#1487028) if ($COMPOSE_ID) - raise_error(array('code' => 500, 'type' => 'php', + rcube::raise_error(array('code' => 500, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Invalid compose ID"), true, true); $COMPOSE_ID = uniqid(mt_rand()); $_SESSION['compose_data_'.$COMPOSE_ID] = array( 'id' => $COMPOSE_ID, - 'param' => rcube_utils::request2param(RCUBE_INPUT_GET, 'task|action', true), + 'param' => rcube_utils::request2param(rcube_utils::INPUT_GET, 'task|action', true), 'mailbox' => $RCMAIL->storage->get_folder(), ); $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; @@ -74,7 +74,7 @@ if (!is_array($COMPOSE)) $attachment = array( 'group' => $COMPOSE_ID, 'name' => $filename, - 'mimetype' => rc_mime_content_type($attach, $filename), + 'mimetype' => rcube_mime::file_content_type($attach, $filename), 'path' => $attach, ); } @@ -114,7 +114,7 @@ $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubj $OUTPUT->set_env('compose_id', $COMPOSE['id']); $OUTPUT->set_env('session_id', session_id()); -$OUTPUT->set_pagetitle(rcube_label('compose')); +$OUTPUT->set_pagetitle($RCMAIL->gettext('compose')); // add config parameters to client script if (!empty($CONFIG['drafts_mbox'])) { @@ -127,7 +127,7 @@ $OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0); $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); // default font for HTML editor -$font = rcube_fontdefs($RCMAIL->config->get('default_font')); +$font = rcmail::font_defs($RCMAIL->config->get('default_font')); if ($font && !is_array($font)) { $OUTPUT->set_env('default_font', $font); } @@ -264,7 +264,7 @@ $MESSAGE->identities = $RCMAIL->user->list_identities(null, true); // Set From field value if (!empty($_POST['_from'])) { - $MESSAGE->compose['from'] = get_input_value('_from', RCUBE_INPUT_POST); + $MESSAGE->compose['from'] = rcube_utils::get_input_value('_from', rcube_utils::INPUT_POST); } else if (!empty($COMPOSE['param']['from'])) { $MESSAGE->compose['from'] = $COMPOSE['param']['from']; @@ -297,7 +297,7 @@ foreach ($parts as $header) { $COMPOSE['param']['to'] = $fvalue; } else if (!empty($_POST['_'.$header])) { - $fvalue = get_input_value('_'.$header, RCUBE_INPUT_POST, TRUE); + $fvalue = rcube_utils::get_input_value('_'.$header, rcube_utils::INPUT_POST, TRUE); } else if (!empty($COMPOSE['param'][$header])) { $fvalue = $COMPOSE['param'][$header]; @@ -376,7 +376,7 @@ foreach ($parts as $header) { if (empty($addr_part['mailto'])) continue; - $mailto = format_email(rcube_idn_to_utf8($addr_part['mailto'])); + $mailto = format_email(rcube_utils::idn_to_utf8($addr_part['mailto'])); if (!in_array($mailto, $a_recipients) && ( @@ -463,7 +463,7 @@ function rcmail_process_compose_params(&$COMPOSE) function rcmail_compose_headers($attrib) { - global $MESSAGE; + global $RCMAIL, $MESSAGE; list($form_start,) = get_form_tags($attrib); @@ -521,7 +521,7 @@ function rcmail_compose_headers($attrib) $out = $form_start.$out; // configure autocompletion - rcube_autocomplete_init(); + $RCMAIL->autocomplete_init(); return $out; } @@ -544,7 +544,7 @@ function rcmail_compose_header_from($attrib) $separator = intval($RCMAIL->config->get('reply_mode')) > 0 && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD) ? '---' : '-- '; - $field_attrib['onchange'] = JS_OBJECT_NAME.".change_identity(this)"; + $field_attrib['onchange'] = rcmail_output::JS_OBJECT_NAME.".change_identity(this)"; $select_from = new html_select($field_attrib); // create SELECT element @@ -563,7 +563,7 @@ function rcmail_compose_header_from($attrib) $text = trim($h2t->get_text()); } else { - $html = htmlentities($html, ENT_NOQUOTES, RCMAIL_CHARSET); + $html = htmlentities($html, ENT_NOQUOTES, RCUBE_CHARSET); } if (!preg_match('/^--[ -]\r?\n/m', $text)) { @@ -646,8 +646,8 @@ function rcmail_prepare_message_body() // use posted message body if (!empty($_POST['_message'])) { - $body = get_input_value('_message', RCUBE_INPUT_POST, true); - $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); + $body = rcube_utils::get_input_value('_message', rcube_utils::INPUT_POST, true); + $isHtml = (bool) rcube_utils::get_input_value('_is_html', rcube_utils::INPUT_POST); } else if ($COMPOSE['param']['body']) { $body = $COMPOSE['param']['body']; @@ -736,7 +736,7 @@ function rcmail_compose_part_body($part, $isHtml = false) // Check if we have enough memory to handle the message in it // #1487424: we need up to 10x more memory than the body - if (!rcmail_mem_check($part->size * 10)) { + if (!rcube_utils::mem_check($part->size * 10)) { return ''; } @@ -841,7 +841,7 @@ function rcmail_compose_body($attrib) // If desired, set this textarea to be editable by TinyMCE if ($isHtml) { - $MESSAGE_BODY = htmlentities($MESSAGE_BODY, ENT_NOQUOTES, RCMAIL_CHARSET); + $MESSAGE_BODY = htmlentities($MESSAGE_BODY, ENT_NOQUOTES, RCUBE_CHARSET); $attrib['class'] = 'mce_editor'; $attrib['is_escaped'] = true; $textarea = new html_textarea($attrib); @@ -861,7 +861,7 @@ function rcmail_compose_body($attrib) $OUTPUT->set_env('composebody', $attrib['id']); // include HTML editor - rcube_html_editor(); + $RCMAIL->html_editor(); // Set language list if (!empty($CONFIG['enable_spellcheck'])) { @@ -882,7 +882,7 @@ function rcmail_compose_body($attrib) $editor_lang_set = array(); foreach ($spellcheck_langs as $key => $name) { - $editor_lang_set[] = ($key == $lang ? '+' : '') . JQ($name).'='.JQ($key); + $editor_lang_set[] = ($key == $lang ? '+' : '') . rcube::JQ($name).'='.rcube::JQ($key); } // include GoogieSpell @@ -903,16 +903,16 @@ function rcmail_compose_body($attrib) $RCMAIL->output->get_skin_path(), $RCMAIL->url(array('_task' => 'utils', '_action' => 'spell', '_remote' => 1)), !empty($dictionary) ? 'true' : 'false', - JQ(Q(rcube_label('checkspelling'))), - JQ(Q(rcube_label('resumeediting'))), - JQ(Q(rcube_label('close'))), - JQ(Q(rcube_label('revertto'))), - JQ(Q(rcube_label('nospellerrors'))), - JQ(Q(rcube_label('addtodict'))), - json_serialize($spellcheck_langs), + rcube::JQ(rcube::Q($RCMAIL->gettext('checkspelling'))), + rcube::JQ(rcube::Q($RCMAIL->gettext('resumeediting'))), + rcube::JQ(rcube::Q($RCMAIL->gettext('close'))), + rcube::JQ(rcube::Q($RCMAIL->gettext('revertto'))), + rcube::JQ(rcube::Q($RCMAIL->gettext('nospellerrors'))), + rcube::JQ(rcube::Q($RCMAIL->gettext('addtodict'))), + rcube_output::json_serialize($spellcheck_langs), $lang, $attrib['id'], - JS_OBJECT_NAME), 'foot'); + rcmail_output::JS_OBJECT_NAME), 'foot'); $OUTPUT->add_label('checking'); $OUTPUT->set_env('spellcheck_langs', join(',', $editor_lang_set)); @@ -930,11 +930,11 @@ function rcmail_create_reply_body($body, $bodyIsHtml) // build reply prefix $from = array_pop(rcube_mime::decode_address_list($MESSAGE->get_header('from'), 1, false, $MESSAGE->headers->charset)); - $prefix = rcube_label(array( + $prefix = $RCMAIL->gettext(array( 'name' => 'mailreplyintro', 'vars' => array( - 'date' => format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long')), - 'sender' => $from['name'] ? $from['name'] : rcube_idn_to_utf8($from['mailto']), + 'date' => $RCMAIL->format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long')), + 'sender' => $from['name'] ? $from['name'] : rcube_utils::idn_to_utf8($from['mailto']), ) )); @@ -961,7 +961,7 @@ function rcmail_create_reply_body($body, $bodyIsHtml) $body = rcmail_wash_html($body, array('safe' => $MESSAGE->is_safe), $cid_map); // build reply (quote content) - $prefix = '<p>' . Q($prefix) . "</p>\n"; + $prefix = '<p>' . rcube::Q($prefix) . "</p>\n"; $prefix .= '<blockquote>'; if (intval($RCMAIL->config->get('reply_mode')) > 0) { // top-posting @@ -985,19 +985,19 @@ function rcmail_create_forward_body($body, $bodyIsHtml) if (!isset($COMPOSE['forward_attachments']) && is_array($MESSAGE->mime_parts)) $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml); - $date = format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long')); + $date = $RCMAIL->format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long')); if (!$bodyIsHtml) { - $prefix = "\n\n\n-------- " . rcube_label('originalmessage') . " --------\n"; - $prefix .= rcube_label('subject') . ': ' . $MESSAGE->subject . "\n"; - $prefix .= rcube_label('date') . ': ' . $date . "\n"; - $prefix .= rcube_label('from') . ': ' . $MESSAGE->get_header('from') . "\n"; - $prefix .= rcube_label('to') . ': ' . $MESSAGE->get_header('to') . "\n"; + $prefix = "\n\n\n-------- " . $RCMAIL->gettext('originalmessage') . " --------\n"; + $prefix .= $RCMAIL->gettext('subject') . ': ' . $MESSAGE->subject . "\n"; + $prefix .= $RCMAIL->gettext('date') . ': ' . $date . "\n"; + $prefix .= $RCMAIL->gettext('from') . ': ' . $MESSAGE->get_header('from') . "\n"; + $prefix .= $RCMAIL->gettext('to') . ': ' . $MESSAGE->get_header('to') . "\n"; if ($cc = $MESSAGE->headers->get('cc')) - $prefix .= rcube_label('cc') . ': ' . $cc . "\n"; + $prefix .= $RCMAIL->gettext('cc') . ': ' . $cc . "\n"; if (($replyto = $MESSAGE->headers->get('reply-to')) && $replyto != $MESSAGE->get_header('from')) - $prefix .= rcube_label('replyto') . ': ' . $replyto . "\n"; + $prefix .= $RCMAIL->gettext('replyto') . ': ' . $replyto . "\n"; $prefix .= "\n"; $body = trim($body, "\r\n"); @@ -1009,24 +1009,24 @@ function rcmail_create_forward_body($body, $bodyIsHtml) $body = rcmail_wash_html($body, array('safe' => $MESSAGE->is_safe), $cid_map); $prefix = sprintf( - "<br /><p>-------- " . rcube_label('originalmessage') . " --------</p>" . + "<br /><p>-------- " . $RCMAIL->gettext('originalmessage') . " --------</p>" . "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody>" . "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>" . "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>" . "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>" . "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>", - rcube_label('subject'), Q($MESSAGE->subject), - rcube_label('date'), Q($date), - rcube_label('from'), Q($MESSAGE->get_header('from'), 'replace'), - rcube_label('to'), Q($MESSAGE->get_header('to'), 'replace')); + $RCMAIL->gettext('subject'), rcube::Q($MESSAGE->subject), + $RCMAIL->gettext('date'), rcube::Q($date), + $RCMAIL->gettext('from'), rcube::Q($MESSAGE->get_header('from'), 'replace'), + $RCMAIL->gettext('to'), rcube::Q($MESSAGE->get_header('to'), 'replace')); if ($cc = $MESSAGE->headers->get('cc')) $prefix .= sprintf("<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>", - rcube_label('cc'), Q($cc, 'replace')); + $RCMAIL->gettext('cc'), rcube::Q($cc, 'replace')); if (($replyto = $MESSAGE->headers->get('reply-to')) && $replyto != $MESSAGE->get_header('from')) $prefix .= sprintf("<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>", - rcube_label('replyto'), Q($replyto, 'replace')); + $RCMAIL->gettext('replyto'), rcube::Q($replyto, 'replace')); $prefix .= "</tbody></table><br>"; } @@ -1330,7 +1330,7 @@ function rcmail_save_image($path, $mimetype='') $attachment = array( 'group' => $COMPOSE['id'], 'name' => $name, - 'mimetype' => $mimetype ? $mimetype : rc_mime_content_type($path, $name), + 'mimetype' => $mimetype ? $mimetype : rcube_mime::file_content_type($path, $name), 'data' => $data, 'size' => strlen($data), ); @@ -1370,7 +1370,7 @@ function rcmail_compose_subject($attrib) // use subject from post if (isset($_POST['_subject'])) { - $subject = get_input_value('_subject', RCUBE_INPUT_POST, TRUE); + $subject = rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE); } // create a reply-subject else if ($compose_mode == RCUBE_COMPOSE_REPLY) { @@ -1404,7 +1404,7 @@ function rcmail_compose_subject($attrib) function rcmail_compose_attachment_list($attrib) { - global $OUTPUT, $CONFIG, $COMPOSE; + global $RCMAIL, $OUTPUT, $CONFIG, $COMPOSE; // add ID if not given if (!$attrib['id']) @@ -1418,11 +1418,11 @@ function rcmail_compose_attachment_list($attrib) if ($attrib['deleteicon']) { $button = html::img(array( 'src' => $CONFIG['skin_path'] . $attrib['deleteicon'], - 'alt' => rcube_label('delete') + 'alt' => $RCMAIL->gettext('delete') )); } else if (rcube_utils::get_boolean($attrib['textbuttons'])) { - $button = Q(rcube_label('delete')); + $button = rcube::Q($RCMAIL->gettext('delete')); } foreach ($COMPOSE['attachments'] as $id => $a_prop) { @@ -1432,17 +1432,17 @@ function rcmail_compose_attachment_list($attrib) $out .= html::tag('li', array( 'id' => 'rcmfile'.$id, - 'class' => rcmail_filetype2classname($a_prop['mimetype'], $a_prop['name']), + 'class' => rcube_utils::file2class($a_prop['mimetype'], $a_prop['name']), 'onmouseover' => "rcube_webmail.long_subject_title_ex(this, 0)", ), html::a(array( 'href' => "#delete", - 'title' => rcube_label('delete'), - 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id), + 'title' => $RCMAIL->gettext('delete'), + 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", rcmail_output::JS_OBJECT_NAME, $id), 'class' => 'delete' ), $button - ) . Q($a_prop['name']) + ) . rcube::Q($a_prop['name']) ); $jslist['rcmfile'.$id] = array('name' => $a_prop['name'], 'complete' => true, 'mimetype' => $a_prop['mimetype']); @@ -1467,23 +1467,23 @@ function rcmail_compose_attachment_list($attrib) function rcmail_compose_attachment_form($attrib) { - global $OUTPUT; + global $OUTPUT, $RCMAIL; // set defaults $attrib += array('id' => 'rcmUploadbox', 'buttons' => 'yes'); // Get filesize, enable upload progress bar - $max_filesize = rcube_upload_init(); + $max_filesize = $RCMAIL->upload_init(); $button = new html_inputfield(array('type' => 'button')); $out = html::div($attrib, $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'), html::div(null, rcmail_compose_attachment_field()) . - html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . - (get_boolean($attrib['buttons']) ? html::div('buttons', - $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . - $button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)")) + html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . + (rcube_utils::get_boolean($attrib['buttons']) ? html::div('buttons', + $button->show($RCMAIL->gettext('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . + $button->show($RCMAIL->gettext('upload'), array('class' => 'button mainaction', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".command('send-attachment', this.form)")) ) : '') ) ); @@ -1506,7 +1506,7 @@ function rcmail_compose_attachment_field($attrib = array()) function rcmail_priority_selector($attrib) { - global $MESSAGE; + global $RCMAIL, $MESSAGE; list($form_start, $form_end) = get_form_tags($attrib); unset($attrib['form']); @@ -1514,11 +1514,11 @@ function rcmail_priority_selector($attrib) $attrib['name'] = '_priority'; $selector = new html_select($attrib); - $selector->add(array(rcube_label('lowest'), - rcube_label('low'), - rcube_label('normal'), - rcube_label('high'), - rcube_label('highest')), + $selector->add(array($RCMAIL->gettext('lowest'), + $RCMAIL->gettext('low'), + $RCMAIL->gettext('normal'), + $RCMAIL->gettext('high'), + $RCMAIL->gettext('highest')), array('5', '4', '0', '2', '1')); if (isset($_POST['_priority'])) @@ -1594,6 +1594,8 @@ function rcmail_dsn_checkbox($attrib) function rcmail_editor_selector($attrib) { + global $RCMAIL; + // determine whether HTML or plain text should be checked $useHtml = rcmail_compose_editor_mode(); @@ -1607,15 +1609,15 @@ function rcmail_editor_selector($attrib) $select = new html_select($attrib); - $select->add(Q(rcube_label('htmltoggle')), 'html'); - $select->add(Q(rcube_label('plaintoggle')), 'plain'); + $select->add(rcube::Q($RCMAIL->gettext('htmltoggle')), 'html'); + $select->add(rcube::Q($RCMAIL->gettext('plaintoggle')), 'plain'); return $select->show($useHtml ? 'html' : 'plain'); /* foreach ($choices as $value => $text) { $attrib['id'] = '_' . $value; $attrib['value'] = $value; - $selector .= $radio->show($chosenvalue, $attrib) . html::label($attrib['id'], Q(rcube_label($text))); + $selector .= $radio->show($chosenvalue, $attrib) . html::label($attrib['id'], rcube::Q($RCMAIL->gettext($text))); } return $selector; @@ -1625,11 +1627,11 @@ function rcmail_editor_selector($attrib) function rcmail_store_target_selection($attrib) { - global $COMPOSE; + global $COMPOSE, $RCMAIL; $attrib['name'] = '_store_target'; - $select = rcmail_mailbox_select(array_merge($attrib, array( - 'noselection' => '- '.rcube_label('dontsave').' -', + $select = $RCMAIL->folder_selector(array_merge($attrib, array( + 'noselection' => '- ' . $RCMAIL->gettext('dontsave') . ' -', 'folder_filter' => 'mail', 'folder_rights' => 'w', ))); @@ -1701,11 +1703,11 @@ function rcmail_addressbook_list($attrib = array()) 'id' => 'rcmli%s', 'class' => '%s'), html::a(array('href' => '#list', 'rel' => '%s', - 'onclick' => "return ".JS_OBJECT_NAME.".command('list-adresses','%s',this)"), '%s')); + 'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('list-adresses','%s',this)"), '%s')); foreach ($RCMAIL->get_address_sources(false, true) as $j => $source) { $id = strval(strlen($source['id']) ? $source['id'] : $j); - $js_id = JQ($id); + $js_id = rcube::JQ($id); // set class name(s) $class_name = 'addressbook'; @@ -1713,7 +1715,7 @@ function rcmail_addressbook_list($attrib = array()) $class_name .= ' ' . $source['class_name']; $out .= sprintf($line_templ, - html_identifier($id,true), + rcube_utils::html_identifier($id,true), $class_name, $source['id'], $js_id, (!empty($source['name']) ? $source['name'] : $id)); @@ -1727,7 +1729,7 @@ function rcmail_addressbook_list($attrib = array()) // return the contacts list as HTML table function rcmail_contacts_list($attrib = array()) { - global $OUTPUT; + global $RCMAIL, $OUTPUT; $attrib += array('id' => 'rcmAddressList'); @@ -1737,7 +1739,7 @@ function rcmail_contacts_list($attrib = array()) $OUTPUT->set_env('current_page', 0); $OUTPUT->include_script('list.js'); - return rcube_table_output($attrib, array(), array('name'), 'ID'); + return $RCMAIL->table_output($attrib, array(), array('name'), 'ID'); } @@ -1773,7 +1775,7 @@ function rcmail_compose_responses_list($attrib) 'class' => rtrim('insertresponse ' . $attrib['itemclass']), 'unselectable' => 'on', 'rel' => $key, - ), Q($response['name'])); + ), rcube::Q($response['name'])); $jsenv[$key] = $response; $list->add(array(), $item); diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc index 876657485..4cebae6c6 100644 --- a/program/steps/mail/copy.inc +++ b/program/steps/mail/copy.inc @@ -25,15 +25,15 @@ if (!$OUTPUT->ajax_call) // move messages if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { - $uids = get_input_value('_uid', RCUBE_INPUT_POST); - $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); - $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); + $uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); + $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); $copied = $RCMAIL->storage->copy_message($uids, $target, $mbox); if (!$copied) { // send error message - rcmail_display_server_error('errorcopying'); + $RCMAIL->display_server_error('errorcopying'); $OUTPUT->send(); exit; } @@ -43,7 +43,7 @@ if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { rcmail_send_unread_count($target, true); - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); } // unknown action or missing query param else { diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc index 574d6e975..d7cfd93f3 100644 --- a/program/steps/mail/folders.inc +++ b/program/steps/mail/folders.inc @@ -23,7 +23,7 @@ if (!$OUTPUT->ajax_call) return; -$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); +$mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); // send EXPUNGE command if ($RCMAIL->action == 'expunge') { @@ -35,14 +35,14 @@ if ($RCMAIL->action == 'expunge') { $OUTPUT->show_message('folderexpunged', 'confirmation'); if (!empty($_REQUEST['_reload'])) { - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); $OUTPUT->command('message_list.clear'); $RCMAIL->action = 'list'; return; } } else { - rcmail_display_server_error(); + $RCMAIL->display_server_error(); } } @@ -69,12 +69,12 @@ else if ($RCMAIL->action == 'purge') $OUTPUT->command('message_list.clear'); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text(), $mbox); $OUTPUT->command('set_unread_count', $mbox, 0); - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); rcmail_set_unseen_count($mbox, 0); } } else { - rcmail_display_server_error(); + $RCMAIL->display_server_error(); } } } diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index aefe1744c..00d66a0d0 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -32,7 +32,7 @@ $SEARCH_MODS_DEFAULT = array( $RCMAIL->storage_init(); // set imap properties and session vars -if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC, true)))) +if (strlen(trim($mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true)))) $RCMAIL->storage->set_folder(($_SESSION['mbox'] = $mbox)); else if ($RCMAIL->storage) $_SESSION['mbox'] = $RCMAIL->storage->get_folder(); @@ -78,7 +78,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { $search_request = md5($mbox_name.$_SESSION['search_filter']); - $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, rcmail_sort_column()); + $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET, rcmail_sort_column()); $_SESSION['search'] = $RCMAIL->storage->get_search_set(); $_SESSION['search_request'] = $search_request; $OUTPUT->set_env('search_request', $search_request); @@ -131,10 +131,10 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { // register UI objects $OUTPUT->add_handlers(array( - 'mailboxlist' => 'rcmail_mailbox_list', + 'mailboxlist' => array($RCMAIL, 'folder_list'), 'messages' => 'rcmail_message_list', 'messagecountdisplay' => 'rcmail_messagecount_display', - 'quotadisplay' => 'rcmail_quota_display', + 'quotadisplay' => array($RCMAIL, 'quota_display'), 'mailboxname' => 'rcmail_mailbox_name_display', 'messageheaders' => 'rcmail_message_headers', 'messagefullheaders' => 'rcmail_message_full_headers', @@ -249,7 +249,7 @@ function rcmail_message_list($attrib) $OUTPUT->set_env('col_movable', !in_array('list_cols', (array)$CONFIG['dont_override'])); } else { - $a_show_cols = preg_split('/[\s,;]+/', strip_quotes($attrib['columns'])); + $a_show_cols = preg_split('/[\s,;]+/', str_replace(array("'", '"'), '', $attrib['columns'])); $attrib['columns'] = $a_show_cols; } @@ -298,7 +298,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null } else { if (!is_array($a_show_cols)) - $a_show_cols = preg_split('/[\s,;]+/', strip_quotes($a_show_cols)); + $a_show_cols = preg_split('/[\s,;]+/', str_replace(array("'", '"'), '', $a_show_cols)); $head_replace = true; } @@ -357,15 +357,15 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null $cont = rcmail_address_string($header->$col_name, 3, false, null, $header->charset); else if ($col == 'subject') { $cont = trim(rcube_mime::decode_header($header->$col, $header->charset)); - if (!$cont) $cont = rcube_label('nosubject'); - $cont = Q($cont); + if (!$cont) $cont = $RCMAIL->gettext('nosubject'); + $cont = rcube::Q($cont); } else if ($col == 'size') $cont = show_bytes($header->$col); else if ($col == 'date') - $cont = format_date($header->date); + $cont = $RCMAIL->format_date($header->date); else - $cont = Q($header->$col); + $cont = rcube::Q($header->$col); $a_msg_cols[$col] = $cont; } @@ -386,7 +386,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null if ($header->priority) $a_msg_flags['prio'] = (int) $header->priority; - $a_msg_flags['ctype'] = Q($header->ctype); + $a_msg_flags['ctype'] = rcube::Q($header->ctype); $a_msg_flags['mbox'] = $mbox; // merge with plugin result (Deprecated, use $header->flags) @@ -435,14 +435,14 @@ function rcmail_message_list_head($attrib, $a_show_cols) $a_sort_cols = array('subject', 'date', 'from', 'to', 'fromto', 'size', 'cc'); if (!empty($attrib['optionsmenuicon'])) { - $onclick = 'return ' . JS_OBJECT_NAME . ".command('menu-open', 'messagelistmenu')"; + $onclick = 'return ' . rcmail_output::JS_OBJECT_NAME . ".command('menu-open', 'messagelistmenu')"; if ($attrib['optionsmenuicon'] === true || $attrib['optionsmenuicon'] == 'true') $list_menu = html::div(array('onclick' => $onclick, 'class' => 'listmenu', - 'id' => 'listmenulink', 'title' => rcube_label('listoptions'))); + 'id' => 'listmenulink', 'title' => $RCMAIL->gettext('listoptions'))); else $list_menu = html::a(array('href' => '#', 'onclick' => $onclick), html::img(array('src' => $skin_path . $attrib['optionsmenuicon'], - 'id' => 'listmenulink', 'title' => rcube_label('listoptions'))) + 'id' => 'listmenulink', 'title' => $RCMAIL->gettext('listoptions'))) ); } else @@ -470,15 +470,15 @@ function rcmail_message_list_head($attrib, $a_show_cols) $col_name = $list_menu; break; case 'fromto': - $col_name = Q(rcube_label($smart_col)); + $col_name = rcube::Q($RCMAIL->gettext($smart_col)); break; default: - $col_name = Q(rcube_label($col)); + $col_name = rcube::Q($RCMAIL->gettext($col)); } // make sort links if (in_array($col, $a_sort_cols)) - $col_name = html::a(array('href'=>"./#sort", 'onclick' => 'return '.JS_OBJECT_NAME.".command('sort','".$col."',this)", 'title' => rcube_label('sortby')), $col_name); + $col_name = html::a(array('href'=>"./#sort", 'onclick' => 'return '.rcmail_output::JS_OBJECT_NAME.".command('sort','".$col."',this)", 'title' => $RCMAIL->gettext('sortby')), $col_name); else if ($col_name[0] != '<') $col_name = '<span class="' . $col .'">' . $col_name . '</span>'; @@ -522,7 +522,7 @@ function rcmail_messagecount_display($attrib) $RCMAIL->output->add_gui_object('countdisplay', $attrib['id']); - $content = $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : rcube_label('loading'); + $content = $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : $RCMAIL->gettext('loading'); return html::span($attrib, $content); } @@ -545,14 +545,14 @@ function rcmail_get_messagecount_text($count=NULL, $page=NULL) $max = $RCMAIL->storage->count(NULL, $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL'); if ($max==0) - $out = rcube_label('mailboxempty'); + $out = $RCMAIL->gettext('mailboxempty'); else - $out = rcube_label(array('name' => $RCMAIL->storage->get_threading() ? 'threadsfromto' : 'messagesfromto', + $out = $RCMAIL->gettext(array('name' => $RCMAIL->storage->get_threading() ? 'threadsfromto' : 'messagesfromto', 'vars' => array('from' => $start_msg, 'to' => min($max, $start_msg + $page_size - 1), 'count' => $max))); - return Q($out); + return rcube::Q($out); } @@ -572,7 +572,7 @@ function rcmail_mailbox_name_display($attrib) function rcmail_get_mailbox_name_text() { global $RCMAIL; - return rcmail_localize_foldername($RCMAIL->storage->get_folder()); + return $RCMAIL->localize_foldername($RCMAIL->storage->get_folder()); } @@ -671,7 +671,7 @@ function rcmail_wash_html($html, $p, $cid_replaces) // charset was converted to UTF-8 in rcube_storage::get_message_part(), // change/add charset specification in HTML accordingly, // washtml cannot work without that - $meta = '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />'; + $meta = '<meta http-equiv="Content-Type" content="text/html; charset='.RCUBE_CHARSET.'" />'; // remove old meta tag and add the new one, making sure // that it is placed in the head (#1488093) @@ -686,7 +686,7 @@ function rcmail_wash_html($html, $p, $cid_replaces) 'show_washed' => false, 'allow_remote' => $p['safe'], 'blocked_src' => "./program/resources/blocked.gif", - 'charset' => RCMAIL_CHARSET, + 'charset' => RCUBE_CHARSET, 'cid_map' => $cid_replaces, 'html_elements' => array('body'), ); @@ -716,7 +716,7 @@ function rcmail_wash_html($html, $p, $cid_replaces) $washer->add_callback('style', 'rcmail_washtml_callback'); // Remove non-UTF8 characters (#1487813) - $html = rc_utf8_clean($html); + $html = rcube_charset::clean($html); $html = $washer->wash($html); $REMOTE_OBJECTS = $washer->extlinks; @@ -840,7 +840,7 @@ function rcmail_plain_body($body) $body = join("\n", $body); - // quote plain text (don't use Q() here, to display entities "as is") + // quote plain text (don't use rcube::Q() here, to display entities "as is") $table = get_html_translation_table(HTML_SPECIALCHARS); unset($table['?']); $body = strtr($body, $table); @@ -877,7 +877,7 @@ function rcmail_washtml_callback($tagname, $attrib, $content, $washtml) case 'style': // decode all escaped entities and reduce to ascii strings - $stripped = preg_replace('/[^a-zA-Z\(:;]/', '', rcmail_xss_entity_decode($content)); + $stripped = preg_replace('/[^a-zA-Z\(:;]/', '', rcube_utils::xss_entity_decode($content)); // now check for evil strings like expression, behavior or url() if (!preg_match('/expression|behavior|javascript:|import[^a]/i', $stripped)) { @@ -945,13 +945,13 @@ function rcmail_message_headers($attrib, $headers=null) if (in_array($hkey, $exclude_headers)) continue; - $header_title = rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)); + $header_title = $RCMAIL->gettext(preg_replace('/(^mail-|-)/', '', $hkey)); if ($hkey == 'date') { if ($PRINT_MODE) - $header_value = format_date($value, $RCMAIL->config->get('date_long', 'x')); + $header_value = $RCMAIL->format_date($value, $RCMAIL->config->get('date_long', 'x')); else - $header_value = format_date($value); + $header_value = $RCMAIL->format_date($value); } else if ($hkey == 'priority') { if ($value) { @@ -995,7 +995,7 @@ function rcmail_message_headers($attrib, $headers=null) $ishtml = true; } else if ($hkey == 'subject' && empty($value)) - $header_value = rcube_label('nosubject'); + $header_value = $RCMAIL->gettext('nosubject'); else $header_value = trim(rcube_mime::decode_header($value, $headers['charset'])); @@ -1012,14 +1012,14 @@ function rcmail_message_headers($attrib, $headers=null) // single header value is requested if (!empty($attrib['valueof'])) - return Q($plugin['output'][$attrib['valueof']]['value'], ($attrib['valueof'] == 'subject' ? 'strict' : 'show')); + return rcube::Q($plugin['output'][$attrib['valueof']]['value'], ($attrib['valueof'] == 'subject' ? 'strict' : 'show')); // compose html table $table = new html_table(array('cols' => 2)); foreach ($plugin['output'] as $hkey => $row) { - $table->add(array('class' => 'header-title'), Q($row['title'])); - $table->add(array('class' => 'header '.$hkey), $row['html'] ? $row['value'] : Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show'))); + $table->add(array('class' => 'header-title'), rcube::Q($row['title'])); + $table->add(array('class' => 'header '.$hkey), $row['html'] ? $row['value'] : rcube::Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show'))); } return $table->show($attrib); @@ -1030,6 +1030,8 @@ function rcmail_message_headers($attrib, $headers=null) */ function rcmail_localized_priority($value) { + global $RCMAIL; + $labels_map = array( '1' => 'highest', '2' => 'high', @@ -1039,7 +1041,7 @@ function rcmail_localized_priority($value) ); if ($value && $labels_map[$value]) - return rcube_label($labels_map[$value]); + return $RCMAIL->gettext($labels_map[$value]); return ''; } @@ -1049,10 +1051,10 @@ function rcmail_localized_priority($value) */ function rcmail_message_full_headers($attrib, $headers=NULL) { - global $OUTPUT; + global $OUTPUT, $RCMAIL; $html = html::div(array('id' => "all-headers", 'class' => "all", 'style' => 'display:none'), html::div(array('id' => 'headers-source'), '')); - $html .= html::div(array('class' => "more-headers show-headers", 'onclick' => "return ".JS_OBJECT_NAME.".command('show-headers','',this)", 'title' => rcube_label('togglefullheaders')), ''); + $html .= html::div(array('class' => "more-headers show-headers", 'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('show-headers','',this)", 'title' => $RCMAIL->gettext('togglefullheaders')), ''); $OUTPUT->add_gui_object('all_headers_row', 'all-headers'); $OUTPUT->add_gui_object('all_headers_box', 'headers-source'); @@ -1094,7 +1096,7 @@ function rcmail_message_body($attrib) // unsupported (e.g. encrypted) if ($part->realtype) { if ($part->realtype == 'multipart/encrypted' || $part->realtype == 'application/pkcs7-mime') { - $out .= html::span('part-notice', rcube_label('encryptedmessage')); + $out .= html::span('part-notice', $RCMAIL->gettext('encryptedmessage')); } continue; } @@ -1103,10 +1105,10 @@ function rcmail_message_body($attrib) } // Check if we have enough memory to handle the message in it // #1487424: we need up to 10x more memory than the body - else if (!rcmail_mem_check($part->size * 10)) { - $out .= html::span('part-notice', rcube_label('messagetoobig'). ' ' + else if (!rcube_utils::mem_check($part->size * 10)) { + $out .= html::span('part-notice', $RCMAIL->gettext('messagetoobig'). ' ' . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id - .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), rcube_label('download'))); + .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), $RCMAIL->gettext('download'))); continue; } @@ -1158,17 +1160,17 @@ function rcmail_message_body($attrib) else { // Check if we have enough memory to handle the message in it // #1487424: we need up to 10x more memory than the body - if (!rcmail_mem_check(strlen($MESSAGE->body) * 10)) { - $out .= html::span('part-notice', rcube_label('messagetoobig'). ' ' + if (!rcube_utils::mem_check(strlen($MESSAGE->body) * 10)) { + $out .= html::span('part-notice', $RCMAIL->gettext('messagetoobig'). ' ' . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part=0' - .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), rcube_label('download'))); + .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), $RCMAIL->gettext('download'))); } else { $plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', array( 'part' => $MESSAGE, 'prefix' => '')); $out .= html::div('message-part', $plugin['prefix'] . html::tag('pre', array(), - rcmail_plain_body(Q($MESSAGE->body, 'strict', false)))); + rcmail_plain_body(rcube::Q($MESSAGE->body, 'strict', false)))); } } @@ -1191,7 +1193,7 @@ function rcmail_message_body($attrib) 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), 'onclick' => sprintf( 'return %s.command(\'load-attachment\',\'%s\',this)', - JS_OBJECT_NAME, + rcmail_output::JS_OBJECT_NAME, $attach_prop->mime_id) ); $out .= html::p('image-attachment', @@ -1204,18 +1206,18 @@ function rcmail_message_body($attrib) 'style' => sprintf('max-width:%dpx; max-height:%dpx', $thumbnail_size, $thumbnail_size), )) ) . - html::span('image-filename', Q($attach_prop->filename)) . - html::span('image-filesize', Q($RCMAIL->message_part_size($attach_prop))) . + html::span('image-filename', rcube::Q($attach_prop->filename)) . + html::span('image-filesize', rcube::Q($RCMAIL->message_part_size($attach_prop))) . html::span('attachment-links', - (in_array($mimetype, $client_mimetypes) ? html::a($show_link, rcube_label('showattachment')) . ' ' : '') . - html::a($show_link['href'] . '&_download=1', rcube_label('download')) + (in_array($mimetype, $client_mimetypes) ? html::a($show_link, $RCMAIL->gettext('showattachment')) . ' ' : '') . + html::a($show_link['href'] . '&_download=1', $RCMAIL->gettext('download')) ) . html::br(array('style' => 'clear:both')) ); } else { $out .= html::tag('fieldset', 'image-attachment', - html::tag('legend', 'image-filename', Q($attach_prop->filename)) . + html::tag('legend', 'image-filename', rcube::Q($attach_prop->filename)) . html::p(array('align' => "center"), html::img(array( 'src' => $MESSAGE->get_part_url($attach_prop->mime_id, 'image'), @@ -1295,7 +1297,7 @@ function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null // replace all css definitions with #container [def] $styles = substr($body, $pos, $len); - $styles = rcmail_mod_css_styles($styles, $cont_id, $allow_remote); + $styles = rcube_utils::mod_css_styles($styles, $cont_id, $allow_remote); $body = substr_replace($body, $styles, $pos, $len); $last_style_pos = $pos2 + strlen($styles) - $len; @@ -1385,7 +1387,7 @@ function rcmail_alter_html_link($matches) global $RCMAIL; $tag = strtolower($matches[1]); - $attrib = parse_attrib_string($matches[2]); + $attrib = html::parse_attrib_string($matches[2]); $end = '>'; // Remove non-printable characters in URL (#1487805) @@ -1421,8 +1423,8 @@ function rcmail_alter_html_link($matches) $attrib['href'] = 'mailto:' . implode(',', $addresses); $attrib['onclick'] = sprintf( "return %s.command('compose','%s',this)", - JS_OBJECT_NAME, - JQ(implode(',', $mailto) . ($url ? "?$url" : ''))); + rcmail_output::JS_OBJECT_NAME, + rcube::JQ(implode(',', $mailto) . ($url ? "?$url" : ''))); } else { $attrib['href'] = '#NOP'; @@ -1477,7 +1479,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, $name = $part['name']; $mailto = $part['mailto']; $string = $part['string']; - $valid = check_email($mailto, false); + $valid = rcube_utils::check_email($mailto, false); // phishing email prevention (#1488981), e.g. "valid@email.addr <phishing@email.addr>" if (!$show_email && $valid && $name && $name != $mailto && strpos($name, '@')) { @@ -1486,27 +1488,27 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, // IDNA ASCII to Unicode if ($name == $mailto) - $name = rcube_idn_to_utf8($name); + $name = rcube_utils::idn_to_utf8($name); if ($string == $mailto) - $string = rcube_idn_to_utf8($string); - $mailto = rcube_idn_to_utf8($mailto); + $string = rcube_utils::idn_to_utf8($string); + $mailto = rcube_utils::idn_to_utf8($mailto); if ($PRINT_MODE) { - $address = sprintf('%s <%s>', Q($name), Q($mailto)); + $address = sprintf('%s <%s>', rcube::Q($name), rcube::Q($mailto)); } else if ($valid) { if ($linked) { $attrs = array( 'href' => 'mailto:' . $mailto, - 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ(format_email_recipient($mailto, $name))), + 'onclick' => sprintf("return %s.command('compose','%s',this)", rcmail_output::JS_OBJECT_NAME, rcube::JQ(format_email_recipient($mailto, $name))), 'class' => "rcmContactAddress", ); if ($show_email && $name && $mailto) { - $content = Q($name ? sprintf('%s <%s>', $name, $mailto) : $mailto); + $content = rcube::Q($name ? sprintf('%s <%s>', $name, $mailto) : $mailto); } else { - $content = Q($name ? $name : $mailto); + $content = rcube::Q($name ? $name : $mailto); $attrs['title'] = $mailto; } @@ -1514,14 +1516,14 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, } else { $address = html::span(array('title' => $mailto, 'class' => "rcmContactAddress"), - Q($name ? $name : $mailto)); + rcube::Q($name ? $name : $mailto)); } if ($addicon && $_SESSION['writeable_abook']) { $address .= html::a(array( 'href' => "#add", - 'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, JQ($string)), - 'title' => rcube_label('addtoaddressbook'), + 'onclick' => sprintf("return %s.command('add-contact','%s',this)", rcmail_output::JS_OBJECT_NAME, rcube::JQ($string)), + 'title' => $RCMAIL->gettext('addtoaddressbook'), 'class' => 'rcmaddcontact', ), html::img(array( @@ -1533,9 +1535,9 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, else { $address = ''; if ($name) - $address .= Q($name); + $address .= rcube::Q($name); if ($mailto) - $address = trim($address . ' ' . Q($name ? sprintf('<%s>', $mailto) : $mailto)); + $address = trim($address . ' ' . rcube::Q($name ? sprintf('<%s>', $mailto) : $mailto)); } $address = html::span('adr', $address); @@ -1561,7 +1563,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, 'href' => '#more', 'class' => 'morelink', 'onclick' => '$(this).hide().next().show()', - ), Q(rcube_label(array('name' => 'andnmore', 'vars' => array('nr' => $moreadrs))))) . + ), rcube::Q($RCMAIL->gettext(array('name' => 'andnmore', 'vars' => array('nr' => $moreadrs))))) . html::span(array('style' => 'display:none'), join(', ', $allvalues)); } else { @@ -1569,11 +1571,11 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, 'href' => '#more', 'class' => 'morelink', 'onclick' => sprintf("return %s.show_popup_dialog('%s','%s')", - JS_OBJECT_NAME, - JQ(join(', ', $allvalues)), - JQ($title)) + rcmail_output::JS_OBJECT_NAME, + rcube::JQ(join(', ', $allvalues)), + rcube::JQ($title)) ), - Q(rcube_label(array('name' => 'andnmore', 'vars' => array('nr' => $moreadrs))))); + rcube::Q($RCMAIL->gettext(array('name' => 'andnmore', 'vars' => array('nr' => $moreadrs))))); } } @@ -1604,7 +1606,7 @@ function rcmail_wrap_and_quote($text, $length = 72) $line = '>' . rtrim($line); else if (mb_strlen($line) > $max) { $newline = ''; - foreach (explode("\n", rc_wordwrap($line, $length - 2)) as $l) { + foreach (explode("\n", rcube_mime::wordwrap($line, $length - 2)) as $l) { if (strlen($l)) $newline .= '> ' . $l . "\n"; else @@ -1690,17 +1692,17 @@ function rcmail_send_mdn($message, &$smtp_error) $compose->setParam('text_encoding', 'quoted-printable'); $compose->setParam('html_encoding', 'quoted-printable'); $compose->setParam('head_encoding', 'quoted-printable'); - $compose->setParam('head_charset', RCMAIL_CHARSET); - $compose->setParam('html_charset', RCMAIL_CHARSET); - $compose->setParam('text_charset', RCMAIL_CHARSET); + $compose->setParam('head_charset', RCUBE_CHARSET); + $compose->setParam('html_charset', RCUBE_CHARSET); + $compose->setParam('text_charset', RCUBE_CHARSET); // compose headers array $headers = array( - 'Date' => rcmail_user_date(), + 'Date' => $RCMAIL->user_date(), 'From' => $sender, 'To' => $message->headers->mdn_to, - 'Subject' => rcube_label('receiptread') . ': ' . $message->subject, - 'Message-ID' => rcmail_gen_message_id(), + 'Subject' => $RCMAIL->gettext('receiptread') . ': ' . $message->subject, + 'Message-ID' => $RCMAIL->gen_message_id(), 'X-Sender' => $identity['email'], 'References' => trim($message->headers->references . ' ' . $message->headers->messageID), ); @@ -1718,21 +1720,21 @@ function rcmail_send_mdn($message, &$smtp_error) $report .= "Reporting-UA: $agent\r\n"; } - $body = rcube_label("yourmessage") . "\r\n\r\n" . - "\t" . rcube_label("to") . ': ' . rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset) . "\r\n" . - "\t" . rcube_label("subject") . ': ' . $message->subject . "\r\n" . - "\t" . rcube_label("sent") . ': ' . format_date($message->headers->date, $RCMAIL->config->get('date_long')) . "\r\n" . - "\r\n" . rcube_label("receiptnote"); + $body = $RCMAIL->gettext("yourmessage") . "\r\n\r\n" . + "\t" . $RCMAIL->gettext("to") . ': ' . rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset) . "\r\n" . + "\t" . $RCMAIL->gettext("subject") . ': ' . $message->subject . "\r\n" . + "\t" . $RCMAIL->gettext("sent") . ': ' . $RCMAIL->format_date($message->headers->date, $RCMAIL->config->get('date_long')) . "\r\n" . + "\r\n" . $RCMAIL->gettext("receiptnote"); $compose->headers($headers); $compose->setContentType('multipart/report', array('report-type'=> 'disposition-notification')); - $compose->setTXTBody(rc_wordwrap($body, 75, "\r\n")); + $compose->setTXTBody(rcube_mime::wordwrap($body, 75, "\r\n")); $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline'); if ($RCMAIL->config->get('mdn_use_from')) $options['mdn_use_from'] = true; - $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options); + $sent = $RCMAIL->deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options); if ($sent) { $RCMAIL->storage->set_flag($message->uid, 'MDNSENT'); @@ -1868,16 +1870,18 @@ function rcmail_fix_mimetype($name) // return attachment filename, handle empty filename case function rcmail_attachment_name($attachment, $display = false) { + global $RCMAIL; + $filename = $attachment->filename; if ($filename === null || $filename === '') { if ($attachment->mimetype == 'text/html') { - $filename = rcube_label('htmlmessage'); + $filename = $RCMAIL->gettext('htmlmessage'); } else { $ext = (array) rcube_mime::get_mime_extensions($attachment->mimetype); $ext = array_shift($ext); - $filename = rcube_label('messagepart') . ' ' . $attachment->mime_id; + $filename = $RCMAIL->gettext('messagepart') . ' ' . $attachment->mime_id; if ($ext) { $filename .= '.' . $ext; } @@ -1889,7 +1893,7 @@ function rcmail_attachment_name($attachment, $display = false) // Display smart names for some known mimetypes if ($display) { if (preg_match('/application\/(pgp|pkcs7)-signature/i', $attachment->mimetype)) { - $filename = rcube_label('digitalsig'); + $filename = $RCMAIL->gettext('digitalsig'); } } @@ -1898,12 +1902,12 @@ function rcmail_attachment_name($attachment, $display = false) function rcmail_search_filter($attrib) { - global $OUTPUT, $CONFIG; + global $RCMAIL, $OUTPUT, $CONFIG; if (!strlen($attrib['id'])) $attrib['id'] = 'rcmlistfilter'; - $attrib['onchange'] = JS_OBJECT_NAME.'.filter_mailbox(this.value)'; + $attrib['onchange'] = rcmail_output::JS_OBJECT_NAME.'.filter_mailbox(this.value)'; // Content-Type values of messages with attachments // the same as in app.js:add_message_row() @@ -1916,20 +1920,20 @@ function rcmail_search_filter($attrib) } $select_filter = new html_select($attrib); - $select_filter->add(rcube_label('all'), 'ALL'); - $select_filter->add(rcube_label('unread'), 'UNSEEN'); - $select_filter->add(rcube_label('flagged'), 'FLAGGED'); - $select_filter->add(rcube_label('unanswered'), 'UNANSWERED'); + $select_filter->add($RCMAIL->gettext('all'), 'ALL'); + $select_filter->add($RCMAIL->gettext('unread'), 'UNSEEN'); + $select_filter->add($RCMAIL->gettext('flagged'), 'FLAGGED'); + $select_filter->add($RCMAIL->gettext('unanswered'), 'UNANSWERED'); if (!$CONFIG['skip_deleted']) { - $select_filter->add(rcube_label('deleted'), 'DELETED'); - $select_filter->add(rcube_label('undeleted'), 'UNDELETED'); + $select_filter->add($RCMAIL->gettext('deleted'), 'DELETED'); + $select_filter->add($RCMAIL->gettext('undeleted'), 'UNDELETED'); } - $select_filter->add(rcube_label('withattachment'), $attachment); - $select_filter->add(rcube_label('priority').': '.rcube_label('highest'), 'HEADER X-PRIORITY 1'); - $select_filter->add(rcube_label('priority').': '.rcube_label('high'), 'HEADER X-PRIORITY 2'); - $select_filter->add(rcube_label('priority').': '.rcube_label('normal'), 'NOT HEADER X-PRIORITY 1 NOT HEADER X-PRIORITY 2 NOT HEADER X-PRIORITY 4 NOT HEADER X-PRIORITY 5'); - $select_filter->add(rcube_label('priority').': '.rcube_label('low'), 'HEADER X-PRIORITY 4'); - $select_filter->add(rcube_label('priority').': '.rcube_label('lowest'), 'HEADER X-PRIORITY 5'); + $select_filter->add($RCMAIL->gettext('withattachment'), $attachment); + $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('highest'), 'HEADER X-PRIORITY 1'); + $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('high'), 'HEADER X-PRIORITY 2'); + $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('normal'), 'NOT HEADER X-PRIORITY 1 NOT HEADER X-PRIORITY 2 NOT HEADER X-PRIORITY 4 NOT HEADER X-PRIORITY 5'); + $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('low'), 'HEADER X-PRIORITY 4'); + $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('lowest'), 'HEADER X-PRIORITY 5'); $out = $select_filter->show($_SESSION['search_filter']); @@ -1956,13 +1960,13 @@ function rcmail_message_error($uid=null) function rcmail_message_import_form($attrib = array()) { - global $OUTPUT; + global $OUTPUT, $RCMAIL; // set defaults $attrib += array('id' => 'rcmImportform', 'buttons' => 'yes'); // Get filesize, enable upload progress bar - $max_filesize = rcube_upload_init(); + $max_filesize = $RCMAIL->upload_init(); $button = new html_inputfield(array('type' => 'button')); $fileinput = new html_inputfield(array( @@ -1976,10 +1980,10 @@ function rcmail_message_import_form($attrib = array()) $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'method' => 'post', 'enctype' => 'multipart/form-data'), html::tag('input', array('type' => 'hidden', 'name' => '_unlock', 'value' => '')) . html::div(null, $fileinput->show()) . - html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . - (get_boolean($attrib['buttons']) ? html::div('buttons', - $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . - $button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('import-messages', this.form)")) + html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . + (rcube_utils::get_boolean($attrib['buttons']) ? html::div('buttons', + $button->show($RCMAIL->gettext('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . + $button->show($RCMAIL->gettext('upload'), array('class' => 'button mainaction', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".command('import-messages', this.form)")) ) : '') ) ); diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index be1366dcf..d588343de 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -23,12 +23,12 @@ // show loading page if (!empty($_GET['_preload'])) { $url = preg_replace('/([&?]+)_preload=/', '\\1_mimewarning=1&_embed=', $_SERVER['REQUEST_URI']); - $message = rcube_label('loadingdata'); + $message = $RCMAIL->gettext('loadingdata'); - header('Content-Type: text/html; charset=' . RCMAIL_CHARSET); + header('Content-Type: text/html; charset=' . RCUBE_CHARSET); print "<html>\n<head>\n" - . '<meta http-equiv="refresh" content="0; url='.Q($url).'">' . "\n" - . '<meta http-equiv="content-type" content="text/html; charset='.RCMAIL_CHARSET.'">' . "\n" + . '<meta http-equiv="refresh" content="0; url='.rcube::Q($url).'">' . "\n" + . '<meta http-equiv="content-type" content="text/html; charset='.RCUBE_CHARSET.'">' . "\n" . "</head>\n<body>\n$message\n</body>\n</html>"; exit; } @@ -38,7 +38,7 @@ ob_end_clean(); // similar code as in program/steps/mail/show.inc if (!empty($_GET['_uid'])) { - $uid = get_input_value('_uid', RCUBE_INPUT_GET); + $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET); $RCMAIL->config->set('prefer_html', true); $MESSAGE = new rcube_message($uid); } @@ -46,7 +46,7 @@ if (!empty($_GET['_uid'])) { // check connection status check_storage_status(); -$part_id = get_input_value('_part', RCUBE_INPUT_GPC); +$part_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_GPC); // show part page if (!empty($_GET['_frame'])) { @@ -72,7 +72,7 @@ if (!empty($_GET['_frame'])) { // render thumbnail of an image attachment else if ($_GET['_thumb']) { - $pid = get_input_value('_part', RCUBE_INPUT_GET); + $pid = rcube_utils::get_input_value('_part', rcube_utils::INPUT_GET); if ($part = $MESSAGE->mime_parts[$pid]) { $thumbnail_size = $RCMAIL->config->get('image_thumbnail_size', 240); $temp_dir = $RCMAIL->config->get('temp_dir'); @@ -187,7 +187,7 @@ else if (strlen($part_id)) { $OUTPUT = new rcmail_html_page(); $OUTPUT->write(html::tag('html', null, html::tag('body', 'embed', html::div(array('class' => 'rcmail-inline-message rcmail-inline-warning'), - rcube_label(array( + $RCMAIL->gettext(array( 'name' => 'attachmentvalidationerror', 'vars' => array( 'expected' => $mimetype . ($file_extension ? " (.$file_extension)" : ''), @@ -197,7 +197,7 @@ else if (strlen($part_id)) { html::p(array('class' => 'rcmail-inline-buttons'), html::tag('button', array('onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_nocheck' => 1))) . "'"), - rcube_label('showanyway'))) + $RCMAIL->gettext('showanyway'))) ) ))); } @@ -221,7 +221,7 @@ else if (strlen($part_id)) { list($ctype_primary, $ctype_secondary) = explode('/', $mimetype); if (!$plugin['download'] && $ctype_primary == 'text') { - header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ? $part->charset : RCMAIL_CHARSET)); + header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ? $part->charset : RCUBE_CHARSET)); } else { header("Content-Type: $mimetype"); @@ -232,10 +232,10 @@ else if (strlen($part_id)) { if ($ctype_primary == 'text' && $ctype_secondary == 'html' && empty($plugin['download'])) { // Check if we have enough memory to handle the message in it // #1487424: we need up to 10x more memory than the body - if (!rcmail_mem_check($part->size * 10)) { - $out = '<body>' . rcube_label('messagetoobig'). ' ' + if (!rcube_utils::mem_check($part->size * 10)) { + $out = '<body>' . $RCMAIL->gettext('messagetoobig'). ' ' . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id - .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), rcube_label('download')) . '</body></html>'; + .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), $RCMAIL->gettext('download')) . '</body></html>'; } else { // get part body if not available @@ -256,10 +256,10 @@ else if (strlen($part_id)) { } $out = substr($out, 0, $body_start) . html::div(array('class' => 'rcmail-inline-message rcmail-inline-warning'), - Q(rcube_label('blockedimages')) . ' ' . + rcube::Q($RCMAIL->gettext('blockedimages')) . ' ' . html::tag('button', array('onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_safe' => 1))) . "'"), - Q(rcube_label('showimages'))) + rcube::Q($RCMAIL->gettext('showimages'))) ) . substr($out, $body_start); } @@ -270,7 +270,7 @@ else if (strlen($part_id)) { check_storage_status(); } - $OUTPUT = new rcube_html_page(); + $OUTPUT = new rcmail_html_page(); $OUTPUT->write($out); } else { @@ -376,7 +376,7 @@ else { $cont .= rcmail_message_body(array()); $cont .= "\n</body>\n</html>"; - $OUTPUT = new rcube_html_page(); + $OUTPUT = new rcmail_html_page(); $OUTPUT->write($cont); exit; @@ -410,7 +410,7 @@ function check_storage_status() header('Location: ' . $_SERVER['REQUEST_URI'] . '&_redirected=1'); } else { - raise_error(array( + rcube::raise_error(array( 'code' => 500, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => 'Unable to get/display message part. IMAP connection error'), @@ -429,7 +429,7 @@ function rcmail_message_part_controls($attrib) { global $MESSAGE, $RCMAIL; - $part = asciiwords(get_input_value('_part', RCUBE_INPUT_GPC)); + $part = asciiwords(rcube_utils::get_input_value('_part', rcube_utils::INPUT_GPC)); if (!is_object($MESSAGE) || !is_array($MESSAGE->parts) || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE->mime_parts[$part] ) { @@ -439,14 +439,14 @@ function rcmail_message_part_controls($attrib) $part = $MESSAGE->mime_parts[$part]; $table = new html_table(array('cols' => 2)); - $table->add('title', Q(rcube_label('namex')).':'); - $table->add('header', Q(rcmail_attachment_name($part))); + $table->add('title', rcube::Q($RCMAIL->gettext('namex')).':'); + $table->add('header', rcube::Q(rcmail_attachment_name($part))); - $table->add('title', Q(rcube_label('type')).':'); - $table->add('header', Q($part->mimetype)); + $table->add('title', rcube::Q($RCMAIL->gettext('type')).':'); + $table->add('header', rcube::Q($part->mimetype)); - $table->add('title', Q(rcube_label('size')).':'); - $table->add('header', Q($RCMAIL->message_part_size($part))); + $table->add('title', rcube::Q($RCMAIL->gettext('size')).':'); + $table->add('header', rcube::Q($RCMAIL->message_part_size($part))); return $table->show($attrib); } @@ -458,7 +458,7 @@ function rcmail_message_part_frame($attrib) { global $MESSAGE, $RCMAIL; - $part = $MESSAGE->mime_parts[asciiwords(get_input_value('_part', RCUBE_INPUT_GPC))]; + $part = $MESSAGE->mime_parts[asciiwords(rcube_utils::get_input_value('_part', rcube_utils::INPUT_GPC))]; $ctype_primary = strtolower($part->ctype_primary); $attrib['src'] = './?' . str_replace('_frame=', ($ctype_primary=='text' ? '_embed=' : '_preload='), $_SERVER['QUERY_STRING']); diff --git a/program/steps/mail/headers.inc b/program/steps/mail/headers.inc index cad113f68..ae1f1db81 100644 --- a/program/steps/mail/headers.inc +++ b/program/steps/mail/headers.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -if ($uid = get_input_value('_uid', RCUBE_INPUT_POST)) +if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) { $source = $RCMAIL->storage->get_raw_headers($uid); diff --git a/program/steps/mail/import.inc b/program/steps/mail/import.inc index f7e7a3eb8..69124f71a 100644 --- a/program/steps/mail/import.inc +++ b/program/steps/mail/import.inc @@ -31,7 +31,7 @@ if (is_array($_FILES['_file'])) { if (!$err) { // check file content type first - list($mtype_primary,) = explode('/', rc_mime_content_type($filepath, $_FILES['_file']['name'][$i], $_FILES['_file']['type'][$i])); + list($mtype_primary,) = explode('/', rcube_mime::file_content_type($filepath, $_FILES['_file']['name'][$i], $_FILES['_file']['type'][$i])); if (!in_array($mtype_primary, array('text','message'))) { $OUTPUT->show_message('importmessageerror', 'error'); continue; @@ -74,7 +74,8 @@ if (is_array($_FILES['_file'])) { } if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { - $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); + $size = $RCMAIL->show_bytes(parse_bytes(ini_get('upload_max_filesize'))); + $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $size))); } else if ($err) { $OUTPUT->show_message('fileuploaderror', 'error'); @@ -82,7 +83,7 @@ if (is_array($_FILES['_file'])) { } // end foreach if ($imported) { - $OUTPUT->show_message(rcube_label(array('name' => 'importmessagesuccess', 'nr' => $imported, 'vars' => array('nr' => $imported))), 'confirmation'); + $OUTPUT->show_message($RCMAIL->gettext(array('name' => 'importmessagesuccess', 'nr' => $imported, 'vars' => array('nr' => $imported))), 'confirmation'); $OUTPUT->command('command', 'list'); } else { @@ -93,9 +94,9 @@ else if ($_SERVER['REQUEST_METHOD'] == 'POST') { // if filesize exceeds post_max_size then $_FILES array is empty, // show filesizeerror instead of fileuploaderror if ($maxsize = ini_get('post_max_size')) - $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes($maxsize))))); + $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $RCMAIL->show_bytes(parse_bytes($maxsize))))); else - $msg = rcube_label('fileuploaderror'); + $msg = $RCMAIL->gettext('fileuploaderror'); $OUTPUT->command('display_message', $msg, 'error'); } diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index a2380131a..fe7991c29 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -27,7 +27,7 @@ $save_arr = array(); $dont_override = (array) $RCMAIL->config->get('dont_override'); // is there a sort type for this request? -if ($sort = get_input_value('_sort', RCUBE_INPUT_GET)) { +if ($sort = rcube_utils::get_input_value('_sort', rcube_utils::INPUT_GET)) { // yes, so set the sort vars list($sort_col, $sort_order) = explode('_', $sort); @@ -41,7 +41,7 @@ if ($sort = get_input_value('_sort', RCUBE_INPUT_GET)) { } // is there a set of columns for this request? -if ($cols = get_input_value('_cols', RCUBE_INPUT_GET)) { +if ($cols = rcube_utils::get_input_value('_cols', rcube_utils::INPUT_GET)) { if (!in_array('list_cols', $dont_override)) { $save_arr['list_cols'] = explode(',', $cols); } @@ -60,7 +60,7 @@ $RCMAIL->storage->folder_sync($mbox_name); // initialize searching result if search_filter is used if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { $search_request = md5($mbox_name.$_SESSION['search_filter']); - $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, rcmail_sort_column()); + $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET, rcmail_sort_column()); $_SESSION['search'] = $RCMAIL->storage->get_search_set(); $_SESSION['search_request'] = $search_request; $OUTPUT->set_env('search_request', $search_request); @@ -108,7 +108,7 @@ if (isset($a_headers) && count($a_headers)) { else { // handle IMAP errors (e.g. #1486905) if ($err_code = $RCMAIL->storage->get_error_code()) { - rcmail_display_server_error(); + $RCMAIL->display_server_error(); } else if ($search_request) $OUTPUT->show_message('searchnomatch', 'notice'); diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc index 3ffd9f6a6..46f81353a 100644 --- a/program/steps/mail/list_contacts.inc +++ b/program/steps/mail/list_contacts.inc @@ -65,7 +65,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search } // list contacts from selected source else { - $source = get_input_value('_source', RCUBE_INPUT_GPC); + $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); $CONTACTS = $RCMAIL->get_address_book($source); if ($CONTACTS && $CONTACTS->ready) { @@ -73,7 +73,7 @@ else { $CONTACTS->set_pagesize($page_size); $CONTACTS->set_page($list_page); - if ($group_id = get_input_value('_gid', RCUBE_INPUT_GPC)) { + if ($group_id = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC)) { $CONTACTS->set_group($group_id); } // list groups of this source (on page one) @@ -89,7 +89,7 @@ else { $row_id = 'G'.$group['ID']; $jsresult[$row_id] = format_email_recipient($email, $group['name']); $OUTPUT->command('add_contact_row', $row_id, array( - 'contactgroup' => html::span(array('title' => $email), Q($group['name']))), 'group'); + 'contactgroup' => html::span(array('title' => $email), rcube::Q($group['name']))), 'group'); } } // make virtual groups clickable to list their members @@ -99,9 +99,9 @@ else { 'contactgroup' => html::a(array( 'href' => '#list', 'rel' => $row['ID'], - 'title' => rcube_label('listgroup'), - 'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", JS_OBJECT_NAME, $source, $group['ID']), - ), Q($group['name']) . ' ' . html::span('action', '»'))), + 'title' => $RCMAIL->gettext('listgroup'), + 'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", rcmail_output::JS_OBJECT_NAME, $source, $group['ID']), + ), rcube::Q($group['name']) . ' ' . html::span('action', '»'))), 'group', array('ID' => $group['ID'], 'name' => $group['name'], 'virtual' => true)); } @@ -110,7 +110,7 @@ else { $row_id = 'E'.$group['ID']; $jsresult[$row_id] = $group['name']; $OUTPUT->command('add_contact_row', $row_id, array( - 'contactgroup' => Q($group['name'] . ' (' . intval($result->count) . ')')), 'group'); + 'contactgroup' => rcube::Q($group['name'] . ' (' . intval($result->count) . ')')), 'group'); } } @@ -140,8 +140,8 @@ else if (!empty($result) && $result->count > 0) { $keyname = $row['_type'] == 'group' ? 'contactgroup' : 'contact'; $OUTPUT->command('add_contact_row', $row_id, array( - $keyname => html::span(array('title' => $email), Q($name ? $name : $email) . - ($name && count($emails) > 1 ? ' ' . html::span('email', Q($email)) : '') + $keyname => html::span(array('title' => $email), rcube::Q($name ? $name : $email) . + ($name && count($emails) > 1 ? ' ' . html::span('email', rcube::Q($email)) : '') )), $classname); } } diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index dfc892ea1..b081bc9b0 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -32,7 +32,7 @@ $a_flags_map = array( $threading = (bool) $RCMAIL->storage->get_threading(); -if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST))) +if (($uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) && ($flag = rcube_utils::get_input_value('_flag', rcube_utils::INPUT_POST))) { $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag); @@ -49,7 +49,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va // send error message if ($_POST['_from'] != 'show') $OUTPUT->command('list_mailbox'); - rcmail_display_server_error('errormarking'); + $RCMAIL->display_server_error('errormarking'); $OUTPUT->send(); exit; } @@ -58,7 +58,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va } if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) { - $ruids = get_input_value('_ruid', RCUBE_INPUT_POST); + $ruids = rcube_utils::get_input_value('_ruid', rcube_utils::INPUT_POST); $read = $RCMAIL->storage->set_flag($ruids, 'SEEN'); if ($read && !$CONFIG['skip_deleted']) @@ -70,12 +70,12 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va } else if ($flag == 'DELETED' && $CONFIG['skip_deleted']) { if ($_POST['_from'] == 'show') { - if ($next = get_input_value('_next_uid', RCUBE_INPUT_GPC)) + if ($next = rcube_utils::get_input_value('_next_uid', rcube_utils::INPUT_GPC)) $OUTPUT->command('show_message', $next); else $OUTPUT->command('command', 'list'); } else { - $search_request = get_input_value('_search', RCUBE_INPUT_GPC); + $search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC); // refresh saved search set after moving some messages if ($search_request && $RCMAIL->storage->get_search_set()) { $_SESSION['search'] = $RCMAIL->storage->refresh_search(); @@ -113,7 +113,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); if ($threading) { - $count = get_input_value('_count', RCUBE_INPUT_POST); + $count = rcube_utils::get_input_value('_count', rcube_utils::INPUT_POST); } // add new rows from next page (if any) diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index f15cd2460..587373997 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -30,9 +30,9 @@ $old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize()); // move messages if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { - $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); - $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); - $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); + $count = sizeof(explode(',', ($uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)))); + $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); $trash = $RCMAIL->config->get('trash_mbox'); $moved = $RCMAIL->storage->move_message($uids, $target, $mbox); @@ -41,7 +41,7 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe // send error message if ($_POST['_from'] != 'show') $OUTPUT->command('list_mailbox'); - rcmail_display_server_error('errormoving', null, $target == $trash ? 'delete' : ''); + $RCMAIL->display_server_error('errormoving', null, $target == $trash ? 'delete' : ''); $OUTPUT->send(); exit; } @@ -53,8 +53,8 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe } // delete messages else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { - $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); - $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); + $count = sizeof(explode(',', ($uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)))); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); $del = $RCMAIL->storage->delete_message($uids, $mbox); @@ -62,7 +62,7 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { // send error message if ($_POST['_from'] != 'show') $OUTPUT->command('list_mailbox'); - rcmail_display_server_error('errordeleting'); + $RCMAIL->display_server_error('errordeleting'); $OUTPUT->send(); exit; } @@ -79,7 +79,7 @@ else { exit; } -$search_request = get_input_value('_search', RCUBE_INPUT_GPC); +$search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC); // refresh saved search set after moving some messages if ($search_request && $RCMAIL->storage->get_search_set()) { @@ -88,7 +88,7 @@ if ($search_request && $RCMAIL->storage->get_search_set()) { if ($_POST['_from'] == 'show') { - if ($next = get_input_value('_next_uid', RCUBE_INPUT_GPC)) + if ($next = rcube_utils::get_input_value('_next_uid', rcube_utils::INPUT_GPC)) $OUTPUT->command('show_message', $next); else $OUTPUT->command('command', 'list'); @@ -130,11 +130,11 @@ else rcmail_send_unread_count($target, true); } - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); if ($threading) { - $count = get_input_value('_count', RCUBE_INPUT_POST); + $count = rcube_utils::get_input_value('_count', rcube_utils::INPUT_POST); } // add new rows from next page (if any) diff --git a/program/steps/mail/pagenav.inc b/program/steps/mail/pagenav.inc index e4b70ad60..59c131f69 100644 --- a/program/steps/mail/pagenav.inc +++ b/program/steps/mail/pagenav.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -$uid = get_input_value('_uid', RCUBE_INPUT_GET); +$uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET); $index = $RCMAIL->storage->index(null, rcmail_sort_column(), rcmail_sort_order()); $cnt = $index->count_messages(); @@ -48,7 +48,7 @@ if ($last) $OUTPUT->set_env('messagecount', 1); // Set rowcount text -$OUTPUT->command('set_rowcount', rcube_label(array( +$OUTPUT->command('set_rowcount', $RCMAIL->gettext(array( 'name' => 'messagenrof', 'vars' => array('nr' => $pos+1, 'count' => $cnt) ))); diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index fb1b48797..03d6de326 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -24,13 +24,13 @@ $_SESSION['page'] = 1; // using encodeURI with javascript "should" give us // a correctly encoded query string -$imap_charset = RCMAIL_CHARSET; +$imap_charset = RCUBE_CHARSET; // get search string -$str = get_input_value('_q', RCUBE_INPUT_GET, true); -$mbox = get_input_value('_mbox', RCUBE_INPUT_GET, true); -$filter = get_input_value('_filter', RCUBE_INPUT_GET); -$headers = get_input_value('_headers', RCUBE_INPUT_GET); +$str = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GET, true); +$mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GET, true); +$filter = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET); +$headers = rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET); $subject = array(); $search_request = md5($mbox.$filter.$str); @@ -134,7 +134,7 @@ if (!empty($result_h)) { } // handle IMAP errors (e.g. #1486905) else if ($err_code = $RCMAIL->storage->get_error_code()) { - rcmail_display_server_error(); + $RCMAIL->display_server_error(); } else { $OUTPUT->show_message('searchnomatch', 'notice'); diff --git a/program/steps/mail/search_contacts.inc b/program/steps/mail/search_contacts.inc index 668181623..4d5abf9ef 100644 --- a/program/steps/mail/search_contacts.inc +++ b/program/steps/mail/search_contacts.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -$search = get_input_value('_q', RCUBE_INPUT_GPC, true); +$search = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GPC, true); $sources = $RCMAIL->get_address_sources(); $search_mode = (int) $RCMAIL->config->get('addressbook_search_mode'); $addr_sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name'); @@ -79,8 +79,8 @@ if (!empty($result) && $result->count > 0) { $row_id = $row['ID'].'-'.$i; $jsresult[$row_id] = format_email_recipient($email, $name); $OUTPUT->command('add_contact_row', $row_id, array( - 'contact' => html::span(array('title' => $email), Q($name ? $name : $email) . - ($name && count($emails) > 1 ? ' ' . html::span('email', Q($email)) : '') + 'contact' => html::span(array('title' => $email), rcube::Q($name ? $name : $email) . + ($name && count($emails) > 1 ? ' ' . html::span('email', rcube::Q($email)) : '') )), 'person'); } } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index f26034fa4..9f79df343 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -26,13 +26,13 @@ $OUTPUT->framed = TRUE; $savedraft = !empty($_POST['_draft']) ? true : false; -$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC); +$COMPOSE_ID = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC); $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; /****** checks ********/ if (!isset($COMPOSE['id'])) { - raise_error(array('code' => 500, 'type' => 'php', + rcube::raise_error(array('code' => 500, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Invalid compose ID"), true, false); @@ -78,9 +78,9 @@ function rcmail_get_identity($id) if ($sql_arr = $RCMAIL->user->get_identity($id)) { $out = $sql_arr; - if ($message_charset != RCMAIL_CHARSET) { + if ($message_charset != RCUBE_CHARSET) { foreach ($out as $k => $v) - $out[$k] = rcube_charset_convert($v, RCMAIL_CHARSET, $message_charset); + $out[$k] = rcube_charset::convert($v, RCUBE_CHARSET, $message_charset); } $out['mailto'] = $sql_arr['email']; @@ -212,17 +212,17 @@ function rcmail_email_input_format($mailto, $count=false, $check=true) $mailto = trim(preg_replace($regexp, $replace, $mailto)); $result = array(); - $items = rcube_explode_quoted_string($delim, $mailto); + $items = rcube_utils::explode_quoted_string($delim, $mailto); foreach($items as $item) { $item = trim($item); // address in brackets without name (do nothing) if (preg_match('/^<'.$email_regexp.'>$/', $item)) { - $item = rcube_idn_to_ascii(trim($item, '<>')); + $item = rcube_utils::idn_to_ascii(trim($item, '<>')); $result[] = $item; // address without brackets and without name (add brackets) } else if (preg_match('/^'.$email_regexp.'$/', $item)) { - $item = rcube_idn_to_ascii($item); + $item = rcube_utils::idn_to_ascii($item); $result[] = $item; // address with name (handle name) } else if (preg_match('/<*'.$email_regexp.'>*$/', $item, $matches)) { @@ -232,7 +232,7 @@ function rcmail_email_input_format($mailto, $count=false, $check=true) $name = substr($name, 1, -1); } $name = stripcslashes($name); - $address = rcube_idn_to_ascii(trim($address, '<>')); + $address = rcube_utils::idn_to_ascii(trim($address, '<>')); $result[] = format_email_recipient($address, $name); $item = $address; } else if (trim($item)) { @@ -241,7 +241,7 @@ function rcmail_email_input_format($mailto, $count=false, $check=true) // check address format $item = trim($item, '<>'); - if ($item && $check && !check_email($item)) { + if ($item && $check && !rcube_utils::check_email($item)) { $EMAIL_FORMAT_ERROR = $item; return; } @@ -285,9 +285,9 @@ function rcmail_generic_message_footer($isHtml) /****** compose message ********/ if (strlen($_POST['_draft_saveid']) > 3) - $olddraftmessageid = get_input_value('_draft_saveid', RCUBE_INPUT_POST); + $olddraftmessageid = rcube_utils::get_input_value('_draft_saveid', rcube_utils::INPUT_POST); -$message_id = rcmail_gen_message_id(); +$message_id = $RCMAIL->gen_message_id(); // set default charset $message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $OUTPUT->get_charset(); @@ -295,9 +295,9 @@ $message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $OUTPUT->get $EMAIL_FORMAT_ERROR = NULL; $RECIPIENT_COUNT = 0; -$mailto = rcmail_email_input_format(get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset), true); -$mailcc = rcmail_email_input_format(get_input_value('_cc', RCUBE_INPUT_POST, TRUE, $message_charset), true); -$mailbcc = rcmail_email_input_format(get_input_value('_bcc', RCUBE_INPUT_POST, TRUE, $message_charset), true); +$mailto = rcmail_email_input_format(rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST, TRUE, $message_charset), true); +$mailcc = rcmail_email_input_format(rcube_utils::get_input_value('_cc', rcube_utils::INPUT_POST, TRUE, $message_charset), true); +$mailbcc = rcmail_email_input_format(rcube_utils::get_input_value('_bcc', rcube_utils::INPUT_POST, TRUE, $message_charset), true); if ($EMAIL_FORMAT_ERROR) { $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR)); @@ -312,7 +312,7 @@ else if (empty($mailto)) $mailto = 'undisclosed-recipients:;'; // Get sender name and address... -$from = get_input_value('_from', RCUBE_INPUT_POST, true, $message_charset); +$from = rcube_utils::get_input_value('_from', rcube_utils::INPUT_POST, true, $message_charset); // ... from identity... if (is_numeric($from)) { if (is_array($identity_arr = rcmail_get_identity($from))) { @@ -381,8 +381,8 @@ if ($CONFIG['http_received_header']) $headers['Received'] = $http_header; } -$headers['Date'] = rcmail_user_date(); -$headers['From'] = rcube_charset_convert($from_string, RCMAIL_CHARSET, $message_charset); +$headers['Date'] = $RCMAIL->user_date(); +$headers['From'] = rcube_charset::convert($from_string, RCUBE_CHARSET, $message_charset); $headers['To'] = $mailto; // additional recipients @@ -401,19 +401,19 @@ if (($max_recipients = (int) $RCMAIL->config->get('max_recipients')) > 0) { } // add subject -$headers['Subject'] = trim(get_input_value('_subject', RCUBE_INPUT_POST, TRUE, $message_charset)); +$headers['Subject'] = trim(rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE, $message_charset)); if (!empty($identity_arr['organization'])) { $headers['Organization'] = $identity_arr['organization']; } if (!empty($_POST['_replyto'])) { - $headers['Reply-To'] = rcmail_email_input_format(get_input_value('_replyto', RCUBE_INPUT_POST, TRUE, $message_charset)); + $headers['Reply-To'] = rcmail_email_input_format(rcube_utils::get_input_value('_replyto', rcube_utils::INPUT_POST, TRUE, $message_charset)); } if (!empty($headers['Reply-To'])) { $headers['Mail-Reply-To'] = $headers['Reply-To']; } if (!empty($_POST['_followupto'])) { - $headers['Mail-Followup-To'] = rcmail_email_input_format(get_input_value('_followupto', RCUBE_INPUT_POST, TRUE, $message_charset)); + $headers['Mail-Followup-To'] = rcmail_email_input_format(rcube_utils::get_input_value('_followupto', rcube_utils::INPUT_POST, TRUE, $message_charset)); } // remember reply/forward UIDs in special headers @@ -468,10 +468,10 @@ else $headers = $data['headers']; -$isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); +$isHtml = (bool) rcube_utils::get_input_value('_is_html', rcube_utils::INPUT_POST); // fetch message body -$message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset); +$message_body = rcube_utils::get_input_value('_message', rcube_utils::INPUT_POST, TRUE, $message_charset); if ($isHtml) { $bstyle = array(); @@ -505,7 +505,7 @@ if (!$savedraft) { && empty($COMPOSE['spell_checked']) && !empty($message_body) ) { $message_body = str_replace("\r\n", "\n", $message_body); - $spellchecker = new rcube_spellchecker(get_input_value('_lang', RCUBE_INPUT_GPC)); + $spellchecker = new rcube_spellchecker(rcube_utils::get_input_value('_lang', rcube_utils::INPUT_GPC)); $spell_result = $spellchecker->check($message_body, $isHtml); $COMPOSE['spell_checked'] = true; @@ -520,7 +520,7 @@ if (!$savedraft) { // generic footer for all messages if ($footer = rcmail_generic_message_footer($isHtml)) { - $footer = rcube_charset_convert($footer, RCMAIL_CHARSET, $message_charset); + $footer = rcube_charset::convert($footer, RCUBE_CHARSET, $message_charset); $message_body .= "\r\n" . $footer; } } @@ -530,7 +530,7 @@ if ($isHtml) { } // sort attachments to make sure the order is the same as in the UI (#1488423) -$files = get_input_value('_attachments', RCUBE_INPUT_POST); +$files = rcube_utils::get_input_value('_attachments', rcube_utils::INPUT_POST); if ($files) { $files = explode(',', $files); $files = array_flip($files); @@ -576,11 +576,11 @@ if ($isHtml) { $MAIL_MIME->setHTMLBody($plugin['body']); // replace emoticons - $plugin['body'] = rcmail_replace_emoticons($plugin['body']); + $plugin['body'] = $RCMAIL->replace_emoticons($plugin['body']); // add a plain text version of the e-mail as an alternative part. $h2t = new rcube_html2text($plugin['body'], false, true, 0, $message_charset); - $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n", false, $message_charset); + $plainTextPart = rcube_mime::wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n", false, $message_charset); $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true); // make sure all line endings are CRLF (#1486712) @@ -608,7 +608,7 @@ else { if ($flowed = ($savedraft || $RCMAIL->config->get('send_format_flowed', true))) $message_body = rcube_mime::format_flowed($message_body, min($LINE_LENGTH+2, 79), $message_charset); else - $message_body = rc_wordwrap($message_body, $LINE_LENGTH, "\r\n", false, $message_charset); + $message_body = rcube_mime::wordwrap($message_body, $LINE_LENGTH, "\r\n", false, $message_charset); $message_body = wordwrap($message_body, 998, "\r\n", true); @@ -663,7 +663,7 @@ if (is_array($COMPOSE['attachments'])) { '', '', '', $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL, $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL, - '', RCMAIL_CHARSET + '', RCUBE_CHARSET ); } } @@ -700,7 +700,7 @@ if (function_exists('mb_encode_mimeheader')) { mb_internal_encoding($message_charset); $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], $message_charset, 'Q', "\r\n", 8); - mb_internal_encoding(RCMAIL_CHARSET); + mb_internal_encoding(RCUBE_CHARSET); } // pass headers to message object @@ -720,7 +720,7 @@ if (!$savedraft) $smtp_opts['dsn'] = true; } - $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, + $sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto, $smtp_error, $mailbody_file, $smtp_opts); // return to compose page if sending failed @@ -754,7 +754,7 @@ if (!$savedraft) if ($savedraft) $store_target = $CONFIG['drafts_mbox']; else if (!$RCMAIL->config->get('no_save_sent_messages')) - $store_target = isset($_POST['_store_target']) ? get_input_value('_store_target', RCUBE_INPUT_POST) : $CONFIG['sent_mbox']; + $store_target = isset($_POST['_store_target']) ? rcube_utils::get_input_value('_store_target', rcube_utils::INPUT_POST) : $CONFIG['sent_mbox']; if ($store_target) { // check if folder is subscribed @@ -788,7 +788,7 @@ if ($store_target) { } if (PEAR::isError($msg)) - raise_error(array('code' => 650, 'type' => 'php', + rcube::raise_error(array('code' => 650, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not create message: ".$msg->getMessage()), TRUE, FALSE); @@ -805,7 +805,7 @@ if ($store_target) { // raise error if saving failed if (!$saved) { - raise_error(array('code' => 800, 'type' => 'imap', + rcube::raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not save message in $store_target"), TRUE, FALSE); @@ -828,7 +828,7 @@ if ($store_target) { // raise error if deletion of old draft failed if (!$deleted) - raise_error(array('code' => 800, 'type' => 'imap', + rcube::raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not delete message from ".$CONFIG['drafts_mbox']), TRUE, FALSE); } @@ -871,13 +871,13 @@ else { $OUTPUT->command('remove_compose_data', $COMPOSE_ID); if ($store_folder && !$saved) - $OUTPUT->command('sent_successfully', 'error', rcube_label('errorsavingsent'), $folders); + $OUTPUT->command('sent_successfully', 'error', $RCMAIL->gettext('errorsavingsent'), $folders); else { if ($store_folder) { $folders[] = $store_target; } - $OUTPUT->command('sent_successfully', 'confirmation', rcube_label('messagesent'), $folders); + $OUTPUT->command('sent_successfully', 'confirmation', $RCMAIL->gettext('messagesent'), $folders); } } diff --git a/program/steps/mail/sendmdn.inc b/program/steps/mail/sendmdn.inc index 01d0807be..7cc152a2b 100644 --- a/program/steps/mail/sendmdn.inc +++ b/program/steps/mail/sendmdn.inc @@ -24,7 +24,7 @@ if (!$OUTPUT->ajax_call) return; if (!empty($_POST['_uid'])) { - $sent = rcmail_send_mdn(get_input_value('_uid', RCUBE_INPUT_POST), $smtp_error); + $sent = rcmail_send_mdn(rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST), $smtp_error); } // show either confirm or error message diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 9d85f9c8f..6382e49fe 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -22,7 +22,7 @@ $PRINT_MODE = $RCMAIL->action == 'print' ? TRUE : FALSE; // Read browser capabilities and store them in session -if ($caps = get_input_value('_caps', RCUBE_INPUT_GET)) { +if ($caps = rcube_utils::get_input_value('_caps', rcube_utils::INPUT_GET)) { $browser_caps = array(); foreach (explode(',', $caps) as $cap) { $cap = explode('=', $cap); @@ -31,7 +31,7 @@ if ($caps = get_input_value('_caps', RCUBE_INPUT_GET)) { $_SESSION['browser_caps'] = $browser_caps; } -$uid = get_input_value('_uid', RCUBE_INPUT_GET); +$uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET); $mbox_name = $RCMAIL->storage->get_folder(); // similar code as in program/steps/mail/get.inc @@ -68,7 +68,7 @@ if ($uid) { // set environement $OUTPUT->set_env('safemode', $MESSAGE->is_safe); $OUTPUT->set_env('sender', $MESSAGE->sender['string']); - $OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name))); + $OUTPUT->set_env('permaurl', $RCMAIL->url(array('_action' => 'show', '_uid' => $MESSAGE->uid, '_mbox' => $mbox_name))); $OUTPUT->set_env('delimiter', $RCMAIL->storage->get_hierarchy_delimiter()); $OUTPUT->set_env('mailbox', $mbox_name); $OUTPUT->set_env('compose_extwin', $RCMAIL->config->get('compose_extwin',false)); @@ -172,7 +172,7 @@ function rcmail_message_attachments($attrib) if ($PRINT_MODE) { $size = $RCMAIL->message_part_size($attach_prop); - $ol .= html::tag('li', null, Q(sprintf("%s (%s)", $filename, $size))); + $ol .= html::tag('li', null, rcube::Q(sprintf("%s (%s)", $filename, $size))); } else { if ($attrib['maxlength'] && mb_strlen($filename) > $attrib['maxlength']) { @@ -184,15 +184,15 @@ function rcmail_message_attachments($attrib) } $mimetype = rcmail_fix_mimetype($attach_prop->mimetype); - $class = rcmail_filetype2classname($mimetype, $filename); + $class = rcube_utils::file2class($mimetype, $filename); $id = 'attach' . $attach_prop->mime_id; $link = html::a(array( 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), 'onclick' => sprintf('return %s.command(\'load-attachment\',\'%s\',this)', - JS_OBJECT_NAME, $attach_prop->mime_id), + rcmail_output::JS_OBJECT_NAME, $attach_prop->mime_id), 'onmouseover' => $title ? '' : 'rcube_webmail.long_subject_title_ex(this, 0)', - 'title' => Q($title), - ), Q($filename)); + 'title' => rcube::Q($title), + ), rcube::Q($filename)); $ol .= html::tag('li', array('class' => $class, 'id' => $id), $link); $attachments[$attach_prop->mime_id] = $mimetype; @@ -214,13 +214,13 @@ function rcmail_remote_objects_msg() $attrib['class'] = 'notice'; $attrib['style'] = 'display: none'; - $msg = Q(rcube_label('blockedimages')) . ' '; - $msg .= html::a(array('href' => "#loadimages", 'onclick' => JS_OBJECT_NAME.".command('load-images')"), Q(rcube_label('showimages'))); + $msg = rcube::Q($RCMAIL->gettext('blockedimages')) . ' '; + $msg .= html::a(array('href' => "#loadimages", 'onclick' => rcmail_output::JS_OBJECT_NAME.".command('load-images')"), rcube::Q($RCMAIL->gettext('showimages'))); // add link to save sender in addressbook and reload message if ($MESSAGE->sender['mailto'] && $RCMAIL->config->get('show_images') == 1) { - $msg .= ' ' . html::a(array('href' => "#alwaysload", 'onclick' => JS_OBJECT_NAME.".command('always-load')", 'style' => "white-space:nowrap"), - Q(rcube_label(array('name' => 'alwaysshow', 'vars' => array('sender' => $MESSAGE->sender['mailto']))))); + $msg .= ' ' . html::a(array('href' => "#alwaysload", 'onclick' => rcmail_output::JS_OBJECT_NAME.".command('always-load')", 'style' => "white-space:nowrap"), + rcube::Q($RCMAIL->gettext(array('name' => 'alwaysshow', 'vars' => array('sender' => $MESSAGE->sender['mailto']))))); } $RCMAIL->output->add_gui_object('remoteobjectsmsg', $attrib['id']); @@ -243,8 +243,8 @@ function rcmail_message_buttons() $attrib['id'] = 'message-buttons'; $attrib['class'] = 'notice'; - $msg = Q(rcube_label('isdraft')) . ' '; - $msg .= html::a(array('href' => "#edit", 'onclick' => JS_OBJECT_NAME.".command('edit')"), Q(rcube_label('edit'))); + $msg = rcube::Q($RCMAIL->gettext('isdraft')) . ' '; + $msg .= html::a(array('href' => "#edit", 'onclick' => rcmail_output::JS_OBJECT_NAME.".command('edit')"), rcube::Q($RCMAIL->gettext('edit'))); return html::div($attrib, $msg); } diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc index c560d7d41..719239344 100644 --- a/program/steps/mail/viewsource.inc +++ b/program/steps/mail/viewsource.inc @@ -22,7 +22,7 @@ ob_end_clean(); // similar code as in program/steps/mail/get.inc -if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) +if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) { $headers = $RCMAIL->storage->get_message_headers($uid); $charset = $headers->charset ? $headers->charset : $CONFIG['default_charset']; @@ -48,7 +48,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) } else { - raise_error(array( + rcube::raise_error(array( 'code' => 500, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/program/steps/settings/about.inc b/program/steps/settings/about.inc index 0fdefddda..eae4da842 100644 --- a/program/steps/settings/about.inc +++ b/program/steps/settings/about.inc @@ -28,7 +28,7 @@ function rcmail_supportlink($attrib) if ($url = $RCMAIL->config->get('support_url')) { $label = $attrib['label'] ? $attrib['label'] : 'support'; $attrib['href'] = $url; - return html::a($attrib, rcube_label($label)); + return html::a($attrib, $RCMAIL->gettext($label)); } } @@ -66,10 +66,10 @@ function rcmail_plugins_list($attrib) $table = new html_table($attrib); // add table header - $table->add_header('name', rcube_label('plugin')); - $table->add_header('version', rcube_label('version')); - $table->add_header('license', rcube_label('license')); - $table->add_header('source', rcube_label('source')); + $table->add_header('name', $RCMAIL->gettext('plugin')); + $table->add_header('version', $RCMAIL->gettext('version')); + $table->add_header('license', $RCMAIL->gettext('license')); + $table->add_header('source', $RCMAIL->gettext('source')); foreach ($plugin_info as $name => $data) { $uri = $data['src_uri'] ? $data['src_uri'] : $data['uri']; @@ -78,19 +78,19 @@ function rcmail_plugins_list($attrib) } $table->add_row(); - $table->add('name', Q($data['name'] ? $data['name'] : $name)); - $table->add('version', Q($data['version'])); - $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> Q($data['license_uri'])), - Q($data['license'])) : $data['license']); - $table->add('source', $uri ? html::a(array('target' => '_blank', href=> Q($uri)), - Q(rcube_label('download'))) : ''); + $table->add('name', rcube::Q($data['name'] ? $data['name'] : $name)); + $table->add('version', rcube::Q($data['version'])); + $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> rcube::Q($data['license_uri'])), + rcube::Q($data['license'])) : $data['license']); + $table->add('source', $uri ? html::a(array('target' => '_blank', href=> rcube::Q($uri)), + rcube::Q($RCMAIL->gettext('download'))) : ''); } return $table->show(); } -$OUTPUT->set_pagetitle(rcube_label('about')); +$OUTPUT->set_pagetitle($RCMAIL->gettext('about')); $OUTPUT->add_handler('supportlink', 'rcmail_supportlink'); $OUTPUT->add_handler('pluginlist', 'rcmail_plugins_list'); diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc index d5146db66..85d128c8f 100644 --- a/program/steps/settings/delete_identity.inc +++ b/program/steps/settings/delete_identity.inc @@ -19,19 +19,19 @@ +-----------------------------------------------------------------------+ */ -$iid = get_input_value('_iid', RCUBE_INPUT_GPC); +$iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC); // check request token -if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(RCUBE_INPUT_GPC)) { +if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(rcube_utils::INPUT_GPC)) { $OUTPUT->show_message('invalidrequest', 'error'); - rcmail_overwrite_action('identities'); + $RCMAIL->overwrite_action('identities'); return; } if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) { $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid)); - + $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result']; if ($deleted > 0 && $deleted !== false) @@ -48,4 +48,4 @@ if ($OUTPUT->ajax_call) exit; // go to identities page -rcmail_overwrite_action('identities'); +$RCMAIL->overwrite_action('identities'); diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc index 7f2a10ebc..ff28d04c8 100644 --- a/program/steps/settings/edit_folder.inc +++ b/program/steps/settings/edit_folder.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -// WARNING: folder names in UI are encoded with RCMAIL_CHARSET +// WARNING: folder names in UI are encoded with RCUBE_CHARSET function rcmail_folder_form($attrib) { @@ -28,12 +28,12 @@ function rcmail_folder_form($attrib) $storage = $RCMAIL->get_storage(); // edited folder name (empty in create-folder mode) - $mbox = get_input_value('_mbox', RCUBE_INPUT_GPC, true); - $mbox_imap = rcube_charset_convert($mbox, RCMAIL_CHARSET, 'UTF7-IMAP'); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true); + $mbox_imap = rcube_charset::convert($mbox, RCUBE_CHARSET, 'UTF7-IMAP'); // predefined path for new folder - $parent = get_input_value('_path', RCUBE_INPUT_GPC, true); - $parent_imap = rcube_charset_convert($parent, RCMAIL_CHARSET, 'UTF7-IMAP'); + $parent = rcube_utils::get_input_value('_path', rcube_utils::INPUT_GPC, true); + $parent_imap = rcube_charset::convert($parent, RCUBE_CHARSET, 'UTF7-IMAP'); $threading_supported = $storage->get_capability('THREAD'); $delimiter = $storage->get_hierarchy_delimiter(); @@ -46,7 +46,7 @@ function rcmail_folder_form($attrib) $path = explode($delimiter, $mbox_imap); $folder = array_pop($path); $path = implode($delimiter, $path); - $folder = rcube_charset_convert($folder, 'UTF7-IMAP'); + $folder = rcube_charset::convert($folder, 'UTF7-IMAP'); $hidden_fields = array('name' => '_mbox', 'value' => $mbox); } @@ -73,33 +73,33 @@ function rcmail_folder_form($attrib) // General tab $form['props'] = array( - 'name' => rcube_label('properties'), + 'name' => $RCMAIL->gettext('properties'), ); // Location (name) if ($options['protected']) { - $foldername = str_replace($delimiter, ' » ', Q(rcmail_localize_folderpath($mbox_imap))); + $foldername = str_replace($delimiter, ' » ', rcube::Q($RCMAIL->localize_folderpath($mbox_imap))); } else if ($options['norename']) { - $foldername = Q($folder); + $foldername = rcube::Q($folder); } else { if (isset($_POST['_name'])) - $folder = trim(get_input_value('_name', RCUBE_INPUT_POST, true)); + $folder = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); $foldername = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30)); $foldername = $foldername->show($folder); if ($options['special']) { - $foldername .= ' (' . Q(rcmail_localize_foldername($mbox_imap)) .')'; + $foldername .= ' (' . rcube::Q($RCMAIL->localize_foldername($mbox_imap)) .')'; } } $form['props']['fieldsets']['location'] = array( - 'name' => rcube_label('location'), + 'name' => $RCMAIL->gettext('location'), 'content' => array( 'name' => array( - 'label' => rcube_label('foldername'), + 'label' => $RCMAIL->gettext('foldername'), 'value' => $foldername, ), ), @@ -121,7 +121,7 @@ function rcmail_folder_form($attrib) $exceptions[] = substr($prefix, 0, -1); } - $select = rcmail_mailbox_select(array( + $select = $RCMAIL->folder_selector(array( 'name' => '_parent', 'noselection' => '---', 'realnames' => false, @@ -132,21 +132,21 @@ function rcmail_folder_form($attrib) )); $form['props']['fieldsets']['location']['content']['path'] = array( - 'label' => rcube_label('parentfolder'), + 'label' => $RCMAIL->gettext('parentfolder'), 'value' => $select->show($selected), ); } // Settings $form['props']['fieldsets']['settings'] = array( - 'name' => rcube_label('settings'), + 'name' => $RCMAIL->gettext('settings'), ); // Settings: threading if ($threading_supported && ($mbox_imap == 'INBOX' || (!$options['noselect'] && !$options['is_root']))) { $select = new html_select(array('name' => '_viewmode', 'id' => '_listmode')); - $select->add(rcube_label('list'), 0); - $select->add(rcube_label('threads'), 1); + $select->add($RCMAIL->gettext('list'), 0); + $select->add($RCMAIL->gettext('threads'), 1); if (isset($_POST['_viewmode'])) { $value = (int) $_POST['_viewmode']; @@ -157,38 +157,38 @@ function rcmail_folder_form($attrib) } $form['props']['fieldsets']['settings']['content']['viewmode'] = array( - 'label' => rcube_label('listmode'), + 'label' => $RCMAIL->gettext('listmode'), 'value' => $select->show($value), ); } /* // Settings: sorting column $select = new html_select(array('name' => '_sortcol', 'id' => '_sortcol')); - $select->add(rcube_label('nonesort'), ''); - $select->add(rcube_label('arrival'), 'arrival'); - $select->add(rcube_label('sentdate'), 'date'); - $select->add(rcube_label('subject'), 'subject'); - $select->add(rcube_label('fromto'), 'from'); - $select->add(rcube_label('replyto'), 'replyto'); - $select->add(rcube_label('cc'), 'cc'); - $select->add(rcube_label('size'), 'size'); + $select->add($RCMAIL->gettext('nonesort'), ''); + $select->add($RCMAIL->gettext('arrival'), 'arrival'); + $select->add($RCMAIL->gettext('sentdate'), 'date'); + $select->add($RCMAIL->gettext('subject'), 'subject'); + $select->add($RCMAIL->gettext('fromto'), 'from'); + $select->add($RCMAIL->gettext('replyto'), 'replyto'); + $select->add($RCMAIL->gettext('cc'), 'cc'); + $select->add($RCMAIL->gettext('size'), 'size'); $value = isset($_POST['_sortcol']) ? $_POST['_sortcol'] : ''; $form['props']['fieldsets']['settings']['content']['sortcol'] = array( - 'label' => rcube_label('listsorting'), + 'label' => $RCMAIL->gettext('listsorting'), 'value' => $select->show($value), ); // Settings: sorting order $select = new html_select(array('name' => '_sortord', 'id' => '_sortord')); - $select->add(rcube_label('asc'), 'ASC'); - $select->add(rcube_label('desc'), 'DESC'); + $select->add($RCMAIL->gettext('asc'), 'ASC'); + $select->add($RCMAIL->gettext('desc'), 'DESC'); $value = isset($_POST['_sortord']) ? $_POST['_sortord'] : ''; $form['props']['fieldsets']['settings']['content']['sortord'] = array( - 'label' => rcube_label('listorder'), + 'label' => $RCMAIL->gettext('listorder'), 'value' => $select->show(), ); */ @@ -196,7 +196,7 @@ function rcmail_folder_form($attrib) if (strlen($mbox)) { // Number of messages $form['props']['fieldsets']['info'] = array( - 'name' => rcube_label('info'), + 'name' => $RCMAIL->gettext('info'), 'content' => array() ); @@ -207,9 +207,9 @@ function rcmail_folder_form($attrib) if ($msgcount) { // create link with folder-size command $onclick = sprintf("return %s.command('folder-size', '%s', this)", - JS_OBJECT_NAME, JQ($mbox_imap)); + rcmail_output::JS_OBJECT_NAME, rcube::JQ($mbox_imap)); $size = html::a(array('href' => '#', 'onclick' => $onclick, - 'id' => 'folder-size'), rcube_label('getfoldersize')); + 'id' => 'folder-size'), $RCMAIL->gettext('getfoldersize')); } else { // no messages -> zero size @@ -217,11 +217,11 @@ function rcmail_folder_form($attrib) } $form['props']['fieldsets']['info']['content']['count'] = array( - 'label' => rcube_label('messagecount'), + 'label' => $RCMAIL->gettext('messagecount'), 'value' => (int) $msgcount ); $form['props']['fieldsets']['info']['content']['size'] = array( - 'label' => rcube_label('size'), + 'label' => $RCMAIL->gettext('size'), 'value' => $size, ); } @@ -229,8 +229,8 @@ function rcmail_folder_form($attrib) // show folder type only if we have non-private namespaces if (!empty($namespace['shared']) || !empty($namespace['others'])) { $form['props']['fieldsets']['info']['content']['foldertype'] = array( - 'label' => rcube_label('foldertype'), - 'value' => rcube_label($options['namespace'] . 'folder')); + 'label' => $RCMAIL->gettext('foldertype'), + 'value' => $RCMAIL->gettext($options['namespace'] . 'folder')); } } @@ -256,7 +256,7 @@ function rcmail_folder_form($attrib) foreach ($tab['fieldsets'] as $fieldset) { $subcontent = rcmail_get_form_part($fieldset, $attrib); if ($subcontent) { - $content .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $subcontent) ."\n"; + $content .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($fieldset['name'])) . $subcontent) ."\n"; } } } @@ -265,7 +265,7 @@ function rcmail_folder_form($attrib) } if ($content && sizeof($form) > 1) { - $out .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) ."\n"; + $out .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($tab['name'])) . $content) ."\n"; } else { $out .= $content ."\n"; @@ -287,9 +287,9 @@ function rcmail_get_form_part($form, $attrib = array()) $table = new html_table(array('cols' => 2)); foreach ($form['content'] as $col => $colprop) { $colprop['id'] = '_'.$col; - $label = !empty($colprop['label']) ? $colprop['label'] : rcube_label($col); + $label = !empty($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col); - $table->add('title', html::label($colprop['id'], Q($label))); + $table->add('title', html::label($colprop['id'], rcube::Q($label))); $table->add(null, $colprop['value']); } $content = $table->show($attrib); @@ -302,7 +302,7 @@ function rcmail_get_form_part($form, $attrib = array()) } -//$OUTPUT->set_pagetitle(rcube_label('folders')); +//$OUTPUT->set_pagetitle($RCMAIL->gettext('folders')); // register UI objects $OUTPUT->add_handlers(array( diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc index edd4ba60d..974acb42a 100644 --- a/program/steps/settings/edit_identity.inc +++ b/program/steps/settings/edit_identity.inc @@ -23,14 +23,14 @@ define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0))); // edit-identity if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') { - $IDENTITY_RECORD = $RCMAIL->user->get_identity(get_input_value('_iid', RCUBE_INPUT_GPC)); + $IDENTITY_RECORD = $RCMAIL->user->get_identity(rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC)); if (is_array($IDENTITY_RECORD)) $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']); else { $OUTPUT->show_message('dberror', 'error'); // go to identities page - rcmail_overwrite_action('identities'); + $RCMAIL->overwrite_action('identities'); return; } } @@ -39,7 +39,7 @@ else { if (IDENTITIES_LEVEL > 1) { $OUTPUT->show_message('opnotpermitted', 'error'); // go to identities page - rcmail_overwrite_action('identities'); + $RCMAIL->overwrite_action('identities'); return; } else if (IDENTITIES_LEVEL == 1) { @@ -53,7 +53,7 @@ function rcube_identity_form($attrib) global $IDENTITY_RECORD, $RCMAIL, $OUTPUT; // Add HTML editor script(s) - rcube_html_editor('identity'); + $RCMAIL->html_editor('identity'); // add some labels to client $OUTPUT->add_label('noemailwarning', 'nonamewarning', 'converting', 'editorwarning'); @@ -65,21 +65,21 @@ function rcube_identity_form($attrib) // list of available cols $form = array( 'addressing' => array( - 'name' => rcube_label('settings'), + 'name' => $RCMAIL->gettext('settings'), 'content' => array( 'name' => array('type' => 'text', 'size' => $i_size), 'email' => array('type' => 'text', 'size' => $i_size), 'organization' => array('type' => 'text', 'size' => $i_size), 'reply-to' => array('type' => 'text', 'size' => $i_size), 'bcc' => array('type' => 'text', 'size' => $i_size), - 'standard' => array('type' => 'checkbox', 'label' => rcube_label('setdefault')), + 'standard' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('setdefault')), )), 'signature' => array( - 'name' => rcube_label('signature'), + 'name' => $RCMAIL->gettext('signature'), 'content' => array( 'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows, 'spellcheck' => true), - 'html_signature' => array('type' => 'checkbox', 'label' => rcube_label('htmlsignature'), + 'html_signature' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('htmlsignature'), 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'), )) ); @@ -90,7 +90,7 @@ function rcube_identity_form($attrib) $form['signature']['content']['signature']['is_escaped'] = true; // Correctly handle HTML entities in HTML editor (#1488483) - $IDENTITY_RECORD['signature'] = htmlspecialchars($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCMAIL_CHARSET); + $IDENTITY_RECORD['signature'] = htmlspecialchars($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCUBE_CHARSET); } // disable some field according to access level @@ -106,7 +106,7 @@ function rcube_identity_form($attrib) } } - $IDENTITY_RECORD['email'] = rcube_idn_to_utf8($IDENTITY_RECORD['email']); + $IDENTITY_RECORD['email'] = rcube_utils::idn_to_utf8($IDENTITY_RECORD['email']); // Allow plugins to modify identity form content $plugin = $RCMAIL->plugins->exec_hook('identity_form', array( @@ -137,12 +137,12 @@ function rcube_identity_form($attrib) $colprop['id'] = 'rcmfd_'.$col; $label = !empty($colprop['label']) ? $colprop['label'] : - rcube_label(str_replace('-', '', $col)); + $RCMAIL->gettext(str_replace('-', '', $col)); $value = !empty($colprop['value']) ? $colprop['value'] : - rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']); + rcube_output::get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']); - $table->add('title', html::label($colprop['id'], Q($label))); + $table->add('title', html::label($colprop['id'], rcube::Q($label))); $table->add(null, $value); } $content = $table->show($attrib); @@ -151,7 +151,7 @@ function rcube_identity_form($attrib) $content = $fieldset['content']; } - $out .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $content) ."\n"; + $out .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($fieldset['name'])) . $content) ."\n"; } $out .= $form_end; @@ -164,7 +164,7 @@ $OUTPUT->add_handler('identityform', 'rcube_identity_form'); $OUTPUT->set_env('identities_level', IDENTITIES_LEVEL); $OUTPUT->add_label('deleteidentityconfirm'); -$OUTPUT->set_pagetitle(rcube_label(($RCMAIL->action=='add-identity' ? 'newidentity' : 'edititem'))); +$OUTPUT->set_pagetitle($RCMAIL->gettext(($RCMAIL->action=='add-identity' ? 'newidentity' : 'edititem'))); if ($RCMAIL->action=='add-identity' && $OUTPUT->template_exists('identityadd')) $OUTPUT->send('identityadd'); diff --git a/program/steps/settings/edit_prefs.inc b/program/steps/settings/edit_prefs.inc index adf6b1623..93e27aedc 100644 --- a/program/steps/settings/edit_prefs.inc +++ b/program/steps/settings/edit_prefs.inc @@ -20,10 +20,10 @@ */ if (!$OUTPUT->ajax_call) - $OUTPUT->set_pagetitle(rcube_label('preferences')); + $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences')); -$CURR_SECTION = get_input_value('_section', RCUBE_INPUT_GPC); +$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GPC); list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION); function rcmail_user_prefs_form($attrib) diff --git a/program/steps/settings/edit_response.inc b/program/steps/settings/edit_response.inc index 49856775a..371d7ecc4 100644 --- a/program/steps/settings/edit_response.inc +++ b/program/steps/settings/edit_response.inc @@ -22,7 +22,7 @@ $responses = $RCMAIL->get_compose_responses(); // edit-response -if (($key = get_input_value('_key', RCUBE_INPUT_GPC))) { +if (($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC))) { foreach ($responses as $i => $response) { if ($response['key'] == $key) { $RESPONSE_RECORD = $response; @@ -34,8 +34,8 @@ if (($key = get_input_value('_key', RCUBE_INPUT_GPC))) { // save response if ($RCMAIL->action == 'save-response' && isset($_POST['_name']) && !$RESPONSE_RECORD['static']) { - $name = trim(get_input_value('_name', RCUBE_INPUT_POST)); - $text = trim(get_input_value('_text', RCUBE_INPUT_POST)); + $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST)); + $text = trim(rcube_utils::get_input_value('_text', rcube_utils::INPUT_POST)); if (!empty($name) && !empty($text)) { $dupes = 0; @@ -85,12 +85,12 @@ function rcube_response_form($attrib) $out = "$form_start\n"; $table = new html_table(array('cols' => 2)); - $label = rcube_label('responsename'); + $label = $RCMAIL->gettext('responsename'); - $table->add('title', html::label('ffname', Q(rcube_label('responsename')))); + $table->add('title', html::label('ffname', rcube::Q($RCMAIL->gettext('responsename')))); $table->add(null, rcube_output::get_edit_field('name', $RESPONSE_RECORD['name'], array('id' => 'ffname', 'size' => $attrib['size'], 'disabled' => $disabled), 'text')); - $table->add('title', html::label('fftext', Q(rcube_label('responsetext')))); + $table->add('title', html::label('fftext', rcube::Q($RCMAIL->gettext('responsetext')))); $table->add(null, rcube_output::get_edit_field('text', $RESPONSE_RECORD['text'], array('id' => 'fftext', 'size' => $attrib['textareacols'], 'rows' => $attrib['textarearows'], 'disabled' => $disabled), 'textarea')); $out .= $table->show($attrib); @@ -101,7 +101,7 @@ function rcube_response_form($attrib) $OUTPUT->set_env('readonly', !empty($RESPONSE_RECORD['static'])); $OUTPUT->add_handler('responseform', 'rcube_response_form'); -$OUTPUT->set_pagetitle(rcube_label(($RCMAIL->action=='add-response' ? 'savenewresponse' : 'editresponse'))); +$OUTPUT->set_pagetitle($RCMAIL->gettext($RCMAIL->action == 'add-response' ? 'savenewresponse' : 'editresponse')); $OUTPUT->send('responseedit'); diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 44482e938..118590318 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -20,7 +20,7 @@ +-----------------------------------------------------------------------+ */ -// WARNING: folder names in UI are encoded with RCMAIL_CHARSET +// WARNING: folder names in UI are encoded with RCUBE_CHARSET // init IMAP connection $STORAGE = $RCMAIL->get_storage(); @@ -28,7 +28,7 @@ $STORAGE = $RCMAIL->get_storage(); // subscribe mailbox if ($RCMAIL->action == 'subscribe') { - $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true, 'UTF7-IMAP'); if (strlen($mbox)) { $result = $STORAGE->subscribe(array($mbox)); @@ -53,28 +53,28 @@ if ($RCMAIL->action == 'subscribe') $OUTPUT->show_message('foldersubscribed', 'confirmation'); } else - rcmail_display_server_error('errorsaving'); + $RCMAIL->display_server_error('errorsaving'); } } // unsubscribe mailbox else if ($RCMAIL->action == 'unsubscribe') { - $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true, 'UTF7-IMAP'); if (strlen($mbox)) { $result = $STORAGE->unsubscribe(array($mbox)); if ($result) $OUTPUT->show_message('folderunsubscribed', 'confirmation'); else - rcmail_display_server_error('errorsaving'); + $RCMAIL->display_server_error('errorsaving'); } } // delete an existing mailbox else if ($RCMAIL->action == 'delete-folder') { - $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); - $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); + $mbox_utf8 = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); + $mbox = rcube_charset::convert($mbox_utf8, RCUBE_CHARSET, 'UTF7-IMAP'); if (strlen($mbox)) { $plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox)); @@ -98,22 +98,22 @@ else if ($RCMAIL->action == 'delete-folder') $OUTPUT->show_message('folderdeleted', 'confirmation'); // Clear content frame $OUTPUT->command('subscription_select'); - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); } else if (!$deleted) { - rcmail_display_server_error('errorsaving'); + $RCMAIL->display_server_error('errorsaving'); } } // rename an existing mailbox else if ($RCMAIL->action == 'rename-folder') { - $name_utf8 = trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, true)); - $oldname_utf8 = get_input_value('_folder_oldname', RCUBE_INPUT_POST, true); + $name_utf8 = trim(rcube_utils::get_input_value('_folder_newname', rcube_utils::INPUT_POST, true)); + $oldname_utf8 = rcube_utils::get_input_value('_folder_oldname', rcube_utils::INPUT_POST, true); if (strlen($name_utf8) && strlen($oldname_utf8)) { - $name = rcube_charset_convert($name_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); - $oldname = rcube_charset_convert($oldname_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); + $name = rcube_charset::convert($name_utf8, RCUBE_CHARSET, 'UTF7-IMAP'); + $oldname = rcube_charset::convert($oldname_utf8, RCUBE_CHARSET, 'UTF7-IMAP'); $rename = rcmail_rename_folder($oldname, $name); } @@ -122,15 +122,15 @@ else if ($RCMAIL->action == 'rename-folder') rcmail_update_folder_row($name, $oldname); } else if (!$rename) { - rcmail_display_server_error('errorsaving'); + $RCMAIL->display_server_error('errorsaving'); } } // clear mailbox else if ($RCMAIL->action == 'purge') { - $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); - $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); + $mbox_utf8 = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); + $mbox = rcube_charset::convert($mbox_utf8, RCUBE_CHARSET, 'UTF7-IMAP'); $delimiter = $STORAGE->get_hierarchy_delimiter(); $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/'; @@ -151,7 +151,7 @@ else if ($RCMAIL->action == 'purge') $OUTPUT->set_env('messagecount', 0); if ($delete) { $OUTPUT->show_message('folderpurged', 'confirmation'); - $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->command('set_quota', $RCMAIL->quota_content()); } else { $OUTPUT->show_message('messagemoved', 'confirmation'); @@ -160,24 +160,24 @@ else if ($RCMAIL->action == 'purge') $OUTPUT->command('show_folder', $mbox_utf8, null, true); } else { - rcmail_display_server_error('errorsaving'); + $RCMAIL->display_server_error('errorsaving'); } } // get mailbox size else if ($RCMAIL->action == 'folder-size') { - $name = get_input_value('_mbox', RCUBE_INPUT_POST, true); + $name = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); $size = $STORAGE->folder_size($name); // @TODO: check quota and show percentage usage of specified mailbox? if ($size !== false) { - $OUTPUT->command('folder_size_update', show_bytes($size)); + $OUTPUT->command('folder_size_update', $RCMAIL->show_bytes($size)); } else { - rcmail_display_server_error(); + $RCMAIL->display_server_error(); } } @@ -200,7 +200,7 @@ function rcube_subscription_form($attrib) if ($attrib['noheader'] !== true && $attrib['noheader'] != "true") { // add table header - $table->add_header('name', rcube_label('foldername')); + $table->add_header('name', $RCMAIL->gettext('foldername')); $table->add_header('subscribed', ''); } @@ -225,7 +225,7 @@ function rcube_subscription_form($attrib) $folder_id = $folder; $folder = $STORAGE->mod_folder($folder); $foldersplit = explode($delimiter, $folder); - $name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP'); + $name = rcube_charset::convert(array_pop($foldersplit), 'UTF7-IMAP'); $parent_folder = join($delimiter, $foldersplit); $level = count($foldersplit); @@ -234,7 +234,7 @@ function rcube_subscription_form($attrib) for ($i=1; $i<=$level; $i++) { $ancestor_folder = join($delimiter, array_slice($foldersplit, 0, $i)); if ($ancestor_folder && !$seen[$ancestor_folder]++) { - $ancestor_name = rcube_charset_convert($foldersplit[$i-1], 'UTF7-IMAP'); + $ancestor_name = rcube_charset::convert($foldersplit[$i-1], 'UTF7-IMAP'); $list_folders[] = array( 'id' => $ancestor_folder, 'name' => $ancestor_name, @@ -270,8 +270,8 @@ function rcube_subscription_form($attrib) $checkbox_subscribe = new html_checkbox(array( 'name' => '_subscribed[]', - 'title' => rcube_label('changesubscription'), - 'onclick' => JS_OBJECT_NAME.".command(this.checked?'subscribe':'unsubscribe',this.value)", + 'title' => $RCMAIL->gettext('changesubscription'), + 'onclick' => rcmail_output::JS_OBJECT_NAME.".command(this.checked?'subscribe':'unsubscribe',this.value)", )); // create list of available folders @@ -283,9 +283,9 @@ function rcube_subscription_form($attrib) $noselect = false; $classes = array($i%2 ? 'even' : 'odd'); - $folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP'); + $folder_utf8 = rcube_charset::convert($folder['id'], 'UTF7-IMAP'); $display_folder = str_repeat(' ', $folder['level']) - . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); + . rcube::Q($protected ? $RCMAIL->localize_foldername($folder['id']) : $folder['name']); if ($folder['virtual']) { $classes[] = 'virtual'; @@ -418,7 +418,7 @@ function rcmail_rename_folder($oldname, $newname) } -$OUTPUT->set_pagetitle(rcube_label('folders')); +$OUTPUT->set_pagetitle($RCMAIL->gettext('folders')); $OUTPUT->include_script('list.js'); $OUTPUT->set_env('prefix_ns', $STORAGE->get_namespace('prefix')); if ($STORAGE->get_capability('QUOTA')) { @@ -432,9 +432,8 @@ $OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting' // register UI objects $OUTPUT->add_handlers(array( 'foldersubscription' => 'rcube_subscription_form', - 'folderframe' => 'rcmail_folder_frame', - 'quotadisplay' => 'rcmail_quota_display', + 'folderframe' => 'rcmail_folder_frame', + 'quotadisplay' => array($RCMAIL, 'quota_display'), )); $OUTPUT->send('folders'); - diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 81744d904..c504e6c40 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -20,7 +20,7 @@ */ if (!$OUTPUT->ajax_call) { - $OUTPUT->set_pagetitle(rcube_label('preferences')); + $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences')); } // similar function as /steps/settings/identities.inc::rcmail_identity_frame() @@ -48,7 +48,7 @@ function rcmail_sections_list($attrib) list($list, $cols) = rcmail_user_prefs(); // create XHTML table - $out = rcube_table_output($attrib, $list, $cols, 'id'); + $out = $RCMAIL->table_output($attrib, $list, $cols, 'id'); // set client env $RCMAIL->output->add_gui_object('sectionslist', $attrib['id']); @@ -70,7 +70,7 @@ function rcmail_identities_list($attrib) // get identities list and define 'mail' column $list = $RCMAIL->user->list_identities(); foreach ($list as $idx => $row) { - $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_idn_to_utf8($row['email']) .'>'); + $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_utils::idn_to_utf8($row['email']) .'>'); } // get all identites from DB and define list of cols to be displayed @@ -81,7 +81,7 @@ function rcmail_identities_list($attrib) // @TODO: use <UL> instead of <TABLE> for identities list // create XHTML table - $out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id'); + $out = $RCMAIL->table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id'); // set client env $OUTPUT->add_gui_object('identitieslist', $attrib['id']); @@ -127,13 +127,13 @@ function rcmail_user_prefs($current = null) { global $RCMAIL; - $sections['general'] = array('id' => 'general', 'section' => rcube_label('uisettings')); - $sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview')); - $sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying')); - $sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition')); - $sections['addressbook'] = array('id' => 'addressbook','section' => rcube_label('addressbook')); - $sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders')); - $sections['server'] = array('id' => 'server', 'section' => rcube_label('serversettings')); + $sections['general'] = array('id' => 'general', 'section' => $RCMAIL->gettext('uisettings')); + $sections['mailbox'] = array('id' => 'mailbox', 'section' => $RCMAIL->gettext('mailboxview')); + $sections['mailview'] = array('id' => 'mailview','section' => $RCMAIL->gettext('messagesdisplaying')); + $sections['compose'] = array('id' => 'compose', 'section' => $RCMAIL->gettext('messagescomposition')); + $sections['addressbook'] = array('id' => 'addressbook','section' => $RCMAIL->gettext('addressbook')); + $sections['folders'] = array('id' => 'folders', 'section' => $RCMAIL->gettext('specialfolders')); + $sections['server'] = array('id' => 'server', 'section' => $RCMAIL->gettext('serversettings')); // hook + define list cols $plugin = $RCMAIL->plugins->exec_hook('preferences_sections_list', @@ -155,10 +155,10 @@ function rcmail_user_prefs($current = null) // general case 'general': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'skin' => array('name' => Q(rcube_label('skin'))), - 'browser' => array('name' => Q(rcube_label('browseroptions'))), - 'advanced'=> array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'skin' => array('name' => rcube::Q($RCMAIL->gettext('skin'))), + 'browser' => array('name' => rcube::Q($RCMAIL->gettext('browseroptions'))), + 'advanced'=> array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); // language selection @@ -175,7 +175,7 @@ function rcmail_user_prefs($current = null) $select->add(array_values($a_lang), array_keys($a_lang)); $blocks['main']['options']['language'] = array( - 'title' => html::label($field_id, Q(rcube_label('language'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('language'))), 'content' => $select->show($RCMAIL->user->language), ); } @@ -188,7 +188,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_timezone'; $select = new html_select(array('name' => '_timezone', 'id' => $field_id)); - $select->add(rcube_label('autodetect'), 'auto'); + $select->add($RCMAIL->gettext('autodetect'), 'auto'); $zones = array(); foreach (DateTimeZone::listIdentifiers() as $i => $tzs) { @@ -210,7 +210,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['timezone'] = array( - 'title' => html::label($field_id, Q(rcube_label('timezone'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('timezone'))), 'content' => $select->show((string)$config['timezone']), ); } @@ -232,7 +232,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['time_format'] = array( - 'title' => html::label($field_id, Q(rcube_label('timeformat'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('timeformat'))), 'content' => $select->show($RCMAIL->config->get('time_format')), ); } @@ -253,7 +253,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['date_format'] = array( - 'title' => html::label($field_id, Q(rcube_label('dateformat'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('dateformat'))), 'content' => $select->show($config['date_format']), ); } @@ -268,7 +268,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['prettydate'] = array( - 'title' => html::label($field_id, Q(rcube_label('prettydate'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('prettydate'))), 'content' => $input->show($config['prettydate']?1:0), ); } @@ -281,16 +281,16 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_refresh_interval'; $select = new html_select(array('name' => '_refresh_interval', 'id' => $field_id)); - $select->add(rcube_label('never'), 0); + $select->add($RCMAIL->gettext('never'), 0); foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) { if (!$config['min_refresh_interval'] || $config['min_refresh_interval'] <= $min * 60) { - $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))); + $label = $RCMAIL->gettext(array('name' => 'everynminutes', 'vars' => array('n' => $min))); $select->add($label, $min); } } $blocks['main']['options']['refresh_interval'] = array( - 'title' => html::label($field_id, Q(rcube_label('refreshinterval'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('refreshinterval'))), 'content' => $select->show($config['refresh_interval']/60), ); } @@ -318,16 +318,16 @@ function rcmail_user_prefs($current = null) if (is_array($meta) && $meta['name']) { $skinname = $meta['name']; - $author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), Q($meta['author'])) : Q($meta['author']); - $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), Q($meta['license'])) : Q($meta['license']); + $author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), rcube::Q($meta['author'])) : rcube::Q($meta['author']); + $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), rcube::Q($meta['license'])) : rcube::Q($meta['license']); } $blocks['skin']['options'][$skin]['content'] = html::label(array('class' => 'skinselection'), html::span('skinitem', $input->show($config['skin'], array('value' => $skin, 'id' => $field_id.$skin))) . html::span('skinitem', html::img(array('src' => $thumbnail, 'class' => 'skinthumbnail', 'alt' => $skin, 'width' => 64, 'height' => 64))) . - html::span('skinitem', html::span('skinname', Q($skinname)) . html::br() . + html::span('skinitem', html::span('skinname', rcube::Q($skinname)) . html::br() . html::span('skinauthor', $author_link ? 'by ' . $author_link : '') . html::br() . - html::span('skinlicense', $license_link ? rcube_label('license').': ' . $license_link : '')) + html::span('skinlicense', $license_link ? $RCMAIL->gettext('license').': ' . $license_link : '')) ); } } @@ -344,7 +344,7 @@ function rcmail_user_prefs($current = null) $checkbox = new html_checkbox(array('name' => '_standard_windows', 'id' => $field_id, 'value' => 1)); $blocks['browser']['options']['standard_windows'] = array( - 'title' => html::label($field_id, Q(rcube_label('standardwindows'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('standardwindows'))), 'content' => $checkbox->show($config['standard_windows']?1:0), ); } @@ -352,13 +352,13 @@ function rcmail_user_prefs($current = null) if ($current) { $product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail'); $RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');", - JS_OBJECT_NAME, JQ($product_name)), 'foot'); + rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'foot'); } $blocks['browser']['options']['mailtoprotohandler'] = array( 'content' => html::a(array( 'href' => '#', - 'id' => 'mailtoprotohandler'), Q(rcube_label('mailtoprotohandler'))), + 'id' => 'mailtoprotohandler'), rcube::Q($RCMAIL->gettext('mailtoprotohandler'))), ); break; @@ -366,9 +366,9 @@ function rcmail_user_prefs($current = null) // Mailbox view (mail screen) case 'mailbox': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'new_message' => array('name' => Q(rcube_label('newmessage'))), - 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'new_message' => array('name' => rcube::Q($RCMAIL->gettext('newmessage'))), + 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); // show config parameter for preview pane @@ -382,7 +382,7 @@ function rcmail_user_prefs($current = null) 'onchange' => "$('#rcmfd_preview_pane_mark_read').prop('disabled', !this.checked)")); $blocks['main']['options']['preview_pane'] = array( - 'title' => html::label($field_id, Q(rcube_label('previewpane'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('previewpane'))), 'content' => $input->show($config['preview_pane']?1:0), ); } @@ -400,16 +400,16 @@ function rcmail_user_prefs($current = null) $select = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id, 'disabled' => $config['preview_pane']?0:1)); - $select->add(rcube_label('never'), '-1'); - $select->add(rcube_label('immediately'), 0); + $select->add($RCMAIL->gettext('never'), '-1'); + $select->add($RCMAIL->gettext('immediately'), 0); foreach (array(5, 10, 20, 30) as $sec) { - $label = rcube_label(array('name' => 'afternseconds', 'vars' => array('n' => $sec))); + $label = $RCMAIL->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec))); $select->add($label, $sec); } $blocks['main']['options']['preview_pane_mark_read'] = array( - 'title' => html::label($field_id, Q(rcube_label('previewpanemarkread'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('previewpanemarkread'))), 'content' => $select->show(intval($config['preview_pane_mark_read'])), ); } @@ -421,14 +421,14 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_mdn_requests'; $select = new html_select(array('name' => '_mdn_requests', 'id' => $field_id)); - $select->add(rcube_label('askuser'), 0); - $select->add(rcube_label('autosend'), 1); - $select->add(rcube_label('autosendknown'), 3); - $select->add(rcube_label('autosendknownignore'), 4); - $select->add(rcube_label('ignore'), 2); + $select->add($RCMAIL->gettext('askuser'), 0); + $select->add($RCMAIL->gettext('autosend'), 1); + $select->add($RCMAIL->gettext('autosendknown'), 3); + $select->add($RCMAIL->gettext('autosendknownignore'), 4); + $select->add($RCMAIL->gettext('ignore'), 2); $blocks['main']['options']['mdn_requests'] = array( - 'title' => html::label($field_id, Q(rcube_label('mdnrequests'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mdnrequests'))), 'content' => $select->show($config['mdn_requests']), ); } @@ -444,12 +444,12 @@ function rcmail_user_prefs($current = null) if ($supported) { $field_id = 'rcmfd_autoexpand_threads'; $select = new html_select(array('name' => '_autoexpand_threads', 'id' => $field_id)); - $select->add(rcube_label('never'), 0); - $select->add(rcube_label('do_expand'), 1); - $select->add(rcube_label('expand_only_unread'), 2); + $select->add($RCMAIL->gettext('never'), 0); + $select->add($RCMAIL->gettext('do_expand'), 1); + $select->add($RCMAIL->gettext('expand_only_unread'), 2); $blocks['main']['options']['autoexpand_threads'] = array( - 'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autoexpand_threads'))), 'content' => $select->show($config['autoexpand_threads']), ); } @@ -466,7 +466,7 @@ function rcmail_user_prefs($current = null) $size = intval($config['mail_pagesize'] ? $config['mail_pagesize'] : $config['pagesize']); $blocks['main']['options']['pagesize'] = array( - 'title' => html::label($field_id, Q(rcube_label('pagesize'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))), 'content' => $input->show($size ? $size : 50), ); } @@ -480,7 +480,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1)); $blocks['new_message']['options']['check_all_folders'] = array( - 'title' => html::label($field_id, Q(rcube_label('checkallfolders'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('checkallfolders'))), 'content' => $input->show($config['check_all_folders']?1:0), ); } @@ -489,8 +489,8 @@ function rcmail_user_prefs($current = null) // Message viewing case 'mailview': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); // show checkbox to open message view in new window @@ -503,7 +503,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_message_extwin', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['message_extwin'] = array( - 'title' => html::label($field_id, Q(rcube_label('showinextwin'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showinextwin'))), 'content' => $input->show($config['message_extwin']?1:0), ); } @@ -518,7 +518,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_message_show_email', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['message_show_email'] = array( - 'title' => html::label($field_id, Q(rcube_label('showemail'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showemail'))), 'content' => $input->show($config['message_show_email']?1:0), ); } @@ -534,7 +534,7 @@ function rcmail_user_prefs($current = null) 'onchange' => "$('#rcmfd_show_images').prop('disabled', !this.checked).val(0)")); $blocks['main']['options']['prefer_html'] = array( - 'title' => html::label($field_id, Q(rcube_label('preferhtml'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('preferhtml'))), 'content' => $input->show($config['prefer_html']?1:0), ); } @@ -547,7 +547,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_default_charset'; $blocks['advanced']['options']['default_charset'] = array( - 'title' => html::label($field_id, Q(rcube_label('defaultcharset'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultcharset'))), 'content' => $RCMAIL->output->charset_selector(array( 'id' => $field_id, 'name' => '_default_charset', 'selected' => $config['default_charset'] ))); @@ -562,12 +562,12 @@ function rcmail_user_prefs($current = null) $input = new html_select(array('name' => '_show_images', 'id' => $field_id, 'disabled' => !$config['prefer_html'])); - $input->add(rcube_label('never'), 0); - $input->add(rcube_label('fromknownsenders'), 1); - $input->add(rcube_label('always'), 2); + $input->add($RCMAIL->gettext('never'), 0); + $input->add($RCMAIL->gettext('fromknownsenders'), 1); + $input->add($RCMAIL->gettext('always'), 2); $blocks['main']['options']['show_images'] = array( - 'title' => html::label($field_id, Q(rcube_label('showremoteimages'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showremoteimages'))), 'content' => $input->show($config['prefer_html'] ? $config['show_images'] : 0), ); } @@ -581,7 +581,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['inline_images'] = array( - 'title' => html::label($field_id, Q(rcube_label('showinlineimages'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showinlineimages'))), 'content' => $input->show($config['inline_images']?1:0), ); } @@ -596,7 +596,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['display_next'] = array( - 'title' => html::label($field_id, Q(rcube_label('displaynext'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('displaynext'))), 'content' => $input->show($config['display_next']?1:0), ); } @@ -605,10 +605,10 @@ function rcmail_user_prefs($current = null) // Mail composition case 'compose': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'sig' => array('name' => Q(rcube_label('signatureoptions'))), - 'spellcheck' => array('name' => Q(rcube_label('spellcheckoptions'))), - 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'sig' => array('name' => rcube::Q($RCMAIL->gettext('signatureoptions'))), + 'spellcheck' => array('name' => rcube::Q($RCMAIL->gettext('spellcheckoptions'))), + 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); // show checkbox to compose messages in a new window @@ -621,7 +621,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_compose_extwin', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['compose_extwin'] = array( - 'title' => html::label($field_id, Q(rcube_label('composeextwin'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('composeextwin'))), 'content' => $input->show($config['compose_extwin']?1:0), ); } @@ -634,13 +634,13 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_htmleditor'; $select = new html_select(array('name' => '_htmleditor', 'id' => $field_id)); - $select->add(rcube_label('never'), 0); - $select->add(rcube_label('always'), 1); - $select->add(rcube_label('htmlonreply'), 2); - $select->add(rcube_label('htmlonreplyandforward'), 3); + $select->add($RCMAIL->gettext('never'), 0); + $select->add($RCMAIL->gettext('always'), 1); + $select->add($RCMAIL->gettext('htmlonreply'), 2); + $select->add($RCMAIL->gettext('htmlonreplyandforward'), 3); $blocks['main']['options']['htmleditor'] = array( - 'title' => html::label($field_id, Q(rcube_label('htmleditor'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('htmleditor'))), 'content' => $select->show(intval($config['htmleditor'])), ); } @@ -653,14 +653,14 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_autosave'; $select = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox']))); - $select->add(rcube_label('never'), 0); + $select->add($RCMAIL->gettext('never'), 0); foreach (array(1, 3, 5, 10) as $i => $min) { - $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))); + $label = $RCMAIL->gettext(array('name' => 'everynminutes', 'vars' => array('n' => $min))); $select->add($label, $min*60); } $blocks['main']['options']['draft_autosave'] = array( - 'title' => html::label($field_id, Q(rcube_label('autosavedraft'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autosavedraft'))), 'content' => $select->show($config['draft_autosave']), ); } @@ -673,12 +673,12 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_param_folding'; $select = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id)); - $select->add(rcube_label('2231folding'), 0); - $select->add(rcube_label('miscfolding'), 1); - $select->add(rcube_label('2047folding'), 2); + $select->add($RCMAIL->gettext('2231folding'), 0); + $select->add($RCMAIL->gettext('miscfolding'), 1); + $select->add($RCMAIL->gettext('2047folding'), 2); $blocks['advanced']['options']['mime_param_folding'] = array( - 'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mimeparamfolding'))), 'content' => $select->show($config['mime_param_folding']), ); } @@ -692,7 +692,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1)); $blocks['advanced']['options']['force_7bit'] = array( - 'title' => html::label($field_id, Q(rcube_label('force7bit'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('force7bit'))), 'content' => $input->show($config['force_7bit']?1:0), ); } @@ -706,7 +706,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_mdn_default', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['mdn_default'] = array( - 'title' => html::label($field_id, Q(rcube_label('reqmdn'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('reqmdn'))), 'content' => $input->show($config['mdn_default']?1:0), ); } @@ -720,7 +720,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_dsn_default', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['dsn_default'] = array( - 'title' => html::label($field_id, Q(rcube_label('reqdsn'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('reqdsn'))), 'content' => $input->show($config['dsn_default']?1:0), ); } @@ -734,7 +734,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_reply_same_folder', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['reply_same_folder'] = array( - 'title' => html::label($field_id, Q(rcube_label('replysamefolder'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replysamefolder'))), 'content' => $input->show($config['reply_same_folder']?1:0), ); } @@ -747,12 +747,12 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_reply_mode'; $select = new html_select(array('name' => '_reply_mode', 'id' => $field_id)); - $select->add(rcube_label('replyempty'), -1); - $select->add(rcube_label('replybottomposting'), 0); - $select->add(rcube_label('replytopposting'), 1); + $select->add($RCMAIL->gettext('replyempty'), -1); + $select->add($RCMAIL->gettext('replybottomposting'), 0); + $select->add($RCMAIL->gettext('replytopposting'), 1); $blocks['main']['options']['reply_mode'] = array( - 'title' => html::label($field_id, Q(rcube_label('whenreplying'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('whenreplying'))), 'content' => $select->show(intval($config['reply_mode'])), ); } @@ -766,7 +766,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_spellcheck_before_send', 'id' => $field_id, 'value' => 1)); $blocks['spellcheck']['options']['spellcheck_before_send'] = array( - 'title' => html::label($field_id, Q(rcube_label('spellcheckbeforesend'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('spellcheckbeforesend'))), 'content' => $input->show($config['spellcheck_before_send']?1:0), ); } @@ -782,7 +782,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_'.$key, 'id' => 'rcmfd_'.$key, 'value' => 1)); $blocks['spellcheck']['options'][$key] = array( - 'title' => html::label($field_id, Q(rcube_label(str_replace('_', '', $key)))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext(str_replace('_', '', $key)))), 'content' => $input->show($config[$key]?1:0), ); } @@ -797,13 +797,13 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_show_sig'; $select = new html_select(array('name' => '_show_sig', 'id' => $field_id)); - $select->add(rcube_label('never'), 0); - $select->add(rcube_label('always'), 1); - $select->add(rcube_label('newmessageonly'), 2); - $select->add(rcube_label('replyandforwardonly'), 3); + $select->add($RCMAIL->gettext('never'), 0); + $select->add($RCMAIL->gettext('always'), 1); + $select->add($RCMAIL->gettext('newmessageonly'), 2); + $select->add($RCMAIL->gettext('replyandforwardonly'), 3); $blocks['sig']['options']['show_sig'] = array( - 'title' => html::label($field_id, Q(rcube_label('autoaddsignature'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autoaddsignature'))), 'content' => $select->show($RCMAIL->config->get('show_sig', 1)), ); } @@ -817,7 +817,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_strip_existing_sig', 'id' => $field_id, 'value' => 1)); $blocks['sig']['options']['strip_existing_sig'] = array( - 'title' => html::label($field_id, Q(rcube_label('replyremovesignature'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyremovesignature'))), 'content' => $input->show($config['strip_existing_sig']?1:0), ); } @@ -830,11 +830,11 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_forward_attachment'; $select = new html_select(array('name' => '_forward_attachment', 'id' => $field_id)); - $select->add(rcube_label('inline'), 0); - $select->add(rcube_label('asattachment'), 1); + $select->add($RCMAIL->gettext('inline'), 0); + $select->add($RCMAIL->gettext('asattachment'), 1); $blocks['main']['options']['forward_attachment'] = array( - 'title' => html::label($field_id, Q(rcube_label('forwardmode'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('forwardmode'))), 'content' => $select->show(intval($config['forward_attachment'])), ); } @@ -858,13 +858,13 @@ function rcmail_user_prefs($current = null) $select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id)); $select_default_font->add('', ''); - $fonts = rcube_fontdefs(); + $fonts = rcmail::font_defs(); foreach ($fonts as $fname => $font) { $select_default_font->add($fname, $fname); } $blocks['main']['options']['default_font'] = array( - 'title' => html::label($field_id, Q(rcube_label('defaultfont'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultfont'))), 'content' => $select_default_font->show($RCMAIL->config->get('default_font', 1)) . $select_default_font_size->show($RCMAIL->config->get('default_font_size', 1)) ); @@ -878,11 +878,11 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_reply_all_mode'; $select = new html_select(array('name' => '_reply_all_mode', 'id' => $field_id)); - $select->add(rcube_label('replyalldefault'), 0); - $select->add(rcube_label('replyalllist'), 1); + $select->add($RCMAIL->gettext('replyalldefault'), 0); + $select->add($RCMAIL->gettext('replyalllist'), 1); $blocks['main']['options']['reply_all_mode'] = array( - 'title' => html::label($field_id, Q(rcube_label('replyallmode'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyallmode'))), 'content' => $select->show(intval($config['reply_all_mode'])), ); } @@ -892,8 +892,8 @@ function rcmail_user_prefs($current = null) // Addressbook config case 'addressbook': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); if (!isset($no_override['default_addressbook']) @@ -911,7 +911,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['default_addressbook'] = array( - 'title' => html::label($field_id, Q(rcube_label('defaultabook'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultabook'))), 'content' => $select->show($config['default_addressbook']), ); } @@ -925,13 +925,13 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_addressbook_name_listing'; $select = new html_select(array('name' => '_addressbook_name_listing', 'id' => $field_id)); - $select->add(rcube_label('name'), 0); - $select->add(rcube_label('firstname') . ' ' . rcube_label('surname'), 1); - $select->add(rcube_label('surname') . ' ' . rcube_label('firstname'), 2); - $select->add(rcube_label('surname') . ', ' . rcube_label('firstname'), 3); + $select->add($RCMAIL->gettext('name'), 0); + $select->add($RCMAIL->gettext('firstname') . ' ' . $RCMAIL->gettext('surname'), 1); + $select->add($RCMAIL->gettext('surname') . ' ' . $RCMAIL->gettext('firstname'), 2); + $select->add($RCMAIL->gettext('surname') . ', ' . $RCMAIL->gettext('firstname'), 3); $blocks['main']['options']['list_name_listing'] = array( - 'title' => html::label($field_id, Q(rcube_label('listnamedisplay'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('listnamedisplay'))), 'content' => $select->show($config['addressbook_name_listing']), ); } @@ -945,12 +945,12 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_addressbook_sort_col'; $select = new html_select(array('name' => '_addressbook_sort_col', 'id' => $field_id)); - $select->add(rcube_label('name'), 'name'); - $select->add(rcube_label('firstname'), 'firstname'); - $select->add(rcube_label('surname'), 'surname'); + $select->add($RCMAIL->gettext('name'), 'name'); + $select->add($RCMAIL->gettext('firstname'), 'firstname'); + $select->add($RCMAIL->gettext('surname'), 'surname'); $blocks['main']['options']['sort_col'] = array( - 'title' => html::label($field_id, Q(rcube_label('listsorting'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('listsorting'))), 'content' => $select->show($config['addressbook_sort_col']), ); } @@ -966,7 +966,7 @@ function rcmail_user_prefs($current = null) $size = intval($config['addressbook_pagesize'] ? $config['addressbook_pagesize'] : $config['pagesize']); $blocks['main']['options']['pagesize'] = array( - 'title' => html::label($field_id, Q(rcube_label('pagesize'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))), 'content' => $input->show($size ? $size : 50), ); } @@ -980,7 +980,7 @@ function rcmail_user_prefs($current = null) $checkbox = new html_checkbox(array('name' => '_autocomplete_single', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['autocomplete_single'] = array( - 'title' => html::label($field_id, Q(rcube_label('autocompletesingle'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autocompletesingle'))), 'content' => $checkbox->show($config['autocomplete_single']?1:0), ); } @@ -989,8 +989,8 @@ function rcmail_user_prefs($current = null) // Special IMAP folders case 'folders': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); if (!isset($no_override['show_real_foldernames'])) { @@ -1002,14 +1002,14 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_show_real_foldernames', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['show_real_foldernames'] = array( - 'title' => html::label($field_id, Q(rcube_label('show_real_foldernames'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('show_real_foldernames'))), 'content' => $input->show($config['show_real_foldernames']?1:0), ); } // Configure special folders if (!isset($no_override['default_folders']) && $current) { - $select = rcmail_mailbox_select(array( + $select = $RCMAIL->folder_selector(array( 'noselection' => '---', 'realnames' => true, 'maxlength' => 30, @@ -1027,7 +1027,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['drafts_mbox'] = array( - 'title' => Q(rcube_label('drafts')), + 'title' => rcube::Q($RCMAIL->gettext('drafts')), 'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox", 'onchange' => $onchange)), ); } @@ -1038,7 +1038,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['sent_mbox'] = array( - 'title' => Q(rcube_label('sent')), + 'title' => rcube::Q($RCMAIL->gettext('sent')), 'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox", 'onchange' => '')), ); } @@ -1049,7 +1049,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['junk_mbox'] = array( - 'title' => Q(rcube_label('junk')), + 'title' => rcube::Q($RCMAIL->gettext('junk')), 'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox", 'onchange' => $onchange)), ); } @@ -1060,7 +1060,7 @@ function rcmail_user_prefs($current = null) } $blocks['main']['options']['trash_mbox'] = array( - 'title' => Q(rcube_label('trash')), + 'title' => rcube::Q($RCMAIL->gettext('trash')), 'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox", 'onchange' => $onchange)), ); } @@ -1069,9 +1069,9 @@ function rcmail_user_prefs($current = null) // Server settings case 'server': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'maintenance' => array('name' => Q(rcube_label('maintenance'))), - 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), + 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), + 'maintenance' => array('name' => rcube::Q($RCMAIL->gettext('maintenance'))), + 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), ); if (!isset($no_override['read_when_deleted'])) { @@ -1083,7 +1083,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['read_when_deleted'] = array( - 'title' => html::label($field_id, Q(rcube_label('readwhendeleted'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('readwhendeleted'))), 'content' => $input->show($config['read_when_deleted']?1:0), ); } @@ -1097,7 +1097,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['flag_for_deletion'] = array( - 'title' => html::label($field_id, Q(rcube_label('flagfordeletion'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('flagfordeletion'))), 'content' => $input->show($config['flag_for_deletion']?1:0), ); } @@ -1112,7 +1112,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['skip_deleted'] = array( - 'title' => html::label($field_id, Q(rcube_label('skipdeleted'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('skipdeleted'))), 'content' => $input->show($config['skip_deleted']?1:0), ); } @@ -1126,7 +1126,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_delete_always', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['delete_always'] = array( - 'title' => html::label($field_id, Q(rcube_label('deletealways'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('deletealways'))), 'content' => $input->show($config['delete_always']?1:0), ); } @@ -1140,7 +1140,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_delete_junk', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['delete_junk'] = array( - 'title' => html::label($field_id, Q(rcube_label('deletejunk'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('deletejunk'))), 'content' => $input->show($config['delete_junk']?1:0), ); } @@ -1155,7 +1155,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1)); $blocks['maintenance']['options']['logout_purge'] = array( - 'title' => html::label($field_id, Q(rcube_label('logoutclear'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('logoutclear'))), 'content' => $input->show($config['logout_purge']?1:0), ); } @@ -1170,7 +1170,7 @@ function rcmail_user_prefs($current = null) $input = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1)); $blocks['maintenance']['options']['logout_expunge'] = array( - 'title' => html::label($field_id, Q(rcube_label('logoutcompact'))), + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('logoutcompact'))), 'content' => $input->show($config['logout_expunge']?1:0), ); } @@ -1265,19 +1265,19 @@ function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class $storage = $RCMAIL->get_storage(); $delimiter = $storage->get_hierarchy_delimiter(); - $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP'); + $name_utf8 = rcube_charset::convert($name, 'UTF7-IMAP'); $protected = $protect_folders && in_array($name, $default_folders); $foldersplit = explode($delimiter, $storage->mod_folder($name)); $level = count($foldersplit) - 1; $display_name = str_repeat(' ', $level) - . Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP')); + . rcube::Q($protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP')); if ($oldname === null) $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, $subscribe, false, $class_name); else - $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldname, 'UTF7-IMAP'), + $OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'), $name_utf8, $display_name, $protected, $class_name); } diff --git a/program/steps/settings/identities.inc b/program/steps/settings/identities.inc index 82a1841a3..7072acf72 100644 --- a/program/steps/settings/identities.inc +++ b/program/steps/settings/identities.inc @@ -21,7 +21,7 @@ define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0))); -$OUTPUT->set_pagetitle(rcube_label('identities')); +$OUTPUT->set_pagetitle($RCMAIL->gettext('identities')); $OUTPUT->include_script('list.js'); diff --git a/program/steps/settings/responses.inc b/program/steps/settings/responses.inc index cfc4148c3..45d1405f7 100644 --- a/program/steps/settings/responses.inc +++ b/program/steps/settings/responses.inc @@ -21,8 +21,8 @@ if (!empty($_POST['_insert'])) { - $name = trim(get_input_value('_name', RCUBE_INPUT_POST)); - $text = trim(get_input_value('_text', RCUBE_INPUT_POST)); + $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST)); + $text = trim(rcube_utils::get_input_value('_text', rcube_utils::INPUT_POST)); if (!empty($name) && !empty($text)) { $dupes = 0; @@ -40,10 +40,10 @@ if (!empty($_POST['_insert'])) { if ($RCMAIL->user->save_prefs(array('compose_responses' => $responses))) { $RCMAIL->output->command('add_response_item', $response); - $RCMAIL->output->command('display_message', rcube_label('successfullysaved'), 'confirmation'); + $RCMAIL->output->command('display_message', $RCMAIL->gettext('successfullysaved'), 'confirmation'); } else { - $RCMAIL->output->command('display_message', rcube_label('errorsaving'), 'error'); + $RCMAIL->output->command('display_message', $RCMAIL->gettext('errorsaving'), 'error'); } } @@ -53,7 +53,7 @@ if (!empty($_POST['_insert'])) { if ($RCMAIL->action == 'delete-response') { - if ($key = get_input_value('_key', RCUBE_INPUT_GPC)) { + if ($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC)) { $responses = $RCMAIL->get_compose_responses(false, true); foreach ($responses as $i => $response) { if (empty($response['key'])) @@ -67,7 +67,7 @@ if ($RCMAIL->action == 'delete-response') { } if ($deleted) { - $RCMAIL->output->command('display_message', rcube_label('deletedsuccessfully'), 'confirmation'); + $RCMAIL->output->command('display_message', $RCMAIL->gettext('deletedsuccessfully'), 'confirmation'); $RCMAIL->output->command('remove_response', $key); } @@ -77,7 +77,7 @@ if ($RCMAIL->action == 'delete-response') { } -$OUTPUT->set_pagetitle(rcube_label('responses')); +$OUTPUT->set_pagetitle($RCMAIL->gettext('responses')); $OUTPUT->include_script('list.js'); @@ -95,7 +95,7 @@ function rcmail_responses_list($attrib) 'cols' => array('name') )); - $out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'key'); + $out = $RCMAIL->table_output($attrib, $plugin['list'], $plugin['cols'], 'key'); // set client env $OUTPUT->add_gui_object('responseslist', $attrib['id']); diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc index 72a631cfc..f876ff8e0 100644 --- a/program/steps/settings/save_folder.inc +++ b/program/steps/settings/save_folder.inc @@ -19,18 +19,18 @@ +-----------------------------------------------------------------------+ */ -// WARNING: folder names in UI are encoded with RCMAIL_CHARSET +// WARNING: folder names in UI are encoded with RCUBE_CHARSET // init IMAP connection $STORAGE = $RCMAIL->get_storage(); -$name = trim(get_input_value('_name', RCUBE_INPUT_POST, true)); -$old = get_input_value('_mbox', RCUBE_INPUT_POST, true); -$path = get_input_value('_parent', RCUBE_INPUT_POST, true); +$name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); +$old = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); +$path = rcube_utils::get_input_value('_parent', rcube_utils::INPUT_POST, true); -$name_imap = rcube_charset_convert($name, RCMAIL_CHARSET, 'UTF7-IMAP'); -$old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP'); +$name_imap = rcube_charset::convert($name, RCUBE_CHARSET, 'UTF7-IMAP'); +$old_imap = rcube_charset::convert($old, RCUBE_CHARSET, 'UTF7-IMAP'); // $path is in UTF7-IMAP already $delimiter = $STORAGE->get_hierarchy_delimiter(); @@ -40,16 +40,16 @@ $options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array(); if ($options['protected'] || $options['norename']) { } else if (!strlen($name)) { - $error = rcube_label('namecannotbeempty'); + $error = $RCMAIL->gettext('namecannotbeempty'); } else if (mb_strlen($name) > 128) { - $error = rcube_label('nametoolong'); + $error = $RCMAIL->gettext('nametoolong'); } else { // these characters are problematic e.g. when used in LIST/LSUB foreach (array($delimiter, '%', '*') as $char) { if (strpos($name, $delimiter) !== false) { - $error = rcube_label('forbiddencharacter') . " ($char)"; + $error = $RCMAIL->gettext('forbiddencharacter') . " ($char)"; break; } } @@ -76,7 +76,7 @@ if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) if ($parent_opts['namespace'] != 'personal' && (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts['rights']))) ) { - $error = rcube_label('parentnotwritable'); + $error = $RCMAIL->gettext('parentnotwritable'); } } @@ -90,9 +90,9 @@ else { $folder['options'] = $options; $folder['settings'] = array( // List view mode: 0-list, 1-threads - 'view_mode' => (int) get_input_value('_viewmode', RCUBE_INPUT_POST), - 'sort_column' => get_input_value('_sortcol', RCUBE_INPUT_POST), - 'sort_order' => get_input_value('_sortord', RCUBE_INPUT_POST), + 'view_mode' => (int) rcube_utils::get_input_value('_viewmode', rcube_utils::INPUT_POST), + 'sort_column' => rcube_utils::get_input_value('_sortcol', rcube_utils::INPUT_POST), + 'sort_order' => rcube_utils::get_input_value('_sortord', rcube_utils::INPUT_POST), ); } @@ -199,4 +199,4 @@ else if (!$error) { } } -rcmail_overwrite_action('edit-folder'); +$RCMAIL->overwrite_action('edit-folder'); diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc index d3b132f8b..5bd04003d 100644 --- a/program/steps/settings/save_identity.inc +++ b/program/steps/settings/save_identity.inc @@ -28,7 +28,7 @@ $updated = $default_id = false; // check input if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))) { $OUTPUT->show_message('formincomplete', 'warning'); - rcmail_overwrite_action('edit-identity'); + $RCMAIL->overwrite_action('edit-identity'); return; } @@ -36,7 +36,7 @@ $save_data = array(); foreach ($a_save_cols as $col) { $fname = '_'.$col; if (isset($_POST[$fname])) - $save_data[$col] = get_input_value($fname, RCUBE_INPUT_POST, true); + $save_data[$col] = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true); } // set "off" values for checkboxes that were not checked, and therefore @@ -61,17 +61,17 @@ else if (IDENTITIES_LEVEL == 4) { } // Validate e-mail addresses -$email_checks = array(rcube_idn_to_ascii($save_data['email'])); +$email_checks = array(rcube_utils::idn_to_ascii($save_data['email'])); foreach (array('reply-to', 'bcc') as $item) { foreach (rcube_mime::decode_address_list($save_data[$item], null, false) as $rcpt) - $email_checks[] = rcube_idn_to_ascii($rcpt['mailto']); + $email_checks[] = rcube_utils::idn_to_ascii($rcpt['mailto']); } foreach ($email_checks as $email) { - if ($email && !check_email($email)) { + if ($email && !rcube_utils::check_email($email)) { // show error message - $OUTPUT->show_message('emailformaterror', 'error', array('email' => rcube_idn_to_utf8($email)), false); - rcmail_overwrite_action('edit-identity'); + $OUTPUT->show_message('emailformaterror', 'error', array('email' => rcube_utils::idn_to_utf8($email)), false); + $RCMAIL->overwrite_action('edit-identity'); return; } } @@ -87,7 +87,7 @@ if (!empty($save_data['signature']) && !empty($save_data['html_signature'])) { // update an existing contact if ($_POST['_iid']) { - $iid = get_input_value('_iid', RCUBE_INPUT_POST); + $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_POST); if (in_array(IDENTITIES_LEVEL, array(1,3,4))) { // merge with old identity data, fixes #1488834 @@ -100,7 +100,7 @@ if ($_POST['_iid']) { $save_data = $plugin['record']; if ($save_data['email']) - $save_data['email'] = rcube_idn_to_ascii($save_data['email']); + $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']); if (!$plugin['abort']) $updated = $RCMAIL->user->update_identity($iid, $save_data); else @@ -114,13 +114,13 @@ if ($_POST['_iid']) { if ($_POST['_framed']) { // update the changed col in list - $OUTPUT->command('parent.update_identity_row', $iid, Q(trim($save_data['name'] . ' <' . rcube_idn_to_utf8($save_data['email']) .'>'))); + $OUTPUT->command('parent.update_identity_row', $iid, rcube::Q(trim($save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>'))); } } else { // show error message $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); - rcmail_overwrite_action('edit-identity'); + $RCMAIL->overwrite_action('edit-identity'); return; } } @@ -135,7 +135,7 @@ else if (IDENTITIES_LEVEL < 2) { $save_data = $plugin['record']; if ($save_data['email']) - $save_data['email'] = rcube_idn_to_ascii($save_data['email']); + $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']); if (!$plugin['abort']) $insert_id = $save_data['email'] ? $RCMAIL->user->insert_identity($save_data) : null; @@ -152,13 +152,13 @@ else if (IDENTITIES_LEVEL < 2) { if ($_POST['_framed']) { // add a new row to the list - $OUTPUT->command('parent.update_identity_row', $insert_id, Q(trim($save_data['name'] . ' <' . rcube_idn_to_utf8($save_data['email']) .'>')), true); + $OUTPUT->command('parent.update_identity_row', $insert_id, rcube::Q(trim($save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>')), true); } } else { // show error message $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); - rcmail_overwrite_action('edit-identity'); + $RCMAIL->overwrite_action('edit-identity'); return; } } @@ -172,10 +172,10 @@ if ($default_id) // go to next step if (!empty($_REQUEST['_framed'])) { - rcmail_overwrite_action('edit-identity'); + $RCMAIL->overwrite_action('edit-identity'); } else - rcmail_overwrite_action('identities'); + $RCMAIL->overwrite_action('identities'); /** @@ -185,14 +185,14 @@ function rcmail_wash_html($html) { // Add header with charset spec., washtml cannot work without that $html = '<html><head>' - . '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />' + . '<meta http-equiv="Content-Type" content="text/html; charset='.RCUBE_CHARSET.'" />' . '</head><body>' . $html . '</body></html>'; // clean HTML with washhtml by Frederic Motte $wash_opts = array( 'show_washed' => false, 'allow_remote' => 1, - 'charset' => RCMAIL_CHARSET, + 'charset' => RCUBE_CHARSET, 'html_elements' => array('body', 'link'), 'html_attribs' => array('rel', 'type'), ); @@ -204,7 +204,7 @@ function rcmail_wash_html($html) //$washer->add_callback('style', 'rcmail_washtml_callback'); // Remove non-UTF8 characters (#1487813) - $html = rc_utf8_clean($html); + $html = rcube_charset::clean($html); $html = $washer->wash($html); diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index bcd05bb85..325c66ae8 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -$CURR_SECTION = get_input_value('_section', RCUBE_INPUT_POST); +$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_POST); $a_user_prefs = array(); @@ -28,14 +28,14 @@ switch ($CURR_SECTION) { case 'general': $a_user_prefs = array( - 'language' => isset($_POST['_language']) ? get_input_value('_language', RCUBE_INPUT_POST) : $CONFIG['language'], - 'timezone' => isset($_POST['_timezone']) ? get_input_value('_timezone', RCUBE_INPUT_POST) : $CONFIG['timezone'], - 'date_format' => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'], - 'time_format' => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), + 'language' => isset($_POST['_language']) ? rcube_utils::get_input_value('_language', rcube_utils::INPUT_POST) : $CONFIG['language'], + 'timezone' => isset($_POST['_timezone']) ? rcube_utils::get_input_value('_timezone', rcube_utils::INPUT_POST) : $CONFIG['timezone'], + 'date_format' => isset($_POST['_date_format']) ? rcube_utils::get_input_value('_date_format', rcube_utils::INPUT_POST) : $CONFIG['date_format'], + 'time_format' => isset($_POST['_time_format']) ? rcube_utils::get_input_value('_time_format', rcube_utils::INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), 'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE, 'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'], 'standard_windows' => isset($_POST['_standard_windows']) ? TRUE : FALSE, - 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], + 'skin' => isset($_POST['_skin']) ? rcube_utils::get_input_value('_skin', rcube_utils::INPUT_POST) : $CONFIG['skin'], ); // compose derived date/time format strings @@ -66,7 +66,7 @@ switch ($CURR_SECTION) 'inline_images' => isset($_POST['_inline_images']) ? TRUE : FALSE, 'show_images' => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : 0, 'display_next' => isset($_POST['_display_next']) ? TRUE : FALSE, - 'default_charset' => get_input_value('_default_charset', RCUBE_INPUT_POST), + 'default_charset' => rcube_utils::get_input_value('_default_charset', rcube_utils::INPUT_POST), ); break; @@ -88,8 +88,8 @@ switch ($CURR_SECTION) 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1, 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), - 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST), - 'default_font_size' => get_input_value('_default_font_size', RCUBE_INPUT_POST), + 'default_font' => rcube_utils::get_input_value('_default_font', rcube_utils::INPUT_POST), + 'default_font_size' => rcube_utils::get_input_value('_default_font_size', rcube_utils::INPUT_POST), 'reply_all_mode' => intval($_POST['_reply_all_mode']), 'forward_attachment' => !empty($_POST['_forward_attachment']), ); @@ -98,10 +98,10 @@ switch ($CURR_SECTION) case 'addressbook': $a_user_prefs = array( - 'default_addressbook' => get_input_value('_default_addressbook', RCUBE_INPUT_POST, true), + 'default_addressbook' => rcube_utils::get_input_value('_default_addressbook', rcube_utils::INPUT_POST, true), 'autocomplete_single' => isset($_POST['_autocomplete_single']) ? TRUE : FALSE, - 'addressbook_sort_col' => get_input_value('_addressbook_sort_col', RCUBE_INPUT_POST), - 'addressbook_name_listing' => intval(get_input_value('_addressbook_name_listing', RCUBE_INPUT_POST)), + 'addressbook_sort_col' => rcube_utils::get_input_value('_addressbook_sort_col', rcube_utils::INPUT_POST), + 'addressbook_name_listing' => intval(rcube_utils::get_input_value('_addressbook_name_listing', rcube_utils::INPUT_POST)), 'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'], ); @@ -124,10 +124,10 @@ switch ($CURR_SECTION) $a_user_prefs = array( 'show_real_foldernames' => isset($_POST['_show_real_foldernames']) ? TRUE : FALSE, - 'drafts_mbox' => get_input_value('_drafts_mbox', RCUBE_INPUT_POST, true), - 'sent_mbox' => get_input_value('_sent_mbox', RCUBE_INPUT_POST, true), - 'junk_mbox' => get_input_value('_junk_mbox', RCUBE_INPUT_POST, true), - 'trash_mbox' => get_input_value('_trash_mbox', RCUBE_INPUT_POST, true), + 'drafts_mbox' => rcube_utils::get_input_value('_drafts_mbox', rcube_utils::INPUT_POST, true), + 'sent_mbox' => rcube_utils::get_input_value('_sent_mbox', rcube_utils::INPUT_POST, true), + 'junk_mbox' => rcube_utils::get_input_value('_junk_mbox', rcube_utils::INPUT_POST, true), + 'trash_mbox' => rcube_utils::get_input_value('_trash_mbox', rcube_utils::INPUT_POST, true), ); break; @@ -221,5 +221,4 @@ else $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); // display the form again -rcmail_overwrite_action('edit-prefs'); - +$RCMAIL->overwrite_action('edit-prefs'); diff --git a/program/steps/utils/html2text.inc b/program/steps/utils/html2text.inc index c6481b197..c01443b22 100644 --- a/program/steps/utils/html2text.inc +++ b/program/steps/utils/html2text.inc @@ -22,7 +22,7 @@ $html = $HTTP_RAW_POST_DATA; // Replace emoticon images with its text representation -$html = rcmail_replace_emoticons($html); +$html = $RCMAIL->replace_emoticons($html); $converter = new rcube_html2text($html, false, true, 0); diff --git a/program/steps/utils/modcss.inc b/program/steps/utils/modcss.inc index 1a28c6598..c8a7cb524 100644 --- a/program/steps/utils/modcss.inc +++ b/program/steps/utils/modcss.inc @@ -55,7 +55,7 @@ $ctype = '~Content-Type:\s+text/(css|plain)~i'; if ($source !== false && preg_match($ctype, $headers)) { header('Content-Type: text/css'); - echo rcmail_mod_css_styles($source, preg_replace('/[^a-z0-9]/i', '', $_GET['_c'])); + echo rcube_utils::mod_css_styles($source, preg_replace('/[^a-z0-9]/i', '', $_GET['_c'])); exit; } diff --git a/program/steps/utils/save_pref.inc b/program/steps/utils/save_pref.inc index 7c30be71b..183c398d3 100644 --- a/program/steps/utils/save_pref.inc +++ b/program/steps/utils/save_pref.inc @@ -19,9 +19,9 @@ +-----------------------------------------------------------------------+ */ -$name = get_input_value('_name', RCUBE_INPUT_POST); -$value = get_input_value('_value', RCUBE_INPUT_POST); -$sessname = get_input_value('_session', RCUBE_INPUT_POST); +$name = rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST); +$value = rcube_utils::get_input_value('_value', rcube_utils::INPUT_POST); +$sessname = rcube_utils::get_input_value('_session', rcube_utils::INPUT_POST); // Whitelisted preferences and session variables, others // can be added by plugins @@ -39,7 +39,7 @@ $whitelist = array_merge($whitelist, $RCMAIL->plugins->allowed_prefs); $whitelist_sess = array_merge($whitelist_sess, $RCMAIL->plugins->allowed_session_prefs); if (!in_array($name, $whitelist) || ($sessname && !in_array($sessname, $whitelist_sess))) { - raise_error(array('code' => 500, 'type' => 'php', + rcube::raise_error(array('code' => 500, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => sprintf("Hack attempt detected (user: %s)", $RCMAIL->get_user_name())), true, false); diff --git a/program/steps/utils/spell.inc b/program/steps/utils/spell.inc index 595cfd6f2..c8807e32f 100644 --- a/program/steps/utils/spell.inc +++ b/program/steps/utils/spell.inc @@ -20,7 +20,7 @@ */ // read input -$lang = get_input_value('lang', RCUBE_INPUT_GET); +$lang = rcube_utils::get_input_value('lang', rcube_utils::INPUT_GET); $data = file_get_contents('php://input'); $learn_word = strpos($data, '<learnword>'); @@ -29,13 +29,13 @@ $learn_word = strpos($data, '<learnword>'); $left = strpos($data, '<text>'); $right = strrpos($data, '</text>'); $data = substr($data, $left+6, $right-($left+6)); -$data = html_entity_decode($data, ENT_QUOTES, RCMAIL_CHARSET); +$data = html_entity_decode($data, ENT_QUOTES, RCUBE_CHARSET); $spellchecker = new rcube_spellchecker($lang); if ($learn_word) { $spellchecker->add_word($data); - $result = '<?xml version="1.0" encoding="'.RCMAIL_CHARSET.'"?><learnwordresult></learnwordresult>'; + $result = '<?xml version="1.0" encoding="'.RCUBE_CHARSET.'"?><learnwordresult></learnwordresult>'; } else { $spellchecker->check($data); @@ -56,6 +56,6 @@ if ($err = $spellchecker->error()) { header("Content-Length: " . strlen($result)); // Don't use server's default Content-Type charset (#1486406) -header("Content-Type: text/xml; charset=" . RCMAIL_CHARSET); +header("Content-Type: text/xml; charset=" . RCUBE_CHARSET); print $result; exit; diff --git a/program/steps/utils/spell_html.inc b/program/steps/utils/spell_html.inc index 96b41e230..27b14acef 100644 --- a/program/steps/utils/spell_html.inc +++ b/program/steps/utils/spell_html.inc @@ -56,7 +56,7 @@ if ($error = $spellchecker->error()) { } // send output -header("Content-Type: text/xml; charset=".RCMAIL_CHARSET); +header("Content-Type: text/xml; charset=".RCUBE_CHARSET); echo json_encode($result); exit; |