X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex_rd.php;h=9b82158ae54dd06020a84d4f1ca8d9181d871112;hb=182eff6ad1aafbdcb765a4190a24a1c8f2f93f6b;hp=8b25ae0f222f312ac4d4cf691d1085a503b361e3;hpb=ba124be15839e2a62fa793b70869e0209f8daf90;p=brisk.git diff --git a/web/index_rd.php b/web/index_rd.php index 8b25ae0..9b82158 100644 --- a/web/index_rd.php +++ b/web/index_rd.php @@ -2,7 +2,7 @@ /* * brisk - index_rd.php * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2011 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -20,14 +20,22 @@ * not, write to the Free Software Foundation, Inc, 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. * - * $Id$ - * */ +$G_base = ""; + require_once("Obj/brisk.phh"); // require_once("Obj/proxyscan.phh"); require_once("briskin5/Obj/briskin5.phh"); + +$mlang_indrd = array( + 'btn_backtotab' => array('it' => ' torna ai tavoli ', + 'en' => ' back to tables '), + 'btn_btotabsup' => array('it' => ' grazie della donazione, torna ai tavoli ', + 'en' => ' thank you for donation, back to tables ') + ); + // Use of proxies isn't allowed. // if (is_proxy()) { // sleep(5); @@ -57,7 +65,7 @@ function unrecerror() $is_page_streaming = TRUE; log_rd2("UNREC_ERROR:".var_export(debug_backtrace())); - return (sprintf('the_end=true; window.onunload = null; document.location.assign("index.php");')); + return (sprintf('the_end=true; window.onunload = null; window.onbeforeunload = null; document.location.assign("index.php");')); } function page_sync($sess, $page, $table_idx, $table_token) @@ -69,7 +77,7 @@ function page_sync($sess, $page, $table_idx, $table_token) $is_page_streaming = TRUE; log_rd2("PAGE_SYNC"); - return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); the_end=true; window.onunload = null; document.location.assign("%s");', $table_idx, $table_token, $page)); + return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); the_end=true; window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page)); } @@ -77,7 +85,11 @@ function page_sync($sess, $page, $table_idx, $table_token) function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step) { - GLOBAL $is_page_streaming, $first_loop; + GLOBAL $G_lang, $mlang_indrd, $is_page_streaming, $first_loop; + 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; + GLOBAL $$CO_splashdate; $ret = FALSE; $room = FALSE; @@ -110,13 +122,20 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su ignore_user_abort(FALSE); } else { + // wait 20 secs, then restart the xhr + ignore_user_abort(FALSE); + + return ("sleep(gst,20000);|xhr_rd_abort(xhr_rd);"); + /* + ignore_user_abort(FALSE); return (FALSE); + */ } if (($proxy_step = step_get($sess)) != FALSE) { // log_rd2("Postget".$proxy_step."zizi"); - if ($cur_step == $proxy_step) { + if ($cur_step == $proxy_step['s']) { log_lock("P"); return (FALSE); } @@ -203,6 +222,19 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su if ($user->stat == 'room') { log_rd("roomma ".$user->step); + $curtime = time(); + + if ($G_with_splash && + ($$CO_splashdate < $curtime - $G_splash_interval || + $$CO_splashdate > $curtime)) { + $is_super = $user->flags & USER_FLAG_TY_SUPER; + $ret .= show_notify_ex(str_replace("\n", " ", $G_splash_content[$G_lang]), + ($is_super ? 0 : $G_splash_timeout), + $mlang_indrd[($is_super ? 'btn_btotabsup' : 'btn_backtotab')][$G_lang], + $G_splash_w, $G_splash_h, true, + ($is_super ? 0 : $G_splash_timeout)); + $ret .= sprintf('|createCookie("CO_splashdate%d", %d, 24*365, cookiepath);', $G_splash_idx, $curtime); + } $ret .= $room->show_room($user->step, &$user); // TODO uncomment and test @@ -253,7 +285,9 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $new_subst = $user->subst; $new_step = $user->step; } while (0); - + + log_mop($user->step, 'index_rd.php: after ret set'); + if ($user->the_end == TRUE) { log_rd2("LOGOUT BYE BYE!!"); log_auth($user->sess, "Explicit logout."); @@ -262,7 +296,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su if ($user->subst == 'sitdown') { log_load("ROOM WAKEUP"); - $room->room_wakeup(&$user); + $room->room_wakeup($user); } else if ($user->subst == 'standup') $room->room_outstandup(&$user); @@ -292,9 +326,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su step */ -$is_page_streaming = ((stristr($HTTP_USER_AGENT, "linux") && - (stristr($HTTP_USER_AGENT, "firefox") || stristr($HTTP_USER_AGENT, "iceweasel"))) ? FALSE : TRUE); - +$is_page_streaming = (stristr($HTTP_USER_AGENT, "MSIE") || stristr($HTTP_USER_AGENT, "CHROME") ? TRUE : FALSE); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past @@ -316,6 +348,7 @@ $old_step = $ext_step = $step; for ($i = 0 ; time() < $endtime ; $i++) { // log_rd("PRE MAIN ".$step);; + $pre_main = gettimeofday(TRUE); if (($ret = maincheck($sess, $old_stat, $old_subst, $old_step, &$stat, &$subst, &$step)) != FALSE) { echo '@BEGIN@'; // log_rd2(sprintf("\nSESS: [%s]\nOLD_STAT: [%s] OLD_SUBST: [%s] OLD_STEP: [%s] \nSTAT: [%s] SUBST: [%s] STEP: [%s] \nCOMM: [%s]\n", $sess, $old_stat, $old_subst, $old_step, $stat, $subst, $step, $ret)); @@ -323,6 +356,7 @@ for ($i = 0 ; time() < $endtime ; $i++) { echo ' @END@'; log_send("IS_PAGE: ".($is_page_streaming == TRUE ? "TRUE" : "FALSE")."EXT_STEP: ".$ext_step." ENDTIME: [".$endtime."] ".$ret); flush(); + log_mop(0, 'index_rd.php: after flush (begin: '.sprintf("%f", $pre_main).')'); if ($is_page_streaming) break; } @@ -331,7 +365,7 @@ for ($i = 0 ; time() < $endtime ; $i++) { $old_step = $step; // log_rd("POST MAIN ".$step);; usleep(400000); - if (($i % 5) == 0) { + if (($i % 10) == 0) { // log_rd2("TIME: ".time()); echo '_'; flush();