add 'help' and 'about' messages
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Tue, 17 Jul 2012 05:15:33 +0000 (07:15 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Tue, 17 Jul 2012 05:15:33 +0000 (07:15 +0200)
web/Obj/brisk.phh
web/index_wr.php
web/spush/brisk-spush.php

index 58f1e85..231788e 100644 (file)
@@ -275,7 +275,7 @@ $G_room_about = array( 'it' => '<br>
   briscola chiamata in salsa ajax
 </div>
 <br><b>version '.$G_brisk_version.'</b><br><br>
-Copyright 2006-2009 <a href=\\"mailto:brisk@alternativeoutput.it\\">Matteo Nastasi</a> (aka mop)<br><br>',
+Copyright 2006-2012 <a href=\\"mailto:brisk@alternativeoutput.it\\">Matteo Nastasi</a> (aka mop)<br><br>',
                       'en' => '<br>
 <div id=\\"header\\" class=\\"header\\">
   <img class=\\"nobo\\" src=\\"img/brisk_logo64.png\\">
index 22f2587..8b23bd9 100644 (file)
@@ -22,8 +22,8 @@
  *
  */
 
-require_once("Obj/brisk.phh");
-require_once("Obj/auth.phh");
+// require_once("Obj/brisk.phh");
+// require_once("Obj/auth.phh");
 // require_once("Obj/proxyscan.phh");
 
 // Use of proxies isn't allowed.
@@ -81,13 +81,16 @@ $mlang_indwr = array( 'btn_backtotab' => array( 'it' => 'Torna ai tavoli.',
 
 function index_wr_main(&$room, $remote_addr, $get, $post, $cookie)
 {
-    GLOBAL $G_black_list;
+    GLOBAL $G_black_list, $G_lang, $G_room_help, $G_room_about, $mlang_indwr;
 
     log_load("index_wr.php");
 
     if (($mesg = gpcs_var('mesg', $get, $post, $cookie)) === FALSE) 
         unset($mesg);
 
+    if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
+        $sess = "";
+
     
     if (DEBUGGING == "local" && $remote_addr != '127.0.0.1') {
         echo "Debugging time!";
@@ -154,16 +157,16 @@ function index_wr_main(&$room, $remote_addr, $get, $post, $cookie)
                 return FALSE;
             }
         }
-  /* else if ($argz[0] == 'auth') { */
-  /*   printf("challenge|ok"); */
-  /* } */
-  /* else if ($argz[0] == 'help') { */
-  /*   /\* MLANG: "torna ai tavoli" *\/  */
-  /*   echo show_notify(str_replace("\n", " ", $G_room_help[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lang], 600, 500); */
-  /* } */
-  /* else if ($argz[0] == 'about') { */
-  /*   echo show_notify(str_replace("\n", " ", $G_room_about[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lang], 400, 220); */
-  /* } */
+        else if ($argz[0] == 'auth') {
+            printf("challenge|ok");
+        }
+        else if ($argz[0] == 'help') {
+            /* MLANG: "torna ai tavoli" */
+            echo show_notify(str_replace("\n", " ", $G_room_help[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lang], 600, 500);
+        }
+        else if ($argz[0] == 'about') {
+            echo show_notify(str_replace("\n", " ", $G_room_about[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lang], 400, 220);
+        }
   /* else if ($argz[0] == 'passwdhowto') { */
   /*   echo show_notify(str_replace("\n", " ", $G_room_passwdhowto[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lang], 400, 200); */
   /* } */
index f5c944e..3750ba9 100755 (executable)
@@ -22,6 +22,7 @@
  * Suite 330, Boston, MA 02111-1307, USA.
  *
  * TODO
+ *   problema con getpeer (HOSTADDR)
  *   setcookie (for tables only)
  *   keepalive
  *   chunked 
@@ -267,17 +268,22 @@ function main()
                             $header_out = array();
                             ob_start();
                             index_main($room, $header_out, $get, $post, $cookie);
-                            $content = ob_get_flush();
-
+                            $content = ob_get_contents();
+                            ob_end_clean();
                             // printf("OUT: [%s]\n", $G_content);
                             fwrite($new_socket, headers_render($header_out).$content);
                             fclose($new_socket);
                             break;
                         case SITE_PREFIX."index_wr.php":
                             $G_headers = "";
+                            $addr = "";
+                            $ret = socket_getpeername($new_socket, $addr);
+                            // printf("RET: %d\n", $ret);
+                            // exit(123);
                             ob_start();
-                            index_wr_main($room, socket_getpeername($$new_socket), $get, $post, $cookie);
-                            $content = ob_get_flush();
+                            index_wr_main($room, $addr, $get, $post, $cookie);
+                            $content = ob_get_contents();
+                            ob_end_clean();
                             
                             // printf("OUT: [%s]\n", $G_content);
                             fwrite($new_socket, headers_render($header_out).$content);
@@ -413,7 +419,7 @@ function main()
                 $header_out = array();
                 $body = "";
                 index_rd_ifra_main($room, $room->user[$s2u[intval($sock)]], $body);
-                echo "SPIA: [$body]\n";
+                echo "SPIA: [".substr($body, 0, 60)."...]\n";
                 fwrite($sock, headers_render($header_out).$body);
                 fflush($sock);
             }