X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2FObj%2Fbrisk.phh;h=62946ed10a3d356c1d4468d355ad43920b67f16a;hb=b1bb4eedabda830bd520f773928cd848c5dcb11a;hp=41524d291989e5b2dfa9caffdbd52415b36a5b1f;hpb=7bb29caf1761665d81089090d1df1153b5d2bab9;p=brisk.git
diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh
index 41524d2..62946ed 100644
--- a/web/Obj/brisk.phh
+++ b/web/Obj/brisk.phh
@@ -2,7 +2,7 @@
/*
* brisk - brisk.phh
*
- * Copyright (C) 2006-2011 Matteo Nastasi
+ * Copyright (C) 2006-2012 Matteo Nastasi
* mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
@@ -50,6 +50,8 @@ define('CHAT_ENABLED', TRUE);
define('SESS_LEN', 13);
define('STREAM_TIMEOUT', 60);
/* FIXME: move to sac-a-push .phh */
+/* TIME_RD define the server-side timeout, after half of it a ping request
+ is sent to client, after this time the client is log out */
define('EXPIRE_TIME_RD', 180);
define('EXPIRE_TIME_SMAMMA', 360);
define('EXPIRE_TIME_WAG', 10);
@@ -284,7 +286,7 @@ Copyright 2006-2012 Matteo Nasta
declaration briscola in ajax sauce (Beta)
version '.$G_brisk_version.'
-Copyright 2006-2009 Matteo Nastasi (aka mop)
');
+Copyright 2006-2012 Matteo Nastasi (aka mop)
');
function mop_flush()
{
@@ -678,7 +680,7 @@ class Room {
var $match;
var $comm; // commands for many people
var $step; // current step of the comm array
- // externalized var $garbage_timeout;
+ var $garbage_timeout;
var $shm_sz;
function Room () {
@@ -707,8 +709,7 @@ class Room {
else
$this->table[$i]->auth_only = FALSE;
}
- // externalized $this->garbage_timeout = 0;
- Room::garbage_time_expire_set(0);
+ $this->garbage_timeout = 0;
$this->shm_sz = SHM_DIMS_MIN;
}
@@ -723,8 +724,7 @@ class Room {
/* Garbage collector degli utenti in timeout */
$curtime = time();
- // externalized if ($force || $this->garbage_timeout < $curtime) {
- if (!$force && !Room::garbage_time_is_expired($curtime)) {
+ if (!$force && !($this->garbage_timeout < $curtime)) {
return ($ismod);
}
@@ -872,8 +872,7 @@ class Room {
}
log_rd2("GARBAGE UPDATED!");
- // externalized $this->garbage_timeout = time() + GARBAGE_TIMEOUT;
- Room::garbage_time_expire_set($curtime + GARBAGE_TIMEOUT);
+ $this->garbage_timeout = $curtime + GARBAGE_TIMEOUT;
$ismod = TRUE;
return ($ismod);
@@ -1653,9 +1652,9 @@ class Room {
* if ($idx == -$idx && ret == user) => SUCCESS (but the login exists in the auth db)
*/
- function add_user(&$sess, &$idx, $name, $pass, $ip)
+ function add_user(&$sess, &$idx, $name, $pass, $ip, $cookie)
{
- GLOBAL $G_base, $CO_list;
+ GLOBAL $G_base;
$idx = 0;
@@ -1795,12 +1794,12 @@ class Room {
$this->user[$idx]->code = $authenticate->code_get();
$this->user[$idx]->flags |= USER_FLAG_LISTAUTH;
- if (isset($CO_list)) {
- if (strcmp($CO_list, "auth") == 0) {
+ if (isset($cookie['CO_list'])) {
+ if (strcmp($cookie['CO_list'], "auth") == 0) {
$this->user[$idx]->flags &= ~USER_FLAG_MAP_AUTH;
$this->user[$idx]->flags |= USER_FLAG_LISTAUTH;
}
- if (strcmp($CO_list, "isolation") == 0) {
+ if (strcmp($cookie['CO_list'], "isolation") == 0) {
$this->user[$idx]->flags &= ~USER_FLAG_MAP_AUTH;
$this->user[$idx]->flags |= USER_FLAG_ISOLAUTH;
}
@@ -2133,48 +2132,6 @@ class Room {
return ($ret);
}
- static function garbage_time_is_expired($tm)
- {
- $ret = TRUE;
- $fp = FALSE;
- do {
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH, 0775, TRUE);
- if (($fp = @fopen(PROXY_PATH."/garbage_time.expired", 'rb')) == FALSE)
- break;
- if (($s = fread($fp, 4)) == FALSE)
- break;
- if (mb_strlen($s, "ASCII") != 4)
- break;
- $arr = unpack('Le', $s);
- if ($arr['e'] > $tm)
- $ret = FALSE;
- } while (0);
-
- if ($fp != FALSE)
- fclose($fp);
-
- log_rd2("END: return ".($ret ? "TRUE" : "FALSE"));
-
- return ($ret);
- }
-
- static function garbage_time_expire_set($tm)
- {
- do {
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH, 0775, TRUE);
- if (($fp = @fopen(PROXY_PATH."/garbage_time.expired", 'wb')) == FALSE)
- break;
- fwrite($fp, pack("L",$tm));
- fclose($fp);
-
- return (TRUE);
- } while (0);
-
- return (FALSE);
- }
-
function request_mgr(&$s_a_p, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
{
printf("NEW_SOCKET (root): %d\n", intval($new_socket));