Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Flashchat Integration for vB 3.6 Details »»
Flashchat Integration for vB 3.6
Version: 3.57, by Paul M Paul M is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.x Rating:
Released: 07-10-2006 Last Update: 05-05-2008 Installs: 1022
Uses Plugins Auto-Templates
Additional Files Translations  
No support by the author.

This modification is no longer available or supported.

Flashchat integration with vBulletin 3.6

Note:
Standard Flashchat includes a version of my vBulletin integration as part of the Tufat supplied files - including a working vBulletin 3.6 CMS file. However, the standard files do not include Direct Usergroup Integration or other extra's like the WOL Display & Flashchat on a vBulletin page. This Integration Mod adds those features


Standard vB 3.6 integration features

* Authorised members are automatically logged in.
* Automatic login works even if a member has not ticked "remember me".
* All non authorised members are locked out (this and the above are based on usergroup membership).
* If enabled, Flashchat updates the users session location (displayed in various vBulletin online location displays such as WOL).
* Real ip detection when a proxy server is used (only if the proxy server passes on the details).
* Permanant, Private Rooms are loaded by Admins and Moderators (allows for Staff Rooms).

Extra's added by this modification

* Direct login to a room.
* The WOL will correctly display Flashchat as the location (not 'Unknown Location')
* Flashchat can be displayed embedded inside a 'standard' vBulletin Page (i.e. not full screen).
* Direct Usergroup Integration - a section is added to each usergroup in the ACP Usergroup Manager to set the Flashchat permissions for that group.
* The plugin will try to automatically add a link to Flashchat in your Quick Links or Navbar - this feature can be disabled if you wish.
* The automatic link can have a prefix path defined - useful if you use something like CMPS.


More notes:

* This integration is for Flashchat versions 4.7.x and above.
* The automatic link feature may fail if you have customised templates.
* For Flashchat inside a vBulletin page you need to link to .../misc.php?do=flashchat
* This modification does not add any links to Flashchat Administration in the ACP.
* You can set all members to login direct to particular room via the ACP.
* You can also add a room parameter to the url - i.e. .../misc.php?do=flashchat&room=3
* 3.56 onwards has extra code to cope with VBs CSRF protection, which interferes with profile linking (vb 3.6.10+).

The CMS file assumes that you are installing Flashchat in your forum root folder - this is the same folder as your usercp.php file and includes folder. Installation will fail if you do not do this.

Support: Please check the instructions, and make sure you have uploaded any files to the correct location - the vast majority of problems reported are due to an error made in editing or uploading files. If you are still stuck and want me to take a look then feel free to PM me your site address, an admin user, and ftp access details, without these I cannot help you. I will look when I have time.

Finally, I am not Tufat.com or Flashchat Support - if you have questions about Flashchat, their forums are here.


To use the this upgraded integration simply download and unzip the file, then follow the instructions in the text file. Once installed, the Flashchat userlevel options for each usergroup will appear in the ACP usergroup edit screens - editing of the CMS file will no longer be required.



History:

v3.01 : First version for vb 3.6 (not released).
v3.02 : Various code changes, first public release.
v3.02A : Minor bug fixes to WOL Display.
v3.02B : Dependancies updated for 3.6.0 Gold.
v3.03 : Minor fix to Get User for membergroupids, some SQL changes.
v3.03A : Updated for Version Checking.
v3.04 : Security (anti-hacking) code added (as supplied by Darren).
v3.05 : Usergroup settings moved to top of CMS file.
v3.06 : Fixed error message when accessing chat admin area.
v3.07 : Default role changed.
v3.08 : Minor bug fix to Avatar detection, login code changes, tidy up.

v3.50 : Beta release with direct usergroup integration.
v3.51 : First full release with direct usergroup integration.
v3.52 : No Access and Banned split into separate permissions.
v3.53 : Minor changes - includes disabling the utf8 functions if the F/C config option is false.
v3.53A : Internal updates, not released.
v3.53B : Internal updates, not released.
v3.53C : Add ability for member to do direct to a room (other than the Flashchat default).
v3.53D : Defaults on first install updated.
v3.54 : Option for link path prefix added.
v3.55 : Minor changes to install code only.
v3.56 : Code added to allow profile views when CSRF protection is active.
v3.57 : CSRF Code changed.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #202  
Old 09-30-2006, 07:44 PM
Neal-UK's Avatar
Neal-UK Neal-UK is offline
 
Join Date: Feb 2004
Location: Lancashire, England
Posts: 604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some reason I don't get an e-mail when you update this hack. Only notice by chance.
Reply With Quote
  #203  
Old 10-01-2006, 04:26 AM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There was always an error message displaying at the top right corner of the private message windows, saying "Image load error" in red.

I guess i finally fixed it by commenting out these lines in vbulletin36CMS.php:
PHP Code:
//$this->getAvatar = new Statement("SELECT * FROM {$prefix}customavatar WHERE userid = ? AND visible = 1");
        //$this->getPicture = new Statement("SELECT * FROM {$prefix}customprofilepic WHERE userid = ? AND visible = 1"); 
PHP Code:
// Get current profile picture or avatar
    // This function is only supported if you use the database storage method in vbulletin
//    function getPhoto($userid)
    //{
        //if($_SESSION['fc_users_cache'][$userid]['pid'] == $userid)
        //{
            //return $_SESSION['fc_users_cache'][$userid]['fpath'];
        //}
        //if($GLOBALS['vbulletin']['useavatar'])
        //{
        //    $rs = $this->getAvatar->process($userid);
        //}
        //else
        //{
        //    $rs = $this->getPicture->process($userid);
        //}
        //if(($rec = $rs->next()) == null) return '';
        //$fparts = explode('.', $rec['filename']);
        //$fname  = strtolower('$'.substr('000000'.$userid,-6).'$'.$rec['dateline'].'.'.$fparts[count($fparts)-1]);
        //$fpath  = './images/cust_img/'.$fname;
        //if(!file_exists($fpath))
        //{
        //    $fp = fopen($fpath, 'wb');
        //    fwrite($fp, $rec['filedata']);
        //    fflush($fp);
        //    fclose($fp);
        //}
        //$_SESSION['fc_users_cache'][$userid]['pid'] = $userid;
        //$_SESSION['fc_users_cache'][$userid]['fpath'] = $fpath;
        //return $fpath;
    //} 
PHP Code:
//'useavatar' => true, // True = use custom avatar for flashchat photo feature, False = use custom profile picture. 
It says:
Quote:
This function is only supported if you use the database storage method in vbulletin
I use filesystem.

PHP Code:
'useavatar' => true// True = use custom avatar for flashchat photo feature, False = use custom profile picture. 
There must be an option to completely disable both avatars and profile pictures.

Another question...
I've seen this part in your integration mod:
PHP Code:
// Get male or female
    
function getGender($user)
    {
        return 
NULL;
    } 
I've gender customfields defined at my vb. How can i use it for the code above?

Thanks
Reply With Quote
  #204  
Old 10-01-2006, 04:38 AM
RedTurtle's Avatar
RedTurtle RedTurtle is offline
 
Join Date: May 2006
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Paul!

I've integrated FC with 3.6 and it works fine but the only problem I'm having is that it requires me as an admin to always have to login to the chat when i'm already logged into vB.

Here's my CMS file (which I double checked that I have uploaded to chat/inc/cmses )


PHP Code:
<?php

    
if ( !defined'INC_DIR' ) ) {
        die( 
'hacking attempt' );
    }

/*

Version 3.02
By Paul M - this CMS file is For vBulletin 3.6.x and Flashchat 4.5.x (or above).

Recent changes ;
3.01 - First Version, based on vb 3.5 CMS file (v2.60).
3.02 - Changes to User and Role Caching to fix minor irritations.

*/

class vBulletinCMS
{
    
// Initialise CMS
    
function vBulletinCMS()
    {
        
$this->loginStmt = new Statement("SELECT userid AS id, password, salt FROM {$GLOBALS['vbulletin']['prefix']}user WHERE username=?");
        
$this->getUserStmt = new Statement("SELECT userid AS id, username AS login, usergroupid, membergroupids FROM {$GLOBALS['vbulletin']['prefix']}user WHERE userid=?");
        
$this->getUsersStmt = new Statement("SELECT userid AS id, username AS login, usergroupid FROM {$GLOBALS['vbulletin']['prefix']}user");
        
$this->getUserForSession = new Statement("SELECT * FROM {$GLOBALS['vbulletin']['prefix']}session WHERE sessionhash=? ORDER BY lastactivity DESC");
        
$this->updateLastactivityForUser = new Statement("UPDATE {$GLOBALS['vbulletin']['prefix']}user SET lastactivity=? WHERE userid=?");
        
$this->updateSessionForUser = new Statement("UPDATE {$GLOBALS['vbulletin']['prefix']}session SET lastactivity=?, location='$_SERVER[REQUEST_URI]' WHERE userid=?");
        
$this->getAvatar = new Statement("SELECT * FROM {$GLOBALS['vbulletin']['prefix']}customavatar WHERE userid = ? AND visible = 1");
        
$this->getPicture = new Statement("SELECT * FROM {$GLOBALS['vbulletin']['prefix']}customprofilepic WHERE userid = ? AND visible = 1");

        
$this->session $_COOKIE[$GLOBALS['vbulletin']['cookie'] . 'sessionhash'];
        if(
$_SESSION['fc_users_cache']['sessionhashid'] != $this->session)
        {
            
$rs $this->getUserForSession->process($this->session);
            if(
$rec $rs->next())
            {
                
$this->userid intval($rec['userid']);
                
$_SESSION['fc_users_cache']['sessionuserid'] = $this->userid;
                
$_SESSION['fc_users_cache']['sessionhashid'] = $this->session;
            }
        }
        else
        {
            
$this->userid $_SESSION['fc_users_cache']['sessionuserid'];
        }

        if(
$_POST['t'] AND $GLOBALS['vbulletin']['spkupdate'] AND intval($this->userid) > 0)
        {
            
$ru $this->updateSessionForUser->process(time(),$this->userid);
            
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
        }
    }

    
// Auto Login
    
function isLoggedIn()
    {
        if(
$this->userid AND $GLOBALS['vbulletin']['logupdate'])
        {
            
$ru $this->updateSessionForUser->process(time(),$this->userid);
            
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
        }
        unset (
$_SESSION['fc_users_cache'][$this->userid]);
        unset (
$_SESSION['fc_roles_cache'][$this->userid]);
        return 
$this->userid;
    }

    
// Manual Login
    
function login($login$password)
    {
        
$rv NULL;
        if (
$login == '_int_') return $this->userid;
        
$login utf8_to_entities($login);
        
$rs $this->loginStmt->process(utf8_decode($login));
        
$rec $rs->next();
        if(
$rs)
        {
            
$password utf8_to_entities($password);
            if((
$rec['password'] == md5(md5(utf8_decode($password)) . $rec['salt']))) $rv $rec['id'];
        }
        if(
$rv AND $GLOBALS['vbulletin']['logupdate'])
        {
            
$ru $this->updateSessionForUser->process(time(),$rv);
            
$ru $this->updateLastactivityForUser->process(time(),$rv);
        }
        unset (
$_SESSION['fc_users_cache'][$this->userid]);
        unset (
$_SESSION['fc_roles_cache'][$this->userid]);
        return 
$rv;
    }

    
// Logout
    
function logout()
    {
        
$_SESSION['fc_users_cache']['sessionhashid'] = '#';
        if(
$this->userid AND $GLOBALS['vbulletin']['logupdate'])
        {
            
$ru $this->updateSessionForUser->process(time(),$this->userid);
            
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
        }
        return 
NULL;
    }

    
// Assign chat role
    
function getRoles($usergroupid)
    {
        
$groups explode(',',$usergroupid);
        
$userrole ROLE_NOBODY // Set default access
        
foreach ($GLOBALS['vbulletin']['users'] as $group) if (in_array($group,$groups)) $userrole ROLE_USER;
        if (
$GLOBALS['fc_config']['liveSupportMode'])
        {
            foreach (
$GLOBALS['vbulletin']['customer'] as $group) if (in_array($group,$groups)) $userrole ROLE_CUSTOMER;
        }
        foreach (
$GLOBALS['vbulletin']['mods'] as $group) if (in_array($group,$groups)) $userrole ROLE_MODERATOR;
        foreach (
$GLOBALS['vbulletin']['admin'] as $group) if (in_array($group,$groups)) $userrole ROLE_ADMIN;
        foreach (
$GLOBALS['vbulletin']['banned'] as $group) if (in_array($group,$groups)) $userrole ROLE_NOBODY;
        return 
$userrole;
    }

    
// Get user details
    
function getUser($userid)
    {
        if((
$rs $this->getUserStmt->process($userid)) && ($rec $rs->next()))
        {
            
$rec['usergroupid'] .= ",".$rec['membergroupids'] ;
            
$rec['roles'] = $this->getRoles($rec['usergroupid']);
            
$tagencoded entities_to_utf8($rec['login']);
            if(
strlen($rec['login']) > strlen($tagencoded)) $rec['login'] = $tagencoded;
            else 
$rec['login'] = utf8_encode($rec['login']);
            
$_SESSION['fc_users_cache'][$userid] = $rec;
            
$_SESSION['fc_roles_cache'][$userid] = $rec['roles'];
            return 
$rec;
        }
        return 
null;
    }

    
// Return all existing users
    
function getUsers()
    {
        return 
$this->getUsersStmt->process();
    }

    
// Returns URL of user profile page for such user id or null if user not found
    
function getUserProfile($userid)
    {
        return (
$this->userid == $userid) ? "../profile.php?do=editprofile" "../member.php?u=$userid";
    }

    
// Check if user is in a specific role
    
function userInRole($userid$role)
    {
        if(!
intval($userid))
        {
            return 
false;
        }
        
$user $this->getUser($userid) ;
        if(
$role == $user['roles']) return true;
        return 
false;
    }

    
// Get male or female
    
function getGender($user)
    {
        return 
NULL;
    }

    
// Get current profile picture or avatar
    // This function is only supported if you use the database storage method in vbulletin
    
function getPhoto($userid)
    {
        if(
$_SESSION['fc_users_cache'][$userid]['pid'] == $userid)
        {
            return 
$_SESSION['fc_users_cache'][$userid]['fpath'];
        }
        if(
$GLOBALS['vbulletin']['useavatar'])
        {
            
$rs $this->getAvatar->process($userid);
        }
        else
        {
            
$rs $this->getPicture->process($userid);
        }
        if((
$rec $rs->next()) == null) return '';
        
$fparts explode('.'$rec['filename']);
        
$fname  strtolower('$'.substr('000000'.$userid,-6).'$'.$rec['dateline'].'.'.$fparts[count($fparts)-1]);
        
$fpath  './images/cust_img/'.$fname;
        if(!
file_exists($fpath))
        {
            
$fp fopen($fpath'wb');
            
fwrite($fp$rec['filedata']);
            
fflush($fp);
            
fclose($fp);
        }
        
$_SESSION['fc_users_cache'][$userid]['pid'] = $userid;
        
$_SESSION['fc_users_cache'][$userid]['fpath'] = $fpath;
        return 
$fpath;
    }
}

// Get vb config.php
$vbpath realpath(dirname(__FILE__));
require_once 
$vbpath '/../../../includes/config.php';

// Clear moderator message
foreach($GLOBALS['fc_config']['languages'] as $k => $v)
{
    
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}

// Get settings from vbulletin config settings
$GLOBALS['fc_config']['db'] = array(
    
'base' => $config['Database']['dbname'],
    
'user' => $config['MasterServer']['username'],
    
'pass' => $config['MasterServer']['password'],
    
'pref' => $GLOBALS['fc_config']['db']['pref'],
    
'host' => $config['MasterServer']['servername'],
);

// Add tcp port if specified
if($config['MasterServer']['port'])
{
    
$GLOBALS['fc_config']['db']['host'] .= ':'.$config['MasterServer']['port'];
}

// vbulletin specific settings
$GLOBALS['vbulletin'] = array(
    
'cookie' => $config['Misc']['cookieprefix'],
    
'prefix' => $config['Database']['tableprefix'],

    
'spkupdate' => true// Update vBulletin when user speaks.
    
'logupdate' => true// Update vBulletin when user logs in/out.
    
'useavatar' => true// True = use custom avatar for flashchat photo feature, False = use custom profile picture.

    
'users' => array( ) , // Usergroups allowed standard access to chat.
    
'mods' => array( 5,) , // Usergroups allowed access as chat moderators.
    
'admin' => array( ) , // Usergroups allowed access as chat administrators.
    
'banned' => array( 1,3,) , // Usergroups banned from accessing the chat.
    
'customer' => array( ) , // Usergroups allowed access as customers (Live support mode only).
);

// Initiate class
$GLOBALS['fc_config']['cms'] = new vBulletinCMS();

?>
Reply With Quote
  #205  
Old 10-01-2006, 04:51 AM
NeitherSparky's Avatar
NeitherSparky NeitherSparky is offline
 
Join Date: Aug 2006
Location: Sacramento, CA
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR
There was always an error message displaying at the top right corner of the private message windows, saying "Image load error" in red.
NeutralizeR, I have also gotten that error and my users have gotten it too (though it's not every time). I do use the database system though. Is there something I should be altering in the CMS? I couldn't really follow what you were saying in your post, I don't understand php.

~Sparky
Reply With Quote
  #206  
Old 10-01-2006, 05:13 AM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RedTurtle
Hi Paul!

I've integrated FC with 3.6 and it works fine but the only problem I'm having is that it requires me as an admin to always have to login to the chat when i'm already logged into vB.

Here's my CMS file (which I double checked that I have uploaded to chat/inc/cmses )


PHP Code:
<?php

if ( !defined'INC_DIR' ) ) {
die( 
'hacking attempt' );
}

/*

Version 3.02
By Paul M - this CMS file is For vBulletin 3.6.x and Flashchat 4.5.x (or above).

Recent changes ;
3.01 - First Version, based on vb 3.5 CMS file (v2.60).
3.02 - Changes to User and Role Caching to fix minor irritations.

*/

class vBulletinCMS
{
// Initialise CMS
function vBulletinCMS()
{
$this->loginStmt = new Statement("SELECT userid AS id, password, salt FROM {$GLOBALS['vbulletin']['prefix']}user WHERE username=?");
$this->getUserStmt = new Statement("SELECT userid AS id, username AS login, usergroupid, membergroupids FROM {$GLOBALS['vbulletin']['prefix']}user WHERE userid=?");
$this->getUsersStmt = new Statement("SELECT userid AS id, username AS login, usergroupid FROM {$GLOBALS['vbulletin']['prefix']}user");
$this->getUserForSession = new Statement("SELECT * FROM {$GLOBALS['vbulletin']['prefix']}session WHERE sessionhash=? ORDER BY lastactivity DESC");
$this->updateLastactivityForUser = new Statement("UPDATE {$GLOBALS['vbulletin']['prefix']}user SET lastactivity=? WHERE userid=?");
$this->updateSessionForUser = new Statement("UPDATE {$GLOBALS['vbulletin']['prefix']}session SET lastactivity=?, location='$_SERVER[REQUEST_URI]' WHERE userid=?");
$this->getAvatar = new Statement("SELECT * FROM {$GLOBALS['vbulletin']['prefix']}customavatar WHERE userid = ? AND visible = 1");
$this->getPicture = new Statement("SELECT * FROM {$GLOBALS['vbulletin']['prefix']}customprofilepic WHERE userid = ? AND visible = 1");

$this->session $_COOKIE[$GLOBALS['vbulletin']['cookie'] . 'sessionhash'];
if(
$_SESSION['fc_users_cache']['sessionhashid'] != $this->session)
{
$rs $this->getUserForSession->process($this->session);
if(
$rec $rs->next())
{
$this->userid intval($rec['userid']);
$_SESSION['fc_users_cache']['sessionuserid'] = $this->userid;
$_SESSION['fc_users_cache']['sessionhashid'] = $this->session;
}
}
else
{
$this->userid $_SESSION['fc_users_cache']['sessionuserid'];
}

if(
$_POST['t'] AND $GLOBALS['vbulletin']['spkupdate'] AND intval($this->userid) > 0)
{
$ru $this->updateSessionForUser->process(time(),$this->userid);
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
}
}

// Auto Login
function isLoggedIn()
{
if(
$this->userid AND $GLOBALS['vbulletin']['logupdate'])
{
$ru $this->updateSessionForUser->process(time(),$this->userid);
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
}
unset (
$_SESSION['fc_users_cache'][$this->userid]);
unset (
$_SESSION['fc_roles_cache'][$this->userid]);
return 
$this->userid;
}

// Manual Login
function login($login$password)
{
$rv NULL;
if (
$login == '_int_') return $this->userid;
$login utf8_to_entities($login);
$rs $this->loginStmt->process(utf8_decode($login));
$rec $rs->next();
if(
$rs)
{
$password utf8_to_entities($password);
if((
$rec['password'] == md5(md5(utf8_decode($password)) . $rec['salt']))) $rv $rec['id'];
}
if(
$rv AND $GLOBALS['vbulletin']['logupdate'])
{
$ru $this->updateSessionForUser->process(time(),$rv);
$ru $this->updateLastactivityForUser->process(time(),$rv);
}
unset (
$_SESSION['fc_users_cache'][$this->userid]);
unset (
$_SESSION['fc_roles_cache'][$this->userid]);
return 
$rv;
}

// Logout
function logout()
{
$_SESSION['fc_users_cache']['sessionhashid'] = '#';
if(
$this->userid AND $GLOBALS['vbulletin']['logupdate'])
{
$ru $this->updateSessionForUser->process(time(),$this->userid);
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
}
return 
NULL;
}

// Assign chat role
function getRoles($usergroupid)
{
$groups explode(',',$usergroupid);
$userrole ROLE_NOBODY // Set default access
foreach ($GLOBALS['vbulletin']['users'] as $group) if (in_array($group,$groups)) $userrole ROLE_USER;
if (
$GLOBALS['fc_config']['liveSupportMode'])
{
foreach (
$GLOBALS['vbulletin']['customer'] as $group) if (in_array($group,$groups)) $userrole ROLE_CUSTOMER;
}
foreach (
$GLOBALS['vbulletin']['mods'] as $group) if (in_array($group,$groups)) $userrole ROLE_MODERATOR;
foreach (
$GLOBALS['vbulletin']['admin'] as $group) if (in_array($group,$groups)) $userrole ROLE_ADMIN;
foreach (
$GLOBALS['vbulletin']['banned'] as $group) if (in_array($group,$groups)) $userrole ROLE_NOBODY;
return 
$userrole;
}

// Get user details
function getUser($userid)
{
if((
$rs $this->getUserStmt->process($userid)) && ($rec $rs->next()))
{
$rec['usergroupid'] .= ",".$rec['membergroupids'] ;
$rec['roles'] = $this->getRoles($rec['usergroupid']);
$tagencoded entities_to_utf8($rec['login']);
if(
strlen($rec['login']) > strlen($tagencoded)) $rec['login'] = $tagencoded;
else 
$rec['login'] = utf8_encode($rec['login']);
$_SESSION['fc_users_cache'][$userid] = $rec;
$_SESSION['fc_roles_cache'][$userid] = $rec['roles'];
return 
$rec;
}
return 
null;
}

// Return all existing users
function getUsers()
{
return 
$this->getUsersStmt->process();
}

// Returns URL of user profile page for such user id or null if user not found
function getUserProfile($userid)
{
return (
$this->userid == $userid) ? "../profile.php?do=editprofile" "../member.php?u=$userid";
}

// Check if user is in a specific role
function userInRole($userid$role)
{
if(!
intval($userid))
{
return 
false;
}
$user $this->getUser($userid) ;
if(
$role == $user['roles']) return true;
return 
false;
}

// Get male or female
function getGender($user)
{
return 
NULL;
}

// Get current profile picture or avatar
// This function is only supported if you use the database storage method in vbulletin
function getPhoto($userid)
{
if(
$_SESSION['fc_users_cache'][$userid]['pid'] == $userid)
{
return 
$_SESSION['fc_users_cache'][$userid]['fpath'];
}
if(
$GLOBALS['vbulletin']['useavatar'])
{
$rs $this->getAvatar->process($userid);
}
else
{
$rs $this->getPicture->process($userid);
}
if((
$rec $rs->next()) == null) return '';
$fparts explode('.'$rec['filename']);
$fname strtolower('$'.substr('000000'.$userid,-6).'$'.$rec['dateline'].'.'.$fparts[count($fparts)-1]);
$fpath './images/cust_img/'.$fname;
if(!
file_exists($fpath))
{
$fp fopen($fpath'wb');
fwrite($fp$rec['filedata']);
fflush($fp);
fclose($fp);
}
$_SESSION['fc_users_cache'][$userid]['pid'] = $userid;
$_SESSION['fc_users_cache'][$userid]['fpath'] = $fpath;
return 
$fpath;
}
}

// Get vb config.php
$vbpath realpath(dirname(__FILE__));
require_once 
$vbpath '/../../../includes/config.php';

// Clear moderator message
foreach($GLOBALS['fc_config']['languages'] as $k => $v)
{
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}

// Get settings from vbulletin config settings
$GLOBALS['fc_config']['db'] = array(
'base' => $config['Database']['dbname'],
'user' => $config['MasterServer']['username'],
'pass' => $config['MasterServer']['password'],
'pref' => $GLOBALS['fc_config']['db']['pref'],
'host' => $config['MasterServer']['servername'],
);

// Add tcp port if specified
if($config['MasterServer']['port'])
{
$GLOBALS['fc_config']['db']['host'] .= ':'.$config['MasterServer']['port'];
}

// vbulletin specific settings
$GLOBALS['vbulletin'] = array(
'cookie' => $config['Misc']['cookieprefix'],
'prefix' => $config['Database']['tableprefix'],

'spkupdate' => true// Update vBulletin when user speaks.
'logupdate' => true// Update vBulletin when user logs in/out.
'useavatar' => true// True = use custom avatar for flashchat photo feature, False = use custom profile picture.

'users' => array( ) , // Usergroups allowed standard access to chat.
'mods' => array( 5,) , // Usergroups allowed access as chat moderators.
'admin' => array( ) , // Usergroups allowed access as chat administrators.
'banned' => array( 1,3,) , // Usergroups banned from accessing the chat.
'customer' => array( ) , // Usergroups allowed access as customers (Live support mode only).
);

// Initiate class
$GLOBALS['fc_config']['cms'] = new vBulletinCMS();

?>
Just upgrade to the latest version:
v3.06 - Fixed error message when accessing chat admin area.
v3.07 - Default role changed.



Quote:
Originally Posted by NeitherSparky
NeutralizeR, I have also gotten that error and my users have gotten it too (though it's not every time). I do use the database system though. Is there something I should be altering in the CMS? I couldn't really follow what you were saying in your post, I don't understand php.

~Sparky
Here is my CMS:
PHP Code:
<?php
/*
$Author: pem $
$Revision: 1.8 $  
$Date: 2006/09/27 09:30:01 $ 

Version 3.07
By Paul M - this CMS file is For vBulletin 3.6 and Flashchat 4.7.0 or above.

Recent changes ;
3.03 - Minor fix to Get User for membergroupids, some SQL changes.
3.04 - Security (anti-hacking) code added (as supplied by Darren).
3.05 - Multiple updates, user settings moved to top.
3.06 - Fixed bug in vbpath when in admin area.
3.07 - Default role changed.
*/

// Usergroup Definitions
$users '2,9' 
$moderators '5,7' ;
$administrators '6' ;
$banned '1,3,4,8' ;

// Live support mode only
$customers '0' 

// Path to vbulletin root folder - with trailing '/' 
$vbpath ''// Leave blank unless you wish to override the default.

class vBulletinCMS
{
    
// Initialise CMS
    
function vBulletinCMS()
    {
        
$prefix $GLOBALS['vbulletin']['prefix'];
        
$this->loginStmt = new Statement("SELECT *, userid AS id FROM {$prefix}user WHERE username=?");
        
$this->getUserStmt = new Statement("SELECT *, userid AS id, username AS login FROM {$prefix}user WHERE userid=?");
        
$this->getUsersStmt = new Statement("SELECT *, userid AS id, username AS login FROM {$prefix}user");
        
$this->getUserForSession = new Statement("SELECT * FROM {$prefix}session WHERE sessionhash=? ORDER BY lastactivity DESC");
        
$this->updateLastactivityForUser = new Statement("UPDATE {$prefix}user SET lastactivity=? WHERE userid=?");
        
$this->updateSessionForUser = new Statement("UPDATE {$prefix}session SET lastactivity=?, location='$_SERVER[REQUEST_URI]' WHERE userid=?");
        
//$this->getAvatar = new Statement("SELECT * FROM {$prefix}customavatar WHERE userid = ? AND visible = 1");
        //$this->getPicture = new Statement("SELECT * FROM {$prefix}customprofilepic WHERE userid = ? AND visible = 1");

        
$this->session $_COOKIE[$GLOBALS['vbulletin']['cookie'] . 'sessionhash'];
        if(
$_SESSION['fc_users_cache']['sessionhashid'] != $this->session)
        {
            
$rs $this->getUserForSession->process($this->session);
            if(
$rec $rs->next()) 
            {
                
$this->userid intval($rec['userid']);
                
$_SESSION['fc_users_cache']['sessionuserid'] = $this->userid;
                
$_SESSION['fc_users_cache']['sessionhashid'] = $this->session;
            }
        }
        else
        {
            
$this->userid $_SESSION['fc_users_cache']['sessionuserid'];
        }

        if(
$_POST['t'] AND $GLOBALS['vbulletin']['spkupdate'] AND intval($this->userid) > 0)
        {
            
$ru $this->updateSessionForUser->process(time(),$this->userid);
            
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
        }  
    }

    
// Auto Login
    
function isLoggedIn()
    {
        if(
$this->userid AND $GLOBALS['vbulletin']['logupdate'])
        {
            
$ru $this->updateSessionForUser->process(time(),$this->userid);
            
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
        }
        unset (
$_SESSION['fc_users_cache'][$this->userid]);
        unset (
$_SESSION['fc_roles_cache'][$this->userid]); 
        return 
$this->userid;
    }

    
// Manual Login
    
function login($login$password)
    {
        
$rv NULL;
        if (
$login == '_int_') return $this->userid;
        
$login utf8_to_entities($login);
        
$rs $this->loginStmt->process(utf8_decode($login));
        
$rec $rs->next();
        if(
$rs)
        {
            
$password utf8_to_entities($password);
            if((
$rec['password'] == md5(md5(utf8_decode($password)) . $rec['salt']))) $rv $rec['id'];
        }
        if(
$rv AND $GLOBALS['vbulletin']['logupdate'])
        {
            
$ru $this->updateSessionForUser->process(time(),$rv);
            
$ru $this->updateLastactivityForUser->process(time(),$rv);
        }
        unset (
$_SESSION['fc_users_cache'][$this->userid]);
        unset (
$_SESSION['fc_roles_cache'][$this->userid]); 
        return 
$rv;
    }

    
// Logout
    
function logout()
    {
        
$_SESSION['fc_users_cache']['sessionhashid'] = '#';
        if(
$this->userid AND $GLOBALS['vbulletin']['logupdate'])
        {
            
$ru $this->updateSessionForUser->process(time(),$this->userid);
            
$ru $this->updateLastactivityForUser->process(time(),$this->userid);
        }
        return 
NULL;
    }

    
// Assign chat role
    
function getRoles($usergroupid)
    {
        
$groups explode(',',$usergroupid);
        
$userrole ROLE_ANY // Default //
        
foreach ($GLOBALS['vbulletin']['users'] as $group) if (in_array($group,$groups)) $userrole ROLE_USER;
        if (
$GLOBALS['fc_config']['liveSupportMode']) 
        {
            foreach (
$GLOBALS['vbulletin']['customer'] as $group) if (in_array($group,$groups)) $userrole ROLE_CUSTOMER;
        }
        foreach (
$GLOBALS['vbulletin']['mods'] as $group) if (in_array($group,$groups)) $userrole ROLE_MODERATOR;
        foreach (
$GLOBALS['vbulletin']['admin'] as $group) if (in_array($group,$groups)) $userrole ROLE_ADMIN;
        foreach (
$GLOBALS['vbulletin']['banned'] as $group) if (in_array($group,$groups)) $userrole ROLE_NOBODY
        return 
$userrole;
    }

    
// Get user details
    
function getUser($userid)
    {
        if((
$rs $this->getUserStmt->process($userid)) && ($rec $rs->next()))
        {
            if(
intval($rec['membergroupids'])) $rec['usergroupid'] .= ",".$rec['membergroupids'] ;
            
$rec['roles'] = $this->getRoles($rec['usergroupid']);
            
$tagencoded entities_to_utf8($rec['login']);
            if(
strlen($rec['login']) > strlen($tagencoded)) $rec['login'] = $tagencoded;
            else 
$rec['login'] = utf8_encode($rec['login']);
            
$_SESSION['fc_users_cache'][$userid] = $rec;
            
$_SESSION['fc_roles_cache'][$userid] = $rec['roles'];
            return 
$rec;
        }
        return 
null;
    }

    
// Return all existing users
    
function getUsers()
    {
        return 
$this->getUsersStmt->process();
    }

    
// Returns URL of user profile page for such user id or null if user not found
    
function getUserProfile($userid)
    {
        return (
$this->userid == $userid) ? "../profile.php?do=editprofile" "../member.php?u=$userid";
    }

    
// Check if user is in a specific role
    
function userInRole($userid$role)
    {
        if(!
intval($userid))
        {
            return 
false;
        }
        
$user $this->getUser($userid) ;
        if(
$role == $user['roles']) return true;
        return 
false;
    }

    
// Get male or female
    
function getGender($user)
    {
        return 
NULL;
    }

    
// Get current profile picture or avatar
    // This function is only supported if you use the database storage method in vbulletin
//    function getPhoto($userid)
    //{
        //if($_SESSION['fc_users_cache'][$userid]['pid'] == $userid)
        //{
            //return $_SESSION['fc_users_cache'][$userid]['fpath'];
        //}
        //if($GLOBALS['vbulletin']['useavatar'])
        //{
        //    $rs = $this->getAvatar->process($userid);
        //}
        //else
        //{
        //    $rs = $this->getPicture->process($userid);
        //}
        //if(($rec = $rs->next()) == null) return '';
        //$fparts = explode('.', $rec['filename']);
        //$fname  = strtolower('$'.substr('000000'.$userid,-6).'$'.$rec['dateline'].'.'.$fparts[count($fparts)-1]);
        //$fpath  = './images/cust_img/'.$fname;
        //if(!file_exists($fpath))
        //{
        //    $fp = fopen($fpath, 'wb');
        //    fwrite($fp, $rec['filedata']);
        //    fflush($fp);
        //    fclose($fp);
        //}
        //$_SESSION['fc_users_cache'][$userid]['pid'] = $userid;
        //$_SESSION['fc_users_cache'][$userid]['fpath'] = $fpath;
        //return $fpath;
    //}
}

// Security check
if (!defined('INC_DIR')) 
{
    exit(
'Error 01 - Please consult you system administrator.');
}

// Find vbroot
$vbroot realpath(dirname(__FILE__)).'/../../../';
if (
$vbpath
{
    
$vbroot $vbpath;
}

// Get vb config
if (!include_once($vbroot.'includes/config.php')) 
{
    exit(
'Error 02 - vbulletin config file not loaded, check you have the correct path.');
}

// Clear moderator message 
foreach($GLOBALS['fc_config']['languages'] as $k => $v)
{
    
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}

// Get settings from vbulletin config settings
$GLOBALS['fc_config']['db'] = array(
    
'base' => $config['Database']['dbname'],
    
'user' => $config['MasterServer']['username'],
    
'pass' => $config['MasterServer']['password'],
    
'pref' => $GLOBALS['fc_config']['db']['pref'],
    
'host' => $config['MasterServer']['servername'],
);

// Add tcp port if specified
if($config['MasterServer']['port'])
{
    
$GLOBALS['fc_config']['db']['host'] .= ':'.$config['MasterServer']['port'];
}

// vbulletin specific settings
$GLOBALS['vbulletin'] = array(
    
'cookie' => $config['Misc']['cookieprefix'],
    
'prefix' => $config['Database']['tableprefix'],
    
'spkupdate' => true// Update vBulletin when user speaks.
    
'logupdate' => true// Update vBulletin when user logs in/out.
    //'useavatar' => true, // True = use custom avatar for flashchat photo feature, False = use custom profile picture.
    
'users' => explode(',',$users) , // Usergroups allowed standard access to chat.
    
'mods' => explode(',',$moderators) , // Usergroups allowed access as chat moderators.
    
'admin' => explode(',',$administrators) , // Usergroups allowed access as chat administrators.
    
'banned' => explode(',',$banned) , // Usergroups banned from accessing the chat.
    
'customer' => explode(',',$customers) , // Usergroups allowed access as customers.
);

// Initiate class
$GLOBALS['fc_config']['cms'] = new vBulletinCMS();

?>
Just set your Usergroup Definitions at the beginning.

I'm waiting Paul's answer like you.
Reply With Quote
  #207  
Old 10-01-2006, 09:37 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Neal-UK
For some reason I don't get an e-mail when you update this hack. Only notice by chance.
Update messages are not sent out unless it's a requirement (or desirable) to update, or new functionality is added - none of these is the case in any of the recent updates.
Reply With Quote
  #208  
Old 10-01-2006, 10:04 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR
There was always an error message displaying at the top right corner of the private message windows, saying "Image load error" in red.
You must have used the database in the past - basically it's finding avatars stored in the database and trying to use them. If you don't use the database for avatar storage then empty the customavatars table and the problem should go away.

Quote:
Originally Posted by NeutralizeR
I've seen this part in your integration mod:
PHP Code:
// Get male or female
    
function getGender($user)
    {
        return 
NULL;
    } 
I've gender customfields defined at my vb. How can i use it for the code above?
You can't unless you write some custom code to query the vb database for the relevant field and then convert the result into Male or Female.
Reply With Quote
  #209  
Old 10-01-2006, 11:59 AM
RedTurtle's Avatar
RedTurtle RedTurtle is offline
 
Join Date: May 2006
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Just upgrade to the latest version:
v3.06 - Fixed error message when accessing chat admin area.
v3.07 - Default role changed.
Hi, I just upgraded my CMS file to v3.07 but I'm still having the problem where the admin (me) and moderators are required to login to FlashChat when they're already logged into vB. I cleared my cache on my browser and still get the same problem.

One thing of interest is that a regular user does not have this problem on her computer however if I login to vB with her username and password and then go to the chatroom, it doesn't auto-log me in. It requires the user/pass.

Any ideas? I would really appreciate all your help. Thank you very much.
Reply With Quote
  #210  
Old 10-01-2006, 03:47 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
You must have used the database in the past - basically it's finding avatars stored in the database and trying to use them. If you don't use the database for avatar storage then empty the customavatars table and the problem should go away.
I've empied them as i don't want to edit CMS file each time i upgrade my flashchat vb integration. Any chance to get customavatars-customprofilepics working for filesystem?

Edit: Guess what? All customavatars & customprofilepics've been deleted.... cpanel daily backups are enabled, how can i restore them?
Quote:
Originally Posted by Paul M
You can't unless you write some custom code to query the vb database for the relevant field and then convert the result into Male or Female.
You'll never code it for me, will you :P

Thanks for the reply.
Reply With Quote
  #211  
Old 10-01-2006, 03:59 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR
Edit: Guess what? All customavatars & customprofilepics've been deleted....
Then despite what you said, you obviously weren't using the filesystem, you were using the database.

Quote:
Originally Posted by NeutralizeR
cpanel daily backups are enabled, how can i restore them?
You'll have to ask your host that, or start a thread asking, I don't use cpanel.
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 02:48 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07351 seconds
  • Memory Usage 2,698KB
  • Queries Executed 25 (?)
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
  • (9)bbcode_php
  • (12)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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