/** * Get the ajax result of the form and save it on the database */ function form_submit() { require_once dirname(__FILE__) . '/includes/fetchMailRc.php'; $this->rcmail->output->add_label('fetchmail_rc.new_account_saved', 'fetchmail_rc.account_updated', 'fetchmail_rc.save_error'); $id = get_input_value('_fetchmail_rc_id', RCUBE_INPUT_POST); try { $fetchmailRc = new fetchMailRc($id); $fetchmailRc->set_mail_host(get_input_value('_mail_host', RCUBE_INPUT_POST))->set_fk_user($this->rcmail->user->data['user_id'])->set_mail_username(get_input_value('_mail_username', RCUBE_INPUT_POST))->set_mail_password(get_input_value('_mail_password', RCUBE_INPUT_POST))->set_mail_arguments(get_input_value('_mail_arguments', RCUBE_INPUT_POST))->set_mail_protocol(get_input_value('_mail_protocol', RCUBE_INPUT_POST))->set_mail_enabled(!get_input_value('_mail_disabled', RCUBE_INPUT_POST))->set_error('')->set_count_errors(0)->set_mail_ssl(get_input_value('_mail_ssl', RCUBE_INPUT_POST)); $saved = $fetchmailRc->save(); } catch (Exception $e) { $this->rcmail->output->command('plugin.save_error', array("error" => $e->getMessage())); $this->rcmail->output->send('plugin'); } if ($saved) { $new_label = $fetchmailRc->get_mail_host(); if (!$fetchmailRc->get_enabled()) { $new_label .= ' (' . $this->gettext('disabled') . ')'; } $this->rcmail->output->command('plugin.save_success', array("message" => $this->gettext("save_successfull"), "type" => $id ? "update" : "add", "new_label" => $new_label, "id" => $fetchmailRc->get_id())); $this->rcmail->output->send('plugin'); } else { $this->rcmail->output->command('plugin.save_error', array()); $this->rcmail->output->send('plugin'); } }