DIPOrgOS

DIPOrgOS Forums
It is currently 29 Jul 2010 23:21

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Only some users migrated
PostPosted: 25 Feb 2010 12:46 
Offline

Joined: 25 Feb 2010 12:40
Posts: 2
Hi,

I downloaded and tried the latest release t1 version of this mod. I can't find any links or documentation for the mod besides this forum.

I have installed a new latest version (as of 23/02/2010) of E107 CMS and then have installed this e107bb release. I wish to use the PHPBB3 login and registration, but have the users authenticated on the e107 portal. It would seem that on installation only 1/3 of all my user base was copied across from the PHPBB3 to the e107. I want all new users to register via the PHPBB3 registration page and then login to the portal and phpbb3 portion with that login. Is this possible and if so how do I go about doing it?

As an additional request, is it possible to have a box that edits the title of the login box for the e107bb within the admin area?

I am brand new to both this CMS and this mod, I have been looking for a CMS that is well integrated with PHPBB3 and this was recommended to me.


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 25 Feb 2010 22:27 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
It seems for some reason e107bb didn't ask you to run the post installation script:

Open this in your website: e107_plugins/e107bb/admin_install.php and click on continue. You should wait until it says e107bb was sucessfully installed.

And sorry, i don't really understand your second question about the login box :(


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 26 Feb 2010 12:17 
Offline

Joined: 25 Feb 2010 12:40
Posts: 2
Hi,

I tried the older 3.0.1 version and it worked for me then mostly the way I wanted it to - except for the registration process. But I have seen in your update for this 3.1 version that you have removed the phpBB authentication method and included the registration process. If I use the 3.1, will I still be able to authenticate via the phpBB3 and be logged in to both?

My requirements:
Have existing PHPBB3 board, new e107
Use authentication from PHPBB3 - users are taken from there/duplicated into e107 user tables with no need for user intervention/action
Registration is done via PHPBB3, but new users behave same way as existing PHPBB3 users.

Are all the above features possible with 3.1.t1 ? Or are some only available in 3.0.1 ?





The login box question relates to:

The box on my homepage says 'e107bb' with the following options in it: phpBB Admin Area
Edit Profile
0 new message(s), 0 unread message(s)

I want to be able to edit these names to say something else, is this possible and where would I edit such a thing - or could it be built into the control panel like I have seen with some other mods?


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 26 Feb 2010 19:13 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
Do not use e107bb 3.0.1. The way the phpBB Authentication Mode works is bad and it stops working when you are not expecting such thing.

e107bb 3.1.t1 works with existing phpBB3 board and new e107 without using the phpBB authentication mode, so your users are handled by e107 and register in e107.

As I already explained, you don't need phpBB Auth mode (and you shouldn't be using it anyway). If you upgrade to e107bb 3.1.t1 and run the full setup, everything will work. (If you any problem, I will help :) )

To edit that box, change the English language file and replace the text.


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 02 Mar 2010 08:18 
Offline

Joined: 02 Mar 2010 08:08
Posts: 7
Why when transfer users from phpBB to e107 put in password field "phpbb" They cannot loggin in in that situation, it's nonsense. Why don't transfer phpBB password into e107 user when transfer non existing users ?


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 02 Mar 2010 18:26 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
Actually it makes sense: They can login, but you must have e107bb installed.
e107 doesn't support the phpBB password hash system, so when e107bb detects a user with the "phpbb" tag it uses the phpbb functions to check the password and then store a e107 compatible password. (md5)

There is no better way to do it. If you know any, I'll implement it.
(The e107bb 3.0.1 approach is less stable and also requires a phpBB users table to work properly.)


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 02 Mar 2010 21:05 
Offline

Joined: 02 Mar 2010 08:08
Posts: 7
Yah I understand how it works 10x.


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 03 Mar 2010 11:54 
Offline

Joined: 02 Mar 2010 08:08
Posts: 7
I got this error when i install plugin into my site. (Test install was on local.)

Code:
General Error
SQL ERROR [ mysql4 ]

Unknown column 'loginname' in 'where clause' [1054]

An sql error occurred while fetching this page. Please contact an administrator if this problem persists.


What i have to do, anyone?


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 03 Mar 2010 21:50 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
Replace the file in phpbbfolder/includes/auth/auth_e107.php with this:
Code:
<?php
/**
* e107 auth plug-in for phpBB3
* e107bb 3.0 (http://www.diporg.com)
*
* Based on auth_apache.php file:
* Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
*
* @package login
* @version $Id: auth_apache.php,v 1.18 2007/10/05 12:42:06 acydburn Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

/**
* Checks whether the user is identified to e107
* Only allow changing authentication to e107 if the user is identified
* Called in acp_board while setting authentication plugins
*
* @return boolean|string false if the user is identified and else an error message
*/
function init_e107()
{

   if (!defined('e107_INIT'))
   {
      return "e107 was not loaded. You must use the e107bb plugin to use this page.";
   }
   return false;
}

/**
* Login function
*/
function login_e107($username, $password)
{
   global $db, $sql;

   if (!defined('e107_INIT'))
   {
      return array(
         'status'      => LOGIN_ERROR,
         'error_msg'      => "e107 was not loaded.",
         'user_row'      => array('user_id' => ANONYMOUS),
      );
   }

   //Login user at e107
   if(!USER)
   {
      e107_require_once(e_HANDLER."login.php");
      //Currently there is only a hack for autologin, and we don't want that
      $usr = new userlogin($username, $password, 0);
      if(defined("LOGINMESSAGE")) {
         return array(
            'status'   => LOGIN_ERROR_USERNAME,
            'error_msg'   => 'LOGIN_ERROR_USERNAME',
            'user_row'   => array('user_id' => ANONYMOUS),
         );
      }
   }

   //e107bb 3.0.2: Fetch user details using e107 sql class
   $sql->db_Select('user', 'user_id, user_loginname, user_password', "user_id = '".USERID."'");
   $row = $sql->db_Fetch();
   if ($row)
   {
      $e107_auth_user = $row['user_loginname'];
      $e107_auth_pw = $row['user_password'];
   }
   unset($row);

   //If we have an user and password
   if (!empty($e107_auth_user) && !empty($e107_auth_pw))
   {
      //If this is true, something is really wrong
      if ($e107_auth_user !== $username)
      {
         return array(
            'status'   => LOGIN_ERROR_USERNAME,
            'error_msg'   => 'LOGIN_ERROR_USERNAME',
            'user_row'   => array('user_id' => ANONYMOUS),
         );
      }

      //Fetch phpBB details of the user
      $bbsql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
         FROM ' . USERS_TABLE . "
         WHERE ".get_field_e107()." = '" . $db->sql_escape($e107_auth_user) . "'";
      $result = $db->sql_query($bbsql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      //If true, then the user exists
      if ($row)
      {
         // User inactive...
         if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
         {
            return array(
               'status'      => LOGIN_ERROR_ACTIVE,
               'error_msg'      => 'ACTIVE_ERROR',
               'user_row'      => $row,
            );
         }
   
         // Successful login...
         return array(
            'status'      => LOGIN_SUCCESS,
            'error_msg'      => false,
            'user_row'      => $row,
         );
      }

      // this is the user's first login so create an empty profile
      return array(
         'status'      => LOGIN_SUCCESS_CREATE_PROFILE,
         'error_msg'      => false,
         'user_row'      => user_row_e107($e107_auth_user, $e107_auth_pw),
      );
   }

   // Not logged into e107
   return array(
      'status'      => LOGIN_ERROR_EXTERNAL_AUTH,
      'error_msg'      => "GENERAL_ERROR",
      'user_row'      => array('user_id' => ANONYMOUS),
   );
}

/**
* Autologin function
*
* @return array containing the user row or empty if no auto login should take place
*/
function autologin_e107()
{
   global $db, $sql;

   if(!defined("MISC_E107")) { misc_e107(); }

   if (!USER)
   {
      return array();
   }

   //e107bb 3.0.2: Fetch user details using e107 sql class
   $sql->db_Select('user', '*', "user_id = '".USERID."'");
   $row = $sql->db_Fetch();
   if ($row)
   {
      $e107_auth_user = $row['user_loginname'];
      $dispname = $row['user_name'];
      $e107_auth_pw = $row['user_password'];
      $e107_email = $row['user_email'];
   }
   unset($row);

   if (!empty($e107_auth_user) && !empty($e107_auth_pw))
   {
      set_var($e107_auth_user, $e107_auth_user, 'string', true);
      set_var($e107_auth_pw, $e107_auth_pw, 'string');

      $bbsql = 'SELECT *
         FROM ' . USERS_TABLE . "
         WHERE ".get_field_e107()." = '" . $db->sql_escape($e107_auth_user) . "'";
      $result = $db->sql_query($bbsql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      if ($row)
      {

         if(get_field_e107() === "loginname") {
            $bbsql = 'UPDATE ' . USERS_TABLE . " SET `username` = '".$db->sql_escape($dispname)."',
            `username_clean` = '".$db->sql_escape(utf8_clean_string($dispname))."' WHERE `user_id` = ".$row['user_id']." LIMIT 1 ";
            $db->sql_query($bbsql);
         }

         return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row;
      }

      if (!function_exists('user_add'))
      {
         global $phpbb_root_path, $phpEx;

         include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
      }

      // create the user if he does not exist yet
      user_add(user_row_e107($e107_auth_user, $e107_auth_pw, $e107_email, $dispname));

      $bbsql = 'SELECT *
         FROM ' . USERS_TABLE . "
         WHERE ".get_field_e107()."_clean = '" . $db->sql_escape(utf8_clean_string($e107_auth_user)) . "'";
      $result = $db->sql_query($bbsql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      if ($row)
      {
         return $row;
      }
   }

   return array();
}

/**
* This function generates an array which can be passed to the user_add function in order to create a user
*/
function user_row_e107($username, $password, $email, $dispname)
{
   global $db, $config, $user;
   // first retrieve default group id
   $sql = 'SELECT group_id
      FROM ' . GROUPS_TABLE . "
      WHERE group_name = '" . $db->sql_escape('REGISTERED') . "'
         AND group_type = " . GROUP_SPECIAL;
   $result = $db->sql_query($sql);
   $row = $db->sql_fetchrow($result);
   $db->sql_freeresult($result);

   if (!$row)
   {
      trigger_error('NO_GROUP');
   }

   // generate user account data
   if(get_field_e107() === "loginname") {
   return array(
      'loginname'       => $username,
      'username'       => $dispname,
      'user_password'   => $password,
      'user_email'   => $email,
      'group_id'      => (int) $row['group_id'],
      'user_type'      => USER_NORMAL,
      'user_ip'      => $user->ip,
   );
   } else {
   return array(
      'username'      => $username,
      'user_password'   => $password,
      'user_email'   => $email,
      'group_id'      => (int) $row['group_id'],
      'user_type'      => USER_NORMAL,
      'user_ip'      => $user->ip,
   );
   }
}

/**
* The session validation function checks whether the user is still logged in
*
* @return boolean true if the given user is authenticated or false if the session should be closed
*/
function validate_session_e107(&$user)
{
global $db, $sql;

   if(!defined("MISC_E107")) { misc_e107(); }
   
   //If user is off on both systems
   if (!USER && $user['username'] === "Anonymous")
   {
      return true;
   //If user is off only at e107
   } else if (!USER)
   {
      return false;
   }

   $e107_auth_user = '';

   //e107bb 3.0.2: For e107 stuff, use e107 mysql classes
   $sql->db_Select('user', '*', "user_id = '".USERID."'");
   $row = $sql->db_Fetch();
   if ($row)
   {
      $e107_auth_user = $row['user_loginname'];
      $dispname = $row['user_name'];
   }

   if(get_field_e107() === "loginname") {

      if(($dispname !== $user['username']) && ($e107_auth_user === $user['loginname'])) {   -
         $bbsql = 'UPDATE ' . USERS_TABLE . " SET `username` = '".$db->sql_escape($dispname)."',
         `username_clean` = '".$db->sql_escape(utf8_clean_string($dispname))."' WHERE `user_id` = ".$user['user_id']." LIMIT 1 ";
         $db->sql_query($bbsql);
      }
      return ($e107_auth_user === $user['loginname']) ? true : false;

   } else {
      return ($e107_auth_user === $user['username']) ? true : false;
   }


}

function logout_e107()
{
$redir = SITEURL."index.php?logout";
redirect($redir);
}

/**
* This function is called to do misc things on e107.
*/
function misc_e107() {
   global $phpbb_hook;

   //e107bb 3.1: Do not allow remind/register modes:
   if(isset($_REQUEST['mode']) && $_REQUEST['mode'] == "register") {
      $redir = SITEURL."signup.php";
      redirect($redir);
   } elseif (isset($_REQUEST['mode']) && $_REQUEST['mode'] == "sendpassword") {
      $redir = SITEURL."fpw.php";
      redirect($redir);
   }
   //Hook Template
   $phpbb_hook->register(array('template','display'), 'bb_e107_header');
   $phpbb_hook->register('append_sid', 'fix_amp_e107');

   //This function should only be called once
   define("MISC_E107",true);
}

function get_field_e107() {
   return "username";
}

function fix_amp_e107(&$hooks, $url, $params = false, $is_amp = true, $session_id = false) {
   global $phpbb_hook;
   //This must be the most ugly hack ever made
   //But hey, it works...
   $hook_temp = $phpbb_hook;
   $phpbb_hook = "";
   $result = append_sid($url, $params, $is_amp, $session_id);
   $phpbb_hook = $hook_temp;
   unset($hook_temp);

   $result = str_replace("?amp;", "?",$result);
   $result = str_replace("&amp;", "&",$result);
   $result = str_replace("amp;", "&",$result);
   return $result;
}

?>



I'm sure it will fix your problem. If you could help me with some debugging I would appreciate it to fix the problem for future versions.
Please run this sql command in phpMyAdmin or similar:
Code:
SHOW COLUMNS FROM phpbb_users LIKE  'loginname'

What is the output?

Thank you


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 03 Mar 2010 22:45 
Offline

Joined: 02 Mar 2010 08:08
Posts: 7
Thank you! This fix the problem.


Maybe prefix is the problem here. When i run the query i get this error:

Code:
#1146 - Table 'adv_db.phpbb_users' doesn't exist


My prefix for forum is phpbb3_. You can use $table_prefix in forumdir/config.php if that is the problem. But strange is that i already install plugin on my local host. First time I get this error that I post already and I was tinkling I did something wrong when I try to install "Separate Login and User Name phpBB MOD" module. So i upload again all my files and when install e107pp It was okay.

P.S By the way I also wasn't asked to run the post installation script. When i install it was shot this:

Quote:
e107bb Installed!
Your phpBB board was sucessfully integrated with e107!
Go to the e107bb Administration Panel if you need Theme Integration.

e107bb Administration Panel


May be it will be good to put a link to post installation script in this message.


Last edited by HeBuguM on 03 Mar 2010 22:57, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 03 Mar 2010 22:51 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
It's something related to that mod.

What do you get when you run this?
Code:
SHOW COLUMNS FROM phpbb3_users LIKE  'loginname'


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 04 Mar 2010 01:02 
Offline

Joined: 02 Mar 2010 08:08
Posts: 7
Code:
Your SQL query has been executed successfully (Query took 0.0001 sec)


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 04 Mar 2010 18:26 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
Ok, thank you :)


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 04 Mar 2010 22:02 
Offline

Joined: 02 Mar 2010 08:08
Posts: 7
Another big problem. When i install module my forum style is horrible. It's like zoomed, fonts are so big and its very bad. When i uninstall module everything it's OK. Why is that?

This problem is only in IE. There is a BOM in front of source and IE cannot read correctly after him i think.


Top
 Profile  
 
 Post subject: Re: Only some users migrated
PostPosted: 05 Mar 2010 21:25 
Offline
Site Admin

Joined: 07 Nov 2006 16:22
Posts: 811
Please try to replace e107bb/e_module.php file with this:
Code:
<?php
/*
+---------------------------------------------------------------+
|        e107bb 3.1
|        DIPOrg (suporte@diporg.com)
|        http://www.diporg.com
|
|        Plugin for e107 (http://e107.org)
|
|        Released under the terms and conditions of the
|        GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/

/* Default variables of phpbb */
if(isset($pref['e107bb_url'])) {
/* e107bb 3.0.t3 - Updated old bad way to get url*/
/* e107bb 3.0.0 - Updated path to avoid input errors.*/
$phpBBpath = "./".$pref['e107bb_url']."/";
define('PHPBB_PATH', e_BASE.$phpBBpath);

if(file_exists(PHPBB_PATH)) {

/* Get phpBB3 database prefix */
require(PHPBB_PATH."config.php");
$phpBBsqlprefix = $table_prefix;
define('PHPBB_PREFIX', $phpBBsqlprefix);

define('E107BB_VERSION', $pref['e107bb_version']);

//define('E107BB_AUTHTYPE', $pref['e107bb_bbauthtype']);

/*this is not unset, but it works*/
//$phpBBpath = "";
$dbpasswd = "";
$table_prefix = "";
$phpBBsqlprefix = "";
} else {
//echo "<h1>phpBB could not be found at ".PHPBB_PATH."!</h1> Please fix this error.<br/>";
}
}

// e107bb 3.1: For phpBB only users
if (isset($_POST['userlogin']) || isset($_POST['userlogin_x'])) {
   if($sql->db_Select("user", "user_loginname", "user_loginname = '".$tp -> toDB(trim($_POST['username']))."' AND user_password = 'phpbb'")) {
      require_once (e_PLUGIN."e107bb/bbfunctions.php");
      $sql->db_Select_gen("SELECT user_password FROM ".PHPBB_PREFIX."users  WHERE username='".$tp -> toDB(trim($_POST['username']))."' LIMIT 1");
      while($row = $sql -> db_Fetch()) {
         if(e107_phpbb_check_hash(trim($_POST['userpass']), $row['user_password']) === true) {
            $sql->db_Update("user", "user_password='".md5(trim($_POST['userpass']))."' WHERE user_loginname='".$tp -> toDB(trim($_POST['username']))."' LIMIT 1");
         }
      }
   }
}

?>


This will disable completely the ability to use theme integration. If you still have the problem after this, try a different e107 and phpBB theme to be sure it's e107bb fault. I'll check all the e107bb files and save them without BOM in the next release.

Thank you for your report


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
URL Optimization by phpBB SEO