vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Integration with vBulletin - Flashchat Integration for vB 3.6 (https://vborg.vbsupport.ru/showthread.php?t=120926)

Neal-UK 09-30-2006 07:44 PM

For some reason I don't get an e-mail when you update this hack. Only notice by chance.

NeutralizeR 10-01-2006 04:26 AM

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

RedTurtle 10-01-2006 04:38 AM

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();

?>


NeitherSparky 10-01-2006 04:51 AM

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

NeutralizeR 10-01-2006 05:13 AM

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.

Paul M 10-01-2006 09:37 AM

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.

Paul M 10-01-2006 10:04 AM

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.

RedTurtle 10-01-2006 11:59 AM

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.

NeutralizeR 10-01-2006 03:47 PM

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.

Paul M 10-01-2006 03:59 PM

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.

NeutralizeR 10-01-2006 04:11 PM

Quote:

Originally Posted by Paul M
Then despite what you said, you obviously weren't using the filesystem, you were using the database.

You'll have to ask your host that, or start a thread asking, I don't use cpanel.

I'm using the filesystem but those tables should still have some data to attach them to user tables.
Quote:

Storage Type Attachments are currently being stored in the filesystem at /home/msxorg/public_html/forum/uploads
I can't restore a fullbackup of yesterday since i'll lose 300+ members and many threads & posts.

I just need to restore 2 tables. If you know how to do it (not via cpanel) i'll be appreciated.

Edit: Found this thread:
http://www.vbulletin.com/forum/showt...e+single+table

and submitted a ticket to my server management team...

Paul M 10-01-2006 04:38 PM

Quote:

Originally Posted by NeutralizeR
I'm using the filesystem but those tables should still have some data to attach them to user tables.

Nope, you are not using the filesystem for avatars and pictures, if you were then those tables can happily be emptied without any problem. You are using the database to store them.

Quote:

Attachments are currently being stored in the filesystem at /home/msxorg/public_html/forum/uploads
This refers to attachments only, not avatars or profile pictures - for those look in the ACP under Avatars > User Picture Storage Type.

NeutralizeR 10-01-2006 05:23 PM

Quote:

Originally Posted by Paul M
Nope, you are not using the filesystem for avatars and pictures, if you were then those tables can happily be emptied without any problem. You are using the database to store them.

This refers to attachments only, not avatars or profile pictures - for those look in the ACP under Avatars > User Picture Storage Type.

I've checked and it says:
Quote:

Avatars are currently being served from the filesystem at ./customavatars
Profile pictures are currently being served from the filesystem at ./customprofilepics
Signature pictures are currently being served from the filesystem at ./signaturepics

sam anders 10-01-2006 06:12 PM

any idea how i can admin this plugin?

installed but i dont want access to all my members when i access the admin on the chat software it say do it via the cms program but i seen no options in my vb admin

NeutralizeR 10-01-2006 06:35 PM

I've restored those tables and it's ok now...

PixelFx 10-01-2006 06:43 PM

I'm running php 5.1.6, and getting a blank page the first time I go to run the install.php for flash chat, I've checked all my links and settings so not sure what I'm missing.

Anything you can do to point me in the right direction would be great.

Paul M 10-01-2006 06:48 PM

Quote:

Originally Posted by NeutralizeR
I've checked and it says:

My apologies, you are absolutely right. I just spent a bit of time looking at this and it seems it still uses the tables to store certain information about the files, so clearing them was a bad idea. :dead: Glad you got them restored. :)

The CMS file sees those entries and assumes the database is in use - the check needs to be more exact.

teedizz 10-01-2006 08:55 PM

hey Paul, how can i make it to when someone clicks to go into chat, it opens up a new window instead of opening up in the current window?

Paul M 10-01-2006 08:59 PM

add target="_blank" to the link.

Paul M 10-01-2006 09:00 PM

Quote:

Originally Posted by PixelFx
I'm running php 5.1.6, and getting a blank page the first time I go to run the install.php for flash chat, I've checked all my links and settings so not sure what I'm missing.

Anything you can do to point me in the right direction would be great.

Is the chat in your forum root ?

teedizz 10-02-2006 04:19 AM

Quote:

Originally Posted by Paul M
add target="_blank" to the link.

im sorry paul..can you explain a little bit more please.

Paul M 10-02-2006 01:17 PM

In the code for your link you will have something like
Code:

<a href="some url">
you need to add a target to it, like this
Code:

<a href="some url" target="_blank">

RedTurtle 10-02-2006 05:45 PM

Quote:

Originally Posted by RedTurtle
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.

So I asked some more users and apparently everyone has to put in their login and password even though they are already logged into vB. Their vB login/pass works and they're allowed into the chat but I'm trying to get it so that if they're logged into vB it doesn't ask for them to re-authenticate.

What am I doing wrong? Your help would be greatly appreciated!

Paul M 10-02-2006 06:18 PM

Sounds like you haven't specified the vbulletin CMS file in Flashchats config.php file.

You should see a section like this ;

PHP Code:

//your CMS system
'CMSsystem' => 'vbulletin36CMS',// default - default CMS, blank - stateless CMS 

Make sure it specifies the correct system (as above)

RedTurtle 10-02-2006 06:20 PM

Yup, I have that set too. It really makes no sense to me. Can I PM you with my login details?

Paul M 10-02-2006 06:57 PM

Yes.

RedTurtle 10-02-2006 07:11 PM

PM sent. THANK YOU!

teedizz 10-02-2006 07:17 PM

Quote:

Originally Posted by Paul M
In the code for your link you will have something like
Code:

<a href="some url">
you need to add a target to it, like this
Code:

<a href="some url" target="_blank">


ohh I see, would that be in the config.php? but i do understand what your saying, just dont know what file to look under to add it.

sam anders 10-02-2006 08:10 PM

Quote:

Originally Posted by sam anders
any idea how i can admin this plugin?

installed but i dont want access to all my members when i access the admin on the chat software it say do it via the cms program but i seen no options in my vb admin

ok i have checked all the settings and can not find how to admin this mod, i have read up on flashchats site and still none the wiser maybe its me being thick but how can i admin this plugin?

every time i click on /chat/admin/index.php all the options do not work the following message is shown:

This option is not available when FlashChat is integrated with a custom CMS (content management system).
Please use the user administration tools which come with your system to add, edit, or remove users.


now i have checked my vb admin page and cant see any links to admin the flashchat can any one point me in the right direction please

smoknz28 10-02-2006 08:19 PM

Has anyone figured out how to fix the drop-down menus in the navbar to function correctly while using this mod?

When in the Flashchat....users cannot use the dropdown menus in the navbar. The Flashchat blocks out the dropdown menus from displaying.

vB 3.6.1

Thanks gang,
Mark

Paul M 10-02-2006 09:14 PM

Quote:

Originally Posted by teedizz
ohh I see, would that be in the config.php? but i do understand what your saying, just dont know what file to look under to add it.

Did you create a link yourself, or are you using the link it auto creates in Quick Links ?

Quote:

Originally Posted by sam anders
now i have checked my vb admin page and cant see any links to admin the flashchat can any one point me in the right direction please

What are you actually trying to do ?

Quote:

Originally Posted by smoknz28
Has anyone figured out how to fix the drop-down menus in the navbar to function correctly while using this mod?

Nope, no one has an answer for that yet.

smoknz28 10-02-2006 09:17 PM

Quote:

Originally Posted by Paul M
Nope, no one has an answer for that yet.

Thanks Paul....nice mod.... :D

I'll just sit back and check in from time to time and see if anyone comes up with a fix.

Thanks again,
Mark

teedizz 10-02-2006 09:21 PM

Quote:

Originally Posted by Paul M
Did you create a link yourself, or are you using the link it auto creates in Quick Links ?

Thanks paul...I figured it out bro ;) ...its appreciated

NeutralizeR 10-02-2006 10:02 PM

Quote:

Originally Posted by smoknz28
Thanks Paul....nice mod.... :D

I'll just sit back and check in from time to time and see if anyone comes up with a fix.

Thanks again,
Mark

Actually it's possible to show DHTML menus over flashchat but this time you can't send messages by pressing the enter button. Still testing alternative solutions...

sam anders 10-03-2006 06:54 AM

well i want to be able to change the room names and can i set up that only some members can go to some rooms? i.e a mod only chat room, and then a room just for members?

SCRIPT3R 10-03-2006 03:25 PM

Quote:

Originally Posted by sam anders
well i want to be able to change the room names and can i set up that only some members can go to some rooms? i.e a mod only chat room, and then a room just for members?

you could password protect those rooms and only give out the password to your staff.

Paul M 10-03-2006 03:32 PM

Staff rooms are already possible - in the flashchat rooms area you create a room that is Permanant and Private - that room is then visible only to moderators and administrators.

dieselpowered 10-07-2006 07:39 PM

Are there settings for this within the ADMINCP?

I see that you mention some functionality if enabled, however, not sure where you enable it??

For example you mentioned that it will display users in the chat if enabled...where do I enable that or do I have to install that hack?

Am I completely clueless?

Paul M 10-07-2006 08:04 PM

The only ACP setting this has is for the height of the frame - this is in general settings. The WOL display when a person is in Flashchat is automatic - don't confuse this with the seperate hack that displays who is in that chat on forumhome.

dieselpowered 10-07-2006 09:16 PM

Oh ok, ya I was confusing it...

So what about the setup of the permanent private rooms...is that done within flashchat?

Thanks Paul, always nice to install your hacks due to the fact that if there is any questions you always respond and assist. Thanks again!


All times are GMT. The time now is 09:15 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.02968 seconds
  • Memory Usage 2,292KB
  • 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_code_printable
  • (10)bbcode_php_printable
  • (31)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
  • (40)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