$G_false = FALSE;
$G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "2.1.2 - trusty";
+$G_brisk_version = "2.1.3 - trusty";
-$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: Autenticazione, tavoli riservati e ban efficaci.',
+$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: Garanzia dal sito e stato degli utenti (guarda l\'help).',
'Se vuoi iscriverti alla <a target="_blank" href="http://www.milug.org/cgi-bin/mailman/listinfo/ml-briscola">Mailing List</a>, cliccala!' );
$table_wellarr = Array ( 'Benvenuto al tavolo. Se almeno tre giocatori non sbloccano l\'uscita cliccando il lucchetto, chi esce non può risedersi a un qualunque tavolo per '.floor(BAN_TIME/60).' minuti.');
<dt><b>Comandi della chat</b>
<dd><b>/nick <i><nuovo_nickname></i></b> - cambio di nickname
<dd><b>/tav <i><frase di invito></i></b> - invito per gli altri giocatori al tavolo dove si è seduti
+<dd><b>/st <i><stato></i></b> - cambia l\'icona associata al tuo user; <i>stato</i> può valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\" oppure \\"sigaretta\\"
+<dd><b>/garante</b> - se si è autenticati permette di garantire per un utente fidato
</dl>
</div>
';
+//
+
$G_room_about= '<br>
<div id=\\"header\\" class=\\"header\\">
<img class=\\"nobo\\" src=\\"img/brisk_logo64.png\\">
return (str_replace($from, $to, htmlentities($s,ENT_COMPAT,"UTF-8")));
}
+function xcapelt($s)
+{
+ $from = array ( '\\', '|' );
+ $to = array ( '\\\\', '\\|' );
+
+ return (str_replace($from, $to, $s));
+}
class Card {
var $value; /* 0 - 39 card value */
// User flags
define(USER_FLAG_AUTH, 0x02);
+// user status
+define(USER_FLAG_S_NORM, 0x000); // done
+define(USER_FLAG_S_PAU, 0x100); // done
+define(USER_FLAG_S_OUT, 0x200); // done
+define(USER_FLAG_S_DOG, 0x300); // done
+define(USER_FLAG_S_EAT, 0x400); // done
+define(USER_FLAG_S_WRK, 0x500); // done
+define(USER_FLAG_S_SMK, 0x600); // done
+
+define(USER_FLAG_S_ALL, 0xf00); // done
+
class User {
var $name; // name of the user
var $sess; // session of the user
$to_all = show_notify($msg, 0, "chiudi", 400, 120);
} while (0);
} // /alarm chat command
-
+ else if (strncmp($msg, "/garante", 8) == 0) {
+ if ($user->flags & USER_FLAG_AUTH) {
+ $to_user = sprintf('authbox(300,200);');
+ }
+ else {
+ $to_user = sprintf('chatt_sub("%s", [2, "%s"],"<b>Per autenticare qualcuno devi a tua volta essere autenticato.</b>");', $dt, NICKSERV);
+ }
+ }
else if (strncmp($msg, "/nick ", 6) == 0) {
log_main("chatt_send BEGIN");
} while (0);
} // nick chat command
+ else if (strncmp($msg, "/st ", 4) == 0) {
+ log_main("chatt_send BEGIN");
+
+ do {
+ $st_str = substr($msg, 4);
+
+ if (strcasecmp($st_str, "normale") == 0) {
+ $st = USER_FLAG_S_NORM;
+ }
+ else if (strcasecmp($st_str, "pausa") == 0) {
+ $st = USER_FLAG_S_PAU;
+ }
+ else if (strcasecmp($st_str, "fuori") == 0) {
+ $st = USER_FLAG_S_OUT;
+ }
+ else if (strcasecmp($st_str, "cane") == 0) {
+ $st = USER_FLAG_S_DOG;
+ }
+ else if (strcasecmp($st_str, "cibo") == 0) {
+ $st = USER_FLAG_S_EAT;
+ }
+ else if (strcasecmp($st_str, "lavoro") == 0) {
+ $st = USER_FLAG_S_WRK;
+ }
+ else if (strcasecmp($st_str, "sigaretta") == 0) {
+ $st = USER_FLAG_S_SMK;
+ }
+ else {
+ $to_user = sprintf('chatt_sub("%s", [2,"%s"],"Questo stato non esiste.");', $dt, NICKSERV);
+ break;
+ }
+
+ log_main("chatt_send start set");
+ if (($user->flags & USER_FLAG_S_ALL) != $st) {
+ $update_room = TRUE;
+ $user->flags = ($user->flags & ~USER_FLAG_S_ALL) | $st;
+ }
+ } while (0);
+ } // nick chat command
+
else { // normal chat line
if ($curtime < ($user->chat_ban + $user->chat_dlt)) {
$only_you = TRUE;
return ($shm_sz);
}
+class Warrant {
+ function lock_data()
+ {
+ GLOBAL $sess;
+
+ if (($tok = @ftok(FTOK_PATH."/warrant", "B")) == -1) {
+ echo "FTOK FAILED";
+ exit;
+ }
+ // echo "FTOK ".$tok."<br>";
+ if (($res = sem_get($tok)) == FALSE) {
+ echo "SEM_GET FAILED";
+ exit;
+ }
+ if (sem_acquire($res)) {
+ log_lock("LOCK room");
+ return ($res);
+ }
+ else
+ return (FALSE);
+ }
+
+ function unlock_data($res)
+ {
+ GLOBAL $sess;
+
+ log_lock("UNLOCK room");
+
+ return (sem_release($res));
+ }
+
+}
?>
*/
+function state_add(flags)
+{
+ var content = "";
+ var st, name = "";
+ var tit = "";
+
+ if ((flags & 0xf00) != 0) {
+ st = flags & 0xf00;
+ switch (st) {
+ case 0x100:
+ name = "st_pau.png";
+ tit = "in pausa";
+ break;
+ case 0x200:
+ name = "st_out.png";
+ tit = "fuori";
+ break;
+ case 0x300:
+ name = "st_dog.png";
+ tit = "cane a spasso";
+ break;
+ case 0x400:
+ name = "st_eat.png";
+ tit = "a mangiare";
+ break;
+ case 0x500:
+ name = "st_wrk.png";
+ tit = "a lavoro";
+ break;
+ case 0x600:
+ name = "st_smoke.png";
+ tit = "si sta fumando una sigaretta (e facendosi venire il cancro)";
+ break;
+ default:
+ break;
+ }
+ if (name != "") {
+ content += '<img title="'+tit+'" class="unbo" src="img/'+name+'">';
+ }
+ }
+
+ return content;
+}
+
function j_stand_cont(data)
{
var i;
var content;
+ var st, name = "";
content = '<table cols="'+(data.length < 4 ? data.length : 4)+'" class="table_standup">';
for (i = 0 ; i < data.length ; i++) {
if (data[i][0] & 0x01)
content += '</b>';
+ content += state_add(data[i][0]);
content += '</td>';
if ((i % 4) == 3)
if (data[i][0] & 0x01)
content += '</b>';
+ content += state_add(data[i][0]);
content += '<br>';
}
else {
// console.log("richiesta token");
/* richiede token */
- token = server_request('getchallenge|'+encodeURIComponent(form.elements['nameid'].value));
+ token = server_request('mesg', 'getchallenge', 'cli_name', encodeURIComponent(form.elements['nameid'].value));
tokens = token.split('|');
// console.log('XX token: '+token);
menu_init();
login_formtext_hilite();
}
+
+function warrant_formtext_hilite()
+{
+ formtext_hilite($("nameid"));
+ formtext_hilite($("emailid"));
+ formsub_hilite($("subid"));
+ formsub_hilite($("cloid"));
+}
+
+
+function j_check_email(email)
+{
+ if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
+ return (true);
+ return (false);
+}
+
+function j_authbox(form)
+{
+ var no;
+
+ if (form.elements['realsub'].value == "chiudi") {
+ $('authbox').style.visibility = "hidden";
+ return (false);
+ }
+
+ if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false)
+ no = new notify(gst, "<br>I campi user e/o e-mail non sono validi;</br> correggeteli per favore.", 1, "chiudi", 280, 100);
+ else {
+ // submit the request
+ token = server_request('mesg', 'warranty',
+ 'cli_name', encodeURIComponent(form.elements['name'].value),
+ 'cli_email', encodeURIComponent(form.elements['email'].value) );
+ if (token == "1") {
+ $('authbox').style.visibility = "hidden";
+ form.elements['name'].value = "";
+ form.elements['email'].value = "";
+ return (false);
+ }
+ }
+
+ return (false);
+}
+
+function authbox(w, h)
+{
+ var box;
+
+ box = $('authbox');
+
+ box.style.zIndex = 200;
+ box.style.width = w+"px";
+ box.style.marginLeft = -parseInt(w/2)+"px";
+ box.style.height = h+"px";
+ box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop;
+
+ warrant_formtext_hilite();
+
+ box.style.visibility = "visible";
+ $("nameid").focus();
+}