5 * Copyright (C) 2012 Matteo Nastasi
6 * mailto: nastasi@alternativeoutput.it
7 * matteo.nastasi@milug.org
8 * web: http://www.alternativeoutput.it
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details. You should have received a
19 * copy of the GNU General Public License along with this program; if
20 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21 * Suite 330, Boston, MA 02111-1307, USA.
25 define('USER_FLAG_AUTH', 0x02);
27 define('USER_FLAG_MAP_AUTH', 0x0c);
28 define('USER_FLAG_LISTAUTH', 0x04);
29 define('USER_FLAG_ISOLAUTH', 0x08);
31 define('USER_FLAG_DBFAILED', 0x10);
34 define('USER_FLAG_S_NORM', 0x000); // done
35 define('USER_FLAG_S_PAU', 0x100); // done
36 define('USER_FLAG_S_OUT', 0x200); // done
37 define('USER_FLAG_S_DOG', 0x300); // done
38 define('USER_FLAG_S_EAT', 0x400); // done
39 define('USER_FLAG_S_WRK', 0x500); // done
40 define('USER_FLAG_S_SMK', 0x600); // done
41 define('USER_FLAG_S_EYE', 0x700); // done
42 define('USER_FLAG_S_RABB', 0x800); // done
43 define('USER_FLAG_S_SOCC', 0x900); // done
44 define('USER_FLAG_S_BABY', 0xa00); // done
45 define('USER_FLAG_S_MOP', 0xb00); // done
47 define('USER_FLAG_S_ALL', 0xf00); // done
49 /* type of user normal, supporter etc ... */
50 define('USER_FLAG_TY_ALL', 0xff0000); // done
51 define('USER_FLAG_TY_NORM', 0x010000); // done
52 define('USER_FLAG_TY_SUPER', 0x020000); // done
53 // ... other usefull status ...
54 define('USER_FLAG_TY_SUSPEND', 0x400000); // done
55 define('USER_FLAG_TY_DISABLE', 0x800000); // done
57 // 240 is the right value, 600 is for fwrite error test
58 define('RD_ENDTIME_DELTA', 240);
59 define('RD_KEEPALIVE_TOUT', 4);
61 $S_load_stat = array( 'rU_heavy' => 0,
69 'btn_backtotab' => array('it' => ' torna ai tavoli ',
70 'en' => ' back to tables '),
71 'btn_btotabsup' => array('it' => ' grazie della donazione, torna ai tavoli ',
72 'en' => ' thank you for donation, back to tables ')
76 var $room; // reference to the room where the user is registered
77 var $idx; // index in the users array when you are in game
78 var $idx_orig; // index in the users array when you aren't in game
79 var $code; // authentication code
80 var $name; // name of the user
81 var $sess; // session of the user
82 var $ip; // ip of the user
83 var $lacc; // last access (for the cleanup)
84 var $laccwr; // last access (for the cleanup)
85 var $bantime; // timeout to temporary ban
86 var $stat; // status (outdoor, room, table, game, ...)
87 var $subst; // substatus for each status
88 var $step; // step of the current status
89 var $trans_step; // step to enable transition between pages (disable == -1)
91 var $rd_socket; // socket handle of push stream
92 var $rd_endtime; // end time for push stream
93 var $rd_stat; // actual status of push stream
94 var $rd_subst; // actual substatus of push stream
95 var $rd_step; // actual step of push stream
96 var $rd_from; // referer
97 var $rd_scristp; // current script step (for each session)
98 var $rd_kalive; // if no message are sent after RD_KEEPALIVE_TOUT secs we send a keepalive from server
99 var $rd_cache; // place where store failed fwrite data
101 var $comm; // commands array
102 // var $asta_card; //
104 // var $handpt; // Total card points at the beginning of the current hand.
105 // var $exitislock; // Player can exit from the table ?
107 // FIXME: the table_orig field must be removed after table field verify of index management (in spawned table
108 // it is allways ZERO
109 var $table; // id of the current table when you are in game
110 var $table_orig; // id of the current table when you aren't in game
111 var $table_pos; // idx on the table
112 var $table_token;// token that identify a game on a table
113 var $flags; // Bitfield with: AUTHENTICATE: 0x02
114 var $the_end; // Flag to change the end of the session
116 var $chat_lst; // Last chat line
117 var $chattime; // Array of chat times
118 var $chat_cur; // Current chat line number
119 var $chat_ban; // Time for ban chat
120 var $chat_dlt; // Delta t for ban
123 const BASE = ""; // basepath for absolute web references
128 function create(&$room, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
129 if (($thiz = new User()) == FALSE)
132 $thiz->room = &$room;
134 $thiz->idx_orig = $idx;
139 $thiz->lacc = time();
140 $thiz->laccwr = time();
143 $thiz->subst = $subst;
145 $thiz->trans_step = -1;
146 $thiz->comm = array();
148 $thiz->rd_socket = NULL;
149 $thiz->rd_endtime = -1;
151 $thiz->rd_subst = "";
154 $thiz->rd_scristp = -1;
155 $thiz->rd_kalive = -1;
156 $thiz->rd_cache = "";
158 $thiz->asta_card = -2;
159 $thiz->asta_pnt = -1;
161 $thiz->exitislock = TRUE;
165 $thiz->chattime = array_fill(0, CHAT_N, 0);
167 $thiz->chat_lst = "";
171 $thiz->table_orig = $table;
172 $thiz->table = $table;
173 $thiz->table_pos = -1;
174 $thiz->table_token= "";
175 $thiz->shm_sz = SHM_DIMS_U_MIN;
181 $this->idx = $from->idx;
182 $this->idx_orig = $from->idx;
183 $this->code = $from->code;
184 $this->name = $from->name;
185 $this->sess = $from->sess;
186 $this->ip = $from->ip;
187 $this->lacc = $from->lacc;
188 $this->laccwr = $from->laccwr;
189 $this->bantime = $from->bantime;
190 $this->stat = $from->stat;
191 $this->subst = $from->subst;
192 $this->step = $from->step;
193 $this->trans_step = $from->trans_step;
194 $this->comm = array();
196 $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
197 for ($i = $i_start ; $i < $from->step ; $i++) {
199 if (isset($from->comm[$ii])) {
200 $this->comm[$ii] = $from->comm[$ii];
203 $this->asta_card = $from->asta_card;
204 $this->asta_pnt = $from->asta_pnt;
205 $this->handpt = $from->handpt;
206 $this->exitislock = $from->exitislock;
208 $this->flags = $from->flags;
210 $this->chattime = array();
211 for ($i = 0 ; $i < CHAT_N ; $i++)
212 $this->chattime[$i] = $from->chattime[$i];
213 $this->chat_cur = $from->chat_cur;
214 $this->chat_lst = $from->chat_lst;
215 $this->chat_ban = $from->chat_ban;
216 $this->chat_dlt = $from->chat_dlt;
218 $this->table_orig = $from->table_orig;
219 $this->table = $from->table;
220 $this->table_pos = $from->table_pos;
221 $this->table_token = $from->table_token;
222 $this->the_end = $from->the_end;
223 $this->shm_sz = $from->shm_sz;
228 function myclone($from)
230 if (($thiz = new User()) == FALSE)
238 function spawn($from, $table, $table_pos)
240 if (($thiz = new User()) == FALSE)
243 $thiz->idx = $from->idx;
244 $thiz->idx_orig = $from->idx;
245 $thiz->code = $from->code;
246 $thiz->name = $from->name;
247 $thiz->sess = $from->sess;
248 $thiz->ip = $from->ip;
249 $thiz->lacc = $from->lacc;
250 $thiz->laccwr = $from->laccwr;
251 $thiz->bantime = $from->bantime;
252 $thiz->stat = $from->stat;
253 $thiz->subst = $from->subst;
254 $thiz->step = $from->step;
255 $thiz->trans_step = $from->trans_step;
256 $thiz->comm = array();
259 $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
260 for ($i = $i_start ; $i < $from->step ; $i++) {
261 log_wr("TRY PUSH:".$i);
263 $thiz->comm[$ii] = $from->comm[$ii];
266 $thiz->asta_card = $from->asta_card;
267 $thiz->asta_pnt = $from->asta_pnt;
268 $thiz->handpt = $from->handpt;
269 $thiz->exitislock = $from->exitislock;
270 $thiz->the_end = $from->the_end;
272 $thiz->flags = $from->flags;
274 $thiz->chattime = array_fill(0, CHAT_N, 0);
276 $thiz->chat_lst = "";
281 $thiz->table_orig = $table;
283 $thiz->table_pos = $table_pos;
284 $thiz->table_token = $from->table_token;
285 $thiz->shm_sz = $from->shm_sz;
290 function rd_data_set($curtime, $stat, $subst, $step, $from)
292 $this->rd_endtime = $curtime + RD_ENDTIME_DELTA;
293 $this->rd_stat = $stat;
294 $this->rd_subst = $subst;
295 $this->rd_step = $step;
296 $this->rd_from = $from;
297 $this->rd_scristp = 0;
298 $this->rd_kalive = $curtime + RD_KEEPALIVE_TOUT;
301 function rd_socket_get() {
302 return ($this->rd_socket);
305 function rd_socket_set($sock) {
306 $this->rd_socket = $sock;
309 function rd_kalive_get()
311 return ($this->rd_kalive);
314 function rd_kalive_set($tm)
316 $this->rd_kalive = $tm;
319 function rd_kalive_is_expired($tm)
321 // printf("rd_kalive %d tm %d\n", $this->rd_kalive, $tm);
322 return ($this->rd_kalive < $tm);
325 function rd_endtime_is_expired($tm)
327 // printf("rd_endtime %d tm %d\n", $this->rd_kalive, $tm);
328 return ($this->rd_endtime < $tm);
331 function rd_kalive_reset($tm)
333 $this->rd_kalive = $tm + RD_KEEPALIVE_TOUT;
336 function rd_cache_get()
338 return ($this->rd_cache);
341 function rd_cache_set($cache)
343 $this->rd_cache = $cache;
350 function code_get() {
351 return ($this->code);
354 function stat_set($stat) {
355 log_main("sess: [".$this->sess. "] NEW STAT: [".$stat."]");
356 $this->stat = "$stat";
359 if (validate_sess($this->sess)) {
360 if (file_exists(PROXY_PATH) == FALSE)
361 mkdir(PROXY_PATH, 0775, TRUE);
362 $fp = @fopen(PROXY_PATH."/".$this->sess.".stat", 'w');
363 fwrite($fp, sprintf("%s\n",$this->stat));
369 function step_set($step)
371 $this->step = $step & 0x7fffffff;
376 function step_inc($delta = 1) {
377 $this->step += $delta;
378 /* modularization because unpack() not manage unsigned 32bit int correctly */
379 $this->step &= 0x7fffffff;
388 if (validate_sess($this->sess) == FALSE)
390 if (file_exists(PROXY_PATH) == FALSE)
391 mkdir(PROXY_PATH, 0775, TRUE);
392 if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
394 fwrite($fp, pack("LL",$this->step, $this->idx));
397 log_main("step_set [".$this->sess. "] [".$this->step."]");
405 static function load_step($sess)
409 if (validate_sess($sess) == FALSE)
412 if (file_exists(PROXY_PATH) == FALSE)
413 mkdir(PROXY_PATH, 0775, TRUE);
414 if (($fp = @fopen(PROXY_PATH."/".$sess.".step", 'rb')) == FALSE)
416 if (($s = fread($fp, 8)) == FALSE)
418 if (mb_strlen($s, "ASCII") != 8)
420 $arr = unpack('Ls/Li', $s);
423 // log_rd2("A0: ".$arr[0]." A1: ".$arr[1]);
430 log_rd2("STEP_GET [".$sess."]: return false ");
435 static function unproxy_step($sess) {
436 log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step");
437 if (file_exists(PROXY_PATH) == FALSE)
439 @unlink(PROXY_PATH."/".$sess.".step");
444 log_legal($curtime, 'xxx', $this, "STAT:LOGOUT", '');
446 $tmp_sess = $this->sess;
448 self::unproxy_step($tmp_sess);
449 $this->name = ""; // OK here
450 while (array_pop($this->comm) != NULL);
452 $this->chattime = array_fill(0, CHAT_N, 0);
454 $this->chat_lst = "";
457 $this->the_end = FALSE;
460 static function load_data($id, $sess)
462 log_main("load_data: id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
465 if (($tok = @ftok(FTOK_PATH."/user".$id, "C")) == -1) {
466 log_main("ftok failed");
470 if (($shm_sz = sharedmem_sz($tok)) == -1) {
471 log_main("shmop_open failed");
475 $shm_sz = SHM_DIMS_U_MIN;
477 if ($shm = shm_attach($tok, $shm_sz)) {
478 if (($user = @shm_get_var($shm, $tok)) == FALSE) {
481 if ($sess != FALSE && $user->sess != $sess) {
484 log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE"));
486 if ($user == FALSE) {
487 log_only("INIT MAIN DATA");
489 // SHSPLIT FIXME: init_data for User class ??
490 $user = self::create($id, "", "");
491 if (@shm_put_var($shm, $tok, $user) == FALSE) {
492 log_only("PUT_VAR FALLITA ".strlen(serialize($user)));
493 log_only(serialize($user));
495 log_shme("User::save_data2");
498 if ($sess != FALSE) {
500 * NOTE: this part is for check only, theoretically
501 * user->step anch proxy_step are set allways at the same value
503 $old_step = $user->step;
504 $arr = self::load_step($sess);
505 $user->step = $arr['s'];
506 if ($old_step != $user->step) {
507 log_crit("steps are diffetents User->step ".$user->step." Old_step: ".$old_step);
511 $user->shm_sz = $shm_sz;
517 // SHSPLIT: load users from the shared memory
526 static function save_data($user, $id)
532 if (($tok = @ftok(FTOK_PATH."/user".$id, "C")) == -1) {
535 while ($user->shm_sz < SHM_DIMS_U_MAX) {
536 if (($shm = shm_attach($tok, $user->shm_sz)) == FALSE)
539 // log_only("PUT_VAR DI ".strlen(serialize($user)));
540 if (@shm_put_var($shm, $tok, $user) != FALSE) {
542 if ($user->sess != "")
545 log_shme("User::save_data");
547 log_main("User[".$id."] saved.");
550 if (shm_remove($shm) === FALSE) {
551 log_only("REMOVE FALLITA");
555 $user->shm_sz += SHM_DIMS_U_DLT;
564 function myname_innerHTML()
566 $class_id = ($this->flags & USER_FLAG_AUTH) + 1;
568 return (sprintf('$("myname").innerHTML = "<span class=\"au%d\">%s</span>";', $class_id,
569 xcape($this->name,ENT_COMPAT,"UTF-8")));
572 /* INDEX_RD_IFRA PORT */
574 protected function blocking_error($is_unrecoverable)
576 GLOBAL $is_page_streaming;
578 $is_page_streaming = TRUE;
579 log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
580 return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'));
583 // FIXME TO SUPPORT iframe
584 protected function page_sync($sess, $page, $table_idx, $table_token)
586 GLOBAL $is_page_streaming;
588 // log_rd2("page_sync:".var_export(debug_backtrace()));
590 $is_page_streaming = TRUE;
592 log_rd2("PAGE_SYNC");
593 printf("xXx USER::PAGE_SYNC [%s]\n", get_class($this));
594 return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); hstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page));
600 protected function maincheck($cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $splashdate, $table_idx, $table_token)
602 GLOBAL $G_lang, $mlang_indrd, $is_page_streaming;
603 // GLOBAL $first_loop;
604 GLOBAL $G_with_splash, $G_splash_content, $G_splash_interval, $G_splash_idx;
605 GLOBAL $G_splash_w, $G_splash_h, $G_splash_timeout;
606 $CO_splashdate = "CO_splashdate".$G_splash_idx;
607 $$CO_splashdate = $splashdate;
611 log_rd("maincheck begin");
616 /* Nothing changed, return. */
617 if ($cur_step == $this->step)
620 log_rd2("do other cur_stat[".$cur_stat."] user->stat[".$this->stat."] cur_step[".$cur_step."] user_step[".$this->step."]");
622 if ($cur_step == -1) {
624 * if $cur_step == -1 load the current state from the main struct
627 $S_load_stat['wR_minusone']++;
629 if ($this->the_end == TRUE) {
630 // log_rd2("main_check: the end".var_export(debug_backtrace()));
631 $is_page_streaming = TRUE;
634 if ($this->trans_step != -1) {
635 log_rd2("TRANS USATO ".$this->trans_step);
636 $cur_step = $this->trans_step;
637 $this->trans_step = -1;
640 log_rd2("TRANS NON ATTIVATO");
645 /* this part I suppose is read only on $this->room structure */
646 if ($cur_step == -1) {
647 log_rd2("PRE-NEWSTAT: ".$this->stat);
649 if ($this->stat == 'room') {
650 log_rd("roomma ".$this->step);
653 if ($G_with_splash &&
654 ($$CO_splashdate < $curtime - $G_splash_interval ||
655 $$CO_splashdate > $curtime)) {
656 $is_super = $this->flags & USER_FLAG_TY_SUPER;
657 $ret .= show_notify_ex(str_replace("\n", " ", $G_splash_content[$G_lang]),
658 ($is_super ? 0 : $G_splash_timeout),
659 $mlang_indrd[($is_super ? 'btn_btotabsup' : 'btn_backtotab')][$G_lang],
660 $G_splash_w, $G_splash_h, true,
661 ($is_super ? 0 : $G_splash_timeout));
662 $ret .= sprintf('|createCookie("CO_splashdate%d", %d, 24*365, cookiepath);', $G_splash_idx, $curtime);
664 $ret .= $this->room->show_room($this->step, $this);
666 // TODO uncomment and test
667 /* NOTE the sets went common */
668 $new_stat = $this->stat;
669 $new_subst = $this->subst;
670 $new_step = $this->step;
677 else if ($this->stat == 'table') {
679 printf("xXx USER::MAINCHECK1 [%s]\n", get_class($this));
681 return ($this->page_sync($this->sess, "briskin5/index.php", $this->table, $this->table_token));
683 log_rd2("NEWSTAT: ".$this->stat);
684 } /* if ($cur_step == -1) { */
686 /* $sem = Room::lock_data(FALSE); */
687 $S_load_stat['rU_heavy']++;
689 if ($cur_step < $this->step) {
691 if ($cur_step + COMM_N < $this->step) {
692 if (($cur_stat != $this->stat)) {
693 $to_stat = $this->stat;
694 /* Room::unlock_data($sem); */
696 printf("xXx USER::MAINCHECK2 [%s]\n", get_class($this));
697 return ($this->page_sync($this->sess, ($to_stat == "table" ? "briskin5/index.php" : "index.php"), $this->table, $this->table_token));
699 log_rd2("lost history, refresh from scratch");
703 for ($i = $cur_step ; $i < $this->step ; $i++) {
705 log_rd2("ADDED TO THE STREAM: ".$this->comm[$ii]);
706 $ret .= $this->comm[$ii];
708 $new_stat = $this->stat;
709 $new_subst = $this->subst;
710 $new_step = $this->step;
713 log_rd2($this->step, 'index_rd.php: after ret set');
715 if ($this->the_end == TRUE) {
716 log_rd2("LOGOUT BYE BYE!!");
717 log_auth($this->sess, "Explicit logout.");
719 if ($this->the_end == TRUE) {
722 if ($this->subst == 'sitdown') {
723 log_load("ROOM WAKEUP");
724 $this->room->room_wakeup($this);
726 else if ($this->subst == 'standup')
727 $this->room->room_outstandup($this);
729 log_rd2("LOGOUT FROM WHAT ???");
731 } /* if ($this->the_end == TRUE) { ... */
732 } /* if ($this->the_end == TRUE) { ... */
733 } /* if ($cur_step < $this->step) { */
735 /* Room::unlock_data($sem); */
736 } /* else of if ($cur_step == -1) { */
740 } // function maincheck (...
742 public static function stream_fini($init_string, $is_unrecoverable)
746 $body .= sprintf("<html>
748 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
749 <script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
750 <script type=\"text/javascript\">
751 var http_streaming = \"ready\";", self::base_get(), self::base_get());
753 window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
757 $body .= sprintf("<!-- \n%s -->\n", $init_string);
758 $body .= sprintf("<script id='hs%d' type='text/javascript'><!--
761 </script>", 0, escpush(self::blocking_error($is_unrecoverable)) );
763 // return (self::blocking_error($is_unrecoverable));
777 function stream_init($init_string, &$header_out, &$body, $get, $post, $cookie)
781 printf("CLASS: [%s] base: [%s]\n", get_class($this), self::base_get());
783 $is_page_streaming = FALSE; // (webservers_exceeded() || stristr($HTTP_USER_AGENT, "Mozilla/5.0 (Windows NT 6.1; rv:5.0)") || stristr($HTTP_USER_AGENT, "MSIE") || stristr($HTTP_USER_AGENT, "CHROME") ? TRUE : FALSE);
785 $header_out['Cache-Control'] = 'no-cache, must-revalidate'; // HTTP/1.1
786 $header_out['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; // Date in the past
787 $header_out['Content-type'] = 'text/html; charset="utf-8"';
789 log_load("index_rd_ifra_init.php");
791 if (($from = gpcs_var('from', $get, $post, $cookie)) === FALSE)
793 if (($stat = gpcs_var('stat', $get, $post, $cookie)) === FALSE)
795 if (($subst = gpcs_var('subst', $get, $post, $cookie)) === FALSE)
797 if (($step = gpcs_var('step', $get, $post, $cookie)) === FALSE)
800 $this->rd_data_set($curtime, $stat, $subst, $step, $from);
801 $cc = get_called_class();
803 $body .= sprintf("<html>
805 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
806 <script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
807 <script type=\"text/javascript\">
808 var http_streaming = \"ready\";", self::base_get(), self::base_get());
809 if ($this->rd_scristp > 0)
810 $body .= sprintf("last_clean = %d;\n", ($this->rd_scristp-1));
812 window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
816 $body .= sprintf("<!-- \n%s -->\n", $init_string);
821 function stream_main(&$body, $get, $post, $cookie)
823 GLOBAL $is_page_streaming, $G_splash_idx;
825 $CO_splashdate = "CO_splashdate".$G_splash_idx;
826 if (($splashdate = gpcs_var("$CO_splashdate", $get, $post, $cookie)) === FALSE)
828 if (($table_idx = gpcs_var("table_idx", $get, $post, $cookie)) === FALSE)
830 if (($table_token = gpcs_var("table_token", $get, $post, $cookie)) === FALSE)
833 $is_page_streaming = FALSE;
834 log_rd2("FROM OUTSIDE - STAT: ".$this->rd_stat." SUBST: ".$this->rd_subst." STEP: ".$this->rd_step." FROM: ".$this->rd_from. "IS_PAGE:" . $is_page_streaming);
837 $pre_main = gettimeofday(TRUE);
839 $old_stat = $this->rd_stat;
840 $old_subst = $this->rd_subst;
841 $old_step = $this->rd_step;
842 printf("xXx PRE : rd_step %d\n", $this->rd_step);
843 if (($ret = $this->maincheck($old_stat, $old_subst, $old_step, $this->rd_stat, $this->rd_subst, $this->rd_step, $splashdate, $table_idx, $table_token)) != FALSE) {
844 $body .= sprintf("<script id='hs%d' type='text/javascript'><!--
847 </script>", $this->rd_scristp++, escpush($ret) );
849 log_rd2(0, 'index_rd.php: after mop_flush (begin: '.sprintf("%f", $pre_main).')');
850 if ($is_page_streaming)
853 printf("xXx POST: rd_step %d\n", $this->rd_step);
858 function stream_keepalive($with_ping)
860 $ret = (sprintf("<script id='hs%d' type='text/javascript'><!--
863 </script>", $this->rd_scristp++, ($with_ping ? "\"act_ping();\"" : "null")));
868 static function base_get()
870 $c = get_called_class();
871 printf("CALLED_CLASS: [%s]\n", $c);