From: Matteo Nastasi (mop) Date: Sun, 28 Jul 2013 15:10:55 +0000 (+0200) Subject: USER_FLAG_TY_FIRONLY management added X-Git-Tag: v4.9.0~10 X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=brisk.git;a=commitdiff_plain;h=1fa5c579ed75be5f76de133e638855d7b966680d USER_FLAG_TY_FIRONLY management added --- diff --git a/sql/sql.d/100-anagr.sql.noinsert b/sql/sql.d/100-anagr.sql.noinsert index f4e1400..d902048 100644 --- a/sql/sql.d/100-anagr.sql.noinsert +++ b/sql/sql.d/100-anagr.sql.noinsert @@ -6,12 +6,13 @@ -- define(USER_FLAG_TY_ALL, 0x000f0000); // done -- define(USER_FLAG_TY_NORM, 0x00010000); // done -- define(USER_FLAG_TY_SUPER, 0x00020000); // done +-- define(USER_FLAG_TY_FIRONLY, 0x00200000); // done -- define(USER_FLAG_TY_SUSPEND, 0x00400000); // done -- define(USER_FLAG_TY_DISABLE, 0x00800000); // done INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (1, 'uno', md5('one'), 'uno@pluto.com', CAST (X'00020000' as integer), 0); INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (2, 'due', md5('two'), 'due@pluto.com', CAST (X'00010000' as integer), 0); INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (3, 'tre', md5('thr'), 'tre@pluto.com', CAST (X'00010000' as integer), 0); -INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00010000' as integer), 0); +INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00210000' as integer), 0); INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (5, 'cin', md5('fiv'), 'cin@pluto.com', CAST (X'00010000' as integer), 0); diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 6bdcb84..4a595bb 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1292,54 +1292,53 @@ class Room function room_sitdown($user, $table_idx) { - log_main("room_sitdown ".($user == FALSE ? "USER: FALSE" : "USER: ".$user->name)); - - $train_app = ""; - - if ($table_idx > -1 && $table_idx < TABLES_N) { - $table = $this->table[$table_idx]; - - // wagon shutdown - if ($table->wag_own != -1 && $table->player_n == PLAYERS_N) { - for ($i = 0 ; $i < TABLES_N ; $i++) { - if ($table->wag_own == $table->player[$i]) { - $train_app = sprintf("tra.rem(%d); ", $table_idx); - $table->wag_reset(time()); - break; - } - } - } - } - - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - $ret = ""; - $user_cur = $this->user[$i]; - if ($user_cur->sess == '' || $user_cur->stat != 'room') - continue; + log_main("room_sitdown ".($user == FALSE ? "USER: FALSE" : "USER: ".$user->name)); - $ret = "gst.st = ".($user_cur->step+1)."; ".$train_app; - if ($table_idx > -1) - $ret .= $this->table_content($user_cur, $table_idx); - $ret .= $this->standup_content($user_cur); + $train_app = ""; - if ($user->idx_get() == $i) { - $ret .= 'subst = "sitdown"; tra.hide(); '; - // clean the action buttons in other tables - for ($e = 0 ; $e < TABLES_N ; $e++) { - // $ret .= table_act_content(FALSE, 0, $e, $user_cur->table, FALSE); - $ret .= $this->table[$e]->act_content($user_cur); - } + if ($table_idx > -1 && $table_idx < TABLES_N) { + $table = $this->table[$table_idx]; + + // wagon shutdown + if ($table->wag_own != -1 && $table->player_n == PLAYERS_N) { + for ($i = 0 ; $i < TABLES_N ; $i++) { + if ($table->wag_own == $table->player[$i]) { + $train_app = sprintf("tra.rem(%d); ", $table_idx); + $table->wag_reset(time()); + break; + } + } + } } - else if ($table_idx > -1) { - if ($table->player_n == PLAYERS_N) { - // $ret .= table_act_content(($user_cur->subst == 'standup'), PLAYERS_N, $table_idx, $user_cur->table, - /// ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH)); - $ret .= $table->act_content($user_cur); - } + + for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { + $ret = ""; + $user_cur = $this->user[$i]; + if ($user_cur->sess == '' || $user_cur->stat != 'room') + continue; + + $ret = "gst.st = ".($user_cur->step+1)."; ".$train_app; + if ($table_idx > -1) + $ret .= $this->table_content($user_cur, $table_idx); + $ret .= $this->standup_content($user_cur); + + if ($user->idx_get() == $i) { + $ret .= 'subst = "sitdown"; tra.hide(); '; + // clean the action buttons in other tables + for ($e = 0 ; $e < TABLES_N ; $e++) { + $ret .= $this->table[$e]->act_content($user_cur); + } + } + else if ($table_idx > -1) { + if ($table->player_n == PLAYERS_N) { + // $ret .= table_act_content(($user_cur->subst == 'standup'), PLAYERS_N, $table_idx, $user_cur->table, + /// ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH)); + $ret .= $table->act_content($user_cur); + } + } + $user_cur->comm[$user_cur->step % COMM_N] = $ret; + $user_cur->step_inc(); } - $user_cur->comm[$user_cur->step % COMM_N] = $ret; - $user_cur->step_inc(); - } } function chatt_send($user, $mesg) diff --git a/web/Obj/user.phh b/web/Obj/user.phh index a2c3829..11b808f 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -59,6 +59,7 @@ define('USER_FLAG_TY_NORM', 0x010000); // done define('USER_FLAG_TY_SUPER', 0x020000); // done define('USER_FLAG_TY_CERT', 0x040000); // done // ... other usefull status ... +define('USER_FLAG_TY_FIRONLY', 0x200000); // done define('USER_FLAG_TY_SUSPEND', 0x400000); // done define('USER_FLAG_TY_DISABLE', 0x800000); // done diff --git a/web/index_wr.php b/web/index_wr.php index 5b05c68..91eb8f3 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -56,6 +56,8 @@ $mlang_indwr = array( 'btn_backtotab' => array( 'it' => 'Torna ai tavoli.', 'en' => 'The table is only just opened, you will sit down in '), // FIXME 'tabwait_b'=> array( 'it' => ' secondi.', 'en' => ' seconds.'), + 'mustfirst'=> array( 'it' => 'Il tuo utente può sedersi al tavolo solo per primo.', + 'en' => 'Your can sit down as first user only.' ), 'pollmust' => array( 'it' => 'Per partecipare al sondaggio devi essere autenticato.', 'en' => 'To vote for the poll you have to be authenticated'), 'pollnone' => array( 'it' => '

Al momento non è attivo alcun sondaggio.', @@ -567,20 +569,26 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $table_idx = (int)$argz[1]; $table = &$room->table[$table_idx]; - if ($G_shutdown || $table->wakeup_time > $curtime || - ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) ) { - $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - - /* MLANG: "Il server sta per essere riavviato, non possono avere inizio nuove partite.", "Il tavolo a cui volevi sederti richiede autentifica.", "Il tavolo si è appena liberato, ci si potrà sedere tra %d secondi." */ - if ($G_shutdown) { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]); - } - else if ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]); - } - else { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s%d%s");', $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]); - } + $not_allowed_msg = ""; + if ($G_shutdown) { + $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', + $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]); + } + else if ($table->wakeup_time > $curtime) { + $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s%d%s");', + $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], + $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]); + } + else if ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) { + $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', + $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]); + } + else if ($user->flags & USER_FLAG_TY_FIRONLY && $table->player_n > 0) { + $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"], "%s");', + $dt, NICKSERV, $mlang_indwr['mustfirst'][$G_lang]); + } + if ($not_allowed_msg != "") { + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ".$not_allowed_msg; $user->step_inc(); return TRUE; }