return ($ret);
}
-public static function stream_fini($is_unrecoverable)
+ public static function stream_fini($init_string, $is_unrecoverable)
{
- GLOBAL $G_four_rnd_string;
-
printf("xXx user::stream_fini\n");
// IF IFRAME THEN:
$body .= sprintf("<html>
<head>
<script type=\"text/javascript\" src=\"%scommons.js\"></script>
-<script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
+<script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
<script type=\"text/javascript\">
-var http_streaming = \"ready\";", self::base_get(), self::base_get());
+var xynt_streaming = \"ready\";", self::base_get(), self::base_get());
$body .= sprintf("
-window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
+window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
</script>
</head>
<body>");
- $body .= sprintf("<!-- \n%s -->\n", $G_four_rnd_string);
+ $body .= sprintf("<!-- \n%s -->\n", $init_string);
$body .= sprintf("<script id='hs%d' type='text/javascript'><!--
push(\"%s\");
// -->
$is_page_streaming = TRUE;
log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
- return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
+ return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");'));
}
protected function page_sync($sess, $page)
$is_page_streaming = TRUE;
log_rd2("PAGE_SYNC");
printf("xXx BIN5_USER::PAGE_SYNC\n");
- return (sprintf('hstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
+ 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)
$user_cur->laccwr = $curtime;
$ret = "gst.st = ".($user_cur->step+1)."; ";
- $ret .= 'gst.st_loc++; hstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");|';
+ $ret .= 'gst.st_loc++; xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("../index.php");|';
log_wr($user_cur->sess." BIN5_WAKEUP: ".$ret);
$user_cur->comm[$user_cur->step % COMM_N] = $ret;
return ($is_ab);
}
- static function request_mgr(&$s_a_p, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
+ static function request_mgr(&$s_a_p, $enc, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
{
printf("NEW_SOCKET (root): %d\n", intval($new_socket));
$content = ob_get_contents();
ob_end_clean();
- $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
+ $s_a_p->pgflush_try_add($enc, $new_socket, 20, $header_out, $content);
return TRUE;
break;
case "index_wr.php":
- $bri = $s_a_p->app->match_get($table_idx, $table_token);
- ob_start();
- bin5_index_wr_main($bri, $addr, $get, $post, $cookie);
- $content = ob_get_contents();
- ob_end_clean();
-
- $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
+ // 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();
+ bin5_index_wr_main($bri, $addr, $get, $post, $cookie);
+ $content = ob_get_contents();
+ ob_end_clean();
+ }
+ }
+ $s_a_p->pgflush_try_add($enc, $new_socket, 20, $header_out, $content);
return TRUE;
break;
case "index_rd_ifra.php":
do {
- if (($bri = $s_a_p->app->match_get($table_idx, $table_token)) == NULL
+ if (!isset($table_idx)
+ || !isset($table_token)
|| !isset($cookie['sess'])
+ || ($bri = $s_a_p->app->match_get($table_idx, $table_token)) == NULL
|| (($user = $bri->get_user($cookie['sess'], $idx)) == FALSE)) {
- $content = Bin5_user::stream_fini(TRUE);
- $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
+ $content = Bin5_user::stream_fini($s_a_p->rndstr, TRUE);
+ $s_a_p->pgflush_try_add($enc, $new_socket, 20, $header_out, $content);
- return TRUE;
+ return TRUE;
break;
}
// close a previous opened index_read_ifra socket, if exists
}
$content = "";
- $user->stream_init($header_out, $content, $get, $post, $cookie);
- $response = headers_render($header_out, -1).chunked_content($content);
+ $user->stream_init($s_a_p->rndstr, $enc, $header_out, $content, $get, $post, $cookie);
+ $response = headers_render($header_out, -1).chunked_content($user->rd_zls_get(), $content);
$response_l = mb_strlen($response, "ASCII");
$wret = @fwrite($new_socket, $response, $response_l);
/* NOTIFY FOR THE CARD MAKER */
if ($is_transition) { // && $user->subst == "asta" superfluo
$ret .= show_table_info(&$bri, &$table, $table_pos);
+ $ret .= "setTimeout(preload_images, 500, g_preload_img_arr, g_imgct);";
}
if (!$is_again)
$ret .= table_wellcome($user);