From: Matteo Nastasi (mop) Date: Thu, 23 Jan 2014 17:35:47 +0000 (+0100) Subject: Merge branch 'master', remote branch 'origin' into auto-maintenance X-Git-Tag: v4.14.0~22 X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=brisk.git;a=commitdiff_plain;h=43b825479e2c58fe49b714e8d09fbbf472b8e662;hp=14986dd09de4a3e52f42bd0730c44e0ab8fa5099 Merge branch 'master', remote branch 'origin' into auto-maintenance --- diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 6867802..1fbfa0a 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -150,12 +150,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.12.0"; +$G_brisk_version = "4.12.4"; /* MLANG: ALL THE INFO STRINGS IN brisk.phh */ -$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': aggiunta la gestione automatica dei termini del servizio, comando /guar per info sul garante di un utente.', +$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': potenziato il sistema di debug.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ), - 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: automatic management of terms of services added, new /guar command to ask info about a user guarantee.', + 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: empowered logging system.', 'If you want to subscribe our Mailing List, click it!' ) ); $G_room_help = array( 'it' => ' @@ -623,17 +623,17 @@ class Table { return ($this->player_n - 1); } - function user_rem($room, $user) + function user_rem($brisk, $user) { $tabpos = $user->table_pos; /* verifico la consistenza dei dati */ - if ($room->user[$this->player[$tabpos]] == $user) { + if ($brisk->user[$this->player[$tabpos]] == $user) { /* aggiorna l'array dei giocatori al tavolo. */ for ($i = $tabpos ; $i < $this->player_n-1 ; $i++) { $this->player[$i] = $this->player[$i+1]; - $user_cur = $room->user[$this->player[$i]]; + $user_cur = $brisk->user[$this->player[$i]]; $user_cur->table_pos = $i; } $this->player_n--; @@ -830,7 +830,7 @@ class Client_prefs { } -class Room +class Brisk { static $delta_t; @@ -845,7 +845,9 @@ class Room var $delay_mgr; - function Room ($crystal_filename) { + public static $sess_cur; + + function Brisk($crystal_filename) { $this->crystal_filename = $crystal_filename; $this->user = array(); $this->table = array(); @@ -876,6 +878,8 @@ class Room $this->shm_sz = SHM_DIMS_MIN; $this->delay_mgr = new Delay_Manager(1.5); + + static::$sess_cur = FALSE; } function garbage_manager($force) @@ -907,27 +911,27 @@ class Room $no_recovery = FALSE; if (isset($this->match[$table_idx])) { - $bri = $this->match[$table_idx]; + $bin5 = $this->match[$table_idx]; - if ($table_cur->table_token != $bri->table_token) { - log_main("ERROR: not matching table_token. Room: ".$table_cur->table_token." Table: ".$bri->table_token); - log_main("ERROR: not matching table_start. Room: ".$table_cur->table_start." Table: ".$bri->table_start); + if ($table_cur->table_token != $bin5->table_token) { + log_main("ERROR: not matching table_token. Brisk: ".$table_cur->table_token." Table: ".$bin5->table_token); + log_main("ERROR: not matching table_start. Brisk: ".$table_cur->table_start." Table: ".$bin5->table_start); $no_recovery = TRUE; - $bri = FALSE; + $bin5 = FALSE; } - if ($bri != FALSE) { + if ($bin5 != FALSE) { // // SPAWN: JOIN // log_main("garbage_manager: bri loaded successfully."); - $bri->garbage_manager(TRUE); + $bin5->garbage_manager(TRUE); - $bri_table = $bri->table[0]; + $bin5_table = $bin5->table[0]; // is the end of the table - if ($bri->the_end == TRUE) { + if ($bin5->the_end == TRUE) { /* * DESTROY OF FINISHED TABLE && MOVE PLAYER TO ROOM AGAIN */ @@ -938,16 +942,16 @@ class Room $plist .= '|'.$this->user[$table_cur->player[$i]]->sess; } - for ($i = 0 ; $i < $bri_table->player_n ; $i++) { + for ($i = 0 ; $i < $bin5_table->player_n ; $i++) { // stat must be "table" by definition $user_cur = $this->user[$table_cur->player[$i]]; - $bri_user = $bri->user[$i]; + $bin5_user = $bin5->user[$i]; - $user_cur->subst = $bri_user->subst; - $user_cur->step = $bri_user->step; - $user_cur->lacc = $bri_user->lacc; - $user_cur->laccwr = $bri_user->lacc; - $user_cur->bantime = $bri_user->bantime; + $user_cur->subst = $bin5_user->subst; + $user_cur->step = $bin5_user->step; + $user_cur->lacc = $bin5_user->lacc; + $user_cur->laccwr = $bin5_user->lacc; + $user_cur->bantime = $bin5_user->bantime; } log_legal($curtime, $user_cur->ip, $user_cur, "STAT:DESTROY_GAME", $plist); @@ -961,11 +965,11 @@ class Room else { log_main("gm:: save_data"); - for ($i = 0 ; $i < $bri_table->player_n ; $i++) { - $this->user[$table_cur->player[$i]]->lacc = $bri->user[$i]->lacc; + for ($i = 0 ; $i < $bin5_table->player_n ; $i++) { + $this->user[$table_cur->player[$i]]->lacc = $bin5->user[$i]->lacc; } } - } // if ($bri == FALSE + } // if ($bin5 == FALSE else if ($no_recovery == FALSE) { log_crit("ERROR: table ".$table_idx." unrecoverable join"); @@ -1809,19 +1813,19 @@ class Room // Before all align times with table timeout for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) { if (isset($this->match[$table_idx])) { - $bri = $this->match[$table_idx]; + $bin5 = $this->match[$table_idx]; - $bri_table = $bri->table[0]; - for ($i = 0 ; $i < $bri_table->player_n ; $i++) { + $bin5_table = $bin5->table[0]; + for ($i = 0 ; $i < $bin5_table->player_n ; $i++) { // stat must be "table" by definition - $bri_user = $bri->user[$i]; + $bin5_user = $bin5->user[$i]; - if ($target != "" && $bri_user->name != $target) + if ($target != "" && $bin5_user->name != $target) continue; log_main("writa: ".$user_mesg); - $bri_user->comm[$bri_user->step % COMM_N] = "gst.st = ".($bri_user->step+1)."; "; - $bri_user->comm[$bri_user->step % COMM_N] .= $to_tabl; - $bri_user->step_inc(); + $bin5_user->comm[$bin5_user->step % COMM_N] = "gst.st = ".($bin5_user->step+1)."; "; + $bin5_user->comm[$bin5_user->step % COMM_N] .= $to_tabl; + $bin5_user->step_inc(); } } // if (isset($this->match } // for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) { @@ -1866,7 +1870,7 @@ class Room } /* - * function add_user(&$room, &$sess, &$idx, $name, $pass, $ip) + * function add_user(&$brisk, &$sess, &$idx, $name, $pass, $ip) * * RETURN VALUE: * if ($idx > -1 && ret == FALSE) => duplicated nick @@ -1975,12 +1979,12 @@ class Room if ($ghost_user->stat == "table" && $this->table[$table_idx]->player_n == PLAYERS_N) { require_once("${G_base}briskin5/Obj/briskin5.phh"); if (isset($this->match[$table_idx])) { - $bri = $this->match[$table_idx]; + $bin5 = $this->match[$table_idx]; - if ($bri->the_end != TRUE) { - $bri->user[$ghost_user->table_pos]->comm[$bri->user[$ghost_user->table_pos]->step % COMM_N] = ""; - $bri->user[$ghost_user->table_pos]->step_inc(); - $bri->user[$ghost_user->table_pos]->sess = $sess; + if ($bin5->the_end != TRUE) { + $bin5->user[$ghost_user->table_pos]->comm[$bin5->user[$ghost_user->table_pos]->step % COMM_N] = ""; + $bin5->user[$ghost_user->table_pos]->step_inc(); + $bin5->user[$ghost_user->table_pos]->sess = $sess; } } } @@ -2116,17 +2120,17 @@ class Room // Static functions static function create($crystal_filename) { - if (($room_ser = @file_get_contents($crystal_filename)) == FALSE || - ($room = unserialize($room_ser)) == FALSE) { + if (($brisk_ser = @file_get_contents($crystal_filename)) == FALSE || + ($brisk = unserialize($brisk_ser)) == FALSE) { fprintf(STDERR, "NEW ROOM\n"); - $room = new Room($crystal_filename); + $brisk = new Brisk($crystal_filename); } else { fprintf(STDERR, "ROOM FROM FILE\n"); rename($crystal_filename, $crystal_filename.".old"); } - return $room; + return $brisk; } @@ -2148,31 +2152,31 @@ class Room $shm_sz = SHM_DIMS_MIN; if ($shm = shm_attach($tok, $shm_sz)) { - $room = @shm_get_var($shm, $tok); // CHECKED BELOW + $brisk = @shm_get_var($shm, $tok); // CHECKED BELOW - log_only("bri == ".($room == FALSE ? "FALSE" : "TRUE")." bri === ".($room === FALSE ? "FALSE" : "TRUE")." bri isset ".(isset($room) ? "TRUE" : "FALSE")); - if (isset($room)) - log_only("bri count ".count($room)); + log_only("bri == ".($brisk == FALSE ? "FALSE" : "TRUE")." bri === ".($brisk === FALSE ? "FALSE" : "TRUE")." bri isset ".(isset($brisk) ? "TRUE" : "FALSE")); + if (isset($brisk)) + log_only("bri count ".count($brisk)); - if ($room == FALSE) { + if ($brisk == FALSE) { log_only("INIT MAIN DATA"); shm_detach($shm); - $room = Room::create(); + $brisk = Brisk::create(); - log_shme("Room::create"); + log_shme("Brisk::create"); - if (Room::save_data($room) == FALSE) + if (Brisk::save_data($brisk) == FALSE) return FALSE; - return $room; + return $brisk; } - $room->shm_sz = $shm_sz; + $brisk->shm_sz = $shm_sz; shm_detach($shm); for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - if (($room->user[$i] = User::load_data($i, FALSE)) == FALSE) { + if (($brisk->user[$i] = User::load_data($i, FALSE)) == FALSE) { log_crit("User::load_data failed"); break; } @@ -2185,30 +2189,30 @@ class Room // // SHSPLIT: load users from the shared memory // - return ($room); + return ($brisk); } while (0); return (FALSE); } - function save_data_orig($room) + function save_data_orig($brisk) { GLOBAL $sess; $shm = FALSE; - // var_dump($room); + // var_dump($brisk); if (($tok = @ftok(FTOK_PATH."/main", "C")) == -1) return (FALSE); - while ($room->shm_sz < SHM_DIMS_MAX) { - if (($shm = shm_attach($tok, $room->shm_sz)) == FALSE) + while ($brisk->shm_sz < SHM_DIMS_MAX) { + if (($shm = shm_attach($tok, $brisk->shm_sz)) == FALSE) break; - // log_only("PUT_VAR DI ".strlen(serialize($room))); - if (@shm_put_var($shm, $tok, $room) != FALSE) { + // log_only("PUT_VAR DI ".strlen(serialize($brisk))); + if (@shm_put_var($shm, $tok, $brisk) != FALSE) { shm_detach($shm); return (TRUE); } @@ -2217,7 +2221,7 @@ class Room break; } shm_detach($shm); - $room->shm_sz += SHM_DIMS_DLT; + $brisk->shm_sz += SHM_DIMS_DLT; } if ($shm) @@ -2227,16 +2231,16 @@ class Room } function dump_data() { - $room_ser = serialize($this); - $room_ser_len = mb_strlen($room_ser, "ASCII"); - if (file_put_contents($this->crystal_filename, $room_ser) == $room_ser_len) { + $brisk_ser = serialize($this); + $brisk_ser_len = mb_strlen($brisk_ser, "ASCII"); + if (file_put_contents($this->crystal_filename, $brisk_ser) == $brisk_ser_len) { return (TRUE); } return (FALSE); } - function save_data($room) + function save_data($brisk) { GLOBAL $sess; @@ -2246,21 +2250,21 @@ class Room if (($tok = @ftok(FTOK_PATH."/main", "C")) == -1) return (FALSE); - // SHSPLIT: before save the $room you must save users, + // SHSPLIT: before save the $brisk you must save users, // detach from main struct and (then) reattach $user_park = array(); for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - $user_park[$i] = $room->user[$i]; - $room->user[$i] = FALSE; + $user_park[$i] = $brisk->user[$i]; + $brisk->user[$i] = FALSE; } - while ($room->shm_sz < SHM_DIMS_MAX) { - if (($shm = shm_attach($tok, $room->shm_sz)) == FALSE) + while ($brisk->shm_sz < SHM_DIMS_MAX) { + if (($shm = shm_attach($tok, $brisk->shm_sz)) == FALSE) break; - // log_only("PUT_VAR DI ".strlen(serialize($room))); - if (@shm_put_var($shm, $tok, $room) != FALSE) { - log_shme("Room::save_data"); + // log_only("PUT_VAR DI ".strlen(serialize($brisk))); + if (@shm_put_var($shm, $tok, $brisk) != FALSE) { + log_shme("Brisk::save_data"); $ret = TRUE; break; } @@ -2269,7 +2273,7 @@ class Room break; } shm_detach($shm); - $room->shm_sz += SHM_DIMS_DLT; + $brisk->shm_sz += SHM_DIMS_DLT; } if ($shm) @@ -2278,7 +2282,7 @@ class Room // SHSPLIT: reattach users to the room class for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { User::save_data($user_park[$i], $i); - $room->user[$i] = $user_park[$i]; + $brisk->user[$i] = $user_park[$i]; } log_load("FINISH: ".($ret == TRUE ? "TRUE" : "FALSE")); @@ -2462,6 +2466,7 @@ class Room break; } + $this->sess_cur_set($user->sess); // close a previous opened index_read_ifra socket, if exists if (($prev = $user->rd_socket_get()) != NULL) { $s_a_p->socks_unset($user->rd_socket_get()); @@ -2542,8 +2547,16 @@ class Room } return NULL; } + function sess_cur_set($sess) + { + static::$sess_cur = $sess; + } -} // end class Room + static function sess_cur_get() + { + return(static::$sess_cur); + } +} // end class Brisk function make_seed() { @@ -2580,11 +2593,12 @@ function trace_ftok($id, $add) function log_mop($step, $log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LMOP) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2606,11 +2620,12 @@ function log_mop($step, $log) function log_only2($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONL2) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2631,11 +2646,12 @@ function log_only2($log) function log_crit($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_CRIT) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2656,11 +2672,12 @@ function log_crit($log) function log_only($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONLY) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2681,11 +2698,12 @@ function log_only($log) function log_main($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_MAIN) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2706,11 +2724,12 @@ function log_main($log) function log_rd($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_READ) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2731,11 +2750,12 @@ function log_rd($log) function log_rd2($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_REA2) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2757,11 +2777,12 @@ function log_rd2($log) function log_send($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_SEND) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2782,11 +2803,12 @@ function log_send($log) function log_lock($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOCK) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2807,11 +2829,12 @@ function log_lock($log) function log_wr($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_WRIT) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2832,11 +2855,12 @@ function log_wr($log) function log_load($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOAD) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else @@ -2877,11 +2901,12 @@ function log_auth($sess, $log) function log_shme($log) { - GLOBAL $sess, $PHP_SELF; + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_SHME) == 0) return; + $sess = Brisk::sess_cur_get(); if (isset($sess) == FALSE) $ssess = "XXXX"; else diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index cb10643..27ed4c4 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -626,6 +626,7 @@ class Sac_a_push { $this->main_loop = TRUE; while ($this->main_loop) { + $this->app->sess_cur_set(FALSE); $this->curtime = time(); fprintf(STDERR, "IN LOOP: Current opened: %d pending_pages: %d\n", count($this->socks), count($this->pending_pages)); diff --git a/web/Obj/user.phh b/web/Obj/user.phh index 50fdd66..4754969 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -99,7 +99,7 @@ $mlang_user = array( ); class User { - var $room; // reference to the room where the user is registered + var $brisk; // reference to the room where the user is registered var $idx; // index in the room users array when you are in game var $idx_orig; // index in the room table users array when you aren't in game var $code; // authentication code @@ -155,11 +155,11 @@ class User { function User() { } - static function create(&$room, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { + static function create(&$brisk, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { if (($thiz = new User()) == FALSE) return (FALSE); - $thiz->room = &$room; + $thiz->room = &$brisk; $thiz->idx = $idx; $thiz->idx_orig = $idx; $thiz->code = -1; @@ -685,7 +685,7 @@ class User { log_rd2("NEWSTAT: ".$this->stat); } /* if ($this->rd_step == -1) { */ else { - /* $sem = Room::lock_data(FALSE); */ + /* $sem = Brisk::lock_data(FALSE); */ $S_load_stat['rU_heavy']++; if ($this->rd_step < $this->step) { @@ -693,7 +693,7 @@ class User { if ($this->rd_step + COMM_N < $this->step) { if (($this->rd_stat != $this->stat)) { $to_stat = $this->stat; - /* Room::unlock_data($sem); */ + /* Brisk::unlock_data($sem); */ log_load("RESYNC"); printf("xXx USER::MAINCHECK2 [%s]\n", get_class($this)); return ($this->page_sync($this->sess, ($to_stat == "table" ? "briskin5/index.php" : "index.php"), $this->table, $this->table_token)); @@ -740,12 +740,12 @@ class User { } /* if ($this->the_end == TRUE) { ... */ } /* if ($this->rd_step < $this->step) { */ - /* Room::unlock_data($sem); */ + /* Brisk::unlock_data($sem); */ } /* else of if ($this->rd_step == -1) { */ return ($ret); - } // function maincheck (... + } // function maincheck(... public static function stream_fini($transp, $init_string, $is_unrecoverable) { @@ -809,11 +809,8 @@ function stream_main(&$body, $get, $post, $cookie) $pre_main = gettimeofday(TRUE); - $old_stat = $this->rd_stat; - $old_subst = $this->rd_subst; - $old_step = $this->rd_step; printf("xXx PRE : rd_step %d\n", $this->rd_step); - if (($ret = $this->maincheck($old_stat, $old_subst, $old_step, $get, $post, $cookie)) != FALSE) { + if (($ret = $this->maincheck($get, $post, $cookie)) != FALSE) { $body .= $this->rd_transp->chunk( $this->rd_scristp++, $ret); log_rd2(0, 'index_rd.php: after mop_flush (begin: '.sprintf("%f", $pre_main).')'); } diff --git a/web/brisk.css b/web/brisk.css index f4ffe53..6f375ab 100644 --- a/web/brisk.css +++ b/web/brisk.css @@ -21,25 +21,38 @@ * */ +* { + font-family: verdana, helvetica, arial, sans-serif; + font-size: 13px; + line-height: 120%; +} + +/* TRICK TO REMOVE EXCESS OF PADDING INSIDE INPUT BUTTONS WITH FIREFOX */ +input::-moz-focus-inner { + border: 0; + padding: 0; + margin-top:-2px; + margin-bottom: -2px; +} + body { - background-image: url('img/snowy.jpg'); + background-image: url('img/happysunbg.png'); background-color: #fafafa; background-repeat: no-repeat; background-position: center center; margin:0px; - font-size: 12px; padding: 0px; align: center; } div { - font-size: 12px; + font-size: 100%; } td { - font-size: 12px; + font-size: 100%; } img { @@ -212,16 +225,13 @@ input.input_sub_hi { input.button { border: 1px solid gray; margin: 1px; - padding: 0px; + padding: 2px; color: black; background-color: RGB(246,246,246); vertical-align: middle; text-decoration: none; font-size: 100%; cursor: pointer; - height: 20px ! important; - max-height: 20px ! important; - min-height: 20px ! important; display: inline; } diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 1439943..f51b303 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -1073,7 +1073,7 @@ class Bin5_user extends User { $this->rd_step = $this->step; } /* if ($this->rd_step == -1) { */ else { - /* $sem = Room::lock_data(FALSE); */ + /* $sem = Brisk::lock_data(FALSE); */ $S_load_stat['rU_heavy']++; if ($this->rd_step < $this->step) { @@ -1081,7 +1081,7 @@ class Bin5_user extends User { if ($this->rd_step + COMM_N < $this->step) { if ($this->rd_stat != $this->stat) { $to_stat = $this->stat; - /* Room::unlock_data($sem); */ + /* Brisk::unlock_data($sem); */ log_load("RESYNC"); printf("xXx BIN5_USER::MAINCHECK\n"); return ($this->page_sync($this->sess, ($to_stat == "table" ? "index.php" : "../index.php"), $this->table, $this->table_token)); @@ -1130,12 +1130,12 @@ class Bin5_user extends User { } /* if ($this->the_end == TRUE) { ... */ } /* if ($this->rd_step < $this->step) { */ - /* Room::unlock_data($sem); */ + /* Brisk::unlock_data($sem); */ } /* else of if ($this->rd_step == -1) { */ return ($ret); - } // function maincheck (... + } // function maincheck(... function continue_set($match_code) { @@ -1151,6 +1151,7 @@ class Bin5_user extends User { class Bin5 { static $delta_t = array(); + var $brisk;// room object reference var $user; var $table; @@ -1167,7 +1168,7 @@ class Bin5 { var $delay_mgr; - function Bin5 ($room, $table_idx, $table_token, $get, $post, $cookie) { + function Bin5($brisk, $table_idx, $table_token, $get, $post, $cookie) { $this->user = array(); $this->table = array(); @@ -1178,9 +1179,9 @@ class Bin5 { exit; } - $user = $room->user; - $table = $room->table[$table_idx]; - + $this->brisk = $brisk; + $user = $brisk->user; + $table = $brisk->table[$table_idx]; log_wr("Bin5 constructor"); for ($i = 0 ; $i < $table->player_n ; $i++) { @@ -1483,7 +1484,6 @@ class Bin5 { break; case "index_wr.php": - // FIXME $content can be unset if (isset($table_idx) && isset($table_token)) { if (($bri = $s_a_p->app->match_get($table_idx, $table_token)) != FALSE) { ob_start(); @@ -1521,6 +1521,8 @@ class Bin5 { return TRUE; break; } + $bri->brisk->sess_cur_set($user->sess); + // close a previous opened index_read_ifra socket, if exists if (($prev = $user->rd_socket_get()) != NULL) { $s_a_p->socks_unset($user->rd_socket_get()); diff --git a/web/briskin5/briskin5.css b/web/briskin5/briskin5.css index 4e46e65..26c2854 100644 --- a/web/briskin5/briskin5.css +++ b/web/briskin5/briskin5.css @@ -25,16 +25,6 @@ body { background-image: none; background-color: #fafafa; text-align: center; -/* inherit from brisk.css - background-repeat: no-repeat; - background-position: top center; - margin:0px; - - font-size: 12px; - padding: 0px; - - align: center; -*/ } .chattshort { @@ -43,7 +33,6 @@ body { border: 1px solid gray; vertical-align: text-bottom; text-align: left; - /* font-size: 10pt;*/ } table.chattshort_table { @@ -52,7 +41,6 @@ table.chattshort_table { } .txtt { - /* font-size: 10pt;*/ } img.tableinfo { @@ -90,7 +78,6 @@ img.card { img.astacard { position: absolute; - /* visibility: visible; */ border-width: 0px; } @@ -103,7 +90,6 @@ img.cover { } .chooseed { - /* background-color: yellow; */ visibility: hidden; position:absolute; width: 200px; @@ -114,7 +100,6 @@ img.cover { } .asta { - /* background-color: yellow; */ visibility: hidden; position: absolute; width: 200px; @@ -168,8 +153,6 @@ img.seed3 { } .points { - /* position: relative; */ - margin-top: 8px; padding: 8px; margin-left:auto; @@ -243,23 +226,16 @@ div.table_commands { width: 68; height: 50; margin-top: 4px; - /* - border-style: solid; - border-width: 1px; - border-color: blu; - */ align: center; text-align: center; } .puntifield { - /* position: absolute; */ align: center; text-align: center; } .pubinfo { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -270,7 +246,6 @@ div.table_commands { } .pubinfo_iscalling { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -284,7 +259,6 @@ div.table_commands { } .public { - /* background-color: red; */ visibility: hidden; position: absolute; display: table; @@ -328,7 +302,6 @@ div.table_commands { } .public_we { - /* background-color: red; */ visibility: hidden; position: absolute; top: 250px; @@ -340,7 +313,6 @@ div.table_commands { } .pubinfo_nw { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -351,7 +323,6 @@ div.table_commands { } .pubinfo_nw_iscalling { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -365,7 +336,6 @@ div.table_commands { } .public_nw { - /* background-color: red; */ visibility: hidden; position: absolute; top: 125px; @@ -377,7 +347,6 @@ div.table_commands { } .pubinfo_ne { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -388,7 +357,6 @@ div.table_commands { } .pubinfo_ne_iscalling { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -402,7 +370,6 @@ div.table_commands { } .public_ne { - /* background-color: red; */ visibility: hidden; position: absolute; top: 125px; @@ -414,7 +381,6 @@ div.table_commands { } .pubinfo_ea { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -425,7 +391,6 @@ div.table_commands { } .pubinfo_ea_iscalling { - /* background-color: red; */ color: gray; visibility: visible; position: absolute; @@ -439,7 +404,6 @@ div.table_commands { } .public_ea { - /* background-color: red; */ visibility: hidden; position: absolute; top: 250px; @@ -452,7 +416,7 @@ div.table_commands { .vert_midfloat { position: relative; -#position: absolute; + #position: absolute; _top: 50%; left: 0px; width: 100%; @@ -461,17 +425,12 @@ div.table_commands { } .vert_innfloat { -#position: relative; -#top: -50%; + #position: relative; + #top: -50%; text-align: center; } .vert_innfloat_so { - /* border-style: solid; - border-width: 1px; - border-color: black; - - background-color: white; */ #position: relative; #top: -50%; text-align: center; @@ -522,10 +481,7 @@ div.table_commands { } .callerinfo { - /* background-color: red; */ - /* visibility: visible; */ position: absolute; - /* font-size: 10pt;*/ left: 5px; top: 55px; width: 115px; diff --git a/web/briskin5/index.php b/web/briskin5/index.php index e9e25d7..ac0fb12 100644 --- a/web/briskin5/index.php +++ b/web/briskin5/index.php @@ -94,7 +94,7 @@ function bin5_index_main($transp_type, &$header_out, $addr, $get, $post, $cookie var gst = new globst(); gst.st = get_user($sess, &$idx)) == FALSE) { + if (($user = &$bin5->get_user($sess, &$idx)) == FALSE) { echo "Get User Error"; log_wr("Get User Error"); return FALSE; } - + $bin5->brisk->sess_cur_set($user->sess); if (array_search($user->ip, $G_black_list) !== FALSE) { // TODO: waiting async 5 sec before close return (FALSE); @@ -97,7 +97,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) log_rd2("bin5/index_wr.php: AUTO LOGOUT."); if ($user->stat == 'table') { - $bri->table_wakeup($user); + $bin5->table_wakeup($user); // to force the logout $user->lacc = 0; } @@ -111,17 +111,17 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) *********************/ else if ($user->stat == 'table') { $user->laccwr = time(); - $table = $bri->table[$user->table]; + $table = $bin5->table[$user->table]; if ($argz[0] == 'tableinfo') { log_wr("PER DI TABLEINFO"); $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= show_table_info(&$bri, &$table, $user->table_pos); + $user->comm[$user->step % COMM_N] .= show_table_info(&$bin5, &$table, $user->table_pos); log_wr($user->comm[$user->step % COMM_N]); $user->step_inc(); } else if ($argz[0] == 'chatt') { - $bri->chatt_send(&$user,$mesg); + $bin5->chatt_send(&$user,$mesg); } else if ($argz[0] == 'preferences_update') { log_wr("PER DI PREFERENCES_UPDATE"); @@ -141,10 +141,10 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) $logout_cont = TRUE; if ($remcalc >= 3) { - $lockcalc = $table->exitlock_calc(&$bri->user, $user->table_pos); + $lockcalc = $table->exitlock_calc(&$bin5->user, $user->table_pos); if ($lockcalc < 3) { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= $table->exitlock_show(&$bri->user, $user->table_pos); + $user->comm[$user->step % COMM_N] .= $table->exitlock_show(&$bin5->user, $user->table_pos); $user->comm[$user->step % COMM_N] .= show_notify("
I dati presenti sul server non erano allineati con quelli inviati dal tuo browser, adesso lo sono. Riprova ora.", 2000, "torna alla partita.", 400, 100); log_wr($user->comm[$user->step % COMM_N]); @@ -160,14 +160,14 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) // $user->bantime = $user->laccwr + BAN_TIME; if ($logout_cont == TRUE) { - $bri->table_wakeup(&$user); + $bin5->table_wakeup(&$user); } } else if ($argz[0] == 'exitlock') { if ($user->exitislock == TRUE) { $user->exitislock = ($user->exitislock == TRUE ? FALSE : TRUE); for ($ct = 0, $i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur[$i] = &$bri->user[$table->player[$i]]; + $user_cur[$i] = &$bin5->user[$table->player[$i]]; if ($user_cur[$i]->exitislock == FALSE) $ct++; } @@ -207,14 +207,14 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) /* log_points($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist); */ /* } */ - /* $table->game_init(&$bri->user); */ + /* $table->game_init(&$bin5->user); */ - if ($table->rules_engine(&$bri, $curtime, BIN5_RULES_ABANDON, $user)) { + if ($table->rules_engine(&$bin5, $curtime, BIN5_RULES_ABANDON, $user)) { for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d;', $user_cur->step+1); - $ret .= show_table(&$bri,&$user_cur,$user_cur->step+1, TRUE, TRUE); + $ret .= show_table(&$bin5,&$user_cur,$user_cur->step+1, TRUE, TRUE); $user_cur->comm[$user_cur->step % COMM_N] = $ret; $user_cur->step_inc(); } @@ -269,7 +269,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) /* next step */ $showst = "show_astat("; for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $showst .= sprintf("%s%d", ($i == 0 ? "" : ", "), ($user_cur->asta_card < 9 ? $user_cur->asta_card : $user_cur->asta_pnt)); } @@ -279,7 +279,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) $maxcard = -2; for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; if ($maxcard < $user_cur->asta_card) $maxcard = $user_cur->asta_card; } @@ -298,7 +298,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d; %s', $user_cur->step+1, $showst); if ($user_cur->table_pos == ($table->gstart % BIN5_PLAYERS_N)) $ret .= sprintf('dispose_asta(%d,%d, %s); remark_on();', @@ -313,12 +313,12 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) else if ($table->asta_pla_n == 0) { log_wr("PASSANO TUTTI!"); - if ($table->rules_engine(&$bri, $curtime, BIN5_RULES_ALLPASS, $user)) { + if ($table->rules_engine(&$bin5, $curtime, BIN5_RULES_ALLPASS, $user)) { for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d;', $user_cur->step+1); - $ret .= show_table(&$bri,&$user_cur,$user_cur->step+1, TRUE, TRUE); + $ret .= show_table(&$bin5,&$user_cur,$user_cur->step+1, TRUE, TRUE); $user_cur->comm[$user_cur->step % COMM_N] = $ret; $user_cur->step_inc(); } @@ -349,7 +349,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) $table->asta_win = $chooser; for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d; %s dispose_asta(%d, %d, false);', $user_cur->step+1, $showst, $table->asta_card + 1,-($table->asta_pnt)); @@ -383,9 +383,9 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) log_wr("Setta la briscola a ".$a_brisco); $chooser = $table->asta_win; - $user_chooser = &$bri->user[$table->player[$chooser]]; + $user_chooser = &$bin5->user[$table->player[$chooser]]; for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $user_cur->subst = 'game'; $ret = sprintf('gst.st = %d; subst = "game";', $user_cur->step+1); @@ -396,7 +396,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) $ret .= sprintf('document.title = "Brisk - Tavolo %d";', $user->table_orig); /* bg of caller cell */ - $ret .= briscola_show($bri, $table, $user_cur); + $ret .= briscola_show($bin5, $table, $user_cur); /* first gamer */ if ($i == ($table->gstart % BIN5_PLAYERS_N)) @@ -466,7 +466,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) $table->gstart = $winner; $turn_nex = ($table->gstart + $table->turn) % BIN5_PLAYERS_N; - log_wr(sprintf("The winner is: [%d] [%s]", $winner, $bri->user[$table->player[$winner]]->name)); + log_wr(sprintf("The winner is: [%d] [%s]", $winner, $bin5->user[$table->player[$winner]]->name)); $card_take = sprintf("sleep(gst,2000);|cards_take(%d);|", $winner); $player_cur = "remark_off();" . $card_take; if ($turn_cur != $turn_nex) @@ -480,7 +480,7 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) log_wr(sprintf("Turn Cur %d Turn Nex %d",$turn_cur, $turn_nex)); for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d; ', $user_cur->step+1); @@ -501,16 +501,16 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) if ($table->turn == (BIN5_PLAYERS_N * BIN5_CARD_HAND)) { /* game finished */ log_wr(sprintf("GIOCO FINITO !!!")); - if ($table->rules_engine(&$bri, $curtime, BIN5_RULES_FINISH, $user)) { + if ($table->rules_engine(&$bin5, $curtime, BIN5_RULES_FINISH, $user)) { for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; - $retar[$i] .= show_table(&$bri,&$user_cur,$user_cur->step+1,TRUE, TRUE); + $user_cur = &$bin5->user[$table->player[$i]]; + $retar[$i] .= show_table(&$bin5,&$user_cur,$user_cur->step+1,TRUE, TRUE); } } } for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - $user_cur = &$bri->user[$table->player[$i]]; + $user_cur = &$bin5->user[$table->player[$i]]; $user_cur->comm[$user_cur->step % COMM_N] = $retar[$i]; $user_cur->step_inc(); diff --git a/web/briskin5/stat-day.php b/web/briskin5/stat-day.php index caf3e0a..c8af36d 100644 --- a/web/briskin5/stat-day.php +++ b/web/briskin5/stat-day.php @@ -427,7 +427,8 @@ function main_pgsql($from, $to) fprintf($fpexp, ""); for ($u = 0 ; $u < BIN5_PLAYERS_N ; $u++) { $tot_sql = sprintf(" -SELECT SUM(p.pts) AS pts FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_points AS p, %susers AS u WHERE m.code = g.mcode AND g.code = p.gcode AND u.code = p.ucode AND m.code = %d AND u.code = %d", $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, +SELECT SUM(p.pts) AS pts FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_points AS p, %susers AS u +WHERE m.code = g.mcode AND g.code = p.gcode AND u.code = p.ucode AND ( (u.type & (CAST (X'00ff0000' as integer))) <> (CAST (X'00800000' as integer)) ) AND m.code = %d AND u.code = %d", $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $tmt_obj->code, $users[$u]['code']); if (($tot_pg = pg_query($bdb->dbconn->db(), $tot_sql)) == FALSE ) { break; diff --git a/web/index.php b/web/index.php index ac6ab9d..294234c 100644 --- a/web/index.php +++ b/web/index.php @@ -249,7 +249,7 @@ function carousel_top() } } -function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $cookie) +function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $cookie) { GLOBAL $G_with_donors, $G_donors_cur, $G_donors_all; GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local; @@ -283,16 +283,17 @@ function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $coo if (isset($BRISK_SHOWHTML) == FALSE) { $is_table = FALSE; - log_main("lock Room"); + log_main("lock Brisk"); $curtime = time(); /* Actions */ if (validate_sess($sess)) { log_main("pre garbage_manager UNO"); - $room->garbage_manager(TRUE); + $brisk->garbage_manager(TRUE); log_main("post garbage_manager"); - if (($user = &$room->get_user($sess, &$idx)) != FALSE) { + if (($user = &$brisk->get_user($sess, &$idx)) != FALSE) { + $brisk->sess_cur_set($user->sess); log_main("user stat: ".$user->stat); if ($user->stat == "table") { $cookies = new Cookies(); @@ -313,11 +314,12 @@ function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $coo $pass_private = FALSE; } - $room->garbage_manager(TRUE); + $brisk->garbage_manager(TRUE); /* try login */ $ipv4addr = addrtoipv4($addr); - if (($user = $room->add_user(&$sess, &$idx, $name, $pass_private, $ipv4addr, $cookie)) != FALSE) { + if (($user = $brisk->add_user(&$sess, &$idx, $name, $pass_private, $ipv4addr, $cookie)) != FALSE) { + $brisk->sess_cur_set($user->sess); $ACTION = "room"; if ($idx < 0) { $idx = -$idx - 1; @@ -337,7 +339,7 @@ function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $coo } // setcookie ("sess", "", time() + 180); - $room->standup_update(&$user); + $brisk->standup_update(&$user); } else { /* Login Rendering */ @@ -478,9 +480,12 @@ function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $coo - - - $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt"); + /* NOTE: Brisk donate or donate fake if local */ + if (!$G_is_local) + $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt"); + else + $brisk_donate = '
BRISK_DONATE
'; + if ($brisk_donate == FALSE) $brisk_donate = ""; @@ -855,13 +860,15 @@ supported by:
'.$altout_support_big.' -
-
-


+' . ( /* NOTE: here facebook or fake facebook */ +! $G_is_local ? +'
+' : '
FACEBOOK HERE
+' ) . '
+ %s %s -
-'; +'; /* Templates. */ if ($ACTION == 'login') { @@ -938,8 +945,27 @@ supported by:
//--> + + +
+ + + \n"); @@ -951,9 +977,6 @@ supported by:
if ($G_with_sidebanner) { printf("%s", $G_sidebanner); - if ($G_with_sidebanner2) { - printf("
"); - } } @@ -964,7 +987,7 @@ supported by:
?> - @@ -1113,17 +1136,31 @@ if ($is_login) { //--> + + +
+ + + \n"); - /* printf($brisk_vertical_menu, '



', - $brisk_donate); - printf($brisk_vertical_menu, '

', - $brisk_donate);*/ - printf($brisk_vertical_menu, '
', - $brisk_donate); + printf($brisk_vertical_menu, '', $brisk_donate); if ($G_with_sidebanner xor $G_with_sidebanner2) { @@ -1132,9 +1169,6 @@ if ($is_login) { if ($G_with_sidebanner) { printf("%s", $G_sidebanner); - if ($G_with_sidebanner2) { - printf("
"); - } } diff --git a/web/index_wr.php b/web/index_wr.php index e8768ce..4f1fae3 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -84,7 +84,7 @@ define('LICMGR_CHO_ACCEPT', 0); define('LICMGR_CHO_REFUSE', 1); define('LICMGR_CHO_AFTER', 2); -function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) +function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) { GLOBAL $G_shutdown, $G_black_list, $G_lang, $G_room_help, $G_room_about, $G_room_passwdhowto, $mlang_indwr; GLOBAL $G_tos_vers; @@ -122,7 +122,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $curtime = time(); $dt = date("H:i ", $curtime); - if (($user = $room->get_user($sess, &$idx)) == FALSE) { + if (($user = $brisk->get_user($sess, &$idx)) == FALSE) { $argz = explode('|', xcapemesg($mesg)); if ($argz[0] == 'getchallenge') { @@ -195,8 +195,9 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) return FALSE; } return TRUE; - } + } // end if (($user = $brisk->get_user($sess, ... == FALSE) { + $brisk->sess_cur_set($user->sess); $argz = explode('|', xcapemesg($mesg)); log_wr('POSTSPLIT: '.$argz[0]); @@ -233,11 +234,11 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) if ($argz[1] == 'save') { if ($user->stat == 'room' && $user->subst == 'standup') { - $room->standup_update($user); + $brisk->standup_update($user); } else if ($user->stat == 'room' && $user->subst == 'sitdown') { log_main("chatt_send pre table update"); - $room->table_update($user); + $brisk->table_update($user); log_main("chatt_send post table update"); } } @@ -251,9 +252,9 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) log_rd2("AUTO LOGOUT."); if ($user->subst == 'sitdown' || $user->stat == 'table') - $room->room_wakeup($user); + $brisk->room_wakeup($user); else if ($user->subst == 'standup') - $room->room_outstandup(&$user); + $brisk->room_outstandup(&$user); else { log_rd2("SHUTDOWN FROM WHAT ???"); } @@ -545,7 +546,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) } else if ($argz[0] == 'chatt') { - $room->chatt_send(&$user, xcapemesg($mesg)); + $brisk->chatt_send(&$user, xcapemesg($mesg)); } else if ($argz[0] == 'tosmgr') { // check IF is authnticated user, both terms of service versions matches @@ -592,7 +593,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) // Take parameters $table_idx = (int)$argz[1]; - $table = &$room->table[$table_idx]; + $table = &$brisk->table[$table_idx]; $not_allowed_msg = ""; if ($G_shutdown) { @@ -660,28 +661,28 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) // // Create new spawned table - // $bri_sem = Bin5::lock_data(TRUE, $table_idx); + // $bin5_sem = Bin5::lock_data(TRUE, $table_idx); $table_token = uniqid(""); - $room->table[$table_idx]->table_token = $table_token; - $room->table[$table_idx]->table_start = $curtime; + $brisk->table[$table_idx]->table_token = $table_token; + $brisk->table[$table_idx]->table_start = $curtime; $plist = "$table_token|$user->table|$table->player_n"; for ($i = 0 ; $i < $table->player_n ; $i++) { - $plist .= '|'.$room->user[$table->player[$i]]->sess; + $plist .= '|'.$brisk->user[$table->player[$i]]->sess; } log_legal($curtime, $user->ip, $user, "STAT:CREATE_GAME", $plist); log_wr("pre new Bin5"); - if (($bri = new Bin5($room, $table_idx, $table_token, $get, $post, $cookie)) == FALSE) + if (($bin5 = new Bin5($brisk, $table_idx, $table_token, $get, $post, $cookie)) == FALSE) log_wr("bri create: FALSE"); else - log_wr("bri create: ".serialize($bri)); + log_wr("bri create: ".serialize($bin5)); log_wr("pre init table"); // init table - $bri_table = $bri->table[0]; - $bri_table->init($bri->user); - $bri_table->game_init($bri->user); + $bin5_table = $bin5->table[0]; + $bin5_table->init($bin5->user); + $bin5_table->game_init($bin5->user); // // Init spawned users. // @@ -689,17 +690,17 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) // log_wr("game_init after"); for ($i = 0 ; $i < $table->player_n ; $i++) { - $bri_user_cur = $bri->user[$i]; - $user_cur = $room->user[$table->player[$i]]; + $bin5_user_cur = $bin5->user[$i]; + $user_cur = $brisk->user[$table->player[$i]]; - $bri_user_cur->laccwr = $curtime; - $bri_user_cur->trans_step = $user_cur->step + 1; - $bri_user_cur->comm[$bri_user_cur->step % COMM_N] = ""; - $bri_user_cur->step_inc(); - $bri_user_cur->comm[$bri_user_cur->step % COMM_N] = show_table(&$bri,&$bri_user_cur,$bri_user_cur->step+1,TRUE, FALSE); - $bri_user_cur->step_inc(); + $bin5_user_cur->laccwr = $curtime; + $bin5_user_cur->trans_step = $user_cur->step + 1; + $bin5_user_cur->comm[$bin5_user_cur->step % COMM_N] = ""; + $bin5_user_cur->step_inc(); + $bin5_user_cur->comm[$bin5_user_cur->step % COMM_N] = show_table(&$bin5,&$bin5_user_cur,$bin5_user_cur->step+1,TRUE, FALSE); + $bin5_user_cur->step_inc(); - log_wr("TRY PRESAVE: ".$bri_user_cur->step." TRANS STEP: ".$bri_user_cur->trans_step); + log_wr("TRY PRESAVE: ".$bin5_user_cur->step." TRANS STEP: ".$bin5_user_cur->trans_step); log_wr("Pre if!"); @@ -717,11 +718,11 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $user_cur->step_inc(); } log_wr("presave bri"); - $room->match_add($table_idx, $bri); + $brisk->match_add($table_idx, $bin5); log_wr("postsave bri"); } // change room - $room->room_sitdown($user, $table_idx); + $brisk->room_sitdown($user, $table_idx); log_wr("MOP finish"); } @@ -739,10 +740,10 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) **********************/ else if ($user->subst == 'sitdown') { if ($argz[0] == 'wakeup') { - $room->room_wakeup($user); + $brisk->room_wakeup($user); } else if ($argz[0] == 'logout') { - $room->room_wakeup($user); + $brisk->room_wakeup($user); $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; $user->comm[$user->step % COMM_N] .= 'postact_logout();'; $user->the_end = TRUE; @@ -751,10 +752,10 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) } } log_wr("before save data"); - // Room::save_data($room); + // Brisk::save_data($brisk); log_wr($user->step, 'index_wr.php: after save_data()'); -/* Room::unlock_data($sem); */ +/* Brisk::unlock_data($sem); */ /* exit; */ return (FALSE); } diff --git a/web/room.css b/web/room.css index 8ff07f6..73cb799 100644 --- a/web/room.css +++ b/web/room.css @@ -48,7 +48,6 @@ body.* { } div.container { - /* border:1px solid gray; */ position: relative; width:100%; margin:0px; @@ -56,41 +55,36 @@ div.container { } div.header { - /* border: 1px solid yellow; */ align: center; text-align: center; - font-size: 12px; + font-size: 100%; clear:left; } div.topmenu { - /* border: 1px solid red; */ width:94px; margin:0; text-align: center; align: center; - font-size: 10px; - padding:2px; + font-size: 85%; + padding: 2px 2px 0 2px; } div.proflash { - /* border: 1px solid red; */ border: 1px solid gray; background-color: RGB(246,246,246); text-align: center; align: center; - font-size: 10px; + font-size: 85%; padding:4px; } div.tables { - /* border: 1px solid gray; */ margin-left:100px; padding:4px; } div.bottom { - /* border: 1px solid green; */ position: relative; top: -13px; align: center: @@ -105,9 +99,6 @@ div.room_tit { align: left; text-align: left; margin: 0px; - /* background-color: orange; */ - /* clip: auto; */ - /* overflow: hidden; */ } span.room_titin { @@ -120,22 +111,18 @@ span.room_titin { table.floaty { width: 100%; - /* border: 1px solid red; */ border-collapse: collapse; border-spacing: 0px; padding: 0px; } table.floaty td { - /* border: 1px solid orange; */ align: center; text-align: center; vertical-align: top; } table.placings { -/* border: 1px solid red; */ -/* border-collapse: collapse; */ border-spacing: 8px; margin: 0px; width: 100%; @@ -174,7 +161,6 @@ table.floaty td.floatyleft { } table.macro { - /* border: 1px solid orange; */ border-spacing: 0px; align: center; width: 100%; @@ -182,14 +168,11 @@ table.macro { } table.macro td { - /* border: 1px solid green; */ align: center; text-align: center; } div.room_tab { - /* border: 1px solid blue; */ - /* background-color: green; */ height: 346px; margin-left: auto; margin-right: auto; @@ -200,16 +183,14 @@ div.room_tab { table.room_tab { width: 100%; - /* border: 0px solid red; */ border-collapse: separate; border-spacing: 4px; border-style: none; } table.room_tab td { - /* background-color: yellow; */ width: 25%; - height: 110px; + height: 120px; vertical-align: top; border: 1px solid gray; } @@ -217,7 +198,6 @@ table.room_tab td { div.room_div { - /* background-color: orange; */ position: relative; } @@ -234,20 +214,17 @@ div.table_act { div.room_standup { position: absolute; vertical-align: "top"; - /* align: left; */ top: 26px; width: 100%; height: 80px; padding: 0px; margin: 0px; - /* background-color: orange; */ overflow: auto; clip: auto; } table.room_standup { position: relative; - /* margin-left: 4px; */ width: 100%; border: 1px solid gray; border-spacing: 0px; @@ -255,7 +232,6 @@ table.room_standup { } table.room_standup td { - /* background-color: yellow; */ position: relative; border: 0px none gray; vertical-align: top; @@ -285,8 +261,6 @@ div.room_ex_standup { } table.table_standup { - /* background-color: red; */ - border-spacing: 0px; width: 100%; margin: 0px; @@ -294,8 +268,6 @@ table.table_standup { } table.table_standup td { - /* background-color: green; */ - /* border: 1px solid red; */ width: 25%; text-align: center; align: center; @@ -315,16 +287,12 @@ div.esco { height: 100px; overflow: auto; border: 1px solid gray; - /* padding: 2px; */ vertical-align: text-bottom; } .txtt { - /* font-size: 10pt;*/ position: relative; - top: 2px; - /* rows: 1; */ } .urgmsg { @@ -337,7 +305,6 @@ div.esco { width: 100%; align: center; text-align: center; - /* background-color: green; */ } .webstart_hilite { @@ -377,7 +344,18 @@ div.esco { text-decoration: none; } -.topbanner { +.sidebanner { + /* Top Right Bottom Left */ + margin: 4px auto 0px auto; + position: relative; + align: center; + text-align:center; + background-color: #f8f8f8; + padding: 4px; + border: 1px solid #000000; +} + +.topbanner { position: relative; align: center; text-align:center; @@ -413,9 +391,6 @@ div.esco { width: 0px; height: 50px; z-index: 10; - /*background-color: #ff00ff; - clip: auto; - overflow: hidden; */ } .wagon { @@ -425,11 +400,10 @@ div.esco { cursor: pointer; left: 0px; top: 2px; - font-size: 10px; + font-size: 85%; font-weight: bold; padding: 4px; z-index: 10; - /* visibility: hidden; */ } .wagon_disable { @@ -439,12 +413,10 @@ div.esco { cursor: default; left: 0px; top: 2px; - font-size: 10px; + font-size: 85%; font-weight: bold; font-color: #999999; padding: 4px; - /*z-index: -1;*/ - /* visibility: hidden; */ } .wagon_disable2 { @@ -454,11 +426,9 @@ div.esco { border: 1px solid green; left: 0px; top: 2px; - font-size: 10px; + font-size: 85%; font-color: #333333; padding: 4px; - /* z-index: -1; */ - /* visibility: hidden; */ } .notebox { @@ -467,7 +437,6 @@ div.esco { padding: 4px; position: absolute; visibility: hidden; - /* z-index: 15px; */ } .room_standup_orig { @@ -479,7 +448,6 @@ td.tickbut { width: 0px; text-align: left; vertical-align: top; - /* background-color: red; */ padding: 0px; } diff --git a/web/spush/brisk-spush.php b/web/spush/brisk-spush.php index 35c2584..7756764 100755 --- a/web/spush/brisk-spush.php +++ b/web/spush/brisk-spush.php @@ -43,13 +43,13 @@ function main($argv) { pid_save(); do { - if (($room = Room::create(LEGAL_PATH."/brisk-crystal.data")) == FALSE) { - log_crit("room::create failed"); + if (($brisk = Brisk::create(LEGAL_PATH."/brisk-crystal.data")) == FALSE) { + log_crit("Brisk::create failed"); $ret = 1; break; } - if (($s_a_p = Sac_a_push::create($room, USOCK_PATH, 0, 0, $argv)) === FALSE) { + if (($s_a_p = Sac_a_push::create($brisk, USOCK_PATH, 0, 0, $argv)) === FALSE) { $ret = 2; break; } diff --git a/web/xynt-streaming.js b/web/xynt-streaming.js index 7292340..610d701 100644 --- a/web/xynt-streaming.js +++ b/web/xynt-streaming.js @@ -5,6 +5,7 @@ // function transport_ws(doc, xynt_streaming, page) { + this.name = "WebSocket"; this.ctx_new = ""; var self = this; @@ -55,6 +56,7 @@ this.xynt_streaming.log("PAGE: "+page); transport_ws.prototype = { doc: null, + name: null, xynt_streaming: "ready", ws: null, stopped: true, @@ -161,6 +163,7 @@ this.xynt_streaming.log("WSCLOSE"); // function transport_xhr(doc, xynt_streaming, page) { + this.name = "XHR"; this.doc = doc; this.xynt_streaming = xynt_streaming; this.xhr = createXMLHttpRequest(); @@ -175,6 +178,7 @@ function transport_xhr(doc, xynt_streaming, page) transport_xhr.prototype = { doc: null, + name: null, xynt_streaming: "ready", xhr: null, stopped: true, @@ -290,6 +294,7 @@ transport_xhr.prototype = { // function transport_htmlfile(doc, xynt_streaming, page) { + this.name = "HTMLFile"; this.doc = doc; this.xynt_streaming = xynt_streaming; this.transfdoc = new ActiveXObject("htmlfile"); @@ -304,6 +309,7 @@ function transport_htmlfile(doc, xynt_streaming, page) transport_htmlfile.prototype = { doc: null, + name: null, xynt_streaming: null, stopped: true, ifra: null, @@ -393,6 +399,7 @@ transport_htmlfile.prototype = { // function transport_iframe(doc, xynt_streaming, page) { + this.name = "IFRAME"; this.doc = doc; this.xynt_streaming = xynt_streaming; this.ifra = doc.createElement("iframe"); @@ -404,6 +411,7 @@ function transport_iframe(doc, xynt_streaming, page) transport_iframe.prototype = { doc: null, + name: null, xynt_streaming: null, stopped: true, ifra: null, @@ -725,8 +733,7 @@ xynt_streaming.prototype = { var ctx_new_len; if (this.sandbox != null) { - // from old: var zug = "POLL sess = "+sess+" stat = "+stat+" subst = "+subst+" step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new+" STOP: "+this.stopped; - var zug = "WATCHDOG sess = ["+this.sess+"] step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new; + var zug = "WATCHDOG sess = ["+this.sess+"] step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new+"Transport: "+this.transp.name; if (zug != this.sandbox.innerHTML) this.sandbox.innerHTML = zug; }