From: Matteo Nastasi Date: Sat, 8 Jan 2011 14:49:33 +0000 (+0100) Subject: allignment pre merge in master X-Git-Tag: 3.0.0~4 X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=brisk.git;a=commitdiff_plain;h=bdb3cb2379f32bfb9279da661b1d4dbaf9712299 allignment pre merge in master --- diff --git a/INSTALL.sh b/INSTALL.sh index 862f27f..6b3e35c 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -6,7 +6,7 @@ players_n=3 tables_n=16 tables_auth_n=6 -brisk_auth_conf="brisk_auth.conf.pho" +brisk_auth_conf="brisk_auth2.conf.pho" brisk_debug="0xffff" web_path="$HOME/brisk" legal_path="$HOME/brisk-priv" @@ -15,8 +15,8 @@ proxy_path="$HOME/brisk-priv/proxy" web_only="FALSE" brisk_conf="brisk.conf.pho" -if [ -f $HOME/.trusty_install ]; then - . $HOME/.trusty_install +if [ -f $HOME/.brisk_install ]; then + . $HOME/.brisk_install fi if [ "x$cookie_path" = "x" ]; then cookie_path=$web_path diff --git a/web/Obj/auth.phh b/web/Obj/auth.phh index 5f4426d..fd209c9 100644 --- a/web/Obj/auth.phh +++ b/web/Obj/auth.phh @@ -277,13 +277,36 @@ class LoginDBItem { var $login; var $pass; var $email; + var $type; - function LoginDBItem($login, $pass, $email) + function LoginDBItem($login, $pass, $email, $type) { $this->login = $login; $this->pass = $pass; $this->email = $email; + $this->type = $type; } + + function loginget() + { + return $this->login; + } + + function passget() + { + return $this->pass; + } + + function emailget() + { + return $this->email; + } + + function typeget() + { + return $this->type; + } + } class LoginDB { @@ -300,9 +323,9 @@ class LoginDB { require("$DOCUMENT_ROOT/Etc/".BRISK_AUTH_CONF); } else { - $this->item = array( new LoginDBItem("uno", md5("one"), "pippo@pluto.com"), - new LoginDBItem("due", md5("two"), "pippo@pluto.com"), - new LoginDBItem("a_b", md5("abb"), "pippo@pluto.com"), + $this->item = array( new LoginDBItem("uno", md5("one"), "pippo@pluto.com"), + new LoginDBItem("due", md5("two"), "pippo@pluto.com"), + new LoginDBItem("a_b", md5("abb"), "pippo@pluto.com"), new LoginDBItem("tre", md5("three"), "pippo@pluto.com") ); } $this->item_n = count($this->item); @@ -368,9 +391,25 @@ class LoginDB { return (FALSE); } - function login_verify($login, $pass) + function gettype($login) { - $ret = FALSE; + log_main("getmail"); + + /* check the existence of the nick in the LoginDB */ + for ($i = 0 ; $i < $this->item_n ; $i++) { + if (strcasecmp($this->item[$i]->login, $login) == 0) { + log_main("login[".$i."]: ".$this->item[$i]->login); + return ($this->item[$i]->type); + } + } + return (FALSE); + } + + function &login_verify($login, $pass) + { + GLOBAL $G_false; + + $ret = &$G_false; log_main("login_verify: ".$login); @@ -394,7 +433,7 @@ class LoginDB { log_main("login_verify SUCCESS for ".$login); $chals->rem($login); - $ret = TRUE; + $ret = &$this->item[$i]; break; } } diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index a4b2087..bd40259 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -65,6 +65,7 @@ define(DBG_WRIT, 0x0080); define(DBG_LOAD, 0x0100); define(DBG_AUTH, 0x0200); define(DBG_CRIT, 0x0400); +define(DBG_LMOP, 0x0800); // NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols define(BRISK_DEBUG, 0xffffffbf); @@ -565,9 +566,17 @@ define(USER_FLAG_S_WRK, 0x500); // done define(USER_FLAG_S_SMK, 0x600); // done define(USER_FLAG_S_EYE, 0x700); // done define(USER_FLAG_S_RABB, 0x800); // done +define(USER_FLAG_S_SOCC, 0x900); // done +define(USER_FLAG_S_BABY, 0xa00); // done +define(USER_FLAG_S_MOP, 0xb00); // done define(USER_FLAG_S_ALL, 0xf00); // done +/* type of user normal, supporter etc ... */ +define(USER_FLAG_TY_ALL, 0xf0000); // done +define(USER_FLAG_TY_NORM, 0x10000); // done +define(USER_FLAG_TY_SUPER, 0x20000); // done + class User { var $name; // name of the user var $sess; // session of the user @@ -1257,7 +1266,7 @@ class Room { } log_main("___"); - log_main("VALORI name: ".$user_cur->name." tab: ".$user_cur->table." taix: ".$table_idx." ucur: ".$user_cur." us: ".$user); + log_main("VALORI name: ".$user_cur->name." tab: ".$user_cur->table." taix: ".$table_idx); $ret = "gst.st = ".($user_cur->step+1)."; ".($remove_wagon ? sprintf("tra.rem(%d);",$table_idx) : ""); if ($user_cur->stat == "room") { @@ -1568,12 +1577,12 @@ class Room { /* MLANG: "Non puoi cambiare nick a un tavolo per soli autenticati.", "Il nickname \'%s\' è già registrato, se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghostN." */ if ($user->flags & USER_FLAG_AUTH) { if (strcasecmp($user->name,$name_new) != 0) { - if (($user->flags & USER_FLAG_MAP_AUTH != USER_FLAG_ISOLAUTH) && + if (( ($user->flags & USER_FLAG_MAP_AUTH) != USER_FLAG_ISOLAUTH) && ($user->subst == 'standup' || ($user->subst != 'standup' && $this->table[$user->table]->auth_only == FALSE) ) ) { - $user->flags &= ~USER_FLAG_AUTH; // Remove auth if name changed + $user->flags &= ~(USER_FLAG_AUTH | USER_FLAG_TY_ALL); // Remove auth if name changed for ($i = 0 ; $i < TABLES_N ; $i++) { $to_user .= $this->table[$i]->act_content($user); } @@ -1634,6 +1643,15 @@ class Room { else if (strcasecmp($st_str, "coniglio") == 0) { $st = USER_FLAG_S_RABB; } + else if (strcasecmp($st_str, "calcio") == 0) { + $st = USER_FLAG_S_SOCC; + } + else if (strcasecmp($st_str, "pupo") == 0) { + $st = USER_FLAG_S_BABY; + } + else if (strcasecmp($st_str, "pulizie") == 0) { + $st = USER_FLAG_S_MOP; + } else { /* MLANG: "Questo stato non esiste." */ $to_user = sprintf('chatt_sub("%s", [2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['statunkn'][$G_lang]); @@ -1836,6 +1854,7 @@ class Room { $idx = 0; $authenticate = FALSE; + $user_type = 0; $login_exists = FALSE; $ghost = -1; $ghost_auth = FALSE; @@ -1857,11 +1876,14 @@ class Room { if ($pass != FALSE) { log_auth("XXX", "auth2"); $authenticate = $userdb->login_verify($name_new, $pass); - log_auth("XXX", "authenticate: ".($authenticate == TRUE ? "TRUE" : "FALSE")); + log_auth("XXX", "authenticate: ".($authenticate != FALSE ? "TRUE" : "FALSE")); - if ($authenticate == FALSE) { - $idx = -3; - return ($G_false); + if ($authenticate != FALSE) { + $user_type = $authenticate->typeget(); + } + else { + $idx = -3; + return ($G_false); } } else { @@ -1878,14 +1900,14 @@ class Room { continue; // NOTE: CHECK IT !! } if (strcasecmp($this->user[$i]->name, $name_new) == 0) { - if ($authenticate == FALSE) { - $idx = $i; - break; - } - else { - $ghost = $i; - $ghost_auth = ($this->user[$i]->flags & USER_FLAG_AUTH); - } + if ($authenticate != FALSE) { + $ghost = $i; + $ghost_auth = ($this->user[$i]->flags & USER_FLAG_AUTH); + } + else { + $idx = $i; + break; + } } } if ($idx == -1) @@ -1893,7 +1915,7 @@ class Room { log_auth("XXX", sprintf("TROVATO A QUESTO PUNTO [%d] sess [%s] name [%s]", $idx, $sess, $name_new)); - if ($ghost > -1 && $ghost_auth && $authenticate) { + if ($ghost > -1 && $ghost_auth && ($authenticate != FALSE)) { /* swap session */ $ghost_user =& $this->user[$ghost]; @@ -1947,9 +1969,12 @@ class Room { $this->user[$idx]->bantime = 0; $this->user[$idx]->ip = $ip; - $this->user[$idx]->flags = ($authenticate ? USER_FLAG_AUTH : 0x00); + $this->user[$idx]->flags = ($authenticate != FALSE ? USER_FLAG_AUTH : 0x00) | $user_type; + + log_auth("XXX", sprintf("FLAGS: [%x]", $this->user[$idx]->flags)); + - if ($authenticate) { + if ($authenticate != FALSE) { $this->user[$idx]->flags |= USER_FLAG_LISTAUTH; if (isset($CO_list)) { @@ -2248,8 +2273,29 @@ function make_seed() } +function log_mop($step, $log) { + GLOBAL $sess, $PHP_SELF; + + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LMOP) == 0) + return; + + if (isset($sess) == FALSE) + $ssess = "XXXX"; + else + $ssess = $sess; + + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LMOP) == 0) + return; + + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { + fwrite($fp, sprintf("LMOP: [%f] [%05d] [%s] [%s]\n", gettimeofday(TRUE), $step, $PHP_SELF, $log)); + fclose($fp); + } +} + + function log_only2($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONL2) == 0) return; @@ -2263,13 +2309,13 @@ function log_only2($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("ONL2: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("ONL2: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_crit($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_CRIT) == 0) return; @@ -2283,13 +2329,13 @@ function log_crit($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("CRIT: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("CRIT: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_only($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONLY) == 0) return; @@ -2303,13 +2349,13 @@ function log_only($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("ONLY: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("ONLY: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_main($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_MAIN) == 0) return; @@ -2323,13 +2369,13 @@ function log_main($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("MAIN: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("MAIN: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_rd($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_READ) == 0) return; @@ -2343,13 +2389,13 @@ function log_rd($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("READ: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("READ: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_rd2($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_REA2) == 0) return; @@ -2363,13 +2409,13 @@ function log_rd2($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("REA2: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("REA2: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_send($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_SEND) == 0) return; @@ -2383,13 +2429,13 @@ function log_send($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("SEND: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("SEND: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_lock($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOCK) == 0) return; @@ -2403,13 +2449,13 @@ function log_lock($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("LOCK: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("LOCK: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_wr($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_WRIT) == 0) return; @@ -2423,13 +2469,13 @@ function log_wr($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("WRIT: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("WRIT: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_load($log) { - GLOBAL $sess; + GLOBAL $sess, $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOAD) == 0) return; @@ -2443,12 +2489,13 @@ function log_load($log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("LOAD: [%s] [%s]\n", $ssess, $log)); + fwrite($fp, sprintf("LOAD: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log)); fclose($fp); } } function log_auth($sess, $log) { + GLOBAL $PHP_SELF; if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_AUTH) == 0) return; @@ -2456,7 +2503,7 @@ function log_auth($sess, $log) { return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { - fwrite($fp, sprintf("AUTH: [%s] [%d] [%s]\n", $sess, time(), $log)); + fwrite($fp, sprintf("AUTH: [%s] [%d] [%s] [%s]\n", $sess, time(), $PHP_SELF, $log)); fclose($fp); } } diff --git a/web/brisk.css b/web/brisk.css index 0909e72..c977cd2 100644 --- a/web/brisk.css +++ b/web/brisk.css @@ -62,6 +62,12 @@ img.nobo { margin: auto; } +img.inline { + position: relative; + vertical-align: middle; + border-width: 0px; +} + img.nobohide { position: absolute; border-width: 0px; diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 205a122..241be5b 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -605,6 +605,15 @@ class Briskin5 { */ + /* se gli altri utenti non erano d'accordo questo utente viene bannato */ + $remcalc = $this->table[0]->exitlock_calc(&$this->user, $user_cur->table_pos); + if ($remcalc < 3) { + require_once("/var/www/webspace/trusty/Obj/hardban.phh"); + Hardbans::add(($user_cur->flags & USER_FLAG_AUTH ? $user_cur->name : FALSE), + $user_cur->ip, $user_cur->sess, $user_cur->laccwr + BAN_TIME); + } + // $user->bantime = $user->laccwr + BAN_TIME; + $this->table_wakeup(&$user_cur); } } @@ -1251,7 +1260,7 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) else $ret .= "remark_off();"; - /* WHO CALL AND WATH */ + /* WHO CALL AND WHAT */ $ret .= briscola_show($room, $table, $user); } @@ -1456,6 +1465,7 @@ function briscola_show($room, $table, $user) $ret .= sprintf($prestr, xcape($room->user[$table->player[$table->asta_win]]->name), $ptnadd); } + $ret .= sprintf('set_iscalling(%d);', ($table->asta_win - $user->table_pos + BRISKIN5_PLAYERS_N) % BRISKIN5_PLAYERS_N); $ret .= sprintf('$("caller").style.backgroundImage = \'url("img/brisk_caller_sand%d.png")\';', $table->asta_win); diff --git a/web/briskin5/briskin5.css b/web/briskin5/briskin5.css index 94c9ef7..cf4589a 100644 --- a/web/briskin5/briskin5.css +++ b/web/briskin5/briskin5.css @@ -112,6 +112,7 @@ img.cover { height: 200px; top: 250px; left: 300px; + z-index: 10; } .asta { @@ -122,30 +123,35 @@ img.cover { height: 200px; top: 250px; left: 300px; + z-index: 10; } img.seed0 { position: absolute; left: 0px; top: 55px; + cursor: pointer; } img.seed1 { position: absolute; left: 43px; top: 55px; + cursor: pointer; } img.seed2 { position: absolute; left: 93px; top: 55px; + cursor: pointer; } img.seed3 { position: absolute; left: 143px; top: 55px; + cursor: pointer; } .area { @@ -203,7 +209,7 @@ div.table_commands { border-style: solid; border-width: 0px; border-color: green; - z-index: 0; + z-index: 1; } .remark1 { @@ -217,7 +223,7 @@ div.table_commands { border-style: solid; border-width: 4px; border-color: green; - z-index: 0; + z-index: 1; } .remark2 { @@ -231,7 +237,7 @@ div.table_commands { border-style: solid; border-width: 2px; border-color: green; - z-index: 0; + z-index: 1; } .punti { @@ -265,6 +271,20 @@ div.table_commands { height: 125px; } +.pubinfo_iscalling { + /* background-color: red; */ + color: grey; + visibility: visible; + position: absolute; + top: 475px; + left: 200px; + width: 396px !important; + width: 400px; + height: 121px !important; + height: 125px; + border: 2px solid #66bbff; +} + .public { /* background-color: red; */ visibility: hidden; @@ -286,8 +306,6 @@ div.table_commands { margin-right: auto; } - - .pubinfo_we { color: grey; visibility: visible; @@ -298,6 +316,19 @@ div.table_commands { height: 200px; } +.pubinfo_we_iscalling { + color: grey; + visibility: visible; + position: absolute; + top: 250px; + left: 175px; + width: 121px !important; + width: 125px; + height: 196px !important; + height: 200px; + border: 2px solid #66bbff; +} + .public_we { /* background-color: red; */ visibility: hidden; @@ -321,6 +352,20 @@ div.table_commands { height: 125px; } +.pubinfo_nw_iscalling { + /* background-color: red; */ + color: grey; + visibility: visible; + position: absolute; + top: 125px; + left: 200px; + width: 196px !important; + width: 200px; + height: 121px !important; + height: 125px; + border: 2px solid #66bbff; +} + .public_nw { /* background-color: red; */ visibility: hidden; @@ -333,52 +378,78 @@ div.table_commands { overflow: hidden; } -.public_ne { +.pubinfo_ne { /* background-color: red; */ - visibility: hidden; + color: grey; + visibility: visible; position: absolute; top: 125px; left: 400px; - display: table; width: 200px; height: 125px; - overflow: hidden; } -.pubinfo_ne { +.pubinfo_ne_iscalling { /* background-color: red; */ color: grey; visibility: visible; position: absolute; top: 125px; left: 400px; + width: 196px !important; width: 200px; + height: 121px !important; height: 125px; + border: 2px solid #66bbff; } +.public_ne { + /* background-color: red; */ + visibility: hidden; + position: absolute; + top: 125px; + left: 400px; + display: table; + width: 200px; + height: 125px; + overflow: hidden; +} - -.public_ea { +.pubinfo_ea { /* background-color: red; */ - visibility: hidden; + color: grey; + visibility: visible; position: absolute; top: 250px; left: 500px; - display: table; width: 125px; height: 200px; - overflow: hidden; } -.pubinfo_ea { +.pubinfo_ea_iscalling { /* background-color: red; */ color: grey; visibility: visible; position: absolute; top: 250px; left: 500px; + width: 121px !important; width: 125px; + height: 196px !important; height: 200px; + border: 2px solid #66bbff; +} + +.public_ea { + /* background-color: red; */ + visibility: hidden; + position: absolute; + top: 250px; + left: 500px; + display: table; + width: 125px; + height: 200px; + overflow: hidden; } .vert_midfloat { diff --git a/web/briskin5/briskin5.js b/web/briskin5/briskin5.js index 83a837c..00c79d8 100644 --- a/web/briskin5/briskin5.js +++ b/web/briskin5/briskin5.js @@ -207,6 +207,8 @@ function table_init() { $("asta").style.visibility = "hidden"; $("caller").style.visibility = "hidden"; show_astat(-2,-2,-2,-2,-2); + set_iscalling(-1); + for (i=0 ; i < 8 ; i++) { Drag.init($("card" + i), card_mouseup_cb); for (e = 0 ; e < PLAYERS_N ; e++) @@ -268,7 +270,7 @@ function act_reload() function set_names(so,ea,ne,nw,we) { -// alert("EA: "+ea); + // alert("SET NAME"); $("name").innerHTML = italizer(so); $("name").title = unescapeHTML(so[1]); $("name_ea").innerHTML = italizer(ea); @@ -280,9 +282,22 @@ function set_names(so,ea,ne,nw,we) $("name_we").innerHTML = italizer(we); $("name_we").title = unescapeHTML(we[1]); + for (i = 0 ; i < PLAYERS_N ; i++) + $("name"+astat_suffix[i]).title_orig = $("name"+astat_suffix[i]).title; + return; } +function set_iscalling(idx) +{ + var i; + + for (i = 0 ; i < PLAYERS_N ; i++) { + $("name"+astat_suffix[i]).className = "pubinfo"+astat_suffix[i]+(i == idx ? "_iscalling" : ""); + $("name"+astat_suffix[i]).title = $("name"+astat_suffix[i]).title_orig + (i == idx ? " sta chiamando" : ""); + } +} + function preferences_init() { var rd; diff --git a/web/briskin5/index_rd.php b/web/briskin5/index_rd.php index 8055c20..042bb29 100644 --- a/web/briskin5/index_rd.php +++ b/web/briskin5/index_rd.php @@ -252,6 +252,8 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $new_subst = $user->subst; $new_step = $user->step; } while (0); + + log_mop($user->step, 'bin::index_rd.php: after ret set'); if ($user->the_end == TRUE) { log_rd2("LOGOUT BYE BYE!!"); @@ -293,9 +295,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su step */ -$is_page_streaming = ((stristr($HTTP_USER_AGENT, "linux") && - (stristr($HTTP_USER_AGENT, "firefox") || stristr($HTTP_USER_AGENT, "iceweasel"))) ? FALSE : TRUE); - +$is_page_streaming = (stristr($HTTP_USER_AGENT, "MSIE") || stristr($HTTP_USER_AGENT, "CHROME") ? TRUE : FALSE); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past @@ -317,6 +317,7 @@ $old_step = $ext_step = $step; for ($i = 0 ; time() < $endtime ; $i++) { // log_rd("PRE MAIN ".$step);; + $pre_main = gettimeofday(TRUE); if (($ret = maincheck($sess, $old_stat, $old_subst, $old_step, &$stat, &$subst, &$step, $table_idx, $table_token)) != FALSE) { echo '@BEGIN@'; // log_rd2(sprintf("\nSESS: [%s]\nOLD_STAT: [%s] OLD_SUBST: [%s] OLD_STEP: [%s] \nSTAT: [%s] SUBST: [%s] STEP: [%s] \nCOMM: [%s]\n", $sess, $old_stat, $old_subst, $old_step, $stat, $subst, $step, $ret)); @@ -324,6 +325,7 @@ for ($i = 0 ; time() < $endtime ; $i++) { echo ' @END@'; log_send("EXT_STEP: ".$ext_step." ENDTIME: [".$endtime."] ".$ret); flush(); + log_mop(0, 'bin::index_rd.php: after flush (begin: '.sprintf("%f", $pre_main).')'); if ($is_page_streaming) break; } @@ -332,7 +334,7 @@ for ($i = 0 ; time() < $endtime ; $i++) { $old_step = $step; // log_rd("POST MAIN ".$step);; usleep(400000); - if (($i % 5) == 0) { + if (($i % 10) == 0) { // log_rd2("TIME: ".time()); echo '_'; flush(); diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 81922cf..22feb29 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -49,6 +49,8 @@ log_wr('COMM: '.$mesg); if ($table_idx < 0 || $table_idx >= TABLE_N) exit; +log_mop(0, 'bin::index_wr.php: COMM: '.xcapemesg($mesg)); + $sem = Briskin5::lock_data($table_idx); if (($bri = &Briskin5::load_data($table_idx,$table_token)) == FALSE) { @@ -67,8 +69,9 @@ if (($user = &$bri->get_user($sess, &$idx)) == FALSE) { $argz = explode('|', $mesg); log_wr('POSTSPLIT: '.$argz[0]); +log_mop($user->step, 'bin::index_wr.php: after get_user()'); -if ($argz[0] == 'shutdown') { +if (false && $argz[0] == 'shutdown') { log_auth($user_cur->sess, "Shutdown session. delegate to room gc the autologout"); log_rd2("bin5/index_wr.php: AUTO LOGOUT."); @@ -483,7 +486,7 @@ else if ($user->stat == 'table') { } log_legal($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist); if ($user->table_orig < TABLES_AUTH_N) - log_points($curtime, xcapelt($user), "STAT:BRISKIN5:FINISH_GAME", $plist); + log_points($curtime, xcapelt($user->name), "STAT:BRISKIN5:FINISH_GAME", $plist); $table->game_next(); $table->game_init(&$bri->user); @@ -515,6 +518,7 @@ else if ($user->stat == 'table') { } log_wr("before save data"); Briskin5::save_data($bri); +log_mop($user->step, 'bin::index_wr.php: after save_data()'); Briskin5::unlock_data($sem); exit; diff --git a/web/briskin5/statadm.php b/web/briskin5/statadm.php index ce73f0a..4933b03 100644 --- a/web/briskin5/statadm.php +++ b/web/briskin5/statadm.php @@ -35,7 +35,7 @@ TODO: */ -ini_set("max_execution_time", "120"); +ini_set("max_execution_time", "240"); require_once("../Obj/brisk.phh"); require_once("../Obj/auth.phh"); @@ -50,7 +50,7 @@ function main() $wee = array(); echo "inizio
"; - fflush(); + flush(); if ($pazz != $G_alarm_passwd) exit; diff --git a/web/commons.js b/web/commons.js index 704c481..e3e56d7 100644 --- a/web/commons.js +++ b/web/commons.js @@ -252,6 +252,12 @@ function send_mesg(mesg) // alert("xhr_wr: "+xhr_wr+" is_conn: "+is_conn); xhr_wr.open('GET', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+'mesg='+mesg, (is_conn ? true : false)); xhr_wr.onreadystatechange = function() { return; }; + if (typeof(console) == 'object') { + if (typeof(console.log) == 'function') { + var ldate = new Date(); + console.log(ldate.getTime()+':MESG:'+mesg); + } + } xhr_wr.send(null); if (!is_conn) { diff --git a/web/index.php b/web/index.php index d75a7f2..0aa8592 100644 --- a/web/index.php +++ b/web/index.php @@ -20,7 +20,7 @@ * not, write to the Free Software Foundation, Inc, 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. * - * $Id$ + * $Id: index.php,v 1.33.2.28 2009-12-12 08:42:19 nastasi Exp $ * */ @@ -79,6 +79,12 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati 'en' => 'present'), 'st_rabb_desc' => array('it' => 'coniglio', 'en' => 'rabbit'), + 'st_socc_desc' => array('it' => 'calcio', + 'en' => 'soccer'), + 'st_baby_desc' => array('it' => 'pupo', + 'en' => 'baby'), + 'st_mop_desc' => array('it' => 'pulizie', + 'en' => 'mop'), 'tit_ticker' => array('it' => 'scrivi un invito al tavolo e clicca', 'en' => 'write an invitation at the table and click'), @@ -154,10 +160,10 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati 'en' => 'roadmap of next functionalities'), 'itm_rmap' => array('it' => 'roadmap', 'en' => 'roadmap'), - 'tit_meet' => array('it' => 'foto dei raduni di briskisti', + 'tit_meet' => array('it' => 'foto dei raduni di briskisti (serve Facebook)', 'en' => 'photos of brisk meetings'), - 'itm_meet' => array('it' => 'raduni', - 'en' => 'meeting'), + 'itm_meet' => array('it' => 'BriskMeeting', + 'en' => 'BriskMeeting'), 'tit_mesg' => array('it' => 'manda un messaggio o una segnalazione all\'amministratore del sito', 'en' => 'send a message or a signalling to the administrator' ), 'mesgtoadm_tit'=> array('it' => 'Invia un messaggio o una segnalazione all\'amministratore:', @@ -207,6 +213,12 @@ function poll_dom() { return ''; } +function carousel_top() +{ + $rn = rand(1, 3); + return (sprintf('', $rn)); +} + function main() { GLOBAL $G_with_donors, $G_donors_cur, $G_donors_all; @@ -223,177 +235,177 @@ function main() $ACTION = "login"; if (isset($BRISK_SHOWHTML) == FALSE) { - $is_table = FALSE; - $sem = Room::lock_data(); - log_main("lock Room"); - $room = &Room::load_data(); - $curtime = time(); - - /* Actions */ - - if (validate_sess($sess)) { - log_main("pre garbage_manager UNO"); - $room->garbage_manager(TRUE); - log_main("post garbage_manager"); - if (($user = &$room->get_user($sess, &$idx)) != FALSE) { - log_main("user stat: ".$user->stat); - if ($user->stat == "table") { - if (Room::save_data(&$room) == FALSE) { - echo "ERRORE SALVATAGGIO\n"; - exit; - } - log_main("unlock Room"); - Room::unlock_data($sem); - setcookie("table_token", $user->table_token, $curtime + 31536000); - setcookie("table_idx", $user->table, $curtime + 31536000); - header ("Location: briskin5/index.php"); - exit; - } - $ACTION = "room"; - } - - if (Room::save_data(&$room) == FALSE) { - echo "ERRORE SALVATAGGIO\n"; - exit; - } - } - - if ($ACTION == "login" && isset($name)) { + $is_table = FALSE; + $sem = Room::lock_data(); + log_main("lock Room"); + $room = &Room::load_data(); + $curtime = time(); - log_main("pre garbage_manager DUE"); - - if (isset($pass_private) == FALSE) { - $pass_private = FALSE; + /* Actions */ + + if (validate_sess($sess)) { + log_main("pre garbage_manager UNO"); + $room->garbage_manager(TRUE); + log_main("post garbage_manager"); + if (($user = &$room->get_user($sess, &$idx)) != FALSE) { + log_main("user stat: ".$user->stat); + if ($user->stat == "table") { + if (Room::save_data(&$room) == FALSE) { + echo "ERRORE SALVATAGGIO\n"; + exit; + } + log_main("unlock Room"); + Room::unlock_data($sem); + setcookie("table_token", $user->table_token, $curtime + 31536000); + setcookie("table_idx", $user->table, $curtime + 31536000); + header ("Location: briskin5/index.php"); + exit; + } + $ACTION = "room"; + } + + if (Room::save_data(&$room) == FALSE) { + echo "ERRORE SALVATAGGIO\n"; + exit; + } } - - $room->garbage_manager(TRUE); - /* try login */ - if (($user = &$room->add_user(&$sess, &$idx, $name, $pass_private, $_SERVER['REMOTE_ADDR'])) != FALSE) { - $ACTION = "room"; - if ($idx < 0) { - $idx = -$idx - 1; - $is_login = TRUE; - } - - log_legal($curtime, $user, "STAT:LOGIN", ''); - - // recovery lost game - if ($user->stat == "table") { - if (Room::save_data(&$room) == FALSE) { - echo "ERRORE SALVATAGGIO\n"; - exit; - } - log_main("unlock Room"); - Room::unlock_data($sem); - setcookie("table_token", $user->table_token, $curtime + 31536000); - setcookie("table_idx", $user->table, $curtime + 31536000); - header ("Location: briskin5/index.php"); - exit; - } - - - // setcookie ("sess", "", time() + 180); - $room->standup_update(&$user); - + + if ($ACTION == "login" && isset($name)) { + + log_main("pre garbage_manager DUE"); + + if (isset($pass_private) == FALSE) { + $pass_private = FALSE; + } + + $room->garbage_manager(TRUE); + /* try login */ + if (($user = &$room->add_user(&$sess, &$idx, $name, $pass_private, $_SERVER['REMOTE_ADDR'])) != FALSE) { + $ACTION = "room"; + if ($idx < 0) { + $idx = -$idx - 1; + $is_login = TRUE; + } + + log_legal($curtime, $user, "STAT:LOGIN", ''); + + // recovery lost game + if ($user->stat == "table") { + if (Room::save_data(&$room) == FALSE) { + echo "ERRORE SALVATAGGIO\n"; + exit; + } + log_main("unlock Room"); + Room::unlock_data($sem); + setcookie("table_token", $user->table_token, $curtime + 31536000); + setcookie("table_idx", $user->table, $curtime + 31536000); + header ("Location: briskin5/index.php"); + exit; + } + + + // setcookie ("sess", "", time() + 180); + $room->standup_update(&$user); + if (Room::save_data(&$room) == FALSE) { - echo "ERRORE SALVATAGGIO\n"; - exit; + echo "ERRORE SALVATAGGIO\n"; + exit; } + } + else { + /* Login Rendering */ + /* MLANG: "Utente e/o password errati.", "Il nickname deve contenere almeno una lettera o una cifra.", "Spiacenti, non ci sono più posti liberi. Riprova più tardi.", "Il tuo nickname è già in uso." */ + /* + if ($idx == -3) + $body .= '
'.$mlang_room['userpasserr'][$G_lang].'
'; + else if ($idx == -2) + // $body .= '
Il nickname deve contenere almeno una lettera o una cifra.
'; + $body .= '
'.$mlang_room['userpassmust'][$G_lang].'
'; + else if ($idx == -1) + // $body .= '
Spiacenti, non ci sono più posti liberi. Riprova più tardi.
'; + $body .= '
'.$mlang_room['userpassend'][$G_lang].'
'; + else + // $body .= '
Il tuo nickname è già in uso.
'; + $body .= '
'.$mlang_room['userpassuse'][$G_lang].'
'; + */ + + if ($idx == -3) + $sfx = 'err'; + else if ($idx == -2) + $sfx = 'must'; + else if ($idx == -1) + $sfx = 'end'; + else + $sfx = 'use'; + + $body .= '
'.$mlang_room['userpass'.$sfx][$G_lang].'
'; + } } - else { - /* Login Rendering */ - /* MLANG: "Utente e/o password errati.", "Il nickname deve contenere almeno una lettera o una cifra.", "Spiacenti, non ci sono più posti liberi. Riprova più tardi.", "Il tuo nickname è già in uso." */ - /* - if ($idx == -3) - $body .= '
'.$mlang_room['userpasserr'][$G_lang].'
'; - else if ($idx == -2) - // $body .= '
Il nickname deve contenere almeno una lettera o una cifra.
'; - $body .= '
'.$mlang_room['userpassmust'][$G_lang].'
'; - else if ($idx == -1) - // $body .= '
Spiacenti, non ci sono più posti liberi. Riprova più tardi.
'; - $body .= '
'.$mlang_room['userpassend'][$G_lang].'
'; - else - // $body .= '
Il tuo nickname è già in uso.
'; - $body .= '
'.$mlang_room['userpassuse'][$G_lang].'
'; - */ - - if ($idx == -3) - $sfx = 'err'; - else if ($idx == -2) - $sfx = 'must'; - else if ($idx == -1) - $sfx = 'end'; - else - $sfx = 'use'; - - $body .= '
'.$mlang_room['userpass'.$sfx][$G_lang].'
'; - } - } - Room::unlock_data($sem); + Room::unlock_data($sem); } /* Rendering. */ if ($BRISK_SHOWHTML == "debugtable") { - $ACTION = "room"; + $ACTION = "room"; } else if ($BRISK_SHOWHTML == "debuglogin") { - $ACTION = "login"; + $ACTION = "login"; } - + if ($ACTION == "room") { - $tables .= '
'; - $tables .= ''; - for ($ii = 0 ; $ii < TABLES_N ; $ii++) { - if ($user->flags & USER_FLAG_AUTH) + $tables .= '
'; + $tables .= '
'; + for ($ii = 0 ; $ii < TABLES_N ; $ii++) { + if ($user->flags & USER_FLAG_AUTH) $i = $ii; - else - $i = TABLES_N - $ii - 1; - - if ($ii % 4 == 0) { - $tables .= ''; - } - if (TRUE || !($user->flags & USER_FLAG_ISOLAUTH) || $ii < TABLES_AUTH_N) { - $tables .= ''."\n"; + else + $i = TABLES_N - $ii - 1; + + if ($ii % 4 == 0) { + $tables .= ''; + } + if (TRUE || !($user->flags & USER_FLAG_ISOLAUTH) || $ii < TABLES_AUTH_N) { + $tables .= ''."\n"; + } + if ($ii % 4 == 3) { + $tables .= ''; + } } - if ($ii % 4 == 3) { - $tables .= ''; - } - } - $tables .= '
'; - - $tables .= '
'.$mlang_room['tit_tabl'][$G_lang].$i.'
'; - $tables .= sprintf('
', $i); - $tables .= sprintf('
', $i); - $tables .= '
'; - $tables .= '
'; + + $tables .= '
'.$mlang_room['tit_tabl'][$G_lang].$i.'
'; + $tables .= sprintf('
', $i); + $tables .= sprintf('
', $i); + $tables .= '
'; + $tables .= '
'; - - - $standup .= '
'; - $standup .= '
'; - /* MLANG: "Giocatori in piedi" */ - // $standup .= '
Giocatori in piedi - Come ottenere user e password -
'; - $standup .= '
'.$mlang_room['standing'][$G_lang].'
'; - - $standup .= sprintf('
'); - // MLANG Esco. - $standup .= '
'; - $standup .= '
'; + $tables .= ''; + + + $standup .= '
'; + $standup .= '
'; + /* MLANG: "Giocatori in piedi" */ + // $standup .= '
Giocatori in piedi - Come ottenere user e password -
'; + $standup .= '
'.$mlang_room['standing'][$G_lang].'
'; + + $standup .= sprintf('
'); + // MLANG Esco. + $standup .= '
'; + $standup .= '
'; } - + $altout_sponsor_arr = array( array ( 'id' => 'btn_altout', - 'url' => 'http://www.alternativeoutput.it', - 'content' => 'img/altout80x15.png', - 'content_big' => 'img/logotxt_banner.png'), - array ( 'id' => 'btn_virtualsky', - 'url' => 'http://virtualsky.alternativeoutput.it', - 'content' => 'img/virtualsky80x15a.gif', - 'content_big' => 'img/virtualsky_big.png'), - array ( 'id' => 'btn_dynamica', - 'url' => 'http://www.dynamica.it', - 'content' => 'img/dynamica.png', - 'content_big' => 'img/dynamica_big.png') - ); - + 'url' => 'http://www.alternativeoutput.it', + 'content' => 'img/altout80x15.png', + 'content_big' => 'img/logotxt_banner.png'), + array ( 'id' => 'btn_virtualsky', + 'url' => 'http://virtualsky.alternativeoutput.it', + 'content' => 'img/virtualsky80x15a.gif', + 'content_big' => 'img/virtualsky_big.png'), + array ( 'id' => 'btn_dynamica', + 'url' => 'http://www.dynamica.it', + 'content' => 'img/dynamica.png', + 'content_big' => 'img/dynamica_big.png') + ); + $altout_support_arr = array( array ( 'id' => 'btn_brichi', 'url' => 'http://www.briscolachiamata.it', 'content' => 'img/brichi.png', @@ -402,56 +414,55 @@ function main() 'url' => 'http://www.forumolimpia.it', 'content' => 'img/forumolimpia.gif', 'content_big' => 'img/forumolimpia_big.png' ) ); - - - + + + $altout_support = ""; $altout_support_big = ""; for ($i = 0 ; $i < 3 ; $i++) { - $ii = ($i < 2 ? $i : 0); - - $altout_support .= sprintf('
', - $i * 20, $altout_support_arr[$ii]['url'], - $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content']); - - $altout_support_big .= sprintf('', - $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content_big']); + $ii = ($i < 2 ? $i : 0); + + $altout_support .= sprintf('
', + $i * 20, $altout_support_arr[$ii]['url'], + $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content']); + + $altout_support_big .= sprintf('', + $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content_big']); } - - + + // seed with microseconds since last "whole" second // srand ((double) microtime() * 1000000); // $randval = rand(0,count($altout_sponsor_arr)-1); $altout_sponsor = ""; $altout_sponsor_big = ""; for ($i = 0 ; $i < 4 ; $i++) { - $ii = ($i < 3 ? $i : 0); - - $altout_sponsor .= sprintf('
', - $i * 20, $altout_sponsor_arr[$ii]['url'], - $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content']); - - $altout_sponsor_big .= sprintf('', + $ii = ($i < 3 ? $i : 0); + + $altout_sponsor .= sprintf('
', + $i * 20, $altout_sponsor_arr[$ii]['url'], + $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content']); + + $altout_sponsor_big .= sprintf('', $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content_big']); } - - - - - + + + + + $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt"); if ($brisk_donate == FALSE) - $brisk_donate = ""; - - + $brisk_donate = ""; + + /* MLANG: "briscola chiamata in salsa ajax", */ - -$brisk_header_form = '
- -