Welcome, Guest. Please Login or Register.
April 27, 2025, 05:33:02 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Completed mods  |  Mod to fix Quote redirects « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Mod to fix Quote redirects  (Read 1041 times)
gandolphxx
Noobie
*
Posts: 41


Novice Admin

gandolphxx@hotmail.com WWW
Mod to fix Quote redirects
« on: May 12, 2003, 04:41:13 AM »
Reply with quote

I have a very active forum and attentive moderators - we move threads where they belong and split/merge to maintain continuity - this leads to quote references having the incorrect board id. In reality the board id is never needed anyway since the messages are unique - seems like a leftover from YaBB.

The following patch in Display.php will fix the errant quote problem with only a small overhead incurred for quote redirects that fail the current board test - quite negligible and far better than being told that the topic doesn't exist when indeed it does.

The loopback ensures that security is maintained and the global variable should prevent an infinite loop.

<search for>
  global $sourcedir, $sc, $prev_next;
</search for>

<add after>
  global $Gxx_display_redirect;
</add after>

<search for>
  if (mysql_num_rows($request) == 0)
     fatal_error($txt[472]);
</search for>

<replace>
  if (mysql_num_rows($request) == 0)
  {
     $request = mysql_query("
     SELECT ID_BOARD FROM {$db_prefix}topics
     WHERE ID_TOPIC = $viewnum") or database_error(__FILE__, __LINE__);
     if (mysql_num_rows($request) == 0 || $Gxx_display_redirect == 1)
     {
        fatal_error($txt[472]);
     }
     else
     {
        $row = mysql_fetch_row($request);
        $currentboard = $row[0];
        $Gxx_display_redirect = 1;
        Display();
     }
  }
</replace>


My contribution to happy forum users.
Logged
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:Mod to fix Quote redirects
« Reply #1 on: May 12, 2003, 05:00:15 AM »
Reply with quote

Wouldn't it be simpiler to just remove the part of the query that says WHERE (board_id='$board')

I still can't figure out why they put it there in the first place because there can't be a post with the same id on 2 different boards. :-/

So in otherwords using $board does nothing but clutter up the code for displaying topics. :-/

Anyway, great work I hate it when you can't find the topic you are looking for because it was moved.

[edit]I am not sure about this... but they "might" have done this so that they didn't have to code permission in display topic for the boards and categories... not positive on this... but it just hit me just now... after I had posted this. ;)[/edit]
« Last Edit: May 12, 2003, 05:01:35 AM by Chris Cromer » Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
gandolphxx
Noobie
*
Posts: 41


Novice Admin

gandolphxx@hotmail.com WWW
Re:Mod to fix Quote redirects
« Reply #2 on: May 12, 2003, 07:08:46 AM »
Reply with quote

In general I agree that the board id is useless, but in my case I am utilizing the excellent "allowed  users" mod extensively and need it for sub forum access in the near future - that is why I did the recursive call - to force permission checking - sometimes threads get moved to restricted boards and this trick catches that.
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Mod to fix Quote redirects
« Reply #3 on: May 13, 2003, 03:40:24 AM »
Reply with quote

Yeah, that's why the next version doesn't include the $board in every URL anymore ::)... in fact, $cgi is *gone*.

-[Unknown]
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  Mod to fix Quote redirects « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.031 seconds with 16 queries.