if ($str[0] == '-') {
         $not = 'NOT ';
         $str = substr($str, 1);
     } else {
         $not = '';
     }
     if ($i > 0) {
         $sql_where_like .= $op . $not;
     }
     if ($_POST['opt_0'] == 0) {
         $sql_where_like .= "(r.topic LIKE{$binary} '%{$str}%' OR r.comment LIKE{$binary} '%{$str}%') ";
     } else {
         $sql_where_like .= "r.topic LIKE{$binary} '%{$str}%' ";
     }
 }
 $sql_where = $slog->sqlinboards('r.board', 1, $boards) . " ";
 if (count($used) > 0) {
     $sql_where .= "({$sql_where_like}) ";
 }
 if (isset($rname)) {
     if (count($used) > 0) {
         $sql_where .= "AND ";
     }
     $sql_where .= "r.name = '{$rname}' ";
 }
 if (strxlen($_POST['name']) >= $config['searchminlength']) {
     $used[] = $_POST['name'];
 } else {
     $ignored[] = $_POST['name'];
 }
 $having = '';
// Header of feeds
$rss = new UniversalFeedCreator();
$rss->encoding = $lang->phrase('charset');
$rss->setDir("feeds/topics_");
$rss->useCached($action, '', $h);
$rss->title = $config['fname'];
$rss->description = $config['fdesc'];
$rss->link = $config['furl'] . "/forum.php";
$rss->language = $lang->phrase('rss_language');
$rss->ttl = $config['rssttl'];
$rss->copyright = $config['fname'];
$rss->lastBuildDate = time();
$rss->editor = $config['fname'];
$rss->editorEmail = $config['forenmail'];
$sqllimit = 15;
$sqlwhere = "r.tstart = '1' AND f.invisible != '2' AND f.active_topic = '1' AND f.opt != 'pw' " . $slog->sqlinboards('t.board');
$sqlorder = "t.date DESC";
$sqljoin = $sqlfields = '';
($code = $plugins->load('external_query')) ? eval($code) : null;
// Get the last 15 topics
$result = $db->query("\nSELECT r.dowords, r.comment, r.guest, f.name as forum, u.name as uname, u.mail as umail, r.name as gname, r.email as gmail, t.topic, t.id, t.board, t.date, t.status {$sqlfields} \nFROM {$db->pre}topics AS t LEFT JOIN {$db->pre}replies AS r ON t.id = r.topic_id \n\tLEFT JOIN {$db->pre}user AS u ON r.name=u.id \n\tLEFT JOIN {$db->pre}forums AS f ON t.board=f.id \n\t{$sqljoin}\nWHERE {$sqlwhere} \nORDER BY {$sqlorder} \nLIMIT {$sqllimit}\n", __LINE__, __FILE__);
// Loop through them if the site is not offline
if ($config['foffline'] == 0) {
    while ($row = $db->fetch_object($result)) {
        // Formats the data
        if ($row->guest == 0) {
            $row->email = $row->umail;
            $row->name = $row->uname;
        } else {
            $row->email = $row->gmail;
            $row->name = $row->gname;
// Header of feeds
$rss = new UniversalFeedCreator();
$rss->encoding = $lang->phrase('charset');
$rss->setDir("feeds/topics_");
$rss->useCached($action, '', $h);
$rss->title = $config['fname'];
$rss->description = $config['fdesc'];
$rss->link = $config['furl'] . "/forum.php";
$rss->language = $lang->phrase('rss_language');
$rss->ttl = $config['rssttl'];
$rss->copyright = $config['fname'];
$rss->lastBuildDate = time();
$rss->editor = $config['fname'];
$rss->editorEmail = $config['forenmail'];
// Get the last 15 topics
$result = $db->query("\nSELECT r.dowords, r.comment, c.name as forum, u.name as uname, u.mail as umail, r.name as gname, r.email as gmail, t.topic, t.id, t.board, t.date, t.status \nFROM {$db->pre}topics AS t LEFT JOIN {$db->pre}replies AS r ON t.id = r.topic_id LEFT JOIN {$db->pre}user AS u ON r.name=u.id LEFT JOIN {$db->pre}cat AS c ON t.board=c.id \nWHERE r.tstart = '1' AND c.opt != 'pw' {$statustype} " . $slog->sqlinboards('t.board') . "\nORDER BY t.date DESC \nLIMIT 15\n", __LINE__, __FILE__);
// Loop through them if the site is not offline
if ($config['foffline'] == 0) {
    while ($row = $db->fetch_object($result)) {
        // Formats the data
        if (!$row->gmail) {
            $row->email = $row->umail;
            $row->name = $row->uname;
        } else {
            $row->email = $row->gmail;
            $row->name = $row->gname;
        }
        $bbcode->setSmileys(0);
        if ($config['wordstatus'] == 0) {
            $row->dowords = 0;
        }
     if ($str[0] == '-') {
         $not = 'NOT ';
         $str = substr($str, 1);
     } else {
         $not = '';
     }
     if ($i > 0) {
         $sql_where_like .= $op . $not;
     }
     if ($_POST['opt_0'] == 0) {
         $sql_where_like .= "(r.topic LIKE{$binary} '%{$str}%' OR r.comment LIKE{$binary} '%{$str}%') ";
     } else {
         $sql_where_like .= "r.topic LIKE{$binary} '%{$str}%' ";
     }
 }
 $sql_where = $slog->sqlinboards('r.board', 1) . " ";
 if (count($used) > 0) {
     $sql_where .= "({$sql_where_like}) ";
 }
 if (isset($rname)) {
     if (count($used) > 0) {
         $sql_where .= "AND ";
     }
     $sql_where .= "r.name = '{$rname}' ";
 }
 if (strxlen($_POST['name']) >= $config['searchminlength']) {
     $used[] = $_POST['name'];
 } else {
     $ignored[] = $_POST['name'];
 }
 $having = '';
// Header of feeds
$rss = new UniversalFeedCreator();
$rss->encoding = $lang->phrase('charset');
$rss->setDir("feeds/topics_");
$rss->useCached($action, '', $h);
$rss->title = $config['fname'];
$rss->description = $config['fdesc'];
$rss->link = $config['furl'] . "/forum.php";
$rss->language = $lang->phrase('rss_language');
$rss->ttl = $config['rssttl'];
$rss->copyright = $config['fname'];
$rss->lastBuildDate = time();
$rss->editor = $config['fname'];
$rss->editorEmail = $config['forenmail'];
$sqllimit = 15;
$sqlwhere = "r.tstart = '1' AND c.opt != 'pw' " . $slog->sqlinboards('t.board');
$sqlorder = "t.date DESC";
$sqljoin = $sqlfields = '';
($code = $plugins->load('external_query')) ? eval($code) : null;
// Get the last 15 topics
$result = $db->query("\nSELECT r.dowords, r.comment, r.guest, c.name as forum, u.name as uname, u.mail as umail, r.name as gname, r.email as gmail, t.topic, t.id, t.board, t.date, t.status {$sqlfields} \nFROM {$db->pre}topics AS t LEFT JOIN {$db->pre}replies AS r ON t.id = r.topic_id \n\tLEFT JOIN {$db->pre}user AS u ON r.name=u.id \n\tLEFT JOIN {$db->pre}cat AS c ON t.board=c.id \n\t{$sqljoin}\nWHERE {$sqlwhere} \nORDER BY {$sqlorder} \nLIMIT {$sqllimit}\n", __LINE__, __FILE__);
// Loop through them if the site is not offline
if ($config['foffline'] == 0) {
    while ($row = $db->fetch_object($result)) {
        // Formats the data
        if ($row->guest == 0) {
            $row->email = $row->umail;
            $row->name = $row->uname;
        } else {
            $row->email = $row->gmail;
            $row->name = $row->gname;