summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/copy.inc4
-rw-r--r--program/steps/addressbook/delete.inc21
-rw-r--r--program/steps/addressbook/edit.inc24
-rw-r--r--program/steps/addressbook/export.inc2
-rw-r--r--program/steps/addressbook/func.inc160
-rw-r--r--program/steps/addressbook/groups.inc16
-rw-r--r--program/steps/addressbook/import.inc45
-rw-r--r--program/steps/addressbook/mailto.inc4
-rw-r--r--program/steps/addressbook/move.inc4
-rw-r--r--program/steps/addressbook/photo.inc8
-rw-r--r--program/steps/addressbook/save.inc34
-rw-r--r--program/steps/addressbook/search.inc34
-rw-r--r--program/steps/addressbook/show.inc26
-rw-r--r--program/steps/addressbook/upload_photo.inc16
14 files changed, 209 insertions, 189 deletions
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 3bb2ef500..b2aac8a71 100644
--- a/program/steps/addressbook/delete.inc
+++ b/program/steps/addressbook/delete.inc
@@ -51,8 +51,21 @@ foreach ($cids as $source => $cid)
$deleted = !$plugin['abort'] ? $CONTACTS->delete($cid, $undo_time < 1) : $plugin['result'];
if (!$deleted) {
- $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'contactdelerror', 'error');
- $OUTPUT->command('list_contacts');
+ if ($plugin['message']) {
+ $error = $plugin['message'];
+ }
+ else if (($error = $CONTACTS->get_error()) && $error['message']) {
+ $error = $error['message'];
+ }
+ else {
+ $error = 'contactdelerror';
+ }
+
+ $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);
$OUTPUT->send();
}
else {
@@ -113,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']),
), '&raquo;');
}
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 60f5d7b61..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');
@@ -249,7 +250,7 @@ if (is_array($_FILES['_file'])) {
$IMPORT_STATS->inserted = $IMPORT_STATS->skipped = $IMPORT_STATS->invalid = $IMPORT_STATS->errors = 0;
if ($replace) {
- $CONTACTS->delete_all();
+ $CONTACTS->delete_all($CONTACTS->groups && $with_groups < 2);
}
if ($with_groups) {
@@ -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');
}