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)
-   -   Google sitemap for the vB Archives. Redirect human and robots. (https://vborg.vbsupport.ru/showthread.php?t=93980)

falter 10-09-2005 05:09 PM

update: I went so far as moving the code out of "archive/global.php" into "includes/init.php", where $show['search_engine'] is defined.

I replaced:
PHP Code:

$show['search_engine'] = ($vbulletin->superglobal_size['_COOKIE'] == AND preg_match("#(google|msnbot|yahoo! slurp)#si"$_SERVER['HTTP_USER_AGENT'])); 

with
PHP Code:

 /**
    * Return true if visited by a robot.
    */
    
function is_robot_visit()
    {
        require_once(
DIR '/includes/class_xml.php');
        
$xmlobj = new XMLparser(falseDIR '/includes/xml/spiders_vbulletin.xml');
        
$spiderdata $xmlobj->parse();
    
        if (
is_array($spiderdata['spider']))
        {
            foreach (
$spiderdata['spider'] AS $spiderling)
            {
                if (isset(
$_SERVER['HTTP_USER_AGENT']) AND preg_match("#"preg_quote($spiderling['ident'], '#') . "#si"$_SERVER['HTTP_USER_AGENT'])) {
                    return 
true;
                }
            }
        }
        unset(
$spiderdata$xmlobj);
        return 
false;
    }

$show['search_engine'] = is_robot_visit(); 

Everything works great!

dutchbb 10-09-2005 05:59 PM

You guys have time for "the redirect to the actual thread for human visitors" instructions in step 3?

Or maybe you can just send the 2 files? The ones in the zip don't make any sence to me :(

falter 10-09-2005 06:22 PM

if lierduh could provide patchable diff's between the gold (3.5.0) and his modifications, that'd be awesome (I'd do it, but I've hacked up my files way too much, sorry).

lierduh, this page shows how: http://www2.linuxjournal.com/article/1237

it'll make modifying the vanilla files much easier.

xtreme-mobile 10-09-2005 07:06 PM

Quote:

Originally Posted by Triple_T
You guys have time for "the redirect to the actual thread for human visitors" instructions in step 3?

Or maybe you can just send the 2 files? The ones in the zip don't make any sence to me :(


same here i aint got a clue what to do :(

lierduh 10-09-2005 10:36 PM

Thanks falter. I will merge your code in my next release. With the Stadler's updated xml file. It will be better using the xml file than my string. I should be able to make that into plugins. So that no code needs to be changed regarding search engine crawler detection.

I also have an idea that I should make threads with new posts higher sitemap priority. So a new version is not far away.:)

It is good to see hackers work together creating better code. It makes it more interesting than explaining how to set permissions. :)

I have attached patch.diff for the two files.

Quote:

Originally Posted by falter
hey lierduh,

I've been playing around a bit with the robot detection. I snagged a bunch of code from "online.php", hacked it up a bit, and came up with this (as a drop-in replacement for the "is_robot_visit" function. This one uses the spiders_vbulletin.xml file, which I recommend people updating. The 3.5.0 gold version is fairly vanilla. I got an updated one from here: http://www.vbulletin.com/forum/showp...5&postcount=12

Anyway, here's the change to global.php (this is assuming that you have the very latest version of lierduh's code :) )

There's all sorts of extra markup in the xml for ip ranges and such, but I'm just goign to match against the user-agents, for now.


hotrod1 10-10-2005 12:28 AM

Great hack, thanks alot!

falter 10-10-2005 12:29 AM

lierduh, are you sure that you're diffing a modified 3.5.0 (gold) against the original 3.5.0 (gold) ? I'm having problems running the diffs as patches against the 3.5.0 gold versions of the files (pulled straight out of the tarball).

regardless, perhaps the diffs are the wrong route? Maybe it would do better service to the less technical users if you had some instructions for code modifications that were similar to many of the others hacks? (ex. find [this block of code] add [this chunk of code] right after it, bla bla bla).

Brandon Sheley 10-10-2005 12:32 AM

Quote:

Originally Posted by lierduh
I also have an idea that I should make threads with new posts higher sitemap priority. So a new version is not far away.:)

sounds great, keep up the good work ;)

Unreal Player 10-10-2005 12:50 AM

I do not get your two files at all.

Vtec44 10-10-2005 01:15 AM

Did you chmod 777 your home folder?


All times are GMT. The time now is 06: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.01218 seconds
  • Memory Usage 1,754KB
  • 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
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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