vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Add-On Releases - [YUI] Live Search (https://vborg.vbsupport.ru/showthread.php?t=204517)

mad@Max 03-11-2009 11:38 AM

Version 2.0.2
Rewritten some functions.

fukdawrld 03-11-2009 05:01 PM

Thank you for the update! It pulls up results now. It still has the issue where you have to click outside the box in order for it to search for the results. If you don't it just has a blank box with no results. Also on my board it doesn't work at all in IE.

Thanks again for the update.

star88 03-14-2009 08:35 AM

Thanks Max for the update but it still doesn't work with non-english characters searches.
I didn't find the issue

mad@Max 03-14-2009 11:36 AM

I searching decision of this issue.

thanhcavn 03-14-2009 06:21 PM

Not work in IE (popup result does not display)

keeptry 03-15-2009 05:57 PM

great hack but it has a wrong position -.-"... can someone help?http://img5.imageshack.us/img5/5933/98021795.jpg

maidos 03-17-2009 12:26 PM

i got a issue, i have quick search but when i add your code it will then have 2 search box needhelp. Wish to use the template default search bar so need help

also is it also possible the search starts instantly when u type more than x words

im unableto move the search window because on vbulletion option you only grant us to change the height and width but not allowing to move the top

<form action="search.php?do=process" method="post">
<div id="lsa_window">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="" />
<input type="hidden" name="securitytoken" value="guest" />
<div class="searchBoxInput">

<input type="text" class="searchinput" name="query" value="Search Forum" onfocus="if (this.value == 'Search Forum') this.value = '';" onblur="if (this.value == '') this.value = 'Search Forum';" />

mad@Max 03-18-2009 04:56 PM

If you wanna use moveable window, you can use old version of hack:) I still not plan moveable window.

maidos 03-18-2009 10:14 PM

well thing is i dont have the older version anymore and the result window is in mess aswell it displays over the search field. so hope u reconsider to make the window moveable again oratleast tell me where in template i can move the window

couldyouhelp me how to integrate your live search on the code i posted while keeping the default search bar? i prefer my templates search bar

mad@Max 03-20-2009 01:43 PM

If you talk about default dropdown search, integration not easy...

rmxs 03-20-2009 02:22 PM

The install guid is not clear.
I wont to display on nav bar...before was ok 3 letters and i saw results 4th and new results now dont works..
If i dont click search in advance doesnt search automaticaly also to display the box i have to click out..
This is my code


Code:

<form action="search.php?do=process" method="post">
                    <div id="lsa_window">
                        <div id="tb-searchbox"><b>Live Search: </b> <input type="text" class="bginput" name="query" tabindex="1001" id="lsa_input" maxlength="$vboptions[lsa_maxsym]" value="$vbphrase[live_search]" onfocus="if(this.value=='$vbphrase[live_search]'){this.value=''};<if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"> showHint();</if>" onblur="if (this.value==''){this.value='$vbphrase[live_search]'}"<if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"> onkeyup="showHint();</if> />
onfocus="if(this.value=='$vbphrase[search_forums]')this.value='';" onblur="if(this.value=='$vbphrase[search_forums]')this.value='';" onkeyup="showHint(this.value)" /></div>

                        <input type="hidden" name="do" value="process" />
                        <input type="hidden" name="quicksearch" value="1" />
                        <input type="hidden" name="childforums" value="1" />
                        <input type="hidden" name="exactname" value="1" />
                        <input type="hidden" name="s" value="$session[sessionhash]" />
                        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                    </div>
                    <if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"><script type="text/javascript"> vbmenu_register("lsa_window",1); </script></if>
                    </form>


EDIT


AFTER SOME EDITS TO YOUR CODE AT FORM TEMPLATE NOW WORKS GOOD AND NOT NEED CLICKOUTSIDE OF WINDOW TO OPEN THE SEARCH ALSO NOW WORK WITH3-4-5-6-7 LETTERS AND MAKE NEW SEARCH EVERYTIME THAT YOU WRITE SOMETHINK

i just add to my navbar $lsaform and activated from settings
BYT STILL CANT SEARCH WITH GREEK (NO RESUTLS)

MySQL charset: UTF-8 Unicode (utf8)

Tables
latin1_swedish_ci

rmxs 03-20-2009 07:03 PM

I fount out why some people need to click 2 times to open search box.

Is this Live search on the box..
If you remove it no more 2 clicks.

How to remove (Simple way)

Go to your language and search for Live Search (at results select this from GLOBAL live_search)
Click edit and at the boxes bellow with your languages just click a SPACE no let it empty..Just one space.)

mad@Max 03-22-2009 01:40 PM

Version 2.0.3
Fixed some bugs with search field.
Updated instruction.

rmxs 03-22-2009 05:39 PM

Updated
(you have remove the text from box right?)

Still no results a non english

FiMeTi 03-22-2009 05:44 PM

Nice Addon. Good job. :)

mad@Max 03-22-2009 08:34 PM

rmxs, no, i'm not removing, just rewrote some html and js things.

rmxs 03-22-2009 09:08 PM

Quote:

Originally Posted by mad@Max (Post 1774550)
rmxs, no, i'm not removing, just rewrote some html and js things.

oh yes i ynistall and install and dont replace my changes :|

at my template i have add just the code
$lsaform
is that correct?
For me works good (except non eglish)

My db is UTF-8 byt tables are latin1_swedish_ci

maybe this is the problem with non english..
is possible to change tables collation or can we do it from code?

mad@Max 03-22-2009 10:04 PM

Yes, thats it:)

fukdawrld 03-22-2009 11:03 PM

Ok this release fixed the double click issue but I still have to click outside the box and back on it for the results to show up in Firefox and opera. Still doesn't work in IE at all on my board.

mad@Max 03-23-2009 01:32 AM

This is intended:) On my forums search work on all browsers.

star88 03-24-2009 07:59 AM

Thanks Max for this update
unfortunatly, because non-english characters don't return any result I can't use this great mod on my site.

rmxs 03-24-2009 08:29 AM

Yes max must fix this error (old version was ok :( )

mad@Max 03-24-2009 10:47 AM

With which the old version of hack it work?

fukdawrld 03-24-2009 11:04 AM

Quote:

Originally Posted by mad@Max (Post 1774744)
This is intended:) On my forums search work on all browsers.

You mean its intended to have to click outside the box to pull up results?

rmxs 03-24-2009 02:20 PM

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]);
.............................

mad@Max 03-24-2009 02:26 PM

This function convert utf to windows-1251(cp1251)...

rmxs 03-24-2009 05:05 PM

Quote:

Originally Posted by mad@Max (Post 1775859)
This function convert utf to windows-1251(cp1251)...

Yes i know byt with the old work with non english and with new no. :|
you have try to include this on new version?

mad@Max 03-24-2009 08:11 PM

Version 2.0.4
Previously was a problem that, if after a certain time to begin a search, it will not bring any results. Now the problem is solved (i hope) by using $vbulletin->GPC.

mad@Max 03-24-2009 08:19 PM

rmxs, i can, but I do not know if this will work for all. But you can do this for yourself:
Replace this
PHP Code:

    if (function_exists('iconv'))
    {
        
$query = @iconv('UTF-8'$stylevar['charset'], $query);
    }else
    {
        
$query $query;
    } 

With
PHP Code:

        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 utf8_to_win($query); 


rmxs 03-24-2009 08:30 PM

Now this version works without any change :)

mad@Max 03-24-2009 08:57 PM

I'm happy:)

star88 03-25-2009 07:57 AM

Great ! Now it works like a charm with french accents. Thank you Max :)

mad@Max 03-25-2009 10:11 AM

In the next version i will try to make the search for individual words.

rmxs 03-25-2009 11:10 AM

Hello max :)

You have make good work..

I wont to see from you also somethink like similar thead check..
Check for similar thread before posting a new one

Its not too clean and conflict with many mods.

I think with this mod with some improvments you can tranform it to similar thread check :)

mad@Max 03-25-2009 06:30 PM

I do not fully understand what you are saying:)

rmxs 03-25-2009 08:09 PM

Ops :) read again adove.

mad@Max 03-25-2009 08:51 PM

No, thanks:) I already wrote a search for individual words. Wait a new version...

mad@Max 03-25-2009 09:56 PM

Version 2.1
Finally i wrote search by individual words!

dvbusuario 03-26-2009 03:05 AM

1 Attachment(s)
With Version 1.6 No show results, but yes shows the popup window

Attachment 96985

And with the new version 2.1 no show anything of the popup window

How can I fix this?

Thank you!

Stoebi 03-26-2009 06:25 AM

Can't get it to work also. No Popup in IE7/IE8 (navbar or $lsaform) :(

vBulletin 3.8.1pl1 (using Standard-Style without any edits (only navbar ;))).
PHP: 5.2.6
MySQL Version: 5.0.67-community (Charset: UTF-8 Unicode (utf8))



This is the only change i did in template navbar:
Code:

                <form action="search.php?do=process" method="post">

                    <div id="lsa_window">
                    <input type="hidden" name="do" value="process" />
                    <input type="hidden" name="quicksearch" value="1" />
                    <input type="hidden" name="childforums" value="1" />
                    <input type="hidden" name="exactname" value="1" />
                    <input type="hidden" name="s" value="$session[sessionhash]" />
                    <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                    <div>
                        <input type="text" class="bginput" size="25" id="lsa_input" name="query" tabindex="1001" maxlength="$vboptions[lsa_maxsym]" value="$vbphrase[live_search]" <if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))">onfocus="vbmenu_register('lsa_window',1); if(this.value=='$vbphrase[live_search]'){this.value=''}; showHint();" onblur="this.value='$vbphrase[live_search]';" onkeyup="showHint();"<else />onfocus="if(this.value=='$vbphrase[live_search]'){this.value=''};" onblur="this.value='$vbphrase[live_search]';"</if> />
                        <input type="submit" class="button" value="$vbphrase[go]" tabindex="1004" />
                    </div>
                    <div style="margin-top:$stylevar[cellpadding]px">
                        <label for="rb_nb_sp0"><input type="radio" name="showposts" value="0" id="rb_nb_sp0" tabindex="1002" checked="checked" />$vbphrase[show_threads]</label>
                        &nbsp;
                        <label for="rb_nb_sp1"><input type="radio" name="showposts" value="1" id="rb_nb_sp1" tabindex="1003" />$vbphrase[show_posts]</label>
                    </div>
                    </div>
                </form>

With Firefox and Chrome the code in navbar is not working fine, because I've no chance to enter any word.
With $lsaform placed in header or FORUMHOME for example, your hack is working fine, but not with IE7/IE8 at the moment :(


Video: http://ioj.com/v/3pvf5



Regards, Stoebi


All times are GMT. The time now is 06:37 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01543 seconds
  • Memory Usage 1,866KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete