From: Matteo Nastasi Date: Sun, 16 Jul 2017 15:44:27 +0000 (+0200) Subject: Merge branch 'together-for-fun' into nginx X-Git-Tag: v5.6.0~24 X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=a16d8054d9577795a6d9306570eb3a06c46da147;hp=-c;p=brisk.git Merge branch 'together-for-fun' into nginx --- a16d8054d9577795a6d9306570eb3a06c46da147 diff --combined INSTALL.sh index 1966c41,01289c6..5391cae --- a/INSTALL.sh +++ b/INSTALL.sh @@@ -364,8 -364,6 +364,8 @@@ if [ "$web_only" = "FALSE" ]; the done chmod -R 777 ${proxy_path}/bin5 + mkdir -p "${legal_path}" + chmod 777 "${legal_path}" fi install -d ${web_path}__ for i in $(find web -type d | grep '/' | sed 's/^....//g'); do @@@ -375,10 -373,6 +375,10 @@@ don for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^....//g'); do install -m 644 "web/$i" "${web_path}__/$i" done + +# hardlink for nginx managed websocket files. +ln "${web_path}__/xynt_test01.php" "${web_path}__/xynt_test01_wss.php" + if [ "$test_add" = "TRUE" ]; then for i in $(find webtest -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^........//g'); do install -m 644 "webtest/$i" "${web_path}__/$i" @@@ -431,7 -425,7 +431,7 @@@ sed -i "s@var \+cookiepath \+= \+\"[^\" sed -i "s@\( \+cookiepath *: *\)\"[^\"]*\" *,@\1 \"$prefix_path\",@g" ${web_path}__/xynt-streaming.js document_root="$(grep DocumentRoot "${apache_conf}" | grep -v '^[ ]*#' | awk '{ print $2 }')" - sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph* + sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph* ${web_path}__/donometer.php if [ -d ../brisk-img ]; then cd ../brisk-img diff --combined web/Obj/brisk.phh index c89d6ac,42e4bd1..62fc1a4 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@@ -153,10 -153,10 +153,10 @@@ $mlang_brisk = array( 'btn_backstand'= $G_lng = langtolng($G_lang); $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 ); - $G_brisk_version = "5.4.1"; + $G_brisk_version = "5.4.2"; /* MLANG: ALL THE INFO STRINGS IN brisk.phh */ - $root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': potete scegliere che regole usare per giocare dal menu "Prefs" al tavolo, descrizioni più consistenti.', + $root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': uscita più veloce dal sito.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ), 'en' => array ( 'EN Brisk (Ver. '.$G_brisk_version.'), NOVITA\': puoi creare la tua rete di amicizie con /info,', 'vedere cosa pensano i tuoi amici degli altri utenti e tavoli riservati per registrati e apprendisti.', @@@ -1226,10 -1226,15 +1226,15 @@@ class Bris function users_cleanup() { + $curtime = time(); for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { $user_cur = $this->user[$i]; - if ($user_cur->the_end) { + if ($user_cur->the_end + && (($user_cur->rd_toflush == FALSE + && $user_cur->rd_step == $user_cur->step) + || $user_cur->rd_endtime_is_expired($curtime)) + ) { $user_cur->reset(); // users_cleanup, OK } } @@@ -2803,10 -2808,9 +2808,10 @@@ break; case "index_rd.php": + case "index_rd_wss.php": if (($transp = gpcs_var('transp', $get, $post, $cookie)) === FALSE) $transp = "iframe"; - if ($transp == 'websocket') + if ($transp == 'websocket' || $transp == 'websocketsec') $enc = 'plain'; do { @@@ -2872,7 -2876,7 +2877,7 @@@ $subs = "briskin5/"; $subs_l = strlen($subs); if (!strncmp($path, $subs, $subs_l)) { - $ret = Bin5::request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, substr($path, $subs_l) , $addr, $get, $post, $cookie); + $ret = Bin5::request_mgr($s_a_p, $header, $header_out, $new_socket, substr($path, $subs_l) , $addr, $get, $post, $cookie); return ($ret); } break; diff --combined web/Obj/sac-a-push.phh index 46227fc,b4ec956..05c24ce --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@@ -571,7 -571,7 +571,7 @@@ class Sac_a_push function pendpage_try_addcont(&$new_socket, $tout, $method, $header, $get, $post, $cookie, $path, $addr, $rest, $cont) { - $pendpage = PendingPage::pendingpage_continue(&$new_socket, $this->curtime, $tout, $method, + $pendpage = PendingPage::pendingpage_continue( $new_socket, $this->curtime, $tout, $method, $header, $get, $post, $cookie, $path, $addr, $rest, $cont); @@@ -631,14 -631,18 +631,18 @@@ foreach ($this->socks as $k => $sock) { $id = intval($sock); if (isset($this->s2u[$id])) { - if ($this->s2u[$id]->the_end) { - if ($this->s2u[$id]->rd_socket_get() != NULL) { - $this->s2u[$id]->rd_socket_set(NULL); + $user = $this->s2u[$id]; + if ($user->the_end) { + if (($user->rd_toflush == FALSE && $user->rd_step == $user->step) + || $user->rd_endtime_is_expired($this->curtime)) { + if ($user->rd_socket_get() != NULL) { + $user->rd_socket_set(NULL); + } + unset($this->socks[$id]); + unset($this->s2u[$id]); + fclose($sock); + printf("CLOSE ON GARBAGE MANAGER\n"); } - unset($this->socks[$id]); - unset($this->s2u[$id]); - fclose($sock); - printf("CLOSE ON GARBAGE MANAGER\n"); } } } @@@ -1033,7 -1037,7 +1037,7 @@@ return cmd_return(401, 'malformed cmd'); } $idx = -1; - if (($user = $this->app->get_user($cmd['sess'], &$idx)) == FALSE) + if (($user = $this->app->get_user($cmd['sess'], $idx)) == FALSE) return cmd_return(402, 'user not found'); if (($user->flags & USER_FLAG_TY_ADMIN) == 0x00) diff --combined web/briskin5/index_wr.php index 19ac735,e4d5af7..d188c0f --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@@ -56,7 -56,7 +56,7 @@@ function bin5_index_wr_main(&$bin5, $re log_wr(0, 'bin::index_wr.php: COMM: '.xcapemesg($mesg)); - if (($user = &$bin5->get_user($sess, &$idx)) == FALSE) { + if (($user = &$bin5->get_user($sess, $idx)) == FALSE) { echo "Get User Error"; log_wr("Get User Error"); return FALSE; @@@ -102,12 -102,12 +102,12 @@@ 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(&$bin5, &$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') { - $bin5->chatt_send(&$user, $mesg); + $bin5->chatt_send($user, $mesg); } else if ($argz[0] == 'preferences_update') { log_wr("PER DI PREFERENCES_UPDATE"); @@@ -127,10 -127,10 +127,10 @@@ $logout_cont = TRUE; if ($remcalc >= 3) { - $lockcalc = $table->exitlock_calc(&$bin5->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(&$bin5->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]); @@@ -169,12 -169,12 +169,12 @@@ } else if ($user->subst == 'asta') { if ($argz[0] == 'lascio') { - if ($table->rules->engine(&$bin5, $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 = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d;', $user_cur->step+1); - $ret .= show_table(&$bin5,&$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(); } @@@ -189,7 -189,7 +189,7 @@@ if ($user->table_pos != $index_cur || !$table->asta_pla[$index_cur]) { // FIXME_LANG - $ret_s = 'grave inconsistenza'; + // $ret_s = 'grave inconsistenza'; break; } @@@ -199,7 -199,7 +199,7 @@@ log_wr("CI SIAMO a_card ".$a_card." asta_card ".$table->asta_card); /* user action management */ - if (!$table->rules->engine(&$bin5, $curtime, BIN5_RULES_ASTA, $user, + if (!$table->rules->engine($bin5, $curtime, BIN5_RULES_ASTA, $user, $ret_s, $a_card, $a_pnt)) { break; } @@@ -229,7 -229,7 +229,7 @@@ * asta_pla_n > 0 if someone NOT bet) * THEN advance auction */ - if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_NEXTAUCT, $user, $maxcard)) { + if ($table->rules->engine($bin5, $curtime, BIN5_RULES_NEXTAUCT, $user, $maxcard)) { /* search the next player in auction and put it in gstart field */ for ($i = 1 ; $i < BIN5_PLAYERS_N ; $i++) { $index_next = ($table->gstart + $i) % BIN5_PLAYERS_N; @@@ -257,12 -257,12 +257,12 @@@ else if ($table->asta_pla_n == 0) { log_wr("PASSANO TUTTI!"); - if ($table->rules->engine(&$bin5, $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 = &$bin5->user[$table->player[$i]]; $ret = sprintf('gst.st = %d;', $user_cur->step+1); - $ret .= show_table(&$bin5,&$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(); } @@@ -329,7 -329,7 +329,7 @@@ do { $a_brisco = $argz[1]; - if (!$table->rules->engine(&$bin5, $curtime, BIN5_RULES_CHECKCHOOSE, $user, $ret_s, $a_brisco)) { + if (!$table->rules->engine($bin5, $curtime, BIN5_RULES_CHECKCHOOSE, $user, $ret_s, $a_brisco)) { break; } @@@ -483,10 -483,10 +483,10 @@@ if ($table->turn == (BIN5_PLAYERS_N * BIN5_CARD_HAND)) { /* game finished */ log_wr(sprintf("GIOCO FINITO !!!")); - if ($table->rules->engine(&$bin5, $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 = &$bin5->user[$table->player[$i]]; - $retar[$i] .= show_table(&$bin5,&$user_cur,$user_cur->step+1,TRUE, TRUE); + $retar[$i] .= show_table($bin5, $user_cur, $user_cur->step+1, TRUE, TRUE); } } } @@@ -498,7 -498,7 +498,7 @@@ $user_cur->step_inc(); } - log_wr(sprintf("TURN: %d",$table->turn)); + log_wr(sprintf("TURN: %d", $table->turn)); /* Have played all the players ? */ /* NO: switch the focus and enable the next player to play. */ diff --combined web/index_wr.php index 48b3c14,2b97b93..002a76e --- a/web/index_wr.php +++ b/web/index_wr.php @@@ -166,7 -166,7 +166,7 @@@ function index_wr_main(&$brisk, $remote $curtime = time(); $dt = date("H:i ", $curtime); - if (($user = $brisk->get_user($sess, &$idx)) == FALSE) { + if (($user = $brisk->get_user($sess, $idx)) == FALSE) { $argz = explode('|', xcapemesg($mesg)); if ($argz[0] == 'getchallenge') { @@@ -196,7 -196,7 +196,7 @@@ echo '1|'; } if ($chals->ismod()) { - Challenges::save_data(&$chals); + Challenges::save_data($chals); } } @@@ -421,7 -421,7 +421,7 @@@ if ($user->subst == 'sitdown' || $user->stat == 'table') $brisk->room_wakeup($user); else if ($user->subst == 'standup') - $brisk->room_outstandup(&$user); + $brisk->room_outstandup($user); else { log_rd2("SHUTDOWN FROM WHAT ???"); } @@@ -767,7 -767,7 +767,7 @@@ } else if ($argz[0] == 'chatt') { - $brisk->chatt_send(&$user, xcapemesg($mesg), $mlang_indwr); + $brisk->chatt_send($user, xcapemesg($mesg), $mlang_indwr); } else if ($argz[0] == 'tosmgr') { // check IF is authnticated user, both terms of service versions matches @@@ -923,9 -923,7 +923,9 @@@ $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->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: ".$bin5_user_cur->step." TRANS STEP: ".$bin5_user_cur->trans_step); @@@ -956,16 -954,13 +956,13 @@@ } else if ($argz[0] == 'logout') { $brisk->ghost_sess->push($curtime, $user->sess, GHOST_SESS_REAS_LOUT); + $user->the_end = TRUE; + $brisk->room_outstandup($user); - if ($user->subst == 'sitdown') { - log_load("ROOM WAKEUP"); - $brisk->room_wakeup($user); - } - else if ($user->subst == 'standup') - $brisk->room_outstandup($user); - else - log_rd2("LOGOUT FROM WHAT ???"); + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] .= sprintf('gst.st_loc++; xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'); + $user->step_inc(); } } /********************** @@@ -984,9 -979,13 +981,13 @@@ } else if ($argz[0] == 'logout') { $brisk->ghost_sess->push($curtime, $user->sess, GHOST_SESS_REAS_LOUT); - $user->the_end = TRUE; + $user->the_end = TRUE; $brisk->room_wakeup($user); + + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] .= sprintf('gst.st_loc++; xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'); + $user->step_inc(); } } }