X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=87185da28b58a1a463528a6034913faacc9c6300;hb=182eff6ad1aafbdcb765a4190a24a1c8f2f93f6b;hp=794c1e3f1e3ec01daf7c8ee761212cf5af270a2c;hpb=03a659bfa86a9f914d704a82075cf3ecf328eaa8;p=brisk.git
diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh
index 794c1e3..87185da 100644
--- a/web/Obj/brisk.phh
+++ b/web/Obj/brisk.phh
@@ -134,12 +134,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 = "3.4.2";
+$G_brisk_version = "3.4.3";
/* MLANG: ALL THE INFO STRINGS IN brisk.phh */
-$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': versione di test per la nuova gestione dei dati volatili.',
+$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': versione di test per la nuova gestione dei dati volatili, rivista gestione del ticker.',
'Se vuoi iscriverti alla Mailing List, cliccala!' ),
- 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: test version for the new volatile data management.',
+ 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: test version for the new volatile data management, ticker management refactored.',
'If you want to subscribe our Mailing List, click it!' ) );
$G_room_help = array( 'it' => '
@@ -808,39 +808,46 @@ class User {
*/
}
- function step_set($step) {
- $this->step = $step;
-
- do {
- if (validate_sess($this->sess) == FALSE)
- break;
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH);
- if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
- break;
- fwrite($fp, pack("LL",$this->step, $this->idx));
- fclose($fp);
-
- return (TRUE);
- } while (0);
+ function step_set($step)
+ {
+ $this->step = $step & 0x7fffffff;
+
+ do {
+ if (validate_sess($this->sess) == FALSE)
+ break;
+ if (file_exists(PROXY_PATH) == FALSE)
+ mkdir(PROXY_PATH);
+ if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
+ break;
+ fwrite($fp, pack("LL",$this->step, $this->idx));
+ fclose($fp);
- return (FALSE);
+ log_main("step_set [".$this->sess. "] [".$this->step."]");
+
+ return (TRUE);
+ } while (0);
+
+ return (FALSE);
}
-
+
function step_inc($delta = 1) {
- $this->step += $delta;
-
- if (validate_sess($this->sess)) {
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH);
- $fp = fopen(PROXY_PATH."/".$this->sess.".step", 'w');
- fwrite($fp, pack("LL", $this->step, $this->idx));
- fclose($fp);
-
- return (TRUE);
- }
-
- return (FALSE);
+ $this->step += $delta;
+ /* modularization because unpack() not manage unsigned 32bit int correctly */
+ $this->step &= 0x7fffffff;
+
+ if (validate_sess($this->sess)) {
+ if (file_exists(PROXY_PATH) == FALSE)
+ mkdir(PROXY_PATH);
+ $fp = fopen(PROXY_PATH."/".$this->sess.".step", 'w');
+ fwrite($fp, pack("LL", $this->step, $this->idx));
+ fclose($fp);
+
+ log_main("step_inc [".$this->sess. "] [".$this->step."]");
+
+ return (TRUE);
+ }
+
+ return (FALSE);
}
function reset() {
@@ -864,12 +871,12 @@ class User {
// SHSPLIT save and load function for the User class.
- function load_data($id)
+ static function load_data($id, $sess)
{
- GLOBAL $sess;
-
// error_log("User::load_data BEGIN", 0);
+ log_main("load_data: id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
+
$doexit = FALSE;
do {
if (($tok = @ftok(FTOK_PATH."/user".$id, "B")) == -1) {
@@ -888,7 +895,11 @@ class User {
if ($shm = shm_attach($tok, $shm_sz)) {
$user = @shm_get_var($shm, $tok);
- log_only("bri == ".($user == FALSE ? "FALSE" : "TRUE")." bri === ".($user === FALSE ? "FALSE" : "TRUE")." bri isset ".(isset($user) ? "TRUE" : "FALSE"));
+ if ($sess != FALSE && $user->sess != $sess) {
+ $doexit = TRUE;
+ break;
+ }
+ log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE"));
if (isset($user))
log_only("bri count ".count($user));
@@ -896,7 +907,7 @@ class User {
log_only("INIT MAIN DATA");
// SHSPLIT FIXME: init_data for User class ??
- $user =& User::create($id, "", "");
+ $user = User::create($id, "", "");
if (@shm_put_var($shm, $tok, $user) == FALSE) {
log_only("PUT_VAR FALLITA ".strlen(serialize($user)));
log_only(serialize($user));
@@ -921,7 +932,7 @@ class User {
}
- function save_data(&$user, $id)
+ function save_data($user, $id)
{
GLOBAL $sess;
@@ -957,39 +968,39 @@ class User {
}
+ static function step_get($sess)
+ {
+ $fp = FALSE;
+ do {
+ if (validate_sess($sess) == FALSE)
+ break;
+
+ if (file_exists(PROXY_PATH) == FALSE)
+ mkdir(PROXY_PATH);
+ if (($fp = @fopen(PROXY_PATH."/".$sess.".step", 'rb')) == FALSE)
+ break;
+ if (($s = fread($fp, 8)) == FALSE)
+ break;
+ if (strlen($s) != 8)
+ break;
+ $arr = unpack('Ls/Li', $s);
+ fclose($fp);
+
+ // log_rd2("A0: ".$arr[0]." A1: ".$arr[1]);
+ return ($arr);
+ } while (0);
+
+ if ($fp != FALSE)
+ fclose($fp);
+
+ log_rd2("STEP_GET [".$sess."]: return false ");
+
+ return (FALSE);
+ }
} // end class User
-function step_get($sess) {
- $fp = FALSE;
- do {
- if (validate_sess($sess) == FALSE)
- break;
-
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH);
- if (($fp = @fopen(PROXY_PATH."/".$sess.".step", 'rb')) == FALSE)
- break;
- if (($s = fread($fp, 8)) == FALSE)
- break;
- if (strlen($s) != 8)
- break;
- $arr = unpack('Ls/Li', $s);
- fclose($fp);
-
- // log_rd2("A0: ".$arr[0]." A1: ".$arr[1]);
- return ($arr);
- } while (0);
-
- if ($fp != FALSE)
- fclose($fp);
-
- log_rd2("STEP_GET: return false ");
-
- return (FALSE);
-}
-
function step_unproxy($sess) {
log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step");
if (file_exists(PROXY_PATH) == FALSE)
@@ -2408,8 +2419,8 @@ class Room {
if ($user->stat != 'room')
return;
- for ($e = 0 , $ct = 0 ; $ct < 4 && $e < MAX_PLAYERS ; $e++) {
- if ($this->user[$e]->sess == "" || $this->user[$e]->stat != "room" || $this->user[$e]->name == "")
+ for ($i = 0 , $ct = 0 ; $ct < 4 && $i < MAX_PLAYERS ; $i++) {
+ if ($this->user[$i]->sess == "" || $this->user[$i]->stat != "room" || $this->user[$i]->name == "")
continue;
$ct++;
}
@@ -2418,20 +2429,19 @@ class Room {
$content = ' j_stand_cont( [ ';
- for ($e = 0 , $ct = 0 ; $e < MAX_PLAYERS ; $e++) {
- if ($this->user[$e]->sess == "" || $this->user[$e]->stat != "room" || $this->user[$e]->name == "")
+ for ($i = 0 , $ct = 0 ; $i < MAX_PLAYERS ; $i++) {
+ if ($this->user[$i]->sess == "" || $this->user[$i]->stat != "room" || $this->user[$i]->name == "")
continue;
- $flags = $this->user[$e]->flags;
+ $flags = $this->user[$i]->flags;
- if ($this->user[$e]->subst == "standup") {
- if ($this->user[$e] == $user)
- {
- $flags |= 1;
+ if ($this->user[$i]->subst == "standup") {
+ if ($user->idx_get() == $i) {
+ $flags |= 1;
}
-
- $content .= sprintf('%s[ %d, "%s" ]',($ct > 0 ? ', ' : ''), $flags, xcape($this->user[$e]->name));
- $ct++;
+
+ $content .= sprintf('%s[ %d, "%s" ]',($ct > 0 ? ', ' : ''), $flags, xcape($this->user[$i]->name));
+ $ct++;
}
}
$content .= ' ]);';