X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=db065d93c0a5fffed27f98c64e381af50f558e6a;hb=refs%2Ftags%2Fv4.15.0;hp=881e9a3c9b12dc88e5161de32474a097c291a73a;hpb=7bccbb21239ca3cecf2914e9b307ab1e1b1aa46e;p=brisk.git
diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh
index 881e9a3..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,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!' ) );
@@ -1007,18 +1008,7 @@ class Brisk
function Brisk()
{
- // 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->cds = NULL;
}
// constructor
@@ -1028,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);
}
@@ -1045,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, "", "");
}
@@ -1064,6 +1049,8 @@ class Brisk
static::$sess_cur = FALSE;
+ $thiz->reload(TRUE, $ban_list, $black_list);
+
return ($thiz);
}
@@ -1088,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()
@@ -2150,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
@@ -2161,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;
@@ -2270,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) {
@@ -2369,10 +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 ($this->cds->execute("tor_chk", $this, $real_idx, $sess, $ip) == FALSE) {
- log_main("cds_execute failed");
+ if (defined('CURL_DE_SAC_VERS')) {
+ brisk_cds_execute($this, $ghost, $real_idx, $sess, $ip, $authenticate, $header);
}
-
return ($ret);
}
@@ -2533,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();
@@ -2725,6 +2721,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)
{