g_deck test [2]
[brisk.git] / web / briskin5 / index.php
1 <?php
2 /*
3  *  brisk - briskin5/index.php
4  *
5  *  Copyright (C) 2006-2012 Matteo Nastasi
6  *                          mailto: nastasi@alternativeoutput.it
7  *                                  matteo.nastasi@milug.org
8  *                          web: http://www.alternativeoutput.it
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details. You should have received a
19  * copy of the GNU General Public License along with this program; if
20  * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21  * Suite 330, Boston, MA 02111-1307, USA.
22  *
23  */
24
25 /* MLANG: le img dell'asta */
26
27 $G_base = "../";
28
29 require_once("../Obj/brisk.phh");
30 require_once("Obj/briskin5.phh");
31
32 $mlang_bin5_index = array( 'aucwin' => array( 'it' => 'Hai vinto l\'asta.<br> Scegli il seme:',
33                                               'en' => 'You win the auction.<br> Choose the seed:' ),
34                            'tit_info'    => array( 'it' => 'Info',
35                                                    'en' => 'Info'),
36                            'tit_relo'    => array( 'it' => 'Reload',
37                                                    'en' => 'Reload'),
38                            'tit_out'     => array( 'it' => 'Fuori',
39                                                    'en' => 'Out'),
40                            'tit_pref'    => array( 'it' => 'Prefs',
41                                                    'en' => 'Prefs'),
42                            'itm_ringauc' => array('it' => 'riproduci un suono di notifica alla fine dell\' asta',
43                                                   'en' => 'play a sound at the end of the auction'),
44                            'btn_update'  => array('it' => 'Aggiorna.',
45                                                   'en' => 'Update.' )
46                            );
47
48
49 function bin5_index_main($transp_type, $header, &$header_out, $addr, $get, $post, $cookie)
50 {
51     GLOBAL $G_lang, $mlang_bin5_index;
52
53     $transp_port = ((array_key_exists("X-Forwarded-Proto", $header) &&
54                      $header["X-Forwarded-Proto"] == "https") ? 443 : 80);
55
56     if (($table_idx = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
57         unset ($table_idx);
58     if (($laststate = gpcs_var('laststate', $get, $post, $cookie)) === FALSE)
59         unset ($laststate);
60     if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
61         unset ($sess);
62
63     fprintf(STDERR, "PREF_DECK SET %s", (isset($cookie['CO_bin5_pref_deck']) ? "YES" : "NO"));
64
65     $deck = (isset($cookie['CO_bin5_pref_deck']) ? $cookie['CO_bin5_pref_deck'] : 'xx');
66
67 // header('Content-type: text/html; charset="utf-8"',true);
68     ?>
69 <html>
70 <head>
71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
72 <title>Brisk - Tavolo <?php echo "$table_idx";?></title>
73 <link rel="shortcut icon" href="../img/brisk_ico.png">
74 <link rel="stylesheet" type="text/css" href="../brisk.css?v=<? echo BSK_BUSTING; ?>">
75 <link rel="stylesheet" type="text/css" href="briskin5.css?v=<? echo BSK_BUSTING; ?>">
76 <link rel="stylesheet" type="text/css" href="cards_<? echo $deck; ?>.css?v=<? echo BSK_BUSTING; ?>">
77 <script type="text/javascript">
78    var g_deck = "<?php echo "$deck"; ?>";
79 </script>
80 <script src="//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
81 <script type="text/javascript" src="../commons.js?v=<? echo BSK_BUSTING; ?>"></script>
82 <script type="text/javascript" src="../heartbit.js?v=<? echo BSK_BUSTING; ?>"></script>
83 <script type="text/javascript" src="../xynt-streaming.js?v=<? echo BSK_BUSTING; ?>"></script>
84 <script type="text/javascript" src="dnd.js?v=<? echo BSK_BUSTING; ?>"></script>
85 <script type="text/javascript" src="dom-drag.js?v=<? echo BSK_BUSTING; ?>"></script>
86 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js?v=<? echo BSK_BUSTING; ?>"></script>
87 <script type="text/javascript" src="briskin5.js?v=<? echo BSK_BUSTING; ?>"></script>
88 <script type="text/javascript">
89    var $$ = jQuery.noConflict();
90
91    var myname = null;
92    var sess = "not_connected";
93    var xstm = null;
94    var g_lang = "<?php echo "$G_lang"; ?>";
95    var stat = "table";
96    var subst = "none";
97    var table_pos = "";
98    var g_jukebox = null;
99
100    var asta_ptr;
101    var area_ptr;
102
103    var gst  = new globst();
104    gst.st = <?php
105    log_load("bin5/index.php");
106
107    if (isset($laststate) == false) {
108        $laststate = -1;
109    }
110    echo $laststate;
111    ?>;
112 var g_is_spawn=1;
113 // var g_table_idx=<?php echo "$table_idx";?>;
114
115 var g_imgct= 0;
116 var g_imgtot = g_preload_img_arr.length;
117 var g_exitlock = 0;
118
119
120 window.onload = function() {
121   g_jukebox = new jukebox([{'name': 'cow', 'file': 'cow.mp3'},
122                            {'name': 'rooster', 'file': 'rooster.mp3'},
123                            {'name': 'ringbell', 'file': 'ringbell.mp3'}]);
124   remark_off();
125
126   preferences_init();
127   preferences_update();
128
129   sess = "<?php echo "$sess"; ?>";
130   xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 2, null /* console */, gst, 'table_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
131   xstm.hbit_set(heartbit);
132
133   /* dynamic callerimg positioning */
134   $("callerimg").style.left = (162 - cards_width_d2) + "px";
135   $("callerimg").style.top = (63 - cards_height_d2) + "px";
136
137   window.onbeforeunload = onbeforeunload_cb;
138   window.onunload = onunload_cb;
139
140   xstm.start();
141
142   addEvent($('select_rules'), "change", function() { act_select_rules(this.value); } );
143   addEvent($('select_deck'), "change", function() { act_select_deck(this.value); } );
144   // FIXME: add this setTimeout(preload_images into data stream to avoid
145   // race on opened socket
146   // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct);
147 }
148 </script>
149 </head>
150 <body>
151 <div id="bg" class="area">
152
153 <div id="remark" class="remark0"></div>
154 <img id="card0" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
155 <img id="card1" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
156 <img id="card2" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
157 <img id="card3" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
158 <img id="card4" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
159 <img id="card5" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
160 <img id="card6" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
161 <img id="card7" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
162 <img id="takes" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
163 <img id="card_ne0" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
164 <img id="card_ne1" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
165 <img id="card_ne2" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
166 <img id="card_ne3" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
167 <img id="card_ne4" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
168 <img id="card_ne5" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
169 <img id="card_ne6" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
170 <img id="card_ne7" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
171 <img id="takes_ne" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
172 <img id="card_nw0" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
173 <img id="card_nw1" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
174 <img id="card_nw2" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
175 <img id="card_nw3" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
176 <img id="card_nw4" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
177 <img id="card_nw5" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
178 <img id="card_nw6" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
179 <img id="card_nw7" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
180 <img id="takes_nw" data-card-id="cover" src="img/cards_xx_empty.png" class="sp-card"/>
181 <img id="card_ea0" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
182 <img id="card_ea1" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
183 <img id="card_ea2" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
184 <img id="card_ea3" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
185 <img id="card_ea4" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
186 <img id="card_ea5" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
187 <img id="card_ea6" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
188 <img id="card_ea7" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
189 <img id="takes_ea" data-card-id="cover_ea" src="img/cards_xx_empty_ea.png" class="sp-card"/>
190 <img id="card_we0" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
191 <img id="card_we1" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
192 <img id="card_we2" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
193 <img id="card_we3" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
194 <img id="card_we4" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
195 <img id="card_we5" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
196 <img id="card_we6" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
197 <img id="card_we7" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
198 <img id="takes_we" data-card-id="cover_we" src="img/cards_xx_empty_we.png" class="sp-card"/>
199
200 <div id="asta" class="asta">
201   <img id="asta0" src="img/asta0.png" class="astacard">
202   <img id="asta1" src="img/asta1.png" class="astacard">
203   <img id="asta2" src="img/asta2.png" class="astacard">
204   <img id="asta3" src="img/asta3.png" class="astacard">
205   <img id="asta4" src="img/asta4.png" class="astacard">
206   <img id="asta5" src="img/asta5.png" class="astacard">
207   <img id="asta6" src="img/asta6.png" class="astacard">
208   <img id="asta7" src="img/asta7.png" class="astacard">
209   <img id="asta8" src="img/asta8.png" class="astacard">
210   <img id="asta9" src="img/asta9.png" class="astacard">
211   <div id="astaptdiv" class="punti">
212     <input class="puntifield" id="astapt" name="astapt" type="text" maxsize="3" size="3" value="61">
213   </div>
214   <img  id="astaptsub" src="img/astaptsub_ro.png" class="astacard">
215   <img  id="astapasso" src="img/astapasso_ro.png" class="astacard">
216   <img  id="astalascio" src="img/astalascio_ro.png" class="astacard">
217 </div>
218 <div id="name" class="pubinfo"></div>
219 <div id="public" class="public">
220    <div class="vert_midfloat">
221        <div id="pubasta" class="vert_innfloat_so">
222            <img id="pubacard" src="img/astapasso_ro.png" class="pubacard">
223            <div id="pubapnt"></div>
224        </div>
225    </div>
226 </div>
227 <div id="name_ea" class="pubinfo_ea"></div>
228 <div id="public_ea" class="public_ea">
229    <div class="vert_midfloat">
230       <div id="pubasta_ea" class="vert_innfloat">
231          <img id="pubacard_ea" src="img/astapasso_ro.png" class="pubacard_ea">
232          <div id="pubapnt_ea"></div>
233       </div>
234    </div>
235 </div>
236 <div id="name_ne" class="pubinfo_ne"></div>
237 <div id="public_ne" class="public_ne">
238    <div class="vert_midfloat">
239       <div id="pubasta_ne" class="vert_innfloat">
240          <img id="pubacard_ne" src="img/astapasso_ro.png" class="pubacard_ne">
241          <div id="pubapnt_ne"></div>
242       </div>
243    </div>
244 </div>
245 <div id="name_nw" class="pubinfo_nw"></div>
246 <div id="public_nw" class="public_nw">
247    <div class="vert_midfloat">
248       <div id="pubasta_nw" class="vert_innfloat">
249          <img id="pubacard_nw" src="img/astapasso_ro.png" class="pubacard_nw">
250          <div id="pubapnt_nw"></div>
251       </div>
252    </div>
253 </div>
254 <div id="name_we" class="pubinfo_we"></div>
255 <div id="public_we" class="public_we">
256    <div class="vert_midfloat">
257       <div id="pubasta_we" class="vert_innfloat">
258          <img id="pubacard_we" src="img/astapasso_ro.png" class="pubacard_we">
259          <div id="pubapnt_we"></div>
260       </div>
261    </div>
262 </div>
263 <div id="chooseed" class="chooseed">
264                            <?php echo $mlang_bin5_index['aucwin'][$G_lang]; ?>
265 <img id="seed0" src="img/00.png" class="seed0">
266 <img id="seed1" src="img/10.png" class="seed1">
267 <img id="seed2" src="img/20.png" class="seed2">
268 <img id="seed3" src="img/30.png" class="seed3">
269 </div>
270 <div id="caller" class="caller">
271 <div id="callerinfo" class="callerinfo">Info</div>
272 <img id="callerimg" data-card-id="cover" src="img/cards_xx_empty.png">
273 </div>
274 <div class="table_commands">
275 <table>
276 <tr>
277 <td style="text-align: center;"><input type="button" class="button" name="xinfo"  value="<?php echo $mlang_bin5_index['tit_info'][$G_lang]; ?>" onclick="act_tableinfo();"></td>
278 <td style="text-align: center;"><input type="button" class="button" name="xreload"  value="<?php echo $mlang_bin5_index['tit_relo'][$G_lang]; ?>" onclick="act_reload();"></td>
279 <td style="text-align: center;"><input type="button" class="button" name="xout"  value="<?php echo $mlang_bin5_index['tit_out'][$G_lang]; ?>" onclick="safelogout();"></td>
280 </tr><tr>
281 <td style="text-align: center;"><img id="stm_stat" class="nobo" src="img/line-status_b.png"></td>
282 <td style="text-align: center;"><input type="button" class="button" name="xpref"  value="<?php echo $mlang_bin5_index['tit_pref'][$G_lang]; ?>" onclick="preferences_showhide();"></td>
283 </td>
284 <td style="text-align: center;"><img id="exitlock" class="button" style="visibility: hidden; border: 0px; display: inline; position: relative;" onclick="act_exitlock();"></td>
285 </tr>
286 </table>
287 </div>
288 <!--
289 <div class="table_commands">
290 <input type="button" class="button" name="xinfo"  value="Info." onclick="act_tableinfo();">
291 <input type="button" class="button" name="xreload"  value="Reload." onclick="act_reload();">
292 <div style="vertical-align: top;">
293 <img id="exitlock" class="button" style="visibility: hidden; border: 0px; display: inline; position: relative;" onclick="act_exitlock();"><input type="button" class="button" name="xout"  value="Out." onclick="safelogout();">
294 </div>
295 </div>
296 -->
297
298 </div>
299
300
301 <div class="subarea">
302 <div id="txt" class="chattshort"></div>
303     <table class="chattshort_table"><tr><td style="width:1%; text-align: right;">
304     <div id="myname"></div>
305     </td><td>
306     <input id="txt_in" maxlength="128" type="text" style="width: 100%;" onkeypress="chatt_checksend(this,event);">
307     </td></tr></table>
308
309 <div id="flasou" style="text-align: left;"></div>
310 <hr>
311 <div id="heartbit" style="text-align: left;"></div>
312 <hr>
313 <div id="imgct" style="text-align: left;">HERE</div>
314 <hr>
315 <div id="sandbox" style="text-align: left;"></div>
316 <div id="sandbox2" style="text-align: left;"></div>
317 <div id="sandbox3" style="text-align: left;"></div>
318 <pre>
319 <div id="xhrlog" style="text-align: left;"></div>
320 </pre>
321 <div id="xhrdeltalog" style="text-align: left;"></div>
322 </div>
323
324 <div id="preferences" class="notify" style="z-index: 200; width: 400px; margin-left: -200px; height: 200px; top: 126px; visibility: hidden;">
325 <div id="preferences_child" style="border-bottom: 1px solid gray; overflow: auto; height: 170px; text-align: center">
326
327 <h2><?php echo $mlang_bin5_index['tit_pref'][$G_lang]; ?></h2>
328 <div style="width: 95%; /* background-color: red; */ margin: auto; text-align: left;">
329     <div>
330         <input type="checkbox" name="pref_ring_endauct" id="pref_ring_endauct" onclick="pref_ring_endauct_set(this);"><?php echo $mlang_bin5_index['itm_ringauc'][$G_lang] ?>
331     </div>
332     <div>
333         <label>Regole:</label> <?php dom_select_rules();?>
334     </div>
335     <div>
336       <label>Tipo di carte:</label> <?php dom_select_deck($deck);?>
337    </div>
338 </div>
339 <div class="notify_clo"><input type="submit" class="input_sub" style="bottom: 4px;" onclick="act_preferences_update();" value="<?php echo $mlang_bin5_index['btn_update'][$G_lang]; ?>"/></div>
340 </div>
341
342
343 </body>
344 </html>
345 <?php
346 }
347 ?>