PDA

View Full Version : Multiple-level forum corrupt rewrite


tomzx
05 Apr 2007, 13:43
I have, in my forums, one category which contains others subcategories. When that category newpost url is being rewritten, the output becomes something like
http://t-thethreadtitle-63-new.html/

So, I've lost the board url during the process and the category in which the post belongs (which is generally just before the t-thethreadtitle-63-new.html

How would you fix that?

Note: I'm currently on 3.6.5

I've done a bit of work and here's what I found

code that is being executed


//forumdisplay / index
#------------------------------
# showthread.php?goto=newpost
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?goto=newpost&amp;t=([0-9]+)"#i', $output, $matches);

if($found) {

$ids = array();


for($i = 0; $i < $found; $i++) {
if(is_numeric($matches[1][$i]))
$ids[] = $matches[1][$i];
}


for ($x = 0; $x < (count($ids)); $x++) {
$title = urlize($GLOBALS[vRewrite_thread]["$ids[$x]"][title]);
$forumid = $GLOBALS[vRewrite_thread]["$ids[$x]"][ownerid];

$fname = urlize($GLOBALS[vRewrite_forum]["$forumid"][title]);

$tid = $ids[$x];
$new = (($vbulletin->options['vRewrite_showthread'] == 1) ? $fname : 'f-' . $fname . '-' . $forumid);
$output = str_replace("<a href=\"showthread.php?goto=newpost&amp;t=$tid\"", "<a href=\"$myurl/$new/t-$title-$tid-new{$vbulletin->options['vRewrite_extension_showthread']}\"", $output);
}
}

What I also found is that the $GLOBALS[vRewrite_forum] for that specific category will output 2 arrays, one with the main category title and another one with the lasttitle and lastthread but no title.

The actual problem is that the $fname doesn't exist for the subforum thus not outputting a value which corrupts the $output.

I can temporarly fix it with

if (empty($fname))
$fname = "subforum";


but I'd like to know how you can actually show up the forum title.

Thanks


1) What version of vRewrite are you running (please look at the plugin version)
1.5.1
2) Version informatioN: (a) vBulletin, (b) MySQL, (c) PHP
vBulletin 3.6.5, MySQL 4, PHP 4
3) Exact error you are receiving; please provide details on how you reproduce the error. Pictures are always nice
See above