Works with version 1.3
with ajax_search.php
here is the content of this file
Code:
<?php
/*
Live Search v1.3
Writed by: coderphp (https://vborg.vbsupport.ru/member.php?u=174485)
Modify by: mad@Max (https://vborg.vbsupport.ru/member.php?u=209608)
*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'ajax_search');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('global');
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
function utf8_to_win($string){
for ($c=0;$c<strlen($string);$c++){
$i=ord($string[$c]);
if ($i <= 127) @$out .= $string[$c];
if (@$byte2){
$new_c2=($c1&3)*64+($i&63);
$new_c1=($c1>>2)&5;
$new_i=$new_c1*256+$new_c2;
if ($new_i==1025){
$out_i=168;
} else {
if ($new_i==1105){
$out_i=184;
} else {
$out_i=$new_i-848;
}
}
@$out .= chr($out_i);
$byte2 = false;
}
if (($i>>5)==6) {
$c1 = $i;
$byte2 = true;
}
}
return $out;
}
$query = addslashes(trim($_GET['query']));
// if you use cp1251 collation your tables, uncomment below strings
//if (is_browser('opera')){
// $query = utf8_to_win ($query);
//}
if($query AND $_SERVER['HTTP_REFERER'])
{
foreach ($vbulletin->userinfo['forumpermissions'] AS $forumid => $fperms)
{
if (!($fperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($fperms & $vbulletin->bf_ugp_forumpermissions['cansearch']) OR !verify_forum_password($forumid, $forum['password'], false) OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['indexposts']))
{
$excludelist .= ",$forumid";
}
else if ((!$vbulletin->GPC['titleonly'] OR $vbulletin->GPC['showposts']) AND !($fperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{ // exclude forums that have canview but no canviewthreads if this is a post search
$excludelist .= ",$forumid";
}
}
$results = $db->query_read("SELECT * FROM ". TABLE_PREFIX ."thread WHERE `title` LIKE '%$query%' AND `". TABLE_PREFIX ."thread`.`forumid` NOT IN (0 $excludelist) LIMIT 50");
if ($db->num_rows($results)> 0)
{
while($result = $db->fetch_array($results))
{
$trimtitle = 45;
$lsfid = $result['forumid'];
$lsttitle = $result['title'];
$lsalt = $lsttitle;
if ($trimtitle > 0 && strlen($lsttitle) > $trimtitle)
{ $lsttitle = fetch_trimmed_title($lsttitle, $trimtitle); }
$lsttitle = preg_replace('/\<[a-zA-Z0-9 \<\<\>\>\:\;\"\'\,\.\?\/\~\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/', '', $lsttitle);
// $lsttitle = preg_replace("#(".$query.")#si", "<span style=\"color: #ff0000; font-weight: bold;\">\\1</span>", $lsttitle);
$lsttitle = preg_replace("#(".$query.")#si", "<span class=\"highlight\">\\1</span>", $lsttitle);
$lstid = $result['threadid'];
$lsftitle = $db->query_first("SELECT title FROM ". TABLE_PREFIX ."forum WHERE forumid = $lsfid LIMIT 1");
$lsfname = $lsftitle['title'];
echo "<div style=\"float:left;\"><a href=\"".$vboptions[bburl]."/Vb/showthread.php?t=".$lstid."\" title=\"".$lsalt."\">".$lsttitle."</a></div><div style=\"float:right;\"><a href=\"".$vboptions[bburl]."/Vb/forumdisplay.php?f=".$lsfid."\"><font color=\"#666666\">".$lsfname."</font></a></div><br />";
}
}else{
echo "<div align=\"center\">" . $vbphrase[ls_no_results] . "</div>";
}
}
?>
I dont have the product and i have unistall it from vb to install this one.
i think here is the tip...
function utf8_to_win($string){
for ($c=0;$c<strlen($string);$c++){
$i=ord($string[$c]);
.............................
|