Thread: Add-On Releases - [YUI] Live Search
View Single Post
  #106  
Old 03-24-2009, 02:20 PM
rmxs rmxs is offline
 
Join Date: Apr 2006
Posts: 419
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 \&lt;\<\>\&gt;\:\;\"\'\,\.\?\/\~\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/', '', $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]);
.............................
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01998 seconds
  • Memory Usage 1,785KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete