+ static function blocking_error($is_unrecoverable)
+ {
+ log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
+ return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
+ }
+
+ protected function page_sync($sess, $page)
+ {
+ log_rd2("PAGE_SYNC");
+ printf("xXx BIN5_USER::PAGE_SYNC\n");
+ return (sprintf('xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
+ }
+
+ protected function maincheck($cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $splashdate, $table_idx, $table_token)
+ {
+ GLOBAL $G_lang, $mlang_indrd;
+ GLOBAL $G_with_splash, $G_splash_content, $G_splash_interval, $G_splash_idx;
+ GLOBAL $G_splash_w, $G_splash_h, $G_splash_timeout;
+ $CO_splashdate = "CO_splashdate".$G_splash_idx;
+ $$CO_splashdate = $splashdate;
+
+ GLOBAL $S_load_stat;
+
+ log_rd("maincheck begin");
+
+ $ret = FALSE;
+ $curtime = time();
+
+ /* Nothing changed, return. */
+ if ($cur_step == $this->step)
+ return (FALSE);
+
+ log_rd2("do other cur_stat[".$cur_stat."] user->stat[".$this->stat."] cur_step[".$cur_step."] user_step[".$this->step."]");
+
+ if ($cur_step == -1) {
+ /*
+ * if $cur_step == -1 load the current state from the main struct
+ */
+
+ $S_load_stat['wR_minusone']++;
+
+ // if ($this->the_end == TRUE) {
+ // log_rd2("main_check: the end".var_export(debug_backtrace()));
+ // }
+
+ if ($this->trans_step != -1) {
+ log_rd2("TRANS USATO ".$this->trans_step);
+ $cur_step = $this->trans_step;
+ $this->trans_step = -1;
+ }
+ else {
+ log_rd2("TRANS NON ATTIVATO");
+ }
+ }
+
+
+ /* this part I suppose is read only on $this->room structure */
+ if ($cur_step == -1) {
+ log_rd2("PRE-NEWSTAT");
+
+ /***************
+ * *
+ * TABLE *
+ * *
+ ***************/
+ if ($this->stat == 'table') {
+ log_load("RESYNC");
+ /* NOTE: $this->room is associated with the current $bri object */
+ printf("xXx CLASS NAME [%s]\n", get_class($this->room));
+ $ret = show_table(&$this->room, $this, $this->step, FALSE, FALSE);
+ }
+ log_rd2("NEWSTAT: ".$this->stat);
+
+ $new_stat = $this->stat;
+ $new_subst = $this->subst;
+ $new_step = $this->step;
+ } /* if ($cur_step == -1) { */
+ else {
+ /* $sem = Room::lock_data(FALSE); */
+ $S_load_stat['rU_heavy']++;
+
+ if ($cur_step < $this->step) {
+ do {
+ if ($cur_step + COMM_N < $this->step) {
+ if (($cur_stat != $this->stat)) {
+ $to_stat = $this->stat;
+ /* Room::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));
+ }
+ log_rd2("lost history, refresh from scratch");
+ printf("xXx LOST HISTORY!\n");
+ $new_step = -1;
+ break;
+ }
+ for ($i = $cur_step ; $i < $this->step ; $i++) {
+ $ii = $i % COMM_N;
+ log_rd2("ADDED TO THE STREAM: ".$this->comm[$ii]);
+ $ret .= $this->comm[$ii];
+ }
+ $new_stat = $this->stat;
+ $new_subst = $this->subst;
+ $new_step = $this->step;
+ } while (0);
+
+ log_rd2($this->step, 'index_rd.php: after ret set');
+
+ if ($this->the_end == TRUE) {
+ log_rd2("LOGOUT BYE BYE!!");
+ log_auth($this->sess, "Explicit logout.");
+
+ if ($this->the_end == TRUE) {
+ $this->reset();
+
+ // FIXME !!!
+ /* if ($this->subst == 'sitdown') { */
+ /* log_load("ROOM WAKEUP"); */
+ /* $this->room->room_wakeup($this); */
+ /* } */
+ /* else if ($this->subst == 'standup') */
+ /* $this->room->room_outstandup($this); */
+ /* else */
+ /* log_rd2("LOGOUT FROM WHAT ???"); */
+
+ } /* if ($this->the_end == TRUE) { ... */
+ } /* if ($this->the_end == TRUE) { ... */
+ } /* if ($cur_step < $this->step) { */
+
+ /* Room::unlock_data($sem); */
+ } /* else of if ($cur_step == -1) { */
+
+
+ return ($ret);
+ } // function maincheck (...
+
+
+
+
+
+