From: Matteo Nastasi (mop) Date: Wed, 3 Dec 2008 23:46:46 +0000 (+0000) Subject: rendering for auth names refactored. X-Git-Tag: 3.0.0~189 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=b2e4016ea5c50bf06160d8e57659838aeacc6fdc;p=brisk.git rendering for auth names refactored. --- diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 904e1bf..6f0a06f 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -301,7 +301,7 @@ class Briskin5 { if (($name_new = validate_name(substr($user_mesg, 6))) == FALSE) { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s","Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.");', $dt.NICKSERV); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.");', $dt, NICKSERV); $user->step_inc(); return; @@ -318,15 +318,27 @@ class Briskin5 { continue; if ($user_cur->name == $name_new) { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s","Nickname %s già in uso.");', $dt.NICKSERV, xcape($name_new)); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"Nickname %s già in uso.%d");', $dt, NICKSERV, xcape($name_new), $this->table[$user->table]->auth_only == TRUE); $user->step_inc(); break; } } if ($i == BRISKIN5_MAX_PLAYERS) { + if ($user->flags & USER_FLAG_AUTH && strcasecmp($user->name,$name_new) != 0) { + if ($this->table[$user->table]->auth_only == TRUE) { + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"Non puoi cambiare nick a un tavolo per soli autenticati.");', $dt, NICKSERV); + $user->step_inc(); + return; + } + else { + $user->flags &= ~USER_FLAG_AUTH; // Remove auth if name changed + } + } + $user->name = $name_new; - log_main($user->sess." chatt_send start set"); + log_main($user->sess." chatt_send start set"); for ($i = 0 ; $i < BRISKIN5_MAX_PLAYERS ; $i++) { @@ -352,15 +364,28 @@ class Briskin5 { $table = &$this->table[$user->table]; $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; - $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('set_names(" %s", " %s", " %s", " %s", " %s"); ', - xcape($this->user[$table->player[($user_cur->table_pos) % BRISKIN5_PLAYERS_N]]->name), - xcape($this->user[$table->player[($user_cur->table_pos+1) % BRISKIN5_PLAYERS_N]]->name), - xcape($this->user[$table->player[($user_cur->table_pos+2) % BRISKIN5_PLAYERS_N]]->name), - (BRISKIN5_PLAYERS_N == 3 ? "" : xcape($this->user[$table->player[($user_cur->table_pos+3) % BRISKIN5_PLAYERS_N]]->name)), - (BRISKIN5_PLAYERS_N == 3 ? "" : xcape($this->user[$table->player[($user_cur->table_pos+4) % BRISKIN5_PLAYERS_N]]->name))); - if ($user_cur == $user) - $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('$("myname").innerHTML = "%s";', - xcape($user->name,ENT_COMPAT,"UTF-8")); + $user_cur->comm[$user_cur->step % COMM_N] .= \ + sprintf('set_names([%d, "%s"], [%d, "%s"], [%d, "%s"], [%d, "%s"], [%d, "%s"]); ', + $this->user[$table->player[($user_cur->table_pos) % BRISKIN5_PLAYERS_N]]->flags, + xcape($this->user[$table->player[($user_cur->table_pos) % BRISKIN5_PLAYERS_N]]->name), + + $this->user[$table->player[($user_cur->table_pos+1) % BRISKIN5_PLAYERS_N]]->flags, + xcape($this->user[$table->player[($user_cur->table_pos+1) % BRISKIN5_PLAYERS_N]]->name), + + $this->user[$table->player[($user_cur->table_pos+2) % BRISKIN5_PLAYERS_N]]->flags, + xcape($this->user[$table->player[($user_cur->table_pos+2) % BRISKIN5_PLAYERS_N]]->name), + + (BRISKIN5_PLAYERS_N == 3 ? 0: $this->user[$table->player[($user_cur->table_pos+3) % BRISKIN5_PLAYERS_N]]->flags), + (BRISKIN5_PLAYERS_N == 3 ? "" : xcape($this->user[$table->player[($user_cur->table_pos+3) % BRISKIN5_PLAYERS_N]]->name)), + + (BRISKIN5_PLAYERS_N == 3 ? 0: $this->user[$table->player[($user_cur->table_pos+4) % BRISKIN5_PLAYERS_N]]->flags), + (BRISKIN5_PLAYERS_N == 3 ? "" : xcape($this->user[$table->player[($user_cur->table_pos+4) % BRISKIN5_PLAYERS_N]]->name))); + if ($user_cur == $user) { + $itin = ($user->flags & USER_FLAG_AUTH ? "" : ""); + $itou = ($user->flags & USER_FLAG_AUTH ? "" : ""); + $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('$("myname").innerHTML = "%s%s%s";', + $itin, xcape($user->name,ENT_COMPAT,"UTF-8"), $itou); + } $user_cur->step_inc(); } } @@ -378,8 +403,8 @@ class Briskin5 { } $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; - $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('chatt_sub("%s","%s");', - $dt.xcape($user->name), xcape($user_mesg)); + $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('chatt_sub("%s", [%d, "%s"],"%s");', + $dt, $user->flags, xcape($user->name), xcape($user_mesg)); $user_cur->step_inc(); } log_legal($curtime, $user->sess, $user->name,