/**
  * Page for editing mailbox
  *
  * @param void
  * @return void
  */
 function edit_mailbox()
 {
     if ($this->active_mailbox->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $this->wireframe->addBreadCrumb(clean($this->active_mailbox->getDisplayName()), $this->active_mailbox->getViewUrl());
     $mailbox_data = $this->request->post('mailbox');
     if (!is_array($mailbox_data)) {
         $mailbox_data = array("from_email" => $this->active_mailbox->getFromEmail(), "from_name" => $this->active_mailbox->getFromName(), "object_type" => $this->active_mailbox->getObjectType(), "host" => $this->active_mailbox->getHost(), "username" => $this->active_mailbox->getUsername(), "password" => $this->active_mailbox->getPassword(), "type" => $this->active_mailbox->getType(), "security" => $this->active_mailbox->getSecurity(), "port" => $this->active_mailbox->getPort(), "mailbox" => $this->active_mailbox->getMailbox(), "project_id" => $this->active_mailbox->getProjectId(), "enabled" => $this->active_mailbox->getEnabled(), "accept_all_registered" => $this->active_mailbox->getAcceptAllRegistered(), "accept_anonymous" => $this->active_mailbox->getAcceptAnonymous());
     } else {
         $mailbox_data['accept_all_registered'] = array_var($mailbox_data, 'accept_all_registered', null) > 0;
         $mailbox_data['accept_anonymous'] = array_var($mailbox_data, 'accept_anonymous', null) > 0;
     }
     // if
     if ($this->request->isSubmitted()) {
         $this->active_mailbox->setAttributes($mailbox_data);
         $manager = $this->active_mailbox->getMailboxManager();
         $result = $manager->testConnection();
         if (is_error($result)) {
             $this->smarty->assign('errors', $result);
         } else {
             $save = $this->active_mailbox->save();
             if (!$save || is_error($save)) {
                 $this->smarty->assign('errors', $save);
             } else {
                 flash_success(lang('Mailbox for email address :mailbox is edited', array('mailbox' => $this->active_mailbox->getFromEmail())));
                 $this->redirectTo('incoming_mail_admin');
             }
             // if
         }
         // if
     }
     // if
     js_assign('test_mailbox_connection_url', assemble_url('incoming_mail_admin_test_mailbox_connection'));
     $this->smarty->assign(array("mailbox_data" => $mailbox_data));
 }