diff options
Diffstat (limited to 'program/steps/mail')
-rw-r--r-- | program/steps/mail/addcontact.inc | 8 | ||||
-rw-r--r-- | program/steps/mail/attachments.inc | 29 | ||||
-rw-r--r-- | program/steps/mail/autocomplete.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/check_recent.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 160 | ||||
-rw-r--r-- | program/steps/mail/copy.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/folders.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 224 | ||||
-rw-r--r-- | program/steps/mail/get.inc | 52 | ||||
-rw-r--r-- | program/steps/mail/headers.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/import.inc | 11 | ||||
-rw-r--r-- | program/steps/mail/list.inc | 8 | ||||
-rw-r--r-- | program/steps/mail/list_contacts.inc | 18 | ||||
-rw-r--r-- | program/steps/mail/mark.inc | 12 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 22 | ||||
-rw-r--r-- | program/steps/mail/pagenav.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/search.inc | 12 | ||||
-rw-r--r-- | program/steps/mail/search_contacts.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 74 | ||||
-rw-r--r-- | program/steps/mail/sendmdn.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 28 | ||||
-rw-r--r-- | program/steps/mail/viewsource.inc | 4 |
22 files changed, 359 insertions, 351 deletions
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__, |