new class transport iframe decoupled from xynt_streaming to allow multiple transports
[brisk.git] / web / briskin5 / index.php
index 369e6b9..00121b8 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *  brisk - briskin5/index.php
  *
- *  Copyright (C) 2006-2011 Matteo Nastasi
+ *  Copyright (C) 2006-2012 Matteo Nastasi
  *                          mailto: nastasi@alternativeoutput.it 
  *                                  matteo.nastasi@milug.org
  *                          web: http://www.alternativeoutput.it
@@ -41,20 +41,30 @@ $mlang_bin5_index = array( 'aucwin' => array( 'it' => 'Hai vinto l\'asta.<br> Sc
                            );
 
 
-// Use of proxies isn't allowed.
-if (is_proxy()) {
-  exit;
-}
+function bin5_index_main(&$header_out, $addr, $get, $post, $cookie)
+{
+    GLOBAL $G_lang, $mlang_bin5_index;
+    if (($table_idx = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
+        unset ($table_idx);
+    if (($laststate = gpcs_var('laststate', $get, $post, $cookie)) === FALSE)
+        unset ($laststate);
+    if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
+        unset ($sess);
 
-header('Content-type: text/html; charset="utf-8"',true);
-?>
+    // Use of proxies isn't allowed.
+    // if (is_proxy()) {
+    // return (FALSE);
+    // }
+    
+// header('Content-type: text/html; charset="utf-8"',true);
+    ?>
 <html>
 <head>
 <title>Brisk - Tavolo <?php echo "$table_idx";?></title>
 <link rel="shortcut icon" href="../img/brisk_ico.png">
 <script type="text/javascript" src="../commons.js"></script> 
 <script type="text/javascript" src="../heartbit.js"></script>
-<script type="text/javascript" src="../http_streaming.js"></script>
+<script type="text/javascript" src="../xynt-streaming.js"></script>
 <script type="text/javascript" src="dnd.js"></script>
 <script type="text/javascript" src="dom-drag.js"></script>
 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
@@ -66,12 +76,11 @@ header('Content-type: text/html; charset="utf-8"',true);
 <body>
 <SCRIPT type="text/javascript">
    var sess = "not_connected";
-   var hstm = null;
+   var xstm = null;
    var g_lang = "<?php echo "$G_lang"; ?>";
    var stat = "table";
    var subst = "none";
    var table_pos = "";
-   var myfrom = "table_php";
    var g_withflash = false;
 
    var asta_ptr;
@@ -79,13 +88,13 @@ header('Content-type: text/html; charset="utf-8"',true);
 
    var gst  = new globst();
    gst.st = <?php 
-log_load("bin5/index.php");
+       log_load("bin5/index.php");
 
-if (isset($laststate) == false) {
-  $laststate = -1;
-}
-echo $laststate;
-?>;
+   if (isset($laststate) == false) {
+       $laststate = -1;
+   }
+   echo $laststate;
+   ?>;
 var g_is_spawn=1;
 // var g_table_idx=<?php echo "$table_idx";?>;
 
@@ -101,14 +110,16 @@ window.onload = function() {
   preferences_update();
 
   sess = "<?php echo "$sess"; ?>";
-  hstm = new http_streaming("sess");
-  hstm.hbit_set(heartbit);
+  xstm = new xynt_streaming(window, 'iframe', null /* console */, gst, 'table_php', 'sess', sess, $('sandbox'), 'index_rd_ifra.php', function(com){eval(com);});
+  xstm.hbit_set(heartbit);
   
   window.onbeforeunload = onbeforeunload_cb;  
   window.onunload = onunload_cb;  
 
-  hstm.start(sess); 
-  setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
+  xstm.start();
+  // FIXME: add this setTimeout(preload_images into data stream to avoid
+  // race on opened socket
+  // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct);
 }
 </SCRIPT>
 <div id="bg" class="area">
@@ -298,3 +309,6 @@ window.onload = function() {
 
 </body>
 </html>
+<?php
+}
+?>