if ($sitted < PLAYERS_N) {
switch ($this->auth_type) {
case TABLE_AUTH_TY_CERT:
- if ($user->flags & USER_FLAG_AUTH && $user->flags & USER_FLAG_TY_CERT)
+ if ($user->is_cert())
$act = "sitcert";
else
$act = 'resercert';
break;
case TABLE_AUTH_TY_AUTH:
- if ($user->flags & USER_FLAG_AUTH)
+ if ($user->is_auth())
$act = "sitreser";
else
$act = 'reserved';
}
// 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->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);
}
return ($thiz);
}
+ function is_auth()
+ {
+ return ($this->flags & USER_FLAG_AUTH);
+ }
+
+ function is_cert()
+ {
+ return (($this->flags & USER_FLAG_AUTH) && ($this->flags & USER_FLAG_TY_CERT));
+ }
+
function flags_set($flags, $mask)
{
$flags_old = $this->flags & (~$mask);
function myname_innerHTML()
{
- $class_id = ($this->flags & USER_FLAG_AUTH) + 1;
+ // 4 -> is certified
+ // 2 -> is authorized
+ // 1 -> is myself
+ $class_id = (($this->flags & USER_FLAG_TY_CERT) >> 16) | ($this->flags & USER_FLAG_AUTH) | 1;
return (sprintf('$("myname").innerHTML = "<span class=\"au%d\">%s</span>";', $class_id,
xcape($this->name,ENT_COMPAT,"UTF-8")));
}
// if authorized not check if banlisted
- if ($user_cur->flags & USER_FLAG_AUTH) {
+ if ($user_cur->is_auth()) {
continue;
}
$remcalc = $this->table[0]->exitlock_calc(&$this->user, $user_cur->table_pos);
if ($remcalc < 3) {
require_once("${G_base}Obj/hardban.phh");
- Hardbans::add(($user_cur->flags & USER_FLAG_AUTH ? $user_cur->name : FALSE),
+ Hardbans::add(($user_cur->is_auth() ? $user_cur->name : FALSE),
$user_cur->ip, $user_cur->sess, $user_cur->laccwr + BAN_TIME);
}
// $user->bantime = $user->laccwr + BAN_TIME;
if (($fp = @fopen(LEGAL_PATH."/points.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, $remote_addr, $where , $mesg));
fclose($fp);
}
return FALSE;
}
$bin5->brisk->sess_cur_set($user->sess);
- if (!($user->flags & USER_FLAG_AUTH) &&
+ if ( ( ! $user->is_auth() ) &&
$bin5->brisk->ban_check($user->ip)) {
// TODO: waiting async 5 sec before close
return (FALSE);
}
else {
require_once("../Obj/hardban.phh");
- Hardbans::add(($user->flags & USER_FLAG_AUTH ? $user->name : FALSE),
+ Hardbans::add(($user->is_auth() ? $user->name : FALSE),
$user->ip, $user->sess, $user->laccwr + BAN_TIME);
}
// $user->bantime = $user->laccwr + BAN_TIME;
$tables .= '<div class="room_tab">';
$tables .= '<table class="room_tab">';
for ($ii = 0 ; $ii < TABLES_N ; $ii++) {
- if ($user->flags & USER_FLAG_AUTH)
+ if ($user->is_auth())
$i = $ii;
else
$i = TABLES_N - $ii - 1;
// MLANG garantisci
.$mlang_room['tit_splash'][$G_lang].
'</a><br>
-'.($user->flags & USER_FLAG_AUTH ? '
+'.($user->is_auth() ? '
<a href="#" title="'
// MLANG garantisci per un tuo conoscente
.$mlang_room['prefs_desc'][$G_lang].'"
// LACC UPDATED
$user->lacc = $curtime;
- if (!($user->flags & USER_FLAG_AUTH) &&
+ if ( ( ! $user->is_auth() ) &&
$brisk->ban_check($user->ip)) {
// TODO: find a way to add a nonblocking sleep(5) here
return (FALSE);
$mesg_to_user = "";
- log_wr("INFO:SKIP:argz == warranty name: [".$cli_name."] AUTH: ".($user->flags & USER_FLAG_AUTH));
- if ($user->flags & USER_FLAG_AUTH) {
+ log_wr("INFO:SKIP:argz == warranty name: [".$cli_name."] AUTH: ".$user->is_auth());
+ if ($user->is_auth()) {
if (0 == 1) {
if (($wa_lock = Warrant::lock_data(TRUE)) != FALSE) {
if (($fp = @fopen(LEGAL_PATH."/warrant.txt", 'a')) != FALSE) {
$mesg_to_user = "";
- log_wr("INFO:SKIP:argz == mesgtoadm name: [".$user->name."] AUTH: ".($user->flags & USER_FLAG_AUTH));
- if ($user->flags & USER_FLAG_AUTH) {
+ log_wr("INFO:SKIP:argz == mesgtoadm name: [".$user->name."] AUTH: ".$user->is_auth());
+ if ($user->is_auth()) {
if (($wa_lock = Warrant::lock_data(TRUE)) != FALSE) {
if (($bdb = BriskDB::create()) != FALSE) {
$bdb->users_load();
$dobreak = FALSE;
do {
- log_wr("INFO:SKIP:argz == poll name: [".$cli_poll_name."] AUTH: ".($user->flags & USER_FLAG_AUTH));
- if (($user->flags & USER_FLAG_AUTH) != USER_FLAG_AUTH) {
+ log_wr("INFO:SKIP:argz == poll name: [".$cli_poll_name."] AUTH: ".$user->is_auth());
+ if ( ! $user->is_auth() ) {
// MLANG: <b>Per partecipare al sondaggio devi essere autenticato.</b>
$mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['pollmust'][$G_lang]);
log_wr("break1");
}
else if ($argz[0] == 'tosmgr') {
// check IF is authnticated user, both terms of service versions matches
- if ($user->flags & USER_FLAG_AUTH && count($argz) == 5) {
+ if ($user->is_auth() && count($argz) == 5) {
$f_type = $argz[1]; $f_code = $argz[2];
$f_tos_curr = $argz[3]; $f_tos_vers = $argz[4];
$dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang],
$table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]);
}
- else if ($table->auth_type == TABLE_AUTH_TY_CERT
- && ( (($user->flags & USER_FLAG_AUTH) == 0) || (($user->flags & USER_FLAG_TY_CERT) == 0) ) ) {
+ else if ($table->auth_type == TABLE_AUTH_TY_CERT && ( ! $user->is_cert() ) ) {
$not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s");',
$dt, NICKSERV, $mlang_indwr['mustcert'][$G_lang]);
}
- else if ($table->auth_type == TABLE_AUTH_TY_AUTH && (($user->flags & USER_FLAG_AUTH) == 0)) {
+ else if ($table->auth_type == TABLE_AUTH_TY_AUTH && ( ! $user->is_auth() ) ) {
$not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s");',
$dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]);
}
// if ($user->bantime > $user->laccwr) {
require_once("Obj/hardban.phh");
- if (($bantime = Hardbans::check(($user->flags & USER_FLAG_AUTH ? $user->name : FALSE),
+ if (($bantime = Hardbans::check(($user->is_auth() ? $user->name : FALSE),
$user->ip, $user->sess)) != -1) {
$user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
/* MLANG: "<br>Ti sei alzato da un tavolo senza il consenso degli altri giocatori. <br><br>Dovrai aspettare ancora ".secstoword($user->bantime - $user->laccwr)." prima di poterti sedere nuovamente.", "resta in piedi.", "<br>Tu o qualcuno col tuo stesso indirizzo IP si รจ alzato da un tavolo senza il consenso degli altri giocatori.<br><br>Dovrai aspettare ancora ".secstoword($bantime - $user->laccwr)." prima di poterti sedere nuovamente.<br><br>Se non sei stato tu ad alzarti e possiedi un login con password, autenticandoti con quello, potrai accedere." */
- if ($user->flags & USER_FLAG_AUTH) {
+ if ($user->is_auth()) {
$user->comm[$user->step % COMM_N] .= show_notify($mlang_indwr['badwake_a'][$G_lang].secstoword($user->bantime - $user->laccwr).$mlang_indwr['badwake_b'][$G_lang], 2000, $mlang_indwr['btn_stays'][$G_lang], 400, 100);
}
else {