authenticate("U_Groups"); if (!$user['U_Groups']) { $user['U_Groups'] = "-4-"; if (!isset($config['guestsearch']) || !$config['guestsearch']) { $html->not_right($ubbt_lang['NO_SEARCH'],$Cat); } } // ------------------------------------------------------------------------ // Let's figure out if they were on a forum, so we can default to searching // that forum $referer = find_environmental ("HTTP_REFERER"); if ($referer!="") { if (preg_match("#/Board/#",$referer)){ preg_match("#Board/(.*)#",$referer,$piece); }else{ preg_match("#Board=(.*)#",$referer,$piece); } if (isset($piece['1'])) { $referer = $piece['1']; $board = $referer; if (stristr($referer,"&")) { list ($board,$crap) = split("&",$referer); } if (stristr($referer,"/")) { list ($board,$crap) = split("/",$referer); } } } // --------------------- // Give them the search $html -> send_header($ubbt_lang['TEXT_SEARCH'],$Cat,0,$user); // --------------- // Grab the forums // ----------------------------------------------- // If we have a Cat variable we only search those if ($Cat) { $Cat = preg_replace("/[^\d,]/","",$Cat); $pattern = ","; $replace = " OR t1.Bo_Cat = "; $thiscat = str_replace($pattern,$replace,$Cat); $catonly = "AND (t1.Bo_Cat = $thiscat )"; } // -------------------------------------------------------------- // We need to format a portion of the SQL query depending on what // groups this user is in $Grouparray = split("-",$user['U_Groups']); $gsize = sizeof($Grouparray); $g = 0; for ($i=0; $i<=$gsize; $i++) { if (!isset($Grouparray[$i])) { continue; } if (!preg_match("/[0-9]/",$Grouparray[$i])) { continue; } $g++; if ($g > 1) { $groupquery .= " OR "; } $groupquery .= "t1.Bo_Read_Perm LIKE '%-$Grouparray[$i]-%'"; } $query = " SELECT t1.Bo_Number,t1.Bo_Title,t1.Bo_Keyword,t1.Bo_Cat,t1.Bo_CatName,t1.Bo_Sorter FROM {$config['tbprefix']}Boards AS t1, {$config['tbprefix']}Category AS t2 WHERE ($groupquery) AND t1.Bo_Active = '1' AND t1.Bo_Cat = t2.Cat_Entry $catonly ORDER BY t2.Cat_Number,t1.Bo_Sorter "; $sth = $dbh -> do_query($query,__LINE__,__FILE__); while (list($Bo_Number,$Bo_Title,$Bo_Keyword,$Bo_Cat,$Bo_CatName,$Bo_Sorter) = $dbh -> fetch_array($sth)) { if ($initialcat != $Bo_Cat) { $forum = 0; $initialcat = $Bo_Cat; } $catarray[$Bo_Cat] = $Bo_CatName; $forumarray[$Bo_Cat][$forum]['BoNum'] = $Bo_Number; $forumarray[$Bo_Cat][$forum]['BoTitle'] = $Bo_Title; $forumarray[$Bo_Cat][$forum]['BoKeyword'] = $Bo_Keyword; $forum++; } $allselected = "selected=\"selected\""; while(list($catnum,$catname) = each($catarray)) { $options .= ""; for($j=0;$j   {$forumarray[$catnum][$j]['BoTitle']}"; } } // What type of range? $config['rangetype'] = $ubbt_lang[$config['rangetype']]; if ($config['rangevalue'] == 1) { $config['rangetype'] = preg_replace("/s$/","",$config['rangetype']); } // --------------------- // Grab the tablewrapper list($tbopen,$tbclose) = $html -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/search.tmpl"); } $html -> send_footer(); ?>