1*397d62a2SAndreas Gohr<?php 2*397d62a2SAndreas Gohr/** 3*397d62a2SAndreas Gohr * Configuration for mybb. Password checking is done in SQL 4*397d62a2SAndreas Gohr * 5*397d62a2SAndreas Gohr * mybb stores additional group ids in a commaseparated list of mybb_users.addtionalgroups This 6*397d62a2SAndreas Gohr * is currently not supported in the setup below. If someone can come up with a clever config for 7*397d62a2SAndreas Gohr * that PRs would be welcome. 8*397d62a2SAndreas Gohr */ 9*397d62a2SAndreas Gohr/** @noinspection SqlResolve */ 10*397d62a2SAndreas Gohr$data = array( 11*397d62a2SAndreas Gohr 'passcrypt' => 'sha1', 12*397d62a2SAndreas Gohr 'conf' => array( 13*397d62a2SAndreas Gohr 'select-user' => ' 14*397d62a2SAndreas Gohr SELECT uid, 15*397d62a2SAndreas Gohr username AS user, 16*397d62a2SAndreas Gohr username AS name, 17*397d62a2SAndreas Gohr email AS mail 18*397d62a2SAndreas Gohr FROM mybb_users 19*397d62a2SAndreas Gohr WHERE username = :user 20*397d62a2SAndreas Gohr ', 21*397d62a2SAndreas Gohr 'check-pass' => ' 22*397d62a2SAndreas Gohr SELECT uid 23*397d62a2SAndreas Gohr FROM mybb_users 24*397d62a2SAndreas Gohr WHERE username = :user 25*397d62a2SAndreas Gohr AND password = MD5(CONCAT(MD5(salt), MD5(:clear))) 26*397d62a2SAndreas Gohr ', 27*397d62a2SAndreas Gohr 'select-user-groups' => ' 28*397d62a2SAndreas Gohr SELECT UG.title AS `group`, 29*397d62a2SAndreas Gohr UG.gid 30*397d62a2SAndreas Gohr FROM mybb_usergroups UG, 31*397d62a2SAndreas Gohr mybb_users U 32*397d62a2SAndreas Gohr WHERE U.usergroup = UG.gid 33*397d62a2SAndreas Gohr AND U.uid = :uid 34*397d62a2SAndreas Gohr ', 35*397d62a2SAndreas Gohr 'select-groups' => ' 36*397d62a2SAndreas Gohr SELECT gid, title AS `group` 37*397d62a2SAndreas Gohr FROM mybb_usergroups 38*397d62a2SAndreas Gohr ', 39*397d62a2SAndreas Gohr 'insert-user' => ' 40*397d62a2SAndreas Gohr SET @salt = LEFT(UUID(), 10); 41*397d62a2SAndreas Gohr INSERT INTO mybb_users 42*397d62a2SAndreas Gohr (username, email, salt, password, regdate) 43*397d62a2SAndreas Gohr VALUES (:user, :mail, @salt, MD5(CONCAT(MD5(@salt), MD5(:clear))), UNIX_TIMESTAMP() ) 44*397d62a2SAndreas Gohr ', 45*397d62a2SAndreas Gohr 'delete-user' => ' 46*397d62a2SAndreas Gohr DELETE FROM mybb_users 47*397d62a2SAndreas Gohr WHERE uid = :uid 48*397d62a2SAndreas Gohr ', 49*397d62a2SAndreas Gohr 'list-users' => ' 50*397d62a2SAndreas Gohr SELECT U.username AS user 51*397d62a2SAndreas Gohr FROM mybb_usergroups UG, 52*397d62a2SAndreas Gohr mybb_users U 53*397d62a2SAndreas Gohr WHERE U.usergroup = UG.gid 54*397d62a2SAndreas Gohr AND UG.title LIKE :group 55*397d62a2SAndreas Gohr AND U.username LIKE :user 56*397d62a2SAndreas Gohr AND U.username LIKE :name 57*397d62a2SAndreas Gohr AND U.email LIKE :mail 58*397d62a2SAndreas Gohr ORDER BY U.username 59*397d62a2SAndreas Gohr LIMIT :limit 60*397d62a2SAndreas Gohr OFFSET :start 61*397d62a2SAndreas Gohr ', 62*397d62a2SAndreas Gohr 'count-users' => ' 63*397d62a2SAndreas Gohr SELECT COUNT(U.username) AS `count` 64*397d62a2SAndreas Gohr FROM mybb_usergroups UG, 65*397d62a2SAndreas Gohr mybb_users U 66*397d62a2SAndreas Gohr WHERE U.usergroup = UG.gid 67*397d62a2SAndreas Gohr AND UG.title LIKE :group 68*397d62a2SAndreas Gohr AND U.username LIKE :user 69*397d62a2SAndreas Gohr AND U.username LIKE :name 70*397d62a2SAndreas Gohr AND U.email LIKE :mail 71*397d62a2SAndreas Gohr ', 72*397d62a2SAndreas Gohr 'update-user-info' => ' 73*397d62a2SAndreas Gohr UPDATE mybb_users 74*397d62a2SAndreas Gohr SET email = :mail 75*397d62a2SAndreas Gohr WHERE uid = :uid 76*397d62a2SAndreas Gohr ', // we do not support changing the full name as that is the same as the login 77*397d62a2SAndreas Gohr 'update-user-login' => ' 78*397d62a2SAndreas Gohr UPDATE mybb_users 79*397d62a2SAndreas Gohr SET username = :newlogin 80*397d62a2SAndreas Gohr WHERE uid = :uid 81*397d62a2SAndreas Gohr ', 82*397d62a2SAndreas Gohr 'update-user-pass' => ' 83*397d62a2SAndreas Gohr SET @salt = LEFT(UUID(), 10); 84*397d62a2SAndreas Gohr UPDATE mybb_users 85*397d62a2SAndreas Gohr SET salt = @salt, 86*397d62a2SAndreas Gohr password = MD5(CONCAT(MD5(@salt), MD5(:clear))) 87*397d62a2SAndreas Gohr WHERE uid = :uid 88*397d62a2SAndreas Gohr ', 89*397d62a2SAndreas Gohr 'insert-group' => ' 90*397d62a2SAndreas Gohr INSERT INTO mybb_usergroups (title) 91*397d62a2SAndreas Gohr VALUES (:group) 92*397d62a2SAndreas Gohr ', 93*397d62a2SAndreas Gohr 'join-group' => ' 94*397d62a2SAndreas Gohr UPDATE mybb_users 95*397d62a2SAndreas Gohr SET usergroup = :gid 96*397d62a2SAndreas Gohr WHERE uid = :uid 97*397d62a2SAndreas Gohr ', 98*397d62a2SAndreas Gohr 'leave-group' => '', // makes probably no sense to implement 99*397d62a2SAndreas Gohr ), 100*397d62a2SAndreas Gohr 'users' => array( 101*397d62a2SAndreas Gohr array( 102*397d62a2SAndreas Gohr 'user' => 'Test One', 103*397d62a2SAndreas Gohr 'pass' => 'fakepass', 104*397d62a2SAndreas Gohr 'name' => 'Test One', 105*397d62a2SAndreas Gohr 'mail' => 'no_one@nowhere.com', 106*397d62a2SAndreas Gohr 'grps' => 107*397d62a2SAndreas Gohr array( 108*397d62a2SAndreas Gohr 0 => 'Registered', 109*397d62a2SAndreas Gohr ), 110*397d62a2SAndreas Gohr ), 111*397d62a2SAndreas Gohr array( 112*397d62a2SAndreas Gohr 'user' => 'Test Two', 113*397d62a2SAndreas Gohr 'pass' => 'fakepass', 114*397d62a2SAndreas Gohr 'name' => 'Test Two', 115*397d62a2SAndreas Gohr 'mail' => 'no_one@nowhere.com', 116*397d62a2SAndreas Gohr 'grps' => 117*397d62a2SAndreas Gohr array( 118*397d62a2SAndreas Gohr 0 => 'Super Moderators', 119*397d62a2SAndreas Gohr ), 120*397d62a2SAndreas Gohr ), 121*397d62a2SAndreas Gohr array( 122*397d62a2SAndreas Gohr 'user' => 'Test Three', 123*397d62a2SAndreas Gohr 'pass' => 'fakepass', 124*397d62a2SAndreas Gohr 'name' => 'Test Three', 125*397d62a2SAndreas Gohr 'mail' => 'no_one@nowhere.com', 126*397d62a2SAndreas Gohr 'grps' => 127*397d62a2SAndreas Gohr array( 128*397d62a2SAndreas Gohr 0 => 'Administrators', 129*397d62a2SAndreas Gohr ), 130*397d62a2SAndreas Gohr ), 131*397d62a2SAndreas Gohr array( 132*397d62a2SAndreas Gohr 'user' => 'Test Four', 133*397d62a2SAndreas Gohr 'pass' => 'fakepass', 134*397d62a2SAndreas Gohr 'name' => 'Test Four', 135*397d62a2SAndreas Gohr 'mail' => 'no_one@nowhere.com', 136*397d62a2SAndreas Gohr 'grps' => 137*397d62a2SAndreas Gohr array( 138*397d62a2SAndreas Gohr 0 => 'Moderators', 139*397d62a2SAndreas Gohr ), 140*397d62a2SAndreas Gohr ), 141*397d62a2SAndreas Gohr 142*397d62a2SAndreas Gohr 143*397d62a2SAndreas Gohr ), 144*397d62a2SAndreas Gohr); 145