installation: reduce time when the install directry is unavailable
[brisk.git] / web / 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_mnu'      => array('it' => 'minuta giornaliera',
189                                              'en' => 'daily report'),
190                      'itm_mnu'      => array('it' => 'minuta',
191                                              'en' => 'daily deport'),
192                      'tit_rmap'     => array('it' => 'prossime funzionalitĆ  implementate',
193                                              'en' => 'roadmap of next functionalities'),
194                      'itm_rmap'     => array('it' => 'roadmap',
195                                              'en' => 'roadmap'),
196                      'tit_meet'     => array('it' => 'foto dei raduni di briskisti (serve Facebook)',
197                                              'en' => 'photos of brisk meetings'),
198                      'itm_meet'     => array('it' => 'BriskMeeting',
199                                              'en' => 'BriskMeeting'),
200                      'tit_mesg'     => array('it' => 'manda un messaggio o una segnalazione all\'amministratore del sito',
201                                              'en' => 'send a message or a signalling to the administrator' ),
202                      'mesgtoadm_tit'=> array('it' => 'Invia un messaggio o una segnalazione all\'amministratore:',
203                                              'en' => 'Send a message to the administrator:'),
204                      'mesgtoadm_sub'=> array('it' => 'soggetto:',
205                                              'en' => 'subject:'),
206                      'btn_send'     => array('it' => 'Invia.',
207                                              'en' => 'Send.'),
208                      'btn_close'    => array('it' => 'Chiudi.',
209                                              'en' => 'Close.')
210                      );
211
212
213
214 require_once("briskin5/Obj/briskin5.phh");
215
216 function poll_dom() {
217   GLOBAL $G_with_poll, $G_poll_title, $G_poll_entries;
218
219   if ($G_with_poll) {
220     $ret = sprintf('<div style="padding: 0px;margin: 0px; height: 8px; font-size: 1px;"></div>
221
222 <img class="nobo" src="img/brisk_poll.png" onmouseover="menu_hide(0,0); menu_show(\'menu_poll\');">
223
224 <div style="width: 300px;" class="webstart" id="menu_poll" onmouseover="menu_over(1,this);" onmouseout="menu_over(-1,this);">
225 <b>%s</b><br><br>
226 <form id="poll_form" accept-charset="utf-8" method="post" action="" onsubmit="return j_pollbox(this);">
227 <input type="hidden" name="realsub" value="666">', $G_poll_title);
228     for ($i = 0 ; $i < count($G_poll_entries) ; $i++) {
229       $ret .= sprintf('<INPUT TYPE="radio" NAME="category" VALUE="%s">%s<hr><br>', $G_poll_entries[$i]['id'],
230                       $G_poll_entries[$i]['cont']);
231     }
232     $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>
233 </form></div>');
234     return ($ret);
235   }
236   else
237     return '';
238 }
239
240 function sidebanners_init($sidebanner_idx)
241 {
242     for ($i = 0 ; $i < count($sidebanner_idx) ; $i++) {
243         printf("     sidebanner_init(%d);\n", $i);
244     }
245 }
246
247 function sidebanners_render($sidebanner, $sidebanner_idx)
248 {
249     $sb_n = count($sidebanner_idx);
250     if ($sb_n == 0) {
251         return;
252     }
253
254     if ($sb_n == 1) {
255         printf("<br><br>");
256     }
257
258     for ($i = 0 ; $i < $sb_n ; $i++) {
259         $idx = $sidebanner_idx[$i];
260         $sb  = $sidebanner[$idx];
261         if (!array_key_exists('link', $sb)
262             || !array_key_exists('title', $sb)
263             || !array_key_exists('icon_big', $sb)) {
264             continue;
265         }
266         $sb_type = (array_key_exists('type', $sb) ? $sb['type'] : 'meeting');
267         if (array_key_exists('icon', $sb)) {
268             $sb_icon = $sb['icon'];
269         }
270         else {
271             if ($sb_type == 'meeting') {
272                 if ($sb_n < 3) {
273                     $sb_icon = 'img/brisk_meeting60.gif';
274                 }
275                 else {
276                     $sb_icon = 'img/brisk_meeting35.gif';
277                 }
278             }
279             else {
280                 // no standard icon for other type of events please add them
281                 continue;
282             }
283         }
284         $sb_dx =  (array_key_exists('dx', $sb) ? $sb['dx'] : 100);
285         $sb_dy =  (array_key_exists('dy', $sb) ? $sb['dy'] : -230);
286
287         printf('<div class="sidebanner" style="background: #ffd780; border: solid 1px #ffae00; width: 60px;" id="sidebanner%d">', $i);
288         printf('<a target="_blank" href="%s">', $sb['link']);
289         printf('<img style="position: static; border: solid 0px black;" src="%s"', $sb_icon);
290         printf('  onMouseOver="show_bigpict($(\'sidebanner%d\'), \'over\', %d, %d, \'\');"', $i, $sb_dx, $sb_dy);
291         printf('  onMouseOut="show_bigpict($(\'sidebanner%d\'), \'out\', 0, 0, \'\');"', $i);
292         $tit = eschtml($sb['title']);
293         printf('  alt="%s" title="%s"></a></div>', $tit, $tit);
294         printf("\n");
295         printf('<img class="nobohide" style="z-index: 255; border: 1px solid gray;" id="sidebanner%d_big" src="%s">', $i, $sb['icon_big']);
296         printf("\n");
297     }
298 }
299
300 function index_main(&$brisk, $transp_type, &$header_out, $remote_addr_full, $get, $post, $cookie)
301 {
302     GLOBAL $G_with_donors, $G_donors_cur, $G_donors_all;
303     GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local;
304     GLOBAL $G_sidebanner, $G_sidebanner_idx;
305     GLOBAL $G_with_poll;
306     GLOBAL $G_lang, $G_lng, $mlang_room;
307     GLOBAL $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
308
309     if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
310         $sess = "";
311     if (($name = gpcs_var('name', $get, $post, $cookie)) === FALSE)
312         unset($name);
313     if (($pass_private = gpcs_var('pass_private', $get, $post, $cookie)) === FALSE)
314         unset ($pass_private);
315     if (($table_idx = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
316         unset ($table_idx);
317     if (($table_token = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
318         unset ($table_token);
319
320     $remote_addr = addrtoipv4($remote_addr_full);
321
322     // Use of proxies isn't allowed.
323     if (!$G_is_local && is_proxy($remote_addr)) {
324         return FALSE;
325     }
326
327   $is_login = FALSE;
328   $body = "";
329   $tables = "";
330   $standup = "";
331   $ACTION = "login";
332
333   if (isset($BRISK_SHOWHTML) == FALSE) {
334       $is_table = FALSE;
335       log_main("lock Brisk");
336       $curtime = time();
337
338       /* Actions */
339
340       if (validate_sess($sess)) {
341           log_main("pre garbage_manager UNO");
342           $brisk->garbage_manager(TRUE);
343           log_main("post garbage_manager");
344           if (($user = &$brisk->get_user($sess, &$idx)) != FALSE) {
345               $brisk->sess_cur_set($user->sess);
346               log_main("user stat: ".$user->stat);
347               if ($user->stat == "table") {
348                   $cookies = new Cookies();
349                   $cookies->add("table_token", $user->table_token, $curtime + 31536000);
350                   $cookies->add("table_idx", $user->table, $curtime + 31536000);
351                   $header_out['cookies'] = $cookies;
352                   $header_out['Location'] = "briskin5/index.php";
353                   return TRUE;
354               }
355               $ACTION = "room";
356           }
357       }
358
359       $banned = FALSE;
360       if ($ACTION == "login" && isset($name)) {
361           log_main("pre garbage_manager DUE");
362
363           if (isset($pass_private) == FALSE || $pass_private == "") {
364               $pass_private = FALSE;
365
366               if ($brisk->ban_check($remote_addr)) {
367                   // TODO: find a way to add a nonblocking sleep(5) here
368                   $banned = TRUE;
369                   $idx = -1;
370               }
371           }
372
373           $brisk->garbage_manager(TRUE);
374           /* try login */
375
376           if ($banned == FALSE &&
377               ($user = $brisk->add_user(&$sess, &$idx, $name, $pass_private, $remote_addr, $cookie)) != FALSE) {
378               $brisk->sess_cur_set($user->sess);
379               $ACTION = "room";
380               if ($idx < 0) {
381                   $idx = -$idx - 1;
382                   $is_login = TRUE;
383               }
384
385               log_legal($curtime, $remote_addr, $user, "STAT:LOGIN", '');
386
387               // recovery lost game
388               if ($user->stat == "table") {
389                   $cookies = new Cookies();
390                   $cookies->add("table_token", $user->table_token, $curtime + 31536000);
391                   $cookies->add("table_idx", $user->table, $curtime + 31536000);
392                   $header_out['cookies'] = $cookies;
393                   $header_out['Location'] = "briskin5/index.php";
394                   return TRUE;
395               }
396
397               // setcookie ("sess", "", time() + 180);      
398               $brisk->standup_update(&$user);
399           }
400           else {
401               /* Login Rendering */
402               /* 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." */
403               /*
404                if ($idx == -3)
405                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpasserr'][$G_lang].'</b></div>';
406                else if ($idx == -2)
407                // $body .= '<div class="urgmsg"><b>Il nickname deve contenere almeno una lettera o una cifra.</b></div>';
408                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpassmust'][$G_lang].'</b></div>';
409                else if ($idx == -1)
410                // $body .= '<div class="urgmsg"><b>Spiacenti, non ci sono pi&ugrave; posti liberi. Riprova pi&ugrave; tardi.</b></div>';
411                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpassend'][$G_lang].'</b></div>';
412                else
413                // $body .= '<div class="urgmsg"><b>Il tuo nickname &egrave; gi&agrave; in uso.</b></div>';
414                $body .= '<div class="urgmsg"><b>'.$mlang_room['userpassuse'][$G_lang].'</b></div>';
415               */
416
417               if ($idx == -3)
418                   $sfx = 'err';
419               else if ($idx == -2)
420                   $sfx = 'must';
421               else if ($idx == -1)
422                   $sfx = 'end';
423               else
424                   $sfx = 'use';
425
426               $body .= '<div class="urgmsg"><b>'.$mlang_room['userpass'.$sfx][$G_lang].'</b></div>';
427           }
428       }
429   }
430   /* Rendering. */
431
432   if ($BRISK_SHOWHTML == "debugtable") {
433       $ACTION = "room";
434   }
435   else if ($BRISK_SHOWHTML == "debuglogin") {
436       $ACTION = "login";
437   }
438
439   if ($ACTION == "room") {
440       $tables .= '<div class="room_tab">';
441       $tables .= '<table class="room_tab">';
442       for ($ii = 0 ; $ii < TABLES_N ; $ii++) {
443           if ($user->is_auth())
444               $i = $ii;
445           else
446               $i = TABLES_N - $ii - 1;
447
448           if ($ii % 4 == 0) {
449               $tables .= '<tr id = "tr_noauth'.$ii.'">';
450           }
451           if (TRUE || !($user->flags & USER_FLAG_ISOLAUTH) || $ii < TABLES_AUTH_N) {
452               $tables .= '<td id = "td_noauth'.$ii.'">';
453
454               $tables .= '<div class="room_div"><div class="room_tit"><b>'.$mlang_room['tit_tabl'][$G_lang].$i.'</b></div>';
455               $tables .= sprintf('<div class="proxhr" id="table%d"></div>', $i);
456               $tables .= sprintf('<div class="table_act" id="table_act%d"></div>', $i);
457               $tables .= '</div>';
458               $tables .= '</td>'."\n";
459           }
460           if ($ii % 4 == 3) {
461               $tables .= '</tr>';
462           }
463       }
464       $tables .= '</table></div>';
465
466       $standup .= '<table class="room_standup"><tr><td><div class="room_standup_orig" id="room_standup_orig"></div>';
467       $standup .= '<div class="room_ex_standup">';
468       /* MLANG: "Giocatori in piedi" */
469       // $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>';
470       $standup .= '<div id="room_tit"><span class="room_titin"><b>'.$mlang_room['standing'][$G_lang].'</b></span></div>';
471
472       $standup .= sprintf('<div id="standup" class="room_standup"></div>');
473       // MLANG Esco.
474       $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>';
475       $standup .= '</div></td></tr></table>';
476   }
477   
478   $altout_sponsor_arr = array( array ( 'id' => 'btn_altout',
479                                        'url' => 'http://www.alternativeoutput.it',
480                                        'content' => 'img/altout80x15.png',
481                                        'content_big' => 'img/logotxt_banner.png'),
482                                array ( 'id' => 'btn_virtualsky',
483                                        'url' => 'http://virtualsky.alternativeoutput.it',
484                                        'content' => 'img/virtualsky80x15a.gif',
485                                        'content_big' => 'img/virtualsky_big.png'),
486                                array ( 'id' => 'btn_dynamica',
487                                        'url' => 'http://www.dynamica.it',
488                                        'content' => 'img/dynamica.png',
489                                        'content_big' => 'img/dynamica_big.png')
490                                );
491   
492   $altout_support_arr = array( array ( 'id' => 'btn_brichi',
493                                        'url' => 'http://www.briscolachiamata.it',
494                                        'content' => 'img/brichi.png',
495                                        'content_big' => 'img/brichi_big.png'),
496                                array ( 'id' => 'btn_foroli',
497                                        'url' => 'http://www.forumolimpia.it',
498                                        'content' => 'img/forumolimpia.gif',
499                                        'content_big' => 'img/forumolimpia_big.png' ),
500                                array ( 'id'=> 'btn_niini',
501                                        'url' => 'http://www.niinivirta.it',
502                                        'content' => 'img/niinivirta.png',
503                                        'content_big' => 'img/niinivirta_big.png') );
504   
505   
506   
507   $altout_support = "";
508   $altout_support_big = "";
509   for ($i = 0 ; $i < 4 ; $i++) {
510       $ii = ($i < 3 ? $i : 0);
511       
512       $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>',
513                                  $i * 20, $altout_support_arr[$ii]['url'],
514                                  $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content']);
515       
516       $altout_support_big .= sprintf('<img style="position: absolute;" class="nobohide" id="%s_big" src="%s">',
517                                      $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content_big']);
518   }
519   
520   
521   // seed with microseconds since last "whole" second
522   // srand ((double) microtime() * 1000000);
523   // $randval = rand(0,count($altout_sponsor_arr)-1);
524   $altout_sponsor = "";
525   $altout_sponsor_big = "";
526   for ($i = 0 ; $i < 4 ; $i++) {
527       $ii = ($i < 3 ? $i : 0);
528       
529       $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>',
530                                  $i * 20, $altout_sponsor_arr[$ii]['url'],
531                                  $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content']);
532       
533       $altout_sponsor_big .= sprintf('<img class="nobohide" id="%s_big" src="%s">',
534                                    $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content_big']);
535   }
536   
537   
538   
539   /* NOTE: Brisk donate or donate fake if local */
540   if (!$G_is_local)
541       $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt");
542   else
543       $brisk_donate = '<div style="background-color: #ff0; height: 27px; margin-top: 4px;">BRISK_DONATE</div>';
544
545   if ($brisk_donate == FALSE)
546       $brisk_donate = "";
547   
548   
549   /* MLANG: "briscola chiamata in salsa ajax", */
550   
551   mt_srand(make_seed());
552   if (!$G_is_local) {
553       $rn = rand(0, 1);
554       
555       if ($rn == 0) { 
556           $banner_top_left = '<script type="text/javascript"><!--
557 google_ad_client = "pub-5246925322544303";
558 google_ad_width = 234;
559 google_ad_height = 60;
560 google_ad_format = "234x60_as";
561 google_ad_type = "text_image";
562 google_ad_channel = "";
563 google_color_border = "808080";
564 google_color_bg = "f6f6f6";
565 google_color_link = "ffae00";
566 google_color_text = "404040";
567 google_color_url = "000000";
568 //-->
569 </script>
570 <script type="text/javascript"
571   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
572 </script>';
573           $banner_top_right = carousel_top();
574       }
575       else { 
576           $banner_top_left = carousel_top();
577           $banner_top_right = '<script type="text/javascript"><!--
578 google_ad_client = "pub-5246925322544303";
579 google_ad_width = 234;
580 google_ad_height = 60;
581 google_ad_format = "234x60_as";
582 google_ad_type = "text_image";
583 google_ad_channel = "";
584 google_color_border = "808080";
585 google_color_bg = "f6f6f6";
586 google_color_link = "ffae00";
587 google_color_text = "404040";
588 google_color_url = "000000";
589 //-->
590 </script>
591 <script type="text/javascript"
592   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
593 </script>';
594       }
595   }
596   else { // !$G_is_local
597       $banner_top_left  = carousel_top();
598       $banner_top_right = carousel_top();
599   }
600
601   $brisk_header_form = '<div class="container">
602 <!-- =========== header ===========  -->
603 <div id="header" class="header">
604 <table width="100%%" border="0" cols="3"><tr>
605 <td align="left"><div style="padding-left: 8px;">'.$banner_top_left.'</div></td>
606 <td align="center">'.(($G_with_topbanner || $G_with_donors) ? '<table><tr><td>' : '').'<div style="text-align: center;">
607     <img class="nobo" src="img/brisk_logo64.png">
608     '.$mlang_room['headline'][$G_lang].'<br>
609     </div>'.( ($G_with_topbanner || $G_with_donors) ? sprintf('</td><td>%s</td></tr></table>', 
610                                                                 ($G_with_topbanner ? $G_topbanner : 
611 "<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>
612 <td align="right"><div style="padding-right: 8px;">
613 '.$banner_top_right.'</div></td>
614 </tr></table>
615 </div>';
616
617 /* MLANG: ALL THE VERTICAL MENU */
618   $brisk_vertical_menu = '
619 <!--  =========== vertical menu ===========  -->
620 <div class="topmenu">
621 <!-- <a target="_blank" href="/briskhome.php"></a> -->
622
623 <div class="webstart_hilite">
624 <img class="nobo" style="cursor: pointer;" src="img/brisk_start.png" onmouseover="menu_hide(0,0); menu_show(\'menu_webstart\');">
625 <div class="webstart" id="menu_webstart" onmouseover="menu_over(1,this);" onmouseout="menu_over(-1,this);">
626
627 <a href="#" onmouseover="menu_hide(0,1);" title="'.$mlang_room['tit_help'][$G_lang].'" onclick="act_help();"
628    >'.$mlang_room['itm_help'][$G_lang].'</a><br>
629
630 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php" 
631    onmouseover="menu_hide(0,1);"
632    title="'.$mlang_room['tit_hpage'][$G_lang].'">homepage</a><br>
633
634 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#cose" 
635    onmouseover="menu_hide(0,1);"
636    title="'.$mlang_room['tit_what'][$G_lang].'">'.$mlang_room['itm_what'][$G_lang].'</a><br>
637
638 <a target="_blank" href="'.$mlang_room['url_rules'][$G_lang].'" 
639    onmouseover="menu_hide(0,1);"
640    title="'.$mlang_room['tit_rules'][$G_lang].'">'.$mlang_room['itm_rules'][$G_lang].'</a><br>
641
642 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#shots" 
643    onmouseover="menu_hide(0,1);"
644    title="'.$mlang_room['tit_shot'][$G_lang].'">screenshoots</a><br>
645
646 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#comp" 
647    onmouseover="menu_hide(0,1);"
648    title="'.$mlang_room['tit_comp'][$G_lang].'">'.$mlang_room['itm_comp'][$G_lang].'</a><br>
649
650 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#sources" 
651    onmouseover="menu_hide(0,1);"
652    title="'.$mlang_room['tit_src'][$G_lang].'">'.$mlang_room['itm_src'][$G_lang].'</a><br>
653
654 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#mailing" 
655    onmouseover="menu_hide(0,1);"
656    title="'.$mlang_room['tit_ml'][$G_lang].'">'.$mlang_room['itm_ml'][$G_lang].'</a><br>
657
658 <a target="_blank" href="http://www.alternativeoutput.it/briskhome.php#prop" 
659    onmouseover="menu_hide(0,1);"
660    title="'.$mlang_room['tit_pro'][$G_lang].'">'.$mlang_room['itm_pro'][$G_lang].'</a><br>
661 <a href="#"
662    onmouseover="menu_hide(0,1);"
663    title="credits" onclick="act_about();">about</a><br>
664
665 <a href="mailto:brisk@alternativeoutput.it" 
666    onmouseover="menu_hide(0,1);"
667    title="'.$mlang_room['tit_mail'][$G_lang].'">'.$mlang_room['itm_mail'][$G_lang].'</a><br>
668
669 <hr>
670
671 <!--
672 <a href="#"
673    onmouseover="menu_hide(0,1);"
674    title="perchĆ© supportare brisk?" onclick="act_whysupport();">supportare?</a><br>
675 -->
676 <a href="#"
677    onmouseover="menu_hide(0,1);"
678    title="'.$mlang_room['tit_cla'][$G_lang].'" onclick="act_placing();">'.$mlang_room['itm_cla'][$G_lang].'</a><br>
679
680 <a target="_blank" href="briskin5/explain.php"
681    onmouseover="menu_hide(0,1);"
682    title="'.$mlang_room['tit_mnu'][$G_lang].'">'.$mlang_room['itm_mnu'][$G_lang].'</a><br>
683
684 <a href="#"
685    onmouseover="menu_hide(0,1);"
686    title="'.$mlang_room['tit_rmap'][$G_lang].'" onclick="act_roadmap();">'.$mlang_room['itm_rmap'][$G_lang].'</a><br>
687
688 <a href="#" title="'.$mlang_room['tit_meet'][$G_lang].'" 
689    onmouseover="menu_show(\'menu_meeting\');">'.$mlang_room['itm_meet'][$G_lang].'</a><br>
690
691 <div style="text-align: right;" id="menu_meeting" class="webstart">
692 <a href="http://it-it.facebook.com/event.php?eid=262482143080&index=1"
693    target="_blank" onmouseover="menu_hide(0,2);"
694    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>
695
696 <a href="http://it-it.facebook.com/event.php?eid=165523204539&index=1"
697    target="_blank" onmouseover="menu_hide(0,2);"
698    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>
699
700 <a href="http://it-it.facebook.com/event.php?eid=105699129890&index=1"
701    target="_blank" onmouseover="menu_hide(0,2);"
702    title="BriskMeeting di Parma del 13/09/2009" >Parma 09/09</a><br>
703
704 <a href="http://it-it.facebook.com/event.php?eid=97829048656&index=1"
705    target="_blank" onmouseover="menu_hide(0,2);"
706    title="BriskMeeting di Clusane d\'Iseo del 5/07/2009" >Clusane 07/09</a><br>
707
708 <a href="http://it-it.facebook.com/event.php?eid=103366692570&index=1"
709    target="_blank" onmouseover="menu_hide(0,2);"
710    title="BriskMeeting Siciliano del 14/06/2009" >Catania 06/09</a><br>
711
712 <a href="http://it-it.facebook.com/event.php?eid=81488770852&index=1" 
713    target="_blank" onmouseover="menu_hide(0,2);"
714    title="BriskMeeting di Piacenza del 19/04/2009" >Piacenza 04/09</a><br>
715
716 <a href="http://it-it.facebook.com/event.php?eid=51159131399&index=1" 
717    target="_blank" onmouseover="menu_hide(0,2);"
718    title="BriskMeeting di Parma del 22/02/2009" >Parma 02/09</a><br>
719
720 <a href="http://www.anomalia.it/mop/photoo?album=brisk_pc0806" 
721    target="_blank" onmouseover="menu_hide(0,2);"
722    title="Raduno di Piacenza del del 15/06/2008" >Piacenza 06/08</a><br>
723
724 <a href="http://www.anomalia.it/mop/photoo" 
725    target="_blank" onmouseover="menu_hide(0,2);"
726    title="Torneo di Milano del 17/05/2008" >Milano 05/08</a><br>
727
728 </div>
729 </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\');">
730
731 <div class="webstart" id="menu_commands" onmouseover="menu_over(1,this);" onmouseout="menu_over(-1,this);">
732
733 <a href="#" title="'
734           // MLANG
735           .$mlang_room['tit_stat'][$G_lang].
736 '" 
737    onmouseover="menu_hide(0,1); menu_show(\'menu_state\');">'
738           // MLANG
739           .$mlang_room['stat_desc'][$G_lang].
740 '</a><br>
741 <div id="menu_state" class="webstart">
742 <a href="#"
743    onmouseover="menu_hide(0,2);"
744    title="" onclick="act_chatt(\'/st normale\'); menu_over(-1,this);">'
745           // MLANG
746           .$mlang_room['st_norm_desc'][$G_lang].
747 '</a><br>
748
749 <a href="#"
750    onmouseover="menu_hide(0,2);"
751    title="" onclick="act_chatt(\'/st pausa\'); menu_over(-1,this);">'
752           // MLANG
753           .$mlang_room['st_paus_desc'][$G_lang].
754 '&nbsp;<img class="unbo" src="img/st_pau.png"></a><br>
755
756 <a href="#"
757    onmouseover="menu_hide(0,2);"
758    title="" onclick="act_chatt(\'/st fuori\'); menu_over(-1,this);">'
759           // MLANG
760           .$mlang_room['st_out_desc'][$G_lang].
761 '&nbsp;<img class="unbo" src="img/st_out.png"></a><br>
762
763 <a href="#"
764    onmouseover="menu_hide(0,2);"
765    title="" onclick="act_chatt(\'/st cane\'); menu_over(-1,this);">'
766           // MLANG
767           .$mlang_room['st_dog_desc'][$G_lang].
768 '&nbsp;<img class="unbo" src="img/st_dog.png"></a><br>
769
770 <a href="#"
771    onmouseover="menu_hide(0,2);"
772    title="" onclick="act_chatt(\'/st cibo\'); menu_over(-1,this);">'
773           // MLANG
774           .$mlang_room['st_food_desc'][$G_lang].
775 '&nbsp;<img class="unbo" src="img/st_eat.png"></a><br>
776
777 <a href="#"
778    onmouseover="menu_hide(0,2);"
779    title="" onclick="act_chatt(\'/st lavoro\'); menu_over(-1,this);">'
780           // MLANG
781           .$mlang_room['st_work_desc'][$G_lang].
782 '&nbsp;<img class="unbo" src="img/st_wrk.png"></a><br>
783
784 <a href="#"
785    onmouseover="menu_hide(0,2);"
786    title="" onclick="act_chatt(\'/st sigaretta\'); menu_over(-1,this);">'
787           // MLANG
788           .$mlang_room['st_smok_desc'][$G_lang].
789 '&nbsp;<img class="unbo" src="img/st_smk.png"></a><br>
790
791 <a href="#"
792    onmouseover="menu_hide(0,2);"
793    title="" onclick="act_chatt(\'/st presente\'); menu_over(-1,this);">'
794           // MLANG
795           .$mlang_room['st_pres_desc'][$G_lang].
796 '&nbsp;<img class="unbo" src="img/st_eye.png"></a><br>
797
798 <a href="#"
799    onmouseover="menu_hide(0,2);"
800    title="" onclick="act_chatt(\'/st coniglio\'); menu_over(-1,this);">'
801           // MLANG
802           .$mlang_room['st_rabb_desc'][$G_lang].
803 '&nbsp;<img class="unbo" src="img/st_rabbit.png"></a><br>
804
805 <a href="#"
806    onmouseover="menu_hide(0,2);"
807    title="" onclick="act_chatt(\'/st calcio\'); menu_over(-1,this);">'
808           // MLANG
809           .$mlang_room['st_socc_desc'][$G_lang].
810 '&nbsp;<img class="unbo" src="img/st_soccer.png"></a><br>
811
812 <a href="#"
813    onmouseover="menu_hide(0,2);"
814    title="" onclick="act_chatt(\'/st pupo\'); menu_over(-1,this);">'
815           // MLANG
816           .$mlang_room['st_baby_desc'][$G_lang].
817 '&nbsp;<img class="unbo" src="img/st_baby.png"></a><br>
818
819 <a href="#"
820    onmouseover="menu_hide(0,2);"
821    title="" onclick="act_chatt(\'/st pulizie\'); menu_over(-1,this);">'
822           // MLANG
823           .$mlang_room['st_mop_desc'][$G_lang].
824 '&nbsp;<img class="unbo" src="img/st_mop.png"></a><br>
825
826 <a href="#"
827    onmouseover="menu_hide(0,2);"
828    title="" onclick="act_chatt(\'/st babbo\'); menu_over(-1,this);">'
829           // MLANG
830           .$mlang_room['st_babbo_desc'][$G_lang].
831 '&nbsp;<img class="unbo" src="img/st_babbo.png"></a><br>
832
833 <a href="#"
834    onmouseover="menu_hide(0,2);"
835    title="" onclick="act_chatt(\'/st renna\'); menu_over(-1,this);">'
836           // MLANG
837           .$mlang_room['st_renna_desc'][$G_lang].
838 '&nbsp;<img class="unbo" src="img/st_renna.png"></a><br>
839
840 <a href="#"
841    onmouseover="menu_hide(0,2);"
842    title="" onclick="act_chatt(\'/st pupazzo\'); menu_over(-1,this);">'
843           // MLANG
844           .$mlang_room['st_pupaz_desc'][$G_lang].
845 '&nbsp;<img class="unbo" src="img/st_pupaz.png"></a><br>
846
847 <a href="#"
848    onmouseover="menu_hide(0,2);"
849    title="" onclick="act_chatt(\'/st vischio\'); menu_over(-1,this);">'
850           // MLANG
851           .$mlang_room['st_visch_desc'][$G_lang].
852 '&nbsp;<img class="unbo" src="img/st_visch.png"></a><br>
853
854 </div>
855
856 <a href="#" title="avvia un ticker pubblicitario per il tuo tavolo" 
857    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>
858
859 <a href="#" title="'
860           // MLANG garantisci per un tuo conoscente
861           .$mlang_room['warr_desc'][$G_lang].
862 '" 
863    onmouseover="menu_hide(0,1);" onclick="act_chatt(\'/authreq\'); menu_over(-1,this);">'
864           // MLANG garantisci
865           .$mlang_room['itm_warr'][$G_lang].
866           '</a><br>
867
868
869
870 <a href="#" title="'
871           // MLANG garantisci per un tuo conoscente
872           .$mlang_room['splash_desc'][$G_lang].
873 '" 
874    onmouseover="menu_hide(0,1);" onclick="act_splash(); menu_over(-1,this);">'
875           // MLANG garantisci
876           .$mlang_room['tit_splash'][$G_lang].
877           '</a><br>
878 '.($user->is_auth() ? '
879 <a href="#" title="'
880           // MLANG garantisci per un tuo conoscente
881           .$mlang_room['prefs_desc'][$G_lang].'"
882    onmouseover="menu_hide(0,1);" onclick="$(\'preferences\').style.visibility = \'visible\'; menu_over(-1,this);">'
883           // MLANG garantisci
884    .$mlang_room['tit_prefs'][$G_lang].'</a><br>' : '').'
885
886 </div>'.($G_with_poll ? '' : '<div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
887 <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();">').'
888 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
889 '.($user->flags & USER_FLAG_AUTH ? '
890 <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()
891  : '
892 <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();">
893 ').'
894
895 ' : '').'
896
897 </div>
898 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
899 sponsored by:<br>
900 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 4px; font-size: 1px;"></div>
901 <div id="spon_caro" style="overflow: hidden; height: 18px; /* border: 1px solid red; */ ">
902 <div style="/*background-color: green; */ text-align: left; position: relative; padding: 0px; margin: 0px; top: 0px; height: 80px;">'.$altout_sponsor.'<br>
903 </div></div>
904 <div style="position: absolute;">
905 '.$altout_sponsor_big.'
906 </div>
907 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 8px; font-size: 1px;"></div>
908 supported by:<br>
909 <div style="padding: 0px; margin: 0px; witdh: 50px; height: 4px; font-size: 1px;"></div>
910 <div id="supp_caro" style="overflow: hidden; height: 18px; /* border: 1px solid red; */">
911 <div style="/* background-color: green; */ text-align: left; position: relative; padding: 0px; margin: 0px; top: 0px; height: 80px;">'.$altout_support.'<br> 
912
913 </div>
914 </div>
915 <div style="position: absolute;">
916 '.$altout_support_big.'
917 </div>
918 <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>
919 ' . ( /* NOTE: here facebook or fake facebook */
920 ! $G_is_local ?
921 '<div class="fb-like" style="margin-top: 4px;" data-href="https://www.facebook.com/pages/Brisk-briscola-chiamata-in-salsa-ajax/716026558416911" data-share="false" data-send="true" data-width="70" data-show-faces="false" data-colorscheme="dark" layout="button_count"></div>
922 ' : '<div style="margin-top: 4px; height: 20px; background-color: #00f;">FACEBOOK HERE</div>
923 ' ) . '<div id="proflashext" class="proflashext"><div id="proflash" class="proflash"></div></div>
924 <img id="stm_stat" class="nobo" style="margin-top: 4px;" src="img/line-status_b.png">
925 %s
926 %s
927 </div>';
928     
929   /* Templates. */
930   if ($ACTION == 'login') {
931       $header_out['Content-type'] = "text/html; charset=\"utf-8\"";
932 ?>
933 <html>
934 <head>
935 <title>Brisk</title>
936 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
937 <link rel="shortcut icon" href="img/brisk_ico.png">
938 <script type="text/javascript" src="commons.js"></script> 
939 <script type="text/javascript" src="prefs.js"></script>
940 <!-- <script type="text/javascript" src="myconsole.js"></script> -->
941 <script type="text/javascript" src="menu.js"></script>
942 <script type="text/javascript" src="heartbit.js"></script>
943 <script type="text/javascript" src="xynt-streaming.js"></script>
944 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
945 <script type="text/javascript" src="AC_OETags.js"></script>
946 <script type="text/javascript" src="room.js"></script>
947 <script type="text/javascript" src="md5.js"></script>
948 <script type="text/javascript" src="probrowser.js"></script>
949 <script type="text/javascript" src="json2.js"></script>
950 <link rel="stylesheet" type="text/css" href="brisk.css">
951 <link rel="stylesheet" type="text/css" href="room.css">
952
953 <SCRIPT type="text/javascript"><!--
954    var g_debug = 0;
955    var g_lang = "<? echo $G_lang; ?>";
956    var g_lng = "<? echo $G_lng; ?>";
957    var g_tables_n = <? echo TABLES_N; ?>;
958    var g_tables_auth_n = <? echo TABLES_AUTH_N; ?>;
959    var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
960    var g_prefs, g_prefs_new = null;
961    var g_listen;
962    var g_withflash = false;
963    var g_is_spawn = 0;
964    var g_nd = null;
965    var g_brow = null;
966    var gst  = new globst();
967    var topbanner_sfx, topbanner_dx;
968    var xstm = null;
969    var sess = "not_connected";
970    var spo_slide, sup_slide;
971
972    window.onload = function() {
973      // alert(window.onbeforeunload);
974      g_brow = get_browser_agent();
975
976      g_prefs = new client_prefs(null);
977
978      spo_slide  = new sideslide($('spon_caro'), 80, 20);
979      sup_slide  = new sideslide($('supp_caro'), 80, 20);
980
981      login_init();
982 <?php
983      if ($G_with_topbanner) {
984        printf("     topbanner_init();\n");
985      }
986      sidebanners_init($G_sidebanner_idx);
987 ?>
988
989      g_withflash = DetectFlashVer(6,0,0);
990      if (g_withflash == false) {
991        $("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>';
992      }
993      else
994        $("proflashext").innerHTML = "";
995      $("nameid").focus();
996    }
997    //-->
998 </SCRIPT>
999 </head>
1000 <?php
1001     if (!$G_is_local) {
1002 ?>
1003 <!-- if myconsole <body onunload="deconsole();"> -->
1004 <body xmlns:fb="http://ogp.me/ns/fb#">
1005 <div id="fb-root"></div>
1006 <script>(function(d, s, id) {
1007   var js, fjs = d.getElementsByTagName(s)[0];
1008   if (d.getElementById(id)) return;
1009   js = d.createElement(s); js.id = id;
1010   js.src = "//connect.facebook.net/it_IT/all.js#xfbml=1";
1011   fjs.parentNode.insertBefore(js, fjs);
1012 }(document, 'script', 'facebook-jssdk'));</script>
1013 <?php
1014     }
1015     else {
1016 ?>
1017 <body>
1018 <?php
1019   }
1020 ?>
1021 <?php
1022     printf($brisk_header_form);
1023     printf("<table class=\"floaty\"><tr><td class=\"floatyleft\">\n");
1024     printf($brisk_vertical_menu, '', '');
1025
1026     sidebanners_render($G_sidebanner, $G_sidebanner_idx);
1027    printf("</td><td>");
1028 ?> 
1029
1030 <!--  =========== tables ===========  -->
1031 <?php
1032
1033 /* 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)" */
1034 echo "$body"; ?>
1035 <br>
1036 <div style="text-align: center;">
1037    <br><br><br>
1038 <?php echo $mlang_room['welcome'][$G_lang];?>
1039 <br><br>
1040 <form accept-charset="utf-8" method="post" action="" onsubmit="return j_login_manager(this);">
1041 <input id="passid_private" name="pass_private" type="hidden" value="">
1042 <table class="login">
1043 <tr><td>user:</td>
1044 <td><input id="nameid" class="input_text" name="name" type="text" size="24" maxlength="12" value=""></td></tr>
1045 <tr><td>pwd:</td>
1046 <td><input id="passid" class="input_text" name="pass" type="password" size="24" maxlength="64" value=""></td></tr>
1047 <tr><td colspan="2"><input id="sub" value="<?php echo $mlang_room['btn_enter'][$G_lang];?>" type="submit" class="button"></td></tr>
1048 </table>
1049 </form><br>
1050 <b><?php echo $mlang_room['passwarn'][$G_lang];?></b><br><br>
1051 <?php echo $mlang_room['browwarn'][$G_lang];?><br>
1052 </div>
1053 <br><br><br><br>
1054 <br><br><br><br>
1055 <br><br><br><br>
1056 <br><br><br><br>
1057 <br><br><br><br>
1058
1059 <div id="imgct"></div>
1060 <div id="logz"></div>
1061 <div id="sandbox"></div>
1062 <div id="sandbox2"></div>
1063 <div id="response"></div>
1064 <div id="xhrstart"></div>
1065 <pre>
1066 <div id="xhrlog"></div>
1067 </pre>
1068 <div id="xhrdeltalog"></div>
1069 </body>
1070 </html>
1071 <?php
1072   }
1073   else if ($ACTION == 'room') {
1074       $header_out['Content-type'] = "text/html; charset=\"utf-8\"";
1075   ?>
1076 <html>
1077 <head>
1078 <title>Brisk</title>
1079 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1080 <link rel="shortcut icon" href="img/brisk_ico.png">
1081 <script type="text/javascript" src="commons.js"></script>
1082 <script type="text/javascript" src="prefs.js"></script>
1083 <!-- <script type="text/javascript" src="myconsole.js"></script> -->
1084 <script type="text/javascript" src="menu.js"></script>
1085 <script type="text/javascript" src="ticker.js"></script>
1086 <script type="text/javascript" src="heartbit.js"></script>
1087 <script type="text/javascript" src="xynt-streaming.js"></script>
1088 <script type="text/javascript" src="room.js"></script>
1089 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
1090 <script type="text/javascript" src="AC_OETags.js"></script>
1091 <script type="text/javascript" src="probrowser.js"></script>
1092 <script type="text/javascript" src="json2.js"></script>
1093 <link rel="stylesheet" type="text/css" href="brisk.css">
1094 <link rel="stylesheet" type="text/css" href="room.css">
1095 <SCRIPT type="text/javascript"><!--
1096    var sess = "not_connected";
1097    var g_debug = 0;
1098    var g_lang = "<? echo $G_lang; ?>";
1099    var g_lng = "<? echo $G_lng; ?>";
1100    var g_tables_n = <? echo TABLES_N; ?>;
1101    var g_tables_auth_n = <? echo TABLES_AUTH_N; ?>;
1102    var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
1103    var g_prefs, g_prefs_new = null;
1104    var g_listen;
1105    var g_is_spawn = 0;
1106    var g_withflash = false;
1107    var g_imgct = 0;
1108    var g_imgtot = g_preload_img_arr.length;
1109    var g_brow = null;
1110    var g_nd = null;
1111    var tra = null;
1112    var stat = "";
1113    var subst = "";
1114    var gst  = new globst();
1115    var topbanner_sfx, topbanner_dx;
1116    // var nonunload = false;
1117    var spo_slide, sup_slide;
1118
1119    window.onload = function() {
1120      g_brow = get_browser_agent();
1121
1122      g_prefs = new client_prefs(null);
1123
1124      spo_slide  = new sideslide($('spon_caro'), 80, 20);
1125      sup_slide  = new sideslide($('supp_caro'), 80, 20);
1126
1127 <?php
1128 if ($BRISK_SHOWHTML == "debugtable") {
1129 ?>
1130      room_checkspace(12, <?php echo TABLES_N; ?>, 50);
1131 <?php
1132 }
1133 else {
1134 ?>
1135     // alert("INDEX START");
1136      menu_init();
1137 <?php
1138      if ($G_with_topbanner) {
1139        printf("     topbanner_init();\n");
1140      }
1141      sidebanners_init($G_sidebanner_idx);
1142 ?>
1143      sess = "<?php echo "$sess"; ?>";
1144 xstm = new xynt_streaming(window, "<?php echo "$transp_type"; ?>", 80, 2, null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
1145      xstm.hbit_set(heartbit);
1146      tra = new train($('room_tit'));
1147      window.onunload = onunload_cb;
1148      window.onbeforeunload = onbeforeunload_cb;
1149      g_withflash = DetectFlashVer(6,0,0);
1150      if (g_withflash == false) {
1151        $("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>';
1152      }
1153      else
1154        $("proflashext").innerHTML = "";
1155
1156      // console.log("session from main: "+sess);
1157      xstm.start();
1158      // alert("ARR LENGTH "+g_preload_img_arr.length);
1159      // FIXME: preload image will be fired by stream instead here
1160      // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
1161      $("txt_in").focus();
1162 <?php
1163 if ($is_login) {
1164   /* 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" */
1165   echo show_notify($mlang_room['regwarn'][$G_lang], 0, $mlang_room['btn_rettabs'][$G_lang], 400, 150);
1166 }
1167 ?>
1168 <?php
1169 }
1170 ?>
1171    }
1172    //-->
1173 </SCRIPT>
1174 </head>
1175 <?php
1176     if (!$G_is_local) {
1177 ?>
1178 <!-- if myconsole <body onunload="deconsole();"> -->
1179 <body xmlns:fb="http://ogp.me/ns/fb#">
1180 <div id="fb-root"></div>
1181 <script>(function(d, s, id) {
1182   var js, fjs = d.getElementsByTagName(s)[0];
1183   if (d.getElementById(id)) return;
1184   js = d.createElement(s); js.id = id;
1185   js.src = "//connect.facebook.net/it_IT/all.js#xfbml=1";
1186   fjs.parentNode.insertBefore(js, fjs);
1187 }(document, 'script', 'facebook-jssdk'));</script>
1188 <?php
1189     }
1190     else {
1191 ?>
1192 <body>
1193 <?php
1194   }
1195 ?>
1196 <?php
1197    printf($brisk_header_form);
1198    printf("<table class=\"floaty\"><tr><td class=\"floatyleft\">\n");
1199    printf($brisk_vertical_menu, '', $brisk_donate);
1200
1201    sidebanners_render($G_sidebanner, $G_sidebanner_idx);
1202
1203    printf("</td><td>");
1204 ?>
1205 <!--  =========== tables ===========  -->
1206 <input name="sess" type="hidden" value="<?php echo "$user->sess"; ?>">
1207 <table class="macro"><tr><td>
1208 <?php echo "$tables"; ?>
1209 </td></tr><tr><td>
1210     <?php echo "$standup"; ?>
1211 </td></tr></table>
1212 </td></tr></table>
1213
1214 <!--  =========== bottom ===========  -->
1215     <div id="bottom" class="bottom">
1216 <b>Chat</b> <span id="list_info" style="color: red;"></span><br>
1217 <div id="txt" class="chatt">
1218 </div>
1219 <div style="text-align: center; ">
1220     <!-- MLANG: scrivi un invito al tavolo e clicca -->
1221     <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;">
1222     <div id="myname"></div>
1223     </td><td>
1224     <input id="txt_in" maxlength="128" type="text" style="width: 100%;" onkeypress="chatt_checksend(this,event);">
1225     </td></tr></table>
1226 </div>
1227 </div>
1228
1229     <div id="authbox" class="notify" style="text-align: center;">
1230        <br>
1231        <b>
1232     <!-- MLANG: Garantisci per un tuo conoscente: -->
1233     <?php echo $mlang_room['tit_warr'][$G_lang]; ?>
1234 </b>
1235        <br><br>
1236
1237        <form id="auth_form" accept-charset="utf-8" method="post" action="" onsubmit="return j_authbox(this);">
1238        <input type="hidden" name="realsub" value="666">
1239 <table class="login">
1240 <tr><td>nickname:</td>
1241 <td><input id="nameid" class="input_text" name="name" type="text" size="24" maxlength="12" value=""></td></tr>
1242 <tr><td>e-mail:</td>
1243 <td><input id="emailid" class="input_text" name="email" type="text" size="24" maxlength="1024" value=""></td></tr>
1244 <tr><td colspan="2" style="text-align: center;">
1245     <!-- MLANG: Garantisci per un tuo conoscente: -->
1246        <input id="subid" name="sub" value=
1247 "<?php echo $mlang_room['btn_send'][$G_lang]; ?>"
1248  type="submit" onclick="this.form.elements['realsub'].value = 'invia';" class="button">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1249     <!-- MLANG: Garantisci per un tuo conoscente: -->
1250 <input id="cloid" name="clo" value=
1251 "<?php echo $mlang_room['btn_close'][$G_lang]; ?>" 
1252 type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chiudi';"></td></tr>
1253 </table>
1254     </form>
1255     </div>
1256     <div id="mesgtoadmbox" class="notify_opaque" style="text-align: center;">
1257        <br>
1258 <!--MLANG: Invia un messaggio o una segnalazione all\'amministratore: -->
1259        <b><?php echo $mlang_room['mesgtoadm_tit'][$G_lang];?></b>
1260        <br><br>
1261        <form id="mesgtoadm_form" accept-charset="utf-8" method="post" action="" onsubmit="return j_mesgtoadmbox(this);">
1262        <input type="hidden" name="realsub" value="666">
1263 <table class="login">
1264 <!--MLANG: soggetto -->
1265 <tr><td><b><?php echo $mlang_room['mesgtoadm_sub'][$G_lang];?></b></td>
1266 <td><input id="subjid" class="input_text" name="subj" type="text" size="32" maxlength="255" value=""></td></tr></table>
1267 <table class="login">
1268 <tr><td><img title="messaggio" class="nobo" src="img/mesgtoadm_mesg<?php echo $G_lng;?>.png"></td>
1269 <td><textarea id="mesgid" class="input_text" name="mesg" cols="40" rows="8" wrap="soft"></textarea></td></tr>
1270 <tr><td colspan="2" style="text-align: center;">
1271        <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;
1272 <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>
1273 </table>
1274     </form>
1275     </div>
1276 <div id="heartbit"></div>
1277 <div id="sandbox"></div>
1278 <div id="imgct"></div>
1279 <div id="logz"></div>
1280 <div id="sandbox2"></div>
1281 <div id="response"></div>
1282 <div id="remark"></div>
1283 <div id="xhrstart"></div>
1284 <div id="xhrlog"></div>
1285 <div id="xhrdeltalog"></div>
1286 </div>
1287 <div id="preferences" class="notify" style="z-index: 200; width: 600px; margin-left: -300px; height: 240px; top: 150px; visibility: hidden;">
1288 <div id="preferences_child" style="border-bottom: 1px solid gray; overflow: auto; height: 370px;">
1289
1290 <h2><?php echo $mlang_room['tit_prefs'][$G_lang]; ?></h2>
1291 <table style="margin: auto;"><tr><td style="vertical-align: top;">
1292 <!--#
1293     #  LISTEN
1294     #-->
1295 <div style="float: left; padding: 8px;">
1296 <table style="border: 1px solid gray;"><tr><th style="background-color: #cccccc;">
1297 <?php echo $mlang_room['itm_list'][$G_lang];?>
1298 </th></tr>
1299 <tr><td><input style="vertical-align: bottom;" id="ra_listen_all" type="radio" name="listen" value="0" onclick="prefs_update('listen');" title="'
1300 <?php echo $mlang_room['listall_desc'][$G_lang];?>
1301 '"><span id="list_all">
1302 <?php echo $mlang_room['tit_listall'][$G_lang];?>
1303 </span></td></tr>
1304 <tr><td><input style="vertical-align: bottom;" id="ra_listen_auth" type="radio" name="listen" value="1" onclick="prefs_update('listen');" title="'
1305 <?php echo $mlang_room['listaut_desc'][$G_lang];?>
1306 '"><span id="list_auth">
1307 <?php echo $mlang_room['tit_listaut'][$G_lang];?>
1308 </span></td></tr>
1309 <tr><td><input style="vertical-align: bottom;" id="ra_listen_isol" type="radio" name="listen" value="2" onclick="prefs_update('listen');" title="'
1310 <?php echo $mlang_room['listisol_desc'][$G_lang];?>
1311 '"><span id="list_isol">
1312 <?php echo $mlang_room['tit_listisol'][$G_lang];?>
1313 </span></td></tr>
1314 </table>
1315 </div>
1316 <?php
1317 if ($user->is_supp_custom()) {
1318 ?>
1319 </td>
1320 <td style="vertical-align: top;">
1321 <!--#
1322     #  SUPPORTER ONLY
1323     #-->
1324 <div style="float: left; padding: 8px;">
1325 <table style="border: 1px solid gray;"><tr><th colspan="4" style="background-color: #cccccc;">
1326 <?php echo $mlang_room['suppcomp_tit'][$G_lang];?>
1327 </th></tr>
1328 <tr>
1329 <th>
1330 <?php echo $mlang_room['suppcomp_fg'][$G_lang];?>
1331 </th><td><input style="width: 3em;" id="s_fg_r" type="text" maxlength="3" size="3" name="s_fg_r"
1332  onchange="prefs_update('supp');" value="255"
1333  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1334    <span id="list_all"><?php echo $mlang_room['suppcomp_r'][$G_lang];?></span></td>
1335 <td><input style="width: 3em;" id="s_fg_g" type="text" maxlength="3" size="3" name="s_fg_g"
1336  onchange="prefs_update('supp');" value="255"
1337  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1338    <span id="list_all"><?php echo $mlang_room['suppcomp_g'][$G_lang];?></span></td>
1339 <td><input style="width: 3em;" id="s_fg_b" type="text" maxlength="3" size="3" name="s_fg_b"
1340  onchange="prefs_update('supp');" value="255"
1341  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1342    <span id="list_all"><?php echo $mlang_room['suppcomp_b'][$G_lang];?></span></td>
1343 </tr>
1344 <tr>
1345 <th>
1346 <?php echo $mlang_room['suppcomp_bg'][$G_lang];?>
1347 </th>
1348 <td><input style="width: 3em;" id="s_bg_r" type="text" maxlength="3" size="3" name="s_bg_r"
1349  onchange="prefs_update('supp');" value="255"
1350  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1351    <span id="list_all"><?php echo $mlang_room['suppcomp_r'][$G_lang];?></span></td>
1352 <td><input style="width: 3em;" id="s_bg_g" type="text" maxlength="3" size="3" name="s_bg_g"
1353  onchange="prefs_update('supp');" value="255"
1354  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1355    <span id="list_all"><?php echo $mlang_room['suppcomp_g'][$G_lang];?></span></td>
1356 <td><input style="width: 3em;" id="s_bg_b" type="text" maxlength="3" size="3" name="s_bg_b"
1357  onchange="prefs_update('supp');" value="255"
1358  title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
1359    <span id="list_all"><?php echo $mlang_room['suppcomp_b'][$G_lang];?></span></td>
1360 </tr>
1361 <tr><td colspan="4" style="text-align: center;">
1362 <img id="s_img" class="nobo" src="img/noimg.png">
1363 </td></tr>
1364 </table>
1365 </div>
1366 </td>
1367 <td>
1368 <?php
1369 }
1370 else {
1371 ?>
1372 <input id="s_fg_r" type="hidden" name="s_fg_r">
1373 <input id="s_fg_g" type="hidden" name="s_fg_g">
1374 <input id="s_fg_b" type="hidden" name="s_fg_b">
1375 <input id="s_bg_r" type="hidden" name="s_bg_r">
1376 <input id="s_bg_g" type="hidden" name="s_bg_g">
1377 <input id="s_bg_b" type="hidden" name="s_bg_b">
1378 <input id="s_img"  type="hidden" name="s_bg_b">
1379 <?php
1380 }
1381 ?>
1382 </td></tr></table>
1383 <div style="width: 95%; /* background-color: red; */ margin: auto; text-align: left;">
1384 <br><br>
1385                                                           <!-- <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]; */ ?> -->
1386 </div>
1387
1388
1389 </div>
1390 <div class="notify_clo">
1391 <input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('preferences').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_prefs_close'][$G_lang]; ?>"/> 
1392 <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_reset();" value="<?php echo $mlang_room['btn_prefs_reset'][$G_lang]; ?>"/>
1393 <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_save();" value="<?php echo $mlang_room['btn_prefs_save'][$G_lang]; ?>"/>
1394 </div>
1395 </div>
1396 </body>
1397 </html>
1398 <?php
1399    }
1400 }
1401
1402 ?>