Ejemplo n.º 1
0
 /**
  * Display author management page.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function manage()
 {
     if (!$this->is_owner && !$this->auth->acl_get('u_titania_mod_author_mod')) {
         return $this->helper->needs_auth();
     }
     $error = array();
     $this->message->set_parent($this->author)->set_auth(array('bbcode' => $this->auth->acl_get('u_titania_bbcode'), 'smilies' => $this->auth->acl_get('u_titania_smilies')))->set_settings(array('display_error' => false, 'display_subject' => false));
     if ($this->request->is_set_post('submit')) {
         $this->author->post_data($this->message);
         $this->author->__set_array(array('author_realname' => $this->request->variable('realname', '', true), 'author_website' => $this->request->variable('website', '')));
         $error = $this->author->validate();
         if (($validate_form_key = $this->message->validate_form_key()) !== false) {
             $error[] = $validate_form_key;
         }
         if (empty($error)) {
             $this->author->submit();
             redirect($this->author->get_url());
         }
     }
     $this->message->display();
     $this->template->assign_vars(array('S_POST_ACTION' => $this->author->get_url('manage'), 'AUTHOR_WEBSITE' => $this->author->get_website_url() || !$this->is_owner ? $this->author->get_website_url() : '', 'ERROR_MSG' => !empty($error) ? implode('<br />', $error) : false));
     return $this->helper->render('authors/author_manage.html', $this->get_title('MANAGE_AUTHOR'));
 }