X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=db065d93c0a5fffed27f98c64e381af50f558e6a;hb=refs%2Fheads%2Fstepback;hp=731dbdd520a6eb7e52d6383ed69c5bf5db681580;hpb=dfd5187d543b2f2233a794d08d6df04f50305103;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 731dbdd..db065d9 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -2,7 +2,7 @@ /* * brisk - brisk.phh * - * Copyright (C) 2006-2013 Matteo Nastasi + * Copyright (C) 2006-2014 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -64,21 +64,23 @@ define('NICKSERV', "BriskServ"); define('LOCK_SHARE_MAX', 10000); -define('DBG_ONL2', 0x0001); -define('DBG_ONLY', 0x0002); -define('DBG_MAIN', 0x0004); -define('DBG_READ', 0x0008); -define('DBG_REA2', 0x0010); -define('DBG_SEND', 0x0020); -define('DBG_LOCK', 0x0040); -define('DBG_WRIT', 0x0080); -define('DBG_LOAD', 0x0100); -define('DBG_AUTH', 0x0200); -define('DBG_CRIT', 0x0400); -define('DBG_LMOP', 0x0800); -define('DBG_TRAC', 0x1000); -define('DBG_SHME', 0x2000); -define('DBG_ENGI', 0x4000); +define('DBG_ONL2', 0x000001); +define('DBG_ONLY', 0x000002); +define('DBG_MAIN', 0x000004); +define('DBG_READ', 0x000008); +define('DBG_REA2', 0x000010); +define('DBG_SEND', 0x000020); +define('DBG_LOCK', 0x000040); +define('DBG_WRIT', 0x000080); +define('DBG_LOAD', 0x000100); +define('DBG_AUTH', 0x000200); +define('DBG_CRIT', 0x000400); +define('DBG_LMOP', 0x000800); +define('DBG_TRAC', 0x001000); +define('DBG_SHME', 0x002000); +define('DBG_ENGI', 0x004000); +define('DBG_CDS', 0x008000); +define('DBG_STEP', 0x010000); // NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols define('BRISK_DEBUG', 0x0800); @@ -108,8 +110,8 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi', 'en' => 'EN
The signalling message of the table
will be deactivated for %d second%s.

'), 'alarpass' => array( 'it' => '
La password digitata non è corretta.

', 'en' => '
The entered password is not correct.

'), - 'alarret' => array( 'it' => '"Alarm \\"%s\\" inviato a %s."', - 'en' => '"Alarm \\"%s\\" sent to %s."'), + 'alarret' => array( 'it' => 'Alarm \\"%s\\" inviato a %s.', + 'en' => 'Alarm \\"%s\\" sent to %s.'), 'authmust' => array( 'it' => 'Per autenticare qualcuno devi a tua volta essere autenticato e certificato.', 'en' => 'To authenticate someone you have to be authenticated and certified.'), // on your turn 'mesgmust' => array( 'it' => 'Per inviare un messaggio devi essere autenticato.', @@ -151,12 +153,12 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi', $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.15.0"; /* MLANG: ALL THE INFO STRINGS IN brisk.phh */ -$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': 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.'), NOVITA\': primo passo per rendere più robusto il sistema di notifica.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ), - 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: new users subscription system.', + 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: new users subscription system, refactored sidebanner system.', 'If you want to subscribe our Mailing List, click it!' ) ); $G_room_help = array( 'it' => ' @@ -230,7 +232,7 @@ $G_room_passwdhowto = array( 'it' => '

Come registrarsi su Brisk

Attualmente ci sono due metodi per ottenere una password sul sito:

-
  • Facendosi garantire da un utente di Brisk che già possidede una password

    +
  • Facendosi garantire da un utente di Brisk che sia certificato.

  • Auto-garantendosi utilizzando uno dei seguenti sistemi di identificazione digitale:

  • Carta Regionale dei Servizi della Lombardia (la tessera sanitaria) @@ -244,13 +246,12 @@ Attualmente ci sono due metodi per ottenere una password sul sito:

  • il lettore di smart-card per collegare la carta al PC (acquistabile di solito presso le edicole)

  • -Per effettuare la registrazione collegarsi al sito:

    -
    -
    https://brisk.mine.nu -
    -

    +Per effettuare la registrazione collegarsi al sito: https://brisk.mine.nu +
    Se sei in possesso di una carta che permette l\'identificazione via internet che non è nell\'elenco qui sopra -fai una segnalazione. +fai una segnalazione.

    +Le regole per ottenere la certificazione sono in via di definizione, l\' unica accettata è la conoscenza +diretta dell\' utente da parte dell\' amministratore.
  • @@ -272,13 +273,13 @@ EN Attualmente ci sono due metodi per ottenere una password sul sito:

  • il lettore di smart-card per collegare la carta al PC (acquistabile di solito presso le edicole)
    -Per effettuare la registrazione collegarsi al sito:

    -
    -
    https://brisk.mine.nu -
    -

    +Per effettuare la registrazione collegarsi al sito: https://brisk.mine.nu +
    Se sei in possesso di una carta che permette l\'identificazione via internet che non è nell\'elenco qui sopra -fai una segnalazione. +fai una segnalazione.

    +Le regole per ottenere la certificazione sono in via di definizione, l\' unica accettata è la conoscenza +diretta dell\' utente da parte dell\' amministratore. + @@ -343,6 +344,10 @@ $G_PG_cons_n = 345; /* 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; @@ -997,10 +1002,13 @@ class Brisk var $delay_mgr; + var $cds; + public static $sess_cur; function Brisk() { + $this->cds = NULL; } // constructor @@ -1010,7 +1018,7 @@ class Brisk 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); } @@ -1027,11 +1035,6 @@ class 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, "", ""); } @@ -1046,6 +1049,8 @@ class Brisk static::$sess_cur = FALSE; + $thiz->reload(TRUE, $ban_list, $black_list); + return ($thiz); } @@ -1070,15 +1075,22 @@ class Brisk } } - 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 (defined('CURL_DE_SAC_VERS')) { + if (brisk_cds_reload($this) == FALSE) { + exit(12); + } + } $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() @@ -1599,26 +1611,22 @@ class Brisk $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; @@ -1796,8 +1804,7 @@ class Brisk /* MLANG: "Alarm %s inviato a %s." */ $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("
    %s

    %s


    ", $dt.NICKSERV, xcape(substr($msg, strlen($alarm_check)))); @@ -1812,7 +1819,7 @@ class Brisk $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 { @@ -1845,7 +1852,7 @@ class Brisk } else { /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato.", "Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.", "Nickname %s 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) { @@ -1854,7 +1861,7 @@ class Brisk } else { /* MLANG: "Per inviare un messaggio devi essere autenticato." */ - $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) { @@ -1862,7 +1869,7 @@ class Brisk 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; } @@ -1877,7 +1884,7 @@ class Brisk } 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; } @@ -1895,7 +1902,7 @@ class Brisk } } 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; } } @@ -1908,7 +1915,7 @@ class Brisk /* MLANG: "Il nickname \'%s\' è già registrato, se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghostN." */ 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); } } } @@ -1979,7 +1986,7 @@ class Brisk } 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; } @@ -2137,7 +2144,7 @@ class Brisk } /* - * function add_user(&$brisk, &$sess, &$idx, $name, $pass, $ip) + * function add_user(&$brisk, &$sess, &$idx, $name, $pass, $ip, $header, $cookie) * * RETURN VALUE: * if ($idx > -1 && ret == FALSE) => duplicated nick @@ -2148,7 +2155,7 @@ class Brisk * if ($idx == -$idx && ret == user) => SUCCESS (but the login exists in the auth db) */ - function add_user(&$sess, &$idx, $name, $pass, $ip, $cookie) + function add_user(&$sess, &$idx, $name, $pass, $ip, $header, $cookie) { GLOBAL $G_base; @@ -2257,6 +2264,9 @@ class Brisk } $idx = $ghost; + if (defined('CURL_DE_SAC_VERS')) { + brisk_cds_execute($this, $ghost, $real_idx, $sess, $ip, $authenticate, $header); + } return ($this->user[$ghost]); } else if ($idx != -1 && $i == MAX_PLAYERS) { @@ -2356,6 +2366,9 @@ class Brisk 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 (defined('CURL_DE_SAC_VERS')) { + brisk_cds_execute($this, $ghost, $real_idx, $sess, $ip, $authenticate, $header); + } return ($ret); } @@ -2516,7 +2529,7 @@ class Brisk case "": case "index.php": ob_start(); - index_main($this, $transp_type, $header_out, $addr, $get, $post, $cookie); + index_main($this, $transp_type, $header, $header_out, $addr, $get, $post, $cookie); $content = ob_get_contents(); ob_end_clean(); @@ -2708,6 +2721,60 @@ function log_mop($step, $log) } } +function log_step($log) +{ + GLOBAL $PHP_SELF; + + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_STEP) == 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_STEP) == 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."/step.log", 'a')) != FALSE) { + fwrite($fp, sprintf("STEP: [%f] [%s] [%s]\n", gettimeofday(TRUE), $log, $btrace)); + fclose($fp); + } +} + + + +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) { @@ -3091,7 +3158,7 @@ function root_welcome($user) $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); }