Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2012, 02:22 PM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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..!
Reply With Quote
  #2  
Old 05-17-2012, 07:47 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Code:
for ($i=1488; $i < 1514; $i++)
{
        $currentletter = '&#' . intval($i) . ';';
Reply With Quote
  #3  
Old 05-20-2012, 06:16 AM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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..
Reply With Quote
  #4  
Old 05-20-2012, 12:51 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 05-20-2012, 01:29 PM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:57 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.03950 seconds
  • Memory Usage 2,221KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (7)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete