TRY THIS SNIPPET AT YOUR OWN RISK - THE IPB SDK DEVELOPMENT SEEMS TO HAVE STOPPED ... THEREFORE NO SUPPORT IS OFFERED
What is the IPB KIT?
The IPB Kit (IBK) is a collection of snippets and chunks, to be used IN CONJUNCTION WITH the IPBSDK class, to integrate your Etomite pages with your Invision Power Board database.
Terms of Use:
Frankly, I don't mind at all how you use it, extend it, etc. In fact, I welcome people extending it. However, I do insist that it isn't used by Etomite forkers to include within their own versions. This condition is absolute.
This is very much a work in progress, and in actual fact, I'm posting it here now more as a gauage of interest than anything else. I'll have to keep it topic based I'm afraid as it's quite convoluted.
Part One: The IBK Driver Snippet
This snippet is the main interface to the IPBSDK. It is called only by other snippets to connect with the IPBSDK and retrieve its functions.
Snippet Name Ibk_Driver
Snippet Code
/*----------------------------------------------------------------
* SNIPPET_TITLE: Ipb_Kit_Driver
* DESCRIPTION: IPBSDK Integration Driver Snippet
*
* RETURN: bool 1 Logged In | 0 Not Logged In
*
* Author: Maz
*
* LICENSE: Free for use with non-forked versions of Etomite CMS
*--------------------------------------------------------------*/
//----------------------------------------------------
// Absolute path pointer to IPBSDK class file.
//----------------------------------------------------
$ibk_sdkpath = "/home/diectory/public_html/classes/class-ipbsdk.php";
//----------------------------------------------------
// IPB Group IDs to validate against.
//----------------------------------------------------
$ibk_authgroups = array(3,4);
if(!isset($GLOBALS['IPBLoggedIn']))
{
include_once $ibk_sdkpath;
$SDK =& new IPBSDK();
$GLOBALS['SDK'] = $SDK;
if ($GLOBALS['SDK']->is_loggedin())
{
if(!isset($GLOBALS['SDKMemberInfo']))
{
$GLOBALS['SDKMemberInfo'] = $GLOBALS['SDK']->get_info();
}
$group = $GLOBALS['SDKMemberInfo']['mgroup'];
//----------------------------------------------------
// Match IPBSDK group against authgroups array
//----------------------------------------------------
if(in_array($group, $ibk_authgroups))
{
$GLOBALS['IPBLoggedIn'] = 1;
return 1;
}
else
{
$GLOBALS['IPBLoggedIn'] = 0;
return 0;
}
}
else
{
$GLOBALS['IPBLoggedIn'] = 0;
return 0;
}
}
else
{
return $GLOBALS['IPBLoggedIn'];
}
Explantion: There are two user configurable settings here:
$ibk_sdkpath
Should be the absolute path to your IPBSDK file.
$ibk_authgroups = array(3,4);
An array of groups which are allowed to login. (Usually this might be just the "Member" and "Admin" group. However, you may have other groups, such as "Customers", etc.
Edited by Dean, 01 May 2007 - 08:22 AM.
added warning










