diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/addressbook/edit.inc | 15 | ||||
-rw-r--r-- | program/steps/addressbook/save.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 50 | ||||
-rw-r--r-- | program/steps/mail/folders.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 12 | ||||
-rw-r--r-- | program/steps/settings/edit_identity.inc | 10 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 15 | ||||
-rw-r--r-- | program/steps/settings/manage_folders.inc | 12 | ||||
-rw-r--r-- | program/steps/settings/save_identity.inc | 2 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 5 |
13 files changed, 64 insertions, 79 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index e3218a35e..64eab86eb 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -33,10 +33,10 @@ if ($CONTACTS->readonly) function rcmail_contact_editform($attrib) { - global $CONTACTS, $OUTPUT; + global $RCMAIL, $CONTACTS, $OUTPUT; // check if we have a valid result - if ($GLOBALS['_action'] != 'add' && !(($result = $CONTACTS->get_result()) && ($record = $result->first()))) + if ($RCMAIL->action != 'add' && !(($result = $CONTACTS->get_result()) && ($record = $result->first()))) { $OUTPUT->show_message('contactnotfound'); return false; @@ -83,20 +83,19 @@ $OUTPUT->add_handler('contacteditform', 'rcmail_contact_editform'); // similar function as in /steps/settings/edit_identity.inc function get_form_tags($attrib) { - global $CONTACTS, $OUTPUT, $EDIT_FORM, $SESS_HIDDEN_FIELD; + global $CONTACTS, $EDIT_FORM, $RCMAIL; $result = $CONTACTS->get_result(); $form_start = ''; if (!strlen($EDIT_FORM)) { - $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); + $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); $hiddenfields->add(array('name' => '_action', 'value' => 'save', 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); if (($result = $CONTACTS->get_result()) && ($record = $result->first())) $hiddenfields->add(array('name' => '_cid', 'value' => $record['ID'])); - $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; - $form_start .= "\n$SESS_HIDDEN_FIELD\n"; + $form_start = !strlen($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; $form_start .= $hiddenfields->show(); } @@ -104,11 +103,11 @@ function get_form_tags($attrib) $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; if (!strlen($EDIT_FORM)) - $OUTPUT->add_gui_object('editform', $form_name); + $RCMAIL->output->add_gui_object('editform', $form_name); $EDIT_FORM = $form_name; - return array($form_start, $form_end); + return array($form_start, $form_end); } diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index c16d4729f..94a0d587d 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -28,7 +28,7 @@ if ($CONTACTS->readonly) } // check input -if ((!get_input_value('_name', RCUBE_INPUT_POST) || !get_input_value('_email', RCUBE_INPUT_POST)) && $_framed) +if ((!get_input_value('_name', RCUBE_INPUT_POST) || !get_input_value('_email', RCUBE_INPUT_POST)) && $OUTPUT->action) { $OUTPUT->show_message('formincomplete', 'warning'); rcmail_overwrite_action(empty($_POST['_cid']) ? 'add' : 'show'); @@ -54,7 +54,7 @@ if (!empty($cid)) { if ($CONTACTS->update($cid, $a_record)) { - if ($_framed) + if ($OUTPUT->action) { // define list of cols to be displayed $a_js_cols = array(); @@ -96,7 +96,7 @@ else // insert record and send response if ($insert_id = $CONTACTS->insert($a_record)) { - if ($_framed) + if ($OUTPUT->action) { // add contact row or jump to the page where it should appear $CONTACTS->reset(); diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 1189c991e..d8ade67ad 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -26,7 +26,7 @@ define('RCUBE_COMPOSE_DRAFT', 0x0108); // remove an attachment -if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) +if ($RCMAIL->action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) { $id = $regs[1]; if (is_array($_SESSION['compose']['attachments'][$id])) @@ -39,7 +39,7 @@ if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_ } } -if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) +if ($RCMAIL->action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) { $id = $regs[1]; if (is_array($_SESSION['compose']['attachments'][$id])) @@ -337,7 +337,7 @@ function rcmail_compose_header_from($attrib) function rcmail_compose_body($attrib) { - global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; + global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; list($form_start, $form_end) = get_form_tags($attrib); unset($attrib['form']); @@ -410,7 +410,7 @@ function rcmail_compose_body($attrib) $body = rcmail_create_draft_body($body, $isHtml); } - $tinylang = substr($_SESSION['user_lang'], 0, 2); + $tinylang = substr($_SESSION['language'], 0, 2); if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js')) { $tinylang = 'en'; @@ -455,14 +455,14 @@ function rcmail_compose_body($attrib) "googie.setCurrentLanguage('%s');\n". "googie.decorateTextarea('%s');\n". "%s.set_env('spellcheck', googie);", - $GLOBALS['COMM_PATH'], + $RCMAIL->comm_path, 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'))), $lang_set, - substr($_SESSION['user_lang'], 0, 2), + substr($_SESSION['language'], 0, 2), $attrib['id'], JS_OBJECT_NAME), 'foot'); @@ -704,30 +704,21 @@ function rcmail_compose_attachment_list($attrib) function rcmail_compose_attachment_form($attrib) { - global $OUTPUT, $SESS_HIDDEN_FIELD; + global $OUTPUT; // add ID if not given if (!$attrib['id']) $attrib['id'] = 'rcmUploadbox'; - // allow the following attributes to be added to the <div> tag - $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style')); - $input_field = rcmail_compose_attachment_field(array()); - $label_send = rcube_label('upload'); - $label_close = rcube_label('close'); - $js_instance = JS_OBJECT_NAME; - - $out = <<<EOF -<div$attrib_str> -<form action="./" method="post" enctype="multipart/form-data"> -$SESS_HIDDEN_FIELD -$input_field<br /> -<input type="button" value="$label_close" class="button" onclick="document.getElementById('$attrib[id]').style.visibility='hidden'" /> -<input type="button" value="$label_send" class="button" onclick="$js_instance.command('send-attachment', this.form)" /> -</form> -</div> -EOF; - + $button = new html_inputfield(array('type' => "button", 'class' => "button")); + + $out = html::div($attrib, + $OUTPUT->form_tag(array('name' => "form", 'method' => "post")) . + rcmail_compose_attachment_field(array()) . html::br() . + $button->show(rcube_label('close'), array('onclick' => "document.getElementById('$attrib[id]').style.visibility='hidden'")) . + $button->show(rcube_label('upload'), array('onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)")) + ); + $OUTPUT->add_gui_object('uploadbox', $attrib['id']); return $out; @@ -843,16 +834,15 @@ function rcmail_editor_selector($attrib) function get_form_tags($attrib) { - global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD; + global $RCMAIL, $MESSAGE_FORM; $form_start = ''; if (!strlen($MESSAGE_FORM)) { - $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); + $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); $hiddenfields->add(array('name' => '_action', 'value' => 'send')); - $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; - $form_start .= "\n$SESS_HIDDEN_FIELD\n"; + $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; $form_start .= $hiddenfields->show(); } @@ -860,7 +850,7 @@ function get_form_tags($attrib) $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; if (!strlen($MESSAGE_FORM)) - $OUTPUT->add_gui_object('messageform', $form_name); + $RCMAIL->output->add_gui_object('messageform', $form_name); $MESSAGE_FORM = $form_name; diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc index b84398f26..69f3c0e4c 100644 --- a/program/steps/mail/folders.inc +++ b/program/steps/mail/folders.inc @@ -21,7 +21,7 @@ $mbox_name = $IMAP->get_mailbox_name(); // send EXPUNGE command -if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) +if ($RCMAIL->action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) { $success = $IMAP->expunge($mbox); @@ -29,7 +29,7 @@ if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) if ($success && !empty($_REQUEST['_reload'])) { $OUTPUT->command('message_list.clear'); - $_action = 'list'; + $RCMAIL->action = 'list'; return; } else @@ -37,7 +37,7 @@ if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) } // clear mailbox -else if ($_action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) +else if ($RCMAIL->action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) { // we should only be purging trash and junk if($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']) diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 8abda6c74..9a81a00ec 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -74,7 +74,7 @@ if (!$OUTPUT->ajax_call) rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage'); // set page title -if (empty($_action) || $_action == 'list') +if (empty($RCMAIL->action) || $RCMAIL->action == 'list') $OUTPUT->set_pagetitle(rcmail_localize_foldername($IMAP->get_mailbox_name())); diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index 131ad2e4f..dad3ce7ef 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -24,7 +24,7 @@ $old_count = $IMAP->messagecount(); $old_pages = ceil($old_count / $IMAP->page_size); // move messages -if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) +if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) { $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); $target = get_input_value('_target_mbox', RCUBE_INPUT_POST); @@ -41,7 +41,7 @@ if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox' } // delete messages -else if ($_action=='delete' && !empty($_POST['_uid'])) +else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); $del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_POST)); @@ -89,7 +89,7 @@ $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count)); $mbox = $IMAP->get_mailbox_name(); $OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'), ($mbox == 'INBOX')); -if ($_action=='moveto' && $target) +if ($RCMAIL->action=='moveto' && $target) $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN')); $OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota())); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 2281a9773..72ef9f4d6 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -313,7 +313,7 @@ $MAIL_MIME->setParam(array( )); // encoding subject header with mb_encode provides better results with asian characters -if ($MBSTRING && function_exists("mb_encode_mimeheader")) +if (function_exists("mb_encode_mimeheader")) { mb_internal_encoding($message_charset); $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], $message_charset, 'Q'); diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index a530184d8..8062f4598 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -19,7 +19,7 @@ */ -$PRINT_MODE = $_action=='print' ? TRUE : FALSE; +$PRINT_MODE = $RCMAIL->action=='print' ? TRUE : FALSE; // similar code as in program/steps/mail/get.inc if ($_GET['_uid']) @@ -35,11 +35,11 @@ if ($_GET['_uid']) if (!$MESSAGE['headers']) { $OUTPUT->show_message('messageopenerror', 'error'); - if ($_action=='preview' && template_exists('messagepreview')) + if ($RCMAIL->action=='preview' && template_exists('messagepreview')) $OUTPUT->send('messagepreview'); else { - $_action = 'list'; + $RCMAIL->action = 'list'; return; } } @@ -78,7 +78,7 @@ if ($_GET['_uid']) if (!$MESSAGE['headers']->seen) { $marked = $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); - if($_action == 'preview' && $marked != -1) + if($RCMAIL->action == 'preview' && $marked != -1) { $OUTPUT->command('set_unread_count_from_preview', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX')); $OUTPUT->command('mark_as_read_from_preview', $MESSAGE['UID']); @@ -203,9 +203,9 @@ $OUTPUT->add_handlers(array( 'blockedobjects' => 'rcmail_remote_objects_msg')); -if ($_action=='print' && template_exists('printmessage')) +if ($RCMAIL->action=='print' && template_exists('printmessage')) $OUTPUT->send('printmessage'); -else if ($_action=='preview' && template_exists('messagepreview')) +else if ($RCMAIL->action=='preview' && template_exists('messagepreview')) $OUTPUT->send('messagepreview'); else $OUTPUT->send('message'); diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc index 2dec5b258..0f849f172 100644 --- a/program/steps/settings/edit_identity.inc +++ b/program/steps/settings/edit_identity.inc @@ -19,7 +19,7 @@ */ -if (($_GET['_iid'] || $_POST['_iid']) && $_action=='edit-identity') +if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') { $IDENTITY_RECORD = $USER->get_identity(get_input_value('_iid', RCUBE_INPUT_GPC)); @@ -37,9 +37,9 @@ $OUTPUT->include_script('list.js'); function rcube_identity_form($attrib) { - global $IDENTITY_RECORD, $OUTPUT; + global $IDENTITY_RECORD, $RCMAIL, $OUTPUT; - $tinylang = substr($_SESSION['user_lang'], 0, 2); + $tinylang = substr($_SESSION['language'], 0, 2); if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js')) { $tinylang = 'en'; @@ -58,7 +58,7 @@ function rcube_identity_form($attrib) "theme_advanced_buttons2 : 'link,unlink,code,forecolor,fontselect,fontsizeselect'," . "theme_advanced_buttons3 : '' });"); - if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity') + if (!$IDENTITY_RECORD && $RCMAIL->action != 'add-identity') return rcube_label('notfound'); // add some labels to client @@ -138,7 +138,7 @@ function rcube_identity_form($attrib) $OUTPUT->add_handler('identityform', 'rcube_identity_form'); -if ($_action=='add-identity' && template_exists('addidentity')) +if ($RCMAIL->action=='add-identity' && template_exists('addidentity')) $OUTPUT->send('addidentity'); $OUTPUT->send('editidentity'); diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index bf889a5dc..09ae6cf06 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -27,7 +27,7 @@ if ($USER->ID) function rcmail_user_prefs_form($attrib) { - global $DB, $CONFIG, $sess_user_lang; + global $DB, $CONFIG; $no_override = is_array($CONFIG['dont_override']) ? array_flip($CONFIG['dont_override']) : array(); @@ -56,7 +56,7 @@ function rcmail_user_prefs_form($attrib) $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", $field_id, Q(rcube_label('language')), - $select_lang->show($sess_user_lang)); + $select_lang->show($_SESSION['language'])); } @@ -251,19 +251,18 @@ function rcmail_identities_list($attrib) // similar function as in /steps/addressbook/edit.inc function get_form_tags($attrib, $action, $add_hidden=array()) { - global $OUTPUT, $EDIT_FORM, $SESS_HIDDEN_FIELD; + global $EDIT_FORM, $RCMAIL; $form_start = ''; if (!strlen($EDIT_FORM)) { - $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); + $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); $hiddenfields->add(array('name' => '_action', 'value' => $action)); if ($add_hidden) $hiddenfields->add($add_hidden); - $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; - $form_start .= "\n$SESS_HIDDEN_FIELD\n"; + $form_start = !strlen($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; $form_start .= $hiddenfields->show(); } @@ -271,11 +270,11 @@ function get_form_tags($attrib, $action, $add_hidden=array()) $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; if (!strlen($EDIT_FORM)) - $OUTPUT->add_gui_object('editform', $form_name); + $RCMAIL->output->add_gui_object('editform', $form_name); $EDIT_FORM = $form_name; - return array($form_start, $form_end); + return array($form_start, $form_end); } diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc index a00ff9fd1..49f9491c5 100644 --- a/program/steps/settings/manage_folders.inc +++ b/program/steps/settings/manage_folders.inc @@ -20,10 +20,10 @@ */ // init IMAP connection -rcmail_imap_init(TRUE); +$RCMAIL->imap_init(true); // subscribe to one or more mailboxes -if ($_action=='subscribe') +if ($RCMAIL->action=='subscribe') { if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)) $IMAP->subscribe(array($mbox)); @@ -33,7 +33,7 @@ if ($_action=='subscribe') } // unsubscribe one or more mailboxes -else if ($_action=='unsubscribe') +else if ($RCMAIL->action=='unsubscribe') { if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)) $IMAP->unsubscribe(array($mbox)); @@ -43,7 +43,7 @@ else if ($_action=='unsubscribe') } // create a new mailbox -else if ($_action=='create-folder') +else if ($RCMAIL->action=='create-folder') { if (!empty($_POST['_name'])) $create = $IMAP->create_mailbox(trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF-7')), TRUE); @@ -62,7 +62,7 @@ else if ($_action=='create-folder') } // rename a mailbox -else if ($_action=='rename-folder') +else if ($RCMAIL->action=='rename-folder') { if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname'])) $rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_POST)), trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, FALSE, 'UTF-7'))); @@ -97,7 +97,7 @@ else if ($_action=='rename-folder') } // delete an existing IMAP mailbox -else if ($_action=='delete-folder') +else if ($RCMAIL->action=='delete-folder') { $a_mboxes = array_merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed()); $delimiter = $IMAP->get_hierarchy_delimiter(); diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc index 2c2a55e49..4a7b4fb22 100644 --- a/program/steps/settings/save_identity.inc +++ b/program/steps/settings/save_identity.inc @@ -107,6 +107,6 @@ if ($default_id) $USER->set_default($default_id); // go to next step -rcmail_overwrite_action($_framed ? 'edit-identity' : 'identities'); +rcmail_overwrite_action($OUTPUT->action ? 'edit-identity' : 'identities'); ?>
\ No newline at end of file diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 9ee30a616..8025ad8ed 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -39,10 +39,7 @@ foreach ((array)$CONFIG['dont_override'] as $p) // switch UI language if (isset($_POST['_language'])) - { - $sess_user_lang = $_SESSION['user_lang'] = get_input_value('_language', RCUBE_INPUT_POST); - rcmail_set_locale($sess_user_lang); - } + $_SESSION['language'] = get_input_value('_language', RCUBE_INPUT_POST); // force min size if ($a_user_prefs['pagesize'] < 1) |