// BAN_TIME da allineare anche in commons.js
define('BAN_TIME', 3600);
define('GARBAGE_TIMEOUT', 5);
-define('NICKSERV', "<i>BriskServ</i>");
+define('NICKSERV', "BriskServ");
define('LOCK_SHARE_MAX', 10000);
'en' => '<br>The entered password is not correct.<br><br>'),
'alarret' => array( 'it' => '"Alarm \\"<b>%s</b>\\" inviato a <b>%s</b>."',
'en' => '"Alarm \\"<b>%s</b>\\" sent to <b>%s</b>."'),
- 'authmust' => array( 'it' => '<b>Per autenticare qualcuno devi a tua volta essere autenticato.</b>',
- 'en' => '<b>To authenticate someone you have to be authenticated.</b>'), // on your turn
+ 'authmust' => array( 'it' => '<b>Per autenticare qualcuno devi a tua volta essere autenticato e certificato.</b>',
+ 'en' => '<b>To authenticate someone you have to be authenticated and certified.</b>'), // on your turn
'mesgmust' => array( 'it' => '<b>Per inviare un messaggio devi essere autenticato.</b>',
'en' => '<b>To send a message you have to be authenticated.</b>'),
'nickmust' => array( 'it' => 'Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.',
}
}
+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;
}
}
- // 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->is_cert())
+ $act = "sitcert";
+ else
+ $act = 'resercert';
+ break;
+ case TABLE_AUTH_TY_AUTH:
+ if ($user->is_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;
}
// if authorized not check if banlisted
- if ($user_cur->flags & USER_FLAG_AUTH) {
+ if ($user_cur->is_auth()) {
continue;
}
}
}
else if (strcmp($msg, "/authreq") == 0) {
- if ($user->flags & USER_FLAG_AUTH) {
- $to_user = sprintf('authbox(300,200);');
- }
- else {
- /* MLANG: "<b>Per autenticare qualcuno devi a tua volta essere autenticato.</b>", "Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.", "Nickname <b>%s</b> già in uso." */
- $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authmust'][$G_lang]);
- }
+ if ($user->is_cert()) {
+ $to_user = sprintf('authbox(300,200);');
+ }
+ else {
+ /* MLANG: "<b>Per autenticare qualcuno devi a tua volta essere autenticato.</b>", "Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.", "Nickname <b>%s</b> già in uso." */
+ $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authmust'][$G_lang]);
+ }
}
else if (strncmp($msg, "/mesgtoadm", 8) == 0) {
- if ($user->flags & USER_FLAG_AUTH) {
+ if ($user->is_auth()) {
$to_user = sprintf('mesgtoadmbox(500,300);');
}
else {
}
/* MLANG: "<b>Non puoi cambiare nick a un tavolo per soli autenticati.</b>", "Il nickname <b>\'%s\'</b> è già registrato, <b>se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghost<i>N</i>.</b>" */
- if ($user->flags & USER_FLAG_AUTH) {
+ if ($user->is_auth()) {
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
}
$user->name = $name_new; // OK - nick changed
/* se nome gia' in uso, segnala cosa potrebbe capitare */
- if (($user->flags & USER_FLAG_AUTH) == 0) {
+ if ( ! $user->is_auth() ) {
if (($bdb = BriskDB::create()) != FALSE) {
$bdb->users_load();
/* MLANG: "Il nickname <b>\'%s\'</b> è già registrato, <b>se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghost<i>N</i>.</b>" */
if ($is_normchat == TRUE) {
// use MAP_AUTH to check if auth or isolation
if ($user_cur->flags & USER_FLAG_MAP_AUTH) {
- if (($user->flags & USER_FLAG_AUTH) == 0) {
- continue;
- }
+ if ( ! $user->is_auth() ) {
+ continue;
+ }
}
}
/*
if (strcasecmp($this->user[$i]->name, $name_new) == 0) {
if ($authenticate != FALSE) {
$ghost = $i;
- $ghost_auth = ($this->user[$i]->flags & USER_FLAG_AUTH);
+ $ghost_auth = $this->user[$i]->is_auth();
}
else {
$idx = $i;
if (($fp = @fopen(LEGAL_PATH."/legal.log", 'a')) != FALSE) {
/* Unix time | session | nickname | IP | where was | mesg */
fwrite($fp, sprintf("%ld|%s|%s|%s|%s|%s|%s|\n", $curtime, $user->sess,
- ($user->flags & USER_FLAG_AUTH ? 'A' : 'N'),
+ ($user->is_auth() ? 'A' : 'N'),
$user->name, $addr, $where , $mesg));
fclose($fp);
}