vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   adding new letters to memberlist.php (https://vborg.vbsupport.ru/showthread.php?t=283076)

ohadpartuck 05-17-2012 02:22 PM

adding new letters to memberlist.php
 
hi.
I am trying to enable search by my own language letters in the http://www.s-maof.com/Forum/memberlist.php .
so i added this code to memberlist.php at line 504


The thing is that my letters are in hebrew.
The code seems to have problems with that
PHP Code:

for ($i=128$i 154$i++)
    {
        
//$currentletter = $i;
        
$currentletter chr($i);
        
$linkletter =& $currentletter;
        
$show['selectedletter'] = $selectedletter == $currentletter true false;
        
$templater vB_Template::create('memberlist_letter');
            
$templater->register('currentletter'$currentletter);
            
$templater->register('linkletter'$linkletter);
            
$templater->register('ltrurl'$ltrurl);
            
$templater->register('perpage'$perpage);
            
$templater->register('sortfield'$sortfield);
            
$templater->register('sortorder'$sortorder);
            
$templater->register('usergrouplink'$usergrouplink);
        
$letterbits .= $templater->render();
    } 

which is the same for the english letters but just different ascii values.
the thing is the code in line 350
PHP Code:

$condition .= " AND username LIKE(\"" $db->escape_string_like($ltr) . "%\")"

doesn't search for the right letter. This is a coding problem.
The advanced serach in my language works. I just don't know how does it do it..!

kh99 05-17-2012 07:47 PM

This is stab in the dark, but try this (for the first few lines):

Code:

for ($i=1488; $i < 1514; $i++)
{
        $currentletter = '&#' . intval($i) . ';';


ohadpartuck 05-20-2012 06:16 AM

Hi kh99,
Thanks for the replay.
As I said, the letters are displayed properly,
but still there is the SQL Query problem in,
more specific in line 350 which looks for the letter wrongly
I have echoed what it gets for one of the letters
PHP Code:

1=AND username LIKE("�%"

the condition code is
PHP Code:

if ($ltr != '')
    {
        if (
$ltr == '#')
        {
            
$condition .= " AND username NOT REGEXP(\"^[a-zA-Z]\")";
        }
        else
        {
            
$ltr chr(intval(ord($ltr)));
            
//echo $ltr ."<BR/>";
            
echo $condition .= " AND username LIKE(\"" $db->escape_string_like($ltr) . "%\")";
        }
    } 

and the letter comes for the url address in line 103
PHP Code:

$ltr $vbulletin->input->clean_gpc('r''ltr'TYPE_NOHTML); 

and of course as a result of that no results are returned..

kh99 05-20-2012 12:51 PM

I realize that you were getting the letters displayed correctly. I don't know a whole lot about using different char encodings but it seems like the code you have is using extended ascii values which aren't always the same (your display changes didn't display hebrew characters when I tried it on my test server, but the code I posted above does). So my thought was that maybe if you instead used html entities for those characters then the search code might work. But like I said, it was just a guess.

ohadpartuck 05-20-2012 01:29 PM

thanks kh99,
I figured it out.
I figured that I just have to look where is the advanced search's condition is (because there, it works),

and there was the solution to the problem:

instead of :
PHP Code:

$ltr chr(intval(ord($ltr))); 

I use:
PHP Code:

htmlspecialchars_uni($ltr); 

and it works!!!!

check on that!


All times are GMT. The time now is 06:16 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.01021 seconds
  • Memory Usage 1,744KB
  • 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
  • (1)bbcode_code_printable
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete