Esempio n. 1
0
function msg_get($id)
{
    if ($r = db_sab('SELECT * FROM phpgw_fud_msg WHERE id=' . $id)) {
        $r->body = read_msg_body($r->foff, $r->length, $r->file_id);
        un_register_fps();
        return $r;
    }
    error_dialog('Invalid Message', 'The message you are trying to view does not exist.');
}
Esempio n. 2
0
$logic_options = tmpl_draw_select_opt("AND\nOR", "AND\nOR", $search_logic, '', '');
$sort_options = tmpl_draw_select_opt("DESC\nASC", "Descending Order\nAscending Order", $sort_order, '', '');
$TITLE_EXTRA = ': Search For ' . htmlspecialchars($srch);
ses_update_status($usr->sid, 'Searching posts');
$page_pager = '';
if ($srch) {
    if (!($c =& fetch_search_cache($srch, $start, $ppg, $search_logic, $field, $sort_order, $forum_limiter, $total))) {
        $search_data = '<br />
<table border="0" cellspacing="1" cellpadding="2" class="ContentTable">
<tr class="RowStyleA"><th colspan=2 width="100%" align="center">No Results</th></tr>
</table>';
    } else {
        $i = 0;
        $search_data = '';
        while ($r = db_rowobj($c)) {
            $body = trim_body(read_msg_body($r->foff, $r->length, $r->file_id));
            $poster_info = !empty($r->poster_id) ? '<a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&amp;id=' . $r->poster_id . '&amp;' . _rsid . '">' . $r->alias . '</a>' : '' . $GLOBALS['ANON_NICK'];
            ++$i;
            $search_data .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td class="GenText" width="100%">' . $i . '. <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&amp;goto=' . $r->id . '&amp;' . _rsid . '">' . $r->subject . '</a><br />' . $body . '</td><td class="GenText" nowrap><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&amp;frm_id=' . $r->forum_id . '&amp;' . _rsid . '">' . $r->forum_name . '</a></td><td class="GenText" nowrap><font class="DateText">' . strftime("%a, %d %B %Y %H:%M", $r->post_stamp) . '</font> By: ' . $poster_info . '</td></tr>';
        }
        un_register_fps();
        $search_data = '<br />
<table border="0" cellspacing="1" cellpadding="2" class="ContentTable">
<tr><th width="100%">Subject</th><th>Forum</th><th nowrap>Posted On</th></tr>
' . $search_data . '
</table>';
        $page_pager = tmpl_create_pager($start, $ppg, $total, '/egroupware/fudforum/3814588639/index.php?t=search&amp;srch=' . urlencode($srch) . '&amp;field=' . $field . '&amp;' . _rsid . '&amp;search_logic=' . $search_logic . '&amp;sort_order=' . $sort_order . '&amp;forum_limiter=' . $forum_limiter);
    }
} else {
    $search_data = '';
}
function msg_get($id)
{
    if ($r = db_sab('SELECT * FROM phpgw_fud_msg WHERE id=' . $id)) {
        $r->body = read_msg_body($r->foff, $r->length, $r->file_id);
        un_register_fps();
        return $r;
    }
    error_dialog('Messaggio non valido', 'Il messaggio che stai cercando di visualizzare non esiste.');
}
                LEFT JOIN phpgw_fud_msg l ON t.last_post_id = l.id
                LEFT JOIN phpgw_fud_users lu ON l.poster_id = lu.id
                WHERE forum_id=' . $line['id'];
    $threads_result = mysql_query($fud_threads) or die('[' . $fud_threads . '] Query failed: ' . mysql_error());
    while ($thread = mysql_fetch_array($threads_result, MYSQL_ASSOC)) {
        //     print_r($thread);
        $vanila_d_sql = 'INSERT INTO LUM_Discussion VALUES(' . $thread['id'] . ',' . $thread['owner'] . ',' . '0,' . $thread['root_msg_id'] . ',' . $thread['last_poster'] . ',' . '1,' . ($thread['thread_opt'] % 2 == 0 ? '0,' : '1,') . ($thread['thread_opt'] > 1 ? '1,' : '0,') . '\'' . mysql_escape_string($thread['subject']) . '\',' . '\'' . $thread['date_created'] . '\',' . '\'' . $thread['date_last'] . '\',' . $thread['replies'] . ',' . $i . ',' . '0,0,0,0)';
        //mysql_query($vanila_d_sql) or die('['.$vanila_d_sql.'] Query failed: ' . mysql_error());
    }
}
mysql_free_result($result);
mysql_free_result($threads_result);
$fud_msg_sql = "SELECT \n             fm.*,\n             fu.egw_id as poster,\n             fu2.egw_id as updater,\n             FROM_UNIXTIME(fm.post_stamp) as date_created, \n             FROM_UNIXTIME(fm.update_stamp) as date_edited \n             FROM `phpgw_fud_msg` fm \n             left join phpgw_fud_users fu on fm.`poster_id`=fu.id\n             left join phpgw_fud_users fu2 on fm.`updated_by`=fu2.id";
$result = mysql_query($fud_msg_sql) or die('[' . $fud_msg_sql . '] Query failed: ' . mysql_error());
while ($msg = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $vanilla_comments_sql = 'INSERT INTO LUM_Comment VALUES(' . $msg['id'] . ',' . $msg['thread_id'] . ',' . $msg['poster'] . ',' . '\'' . $msg['date_created'] . '\',' . '\'' . $msg['updater'] . '\',' . '\'' . $msg['date_edited'] . '\',' . '\'\',' . '\'' . mysql_escape_string(read_msg_body($msg['foff'], $msg['length'], $msg['file_id'])) . '\',' . '\'html\',' . '0,' . '\'\',' . '\'\',' . '\'' . $msg['ip_addr'] . '\')';
    mysql_query($vanilla_comments_sql) or die('[' . $vanilla_comments_sql . '] Query failed: ' . mysql_error());
}
mysql_free_result($result);
mysql_close($link);
/*
 id   	  thread_id   	  poster_id   	  reply_to   	  ip_addr   	  host_name   	  post_stamp   	  update_stamp   	  updated_by   	  icon   	  subject   	  attach_cnt   	  poll_id   	  foff   	  length   	  file_id   	  offset_preview   	  length_preview   	  file_id_preview   	  attach_cache   	  poll_cache   	  mlist_msg_id   	  msg_opt   	  apr   	  poster
CREATE TABLE `LUM_Comment` (
  `CommentID` int(8) NOT NULL auto_increment,
  `DiscussionID` int(8) NOT NULL default '0',
  `AuthUserID` int(10) NOT NULL default '0',
  `DateCreated` datetime default NULL,
  `EditUserID` int(10) default NULL,
  `DateEdited` datetime default NULL,
  `WhisperUserID` int(11) default NULL,
  `Body` text,
Esempio n. 5
0
    function approve($id, $unlock_safe = false)
    {
        /* fetch info about the message, poll (if one exists), thread & forum */
        $mtf = db_sab('SELECT
					m.id, m.poster_id, m.apr, m.subject, m.foff, m.length, m.file_id, m.thread_id, m.poll_id, m.attach_cnt,
					m.post_stamp, m.reply_to, m.mlist_msg_id,
					t.forum_id, t.last_post_id, t.root_msg_id, t.last_post_date,
					m2.post_stamp AS frm_last_post_date,
					f.name AS frm_name,
					u.alias, u.email, u.sig,
					n.id AS nntp_id, ml.id AS mlist_id
				FROM phpgw_fud_msg m
				INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id
				INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id
				LEFT JOIN phpgw_fud_msg m2 ON f.last_post_id=m2.id
				LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id
				LEFT JOIN phpgw_fud_mlist ml ON ml.forum_id=f.id
				LEFT JOIN phpgw_fud_nntp n ON n.forum_id=f.id
				WHERE m.id=' . $id . ' AND m.apr=0');
        /* nothing to do or bad message id */
        if (!$mtf) {
            return;
        }
        if ($mtf->alias) {
            reverse_fmt($mtf->alias);
        } else {
            $mtf->alias = $GLOBALS['ANON_NICK'];
        }
        if (!db_locked()) {
            db_lock('phpgw_fud_thread_view WRITE, phpgw_fud_level WRITE, phpgw_fud_users WRITE, phpgw_fud_forum WRITE, phpgw_fud_thread WRITE, phpgw_fud_msg WRITE');
            $ll = 1;
        }
        q("UPDATE phpgw_fud_msg SET apr=1 WHERE id=" . $mtf->id);
        if ($mtf->poster_id) {
            user_set_post_count($mtf->poster_id);
        }
        $last_post_id = $mtf->post_stamp > $mtf->frm_last_post_date ? $mtf->id : 0;
        if ($mtf->root_msg_id == $mtf->id) {
            /* new thread */
            rebuild_forum_view($mtf->forum_id);
            $threads = 1;
        } else {
            /* reply to thread */
            if ($mtf->post_stamp > $mtf->last_post_date) {
                th_inc_post_count($mtf->thread_id, 1, $mtf->id, $mtf->post_stamp);
            } else {
                th_inc_post_count($mtf->thread_id, 1);
            }
            rebuild_forum_view($mtf->forum_id, q_singleval('SELECT page FROM phpgw_fud_thread_view WHERE forum_id=' . $mtf->forum_id . ' AND thread_id=' . $mtf->thread_id));
            $threads = 0;
        }
        /* update forum thread & post count as well as last_post_id field */
        frm_updt_counts($mtf->forum_id, 1, $threads, $last_post_id);
        if ($unlock_safe || isset($ll)) {
            db_unlock();
        }
        if ($mtf->poll_id) {
            poll_activate($mtf->poll_id, $mtf->forum_id);
        }
        $mtf->body = read_msg_body($mtf->foff, $mtf->length, $mtf->file_id);
        if ($GLOBALS['FUD_OPT_1'] & 16777216) {
            index_text(preg_match('!Re: !i', $mtf->subject) ? '' : $mtf->subject, $mtf->body, $mtf->id);
        }
        /* handle notifications */
        if ($mtf->root_msg_id == $mtf->id) {
            if (empty($mtf->frm_last_post_date)) {
                $mtf->frm_last_post_date = 0;
            }
            /* send new thread notifications to forum subscribers */
            $c = uq('SELECT u.email, u.icq, u.users_opt
					FROM phpgw_fud_forum_notify fn
					INNER JOIN phpgw_fud_users u ON fn.user_id=u.id
					LEFT JOIN phpgw_fud_forum_read r ON r.forum_id=fn.forum_id AND r.user_id=fn.user_id
					INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=' . $mtf->forum_id . '
					LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=fn.user_id AND g2.resource_id=' . $mtf->forum_id . '
				WHERE
					fn.forum_id=' . $mtf->forum_id . ' AND fn.user_id!=' . (int) $mtf->poster_id . '
					AND (CASE WHEN (r.last_view IS NULL AND (u.last_read=0 OR u.last_read >= ' . $mtf->frm_last_post_date . ')) OR r.last_view > ' . $mtf->frm_last_post_date . ' THEN 1 ELSE 0 END)=1
					AND ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0');
            $notify_type = 'frm';
        } else {
            /* send new reply notifications to thread subscribers */
            $c = uq('SELECT u.email, u.icq, u.users_opt, r.msg_id, u.id
					FROM phpgw_fud_thread_notify tn
					INNER JOIN phpgw_fud_users u ON tn.user_id=u.id
					LEFT JOIN phpgw_fud_read r ON r.thread_id=tn.thread_id AND r.user_id=tn.user_id
					INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=' . $mtf->forum_id . '
					LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=tn.user_id AND g2.resource_id=' . $mtf->forum_id . '
				WHERE
					tn.thread_id=' . $mtf->thread_id . ' AND tn.user_id!=' . (int) $mtf->poster_id . '
					AND (r.msg_id=' . $mtf->last_post_id . ' OR (r.msg_id IS NULL AND ' . $mtf->post_stamp . ' > u.last_read))
					AND ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0');
            $notify_type = 'thr';
        }
        while ($r = db_rowarr($c)) {
            if ($r[2] & 16) {
                $to['EMAIL'] = $r[0];
            } else {
                $to['ICQ'] = $r[1] . '@pager.icq.com';
            }
            if (isset($r[4]) && is_null($r[3])) {
                $tl[] = $r[4];
            }
        }
        unset($c);
        if (isset($tl)) {
            /* this allows us to mark the message we are sending notification about as read, so that we do not re-notify the user
             * until this message is read.
             */
            q('INSERT INTO phpgw_fud_read (thread_id, msg_id, last_view, user_id) SELECT ' . $mtf->thread_id . ', 0, 0, id FROM phpgw_fud_users WHERE id IN(' . implode(',', $tl) . ')');
        }
        if (isset($to)) {
            send_notifications($to, $mtf->id, $mtf->subject, $mtf->alias, $notify_type, $notify_type == 'thr' ? $mtf->thread_id : $mtf->forum_id, $mtf->frm_name, $mtf->forum_id);
        }
        // Handle Mailing List and/or Newsgroup syncronization.
        if (($mtf->nntp_id || $mtf->mlist_id) && !$mtf->mlist_msg_id) {
            fud_use('email_msg_format.inc', true);
            reverse_fmt($mtf->alias);
            $from = $mtf->poster_id ? $mtf->alias . ' <' . $mtf->email . '>' : $GLOBALS['ANON_NICK'] . ' <' . $GLOBALS['NOTIFY_FROM'] . '>';
            $body = $mtf->body . ($mtf->msg_opt & 1 && $mtf->sig ? "\n--\n" . $mtf->sig : '');
            plain_text($body);
            plain_text($subject);
            if ($mtf->reply_to) {
                $replyto_id = q_singleval('SELECT mlist_msg_id FROM phpgw_fud_msg WHERE id=' . $mtf->reply_to);
            } else {
                $replyto_id = 0;
            }
            if ($mtf->attach_cnt) {
                $r = uq("SELECT a.id, a.original_name,\n\t\t\t\t\t\tCASE WHEN m.mime_hdr IS NULL THEN 'application/octet-stream' ELSE m.mime_hdr END\n\t\t\t\t\t\tFROM phpgw_fud_attach a\n\t\t\t\t\t\tLEFT JOIN phpgw_fud_mime m ON a.mime_type=m.id\n\t\t\t\t\t\tWHERE a.message_id=" . $mtf->id . " AND a.attach_opt=0");
                while ($ent = db_rowarr($r)) {
                    $attach[$ent[1]] = file_get_contents($GLOBALS['FILE_STORE'] . $ent[0] . '.atch');
                    if ($mtf->mlist_id) {
                        $attach_mime[$ent[1]] = $ent[2];
                    }
                }
            } else {
                $attach_mime = $attach = null;
            }
            if ($mtf->nntp_id) {
                fud_use('nntp.inc', true);
                $nntp_adm = db_sab('SELECT * FROM phpgw_fud_nntp WHERE id=' . $mtf->nntp_id);
                $nntp = new fud_nntp();
                $nntp->server = $nntp_adm->server;
                $nntp->newsgroup = $nntp_adm->newsgroup;
                $nntp->port = $nntp_adm->port;
                $nntp->timeout = $nntp_adm->timeout;
                $nntp->nntp_opt = $nntp_adm->nntp_opt;
                $nntp->login = $nntp_adm->login;
                $nntp->pass = $nntp_adm->pass;
                define('sql_p', 'phpgw_fud_');
                $lock = $nntp->get_lock();
                $nntp->post_message($mtf->subject, $body, $from, $mtf->id, $replyto_id, $attach);
                $nntp->close_connection();
                $nntp->release_lock($lock);
            } else {
                fud_use('mlist_post.inc', true);
                $GLOBALS['CHARSET'] = 'ISO-8859-15';
                $r = db_saq('SELECT name, additional_headers FROM phpgw_fud_mlist WHERE id=' . $mtf->mlist_id);
                mail_list_post($r[0], $from, $mtf->subject, $body, $mtf->id, $replyto_id, $attach, $attach_mime, $r[1]);
            }
        }
    }
Esempio n. 6
0
';
            } else {
                echo '
<item>
	<title>' . sp($r->subject) . '</title>
	<topic_id>' . $r->thread_id . '</topic_id>
	<topic_title>' . sp($r->th_subject) . '</topic_title>
	<message_id>' . $r->id . '</message_id>
	<reply_to_id>' . $r->reply_to . '</reply_to_id>
	<reply_to_title>' . $r->reply_subject . '</reply_to_title>
	<forum_id>' . $r->forum_id . '</forum_id>
	<forum_title>' . sp($r->frm_name) . '</forum_title>
	<category_title>' . sp($r->cat_name) . '</category_title>
	<author>' . sp($r->alias) . '</author>
	<author_id>' . $r->poster_id . '</author_id>
	<body>' . str_replace("\n", '', sp(read_msg_body($r->foff, $r->length, $r->file_id))) . '</body>
';
                if ($r->attach_cnt && $r->attach_cache) {
                    $al = @unserialize($r->attach_cache);
                    if (!empty($al)) {
                        echo '<content:items><rdf:Bag>';
                        foreach ($al as $a) {
                            echo '<rdf:li>
									<content:item rdf:about="attachments">
										<a_title>' . sp($r[1]) . '</a_title>
										<a_id>' . $r[0] . '</a_id>
										<a_size>' . $r[2] . '</a_size>
										<a_nd>' . $r[3] . '</a_nd>
									</content:item>
								</rdf:li>';
                        }
while ($r = db_rowarr($c)) {
    $vl .= $r[0] . "\n";
    $kl .= $r[1] . "\n";
}
if (!$forum) {
    $forum = q_singleval('SELECT forum_id FROM phpgw_fud_thread WHERE id=' . $th);
}
$forum_sel = tmpl_draw_select_opt(rtrim($vl), rtrim($kl), $forum, '', '');
$c = uq("SELECT m.id, m.foff, m.length, m.file_id, m.subject, m.post_stamp, u.alias FROM phpgw_fud_msg m LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id WHERE m.thread_id=" . $th . " AND m.apr=1 ORDER BY m.post_stamp ASC");
$anon_alias = htmlspecialchars($ANON_NICK);
$msg_entry = '';
while ($r = db_rowobj($c)) {
    if (!$r->alias) {
        $r->alias = $anon_alias;
    }
    $msg_body = read_msg_body($r->foff, $r->length, $r->file_id);
    $msg_entry .= '<tr>
<td class="RowStyleC" valign="top" align="center"><input type="checkbox" name="sel_th[]" value="' . $r->id . '"></td>
<td class="RowStyleA">
<table cellspacing=1 cellpadding=2 border=0 class="ContentTable">
<tr class="RowStyleB">
	<td><font size="-1">
	<b>Inviato da:</b> ' . $r->alias . '<br />
	<b>Scritto:</b> ' . strftime("%a, %d %B %Y %H:%M", $r->post_stamp) . '<br />
	<b>Oggetto:</b> ' . $r->subject . '
	</font></td>
</tr>
<tr class="RowStyleA">
	<td>' . $msg_body . '</td>
</tr>
</table>
$tbl =& $DBHOST_TBL_PREFIX;
$base = $magic_file_id = 10000001;
$base -= 1;
$pc = round(q_singleval('SELECT count(*) FROM ' . $tbl . 'msg WHERE file_id<' . $magic_file_id) / 10);
$i = 0;
$stm = time();
if ($pc) {
    db_lock($tbl . 'msg m WRITE, ' . $tbl . 'thread t WRITE, ' . $tbl . 'forum f WRITE, ' . $tbl . 'msg WRITE');
    $c = q('SELECT m.id, m.foff, m.length, m.file_id, f.message_threshold FROM ' . $tbl . 'msg m INNER JOIN ' . $tbl . 'thread t ON m.thread_id=t.id INNER JOIN ' . $tbl . 'forum f ON t.forum_id=f.id WHERE m.file_id<' . $magic_file_id);
    while ($r = db_rowarr($c)) {
        if ($r[4] && $r[2] > $r[4]) {
            $m1 = $magic_file_id = write_body_c($body = read_msg_body($r[1], $r[2], $r[3]), $magic_file_id, $len, $off);
            $magic_file_id = write_body_c(trim_html($body, $r[4]), $magic_file_id, $len2, $off2);
            q('UPDATE ' . $tbl . 'msg SET foff=' . $off . ', length=' . $len . ', file_id=' . $m1 . ', file_id_preview=' . $magic_file_id . ', offset_preview=' . $off2 . ', length_preview=' . $len2 . ' WHERE id=' . $r[0]);
        } else {
            $magic_file_id = write_body_c(read_msg_body($r[1], $r[2], $r[3]), $magic_file_id, $len, $off);
            q('UPDATE ' . $tbl . 'msg SET foff=' . $off . ', length=' . $len . ', file_id=' . $magic_file_id . ' WHERE id=' . $r[0]);
        }
        if ($i && !($i % $pc)) {
            eta_calc($stm, $i, $pc);
        }
        $i++;
    }
    unset($c);
    un_register_fps();
    if (isset($GLOBALS['__FUD_TMP_F__'])) {
        foreach ($GLOBALS['__FUD_TMP_F__'] as $f) {
            fclose($f[0]);
        }
    }
    $magic_file_id++;
Esempio n. 9
0
				m.apr=1 ' . $lmt . ' ORDER BY m.post_stamp, m.thread_id');
if (!($o = db_rowobj($c))) {
    invl_inp_err();
}
if ($thread || $msg) {
    $subject = $o->subject;
}
$fpdf = new fud_pdf('FUDforum ' . $FORUM_VERSION, $FORUM_TITLE, $subject, $PDF_PAGE, $PDF_WMARGIN, $PDF_HMARGIN);
$fpdf->begin_page($subject);
do {
    /* write message header */
    reverse_fmt($o->alias);
    reverse_fmt($o->subject);
    $fpdf->message_header($o->subject, $o->alias, $o->post_stamp, $o->id, $o->thread_id);
    /* write message body */
    $msg_body = strip_tags(post_to_smiley(read_msg_body($o->foff, $o->length, $o->file_id), $re));
    reverse_fmt($msg_body);
    $fpdf->input_text(explode("\n", $msg_body));
    /* handle attachments */
    if ($o->attach_cnt && $o->attach_cache) {
        $a = unserialize($o->attach_cache);
        if (is_array($a) && @count($a)) {
            foreach ($a as $i) {
                $attch[] = array('id' => $i[0], 'name' => $i[1], 'nd' => $i[3]);
            }
            $fpdf->add_attacments($attch);
        }
    }
    /* handle polls */
    if ($o->poll_name && $o->poll_cache) {
        $pc = @unserialize($o->poll_cache);
Esempio n. 10
0
$tbl =& $DBHOST_TBL_PREFIX;
db_lock($tbl . 'search_cache WRITE, ' . $tbl . 'search WRITE, ' . $tbl . 'index WRITE, ' . $tbl . 'title_index WRITE, ' . $tbl . 'msg WRITE');
if (!($sid = q_singleval("SELECT MIN(query_type) FROM " . $tbl . "search_cache WHERE srch_query='' AND query_type<0"))) {
    q('DELETE FROM ' . $tbl . 'search');
    q('DELETE FROM ' . $tbl . 'index');
    q('DELETE FROM ' . $tbl . 'title_index');
    q('DELETE FROM ' . $tbl . 'search_cache');
}
$c = q('SELECT id, subject, length, foff, file_id FROM ' . $tbl . 'msg WHERE ' . ($sid ? ' id>' . $sid . ' AND ' : '') . ' apr=1 ORDER BY subject');
$old_subject = '';
while ($r = db_rowarr($c)) {
    if ($old_subject != $r[1]) {
        $subj = $old_subject = $r[1];
    } else {
        $subj = '';
    }
    q('INSERT INTO ' . $tbl . 'search_cache (srch_query, query_type, expiry, msg_id, n_match) VALUES(\'\', -' . $r[0] . ', 0,0,0)');
    index_text($subj, read_msg_body($r[3], $r[2], $r[4]), $r[0]);
}
unset($c);
un_register_fps();
q('DELETE FROM ' . $tbl . 'search_cache');
db_unlock();
echo 'Done<br>';
if ($FUD_OPT_1 & 1) {
    echo '<br>Re-enabling the forum.<br>';
    maintenance_status($GLOBALS['DISABLED_REASON'], 0);
} else {
    echo '<br><font size=+1 color="red">Your forum is currently disabled, to re-enable it go to the <a href="admglobal.php?' . _rsidl . '">Global Settings Manager</a> and re-enable it.</font>';
}
require $WWW_ROOT_DISK . 'adm/admclose.php';