I should have mentioned that the class defined in external_auth is intended to be a base for a class you define--your class extends the external auth one. Then you make your own methods which retrn the appropriate data.
There are some filter hooks that you use to intercept the logon stuff.
zp_register_filter('authorization_cookie', 'MyBBcheck');
zp_register_filter('zp_logout', 'MyBB_auth::logout');
zp_register_filter('login_link', 'MyBB_auth::link');
zp_register_filter('alt_login_handler','MyBB_auth::alt_login_handler');
I guess I can share those methods from the proprietary implementation since they are pretty generic:
// Filter to provide an external login link
static function link() {
return '/'.trim(getOption('MyBB_auth_bb'),'/').'/member.php?action=login';
}
// filter to provide log out the user if he was authenticated by an external source
static function logout($location, $user) {
if(!is_bool($user->logout_link)) {
$location = '/'.trim(getOption('MyBB_auth_bb'),'/').'/member.php?action=logout&logoutkey='.$user->logout_link;
}
return $location;
}
/**
* Provides a link on the Zenphoto logon form for logging in via MyBB
* @param $handler_list
*/
static function alt_login_handler($handler_list) {
$handler_list[getOption('MyBB_auth_bb_name')] = array('script'=>'/'.trim(getOption('MyBB_auth_bb'),'/').'/member.php', 'params'=>array('action'=>'login'));
return $handler_list;
}
/**
* This is the cookie authorization filter function
* @param bit $authorization
*/
function MyBBcheck($authorization) {
$myBB = new MyBB_auth();
return $myBB->check($authorization);
}