sdoppiata BRISK_DEBUG in BRISK_DEBUG e BRISK_SHOWHTML
[brisk.git] / web / index.php
index 50f7f9f..29efec1 100644 (file)
@@ -31,12 +31,12 @@ log_load($sess, "LOAD: index.php");
 
 function main()
 {
-  GLOBAL $sess, $name, $BRISK_DEBUG;
+  GLOBAL $sess, $name, $BRISK_SHOWHTML;
   
   $body = "";
   $ACTION = "login";
   
-  if (isset($BRISK_DEBUG) == FALSE) {
+  if (isset($BRISK_SHOWHTML) == FALSE) {
     $is_table = false;
     $sem = lock_data();
     $bri = &load_data();
@@ -57,8 +57,6 @@ function main()
     if ($ACTION == "login" && isset($name)) {
       $bri->garbage_manager(TRUE);
       /* try login */
-      $name = substr($name, 0, 12);
-      $name = str_replace(" ", "_", $name);
       if (($user = &$bri->add_user(&$sess, &$idx, $name)) != FALSE) {
        $ACTION = "room";
        
@@ -72,7 +70,9 @@ function main()
       }
       else {
        /* Login Rendering */
-       if ($idx == -1) 
+       if ($idx == -2)
+         $body .= '<div class="urgmsg"><b>Il nickname deve contenere almeno una lettera o una cifra.</b></div>';
+       else if ($idx == -1) 
          $body .= '<div class="urgmsg"><b>Spiacenti, non ci sono pi&ugrave; posti liberi. Riprova pi&ugrave; tardi.</b></div>';
        else
          $body .= '<div class="urgmsg"><b>Il tuo nickname &egrave; gi&agrave; in uso.</b></div>';
@@ -82,10 +82,10 @@ function main()
   }
   /* Rendering. */
 
-  if ($BRISK_DEBUG == "debugtable") {
+  if ($BRISK_SHOWHTML == "debugtable") {
     $ACTION = "room";
   }
-  else if ($BRISK_DEBUG == "debuglogin") {
+  else if ($BRISK_SHOWHTML == "debuglogin") {
     $ACTION = "login";
   }
 
@@ -126,6 +126,10 @@ function main()
                             $altout_propag[$randval]['content']);
                         
 
+  $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt");
+  if ($brisk_donate == FALSE)
+    $brisk_donate = "";
+
 $brisk_header_form = '<div class="container">
 <!-- =========== header ===========  -->
 <div id="header" class="header">
@@ -140,7 +144,10 @@ briscola chiamata in salsa ajax<br><br>
 sponsored by:<br><br>'.$altout_carousel.'<br>
 <a target="_blank" href="http://www.dynamica.it"><img class="nobo" src="img/dynamica.png"></a><br><br>
 supported by:<br><br>
-<a target="_blank" href="http://www.briscolachiamata.it"><img class="nobo" src="img/brichi.png"></a><br><br><br>
+<a target="_blank" href="http://www.briscolachiamata.it"><img class="nobo" src="img/brichi.png"></a><br><br>
+<div id="proflashext" class="proflashext"><div id="proflash" class="proflash">
+</div><br><br></div>
+%s
 %s
 </div>';
     
@@ -156,17 +163,26 @@ supported by:<br><br>
 <script type="text/javascript" src="commons.js"></script> 
 <script type="text/javascript" src="xhr.js"></script>
 <script type="text/javascript" src="preload_img.js"></script>
+<script type="text/javascript" src="AC_OETags.js"></script>
 <link rel="stylesheet" type="text/css" href="brisk.css">
 <link rel="stylesheet" type="text/css" href="room.css">
 </head>
 <body>
 <SCRIPT type="text/javascript">
+   var g_withflash = false;
+
    window.onload = function() {
+     g_withflash = DetectFlashVer(6,0,0);
+     if (g_withflash == false) {
+       $("proflash").innerHTML = 'Audio con Flash.<br><a href="http://www.macromedia.com/"><img class="nobo" style="padding: 4px; width:73; height: 19;" src="img/download_now_flash.gif"></a>';
+     }
+     else
+       $("proflashext").innerHTML = "";
      $("nameid").focus();
    }
 </SCRIPT>
 <?php
-    printf($brisk_header_form, '');
+    printf($brisk_header_form, '', '');
 ?> 
 
 <!--  =========== tables ===========  -->
@@ -210,6 +226,7 @@ Digita il tuo nickname per accedere ai tavoli della briscola.<br><br>
 <script type="text/javascript" src="commons.js"></script> 
 <script type="text/javascript" src="xhr.js"></script>
 <script type="text/javascript" src="preload_img.js"></script>
+<script type="text/javascript" src="AC_OETags.js"></script>
 <link rel="stylesheet" type="text/css" href="brisk.css">
 <link rel="stylesheet" type="text/css" href="room.css">
 </head>
@@ -220,12 +237,13 @@ Digita il tuo nickname per accedere ai tavoli della briscola.<br><br>
    var subst = "";
    var gst  = new globst();
 
+   var g_withflash = false;
    var g_imgct= 0;
    var g_imgtot = g_preload_img_arr.length;
    var myfrom = "index_php";
    window.onload = function() {
 <?php
-if ($BRISK_DEBUG == "debugtable") {
+if ($BRISK_SHOWHTML == "debugtable") {
 ?>
      room_checkspace(12,8,50);
 <?php
@@ -237,7 +255,12 @@ else {
      sess = "<?php echo "$sess"; ?>";
 
      window.onunload = onunload_cb;
-
+     g_withflash = DetectFlashVer(6,0,0);
+     if (g_withflash == false) {
+       $("proflash").innerHTML = 'Audio con Flash.<br><a href="http://www.macromedia.com/"><img class="nobo" style="padding: 4px; width:73; height: 19;" src="img/download_now_flash.gif"></a>';
+     }
+     else
+       $("proflashext").innerHTML = "";
      setTimeout(xhr_rd_poll, 0, sess); 
      // alert("ARR LENGTH "+g_preload_img_arr.length);
      setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
@@ -249,7 +272,8 @@ else {
 
 </SCRIPT>
 <?php
-    printf($brisk_header_form, '<input type="button" class="button" name="xhelp"  value="Help." onclick="act_help();"><br><br><input type="button" class="button" name="xabout"  value="About." onclick="act_about();">');
+    printf($brisk_header_form, '<input type="button" class="button" name="xhelp"  value="Help." onclick="act_help();"><br><br><input type="button" class="button" name="xabout"  value="About." onclick="act_about();"><br><br><br>',
+          $brisk_donate);
 ?> 
 <!--  =========== tables ===========  -->
 <div id="tables" class="tables">