0b3076ae0b81782db4fb3a5919ba0867e50ef47d
[brisk.git] / index.php
1 <?php
2 /*
3  *  brisk - 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 require_once("Obj/brisk.phh");
26 require_once("Obj/auth.phh");
27 require_once("Obj/proxyscan.phh");
28
29 $mlang_room = array( 'userpasserr'  => array('it' => 'Utente e/o password errati.',
30                                              'en' => 'Wrong user and/or password.'),
31                      'userpassmust' => array('it' => 'Il nickname deve contenere almeno una lettera o una cifra.',
32                                              'en' => 'The nickname have to contain at least one letter or one number.'),
33                      'userpassend'  => array('it' => 'Spiacenti, non ci sono pi&ugrave; posti liberi. Riprova pi&ugrave; tardi.',
34                                              'en' => 'We are sorry, there aren\'t free place. Try again later.'),
35                      'userpassuse'  => array('it' => 'Il tuo nickname &egrave; gi&agrave; in uso.',
36                                              'en' => 'Your nickname is already in use.'),
37                      'standing'     => array('it' => 'Giocatori in piedi',
38                                              'en' => 'Standing players'),
39                      'headline'     => array('it' => 'briscola chiamata in salsa ajax',
40                                              'en' => 'declaration briscola in ajax sauce <b>(Beta)</b>'),
41                      'welcome'      => array('it' => 'Digita il tuo nickname per accedere ai tavoli della briscola',
42                                              'en' => 'Enter your nickname to access to the tables of briscola'),
43                      'btn_enter'    => array('it' => 'entra',
44                                              'en' => 'enter'),
45                      'passwarn'     => array('it' => 'Se non hai ancora una password, lascia il campo in bianco ed entra.',
46                                              'en' => 'If you don\'t have a password, leave blank the field and enter.'),
47                      'browwarn'     => array('it' => 'Se qualcosa non funziona prova a ricaricare la pagina con <b>Ctrl + F5</b><br><br>Se non riesci piĆ¹ ad entrare nel nuovo Brisk e prima ci riuscivi potrebbe essere un problema di antivirus,<br>guarda la <a class=\'flat\' style=\'background-color: white; font-weight: bold;\' target=\'_blank\' href=\'http://www.alternativeoutput.it/blog/doku.php?id=brisk:guida_agli_antivirus\'>pagina sugli antivirus</a> per maggiori informazioni su come configurarlo.<br><br>Se ancora non funziona nulla contatta <a class=\'flat\' style=\'background-color: white; font-weight: bold;\' href=\'mailto:brisk@alternativeoutput.it\'>l\'amministratore del sito</a>.',
48                                              'en' => '(if something don\'t work<br>try to reload the current page with <b>Ctrl + F5</b>)'),
49                      'regwarn'      => array('it' => '<br>Il nickname che stai usando &egrave; gi&agrave; registrato,<br><br>se il suo proprietario si autentificher&agrave;<br><br>verrai rinominato d\'ufficio come ghost<i>N</i>.',
50                                              'en' => '<br>The nickname you are using it\'s already registered, <br><br>if its proprietary authenticates<br><br>you will named ghost<i>N</i>.'),
51                      'btn_rettabs'  => array('it' => 'torna ai tavoli',
52                                              'en' => 'back to tables'),
53                      'btn_exit'     => array('it' => 'Esco.',
54                                              'en' => 'Exit.'),
55                      'btn_prefs_save' => array('it' => 'Salva.',
56                                              'en' => 'Save.'),
57                      'btn_prefs_reset' => array('it' => 'Annulla.',
58                                              'en' => 'Reset.'),
59                      'btn_prefs_close' => array('it' => 'Chiudi.',
60                                              'en' => 'Close.'),
61                      'tit_tabl'     => array('it' => 'Tavolo ',
62                                              'en' => 'Table '),
63                      'tit_stat'     => array('it' => 'imposta lo stato del tuo utente',
64                                              'en' => 'set the status of the user'),
65                      'stat_desc'    => array('it' => 'stato',
66                                              'en' => 'mode' ),
67                      'st_norm_desc' => array('it' => 'normale',
68                                              'en' => 'normal'),
69                      'st_paus_desc' => array('it' => 'pausa',
70                                              'en' => 'pause'),
71                      'st_out_desc'  => array('it' => 'fuori',
72                                              'en' => 'out'),
73                      'st_dog_desc'  => array('it' => 'cane',
74                                              'en' => 'dog'),
75                      'st_food_desc' => array('it' => 'cibo',
76                                              'en' => 'food'),
77                      'st_work_desc' => array('it' => 'lavoro',
78                                              'en' => 'work'),
79                      'st_smok_desc' => array('it' => 'sigaretta',
80                                              'en' => 'smoke'),
81                      'st_pres_desc' => array('it' => 'presente',
82                                              'en' => 'present'),
83                      'st_rabb_desc' => array('it' => 'coniglio',
84                                              'en' => 'rabbit'),
85                      'st_socc_desc' => array('it' => 'calcio',
86                                              'en' => 'soccer'),
87                      'st_baby_desc' => array('it' => 'pupo',
88                                              'en' => 'baby'),
89                      'st_mop_desc'  => array('it' => 'pulizie',
90                                              'en' => 'mop'),
91                      'st_babbo_desc'  => array('it' => 'babbo',
92                                              'en' => 'mop'),
93                      'st_renna_desc'  => array('it' => 'renna',
94                                              'en' => 'mop'),
95                      'st_pupaz_desc'  => array('it' => 'pupazzo',
96                                              'en' => 'mop'),
97                      'st_visch_desc'  => array('it' => 'vischio',
98                                              'en' => 'mop'),
99                      
100                      'tit_ticker'   => array('it' => 'scrivi un invito al tavolo e clicca',
101                                              'en' => 'write an invitation at the table and click'),
102                      'itm_warr'     => array('it' => 'garantisci',
103                                              'en' => 'guarantee'),
104                      'warr_desc'    => array('it' => 'garantisci per un tuo conoscente',
105                                              'en' => 'guarantee for a friend'),
106                      'tit_warr'     => array('it' => 'Garantisci per un tuo conoscente.',
107                                              'en' => 'Guarantee for a friend.'),
108                      'itm_list'     => array('it' => 'ascolta',
109                                              'en' => 'listen'),
110                      'list_desc'    => array('it' => 'imposta le regole di ascolto',
111                                              'en' => 'set the listen rules'),
112                      'tit_listall'  => array('it' => 'tutti',
113                                              'en' => 'everybody'),
114                      'listall_desc' => array('it' => 'leggi tutti i messaggi di tutti gli utenti collegati',
115                                              'en' => 'listen all messages from each user connected'),
116                      'tit_listaut'  => array('it' => 'solo autenticati',
117                                              'en' => 'only authorized'),
118                      'tit_listisol'  => array('it' => 'isolamento',
119                                              'en' => 'isolation'),
120                      'listaut_desc' => array('it' => 'leggi soltanto i messaggi degli utenti con password',
121                                              'en' => 'listen messages only from authenticated users'),
122                      'listisol_desc'=> array('it' => 'visualizza Brisk come se fosse solo per utenti con password',
123                                             'en' => 'show Brisk like an authenticated user only site'),
124                      'suppcomp_tit' =>  array('it' => 'personalizza la tua S',
125                                             'en' => 'customize your S'),
126                      'suppcomp_r' =>  array('it' => 'rosso',
127                                             'en' => 'red'),
128                      'suppcomp_g' =>  array('it' => 'verde',
129                                             'en' => 'green'),
130                      'suppcomp_b' =>  array('it' => 'blu',
131                                             'en' => 'blue'),
132                      'suppcomp_fg' =>  array('it' => 'colore',
133                                             'en' => 'color'),
134                      'suppcomp_bg' =>  array('it' => 'sfondo',
135                                             'en' => 'background'),
136                      'suppcomp_range' =>  array('it' => '(0-255)',
137                                             'en' => '(0-255)'),
138                      'tit_splash'   => array('it' => 'splash',
139                                              'en' => 'splash'),
140                      'splash_desc'  => array('it' => 'attiva la finestra di splash',
141                                              'en' => 'show the splash window'),
142                      'tit_prefs'   => array('it' => 'preferenze',
143                                              'en' => 'preferences'),
144                      'prefs_desc'  => array('it' => 'preferenze dell\' utente',
145                                              'en' => 'user\'s preferences'),
146                      'tit_help'     => array('it' => 'informazioni utili su Brisk',
147                                              'en' => 'usefull information about Brisk'),
148                      'itm_help'     => array('it' => 'aiuto',
149                                              'en' => 'help'),
150                      'tit_hpage'    => array('it' => 'homepage del progetto',
151                                              'en' => 'project homepage (ita)'),
152                      'tit_what'     => array('it' => 'di cosa si tratta',
153                                              'en' => 'what is the project'),
154                      'itm_what'     => array('it' => 'cos\'&egrave;',
155                                              'en' => 'what is it'),
156                      'url_rules'    => array('it' => 'http://it.wikipedia.org/wiki/Briscola#Gioco_a_5',
157                                              'en' => 'http://it.wikipedia.org/wiki/Briscola#Gioco_a_5&EN=true'),
158                      'itm_rules'    => array('it' => 'regole',
159                                              'en' => 'rules'),
160                      'tit_rules'    => array('it' => 'come si gioca',
161                                              'en' => 'how to play'),
162                      'tit_shot'     => array('it' => 'screenshots dell\'applicazione',
163                                              'en' => 'screenshots of the web-application'),
164                      'tit_comp'     => array('it' => 'compatibilit&agrave; con i browser',
165                                              'en' => 'browsers compatibility'),
166                      'itm_comp'     => array('it' => 'compatibilit&agrave;',
167                                              'en' => 'compatibility'),
168                      'tit_src'      => array('it' => 'sorgenti dell\'applicazione web',
169                                              'en' => 'sources of the web-application'),
170                      'itm_src'      => array('it' => 'sorgenti',
171                                              'en' => 'sources'),
172                      'tit_ml'       => array('it' => 'come iscriversi alla mailing list',
173                                              'en' => 'how to subscribe the mailing list'),
174                      'itm_ml'       => array('it' => 'mailing&nbsp;list',
175                                              'en' => 'mailing&nbsp;list'),
176                      'tit_pro'      => array('it' => 'come fare pubblicit&agrave; a Brisk!',
177                                              'en' => 'how to spread Brisk!'),
178                      'itm_pro'      => array('it' => 'propaganda',
179                                              'en' => 'propaganda'),
180                      'tit_mail'     => array('it' => 'contatti',
181                                              'en' => 'contacts'),
182                      'itm_mail'     => array('it' => 'contatti',
183                                              'en' => 'contacts'),
184                      'tit_cla'      => array('it' => 'classifiche degli utenti',
185                                              'en' => 'user\'s placings'),
186                      'itm_cla'      => array('it' => 'classifiche',
187                                              'en' => 'placings'),
188                      'tit_rmap'     => array('it' => 'prossime funzionalitĆ  implementate',
189                                              'en' => 'roadmap of next functionalities'),
190                      'itm_rmap'     => array('it' => 'roadmap',
191                                              'en' => 'roadmap'),
192                      'tit_meet'     => array('it' => 'foto dei raduni di briskisti (serve Facebook)',
193                                              'en' => 'photos of brisk meetings'),
194                      'itm_meet'     => array('it' => 'BriskMeeting',
195                                              'en' => 'BriskMeeting'),
196                      'tit_mesg'     => array('it' => 'manda un messaggio o una segnalazione all\'amministratore del sito',
197                                              'en' => 'send a message or a signalling to the administrator' ),
198                      'mesgtoadm_tit'=> array('it' => 'Invia un messaggio o una segnalazione all\'amministratore:',
199                                              'en' => 'Send a message to the administrator:'),
200                      'mesgtoadm_sub'=> array('it' => 'soggetto:',
201                                              'en' => 'subject:'),
202                      'btn_send'     => array('it' => 'Invia.',
203                                              'en' => 'Send.'),
204                      'btn_close'    => array('it' => 'Chiudi.',
205                                              'en' => 'Close.')
206                      );
207
208
209
210 require_once("briskin5/Obj/briskin5.phh");
211
212 function poll_dom() {
213   GLOBAL $G_with_poll, $G_poll_title, $G_poll_entries;
214
215   if ($G_with_poll) {
216     $ret = sprintf('<div style="padding: 0px;margin: 0px; height: 8px; font-size: 1px;"></div>
217
218 <img class="nobo" src="img/brisk_poll.png" onmouseover="menu_hide(0,0); menu_show(\'menu_poll\');">
219
220 <div style="width: 300px;" class="webstart" id="menu_poll" onmouseover="menu_over(1,this);" onmouseout="menu_over(-1,this);">
221 <b>%s</b><br><br>
222 <form id="poll_form" accept-charset="utf-8" method="post" action="" onsubmit="return j_pollbox(this);">
223 <input type="hidden" name="realsub" value="666">', $G_poll_title);
224     for ($i = 0 ; $i < count($G_poll_entries) ; $i++) {
225       $ret .= sprintf('<INPUT TYPE="radio" NAME="category" VALUE="%s">%s<hr><br>', $G_poll_entries[$i]['id'],
226                       $G_poll_entries[$i]['cont']);
227     }
228     $ret .= sprintf('<div style="text-align: center;"><input type="submit" class="input_sub" onclick="this.form.elements[\'realsub\'].value = this.value;" value="invia" name="sub" id="subid"/></div>
229 </form></div>');
230     return ($ret);
231   }
232   else
233     return '';
234 }
235
236 function carousel_top()
237 {
238     $rn = rand(1, 3);
239     return (sprintf('<a target="_blank" href="http://shop.alternativeoutput.it"><img class="nobo" style="display: inline; border: 1px solid #808080;" src="img/briskshop%d.gif"></a>', $rn));
240 }
241
242 function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $cookie)
243 {
244     GLOBAL $G_with_donors, $G_donors_cur, $G_donors_all;
245     GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local;
246     GLOBAL $G_with_sidebanner, $G_sidebanner; 
247     GLOBAL $G_with_sidebanner2, $G_sidebanner2; 
248     GLOBAL $G_with_poll;
249     GLOBAL $G_lang, $G_lng, $mlang_room;
250     GLOBAL $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
251
252     if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE) 
253         $sess = "";
254     if (($name = gpcs_var('name', $get, $post, $cookie)) === FALSE)
255         unset($name);
256     if (($pass_private = gpcs_var('pass_private', $get, $post, $cookie)) === FALSE)
257         unset ($pass_private);
258     if (($table_idx = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
259         unset ($table_idx);
260     if (($table_token = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
261         unset ($table_token);
262
263     // Use of proxies isn't allowed.
264     if (!$G_is_local && is_proxy($addr)) {
265         return FALSE;
266     }
267
268   $is_login = FALSE;
269   $body = "";
270   $tables = "";
271   $standup = "";
272   $ACTION = "login";
273   
274   if (isset($BRISK_SHOWHTML) == FALSE) {
275       $is_table = FALSE;
276       log_main("lock Room");
277       $curtime = time();
278       
279       /* Actions */
280       
281       if (validate_sess($sess)) {
282           log_main("pre garbage_manager UNO");
283           $room->garbage_manager(TRUE);
284           log_main("post garbage_manager");
285           if (($user = &$room->get_user($sess, &$idx)) != FALSE) {
286               log_main("user stat: ".$user->stat);
287               if ($user->stat == "table") {
288                   $cookies = new Cookies();
289                   $cookies->add("table_token", $user->table_token, $curtime + 31536000);
290                   $cookies->add("table_idx", $user->table, $curtime + 31536000);
291                   $header_out['cookies'] = $cookies;
292                   $header_out['Location'] = "briskin5/index.php";
293                   return TRUE;
294               }
295               $ACTION = "room";
296           }
297           
298       }
299       
300       if ($ACTION == "login" && isset($name)) {
301           
302           log_main("pre garbage_manager DUE");
303           
304           if (isset($pass_private) == FALSE) {
305               $pass_private = FALSE;
306           }
307           
308           $room->garbage_manager(TRUE);
309           /* try login */
310
311           $ipv4addr = addrtoipv4($addr);
312           if (($user = $room->add_user(&$sess, &$idx, $name, $pass_private, $ipv4addr, $cookie)) != FALSE) {
313               $ACTION = "room";
314               if ($idx < 0) {
315                   $idx = -$idx - 1;
316                   $is_login = TRUE;
317               }
318               
319               log_legal($curtime, $ipv4addr, $user, "STAT:LOGIN", '');
320               
321               // recovery lost game
322               if ($user->stat == "table") {
323                   $cookies = new Cookies();
324                   $cookies->add("table_token", $user->table_token, $curtime + 31536000);
325                   $cookies->add("table_idx", $user->table, $curtime + 31536000);
326                   $header_out['cookies'] = $cookies;
327                   $header_out['Location'] = "briskin5/index.php";
328                   return TRUE;
329               }
330               
331               
332               // setcookie ("sess", "", time() + 180);      
333               $room->standup_update(&$user);
334               
335           }
336           else {
337               /* Login Rendering */
338               /* MLANG: "Utente e/o password errati.", "Il nickname deve contenere almeno una lettera o una cifra.", "Spiacenti, non ci sono pi&ugrave; posti liberi. Riprova pi&ugrave; tardi.", "Il tuo nickname &egrave; gi&agrave; in uso." */
339               /*
340                if ($idx == -3) 
341                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpasserr'][$G_lang].'</b></div>';
342                else if ($idx == -2)
343                // $body .= '<div class="urgmsg"><b>Il nickname deve contenere almeno una lettera o una cifra.</b></div>';
344                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpassmust'][$G_lang].'</b></div>';
345                else if ($idx == -1) 
346                // $body .= '<div class="urgmsg"><b>Spiacenti, non ci sono pi&ugrave; posti liberi. Riprova pi&ugrave; tardi.</b></div>';
347                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpassend'][$G_lang].'</b></div>';
348                else
349                // $body .= '<div class="urgmsg"><b>Il tuo nickname &egrave; gi&agrave; in uso.</b></div>';
350                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpassuse'][$G_lang].'</b></div>';
351               */
352               
353               if ($idx == -3) 
354                   $sfx = 'err';
355               else if ($idx == -2)
356                   $sfx = 'must';
357               else if ($idx == -1) 
358                   $sfx = 'end';
359               else
360                   $sfx = 'use';
361               
362               $body .= '<div class="urgmsg"><b>'.$mlang_room['userpass'.$sfx][$G_lang].'</b></div>';
363           }
364       }
365   }
366   /* Rendering. */
367
368   if ($BRISK_SHOWHTML == "debugtable") {
369       $ACTION = "room";
370   }
371   else if ($BRISK_SHOWHTML == "debuglogin") {
372       $ACTION = "login";
373   }
374
375   if ($ACTION == "room") {
376       $tables .= '<div class="room_tab">';
377       $tables .= '<table class="room_tab">';
378       for ($ii = 0 ; $ii < TABLES_N ; $ii++) {
379           if ($user->flags & USER_FLAG_AUTH)
380         $i = $ii;
381           else
382               $i = TABLES_N - $ii - 1;
383           
384           if ($ii % 4 == 0) {
385               $tables .= '<tr id = "tr_noauth'.$ii.'">';
386           }
387           if (TRUE || !($user->flags & USER_FLAG_ISOLAUTH) || $ii < TABLES_AUTH_N) {
388               $tables .= '<td id = "td_noauth'.$ii.'">';
389               
390               $tables .= '<div class="room_div"><div class="room_tit"><b>'.$mlang_room['tit_tabl'][$G_lang].$i.'</b></div>';
391               $tables .= sprintf('<div class="proxhr" id="table%d"></div>', $i);
392               $tables .= sprintf('<div class="table_act" id="table_act%d"></div>', $i);
393               $tables .= '</div>';
394               $tables .= '</td>'."\n";
395           }
396           if ($ii % 4 == 3) {
397               $tables .= '</tr>';
398           }
399       }
400       $tables .= '</table></div>';
401       
402       
403       $standup .= '<table class="room_standup"><tr><td><div class="room_standup_orig" id="room_standup_orig"></div>';
404       $standup .= '<div class="room_ex_standup">';
405       /* MLANG: "Giocatori in piedi" */
406       // $standup .= '<div id="room_tit"><span class="room_titin"><b>Giocatori in piedi</b> - <a target="_blank" href="weboftrust.php">Come ottenere user e password</a> - </span></div>';
407       $standup .= '<div id="room_tit"><span class="room_titin"><b>'.$mlang_room['standing'][$G_lang].'</b></span></div>';
408       
409       $standup .= sprintf('<div id="standup" class="room_standup"></div>');
410       // MLANG Esco.
411       $standup .= '<div id="esco" class="esco"><input type="button" class="button" name="xreload"  value="Reload." onclick="act_reloadroom();"><input class="button" name="logout" value="'.$mlang_room['btn_exit'][$G_lang].'" onclick="esco_cb();" type="button"></div>';
412       $standup .= '</div></td></tr></table>';
413   }
414   
415   $altout_sponsor_arr = array( array ( 'id' => 'btn_altout',
416                                        'url' => 'http://www.alternativeoutput.it',
417                                        'content' => 'img/altout80x15.png',
418                                        'content_big' => 'img/logotxt_banner.png'),
419                                array ( 'id' => 'btn_virtualsky',
420                                        'url' => 'http://virtualsky.alternativeoutput.it',
421                                        'content' => 'img/virtualsky80x15a.gif',
422                                        'content_big' => 'img/virtualsky_big.png'),
423                                array ( 'id' => 'btn_dynamica',
424                                        'url' => 'http://www.dynamica.it',
425                                        'content' => 'img/dynamica.png',
426                                        'content_big' => 'img/dynamica_big.png')
427                                );
428   
429   $altout_support_arr = array( array ( 'id' => 'btn_brichi',
430                                        'url' => 'http://www.briscolachiamata.it',
431                                        'content' => 'img/brichi.png',
432                                        'content_big' => 'img/brichi_big.png'),
433                                array ( 'id' => 'btn_foroli',
434                                        'url' => 'http://www.forumolimpia.it',
435                                        'content' => 'img/forumolimpia.gif',
436                                        'content_big' => 'img/forumolimpia_big.png' ),
437                                array ( 'id'=> 'btn_niini',
438                                        'url' => 'http://www.niinivirta.it',
439                                        'content' => 'img/niinivirta.png',
440                                        'content_big' => 'img/niinivirta_big.png') );
441   
442   
443   
444   $altout_support = "";
445   $altout_support_big = "";
446   for ($i = 0 ; $i < 4 ; $i++) {
447       $ii = ($i < 3 ? $i : 0);
448       
449       $altout_support .= sprintf('<a style="position: absolute; top: %dpx; left: 7px;" target="_blank" href="%s"><img class="nobo" id="%s" src="%s" onMouseOver="show_bigpict(this, \'over\',100,10);" onMouseOut="show_bigpict(this, \'out\',0,0);"></a><br>',
450                                  $i * 20, $altout_support_arr[$ii]['url'],
451                                  $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content']);
452       
453       $altout_support_big .= sprintf('<img style="position: absolute;" class="nobohide" id="%s_big" src="%s">',
454                                      $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content_big']);
455   }
456   
457   
458   // seed with microseconds since last "whole" second
459   // srand ((double) microtime() * 1000000);
460   // $randval = rand(0,count($altout_sponsor_arr)-1);
461   $altout_sponsor = "";
462   $altout_sponsor_big = "";
463   for ($i = 0 ; $i < 4 ; $i++) {
464       $ii = ($i < 3 ? $i : 0);
465       
466       $altout_sponsor .= sprintf('<a style="position: absolute; top: %dpx; left: 7px;" target="_blank" href="%s"><img class="nobo" id="%s" src="%s" onMouseOver="show_bigpict(this, \'over\',100,10);" onMouseOut="show_bigpict(this, \'out\',0,0);"></a><br>',
467                                  $i * 20, $altout_sponsor_arr[$ii]['url'],
468                                  $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content']);
469       
470       $altout_sponsor_big .= sprintf('<img class="nobohide" id="%s_big" src="%s">',
471                                    $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content_big']);
472   }
473   
474   
475   
476   
477   
478   $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt");
479   if ($brisk_donate == FALSE)
480       $brisk_donate = "";
481   
482   
483   /* MLANG: "briscola chiamata in salsa ajax", */
484   
485   mt_srand(make_seed());
486   if (!$G_is_local) {
487       $rn = rand(0, 1);
488       
489       if ($rn == 0) { 
490           $banner_top_left = '<script type="text/javascript"><!--
491 google_ad_client = "pub-5246925322544303";
492 google_ad_width = 234;
493 google_ad_height = 60;
494 google_ad_format = "234x60_as";
495 google_ad_type = "text_image";
496 google_ad_channel = "";
497 google_color_border = "808080";
498 google_color_bg = "f6f6f6";
499 google_color_link = "ffae00";
500 google_color_text = "404040";
501 google_color_url = "000000";
502 //-->
503 </script>
504 <script type="text/javascript"
505   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
506 </script>';
507           $banner_top_right = carousel_top();
508       }
509       else { 
510           $banner_top_left = carousel_top();
511           $banner_top_right = '<script type="text/javascript"><!--
512 google_ad_client = "pub-5246925322544303";
513 google_ad_width = 234;
514 google_ad_height = 60;
515 google_ad_format = "234x60_as";
516 google_ad_type = "text_image";
517 google_ad_channel = "";
518 google_color_border = "808080";
519 google_color_bg = "f6f6f6";
520 google_color_link = "ffae00";
521 google_color_text = "404040";
522 google_color_url = "000000";
523 //-->
524 </script>
525 <script type="text/javascript"
526   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
527 </script>';
528       }
529   }
530   else { // !$G_is_local
531       $banner_top_left  = carousel_top();
532       $banner_top_right = carousel_top();
533   }
534
535   $brisk_header_form = '<div class="container">
536 <!-- =========== header ===========  -->
537 <div id="header" class="header">
538 <table width="100%%" border="0" cols="3"><tr>
539 <td align="left"><div style="padding-left: 8px;">'.$banner_top_left.'</div></td>
540 <td align="center">'.(($G_with_topbanner || $G_with_donors) ? '<table><tr><td>' : '').'<div style="text-align: center;">
541     <img class="nobo" src="img/brisk_logo64.png">
542     '.$mlang_room['headline'][$G_lang].'<br>
543     </div>'.( ($G_with_topbanner || $G_with_donors) ? sprintf('</td><td>%s</td></tr></table>', 
544                                                                 ($G_with_topbanner ? $G_topbanner : 
545 "<div style='background-color: #ffd780; border: 1px solid black; text-align: center;'><img class='nobo' src=\"donometer.php?c=".$G_donors_cur."&a=".$G_donors_all."\"><div style='padding: 1px; background-color: white;'><b>donatori</b></div></div>") ) : '').'</td>
546 <td align="right"><div style="padding-right: 8px;">
547 '.$banner_top_right.'</div></td>
548 </tr></table>
549 </div>';
550
551 /* MLANG: ALL THE VERTICAL MENU */
552   $brisk_vertical_menu = '
553 <!--  =========== vertical menu ===========  -->
554 <div class="topmenu">
555 <!-- <a target="_blank" href="/briskhome.php"></a> -->
556
557 <div class="webstart_hilite">
558 <img class="nobo" style="cursor: pointer;" src="img/brisk_start.png" onmouseover="menu_hide(0,0); menu_show(\'menu_webstart\');">
559 <div class="webstart" id="menu_webstart" onmouseover="menu_over(1,this);" onmouseout="menu_over(-1,this);">
560
561 <a href="#" onmouseover="menu_hide(0,1);" title="'.$mlang_room['tit_help'][$G_lang].'" onclick="act_help();"
562    >'.$mlang_room['itm_help'][$G_lang].'</a><br>
563
564 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php" 
565    onmouseover="menu_hide(0,1);"
566    title="'.$mlang_room['tit_hpage'][$G_lang].'">homepage</a><br>
567
568 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#cose" 
569    onmouseover="menu_hide(0,1);"
570    title="'.$mlang_room['tit_what'][$G_lang].'">'.$mlang_room['itm_what'][$G_lang].'</a><br>
571
572 <a target="_blank" href="'.$mlang_room['url_rules'][$G_lang].'" 
573    onmouseover="menu_hide(0,1);"
574    title="'.$mlang_room['tit_rules'][$G_lang].'">'.$mlang_room['itm_rules'][$G_lang].'</a><br>
575
576 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#shots" 
577    onmouseover="menu_hide(0,1);"
578    title="'.$mlang_room['tit_shot'][$G_lang].'">screenshoots</a><br>
579
580 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#comp" 
581    onmouseover="menu_hide(0,1);"
582    title="'.$mlang_room['tit_comp'][$G_lang].'">'.$mlang_room['itm_comp'][$G_lang].'</a><br>
583
584 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#sources" 
585    onmouseover="menu_hide(0,1);"
586    title="'.$mlang_room['tit_src'][$G_lang].'">'.$mlang_room['itm_src'][$G_lang].'</a><br>
587
588 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#mailing" 
589    onmouseover="menu_hide(0,1);"
590    title="'.$mlang_room['tit_ml'][$G_lang].'">'.$mlang_room['itm_ml'][$G_lang].'</a><br>
591
592 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#prop" 
593    onmouseover="menu_hide(0,1);"
594    title="'.$mlang_room['tit_pro'][$G_lang].'">'.$mlang_room['itm_pro'][$G_lang].'</a><br>
595 <a href="#"
596    onmouseover="menu_hide(0,1);"
597    title="credits" onclick="act_about();">about</a><br>
598
599 <a href="mailto:brisk@alternativeoutput.it" 
600    onmouseover="menu_hide(0,1);"
601    title="'.$mlang_room['tit_mail'][$G_lang].'">'.$mlang_room['itm_mail'][$G_lang].'</a><br>
602
603 <hr>
604
605 <!--
606 <a href="#"
607    onmouseover="menu_hide(0,1);"
608    title="perchĆ© supportare brisk?" onclick="act_whysupport();">supportare?</a><br>
609 -->
610 <a href="#"
611    onmouseover="menu_hide(0,1);"
612    title="'.$mlang_room['tit_cla'][$G_lang].'" onclick="act_placing();">'.$mlang_room['itm_cla'][$G_lang].'</a><br>
613
614 <a href="#"
615    onmouseover="menu_hide(0,1);"
616    title="'.$mlang_room['tit_rmap'][$G_lang].'" onclick="act_roadmap();">'.$mlang_room['itm_rmap'][$G_lang].'</a><br>
617
618 <a href="#" title="'.$mlang_room['tit_meet'][$G_lang].'" 
619    onmouseover="menu_show(\'menu_meeting\');">'.$mlang_room['itm_meet'][$G_lang].'</a><br>
620
621 <div style="text-align: right;" id="menu_meeting" class="webstart">
622 <a href="http://it-it.facebook.com/event.php?eid=262482143080&index=1"
623    target="_blank" onmouseover="menu_hide(0,2);"
624    title="1Ā° Torneo-Meeting di Lodi del 21/02/2010" ><img style="display: inline;" class="nobo" src="img/coppa16.png">Lodi 02/10</a><br>
625
626 <a href="http://it-it.facebook.com/event.php?eid=165523204539&index=1"
627    target="_blank" onmouseover="menu_hide(0,2);"
628    title="1Ā° Torneo-Meeting di Parma del 22/11/2009" <img style="display: inline;" class="nobo" src="img/coppa16.png">Parma 11/09</a><br>
629
630 <a href="http://it-it.facebook.com/event.php?eid=105699129890&index=1"
631    target="_blank" onmouseover="menu_hide(0,2);"
632    title="BriskMeeting di Parma del 13/09/2009" >Parma 09/09</a><br>
633
634 <a href="http://it-it.facebook.com/event.php?eid=97829048656&index=1"
635    target="_blank" onmouseover="menu_hide(0,2);"
636    title="BriskMeeting di Clusane d\'Iseo del 5/07/2009" >Clusane 07/09</a><br>
637
638 <a href="http://it-it.facebook.com/event.php?eid=103366692570&index=1"
639    target="_blank" onmouseover="menu_hide(0,2);"
640    title="BriskMeeting Siciliano del 14/06/2009" >Catania 06/09</a><br>
641
642 <a href="http://it-it.facebook.com/event.php?eid=81488770852&index=1" 
643    target="_blank" onmouseover="menu_hide(0,2);"
644    title="BriskMeeting di Piacenza del 19/04/2009" >Piacenza 04/09</a><br>
645
646 <a href="http://it-it.facebook.com/event.php?eid=51159131399&index=1" 
647    target="_blank" onmouseover="menu_hide(0,2);"
648    title="BriskMeeting di Parma del 22/02/2009" >Parma 02/09</a><br>
649
650 <a href="http://www.anomalia.it/mop/photoo?album=brisk_pc0806" 
651    target="_blank" onmouseover="menu_hide(0,2);"
652    title="Raduno di Piacenza del del 15/06/2008" >Piacenza 06/08</a><br>
653
654 <a href="http://www.anomalia.it/mop/photoo" 
655    target="_blank" onmouseover="menu_hide(0,2);"
656    title="Torneo di Milano del 17/05/2008" >Milano 05/08</a><br>
657
658 </div>
659 </div>'. ($ACTION == "room" ? '<div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div><img class="nobo" style="cursor: pointer;" src="img/brisk_commands'.langtolng($G_lang).'.png" onmouseover="menu_hide(0,0); menu_show(\'menu_commands\');">
660
661 <div class="webstart" id="menu_commands" onmouseover="menu_over(1,this);" onmouseout="menu_over(-1,this);">
662
663 <a href="#" title="'
664           // MLANG
665           .$mlang_room['tit_stat'][$G_lang].
666 '" 
667    onmouseover="menu_hide(0,1); menu_show(\'menu_state\');">'
668           // MLANG
669           .$mlang_room['stat_desc'][$G_lang].
670 '</a><br>
671 <div id="menu_state" class="webstart">
672 <a href="#"
673    onmouseover="menu_hide(0,2);"
674    title="" onclick="act_chatt(\'/st normale\'); menu_over(-1,this);">'
675           // MLANG
676           .$mlang_room['st_norm_desc'][$G_lang].
677 '</a><br>
678
679 <a href="#"
680    onmouseover="menu_hide(0,2);"
681    title="" onclick="act_chatt(\'/st pausa\'); menu_over(-1,this);">'
682           // MLANG
683           .$mlang_room['st_paus_desc'][$G_lang].
684 '&nbsp;<img class="unbo" src="img/st_pau.png"></a><br>
685
686 <a href="#"
687    onmouseover="menu_hide(0,2);"
688    title="" onclick="act_chatt(\'/st fuori\'); menu_over(-1,this);">'
689           // MLANG
690           .$mlang_room['st_out_desc'][$G_lang].
691 '&nbsp;<img class="unbo" src="img/st_out.png"></a><br>
692
693 <a href="#"
694    onmouseover="menu_hide(0,2);"
695    title="" onclick="act_chatt(\'/st cane\'); menu_over(-1,this);">'
696           // MLANG
697           .$mlang_room['st_dog_desc'][$G_lang].
698 '&nbsp;<img class="unbo" src="img/st_dog.png"></a><br>
699
700 <a href="#"
701    onmouseover="menu_hide(0,2);"
702    title="" onclick="act_chatt(\'/st cibo\'); menu_over(-1,this);">'
703           // MLANG
704           .$mlang_room['st_food_desc'][$G_lang].
705 '&nbsp;<img class="unbo" src="img/st_eat.png"></a><br>
706
707 <a href="#"
708    onmouseover="menu_hide(0,2);"
709    title="" onclick="act_chatt(\'/st lavoro\'); menu_over(-1,this);">'
710           // MLANG
711           .$mlang_room['st_work_desc'][$G_lang].
712 '&nbsp;<img class="unbo" src="img/st_wrk.png"></a><br>
713
714 <a href="#"
715    onmouseover="menu_hide(0,2);"
716    title="" onclick="act_chatt(\'/st sigaretta\'); menu_over(-1,this);">'
717           // MLANG
718           .$mlang_room['st_smok_desc'][$G_lang].
719 '&nbsp;<img class="unbo" src="img/st_smk.png"></a><br>
720
721 <a href="#"
722    onmouseover="menu_hide(0,2);"
723    title="" onclick="act_chatt(\'/st presente\'); menu_over(-1,this);">'
724           // MLANG
725           .$mlang_room['st_pres_desc'][$G_lang].
726 '&nbsp;<img class="unbo" src="img/st_eye.png"></a><br>
727
728 <a href="#"
729    onmouseover="menu_hide(0,2);"
730    title="" onclick="act_chatt(\'/st coniglio\'); menu_over(-1,this);">'
731           // MLANG
732           .$mlang_room['st_rabb_desc'][$G_lang].
733 '&nbsp;<img class="unbo" src="img/st_rabbit.png"></a><br>
734
735 <a href="#"
736    onmouseover="menu_hide(0,2);"
737    title="" onclick="act_chatt(\'/st calcio\'); menu_over(-1,this);">'
738           // MLANG
739           .$mlang_room['st_socc_desc'][$G_lang].
740 '&nbsp;<img class="unbo" src="img/st_soccer.png"></a><br>
741
742 <a href="#"
743    onmouseover="menu_hide(0,2);"
744    title="" onclick="act_chatt(\'/st pupo\'); menu_over(-1,this);">'
745           // MLANG
746           .$mlang_room['st_baby_desc'][$G_lang].
747 '&nbsp;<img class="unbo" src="img/st_baby.png"></a><br>
748
749 <a href="#"
750    onmouseover="menu_hide(0,2);"
751    title="" onclick="act_chatt(\'/st pulizie\'); menu_over(-1,this);">'
752           // MLANG
753           .$mlang_room['st_mop_desc'][$G_lang].
754 '&nbsp;<img class="unbo" src="img/st_mop.png"></a><br>
755
756 <a href="#"
757    onmouseover="menu_hide(0,2);"
758    title="" onclick="act_chatt(\'/st babbo\'); menu_over(-1,this);">'
759           // MLANG
760           .$mlang_room['st_babbo_desc'][$G_lang].
761 '&nbsp;<img class="unbo" src="img/st_babbo.png"></a><br>
762
763 <a href="#"
764    onmouseover="menu_hide(0,2);"
765    title="" onclick="act_chatt(\'/st renna\'); menu_over(-1,this);">'
766           // MLANG
767           .$mlang_room['st_renna_desc'][$G_lang].
768 '&nbsp;<img class="unbo" src="img/st_renna.png"></a><br>
769
770 <a href="#"
771    onmouseover="menu_hide(0,2);"
772    title="" onclick="act_chatt(\'/st pupazzo\'); menu_over(-1,this);">'
773           // MLANG
774           .$mlang_room['st_pupaz_desc'][$G_lang].
775 '&nbsp;<img class="unbo" src="img/st_pupaz.png"></a><br>
776
777 <a href="#"
778    onmouseover="menu_hide(0,2);"
779    title="" onclick="act_chatt(\'/st vischio\'); menu_over(-1,this);">'
780           // MLANG
781           .$mlang_room['st_visch_desc'][$G_lang].
782 '&nbsp;<img class="unbo" src="img/st_visch.png"></a><br>
783
784 </div>
785
786 <a href="#" title="avvia un ticker pubblicitario per il tuo tavolo" 
787    onmouseover="menu_hide(0,1);" onclick="act_chatt(\'/tav \'+$(\'txt_in\').value); menu_over(-1,this);">ticker &nbsp;<img class="unbo" src="img/train.png"></a><br>
788
789 <a href="#" title="'
790           // MLANG garantisci per un tuo conoscente
791           .$mlang_room['warr_desc'][$G_lang].
792 '" 
793    onmouseover="menu_hide(0,1);" onclick="act_chatt(\'/authreq\'); menu_over(-1,this);">'
794           // MLANG garantisci
795           .$mlang_room['itm_warr'][$G_lang].
796           '</a><br>
797
798
799
800 <a href="#" title="'
801           // MLANG garantisci per un tuo conoscente
802           .$mlang_room['splash_desc'][$G_lang].
803 '" 
804    onmouseover="menu_hide(0,1);" onclick="act_splash(); menu_over(-1,this);">'
805           // MLANG garantisci
806           .$mlang_room['tit_splash'][$G_lang].
807           '</a><br>
808 '.($user->flags & USER_FLAG_AUTH ? '
809 <a href="#" title="'
810           // MLANG garantisci per un tuo conoscente
811           .$mlang_room['prefs_desc'][$G_lang].'"
812    onmouseover="menu_hide(0,1);" onclick="$(\'preferences\').style.visibility = \'visible\'; menu_over(-1,this);">'
813           // MLANG garantisci
814    .$mlang_room['tit_prefs'][$G_lang].'</a><br>' : '').'
815
816 </div>'.($G_with_poll ? '' : '<div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
817 <img style="cursor: pointer;" class="nobo" src="img/brisk_help'.langtolng($G_lang).'.png" title="'.$mlang_room['tit_help'][$G_lang].'" onmouseover="menu_hide(0,0);" onclick="act_help();">').'
818 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
819 '.($user->flags & USER_FLAG_AUTH ? '
820 <img style="cursor: pointer;" class="nobo" src="img/brisk_signal'.langtolng($G_lang).'.png" title="'.$mlang_room['tit_mesg'][$G_lang].'" onmouseover="menu_hide(0,0);" onclick="act_chatt(\'/mesgtoadm\');">'.poll_dom()
821  : '
822 <img style="cursor: pointer;" class="nobo" src="img/brisk_password.png" title="Come ottenere una password su Brisk." onmouseover="menu_hide(0,0);" onclick="act_passwdhowto();">
823 ').'
824
825 ' : '').'
826
827 </div>
828 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
829 sponsored by:<br>
830 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 4px; font-size: 1px;"></div>
831 <div id="spon_caro" style="overflow: hidden; height: 18px; /* border: 1px solid red; */ ">
832 <div style="/*background-color: green; */ text-align: left; position: relative; padding: 0px; margin: 0px; top: 0px; height: 80px;">'.$altout_sponsor.'<br>
833 </div></div>
834 <div style="position: absolute;">
835 '.$altout_sponsor_big.'
836 </div>
837 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
838 supported by:<br>
839 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 4px; font-size: 1px;"></div>
840 <div id="supp_caro" style="overflow: hidden; height: 18px; /* border: 1px solid red; */">
841 <div style="/* background-color: green; */ text-align: left; position: relative; padding: 0px; margin: 0px; top: 0px; height: 80px;">'.$altout_support.'<br> 
842
843 </div>
844 </div>
845 <div style="position: absolute;">
846 '.$altout_support_big.'
847 </div>
848 <a style="/* position: absolute; top: 40px; left: 6px;" */ target="_blank" href="http://it-it.facebook.com/group.php?gid=59742820791"><img class="nobo" id="btn_facebook" src="img/facebook_btn.png" title="unisciti al gruppo \'quelli della brisk\'"></a>
849 <br>
850 <div id="proflashext" class="proflashext"><div id="proflash" class="proflash">
851 </div><br><br></div>
852 %s
853 %s
854 <br>
855 <img id="stm_stat" class="nobo" src="img/line-status_b.png"></div>';
856     
857   /* Templates. */
858   if ($ACTION == 'login') {
859       $header_out['Content-type'] = "text/html; charset=\"utf-8\"";
860 ?>
861 <html>
862 <head>
863 <title>Brisk</title>
864 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
865 <link rel="shortcut icon" href="img/brisk_ico.png">
866 <script type="text/javascript" src="commons.js"></script> 
867 <script type="text/javascript" src="prefs.js"></script>
868 <!-- <script type="text/javascript" src="myconsole.js"></script> -->
869 <script type="text/javascript" src="menu.js"></script>
870 <script type="text/javascript" src="heartbit.js"></script>
871 <script type="text/javascript" src="xynt-streaming.js"></script>
872 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
873 <script type="text/javascript" src="AC_OETags.js"></script>
874 <script type="text/javascript" src="room.js"></script>
875 <script type="text/javascript" src="md5.js"></script>
876 <script type="text/javascript" src="probrowser.js"></script>
877 <script type="text/javascript" src="json2.js"></script>
878 <link rel="stylesheet" type="text/css" href="brisk.css">
879 <link rel="stylesheet" type="text/css" href="room.css">
880
881 <SCRIPT type="text/javascript"><!--
882    var g_debug = 0;
883    var g_lang = "<? echo $G_lang; ?>";
884    var g_lng = "<? echo $G_lng; ?>";
885    var g_tables_n = <? echo TABLES_N; ?>;
886    var g_tables_auth_n = <? echo TABLES_AUTH_N; ?>;
887    var g_prefs, g_prefs_new = null;
888    var g_listen;
889    var g_withflash = false;
890    var g_is_spawn = 0;
891    var gst  = new globst();
892    var topbanner_sfx, topbanner_dx;
893    var g_brow = null;
894    var xstm = null;
895    var sess = "not_connected";
896    var spo_slide, sup_slide;
897
898    window.onload = function() {
899      // alert(window.onbeforeunload);
900      g_brow = get_browser_agent();
901
902      g_prefs = new client_prefs(null);
903
904      spo_slide  = new sideslide($('spon_caro'), 80, 20);
905      sup_slide  = new sideslide($('supp_caro'), 80, 20);
906
907      login_init();
908 <?php
909      if ($G_with_topbanner) {
910        printf("     topbanner_init();\n");
911     }
912      if ($G_with_sidebanner) {
913        printf("     sidebanner_init();\n");
914     }
915      if ($G_with_sidebanner2) {
916        printf("     sidebanner2_init();\n");
917     }
918 ?>
919
920      g_withflash = DetectFlashVer(6,0,0);
921      if (g_withflash == false) {
922        $("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>';
923      }
924      else
925        $("proflashext").innerHTML = "";
926      $("nameid").focus();
927    }
928    //-->
929 </SCRIPT>
930 </head>
931 <!-- if myconsole <body onunload="deconsole();"> -->
932 <body>
933 <?php
934     printf($brisk_header_form);
935     printf("<table class=\"floaty\"><tr><td class=\"floatyleft\">\n");
936     printf($brisk_vertical_menu, '', '');
937
938    if ($G_with_sidebanner xor $G_with_sidebanner2) {
939      printf("<br><br>");
940    }
941
942    if ($G_with_sidebanner) {
943      printf("%s", $G_sidebanner);
944      if ($G_with_sidebanner2) {
945        printf("<br>");
946      }
947    }
948
949
950    if ($G_with_sidebanner2) {
951      printf("%s", $G_sidebanner2);
952    }
953    printf("</td><td>");
954 ?> 
955
956 <!--  =========== tables ===========  -->
957 <?php 
958
959 /* MLANG: "Digita il tuo nickname per accedere ai tavoli della briscola.", "entra", "Se non hai ancora una password, lascia il campo in bianco ed entra." ,"(se usi firefox e qualcosa non funziona prova a ricaricare la pagina con Ctrl + F5)" */
960 echo "$body"; ?>
961 <br>
962 <div style="text-align: center;">
963    <br><br><br>
964 <?php echo $mlang_room['welcome'][$G_lang];?>
965 <br><br>
966 <form accept-charset="utf-8" method="post" action="" onsubmit="return j_login_manager(this);">
967 <input id="passid_private" name="pass_private" type="hidden" value="">
968 <table class="login">
969 <tr><td>user:</td>
970 <td><input id="nameid" class="input_text" name="name" type="text" size="24" maxlength="12" value=""></td></tr>
971 <tr><td>pwd:</td>
972 <td><input id="passid" class="input_text" name="pass" type="password" size="24" maxlength="64" value=""></td></tr>
973 <tr><td colspan="2"><input id="sub" value="<?php echo $mlang_room['btn_enter'][$G_lang];?>" type="submit" class="button"></td></tr>
974 </table>
975 </form><br>
976 <b><?php echo $mlang_room['passwarn'][$G_lang];?></b><br><br>
977 <?php echo $mlang_room['browwarn'][$G_lang];?><br>
978 </div>
979 <br><br><br><br>
980 <br><br><br><br>
981 <br><br><br><br>
982 <br><br><br><br>
983 <br><br><br><br>
984
985 <div id="imgct"></div>
986 <div id="logz"></div>
987 <div id="sandbox"></div>
988 <div id="sandbox2"></div>
989 <div id="response"></div>
990 <div id="xhrstart"></div>
991 <pre>
992 <div id="xhrlog"></div>
993 </pre>
994 <div id="xhrdeltalog"></div>
995 </body>
996 </html>
997 <?php
998   }
999   else if ($ACTION == 'room') {
1000       $header_out['Content-type'] = "text/html; charset=\"utf-8\"";
1001   ?>
1002 <html>
1003 <head>
1004 <title>Brisk</title>
1005 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1006 <link rel="shortcut icon" href="img/brisk_ico.png">
1007 <script type="text/javascript" src="commons.js"></script>
1008 <script type="text/javascript" src="prefs.js"></script>
1009 <!-- <script type="text/javascript" src="myconsole.js"></script> -->
1010 <script type="text/javascript" src="menu.js"></script>
1011 <script type="text/javascript" src="ticker.js"></script>
1012 <script type="text/javascript" src="heartbit.js"></script>
1013 <script type="text/javascript" src="xynt-streaming.js"></script>
1014 <script type="text/javascript" src="room.js"></script>
1015 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
1016 <script type="text/javascript" src="AC_OETags.js"></script>
1017 <script type="text/javascript" src="probrowser.js"></script>
1018 <script type="text/javascript" src="json2.js"></script>
1019 <link rel="stylesheet" type="text/css" href="brisk.css">
1020 <link rel="stylesheet" type="text/css" href="room.css">
1021 <SCRIPT type="text/javascript"><!--
1022    var sess = "not_connected";
1023    var g_debug = 0;
1024    var g_lang = "<? echo $G_lang; ?>";
1025    var g_lng = "<? echo $G_lng; ?>";
1026    var g_tables_n = <? echo TABLES_N; ?>;
1027    var g_tables_auth_n = <? echo TABLES_AUTH_N; ?>;
1028    var g_prefs, g_prefs_new = null;
1029    var g_listen;
1030    var tra = null;
1031    var stat = "";
1032    var subst = "";
1033    var gst  = new globst();
1034    var g_is_spawn = 0; 
1035    var topbanner_sfx, topbanner_dx;
1036    // var nonunload = false;
1037    var g_withflash = false;
1038    var g_imgct = 0;
1039    var g_imgtot = g_preload_img_arr.length;
1040    var g_brow = null;
1041    var spo_slide, sup_slide;
1042
1043    window.onload = function() {
1044      g_brow = get_browser_agent();
1045
1046      g_prefs = new client_prefs(null);
1047
1048      spo_slide  = new sideslide($('spon_caro'), 80, 20);
1049      sup_slide  = new sideslide($('supp_caro'), 80, 20);
1050
1051 <?php
1052 if ($BRISK_SHOWHTML == "debugtable") {
1053 ?>
1054      room_checkspace(12, <?php echo TABLES_N; ?>, 50);
1055 <?php
1056 }
1057 else {
1058 ?>
1059     // alert("INDEX START");
1060      menu_init();
1061 <?php
1062      if ($G_with_topbanner) {
1063        printf("     topbanner_init();\n");
1064      }
1065      if ($G_with_sidebanner) {
1066        printf("     sidebanner_init();\n");
1067     }
1068      if ($G_with_sidebanner2) {
1069        printf("     sidebanner2_init();\n");
1070     }
1071
1072 ?>
1073      sess = "<?php echo "$sess"; ?>";
1074 xstm = new xynt_streaming(window, "<?php echo "$transp_type"; ?>", null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd_ifra.php', function(com){eval(com);});
1075      xstm.hbit_set(heartbit);
1076      tra = new train($('room_tit'));
1077      window.onunload = onunload_cb;
1078      window.onbeforeunload = onbeforeunload_cb;
1079      g_withflash = DetectFlashVer(6,0,0);
1080      if (g_withflash == false) {
1081        $("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>';
1082      }
1083      else
1084        $("proflashext").innerHTML = "";
1085
1086      // console.log("session from main: "+sess);
1087      xstm.start();
1088      // alert("ARR LENGTH "+g_preload_img_arr.length);
1089      // FIXME: preload image will be fired by stream instead here
1090      // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
1091      $("txt_in").focus();
1092 <?php
1093 if ($is_login) {
1094   /* MLANG: "<br>Il nickname che stai usando &egrave; gi&agrave; registrato,<br><br>se il suo proprietario si autentificher&agrave;<br><br>verrai rinominato d'ufficio come ghost<i>N</i>.", "torna ai tavoli" */
1095   echo show_notify($mlang_room['regwarn'][$G_lang], 0, $mlang_room['btn_rettabs'][$G_lang], 400, 150);
1096 }
1097 ?>
1098 <?php
1099 }
1100 ?>
1101    }
1102    //-->
1103 </SCRIPT>
1104 </head>
1105 <!-- if myconsole <body onunload="deconsole();"> -->
1106 <body>
1107 <?php
1108    printf($brisk_header_form);
1109    printf("<table class=\"floaty\"><tr><td class=\"floatyleft\">\n");
1110    /*   printf($brisk_vertical_menu, '<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>',
1111            $brisk_donate);
1112    printf($brisk_vertical_menu, '<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>',
1113            $brisk_donate);*/
1114    printf($brisk_vertical_menu, '<!-- <br><input type="button" class="button" name="xabout"  value="About." onclick="act_about();">--><br>',
1115            $brisk_donate);
1116
1117
1118    if ($G_with_sidebanner xor $G_with_sidebanner2) {
1119      printf("<br><br>");
1120    }
1121
1122    if ($G_with_sidebanner) {
1123      printf("%s", $G_sidebanner);
1124      if ($G_with_sidebanner2) {
1125        printf("<br>");
1126      }
1127    }
1128
1129
1130    if ($G_with_sidebanner2) {
1131      printf("%s", $G_sidebanner2);
1132    }
1133
1134    printf("</td><td>");
1135 ?> 
1136 <!--  =========== tables ===========  -->
1137 <input name="sess" type="hidden" value="<?php echo "$user->sess"; ?>">
1138 <table class="macro"><tr><td>
1139 <?php echo "$tables"; ?>
1140 </td></tr><tr><td>
1141     <?php echo "$standup"; ?>
1142 </td></tr></table>
1143 </td></tr></table>
1144
1145 <!--  =========== bottom ===========  -->
1146     <div id="bottom" class="bottom">
1147 <b>Chat</b> <span id="list_info" style="color: red;"></span><br>
1148 <div id="txt" class="chatt">
1149 </div>
1150 <div style="text-align: center; ">
1151     <!-- MLANG: scrivi un invito al tavolo e clicca -->
1152     <table style="width: 98%; margin: auto;"><tr><td id="tickbut" class="tickbut"><img class="tickbut" src="img/train.png" onclick="act_tav();" title="<?php echo $mlang_room['tit_ticker'][$G_lang];?>"></td><td style="width:1%; text-align: center;">
1153     <div id="myname"></div>
1154     </td><td>
1155     <input id="txt_in" maxlength="128" type="text" style="width: 100%;" onkeypress="chatt_checksend(this,event);">
1156     </td></tr></table>
1157 </div>
1158 </div>
1159
1160     <div id="authbox" class="notify" style="text-align: center;">
1161        <br>
1162        <b>
1163     <!-- MLANG: Garantisci per un tuo conoscente: -->
1164     <?php echo $mlang_room['tit_warr'][$G_lang]; ?>
1165 </b>
1166        <br><br>
1167
1168        <form id="auth_form" accept-charset="utf-8" method="post" action="" onsubmit="return j_authbox(this);">
1169        <input type="hidden" name="realsub" value="666">
1170 <table class="login">
1171 <tr><td>nickname:</td>
1172 <td><input id="nameid" class="input_text" name="name" type="text" size="24" maxlength="12" value=""></td></tr>
1173 <tr><td>e-mail:</td>
1174 <td><input id="emailid" class="input_text" name="email" type="text" size="24" maxlength="1024" value=""></td></tr>
1175 <tr><td colspan="2" style="text-align: center;">
1176     <!-- MLANG: Garantisci per un tuo conoscente: -->
1177        <input id="subid" name="sub" value=
1178 "<?php echo $mlang_room['btn_send'][$G_lang]; ?>"
1179  type="submit" onclick="this.form.elements['realsub'].value = 'invia';" class="button">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1180     <!-- MLANG: Garantisci per un tuo conoscente: -->
1181 <input id="cloid" name="clo" value=
1182 "<?php echo $mlang_room['btn_close'][$G_lang]; ?>" 
1183 type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chiudi';"></td></tr>
1184 </table>
1185     </form>
1186     </div>
1187     <div id="mesgtoadmbox" class="notify_opaque" style="text-align: center;">
1188        <br>
1189 <!--MLANG: Invia un messaggio o una segnalazione all\'amministratore: -->
1190        <b><?php echo $mlang_room['mesgtoadm_tit'][$G_lang];?></b>
1191        <br><br>
1192        <form id="mesgtoadm_form" accept-charset="utf-8" method="post" action="" onsubmit="return j_mesgtoadmbox(this);">
1193        <input type="hidden" name="realsub" value="666">
1194 <table class="login">
1195 <!--MLANG: soggetto -->
1196 <tr><td><b><?php echo $mlang_room['mesgtoadm_sub'][$G_lang];?></b></td>
1197 <td><input id="subjid" class="input_text" name="subj" type="text" size="32" maxlength="255" value=""></td></tr></table>
1198 <table class="login">
1199 <tr><td><img title="messaggio" class="nobo" src="img/mesgtoadm_mesg<?php echo $G_lng;?>.png"></td>
1200 <td><textarea id="mesgid" class="input_text" name="mesg" cols="40" rows="8" wrap="soft"></textarea></td></tr>
1201 <tr><td colspan="2" style="text-align: center;">
1202        <input id="subid" name="sub" value="<?php echo $mlang_room['btn_send'][$G_lang];?>" type="submit" onclick="this.form.elements['realsub'].value = 'invia';" class="button">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1203 <input id="cloid" name="clo" value="<?php echo $mlang_room['btn_close'][$G_lang];?>" type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chiudi';"></td></tr>
1204 </table>
1205     </form>
1206     </div>
1207 <div id="heartbit"></div>
1208 <div id="sandbox"></div>
1209 <div id="imgct"></div>
1210 <div id="logz"></div>
1211 <div id="sandbox2"></div>
1212 <div id="response"></div>
1213 <div id="remark"></div>
1214 <div id="xhrstart"></div>
1215 <div id="xhrlog"></div>
1216 <div id="xhrdeltalog"></div>
1217 </div>
1218 <div id="preferences" class="notify" style="z-index: 200; width: 600px; margin-left: -300px; height: 240px; top: 150px; visibility: hidden;">
1219 <div id="preferences_child" style="border-bottom: 1px solid gray; overflow: auto; height: 370px;">
1220
1221 <h2><?php echo $mlang_room['tit_prefs'][$G_lang]; ?></h2>
1222 <table style="margin: auto;"><tr><td style="vertical-align: top;">
1223 <!--#
1224     #  LISTEN
1225     #-->
1226 <div style="float: left; padding: 8px;">
1227 <table style="border: 1px solid gray;"><tr><th style="background-color: #cccccc;">
1228 <?php echo $mlang_room['itm_list'][$G_lang];?>
1229 </th></tr>
1230 <tr><td><input style="vertical-align: bottom;" id="ra_listen_all" type="radio" name="listen" value="0" onclick="prefs_update('listen');" title="'
1231 <?php echo $mlang_room['listall_desc'][$G_lang];?>
1232 '"><span id="list_all">
1233 <?php echo $mlang_room['tit_listall'][$G_lang];?>
1234 </span></td></tr>
1235 <tr><td><input style="vertical-align: bottom;" id="ra_listen_auth" type="radio" name="listen" value="1" onclick="prefs_update('listen');" title="'
1236 <?php echo $mlang_room['listaut_desc'][$G_lang];?>
1237 '"><span id="list_auth">
1238 <?php echo $mlang_room['tit_listaut'][$G_lang];?>
1239 </span></td></tr>
1240 <tr><td><input style="vertical-align: bottom;" id="ra_listen_isol" type="radio" name="listen" value="2" onclick="prefs_update('listen');" title="'
1241 <?php echo $mlang_room['listisol_desc'][$G_lang];?>
1242 '"><span id="list_isol">
1243 <?php echo $mlang_room['tit_listisol'][$G_lang];?>
1244 </span></td></tr>
1245 </table>
1246 </div>
1247 <?php
1248 if ($user->is_supp_custom()) {
1249 ?>
1250 </td>
1251 <td style="vertical-align: top;">
1252 <!--#
1253     #  SUPPORTER ONLY
1254     #-->
1255 <div style="float: left; padding: 8px;">
1256 <table style="border: 1px solid gray;"><tr><th colspan="4" style="background-color: #cccccc;">
1257 <?php echo $mlang_room['suppcomp_tit'][$G_lang];?>
1258 </th></tr>
1259 <tr>
1260 <th>
1261 <?php echo $mlang_room['suppcomp_fg'][$G_lang];?>
1262 </th><td><input style="width: 3em;" id="s_fg_r" type="text" maxlength="3" size="3" name="s_fg_r"
1263  onchange="prefs_update('supp');" value="255"
1264  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1265    <span id="list_all"><?php echo $mlang_room['suppcomp_r'][$G_lang];?></span></td>
1266 <td><input style="width: 3em;" id="s_fg_g" type="text" maxlength="3" size="3" name="s_fg_g"
1267  onchange="prefs_update('supp');" value="255"
1268  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1269    <span id="list_all"><?php echo $mlang_room['suppcomp_g'][$G_lang];?></span></td>
1270 <td><input style="width: 3em;" id="s_fg_b" type="text" maxlength="3" size="3" name="s_fg_b"
1271  onchange="prefs_update('supp');" value="255"
1272  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1273    <span id="list_all"><?php echo $mlang_room['suppcomp_b'][$G_lang];?></span></td>
1274 </tr>
1275 <tr>
1276 <th>
1277 <?php echo $mlang_room['suppcomp_bg'][$G_lang];?>
1278 </th>
1279 <td><input style="width: 3em;" id="s_bg_r" type="text" maxlength="3" size="3" name="s_bg_r"
1280  onchange="prefs_update('supp');" value="255"
1281  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1282    <span id="list_all"><?php echo $mlang_room['suppcomp_r'][$G_lang];?></span></td>
1283 <td><input style="width: 3em;" id="s_bg_g" type="text" maxlength="3" size="3" name="s_bg_g"
1284  onchange="prefs_update('supp');" value="255"
1285  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1286    <span id="list_all"><?php echo $mlang_room['suppcomp_g'][$G_lang];?></span></td>
1287 <td><input style="width: 3em;" id="s_bg_b" type="text" maxlength="3" size="3" name="s_bg_b"
1288  onchange="prefs_update('supp');" value="255"
1289  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1290    <span id="list_all"><?php echo $mlang_room['suppcomp_b'][$G_lang];?></span></td>
1291 </tr>
1292 <tr><td colspan="4" style="text-align: center;">
1293 <img id="s_img" class="nobo" src="img/noimg.png">
1294 </td></tr>
1295 </table>
1296 </div>
1297 </td>
1298 <td>
1299 <?php
1300 }
1301 else {
1302 ?>
1303 <input id="s_fg_r" type="hidden" name="s_fg_r">
1304 <input id="s_fg_g" type="hidden" name="s_fg_g">
1305 <input id="s_fg_b" type="hidden" name="s_fg_b">
1306 <input id="s_bg_r" type="hidden" name="s_bg_r">
1307 <input id="s_bg_g" type="hidden" name="s_bg_g">
1308 <input id="s_bg_b" type="hidden" name="s_bg_b">
1309 <input id="s_img"  type="hidden" name="s_bg_b">
1310 <?php
1311 }
1312 ?>
1313 </td></tr></table>
1314 <div style="width: 95%; /* background-color: red; */ margin: auto; text-align: left;">
1315 <br><br>
1316                                                           <!-- <input type="checkbox" name="pref_ring_endauct" id="pref_ring_endauct" onclick="pref_ring_endauct_set(this);"><?php /* echo $mlang_room['itm_ringauc'][$G_lang]; */ ?> -->
1317 </div>
1318
1319
1320 </div>
1321 <div class="notify_clo">
1322 <input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('preferences').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_prefs_close'][$G_lang]; ?>"/> 
1323 <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_reset();" value="<?php echo $mlang_room['btn_prefs_reset'][$G_lang]; ?>"/>
1324 <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_save();" value="<?php echo $mlang_room['btn_prefs_save'][$G_lang]; ?>"/>
1325 </div>
1326 </div>
1327 </body>
1328 </html>
1329 <?php
1330    }
1331 }
1332
1333 ?>