1<?php
2/**
3 * Confiuration for fluxbb. They have a very simplistic model. There is no separate display name and a user can
4 * only be in a single group.
5 */
6/** @noinspection SqlResolve */
7$data = array(
8    'passcrypt' => 'sha1',
9    'conf' => array(
10        'select-user' => '
11            SELECT id AS uid,
12                   username AS user,
13                   username AS name,
14                   password AS hash,
15                   email AS mail
16              FROM fluy_users
17             WHERE username = :user
18        ',
19        'select-user-groups' => '
20            SELECT g_title AS `group`
21              FROM fluy_groups G, fluy_users U
22             WHERE U.id = :uid
23               AND U.group_id = G.g_id
24        ',
25        'select-groups' => '
26            SELECT g_id AS gid, g_title AS `group`
27              FROM fluy_groups
28        ',
29        'insert-user' => '
30            INSERT INTO fluy_users
31                   (group_id, username, password, email)
32            VALUES (0, :user, :hash, :mail)
33        ',
34        'delete-user' => '
35            DELETE FROM fluy_users
36             WHERE id = :uid
37        ',
38        'list-users' => '
39            SELECT DISTINCT username AS user
40              FROM fluy_users U, fluy_groups G
41             WHERE U.id = G.g_id
42               AND G.g_title LIKE :group
43               AND U.username LIKE :user
44               AND U.username LIKE :name
45               AND U.email LIKE :mail
46          ORDER BY username
47             LIMIT :limit
48            OFFSET :start
49        ',
50        'count-users' => '
51            SELECT COUNT(DISTINCT username) AS `count`
52              FROM fluy_users U, fluy_groups G
53             WHERE U.id = G.g_id
54               AND G.g_title LIKE :group
55               AND U.username LIKE :user
56               AND U.username LIKE :name
57               AND U.email LIKE :mail
58        ',
59        'update-user-info' => '', // we can't do this because username = displayname
60        'update-user-login' => '
61            UPDATE fluy_users
62               SET username = :newlogin
63             WHERE id = :uid
64        ',
65        'update-user-pass' => '
66            UPDATE fluy_users
67               SET password = :hash
68             WHERE id = :uid
69        ',
70        'insert-group' => '
71            INSERT INTO fluy_groups (g_title) VALUES (:group)
72        ',
73        'join-group' => '
74            UPDATE fluy_users
75               SET group_id = :gid
76             WHERE id = :uid
77        ',
78        'leave-group' => '
79            SELECT 1
80        ', // we do a no-op for this
81    ),
82    'users' => array(
83        array(
84            'user' => 'admin',
85            'pass' => 'pass',
86            'name' => 'admin',
87            'mail' => 'admin@example.com',
88            'grps' =>
89                array(
90                    0 => 'Administrators',
91                ),
92        ),
93        array(
94            'user' => 'test1',
95            'pass' => 'password',
96            'name' => 'test1',
97            'mail' => 'test1@example.com',
98            'grps' =>
99                array(
100                    0 => 'test',
101                ),
102        ),
103    ),
104);
105