Webmastersite.net
Register Log In

e107 integration
Working on integrating WSN Gallery with e107 CMS

Comments on e107 integration

Ducnan Clarke
Member

Usergroup: Member
Joined: Dec 19, 2003
Location: Stoke, UK

Total Topics: 7
Total Comments: 20
Posted Oct 08, 2006 - 10:25 AM:

I have been looking at the integration tools. Here's what I know so far:

- e107 uses 1 cookie (default name = "e107cookie")

- cookie is in format id#.encpasswd where id# is obviouslty the user's id number, and encpasswd is the password in the database (text password having been run through md5) run through md5 again. Eg. if the text password was Password, then the database would contain dc647eb65e6711e155375218212b3964, and the cookie would contain b8498ee29e56e711a268ae8cc461ae94.

- the field in the database to determine if a user is valid (user_ban) uses 0 to show a user is valid, and 1 if they are not. This may be why I get 0 members listed, and errors show when I try to list users ( see http://urbanlines.net/gallery/memberlist.php?debug=1 ).

I have added the following integration code
<?php
$memberstable = 'ul_e107_user';

$newusergroup = 'user_class';
$newname = 'user_loginname';
$newid = 'user_id';
$newpassword = 'user_password';
$newemail = 'user_email';
$newtime = 'user_join';
$newip = 'user_ip';
$newvalidated = 'user_ban';
$newsignature = 'user_signature';
$newlocation = '';
$newbio = '';
$newhomepage = '';
$newoccupation = '';
$newaim = '';
$newmsn = '';
$newicq = '';
$newyahoo = '';
$newcustomtitle = 'user_customtitle';
$newinterests = '';
$newsalt = '';

$otherencoder = 'no';

$admingroup = '-1';
$group4 = '';
$group5 = '';

$idcookiename = 'e107cookie';
$passwordcookiename = '';
$cookietype = '';
$idindex = '';
$passwordindex = '';
$cookieidtype = '';

?>


Results so far are that it recognises when I put the correct username/password in (tells me if it's wrong) but then it still doesn't log me in. It creates 4 cookies:
- e107cookie (userid)
- wsnpass (password as in database)
- testcookie (userid)
- returnto (page I tried to log in from)

I'm a bit stuck on getting it to read/write the cookies. I'm guessing I need to add $cookietype = 'e107'; then edit classes/members.php to include an else if ($cookietype == "e107") section or 2, but not sure what or where.

Is this going to be a simple job, or will loads of complicated changes be needed?
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7867
Paul
Posted Oct 08, 2006 - 3:42 PM:

Replace
   else if ($cookietype == 'smf')
{
$both = unserialize(stripslashes($_COOKIE[$idcookiename]));
$id = $both[0];
$userpassword = $both[1];
}
with
   else if ($cookietype == 'smf')
{
$both = unserialize(stripslashes($_COOKIE[$idcookiename]));
$id = $both[0];
$userpassword = $both[1];
}
else if ($cookietype == 'e107')
{
$both = explode('.', $_COOKIE[$idcookiename]);
$id = $both[0];
$userpassword = md5($both[1]);
}


and that might work, though I'm not sure.

- the field in the database to determine if a user is valid (user_ban) uses 0 to show a user is valid, and 1 if they are not.

You'll have to not integrate that field.
Ducnan Clarke
Member

Usergroup: Member
Joined: Dec 19, 2003
Location: Stoke, UK

Total Topics: 7
Total Comments: 20
Posted Oct 08, 2006 - 4:47 PM:

Had a play with what you sent, and a bit of a rethink. I was thinking that I needed to allow users to log in via the gallery. Of course I can just direct them to the main site to log in and use the cookie created there to allow access to the gallery. D'oh!

Well, the changes required to allow integration to e107:

create an integration script integration/e107.php:
<?php 
$memberstable = 'ul_e107_user';

$newusergroup = 'user_class';
$newname = 'user_loginname';
$newid = 'user_id';
$newpassword = 'user_password';
$newemail = 'user_email';
$newtime = 'user_join';
$newip = 'user_ip';
$newvalidated = '';
$newsignature = 'user_signature';
$newlocation = '';
$newbio = '';
$newhomepage = '';
$newoccupation = '';
$newaim = '';
$newmsn = '';
$newicq = '';
$newyahoo = '';
$newcustomtitle = 'user_customtitle';
$newinterests = '';
$newsalt = '';

$otherencoder = 'no';

$admingroup = '-1';
$group4 = '';
$group5 = '';

$idcookiename = 'e107cookie';
$passwordcookiename = '';
$cookietype = '';
$idindex = '';
$passwordindex = '';
$cookieidtype = '';

?>


classes/members.php - replace
   else if ($cookietype == 'smf') 
{
$both = unserialize(stripslashes($_COOKIE[$idcookiename]));
$id = $both[0];
$userpassword = $both[1];
}
with
   else if ($cookietype == 'smf')
{
$both = unserialize(stripslashes($_COOKIE[$idcookiename]));
$id = $both[0];
$userpassword = $both[1];
}
else if ($cookietype == 'e107')
{
$both = explode('.', $_COOKIE[$idcookiename]);
$id = $both[0];
$userpassword = $both[1];
}


classes/members.php - replace
    if ($userpassword != $this->$newpassword) { $this ->id = 0; $this->name = ''; if ($newid) $this->$newid = 0; if ($newname) $this->$newname = ''; $this->$newpassword = ''; $this->usergroup = 1; $this->$newusergroup = 1; $skip = true; }
with
    if ((($cookietype != 'e107') && ($userpassword != $this->$newpassword)) || (($cookietype == 'e107') && ($userpassword != md5($this->$newpassword)))) { $this->id = 0; $this->name = ''; if ($newid) $this->$newid = 0; if ($newname) $this->$newname = ''; $this->$newpassword = ''; $this->usergroup = 1; $this->$newusergroup = 1; $skip = true; }


Also worth taking out all login username/password forms from the gallery template you're using and redirect guests to the e107 login page. That's the bit I'm going to do next as I'm going to be able to design a template that fits nicely inside the CMS page.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7867
Paul
Posted Oct 08, 2006 - 7:46 PM:

Thanks, I've included those changes for the next release.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.