define('DBG_TRAC', 0x1000);
define('DBG_SHME', 0x2000);
define('DBG_ENGI', 0x4000);
+define('DBG_CDS', 0x8000);
// NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols
define('BRISK_DEBUG', 0x0800);
'en' => 'EN<br>The signalling message of the table<br>will be deactivated for %d second%s.<br><br>'),
'alarpass' => array( 'it' => '<br>La password digitata non è corretta.<br><br>',
'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>."'),
+ '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 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>',
$G_lng = langtolng($G_lang);
$G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "4.14.3";
+$G_brisk_version = "4.14.5";
/* 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, ban con classi di IP',
+$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, nuovi colori, nuovo sistema bi banner laterali per gli eventi',
'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.',
+ 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: new users subscription system, refactored sidebanner system.',
'If you want to subscribe our <a target="_blank" href="ml-briscola+subscribe@milug.org">Mailing List</a>, click it!' ) );
$G_room_help = array( 'it' => '
<div style=\\"text-align: left; padding: 8px;\\">
Attualmente ci sono due metodi per ottenere una password sul sito:<br><br>
<dir>
-<li><b>Facendosi garantire da un utente di Brisk che già possidede una password</b><br><br>
+<li><b>Facendosi garantire da un utente di Brisk che sia certificato.</b><br><br>
<li><b>Auto-garantendosi utilizzando uno dei seguenti sistemi di identificazione digitale:</b><br><br>
<dir>
<li>Carta Regionale dei Servizi della Lombardia (la tessera sanitaria)
<li>il lettore di smart-card per collegare la carta al PC (acquistabile di solito presso le edicole)
</dir>
<br>
-<b>Per effettuare la registrazione collegarsi al sito:</b><br><br>
-<dl>
-<dd><a class=\\"flat\\" target=\\"_blank\\" href=\\"https://brisk.mine.nu\\">https://brisk.mine.nu</a>
-</dl>
-<br><br>
+<b>Per effettuare la registrazione collegarsi al sito:</b> <a class=\\"flat\\" target=\\"_blank\\" href=\\"https://brisk.mine.nu\\">https://brisk.mine.nu</a>
+<br>
Se sei in possesso di una carta che permette l\'identificazione via internet che non è nell\'elenco qui sopra
-<a class=\\"flat\\" href=\\"mailto:authadmbrisk@alternativeoutput.it\\">fai una segnalazione</a>.
+<a class=\\"flat\\" href=\\"mailto:authadmbrisk@alternativeoutput.it\\">fai una segnalazione</a>.<br><br>
+Le regole per ottenere la certificazione sono in via di definizione, l\' unica accettata è la conoscenza
+diretta dell\' utente da parte dell\' amministratore.
</dir>
</div>
<li>il lettore di smart-card per collegare la carta al PC (acquistabile di solito presso le edicole)
</dir>
<br>
-<b>Per effettuare la registrazione collegarsi al sito:</b><br><br>
-<dl>
-<dd><a class=\\"flat\\" target=\\"_blank\\" href=\\"https://brisk.mine.nu\\">https://brisk.mine.nu</a>
-</dl>
-<br><br>
+<b>Per effettuare la registrazione collegarsi al sito:</b> <a class=\\"flat\\" target=\\"_blank\\" href=\\"https://brisk.mine.nu\\">https://brisk.mine.nu</a>
+<br>
Se sei in possesso di una carta che permette l\'identificazione via internet che non è nell\'elenco qui sopra
-<a class=\\"flat\\" href=\\"mailto:authadmbrisk@alternativeoutput.it\\">fai una segnalazione</a>.
+<a class=\\"flat\\" href=\\"mailto:authadmbrisk@alternativeoutput.it\\">fai una segnalazione</a>.<br><br>
+Le regole per ottenere la certificazione sono in via di definizione, l\' unica accettata è la conoscenza
+diretta dell\' utente da parte dell\' amministratore.
+
</dir>
</div>
/* printf("\n"); */
/* } */
+function nickserv_msg($dt, $msg) {
+ return sprintf('chatt_sub("%s",[0x040003,"%s"],"%s");', $dt, NICKSERV, $msg);
+}
+
function passwd_gen($seed = NULL)
{
GLOBAL $G_PG_vow, $G_PG_vow_n, $G_PG_cons, $G_PG_cons_n;
var $delay_mgr;
+ var $cds;
+
public static $sess_cur;
function Brisk()
{
+ $this->cds = NULL;
}
// constructor
fprintf(STDERR, "ROOM FROM FILE\n");
rename($crystal_filename, $crystal_filename.".old");
- $brisk->reload($ban_list, $black_list);
+ $brisk->reload(TRUE, $ban_list, $black_list);
return($brisk);
}
$thiz->ban_list = NULL;
$thiz->black_list = NULL;
- fprintf(STDERR, "PRE IPCLASS_UPDATE (%d, %d)\n", count($ban_list), count($black_list));
- $thiz->ipclass_update('ban_list', $ban_list);
- $thiz->ipclass_update('black_list', $black_list);
- fprintf(STDERR, "POST IPCLASS_UPDATE %d %d\n", count($thiz->ban_list), count($thiz->black_list));
-
for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
$thiz->user[$i] = User::create($thiz, $i, "", "");
}
static::$sess_cur = FALSE;
+ $thiz->reload(TRUE, $ban_list, $black_list);
+
return ($thiz);
}
+ function tor_chk_postprocess($user_idx, $user_sess, $conn_ip, $is_auth, $is_tor)
+ {
+ log_cds(sprintf("user_idx: %d, user_sess: %s, conn_ip: %s, is_auth: %s, is_tor: %s",
+ $user_idx, $user_sess, $conn_ip, ($is_auth ? "YES" : "NO"), ($is_tor ? "YES" : "NO")));
+ }
+
function ipclass_update($ip_out_s, $ip_in)
{
fprintf(STDERR, "N_IN: %d\n", count($ip_in));
}
}
- function reload($ban_list, $black_list)
+ function reload($is_first, $ban_list, $black_list)
{
fprintf(STDERR, "RELOAD STUFF (%d)(%d)\n", count($ban_list), count($black_list));
+ if ($this->cds != NULL) {
+ $this->cds->cmd_cls_deregister_all();
+ unset($this->cds);
+ $this->cds = NULL;
+ }
+ // create cds
+ $this->cds = new Curl_de_sac();
+
+ // create tor_chk_cls
+ $tor_chk_cls = new tor_chk_cmd_cls();
+
+ // registrer tor_chk_cls
+ printf("MAIN: Register 'tor_chk_cls'\n");
+ if (($this->cds->cmd_cls_register($tor_chk_cls)) == FALSE) {
+ fprintf(STDERR, "MAIN: 'tor_chk_cls' registration failed\n");
+ exit(1);
+ }
+
$this->ipclass_update("ban_list", $ban_list);
$this->ipclass_update("black_list", $black_list);
- $this->banned_kickoff();
- $this->garbage_manager(TRUE);
+ if (!$is_first) {
+ $this->banned_kickoff();
+ $this->garbage_manager(TRUE);
+ }
}
function banned_kickoff()
$user_tos_vers = $user_item->tos_vers_get();
if (versions_cmp($user_tos_vers, "1.2") < 0) {
- $mesg = sprintf('chatt_sub("%s",[2,"%s"],"%s");',
- $dt, NICKSERV, sprintf($mlang_brisk['tos_old'][$G_lang], xcape($user_login)));
+ $mesg = nickserv_msg($dt, sprintf($mlang_brisk['tos_old'][$G_lang], xcape($user_login)));
}
else if ($guar_login == "") {
- $mesg = sprintf('chatt_sub("%s",[2,"%s"],"%s");',
- $dt, NICKSERV, sprintf($mlang_brisk['gua_nfd'][$G_lang], xcape($user_login)));
+ $mesg = nickserv_msg($dt, sprintf($mlang_brisk['gua_nfd'][$G_lang], xcape($user_login)));
}
else if ($guar_login == $user_login) {
- $mesg = sprintf('chatt_sub("%s",[2,"%s"],"%s");',
- $dt, NICKSERV, sprintf($mlang_brisk['gua_self'][$G_lang], xcape($user_login)));
+ $mesg = nickserv_msg($dt, sprintf($mlang_brisk['gua_self'][$G_lang], xcape($user_login)));
}
else {
- $mesg = sprintf('chatt_sub("%s",[2,"%s"],"%s");',
- $dt, NICKSERV, sprintf($mlang_brisk['gua_info'][$G_lang],
- xcape($user_login), xcape($guar_login)));
+ $mesg = nickserv_msg($dt, sprintf($mlang_brisk['gua_info'][$G_lang],
+ xcape($user_login), xcape($guar_login)));
}
} while (0);
if ($ret > 0) {
- $mesg = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, sprintf($mlang_brisk['gua_err'][$G_lang], $ret));
+ $mesg = nickserv_msg($dt, sprintf($mlang_brisk['gua_err'][$G_lang], $ret));
}
$user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ".$mesg;
/* MLANG: "Alarm <b>%s</b> inviato a <b>%s</b>." */
$prestr = sprintf($mlang_brisk['alarret'][$G_lang], xcape(substr($msg, strlen($alarm_check))),
($target == "" ? $mlang_brisk['tit_all'][$G_lang] : xcape($target)) );
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],%s);',
- $dt, NICKSERV, $prestr);
+ $to_user = nickserv_msg($dt, $prestr);
$msg = sprintf("<br><b>%s<br><br>%s</b><br><br>",
$dt.NICKSERV, xcape(substr($msg, strlen($alarm_check))));
$flags_old = 0;
if ($user->stat == 'room' && $user->subst == 'sitdown' &&
$user->table >= TABLES_AUTH_N) {
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['listmust'][$G_lang]);
+ $to_user = nickserv_msg($dt, $mlang_brisk['listmust'][$G_lang]);
}
else {
}
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]);
+ $to_user = nickserv_msg($dt, $mlang_brisk['authmust'][$G_lang]);
}
}
else if (strncmp($msg, "/mesgtoadm", 8) == 0) {
}
else {
/* MLANG: "<b>Per inviare un messaggio devi essere autenticato.</b>" */
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['mesgmust'][$G_lang]);
+ $to_user = nickserv_msg($dt, $mlang_brisk['mesgmust'][$G_lang]);
}
}
else if (strncmp($msg, "/nick ", 6) == 0) {
do {
if (($name_new = validate_name(substr($msg, 6))) == FALSE) {
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['nickmust'][$G_lang]);
+ $to_user = nickserv_msg($dt, $mlang_brisk['nickmust'][$G_lang]);
break;
}
}
if ($i < MAX_PLAYERS) {
$prestr = sprintf($mlang_brisk['nickdupl'][$G_lang], xcape($name_new));
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $prestr);
+ $to_user = nickserv_msg($dt, $prestr);
break;
}
}
}
else {
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authchan'][$G_lang]);
+ $to_user = nickserv_msg($dt, $mlang_brisk['authchan'][$G_lang]);
break;
}
}
/* 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 ($bdb->login_exists($name_new)) {
$prestr = sprintf($mlang_brisk['nickjust'][$G_lang], xcape($name_new));
- $to_user .= sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $prestr);
+ $to_user .= nickserv_msg($dt, $prestr);
}
}
}
}
else {
/* MLANG: "Questo stato non esiste." */
- $to_user = sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['statunkn'][$G_lang]);
+ $to_user = nickserv_msg($dt, $mlang_brisk['statunkn'][$G_lang]);
break;
}
}
$idx = $ghost;
+ if ($this->cds->execute("tor_chk", $this, $ghost, $sess, $ip, $authenticate != FALSE) == FALSE) {
+ log_main("cds_execute failed");
+ }
+
return ($this->user[$ghost]);
}
else if ($idx != -1 && $i == MAX_PLAYERS) {
log_main(sprintf("TROVATO LIBERO A [%d] sess [%s] name [%s] count [%d] name [%s] code [%s]", $idx, $sess, $name_new, count($this->user),$this->user[$real_idx]->name, $this->user[$real_idx]->code));
$ret = $this->user[$real_idx];
+ if ($this->cds->execute("tor_chk", $this, $real_idx, $sess, $ip, $authenticate != FALSE) == FALSE) {
+ log_main("cds_execute failed");
+ }
+
return ($ret);
}
}
+function log_cds($log)
+{
+ GLOBAL $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_CDS) == 0)
+ return;
+
+ $sess = Brisk::sess_cur_get();
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_CDS) == 0)
+ return;
+
+ if ((BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
+ if (($fp = @fopen(LEGAL_PATH."/cds.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("CDS: [%f] [%s] [%s]\n", gettimeofday(TRUE), $log, $btrace));
+ fclose($fp);
+ }
+}
+
+
function log_only2($log)
{
GLOBAL $PHP_SELF;
$dt = date("H:i ", $curtime);
for ($i = 0 ; $i < count($root_wellarr[$G_lang]) ; $i++)
- $ret .= sprintf('chatt_sub("%s",[2,"%s"],"%s");', $dt, NICKSERV, str_replace('"', '\"', $root_wellarr[$G_lang][$i]));
+ $ret .= nickserv_msg($dt, str_replace('"', '\"', $root_wellarr[$G_lang][$i]));
return ($ret);
}