From 8ed2a55a82dedbf9ce2014fc2ee1cc06ecedb525 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 07:59:53 +0000 Subject: [PATCH 01/16] formtext_hilite and formsub_hilite added --- web/commons.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/web/commons.js b/web/commons.js index d04ef6f..c5eba32 100644 --- a/web/commons.js +++ b/web/commons.js @@ -572,6 +572,10 @@ function notify(st, text, tout, butt, w, h) this.ancestor.appendChild(box); this.toutid = setTimeout(function(obj){ obj.unblock(); }, tout, this); + + formsub_hilite(clo); + clo.focus(); + } notify.prototype = { @@ -894,3 +898,18 @@ function langtolng(lang) else return (""); } + +function formtext_hilite(obj) +{ + obj.className = 'input_text'; + addEvent(obj, "focus", function () { this.className = 'input_text_hi'; }); + addEvent(obj, "blur", function () { this.className = 'input_text'; }); +} + +function formsub_hilite(obj) +{ + obj.className = 'input_sub'; + addEvent(obj, "focus", function () { this.className = 'input_sub_hi'; }); + addEvent(obj, "blur", function () { this.className = 'input_sub'; }); +} + -- 2.17.1 From 8ad982169ddcaa707e91151c515fdec89af3d4eb Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:03:27 +0000 Subject: [PATCH 02/16] commands menu, /listen and /mesgtoadm commands added --- web/index.php | 130 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 102 insertions(+), 28 deletions(-) diff --git a/web/index.php b/web/index.php index 247356a..bc0735f 100644 --- a/web/index.php +++ b/web/index.php @@ -48,6 +48,7 @@ function main() GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local; GLOBAL $sess, $name, $pass_private, $table_idx, $table_token, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER; GLOBAL $G_lang, $G_lng, $mlang_room; + $is_login = FALSE; $body = ""; $tables = ""; $standup = ""; @@ -103,10 +104,8 @@ function main() $ACTION = "room"; if ($idx < 0) { $idx = -$idx - 1; - $login_exists = TRUE; + $is_login = TRUE; } - else - $login_exists = FALSE; log_legal($curtime, $user, "STAT:LOGIN", ''); @@ -160,8 +159,13 @@ function main() if ($ACTION == "room") { $tables .= '
'; $tables .= ''; - for ($i = 0 ; $i < TABLES_N ; $i++) { - if ($i % 4 == 0) + 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 .= ''; $tables .= ''."\n"; - if ($i % 4 == 3) + if ($ii % 4 == 3) $tables .= ''; } $tables .= '
'; $tables .= '
Tavolo '.$i.'
'; @@ -169,7 +173,7 @@ function main() $tables .= sprintf('
', $i); $tables .= '
'; $tables .= '
'; @@ -274,7 +278,7 @@ $brisk_vertical_menu = '
- + -

+
sponsored by:

'.$altout_carousel.'


supported by:

@@ -528,7 +596,7 @@ else { setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); $("txt_in").focus(); Il nickname che stai usando è già registrato,

se il suo proprietario si autentificherà

verrai rinominato d'ufficio come ghostN.", "torna ai tavoli" */ echo show_notify("
Il nickname che stai usando è già registrato,

se il suo proprietario si autentificherà

verrai rinominato d'ufficio come ghostN.", 0, "torna ai tavoli", 400, 150); } @@ -560,7 +628,7 @@ if ($login_exists) {
-Chat
+Chat
@@ -573,27 +641,12 @@ if ($login_exists) {
- -

Garantisci per un tuo conoscente:

- - -
+ @@ -603,6 +656,27 @@ if ($login_exists) { + +
+
+
+
+ Invia un messaggio o una segnalazione all'amministratore: +

+
+ + + + + + + + + + +
-- 2.17.1 From 4f18d0e24bd1c4c2895bfa13c9d164e2ddd22d47 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:05:03 +0000 Subject: [PATCH 03/16] /mesgtoadm command added --- web/index_wr.php | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/web/index_wr.php b/web/index_wr.php index ceb6b59..60c9af9 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -27,7 +27,6 @@ require_once("Obj/brisk.phh"); require_once("Obj/auth.phh"); // require_once("Obj/proxyscan.phh"); -require_once("briskin5/Obj/briskin5.phh"); // Use of proxies isn't allowed. // if (is_proxy()) { @@ -178,6 +177,49 @@ else if ($argz[0] == 'warranty') { $user->step_inc(); } } +else if ($argz[0] == 'mesgtoadm') { + GLOBAL $cli_subj, $cli_mesg; + + $curtime = time(); + $mesg_to_user = ""; + + log_wr("INFO:SKIP:argz == mesgtoadm name: [".$cli_name."] AUTH: ".($user->flags & USER_FLAG_AUTH)); + if ($user->flags & USER_FLAG_AUTH) { + if (($wa_lock = Warrant::lock_data()) != FALSE) { + if (($fp = @fopen(LEGAL_PATH."/messages.txt", 'a')) != FALSE) { + /* Unix time | session | nickname | IP | where was | mesg */ + fwrite($fp, sprintf("%ld|%s|%s|%s\n", $curtime, $user->name, + xcapelt(urldecode($cli_subj)), xcapelt(urldecode($cli_mesg)))); + fclose($fp); + } + Warrant::unlock_data($wa_lock); + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + /* MLANG: "" */ + $user->comm[$user->step % COMM_N] .= show_notify("

Il messaggio è stato inoltrato all\'amministratore.", 0, "chiudi", 400, 110); + $user->step_inc(); + echo "1"; + } + else { + /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ + $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"E\' occorso un errore durante il salvataggio, riprova o contatta per mail l\'amministratore.");', $dt, NICKSERV); + } + + } + else { + /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato." */ + $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"Per mandare messaggi all\'amministratore devi essere autenticato.");', $dt, NICKSERV); + } + + if ($mesg_to_user != "") { + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + + $dt = date("H:i ", $curtime); + $user->comm[$user->step % COMM_N] .= $mesg_to_user; + $user->step_inc(); + } +} + + /****************** * * * STAT: room * @@ -298,6 +340,7 @@ else if ($user->stat == 'room') { log_wr("MOP before"); if ($table->player_n == PLAYERS_N) { + require_once("briskin5/Obj/briskin5.phh"); log_wr("MOP inall"); // Start game for this table. -- 2.17.1 From ef381a85438ce40b473d3cf11e8853d97dc341c5 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:05:39 +0000 Subject: [PATCH 04/16] commands menu added --- web/menu.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/menu.js b/web/menu.js index 2ae540f..17cb78f 100644 --- a/web/menu.js +++ b/web/menu.js @@ -8,8 +8,11 @@ g_menu_tree[0] = new Array(); g_menu_tree[0][0] = $('menu_webstart'); + g_menu_tree[0][1] = $('menu_commands'); g_menu_tree[1] = new Array(); - g_menu_tree[1][0] = $('menu_raduni'); + g_menu_tree[1][0] = $('menu_meeting'); + g_menu_tree[1][1] = $('menu_state'); + g_menu_tree[1][2] = $('menu_listen'); } function menu_show(id) { -- 2.17.1 From eaa164b2f8408a510d7780c15614dfa6993f7817 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:06:21 +0000 Subject: [PATCH 05/16] minor log bug fixed --- web/Obj/auth.phh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Obj/auth.phh b/web/Obj/auth.phh index fdebea7..a52bc78 100644 --- a/web/Obj/auth.phh +++ b/web/Obj/auth.phh @@ -70,7 +70,7 @@ class Challenges { return ($G_false); } - log_auth("xxx", "LOOPI item: ".$i." tstamp: ".$this->item[$i]->tstamp." curtime: ".$curtime); + // log_auth("xxx", "LOOPI tstamp: ".$this->item[$i]->tstamp." curtime: ".$curtime); if (($chal = new Challenge($login, $token, $ip, $tstamp)) == null) { return ($G_false); -- 2.17.1 From 461259aa77611a333c703802cb905a829ef40f81 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:10:00 +0000 Subject: [PATCH 06/16] improved inheritance between classes, /listen and /mesgtoadm commands added --- web/Obj/brisk.phh | 485 +++++++++++++++------------------------------- 1 file changed, 156 insertions(+), 329 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index cf6b824..19bae1d 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -2,7 +2,7 @@ /* * brisk - brisk.phh * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2009 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -65,7 +65,7 @@ define(DBG_AUTH, 0x0200); define(DBG_CRIT, 0x0400); // NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols -define(BRISK_DEBUG, 0xffffffff); +define(BRISK_DEBUG, 0xffffffbf); define(BRISK_SINGLE_DEBUG,0); define(BRISK_SINGLE_SESS, ""); @@ -80,10 +80,10 @@ $G_lng = ""; // $G_lng = "_en"; $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 ); -$G_brisk_version = "2.1.5 - trusty"; +$G_brisk_version = "2.1.6 - trusty"; /* MLANG: ALL THE INFO STRINGS IN brisk.phh */ -$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': il rendering degli utenti in piedi è stato riscritto.', +$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': menu comandi e filtro sui non autenticati.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ); $G_room_help= ' @@ -111,6 +111,8 @@ Dopo che è iniziata una partita per uscirne dovete chiedere agli altri gi
/tav <frase di invito> - invito per gli altri giocatori al tavolo dove si è seduti
/st <stato> - cambia l\'icona associata al tuo user; stato può valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\", \\"presente\\" oppure \\"sigaretta\\"
/garante - se si è autenticati permette di garantire per un utente fidato +
/mesgtoadm - se si è autenticati permette di lasciare un messaggio all\'amministratore del sito +
/listen <all|auth> - se si è autenticati permette leggere solo i messaggi degli altri autenticati (auth) o di tutti (all)
'; @@ -136,88 +138,26 @@ function xcape($s) function xcapelt($s) { - $from = array ( '\\', '|' ); - $to = array ( '\\\\', '\\|' ); + $from = array ( '\\', '|', "\t", "\n"); + $to = array ( '\\\\', '\\|', "\\t", "\\n"); return (str_replace($from, $to, $s)); } -class Card { - var $value; /* 0 - 39 card value */ - var $stat; /* 'bunch', 'hand', 'table', 'take' */ - var $owner; /* (table position 0-4) */ - // var $pos; /* Pos in hand. */ - var $x; /* When played the X position on the table of the owner. */ - var $y; /* When played the Y position on the table of the owner. */ - - function Card($value, $stat, $owner) - { - $this->value = $value; - $this->stat = $stat; // Card stat - $this->owner = $owner; - } - - function assign($stat,$owner) - { - $this->stat = $stat; // Card stat - $this->owner = $owner; - } - - function setpos($pos) - { - $this->pos = $pos; - } - - function play($x,$y) - { - $this->stat = 'table'; // Card stat - $this->x = $x; - $this->y = $y; - } - - function take($newown) - { - $this->stat = 'take'; // Card stat - $this->owner = $newown; - } -} // end class Card class Table { var $idx; var $player; var $player_n; - var $card; - var $mazzo; - var $gstart; - var $turn; - var $auth_only; + + var $auth_only; // se tavolo riservato o libero var $wag_own; var $wag_com; var $wag_tout; - var $asta_pla; - var $asta_pla_n; - var $asta_card; - var $asta_pnt; - - var $mult; - var $points; // points array - var $points_n; // number of row of points - var $total; - - var $asta_win; - var $briscola; - var $friend; - - var $old_reason; - var $old_asta_pnt; - var $old_pnt; - var $old_win; - var $old_friend; - var $table_token; - var $table_start; + var $table_start; // information field var $wakeup_time; @@ -235,33 +175,12 @@ class Table { $thiz->idx = $idx; $thiz->player = array(); $thiz->player_n = 0; - $thiz->card = FALSE; - $thiz->asta_pla = array(); // TRUE: in auction, FALSE: out of the auction - $thiz->asta_pla_n= -1; - $thiz->asta_card = -1; - $thiz->asta_pnt = -1; - $thiz->mult = 1; - $thiz->auth_only = FALSE; - $thiz->points = array( ); - $thiz->points_n = 0; - $thiz->total = array( 0, 0, 0, 0, 0); - $thiz->asta_win = -1; - $thiz->briscola = -1; - $thiz->friend = -1; - $thiz->turn = 0; - $thiz->wag_own = NULL; $thiz->wag_com = ""; $thiz->wag_tout = 0; - $thiz->old_reason = ""; - $thiz->old_asta_pnt = -1; - $thiz->old_pnt = -1; - $thiz->old_win = -1; - $thiz->old_friend = -1; - $thiz->table_token = ""; $thiz->table_start = 0; @@ -270,53 +189,38 @@ class Table { return ($thiz); } - function &clone(&$from) + function copy(&$from) { GLOBAL $G_false; - if (($thiz =& new Table()) == FALSE) - return ($G_false); - - $thiz->idx = $from->idx; - $thiz->player = array(); + $this->idx = $from->idx; + $this->player = array(); for ($i = 0 ; $i < $from->player_n ; $i++) - $thiz->player[$i] = $from->player[$i]; - $thiz->player_n = $from->player_n; - $thiz->card = $from->card; - $thiz->mazzo = $from->mazzo; // REVIEW - $thiz->gstart = $from->gstart; - $thiz->turn = $from->turn; + $this->player[$i] = $from->player[$i]; + $this->player_n = $from->player_n; - $thiz->auth_only = $from->auth_only; + log_main("PLAYER_N - parent::copy.".$this->player_n); + + $this->auth_only = $from->auth_only; - $thiz->wag_own = $from->wag_own; - $thiz->wag_com = $from->wag_com; - $thiz->wag_tout = $from->wag_taut; + $this->wag_own = $from->wag_own; + $this->wag_com = $from->wag_com; + $this->wag_tout = $from->wag_tout; - $thiz->asta_pla = $from->asta_pla; - $thiz->asta_pla_n = $from->asta_pla_n; - $thiz->asta_card = $from->asta_card; - $thiz->asta_pnt = $from->asta_pnt; - - $thiz->mult = $from->mult; - $thiz->points = $from->points; - $thiz->points_n = $from->points_n; - $thiz->total = $from->total; - - $thiz->asta_win = $from->asta_win; - $thiz->briscola = $from->briscola; - $thiz->friend = $from->friend; - - $thiz->old_reason = $from->old_reason; - $thiz->old_asta_pnt = $from->old_asta_pnt; - $thiz->old_pnt = $from->old_pnt; - $thiz->old_win = $from->old_win; - $thiz->old_friend = $from->old_friend; + $this->table_token = $from->table_token; + $this->table_start = $from->table_start; - $thiz->table_token = $from->table_token; - $thiz->table_start = $from->table_start; + $this->wakeup_time = $from->wakeup_time; + } - $thiz->wakeup_time = $from->wakeup_time; + function &clone(&$from) + { + GLOBAL $G_false; + + if (($thiz =& new Table()) == FALSE) + return ($G_false); + + $this->copy($from); return ($thiz); } @@ -329,42 +233,16 @@ class Table { return ($G_false); $thiz->idx = $from->idx; + $thiz->player = array(); + for ($i = 0 ; $i < $from->player_n ; $i++) + $thiz->player[$i] = $i; $thiz->player_n = $from->player_n; - $thiz->card = &$thiz->bunch_create(); - $thiz->mazzo = $from->mazzo; - $thiz->gstart = $from->gstart; - $thiz->turn = $from->turn; $thiz->auth_only = $from->auth_only; $thiz->wag_own = $from->wag_own; $thiz->wag_com = $from->wag_com; - $thiz->wag_tout = $from->wag_taut; - - $thiz->asta_pla = $from->asta_pla; - $thiz->asta_pla_n = $from->asta_pla_n; - $thiz->asta_card = $from->asta_card; - $thiz->asta_pnt = $from->asta_pnt; - - $thiz->mult = $from->mult; - $thiz->points = $from->points; - $thiz->points_n = $from->points_n; - $thiz->total = $from->total; - - $thiz->asta_win = $from->asta_win; - $thiz->briscola = $from->briscola; - $thiz->friend = $from->friend; - - $thiz->old_reason = $from->old_reason; - $thiz->old_asta_pnt = $from->old_asta_pnt; - $thiz->old_pnt = $from->old_pnt; - $thiz->old_win = $from->old_win; - $thiz->old_friend = $from->old_friend; - - // players are rearranged in an dedicated array - $thiz->player = array(); - for ($i = 0 ; $i < $from->player_n ; $i++) - $thiz->player[$i] = $i; + $thiz->wag_tout = $from->wag_tout; $thiz->table_token = $from->table_token; $thiz->table_start = $from->table_start; @@ -373,18 +251,6 @@ class Table { return ($thiz); } - - function &bunch_create() - { - $ret = array(); - - for ($i = 0 ; $i < 40 ; $i++) { - $ret[$i] =& new Card($i, 'bunch', 'no_owner'); - } - - $oret = &$ret; - return ($oret); - } function wag_set(&$user, $mesg) { @@ -405,79 +271,6 @@ class Table { $this->wag_tout = $timeout; } - function bunch_make() - { - $ct = array(0,0,0,0,0); - - mt_srand(make_seed()); - - for ($i = 39 ; $i >= 0 ; $i--) - $rest[$i] = $i; - - for ($i = 39 ; $i >= 0 ; $i--) { - $rn = rand(0, $i); - - if ($rn == 0) - log_main("RND ZERO"); - - $id = $rest[$rn]; - - $owner = $i % 5; - $this->card[$id]->assign('hand', $owner); - - $rest[$rn] = $rest[$i]; - // $pubbpos[$rn2] = $pubbpos[$i]; - } - } - - function init(&$userarr) - { - $this->mazzo = rand(0,PLAYERS_N-1); - $this->points_n = 0; - $this->mult = 1; - $this->old_win =-1; - $this->old_reason = ""; - for ($i = 0 ; $i < PLAYERS_N ; $i++) { - $this->total[$i] = 0; - $user_cur = &$userarr[$this->player[$i]]; - $user_cur->exitislock = TRUE; - } - - log_main("table::init: ci siamo"); - } - - function game_init(&$userarr) - { - log_rd2("GSTART 4"); - - $this->gstart = ($this->mazzo+1) % PLAYERS_N; - $this->bunch_make(); - - - $this->asta_pla_n = PLAYERS_N; - $this->asta_card = -1; - $this->asta_pnt = 60; - $this->asta_win = -1; - $this->briscola = -1; - $this->friend = -1; - $this->turn = 0; - - for ($i = 0 ; $i < PLAYERS_N ; $i++) { - $this->asta_pla[$i] = TRUE; - $user_cur = &$userarr[$this->player[$i]]; - $user_cur->subst = 'asta'; - $user_cur->asta_card = -2; - $user_cur->asta_pnt = -1; - $user_cur->handpt = $this->hand_points($i); - // SEE function calculate_points(&$table) - } - } - - function game_next() - { - $this->mazzo = ($this->mazzo + 1) % PLAYERS_N; - } - function getPlayer($idx) { return ($this->player[$idx]); @@ -516,45 +309,6 @@ class Table { } } - function hand_points($idx) - { - GLOBAL $G_all_points; - - $tot = 0; - - for ($i = 0 ; $i < 40 ; $i++) { - if ($this->card[$i]->owner != $idx) - continue; - - $ctt = $this->card[$i]->value % 10; - $tot += $G_all_points[$ctt]; - } - - return ($tot); - } - - function exitlock_show(&$userarr, $table_pos) - { - $ct = $this->exitlock_calc(&$userarr, $table_pos); - - $ret = sprintf('exitlock_show(%d, %s);', $ct, - ($userarr[$this->player[$table_pos]]->exitislock ? 'true' : 'false')); - return ($ret); - } - - function exitlock_calc(&$userarr, $table_pos) - { - $ct = 0; - - for ($i = 0 , $ct = 0 ; $i < PLAYERS_N ; $i++) { - if ($userarr[$this->player[$i]]->exitislock == FALSE) - $ct++; - } - - return ($ct); - } - - // $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table, @@ -598,13 +352,12 @@ class Table { return ($ret); } - - } // end class Table - + // User flags -define(USER_FLAG_AUTH, 0x02); +define(USER_FLAG_AUTH, 0x02); +define(USER_FLAG_LISTAUTH, 0x04); // user status define(USER_FLAG_S_NORM, 0x000); // done @@ -630,10 +383,14 @@ class User { var $step; // step of the current status var $trans_step; // step to enable transition between pages (disable == -1) var $comm; // commands array - var $asta_card; // - var $asta_pnt; // - var $handpt; // Total card points at the beginning of the current hand. - var $exitislock; // Player can exit from the table ? + // var $asta_card; // + // var $asta_pnt; // + // var $handpt; // Total card points at the beginning of the current hand. + // var $exitislock; // Player can exit from the table ? + + // FIXME: the table_orig field must be removed after table field verify of index management (in spawned table + // it is allways ZERO + var $table_orig; // id of the current table (if in table state) var $table; // id of the current table (if in table state) var $table_pos; // idx on the table var $table_token;// token that identify a game on a table @@ -678,56 +435,68 @@ class User { $thiz->chat_ban = 0; $thiz->chat_dlt = 0; - $thiz->table = $table; + $thiz->table_orig = $table; + $thiz->table = $table; $thiz->table_pos = -1; $thiz->table_token = ""; return ($thiz); } - function &clone(&$from) + function copy(&$from) { GLOBAL $G_false; - if (($thiz =& new User()) == FALSE) - return ($G_false); - - $thiz->name = $from->name; - $thiz->sess = $from->sess; - $thiz->ip = $from->ip; - $thiz->lacc = $from->lacc; - $thiz->laccwr = $from->laccwr; - $thiz->bantime = $from->bantime; - $thiz->stat = $from->stat; - $thiz->subst = $from->subst; - $thiz->step = $from->step; - $thiz->trans_step = $from->trans_step; - $thiz->comm = array(); + $this->name = $from->name; + $this->sess = $from->sess; + $this->ip = $from->ip; + $this->lacc = $from->lacc; + $this->laccwr = $from->laccwr; + $this->bantime = $from->bantime; + $this->stat = $from->stat; + $this->subst = $from->subst; + $this->step = $from->step; + $this->trans_step = $from->trans_step; + $this->comm = array(); $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N)); for ($i = $i_start ; $i < $from->step ; $i++) { $ii = $i % COMM_N; - $thiz->comm[$ii] = $from->comm[$ii]; + $this->comm[$ii] = $from->comm[$ii]; } - $thiz->asta_card = $from->asta_card; - $thiz->asta_pnt = $from->asta_pnt; - $thiz->handpt = $from->handpt; - $thiz->exitislock = $from->exitislock; + $this->asta_card = $from->asta_card; + $this->asta_pnt = $from->asta_pnt; + $this->handpt = $from->handpt; + $this->exitislock = $from->exitislock; - $thiz->flags = $from->flags; + $this->flags = $from->flags; - $thiz->chattime = array(); + $this->chattime = array(); for ($i = 0 ; $i < CHAT_N ; $i++) - $thiz->chattime[$i] = $from->chattime[$i]; - $thiz->chat_cur = $from->chat_cur; - $thiz->chat_lst = $from->chat_lst; - $thiz->chat_ban = $from->chat_ban; - $thiz->chat_dlt = $from->chat_dlt; - - $thiz->table = $from->table; - $thiz->table_pos = $from->table_pos; - $thiz->table_token = $from->table_token; - $thiz->the_end = $from->the_end; + $this->chattime[$i] = $from->chattime[$i]; + $this->chat_cur = $from->chat_cur; + $this->chat_lst = $from->chat_lst; + $this->chat_ban = $from->chat_ban; + $this->chat_dlt = $from->chat_dlt; + + $this->table_orig = $from->table_orig; + $this->table = $from->table; + $this->table_pos = $from->table_pos; + $this->table_token = $from->table_token; + $this->the_end = $from->the_end; + + return (TRUE); + } + + + function &clone(&$from) + { + GLOBAL $G_false; + + if (($thiz =& new User()) == FALSE) + return ($G_false); + + $thiz->copy($from); return ($thiz); } @@ -774,7 +543,8 @@ class User { $thiz->chat_dlt = 0; - $thiz->table = $table; + $thiz->table_orig = $table; + $thiz->table = 0; $thiz->table_pos = $table_pos; $thiz->table_token = $from->table_token; @@ -851,6 +621,11 @@ class User { } // end class User + + + + + function step_get($sess) { $fp = FALSE; do { @@ -906,6 +681,7 @@ class Room { for ($i = 0 ; $i < TABLES_N ; $i++) { $this->table[$i] =& Table::create($i); + /* OLD METHOD if ($i < 12) { $row = ( (((int)($i / 4)) % 2) == 0 ); $col = ($i % 2 == 0); @@ -914,6 +690,11 @@ class Room { else { $this->table[$i]->auth_only = FALSE; } + */ + if ($i < 16) + $this->table[$i]->auth_only = TRUE; + else + $this->table[$i]->auth_only = FALSE; } $this->garbage_timeout = 0; } @@ -965,7 +746,7 @@ class Room { */ log_main("garbage_manager: INSIDE THE END."); - $plist = "$table_cur->table_token|$user_cur->table|$table_cur->player_n"; + $plist = "$table_cur->table_token|$table_cur->idx|$table_cur->player_n"; for ($i = 0 ; $i < $table_cur->player_n ; $i++) { $plist .= '|'.$this->user[$table_cur->player[$i]]->sess; } @@ -1081,8 +862,15 @@ class Room { { log_main("show_room: username: ".$user->name); - $ret = sprintf('gst.st = %d; ', $user_step); + + if ($user->flags & USER_FLAG_LISTAUTH) { + $ret .= 'list_set(\'auth\', false, \'(solo aut.)\' ); '; + } + else { + $ret .= 'list_set(\'all\', false, \'\' ); '; + } + if ($user->subst == 'standup') $ret .= "tra.show(); "; else @@ -1417,6 +1205,7 @@ class Room { $to_all = FALSE; $to_room = FALSE; $to_tabl = FALSE; + $is_normchat = FALSE; $update_room = FALSE; if (strcmp($msg, "/tav") == 0 || @@ -1487,6 +1276,18 @@ class Room { $to_all = show_notify($msg, 0, "chiudi", 400, 120); } while (0); } // /alarm chat command + else if (strncmp($msg, "/listen ", 8) == 0) { + $arg = substr($msg, 8); + + if (strcasecmp($arg, "auth") == 0) { + $user->flags |= USER_FLAG_LISTAUTH; + $to_user = 'list_set(\'auth\', true, \'(solo aut.)\'); '; + } + else { + $user->flags &= ~USER_FLAG_LISTAUTH; + $to_user = 'list_set(\'all\', true, \'\'); '; + } + } else if (strncmp($msg, "/garante", 8) == 0) { if ($user->flags & USER_FLAG_AUTH) { $to_user = sprintf('authbox(300,200);'); @@ -1496,6 +1297,15 @@ class Room { $to_user = sprintf('chatt_sub("%s", [2, "%s"],"Per autenticare qualcuno devi a tua volta essere autenticato.");', $dt, NICKSERV); } } + else if (strncmp($msg, "/mesgtoadm", 8) == 0) { + if ($user->flags & USER_FLAG_AUTH) { + $to_user = sprintf('mesgtoadmbox(500,300);'); + } + else { + /* MLANG: "Per inviare un messaggio devi essere autenticato." */ + $to_user = sprintf('chatt_sub("%s", [2, "%s"],"Per inviare un messaggio devi essere autenticato.");', $dt, NICKSERV); + } + } else if (strncmp($msg, "/nick ", 6) == 0) { log_main("chatt_send BEGIN"); @@ -1595,6 +1405,7 @@ class Room { } // nick chat command else { // normal chat line + $is_normchat = TRUE; if ($curtime < ($user->chat_ban + $user->chat_dlt)) { $only_you = TRUE; $user->chat_dlt = $user->chat_dlt * 2; @@ -1655,6 +1466,14 @@ class Room { if ($user_cur->sess == '' || $user_cur->stat == 'table' || $user_cur == $user) continue; + if ($is_normchat == TRUE) { + if ($user_cur->flags & USER_FLAG_LISTAUTH) { + if (($user->flags & USER_FLAG_AUTH) == 0) { + continue; + } + } + } + $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; $user_cur->comm[$user_cur->step % COMM_N] .= $to_room; $user_cur->step_inc(); @@ -1758,7 +1577,7 @@ class Room { function &add_user(&$sess, &$idx, $name, $pass, $ip) { - GLOBAL $G_false; + GLOBAL $G_false, $CO_list; $idx = 0; @@ -1873,7 +1692,15 @@ class Room { $this->user[$idx]->ip = $ip; $this->user[$idx]->flags = ($authenticate ? USER_FLAG_AUTH : 0x00); + + if ($authenticate) { + $this->user[$idx]->flags |= USER_FLAG_LISTAUTH; + if (isset($CO_list) && strcmp($CO_list, "all") == 0) { + $this->user[$idx]->flags &= ~USER_FLAG_LISTAUTH; + } + } + if ($ghost > -1) { log_main("ghost: rename!"); $ghost_user =& $this->user[$ghost]; -- 2.17.1 From a4a7154a92b3b6b20849b095a85407e27cea1115 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:10:49 +0000 Subject: [PATCH 07/16] improved inheritance between classes --- web/briskin5/Obj/briskin5.phh | 489 ++++++++++++++++++++++++++++++---- 1 file changed, 435 insertions(+), 54 deletions(-) diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 8e13a91..c8b93b9 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -8,21 +8,409 @@ define(BRISKIN5_SHM_DLT, 32768); $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.'); +class Card { + var $value; /* 0 - 39 card value */ + var $stat; /* 'bunch', 'hand', 'table', 'take' */ + var $owner; /* (table position 0-4) */ + // var $pos; /* Pos in hand. */ + var $x; /* When played the X position on the table of the owner. */ + var $y; /* When played the Y position on the table of the owner. */ + + function Card($value, $stat, $owner) + { + $this->value = $value; + $this->stat = $stat; // Card stat + $this->owner = $owner; + } + + function assign($stat,$owner) + { + $this->stat = $stat; // Card stat + $this->owner = $owner; + } + + function setpos($pos) + { + $this->pos = $pos; + } + + function play($x,$y) + { + $this->stat = 'table'; // Card stat + $this->x = $x; + $this->y = $y; + } + + function take($newown) + { + $this->stat = 'take'; // Card stat + $this->owner = $newown; + } +} // end class Card + +class Table_briskin5 extends Table { + var $card; // il mazzo di carte + var $mazzo; // chi e' di mazzo + var $gstart; + var $turn; + + var $asta_pla; + var $asta_pla_n; + var $asta_card; + var $asta_pnt; + + var $mult; + var $points; // points array + var $points_n; // number of row of points + var $total; + + var $asta_win; + var $briscola; + var $friend; + + var $old_reason; + var $old_asta_pnt; + var $old_pnt; + var $old_win; + var $old_friend; + + function Table_briskin5() + { + } + + + /* CREATE() NOT USED + function &create($idx) + { + GLOBAL $G_false; + + if (($thiz =& new Table_briskin5()) == FALSE) + return ($G_false); + + $thiz->create($idx); + + $thiz->card = FALSE; + $thiz->asta_pla = array(); // TRUE: in auction, FALSE: out of the auction + $thiz->asta_pla_n= -1; + $thiz->asta_card = -1; + $thiz->asta_pnt = -1; + $thiz->mult = 1; + + $thiz->points = array( ); + $thiz->points_n = 0; + $thiz->total = array( 0, 0, 0, 0, 0); + $thiz->asta_win = -1; + $thiz->briscola = -1; + $thiz->friend = -1; + $thiz->turn = 0; + + $thiz->old_reason = ""; + $thiz->old_asta_pnt = -1; + $thiz->old_pnt = -1; + $thiz->old_win = -1; + $thiz->old_friend = -1; + + return ($thiz); + } + */ + + /* CLONE() NOT USED + function &clone(&$from) + { + GLOBAL $G_false; + + if (($thiz =& new Table_briskin5()) == FALSE) + return ($G_false); + + parent::copy($from); + + $thiz->card = $from->card; + $thiz->mazzo = $from->mazzo; // REVIEW + $thiz->gstart = $from->gstart; + $thiz->turn = $from->turn; + + $thiz->asta_pla = $from->asta_pla; + $thiz->asta_pla_n = $from->asta_pla_n; + $thiz->asta_card = $from->asta_card; + $thiz->asta_pnt = $from->asta_pnt; + + $thiz->mult = $from->mult; + $thiz->points = $from->points; + $thiz->points_n = $from->points_n; + $thiz->total = $from->total; + + $thiz->asta_win = $from->asta_win; + $thiz->briscola = $from->briscola; + $thiz->friend = $from->friend; + + $thiz->old_reason = $from->old_reason; + $thiz->old_asta_pnt = $from->old_asta_pnt; + $thiz->old_pnt = $from->old_pnt; + $thiz->old_win = $from->old_win; + $thiz->old_friend = $from->old_friend; + + return ($thiz); + } + */ + + function parentcopy(&$from) + { + parent::copy($from); + } + + function &spawn(&$from) + { + GLOBAL $G_false; + + if (($thiz =& new Table_briskin5()) == FALSE) + return ($G_false); + + $thiz->parentcopy($from); + + log_main("PLAYER_N - spawn.".$thiz->player_n); + + $thiz->card = &$thiz->bunch_create(); + $thiz->mazzo = rand(0,PLAYERS_N-1); + $thiz->points_n = 0; + $thiz->mult = 1; + $thiz->old_win = -1; + $thiz->old_reason = ""; + + // players are rearranged in an dedicated array + $thiz->player = array(); + for ($i = 0 ; $i < $from->player_n ; $i++) + $thiz->player[$i] = $i; + + log_main("TABLE_OLD_WIN - spawn:".$thiz->old_win); + + return ($thiz); + } + + + function &bunch_create() + { + $ret = array(); + + for ($i = 0 ; $i < 40 ; $i++) { + $ret[$i] =& new Card($i, 'bunch', 'no_owner'); + } + + $oret = &$ret; + return ($oret); + } + + function bunch_make() + { + $ct = array(0,0,0,0,0); + + mt_srand(make_seed()); + + for ($i = 39 ; $i >= 0 ; $i--) + $rest[$i] = $i; + + for ($i = 39 ; $i >= 0 ; $i--) { + $rn = rand(0, $i); + + if ($rn == 0) + log_main("RND ZERO"); + + $id = $rest[$rn]; + + $owner = $i % PLAYERS_N; + $this->card[$id]->assign('hand', $owner); + + $rest[$rn] = $rest[$i]; + // $pubbpos[$rn2] = $pubbpos[$i]; + } + } + + function init(&$userarr) + { + /* MOVED INTO SPAWN + $this->mazzo = rand(0,PLAYERS_N-1); + $this->points_n = 0; + $this->mult = 1; + $this->old_win = -1; + $this->old_reason = ""; + */ + for ($i = 0 ; $i < PLAYERS_N ; $i++) { + $this->total[$i] = 0; + $user_cur = &$userarr[$this->player[$i]]; + $user_cur->exitislock = TRUE; + } + + log_main("table::init: ci siamo"); + } + + function game_init(&$userarr) + { + log_rd2("GSTART 4"); + + $this->gstart = ($this->mazzo+1) % PLAYERS_N; + $this->bunch_make(); + + + $this->asta_pla_n = PLAYERS_N; + $this->asta_card = -1; + $this->asta_pnt = 60; + $this->asta_win = -1; + $this->briscola = -1; + $this->friend = -1; + $this->turn = 0; + + for ($i = 0 ; $i < PLAYERS_N ; $i++) { + $this->asta_pla[$i] = TRUE; + $user_cur = &$userarr[$this->player[$i]]; + $user_cur->subst = 'asta'; + $user_cur->asta_card = -2; + $user_cur->asta_pnt = -1; + $user_cur->handpt = $this->hand_points($i); + // SEE function calculate_points(&$table) + } + } + + function game_next() + { + $this->mazzo = ($this->mazzo + 1) % PLAYERS_N; + } + + + function hand_points($idx) + { + GLOBAL $G_all_points; + + $tot = 0; + + for ($i = 0 ; $i < 40 ; $i++) { + if ($this->card[$i]->owner != $idx) + continue; + + $ctt = $this->card[$i]->value % 10; + $tot += $G_all_points[$ctt]; + } + + return ($tot); + } + + + function exitlock_show(&$userarr, $table_pos) + { + $ct = $this->exitlock_calc(&$userarr, $table_pos); + + $ret = sprintf('exitlock_show(%d, %s);', $ct, + ($userarr[$this->player[$table_pos]]->exitislock ? 'true' : 'false')); + return ($ret); + } + + function exitlock_calc(&$userarr, $table_pos) + { + $ct = 0; + + for ($i = 0 , $ct = 0 ; $i < PLAYERS_N ; $i++) { + if ($userarr[$this->player[$i]]->exitislock == FALSE) + $ct++; + } + + return ($ct); + } +} // end class Table_briskin5 + + + + + + +class User_briskin5 extends User { + var $asta_card; // + var $asta_pnt; // + var $handpt; // Total card points at the beginning of the current hand. + var $exitislock; // Player can exit from the table ? + + function User() { + } + + /* CREATE NOT USED + function &create($name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { + GLOBAL $G_false; + + if (($thiz =& new User()) == FALSE) + return ($G_false); + + $thiz->asta_card = -2; + $thiz->asta_pnt = -1; + $thiz->handpt = -1; + $thiz->exitislock = TRUE; + + return ($thiz); + } + */ + + function parentcopy(&$from) + { + parent::copy($from); + } + + function copy(&$from) + { + $this->parentcopy($from); + + $this->asta_card = $from->asta_card; + $this->asta_pnt = $from->asta_pnt; + $this->handpt = $from->handpt; + $this->exitislock = $from->exitislock; + } + + /* CLONE NOT USED + function &clone(&$from) + { + GLOBAL $G_false; + + if (($thiz =& new User()) == FALSE) + return ($G_false); + + $thiz->copy($from); + + return ($thiz); + } + */ + + function &spawn(&$from, $table, $table_pos) + { + GLOBAL $G_false; + + if (($thiz =& new User_briskin5()) == FALSE) + return ($G_false); + + $thiz->parentcopy($from); + + $thiz->asta_card = -2; + $thiz->asta_pnt = -1; + $thiz->handpt = -1; + $thiz->exitislock = TRUE; + + $thiz->table_orig = $table; + $thiz->table = 0; + $thiz->table_pos = $table_pos; + + return ($thiz); + } +} // end class User_briskin5 + + class Briskin5 { var $user; var $table; - var $table_idx; - var $table_token; - var $comm; // commands for many people var $step; // current step of the comm array var $garbage_timeout; + var $shm_sz; + + var $table_idx; + var $table_token; var $the_end; - var $tok; - var $shm_sz; function Briskin5 (&$room, $table_idx, $table_token) { $this->user = array(); @@ -42,9 +430,12 @@ class Briskin5 { for ($i = 0 ; $i < $table->player_n ; $i++) { $user[$table->player[$i]]->table_token = $table_token; - $this->user[$i] =& User::spawn(&$user[$table->player[$i]], 0, $i); + $this->user[$i] =& User_briskin5::spawn(&$user[$table->player[$i]], $table_idx, $i); } - $this->table[0] =& Table::spawn(&$table); + $this->table[0] =& Table_briskin5::spawn(&$table); + + log_main("TABLE_OLD_WIN - Briskin5:".$this->table[0]->old_win); + $this->table_idx = $table_idx; $this->table_token = $table_token; $this->garbage_timeout = 0; @@ -255,7 +646,7 @@ class Briskin5 { { GLOBAL $sess; - log_wr("LOCK_DATA ".FTOK_PATH."/table".$table_idx); + log_lock("LOCK_DATA ".FTOK_PATH."/table".$table_idx); // echo "LOCK: ".FTOK_PATH."/main"; // exit; // WARNING monitor this step @@ -348,20 +739,8 @@ class Briskin5 { $user_cur = &$this->user[$i]; if ($user_cur->sess == '') continue; - if ($user_cur->stat == 'room') { - if ($user->stat == 'room' && $user->subst == 'standup') { - $this->standup_update(&$user); - } - else if ($user->stat == 'room' && $user->subst == 'sitdown' || - $user->stat == 'table') { - log_main($user->sess." chatt_send pre table update"); - - $this->table_update(&$user); - - log_main($user->sess." chatt_send post table update"); - } - } - else if ($user_cur->stat == 'table' && $user_cur->table == $user->table) { + + if ($user_cur->stat == 'table' && $user_cur->table == $user->table) { $table = &$this->table[$user->table]; $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; @@ -407,7 +786,7 @@ class Briskin5 { $dt, $user->flags, xcape($user->name), xcape($user_mesg)); $user_cur->step_inc(); } - log_legal($curtime, $user, ($user->stat == 'room' ? 'room' : 'table '.$user->table),$user_mesg); + log_legal($curtime, $user, ($user->stat == 'room' ? 'room' : 'table '.$user->table_orig),$user_mesg); } } @@ -510,7 +889,7 @@ function calculate_points(&$table) if ($table->asta_pnt == 61 && $pro == 60) { // PATTA ! $table->points[$table->points_n % MAX_POINTS] = array(); - for ($i = 0 ; $i < PLAYERS_N ; $i++) + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) $table->points[$table->points_n % MAX_POINTS][$i] = 0; $table->points_n++; $table->old_pnt = $pro; @@ -525,7 +904,7 @@ function calculate_points(&$table) $sig = -1; $table->points[$table->points_n % MAX_POINTS] = array(); - for ($i = 0 ; $i < 5 ; $i++) { + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) { if ($i == $table->asta_win) $pt = ($i == $table->friend ? 4 : 2); else if ($i == $table->friend) @@ -581,20 +960,20 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) $ret .= sprintf('$("myname").innerHTML = "%s%s%s";', $itin, xcape($user->name), $itou); $ret .= sprintf('set_names([%d, "%s"], [%d, "%s"], [%d, "%s"], [%d, "%s"], [%d, "%s"]); ', - $room->user[$table->player[($table_pos)%PLAYERS_N]]->flags, - xcape($room->user[$table->player[($table_pos)%PLAYERS_N]]->name), + $room->user[$table->player[($table_pos) % BRISKIN5_PLAYERS_N]]->flags, + xcape($room->user[$table->player[($table_pos) % BRISKIN5_PLAYERS_N]]->name), - $room->user[$table->player[($table_pos+1)%PLAYERS_N]]->flags, - xcape($room->user[$table->player[($table_pos+1)%PLAYERS_N]]->name), + $room->user[$table->player[($table_pos+1) % BRISKIN5_PLAYERS_N]]->flags, + xcape($room->user[$table->player[($table_pos+1) % BRISKIN5_PLAYERS_N]]->name), - $room->user[$table->player[($table_pos+2)%PLAYERS_N]]->flags, - xcape($room->user[$table->player[($table_pos+2)%PLAYERS_N]]->name), + $room->user[$table->player[($table_pos+2) % BRISKIN5_PLAYERS_N]]->flags, + xcape($room->user[$table->player[($table_pos+2) % BRISKIN5_PLAYERS_N]]->name), - (PLAYERS_N == 3 ? 0 : $room->user[$table->player[($table_pos+3)%PLAYERS_N]]->flags), - (PLAYERS_N == 3 ? "" : xcape($room->user[$table->player[($table_pos+3)%PLAYERS_N]]->name)), + (BRISKIN5_PLAYERS_N == 3 ? 0 : $room->user[$table->player[($table_pos+3) % BRISKIN5_PLAYERS_N]]->flags), + (BRISKIN5_PLAYERS_N == 3 ? "" : xcape($room->user[$table->player[($table_pos+3) % BRISKIN5_PLAYERS_N]]->name)), - (PLAYERS_N == 3 ? 0 : $room->user[$table->player[($table_pos+4)%PLAYERS_N]]->flags), - (PLAYERS_N == 3 ? "" : xcape($room->user[$table->player[($table_pos+4)%PLAYERS_N]]->name))); + (BRISKIN5_PLAYERS_N == 3 ? 0 : $room->user[$table->player[($table_pos+4) % BRISKIN5_PLAYERS_N]]->flags), + (BRISKIN5_PLAYERS_N == 3 ? "" : xcape($room->user[$table->player[($table_pos+4) % BRISKIN5_PLAYERS_N]]->name))); } /* NOTIFY FOR THE CARD MAKER */ if ($is_transition) { // && $user->subst == "asta" superfluo @@ -613,10 +992,10 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) $ret .= "|"; for ($i = 0 ; $i < 8 ; $i++) { - for ($e = 0 ; $e < PLAYERS_N ; $e++) { + for ($e = 0 ; $e < BRISKIN5_PLAYERS_N ; $e++) { $ct = 0; for ($o = 0 ; $o < 40 && $ct < $i+1 ; $o++) { - if ($table->card[$o]->owner == (($e + $table->gstart) % PLAYERS_N)) { + if ($table->card[$o]->owner == (($e + $table->gstart) % BRISKIN5_PLAYERS_N)) { $ct++; if ($ct == $i+1) break; @@ -624,10 +1003,10 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) } log_rd("O ".$o." VAL ".$table->card[$o]->value." Owner: ".$table->card[$o]->owner); - $ret .= sprintf( ' card_send(%d,%d,%d,%8.2f,%d);|', ($table->gstart + $e) % PLAYERS_N, - $i, ((($e + PLAYERS_N - $table_pos + $table->gstart) % PLAYERS_N) == 0 ? + $ret .= sprintf( ' card_send(%d,%d,%d,%8.2f,%d);|', ($table->gstart + $e) % BRISKIN5_PLAYERS_N, + $i, ((($e + BRISKIN5_PLAYERS_N - $table_pos + $table->gstart) % BRISKIN5_PLAYERS_N) == 0 ? $table->card[$o]->value : -1), - ($i == 7 && $e == (PLAYERS_N - 1) ? 1 : 0.5),$i+1); + ($i == 7 && $e == (BRISKIN5_PLAYERS_N - 1) ? 1 : 0.5),$i+1); } } } @@ -653,7 +1032,7 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) } } $logg = "\n"; - for ($i = 0 ; $i < PLAYERS_N ; $i++) { + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) { $logg .= sprintf("INHAND: %d IN TABLE %d TAKED %d\n", $inhand[$i], $ontabl[$i], $taked[$i]); } log_main("Stat table: ".$logg); @@ -667,7 +1046,7 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) $ret .= sprintf('card_setours(%s);', $oursarg); /* Dispose all cards */ - for ($i = 0 ; $i < PLAYERS_N ; $i++) { + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) { /* Qui sotto al posto di + 1 c'era + ->gstart ... credo in modo errato */ $ret .= sprintf('cards_dispose(%d,%d,%d);', $i, $inhand[$i], $taked[$i]); @@ -685,12 +1064,12 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) /* show users auction status */ $showst = ""; - for ($i = 0 ; $i < PLAYERS_N ; $i++) { + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) { $user_cur = &$room->user[$table->player[$i]]; $showst .= sprintf("%s%d", ($i == 0 ? "" : ", "), ($user_cur->asta_card < 9 ? $user_cur->asta_card : $user_cur->asta_pnt)); } - if (PLAYERS_N == 3) + if (BRISKIN5_PLAYERS_N == 3) $showst .= ",-2,-2"; $ret .= sprintf('show_astat(%s);', $showst); @@ -701,7 +1080,7 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) } else { /* show auction */ - if ($table_pos == ($table->gstart % PLAYERS_N) && + if ($table_pos == ($table->gstart % BRISKIN5_PLAYERS_N) && $table->asta_win == -1) $ret .= sprintf('dispose_asta(%d,%d, %s);', $table->asta_card + 1, $table->asta_pnt+1, ($user->handpt <= 2 ? "true" : "false")); @@ -712,7 +1091,7 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) /* Remark */ if ($table->asta_win == -1) { // auction case - if ($table_pos == ($table->gstart % PLAYERS_N)) + if ($table_pos == ($table->gstart % BRISKIN5_PLAYERS_N)) $ret .= "remark_on();"; else $ret .= "remark_off();"; @@ -726,7 +1105,7 @@ function show_table(&$room, &$user, $sendstep, $is_transition, $is_again) } else if ($user->subst == 'game') { /* HIGHLIGHT */ - if (($table->gstart + $table->turn) % PLAYERS_N == $table_pos) + if (($table->gstart + $table->turn) % BRISKIN5_PLAYERS_N == $table_pos) $ret .= "is_my_time = true; remark_on();"; else $ret .= "remark_off();"; @@ -767,7 +1146,7 @@ function calculate_winner(&$table) $cur_seed = $cur_val - ($cur_val % 10); } - for ($i = 0 ; $i < PLAYERS_N ; $i++) { + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) { if (($ontab[$i] - ($ontab[$i] % 10)) == $cur_seed) { if ($ontab[$i] < $cur_val) { $cur_val = $ontab[$i]; @@ -776,7 +1155,7 @@ function calculate_winner(&$table) } } - for ($i = 0 ; $i < PLAYERS_N ; $i++) { + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) { $table->card[$ontid[$i]]->owner = $cur_win; $table->card[$ontid[$i]]->stat = "take"; // Card stat } @@ -792,7 +1171,7 @@ function show_table_info(&$room, &$table, $table_pos) $noty = sprintf(''); // Names. - for ($i = 0 ; $i < PLAYERS_N ; $i++) + for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) $noty .= sprintf('', xcape($room->user[$table->player[$i]]->name)); $noty .= sprintf(""); @@ -801,14 +1180,14 @@ function show_table_info(&$room, &$table, $table_pos) for ($i = $pnt_min ; $i < $table->points_n ; $i++) { $noty .= sprintf('', $i+1); - for ($e = 0 ; $e < PLAYERS_N ; $e++) + for ($e = 0 ; $e < BRISKIN5_PLAYERS_N ; $e++) $noty .= sprintf('', $table->points[$i % MAX_POINTS][$e]); $noty .= ""; } // Total points. $noty .= ''; - for ($e = 0 ; $e < PLAYERS_N ; $e++) + for ($e = 0 ; $e < BRISKIN5_PLAYERS_N ; $e++) $noty .= sprintf('', $table->total[$e]); $noty .= "
%s
%d%d
Tot.%d
"; @@ -817,7 +1196,9 @@ function show_table_info(&$room, &$table, $table_pos) } if ($table->old_win != -1) { + log_main("TABLE_OLD_WIN:".$table->old_win); $win = $table->player[$table->old_win]; + log_main("TABLE_OLD_FRIEND:".$table->old_friend); $fri = $table->player[$table->old_friend]; $wol = game_result($table->old_asta_pnt, $table->old_pnt); @@ -861,12 +1242,12 @@ function show_table_info(&$room, &$table, $table_pos) if ($user->subst == 'asta') { if ($table->asta_win == -1) // auction case - $curplayer = $table->gstart % PLAYERS_N; + $curplayer = $table->gstart % BRISKIN5_PLAYERS_N; else $curplayer = $table->asta_win; } else if ($user->subst == 'game') { - $curplayer = ($table->gstart + $table->turn) % PLAYERS_N; + $curplayer = ($table->gstart + $table->turn) % BRISKIN5_PLAYERS_N; } /* MLANG: " tocca a te giocare.", " tocca a $unam giocare.", " La partita vale %s.", "torna alla partita" */ -- 2.17.1 From d4d10ccef12155675f0b6d1c658e16101e4dbad5 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:11:19 +0000 Subject: [PATCH 08/16] updated --- CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5bdc117..8c0b765 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +2.1.6 + ENH commands menu added + ENH /listen and /mesgtoadm commands added + ENH improved inheritance between classes + ENH auth only tables disposition changed + 2.1.5 ENH myconsole.js facility added (js) ENH rendering of standup users area (func j_stand_cont()) refactored with a more -- 2.17.1 From ea9ea2b7924e1aa5e55f5cbc3909375a38b9d730 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:12:35 +0000 Subject: [PATCH 09/16] /listen and /mesgtoadm commands added --- web/room.js | 125 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 99 insertions(+), 26 deletions(-) diff --git a/web/room.js b/web/room.js index 9cc2616..0e0aed9 100644 --- a/web/room.js +++ b/web/room.js @@ -44,7 +44,7 @@ function state_add(flags) break; } if (name != "") { - content += ''; + content += ' '; } } @@ -435,20 +435,6 @@ function j_login_manager(form) return (false); } -function formtext_hilite(obj) -{ - obj.className = 'input_text'; - addEvent(obj, "focus", function () { this.className = 'input_text_hi'; }); - addEvent(obj, "blur", function () { this.className = 'input_text'; }); -} - -function formsub_hilite(obj) -{ - obj.className = 'input_sub'; - addEvent(obj, "focus", function () { this.className = 'input_sub_hi'; }); - addEvent(obj, "blur", function () { this.className = 'input_sub'; }); -} - function login_formtext_hilite() { formtext_hilite($("nameid")); @@ -462,12 +448,32 @@ function login_init() login_formtext_hilite(); } -function warrant_formtext_hilite() +function warrant_formtext_hilite(form) { + /* formtext_hilite($("nameid")); formtext_hilite($("emailid")); formsub_hilite($("subid")); formsub_hilite($("cloid")); + */ + formtext_hilite(form.elements['name']); + formtext_hilite(form.elements['email']); + formsub_hilite(form.elements['sub']); + formsub_hilite(form.elements['clo']); +} + +function mesgtoadm_formtext_hilite(form) +{ + /* + formtext_hilite($("subjid")); + formtext_hilite($("mesgid")); + formsub_hilite($("subid")); + formsub_hilite($("cloid")); + */ + formtext_hilite(form.elements['subj']); + formtext_hilite(form.elements['mesg']); + formsub_hilite(form.elements['sub']); + formsub_hilite(form.elements['clo']); } @@ -482,14 +488,17 @@ function j_authbox(form) { var no; - if (form.elements['realsub'].value == "chiudi") { - $('authbox').style.visibility = "hidden"; - return (false); - } + do { + if (form.elements['realsub'].value == "chiudi") { + $('authbox').style.visibility = "hidden"; + break; + } + + if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false) { + no = new notify(gst, "
I campi user e/o e-mail non sono validi;
correggeteli per favore.", 1, "chiudi", 280, 100); + break; + } - if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false) - no = new notify(gst, "
I campi user e/o e-mail non sono validi;
correggeteli per favore.", 1, "chiudi", 280, 100); - else { // submit the request token = server_request('mesg', 'warranty', 'cli_name', encodeURIComponent(form.elements['name'].value), @@ -498,9 +507,9 @@ function j_authbox(form) $('authbox').style.visibility = "hidden"; form.elements['name'].value = ""; form.elements['email'].value = ""; - return (false); + break; } - } + } while (0); return (false); } @@ -517,8 +526,72 @@ function authbox(w, h) box.style.height = h+"px"; box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop; - warrant_formtext_hilite(); + warrant_formtext_hilite($('auth_form')); box.style.visibility = "visible"; $("nameid").focus(); } + +function j_mesgtoadmbox(form) +{ + var no; + + do { + if (form.elements['realsub'].value == "chiudi") { + $('mesgtoadmbox').style.visibility = "hidden"; + break; + } + + if (form.elements['mesg'].value == '' || form.elements['subj'].value == '') { + no = new notify(gst, "
Il soggetto e il messaggo non possono essere vuoti;
correggeteli per favore.", 1, "chiudi", 280, 100); + break; + } + + // submit the request + token = server_request('mesg', 'mesgtoadm', + 'cli_subj', encodeURIComponent(form.elements['subj'].value), + 'cli_mesg', encodeURIComponent(form.elements['mesg'].value) ); + if (token == "1") { + $('mesgtoadmbox').style.visibility = "hidden"; + form.elements['subj'].value = ""; + form.elements['mesg'].value = ""; + break; + } + } while (0); + + return (false); +} + +function mesgtoadmbox(w, h) +{ + var box; + + box = $('mesgtoadmbox'); + + 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; + + mesgtoadm_formtext_hilite($('mesgtoadm_form')); + + box.style.visibility = "visible"; + $('mesgtoadm_form').elements['subj'].focus(); +} + +function list_set(what, setco, info) +{ + if (what == 'auth') { + $('list_auth').style.color = 'red'; + $('list_all').style.color = 'black'; + } + else { + $('list_auth').style.color = 'black'; + $('list_all').style.color = 'red'; + } + $('list_info').innerHTML = info; + if (setco) { + createCookie("CO_list", what, 24*365, cookiepath); + } +} -- 2.17.1 From 2e54dcfdff207c16de16adc34eb1f28da838ecd9 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:13:34 +0000 Subject: [PATCH 10/16] messages reader --- bin/procmsg.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bin/procmsg.sh diff --git a/bin/procmsg.sh b/bin/procmsg.sh new file mode 100755 index 0000000..2eb25be --- /dev/null +++ b/bin/procmsg.sh @@ -0,0 +1,18 @@ +#!/bin/bash +src="$1" +IFS=" +" +for i in `cat $src`; do + dt="$(echo $i | cut -d '|' -f 1)" + user="$(echo $i | cut -d '|' -f 2)" + subj="$(echo $i | cut -d '|' -f 3)" + mesg="$(echo $i | cut -d '|' -f 4)" + + echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" + echo "Date :" | tr -d '\n' + date -d @$dt + echo "User: $user" + echo "Subject: $subj" + echo -e "$mesg" + echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" +done \ No newline at end of file -- 2.17.1 From cb0ba3960a1911a231d114b25560e8bce211a79a Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:19:28 +0000 Subject: [PATCH 11/16] copyright updated --- web/Obj/auth.phh | 2 +- web/Obj/hardban.phh | 2 +- web/briskin5/Obj/briskin5.phh | 24 ++++++++++++++++++++++++ web/briskin5/index.php | 2 +- web/briskin5/index_rd.php | 2 +- web/briskin5/index_wr.php | 2 +- web/briskmeeting.php | 24 ++++++++++++++++++++++++ web/briskmeeting2.php | 26 +++++++++++++++++++++++++- web/briskmeeting3.php | 24 ++++++++++++++++++++++++ web/index_rd.php | 2 +- web/index_wr.php | 2 +- 11 files changed, 104 insertions(+), 8 deletions(-) diff --git a/web/Obj/auth.phh b/web/Obj/auth.phh index a52bc78..8231830 100644 --- a/web/Obj/auth.phh +++ b/web/Obj/auth.phh @@ -2,7 +2,7 @@ /* * brisk - auth.phh * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2009 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it diff --git a/web/Obj/hardban.phh b/web/Obj/hardban.phh index 239ed7d..34dd864 100644 --- a/web/Obj/hardban.phh +++ b/web/Obj/hardban.phh @@ -2,7 +2,7 @@ /* * brisk - auth.phh * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2009 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index c8b93b9..1afb8b2 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -1,4 +1,28 @@ diff --git a/web/briskmeeting2.php b/web/briskmeeting2.php index 34005f5..04618fb 100644 --- a/web/briskmeeting2.php +++ b/web/briskmeeting2.php @@ -1,4 +1,28 @@ @@ -75,7 +99,7 @@ Bevande:
-

Come si articolerà la giornata

+

Come si articoleranno le giornate

  • ritrovo in tarda mattinata (9:30-10:00)
  • diff --git a/web/briskmeeting3.php b/web/briskmeeting3.php index c349a39..31a4362 100644 --- a/web/briskmeeting3.php +++ b/web/briskmeeting3.php @@ -1,4 +1,28 @@ diff --git a/web/index_rd.php b/web/index_rd.php index 473a6fd..da00f1d 100644 --- a/web/index_rd.php +++ b/web/index_rd.php @@ -2,7 +2,7 @@ /* * brisk - index_rd.php * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2009 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it diff --git a/web/index_wr.php b/web/index_wr.php index 60c9af9..f1e55f1 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -2,7 +2,7 @@ /* * brisk - index_wr.php * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2009 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it -- 2.17.1 From 16ee6bb0f47aa75592741f51523b47b61255a347 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 29 Mar 2009 08:58:10 +0000 Subject: [PATCH 12/16] correct special char --- web/Obj/brisk.phh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 19bae1d..63656ed 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -112,7 +112,7 @@ Dopo che è iniziata una partita per uscirne dovete chiedere agli altri gi
    /st <stato> - cambia l\'icona associata al tuo user; stato può valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\", \\"presente\\" oppure \\"sigaretta\\"
    /garante - se si è autenticati permette di garantire per un utente fidato
    /mesgtoadm - se si è autenticati permette di lasciare un messaggio all\'amministratore del sito -
    /listen <all|auth> - se si è autenticati permette leggere solo i messaggi degli altri autenticati (auth) o di tutti (all) +
    /listen <all or auth> - se si è autenticati permette leggere solo i messaggi degli altri autenticati (auth) o di tutti (all) '; -- 2.17.1 From f62bcf4727b440b940afee728b58be12a8d2620e Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 1 Apr 2009 07:37:45 +0000 Subject: [PATCH 13/16] return bug fixed, sidebanner, bg updated --- web/Obj/brisk.phh | 16 ++++++++++++---- web/brisk.css | 2 +- web/commons.js | 19 +++++++++++++++++++ web/index.php | 19 ++++++++++++++++++- web/index_wr.php | 8 ++++---- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 63656ed..14c071d 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -27,7 +27,7 @@ define(BRISK_CONF, "brisk.conf.pho"); define(FTOK_PATH, "/var/lib/brisk"); define(LEGAL_PATH, "/tmp/legal_brisk"); define(PROXY_PATH, "/var/lib/brisk_proxy"); -define(TABLES_N, 32); +define(TABLES_N, 36); define(PLAYERS_N, 3); define(MAX_POINTS, 5); define(MAX_PLAYERS, (20 + (PLAYERS_N * TABLES_N))); @@ -80,10 +80,10 @@ $G_lng = ""; // $G_lng = "_en"; $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 ); -$G_brisk_version = "2.1.6 - trusty"; +$G_brisk_version = "2.1.7 - trusty"; /* MLANG: ALL THE INFO STRINGS IN brisk.phh */ -$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': menu comandi e filtro sui non autenticati.', +$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': menu comandi, filtro opzionale sui non autenticati e "return bug" corretto.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ); $G_room_help= ' @@ -144,6 +144,14 @@ function xcapelt($s) return (str_replace($from, $to, $s)); } +function xcapemesg($s) +{ + $from = array ( "\n"); + $to = array ( "\\n"); + + return (str_replace($from, $to, $s)); +} + class Table { var $idx; @@ -691,7 +699,7 @@ class Room { $this->table[$i]->auth_only = FALSE; } */ - if ($i < 16) + if ($i < 12) $this->table[$i]->auth_only = TRUE; else $this->table[$i]->auth_only = FALSE; diff --git a/web/brisk.css b/web/brisk.css index e586175..76dfd5b 100644 --- a/web/brisk.css +++ b/web/brisk.css @@ -24,7 +24,7 @@ */ body { - background-image: url('img/wip_bg.jpg'); + background-image: url('img/brisk2bg.jpg'); background-color: #fafafa; background-repeat: no-repeat; background-position: top center; diff --git a/web/commons.js b/web/commons.js index c5eba32..63bb79b 100644 --- a/web/commons.js +++ b/web/commons.js @@ -890,6 +890,25 @@ function topbanner_cb() // console.log("A: "+a+" B: "+b); } +function sidebanner_init() +{ + setInterval(sidebanner_cb, 666); +; +} + +function sidebanner_cb() +{ + var a, b; + + a = $('sidebanner').style.backgroundColor; + b = $('sidebanner').style.borderLeftColor; + + $('sidebanner').style.backgroundColor = b; + $('sidebanner').style.borderColor = a+" "+a+" "+a+" "+a; + + // console.log("A: "+a+" B: "+b); +} + function langtolng(lang) { diff --git a/web/index.php b/web/index.php index bc0735f..effe155 100644 --- a/web/index.php +++ b/web/index.php @@ -46,6 +46,7 @@ log_load("index.php"); function main() { GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local; + GLOBAL $G_with_sidebanner, $G_sidebanner; GLOBAL $sess, $name, $pass_private, $table_idx, $table_token, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER; GLOBAL $G_lang, $G_lng, $mlang_room; $is_login = FALSE; @@ -465,6 +466,9 @@ supported by:

    if ($G_with_topbanner) { printf(" topbanner_init();\n"); } + if ($G_with_sidebanner) { + printf(" sidebanner_init();\n"); + } ?> g_withflash = DetectFlashVer(6,0,0); @@ -484,6 +488,9 @@ supported by:

    printf($brisk_header_form); printf("
    \n"); printf($brisk_vertical_menu, '', ''); + if ($G_with_sidebanner) { + printf("

    %s", $G_sidebanner); + } printf("
    "); ?> @@ -577,6 +584,10 @@ else { if ($G_with_topbanner) { printf(" topbanner_init();\n"); } + if ($G_with_sidebanner) { + printf(" sidebanner_init();\n"); + } + ?> xhr_rd = createXMLHttpRequest(); // xhr_rd.setRequestHeader("Content-type", "text/html; charset=utf-8"); @@ -613,8 +624,14 @@ if ($is_login) {
    \n"); - printf($brisk_vertical_menu, '



    ', + /* printf($brisk_vertical_menu, '



    ', + $brisk_donate);*/ + printf($brisk_vertical_menu, '

    ', $brisk_donate); + + if ($G_with_sidebanner) { + printf("

    %s", $G_sidebanner); + } printf("
    "); ?> diff --git a/web/index_wr.php b/web/index_wr.php index f1e55f1..80c7edd 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -52,7 +52,7 @@ if (array_search($_SERVER['REMOTE_ADDR'], $G_black_list) !== FALSE) { $is_spawn = FALSE; -log_wr('COMM: '.$mesg); +log_wr('COMM: '.xcapemesg($mesg)); $sem = Room::lock_data(); if (($room = &Room::load_data()) == FALSE) { @@ -63,7 +63,7 @@ if (($room = &Room::load_data()) == FALSE) { } if (($user = &$room->get_user($sess, &$idx)) == FALSE) { Room::unlock_data($sem); - $argz = explode('|', $mesg); + $argz = explode('|', xcapemesg($mesg)); if ($argz[0] == 'getchallenge') { GLOBAL $cli_name; @@ -119,7 +119,7 @@ if (($user = &$room->get_user($sess, &$idx)) == FALSE) { } exit; } -$argz = explode('|', $mesg); +$argz = explode('|', xcapemesg($mesg)); log_wr('POSTSPLIT: '.$argz[0]); @@ -261,7 +261,7 @@ else if ($user->stat == 'room') { } else if ($argz[0] == 'chatt') { - $room->chatt_send(&$user,$mesg); + $room->chatt_send(&$user, xcapemesg($mesg)); } /********************** * * -- 2.17.1 From d6e78ab1c534675fdaf838c17375850f414d4c3e Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sat, 4 Apr 2009 16:15:46 +0000 Subject: [PATCH 14/16] 'alarm bug' fixed --- web/Obj/brisk.phh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 14c071d..4fefa54 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -717,6 +717,9 @@ class Room { $curtime = time(); if ($force || $this->garbage_timeout < $curtime) { + // FIXME BRISK4: include for each kind of table + require_once("briskin5/Obj/briskin5.phh"); + // Before all align times with table timeout for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) { $table_cur =& $this->table[$table_idx]; @@ -1489,6 +1492,8 @@ class Room { } if ($to_tabl) { + // FIXME BRISK4: include for each kind of table + require_once("briskin5/Obj/briskin5.phh"); // Before all align times with table timeout for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) { $table_cur =& $this->table[$table_idx]; @@ -1664,6 +1669,8 @@ class Room { // If user at the table we need to update the table data too $table_idx = $ghost_user->table; if ($ghost_user->stat == "table" && $this->table[$table_idx]->player_n == PLAYERS_N) { + // FIXME BRISK4: include for each kind of table + require_once("briskin5/Obj/briskin5.phh"); if (($brisem = Briskin5::lock_data($table_idx)) != FALSE) { if (($bri = &Briskin5::load_data($table_idx)) != FALSE) { if ($bri->the_end != TRUE) { -- 2.17.1 From e18c2d271172bc19f1c999cc9498989c3eb87800 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 10 May 2009 16:43:58 +0000 Subject: [PATCH 15/16] sideslide added --- web/index.php | 102 +++++++++++++++++++++++++++++++++++++------------- web/room.js | 63 +++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 26 deletions(-) diff --git a/web/index.php b/web/index.php index effe155..ece7b3c 100644 --- a/web/index.php +++ b/web/index.php @@ -191,29 +191,62 @@ function main() $standup .= '
    '; } - $altout_propag = array( array ( 'id' => 'btn_altout', + $altout_sponsor_arr = array( array ( 'id' => 'btn_altout', 'url' => 'http://www.alternativeoutput.it', 'content' => 'img/altout80x15.png', - 'content_big' => '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') + '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', + 'content_big' => 'img/brichi_big.png'), + array ( 'id' => 'btn_foroli', + 'url' => 'http://www.forumolimpia.it', + 'content' => 'img/forumolimpia.gif', + 'content_big' => 'img/forumolimpia_big.png' ) ); + + + + $altout_support = ""; + 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']); + } + + // seed with microseconds since last "whole" second - srand ((double) microtime() * 1000000); - // $randval = rand(0,count($altout_propag)-1); - $randval = 1; - $altout_carousel = sprintf('', - $altout_propag[$randval]['url'], - $altout_propag[$randval]['id'], - $altout_propag[$randval]['content']); - - $altout_carousel_big = sprintf('', - $altout_propag[$randval]['id'], - $altout_propag[$randval]['content_big']); - + // srand ((double) microtime() * 1000000); + // $randval = rand(0,count($altout_sponsor_arr)-1); + $altout_sponsor = ""; + 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('', + $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) @@ -411,20 +444,30 @@ $brisk_vertical_menu = '
    -sponsored by:

    '.$altout_carousel.'
    -

    +sponsored by:

    +
    +
    '.$altout_sponsor.'
    +
    +
    +'.$altout_sponsor_big.' +
    +
    supported by:

    -
    -
    -
    +
    +
    '.$altout_support.'
    + +
    +
    +
    +'.$altout_support_big.' +
    + +


    %s %s - - - -'.$altout_carousel_big.''; +
    '; /* Templates. */ if ($ACTION == 'login') { @@ -457,10 +500,14 @@ supported by:

    var topbanner_sfx, topbanner_dx; var g_brow = null; var sess = "not_connected"; - + var spo_slide, sup_slide; + window.onload = function() { // alert(window.onbeforeunload); g_brow = get_browser_agent(); + spo_slide = new sideslide($('spon_caro'), 80, 20); + sup_slide = new sideslide($('supp_caro'), 60, 20); + login_init();
    window.onload = function() { g_brow = get_browser_agent(); + spo_slide = new sideslide($('spon_caro'), 80, 20); + sup_slide = new sideslide($('supp_caro'), 60, 20); + diff --git a/web/room.js b/web/room.js index 0e0aed9..85c9275 100644 --- a/web/room.js +++ b/web/room.js @@ -595,3 +595,66 @@ function list_set(what, setco, info) createCookie("CO_list", what, 24*365, cookiepath); } } + +function sideslide(domobj, height, step) +{ + this.st = 'wait'; + this.twait = 5000; + + this.domobj = domobj; + this.height = height; + this.step = step; + + this.start(); +} + +sideslide.prototype = { + id: null, + st: 'wait', + twait: 0, + scroll: 0, + countdown: 0, + + domobj: null, + height: 0, + step: 0, + + start: function() { + var instant = this; + + this.st = 'wait'; + this.id = setTimeout(function () { instant.sideslide_cb(); }, this.twait); + }, + + sideslide_cb: function() { + var instant = this; + + if (this.st == 'wait') { + this.st = 'scroll'; + this.countdown = 10; + this.id = setInterval(function () { instant.sideslide_cb(); }, 100); + } + else if (this.st == 'scroll') { + this.scroll += (this.step / 10); + if (this.scroll >= this.height - this.step) { + this.scroll = 0; + } + this.domobj.scrollTop = this.scroll; + this.countdown--; + if (this.countdown == 0) { + this.stop(); + this.st = 'wait'; + this.id = setTimeout(function () { instant.sideslide_cb(); }, this.twait); + } + } + }, + + + stop: function() { + if (this.id != null) { + clearInterval(this.id); + this.id = null; + } + } + +} -- 2.17.1 From 056cba1fe06db39680272547592467452a2bf768 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sat, 23 May 2009 09:29:53 +0000 Subject: [PATCH 16/16] updated --- TODO.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index 1561f89..da873b7 100644 --- a/TODO.txt +++ b/TODO.txt @@ -9,7 +9,7 @@ BUG --- - - paste da demauroparavia + DONE - paste da demauroparavia DONE - recupero partita per re-login con password DONE - problema "|" nei nomi (manca enhance degli script lato server) - problema col treno se mouse sopra mentre stringe (verif) @@ -47,7 +47,7 @@ DONE - for status - for password - - reload home + DONE - reload home - notify for long pages - buddy list -- 2.17.1