Topic: FluxBB Wiki

Hi all,

We have a wiki, which is currently lacking in content, if anyone wants to help out and add any missing pages (or improve current ones), that would be great smile

http://fluxbb.org/wiki/

Re: FluxBB Wiki

Oh, it uses the FluxBB user database? Sweet. smile

Re: FluxBB Wiki

Connor,

Did you have to do something to Doku's PunBB authentication layer to work with the 1.3 code?

Bert Garcia - When all you have is a keyboard

Re: FluxBB Wiki

Yeh, but Smartys did it not me, I assume he used http://punbb.informer.com/forums/viewto … 53#p113853 but I don't know, I'm sure he'll give details when he reads this smile

Re: FluxBB Wiki

Exactly what I did, although I called the auth scheme fluxbb rather than punbb to avoid any issues when upgrading. I also went through and made the punbb -> fluxbb variable name, etc changes.
I'll post up the code if anyone is interested: however, I think it can certainly be written much more cleanly (as I mentioned in that post).

Re: FluxBB Wiki

Smartys,

Yes, if you could post the code somewhere, here or the wiki, then I could point Andi of DokuWiki towards it.

Thanks.

Bert Garcia - When all you have is a keyboard

Re: FluxBB Wiki

Sweet, thanks smile

I called it fluxbb.class.php (and as I said, I think I removed the dependency on auth_mysql, I just didn't know enough about dokuwiki to actually touch anything other than the FluxBB code).

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

if(!defined('FORUM_ROOT')) define('FORUM_ROOT', DOKU_INC.'../forums/');
define('FORUM_DISABLE_CSRF_CONFIRM', 1);
require_once FORUM_ROOT.'include/common.php';
require_once DOKU_INC.'inc/auth/mysql.class.php';

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

class auth_fluxbb extends auth_mysql {

  /**
   * Constructor.
   *
   * Sets additional capabilities and config strings
   */
  function auth_fluxbb(){
    global $conf;
    $this->cando['external'] = true;
    $this->cando['logoff']   = 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
    $this->auth_mysql();
  }

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

    // someone used the login form
    if(!empty($user)){
      authenticate_user($user, $pass);
      if (!$forum_user['is_guest']){
        $expire = ($forum_user['save_pass'] == '1') ? time() + 31536000 : 0;
        forum_setcookie($cookie_name, base64_encode($forum_user['id'].'|'.$forum_user['password']), $expire);
      }else{
        //invalid credentials - log off
        msg($lang['badlogin'],-1);
        auth_logoff();
        return false;
      }
    }

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

      $_SERVER['REMOTE_USER'] = $forum_user['username'];
      $_SESSION[DOKU_COOKIE]['auth']['user'] = $forum_user['username'];
      $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
      return true;
    }

    // to be sure
    auth_logoff();
    return false;
  }

  /**
   * remove fluxbb cookie on logout
   */
  function logOff(){
    global $forum_user;
    global $cookie_name;
    $forum_user = array();
    $forum_user['is_guest'] = true;
    forum_setcookie($cookie_name, base64_encode('1|'.random_key(8, true)), time() + 31536000);
  }
}
//Setup VIM: ex: et ts=2 enc=utf-8 :

Re: FluxBB Wiki

Smartys wrote:

Sweet, thanks smile

When FluxBB is officially announced, I'll contact Andi.

Thanks.

Bert Garcia - When all you have is a keyboard

Re: FluxBB Wiki

Trac has a built-in wiki. Why not use that?

I'm posting on FORUMS!

Re: FluxBB Wiki

This is a really nice template for Doku:

http://www.chimeric.de/projects/dokuwik … ate/arctic

Bert Garcia - When all you have is a keyboard

Re: FluxBB Wiki

Adam wrote:

Trac has a built-in wiki. Why not use that?

Because integration is a huge hassle.

Re: FluxBB Wiki

I'm not an expert on Doku, but it doesn't seem to handle internationalization. That could be an issue.

If a separate wiki is installed for each locale support sub-site, does it support transwiki link like MediaWiki does?

Re: FluxBB Wiki

Jérémie wrote:

I'm not an expert on Doku, but it doesn't seem to handle internationalization. That could be an issue.

If a separate wiki is installed for each locale support sub-site, does it support transwiki link like MediaWiki does?

Theres a translation plugin, i think it uses namespaces for the different languages see http://wiki.splitbrain.org/wiki:translation

Re: FluxBB Wiki

Connor: Good idea, I'll install that plugin now

Re: FluxBB Wiki

And done, you'll need to do a hard refresh (Ctrl-F5) to reload the stylesheets though. Otherwise, it looks odd.
If anyone has a language they would like to add, please suggest it here: we need to manually add languages to the selector. I've taken the liberty of adding French to start with. wink

Re: FluxBB Wiki

Swedish which will keep Kristoffer busy.

The only thing worse than finding a bug is knowing I created it in the first place.

Re: FluxBB Wiki

Added as well

18

Re: FluxBB Wiki

Finnish, I'll be handling that.

Re: FluxBB Wiki

btw, the french is in french, but the swedish strings are still english :S

Re: FluxBB Wiki

Because Swedish is apparently sv, not se. Google lied to me. tongue

Re: FluxBB Wiki

Fixed, and added Finnish

Re: FluxBB Wiki

I can do Dutch if needed.

Ben
SVN repository for my extensions - The thread
Quickmarks 0.5
“Question: How does a large software project get to be one year late? Answer: One day at a time!” - Fred Brooks

Re: FluxBB Wiki

Smartys wrote:

Because Swedish is apparently sv, not se. Google lied to me. tongue

Thats because Swedish people say it like "Svedan" tongue

Re: FluxBB Wiki

Dutch added
And bah, Google was wrong, I thought it was SV tongue

Re: FluxBB Wiki

Oh, and please make sure your links are correct. For example:

start
becomes
nl:start
fr:start
etc

and links to v1.2:installation become
nl:v1.2:installation
fr:v1.2:installation
etc