vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Integration with vBulletin - vbWiki Standard - vBulletin+MediaWiki integration (https://vborg.vbsupport.ru/showthread.php?t=136242)

Smitty 07-03-2008 08:05 PM

Has anyone done vB 3.7.2, Wediawiki 12, and the Pro version?

swisscotton 07-06-2008 09:30 PM

I am ready install wiki but just wanted to make sure that this has no chance of messing up your live forum?

Michael Morris 07-07-2008 04:42 AM

Ran across the session logout bug mentioned in this thread. This is how I killed it - I'm not familiar enough with mediaWiki yet to fully weigh the ramifications of this stunt. Use with caution.

In file vbWiki.php find this line of code
PHP Code:

require_once( LUX_VB_DIR "/vbWiki_Hooks.php" ); 

Insert after

PHP Code:

/** Patch - make sure $_SESSION is populated **/
if ((empty($_SESSION['wsUserID']) || empty($_SESSION['wsUserName']) || empty($_SESSION['wsToken'])) && !empty($_COOKIE['seebelow']))
{
    
$_SESSION array_merge$_SESSION$db->query_first("SELECT 
        user_id AS wsUserID,
        user_name AS wsUserName,
        user_token AS wsToken
        FROM mw__user
        WHERE user_name = '"
.addslashes($_COOKIE['seebelow'])."' LIMIT 1"));


To get the above to work you must also change $_COOKIE['seebelow'] following the instructions below. For my board it was

$_COOKIE['enprod_mw__UserName']

This appears to be databasename + underscore + mediawiki prefix + "UserName".

You can discover what the field actually is by calling print_r($_COOKIE); exit; where this code mod occurs to find out what part of the cookie you need to reference to find the username for the wiki.

It is during the code that precedes that vbWiki populates the cookie but for some reason the $_SESSION is left empty - this is why the user is logged out when they go to the wiki and has to log in. Keep in mind that vbulletin doesn't use $_SESSION at all.

The hack above populates $_SESSION with the values necessary to authenticate mediaWiki. It is called after the bridge has already tested the cookie using vbulletin core - so it should be safe.

With the fix above I now have this module running on vBulletin 3.7.2 and MediaWiki 1.12.0

Michael Morris 07-07-2008 12:36 PM

Ok, if they don't click 'remember me' the above fails. Hmm... I'm close....

iRO Wiki 07-08-2008 12:31 AM

Thanks for working to get this compatible. Once you do, is there any chance you can upload a complete working/compatible version of the basic files somewhere?

Michael Morris 07-08-2008 01:17 AM

Quote:

Originally Posted by iRO Wiki (Post 1569666)
Thanks for working to get this compatible. Once you do, is there any chance you can upload a complete working/compatible version of the basic files somewhere?

I will upload the instructions, but legally I can't do anything more since I don't own the rights to the hack.

HOWEVER... I *might* be able to use a plugin.xml to make the transition easier. We'll see. If I can get a plugin to fix the compat issues I can release that as a separate hack of a hack.

SuperGLS 07-08-2008 03:41 PM

Quote:

Originally Posted by iRO Wiki (Post 1569666)
Thanks for working to get this compatible. Once you do, is there any chance you can upload a complete working/compatible version of the basic files somewhere?

Quote:

Originally Posted by Michael Morris (Post 1569679)
I will upload the instructions, but legally I can't do anything more since I don't own the rights to the hack.

HOWEVER... I *might* be able to use a plugin.xml to make the transition easier. We'll see. If I can get a plugin to fix the compat issues I can release that as a separate hack of a hack.

I love to see a new write up with simple and clear instructions on compatibility with 3.7 and 1.12. A plug in to make the whole process easy would be wonderful. Thanks for your hard work on this.

Michael Morris 07-09-2008 04:53 AM

Ok, I've got this down to something reasonably easy to do, but it is still a hack as there seems to be bad code floating about :\

I have managed to narrow down the edits to one file - arcane_vbulletin_core.php

In that file find this code

PHP Code:

// Include vBulletin Engine
    
if ($g_vbWiki_StyleId_Override 0)
    {
        
define('VB_AREA''Forum');
        require_once(
'./includes/init.php');
        
$vbulletin->options['styleid'] = $g_vbWiki_StyleId_Override;
        
$vbulletin->options['allowchangestyles'] = false;                    // ignore user styles
        
$vbulletin->userinfo['styleid'] = 0;
    }
    
    require_once(
'./global.php');
    require_once(
'./includes/functions_login.php');
    require_once(
"./includes/functions.php");                // vbdate
    
require_once("./includes/functions_forumdisplay.php");
    require_once(
"./includes/functions_newpost.php");
    require_once(
"./includes/adminfunctions.php" ); 

A LOT of libraries are being included there, and I *think* most of them are only used by the pro-integration. I changed that whole block to the following.

PHP Code:

    require_once('./global.php');

    if ((empty(
$_SESSION['wsUserID']) || empty($_SESSION['wsUserName']) || empty($_SESSION['wsToken'])) 
        && !empty(
$_COOKIE[$wgDBname.'_'.$wgDBprefix.'UserName']))
    {
        
$_SESSION array_merge$_SESSION$db->query_first("SELECT 
            user_id AS wsUserID,
            user_name AS wsUserName,
            user_token AS wsToken
            FROM "
.$wgDBname.".".$wgDBprefix."user
            WHERE user_name = '"
.addslashes($_COOKIE[$wgDBname.'_'.$wgDBprefix.'UserName'])."' LIMIT 1"));
    } 

That should fix this plug in to work with mediaWiki 1.12 and vbulletin 3.7 HOWEVER I do not guarantee the pro version will work and I also suspect that users with cookies disabled or blocked will still experience log out troubles.

SuperGLS 07-09-2008 09:06 PM

So all we do is install MW 1.12, vBwiki Standard, and then make the changes in post 298 (the one above this one) and it should work? Sounds too easy! Thanks.

Michael Morris 07-10-2008 02:26 AM

Quote:

Originally Posted by SuperGLS (Post 1571396)
So all we do is install MW 1.12, vBwiki Standard, and then make the changes in post 298 (the one above this one) and it should work? Sounds too easy! Thanks.

Yes. If you run into problems I will try to help as I find the time.


All times are GMT. The time now is 03:13 AM.

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.01758 seconds
  • Memory Usage 1,774KB
  • 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
  • (4)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)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