Login / Status
developer.Resource
Home . Extensions . Repository
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

Extension Repository

The official extension repository only consists of freely available extensions. New documentation is rendered once a day.


vBulletin auth service


InfoRatingsFeedback


  • Icon
    vbulletin_auth
    Title
    vBulletin auth service
    Extension key
    ( vbulletin_auth )
    State
    alpha, Not reviewed!
    Author
    Valery Romanchev
    Category
    services
    Version
    0.0.1
    Manual
    Not available
    Downloads (total / this version)
    1056 / 1020
    Rating
    none
    Updated
    19.12.2004
    Upload comment
    Very initial alpha version. See ext code for configuration.
    Description
    Authenticate vBulletin users as FE-users
  • Dependencies
    • depends on typo3
    • depends on php
    • depends on cc_sv_auth
    Reverse dependencies

    The following extension versions depend on this extension:

    Version history
      Download extension

      Download compressed extension .T3X file

    • Filename Size View Date Download
      ext_icon.gif 646 View 03.12.2004 Download
      ext_localconf.php 565 View 03.12.2004 Download
      sv1/class.tx_vbulletinauth_sv1.php 6.3 K View 03.12.2004 Download
      doc/wizard_form.dat 708 03.12.2004 Download
      doc/wizard_form.html 9.5 K 03.12.2004 Download
      Preview for file vbulletin_auth-0.0.1-sv1__class__tx_vbulletinauth_sv1__php:
      
      <?php
      /***************************************************************
      *  Copyright notice
      *  
      *  (c) 2004 Valery Romanchev (it@webmed.ru)
      *  All rights reserved
      *
      *  This script is part of the TYPO3 project. The TYPO3 project is 
      *  free software; you can redistribute it and/or modify
      *  it under the terms of the GNU General Public License as published by
      *  the Free Software Foundation; either version 2 of the License, or
      *  (at your option) any later version.

      *  The GNU General Public License can be found at
      *  http://www.gnu.org/copyleft/gpl.html.

      *  This script is distributed in the hope that it will be useful,
      *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      *  GNU General Public License for more details.
      *
      *  This copyright notice MUST APPEAR in all copies of the script!
      ***************************************************************/
      /** 
       * Service 'vBulletin Authentification Service' for the 'vbulletin_auth' extension.
       *
       * @author    Valery Romanchev <it@webmed.ru>
       */

      // Prefix and names for the database tables
      define('VB_TABLE_PREFIX''vbb_'); 
      define('VB_USER_TABLE''user'); // The members table
      define('TYPO3_FEUSER_PID'3);

       
      require_once(
      PATH_t3lib.'class.t3lib_svbase.php');


      class 
      tx_vbulletinauth_sv1 extends tx_sv_authbase {
          var 
      $prefixId 'tx_vbulletinauth_sv1';        // Same as class name
          
      var $scriptRelPath 'sv1/class.tx_vbulletinauth_sv1.php';    // Path to this script relative to the extension dir.
          
      var $extKey 'vbulletin_auth';    // The extension key.

          
      function getUser()    {

      $vbgrops_to_typo3groups=array(
      // vBulletin usergroupid  => TYPO3 FE usergroup uid
      // Default vBulletin Usergroups  
      => ''// Unregistered / Not Logged In
      => '1'// Users Awaiting Email Confirmation
      => '1'// Registered Users
      => ''// (COPPA) Users Awaiting Moderation
      => '1,2'// Super Moderators
      => '1,2'// Administrators
      => '1,2'// Moderators
      // Custom vBulletin groups
      => 'banned'// Banned Users
      => '1,2'// Registered Power Users
      10 => '1,2' // Registered Users (test)
      );

              
              
      // only do this if there is no valid user session
              
      if(!$this->info['userSession']['uid']) {
                  
      $user false;
              if (
      $this->login['uident'] AND $this->login['uname'])    {

                      
      // Look up the new user by the username:
                  
      $dbres $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                  
      '*',
                                  
      VB_TABLE_PREFIX.VB_USER_TABLE,
                                      
      'username="'.$GLOBALS['TYPO3_DB']->quoteStr($this->login['uname'], VB_TABLE_PREFIX.VB_USER_TABLE).'"'
                          
      );

                  if (
      $dbres)    {
                      
      $vb_user $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres);
                      
      $GLOBALS['TYPO3_DB']->sql_free_result($dbres);
                  }

                  if(!
      is_array($vb_user)) {
                          
      // Failed login attempt (no username found)
                      
      if ($this->pObj->writeAttemptLog) {
                          
      $this->writelog(255,3,3,2,
                              
      "Login-attempt from %s (%s), username '%s' not found!!",
                              Array(
      $this->info['REMOTE_ADDR'], $this->info['REMOTE_HOST'], $this->login['uname']));    // Logout written to log
                      
      }
                  } else {
                      if (
      $this->writeDevLog)     t3lib_div::devLog('User found: '.$vb_user['userid'], 'vb_auth');
                      
      $groupsForTypo3='';
                      
      $vb_usergrops=array();
                      if (
      $vb_user['membergroupids'] !=''){
                          
      $vb_usergrops=explode(","$vb_user['membergroupids']);
                      }
                      
      $vb_usergrops[]=$vb_user['usergroupid'];
                      foreach (
      $vb_usergrops as $vbgroup_id) {
                          if (
      $vbgrops_to_typo3groups[$vbgroup_id]=='banned'){
                              
      $groupsForTypo3='';
                              break;
                          }
                          elseif (isset(
      $vbgrops_to_typo3groups[$vbgroup_id]) && $vbgrops_to_typo3groups[$vbgroup_id]!=''){
                              
      $groupsForTypo3.=$vbgrops_to_typo3groups[$vbgroup_id].',';
                          }
                      }
                      
      $groupsForTypo3arr=explode(","$groupsForTypo3);
                      
      $groupsForTypo3arr array_unique($groupsForTypo3arr);
                      
      $groupsForTypo3str=implode(',',$groupsForTypo3arr);
                      
      //find user  in TYPO3 fe_users
                      
      $dbres $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                      
      '*',
                                      
      $this->db_user['table'],
                                      
      $this->db_user['userid_column'].'='.$vb_user['userid']
                              );
          
                      if (
      $dbres)    {
                          
      $user $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres);
                          
      $GLOBALS['TYPO3_DB']->sql_free_result($dbres);
                      }

                      
      $Fields = array(
                          
      $this->db_user['username_column'] => $vb_user['username'],
                          
      //$this->db_user['userident_column'] => $vb_user['password'],
                          
      'pid' => TYPO3_FEUSER_PID,
                          
      'usergroup' => $groupsForTypo3str
                      
      );

                      if(!
      is_array($user)) {
                              
      // no fe_user, we must add it 
                          
      $Fields[$this->db_user['userid_column']] = $vb_user['userid'];
                          
      $GLOBALS['TYPO3_DB']->exec_INSERTquery($this->db_user['table'], $Fields);
                      } 
                      else{
                          
      $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
                              
      $this->db_user['table'],
                              
      $this->db_user['userid_column'].'='.$vb_user['userid'],
                              
      $Fields);
                      }
                      
      $user[$this->db_user['userid_column']]=$vb_user['userid'];
                      
      $user=array_merge($user,$vb_user);
          
                  }
              }
              
          }
          return 
      $user;
          }

          
      /**
           * Authenticate a user
           *
           * @param    array     Data of user.
           * @param    array     Information array. Holds submitted form data etc.
           * @param    string     subtype of the service which is used to call this service.
           * @return    int
           */    

           
      function authUser($user) {

               
               
      t3lib_div::devLog('user uid authuser!!! '.$user['uid'].' '.$user['username'].' '.$user['usergroupid'], 'authUser'1);

              
      $OK 100;

              if (
      $this->login['uident'] && $this->login['uname'])    {
                  
      $OK false;
                   
      t3lib_div::devLog('before sql'.$this->login['uident'].' '.$this->login['uname'], 'authUser');
                  if(
      is_array($user)){

                      if (
      $user['password'] == md5(md5($this->login['uident']).$user['salt'])) { 

                          
      $OK=200;
                      }
                  }                
                  if(
      $OK!=200)     {
                          
      // Failed login attempt (wrong password) - write that to the log!
                      
      if ($this->writeAttemptLog) {
                          
      $this->writelog(255,3,3,1,
                              
      "Login-attempt from %s (%s), username '%s', password not accepted!",
                              Array(
      $this->info['REMOTE_ADDR'], $this->info['REMOTE_HOST'], $this->login['uname']));
                      }
                      if (
      $this->writeDevLog)     t3lib_div::devLog('Password not accepted: '.$this->login['uident'], 'vb_auth'2);
                  }
              } 

               
      t3lib_div::devLog('after sql, OK= '.$OK.' ''authUser');
              return 
      $OK;
           
          }
          
          


      }
       

      if (
      defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/vbulletin_auth/sv1/class.tx_vbulletinauth_sv1.php"])    {
          include_once(
      $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/vbulletin_auth/sv1/class.tx_vbulletinauth_sv1.php"]);
      }

      ?>