From: Matteo Nastasi (mop) Date: Thu, 23 May 2013 06:30:08 +0000 (+0200) Subject: first lines in moderation window X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=9c32b198f916bdf20fc051b86bba6092b105ca9e;p=brisk.git first lines in moderation window --- diff --git a/INSTALL.sh b/INSTALL.sh index b021de5..0af7213 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -9,7 +9,7 @@ apache_conf="/etc/apache2/sites-available/default" players_n=3 tables_n=44 tables_auth_n=12 -brisk_auth_conf="brisk_spu_auth.conf.pho" +brisk_auth_conf="brisk_auth.conf.pho" brisk_debug="0x0400" # brisk_debug="0xffff" web_path="/home/nastasi/web/brisk" diff --git a/sql/sql.d/100-anagr.sql.noinsert b/sql/sql.d/100-anagr.sql.noinsert index f4e1400..c0fb115 100644 --- a/sql/sql.d/100-anagr.sql.noinsert +++ b/sql/sql.d/100-anagr.sql.noinsert @@ -9,9 +9,9 @@ -- define(USER_FLAG_TY_SUSPEND, 0x00400000); // done -- define(USER_FLAG_TY_DISABLE, 0x00800000); // done -INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (1, 'uno', md5('one'), 'uno@pluto.com', CAST (X'00020000' as integer), 0); -INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (2, 'due', md5('two'), 'due@pluto.com', CAST (X'00010000' as integer), 0); -INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (3, 'tre', md5('thr'), 'tre@pluto.com', CAST (X'00010000' as integer), 0); -INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00010000' as integer), 0); -INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (5, 'cin', md5('fiv'), 'cin@pluto.com', CAST (X'00010000' as integer), 0); +INSERT INTO #PFX#users (code, login, pass, email, type) VALUES (1, 'uno', md5('one'), 'uno@pluto.com', CAST (X'00020000' as integer)); +INSERT INTO #PFX#users (code, login, pass, email, type) VALUES (2, 'due', md5('two'), 'due@pluto.com', CAST (X'00010000' as integer)); +INSERT INTO #PFX#users (code, login, pass, email, type) VALUES (3, 'tre', md5('thr'), 'tre@pluto.com', CAST (X'00010000' as integer)); +INSERT INTO #PFX#users (code, login, pass, email, type) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00010000' as integer)); +INSERT INTO #PFX#users (code, login, pass, email, type) VALUES (5, 'cin', md5('fiv'), 'cin@pluto.com', CAST (X'00010000' as integer)); diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 44b00f4..f7430b5 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -782,6 +782,34 @@ class Client_prefs { } } +class ModerationItem +{ + var $table; + var $date; + var $content; + + function ModerationItem($where, $date, $content) + { + $this->where = $where; + $this->time = $time; + $this->content = $content; + } +} + +class Moderation +{ + var $row; + + function Moderation() + { + $this->item = Array(); + } + + function get_all() + { + return json_encode($this->item); + } +} class Room { @@ -1653,33 +1681,38 @@ class Room } if ($to_room != FALSE) { - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - $user_cur = $this->user[$i]; - if ($target != "" && $user_cur->name != $target) - continue; - if ($user_cur->sess == '' || $user_cur->stat == 'table' || $user->idx_get() == $i) - continue; - - if ($is_normchat == TRUE) { - // use MAP_AUTH to check if auth or isolation - if ($user_cur->flags & USER_FLAG_MAP_AUTH) { - if (($user->flags & USER_FLAG_AUTH) == 0) { - continue; + for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { + $user_cur = $this->user[$i]; + if ($target != "" && $user_cur->name != $target) + continue; + if ($user_cur->sess == '' || $user_cur->stat == 'table' || $user->idx_get() == $i) + continue; + + if ($is_normchat == TRUE) { + // use MAP_AUTH to check if auth or isolation + if ($user_cur->flags & USER_FLAG_MAP_AUTH) { + if (($user->flags & USER_FLAG_AUTH) == 0) { + continue; + } + } } - } - } - /* - else if ($is_ticker) { - if (($user_cur->flags & USER_FLAG_MAP_AUTH) == USER_FLAG_ISOLAUTH) { - if ($user->table >= TABLES_AUTH_N) + /* + else if ($is_ticker) { + if (($user_cur->flags & USER_FLAG_MAP_AUTH) == USER_FLAG_ISOLAUTH) { + if ($user->table >= TABLES_AUTH_N) 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; + + if ($user_cur->flags_vlt_get(USER_FLAG_MODER)) { + $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('$$(moder_win, "mainbody").innerHTML += "%s
";' , + xcape($to_room) ); + } + $user_cur->step_inc(); } - */ - $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(); - } } if ($to_tabl) { diff --git a/web/Obj/user.phh b/web/Obj/user.phh index 3e37535..87c93fb 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -53,6 +53,9 @@ define('USER_FLAG_S_VISCH', 0x0f); // done define('USER_FLAG_S_ALL', 0xff); // done +/* does is user moderationg brisk ? */ +define('USER_FLAG_MODER', 0x0100); // done + /* type of user normal, supporter etc ... */ define('USER_FLAG_TY_ALL', 0xff0000); // done define('USER_FLAG_TY_NORM', 0x010000); // done @@ -120,6 +123,8 @@ class User { var $table_orig; // id of the current table when you aren't in game var $table_pos; // idx on the table var $table_token;// token that identify a game on a table + + var $flags_volat;// Bitfield of volatile flags var $flags; // Bitfield with: AUTHENTICATE: 0x02 var $flags_vlt; // Volatile flags valid for this session only var $rec; // field with user db record or FALSE @@ -307,6 +312,11 @@ class User { return ($thiz); } + function flags_get($mask) + { + return ($this->flags & $mask); + } + function flags_set($flags, $mask) { $flags_old = $this->flags; @@ -315,6 +325,11 @@ class User { return ($flags_old != $this->flags); } + function flags_vlt_get($mask) + { + return ($this->flags_vlt & $mask); + } + function flags_vlt_set($flags_vlt, $mask) { $flags_vlt_old = $this->flags_vlt; diff --git a/web/commons.js b/web/commons.js index 713a4be..7ba8b31 100644 --- a/web/commons.js +++ b/web/commons.js @@ -54,6 +54,8 @@ var mlang_commons = { 'imgload_a' : { 'it' : 'Immagine caricate ', function $(id) { return document.getElementById(id); } +function $$(win, id) { return win.document.getElementById(id); } + function dec2hex(d, padding) { var hex = Number(d).toString(16); @@ -451,6 +453,27 @@ function act_logout(exitlock) send_mesg("logout|"+exitlock); } +var moder_win = null; +var moder_cur = -1; +function act_moderate() +{ + send_mesg("moderate"); +} + +function moderate(enable) +{ + if (enable) { + moder_win = window.open("moderation.php", "moderation", "width=800,height=600,toolbar=no,location=no,menubar=no,status=no"); + } + else { + if (moder_win != null) { + moder_win.close(); + moder_win = null; + moder_cur = -1; + } + } +} + function act_reloadroom() { window.onunload = null; @@ -458,6 +481,7 @@ function act_reloadroom() document.location.assign("index.php"); } + function act_shutdown() { var c = 0; diff --git a/web/index.php b/web/index.php index 0b3076a..d606335 100644 --- a/web/index.php +++ b/web/index.php @@ -50,6 +50,10 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati 'en' => '
The nickname you are using it\'s already registered,

if its proprietary authenticates

you will named ghostN.'), 'btn_rettabs' => array('it' => 'torna ai tavoli', 'en' => 'back to tables'), + 'btn_moder' => array('it' => 'Modera.', + 'en' => 'Moderate.'), + 'btn_reload' => array('it' => 'Reload.', + 'en' => 'Reload.'), 'btn_exit' => array('it' => 'Esco.', 'en' => 'Exit.'), 'btn_prefs_save' => array('it' => 'Salva.', @@ -407,8 +411,15 @@ function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $coo $standup .= '
'.$mlang_room['standing'][$G_lang].'
'; $standup .= sprintf('
'); - // MLANG Esco. - $standup .= '
'; + // MLANG (Modera) Reload Esco. + // TODO: moderation button if moderator only + if (1 == 1) { + $moder_button = ''; + } + else { + $moder_button = ''; + } + $standup .= '
'.$moder_button.'
'; $standup .= ''; } @@ -888,6 +899,7 @@ supported by:
var g_listen; var g_withflash = false; var g_is_spawn = 0; + var g_moder = -1; var gst = new globst(); var topbanner_sfx, topbanner_dx; var g_brow = null; diff --git a/web/index_wr.php b/web/index_wr.php index ae8bfa7..f47071c 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -355,9 +355,6 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $user->step_inc(); } } - - - else if ($argz[0] == 'poll') { GLOBAL $G_with_poll, $G_poll_name; if (($cli_choose = gpcs_var('cli_choose', $get, $post, $cookie)) === FALSE) @@ -470,7 +467,24 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) echo "$echont"; } - + else if ($argz[0] == 'moderate') { + // TODO: add certification check + if (1 == 1) { + if ($user->flags_vlt_get(USER_FLAG_MODER) == 0) { + /* enable moderation */ + $moder_enable = 'true'; + $user->flags_vlt_set(USER_FLAG_MODER, USER_FLAG_MODER); + } + else { + /* disable moderation */ + $moder_enable = 'false'; + $user->flags_vlt_set(0, USER_FLAG_MODER); + } + $user->comm[$user->step % COMM_N] = sprintf("gst.st = %d; moderate(%s);", + $user->step+1, $moder_enable); + $user->step_inc(); + } + } /****************** * * * STAT: room *