X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=841ee0e1f296fab1ffb41d3056344e50a434f46a;hb=1f1dc03f2bfda5d54dba9c25e8e3f9f45a4f1547;hp=3af8a15f854c4bebc15b189d334abcc921431b54;hpb=706f411d26dee22befc679885d715dd620b674e5;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 3af8a15..841ee0e 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -64,22 +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_CDS', 0x8000); +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); @@ -152,10 +153,10 @@ $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.5"; +$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, nuovi colori, nuovo sistema bi banner laterali per gli eventi', +$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, refactored sidebanner system.', 'If you want to subscribe our Mailing List, click it!' ) ); @@ -982,6 +983,67 @@ class Client_prefs { } } +define('GHOST_SESS_TOUT', 300); +define('GHOST_SESS_REAS_ANOT', 1); +class GhostSessEl +{ + var $time; + var $sess; + var $reas; + + function GhostSessEl($time, $sess, $reas) + { + $this->time = $time + GHOST_SESS_TOUT; + $this->sess = $sess; + $this->reas = $reas; + } +} + +class GhostSess +{ + var $gs; + + function GhostSess() + { + $this->gs = array(); + } + + // push or update for this session + function push($time, $sess, $reas) + { + foreach($this->gs as $el) { + if ($el->sess == "$sess") { + $el->reas = $reas; + $el->time = $time + GHOST_SESS_TOUT; + return TRUE; + } + } + + $this->gs[] = new GhostSessEl($time, $sess, $reas); + return TRUE; + } + + function pop($sess) + { + foreach($this->gs as $key => $el) { + if ($el->sess == "$sess") { + $ret = $this->gs[$key]; + unset($this->gs[$key]); + return ($ret); + } + } + return FALSE; + } + + function garbage_manager($curtime) + { + foreach($this->gs as $key => $el) { + if ($el->time < $curtime) { + unset($this->gs[$key]); + } + } + } +} class Brisk { @@ -998,7 +1060,7 @@ class Brisk var $ban_list; // ban list (authized allowed) var $black_list; // black list (anti-dos, noone allowed) - + var $ghost_sess; var $delay_mgr; var $cds; @@ -1033,6 +1095,7 @@ class Brisk $thiz->ban_list = NULL; $thiz->black_list = NULL; + $thiz->ghost_sess = new GhostSess(); for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { $thiz->user[$i] = User::create($thiz, $i, "", ""); @@ -1331,6 +1394,8 @@ class Brisk $this->garbage_timeout = $curtime + GARBAGE_TIMEOUT; $ismod = TRUE; + $this->ghost_sess->garbage_manager($curtime); + $this->delay_mgr->lastcheck_set($curtime); return ($ismod); } @@ -2143,7 +2208,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 @@ -2154,7 +2219,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; @@ -2237,6 +2302,7 @@ class Brisk $ghost_user = $this->user[$ghost]; $curtime = time(); + $this->ghost_sess->push($curtime, $ghost_user->sess, GHOST_SESS_REAS_ANOT); $ghost_user->comm[$ghost_user->step % COMM_N] = ""; $ghost_user->step_inc(); if ($sess == "") { @@ -2264,7 +2330,7 @@ class Brisk $idx = $ghost; if (defined('CURL_DE_SAC_VERS')) { - brisk_cds_execute($this, $real_idx, $sess, $ip, $authenticate); + brisk_cds_execute($this, $ghost, $real_idx, $sess, $ip, $authenticate, $header); } return ($this->user[$ghost]); } @@ -2366,7 +2432,7 @@ class Brisk $ret = $this->user[$real_idx]; if (defined('CURL_DE_SAC_VERS')) { - brisk_cds_execute($this, $real_idx, $sess, $ip, $authenticate); + brisk_cds_execute($this, $ghost, $real_idx, $sess, $ip, $authenticate, $header); } return ($ret); } @@ -2528,7 +2594,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(); @@ -2720,6 +2786,33 @@ 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) {