d074067de68e29e10bd95105fae0b8a695e30b3b
[brisk.git] / doc / ARCHITECTURE.txt
1 Sparse documentation about Brisk.
2
3 ==== brisk/table/user relationships ====
4
5 === in the room ===
6
7 // when standup
8 bri->user[user_idx] = user
9 user->idx      = user_idx
10 user->idx_orig = user_idx
11
12 // when sitdown
13 table->player[player_idx] = user_idx
14 user->table_pos = player_idx
15
16 === in the game ===
17
18 bin5->user[user_idx] = user
19 table->player[player_idx] = user_idx
20 user->table_pos = player_idx
21
22
23 Many things aren't documented at all, but I start with authentication workflow.
24
25 ==== MODIFY USERS TABLE ====
26
27 === PHP CODE ===
28
29 web/Obj/dbase_base.phh
30   function LoginDBItem -> args & body
31   function LoginDBItemFromRecord -> args & body
32
33 === SQL CODE ===
34 sql/sql.d/nnn-name-patch.sql
35
36
37 AUTHENTICATION WORKFLOW
38
39 --- CLI ------------
40 index.php:
41   onsubmit="return j_login_manager(this);" ->
42             sync xhr(index_wr.php?mesg=getchallenge&cli_name=<username>)
43
44 --- SRV ------------
45   GET index_wr.php send the string: "1|<tokens>"
46
47 --- CLI ------------
48   POST index.php with passid_private field equal to calcMD5(tokens[1]+calcMD5(form.elements['passid'].value))
49
50
51
52 ===== Game Lifecycle =====
53
54 -> bin5/index_wr.php + argz[0] == 'logout'
55    - bri->table_wakeup($user)
56      - set users subst to "shutdowner" and "shutdowned"
57      - save this: "gst.st_loc++; the_end=true; window.onbeforeunload = null; \
58                    window.onunload = null; document.location.assign("../index.php");" 
59        in user->comm var for client xhr
60      - set $bri->the_end = TRUE
61
62
63 -> index.php  (after verify session value: ~L250)
64   - garbage_manager(TRUE)
65     - align many status var with briskin5 user values
66     - room_join_wakeup()
67
68 ==== Chunk flow ====
69
70
71 $ret = $user->maincheck($old_stat, $old_subst, $old_step, $this->rd_stat, $this->rd_subst, $this->rd_step,
72                         $splashdate, $table_idx, $table_token))
73 $user->rd_transp->chunk($this->rd_scristp++, $ret);
74