phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Wiki and phpBB2?


 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Tue Dec 08, 2009 7:30 pm 
Post subject: Wiki and phpBB2?

Does anybody have a working Wiki/phpBB2 integration (shared user accounts, maybe subSilver-like style)?

/Holger
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Dec 09, 2009 6:58 am 
Post subject: Re: Wiki and phpBB2?

DokuWiki is super easy to integrate with phpBB2. You need to do the template work yourself and add wiki link yourself, but user integration couldn't be more straightforward and easy. I'm using the "Another phpbb.class.php" version further down the page..
_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 7:58 am 
Post subject: Re: Wiki and phpBB2?

Thank you!
I also found an integration of Mediawiki ...
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Dec 09, 2009 8:22 am 
Post subject: Re: Wiki and phpBB2?

The MediaWiki integration is poor, because it doesn't login to wiki when logged in to forum and vice versa. It also has problems with some accounts.
_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 8:24 am 
Post subject: Re: Wiki and phpBB2?

Ok! I will give DokuWiki a try!
Thanks!
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 9:07 am 
Post subject: Re: Wiki and phpBB2?

Is "Another phpbb.class.php" the only thing I need?
http://www.dokuwiki.org/tips:integrate_with_phpbb#phpbbclassphp

Sorry, I am a little bit confused.

/Holger
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Dec 09, 2009 9:28 am 
Post subject: Re: Wiki and phpBB2?

This is my file in dokuwiki/inc/auth/phpbb.class.php:
Code:
<?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 = '/home/user/public_html/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;
  }*/

}


You need to change the $phpbb_root_path = '/home/user/public_html/phpBB2/'; to your full phpBB2 path, this is the most reliable method.

Then, once you have the file in place, you simply need to make DokuWiki use this authentication method.

_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 9:34 am 
Post subject: Re: Wiki and phpBB2?

Cool! Works!
Buttttttttttttt ... I cannot access the admin-interface any more ...

And what about the logout-button. Is that without function now?

Sorry to bother you with these questions!
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Dec 09, 2009 12:14 pm 
Post subject: Re: Wiki and phpBB2?

Hmm, I don't currently have login/logout on my integration, so the login works only via forum. It is a thing to add though, but I don't have a code for that at the moment. However, I think you should have access to $userdata variable in the template, so you should be able to use it to produce login/logout link.

For me the admin panel seems a bit unnecessary as you can simply edit the configuration files.

_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 12:26 pm 
Post subject: Re: Wiki and phpBB2?

Ok, it is no problem for to not have access to the Wiki-ACP.
And I will delete the Lougout-button.
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 1:10 pm 
Post subject: Re: Wiki and phpBB2?

I suppose I have to make all settings in dokuwiki.php
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Wed Dec 09, 2009 1:22 pm 
Post subject: Re: Wiki and phpBB2?

Hmm, I guess they recommend using local.php for overriding settings, but yeah, I've done all the modifications to dokuwiki.php.
_________________
Comboa Twitter
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 1:30 pm 
Post subject: Re: Wiki and phpBB2?

Ok, maybe local.php is overriding dokuwiki.php?

I deleted the Logout button in /lib/tpl/default/main.php:
Code:
      <div class="bar-right" id="bar__bottomright">
        <?php tpl_button('subscribe')?>
        <?php tpl_button('subscribens')?>
        <?php tpl_button('admin')?>
        <?php tpl_button('profile')?>
<!--        <?php tpl_button('login')?> -->
        <?php tpl_button('index')?>
        <?php tpl_button('top')?>&nbsp;
      </div>
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Dec 09, 2009 1:40 pm 
Post subject: Re: Wiki and phpBB2?

One more question though!
How do I define the superadmin?
Because, as it is now I think all members, me included, are normal Wikiuser.
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Jan 27, 2010 9:32 am 
Post subject: Re: Wiki and phpBB2?

Hi there, I am not THAT satisfied with DokuWiki icon_redface.gif

Any other ideas?
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0301 seconds using 15 queries. (SQL 0.0020 Parse 0.0010 Other 0.0271)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo