Beispiel #1
0
 function report($postID = 0)
 {
     $this->freakauth_light->check();
     $postID = intval($postID);
     $post_data = $this->post_model->getReplyData($postID);
     // Check if reply exists
     if (!empty($post_data)) {
         if ($post_data['parentID'] != 0) {
             $topicID = $post_data['parentID'];
         } else {
             $topicID = $post_data['postID'];
         }
         $data = array('postID' => $post_data['postID'], 'topic_name' => $post_data['post_title'], 'topicID' => $topicID);
         $this->data = array_merge($this->data, $data);
         if (!empty($_POST['submit'])) {
             $message = trim($this->input->post('message', TRUE));
             $message = strip_tags($message);
             if (empty($message)) {
                 $this->template->error("Error Message:  Report Text field is empty.");
                 $this->template->create('report', $this->data);
             } else {
                 $report_text = $this->lang->line('report_text');
                 $report_text = str_replace('<#USERNAME#>', getUserFullNameFromId($this->userID), $report_text);
                 $report_text = str_replace('<#TOPIC#>', anchor('forums/topics/view_topic/' . $this->data['topicID'], $this->data['topic_name']), $report_text);
                 $report_text = str_replace('<#LINK_TO_POST#>', anchor('forums/posts/view_reply/' . $postID, '#' . $postID), $report_text);
                 $report_text = str_replace('<#REPORT#>', $message, $report_text);
                 $report_text = addslashes($report_text);
                 $data = array('message_to' => $this->config->item('default_moderator'), 'message_subject' => 'Report', 'message_content' => $report_text);
                 $this->CI->load->module_model('messages', 'message_model');
                 $this->message_model->insert('inbox', $data);
                 $this->data['message'] = "Report Successfully Added, Moderators will check it out.";
                 $this->template->create('message', $this->data);
             }
         } else {
             $this->template->title('Forums > Report');
             $this->template->create('report', $this->data);
         }
     } else {
         show_error("The post doesn`t exist!");
     }
 }
Beispiel #2
0
 function NewPostNotify($topicID, $userID)
 {
     $mail_array = array();
     $this->db->select('*');
     $this->db->where('topicID', $topicID);
     $this->db->where('userID !=', $userID);
     $query = $this->db->get($this->subscriptionsTable);
     $i = 0;
     foreach ($query->result_array() as $row) {
         $mail_array[$i]['user_id'] = $row['userID'];
         $mail_array[$i]['user_name'] = getUserFullNameFromId($row['userID']);
         $mail_array[$i]['user_email'] = getUserProperty('email', $row['userID']);
         $i++;
     }
     $this->load->library('email');
     foreach ($mail_array as $user_data) {
         $this->email->clear();
         $this->email->to($user_data['user_email']);
         $this->email->from($this->config->item('admin_email'));
         $this->email->subject('New Message in Topic');
         $this->email->message('Dear ' . $user_data['user_name'] . '. <br>A new message has been posted in topic: ' . site_url('forums/topics/view_topic/' . $topicID) . ' <br>To unsubscribe please visit: ' . site_url('forums/topics/unsubscribe/' . $topicID) . ' ');
         $this->email->send();
     }
 }