FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » 2.7.6 - Tread Rating Enables Javascript for Non-Moderators. (RateThread enables Javascript for non-moderators after user rates thread.)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
2.7.6 - Tread Rating Enables Javascript for Non-Moderators. [message #35642] Fri, 26 January 2007 21:33 Go to previous message
Bubba is currently offline  Bubba   United States
Messages: 5
Registered: December 2006
Karma:
Junior Member
I'm using FUDForum 2.7.6 w/ ratings displayed at top of template msg and tree. When non-moderator users rate a thread, ratethread.php enables javascript to moderate ratings. While this is harmless as opened window results in "Invalid URL" error, when "OK" is clicked, secondary window reloads forum resulting in bad user experience.

Here's the offending code and possible solution.

File: src/ratethread.php.t

ISSUE:
if ($is_a) {
$MOD = 1;
} else {
$MOD = q_singleval('SELECT m.id FROM {SQL_TABLE_PREFIX}thread t INNER JOIN {SQL_TABLE_PREFIX}mod m ON m.forum_id=t.forum_id WHERE t.id='.$th);
}

$MOD is 1 for Admins or row id of thread moderator.

When {TEMPLATE: thread_rating} is evaluated, JS is enabled.

{MAIN_SECTION: thread_rating}
&nbsp;({IF: $MOD}<a href="javascript://" onClick="javascript: window_open(\'{FULL_ROOT}{ROOT}?t=ratingtrack&amp;{DEF: _rsid}&amp;th={VAR: frm->id}\', \'th_rating_track\', 300, 400);">{ENDIFI}<img src="{THEME_IMAGE_ROOT}/{VAR: frm->rating}stars.gif" title="{MSG: topic_rating}" />{IF: $MOD}</a>{ENDIFI}) {MSG: vote}
{MAIN_SECTION: END}

Possible Fix:
if ($is_a) {
$MOD = 1;
} else {
$mod_id = q_singleval('SELECT m.user_id FROM {SQL_TABLE_PREFIX}thread t INNER JOIN {SQL_TABLE_PREFIX}mod m ON m.forum_id=t.forum_id WHERE t.id='.$th);
$MOD = ($mod_id === _uid);
}

Hope this helps.
[Message index]
 
Read Message
Read Message
Previous Topic: Missing flag icon?
Next Topic: 2.7.6 - Locked Thread Displays Action Buttons for Original Poster and Moderators
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 01:27:26 GMT 2024

Total time taken to generate the page: 0.04125 seconds