When 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 reproduce: create 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;
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Reported by Greybrow on 2 Nov 2014 21:07
Version: 2.7.1
When 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 reproduce: create 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_membermediumint(8) unsigned NOT NULL,member_namevarchar(80) NOT NULL DEFAULT '',date_registeredint(10) unsigned NOT NULL DEFAULT '0',postsmediumint(8) unsigned NOT NULL DEFAULT '0',id_groupsmallint(5) unsigned NOT NULL DEFAULT '0',lngfilevarchar(255) NOT NULL DEFAULT '',last_loginint(10) unsigned NOT NULL DEFAULT '0',real_namevarchar(255) NOT NULL DEFAULT '',instant_messagessmallint(5) NOT NULL DEFAULT '0',unread_messagessmallint(5) NOT NULL DEFAULT '0',new_pmtinyint(3) unsigned NOT NULL DEFAULT '0',buddy_listtext NOT NULL,pm_ignore_listvarchar(255) NOT NULL DEFAULT '',pm_prefsmediumint(8) NOT NULL DEFAULT '0',mod_prefsvarchar(20) NOT NULL DEFAULT '',message_labelstext NOT NULL,passwdvarchar(64) NOT NULL DEFAULT '',openid_uritext NOT NULL,email_addressvarchar(255) NOT NULL DEFAULT '',personal_textvarchar(255) NOT NULL DEFAULT '',gendertinyint(4) unsigned NOT NULL DEFAULT '0',birthdatedate NOT NULL DEFAULT '0001-01-01',website_titlevarchar(255) NOT NULL DEFAULT '',website_urlvarchar(255) NOT NULL DEFAULT '',locationvarchar(255) NOT NULL DEFAULT '',icqvarchar(255) NOT NULL DEFAULT '',aimvarchar(255) NOT NULL DEFAULT '',yimvarchar(32) NOT NULL DEFAULT '',msnvarchar(255) NOT NULL DEFAULT '',hide_emailtinyint(4) NOT NULL DEFAULT '0',show_onlinetinyint(4) NOT NULL DEFAULT '1',time_formatvarchar(80) NOT NULL DEFAULT '',signaturetext NOT NULL,time_offsetfloat NOT NULL DEFAULT '0',avatarvarchar(255) NOT NULL DEFAULT '',pm_email_notifytinyint(4) NOT NULL DEFAULT '0',karma_badsmallint(5) unsigned NOT NULL DEFAULT '0',karma_goodsmallint(5) unsigned NOT NULL DEFAULT '0',usertitlevarchar(255) NOT NULL DEFAULT '',notify_announcementstinyint(4) NOT NULL DEFAULT '1',notify_regularitytinyint(4) NOT NULL DEFAULT '1',notify_send_bodytinyint(4) NOT NULL DEFAULT '0',notify_typestinyint(4) NOT NULL DEFAULT '2',member_ipvarchar(255) NOT NULL DEFAULT '',member_ip2varchar(255) NOT NULL DEFAULT '',secret_questionvarchar(255) NOT NULL DEFAULT '',secret_answervarchar(64) NOT NULL DEFAULT '',id_themetinyint(4) unsigned NOT NULL DEFAULT '0',is_activatedtinyint(3) unsigned NOT NULL DEFAULT '1',validation_codevarchar(10) NOT NULL DEFAULT '',id_msg_last_visitint(10) unsigned NOT NULL DEFAULT '0',additional_groupsvarchar(255) NOT NULL DEFAULT '',smiley_setvarchar(48) NOT NULL DEFAULT '',id_post_groupsmallint(5) unsigned NOT NULL DEFAULT '0',total_time_logged_inint(10) unsigned NOT NULL DEFAULT '0',password_saltvarchar(255) NOT NULL DEFAULT '',ignore_boardstext NOT NULL,warningtinyint(4) NOT NULL DEFAULT '0',passwd_floodvarchar(12) NOT NULL DEFAULT '',pm_receive_fromtinyint(4) unsigned NOT NULL DEFAULT '1',thank_you_post_mademediumint(8) NOT NULL DEFAULT '0',thank_you_post_becamemediumint(8) NOT NULL DEFAULT '0',last_thank_you_timeint(10) NOT NULL DEFAULT '0',is_spammertinyint(3) NOT NULL DEFAULT '0',bpmint(11) unsigned NOT NULL DEFAULT '0',goldint(11) unsigned NOT NULL DEFAULT '100',is_deadint(11) unsigned NOT NULL DEFAULT '0',battle_lastint(10) unsigned NOT NULL DEFAULT '0',stat_pointint(11) unsigned NOT NULL DEFAULT '0',lastupdateint(11) unsigned NOT NULL DEFAULT '0',atkint(11) unsigned NOT NULL DEFAULT '100',max_atkint(11) unsigned NOT NULL DEFAULT '100',defint(11) unsigned NOT NULL DEFAULT '100',max_defint(11) unsigned NOT NULL DEFAULT '100',energyint(11) unsigned NOT NULL DEFAULT '100',max_energyint(11) unsigned NOT NULL DEFAULT '100',staminaint(11) unsigned NOT NULL DEFAULT '100',max_staminaint(11) unsigned NOT NULL DEFAULT '100',hpint(11) unsigned NOT NULL DEFAULT '100',max_hpint(11) unsigned NOT NULL DEFAULT '100',expint(11) unsigned NOT NULL DEFAULT '0',max_expint(11) unsigned NOT NULL DEFAULT '0',levelint(11) unsigned NOT NULL DEFAULT '0',mem_slaysint(11) unsigned NOT NULL DEFAULT '0',battle_only_buddies_shoutint(11) unsigned NOT NULL DEFAULT '0',mon_slaysint(11) unsigned NOT NULL DEFAULT '0',battle_pointsbigint(11) unsigned NOT NULL DEFAULT '0',breeze_profile_viewstext NOT NULL,email_mentionstinyint(4) NOT NULL DEFAULT '0',unread_mentionsint(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_membersALTER TABLE
smf2old_membersADD PRIMARY KEY (
id_member), ADD KEYmember_name(member_name), ADD KEYreal_name(real_name), ADD KEYdate_registered(date_registered), ADD KEYid_group(id_group), ADD KEYbirthdate(birthdate), ADD KEYposts(posts), ADD KEYlast_login(last_login), ADD KEYlngfile(lngfile(30)), ADD KEYid_post_group(id_post_group), ADD KEYwarning(warning), ADD KEYtotal_time_logged_in(total_time_logged_in), ADD KEYid_theme(id_theme);[/code]
login with
smf_admin/piwigo123
go to administration/users/manage or http://localhost/piwigo/admin.php?page=user_list
Additional information: Read this topic: http://piwigo.org/forum/viewtopic.php?pid=155622#p155622
Piwigo Bugtracker #3169