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
100 var $rd_zls; // zlibstream object handle if compressed stream, else FALSE
102 var $comm; // commands array
103 // var $asta_card; //
105 // var $handpt; // Total card points at the beginning of the current hand.
106 // var $exitislock; // Player can exit from the table ?
108 // FIXME: the table_orig field must be removed after table field verify of index management (in spawned table
109 // it is allways ZERO
110 var $table; // id of the current table when you are in game
111 var $table_orig; // id of the current table when you aren't in game
112 var $table_pos; // idx on the table
113 var $table_token;// token that identify a game on a table
114 var $flags; // Bitfield with: AUTHENTICATE: 0x02
115 var $the_end; // Flag to change the end of the session
117 var $chat_lst; // Last chat line
118 var $chattime; // Array of chat times
119 var $chat_cur; // Current chat line number
120 var $chat_ban; // Time for ban chat
121 var $chat_dlt; // Delta t for ban
124 const BASE = ""; // basepath for absolute web references
129 function create(&$room, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
130 if (($thiz = new User()) == FALSE)
133 $thiz->room = &$room;
135 $thiz->idx_orig = $idx;
140 $thiz->lacc = time();
141 $thiz->laccwr = time();
144 $thiz->subst = $subst;
146 $thiz->trans_step = -1;
147 $thiz->comm = array();
149 $thiz->rd_socket = NULL;
150 $thiz->rd_endtime = -1;
152 $thiz->rd_subst = "";
155 $thiz->rd_scristp = -1;
156 $thiz->rd_kalive = -1;
157 $thiz->rd_cache = "";
158 $thiz->rd_zls = FALSE;
160 $thiz->asta_card = -2;
161 $thiz->asta_pnt = -1;
163 $thiz->exitislock = TRUE;
167 $thiz->chattime = array_fill(0, CHAT_N, 0);
169 $thiz->chat_lst = "";
173 $thiz->table_orig = $table;
174 $thiz->table = $table;
175 $thiz->table_pos = -1;
176 $thiz->table_token= "";
177 $thiz->shm_sz = SHM_DIMS_U_MIN;
183 $this->idx = $from->idx;
184 $this->idx_orig = $from->idx;
185 $this->code = $from->code;
186 $this->name = $from->name;
187 $this->sess = $from->sess;
188 $this->ip = $from->ip;
189 $this->lacc = $from->lacc;
190 $this->laccwr = $from->laccwr;
191 $this->bantime = $from->bantime;
192 $this->stat = $from->stat;
193 $this->subst = $from->subst;
194 $this->step = $from->step;
195 $this->trans_step = $from->trans_step;
196 $this->comm = array();
198 $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
199 for ($i = $i_start ; $i < $from->step ; $i++) {
201 if (isset($from->comm[$ii])) {
202 $this->comm[$ii] = $from->comm[$ii];
205 $this->asta_card = $from->asta_card;
206 $this->asta_pnt = $from->asta_pnt;
207 $this->handpt = $from->handpt;
208 $this->exitislock = $from->exitislock;
210 $this->flags = $from->flags;
212 $this->chattime = array();
213 for ($i = 0 ; $i < CHAT_N ; $i++)
214 $this->chattime[$i] = $from->chattime[$i];
215 $this->chat_cur = $from->chat_cur;
216 $this->chat_lst = $from->chat_lst;
217 $this->chat_ban = $from->chat_ban;
218 $this->chat_dlt = $from->chat_dlt;
220 $this->table_orig = $from->table_orig;
221 $this->table = $from->table;
222 $this->table_pos = $from->table_pos;
223 $this->table_token = $from->table_token;
224 $this->the_end = $from->the_end;
225 $this->shm_sz = $from->shm_sz;
230 function myclone($from)
232 if (($thiz = new User()) == FALSE)
240 function spawn($from, $table, $table_pos)
242 if (($thiz = new User()) == FALSE)
245 $thiz->idx = $from->idx;
246 $thiz->idx_orig = $from->idx;
247 $thiz->code = $from->code;
248 $thiz->name = $from->name;
249 $thiz->sess = $from->sess;
250 $thiz->ip = $from->ip;
251 $thiz->lacc = $from->lacc;
252 $thiz->laccwr = $from->laccwr;
253 $thiz->bantime = $from->bantime;
254 $thiz->stat = $from->stat;
255 $thiz->subst = $from->subst;
256 $thiz->step = $from->step;
257 $thiz->trans_step = $from->trans_step;
258 $thiz->comm = array();
261 $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
262 for ($i = $i_start ; $i < $from->step ; $i++) {
263 log_wr("TRY PUSH:".$i);
265 $thiz->comm[$ii] = $from->comm[$ii];
268 $thiz->asta_card = $from->asta_card;
269 $thiz->asta_pnt = $from->asta_pnt;
270 $thiz->handpt = $from->handpt;
271 $thiz->exitislock = $from->exitislock;
272 $thiz->the_end = $from->the_end;
274 $thiz->flags = $from->flags;
276 $thiz->chattime = array_fill(0, CHAT_N, 0);
278 $thiz->chat_lst = "";
283 $thiz->table_orig = $table;
285 $thiz->table_pos = $table_pos;
286 $thiz->table_token = $from->table_token;
287 $thiz->shm_sz = $from->shm_sz;
292 function rd_data_set($curtime, $enc, $stat, $subst, $step, $from)
294 $this->rd_endtime = $curtime + RD_ENDTIME_DELTA;
295 $this->rd_stat = $stat;
296 $this->rd_subst = $subst;
297 $this->rd_step = $step;
298 $this->rd_from = $from;
299 $this->rd_scristp = 0;
300 $this->rd_kalive = $curtime + RD_KEEPALIVE_TOUT;
301 $this->rd_zls = ZLibStream::create($enc);
304 function rd_socket_get() {
305 return ($this->rd_socket);
308 function rd_socket_set($sock) {
311 $this->rd_zls->destroy();
312 $this->rd_zls = FALSE;
315 $this->rd_socket = $sock;
318 function rd_kalive_get()
320 return ($this->rd_kalive);
323 function rd_kalive_set($tm)
325 $this->rd_kalive = $tm;
328 function rd_kalive_is_expired($tm)
330 // printf("rd_kalive %d tm %d\n", $this->rd_kalive, $tm);
331 return ($this->rd_kalive < $tm);
334 function rd_endtime_is_expired($tm)
336 // printf("rd_endtime %d tm %d\n", $this->rd_kalive, $tm);
337 return ($this->rd_endtime < $tm);
340 function rd_kalive_reset($tm)
342 $this->rd_kalive = $tm + RD_KEEPALIVE_TOUT;
345 function rd_cache_get()
347 return ($this->rd_cache);
350 function rd_cache_set($cache)
352 $this->rd_cache = $cache;
355 function rd_zls_get()
357 return ($this->rd_zls);
364 function code_get() {
365 return ($this->code);
368 function stat_set($stat) {
369 log_main("sess: [".$this->sess. "] NEW STAT: [".$stat."]");
370 $this->stat = "$stat";
373 if (validate_sess($this->sess)) {
374 if (file_exists(PROXY_PATH) == FALSE)
375 mkdir(PROXY_PATH, 0775, TRUE);
376 $fp = @fopen(PROXY_PATH."/".$this->sess.".stat", 'w');
377 fwrite($fp, sprintf("%s\n",$this->stat));
383 function step_set($step)
385 $this->step = $step & 0x7fffffff;
390 function step_inc($delta = 1) {
391 $this->step += $delta;
392 /* modularization because unpack() not manage unsigned 32bit int correctly */
393 $this->step &= 0x7fffffff;
402 if (validate_sess($this->sess) == FALSE)
404 if (file_exists(PROXY_PATH) == FALSE)
405 mkdir(PROXY_PATH, 0775, TRUE);
406 if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
408 fwrite($fp, pack("LL",$this->step, $this->idx));
411 log_main("step_set [".$this->sess. "] [".$this->step."]");
419 static function load_step($sess)
423 if (validate_sess($sess) == FALSE)
426 if (file_exists(PROXY_PATH) == FALSE)
427 mkdir(PROXY_PATH, 0775, TRUE);
428 if (($fp = @fopen(PROXY_PATH."/".$sess.".step", 'rb')) == FALSE)
430 if (($s = fread($fp, 8)) == FALSE)
432 if (mb_strlen($s, "ASCII") != 8)
434 $arr = unpack('Ls/Li', $s);
437 // log_rd2("A0: ".$arr[0]." A1: ".$arr[1]);
444 log_rd2("STEP_GET [".$sess."]: return false ");
449 static function unproxy_step($sess) {
450 log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step");
451 if (file_exists(PROXY_PATH) == FALSE)
453 @unlink(PROXY_PATH."/".$sess.".step");
458 log_legal($curtime, 'xxx', $this, "STAT:LOGOUT", '');
460 $tmp_sess = $this->sess;
462 self::unproxy_step($tmp_sess);
463 $this->name = ""; // OK here
464 while (array_pop($this->comm) != NULL);
466 $this->chattime = array_fill(0, CHAT_N, 0);
468 $this->chat_lst = "";
471 $this->the_end = FALSE;
474 static function load_data($id, $sess)
476 log_main("load_data: id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
479 if (($tok = @ftok(FTOK_PATH."/user".$id, "C")) == -1) {
480 log_main("ftok failed");
484 if (($shm_sz = sharedmem_sz($tok)) == -1) {
485 log_main("shmop_open failed");
489 $shm_sz = SHM_DIMS_U_MIN;
491 if ($shm = shm_attach($tok, $shm_sz)) {
492 if (($user = @shm_get_var($shm, $tok)) == FALSE) {
495 if ($sess != FALSE && $user->sess != $sess) {
498 log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE"));
500 if ($user == FALSE) {
501 log_only("INIT MAIN DATA");
503 // SHSPLIT FIXME: init_data for User class ??
504 $user = self::create($id, "", "");
505 if (@shm_put_var($shm, $tok, $user) == FALSE) {
506 log_only("PUT_VAR FALLITA ".strlen(serialize($user)));
507 log_only(serialize($user));
509 log_shme("User::save_data2");
512 if ($sess != FALSE) {
514 * NOTE: this part is for check only, theoretically
515 * user->step anch proxy_step are set allways at the same value
517 $old_step = $user->step;
518 $arr = self::load_step($sess);
519 $user->step = $arr['s'];
520 if ($old_step != $user->step) {
521 log_crit("steps are diffetents User->step ".$user->step." Old_step: ".$old_step);
525 $user->shm_sz = $shm_sz;
531 // SHSPLIT: load users from the shared memory
540 static function save_data($user, $id)
546 if (($tok = @ftok(FTOK_PATH."/user".$id, "C")) == -1) {
549 while ($user->shm_sz < SHM_DIMS_U_MAX) {
550 if (($shm = shm_attach($tok, $user->shm_sz)) == FALSE)
553 // log_only("PUT_VAR DI ".strlen(serialize($user)));
554 if (@shm_put_var($shm, $tok, $user) != FALSE) {
556 if ($user->sess != "")
559 log_shme("User::save_data");
561 log_main("User[".$id."] saved.");
564 if (shm_remove($shm) === FALSE) {
565 log_only("REMOVE FALLITA");
569 $user->shm_sz += SHM_DIMS_U_DLT;
578 function myname_innerHTML()
580 $class_id = ($this->flags & USER_FLAG_AUTH) + 1;
582 return (sprintf('$("myname").innerHTML = "<span class=\"au%d\">%s</span>";', $class_id,
583 xcape($this->name,ENT_COMPAT,"UTF-8")));
586 /* INDEX_RD_IFRA PORT */
588 protected function blocking_error($is_unrecoverable)
590 GLOBAL $is_page_streaming;
592 $is_page_streaming = TRUE;
593 log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE"));
594 return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'));
597 // FIXME TO SUPPORT iframe
598 protected function page_sync($sess, $page, $table_idx, $table_token)
600 GLOBAL $is_page_streaming;
602 // log_rd2("page_sync:".var_export(debug_backtrace()));
604 $is_page_streaming = TRUE;
606 log_rd2("PAGE_SYNC");
607 printf("xXx USER::PAGE_SYNC [%s]\n", get_class($this));
608 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));
614 protected function maincheck($cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $splashdate, $table_idx, $table_token)
616 GLOBAL $G_lang, $mlang_indrd, $is_page_streaming;
617 // GLOBAL $first_loop;
618 GLOBAL $G_with_splash, $G_splash_content, $G_splash_interval, $G_splash_idx;
619 GLOBAL $G_splash_w, $G_splash_h, $G_splash_timeout;
620 $CO_splashdate = "CO_splashdate".$G_splash_idx;
621 $$CO_splashdate = $splashdate;
625 log_rd("maincheck begin");
630 /* Nothing changed, return. */
631 if ($cur_step == $this->step)
634 log_rd2("do other cur_stat[".$cur_stat."] user->stat[".$this->stat."] cur_step[".$cur_step."] user_step[".$this->step."]");
636 if ($cur_step == -1) {
638 * if $cur_step == -1 load the current state from the main struct
641 $S_load_stat['wR_minusone']++;
643 if ($this->the_end == TRUE) {
644 // log_rd2("main_check: the end".var_export(debug_backtrace()));
645 $is_page_streaming = TRUE;
648 if ($this->trans_step != -1) {
649 log_rd2("TRANS USATO ".$this->trans_step);
650 $cur_step = $this->trans_step;
651 $this->trans_step = -1;
654 log_rd2("TRANS NON ATTIVATO");
659 /* this part I suppose is read only on $this->room structure */
660 if ($cur_step == -1) {
661 log_rd2("PRE-NEWSTAT: ".$this->stat);
663 if ($this->stat == 'room') {
664 log_rd("roomma ".$this->step);
667 if ($G_with_splash &&
668 ($$CO_splashdate < $curtime - $G_splash_interval ||
669 $$CO_splashdate > $curtime)) {
670 $is_super = $this->flags & USER_FLAG_TY_SUPER;
671 $ret .= show_notify_ex(str_replace("\n", " ", $G_splash_content[$G_lang]),
672 ($is_super ? 0 : $G_splash_timeout),
673 $mlang_indrd[($is_super ? 'btn_btotabsup' : 'btn_backtotab')][$G_lang],
674 $G_splash_w, $G_splash_h, true,
675 ($is_super ? 0 : $G_splash_timeout));
676 $ret .= sprintf('|createCookie("CO_splashdate%d", %d, 24*365, cookiepath);', $G_splash_idx, $curtime);
678 $ret .= $this->room->show_room($this->step, $this);
680 // TODO uncomment and test
681 /* NOTE the sets went common */
682 $new_stat = $this->stat;
683 $new_subst = $this->subst;
684 $new_step = $this->step;
691 else if ($this->stat == 'table') {
693 printf("xXx USER::MAINCHECK1 [%s]\n", get_class($this));
695 return ($this->page_sync($this->sess, "briskin5/index.php", $this->table, $this->table_token));
697 log_rd2("NEWSTAT: ".$this->stat);
698 } /* if ($cur_step == -1) { */
700 /* $sem = Room::lock_data(FALSE); */
701 $S_load_stat['rU_heavy']++;
703 if ($cur_step < $this->step) {
705 if ($cur_step + COMM_N < $this->step) {
706 if (($cur_stat != $this->stat)) {
707 $to_stat = $this->stat;
708 /* Room::unlock_data($sem); */
710 printf("xXx USER::MAINCHECK2 [%s]\n", get_class($this));
711 return ($this->page_sync($this->sess, ($to_stat == "table" ? "briskin5/index.php" : "index.php"), $this->table, $this->table_token));
713 log_rd2("lost history, refresh from scratch");
717 for ($i = $cur_step ; $i < $this->step ; $i++) {
719 log_rd2("ADDED TO THE STREAM: ".$this->comm[$ii]);
720 $ret .= $this->comm[$ii];
722 $new_stat = $this->stat;
723 $new_subst = $this->subst;
724 $new_step = $this->step;
727 log_rd2($this->step, 'index_rd.php: after ret set');
729 if ($this->the_end == TRUE) {
730 log_rd2("LOGOUT BYE BYE!!");
731 log_auth($this->sess, "Explicit logout.");
733 if ($this->the_end == TRUE) {
736 if ($this->subst == 'sitdown') {
737 log_load("ROOM WAKEUP");
738 $this->room->room_wakeup($this);
740 else if ($this->subst == 'standup')
741 $this->room->room_outstandup($this);
743 log_rd2("LOGOUT FROM WHAT ???");
745 } /* if ($this->the_end == TRUE) { ... */
746 } /* if ($this->the_end == TRUE) { ... */
747 } /* if ($cur_step < $this->step) { */
749 /* Room::unlock_data($sem); */
750 } /* else of if ($cur_step == -1) { */
754 } // function maincheck (...
756 public static function stream_fini($init_string, $is_unrecoverable)
760 $body .= sprintf("<html>
762 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
763 <script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
764 <script type=\"text/javascript\">
765 var http_streaming = \"ready\";", self::base_get(), self::base_get());
767 window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
771 $body .= sprintf("<!-- \n%s -->\n", $init_string);
772 $body .= sprintf("<script id='hs%d' type='text/javascript'><!--
775 </script>", 0, escpush(self::blocking_error($is_unrecoverable)) );
777 // return (self::blocking_error($is_unrecoverable));
791 function stream_init($init_string, $enc, &$header_out, &$body, $get, $post, $cookie)
795 printf("CLASS: [%s] base: [%s]\n", get_class($this), self::base_get());
797 $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);
800 $header_out['Content-Encoding'] = $enc;
801 $header_out['Cache-Control'] = 'no-cache, must-revalidate'; // HTTP/1.1
802 $header_out['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; // Date in the past
803 $header_out['Content-type'] = 'text/html; charset="utf-8"';
805 log_load("index_rd_ifra_init.php");
807 if (($from = gpcs_var('from', $get, $post, $cookie)) === FALSE)
809 if (($stat = gpcs_var('stat', $get, $post, $cookie)) === FALSE)
811 if (($subst = gpcs_var('subst', $get, $post, $cookie)) === FALSE)
813 if (($step = gpcs_var('step', $get, $post, $cookie)) === FALSE)
816 $this->rd_data_set($curtime, $enc, $stat, $subst, $step, $from);
817 $cc = get_called_class();
819 $body .= sprintf("<html>
821 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
822 <script type=\"text/javascript\" src=\"%sxynt-http-streaming-ifra.js\"></script>
823 <script type=\"text/javascript\">
824 var http_streaming = \"ready\";", self::base_get(), self::base_get());
825 if ($this->rd_scristp > 0)
826 $body .= sprintf("last_clean = %d;\n", ($this->rd_scristp-1));
828 window.onload = function () { if (http_streaming != \"ready\") { http_streaming.reload(); } };
832 $body .= sprintf("<!-- \n%s -->\n", $init_string);
837 function stream_main(&$body, $get, $post, $cookie)
839 GLOBAL $is_page_streaming, $G_splash_idx;
841 $CO_splashdate = "CO_splashdate".$G_splash_idx;
842 if (($splashdate = gpcs_var("$CO_splashdate", $get, $post, $cookie)) === FALSE)
844 if (($table_idx = gpcs_var("table_idx", $get, $post, $cookie)) === FALSE)
846 if (($table_token = gpcs_var("table_token", $get, $post, $cookie)) === FALSE)
849 $is_page_streaming = FALSE;
850 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);
853 $pre_main = gettimeofday(TRUE);
855 $old_stat = $this->rd_stat;
856 $old_subst = $this->rd_subst;
857 $old_step = $this->rd_step;
858 printf("xXx PRE : rd_step %d\n", $this->rd_step);
859 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) {
860 $body .= sprintf("<script id='hs%d' type='text/javascript'><!--
863 </script>", $this->rd_scristp++, escpush($ret) );
865 log_rd2(0, 'index_rd.php: after mop_flush (begin: '.sprintf("%f", $pre_main).')');
866 if ($is_page_streaming)
869 printf("xXx POST: rd_step %d\n", $this->rd_step);
874 function stream_keepalive($with_ping)
876 $ret = (sprintf("<script id='hs%d' type='text/javascript'><!--
879 </script>", $this->rd_scristp++, ($with_ping ? "\"act_ping();\"" : "null")));
884 static function base_get()
886 $c = get_called_class();
887 printf("CALLED_CLASS: [%s]\n", $c);