X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fbriskin5.phh;h=94a8940b6043d36e741b99ed8ec8cdeb010e8a56;hb=879ef1677b59eb159d0b9982a8fb5b056f13bff7;hp=b2aae3f7311a3d6f411285d7fcd1b362c73cc787;hpb=324d94cde1e6af57f937f4660484d15b740bc348;p=brisk.git diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index b2aae3f..94a8940 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -720,56 +720,22 @@ class Bin5_user extends User { return ($ret); } - public static function stream_fini($init_string, $is_unrecoverable) -{ - printf("xXx user::stream_fini\n"); - - // IF IFRAME THEN: - $body = ""; - $body .= sprintf(" - - - - - -"); - $body .= sprintf("\n", $init_string); - $body .= sprintf("", 0, escpush(self::blocking_error($is_unrecoverable)) ); - // ELSE IF XHR THEN: - // return (self::blocking_error($is_unrecoverable)); - return ($body); -} - - protected function blocking_error($is_unrecoverable) { - GLOBAL $is_page_streaming; - - $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) { - GLOBAL $is_page_streaming; - - $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) { - GLOBAL $G_lang, $mlang_indrd, $is_page_streaming; + 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; @@ -795,10 +761,9 @@ push(\"%s\"); $S_load_stat['wR_minusone']++; - if ($this->the_end == TRUE) { - log_rd2("main_check: the end".var_export(debug_backtrace())); - $is_page_streaming = TRUE; - } + // 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); @@ -1355,7 +1320,7 @@ class Bin5 { $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; @@ -1387,51 +1352,64 @@ class Bin5 { 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, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie) { printf("NEW_SOCKET (root): %d\n", intval($new_socket)); + $enc = get_encoding($header); + if (isset($header['User-Agent']) && strstr($header['User-Agent'], "MSIE")) { + $transp_type = "htmlfile"; + } + else { + $transp_type = "iframe"; + } + force_no_cache($header_out); + if (($table_idx = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE) unset($table_idx); if (($table_token = gpcs_var('table_token', $get, $post, $cookie)) === FALSE) unset($table_token); - force_no_cache($header_out); switch ($path) { case "": case "index.php": ob_start(); - bin5_index_main($header_out, $addr, $get, $post, $cookie); + bin5_index_main($transp_type, $header_out, $addr, $get, $post, $cookie); $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($s_a_p->rndstr, TRUE); - $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; + return TRUE; break; } // close a previous opened index_read_ifra socket, if exists @@ -1443,8 +1421,8 @@ class Bin5 { } $content = ""; - $user->stream_init($s_a_p->rndstr, $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);