Ejemplo n.º 1
0
 public function setup_edit_variables($cur_post, $is_admmod, $can_edit_subject, $errors)
 {
     Container::get('hooks')->fire('model.post.setup_edit_variables_start');
     $post = array();
     $post['hide_smilies'] = Input::post('hide_smilies') ? '1' : '0';
     $post['stick_topic'] = Input::post('stick_topic') ? '1' : '0';
     if (!$is_admmod) {
         $post['stick_topic'] = $cur_post['sticky'];
     }
     // Clean up message from POST
     $post['message'] = Utils::linebreaks(Utils::trim(Input::post('req_message')));
     // Validate BBCode syntax
     if (ForumSettings::get('p_message_bbcode') == '1') {
         $post['message'] = Container::get('parser')->preparse_bbcode($post['message'], $errors);
     }
     // Replace four-byte characters (MySQL cannot handle them)
     $post['message'] = Utils::strip_bad_multibyte_chars($post['message']);
     // Get the subject
     if ($can_edit_subject) {
         $post['subject'] = Utils::trim(Input::post('req_subject'));
     }
     $post = Container::get('hooks')->fire('model.post.setup_edit_variables', $post);
     return $post;
 }
Ejemplo n.º 2
0
 public function setup_variables($cur_post, $is_admmod, $can_edit_subject, $errors)
 {
     $this->hook->fire('setup_variables_start');
     $post = array();
     $post['hide_smilies'] = $this->request->post('hide_smilies') ? '1' : '0';
     $post['stick_topic'] = $this->request->post('stick_topic') ? '1' : '0';
     if (!$is_admmod) {
         $post['stick_topic'] = $cur_post['sticky'];
     }
     // Clean up message from POST
     $post['message'] = Utils::linebreaks(Utils::trim($this->request->post('req_message')));
     // Validate BBCode syntax
     if ($this->config['p_message_bbcode'] == '1') {
         $post['message'] = $this->feather->parser->preparse_bbcode($post['message'], $errors);
     }
     // Replace four-byte characters (MySQL cannot handle them)
     $post['message'] = Utils::strip_bad_multibyte_chars($post['message']);
     // Get the subject
     if ($can_edit_subject) {
         $post['subject'] = Utils::trim($this->request->post('req_subject'));
     }
     $post = $this->hook->fire('setup_variables_edit', $post);
     return $post;
 }
Ejemplo n.º 3
0
 public function setup_variables($errors, $is_admmod)
 {
     $post = array();
     $post = $this->hook->fire('setup_variables_start', $post, $errors, $is_admmod);
     if (!$this->user->is_guest) {
         $post['username'] = $this->user->username;
         $post['email'] = $this->user->email;
     } else {
         $post['username'] = Utils::trim($this->request->post('req_username'));
         $post['email'] = strtolower(Utils::trim($this->config['p_force_guest_email'] == '1' ? $this->request->post('req_email') : $this->request->post('email')));
     }
     if ($this->request->post('req_subject')) {
         $post['subject'] = Utils::trim($this->request->post('req_subject'));
     }
     $post['hide_smilies'] = $this->request->post('hide_smilies') ? '1' : '0';
     $post['subscribe'] = $this->request->post('subscribe') ? '1' : '0';
     $post['stick_topic'] = $this->request->post('stick_topic') && $is_admmod ? '1' : '0';
     $post['message'] = Utils::linebreaks(Utils::trim($this->request->post('req_message')));
     // Validate BBCode syntax
     if ($this->config['p_message_bbcode'] == '1') {
         $post['message'] = $this->feather->parser->preparse_bbcode($post['message'], $errors);
     }
     // Replace four-byte characters (MySQL cannot handle them)
     $post['message'] = Utils::strip_bad_multibyte_chars($post['message']);
     $post['time'] = time();
     $post = $this->hook->fire('setup_variables', $post);
     return $post;
 }