tips:integrate_with_phpbb3
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips:integrate_with_phpbb3 [2013-04-05 10:36] – [Installation instructions] Part not needed anymore 212.51.171.38 | tips:integrate_with_phpbb3 [2023-09-20 21:09] (current) – remove old auth backend docs, use plugin:authphpbb3 instead Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== phpBB 3 (authentication) integration ====== | ||
- | ===== Features ===== | ||
- | |||
- | * Completely using phpBB' | ||
- | * Using phpBB' | ||
- | * // | ||
- | * // | ||
- | * // | ||
- | |||
- | ==== Features missing ==== | ||
- | |||
- | * User registration | ||
- | * Full name display (phpBB doesn' | ||
- | * Integration with Mediamanager, | ||
- | * Language support | ||
- | |||
- | ===== Installation instructions ===== | ||
- | |||
- | //To get this to work with the most Release Candidate version of DokuWiki “Adora Bell 10-09-2912” and PHPBB3 only do the following steps marked with //**=Adora Bell=** | ||
- | |||
- | //To get this to work with the most recent stable version of DokuWiki “Angua 25-01-2012” and PHPBB3 only do the following steps marked with // | ||
- | |||
- | //To get this to work with the outdated version of DokuWiki “Rincewind” and PHPBB3 only do the following steps marked with // | ||
- | |||
- | To install this mod, you can: | ||
- | * use this [[http:// | ||
- | * follow these steps: | ||
- | - create '' | ||
- | - edit '' | ||
- | - edit '' | ||
- | - edit '' | ||
- | - edit '' | ||
- | - edit '' | ||
- | - edit '' | ||
- | - edit '' | ||
- | - [[#set configuration variables]] | ||
- | |||
- | ==== Create inc/ | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | \\ | ||
- | Create a file in the **inc/ | ||
- | <file php phpbb3.class.php><? | ||
- | /** | ||
- | * phpBB3 authentication backend | ||
- | * | ||
- | * Uses external Trust mechanism to check against phpBB' | ||
- | * user cookie. phpBB' | ||
- | * | ||
- | * @author | ||
- | */ | ||
- | |||
- | define(' | ||
- | global $phpbb_root_path; | ||
- | global $db; | ||
- | global $cache; | ||
- | global $phpEx; | ||
- | global $user; | ||
- | global $config; | ||
- | global $conf; | ||
- | global $dbhost; | ||
- | global $dbport; | ||
- | global $dbname; | ||
- | global $dbuser; | ||
- | global $dbpasswd; | ||
- | global $table_prefix; | ||
- | global $phpbb_auth; | ||
- | |||
- | $phpEx = substr(strrchr(__FILE__, | ||
- | |||
- | if(strpos($_SERVER[' | ||
- | if(strpos($_SERVER[' | ||
- | |||
- | require_once(DOKU_INC.' | ||
- | require_once($phpbb_root_path.' | ||
- | |||
- | //config is loaded in common file, but $dbpasswd is unset there, too, so we have to reload it | ||
- | require($phpbb_root_path.' | ||
- | |||
- | $user-> | ||
- | |||
- | //$auth will be used by DokuWiki, so copy phpBB' | ||
- | $phpbb_auth = $auth; | ||
- | $phpbb_auth-> | ||
- | |||
- | class auth_phpbb3 extends auth_mysql | ||
- | { | ||
- | function auth_phpbb3() | ||
- | { | ||
- | $this-> | ||
- | $this-> | ||
- | |||
- | global $conf; | ||
- | |||
- | // get global vars from phpBB config | ||
- | global $dbhost; | ||
- | global $dbport; | ||
- | global $dbname; | ||
- | global $dbuser; | ||
- | global $dbpasswd; | ||
- | global $table_prefix; | ||
- | |||
- | // set group config vars | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | |||
- | // now set up the mysql config strings | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | |||
- | //unset $db* variables, so noone can hack them | ||
- | unset($dbpasswd); | ||
- | unset($dbuser); | ||
- | unset($dbhost); | ||
- | unset($dbport); | ||
- | unset($dbname); | ||
- | |||
- | $conf[' | ||
- | " | ||
- | " | ||
- | |||
- | $conf[' | ||
- | FROM {$table_prefix}users | ||
- | WHERE username=' | ||
- | |||
- | $conf[' | ||
- | FROM {$table_prefix}users | ||
- | WHERE username=' | ||
- | |||
- | $conf[' | ||
- | FROM {$table_prefix}groups g, {$table_prefix}users u, {$table_prefix}user_group ug | ||
- | WHERE u.user_id = ug.user_id | ||
- | AND g.group_id = ug.group_id | ||
- | AND u.username=' | ||
- | |||
- | |||
- | |||
- | $conf[' | ||
- | FROM {$table_prefix}users AS u | ||
- | LEFT JOIN {$table_prefix}user_group AS ug ON u.user_id=ug.user_id | ||
- | LEFT JOIN {$table_prefix}groups AS g ON ug.group_id=g.group_id"; | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | |||
- | $conf[' | ||
- | FROM {$table_prefix}users | ||
- | WHERE username=' | ||
- | |||
- | $conf[' | ||
- | FROM {$table_prefix}groups | ||
- | WHERE group_name=' | ||
- | |||
- | / | ||
- | | ||
- | | ||
- | |||
- | $conf[' | ||
- | | ||
- | |||
- | $conf[' | ||
- | | ||
- | |||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | // | ||
- | $conf[' | ||
- | |||
- | $conf[' | ||
- | WHERE group_id=' | ||
- | |||
- | $conf[' | ||
- | WHERE user_id=' | ||
- | |||
- | $conf[' | ||
- | WHERE user_id=' | ||
- | |||
- | $conf[' | ||
- | WHERE user_id=' | ||
- | AND group_id=' | ||
- | */ | ||
- | |||
- | // call mysql constructor | ||
- | $this-> | ||
- | } | ||
- | |||
- | |||
- | function trustExternal($username, | ||
- | { | ||
- | global $USERINFO; | ||
- | global $conf; | ||
- | global $user; | ||
- | global $phpbb_auth; | ||
- | |||
- | $sticky ? $sticky = true : $sticky = false; // sanity check | ||
- | |||
- | // someone used the login form | ||
- | if(!empty($username)) { | ||
- | // run phpBB' | ||
- | define(' | ||
- | $login = $phpbb_auth-> | ||
- | if($login[' | ||
- | } | ||
- | |||
- | if(!$user-> | ||
- | |||
- | $USERINFO[' | ||
- | $USERINFO[' | ||
- | if($this-> | ||
- | $USERINFO[' | ||
- | } | ||
- | |||
- | $_SERVER[' | ||
- | $_SESSION[DOKU_COOKIE][' | ||
- | $_SESSION[DOKU_COOKIE][' | ||
- | $_SESSION[DOKU_COOKIE][' | ||
- | |||
- | return true; | ||
- | } | ||
- | |||
- | |||
- | function logoff() | ||
- | { | ||
- | global $user; | ||
- | $user-> | ||
- | } | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | Since **=Adora Belle=** you have to change this part: | ||
- | <code php> // call mysql constructor | ||
- | $this-> | ||
- | By this : | ||
- | <code php> // call mysql constructor | ||
- | $parent:: | ||
- | This is because the **auth_mysql** class is now in PHP5 and uses the new constructor. | ||
- | |||
- | |||
- | ==== Edit inc/ | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | \\ | ||
- | In the file **inc/ | ||
- | <code php> | ||
- | Comment it out by adding **%%//%%** in front of the line like this: | ||
- | <code php>// | ||
- | We have to do this because phpBB uses $_REQUEST for its cookies. | ||
- | |||
- | ==== Edit inc/ | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | |||
- | There are some functions in the file **inc/ | ||
- | * utf8_strlen | ||
- | * utf8_substr | ||
- | * utf8_strtolower | ||
- | * utf8_strtoupper | ||
- | * utf8_ucfirst | ||
- | * utf8_strpos | ||
- | * utf8_basename **=Adora Belle=** | ||
- | |||
- | So we only let DokuWiki define these functions if we're not using phpBB by adding an check around these function: <code php> | ||
- | |||
- | === Example: utf8_strlen === | ||
- | |||
- | replace: | ||
- | <code php> | ||
- | return strlen(utf8_decode($string)); | ||
- | }</ | ||
- | with: | ||
- | <code php> | ||
- | function utf8_strlen($string){ | ||
- | return strlen(utf8_decode($string)); | ||
- | } | ||
- | }</ | ||
- | |||
- | ==== Edit inc/ | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | |||
- | The last problem we have is that DokuWiki and phpBB both have a cache class. We can just rename this class in DokuWiki. To do so we open the file **inc/ | ||
- | <code php> | ||
- | replace this line with: | ||
- | <code php> | ||
- | |||
- | Search for: | ||
- | <code php> | ||
- | and replace it with: | ||
- | <code php> | ||
- | |||
- | Search for: | ||
- | <code php> | ||
- | and replace it with: | ||
- | <code php> | ||
- | |||
- | Search for: | ||
- | <code php> | ||
- | and replace it with: | ||
- | <code php> | ||
- | |||
- | ==== Edit feed.php ==== | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | |||
- | Knowing we have just renamed the cache class (see above) and knowing this class is called in feed.php, we also need to rename the calling to make RSS/Atom feeds works. | ||
- | Find: | ||
- | <code php> | ||
- | $cache = new cache($key, ' | ||
- | </ | ||
- | and replace with: | ||
- | <code php> | ||
- | $cache = new wiki_cache($key, | ||
- | </ | ||
- | |||
- | Otherwise you will have a very nice "XML Parsing Error" | ||
- | |||
- | ==== Edit lib/ | ||
- | |||
- | **=Angua=** **=Adora Belle=** **Do __Not__ do for Rincewind** | ||
- | |||
- | **=Angua=** | ||
- | |||
- | Knowing we have just renamed the cache class (see above) and knowing this class is called in lib/ | ||
- | Find: | ||
- | <code php> | ||
- | // The generated script depends on some dynamic options | ||
- | $cache = new cache(' | ||
- | </ | ||
- | and replace with: | ||
- | <code php> | ||
- | // The generated script depends on some dynamic options | ||
- | $cache = new wiki_cache(' | ||
- | </ | ||
- | |||
- | **=Adora Belle=** | ||
- | |||
- | Find: | ||
- | <code php> | ||
- | // The generated script depends on some dynamic options | ||
- | $cache = new cache(' | ||
- | </ | ||
- | and replace with: | ||
- | <code php> | ||
- | // The generated script depends on some dynamic options | ||
- | $cache = new wiki_cache(' | ||
- | </ | ||
- | |||
- | ==== Edit lib/ | ||
- | |||
- | **=Angua=** **=Adora Belle=** **Do __Not__ do for Rincewind** | ||
- | |||
- | Knowing we have just renamed the cache class (see above) and knowing this class is called in lib/ | ||
- | Find: | ||
- | <code php> | ||
- | // The generated script depends on some dynamic options | ||
- | $cache = new cache(' | ||
- | ' | ||
- | </ | ||
- | and replace with: | ||
- | <code php> | ||
- | // The generated script depends on some dynamic options | ||
- | $cache = new wiki_cache(' | ||
- | ' | ||
- | </ | ||
- | |||
- | ==== Edit inc/ | ||
- | |||
- | **=Angua=** **=Adora Belle=** **Do __Not__ do for Rincewind** | ||
- | |||
- | Knowing we have just renamed the cache class (see above) and knowing this class is in inc/ | ||
- | Find: | ||
- | <code php> | ||
- | ' | ||
- | </ | ||
- | and replace with: | ||
- | <code php> | ||
- | ' | ||
- | </ | ||
- | |||
- | |||
- | ==== Set configuration variables ==== | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | |||
- | The last thing we have to do is: enable it! The file **conf/ | ||
- | <code php local.protected.php><? | ||
- | /* | ||
- | * phpBB3 | ||
- | */ | ||
- | |||
- | define(' | ||
- | $phpbb_root_path = ' | ||
- | $conf[' | ||
- | ?></ | ||
- | $phpbb_root_path has to be the relative path to phpBB from the DokuWiki directory, e.g. if phpBB is installed on the same level as DokuWiki, e.g. DokuWiki in **var/ | ||
- | |||
- | I did this, but it wouldn' | ||
- | |||
- | ===== phpBB3 Settings ===== | ||
- | |||
- | ==== Cookie Settings ==== | ||
- | |||
- | **=Angua=** **=Rincewind=** **=Adora Belle=** | ||
- | |||
- | In order for the above integration to work well, it is important that the cookie settings in the phpBB3 ACP (admin control panel) are set right. For example, with wrong cookie settings, first logging in at your phpBB3 forum, then browsing your DokuWiki pages will forcibly log you out when you next load a page of your forum. | ||
- | |||
- | If your phpBB3 forum is installed at **%%www.yourdomain.com/ | ||
- | Instead, set the " | ||
- | < | ||
- | |||
- | ==== Security Settings ==== | ||
- | |||
- | An other thing to check in the phpbb3 ACP is " | ||
- | Be care... | ||
- | |||
- | ===== Credits ===== | ||
- | |||
- | * Thanks to [[http:// | ||
- | |||
- | ===== Comments / Problems ===== | ||
- | |||
- | * I had some problems getting this integration to work, it would not authenticate. But, I found the problem: If $_SERVER[' | ||
- | |||
- | * For German phpbb3: Dont use ÄÖÜ for Usernames, it will not authenticate! It is possible to restrict those usernames in phpbb3 registration settings. Use ASCII Usernames instead. | ||
- | |||
- | * Additional info provided for Adora Belle (fixed now for me with php 5.3) Regards, djSupport |