Exemple #1
0
 /**
  * Common handler for edit/create action.
  *
  * @return bool|JsonResponse Returns true if item was submitted.
  */
 protected function common_post()
 {
     // Load the message object
     $this->message->set_parent($this->faq)->set_auth(array('bbcode' => $this->auth->acl_get('u_titania_bbcode'), 'smilies' => $this->auth->acl_get('u_titania_smilies'), 'attachments' => true));
     // Submit check...handles running $this->faq->post_data() if required
     $submit = $this->message->submit_check();
     $error = $this->message->error;
     if ($this->message->is_plupload_request()) {
         return new JsonResponse($this->message->get_plupload_response_data());
     }
     if ($submit) {
         $error = array_merge($error, $this->faq->validate());
         if (($validate_form_key = $this->message->validate_form_key()) !== false) {
             $error[] = $validate_form_key;
         }
         if (empty($error)) {
             $this->faq->submit();
             $this->message->submit($this->id);
             return true;
         }
     }
     $this->template->assign_vars(array('S_EDIT' => true, 'ERROR_MSG' => !empty($error) ? implode('<br />', $error) : false));
     $this->message->display();
     return false;
 }
 /**
  * Common handler for add/edit action.
  *
  * @param \titania_category	Category object.
  * @param bool|array			Old settings
  * @return bool Returns true if category was submitted.
  */
 protected function common_post($category, $old_settings = false)
 {
     $this->message->set_parent($category)->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));
     $category->post_data($this->message);
     $error = array();
     if ($this->request->is_set_post('submit')) {
         $category = $this->set_submitted_settings($category);
         if (!empty($old_settings) && $category->category_name == $old_settings['name_lang']) {
             $category->category_name = $old_settings['name'];
         }
         $error = $category->validate();
         if (($form_error = $this->message->validate_form_key()) !== false) {
             $error[] = $form_error;
         }
         if (empty($error)) {
             $error = $this->submit($category, $old_settings);
             if (empty($error)) {
                 return true;
             }
         }
     }
     // Generate data for category type dropdown box
     $this->display->generate_type_select($category->category_type);
     $this->message->display();
     $this->template->assign_vars(array('ERROR_MSG' => !empty($error) ? implode('<br />', $error) : '', 'CATEGORY' => $category->category_id, 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_NAME_CLEAN' => $category->category_name_clean, 'CATEGORY_VISIBLE' => $category->category_visible, 'S_MOVE_CATEGORY_OPTIONS' => $this->display->generate_category_select($category->parent_id, true, false)));
     foreach ($category->available_options as $option => $flag) {
         if ($category->is_option_set($option)) {
             $this->template->assign_var(strtoupper("s_{$option}"), 'checked="checked"');
         }
     }
     return false;
 }
Exemple #3
0
 /**
  * Set up message.
  *
  * @param \titania_post $post
  * @param array $auth
  * @param array $settings
  */
 protected function setup_message(\titania_post $post, array $auth = array(), array $settings = array())
 {
     $this->message->set_parent($post)->set_auth(array_merge(array('bbcode' => $this->auth->acl_get('u_titania_bbcode'), 'smilies' => $this->auth->acl_get('u_titania_smilies'), 'attachments' => $this->auth->acl_get('u_titania_post_attach')), $auth))->set_settings($settings);
 }
Exemple #4
0
 /**
  * Load message object.
  *
  * @return null
  */
 protected function load_message()
 {
     $this->message->set_parent($this->contrib)->set_auth(array('bbcode' => $this->auth->acl_get('u_titania_bbcode'), 'smilies' => $this->auth->acl_get('u_titania_smilies'), 'edit_subject' => $this->is_moderator || $this->contrib->is_author()))->set_settings(array('display_error' => false, 'display_subject' => false, 'subject_name' => 'name'));
 }
 /**
  * Get queue message object.
  *
  * @return \phpbb\titania\message\message
  */
 protected function get_message()
 {
     $this->message->set_parent($this->queue)->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));
     $this->queue->post_data($this->message);
     return $this->message;
 }
Exemple #6
0
 /**
  * Get message object.
  *
  * @param mixed $object		Parent object receiving the message.
  * @return \phpbb\titania\message\message
  */
 protected function get_message($object)
 {
     $this->message->set_parent($object)->set_auth(array('bbcode' => $this->auth->acl_get('u_titania_bbcode'), 'smilies' => $this->auth->acl_get('u_titania_smilies')))->set_settings(array('display_subject' => false));
     return $this->message;
 }
Exemple #7
0
 /**
  * Set up message object for contribution description.
  *
  * @param \titania_contribution
  * @return \phpbb\titania\message\message
  */
 protected function setup_message($contrib)
 {
     $this->message->set_parent($contrib)->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, 'subject_name' => 'name'));
     return $this->message;
 }