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
Switch to threaded view of this topic 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 next message
Bubba is currently offline  Bubba   United States
Messages: 5
Registered: December 2006
Karma: 0
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.
Re: 2.7.6 - Tread Rating Enables Javascript for Non-Moderators. [message #35650 is a reply to message #35642] Sun, 28 January 2007 16:16 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Fixed in CVS, thanks.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Thu Nov 21 23:11:16 GMT 2024

Total time taken to generate the page: 0.03438 seconds