Thread: Major Additions - Links and Downloads Manager
View Single Post
  #775  
Old 07-29-2008, 06:57 PM
IrPr IrPr is offline
 
Join Date: Mar 2005
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by derfelix View Post
@obmob
yes thats when you add or modify.. but if you are in a category just browsing the links, i have (top left) a dropdown "sort by" and just below that a second dropdown called "filter".. thats the one i meant.
----------
@Andrew..
just found a little (for me) bug in ratings...
If 3 people rate a link.. lets say:
user 1 rates 5
user 2 rates 3
user 3 rates 4
(total 12 => average 4 ... works fine)

now 2 things can happen:
1. another user comments.. but does NOT rate..
2. user 3 clicks on "Clear ratings"

in my understanding the average should still be 4.. because only 2 users have rated.. (users 1 and 2 .. total 8.. average 4)

But its different.. if 1. happens.. rating becomes 8/3 => ~3
if 2. happens rating becomes 12/4 => 3
and if 1. AND 2 happen.. then rating becomes 8/4 => 2!

Maybe its supposed to be like that..but
Personally i dont want users that have commented but NOT rated to be counted in ratings..
so i made myself a little fix:

open: local_links_actions.php
in function ldm_fix_rating_counts find:
PHP Code:
    foreach ($rates as $r) {
        
$numrate += 1;
        
$totrate += $r;
    } 
replace with
PHP Code:
    foreach ($rates as $r) {
        if(
$r>0)
        {
            
$numrate += 1;
            
$totrate += $r;
        }
    } 
of course on live sites this will not be an ideal solution.. because it will only fix the rating of a link as soon as somebody either rates or comments..
if the site is still small.. admin can modify (open and save) 1 comment/rating in each existing link.. .. if a link is commented/rated for the first time.. there is no problem..

[EDIT] AHHHHHHH... drawback.. now the the number of comments (as it is the same number will only show the amount of ratings.. (not counting the number of comments that have no vote) [/EDIT]
...

-------------
A yes another harder to fix issue..
in the dropdown where you preview the comments (in the linkbit).. IF the site is running in UTF-8 there are some issues (strange characters appearing) sometimes..
I found the problem..
its in the function ldm_cleantext_to_width_rows
IF you run UTF8 and have a special character where the line is supposed to stop.. substr can truncate a non ascii character.. because the count is wrong.. returning the string but the last character is truncated.. showing a weird sign..
The only fix I know of is to use mb_strlen and mb_substr instead of strlen and substr..
I did some test by replacing substr(....) by mb_substr(.....,"UTF-8") in that function.. (also the strlen)
IT WORKS for me.. BUT..
if the mb_substr exists since php 4.06 not all providers have the php multi-byte extension installed.. (i had to activate them on my localhost)
so a fix would only be for those who have it installed.. and are using UTF-8 .. but it still is a a pain.. because you have to specify the encoding every time... AND you DONT always need the mb_substr.. only sometimes.. like here.
maybe there is another workaround???

Felix





..
Awesome!
thanks Felix
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01366 seconds
  • Memory Usage 1,793KB
  • 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
  • (2)bbcode_php
  • (1)bbcode_quote
  • (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