WebmasterSite.net: PHP scripts to enable your creativity
WSN Links PHP Directory Software
PHP Scripts Webmaster Links Support Forums


e107 integration
Working on integrating WSN Gallery with e107 CMS

Version: 2.3.7
printPrint


e107 integration
Ducnan Clarke
Member
Avatar

Usergroup: Member
Joined: Dec 19, 2003
Location: Stoke, UK
Total Topics: 7
Total Posts: 20
Posted 10/08/06 - 10:25 AM:
quote post
#1
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?

_____________________
See my galleries at
- http://urbanlines.net
- http://bugrunners.co.uk
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 55
Total Posts: 5703
Posted 10/08/06 - 03:42 PM:
quote post
#2
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
Avatar

Usergroup: Member
Joined: Dec 19, 2003
Location: Stoke, UK
Total Topics: 7
Total Posts: 20
Posted 10/08/06 - 04:47 PM:
quote post
#3
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.

Edited by Ducnan Clarke on 10/08/06 - 04:49 PM

_____________________
See my galleries at
- http://urbanlines.net
- http://bugrunners.co.uk
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 55
Total Posts: 5703
Posted 10/08/06 - 07:46 PM:
quote post
#4
Thanks, I've included those changes for the next release.
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

   
 
© 2008 Paul Knierim. All rights reserved.