/**
  * Form to email a member
  *
  * @author Jason Warner <*****@*****.**>
  * @since RC1
  **/
 function execute()
 {
     $this->set_title($this->lang->email_email);
     $this->tree($this->lang->email_email);
     if (!$this->perms->auth('email_use')) {
         return $this->message($this->lang->email_email, $this->lang->email_no_perm);
     }
     if (!isset($this->post['submit'])) {
         $this->get['to'] = isset($this->get['to']) ? intval($this->get['to']) : '';
         if ($this->get['to']) {
             $target = $this->db->fetch("SELECT user_name FROM {$this->pre}users WHERE user_id={$this->get['to']}");
             if (!isset($target['user_name']) || $this->get['to'] == USER_GUEST_UID) {
                 return $this->message($this->lang->email_email, $this->lang->email_no_member);
             }
             $this->get['to'] = $target['user_name'];
         }
         return eval($this->template('EMAIL_MAIN'));
     } else {
         if (empty($this->post['to']) || empty($this->post['message']) || empty($this->post['subject'])) {
             return $this->message($this->lang->email_email, $this->lang->email_no_fields);
         }
         $target = $this->db->fetch("SELECT user_id, user_email, user_email_form FROM {$this->pre}users WHERE user_name='{$this->post['to']}'");
         if (!$target['user_email_form']) {
             return $this->message($this->lang->email_email, $this->lang->email_blocked);
         }
         if (!isset($target['user_id']) || $target['user_id'] == USER_GUEST_UID) {
             return $this->message($this->lang->email_email, $this->lang->email_no_member);
         }
         include './lib/mailer.php';
         $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
         $mailer->setSubject("{$this->sets['forum_name']} - {$this->post['subject']}");
         $mailer->setMessage("This mail has been sent by {$this->user['user_name']} via {$this->sets['forum_name']}\n\n" . stripslashes($this->post['message']));
         $mailer->setRecipient($target['user_email']);
         $mailer->setServer($this->sets['mailserver']);
         $mailer->doSend();
         return $this->message($this->lang->email_email, $this->lang->email_sent);
     }
 }
 function send_mail()
 {
     if (!isset($this->post['groups'])) {
         $this->post['groups'] = array();
     }
     include '../lib/mailer.php';
     $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
     $mailer->setSubject($this->post['subject']);
     $message = stripslashes($this->post['message']) . "\n";
     $message .= '___________________' . "\n";
     $message .= $this->sets['forum_name'] . "\n";
     $message .= $this->sets['loc_of_board'] . "\n";
     $mailer->setMessage($message);
     $mailer->setServer($this->sets['mailserver']);
     $i = 0;
     $members = $this->db->query("SELECT user_email FROM {$this->pre}users" . $this->group_query($this->post['groups']));
     while ($sub = $this->db->nqfetch($members)) {
         $mailer->setBcc($sub['user_email']);
         $i++;
     }
     $mailer->doSend();
     return $this->message('Mass Mail', 'Your message has been sent to ' . $i . ' members.');
 }
Exemple #3
0
 /**
  * 
  * @access public
  * @param id
  * 
  */
 public function sendAlert($id)
 {
     $mail = new mailer();
     $user = new users();
     // send alert email !
     $row = $user->getUser($id);
     $emailTo = $row['user'];
     $to[] = $emailTo;
     $subject = "Alert: Hours spent have exceeded planned hours";
     $mail->setSubject($subject);
     $text = "Hello " . $emailTo . ",\n\t\t\t\t\t\t\t\t\n\t\t\tThis is a friendly reminder that you have surpassed\n\t\t\t\t\t\t\t\t\n\t\t\tthe estimated hours for this project. While we \n\t\t\t\t\t\t\t\t\t\n\t\t\tunderstand it is impossible to meet every deadline\n\t\t\t\t\t\t\t\t\t\n\t\t\twe encourage you to be as diligent as possible with\n\t\t\t\t\t\t\t\t\t\n\t\t\tyour workload.";
     $mail->setText($text);
     $mail->sendMail($to);
 }
 /**
  * Handle content posted by a user.
  * This should be called before you try to list new participations (else, freshly submited content won't be shwown)
  * 
  * Valid order is :
  * - $this->handlePost()
  * - list and display validated participations
  * - show participation form ($this->render() )
  *
  * handlePost() does nothing if the participation form has not been submited 
  *
  */
 function handlePost()
 {
     global $thinkedit;
     // if form sent, validate
     if ($this->form->isSent()) {
         $this->content->setArray($_POST);
         $valid_captcha = true;
         if ($this->enable_captcha) {
             require_once ROOT . '/class/captcha.class.php';
             $captcha = new captcha();
             if ($_REQUEST['captcha'] != $captcha->get()) {
                 $valid_captcha = false;
             }
         }
         // first case : invalid content
         if (!$this->content->validate() || !$valid_captcha) {
             $this->form->add('<div class="participation_error">');
             $this->form->add($this->invalid_message);
             $this->form->add('</div>');
         } else {
             // if a captcha was used, reset it in order to have a new one for another message
             if ($this->enable_captcha) {
                 $captcha->reset();
                 unset($_REQUEST['captcha']);
             }
             $failure = false;
             // save content to db
             if (!$this->content->insert()) {
                 $failure = true;
             }
             // add content to curent node
             if (isset($this->parent_node)) {
                 // add content in the container
                 $new_node = $this->parent_node->add($this->content, 'bottom');
                 if (!$new_node) {
                     $failure = true;
                 }
                 /*
                 // update db
                 if (!$new_node->save())
                 {
                 		$failure = true;
                 }
                 */
                 //echo 'publish : ' . $new_node->get('publish');
                 // publish if needed
                 if ($this->enable_moderation) {
                     //echo 'moderation enabled';
                 } else {
                     //echo 'moderation disabled, publishing directly';
                     $new_node->publish();
                 }
                 //echo 'publish after : ' . $new_node->get('publish');
                 /*
                 // move to bottom of curent branch if needed
                 if ($this->move_to_bottom)
                 {
                 		$new_node->moveBottom();
                 		echo 'publish after move to bottom : ' . $new_node->get('publish');
                 }
                 else
                 {
                 		$new_node->rebuild();
                 		echo 'publish after rebuild : ' . $new_node->get('publish');
                 }
                 */
             }
             if ($failure) {
                 $this->form->add('<div class="participation_error">');
                 $this->form->add($this->failure_message);
                 $this->form->add('</div>');
             } else {
                 if (isset($this->notification_email)) {
                     require_once ROOT . '/class/mailer.class.php';
                     $mailer = new mailer();
                     $mailer->isHtml(true);
                     $mailer->setTo($this->notification_email);
                     // todo : find the first email field type in the record to use it as a sender
                     // $mailer->setFrom($this->notification_email);
                     $mailer->setSubject($this->notification_email_subject . $this->content->getTitle());
                     $message = '';
                     foreach ($this->content->field as $field) {
                         $message .= '<b>' . $field->getTitle();
                         $message .= ' : ' . '</b>';
                         $message .= '<br/>';
                         $message .= $field->get();
                         $message .= '<br/>';
                         $message .= '<br/>';
                     }
                     $url = $thinkedit->newUrl();
                     $url->set('node_id', $this->parent_node->getId());
                     $message .= '<a href="' . $url->renderAbsoluteUrl('/edit/structure.php') . '">' . translate('participation_email_admin_link') . '</a>';
                     $mailer->setBody($message);
                     $mailer->send();
                 }
                 $this->form->add('<div class="participation_success">');
                 $this->form->add($this->success_message);
                 $this->form->add('</div>');
             }
         }
     }
 }
Exemple #5
0
 function request_pass()
 {
     $this->set_title($this->lang->login_pass_reset);
     $this->tree($this->lang->login_pass_reset);
     if (!isset($this->get['e'])) {
         $this->get['e'] = null;
     }
     $target = $this->db->fetch("SELECT user_id, user_name, user_email FROM {$this->pre}users WHERE MD5(CONCAT(user_email, user_name, user_password, user_joined))='" . preg_replace('/[^a-z0-9]/', '', $this->get['e']) . '\' AND user_id != ' . USER_GUEST_UID . ' LIMIT 1');
     if (!isset($target['user_id'])) {
         return $this->message($this->lang->login_pass_reset, $this->lang->login_pass_no_id);
     }
     include './lib/mailer.php';
     $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
     $newpass = $this->generate_pass(8);
     $message = "{$this->sets['forum_name']}\n\n";
     $message .= "Your password has been reset to:\n{$newpass}\n\n";
     $message .= "{$this->sets['loc_of_board']}{$this->mainfile}?a=login";
     $mailer->setSubject("{$this->sets['forum_name']} - Reset Password");
     $mailer->setMessage($message);
     $mailer->setRecipient($target['user_email']);
     $mailer->setServer($this->sets['mailserver']);
     $mailer->doSend();
     $this->db->query("UPDATE {$this->pre}users SET user_password='******' WHERE user_id={$target['user_id']}");
     return $this->message($this->lang->login_pass_reset, $this->lang->login_pass_sent);
 }
Exemple #6
0
 function makePost($s)
 {
     /**
      * Determine if the user has permission to make a post here and
      * execute tasks common to both before and after the form submit.
      */
     switch ($s) {
         case 'reply':
             if (!isset($this->get['t'])) {
                 return $this->message($this->lang->post_replying, $this->lang->post_cant_reply);
             }
             $this->get['t'] = intval($this->get['t']);
             $topic = $this->db->fetch("\n\t\t\tSELECT\n\t\t\t    t.topic_modes, t.topic_title, f.forum_name, f.forum_id, t.topic_replies\n\t\t\tFROM\n\t\t\t    {$this->pre}topics t, {$this->pre}forums f\n\t\t\tWHERE\n\t\t\t    t.topic_id={$this->get['t']} AND f.forum_id=t.topic_forum");
             if ($topic && !$this->perms->auth('post_create', $topic['forum_id'])) {
                 if ($this->perms->is_guest) {
                     return $this->message($this->lang->post_replying, sprintf($this->lang->post_cant_reply1, $this->self));
                 } else {
                     return $this->message($this->lang->post_replying, $this->lang->post_cant_reply2);
                 }
             }
             if (!$topic) {
                 return $this->message($this->lang->post_replying, $this->lang->post_cant_reply);
             }
             if ($topic['topic_modes'] & TOPIC_LOCKED) {
                 return $this->message($this->lang->post_replying, $this->lang->post_closed);
             }
             if (strlen($topic['topic_title']) > 30) {
                 $shortened_title = substr($topic['topic_title'], 0, 29);
             } else {
                 $shortened_title = $topic['topic_title'];
             }
             $shortened_title = $this->format($topic['topic_title'], FORMAT_CENSOR | FORMAT_HTMLCHARS);
             $this->get['f'] = $topic['forum_id'];
             $this->tree_forums($topic['forum_id'], true);
             $this->tree($shortened_title, $this->self . '?a=topic&amp;t=' . $this->get['t'] . '&amp;f=' . $topic['forum_id']);
             $this->tree($this->lang->post_replying1);
             break;
         case 'poll':
             if (!isset($this->get['f'])) {
                 return $this->message($this->lang->post_creating, $this->lang->post_no_forum);
             }
             $this->get['f'] = intval($this->get['f']);
             if (!$this->perms->auth('poll_create', $this->get['f'])) {
                 if ($this->perms->is_guest) {
                     return $this->message($this->lang->post_creating_poll, sprintf($this->lang->post_cant_poll, $this->self));
                 } else {
                     return $this->message($this->lang->post_creating_poll, $this->lang->post_cant_poll1);
                 }
             }
             if (!$this->db->num_rows($this->db->query("SELECT forum_id FROM {$this->pre}forums WHERE forum_id={$this->get['f']}"))) {
                 return $this->message($this->lang->post_creating, $this->lang->post_no_forum);
             }
             $this->tree_forums($this->get['f'], true);
             $this->tree($this->lang->post_creating_poll);
             break;
         default:
             //topic
             if (!isset($this->get['f'])) {
                 return $this->message($this->lang->post_creating, $this->lang->post_no_forum);
             }
             $this->get['f'] = intval($this->get['f']);
             if (!$this->perms->auth('topic_create', $this->get['f'])) {
                 if ($this->perms->is_guest) {
                     return $this->message($this->lang->post_creating, sprintf($this->lang->post_cant_create, $this->self));
                 } else {
                     return $this->message($this->lang->post_creating, $this->lang->post_cant_create1);
                 }
             }
             if (!$this->db->num_rows($this->db->query("SELECT forum_id FROM {$this->pre}forums WHERE forum_id={$this->get['f']}"))) {
                 return $this->message($this->lang->post_creating, $this->lang->post_no_forum);
             }
             $this->tree_forums($this->get['f'], true);
             $this->tree($this->lang->post_creating);
     }
     /**
      * Show the form
      */
     if (!isset($this->post['submit'])) {
         $attached = null;
         $attached_data = null;
         $upload_error = null;
         $icon = -1;
         $preview = '';
         $quote = '';
         $checkEmot = ' checked=\'checked\'';
         $checkCode = ' checked=\'checked\'';
         $checkGlob = '';
         $title = isset($this->post['title']) ? $this->format(stripslashes($this->post['title']), FORMAT_HTMLCHARS) : '';
         $desc = isset($this->post['desc']) ? $this->format(stripslashes($this->post['desc']), FORMAT_HTMLCHARS) : '';
         $options = isset($this->post['options']) ? $this->format(stripslashes($this->post['options']), FORMAT_HTMLCHARS) : '';
         if (!isset($this->post['attached_data'])) {
             $this->post['attached_data'] = array();
         }
         if ($this->perms->auth('post_attach', $this->get['f'])) {
             // Attach
             if (isset($this->post['attach'])) {
                 $upload_error = $this->attachmentutil->attach($this->files['attach_upload'], $this->post['attached_data']);
                 // Detach
             } elseif (isset($this->post['detach'])) {
                 $this->attachmentutil->delete($this->post['attached'], $this->post['attached_data']);
             }
             $this->attachmentutil->getdata($attached, $attached_data, $this->post['attached_data']);
         }
         /**
          * Preview
          */
         if (isset($this->post['preview']) || isset($this->post['attach']) || isset($this->post['detach'])) {
             $quote = $this->format(stripslashes($this->post['post']), FORMAT_HTMLCHARS);
             if ($s == 'topic' || $s == 'poll') {
                 $title = $this->format(stripslashes($this->post['title']), FORMAT_HTMLCHARS);
                 $desc = $this->format(stripslashes($this->post['desc']), FORMAT_HTMLCHARS);
                 if ($s == 'poll') {
                     $options = $this->format(stripslashes($this->post['options']), FORMAT_HTMLCHARS);
                 }
             }
             $params = FORMAT_BREAKS | FORMAT_CENSOR | FORMAT_HTMLCHARS;
             if (isset($this->post['parseCode']) && $this->quote_check($this->post['post'])) {
                 $params |= FORMAT_MBCODE;
                 $checkCode = ' checked=\'checked\'';
             } else {
                 $checkCode = '';
             }
             if (isset($this->post['parseEmot'])) {
                 $params |= FORMAT_EMOTICONS;
                 $checkEmot = ' checked=\'checked\'';
             } else {
                 $checkEmot = '';
             }
             if (isset($this->post['global_topic'])) {
                 $checkGlob = ' checked=\'checked\'';
             } else {
                 $checkGlob = '';
             }
             $preview_text = stripslashes($this->post['post']);
             $quote = $this->format($preview_text, FORMAT_HTMLCHARS);
             $preview_text = $this->format($preview_text, $params);
             if ($title != '') {
                 $preview_title = $title;
                 $preview_title = $desc != '' ? $preview_title . ', ' . $desc : $preview_title;
             } else {
                 $preview_title = $this->lang->post_preview;
             }
             $this->lang->topic();
             if ($this->perms->is_guest) {
                 $signature = '';
                 $Poster_Info = eval($this->template('POST_POSTER_GUEST'));
             } else {
                 if ($this->user['user_avatar_type'] != 'none' && $this->user['user_view_avatars']) {
                     if (substr($this->user['user_avatar'], -4) != '.swf') {
                         $avatar = "<img src='{$this->user['user_avatar']}' alt='Avatar' width='{$this->user['user_avatar_width']}' height='{$this->user['user_avatar_height']}' /><br /><br />";
                     } else {
                         $avatar = "<object width='{$this->user['user_avatar_width']}' height='{$this->user['user_avatar_height']}' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'><param name='movie' value='{$this->user['user_avatar']}'><param name='play' value='true'><param name='loop' value='true'><param name='quality' value='high'><embed src='{$this->user['user_avatar']}' width='{$this->user['user_avatar_width']}' height='{$this->user['user_avatar_height']}' play='true' loop='true' quality='high'></embed></object><br /><br />";
                     }
                 } else {
                     $avatar = null;
                 }
                 if ($this->user['user_signature'] && $this->user['user_view_signatures']) {
                     $signature = '.........................<br />' . $this->format($this->user['user_signature'], FORMAT_CENSOR | FORMAT_HTMLCHARS | FORMAT_BREAKS | FORMAT_MBCODE | FORMAT_EMOTICONS);
                 } else {
                     $signature = null;
                 }
                 $joined = $this->mbdate(DATE_ONLY_LONG, $this->user['user_joined']);
                 $Poster_Info = eval($this->template('POST_POSTER_MEMBER'));
             }
             if ($this->post['attached_data']) {
                 $this->lang->topic();
                 $download_perm = $this->perms->auth('post_attach_download', $this->get['f']);
                 foreach ($this->post['attached_data'] as $md5 => $file) {
                     if ($download_perm) {
                         $ext = strtolower(substr($file, -4));
                         if ($ext == '.jpg' || $ext == '.gif' || $ext == '.png') {
                             $preview_text .= "<br /><br />{$this->lang->topic_attached} {$file}<br /><img src='./attachments/{$md5}' alt='{$file}' />";
                             continue;
                         }
                     }
                     $preview_text .= "<br /><br />{$this->lang->topic_attached} {$file}";
                 }
             }
             $preview = eval($this->template('POST_PREVIEW'));
         }
         if ($s == 'reply') {
             if (isset($this->get['qu'])) {
                 $this->get['qu'] = intval($this->get['qu']);
                 $query = $this->db->fetch("SELECT p.post_text, m.user_name FROM {$this->pre}posts p, {$this->pre}users m WHERE p.post_id={$this->get['qu']} AND p.post_author=m.user_id");
                 if ($query['post_text'] != '') {
                     $quote = '[quote=' . $query['user_name'] . ']' . $this->format($query['post_text'], FORMAT_CENSOR | FORMAT_HTMLCHARS) . '[/quote]';
                 }
             }
         } else {
             if ($this->perms->auth('topic_global')) {
                 $universal_topic = eval($this->template('POST_GLOBAL'));
             } else {
                 $universal_topic = '';
             }
         }
         $icon = isset($this->post['icon']) ? $this->post['icon'] : -1;
         $msg_icons = $this->get_icons($icon);
         $clickable = $this->make_clickable($this->sets['clickable_per_row']);
         $posticons = eval($this->template('POST_MESSAGE_ICONS'));
         $smilies = eval($this->template('POST_CLICKABLE_SMILIES'));
         $this->lang->mbcode();
         // Load the mbcode values
         $mbcodeButtons = eval($this->template('MAIN_MBCODE'));
         if ($this->perms->auth('post_attach', $this->get['f'])) {
             if ($attached) {
                 $remove_box = eval($this->template('POST_ATTACH_REMOVE'));
             } else {
                 $remove_box = '';
             }
             $attach_box = eval($this->template('POST_ATTACH'));
         } else {
             $attach_box = null;
         }
         switch ($s) {
             case 'reply':
                 $temp_name = 'POST_REPLY';
                 $review = $this->makeReview(5);
                 break;
             case 'poll':
                 $temp_name = 'POST_POLL';
                 break;
             default:
                 $temp_name = 'POST_TOPIC';
         }
         $post_box = eval($this->template($this->post_box()));
         return eval($this->template($temp_name));
         /**
          * Final submission of form, after all attachments and previews
          */
     } else {
         if (!$this->perms->auth('post_noflood', $this->get['f']) && $this->user['user_lastpost'] > $this->time - $this->sets['flood_time']) {
             return $this->message($this->lang->post_replying, sprintf($this->lang->post_flood, $this->sets['flood_time']));
         }
         if (trim($this->post['post']) == '') {
             return $this->message($this->lang->post_posting, $this->lang->post_must_msg);
         }
         if (!isset($this->post['icon'])) {
             $this->post['icon'] = '';
         }
         if (!isset($this->post['parseCode'])) {
             $this->post['parseCode'] = 0;
         }
         if (!isset($this->post['parseEmot'])) {
             $this->post['parseEmot'] = 0;
         }
         if ($this->post['parseCode'] && !$this->quote_check($this->post['post'])) {
             $this->post['parseCode'] = 0;
         }
         if ($s == 'topic' || $s == 'poll') {
             $mode = 0;
             if ($this->perms->auth('topic_global') && isset($this->post['global_topic'])) {
                 $mode |= TOPIC_GLOBAL;
             }
             if (trim($this->post['title']) == '') {
                 return $this->message($this->lang->post_posting, $this->lang->post_must_title);
             }
             if ($s == 'poll') {
                 if (trim($this->post['options']) == '') {
                     return $this->message($this->lang->post_posting, $this->lang->post_must_options);
                 }
                 $max_options = 15;
                 $option_count = substr_count($this->post['options'], "\n") + 1;
                 if ($option_count > $max_options || $option_count < 2) {
                     return $this->message($this->lang->post_posting, sprintf($this->lang->post_too_many_options, $max_options));
                 }
             }
             $this->sets['topics']++;
             if ($s != 'poll') {
                 $this->db->query("INSERT INTO {$this->pre}topics (topic_title, topic_forum, topic_description, topic_starter, topic_icon, topic_edited, topic_last_poster, topic_modes) VALUES ('{$this->post['title']}', {$this->get['f']}, '{$this->post['desc']}', {$this->user['user_id']}, '{$this->post['icon']}', {$this->time}, {$this->user['user_id']}, {$mode})");
             } else {
                 $mode |= TOPIC_POLL;
                 $this->db->query("INSERT INTO {$this->pre}topics (topic_title, topic_forum, topic_description, topic_starter, topic_icon, topic_edited, topic_last_poster, topic_modes, topic_poll_options) VALUES ('{$this->post['title']}', {$this->get['f']}, '{$this->post['desc']}', {$this->user['user_id']}, '{$this->post['icon']}', {$this->time}, {$this->user['user_id']}, {$mode}, '{$this->post['options']}')");
             }
             $this->get['t'] = $this->db->insert_id();
         }
         $newlevel = $this->get_level($this->user['user_posts'] + 1);
         if ($this->user['user_title_custom']) {
             $membertitle = $this->user['user_title'];
         } else {
             $membertitle = $newlevel['user_title'];
         }
         $this->sets['posts']++;
         $this->write_sets();
         /*
         if (isset($this->post['rich'])) {
         	$this->post['post'] = $this->format_html_mbcode($this->post['post']);
         }
         */
         $this->db->query("INSERT INTO {$this->pre}posts (post_topic, post_author, post_text, post_time, post_emoticons, post_mbcode, post_ip, post_icon) VALUES ({$this->get['t']}, {$this->user['user_id']}, '{$this->post['post']}', {$this->time}, {$this->post['parseEmot']}, {$this->post['parseCode']}, INET_ATON('{$this->ip}'), '{$this->post['icon']}')");
         $post_id = $this->db->insert_id();
         $this->db->query("UPDATE {$this->pre}users SET user_posts=user_posts+1, user_lastpost='{$this->time}', user_level='{$newlevel['user_level']}', user_title='" . addslashes($membertitle) . "' WHERE user_id='{$this->user['user_id']}'");
         if ($s == 'reply') {
             $this->db->query("UPDATE {$this->pre}topics SET topic_replies=topic_replies+1, topic_edited={$this->time}, topic_last_poster={$this->user['user_id']} WHERE topic_id={$this->get['t']}");
             $field = 'forum_replies';
         } else {
             $field = 'forum_topics';
         }
         // Update all parent forums if any
         $forums = $this->db->fetch("SELECT forum_tree FROM {$this->pre}forums WHERE forum_id={$this->get['f']}");
         $this->db->query("UPDATE {$this->pre}forums SET {$field}={$field}+1, forum_lastpost={$post_id} WHERE forum_parent > 0 AND forum_id IN ({$forums['forum_tree']}) OR forum_id={$this->get['f']}");
         if (isset($this->post['attached_data']) && $this->perms->auth('post_attach', $this->get['f'])) {
             $this->attachmentutil->insert($post_id, $this->post['attached_data']);
         }
         $this->db->query("DELETE FROM {$this->pre}subscriptions WHERE subscription_expire < {$this->time}");
         $subs = $this->db->query("\n\t\t\tSELECT\n\t\t\t  u.user_email\n\t\t\tFROM\n\t\t\t  {$this->pre}subscriptions s,\n\t\t\t  {$this->pre}users u\n\t\t\tWHERE\n\t\t\t  s.subscription_user = u.user_id AND\n\t\t\t  u.user_id != {$this->user['user_id']} AND\n\t\t\t  ((s.subscription_type = 'topic' AND s.subscription_item = {$this->get['t']}) OR\n\t\t\t   (s.subscription_type = 'forum' AND s.subscription_item = {$this->get['f']}))");
         if ($this->db->num_rows($subs)) {
             $emailtopic = $this->db->fetch("\n\t\t\t\tSELECT\n\t\t\t\t\tt.topic_title,\n\t\t\t\t\tf.forum_name\n\t\t\t\tFROM\n\t\t\t\t\t{$this->pre}topics t,\n\t\t\t\t\t{$this->pre}forums f\n\t\t\t\tWHERE\n\t\t\t\t\tt.topic_id={$this->get['t']} AND\n\t\t\t\t\tt.topic_forum=f.forum_id");
             $message = "{$this->sets['forum_name']}\n";
             $message .= "{$this->sets['loc_of_board']}{$this->mainfile}?a=topic&t={$this->get['t']}\n\n";
             $message .= "A new post has been made in a topic or forum you are subscribed to.\n\n";
             $message .= "Forum: {$emailtopic['forum_name']}\n";
             $message .= "Topic: " . $this->format($emailtopic['topic_title'], FORMAT_CENSOR);
             include './lib/mailer.php';
             $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
             $mailer->setSubject("{$this->sets['forum_name']} - Subscriptions");
             $mailer->setMessage($message);
             $mailer->setServer($this->sets['mailserver']);
             while ($sub = $this->db->nqfetch($subs)) {
                 $mailer->setBcc($sub['user_email']);
             }
             $mailer->doSend();
         }
         if ($s == 'reply') {
             $topic['topic_replies']++;
             if ($topic['topic_replies'] >= $this->sets['posts_per_page']) {
                 $min = floor($topic['topic_replies'] / $this->sets['posts_per_page']) * $this->sets['posts_per_page'];
                 $jump = "&min={$min}#p" . ($topic['topic_replies'] - $min);
             } else {
                 $jump = '#p' . $topic['topic_replies'];
             }
             header('Location: ' . $this->self . '?a=topic&t=' . $this->get['t'] . $jump);
         } else {
             header('Location: ' . $this->self . '?a=topic&t=' . $this->get['t']);
         }
     }
 }
 function send_activation_email($email, $username, $pass, $jointime)
 {
     include './lib/mailer.php';
     $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
     $message = "{$this->lang->register_email_msg}\n";
     $message .= "{$this->lang->register_email_msg2} {$this->sets['forum_name']}.\n\n";
     $message .= "{$this->lang->register_email_msg3}\n";
     $message .= "{$this->sets['loc_of_board']}{$this->mainfile}?a=register&s=activate&e=" . md5($email . $username . $pass . $jointime);
     $mailer->setSubject("{$this->sets['forum_name']} - {$this->lang->register_activating}");
     $mailer->setMessage($message);
     $mailer->setRecipient($email);
     $mailer->setServer($this->sets['mailserver']);
     $mailer->doSend();
     return $this->message($this->lang->register_reging, sprintf($this->lang->register_must_activate, $email));
 }
 function send_activation_email($email, $username, $pass, $jointime)
 {
     include './lib/mailer.php';
     $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
     $message = "This is an automated email generated by MercuryBoard, and sent to you in order\n";
     $message .= "for you to activate your account with {$this->sets['forum_name']}.\n\n";
     $message .= "Please click the following link, or paste it in to your web browser:\n";
     $message .= "{$this->sets['loc_of_board']}{$this->self}?a=register&s=activate&e=" . md5($email . $username . $pass . $jointime);
     $mailer->setSubject("{$this->sets['forum_name']} - Activating Your Account");
     $mailer->setMessage($message);
     $mailer->setRecipient($email);
     $mailer->setServer($this->sets['mailserver']);
     $mailer->doSend();
     return $this->message($this->lang->register_reging, sprintf($this->lang->register_must_activate, $email));
 }