•  » Requests
  •  » Bridging and multi-user suggestion.

#31 2013-02-05 18:08:47

flop25
Piwigo Team
2006-07-06
7037

Re: Bridging and multi-user suggestion.

$conf['password_verify'] = 'pwg_password_verify';=> so create custom function by plugin?


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#32 2013-02-05 18:15:39

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: Bridging and multi-user suggestion.

that's one of the new functions in 2.5 (I didn't check which parameters they take)

in 2.4 there is only one function ($conf['pass_convert']) which take only one parameter (the clear password)

Offline

 

#33 2013-02-05 18:16:34

flop25
Piwigo Team
2006-07-06
7037

Re: Bridging and multi-user suggestion.

mistic100 wrote:

that's one of the new functions in 2.5 (I didn't check which parameters they take)

:/ yep that's what I've just seen


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#34 2013-02-05 19:31:03

Greybrow
Translation Team
1970-01-01
12

Re: Bridging and multi-user suggestion.

is there any documentation or examples how to use it?

Offline

 

#35 2013-02-06 15:46:22

thecorfiot
Member
2011-05-24
21

Re: Bridging and multi-user suggestion.

Hi all,

I can't believe that I got so near, yet so far from a solution!

Am I to understand that when version 2.5 hits the streets, this might become more feasible? I note that RC1 is available.

I really believe that integrating these application would be a benefit to them.

(If we could also upload from Darktable straight to Piwigo I could die a happy man! ;))

Bob

Offline

 

#36 2013-02-15 18:45:31

thecorfiot
Member
2011-05-24
21

Re: Bridging and multi-user suggestion.

Anyone?

Offline

 

#37 2013-04-05 17:19:21

kalotina
Guest

Re: Bridging and multi-user suggestion.

Hi there!!!

I install "Register phpbb" plugin. When i try to follow the first step i take this message:

Warning:  [mysql error 1146] Table '*******_piwig73.phpbb_users' doesn't exist

SELECT username, user_id
FROM phpbb_users
WHERE user_id = 2
; in /home/*******/*******/*******/include/dblayer/functions_mysqli.inc.php on line 813


Fatal error: Call to a member function fetch_assoc() on a non-object in /home/***my website**/**my forum*****/piwigo/include/dblayer/functions_mysqli.inc.php on line 160

Can help me?

 

#38 2013-04-06 16:06:59

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: Bridging and multi-user suggestion.

kalotina wrote:

Hi there!!!

Please, avoif multi-posting and see my request here : http://piwigo.org/forum/viewtopic.php?p … 85#p141985

Offline

 

#39 2014-07-08 00:36:04

Greybrow
Translation Team
1970-01-01
12

Re: Bridging and multi-user suggestion.

Is there anything new happening with smf bridging?

Offline

 

#40 2014-10-29 02:10:11

Greybrow
Translation Team
1970-01-01
12

Re: Bridging and multi-user suggestion.

With help of friend we managed to make Piwigo login with smf users.

code in local/config/config.inc.php

Code:

<?php
// All informations contained in these tables and column are related to
// piwigo_users table.
$conf['users_table'] = 'smf_members';

// If you decide to use external authentication
// change conf below by $conf['external_authentification'] = true;
$conf['external_authentification'] = true;

// user_fields : mapping between generic field names and table specific
// field names. For example, in PWG, the mail address is names
// "mail_address" and in punbb, it's called "email".
$conf['user_fields'] = array(
  'id' => 'id_member',
  'username' => 'member_name',
  'password' => 'passwd',
  'email' => 'email_address'
  );

// Password convert method to use for SMF members database
$conf['pass_convert'] = create_function('$a', 'return sha1($a);');
?>

Change in include/functions_user.inc.php
Before:

Code:

function pwg_password_verify($password, $hash, $user_id=null)
{
  global $conf, $pwg_hasher;

  // If the password has not been hashed with the current algorithm.
  if (strpos($hash, '$P') !== 0)
  {
    if (!empty($conf['pass_convert']))
    {
      $check = ($hash == $conf['pass_convert']($password));
    }

changed to:

Code:

include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 
function pwg_password_verify($password, $hash, $user_id=null)
{
  global $conf, $pwg_hasher;

  // If the password has not been hashed with the current algorithm.
  if (strpos($hash, '$P') !== 0)
  {
    if (!empty($conf['pass_convert']))
    {
      $username = get_username($user_id);
      $check = ($hash == $conf['pass_convert'](strtolower($username).$password));
    }

Log in works, but when trying to manage users in admin section I get:

DataTables warning (table id = 'userList'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.

When I remove the config.inc.php (bringing back the piwigo users table) the list works fine.

I did try to recreate it on fresh local installation of smf and Piwigo, and it works, so it must be something with my users database.
It has currently 5666 users in it.

What should I do to check/correct it?

Below is the sql export for the table. I've cut all records but one and it still shows the error.
login/pass smf_admin/piwigo123

Code:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

CREATE TABLE IF NOT EXISTS `smf_members` (
`id_member` mediumint(8) unsigned NOT NULL,
  `member_name` varchar(80) NOT NULL DEFAULT '',
  `date_registered` int(10) unsigned NOT NULL DEFAULT '0',
  `posts` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `id_group` smallint(5) unsigned NOT NULL DEFAULT '0',
  `lngfile` varchar(255) NOT NULL DEFAULT '',
  `last_login` int(10) unsigned NOT NULL DEFAULT '0',
  `real_name` varchar(255) NOT NULL DEFAULT '',
  `instant_messages` smallint(5) NOT NULL DEFAULT '0',
  `unread_messages` smallint(5) NOT NULL DEFAULT '0',
  `new_pm` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `buddy_list` text NOT NULL,
  `pm_ignore_list` varchar(255) NOT NULL DEFAULT '',
  `pm_prefs` mediumint(8) NOT NULL DEFAULT '0',
  `mod_prefs` varchar(20) NOT NULL DEFAULT '',
  `message_labels` text NOT NULL,
  `passwd` varchar(64) NOT NULL DEFAULT '',
  `openid_uri` text NOT NULL,
  `email_address` varchar(255) NOT NULL DEFAULT '',
  `personal_text` varchar(255) NOT NULL DEFAULT '',
  `gender` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `birthdate` date NOT NULL DEFAULT '0001-01-01',
  `website_title` varchar(255) NOT NULL DEFAULT '',
  `website_url` varchar(255) NOT NULL DEFAULT '',
  `location` varchar(255) NOT NULL DEFAULT '',
  `icq` varchar(255) NOT NULL DEFAULT '',
  `aim` varchar(255) NOT NULL DEFAULT '',
  `yim` varchar(32) NOT NULL DEFAULT '',
  `msn` varchar(255) NOT NULL DEFAULT '',
  `hide_email` tinyint(4) NOT NULL DEFAULT '0',
  `show_online` tinyint(4) NOT NULL DEFAULT '1',
  `time_format` varchar(80) NOT NULL DEFAULT '',
  `signature` text NOT NULL,
  `time_offset` float NOT NULL DEFAULT '0',
  `avatar` varchar(255) NOT NULL DEFAULT '',
  `pm_email_notify` tinyint(4) NOT NULL DEFAULT '0',
  `karma_bad` smallint(5) unsigned NOT NULL DEFAULT '0',
  `karma_good` smallint(5) unsigned NOT NULL DEFAULT '0',
  `usertitle` varchar(255) NOT NULL DEFAULT '',
  `notify_announcements` tinyint(4) NOT NULL DEFAULT '1',
  `notify_regularity` tinyint(4) NOT NULL DEFAULT '1',
  `notify_send_body` tinyint(4) NOT NULL DEFAULT '0',
  `notify_types` tinyint(4) NOT NULL DEFAULT '2',
  `member_ip` varchar(255) NOT NULL DEFAULT '',
  `member_ip2` varchar(255) NOT NULL DEFAULT '',
  `secret_question` varchar(255) NOT NULL DEFAULT '',
  `secret_answer` varchar(64) NOT NULL DEFAULT '',
  `id_theme` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `is_activated` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `validation_code` varchar(10) NOT NULL DEFAULT '',
  `id_msg_last_visit` int(10) unsigned NOT NULL DEFAULT '0',
  `additional_groups` varchar(255) NOT NULL DEFAULT '',
  `smiley_set` varchar(48) NOT NULL DEFAULT '',
  `id_post_group` smallint(5) unsigned NOT NULL DEFAULT '0',
  `total_time_logged_in` int(10) unsigned NOT NULL DEFAULT '0',
  `password_salt` varchar(255) NOT NULL DEFAULT '',
  `ignore_boards` text NOT NULL,
  `warning` tinyint(4) NOT NULL DEFAULT '0',
  `passwd_flood` varchar(12) NOT NULL DEFAULT '',
  `pm_receive_from` tinyint(4) unsigned NOT NULL DEFAULT '1',
  `thank_you_post_made` mediumint(8) NOT NULL DEFAULT '0',
  `thank_you_post_became` mediumint(8) NOT NULL DEFAULT '0',
  `last_thank_you_time` int(10) NOT NULL DEFAULT '0',
  `is_spammer` tinyint(3) NOT NULL DEFAULT '0',
  `bpm` int(11) unsigned NOT NULL DEFAULT '0',
  `gold` int(11) unsigned NOT NULL DEFAULT '100',
  `is_dead` int(11) unsigned NOT NULL DEFAULT '0',
  `battle_last` int(10) unsigned NOT NULL DEFAULT '0',
  `stat_point` int(11) unsigned NOT NULL DEFAULT '0',
  `lastupdate` int(11) unsigned NOT NULL DEFAULT '0',
  `atk` int(11) unsigned NOT NULL DEFAULT '100',
  `max_atk` int(11) unsigned NOT NULL DEFAULT '100',
  `def` int(11) unsigned NOT NULL DEFAULT '100',
  `max_def` int(11) unsigned NOT NULL DEFAULT '100',
  `energy` int(11) unsigned NOT NULL DEFAULT '100',
  `max_energy` int(11) unsigned NOT NULL DEFAULT '100',
  `stamina` int(11) unsigned NOT NULL DEFAULT '100',
  `max_stamina` int(11) unsigned NOT NULL DEFAULT '100',
  `hp` int(11) unsigned NOT NULL DEFAULT '100',
  `max_hp` int(11) unsigned NOT NULL DEFAULT '100',
  `exp` int(11) unsigned NOT NULL DEFAULT '0',
  `max_exp` int(11) unsigned NOT NULL DEFAULT '0',
  `level` int(11) unsigned NOT NULL DEFAULT '0',
  `mem_slays` int(11) unsigned NOT NULL DEFAULT '0',
  `battle_only_buddies_shout` int(11) unsigned NOT NULL DEFAULT '0',
  `mon_slays` int(11) unsigned NOT NULL DEFAULT '0',
  `battle_points` bigint(11) unsigned NOT NULL DEFAULT '0',
  `breeze_profile_views` text NOT NULL,
  `email_mentions` tinyint(4) NOT NULL DEFAULT '0',
  `unread_mentions` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;


INSERT INTO `smf2old_members` (`id_member`, `member_name`, `date_registered`, `posts`, `id_group`, `lngfile`, `last_login`, `real_name`, `instant_messages`, `unread_messages`, `new_pm`, `buddy_list`, `pm_ignore_list`, `pm_prefs`, `mod_prefs`, `message_labels`, `passwd`, `openid_uri`, `email_address`, `personal_text`, `gender`, `birthdate`, `website_title`, `website_url`, `location`, `icq`, `aim`, `yim`, `msn`, `hide_email`, `show_online`, `time_format`, `signature`, `time_offset`, `avatar`, `pm_email_notify`, `karma_bad`, `karma_good`, `usertitle`, `notify_announcements`, `notify_regularity`, `notify_send_body`, `notify_types`, `member_ip`, `member_ip2`, `secret_question`, `secret_answer`, `id_theme`, `is_activated`, `validation_code`, `id_msg_last_visit`, `additional_groups`, `smiley_set`, `id_post_group`, `total_time_logged_in`, `password_salt`, `ignore_boards`, `warning`, `passwd_flood`, `pm_receive_from`, `thank_you_post_made`, `thank_you_post_became`, `last_thank_you_time`, `is_spammer`, `bpm`, `gold`, `is_dead`, `battle_last`, `stat_point`, `lastupdate`, `atk`, `max_atk`, `def`, `max_def`, `energy`, `max_energy`, `stamina`, `max_stamina`, `hp`, `max_hp`, `exp`, `max_exp`, `level`, `mem_slays`, `battle_only_buddies_shout`, `mon_slays`, `battle_points`, `breeze_profile_views`, `email_mentions`, `unread_mentions`) VALUES
(1, 'smf_admin', 1332431432, 0, 0, 'polish-utf8', 1332786884, 'admin', 2, 2, 1, '', '', 0, '', '', 'f867686080cb906ea950a6676e46d2e85129458b', '', 'dummyemail@example.com', '', 0, '0001-01-01', '', '', '', '', '', '', '', 1, 0, '', '', -1, '', 1, 0, 0, '', 1, 1, 1, 2, '127.0.0.1', '127.0.0.1', '', '', 0, 1, 'aaaaaaa', 110, '1', '', 4, 16733, '9b45', '', 0, '1390812964|3', 1, 0, 0, 0, 0, 0, 1100, 1, 0, 0, 0, 90, 100, 87, 100, 100, 100, 100, 100, 0, 100, 0, 0, 0, 0, 0, 0, 0, '', 0, 0),
(2, 'piwigoguest', 1332431432, 0, 0, 'polish-utf8', 1332786884, 'guest', 2, 2, 1, '', '', 0, '', '', 'f867686080cb906ea950a6676e46d2e85129458b', '', 'dummyemail@example.com', '', 0, '0001-01-01', '', '', '', '', '', '', '', 1, 0, '', '', -1, '', 1, 0, 0, '', 1, 1, 1, 2, '127.0.0.1', '127.0.0.1', '', '', 0, 1, 'aaaaaaa', 110, '1', '', 4, 16733, '9b45', '', 0, '1390812964|3', 1, 0, 0, 0, 0, 0, 1100, 1, 0, 0, 0, 90, 100, 87, 100, 100, 100, 100, 100, 0, 100, 0, 0, 0, 0, 0, 0, 0, '', 0, 0);


--
-- Indexes for table `smf_members`
--
ALTER TABLE `smf_members`
 ADD PRIMARY KEY (`id_member`), ADD KEY `member_name` (`member_name`), ADD KEY `real_name` (`real_name`), ADD KEY `date_registered` (`date_registered`), ADD KEY `id_group` (`id_group`), ADD KEY `birthdate` (`birthdate`), ADD KEY `posts` (`posts`), ADD KEY `last_login` (`last_login`), ADD KEY `lngfile` (`lngfile`(30)), ADD KEY `id_post_group` (`id_post_group`), ADD KEY `warning` (`warning`), ADD KEY `total_time_logged_in` (`total_time_logged_in`), ADD KEY `id_theme` (`id_theme`);

Last edited by Greybrow (2014-10-29 02:50:18)

Offline

 

#41 2014-10-29 09:32:11

flop25
Piwigo Team
2006-07-06
7037

Re: Bridging and multi-user suggestion.

What the ..!
the local config provides a clean and correct way to change the name of the function which will be used, so why are you changing the core files to change pwg_password_verify()

I notify plg about your issue on the user list


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#42 2014-10-29 10:30:02

Greybrow
Translation Team
1970-01-01
12

Re: Bridging and multi-user suggestion.

Thanks, that's good news.
Could you please show me where to look how to use this function?
I couldn't make it work with the way smf makes hash, that is sha1 from username.password, as it takes only password as parameter,  so I did change core file.

Offline

 

#43 2014-10-29 11:48:46

flop25
Piwigo Team
2006-07-06
7037

Re: Bridging and multi-user suggestion.

you have
// password_hash: function hash the clear user password to store it in the
// database. The function takes only one parameter: the clear password.
$conf['password_hash'] = 'pwg_password_hash';

// password_verify: function that checks the password against its hash. The
// function takes 2 mandatory parameter : clear password, hashed password +
// an optional parameter user_id. The user_id is used to update the password
// with the new hash introduced in Piwigo 2.5. See function
// pwg_password_verify in include/functions_user.inc.php
$conf['password_verify'] = 'pwg_password_verify';

so you can define custom function, especially the pwg_password_verify one you've changed


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#44 2014-11-02 21:43:23

Greybrow
Translation Team
1970-01-01
12

Re: Bridging and multi-user suggestion.

Thank for the great tip.

I've cut all useless code in external verification mode, and added parts of get_username:

Code:

$conf['password_verify'] = create_function('$password,$hash,$user_id','global $conf;$result = pwg_query(\'SELECT \'.$conf[\'user_fields\'][\'username\'].\' FROM \'.USERS_TABLE.\' WHERE \'.$conf[\'user_fields\'][\'id\'].\' = \'.intval($user_id).\';\');list($username) = pwg_db_fetch_row($result);$username = stripslashes($username);if ($hash == sha1(strtolower($username).$password)) return true;');

And it works :D

While looking into code searching for password_verify, I found in /password.php:

Code:

    if (pwg_password_verify($key, $row['activation_key']))

Shouldn't it probably be replaced with?

Code:

    if ($conf['password_verify']($key, $row['activation_key']))

I also found out what causes the JSON error.
It's the 'level' field in smf table. When removed from smf table the error disappears.
But I don't know the solution :/

Offline

 

#45 2014-11-02 21:54:44

flop25
Piwigo Team
2006-07-06
7037

Re: Bridging and multi-user suggestion.

thx could you post on http://piwigo.org/bugs/main_page.php ?
piwigo use a level column in piwigo_user_infos, but as far as i know it shouldn't mess with the (piwigo|smf)_users table... or is that level field the only complementary column compared to the piwigo_users table


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 
  •  » Requests
  •  » Bridging and multi-user suggestion.

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact