Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2009-12-15 16:14:17

sagar
Member
From: USA
Registered: 2008-07-26
Posts: 49

DokuWiki + Flux1.4 Integration

Can anyone please share this integration script/mod?

Thanks smile


cheers...sagar

Offline

#2 2009-12-15 17:04:25

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

I don't have it at hand right now, but I can probably post it tonight...


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#3 2009-12-15 17:31:17

sagar
Member
From: USA
Registered: 2008-07-26
Posts: 49

Re: DokuWiki + Flux1.4 Integration

That would be great. thanks Lie smile


cheers...sagar

Offline

#4 2009-12-15 22:47:43

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

This might not be perfect or totally clean yet, but it works.

<?php
/**
 * FluxBB auth backend
 *
 * Uses external Trust mechanism to check against FluxBB's
 * user cookie. FluxBB's PUN_ROOT must be defined correctly.
 *
 * @author    Andreas Gohr <andi@splitbrain.org>
 */

require_once DOKU_INC.'inc/auth/mysql.class.php';

#dbg($GLOBALS);
#dbg($forum_user);

class auth_fluxbb_v1_4 extends auth_mysql {

  /**
   * Constructor.
   *
   * Sets additional capabilities and config strings
   */
  function auth_fluxbb_v1_4(){
    global $conf;
    $this->cando['external'] = true;

    $conf['passcrypt'] = 'sha1';

    // get global vars from fluxbb config
    global $db_host;
    global $db_name;
    global $db_username;
    global $db_password;
    global $db_prefix;

    // now set up the mysql config strings
    $conf['auth']['mysql']['server']   = $db_host;
    $conf['auth']['mysql']['user']     = $db_username;
    $conf['auth']['mysql']['password'] = $db_password;
    $conf['auth']['mysql']['database'] = $db_name;

    $conf['auth']['mysql']['checkPass']   = "SELECT u.password AS pass
                                               FROM ${db_prefix}users AS u, ${db_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 ${db_prefix}users AS u, ${db_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 ${db_prefix}users AS u, ${db_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 ${db_prefix}users AS u, ${db_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 ${db_prefix}users
                                                    (username, password, email, realname)
                                             VALUES ('%{user}', '%{pass}', '%{email}', '%{name}')";
    $conf['auth']['mysql']['addGroup']    = "INSERT INTO ${db_prefix}groups (g_title) VALUES ('%{group}')";
    $conf['auth']['mysql']['addUserGroup']= "UPDATE ${db_prefix}users
                                                SET group_id=%{gid}
                                              WHERE id='%{uid}'";
    $conf['auth']['mysql']['delGroup']    = "DELETE FROM ${db_prefix}groups WHERE g_id='%{gid}'";
    $conf['auth']['mysql']['getUserID']   = "SELECT id FROM ${db_prefix}users WHERE username='%{user}'";
    $conf['auth']['mysql']['updateUser']  = "UPDATE ${db_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 ${db_prefix}users SET g_id=4 WHERE id=%{uid}";
    $conf['auth']['mysql']['getGroupID']  = "SELECT g_id AS id FROM ${db_prefix}groups WHERE g_title='%{group}'";

    $conf['auth']['mysql']['TablesToLock']= array("${db_prefix}users", "${db_prefix}users AS u",
                                                  "${db_prefix}groups", "${db_prefix}groups AS g");

    $conf['auth']['mysql']['debug'] = 1;
    // call mysql constructor
    parent::__construct();
  }

  /**
   * Just checks against the $forum_user variable
   */
  function trustExternal($user,$pass,$sticky=false){
    global $USERINFO;
    global $conf;
    global $lang;
    global $pun_user;
    global $pun_config;
    global $cookie_name;
    $sticky ? $sticky = true : $sticky = false; //sanity check

    if(isset($pun_user) && !$pun_user['is_guest']){
      // okay we're logged in - set the globals
      $USERINFO['pass'] = $pun_user['password'];
      $USERINFO['name'] = utf8_encode($pun_user['realname']);
      $USERINFO['mail'] = $pun_user['email'];
      $USERINFO['grps'] = array($pun_user['g_title']);
      if ($pun_user['is_admmod'])
        $USERINFO['grps'][] = 'admin';

      $_SERVER['REMOTE_USER'] = utf8_decode($pun_user['username']);
      $_SESSION[DOKU_COOKIE]['auth']['user'] = $pun_user['username'];
      $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
      return true;
    }

    // to be sure
    auth_logoff();

    $USERINFO['grps'] = array();
    return false;
  }
}
//Setup VIM: ex: et ts=2 enc=utf-8 :

Note: This has to be stored inc <dokuwiki_folder>/inc/auth/fluxbb_v1_4.class.php.

EDIT: Updated parent constructor call for the "Adora Belle" release.

Last edited by Franz (2012-10-16 08:15:48)


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#5 2009-12-15 23:14:16

sagar
Member
From: USA
Registered: 2008-07-26
Posts: 49

Re: DokuWiki + Flux1.4 Integration

Could you please explain a bit? I copied the file and stored in the location you mentioned. But nothing is happening, still have to login separately for flux and wiki


cheers...sagar

Offline

#6 2009-12-15 23:25:11

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

In your DokuWiki configuration file (probably <dokuwiki_folder>/conf/local.php, you have to set

$conf['authtype']

to

fluxbb_v1_4

It is possible that you can do this somewhere in the administration console, too.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#7 2010-02-26 14:14:13

quaker
Member
From: USA
Registered: 2008-05-09
Posts: 89
Website

Re: DokuWiki + Flux1.4 Integration

lie2815 wrote:

In your DokuWiki configuration file (probably <dokuwiki_folder>/conf/local.php, you have to set

$conf['authtype']

to

fluxbb_v1_4

It is possible that you can do this somewhere in the administration console, too.


so it would read?

$conf['fluxbb_v1_4']

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Offline

#8 2010-02-26 14:43:33

Smartys
Former Developer
Registered: 2008-04-27
Posts: 3,139
Website

Re: DokuWiki + Flux1.4 Integration

No, you set the value, not the key.

Offline

#9 2010-02-26 14:47:10

quaker
Member
From: USA
Registered: 2008-05-09
Posts: 89
Website

Re: DokuWiki + Flux1.4 Integration

ok Thank you smartys...

Q


My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Offline

#10 2010-05-13 20:47:09

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

Hi, I was trying this out and I am having some trouble.

I copied your file to the proper place, and I have set in local.php:

$conf['useacl'] = 1;
$conf['authtype'] = 'fluxbb_v1_4';

additionally, I have created the file local.protect.php with the following in it:

<?php
define('PUN_ROOT', '/home/boxofspoons/www/fluxbb/');

but docuwiki displays the following errors:

MySQL err: insufficient configuration. [mysql.class.php:54]
User authentication is temporarily unavailable. If this situation persists, please inform your Wiki Admin.

Any help?

Last edited by Hellfire (2010-05-13 20:48:41)

Offline

#11 2010-05-13 20:55:14

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

You need to add this line to local.protect.php (never heard of that file by the way):

include PUN_ROOT.'include/common.php';

fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#12 2010-05-13 21:04:22

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

Holy cow that was fast, posted ~5 minutes ago.

in case you didn't know, in dokuwiki local.protected.php is the same as local.php the difference being that local.php is edited by the GUI interface and thus is overwritten anytime anything is changed. This means that anything you put in there that doesn't have a GUI option will be erased if you edit any GUI settings. local.protect.php is the same thing, but allows for manual override.

Since there is a GUI option for $conf['authtype'] I left it in there, but there is no gui support for the defines and includes needed, so to protect them I put them in local.protected.php

Anyway, thanks for the help, it appears to work.

Offline

#13 2010-05-13 21:08:13

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

Uh, good point. We might want to consider that, too.

Is it local.protect.php or local.protected.php, though?


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#14 2010-05-13 21:10:00

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

sorry: local.protected.php

For other peoples benefit the following may also be of use:

since fluxbb by default has administrators as "Administrators" you may wish to change dokuwiki:

$conf['superuser'] = '@admin,@Administrator';

Also, Fluxbb uses "Member" for default user group and dokuwiki uses "user" so you may wish to set:

$conf['defaultgroup'] = 'Member';

Both of these can also be done in the GUI

Last edited by Hellfire (2010-05-13 21:10:37)

Offline

#15 2010-05-13 21:42:42

Cyclone103
Member
From: Antarctica
Registered: 2008-10-10
Posts: 46
Website

Re: DokuWiki + Flux1.4 Integration

DokuWiki has too many problems for me to try to integrate it sad

Offline

#16 2010-05-13 21:43:49

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

Curious: what problems? I am moving to it from MediaWiki which I feel is too heavy for what I need.

Offline

#17 2010-05-13 23:01:39

Cyclone103
Member
From: Antarctica
Registered: 2008-10-10
Posts: 46
Website

Re: DokuWiki + Flux1.4 Integration

Screenshot

I had this issue a while ago. It seemed as though all buttons were not showing any sort of text.

It also created login/logout issues.

Offline

#18 2010-06-21 18:08:04

François
Member
From: Lyon (France)
Registered: 2009-09-01
Posts: 197
Website

Re: DokuWiki + Flux1.4 Integration

Thanks for the code, it works fine smile

Juste one thing in the file fluxbb_v1_4.class.php : there is not need of "utf8_encode" and "utf8_decode". I had to remove them because the "ç" made mistakes. It works all fine without those utf8 functions wink


Sorry for my English, I'm French

Offline

#19 2010-06-22 00:22:23

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

Has anyone done any work porting the FluxBB Air theme to dokuwiki? Also, what is the best way to integrate the two in terms of making into appear to be a single website so that switching between wiki and forum is relatively seamless (kind of like it is here on fluxbb.org)? Would embedding them into <div>'s be the way to go?

Offline

#20 2010-06-22 21:52:09

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

The <div> stuff is a start, though you might better want to hear an expert? Is the "port" we have here enough? It does have the same colours like Air wink

Last edited by Franz (2010-06-22 21:52:17)


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#21 2010-06-22 23:52:44

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

Yes, I would like something similar to fluxbb.org, at least as a base and could modify it as necessary from there. Is the source code/theme available?

Offline

#22 2010-06-23 02:13:08

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

Also, I think it would be AMAZING if someone made a mod for fluxbb that allowed the insertion of dokuwiki snippets (like segments from a dokuwiki install that would be dynamic to always reflect the wiki).

Offline

#23 2010-06-23 11:20:24

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,590
Website

Re: DokuWiki + Flux1.4 Integration

If you send me a mail, I can send you the package next week.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#24 2010-06-24 21:08:54

oli_v_ier
Member
Registered: 2008-09-21
Posts: 39

Re: DokuWiki + Flux1.4 Integration

Hello,

I have a bug when I try this integration: the style of the wiki disappears.

10062403104943910.jpg

I'm testing it on a local server and with the default configuration of dokuwiki and fluxBB 1.4.0 .

Somebody have an idea to solve the problem ?

Offline

#25 2010-06-26 19:43:13

Hellfire
Member
Registered: 2010-04-21
Posts: 18

Re: DokuWiki + Flux1.4 Integration

I had a similar problem, but it wasn't caused by the integration. I found that if you move dokuwiki (say from /www/iamtestingmynewwiki to /www/wiki) some of the stuff gets messed up. Maybe there is a baseurl setting somewhere that needs to be fixed?

Offline

Board footer

Powered by FluxBB