vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   vRewrite - SEOed URLs for vBulletin (https://vborg.vbsupport.ru/showthread.php?t=104484)

Snake 01-05-2006 06:48 PM

Ah that's awesome. So are you gonna update the zip file now?! :D

jonblaze3 01-05-2006 07:15 PM

Hey Tyler,

You're a good guy making this for everyone here so i'm gonna donate to you even though i'm not rich or anything. Anyways i haven't installed it cause i have vbseo but i might in the future and i like ur idea of not having it encoded or charging and i'm also a believer in competition to make better products and services for the people + i hate monopolies...lol.

BTW can you male the member profiles say "username.html" instead of "u-username-###.html?

Thanks!!!

Cole2026 01-05-2006 07:23 PM

Quote:

Originally Posted by jonblaze3
Hey Tyler,

You're a good guy making this for everyone here so i'm gonna donate to you even though i'm not rich or anything. Anyways i haven't installed it cause i have vbseo but i might in the future and i like ur idea of not having it encoded or charging and i'm also a believer in competition to make better products and services for the people + i hate monopolies...lol.

BTW can you male the member profiles say "username.html" instead of "u-username-###.html?

Thanks!!!

We have plans to make the software more versatile and flexible as later versions come out, we will probably have some options in later version to make the rewrite urls whatever you want.

GamerJunk.net 01-05-2006 08:57 PM

I'm gonna test this tonight and then install it on my live board afterwards...good mod

GamerJunk.net 01-05-2006 08:58 PM

But also I get this when I view the profiles...

http://www.hosting-talk.com/member.php?u=1

Immortal 01-05-2006 10:44 PM

Quote:

Originally Posted by Aftermath
Ah that's awesome. So are you gonna update the zip file now?!

It's uploaded now. Please note: That you do not need to upgrade if you are not getting any MySQL errors. If you are (and use table prefixe(s)) you will need to upgrade. Simply upload the new product and choose "Allow overwrite". Nothing new has been fixed other then this.

Quote:

Originally Posted by RasMasta
But also I get this when I view the profiles...

http://www.hosting-talk.com/member.php?u=1

Where is that URL coming from?

TNAImpact 01-05-2006 10:47 PM

How about donations to remove the copyright line? (I'm picky about stuff like that)

I'd definatly be intrested in donating once this becomes a non-beta plugin as it seems very promosing.

Immortal 01-05-2006 10:48 PM

Quote:

Originally Posted by TNAImpact
How about donations to remove the copyright line? (I'm picky about stuff like that)

I'd definatly be intrested in donating once this becomes a non-beta plugin as it seems very promosing.

I can do that, just shoot me an email when you are ready :)

derekivey 01-05-2006 11:13 PM

Tyler, found a bug, when you view a forum and see all the threads, if you click the username of the person that started the thread, it doesn't rewrite their username.

Should be an easy fix...

Derek

Immortal 01-05-2006 11:53 PM

Quote:

Originally Posted by derekivey
Tyler, found a bug, when you view a forum and see all the threads, if you click the username of the person that started the thread, it doesn't rewrite their username.

Should be an easy fix...

Derek

Whoops, yah it uses JS so it wasn't affected by the <a href. I've fixed this for 1.0. Thanks :)

derekivey 01-06-2006 12:34 AM

No Problem :)

cclaerhout 01-06-2006 01:11 AM

Quote:

Originally Posted by Immortal
It's uploaded now. Please note: That you do not need to upgrade if you are not getting any MySQL errors. If you are (and use table prefixe(s)) you will need to upgrade. Simply upload the new product and choose "Allow overwrite". Nothing new has been fixed other then this.
Where is that URL coming from?

I don't understand it was working with you previous released and now i've got this message :

Code:

Database error in vBulletin 3.5.3:

Invalid SQL:
SELECT userid, username FROMuser WHERE username='osibille';

MySQL Error  : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE username='osibille'' at line 1
Error Number : 1064
Date        : Thursday, January 5th 2006 @ 10:09:19 PM
Script      : http://www.anciensipj.org/forum/index.php
Referrer    : http://www.anciensipj.org/index.php?page=edito
IP Address  : 83.202.70.78
Username    : Technologue
Classname    : vb_database


Immortal 01-06-2006 01:31 AM

Quote:

Originally Posted by Immortal
You do not need to upgrade unless you previously had SQL errors.

:)

Okay....go to your Plugin Manager, find the hook global_complete and open up vRewrite's plugin. Copy and paste that text to me and PM it to me please. :)

It's working fine on my boards and I can't see why it wouldn't work unless there's an error in the syntax.

eXaulz 01-06-2006 01:32 AM

Wow. I love the idea, Immortal. Finally, somebody actually cares about helping people instead of making money. Hopefully, this will be better than vBSEO.

:)

eXaulz 01-06-2006 01:37 AM

Also, a suggestion:

Allow "custom" 'friendly urls'. Don't know how, but I'm sure you can do it

Immortal 01-06-2006 01:52 AM

Quote:

Originally Posted by eXaulz
Also, a suggestion:

Allow "custom" 'friendly urls'. Don't know how, but I'm sure you can do it.

Thanks for the kind compliment :)

We're hoping to add custom and choices for the 4 major rewrites (showthread, forumdisplay, member and showpost). Hopefully we're have it in the 1.5 release :)

GamerJunk.net 01-06-2006 01:56 AM

When adding the code to my showthread template I received this error..

Code:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/*******/public_html/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 325

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.


eXaulz 01-06-2006 02:00 AM

Wow. In some SQL queries you were putting FROM". TABLE_PREFIX ." instead of FROM ". TABLE PREFIX ." (notice the space between FROM and ". TABLE_PREFIX .").

Below is the proper code for vRewrite plugin, being called in global_complete. Nothing has been modified except for the things I mentioned above.

Works great now. Do the fix below if you are getting errors like:

Quote:

Database error in vBulletin 3.5.3:

Invalid SQL:
SELECT userid, username FROMuser WHERE username='youruser';

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE username='youruser'' at line 1 Error Number : 1064
Date : Thursday, January 5th 2006 @ 10:45:33 PM
Script : yoursite
Referrer : yoursite/url
IP Address : yourip
Username : youruser
Classname : vb_database
Go to AdminCP -> Plugin System > Plugin Manager >> Click on the vRewrite plugin found under Hook Location : global_complete. Replace the PHP code (found in the big Text Area) with the following: (yes, it works fine)

PHP Code:

if($vbulletin->options['vRewrite_on'])
{
#------------------------------
# Replace Forums
#------------------------------
$found preg_match_all('#<a href="forumdisplay\.php\?f=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT forumid, title FROM " TABLE_PREFIX "forum WHERE forumid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$title urlize($f['title']);
        
$fid $f['forumid'];

        
$output str_replace("<a href=\"forumdisplay.php?f=$fid\"""<a href=\"f-$title-$fid.html\""$output);
    }


}

#------------------------------
# Replace User
#------------------------------
$found preg_match_all('#<a href="member\.php\?u=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid IN($ids)");

    while(
$u $vbulletin->db->fetch_array($res))
    {
        
$username urlize($u['username']);
        
$uid $u['userid'];

        
$output str_replace("<a href=\"member.php?u=$uid\"""<a href=\"u-$username-$uid.html\""$output);
    }


}

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

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, title, forumid FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$n $vbulletin->db->fetch_array($res))
    {
        
$title urlize($n['title']);
        
$tid $n['threadid'];
        
$fid $n['forumid'];


        
$output str_replace("<a href=\"showthread.php?goto=newpost&amp;t=$tid\"""<a href=\"$title-$tid-newpost.html\""$output);
    }


}

#------------------------------
# Replace Last Post User (Forum)
#------------------------------
$found preg_match_all('#<a href="member\.php\?find=lastposter&amp;f=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT lastposter, forumid FROM " TABLE_PREFIX "forum WHERE forumid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$lp $f['lastposter'];

        
$lpidinfo $vbulletin->db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE username='$lp'");
        
$lp urlize($lpidinfo['username']);
        
$lpid $lpidinfo['userid'];
        
$fid $f['forumid'];

        

        
$output str_replace("<a href=\"member.php?find=lastposter&amp;f=$fid\"""<a href=\"u-$lp-$lpid.html\""$output);
    }


}

#------------------------------
# Replace Last Post User (Thread)
#------------------------------
$found preg_match_all('#<a href="member\.php\?find=lastposter&amp;t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT lastposter, threadid FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$lp $f['lastposter'];

        
$lpidinfo $vbulletin->db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE username='$lp'");
        
$lp urlize($lpidinfo['username']);
        
$lpid $lpidinfo['userid'];
        
$tid $f['threadid'];

        

        
$output str_replace("<a href=\"member.php?find=lastposter&amp;t=$tid\"""<a href=\"u-$lp-$lpid.html\""$output);
    }


}
#-----------------------------------
# DO NOT REMOVE OTHERWISE YOU 
# WILL BE SENT A DMCA FOR COPYRIGHT 
# INFRINGEMENT YOU MAY NOT USE THIS 
# PLUGIN WITHOUT THIS LINE OF CODE
# IF YOU WISE TO REMOVE THIS AND
# ADD IT TO YOUR STYLE, FEEL FREE
# AS LONG AS THE COPYRIGHT REMAINS
#-----------------------------------

$output .= '<div align="center" class="smallfont">SEOed URLs completed by <a href="http://www.techhelpforum.com">Tech Help Forum</a>.</div>';

#------------------------------
# SHOWTHREAD
#------------------------------
$found preg_match_all('#<a href="showthread\.php\?t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];
        
$fid $t['forumid'];
        
$foruminfo $vbulletin->db->query_first("SELECT title FROM " TABLE_PREFIX "forum WHERE forumid='$fid'");
        
$fname urlize($foruminfo['title']);

        
$output str_replace("<a href=\"showthread.php?t=$tid\"""<a href=\"$fname/t-$title-$tid.html\""$output);
    }


}

#------------------------------
# SHOWTHREAD and page
#------------------------------
$found preg_match_all('#<a href="showthread\.php\?t=([0-9]+)&amp;page=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

    
// Keep track of page nums that go with tid's
    
$temp = array();

    for(
$i 0$i $found$i++)
    {
        
// $temp[<threadid>] = <page>
        
$temp$matches[1][$i] ] = $matches[2][$i];

        if(
is_numeric($matches[1][$i]))
            
$ids[] = $matches[1][$i];
    }
    
$ids implode(','$ids);

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];
        
$fid $t['forumid'];
        
$foruminfo $vbulletin->db->query_first("SELECT title FROM " TABLE_PREFIX "forum WHERE forumid='$fid'");
        
$fname urlize($foruminfo['title']);
        
$page $temp[$tid];
        

        
$output str_replace("<a href=\"showthread.php?t=$tid&amp;page=$page\"""<a href=\"$fname/t-$title-$tid-page-$page.html\""$output);


    }


}

#------------------------------
# showpost
#------------------------------
$found preg_match_all('#<a href="showpost\.php\?p=([0-9]+)&amp;postcount=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

    for(
$i 0$i $found$i++)
    {
        
$temp$matches[1][$i] ] = $matches[2][$i];
        if(
is_numeric($matches[1][$i]))
            
$ids[] = $matches[1][$i];
    }
    
$ids implode(','$ids);


    
// Go through each
    
$res $vbulletin->db->query_read("SELECT postid, title FROM " TABLE_PREFIX "post WHERE postid IN($ids)");

    while(
$p $vbulletin->db->fetch_array($res))
    {
        
$pid $p['postid'];
        
$postcount $temp[$pid];
        
$output str_replace("<a href=\"showpost.php?p=$pid&amp;postcount=$postcount\"""<a href=\"p-$pid.html\""$output);    }


}
#------------------------------
# Print SHOWTHREAD
#------------------------------
$found preg_match_all('#<a href="printthread\.php\?t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];

        
$output str_replace("<a href=\"printthread.php?t=$tid\"""<a href=\"print-$title-$tid.html\""$output);
    }


}

#------------------------------
# Email SHOWTHREAD
#------------------------------
$found preg_match_all('#<a href="sendmessage\.php\?do=sendtofriend&amp;t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];

        
$output str_replace("<a href=\"sendmessage.php?do=sendtofriend&amp;t=$tid\"""<a href=\"sendtofriend-$title-$tid.html\""$output);
    }


}

#------------------------------
# New Thread
#------------------------------
$found preg_match_all('#<a href="newthread\.php\?do=newthread&amp;f=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT forumid, title FROM " TABLE_PREFIX "forum WHERE forumid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$title urlize($f['title']);
        
$fid $f['forumid'];

        
$output str_replace("<a href=\"newthread.php?do=newthread&amp;f=$fid\"""<a href=\"$title-$fid/newthread.php\""$output);
    }


}

#------------------------------
# New Post
#------------------------------
$found preg_match_all('#<a href="newreply\.php\?do=newreply&amp;noquote=1&amp;p=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, postid FROM " TABLE_PREFIX "post WHERE postid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$tid $t['threadid'];
        
$pid $t['postid'];
        
$threadinfo $vbulletin->db->query_first("SELECT title, forumid FROM " TABLE_PREFIX "thread WHERE threadid='$tid'");
        
$title urlize($threadinfo['title']);
        
$fid $threadinfo['forumid'];
        
$f fetch_foruminfo($fid); 
        
$fname urlize($f['title']);



        
$output str_replace("<a href=\"newreply.php?do=newreply&amp;noquote=1&amp;p=$pid\"""<a href=\"$fname/newpostnoquote-$pid.php\""$output);
    }


}

#------------------------------
# New Post
#------------------------------
$found preg_match_all('#<a href="newreply\.php\?do=newreply&amp;p=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, postid FROM " TABLE_PREFIX "post WHERE postid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$tid $t['threadid'];
        
$pid $t['postid'];
        
$threadinfo $vbulletin->db->query_first("SELECT title, forumid FROM " TABLE_PREFIX "thread WHERE threadid='$tid'");
        
$title urlize($threadinfo['title']);
        
$fid $threadinfo['forumid'];
        
$f fetch_foruminfo($fid); 
        
$fname urlize($f['title']);



        
$output str_replace("<a href=\"newreply.php?do=newreply&amp;p=$pid\"""<a href=\"$fname/newpost-$pid.php\""$output);
    }


}

#------------------------------
# Search
#------------------------------
$found preg_match_all('#<a href="search\.php\?searchid=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT userid, searchid FROM " TABLE_PREFIX "search WHERE searchid IN($ids)");

    while(
$s $vbulletin->db->fetch_array($res))
    {
        
$userid $s['userid'];
        
$searchid $s['searchid'];
        

        
$output str_replace("search.php?searchid=$searchid""search-$userid-$searchid.html"$output);
    }


}


#------------------------------
# misc pages
#------------------------------
$output str_replace("search.php?do=getnew","search-getnew.html",$output);
$output str_replace("search.php?do=getdaily","search-getdaily.html",$output);
$output str_replace("forumdisplay.php?do=markread","markread.html",$output);
}

/**
 * Turn a string into a URL friendly string
 *
 * @param string $txt The string to work on
 * @return string The new string
 */
function urlize($txt)
{
    
$txt unaccent($txt);
    
$txt html_entity_decode($txt);
    
$txt str_replace(' ''-'$txt);
    
$txt preg_replace('#[^a-zA-Z0-9_\-]+#'''$txt);
    
$txt preg_replace('#[\-]+#''-'$txt);

    return 
strtolower($txt);
}

/**
 * Turn accented characters into normal characters
 *
 * @param string $txt The string to remove the accents from
 * @return string Your new clean string
 */
function unaccent($txt)
{
    
$trans get_html_translation_table(HTML_ENTITIES);
    
    foreach(
$trans as $literal => $entity)
    {
        if(
ord($literal) >= 192)
        {
            
$search[]   = $literal;
            
$replace[]  = substr($entity11);
        }
    }

    return 
str_replace($search$replace$txt);


Bug: Avaters aren't displaying properly. For Avatars, it's giving me URL's like: http://forum.excommunity.com/general...ine=1133479736

Oops. Forgot to do the <base href> thing. Sorry.

GamerJunk.net 01-06-2006 02:02 AM

After I install it and upload everything...I get this error

Database error in vBulletin 3.5.2:

Invalid SQL:
SELECT userid, username FROMvb3_user WHERE username='Mike';

MySQL Error : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE username='Mike'' at line 1
Error Number : 1064
Date : Thursday, January 5th 2006 @ 11:01:01 PM
Script : http://www.gsnforce.com/forum/index.php
Referrer : http://www.gsnforce.com/forum/forumdisplay.php?f=5
IP Address : *******
Username : Mike
Classname : vb_database

eXaulz 01-06-2006 02:03 AM

Rasmasta:

https://vborg.vbsupport.ru/showpost....7&postcount=58

GamerJunk.net 01-06-2006 02:06 AM

Yea we posted right after another

but now I am getting this error...

Parse error: parse error, unexpected $ in /home/gsnforce/public_html/forum/includes/functions.php(4314) : eval()'d code on line 30 on the header of my forums...

and then also my showthraed is fudged...I get

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gsnforce/public_html/forum/showthread.php(1911) : eval()'d code on line 325

GamerJunk.net 01-06-2006 02:10 AM

Ok I Fixed the showthread problem....but what about that link at the top of my forums??

www.gsnforce.com/forum

LincolnForums 01-06-2006 02:10 AM

wondering if this will work with such hacks as the vB Goolge/Yahoo site map

Immortal 01-06-2006 02:11 AM

Thanks, eXaulz. That's weird - I figured that was the problem but my dev board has all the spaces. Let me re-export the product and reupload to see if that solves all the issues.

RasMasta - Let me see if the issue still exist after I reupload the ZIP. :)

Quote:

Originally Posted by LincolnForums
wondering if this will work with such hacks as the vB Goolge/Yahoo site map

It will work persay. But the URLs won't be rewritten unless the author of the hack has specifically fixed it. I'll try and release an addon for one of the generators that uses vRewrite - once it goes stable.

GamerJunk.net 01-06-2006 02:12 AM

Also it isn;t working on my forum....it's not rewriting the threads....do I need to run an update or something on thread titles?

eXaulz 01-06-2006 02:13 AM

Hmmm. Let me check the plugin code real quick, RasMasta.

Not sure if this will work, I just changed the syntax. Besides, I'm not getting those errors on here - so I'm just guessing.

Go to AdminCP -> Plugin System > Plugin Manager >> Click on the vRewrite plugin found under Hook Location : global_complete. Replace the PHP code (found in the big Text Area) with the following: (yes, it works fine)

PHP Code:

if($vbulletin->options['vRewrite_on'])
{
#------------------------------
# Replace Forums
#------------------------------
$found preg_match_all('#<a href="forumdisplay\.php\?f=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT forumid, title FROM " TABLE_PREFIX "forum WHERE forumid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$title urlize($f['title']);
        
$fid $f['forumid'];

        
$output str_replace("<a href=\"forumdisplay.php?f="$fid ."\"""<a href=\"f-"$title ."-"$fid .".html\""$output);
    }


}

#------------------------------
# Replace User
#------------------------------
$found preg_match_all('#<a href="member\.php\?u=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid IN($ids)");

    while(
$u $vbulletin->db->fetch_array($res))
    {
        
$username urlize($u['username']);
        
$uid $u['userid'];

        
$output str_replace("<a href=\"member.php?u=$uid\"""<a href=\"u-$username-$uid.html\""$output);
    }


}

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

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, title, forumid FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$n $vbulletin->db->fetch_array($res))
    {
        
$title urlize($n['title']);
        
$tid $n['threadid'];
        
$fid $n['forumid'];


        
$output str_replace("<a href=\"showthread.php?goto=newpost&amp;t=$tid\"""<a href=\"$title-$tid-newpost.html\""$output);
    }


}

#------------------------------
# Replace Last Post User (Forum)
#------------------------------
$found preg_match_all('#<a href="member\.php\?find=lastposter&amp;f=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT lastposter, forumid FROM " TABLE_PREFIX "forum WHERE forumid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$lp $f['lastposter'];

        
$lpidinfo $vbulletin->db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE username='$lp'");
        
$lp urlize($lpidinfo['username']);
        
$lpid $lpidinfo['userid'];
        
$fid $f['forumid'];

        

        
$output str_replace("<a href=\"member.php?find=lastposter&amp;f=$fid\"""<a href=\"u-$lp-$lpid.html\""$output);
    }


}

#------------------------------
# Replace Last Post User (Thread)
#------------------------------
$found preg_match_all('#<a href="member\.php\?find=lastposter&amp;t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT lastposter, threadid FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$lp $f['lastposter'];

        
$lpidinfo $vbulletin->db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE username='$lp'");
        
$lp urlize($lpidinfo['username']);
        
$lpid $lpidinfo['userid'];
        
$tid $f['threadid'];

        

        
$output str_replace("<a href=\"member.php?find=lastposter&amp;t=$tid\"""<a href=\"u-$lp-$lpid.html\""$output);
    }


}
#-----------------------------------
# DO NOT REMOVE OTHERWISE YOU 
# WILL BE SENT A DMCA FOR COPYRIGHT 
# INFRINGEMENT YOU MAY NOT USE THIS 
# PLUGIN WITHOUT THIS LINE OF CODE
# IF YOU WISE TO REMOVE THIS AND
# ADD IT TO YOUR STYLE, FEEL FREE
# AS LONG AS THE COPYRIGHT REMAINS
#-----------------------------------

$output .= '<div align="center" class="smallfont">SEOed URLs completed by <a href="http://www.techhelpforum.com">Tech Help Forum</a>.</div>';

#------------------------------
# SHOWTHREAD
#------------------------------
$found preg_match_all('#<a href="showthread\.php\?t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];
        
$fid $t['forumid'];
        
$foruminfo $vbulletin->db->query_first("SELECT title FROM " TABLE_PREFIX "forum WHERE forumid='$fid'");
        
$fname urlize($foruminfo['title']);

        
$output str_replace("<a href=\"showthread.php?t=$tid\"""<a href=\"$fname/t-$title-$tid.html\""$output);
    }


}

#------------------------------
# SHOWTHREAD and page
#------------------------------
$found preg_match_all('#<a href="showthread\.php\?t=([0-9]+)&amp;page=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

    
// Keep track of page nums that go with tid's
    
$temp = array();

    for(
$i 0$i $found$i++)
    {
        
// $temp[<threadid>] = <page>
        
$temp$matches[1][$i] ] = $matches[2][$i];

        if(
is_numeric($matches[1][$i]))
            
$ids[] = $matches[1][$i];
    }
    
$ids implode(','$ids);

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];
        
$fid $t['forumid'];
        
$foruminfo $vbulletin->db->query_first("SELECT title FROM " TABLE_PREFIX "forum WHERE forumid='$fid'");
        
$fname urlize($foruminfo['title']);
        
$page $temp[$tid];
        

        
$output str_replace("<a href=\"showthread.php?t=$tid&amp;page=$page\"""<a href=\"$fname/t-$title-$tid-page-$page.html\""$output);


    }


}

#------------------------------
# showpost
#------------------------------
$found preg_match_all('#<a href="showpost\.php\?p=([0-9]+)&amp;postcount=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

    for(
$i 0$i $found$i++)
    {
        
$temp$matches[1][$i] ] = $matches[2][$i];
        if(
is_numeric($matches[1][$i]))
            
$ids[] = $matches[1][$i];
    }
    
$ids implode(','$ids);


    
// Go through each
    
$res $vbulletin->db->query_read("SELECT postid, title FROM " TABLE_PREFIX "post WHERE postid IN($ids)");

    while(
$p $vbulletin->db->fetch_array($res))
    {
        
$pid $p['postid'];
        
$postcount $temp[$pid];
        
$output str_replace("<a href=\"showpost.php?p=$pid&amp;postcount=$postcount\"""<a href=\"p-$pid.html\""$output);    }


}
#------------------------------
# Print SHOWTHREAD
#------------------------------
$found preg_match_all('#<a href="printthread\.php\?t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];

        
$output str_replace("<a href=\"printthread.php?t="$tid ."\"""<a href=\"print-"$title ."-"$tid .".html\""$output);
    }


}

#------------------------------
# Email SHOWTHREAD
#------------------------------
$found preg_match_all('#<a href="sendmessage\.php\?do=sendtofriend&amp;t=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, title FROM " TABLE_PREFIX "thread WHERE threadid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$title urlize($t['title']);
        
$tid $t['threadid'];

        
$output str_replace("<a href=\"sendmessage.php?do=sendtofriend&amp;t=$tid\"""<a href=\"sendtofriend-$title-$tid.html\""$output);
    }


}

#------------------------------
# New Thread
#------------------------------
$found preg_match_all('#<a href="newthread\.php\?do=newthread&amp;f=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT forumid, title FROM " TABLE_PREFIX "forum WHERE forumid IN($ids)");

    while(
$f $vbulletin->db->fetch_array($res))
    {
        
$title urlize($f['title']);
        
$fid $f['forumid'];

        
$output str_replace("<a href=\"newthread.php?do=newthread&amp;f=$fid\"""<a href=\"$title-$fid/newthread.php\""$output);
    }


}

#------------------------------
# New Post
#------------------------------
$found preg_match_all('#<a href="newreply\.php\?do=newreply&amp;noquote=1&amp;p=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, postid FROM " TABLE_PREFIX "post WHERE postid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$tid $t['threadid'];
        
$pid $t['postid'];
        
$threadinfo $vbulletin->db->query_first("SELECT title, forumid FROM " TABLE_PREFIX "thread WHERE threadid='$tid'");
        
$title urlize($threadinfo['title']);
        
$fid $threadinfo['forumid'];
        
$f fetch_foruminfo($fid); 
        
$fname urlize($f['title']);



        
$output str_replace("<a href=\"newreply.php?do=newreply&amp;noquote=1&amp;p=$pid\"""<a href=\"$fname/newpostnoquote-$pid.php\""$output);
    }


}

#------------------------------
# New Post
#------------------------------
$found preg_match_all('#<a href="newreply\.php\?do=newreply&amp;p=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT threadid, postid FROM " TABLE_PREFIX "post WHERE postid IN($ids)");

    while(
$t $vbulletin->db->fetch_array($res))
    {
        
$tid $t['threadid'];
        
$pid $t['postid'];
        
$threadinfo $vbulletin->db->query_first("SELECT title, forumid FROM " TABLE_PREFIX "thread WHERE threadid='$tid'");
        
$title urlize($threadinfo['title']);
        
$fid $threadinfo['forumid'];
        
$f fetch_foruminfo($fid); 
        
$fname urlize($f['title']);



        
$output str_replace("<a href=\"newreply.php?do=newreply&amp;p=$pid\"""<a href=\"$fname/newpost-$pid.php\""$output);
    }


}

#------------------------------
# Search
#------------------------------
$found preg_match_all('#<a href="search\.php\?searchid=([0-9]+)"#i'$output$matches);

if(
$found)
{
    
// Build an array of ID's
    
$ids = array();

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

    
// Go through each
    
$res $vbulletin->db->query_read("SELECT userid, searchid FROM " TABLE_PREFIX "search WHERE searchid IN($ids)");

    while(
$s $vbulletin->db->fetch_array($res))
    {
        
$userid $s['userid'];
        
$searchid $s['searchid'];
        

        
$output str_replace("search.php?searchid=$searchid""search-$userid-$searchid.html"$output);
    }


}


#------------------------------
# misc pages
#------------------------------
$output str_replace("search.php?do=getnew","search-getnew.html",$output);
$output str_replace("search.php?do=getdaily","search-getdaily.html",$output);
$output str_replace("forumdisplay.php?do=markread","markread.html",$output);
}

/**
 * Turn a string into a URL friendly string
 *
 * @param string $txt The string to work on
 * @return string The new string
 */
function urlize($txt)
{
    
$txt unaccent($txt);
    
$txt html_entity_decode($txt);
    
$txt str_replace(' ''-'$txt);
    
$txt preg_replace('#[^a-zA-Z0-9_\-]+#'''$txt);
    
$txt preg_replace('#[\-]+#''-'$txt);

    return 
strtolower($txt);
}

/**
 * Turn accented characters into normal characters
 *
 * @param string $txt The string to remove the accents from
 * @return string Your new clean string
 */
function unaccent($txt)
{
    
$trans get_html_translation_table(HTML_ENTITIES);
    
    foreach(
$trans as $literal => $entity)
    {
        if(
ord($literal) >= 192)
        {
            
$search[]   = $literal;
            
$replace[]  = substr($entity11);
        }
    }

    return 
str_replace($search$replace$txt);



GamerJunk.net 01-06-2006 02:15 AM

Look at my forum if you can...I'll check and see what it is calling

GamerJunk.net 01-06-2006 02:16 AM

4311-4317

Code:

// parse PHP include ##################
        if (!is_demo_mode())
        {
                ($hook = vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false;
        }

        if ($vbulletin->options['gzipoutput'] AND !headers_sent())

What could be the cause?

eXaulz 01-06-2006 02:18 AM

It has nothing to do with that, RM. It has to do with the eval()'ed code, which is being done here:

PHP Code:

($hook vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false

(as you can see in the error msg). That's a cool thing about eval().

Also, did you apply my fix? It might fix your problem.

GamerJunk.net 01-06-2006 02:20 AM

With your new code I am getting taht error at the top on line 4314

GamerJunk.net 01-06-2006 02:21 AM

And none of my threads have been rewritten either

GamerJunk.net 01-06-2006 02:22 AM

Parse error: parse error, unexpected T_STRING in /home/gsnforce/public_html/forum/includes/functions.php(4314) : eval()'d code on line 543

eXaulz 01-06-2006 02:25 AM

Post 1 - Odd.
Post 2 - Did you upload .htaccess correctly? Re-upload it again.
Post 3 - Line 543 doesn't exist...

GamerJunk.net 01-06-2006 02:28 AM

Yea I did and I changed it to /forum

I'll reinstall the plug in maybe? And wtf? if Line 543 doesn't exist why is it spitting out that error?

eXaulz 01-06-2006 02:31 AM

Not sure. Soemtimes PHP get's confused, and does real bad line counting, so it might hav ebeen soemthing I put in the code. Downoad an dupload the new attached file in the first post (the vRewrite post by Immortal) and do everything again. Also, take off '/forum' from your .htaccess.

I'm off.

GamerJunk.net 01-06-2006 02:37 AM

Reinstalled and now the error is gone but no rewriting? Does this only apply to new threads or do I need to update thread titles?

GamerJunk.net 01-06-2006 02:39 AM

Nevermind it's working fine now....just when I click the thread and it takes me to the last post it doesn't have the name changed

GamerJunk.net 01-06-2006 02:39 AM

Thanks for all your help!

Immortal 01-06-2006 02:52 AM

Quote:

Originally Posted by RasMasta
Nevermind it's working fine now....just when I click the thread and it takes me to the last post it doesn't have the name changed

Yah that's the bug :( since it's a redirect. I really hope someone can enlight me on how to fix it, as I have no idea. I've tried almost everything :speechless:

GamerJunk.net 01-06-2006 02:55 AM

Ok is anyone else getting this problem....when they create a thread and then click the link to go back to the main forum....the thread isn't there? You have to refresh before it shows up?


All times are GMT. The time now is 04:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04418 seconds
  • Memory Usage 2,330KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete