Piwigo Bugtracker

Piwigo bug tracker has moved to Github

This bugtracker is kept to provide history on old issues.


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003169Piwigoauthenticationpublic2014.11.02 22:072014.11.02 22:07
ReporterGreybrow 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version2.7.1 
Target VersionFixed in Version 
Summary0003169: When using external authentication JSON fails when external users table has field named level
DescriptionWhen using external authentication JSON fails with:
[quote]
DataTables warning (table id = 'userList'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
[/quote]
when external users table has field named 'level'.
Steps To Reproducecreate config.inc.php in /local/config/
[code]
<?php
// All informations contained in these tables and column are related to
// piwigo_users table.
$conf['users_table'] = 'smf2old_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_verify: function that checks the password against its hash.
$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;');
?>
[/code]
import this sql:
[code]
CREATE TABLE IF NOT EXISTS `smf2old_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;

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 `smf2old_members`
--
ALTER TABLE `smf2old_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`);
[/code]

login with
smf_admin/piwigo123

go to administration/users/manage or http://localhost/piwigo/admin.php?page=user_list [^]
Additional InformationRead this topic: http://piwigo.org/forum/viewtopic.php?pid=155622#p155622 [^]
TagsNo tags attached.
browserany
Database engine and version
PHP version
Web serverApache 1.3.x
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2014.11.02 22:07 Greybrow New Issue
2014.11.02 22:07 Greybrow browser => any
2014.11.02 22:07 Greybrow Web server => Apache 1.3.x


Copyright © 2000 - 2018 MantisBT Team
Contact
Powered by Mantis Bugtracker