maincheck signature changed, instead of logical arguments we pass directly get, post...
[brisk.git] / web / briskin5 / Obj / briskin5.phh
index 7988b8a..9e29e01 100644 (file)
@@ -37,8 +37,13 @@ define('BIN5_RULES_ALLPASS',    2);
 
 $mlang_bin5_bin5 = array(
                          // br, hr, b, /b, win, fri
-                         'info_part' => array( 'it' => 'Nell\'ultima mano ha chiamato %3$s%5$s%4$s, il socio era %3$s%6$s%4$s,%1$s',
-                                               'en' => 'In the last hand the declarer was %3$s%5$s%4$s, the partner was %3$s%6$s%4$s,%1$s'),
+                         'info_last' => array( 'it' => '%3$sultima mano%4$s',
+                                               'en' => '%3$slast hand%4$s'),
+                         'info_curr' => array( 'it' => '%3$smano corrente%4$s',
+                                               'en' => '%3$scurrent hand%4$s'),
+                         // br, hr, b, /b, win, fri
+                         'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s, il socio era %3$s%6$s%4$s,%1$s',
+                                               'en' => 'The declarer was %3$s%5$s%4$s, the partner was %3$s%6$s%4$s,%1$s'),
                          // br, hr, b, /b
                          'info_capp' => array( 'it' => 'hanno fatto %3$scappotto%4$s EBBRAVI!.%1$s',
                                                'en' => 'and they made %3Dscapot%4$s WELL DONE!.%1$s'),
@@ -57,8 +62,8 @@ $mlang_bin5_bin5 = array(
                                                'en' => 'lost'),
 
                          // br, hr, b, /b, win_name
-                         'info_alon' => array( 'it' => 'Nell\'ultima partita %3$s%5$s%4$s si è chiamato in mano,%1$s',
-                                               'en' => 'In the last hand %3$s%5$s%4$s play alone against each other,%1$s'),
+                         'info_alon' => array( 'it' => '%3$s%5$s%4$s si è chiamato in mano,%1$s',
+                                               'en' => '%3$s%5$s%4$s play alone against each other,%1$s'),
                          // br, hr, b, /b, old_asta_pnt, old_pnt, winornot
                          'info_aleaa' => array( 'it' => 'doveva fare %3$salmeno %5$d%4$s punti e ne ha fatti %3$s%6$d%4$s: ha %3$s%7$s%4$s.%1$s',
                                                'en' => 'he/she had to do %3$sat least %5$d%4$s points and they had made %3$s%6$d%4$s: he/she had %3$s%7$s%4$s.%1$s'),
@@ -628,8 +633,12 @@ class Bin5_table extends Table {
 
         $this->old_friend = $this->friend;
         $this->old_reason = game_description($action, 'html', $this->old_mult,
-                                             $this->old_asta_win, $bri->user[$this->player[$this->old_asta_win]]->name,
-                                             $this->old_friend, $bri->user[$this->player[$this->old_friend]]->name,
+                                             $this->old_asta_win,
+                                             ($this->old_asta_win != -1 ?
+                                              $bri->user[$this->player[$this->old_asta_win]]->name : ""),
+                                             $this->old_friend,
+                                             ($this->old_friend != -1 ?
+                                              $bri->user[$this->player[$this->old_friend]]->name : ""),
                                              $this->old_pnt, $this->old_asta_pnt);
 
 
@@ -1001,13 +1010,11 @@ class Bin5_user extends User {
         return (sprintf('xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
     }
 
-    protected function maincheck($cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $splashdate, $table_idx, $table_token)
+    protected function maincheck($cur_stat, $cur_subst, $cur_step, $get, $post, $cookie)
     {
         GLOBAL $G_lang, $mlang_indrd;
         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;
-        $$CO_splashdate = $splashdate;
 
         GLOBAL $S_load_stat;
 
@@ -1061,9 +1068,9 @@ class Bin5_user extends User {
           }
           log_rd2("NEWSTAT: ".$this->stat);
 
-          $new_stat =  $this->stat;
-          $new_subst = $this->subst;
-          $new_step =  $this->step;
+          $this->rd_stat  = $this->stat;
+          $this->rd_subst = $this->subst;
+          $this->rd_step  = $this->step;
       } /* if ($cur_step == -1) { */
       else {
           /* $sem = Room::lock_data(FALSE); */
@@ -1081,7 +1088,7 @@ class Bin5_user extends User {
                       }
                       log_rd2("lost history, refresh from scratch");
                       printf("xXx LOST HISTORY!\n");
-                      $new_step = -1;
+                      $this->rd_step = -1;
                       break;
                   }
                   for ($i = $cur_step ; $i < $this->step ; $i++) {
@@ -1095,9 +1102,9 @@ class Bin5_user extends User {
                       log_rd2("ADDED TO THE STREAM: ".$this->comm[$ii]);
                       $ret .= $this->comm[$ii];
                   }
-                  $new_stat =  $this->stat;
-                  $new_subst = $this->subst;
-                  $new_step =  $this->step;
+                  $this->rd_stat  = $this->stat;
+                  $this->rd_subst = $this->subst;
+                  $this->rd_step  = $this->step;
               } while (0);
 
               log_rd2($this->step, 'index_rd.php: after ret set');
@@ -1495,7 +1502,7 @@ class Bin5 {
             return TRUE;
 
             break;
-        case "index_rd_ifra.php":
+        case "index_rd.php":
             if (($transp  = gpcs_var('transp', $get, $post, $cookie)) === FALSE)
                 $transp = "iframe";
             if ($transp == 'websocket')
@@ -1824,6 +1831,11 @@ function show_table_info(&$bri, &$table, $table_pos)
 {
     GLOBAL $G_lang, $mlang_bin5_bin5;
 
+    $tg_br = "<br>";
+    $tg_hr = "<hr>";
+    $tg_bo = "<b>";
+    $tg_bc = "</b>";
+
     $ret = "";
     $user = $bri->user[$table->player[$table_pos]];
 
@@ -1852,9 +1864,15 @@ function show_table_info(&$bri, &$table, $table_pos)
     $noty .= "</tr></table>";
     $noty .= "<hr>";
     if ($table->old_reason != "") {
+        $noty .= sprintf($mlang_bin5_bin5['info_last'][$G_lang],
+                         $tg_br, $tg_hr, $tg_bo, $tg_bc);
+        $noty .= '<br>';
         $noty .= $table->old_reason;
     }
 
+    $noty .= sprintf($mlang_bin5_bin5['info_curr'][$G_lang],
+                     $tg_br, $tg_hr, $tg_bo, $tg_bc);
+    $noty .= '<br>';
     /* MLANG: "Fai <b>tu</b> il mazzo,", "Il mazzo a <b>$unam</b>," */
     if ($table->mazzo == $table_pos)
         $noty .= $mlang_bin5_bin5['info_yshuf'][$G_lang];
@@ -1886,10 +1904,10 @@ function show_table_info(&$bri, &$table, $table_pos)
     if ($multer > 1) {
         $noty .= sprintf($mlang_bin5_bin5['info_mult'][$G_lang], multoval($multer) );
     }
-    $noty .= "<hr><br>";
+    $noty .= "<hr>";
     if ($table->match_id != -1) {
         $noty .= sprintf($mlang_bin5_bin5['info_match'][$G_lang], $table->match_id);
-        $noty .= "<hr><br>";
+        $noty .= "<hr>";
     }
     $ret .= show_notify($noty, 3000, $mlang_bin5_bin5['btn_bkgame'][$G_lang], 500, 400);
     /* NOTE: show_notify($noty, 3000, "torna alla partita", 500,
@@ -2079,7 +2097,7 @@ function game_description($act, $form, $old_mult, $win = -1, $win_name = "?1?",
                          $tg_br, $tg_hr, $tg_bo, $tg_bc,
                          multoval($old_multer));
     }
-    $noty .= sprintf('%2$s%1$s', $tg_br, $tg_hr);
+    $noty .= sprintf('%2$s', $tg_br, $tg_hr);
 
     return ($noty);
 }