/**
  * View a reported private message as it shows in the messenger
  *
  * @access	private
  * @return	void
  */
 private function _viewReportedMessage()
 {
     //-----------------------------------------
     // Do we have permission?
     //-----------------------------------------
     $this->registry->getClass('reportLibrary')->buildQueryPermissions();
     if (!in_array($this->memberData['member_group_id'], explode(',', $this->registry->getClass('reportLibrary')->plugins['messages']->_extra['plugi_messages_add']))) {
         $this->registry->getClass('output')->showError('no_permission_addreport', 20115);
     }
     //-----------------------------------------
     // First see if we are already in map...
     //-----------------------------------------
     $topicId = intval($this->request['topicID']);
     $mapRecord = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'message_topic_user_map', 'where' => "map_user_id={$this->memberData['member_id']} AND map_topic_id={$topicId}"));
     //-----------------------------------------
     // Doesn't exist?
     //-----------------------------------------
     if (!$mapRecord['map_user_id']) {
         define('FROM_REPORT_CENTER', true);
         require_once IPSLib::getAppDir('members') . '/sources/classes/messaging/messengerFunctions.php';
         $messengerFunctions = new messengerFunctions($this->registry);
         //-----------------------------------------
         // Add ourselves
         //-----------------------------------------
         try {
             $messengerFunctions->addTopicParticipants($topicId, array($this->memberData['members_display_name']), $this->memberData['member_id']);
         } catch (Exception $e) {
         }
     } else {
         $update = array();
         if (!$mapRecord['map_user_active']) {
             $update['map_user_active'] = 1;
         }
         if ($mapRecord['map_folder_id'] == 'finished') {
             $update['map_folder_id'] = 'myconvo';
         }
         if ($mapRecord['map_user_banned']) {
             $update['map_user_banned'] = 0;
         }
         if (count($update)) {
             $this->DB->update('message_topic_user_map', $update, "map_user_id={$this->memberData['member_id']} AND map_topic_id={$topicId}");
         }
     }
     $this->registry->output->silentRedirect($this->settings['base_url'] . "app=members&module=messaging&section=view&do=showConversation&topicID=" . $topicId . "&st=" . $this->request['st'] . "#msg" . $this->request['msg']);
 }
Exemplo n.º 2
0
function ipb_send_pm($ipb_sender = 0, $ipb_recepient, $ipb_subject, $ipb_msg, $system = false)
{
    global $ipb_prefix, $THIS_BASEPATH, $btit_settings, $TABLE_PREFIX, $registry;
    if ($ipb_sender == 0) {
        $system = true;
        if (isset($btit_settings["ipb_autoposter"]) && $btit_settings["ipb_autoposter"] != 0) {
            $ipb_sender = (int) (0 + $btit_settings["ipb_autoposter"]);
        } else {
            return false;
        }
        $get = get_result("SELECT `ipb_fid` `recipient` FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $ipb_recepient);
    } else {
        $get = get_result("SELECT (SELECT `ipb_fid` FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $ipb_sender . ") `sender`, (SELECT `ipb_fid` FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $ipb_recepient . ") `recipient`");
        $ipb_sender = (int) (0 + $get[0]["sender"]);
    }
    $ipb_recepient = (int) (0 + $get[0]["recipient"]);
    if ($ipb_sender == 0 || $ipb_recepient == 0 || $ipb_sender == $ipb_recipient) {
        // Something is not right. fail
        return false;
    }
    if (!isset($THIS_BASEPATH) || empty($THIS_BASEPATH)) {
        $THIS_BASEPATH = str_replace(array("\\", "/include"), array("/", ""), dirname(__FILE__));
    }
    if (!defined('IPS_ENFORCE_ACCESS')) {
        define('IPS_ENFORCE_ACCESS', true);
    }
    if (!defined('IPB_THIS_SCRIPT')) {
        define('IPB_THIS_SCRIPT', 'public');
    }
    if (!isset($registry) || empty($registry)) {
        require_once $THIS_BASEPATH . '/ipb/initdata.php';
        require_once IPS_ROOT_PATH . 'sources/base/ipsRegistry.php';
        require_once IPS_ROOT_PATH . 'sources/base/ipsController.php';
        $registry = ipsRegistry::instance();
        $registry->init();
    }
    require_once IPSLib::getAppDir('members') . '/sources/classes/messaging/messengerFunctions.php';
    $clean_subj = trim($ipb_subject, "'");
    $clean_post = trim($ipb_msg, "'");
    $classMessage = new messengerFunctions($registry);
    // Reciever, Sender, array of other users to invite (Display Name), Subject, Message, Is system message
    $classMessage->sendNewPersonalTopic($ipb_recepient, $ipb_sender, array(), $clean_subj, $clean_post, $system === true ? array("isSystem" => true, "forcePm" => 1) : array("forcePm" => 1));
}
 /**
  * Fetches the output
  *
  * @access	public
  * @param	string		Output gathered
  * @param	string		Title of the document
  * @param	array 		Navigation gathered
  * @param	array 		Array of document head items
  * @param	array 		Array of JS loader items
  * @param	array 		Array of extra data
  * @return	string		Output to be printed to the client
  */
 public function fetchOutput($output, $title, $navigation, $documentHeadItems, $jsLoaderItems, $extraData = array())
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $system_vars_cache = $this->caches['systemvars'];
     $pmData = FALSE;
     //-----------------------------------------
     // NORMAL
     //-----------------------------------------
     if ($this->_outputType == 'normal') {
         //-----------------------------------------
         // Do we have a PM show?
         //-----------------------------------------
         if (($this->memberData['msg_count_reset'] or $this->memberData['msg_show_notification']) and !$this->memberData['members_disable_pm']) {
             IPSMember::save($this->memberData['member_id'], array('core' => array('msg_show_notification' => 0)));
             if ($this->request['module'] != 'messaging' and (!$this->settings['board_offline'] or $this->memberData['g_access_offline'])) {
                 /* Grab PM Data. We init if we need to recount... */
                 require_once IPSLib::getAppDir("members") . '/sources/classes/messaging/messengerFunctions.php';
                 $messengerFunctions = new messengerFunctions($this->registry);
                 /* Only collect data if we have notifications to show */
                 if ($this->memberData['msg_show_notification']) {
                     $_data = $messengerFunctions->fetchUnreadNotifications($this->memberData['member_id']);
                     if (count($_data)) {
                         $pmData = array_shift($_data);
                     }
                 }
             }
         }
         //-----------------------------------------
         // Add identifier URL
         //-----------------------------------------
         $this->addMetaTag('identifier-url', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
         //-----------------------------------------
         // Add in task image?
         //-----------------------------------------
         $task = '';
         $system_vars_cache['task_next_run'] = isset($system_vars_cache['task_next_run']) ? $system_vars_cache['task_next_run'] : 0;
         if (time() >= $system_vars_cache['task_next_run']) {
             $_url = !$this->registry->getClass('output')->isHTTPS ? $this->settings['base_url'] : $this->settings['base_url_https'];
             $task = "<div><img src='" . $_url . "app=core&amp;module=task' alt='' style='border: 0px;height:1px;width:1px;' /></div>";
         }
         //-----------------------------------------
         // Grab output
         //-----------------------------------------
         $finalOutput = $this->output->getTemplate('global')->globalTemplate($output, $documentHeadItems, $this->_css, $jsLoaderItems, $this->_metaTags, array('title' => $title, 'applications' => $this->core_fetchApplicationData(), 'page' => $this->_current_page_title), array('navigation' => $navigation, 'pmData' => $pmData), array('time' => $this->registry->getClass('class_localization')->getDate(time(), 'SHORT', 1), 'lang_chooser' => $this->html_buildLanguageDropDown(), 'skin_chooser' => $this->html_fetchSetsDropDown(), 'copyright' => $this->html_fetchCopyright()), array('ex_time' => sprintf("%.4f", IPSDebug::endTimer()), 'gzip_status' => $this->settings['disable_gzip'] == 1 ? $this->lang->words['gzip_off'] : $this->lang->words['gzip_on'], 'server_load' => ipsRegistry::$server_load, 'queries' => $this->DB->getQueryCount(), 'task' => $task));
     } else {
         if ($this->_outputType == 'redirect') {
             $extraData['full'] = 1;
             # SEO?
             if ($extraData['seoTitle']) {
                 $extraData['url'] = $this->output->buildSEOUrl($extraData['url'], 'none', $extraData['seoTitle']);
             }
             $finalOutput = $this->output->getTemplate('global_other')->redirectTemplate($documentHeadItems, $this->_css, $jsLoaderItems, $extraData['text'], $extraData['url'], $extraData['full']);
         } else {
             if ($this->_outputType == 'popup') {
                 $finalOutput = $this->output->getTemplate('global_other')->displayPopUpWindow($documentHeadItems, $this->_css, $jsLoaderItems, $title, $output);
             }
         }
     }
     //-----------------------------------------
     // Return
     //-----------------------------------------
     //print IPSLib::sizeFormat( IPSLib::strlenToBytes( strlen( $finalOutput ) ) );
     return $this->parseIPSTags($finalOutput);
 }
 /**
  * Delete all private messages from a member
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _deleteMessages()
 {
     if (!$this->request['confirm']) {
         $countTopics = $this->DB->buildAndFetch(array('select' => 'count(*) as total', 'from' => 'message_topics', 'where' => 'mt_is_deleted=0 AND mt_starter_id=' . intval($this->request['member_id'])));
         $countReplies = $this->DB->buildAndFetch(array('select' => 'count(*) as total', 'from' => 'message_posts', 'where' => 'msg_is_first_post=0 AND msg_author_id=' . intval($this->request['member_id'])));
         $member = IPSMember::load($this->request['member_id']);
         //-----------------------------------------
         // Output
         //-----------------------------------------
         $this->registry->output->html .= $this->html->deleteMessagesWrapper($member, $countTopics, $countReplies);
     } else {
         //-----------------------------------------
         // Get messenger lib
         //-----------------------------------------
         require_once IPSLib::getAppDir('members') . '/sources/classes/messaging/messengerFunctions.php';
         $messengerLibrary = new messengerFunctions($this->registry);
         if ($this->request['topics']) {
             //-----------------------------------------
             // Get topic ids
             //-----------------------------------------
             $messages = array();
             $this->DB->build(array('select' => 'mt_id', 'from' => 'message_topics', 'where' => 'mt_is_deleted=0 AND mt_starter_id=' . intval($this->request['member_id'])));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 $messages[] = $r['mt_id'];
             }
             //-----------------------------------------
             // Delete topics
             //-----------------------------------------
             if (count($messages)) {
                 $messengerLibrary->deleteTopics($this->request['member_id'], $messages, null, true);
             }
         }
         if ($this->request['replies']) {
             //-----------------------------------------
             // Get reply ids
             //-----------------------------------------
             $messages = array();
             $this->DB->build(array('select' => 'msg_id', 'from' => 'message_posts', 'where' => 'msg_is_first_post=0 AND msg_author_id=' . intval($this->request['member_id'])));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 $messages[] = $r['msg_id'];
             }
             //-----------------------------------------
             // Delete topics
             //-----------------------------------------
             if (count($messages)) {
                 $messengerLibrary->deleteMessages($messages, $this->request['member_id']);
             }
         }
         $this->registry->output->redirect($this->settings['base_url'] . "module=members&amp;section=members&amp;do=viewmember&amp;member_id=" . $this->request['member_id'], $this->lang->words['deleted_pms']);
     }
 }
 /**
  * Add a new arn entry
  *
  * @access	private
  * @return	void		[Outputs to screen/redirects]
  */
 private function _doWarn()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $save = array();
     $err = 0;
     $topicPosts_type = trim($this->request['topicPosts_type']);
     $topicPosts_topics = intval($this->request['topicPosts_topics']);
     $topicPosts_replies = intval($this->request['topicPosts_replies']);
     $topicPosts_lastx = intval($this->request['topicPosts_lastx']);
     $topicPosts_lastxunits = trim($this->request['topicPosts_lastxunits']);
     $level_custom = intval($this->request['level_custom']);
     $ban_indef = intval($this->request['ban_indef']);
     $member_banned = intval($this->warn_member['member_banned']);
     $warn_level = intval($this->warn_member['warn_level']);
     //-----------------------------------------
     // Load Mod Squad
     //-----------------------------------------
     require_once IPSLib::getAppDir('forums') . '/sources/classes/moderate.php';
     $moderatorLibrary = new moderatorLibrary($this->registry);
     //-----------------------------------------
     // Security checks
     //-----------------------------------------
     if ($this->type == 'member') {
         $this->registry->output->showError('warn_member_notes', 2028);
     }
     //-----------------------------------------
     // Check security fang
     //-----------------------------------------
     if ($this->request['key'] != $this->member->form_hash) {
         $this->registry->output->showError('warn_bad_key', 3020);
     }
     //-----------------------------------------
     // As Celine Dion once squawked, "Show me the reason"
     //-----------------------------------------
     if (trim($this->request['reason']) == "") {
         $this->_showForm('we_no_reason');
         return;
     }
     //-----------------------------------------
     // Other checks
     //-----------------------------------------
     if (!$this->settings['warn_past_max'] && $this->request['level'] != 'nochange') {
         if ($this->request['level'] == 'custom') {
             if ($level_custom > $this->settings['warn_max']) {
                 $err = 1;
             } else {
                 if ($level_custom < $this->settings['warn_min']) {
                     $err = 2;
                 }
             }
         } else {
             if ($this->request['level'] == 'add') {
                 if ($warn_level >= $this->settings['warn_max']) {
                     $err = 1;
                 }
             } else {
                 if ($warn_level <= $this->settings['warn_min']) {
                     $err = 2;
                 }
             }
         }
         if ($err) {
             $this->registry->output->showError($err == 1 ? 'warn_past_max_high' : 'warn_past_max_low', 10251);
         }
     }
     //-----------------------------------------
     // Plussy - minussy?
     //-----------------------------------------
     if ($this->request['level'] == 'nochange') {
         $save['wlog_type'] = 'nochan';
     } else {
         $save['wlog_type'] = $this->request['level'] == 'custom' ? 'custom' : ($this->request['level'] == 'add' ? 'neg' : 'pos');
     }
     $save['wlog_date'] = time();
     //-----------------------------------------
     // Contacting the member?
     //-----------------------------------------
     $test_content = trim(IPSText::br2nl($_POST['contact']));
     if ($test_content != "") {
         if (trim($this->request['subject']) == "") {
             $this->_showForm('we_no_subject');
             return;
         }
         unset($test_content);
         if (IPSText::getTextClass('editor')->method == 'rte') {
             $this->request['contact'] = IPSText::getTextClass('editor')->processRawPost('contact');
         }
         IPSText::getTextClass('bbcode')->parse_smilies = 1;
         IPSText::getTextClass('bbcode')->parse_html = 0;
         IPSText::getTextClass('bbcode')->parse_bbcode = 1;
         IPSText::getTextClass('bbcode')->parsing_section = 'warn';
         $save['wlog_contact'] = $this->request['contactmethod'];
         $save['wlog_contact_content'] = "<subject>" . $this->request['subject'] . "</subject><content>" . $this->request['contact'] . "</content>";
         $save['wlog_contact_content'] = IPSText::getTextClass('bbcode')->preDbParse($save['wlog_contact_content']);
         if ($this->request['contactmethod'] == 'email') {
             IPSText::getTextClass('bbcode')->parse_smilies = 0;
             IPSText::getTextClass('bbcode')->parse_html = 1;
             IPSText::getTextClass('bbcode')->parse_bbcode = 1;
             IPSText::getTextClass('bbcode')->parsing_section = 'warn';
             IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id'];
             IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->memberData['mgroup_others'];
             $this->request['contact'] = IPSText::getTextClass('bbcode')->preDisplayParse(IPSText::getTextClass('bbcode')->preDbParse($this->request['contact']));
             //-----------------------------------------
             // Send the email
             //-----------------------------------------
             IPSText::getTextClass('email')->getTemplate("email_member");
             IPSText::getTextClass('email')->buildMessage(array('MESSAGE' => IPSText::br2nl($this->request['contact']), 'MEMBER_NAME' => $this->warn_member['members_display_name'], 'FROM_NAME' => $this->memberData['members_display_name']));
             IPSText::getTextClass('email')->subject = $this->request['subject'];
             IPSText::getTextClass('email')->to = $this->warn_member['email'];
             IPSText::getTextClass('email')->from = $this->settings['email_out'];
             IPSText::getTextClass('email')->sendMail();
         } else {
             //-----------------------------------------
             // Grab PM class
             //-----------------------------------------
             require_once IPSLib::getAppDir('members') . '/sources/classes/messaging/messengerFunctions.php';
             $messengerFunctions = new messengerFunctions($this->registry);
             try {
                 $messengerFunctions->sendNewPersonalTopic($this->warn_member['member_id'], $this->memberData['member_id'], array(), $this->request['subject'], IPSText::getTextClass('editor')->method == 'rte' ? nl2br($_POST['contact']) : $_POST['contact'], array('origMsgID' => 0, 'fromMsgID' => 0, 'postKey' => md5(microtime()), 'trackMsg' => 0, 'addToSentFolder' => 0, 'hideCCUser' => 0, 'forcePm' => 1));
             } catch (Exception $error) {
                 $msg = $error->getMessage();
                 $toMember = IPSMember::load($this->warn_member['member_id'], 'core');
                 if (strstr($msg, 'BBCODE_')) {
                     $msg = str_replace('BBCODE_', '', $msg);
                     $this->registry->output->showError($msg, 10252);
                 } else {
                     if (isset($this->lang->words['err_' . $msg])) {
                         $this->lang->words['err_' . $msg] = $this->lang->words['err_' . $msg];
                         $this->lang->words['err_' . $msg] = str_replace('#NAMES#', implode(",", $messengerFunctions->exceptionData), $this->lang->words['err_' . $msg]);
                         $this->lang->words['err_' . $msg] = str_replace('#TONAME#', $toMember['members_display_name'], $this->lang->words['err_' . $msg]);
                         $this->lang->words['err_' . $msg] = str_replace('#FROMNAME#', $this->memberData['members_display_name'], $this->lang->words['err_' . $msg]);
                         $this->registry->output->showError('err_' . $msg, 10253);
                     } else {
                         if ($msg != 'CANT_SEND_TO_SELF') {
                             $_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
                             $this->registry->output->showError($_msgString, 10254);
                         }
                     }
                 }
             }
         }
     } else {
         unset($test_content);
     }
     //-----------------------------------------
     // Right - is we banned or wha?
     //-----------------------------------------
     $restrict_post = '';
     $mod_queue = '';
     $susp = '';
     $_notes = array();
     $_notes['content'] = $this->request['reason'];
     $_notes['mod'] = $this->request['mod_value'];
     $_notes['post'] = $this->request['post_value'];
     $_notes['susp'] = $this->request['susp_value'];
     $_notes['ban'] = $ban_indef;
     $_notes['topicPosts_type'] = $topicPosts_type;
     $_notes['topicPosts_topics'] = $topicPosts_topics;
     $_notes['topicPosts_replies'] = $topicPosts_replies;
     $_notes['topicPosts_lastx'] = $topicPosts_lastx;
     $_notes['topicPosts_lastxunits'] = $topicPosts_lastxunits;
     $save['wlog_notes'] = serialize($_notes);
     //-----------------------------------------
     // Member Content
     //-----------------------------------------
     if ($topicPosts_type == 'unapprove' or $topicPosts_type == 'approve') {
         $time = $topicPosts_lastxunits == 'd' ? $topicPosts_lastx * 24 : $topicPosts_lastx;
         $approve = $topicPosts_type == 'approve' ? TRUE : FALSE;
         if ($topicPosts_topics and $this->canApproveTopics and ($topicPosts_replies and $this->canApprovePosts)) {
             $moderatorLibrary->toggleApproveMemberContent($this->warn_member['member_id'], $approve, 'all', $time);
         } else {
             if ($topicPosts_topics and $this->canApproveTopics) {
                 $moderatorLibrary->toggleApproveMemberContent($this->warn_member['member_id'], $approve, 'topics', $time);
             } else {
                 if ($topicPosts_replies and $this->canApprovePosts) {
                     $moderatorLibrary->toggleApproveMemberContent($this->warn_member['member_id'], $approve, 'replies', $time);
                 }
             }
         }
     } else {
         if ($topicPosts_type == 'delete') {
             $time = $topicPosts_lastxunits == 'd' ? $topicPosts_lastx * 24 : $topicPosts_lastx;
             if ($topicPosts_topics and $this->canDeleteTopics and ($topicPosts_replies and $this->canDeletePosts)) {
                 $moderatorLibrary->deleteMemberContent($this->warn_member['member_id'], 'all', $time);
             } else {
                 if ($topicPosts_topics and $this->canDeleteTopics) {
                     $moderatorLibrary->deleteMemberContent($this->warn_member['member_id'], 'topics', $time);
                 } else {
                     if ($topicPosts_replies and $this->canDeletePosts) {
                         $moderatorLibrary->deleteMemberContent($this->warn_member['member_id'], 'replies', $time);
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Member Suspension
     //-----------------------------------------
     if ($this->canModQueue) {
         if ($this->request['mod_indef'] == 1) {
             $mod_queue = 1;
         } elseif ($this->request['mod_value'] > 0) {
             $mod_queue = IPSMember::processBanEntry(array('timespan' => intval($this->request['mod_value']), 'unit' => $this->request['mod_unit']));
         }
     }
     if ($this->canRemovePostAbility) {
         if ($this->request['post_indef'] == 1) {
             $restrict_post = 1;
         } elseif ($this->request['post_value'] > 0) {
             $restrict_post = IPSMember::processBanEntry(array('timespan' => intval($this->request['post_value']), 'unit' => $this->request['post_unit']));
         }
     }
     if ($this->canSuspend) {
         if ($ban_indef) {
             $member_banned = 1;
         } else {
             if ($this->request['susp_value'] > 0) {
                 $susp = IPSMember::processBanEntry(array('timespan' => intval($this->request['susp_value']), 'unit' => $this->request['susp_unit']));
             }
         }
         /* Were banned but now unticked? */
         if (!$ban_indef and $member_banned) {
             $member_banned = 0;
         }
     }
     $save['wlog_mid'] = $this->warn_member['member_id'];
     $save['wlog_addedby'] = $this->memberData['member_id'];
     //-----------------------------------------
     // Enter into warn loggy poos (eeew - poo)
     //-----------------------------------------
     $this->DB->insert('warn_logs', $save);
     //-----------------------------------------
     // Update member
     //-----------------------------------------
     if ($this->request['level'] != 'nochange') {
         if ($this->request['level'] == 'custom') {
             $warn_level = $level_custom;
         } else {
             if ($this->request['level'] == 'add') {
                 $warn_level++;
             } else {
                 $warn_level--;
             }
         }
         if ($warn_level > $this->settings['warn_max']) {
             $warn_level = $this->settings['warn_max'];
         }
         if ($warn_level < intval($this->settings['warn_min'])) {
             $warn_level = intval($this->settings['warn_min']);
         }
     }
     IPSMember::save($this->warn_member['member_id'], array('core' => array('mod_posts' => $mod_queue, 'restrict_post' => $restrict_post, 'temp_ban' => $susp, 'member_banned' => $member_banned, 'warn_level' => $warn_level, 'warn_lastwarn' => time())));
     //-----------------------------------------
     // Now what? Show success screen, that's what!!
     //-----------------------------------------
     $this->lang->words['w_done_te'] = sprintf($this->lang->words['w_done_te'], $this->warn_member['members_display_name']);
     $tid = intval($this->request['t']);
     $topic = array();
     if ($tid > 0) {
         $topic = $this->DB->buildAndFetch(array('select' => 't.tid, t.title, t.title_seo', 'from' => array('topics' => 't'), 'where' => "t.tid={$tid}", 'add_join' => array(array('select' => 'f.id, f.name, f.name_seo', 'from' => array('forums' => 'f'), 'where' => 'f.id=t.forum_id', 'type' => 'left'))));
     }
     $this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_success($topic);
 }
 /**
  * Rebuild Messenger Totals
  *
  * @access	public
  * @return	void
  */
 public function rebuildMsgCounts()
 {
     //-----------------------------------------
     // Grab messenger lib
     //-----------------------------------------
     require_once IPSLib::getAppDir("members") . '/sources/classes/messaging/messengerFunctions.php';
     $messengerFunctions = new messengerFunctions($this->registry);
     //-----------------------------------------
     // Set up
     //-----------------------------------------
     $done = 0;
     $start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
     $end = intval($this->request['pergo']) ? intval($this->request['pergo']) : 100;
     $dis = $end + $start;
     $output = array();
     //-----------------------------------------
     // Got any more?
     //-----------------------------------------
     $tmp = $this->DB->buildAndFetch(array('select' => 'member_id', 'from' => 'members', 'limit' => array($dis, 1)));
     $max = intval($tmp['member_id']);
     //-----------------------------------------
     // Avoid limit...
     //-----------------------------------------
     $this->DB->build(array('select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($start, $end)));
     $outer = $this->DB->execute();
     //-----------------------------------------
     // Process...
     //-----------------------------------------
     while ($r = $this->DB->fetch($outer)) {
         $messengerFunctions->resetMembersFolderCounts($r['member_id']);
         $messengerFunctions->resetMembersTotalTopicCount($r['member_id']);
         $messengerFunctions->resetMembersNewTopicCount($r['member_id']);
         $done++;
     }
     //-----------------------------------------
     // Finish - or more?...
     //-----------------------------------------
     if (!$done and !$max) {
         //-----------------------------------------
         // Done..
         //-----------------------------------------
         $text = $this->lang->words['re_rebuildcomp'] . implode("<br />", $output);
         $url = "{$this->settings['base_url']}{$this->form_code}";
         $time = 2;
     } else {
         //-----------------------------------------
         // More..
         //-----------------------------------------
         $thisgoeshere = sprintf($this->lang->words['re_thisgoeshere'], $dis);
         $text = $thisgoeshere . implode("<br />", $output);
         $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
         $time = 0;
     }
     //-----------------------------------------
     // Bye....
     //-----------------------------------------
     $this->registry->output->redirect($url, $text, $time);
 }