define('LEGAL_PATH', "/tmp/legal_brisk");
define('PROXY_PATH', "/var/lib/brisk_proxy");
define('TABLES_N', 36);
-define('TABLES_AUTH_N', 4);
+define('TABLES_AUTH_N', 8);
+define('TABLES_CERT_N', 4);
define('PLAYERS_N', 3);
define('MAX_POINTS', 5);
define('MAX_PLAYERS', (20 + (PLAYERS_N * TABLES_N)));
$G_lng = langtolng($G_lang);
$G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "4.14.2";
+$G_brisk_version = "4.14.3";
/* MLANG: ALL THE INFO STRINGS IN brisk.phh */
-$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: nuovo sistema di registrazione degli utenti, aggiunto reinvio dell\' email di verifica',
+$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: nuovo sistema di registrazione degli utenti, aggiunto reinvio dell\' email di verifica, ban con classi di IP',
'Se vuoi iscriverti alla <a target="_blank" href="mailto:ml-briscola+subscribe@milug.org">Mailing List</a>, cliccala!' ),
'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: new users subscription system.',
'If you want to subscribe our <a target="_blank" href="ml-briscola+subscribe@milug.org">Mailing List</a>, click it!' ) );
}
}
+define('TABLE_AUTH_TY_PUBL', 0);
+define('TABLE_AUTH_TY_AUTH', 1);
+define('TABLE_AUTH_TY_CERT', 2);
+
+
class Table {
var $idx;
var $player;
var $player_n;
- var $auth_only; // se tavolo riservato o libero
+ var $auth_type; // required authorization to sit down
var $wag_own;
var $wag_com;
$thiz->idx = $idx;
$thiz->player = array();
$thiz->player_n = 0;
- $thiz->auth_only = FALSE;
+
+ if ($idx < TABLES_CERT_N)
+ $thiz->auth_type = TABLE_AUTH_TY_CERT;
+ else if ($idx < TABLES_AUTH_N)
+ $thiz->auth_type = TABLE_AUTH_TY_AUTH;
+ else
+ $thiz->auth_type = TABLE_AUTH_TY_PUBL;
$thiz->wag_own = -1;
$thiz->wag_com = "";
log_main("PLAYER_N - parent::copy.".$this->player_n);
- $this->auth_only = $from->auth_only;
+ $this->auth_type = $from->auth_type;
$this->wag_own = $from->wag_own;
$this->wag_com = $from->wag_com;
$thiz->player[$i] = $i;
$thiz->player_n = $from->player_n;
- $thiz->auth_only = $from->auth_only;
+ $thiz->auth_type = $from->auth_type;
$thiz->wag_own = $from->wag_own;
$thiz->wag_com = $from->wag_com;
}
}
-
-
- // $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table,
- // ($this->table[$i]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH));
-
- // function act_content($isstanding, $sitted, $table, $cur_table, $allowed)
+ // Table->act_content - return 'id' of type of output required for table button
function act_content($user)
{
$ret = "";
if ($isstanding) {
if ($sitted < PLAYERS_N) {
- if ($this->auth_only) {
- if ($user->flags & USER_FLAG_AUTH)
- $act = "sitreser";
- else
- $act = 'reserved';
- }
- else {
- $act = 'sit';
- }
+ switch ($this->auth_type) {
+ case TABLE_AUTH_TY_CERT:
+ if ($user->flags & USER_FLAG_AUTH && $user->flags & USER_FLAG_TY_CERT)
+ $act = "sitcert";
+ else
+ $act = 'resercert';
+ break;
+ case TABLE_AUTH_TY_AUTH:
+ if ($user->flags & USER_FLAG_AUTH)
+ $act = "sitreser";
+ else
+ $act = 'reserved';
+ break;
+ default:
+ $act = 'sit';
+ break;
+ }
}
else {
$act = 'none';
fprintf(STDERR, "ROOM FROM FILE\n");
rename($crystal_filename, $crystal_filename.".old");
- $brisk->reload();
+ $brisk->reload($ban_list, $black_list);
return($brisk);
}
for ($i = 0 ; $i < TABLES_N ; $i++) {
$thiz->table[$i] = Table::create($i);
- /* OLD METHOD
- if ($i < 12) {
- $row = ( (((int)($i / 4)) % 2) == 0 );
- $col = ($i % 2 == 0);
- $thiz->table[$i]->auth_only = (($row && $col) || (!$row && !$col));
- }
- else {
- $thiz->table[$i]->auth_only = FALSE;
- }
- */
- if ($i < TABLES_AUTH_N)
- $thiz->table[$i]->auth_only = TRUE;
- else
- $thiz->table[$i]->auth_only = FALSE;
}
$thiz->garbage_timeout = 0;
$thiz->shm_sz = SHM_DIMS_MIN;
for ($i = 0 ; $i < TABLES_N ; $i++) {
$ret .= $this->table_content($user, $i);
- // $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table,
- // ($this->table[$i]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH));
+
$ret .= $this->table[$i]->act_content($user);
if ($this->table[$i]->wag_own != -1)
$ret .= sprintf('tra.add(%d, "%s: %s"); ', $i, $this->user[$this->table[$i]->wag_own]->name, $this->table[$i]->wag_com);
// clean the action buttons in other tables
for ($e = 0 ; $e < TABLES_N ; $e++) {
if ($this->table[$e]->player_n < PLAYERS_N) {
- // $ret .= table_act_content(TRUE, 0, $e, $user->table,
- // ($this->table[$e]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH));
$ret .= $this->table[$e]->act_content($user);
}
}
}
else {
- // $ret .= table_act_content(($user_cur->subst == 'standup'), $table->player_n, $table_idx, $user_cur->table,
- // ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH));
$ret .= $table->act_content($user_cur);
}
}
$ret .= $this->table_content($user_cur, $table_idx);
$ret .= $this->standup_content($user_cur);
- // $ret .= table_act_content(FALSE, 0, $table_idx, $user_cur->table,
- // ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH));
$ret .= $table->act_content($user_cur);
log_main("JOIN_WAKEUP wup_idx ".$wup_idx." wup_n ".$user_wup_n);
log_main("JOIN_WAKEUP more");
- // $ret .= table_act_content(($user_cur->subst == 'standup'), $table->player_n, $table_idx, $user_cur->table,
- // ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH));
+
$ret .= $table->act_content($user_cur);
log_main("JOIN_WAKEUP end more");
}
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);
}
}
if (strcasecmp($user->name,$name_new) != 0) {
if (( ($user->flags & USER_FLAG_MAP_AUTH) != USER_FLAG_ISOLAUTH) &&
($user->subst == 'standup' ||
- ($user->subst != 'standup' && $this->table[$user->table]->auth_only == FALSE)
+ ($user->subst != 'standup' && $this->table[$user->table]->auth_type == TABLE_AUTH_TY_PUBL)
)
) {
$user->flags &= ~(USER_FLAG_AUTH | USER_FLAG_TY_ALL); // Remove auth if name changed