目录
本文档由caii于2007年7月18日翻译。
与phpBB集成
本文档描述如何使用dokuwiki集成phpBB的用户验证和组的设置集。
与此主题有关的信息,可在Authenticationbackend: MySQL和New MySQL Authentication Back end找到。下一个版本的DokuWiki将具有修改的验证模块系统,具体细节可在The Dokuwiki Manual找到。届时,本页面的信息将与新的授验证系统有冲突。
— Matthias Grimm 2005-11-22 22:29
新的验证累已经添加到本文档的末尾,它应该能够对phpBB的cookie起作用。 — FatherNitwit 2006-7-14
要求
- 已安装的能运行的phpBB
- 已安装的能运行的dokuwiki
- 一些耐心
序
- 本集成方法依赖于phpBB中组的使用。
对于了解不多的…
使用下面的设置之后,DokuWiki假定你论坛的mySQL数据库的数据表前缀是默认的“phpBB”。这个前缀是你在安装phpBB的过程中设置的,因此,如果你准备安装新的论坛,那么,就不要修改它!
我确定,有一些通过修改DokuWiki代码来说明该前缀的变化,这是可以行得通的。但是,首先,我不懂php或者mySQL,所以,我不能告诉你如何修改。我在修改我phpBB的数据表前缀时出错了,最终我返回我的论坛数据库,手动修改所有的数据表名(这是很单调乏味的),接着编辑/phpBB/config.php文件,将数据表的前缀设置到phpBB中。
步骤
配置auth_mysql
下面的代码最好放在conf/local.php中,以便于日后升级。
我们使用phpBB的username
替换name
,因为phpBB不给我们提供关于真名(姓、名)的任何的信息。如果你是第一次创建local.php,请确定打开文件顶部的<?php 标签。
$conf['openregister']= 0; //Should users to be allowed to register? $conf['useacl'] = 1; //Use Access Control Lists to restrict access? $conf['authtype'] = 'mysql'; $conf['auth']['mysql']['server'] = '<host>'; // mySQL host, usually localhost $conf['auth']['mysql']['user'] = '<database user>'; // mySQL database user for the database that is used by phpBB $conf['auth']['mysql']['password'] = '<database password>'; // mySQL database password for the database that is used by phpBB $conf['auth']['mysql']['database'] = '<database>'; // mySQL database that is used by phpBB $conf['auth']['mysql']['passcheck']= "SELECT username AS login FROM phpbb_users WHERE username='%u' AND user_password=MD5('%p')"; $conf['auth']['mysql']['userinfo'] = "SELECT username AS name, user_email AS mail FROM phpbb_users WHERE username='%u'"; $conf['auth']['mysql']['groups'] = "SELECT group_name as `group` FROM phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id AND a.group_id = c.group_id AND b.username='%u'";
这与新的mySQL后台不兼容!
下面的代码看起来与新的后台兼容:
$conf['openregister']= 0; //Should users to be allowed to register? $conf['useacl'] = 1; //Use Access Control Lists to restrict access? $conf['authtype'] = 'mysql'; $conf['auth']['mysql']['server'] = '<host>'; // mySQL host, usually localhost $conf['auth']['mysql']['user'] = '<database user>'; // mySQL database user for the database that is used by phpBB $conf['auth']['mysql']['password'] = '<database password>'; // mySQL database password for the database that is used by phpBB $conf['auth']['mysql']['database'] = '<database>'; // mySQL database that is used by phpBB $conf['auth']['mysql']['forwardClearPass'] = 1; $conf['auth']['mysql']['checkPass']= "SELECT user_password AS login FROM phpbb_users WHERE username='%{user}' AND user_password=MD5('%{pass}')"; $conf['auth']['mysql']['getUserInfo'] = "SELECT user_password AS pass, username AS name, user_email AS mail FROM phpbb_users WHERE username='%{user}'"; $conf['auth']['mysql']['getGroups'] = "SELECT group_name as `group` FROM phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id AND a.group_id = c.group_id AND b.username='%{user}'";
在phpBB中创建组
仅仅使用现有的phpBB组
使用SQL语句将各种论坛用户添加到组"Uses"中
我论坛具有将近1000用户,我希望用户只能编辑页面,因为不我想每个用户都添加到组“Users”中。我使用下面的SQL语句来选择用户的组,以及自动将用户添加到组“Users”中,组“Users”不出现在我的phpBB中:
$conf['auth']['mysql']['groups'] = "SELECT group_name as `group` FROM phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id AND a.group_id = c.group_id AND b.username='%u' UNION SELECT 'users' as `group` FROM phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id AND a.group_id = c.group_id AND b.username='%u';"
I know its a little big, but I have my own server and a good performance (running on Gentoo *scnr* - the Querry do 0.12sec) so I do better this than adding all Users to Group Users and patch the login.php to add all new users to Users.
For the new MySQL backend
$conf['auth']['mysql']['getGroups'] = "SELECT group_name as `group` FROM phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id AND a.group_id = c.group_id AND b.username='%{user}' UNION SELECT '" . $conf['defaultgroup'] . "' as `group` FROM phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id AND a.group_id = c.group_id AND b.username='%{user}'";
使用修改的脚本将所有的论坛用户添加到默认的组
我不懂mySQL。但是我觉得我最好不要进行查询,最好是修改inc/auth/mysql.php
来实现相同的效果。你需要改变函数auth_getUserData
的一个行,名为循环foreach($result as $row){
replace the line $info['grps'][] = $row['group'];
by this:
$info['grps'][] = $conf['defaultgroup'].','.$row['group'];
每个在phpBB论坛注册的用户都加入到由conf-files定义的组中。
很好,谢谢。这种方法比MySQL-Query好多了。 — integrate_with_phpbb defel 2005-03-30 00:30
最好将默认组添加到forech loop外,因为你现在是在修改里面的每个用户。
所以,foreach loop保持原样,在该loop之前添加这段代码:
$info['grps'][] = $conf['defaultgroup']; //Add the default group
如何将这应用到新的mysql后台?
嗯,与上面类似,要将用户添加到 defaultgroup ,只需添加defaultgroup到组的阵列中。 — integrate_with_phpbb anniyka 2006-07-29 23:22
function _getGroups($user) { $groups = array(); if($this->dbcon) { $sql = str_replace('%{user}',$this->_escape($user),$this->cnf['getGroups']); $result = $this->_queryDB($sql); if(count($result)) { foreach($result as $row) $groups[] = $row['group']; } $groups[] = $this->defaultgroup; // .......... add this line .......... return $groups; } return false;
Configure acl.auth
How to configure the acl.auth is described in acl. The group names are the ones that you have created in phpBB.
Other settings
Signature linking to phpBB user profile
I don't want to publish the email addresses of my privacy concerned users, so I've decided to have their signatures point to their user profiles, which they can configure as they like through phpBB.
I've used the “mail” field of userinfo to hold their user ID:
$conf['auth']['mysql']['userinfo'] = "SELECT username AS name, user_id AS mail FROM phpbb_users WHERE username='%u'";
Then I've set the signature template to:
$conf['signature'] = '//[[user>@MAIL@|@NAME@]] @DATE@//';
(both modifications go into local.php, see config)
The signature is now an interwiki link, which i have set to:
user /forum/profile.php?mode=viewprofile&u=
(put this line in your interwiki.conf) — Andrea 2005-09-17 11:58
The above was the basis for my phpbb signature mod. This is a more up to date version of above.
Add these lines to your local.php file.
$conf['auth']['mysql']['getUserInfo'] = "SELECT username AS name, user_id AS mail FROM phpbb_users WHERE username='%{user}'"; $conf['signature'] = '//[[user>@MAIL@|@NAME@]] @DATE@//';
If you followed the instructions to integrate with phpBB above you already have lines like this.
$conf['auth']['mysql']['getUserInfo'] = "SELECT user_password AS pass, username AS name, user_email AS mail FROM phpbb_users WHERE username='%{user}'";
I commented that line out so that it looked like this.
//$conf['auth']['mysql']['getUserInfo'] = "SELECT user_password AS pass, username AS name, user_email AS mail // FROM phpbb_users // WHERE username='%{user}'";
Then I added this line to the interwiki.conf file at the bottom.
user /forum/profile.php?mode=viewprofile&u=
Save your files and that's it. Now when you add your signature it points back to the profile page in phpBB. This worked for phpBB version 2.0.20.
— [Clint] 2007-07-09
phpBB.CLASS.PHP
I changed PUNBB.CLASS.PHP to be compable with PHPBB,
here is the ,it is not compable with PHPBB too much ,especially the cookie & session functions,cos i do not know much more about punbb !
but it work for me ! Anybody can rechange it more and deeply
<?php /** * phpbb auth backend * * Uses external Trust mechanism to check against phpbb's * user cookie. phpbb's PHPBB_ROOT must be defined correctly. * * @author Andreas Gohr <andi@splitbrain.org> * @hacked Yanni.Zheng <ynzheng@gmail.com> */ if(!defined('PHPBB_ROOT')) define('PHPBB_ROOT', DOKU_INC.'../bbs/'); if(get_magic_quotes_gpc()){ nice_die('Sorry the phpbb auth backend requires the PHP option <a href="http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc">magic_quotes_gpc</a> to be disabled for proper operation. Either setup your PHP install accordingly or choose a different auth backend.'); } require_once PHPBB_ROOT.'/config.php'; require_once DOKU_INC.'inc/auth/mysql.class.php'; #dbg($GLOBALS); #dbg($pun_user); class auth_phpbb extends auth_mysql { /** * Constructor. * * Sets additional capabilities and config strings */ function auth_phpbb(){ global $conf; $this->cando['external'] = true; $this->cando['logoff'] = true; // make sure we use a crypt understood by phpbb if(function_exists('sha1')){ $conf['passcrypt'] = 'sha1'; }else{ $conf['passcrypt'] = 'md5'; } // get global vars from phpbb config global $dbhost; global $dbname; global $dbuser; global $dbpasswd; global $table_prefix; // now set up the mysql config strings $conf['auth']['mysql']['server'] = $dbhost; $conf['auth']['mysql']['user'] = $dbuser; $conf['auth']['mysql']['password'] = $dbpasswd; $conf['auth']['mysql']['database'] = $dbname; //see http://www.dokuwiki.org/wiki:tips:integrate_with_phpbb $conf['auth']['mysql']['forwardClearPass'] = 1; $conf['auth']['mysql']['checkPass']= "SELECT u.user_password AS login FROM ${table_prefix}users AS u WHERE u.username='%{user}' AND u.user_password=MD5('%{pass}')"; //$conf['auth']['mysql']['getUserInfo'] = "SELECT u.user_password AS pass, u.user_fullname AS name, u.user_id AS mail // FROM ${table_prefix}users AS u // WHERE u.username='%{user}'"; $conf['auth']['mysql']['getUserInfo'] = "SELECT u.user_password AS pass, u.user_fullname AS name, u.user_email AS mail FROM ${table_prefix}users AS u WHERE u.username='%{user}'"; //$conf['auth']['mysql']['getGroups'] = "SELECT g.group_name as `group` // FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c // WHERE u.user_id = c.user_id // AND g.group_id = c.group_id // AND u.username='%{user}'"; $conf['auth']['mysql']['getGroups'] = "SELECT g.group_name as `group` FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c WHERE u.user_id = c.user_id AND g.group_id = c.group_id AND u.username='%{user}' UNION SELECT '" . $conf['defaultgroup'] . "' as `group` FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c WHERE u.user_id = c.user_id AND g.group_id = c.group_id AND u.username='%{user}'"; $conf['auth']['mysql']['getUsers'] = "SELECT DISTINCT u.username AS user FROM ${table_prefix}users AS u"; $conf['auth']['mysql']['FilterLogin'] = "u.username LIKE '%{user}'"; $conf['auth']['mysql']['FilterName'] = "u.user_fullname LIKE '%{name}'"; $conf['auth']['mysql']['FilterEmail'] = "u.user_email LIKE '%{email}'"; $conf['auth']['mysql']['FilterGroup'] = "g.group_name LIKE '%{group}'"; $conf['auth']['mysql']['SortOrder'] = "ORDER BY u.username"; //$conf['auth']['mysql']['addUser'] = "INSERT INTO ${table_prefix}users // (username, user_password, user_email, user_fullname) // VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')"; //$conf['auth']['mysql']['addGroup'] = "INSERT INTO ${table_prefix}groups (group_name) VALUES ('%{group}')"; //$conf['auth']['mysql']['addUserGroup']= "UPDATE ${table_prefix}users // SET group_id=%{gid} // WHERE id='%{uid}'"; //$conf['auth']['mysql']['delGroup'] = "DELETE FROM ${table_prefix}groups WHERE g_id='%{gid}'"; //$conf['auth']['mysql']['getUserID'] = "SELECT id FROM ${table_prefix}users WHERE username='%{user}'"; //$conf['auth']['mysql']['updateUser'] = "UPDATE ${table_prefix}users SET"; //$conf['auth']['mysql']['UpdateLogin'] = "username='%{user}'"; //$conf['auth']['mysql']['UpdatePass'] = "password='%{pass}'"; //$conf['auth']['mysql']['UpdateEmail'] = "email='%{email}'"; //$conf['auth']['mysql']['UpdateName'] = "realname='%{name}'"; //$conf['auth']['mysql']['UpdateTarget']= "WHERE id=%{uid}"; //$conf['auth']['mysql']['delUserGroup']= "UPDATE ${table_prefix}users SET g_id=4 WHERE id=%{uid}"; $conf['auth']['mysql']['getGroupID'] = "SELECT group_id AS id FROM ${table_prefix}groups WHERE group_name='%{group}'"; //$conf['auth']['mysql']['TablesToLock']= array("${table_prefix}users", "${table_prefix}users AS u", // "${table_prefix}groups", "${table_prefix}groups AS g"); //end see http://www.dokuwiki.org/wiki:tips:integrate_with_phpbb /* $conf['auth']['mysql']['checkPass'] = "SELECT u.password AS pass FROM ${table_prefix}users AS u, ${table_prefix}groups AS g WHERE u.group_id = g.g_id AND u.username = '%{user}' AND g.g_title != 'Guest'"; $conf['auth']['mysql']['getUserInfo'] = "SELECT password AS pass, realname AS name, email AS mail, id, g_title as `group` FROM ${table_prefix}users AS u, ${table_prefix}groups AS g WHERE u.group_id = g.g_id AND u.username = '%{user}'"; $conf['auth']['mysql']['getGroups'] = "SELECT g.g_title as `group` FROM ${table_prefix}users AS u, ${table_prefix}groups AS g WHERE u.group_id = g.g_id AND u.username = '%{user}'"; $conf['auth']['mysql']['getUsers'] = "SELECT DISTINCT u.username AS user FROM ${table_prefix}users AS u, ${table_prefix}groups AS g WHERE u.group_id = g.g_id"; $conf['auth']['mysql']['FilterLogin'] = "u.username LIKE '%{user}'"; $conf['auth']['mysql']['FilterName'] = "u.realname LIKE '%{name}'"; $conf['auth']['mysql']['FilterEmail'] = "u.email LIKE '%{email}'"; $conf['auth']['mysql']['FilterGroup'] = "g.g_title LIKE '%{group}'"; $conf['auth']['mysql']['SortOrder'] = "ORDER BY u.username"; $conf['auth']['mysql']['addUser'] = "INSERT INTO ${table_prefix}users (username, password, email, realname) VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')"; $conf['auth']['mysql']['addGroup'] = "INSERT INTO ${table_prefix}groups (g_title) VALUES ('%{group}')"; $conf['auth']['mysql']['addUserGroup']= "UPDATE ${table_prefix}users SET group_id=%{gid} WHERE id='%{uid}'"; $conf['auth']['mysql']['delGroup'] = "DELETE FROM ${table_prefix}groups WHERE g_id='%{gid}'"; $conf['auth']['mysql']['getUserID'] = "SELECT id FROM ${table_prefix}users WHERE username='%{user}'"; $conf['auth']['mysql']['updateUser'] = "UPDATE ${table_prefix}users SET"; $conf['auth']['mysql']['UpdateLogin'] = "username='%{user}'"; $conf['auth']['mysql']['UpdatePass'] = "password='%{pass}'"; $conf['auth']['mysql']['UpdateEmail'] = "email='%{email}'"; $conf['auth']['mysql']['UpdateName'] = "realname='%{name}'"; $conf['auth']['mysql']['UpdateTarget']= "WHERE id=%{uid}"; $conf['auth']['mysql']['delUserGroup']= "UPDATE ${table_prefix}users SET g_id=4 WHERE id=%{uid}"; $conf['auth']['mysql']['getGroupID'] = "SELECT g_id AS id FROM ${table_prefix}groups WHERE g_title='%{group}'"; $conf['auth']['mysql']['TablesToLock']= array("${table_prefix}users", "${table_prefix}users AS u", "${table_prefix}groups", "${table_prefix}groups AS g"); */ $conf['auth']['mysql']['debug'] = 1; // call mysql constructor $this->auth_mysql(); } /** * Just checks against the $pun_user variable */ function trustExternal($user,$pass,$sticky=false){ global $USERINFO; global $conf; global $lang; global $pun_user; global $pun_config; $sticky ? $sticky = true : $sticky = false; //sanity check // someone used the login form if(isset($user)){ if($this->checkPass($user,$pass)){ $expire = ($sticky) ? time() + 31536000 : 0; $uinfo = $this->getUserData($user); //pun_setcookie($uinfo['id'], auth_cryptPassword($pass), $expire); setcookie($uinfo['id'], auth_cryptPassword($pass), $expire); $pun_user = array(); $pun_user['password'] = auth_cryptPassword($pass); $pun_user['username'] = $user; $pun_user['realname'] = $uinfo['name']; $pun_user['email'] = $uinfo['mail']; $pun_user['g_title'] = $uinfo['group']; }else{ //invalid credentials - log off msg($lang['badlogin'],-1); auth_logoff(); return false; } } if(isset($pun_user) && !$pun_user['is_guest']){ // okay we're logged in - set the globals $USERINFO['pass'] = $pun_user['password']; $USERINFO['name'] = $pun_user['realname']; $USERINFO['mail'] = $pun_user['email']; $USERINFO['grps'] = array($pun_user['g_title']); $_SERVER['REMOTE_USER'] = $pun_user['username']; $_SESSION[$conf['title']]['auth']['user'] = $pun_user['username']; $_SESSION[$conf['title']]['auth']['info'] = $USERINFO; return true; } // to be sure auth_logoff(); return false; } /** * remove phpbb cookie on logout */ function logOff(){ global $pun_user; $pun_user = array(); //pun_setcookie(1, random_pass(8), time() + 31536000); setcookie(1, '', time() + 31536000); } } //Setup VIM: ex: et ts=2 enc=utf-8 :
— Yanni.Zheng 2006-06-12 11:58
Another phpbb.class.php
I have developed this phpbb.class.php auth backend to be more tightly integrated with phpbb's auth system. It should cooperate with phpbb's cookie authentication (given that your cookie path is set up properly), such that logging in or out of either app will log you in or out of both.
You should just be able to drop this into your int/auth folder, edit $phpbb_root_path, and change your auth mode to phpbb and off you go. You should NOT need to configure any of the mysql query stuff mentioned above for this to work.
It appears to me that “int/auth” should be “inc/auth”. It also appears to me that you need to create the auth folder, since it does not exist by default in the wiki installation (at least, it wasn't created in mine). However, when I did all the other coding suggestions here, I got an error message saying that inc/auth.php was looking for and couldn't find “inc/auth/phpbb.php”, which suggests to me that I am correct (I am getting the error message because I am - for the moment I hope - unable to create the inc/auth folder. - Bill My mistake…the folder inc/auth does exist, but my File Manager GUI for my domain would not let me see it…I had to open a DOS FTP session (I assume this is part of the mystery of UNIX). I was able to upload and use inc/auth/phpbb.php . I am now wrestling with finding basic.class.php (see phpbb.php below) which does not appear to be in the expected folder. If I comment “require_once(DOKU_AUTH.'/basic.class.php');” out, then the statement “class auth_phpbb extends auth_basic” fails, since the auth_basic class was probably defined in the basic.class.php file (which I don't know where it is)…oh, well… - Bill
It shouldent be too hard to get group support working, but I did not have a chance to get to it yet.
<?php /** * PHPBB authentication backend * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author FatherNitwit */ define('DOKU_AUTH', dirname(__FILE__)); require_once(DOKU_AUTH.'/basic.class.php'); define("IN_LOGIN", true); define('IN_PHPBB', true); $phpbb_root_path = $location.'../phpBB2/'; $dlang = $lang; #phpbb uses $lang too.. include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); $lang = $dlang; // we only accept page ids for auth_plain if(isset($_REQUEST['u'])) $_REQUEST['u'] = cleanID($_REQUEST['u']); if(isset($_REQUEST['acl_user'])) $_REQUEST['acl_user'] = cleanID($_REQUEST['acl_user']); class auth_phpbb extends auth_basic { var $userdata; /** * Constructor * * Carry out sanity checks to ensure the object is * able to operate. Set capabilities. * */ function auth_phpbb() { global $user_ip; $this->success = true; $this->cando['logoff'] = true; //$this->cando['getGroups'] = true; $this->cando['external'] = true; // // Set page ID for session management // $this->userdata = session_pagestart($user_ip, PAGE_LOGIN); init_userprefs($this->userdata); // // End session management // } function trustExternal($user,$pass,$sticky=false){ $sticky ? $sticky = true : $sticky = false; if($this->userdata['session_logged_in']) { //already logged in... } else { if(!$this->checkPass2($user,$pass,$sticky)) { return; } } global $USERINFO; $USERINFO = $this->getUserData($this->userdata['username']); $_SERVER['REMOTE_USER'] = $this->userdata['username']; $_SESSION[$conf['title']]['auth']['user'] = $this->userdata['username']; $_SESSION[$conf['title']]['auth']['pass'] = "__"; $_SESSION[$conf['title']]['auth']['buid'] = auth_browseruid(); $_SESSION[$conf['title']]['auth']['info'] = $USERINFO; /*var_dump($_SESSION[$conf['title']]['auth']); die("fff");*/ } function checkPass($user,$pass){ return($this->checkPass2($user,$pass,0)); } function checkPass2($user,$pass,$auto){ global $user_ip; global $db; $sql = "SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\\'", "''", $user) . "'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql); } if( $row = $db->sql_fetchrow($result) ) { if( md5($pass) == $row['user_password'] && $row['user_active'] ) { $this->userdata = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $auto, 0); if( !$this->userdata ) { message_die(CRITICAL_ERROR, "Couldn't start session : login", "", __LINE__, __FILE__); } return(true); } } msg($lang['badlogin'],-1); return(false); } /** * Return user info * * Returns info about the given user needs to contain * at least these fields: * * name string full name of the user * mail string email addres of the user * grps array list of groups the user is in * */ function getUserData($user){ global $conf; if($this->userdata['session_logged_in']) { global $db; //ok, figure out what groups they are in $sql = "SELECT g.group_name, ug.user_pending FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug WHERE ug.user_id = " . $this->userdata['user_id'] . " AND ug.group_id = g.group_id AND g.group_single_user <> " . TRUE . " ORDER BY g.group_name, ug.user_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error getting users group information', '', __LINE__, __FILE__, $sql); } $groups = array($conf['defaultgroup']); while( $row = $db->sql_fetchrow($result) ) { if(!$row['user_pending']) $groups[] = $row['group_name']; } return(array('name' => $user, 'mail' => $this->userdata['user_email'], 'grps' => $groups ) ); } return(false); } function logOff(){ if( $this->userdata['session_logged_in'] ) { session_end($this->userdata['session_id'], $this->userdata['user_id']); } } /* I didnt get this working... function retrieveGroups($start=0,$limit=0) { die("hi g"); $sql = "SELECT g.group_name FROM " . GROUPS_TABLE . " g AND g.group_single_user <> " . TRUE; if($limit != 0) $sql = $sql . " LIMIT $start,$limit"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql); } $groups = array("User"); while( $row = $db->sql_fetchrow($result) ) { $groups[] = $row['group_name']; } return $groups; }*/ }
— FatherNitwit 2006-7-14
Now, you must edit the files in dokuwiki/lib/exe
. In all these files add before if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(FILE).'/../../').'/');
this code:
$location = '../../';
This is important to find the phpBB path.
— DevO 2007-06-14
Why not change the code to this?
$location = DOKU_AUTH.'/../../'; //??? $phpbb_root_path = $location.$conf['phpbb_path'];
Then set in dokuwiki.php
$conf['phpbb_path'] = '../phpBB'; //relative phpBB path
Register and resend password links
Change the links in the inc/html.php file.
<?php if($auth->canDo('addUser') && actionOK('register')){ print '<p>'; print $lang['reghere']; print ': <a href="../phpbb/profile.php?mode=register&agreed=true" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>'; print '</p>'; } if ($auth->canDo('modPass') && actionOK('resendpwd')) { print '<p>'; print $lang['pwdforget']; print ': <a href="../phpbb/profile.php?mode=sendpassword" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>'; print '</p>'; } ?>
Comments
Just to say thanks - many (perhaps most) of my phpBB forum users use cookie authentication so to integrate this with DokuWiki is very useful. — Ben Pollinger
Thanks for this plugin first of all… Do have any sample or demo site that has used this setup? Thnx…. Andrew Abogado
Ok, I'm terribly sorry but I don't completely understand what all I should be doing to integrate these two things. Is there any way someone could make this a little clearer about which files are being edited where, which of it is mysql, which of the files should be created. That sort of thing.
This is written so poorly.