Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2001
Posts: 96
Power User
Power User
Joined: Apr 2001
Posts: 96

If anyone wants to try it, here's my ubb71CMS integration script for FlashChat 4.7. I can't attach the file apparently, so here it is -- rename it ubb71CMS.php and save it to \FLASHCHAT_DIR\inc\cmses

I have not tried this with a later version of UBB.t than 7.1. I will test with 7.3 once it's released...

PHP Code


<?php

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

/************************************************************************/
//!!! IMPORTANT NOTE
//!!! FlashChat 4.4.0 and higher support a new user role: ROLE_MODERATOR
//!!! Please edit the getUser and getRoles function if you need use of
//!!! the new moderator role. This change has not yet been applied.
/************************************************************************/

// integration class for UBB.Threads (www.ubbcentral.com/ubbthreads/)


$ubb_root_path = realpath(dirname(__FILE__) . '/../../../') . '/';

require_once(
$ubb_root_path . 'includes/config.inc.php');

class
UBBCMS {
var
$loginStmt;
var
$updateSessionStmt;
var
$getUserStmt;
var
$getUsersStmt;
var
$userid;
function
UBBCMS() {

$this->loginStmt = new Statement("SELECT USER_DISPLAY_NAME, USER_MEMBERSHIP_LEVEL, USER_PASSWORD,USER_IS_APPROVED,USER_IS_BANNED,USER_ID FROM {$GLOBALS['config']['TABLE_PREFIX']}USERS WHERE USER_DISPLAY_NAME = ? LIMIT 1");
//$this->updateSessionStmt = new Statement("UPDATE {$GLOBALS['config']['TABLE_PREFIX']}USERS SET U_Laston = ?, U_SessionId = ? WHERE USER_DISPLAY_NAME = ?");
$this->getUserStmt = new Statement("SELECT USER_DISPLAY_NAME as login, USER_MEMBERSHIP_LEVEL as status FROM {$GLOBALS['config']['TABLE_PREFIX']}USERS WHERE USER_ID = ? LIMIT 1");
$this->getUsersStmt = new Statement("SELECT USER_DISPLAY_NAME as login, USER_ID as id FROM {$GLOBALS['config']['TABLE_PREFIX']}USERS");

// $this->loginStmt = new Statement("SELECT USER_DISPLAY_NAME, USER_MEMBERSHIP_LEVEL, USER_PASSWORD,USER_IS_APPROVED,USER_IS_BANNED,USER_ID FROM {$GLOBALS['config']['TABLE_PREFIX']}USERS WHERE USER_LOGIN_NAME = ? LIMIT 1");
// $this->updateSessionStmt = new Statement("UPDATE {$GLOBALS['config']['TABLE_PREFIX']}users SET U_Laston = ?, U_SessionId = ? WHERE USER_DISPLAY_NAME = ?");
// $this->getUserStmt = new Statement("SELECT USER_LOGIN_NAME as login, USER_MEMBERSHIP_LEVEL as status FROM {$GLOBALS['config']['TABLE_PREFIX']}USERS WHERE USER_ID = ? LIMIT 1");
// $this->getUsersStmt = new Statement("SELECT USER_LOGIN_NAME as login, USER_ID as id FROM {$GLOBALS['config']['TABLE_PREFIX']}USERS");

$this->userid = isset($_COOKIE[$GLOBALS["config"]["COOKIE_PREFIX"] ."ubbt_myid"]) ? $_COOKIE[$GLOBALS["config"]["COOKIE_PREFIX"] ."ubbt_myid"] : NULL;
}

function
isLoggedIn() {
return
$this->userid;
}


// DOESN'T WORK:
//
// function getRoles($status) {
// $rv = NULL;
//
// if ($status == "Administrator")
// $rv = ROLE_ADMIN;
// elseif ($status == "Moderator")
// $rv = ROLE_MODERATOR;
// elseif ($status == "User")
// $rv = ROLE_USER;
// else
// $rv = ROLE_SPY;
//
// return $rv;
// }


// SO ADMINS AND MODS WILL GET ADMIN STATUS IN FLASHCHAT:


function getRoles($status) {
$rv = NULL;

if (
$status == "Administrator" || $status == "Moderator")
$rv = ROLE_ADMIN;
elseif (
$status == "User")
$rv = ROLE_USER;
else
$rv = ROLE_SPY;

return
$rv;
}

function
getUserProfile($userid) {
if (
$userid == SPY_USERID) $rv = NULL;

elseif (
$user = $this->getUser($userid))
{
//toLog("this",$this->isLoggedIn());
$id = $this->isLoggedIn();

if(
$id && ($id == $userid) )
{
toLog("true",true);
$rv = $GLOBALS["config"]["FULL_URL"] . "/ubbthreads.php?ubb=showprofile&User={$userid}";
}
else
{
toLog("false",false);
$rv = $GLOBALS["config"]["FULL_URL"] . "/ubbthreads.php?ubb=login";
}

}
toLog("rv_prof",$rv);
return
$rv;
}


function
getUser($userid) {

$rs = $this->getUserStmt->process($userid);
$rv = $rs->next();

if(
$rv) {
$rv["roles"] = $this->getRoles($rv["status"]);
}
return
$rv;
}

// taken from ubbt.inc.php



function login($login, $password) {

$goodPassword = false;

$rs = $this->loginStmt->process(addslashes($login));
$rec = $rs->next();

if (
$rec) {
// check if user is banned
if ($rec["USER_IS_BANNED"]) return NULL;

// allow login only with permanent password. Ignore the temporary password
if (md5($password) != $rec["USER_PASSWORD"]) return NULL;

// $this->ubbt_setcookie("{$GLOBALS['config']['cookieprefix']}w3t_myid",$rec['U_Number'],time()+$GLOBALS['config']['cookieexp']);

// $this->updateSessionStmt->process(time() + $GLOBALS["config"]["adjustime"] * 3600, md5(rand(0,32767)), addslashes($login));


return $rec['USER_ID'];

}

}

function
userInRole($userid, $role) {
if(
$user = $this->getUser($userid)) {
return (
$user['roles'] == $role);
}
return
false;
}

function
logout() {

}

function
getUsers() {
return
$this->getUsersStmt->process();
}

function
getGender($userid) {
// 'M' for Male, 'F' for Female, NULL for undefined
return NULL;
}
}

$GLOBALS['fc_config']['db'] = array(
'host' => $GLOBALS["config"]["DATABASE_SERVER"],
'user' => $GLOBALS["config"]["DATABASE_USER"],
'pass' => $GLOBALS["config"]["DATABASE_PASSWORD"],
'base' => $GLOBALS["config"]["DATABASE_NAME"],
'pref' => $GLOBALS["config"]["TABLE_PREFIX"] . 'fc_',
);

$GLOBALS['fc_config']['cms'] = new UBBCMS();


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

?>




GangsterBB.NET (Ver. 7.3)
2007 Content Rulez Contest - Honorable Mention
UBB.classic 6.7.2 - RIP
Browser: Firefox 2.0
Sponsored Links
Entire Thread
Subject Posted By Posted
FlashChat with UBB.Threads 7.0.2 greenfirefly 12/19/2006 1:00 AM
Re: FlashChat with UBB.Threads 7.0.2 AllenAyres 12/21/2006 10:20 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 12/22/2006 2:23 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/02/2007 3:59 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/03/2007 1:54 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/03/2007 3:03 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/03/2007 5:16 AM
Re: FlashChat with UBB.Threads 7.0.2 owen93 03/06/2007 3:52 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/06/2007 5:36 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/06/2007 5:44 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 7:46 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 7:47 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 8:09 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 8:40 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 9:28 PM
Re: FlashChat with UBB.Threads 7.0.2 owen93 03/06/2007 11:25 PM
Re: FlashChat with UBB.Threads 7.0.2 blaaskaak 03/07/2007 1:09 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/07/2007 1:33 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/07/2007 3:10 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/07/2007 3:45 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/07/2007 4:45 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/08/2007 4:33 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/08/2007 6:49 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/08/2007 9:12 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/08/2007 9:43 PM
Re: FlashChat with UBB.Threads 7.0.2 owen93 03/09/2007 1:07 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/09/2007 1:47 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/09/2007 4:44 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/18/2007 9:46 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/21/2007 7:29 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/22/2007 12:15 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/22/2007 1:01 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/22/2007 1:12 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/22/2007 1:15 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/22/2007 8:08 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/23/2007 12:33 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/23/2007 2:05 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/23/2007 5:45 AM
Re: FlashChat with UBB.Threads 7.0.2 Calpy 05/13/2007 4:28 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 05/13/2007 6:13 AM
Re: FlashChat w UBBT7.1 fixed login name issue Calpy 05/13/2007 10:33 AM
Re: FlashChat with UBB.Threads 7.0.2 Calpy 05/14/2007 11:41 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/12/2007 10:00 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/13/2007 9:48 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/13/2007 11:44 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 07/14/2007 1:34 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/14/2007 9:47 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 07/14/2007 10:29 AM
Re: FlashChat with UBB.Threads 7.0.2 sirdude 07/14/2007 10:37 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 07/14/2007 11:57 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/14/2007 8:21 PM
Re: FlashChat with UBB.Threads 7.1 jgeoff 02/20/2008 12:12 AM
Re: FlashChat with UBB.Threads 7.1 jgeoff 02/20/2008 1:14 AM
Re: FlashChat with UBB.Threads 7.1 curiousguy 02/22/2008 3:58 PM
Re: FlashChat with UBB.Threads 7.1 DarylCA 02/22/2008 4:16 PM
Chat integration will work with upgrades? curiousguy 02/22/2008 4:45 PM
Re: Chat integration will work with upgrades? jgeoff 02/22/2008 9:41 PM
Re: Chat integration will work with upgrades? Gizmo 02/23/2008 1:43 AM
Re: Chat integration will work with upgrades? Dslam 02/24/2008 2:56 AM
Re: Chat integration will work with upgrades? Dslam 02/24/2008 3:21 AM
Re: Chat integration will work with upgrades? jgeoff 05/12/2008 11:39 PM
Re: Chat integration will work with upgrades? SteveS 07/07/2008 5:37 PM
Re: Chat integration will work with upgrades? Gizmo 07/08/2008 7:30 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)