DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:integrate_with_phpbb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tips:integrate_with_phpbb [2017-12-05 16:24]
92.217.159.60
tips:integrate_with_phpbb [2017-12-05 18:38] (current)
LarsDW223 old revision restored (2013-05-24 15:32)
Line 1: Line 1:
 +====== Integrate with phpBB ======
 +
 +This is a description of how to integrate the user authentication and group facilities in phpBB with dokuWiki.
 +
 +For integration with PHPBB3, please see [[integrate_with_phpbb3|this page.]]
 +
 +> Information regarding this topic could also be found in [[auth:mysql|Authentication backend: MySQL]]. With the next release DokuWiki will get a revised authentication module system. Details can be found in [[:manual|The Dokuwiki Manual]]. Information on this page will become deprecated with the new authentication system.\\  --- //[[matthiasgrimm@users.sourceforge.net|Matthias Grimm]] 2005-11-22 22:29//
 +
 +> **A new authentication class** has been added to the end of this document which should work with phpbb's cookie. --- //FatherNitwit 2006-7-14//
 +
 ===== Requirements ===== ===== Requirements =====
  
Line 25: Line 35:
 The code below is best placed in **conf/local.php**, so that it will be easy to upgrade later. The code below is best placed in **conf/local.php**, so that it will be easy to upgrade later.
  
-We use phpBBs ''username'' as a replacement for ''name'' since phpBB does not provide us with any information about real names (first name, last name).  If you are creating local.php for the first time, be sure the opening tag, &lt;?php appears at the top of the file.+We use phpBBs ''username'' as a replacement for ''name'' since phpBB does not provide us with any information about real names (first name, last name).  If you are creating local.php for the first time, be sure the opening tag, <?php appears at the top of the file.
  
-&lt;code php&gt;+<code php>
 $conf['openregister']= 0;                //Should users to be allowed to register? $conf['openregister']= 0;                //Should users to be allowed to register?
  
Line 34: Line 44:
 $conf['authtype'] = 'mysql'; $conf['authtype'] = 'mysql';
  
-$conf['auth']['mysql']['server'  = '&lt;host&gt;';              // mySQL host, usually localhost +$conf['auth']['mysql']['server'  = '<host>';              // mySQL host, usually localhost 
-$conf['auth']['mysql']['user'    = '&lt;database user&gt;';     // mySQL database user for the database that is used by phpBB +$conf['auth']['mysql']['user'    = '<database user>';     // mySQL database user for the database that is used by phpBB 
-$conf['auth']['mysql']['password'] = '&lt;database password&gt;'; // mySQL database password 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'] = '&lt;database&gt;';          // mySQL database that is used by phpBB+$conf['auth']['mysql']['database'] = '<database>';          // mySQL database that is used by phpBB
  
-$conf['auth']['mysql']['passcheck']= &quot;SELECT username AS login+$conf['auth']['mysql']['passcheck']= "SELECT username AS login
                                         FROM phpbb_users                                         FROM phpbb_users
                                        WHERE username='%u'                                        WHERE username='%u'
-                                         AND user_password=MD5('%p')&quot;+                                         AND user_password=MD5('%p')"
-$conf['auth']['mysql']['userinfo'] = &quot;SELECT username AS name, user_email AS mail+$conf['auth']['mysql']['userinfo'] = "SELECT username AS name, user_email AS mail
                                         FROM phpbb_users                                         FROM phpbb_users
-                                       WHERE username='%u'&quot;+                                       WHERE username='%u'"
-$conf['auth']['mysql']['groups'  &quot;SELECT group_name as `group`+$conf['auth']['mysql']['groups'  "SELECT group_name as `group`
                                         FROM phpbb_groups a, phpbb_users b, phpbb_user_group c                                         FROM phpbb_groups a, phpbb_users b, phpbb_user_group c
                                        WHERE b.user_id = c.user_id                                        WHERE b.user_id = c.user_id
                                          AND a.group_id = c.group_id                                          AND a.group_id = c.group_id
-                                         AND b.username='%u'&quot;+                                         AND b.username='%u'"
-&lt;/code&gt;+</code>
  
 :!: This does not work with the new MySQL Backend! :!: This does not work with the new MySQL Backend!
Line 59: Line 69:
 To work with the new Backend the following appears to work: To work with the new Backend the following appears to work:
  
-&lt;code php&gt;+<code php>
 $conf['openregister']= 0;                //Should users to be allowed to register? $conf['openregister']= 0;                //Should users to be allowed to register?
  
Line 66: Line 76:
 $conf['authtype'] = 'mysql'; $conf['authtype'] = 'mysql';
  
-$conf['auth']['mysql']['server'  = '&lt;host&gt;';              // mySQL host, usually localhost +$conf['auth']['mysql']['server'  = '<host>';              // mySQL host, usually localhost 
-$conf['auth']['mysql']['user'    = '&lt;database user&gt;';     // mySQL database user for the database that is used by phpBB +$conf['auth']['mysql']['user'    = '<database user>';     // mySQL database user for the database that is used by phpBB 
-$conf['auth']['mysql']['password'] = '&lt;database password&gt;'; // mySQL database password 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'] = '&lt;database&gt;';          // mySQL 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']['forwardClearPass'] = 1;
-$conf['auth']['mysql']['checkPass']= &quot;SELECT user_password AS login+$conf['auth']['mysql']['checkPass']= "SELECT user_password AS login
                                         FROM phpbb_users                                         FROM phpbb_users
                                         WHERE username='%{user}'                                         WHERE username='%{user}'
-                                        AND user_password=MD5('%{pass}')&quot;+                                        AND user_password=MD5('%{pass}')"
-$conf['auth']['mysql']['getUserInfo'] = &quot;SELECT user_password AS pass, username AS name, user_email AS mail+$conf['auth']['mysql']['getUserInfo'] = "SELECT user_password AS pass, username AS name, user_email AS mail
                                         FROM phpbb_users                                         FROM phpbb_users
-                                        WHERE username='%{user}'&quot;+                                        WHERE username='%{user}'"
-$conf['auth']['mysql']['getGroups'  &quot;SELECT group_name as `group`+$conf['auth']['mysql']['getGroups'  "SELECT group_name as `group`
                                         FROM phpbb_groups a, phpbb_users b, phpbb_user_group c                                         FROM phpbb_groups a, phpbb_users b, phpbb_user_group c
                                         WHERE b.user_id = c.user_id                                         WHERE b.user_id = c.user_id
                                         AND a.group_id = c.group_id                                         AND a.group_id = c.group_id
-                                        AND b.username='%{user}'&quot;+                                        AND b.username='%{user}'"
-&lt;/code&gt;+</code>
  
 :!: This does not work with phpBB 3! :!: This does not work with phpBB 3!
Line 99: Line 109:
 :!: Warning the group names should be made lowercase as the ACL script is translating the group names to lowercase as well... :!: Warning the group names should be made lowercase as the ACL script is translating the group names to lowercase as well...
  
-==== Add all forum users to a group &quot;Users&quot; with SQL-statement ====+==== Add all forum users to a group "Userswith SQL-statement ====
  
-I have nearly 1000 Users on my Forum, and i want that only Users are able to edit a page. Because I won't add every User to a Group &quot;Users&quot; I use the following SQL-Statement to select the Group of a User and add the User automaticaly to the Group &quot;Users&quot;, which dosn't exist in my PHPBB: +I have nearly 1000 Users on my Forum, and i want that only Users are able to edit a page. Because I won't add every User to a Group "UsersI use the following SQL-Statement to select the Group of a User and add the User automaticaly to the Group "Users", which dosn't exist in my PHPBB: 
-&lt;code php&gt; +<code php> 
-$conf['auth']['mysql']['groups'       =  &quot;SELECT group_name as `group` +$conf['auth']['mysql']['groups'       =  "SELECT group_name as `group` 
                                            FROM phpbb_groups a, phpbb_users b, phpbb_user_group c                                             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                                            WHERE b.user_id = c.user_id AND a.group_id = c.group_id
Line 112: Line 122:
                                            WHERE b.user_id = c.user_id                                             WHERE b.user_id = c.user_id 
                                            AND a.group_id = c.group_id                                             AND a.group_id = c.group_id 
-                                           AND b.username='%u';&quot; +                                           AND b.username='%u';" 
-&lt;/code&gt;+</code>
  
 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. \\ 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. \\
Line 119: Line 129:
 === For the new MySQL backend === === For the new MySQL backend ===
  
-&lt;code php&gt; +<code php> 
-$conf['auth']['mysql']['getGroups'       =  &quot;SELECT group_name as `group` +$conf['auth']['mysql']['getGroups'       =  "SELECT group_name as `group` 
                                            FROM phpbb_groups a, phpbb_users b, phpbb_user_group c                                             FROM phpbb_groups a, phpbb_users b, phpbb_user_group c 
                                            WHERE b.user_id = c.user_id                                             WHERE b.user_id = c.user_id 
Line 126: Line 136:
                                            AND b.username='%{user}'                                            AND b.username='%{user}'
                                            UNION                                             UNION 
-                                           SELECT '&quot; . $conf['defaultgroup'] . &quot;' as `group` +                                           SELECT '. $conf['defaultgroup'] . "' as `group` 
                                            FROM phpbb_groups a, phpbb_users b, phpbb_user_group c                                             FROM phpbb_groups a, phpbb_users b, phpbb_user_group c 
                                            WHERE b.user_id = c.user_id                                             WHERE b.user_id = c.user_id 
                                            AND a.group_id = c.group_id                                             AND a.group_id = c.group_id 
-                                           AND b.username='%{user}'&quot;+                                           AND b.username='%{user}'"
-&lt;/code&gt;+</code>
  
  
Line 142: Line 152:
 I don't understand anything of mySQL, so I thought I'd better not touch that query, but instead modified ''inc/auth/mysql.php'' to achieve the same effect. You need to change one single line in the function ''auth_getUserData'', namely in the loop ''foreach($result as $row){'' replace the line ''$info['grps'][] = $row['group'];'' by this: I don't understand anything of mySQL, so I thought I'd better not touch that query, but instead modified ''inc/auth/mysql.php'' to achieve the same effect. You need to change one single line in the function ''auth_getUserData'', namely in the loop ''foreach($result as $row){'' replace the line ''$info['grps'][] = $row['group'];'' by this:
  
-&lt;code php&gt;$info['grps'][] = $conf['defaultgroup'].','.$row['group'];&lt;/code&gt;+<code php>$info['grps'][] = $conf['defaultgroup'].','.$row['group'];</code>
  
 Each registered user in your phpBB forum is added to the default group defined in your conf-files. Each registered user in your phpBB forum is added to the default group defined in your conf-files.
  
-&gt; Nice, thanks. This solution is much elegant than the MySQL-Query :-)  --- //[[|]] defel 2005-03-30 00:30//+Nice, thanks. This solution is much elegant than the MySQL-Query :-)  --- //[[|]] defel 2005-03-30 00:30//
  
-&gt;&gt;It would be better to add the default group outside the foreach loop as right now you are adding it for every group the user is in. +>>It would be better to add the default group outside the foreach loop as right now you are adding it for every group the user is in. 
-&gt;&gt;So keep the foreach loop the way it is, and add the following code on the line before the loop: +>>So keep the foreach loop the way it is, and add the following code on the line before the loop: 
-&gt;&gt;&lt;code php&gt;$info['grps'][] = $conf['defaultgroup']; //Add the default group &lt;/code&gt;+>><code php>$info['grps'][] = $conf['defaultgroup']; //Add the default group </code>
  
 How to adapt this to the new mysql backend? How to adapt this to the new mysql backend?
  
-Well, like above. To add the //defaultgroup// by &quot;default&quot; to a user, just add the //defaultgroup// to the array of groups, befor it is returned. ;-) --- //[[|]] anniyka 2006-07-29 23:22// +Well, like above. To add the //defaultgroup// by "defaultto a user, just add the //defaultgroup// to the array of groups, befor it is returned. ;-) --- //[[|]] anniyka 2006-07-29 23:22// 
-&lt;code php&gt;    function _getGroups($user) {+<code php   function _getGroups($user) {
       $groups = array();       $groups = array();
  
-      if($this-&gt;dbcon) { +      if($this->dbcon) { 
-        $sql = str_replace('%{user}',$this-&gt;_escape($user),$this-&gt;cnf['getGroups']); +        $sql = str_replace('%{user}',$this->_escape($user),$this->cnf['getGroups']); 
-        $result = $this-&gt;_queryDB($sql);+        $result = $this->_queryDB($sql);
  
         if(count($result)) {         if(count($result)) {
Line 166: Line 176:
             $groups[] = $row['group'];             $groups[] = $row['group'];
         }         }
-        $groups[] = $this-&gt;defaultgroup;    //    .......... add this line ..........+        $groups[] = $this->defaultgroup;    //    .......... add this line ..........
         return $groups;         return $groups;
       }       }
       return false;       return false;
-&lt;/code&gt;+</code>
  
 ===== Configure acl.auth ===== ===== Configure acl.auth =====
Line 184: Line 194:
 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 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 &quot;mail&quot; field of userinfo to hold their user ID:+I've used the "mailfield of userinfo to hold their user ID:
  
-&lt;code php&gt; +<code php> 
-$conf['auth']['mysql']['userinfo'] = &quot;SELECT username AS name, user_id AS mail+$conf['auth']['mysql']['userinfo'] = "SELECT username AS name, user_id AS mail
                                         FROM phpbb_users                                         FROM phpbb_users
-                                       WHERE username='%u'&quot;+                                       WHERE username='%u'"
-&lt;/code&gt;+</code>
  
 Then I've set the signature template to: Then I've set the signature template to:
  
-&lt;code php&gt; +<code php> 
-$conf['signature'    = '//[[user&gt;@MAIL@|@NAME@]] @DATE@//'; +$conf['signature'    = '//[[user>@MAIL@|@NAME@]] @DATE@//'; 
-&lt;/code&gt;+</code>
  
 (both modifications go into local.php, see [[:config]]) (both modifications go into local.php, see [[:config]])
Line 202: Line 212:
 The signature is now an [[:interwiki]] link, which i have set to: The signature is now an [[:interwiki]] link, which i have set to:
  
-&lt;code&gt; +<code> 
-user      /forum/profile.php?mode=viewprofile&amp;u= +user      /forum/profile.php?mode=viewprofile&u= 
-&lt;/code&gt;+</code>
  
 (put this line in your interwiki.conf) (put this line in your interwiki.conf)
Line 215: Line 225:
 Add these lines to your local.php file. Add these lines to your local.php file.
  
-&lt;code php&gt; +<code php> 
-$conf['auth']['mysql']['getUserInfo'] = &quot;SELECT username AS name, user_id AS mail+$conf['auth']['mysql']['getUserInfo'] = "SELECT username AS name, user_id AS mail
                                         FROM phpbb_users                                         FROM phpbb_users
-                                       WHERE username='%{user}'&quot;;+                                       WHERE username='%{user}'";
  
-$conf['signature'    = '//[[user&gt;@MAIL@|@NAME@]] @DATE@//'; +$conf['signature'    = '//[[user>@MAIL@|@NAME@]] @DATE@//'; 
-&lt;/code&gt;+</code>
  
 If you followed the instructions to integrate with phpBB above you already have lines like this. If you followed the instructions to integrate with phpBB above you already have lines like this.
  
-&lt;code php&gt; +<code php> 
-$conf['auth']['mysql']['getUserInfo'] = &quot;SELECT user_password AS pass, username AS name, user_email AS mail+$conf['auth']['mysql']['getUserInfo'] = "SELECT user_password AS pass, username AS name, user_email AS mail
                                         FROM phpbb_users                                         FROM phpbb_users
-                                        WHERE username='%{user}'&quot;+                                        WHERE username='%{user}'"
-&lt;/code&gt;+</code>
  
 I commented that line out so that it looked like this. I commented that line out so that it looked like this.
  
-&lt;code php&gt; +<code php> 
-//$conf['auth']['mysql']['getUserInfo'] = &quot;SELECT user_password AS pass, username AS name, user_email AS mail+//$conf['auth']['mysql']['getUserInfo'] = "SELECT user_password AS pass, username AS name, user_email AS mail
 //                                        FROM phpbb_users //                                        FROM phpbb_users
-//                                        WHERE username='%{user}'&quot;+//                                        WHERE username='%{user}'"
-&lt;/code&gt;+</code>
  
 Then I added this line to the interwiki.conf file at the bottom. Then I added this line to the interwiki.conf file at the bottom.
  
-&lt;code&gt; +<code> 
-user      /forum/profile.php?mode=viewprofile&amp;u= +user      /forum/profile.php?mode=viewprofile&u= 
-&lt;/code&gt;+</code>
  
 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.  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. 
Line 252: Line 262:
 I changed PUNBB.CLASS.PHP to be compable with PHPBB,  I changed PUNBB.CLASS.PHP to be compable with PHPBB, 
  
-here is the ,it is not compable with PHPBB too much ,especially the cookie &amp; session functions,cos i do not know much more about punbb ! +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  but it work for me ! Anybody can rechange it more and deeply 
  
-&lt;code php&gt; +<code php> 
-&lt;?php+<?php
 /** /**
  * phpbb auth backend  * phpbb auth backend
Line 264: Line 274:
  * user cookie. phpbb's PHPBB_ROOT must be defined correctly.  * user cookie. phpbb's PHPBB_ROOT must be defined correctly.
  *  *
- * @author    Andreas Gohr &lt;andi@splitbrain.org&gt; + * @author    Andreas Gohr <andi@splitbrain.org> 
- * @hacked    Yanni.Zheng &lt;ynzheng@gmail.com&gt;+ * @hacked    Yanni.Zheng <ynzheng@gmail.com>
  */  */
  
Line 271: Line 281:
 if(get_magic_quotes_gpc()){ if(get_magic_quotes_gpc()){
   nice_die('Sorry the phpbb auth backend requires the PHP option   nice_die('Sorry the phpbb auth backend requires the PHP option
-  &lt;a href=&quot;http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc&quot;&gt;magic_quotes_gpc&lt;/a&gt;+  <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   to be disabled for proper operation. Either setup your PHP install accordingly or
   choose a different auth backend.');   choose a different auth backend.');
Line 291: Line 301:
   function auth_phpbb(){   function auth_phpbb(){
     global $conf;     global $conf;
-    $this-&gt;cando['external'] = true; +    $this->cando['external'] = true; 
-    $this-&gt;cando['logoff'  = true;+    $this->cando['logoff'  = true;
  
     // make sure we use a crypt understood by phpbb     // make sure we use a crypt understood by phpbb
Line 317: Line 327:
 $conf['auth']['mysql']['forwardClearPass'] = 1;  $conf['auth']['mysql']['forwardClearPass'] = 1; 
  
-$conf['auth']['mysql']['checkPass']= &quot;SELECT u.user_password AS login+$conf['auth']['mysql']['checkPass']= "SELECT u.user_password AS login
                                         FROM ${table_prefix}users AS u                                         FROM ${table_prefix}users AS u
                                         WHERE u.username='%{user}'                                         WHERE u.username='%{user}'
-                                        AND u.user_password=MD5('%{pass}')&quot;;+                                        AND u.user_password=MD5('%{pass}')";
  
-//$conf['auth']['mysql']['getUserInfo'] = &quot;SELECT u.user_password AS pass, u.user_fullname AS name, u.user_id AS mail+//$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 //                                        FROM ${table_prefix}users AS u
-//                                        WHERE u.username='%{user}'&quot;+//                                        WHERE u.username='%{user}'"
-$conf['auth']['mysql']['getUserInfo'] = &quot;SELECT u.user_password AS pass, u.user_fullname AS name, u.user_email AS mail+$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                                         FROM ${table_prefix}users AS u
-                                        WHERE u.username='%{user}'&quot;;+                                        WHERE u.username='%{user}'";
  
-//$conf['auth']['mysql']['getGroups'  &quot;SELECT g.group_name as `group`+//$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 //                                        FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c
 //                                        WHERE u.user_id = c.user_id //                                        WHERE u.user_id = c.user_id
 //                                        AND g.group_id = c.group_id //                                        AND g.group_id = c.group_id
-//                                        AND u.username='%{user}'&quot;+//                                        AND u.username='%{user}'"
-$conf['auth']['mysql']['getGroups'  &quot;SELECT g.group_name as `group`+$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                                         FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c
                                         WHERE u.user_id = c.user_id                                         WHERE u.user_id = c.user_id
Line 340: Line 350:
                                         AND u.username='%{user}'                                         AND u.username='%{user}'
                                         UNION                                          UNION 
-                                        SELECT '&quot; . $conf['defaultgroup'] . &quot;' as `group`+                                        SELECT '. $conf['defaultgroup'] . "' as `group`
                                         FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c                                         FROM ${table_prefix}groups AS g, ${table_prefix}users AS u, ${table_prefix}user_group c
                                         WHERE u.user_id = c.user_id                                         WHERE u.user_id = c.user_id
                                         AND g.group_id = c.group_id                                         AND g.group_id = c.group_id
-                                        AND u.username='%{user}'&quot;+                                        AND u.username='%{user}'"
-$conf['auth']['mysql']['getUsers'   = &quot;SELECT DISTINCT u.username AS user +$conf['auth']['mysql']['getUsers'   = "SELECT DISTINCT u.username AS user 
-                                        FROM ${table_prefix}users AS u&quot;;    +                                        FROM ${table_prefix}users AS u";    
                                                                                                                                                          
-$conf['auth']['mysql']['FilterLogin'] = &quot;u.username LIKE '%{user}'&quot;+$conf['auth']['mysql']['FilterLogin'] = "u.username LIKE '%{user}'"
-$conf['auth']['mysql']['FilterName'&quot;u.user_fullname LIKE '%{name}'&quot;+$conf['auth']['mysql']['FilterName'"u.user_fullname LIKE '%{name}'"
-$conf['auth']['mysql']['FilterEmail'] = &quot;u.user_email    LIKE '%{email}'&quot;+$conf['auth']['mysql']['FilterEmail'] = "u.user_email    LIKE '%{email}'"
-$conf['auth']['mysql']['FilterGroup'] = &quot;g.group_name    LIKE '%{group}'&quot;+$conf['auth']['mysql']['FilterGroup'] = "g.group_name    LIKE '%{group}'"
-$conf['auth']['mysql']['SortOrder'  &quot;ORDER BY u.username&quot;;+$conf['auth']['mysql']['SortOrder'  "ORDER BY u.username";
  
-//$conf['auth']['mysql']['addUser'    &quot;INSERT INTO ${table_prefix}users+//$conf['auth']['mysql']['addUser'    "INSERT INTO ${table_prefix}users
 //                                                (username, user_password, user_email, user_fullname) //                                                (username, user_password, user_email, user_fullname)
-//                                         VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')&quot;+//                                         VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')"
-//$conf['auth']['mysql']['addGroup'   = &quot;INSERT INTO ${table_prefix}groups (group_name) VALUES ('%{group}')&quot;+//$conf['auth']['mysql']['addGroup'   = "INSERT INTO ${table_prefix}groups (group_name) VALUES ('%{group}')"
-//$conf['auth']['mysql']['addUserGroup']= &quot;UPDATE ${table_prefix}users+//$conf['auth']['mysql']['addUserGroup']= "UPDATE ${table_prefix}users
 //                                            SET group_id=%{gid} //                                            SET group_id=%{gid}
-//                                          WHERE id='%{uid}'&quot;+//                                          WHERE id='%{uid}'"
-//$conf['auth']['mysql']['delGroup'   = &quot;DELETE FROM ${table_prefix}groups WHERE g_id='%{gid}'&quot;+//$conf['auth']['mysql']['delGroup'   = "DELETE FROM ${table_prefix}groups WHERE g_id='%{gid}'"
-//$conf['auth']['mysql']['getUserID'  &quot;SELECT id FROM ${table_prefix}users WHERE username='%{user}'&quot;+//$conf['auth']['mysql']['getUserID'  "SELECT id FROM ${table_prefix}users WHERE username='%{user}'"
-//$conf['auth']['mysql']['updateUser'&quot;UPDATE ${table_prefix}users SET&quot;+//$conf['auth']['mysql']['updateUser'"UPDATE ${table_prefix}users SET"
-//$conf['auth']['mysql']['UpdateLogin'] = &quot;username='%{user}'&quot;+//$conf['auth']['mysql']['UpdateLogin'] = "username='%{user}'"
-//$conf['auth']['mysql']['UpdatePass'&quot;password='%{pass}'&quot;+//$conf['auth']['mysql']['UpdatePass'"password='%{pass}'"
-//$conf['auth']['mysql']['UpdateEmail'] = &quot;email='%{email}'&quot;+//$conf['auth']['mysql']['UpdateEmail'] = "email='%{email}'"
-//$conf['auth']['mysql']['UpdateName'&quot;realname='%{name}'&quot;+//$conf['auth']['mysql']['UpdateName'"realname='%{name}'"
-//$conf['auth']['mysql']['UpdateTarget']= &quot;WHERE id=%{uid}&quot;+//$conf['auth']['mysql']['UpdateTarget']= "WHERE id=%{uid}"
-//$conf['auth']['mysql']['delUserGroup']= &quot;UPDATE ${table_prefix}users SET g_id=4 WHERE id=%{uid}&quot;+//$conf['auth']['mysql']['delUserGroup']= "UPDATE ${table_prefix}users SET g_id=4 WHERE id=%{uid}"
-$conf['auth']['mysql']['getGroupID'&quot;SELECT group_id AS id FROM ${table_prefix}groups WHERE group_name='%{group}'&quot;;+$conf['auth']['mysql']['getGroupID'"SELECT group_id AS id FROM ${table_prefix}groups WHERE group_name='%{group}'";
  
-//$conf['auth']['mysql']['TablesToLock']= array(&quot;${table_prefix}users&quot;&quot;${table_prefix}users AS u&quot;+//$conf['auth']['mysql']['TablesToLock']= array("${table_prefix}users""${table_prefix}users AS u"
-//                                              &quot;${table_prefix}groups&quot;&quot;${table_prefix}groups AS g&quot;);+//                                              "${table_prefix}groups""${table_prefix}groups AS g");
  
 //end see http://www.dokuwiki.org/tips:integrate_with_phpbb                                         //end see http://www.dokuwiki.org/tips:integrate_with_phpbb                                        
  
 /* /*
-    $conf['auth']['mysql']['checkPass'  &quot;SELECT u.password AS pass+    $conf['auth']['mysql']['checkPass'  "SELECT u.password AS pass
                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g
                                               WHERE u.group_id = g.g_id                                               WHERE u.group_id = g.g_id
                                                 AND u.username = '%{user}'                                                 AND u.username = '%{user}'
-                                                AND g.g_title   != 'Guest'&quot;+                                                AND g.g_title   != 'Guest'"
-    $conf['auth']['mysql']['getUserInfo'] = &quot;SELECT password AS pass, realname AS name, email AS mail,+    $conf['auth']['mysql']['getUserInfo'] = "SELECT password AS pass, realname AS name, email AS mail,
                                                     id, g_title as `group`                                                     id, g_title as `group`
                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g
                                               WHERE u.group_id = g.g_id                                               WHERE u.group_id = g.g_id
-                                                AND u.username = '%{user}'&quot;+                                                AND u.username = '%{user}'"
-    $conf['auth']['mysql']['getGroups'  &quot;SELECT g.g_title as `group`+    $conf['auth']['mysql']['getGroups'  "SELECT g.g_title as `group`
                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g
                                               WHERE u.group_id = g.g_id                                               WHERE u.group_id = g.g_id
-                                                AND u.username = '%{user}'&quot;;+                                                AND u.username = '%{user}'";
              
-    $conf['auth']['mysql']['getUsers'   = &quot;SELECT DISTINCT u.username AS user+    $conf['auth']['mysql']['getUsers'   = "SELECT DISTINCT u.username AS user
                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g                                                FROM ${table_prefix}users AS u, ${table_prefix}groups AS g
-                                              WHERE u.group_id = g.g_id&quot;;+                                              WHERE u.group_id = g.g_id";
  
-    $conf['auth']['mysql']['FilterLogin'] = &quot;u.username LIKE '%{user}'&quot;+    $conf['auth']['mysql']['FilterLogin'] = "u.username LIKE '%{user}'"
-    $conf['auth']['mysql']['FilterName'&quot;u.realname LIKE '%{name}'&quot;+    $conf['auth']['mysql']['FilterName'"u.realname LIKE '%{name}'"
-    $conf['auth']['mysql']['FilterEmail'] = &quot;u.email    LIKE '%{email}'&quot;+    $conf['auth']['mysql']['FilterEmail'] = "u.email    LIKE '%{email}'"
-    $conf['auth']['mysql']['FilterGroup'] = &quot;g.g_title    LIKE '%{group}'&quot;+    $conf['auth']['mysql']['FilterGroup'] = "g.g_title    LIKE '%{group}'"
-    $conf['auth']['mysql']['SortOrder'  &quot;ORDER BY u.username&quot;+    $conf['auth']['mysql']['SortOrder'  "ORDER BY u.username"
-    $conf['auth']['mysql']['addUser'    &quot;INSERT INTO ${table_prefix}users+    $conf['auth']['mysql']['addUser'    "INSERT INTO ${table_prefix}users
                                                     (username, password, email, realname)                                                     (username, password, email, realname)
-                                             VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')&quot;+                                             VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')"
-    $conf['auth']['mysql']['addGroup'   = &quot;INSERT INTO ${table_prefix}groups (g_title) VALUES ('%{group}')&quot;+    $conf['auth']['mysql']['addGroup'   = "INSERT INTO ${table_prefix}groups (g_title) VALUES ('%{group}')"
-    $conf['auth']['mysql']['addUserGroup']= &quot;UPDATE ${table_prefix}users+    $conf['auth']['mysql']['addUserGroup']= "UPDATE ${table_prefix}users
                                                 SET group_id=%{gid}                                                 SET group_id=%{gid}
-                                              WHERE id='%{uid}'&quot;+                                              WHERE id='%{uid}'"
-    $conf['auth']['mysql']['delGroup'   = &quot;DELETE FROM ${table_prefix}groups WHERE g_id='%{gid}'&quot;+    $conf['auth']['mysql']['delGroup'   = "DELETE FROM ${table_prefix}groups WHERE g_id='%{gid}'"
-    $conf['auth']['mysql']['getUserID'  &quot;SELECT id FROM ${table_prefix}users WHERE username='%{user}'&quot;+    $conf['auth']['mysql']['getUserID'  "SELECT id FROM ${table_prefix}users WHERE username='%{user}'"
-    $conf['auth']['mysql']['updateUser'&quot;UPDATE ${table_prefix}users SET&quot;+    $conf['auth']['mysql']['updateUser'"UPDATE ${table_prefix}users SET"
-    $conf['auth']['mysql']['UpdateLogin'] = &quot;username='%{user}'&quot;+    $conf['auth']['mysql']['UpdateLogin'] = "username='%{user}'"
-    $conf['auth']['mysql']['UpdatePass'&quot;password='%{pass}'&quot;+    $conf['auth']['mysql']['UpdatePass'"password='%{pass}'"
-    $conf['auth']['mysql']['UpdateEmail'] = &quot;email='%{email}'&quot;+    $conf['auth']['mysql']['UpdateEmail'] = "email='%{email}'"
-    $conf['auth']['mysql']['UpdateName'&quot;realname='%{name}'&quot;+    $conf['auth']['mysql']['UpdateName'"realname='%{name}'"
-    $conf['auth']['mysql']['UpdateTarget']= &quot;WHERE id=%{uid}&quot;+    $conf['auth']['mysql']['UpdateTarget']= "WHERE id=%{uid}"
-    $conf['auth']['mysql']['delUserGroup']= &quot;UPDATE ${table_prefix}users SET g_id=4 WHERE id=%{uid}&quot;+    $conf['auth']['mysql']['delUserGroup']= "UPDATE ${table_prefix}users SET g_id=4 WHERE id=%{uid}"
-    $conf['auth']['mysql']['getGroupID'&quot;SELECT g_id AS id FROM ${table_prefix}groups WHERE g_title='%{group}'&quot;;+    $conf['auth']['mysql']['getGroupID'"SELECT g_id AS id FROM ${table_prefix}groups WHERE g_title='%{group}'";
  
-    $conf['auth']['mysql']['TablesToLock']= array(&quot;${table_prefix}users&quot;&quot;${table_prefix}users AS u&quot;+    $conf['auth']['mysql']['TablesToLock']= array("${table_prefix}users""${table_prefix}users AS u"
-                                                  &quot;${table_prefix}groups&quot;&quot;${table_prefix}groups AS g&quot;);+                                                  "${table_prefix}groups""${table_prefix}groups AS g");
 */ */
  
     $conf['auth']['mysql']['debug'] = 1;     $conf['auth']['mysql']['debug'] = 1;
     // call mysql constructor     // call mysql constructor
-    $this-&gt;auth_mysql();+    $this->auth_mysql();
   }   }
  
Line 442: Line 452:
     // someone used the login form     // someone used the login form
     if(isset($user)){     if(isset($user)){
-      if($this-&gt;checkPass($user,$pass)){+      if($this->checkPass($user,$pass)){
         $expire = ($sticky) ? time() + 31536000 : 0;         $expire = ($sticky) ? time() + 31536000 : 0;
-        $uinfo  = $this-&gt;getUserData($user);+        $uinfo  = $this->getUserData($user);
         //pun_setcookie($uinfo['id'], auth_cryptPassword($pass), $expire);         //pun_setcookie($uinfo['id'], auth_cryptPassword($pass), $expire);
         setcookie($uinfo['id'], auth_cryptPassword($pass), $expire);         setcookie($uinfo['id'], auth_cryptPassword($pass), $expire);
Line 461: Line 471:
     }     }
  
-    if(isset($pun_user) &amp;&amp; !$pun_user['is_guest']){+    if(isset($pun_user) && !$pun_user['is_guest']){
       // okay we're logged in - set the globals       // okay we're logged in - set the globals
       $USERINFO['pass'] = $pun_user['password'];       $USERINFO['pass'] = $pun_user['password'];
Line 491: Line 501:
 //Setup VIM: ex: et ts=2 enc=utf-8 : //Setup VIM: ex: et ts=2 enc=utf-8 :
  
-&lt;/code&gt;+</code>
  
  --- //[[ynzheng@gmail.com|Yanni.Zheng]] 2006-06-12 11:58//  --- //[[ynzheng@gmail.com|Yanni.Zheng]] 2006-06-12 11:58//
Line 513: Line 523:
 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. 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 &quot;int/auth&quot; should be &quot;inc/auth&quot;. 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 &quot;inc/auth/phpbb.php&quot;, 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. +:!: It appears to me that "int/authshould 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// //- 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 &quot;require_once(DOKU_AUTH.'/basic.class.php');&quot; out, then the statement &quot;class auth_phpbb extends auth_basic&quot; 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...+:!: 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_basicfails, 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// //- Bill//
  
 It shouldent be too hard to get group support working, but I did not have a chance to get to it yet. It shouldent be too hard to get group support working, but I did not have a chance to get to it yet.
-&lt;code php&gt; +<code php> 
-&lt;?php+<?php
 /** /**
  * PHPBB authentication backend  * PHPBB authentication backend
Line 532: Line 542:
  
  
-define(&quot;IN_LOGIN&quot;, true);+define("IN_LOGIN", true);
 define('IN_PHPBB', true); define('IN_PHPBB', true);
 $phpbb_root_path = $location.'../phpBB2/'; $phpbb_root_path = $location.'../phpBB2/';
Line 559: Line 569:
     function auth_phpbb() {     function auth_phpbb() {
  global $user_ip;  global $user_ip;
-        $this-&gt;success = true; +        $this->success = true; 
- $this-&gt;cando['logoff'] = true; + $this->cando['logoff'] = true; 
- //$this-&gt;cando['getGroups'] = true; + //$this->cando['getGroups'] = true; 
- $this-&gt;cando['external'] = true;+ $this->cando['external'] = true;
  //  //
  // Set page ID for session management  // Set page ID for session management
  //  //
- $this-&gt;userdata = session_pagestart($user_ip, PAGE_LOGIN); + $this->userdata = session_pagestart($user_ip, PAGE_LOGIN); 
- init_userprefs($this-&gt;userdata);+ init_userprefs($this->userdata);
  //  //
  // End session management  // End session management
Line 575: Line 585:
  function trustExternal($user,$pass,$sticky=false){  function trustExternal($user,$pass,$sticky=false){
  $sticky ? $sticky = true : $sticky = false;  $sticky ? $sticky = true : $sticky = false;
- if($this-&gt;userdata['session_logged_in']) {+ if($this->userdata['session_logged_in']) {
  //already logged in...  //already logged in...
  } else {  } else {
- if(!$this-&gt;checkPass2($user,$pass,$sticky)) {+ if(!$this->checkPass2($user,$pass,$sticky)) {
  return;  return;
  }  }
  }  }
  global $USERINFO;  global $USERINFO;
- $USERINFO = $this-&gt;getUserData($this-&gt;userdata['username']);+ $USERINFO = $this->getUserData($this->userdata['username']);
  
- $_SERVER['REMOTE_USER'] = $this-&gt;userdata['username']; + $_SERVER['REMOTE_USER'] = $this->userdata['username']; 
- $_SESSION[$conf['title']]['auth']['user'] = $this-&gt;userdata['username']; + $_SESSION[$conf['title']]['auth']['user'] = $this->userdata['username']; 
- $_SESSION[$conf['title']]['auth']['pass'] = &quot;__&quot;;+ $_SESSION[$conf['title']]['auth']['pass'] = "__";
  $_SESSION[$conf['title']]['auth']['buid'] = auth_browseruid();  $_SESSION[$conf['title']]['auth']['buid'] = auth_browseruid();
  $_SESSION[$conf['title']]['auth']['info'] = $USERINFO;  $_SESSION[$conf['title']]['auth']['info'] = $USERINFO;
  /*var_dump($_SESSION[$conf['title']]['auth']);  /*var_dump($_SESSION[$conf['title']]['auth']);
- die(&quot;fff&quot;);*/+ die("fff");*/
  }  }
  
     function checkPass($user,$pass){     function checkPass($user,$pass){
- return($this-&gt;checkPass2($user,$pass,0));+ return($this->checkPass2($user,$pass,0));
  }  }
     function checkPass2($user,$pass,$auto){     function checkPass2($user,$pass,$auto){
Line 601: Line 611:
  global $db;  global $db;
   
- $sql = &quot;SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try + $sql = "SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try 
- FROM &quot; . USERS_TABLE . &quot; + FROM . USERS_TABLE . " 
- WHERE username = '&quot; . str_replace(&quot;\\'&quot;&quot;''&quot;, $user) . &quot;'&quot;+ WHERE username = '. str_replace("\\'""''", $user) . "'"
- if ( !($result = $db-&gt;sql_query($sql)) )+ if ( !($result = $db->sql_query($sql)) )
  {  {
  message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);  message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
  }  }
  
- if( $row = $db-&gt;sql_fetchrow($result) )+ if( $row = $db->sql_fetchrow($result) )
  {  {
- if( md5($pass) == $row['user_password'] &amp;&amp; $row['user_active'] ) {+ if( md5($pass) == $row['user_password'] && $row['user_active'] ) {
  
- $this-&gt;userdata = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $auto, 0);+ $this->userdata = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $auto, 0);
  
- if( !$this-&gt;userdata )+ if( !$this->userdata )
  {  {
- message_die(CRITICAL_ERROR, &quot;Couldn't start session : login&quot;&quot;&quot;, __LINE__, __FILE__);+ message_die(CRITICAL_ERROR, "Couldn't start session : login""", __LINE__, __FILE__);
  }  }
  return(true);  return(true);
Line 639: Line 649:
     function getUserData($user){     function getUserData($user){
  global $conf;  global $conf;
- if($this-&gt;userdata['session_logged_in']) {+ if($this->userdata['session_logged_in']) {
  global $db;  global $db;
  //ok, figure out what groups they are in  //ok, figure out what groups they are in
- $sql = &quot;SELECT g.group_name, ug.user_pending  + $sql = "SELECT g.group_name, ug.user_pending  
- FROM &quot; . GROUPS_TABLE . &quot; g, &quot; . USER_GROUP_TABLE . &quot; ug + FROM . GROUPS_TABLE . g, . USER_GROUP_TABLE . ug 
- WHERE ug.user_id = &quot; . $this-&gt;userdata['user_id'] . &quot;  + WHERE ug.user_id = . $this->userdata['user_id'] .  
  AND ug.group_id = g.group_id  AND ug.group_id = g.group_id
- AND g.group_single_user &lt;&gt; &quot; . TRUE . &quot; + AND g.group_single_user <> " . TRUE . " 
- ORDER BY g.group_name, ug.user_id&quot;+ ORDER BY g.group_name, ug.user_id"
- if ( !($result = $db-&gt;sql_query($sql)) )+ if ( !($result = $db->sql_query($sql)) )
  {  {
  message_die(GENERAL_ERROR, 'Error getting users group information', '', __LINE__, __FILE__, $sql);  message_die(GENERAL_ERROR, 'Error getting users group information', '', __LINE__, __FILE__, $sql);
  }  }
  $groups = array($conf['defaultgroup']);  $groups = array($conf['defaultgroup']);
- while( $row = $db-&gt;sql_fetchrow($result) ) {+ while( $row = $db->sql_fetchrow($result) ) {
  if(!$row['user_pending'])  if(!$row['user_pending'])
  $groups[] = $row['group_name'];  $groups[] = $row['group_name'];
  }  }
   
- return(array('name' =&gt; $user,  + return(array('name' =$user,  
- 'mail' =&gt; $this-&gt;userdata['user_email'],  + 'mail' =$this->userdata['user_email'],  
- 'grps' =&gt; $groups+ 'grps' =$groups
  )  )
     );     );
Line 668: Line 678:
   
  function logOff(){  function logOff(){
- if( $this-&gt;userdata['session_logged_in'] )+ if( $this->userdata['session_logged_in'] )
  {  {
- session_end($this-&gt;userdata['session_id'], $this-&gt;userdata['user_id']);+ session_end($this->userdata['session_id'], $this->userdata['user_id']);
  }  }
  }  }
Line 677: Line 687:
  I didnt get this working...  I didnt get this working...
  function retrieveGroups($start=0,$limit=0) {  function retrieveGroups($start=0,$limit=0) {
- die(&quot;hi g&quot;); + die("hi g"); 
- $sql = &quot;SELECT g.group_name  + $sql = "SELECT g.group_name  
- FROM &quot; . GROUPS_TABLE . &quot; + FROM . GROUPS_TABLE . 
- AND g.group_single_user &lt;&gt; &quot; . TRUE;+ AND g.group_single_user <> " . TRUE;
  if($limit != 0)  if($limit != 0)
- $sql = $sql . &quot; LIMIT $start,$limit&quot;+ $sql = $sql . LIMIT $start,$limit"
- if ( !($result = $db-&gt;sql_query($sql)) )+ if ( !($result = $db->sql_query($sql)) )
  {  {
  message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);  message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
  }  }
- $groups = array(&quot;User&quot;); + $groups = array("User"); 
- while( $row = $db-&gt;sql_fetchrow($result) ) {+ while( $row = $db->sql_fetchrow($result) ) {
  $groups[] = $row['group_name'];  $groups[] = $row['group_name'];
  }  }
Line 695: Line 705:
  
 } }
-&lt;/code&gt;+</code>
  --- //FatherNitwit 2006-7-14//  --- //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: 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:
-&lt;code php&gt;$location = '../../';&lt;/code&gt;+<code php>$location = '../../';</code>
 This is important to find the phpBB path. This is important to find the phpBB path.
  
Line 706: Line 716:
  
 Why not change the code to this? Why not change the code to this?
-&lt;code php&gt;+<code php>
 $location = DOKU_AUTH.'/../../'; //??? $location = DOKU_AUTH.'/../../'; //???
 $phpbb_root_path = $location.$conf['phpbb_path']; $phpbb_root_path = $location.$conf['phpbb_path'];
-&lt;/code&gt;+</code>
  
 Then set in dokuwiki.php Then set in dokuwiki.php
  
-&lt;code php&gt;+<code php>
 $conf['phpbb_path'] = '../phpBB'; //relative phpBB path $conf['phpbb_path'] = '../phpBB'; //relative phpBB path
-&lt;/code&gt;+</code>
  
 \\ \\
Line 722: Line 732:
 **Be careful!**\\ **Be careful!**\\
 Make sure, that ''register_globals'' is set to ''off''. This can be done in a .htaccess-File by Make sure, that ''register_globals'' is set to ''off''. This can be done in a .htaccess-File by
-&lt;code&gt;php_flag register_globals off&lt;/code&gt;+<code>php_flag register_globals off</code>
 Otherwise it can cause problems with automatically updating the searchindex!\\ Otherwise it can cause problems with automatically updating the searchindex!\\
 See [[http://forum.dokuwiki.org/thread/1895]] for problem description.\\ See [[http://forum.dokuwiki.org/thread/1895]] for problem description.\\
Line 731: Line 741:
 ===== Register and resend password links ===== ===== Register and resend password links =====
 Change the links in the inc/html.php file. Change the links in the inc/html.php file.
-&lt;code php&gt; +<code php> 
- &lt;?php + <?php 
-    if($auth-&gt;canDo('addUser') &amp;&amp; actionOK('register')){ +    if($auth->canDo('addUser') && actionOK('register')){ 
-      print '&lt;p&gt;';+      print '<p>';
       print $lang['reghere'];       print $lang['reghere'];
-      print ': &lt;a href=&quot;../phpbb/profile.php?mode=register&amp;agreed=true&quot; rel=&quot;nofollow&quot; class=&quot;wikilink1&quot;&gt;'.$lang['register'].'&lt;/a&gt;';+      print ': <a href="../phpbb/profile.php?mode=register&agreed=truerel="nofollowclass="wikilink1">'.$lang['register'].'</a>';
            
-      print '&lt;/p&gt;';+      print '</p>';
     }     }
  
-    if ($auth-&gt;canDo('modPass') &amp;&amp; actionOK('resendpwd')) { +    if ($auth->canDo('modPass') && actionOK('resendpwd')) { 
-      print '&lt;p&gt;';+      print '<p>';
       print $lang['pwdforget'];       print $lang['pwdforget'];
-      print ': &lt;a href=&quot;../phpbb/profile.php?mode=sendpassword&quot; rel=&quot;nofollow&quot; class=&quot;wikilink1&quot;&gt;'.$lang['btn_resendpwd'].'&lt;/a&gt;'; +      print ': <a href="../phpbb/profile.php?mode=sendpasswordrel="nofollowclass="wikilink1">'.$lang['btn_resendpwd'].'</a>'; 
-      print '&lt;/p&gt;';+      print '</p>';
     }     }
-  ?&gt; +  ?> 
-&lt;/code&gt;+</code>
  
  
Line 757: Line 767:
  
 Add the following setting to conf/local.php: Add the following setting to conf/local.php:
-&lt;code php&gt;$conf['passcrypt'   = 'phpbb';&lt;/code&gt;+<code php>$conf['passcrypt'   = 'phpbb';</code>
  
 The important changes to mysql.conf.php are: The important changes to mysql.conf.php are:
-&lt;code php&gt;+<code php>
 $conf['auth']['mysql']['forwardClearPass'] = 0; $conf['auth']['mysql']['forwardClearPass'] = 0;
  
-$conf['auth']['mysql']['checkPass'  &quot;SELECT user_password AS pass+$conf['auth']['mysql']['checkPass'  "SELECT user_password AS pass
                                          FROM phpbb_users                                          FROM phpbb_users
-                                         WHERE username='%{user}'&quot;+                                         WHERE username='%{user}'"
-&lt;/code&gt;+</code>
  
 You then need to add some code to 2 functions in inc/auth.php: You then need to add some code to 2 functions in inc/auth.php:
Line 772: Line 782:
 In the **auth_verifyPassword** function, add the following check. In the **auth_verifyPassword** function, add the following check.
  
-&lt;code php&gt;+<code php>
     }elseif (substr($crypt,0,3) == '$H$'){     }elseif (substr($crypt,0,3) == '$H$'){
      $method = 'phpbb';      $method = 'phpbb';
      $salt = $crypt;      $salt = $crypt;
-&lt;/code&gt;+</code>
  
 Then in the **auth_cryptPassword** function, add this case: Then in the **auth_cryptPassword** function, add this case:
-&lt;code php&gt;+<code php>
 case 'phpbb': case 'phpbb':
       $phpbb_path = '../forum/'; // this is the path to phpBB relative to your wiki       $phpbb_path = '../forum/'; // this is the path to phpBB relative to your wiki
Line 786: Line 796:
       $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';       $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
       return _hash_crypt_private($clear, $salt, $itoa64);       return _hash_crypt_private($clear, $salt, $itoa64);
-&lt;/code&gt;+</code>
 Be sure to change the $phpbb_path variable to your phpBB install directory! Be sure to change the $phpbb_path variable to your phpBB install directory!
  
Line 817: Line 827:
 $conf['authtype'] = 'phpbb'; Add it or change the existing one \\ $conf['authtype'] = 'phpbb'; Add it or change the existing one \\
 $conf['defaultgroup']= 'user'; This one has to be in sync with your existing group in phpBB \\ $conf['defaultgroup']= 'user'; This one has to be in sync with your existing group in phpBB \\
-$conf['superuser'] = '&lt;site admin&gt;'; The admin of the board. Additional superusers can be configured via config tool in the Dokuwiki \\+$conf['superuser'] = '<site admin>'; The admin of the board. Additional superusers can be configured via config tool in the Dokuwiki \\
 $conf['disableactions'] = 'register'; To stop registering via Dokuwiki, I just want new users to register via my phpBB board, got a self-made registering form \\ $conf['disableactions'] = 'register'; To stop registering via Dokuwiki, I just want new users to register via my phpBB board, got a self-made registering form \\
 $conf['openregister']= 0; No self-Registering allowed (Maybe obsolete because of disable register, did not try this) \\ $conf['openregister']= 0; No self-Registering allowed (Maybe obsolete because of disable register, did not try this) \\
Line 833: Line 843:
 After all a little right adjustment should be done via the config tool / rights management. My users (Group: User like the usergroup in phpBB) have the right to write in the namespace where the info files are stored and the board admins rights to manage every page. \\ After all a little right adjustment should be done via the config tool / rights management. My users (Group: User like the usergroup in phpBB) have the right to write in the namespace where the info files are stored and the board admins rights to manage every page. \\
 I created that on my local XAMPP installation and after successful testing I copied the changed files to the installation on my webspace. Now it runs like a charm. \\ I created that on my local XAMPP installation and after successful testing I copied the changed files to the installation on my webspace. Now it runs like a charm. \\
-Please drop a note if you got this to work. If not, too. ;-)  And a big &quot;THANK YOU&quot; goes out to FatherNitwit for creating the phpBB.Class. **by gonzo99**\\ \\+Please drop a note if you got this to work. If not, too. ;-)  And a big "THANK YOUgoes out to FatherNitwit for creating the phpBB.Class. **by gonzo99**\\ \\
  
-**@gonzo99 It worked! (phpBB 2.0.22 &amp; DokuWiki 2007-06-26b)**\\+**@gonzo99 It worked! (phpBB 2.0.22 & DokuWiki 2007-06-26b)**\\
 But I discovered one Problem yet:\\ But I discovered one Problem yet:\\
-When editing a page, if I try to use &quot;insert signature&quot;, there's always the signature of the old Admin (the one I defined when setting up DokuWiki) inserted. Any suggestions for solution?\\+When editing a page, if I try to use "insert signature", there's always the signature of the old Admin (the one I defined when setting up DokuWiki) inserted. Any suggestions for solution?\\
 But: **Many thanks to gonzo99!**\\ But: **Many thanks to gonzo99!**\\
  --- **berlindave** 2007-12-15 21:45  --- **berlindave** 2007-12-15 21:45
tips/integrate_with_phpbb.txt · Last modified: 2017-12-05 18:38 by LarsDW223