Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #41  
Old 11-02-2005, 08:47 AM
exceem exceem is offline
 
Join Date: Sep 2005
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how much code did you have to change in the end?
Reply With Quote
  #42  
Old 11-02-2005, 11:53 AM
ndahiya ndahiya is offline
 
Join Date: Aug 2004
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi

This thread actually has 2 separate topics (the first few posts refer to other stuff)... Can we clean it up and move it to the vb 3.5 forum? should gather more interest ??

Btw, I went live with it as well. Works well, despite that error logging in for the first time....

Nd.
Reply With Quote
  #43  
Old 11-02-2005, 01:03 PM
weeno weeno is offline
 
Join Date: Jan 2002
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The integration alone is pretty much the code posted in the first page of this thread. I did some very minor changes, will post what I'm actually using when I get home later.

Other things you need to do is figure out how many of your users are affected by the illegal characters not allowed in MediaWiki. Mine turned out to be not that many in the grand schemes. I make these users change their username to be able to log in. I have to do this manually.

I now prohibit the use of these characters in new registrations on vbulletin. this is a simple an option in the vbulletin control panel. This is really the only change needed in vbulletin to get the user access integration working.

Unfortauntely the two accounts aren't linked once someone logs into the mediawiki. Password changes aren't carried over. logout/logins are cookied seperately too.

I am working on more integration with the forums itself which requires some vbulletin template mods.

arn
Reply With Quote
  #44  
Old 11-02-2005, 04:25 PM
GrendelKhan{TSU's Avatar
GrendelKhan{TSU GrendelKhan{TSU is offline
 
Join Date: Jun 2005
Location: Boston | Seoul, S. Korea
Posts: 1,311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

still sounds great so far!

can't wait for a public release and full integration

btw...is this phrased?
Reply With Quote
  #45  
Old 11-02-2005, 07:08 PM
pirotess pirotess is offline
 
Join Date: May 2002
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GrendelKhan{TSU
still sounds great so far!

can't wait for a public release and full integration

btw...is this phrased?
Very nice. I've been looking all over for a wiki package for vBulletin. This is closer than anything I have seen but I was hoping to find something as tightly integrated as say vb CMPS eventually. Hopefully this will evolve into that.
Reply With Quote
  #46  
Old 11-02-2005, 07:15 PM
exceem exceem is offline
 
Join Date: Sep 2005
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah i got the code working from that post just fine, i plan to change the email when a update to a pm via the forums, as well as adding whos online tracking, if i do figure it out ill post what i did, as well as integrating the profiles into one profile based on the forums one

weeno do you want to start a thread in the 3.5.x section, since you have probably done the most work towards this hack? it may well encourage other people to all help out?
Reply With Quote
  #47  
Old 11-03-2005, 05:21 AM
sammyman sammyman is offline
 
Join Date: Mar 2004
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When should we get an unofficial, or even better, official release? That code looks sweet!
Reply With Quote
  #48  
Old 11-03-2005, 09:56 PM
weeno weeno is offline
 
Join Date: Jan 2002
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, first read this post by Kai Backman who did most of the coding:

https://vborg.vbsupport.ru/showpost....1&postcount=10

Then, here's my modifications to the code, with my comments I just added now.

AuthPlugin_vBulletin.php file:

Code:
<?php

/**
 * Authentication plugin interface. Instantiate a subclass of AuthPlugin
 * and set $wgAuth to it to authenticate against some external tool.
 *
 * The default behavior is not to do anything, and use the local user
 * database for all authentication. A subclass can require that all
 * accounts authenticate externally, or use it only as a fallback; also
 * you can transparently create internal wiki accounts the first time
 * someone logs in who can be authenticated externally.
 *
 * This interface is new, and might change a bit before 1.4.0 final is
 * done...
 *
 * @package MediaWiki
 */
require_once("includes/AuthPlugin.php");

class AuthPlugin_vBulletin extends AuthPlugin {

  // Persistent DB connection
  var $vb_database;

  function AuthPlugin_vBulletin($host, $username, $password, $dbname)
  {
    $this->vb_database = mysql_pconnect($host, $username, $password);
    mysql_select_db($dbname, $this->vb_database);
  }  


  /**
   * Check whether there exists a user account with the given name.
   * The name will be normalized to MediaWiki's requirements, so
   * you might need to munge it (for instance, for lowercase initial
   * letters).
   *
   * @param string $username
   * @return bool
   * @access public
   */
  function userExists( $username ) {
    $username = addslashes($username);

    $vb_find_user_query = "SELECT membergroupids FROM user WHERE LOWER(username)=LOWER('" . $username . "')";
    $vb_find_result = mysql_query($vb_find_user_query, $this->vb_database);
    if(mysql_num_rows($vb_find_result) == 1) {
      $vb_user_info = mysql_fetch_array($vb_find_result);
      $membergroupids = $vb_user_info['membergroupids'];
      $membergrouparray = explode(",",$membergroupids);

/* weeno comment
 This version checks to see if a user is in a special secondary group.  In 
my case, this is group 17.  I only allow users who are promoted to this 
group (I call it Wiki Editor), to be authorized.  Mine has a post count of 20
 minimum */

/* weeno comment 
Below is some very ugly code to exclude illegal mediawiki chars.  These
 chars are simply denied.  People have to change their username by asking
 to log in.  Could be done in some sorta automatic way perhaps, but then
 you risk collisions.   Come to think of it, this will fail if the illegal char is
 the first and only character in the username. Can someone fix this? */

if ( !strpos($username,"#") and 
 !strpos($username,"+") and
 !strpos($username,"<") and
 !strpos($username,">") and
 !strpos($username,"[") and
 !strpos($username,"]") and
 !strpos($username,"|") and
 !strpos($username,"{") and
 !strpos($username,"}") )
{
    if(in_array("17",$membergrouparray))
        return true;
    else
      return false;
}

}

 return false;
  }
        
  /**
   * Check if a username+password pair is a valid login.
   * The name will be normalized to MediaWiki's requirements, so
   * you might need to munge it (for instance, for lowercase initial
   * letters).
   *
   * @param string $username
   * @param string $password
   * @return bool
   * @access public
   */
  function authenticate( $username, $password ) 
{
    $username = addslashes($username);
    $vb_find_user_query = "SELECT password, salt, membergroupids FROM user WHERE LOWER(username)=LOWER('" . 
$username . "')";
    $vb_find_result = mysql_query($vb_find_user_query, $this->vb_database);
    if(mysql_num_rows($vb_find_result) == 1) 
        {

              $vb_user_info = mysql_fetch_array($vb_find_result);
              $membergroupids = $vb_user_info['membergroupids'];
              $membergrouparray = explode(",",$membergroupids);

/* same check. A function would perhaps be cleaner */
        if ( !strpos($username,"#") and 
         !strpos($username,"+") and
         !strpos($username,"<") and
         !strpos($username,">") and
         !strpos($username,"[") and
         !strpos($username,"]") and
         !strpos($username,"|") and
         !strpos($username,"{") and
         !strpos($username,"}") )
                {
            if(in_array("17",$membergrouparray))
                if(md5(md5($password) .  $vb_user_info['salt']) == $vb_user_info['password'])
                  return true;
                }

        }
        return false;
  }
        
  /**
   * Return true if the wiki should create a new local account automatically
   * when asked to login a user who doesn't exist locally but does in the
   * external auth database.
   *
   * If you don't automatically create accounts, you must still create
   * accounts in some way. It's not possible to authenticate without
   * a local account.
   *
   * This is just a question, and shouldn't perform any actions.
   *
   * @return bool
   * @access public
   */
  function autoCreate() {
    return true;
  }
        
  /**
   * Return true to prevent logins that don't authenticate here from being
   * checked against the local database's password fields.
   *
   * This is just a question, and shouldn't perform any actions.
   *
   * @return bool
   * @access public
   */
  function strict() {
    return false;
  }
        
  /**
   * When creating a user account, optionally fill in preferences and such.
   * For instance, you might pull the email address or real name from the
   * external user database.
   *
   * The User object is passed by reference so it can be modified; don't
   * forget the & on your function declaration.
   *
   * @param User $user
   * @access public
   */
  function initUser( &$user ) { 
    $vb_find_user_query = "SELECT email FROM user WHERE LOWER(username)=LOWER('" . 
addslashes($user->mName) . "')";
    $vb_find_result = mysql_query($vb_find_user_query, $this->vb_database);
    if(mysql_num_rows($vb_find_result) == 1) {
      $vb_user_info = mysql_fetch_array($vb_find_result);

/* weeno comment 
the following two lines copy the email over and make it validated
 so it can be used in the wiki */

      $user->mEmail = $vb_user_info['email'];
      $user->mEmailAuthenticated = wfTimestampNow();
    }
    else {
      // ERROR?
    }
  }
}


?>
Other changes I had to make:

vBulletin AdminCP: exclude the characters from new registrations so it's not an ongoing issue.

I edited out some of the html in the MediaWiki code under SpecialPreferences.php to remove any options to change usernames and passwords, so people couldn't get their accounts out of sync.

any questions? It's still rather crude. but works. I'm working on more forum<->wiki interaction like listing recent articles and stuff. this stuff is still in progress.


arn
Reply With Quote
  #49  
Old 11-04-2005, 12:12 AM
sammyman sammyman is offline
 
Join Date: Mar 2004
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

AWESOME! Thanks arn. One last question for everyone. . . Does the wiki need to be in the same database? Or can it be in a seperate database? I currently have it installed in a seperate db.

Thanks everyone.
Reply With Quote
  #50  
Old 11-04-2005, 12:34 AM
weeno weeno is offline
 
Join Date: Jan 2002
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sammyman
AWESOME! Thanks arn. One last question for everyone. . . Does the wiki need to be in the same database? Or can it be in a seperate database? I currently have it installed in a seperate db.

Thanks everyone.
it can be separate.

arn
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:08 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.02640 seconds
  • Memory Usage 2,287KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete