FEATURES |
----------+
+
+ - improved S
+ . db update (add components, maybe single string)
+ . filter in index.php
+ . filter in index_wr.php
+
- prefs API:
. prefs_assign(content): assign json content as output var
. prefs_apply(prefs_new): apply new content to g_prefs and system
--- /dev/null
+ALTER TABLE #PFX#users ADD COLUMN last_dona timestamp DEFAULT to_timestamp(0) -- last donate
+ALTER TABLE #PFX#users ADD COLUMN supp_comp text DEFAULT 'ff0000ffff00' -- fg/bg supporter color
\ No newline at end of file
class Client_prefs {
var $listen;
+ var $supp_comp;
function Client_prefs()
{
{
fprintf(STDERR, "QQ %s: %x\n", __FUNCTION__, $user->flags);
$this->listen = ($user->flags & USER_FLAG_MAP_AUTH) >> 2;
+ $this->supp_comp = $user->rec->supp_comp;
fprintf(STDERR, "QQ %s: LISTEN: %d\n", __FUNCTION__, $this->listen);
}
else {
$json = $json_s;
}
- $this->listen = $json->listen;
+ $this->listen = $json->listen;
+ $this->supp_comp = $json->supp_comp;
return TRUE;
}
$user->flags_set(($this->listen << 2), USER_FLAG_MAP_AUTH);
fprintf(STDERR, "QQ %s::%s %x\n", __CLASS__, __FUNCTION__,
$user->flags);
+ $user->rec->supp_comp = $this->supp_comp;
if ($is_save)
$user->store_set();
}
$this->user[$idx]->bantime = 0;
$this->user[$idx]->ip = $ip;
+ $this->user[$idx]->rec = $authenticate;
+ fprintf(STDERR, "MOP: [%s]\n", $authenticate->supp_comp);
$this->user[$idx]->flags = $user_type;
$this->user[$idx]->flags |= ($authenticate != FALSE ? USER_FLAG_AUTH : 0x00);
$this->user[$idx]->flags |= ( ($pass != FALSE && $bdb == FALSE) ? USER_FLAG_DBFAILED : 0x00);
var $pass;
var $email;
var $type;
+ var $last_dona;
+ var $supp_comp;
- function LoginDBItem($code, $login, $pass, $email, $type)
+ function LoginDBItem($code, $login, $pass, $email, $type, $last_dona, $supp_comp)
{
- $this->code = $code;
- $this->login = $login;
- $this->pass = $pass;
- $this->email = $email;
- fprintf(STDERR, "QQ: %s: %x\n", __FUNCTION__, $type);
- $this->type = $type;
+ $this->code = $code;
+ $this->login = $login;
+ $this->pass = $pass;
+ $this->email = $email;
+ $this->type = $type;
+ $this->last_dona = $last_dona;
+ $this->supp_comp = $supp_comp;
}
static function LoginDBItemFromRecord($rec)
{
$ret = new LoginDBItem($rec->code, $rec->login, $rec->pass,
- $rec->email, $rec->type);
+ $rec->email, $rec->type, $rec->last_dona,
+ $rec->supp_comp);
return ($ret);
}
function type_get()
{
- fprintf(STDERR, "TYPE GET: %d\n", $this->type);
return $this->type;
}
+ function last_dona_get()
+ {
+ return $this->last_dona;
+ }
+
+ function supp_comp_get()
+ {
+ return $this->supp_comp;
+ }
+
}
?>
\ No newline at end of file
return TRUE;
}
- function user_update_flags($code, $flags)
+ function user_prefs_update($code, $flags, $supp_comp)
{
GLOBAL $G_dbpfx;
- $user_sql = sprintf("UPDATE %susers SET (type) = (%d) WHERE code = %d;", $G_dbpfx, $flags, $code);
+ $user_sql = sprintf("UPDATE %susers SET (type, supp_comp) = (%d, '%s') WHERE code = %d;",
+ $G_dbpfx, $flags, $supp_comp, $code);
fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
return FALSE;
var $table_pos; // idx on the table
var $table_token;// token that identify a game on a table
var $flags; // Bitfield with: AUTHENTICATE: 0x02
+ var $rec; // field with user db record or FALSE
var $the_end; // Flag to change the end of the session
var $chat_lst; // Last chat line
$thiz->exitislock = TRUE;
$thiz->flags = 0x00;
-
+ $thiz->rec = FALSE;
+
$thiz->chattime = array_fill(0, CHAT_N, 0);
$thiz->chat_cur = 0;
$thiz->chat_lst = "";
$this->exitislock = $from->exitislock;
$this->flags = $from->flags;
+ $this->rec = $from->rec;
$this->chattime = array();
for ($i = 0 ; $i < CHAT_N ; $i++)
$thiz->the_end = $from->the_end;
$thiz->flags = $from->flags;
+ $thiz->rec = $from->rec;
$thiz->chattime = array_fill(0, CHAT_N, 0);
$thiz->chat_cur = 0;
if (($bdb = BriskDB::create()) == FALSE) {
return FALSE;
}
- return ($bdb->user_update_flags($this->code, ($this->flags & (USER_FLAG_TY_ALL | USER_FLAG_MAP_AUTH))));
+ return ($bdb->user_prefs_update($this->code, ($this->flags & (USER_FLAG_TY_ALL | USER_FLAG_MAP_AUTH)),
+ $this->rec->supp_comp));
}
function rd_data_set($curtime, $transp, $enc, $stat, $subst, $step, $from)
function $(id) { return document.getElementById(id); }
+function dec2hex(d, padding)
+{
+ var hex = Number(d).toString(16);
+ padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
+
+ while (hex.length < padding) {
+ hex = "0" + hex;
+ }
+
+ return hex;
+}
+
function getStyle(x,IEstyleProp, MozStyleProp)
{
if (x.currentStyle) {
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="img/brisk_ico.png">
<script type="text/javascript" src="commons.js"></script>
+<script type="text/javascript" src="prefs.js"></script>
<!-- <script type="text/javascript" src="myconsole.js"></script> -->
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript" src="heartbit.js"></script>
// alert(window.onbeforeunload);
g_brow = get_browser_agent();
- g_prefs = new client_prefs();
+ g_prefs = new client_prefs(null);
spo_slide = new sideslide($('spon_caro'), 80, 20);
sup_slide = new sideslide($('supp_caro'), 80, 20);
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="img/brisk_ico.png">
<script type="text/javascript" src="commons.js"></script>
+<script type="text/javascript" src="prefs.js"></script>
<!-- <script type="text/javascript" src="myconsole.js"></script> -->
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript" src="ticker.js"></script>
window.onload = function() {
g_brow = get_browser_agent();
- g_prefs = new client_prefs();
+ g_prefs = new client_prefs(null);
spo_slide = new sideslide($('spon_caro'), 80, 20);
sup_slide = new sideslide($('supp_caro'), 80, 20);
<!--#
# LISTEN
#-->
+<div style="float: left; padding: 8px;">
<table style="border: 1px solid gray;"><tr><th style="background-color: #cccccc;">
<?php echo $mlang_room['itm_list'][$G_lang];?>
</th></tr>
-<tr><td><input style="vertical-align: bottom;" id="ra_listen_all" type="radio" name="listen" value="0" onclick="prefs_update();" title="'
+<tr><td><input style="vertical-align: bottom;" id="ra_listen_all" type="radio" name="listen" value="0" onclick="prefs_update('listen');" title="'
<?php echo $mlang_room['listall_desc'][$G_lang];?>
'"><span id="list_all">
<?php echo $mlang_room['tit_listall'][$G_lang];?>
</span></td></tr>
-<tr><td><input style="vertical-align: bottom;" id="ra_listen_auth" type="radio" name="listen" value="1" onclick="prefs_update();" title="'
+<tr><td><input style="vertical-align: bottom;" id="ra_listen_auth" type="radio" name="listen" value="1" onclick="prefs_update('listen');" title="'
<?php echo $mlang_room['listaut_desc'][$G_lang];?>
'"><span id="list_auth">
<?php echo $mlang_room['tit_listaut'][$G_lang];?>
</span></td></tr>
-<tr><td><input style="vertical-align: bottom;" id="ra_listen_isol" type="radio" name="listen" value="2" onclick="prefs_update();" title="'
+<tr><td><input style="vertical-align: bottom;" id="ra_listen_isol" type="radio" name="listen" value="2" onclick="prefs_update('listen');" title="'
<?php echo $mlang_room['listisol_desc'][$G_lang];?>
'"><span id="list_isol">
<?php echo $mlang_room['tit_listisol'][$G_lang];?>
</span></td></tr>
</table>
+</div>
+<!--#
+ # SUPPORTER ONLY
+ #-->
+<div style="float: left; padding: 8px;">
+<table style="border: 1px solid gray;"><tr><th colspan="3" style="background-color: #cccccc;">
+xx<?php echo $mlang_room['itm_list'][$G_lang];?>
+</th></tr>
+<tr>
+<td><input style="width: 3em;" id="s_fg_r" type="text" maxlength="3" size="3" name="s_fg_r"
+ onchange="prefs_update('supp');" value="255"
+ title="'<?php echo $mlang_room['listall_desc'][$G_lang];?>'">
+ <span id="list_all">xx<?php echo $mlang_room['tit_listall'][$G_lang];?></span></td>
+<td><input style="width: 3em;" id="s_fg_g" type="text" maxlength="3" size="3" name="s_fg_g"
+ onchange="prefs_update('supp');" value="255"
+ title="'<?php echo $mlang_room['listall_desc'][$G_lang];?>'">
+ <span id="list_all">xx<?php echo $mlang_room['tit_listall'][$G_lang];?></span></td>
+<td><input style="width: 3em;" id="s_fg_b" type="text" maxlength="3" size="3" name="s_fg_b"
+ onchange="prefs_update('supp');" value="255"
+ title="'<?php echo $mlang_room['listall_desc'][$G_lang];?>'">
+ <span id="list_all">xx<?php echo $mlang_room['tit_listall'][$G_lang];?></span></td>
+</tr>
+<tr>
+<td><input style="width: 3em;" id="s_bg_r" type="text" maxlength="3" size="3" name="s_bg_r"
+ onchange="prefs_update('supp');" value="255"
+ title="'<?php echo $mlang_room['listall_desc'][$G_lang];?>'">
+ <span id="list_all">xx<?php echo $mlang_room['tit_listall'][$G_lang];?></span></td>
+<td><input style="width: 3em;" id="s_bg_g" type="text" maxlength="3" size="3" name="s_bg_g"
+ onchange="prefs_update('supp');" value="255"
+ title="'<?php echo $mlang_room['listall_desc'][$G_lang];?>'">
+ <span id="list_all">xx<?php echo $mlang_room['tit_listall'][$G_lang];?></span></td>
+<td><input style="width: 3em;" id="s_bg_b" type="text" maxlength="3" size="3" name="s_bg_b"
+ onchange="prefs_update('supp');" value="255"
+ title="'<?php echo $mlang_room['listall_desc'][$G_lang];?>'">
+ <span id="list_all">xx<?php echo $mlang_room['tit_listall'][$G_lang];?></span></td>
+</tr>
+<tr><td colspan="3">
+<img id="s_img" class="nobo" src="img/noimg.png">
+</td></tr>
+</table>
+</div>
<div style="width: 95%; /* background-color: red; */ margin: auto; text-align: left;">
--- /dev/null
+var l_list_all = 0x00;
+var l_list_auth = 0x01;
+var l_list_isol = 0x02;
+
+function client_prefs(old)
+{
+ if (old != null) {
+ this.listen = old.listen;
+ this.supp_comp = old.supp_comp;
+ }
+}
+
+client_prefs.prototype = {
+ listen: -1,
+ supp_comp: 'ff00ffff00'
+}
+
+function prefs_assign(content)
+{
+ var prefs_new;
+ var s;
+
+ s = "prefs_new = " + content;
+ eval(s);
+
+ return (prefs_new);
+}
+
+var prefs_list_idx = new Array( 0x00, 0x01, 0x02 );
+var prefs_list_id = new Array( "all", "auth", "isol" );
+
+function prefs_apply(prefs_new, is_update, is_volat)
+{
+ var i;
+ var relo = false;
+
+ if (typeof(g_prefs) == 'undefined')
+ return false;
+ /* listen management */
+ if (g_prefs.listen != prefs_new.listen || is_update) {
+ for (i = 0 ; i < prefs_list_idx.length ; i++) {
+ set_checked_value($('ra_listen_'+prefs_list_id[i]), prefs_new.listen);
+ if (prefs_new.listen == prefs_list_idx[i]) {
+ if (!is_volat)
+ $('list_'+prefs_list_id[i]).style.color = 'red';
+ $('list_info').innerHTML = mlang_commons['tit_list'][i][g_lang];
+ }
+ else {
+ if (!is_volat)
+ $('list_'+prefs_list_id[i]).style.color = 'black';
+ }
+ }
+
+ relo = true;
+ }
+
+ // supporter component management
+ if (g_prefs.supp_comp != prefs_new.supp_comp || is_update) {
+ $('s_img').src = 'suprend.php?comp='+prefs_new.supp_comp;
+ }
+
+ if (relo || !is_update) {
+ for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
+ if (i % 4 == 0) {
+ $('tr_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
+ }
+
+ $('td_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
+ }
+ if (prefs_new.listen == l_list_isol) {
+ tra.hide_noauth();
+ }
+ else {
+ tra.show_noauth();
+ }
+
+ if (false) {
+ // ricalculation of standup area
+ if (standup_data_old != null) {
+ standup_data = standup_data_old;
+ standup_data_old = null;
+ j_stand_cont(standup_data);
+ }
+ }
+ }
+
+ g_prefs.listen = prefs_new.listen;
+ g_prefs.supp_comp = prefs_new.supp_comp;
+}
+
+function prefs_load(content, is_update, is_volat)
+{
+ var prefs_new;
+
+ // console.log('prefs_load('+content+')');
+
+ if ((prefs_new = prefs_assign(content)) == null)
+ return false;
+
+ return prefs_apply(prefs_new, is_update, is_volat);
+}
+
+function prefs_save()
+{
+ var ret;
+
+ if (typeof(g_prefs) == 'undefined')
+ return false;
+
+ ret = server_request('mesg', 'prefs','__POST__', 'prefs', JSON.stringify(g_prefs));
+
+ if (ret == 1)
+ $('preferences').style.visibility = 'hidden';
+}
+
+function prefs_update(field)
+{
+ var i;
+ var prefs_new;
+ var relo = false;
+
+ // console.log("prefs_update("+field+")");
+
+ if (typeof(g_prefs) == 'undefined')
+ return false;
+
+ prefs_new = new client_prefs(g_prefs);
+
+ if (field == 'listen') {
+ /* listen management */
+ for (i = 0 ; i < prefs_list_idx.length ; i++) {
+ prefs_new.listen = get_checked_value($('ra_listen_'+prefs_list_id[i]));
+ if (prefs_new.listen != '')
+ break;
+ }
+ }
+ else if (field == 'supp') {
+ prefs_new.supp_comp = "" + dec2hex($('s_fg_r').value, 2) + dec2hex($('s_fg_g').value, 2) + dec2hex($('s_fg_b').value, 2) + dec2hex($('s_bg_r').value, 2) + dec2hex($('s_bg_g').value, 2) + dec2hex($('s_bg_b').value, 2);
+ }
+
+ /* from form to struct */
+ prefs_apply(prefs_new, true, true);
+}
+
+function list_set(what, is_update, info)
+{
+ var i;
+ var relo = false;
+ var old_st = readCookie("CO_list");
+
+ if (what == 'auth') {
+ $('list_auth').style.color = 'red';
+ $('list_isol').style.color = 'black';
+ $('list_all').style.color = 'black';
+ if (old_st == 'isolation')
+ relo = true;
+ g_listen = l_list_auth;
+ }
+ else if (what == 'isolation') {
+ $('list_auth').style.color = 'black';
+ $('list_isol').style.color = 'red';
+ $('list_all').style.color = 'black';
+ if (old_st != 'isolation')
+ relo = true;
+ g_listen = l_list_isol;
+ }
+ else {
+ $('list_auth').style.color = 'black';
+ $('list_isol').style.color = 'black';
+ $('list_all').style.color = 'red';
+ if (old_st == 'isolation')
+ relo = true;
+ g_listen = l_list_all;
+ }
+
+ set_checked_value($('ra_listen_auth'), what);
+ set_checked_value($('ra_listen_isol'), what);
+ set_checked_value($('ra_listen_all'), what);
+
+ $('list_info').innerHTML = info;
+ if (is_update) {
+ createCookie("CO_list", what, 24*365, cookiepath);
+ }
+
+
+ if (relo || !is_update) {
+ for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
+
+ if (i % 4 == 0) {
+ $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
+ }
+
+ $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
+ }
+ if (what == 'isolation') {
+ tra.hide_noauth();
+ }
+ else {
+ tra.show_noauth();
+ }
+
+ if (false) {
+ // ricalculation of standup area
+ if (standup_data_old != null) {
+ standup_data = standup_data_old;
+ standup_data_old = null;
+ j_stand_cont(standup_data);
+ }
+ }
+ }
+}
*/
-var l_list_all = 0x00;
-var l_list_auth = 0x01;
-var l_list_isol = 0x02;
-
-function client_prefs()
-{
-}
-
-client_prefs.prototype = {
- listen: -1
-}
-
function state_add(flags)
{
var content = "", supercont = "";
return (false);
}
-function prefs_assign(content)
-{
- var prefs_new;
- var s;
-
- s = "prefs_new = " + content;
- eval(s);
-
- return (prefs_new);
-}
-
-var prefs_list_idx = new Array( 0x00, 0x01, 0x02 );
-var prefs_list_id = new Array( "all", "auth", "isol" );
-
-function prefs_apply(prefs_new, is_update, is_volat)
-{
- var i;
- var relo = false;
-
- if (typeof(g_prefs) == 'undefined')
- return false;
- /* listen management */
- if (g_prefs.listen != prefs_new.listen || is_update) {
- for (i = 0 ; i < prefs_list_idx.length ; i++) {
- set_checked_value($('ra_listen_'+prefs_list_id[i]), prefs_new.listen);
- if (prefs_new.listen == prefs_list_idx[i]) {
- if (!is_volat)
- $('list_'+prefs_list_id[i]).style.color = 'red';
- $('list_info').innerHTML = mlang_commons['tit_list'][i][g_lang];
- }
- else {
- if (!is_volat)
- $('list_'+prefs_list_id[i]).style.color = 'black';
- }
- }
-
- relo = true;
- }
-
-
- // TO BE ANALYZED !!!
- // if (is_update) {
- // createCookie("CO_list", what, 24*365, cookiepath);
- // }
-
-
- if (relo || !is_update) {
- for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
- if (i % 4 == 0) {
- $('tr_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
- }
-
- $('td_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
- }
- if (prefs_new.listen == l_list_isol) {
- tra.hide_noauth();
- }
- else {
- tra.show_noauth();
- }
-
- if (false) {
- // ricalculation of standup area
- if (standup_data_old != null) {
- standup_data = standup_data_old;
- standup_data_old = null;
- j_stand_cont(standup_data);
- }
- }
- }
-
- g_prefs.listen = prefs_new.listen;
-}
-
-function prefs_load(content, is_update, is_volat)
-{
- var prefs_new;
-
- if ((prefs_new = prefs_assign(content)) == null)
- return false;
-
- return prefs_apply(prefs_new, is_update, is_volat);
-}
-
-function prefs_save()
-{
- var ret;
-
- if (typeof(g_prefs) == 'undefined')
- return false;
-
- ret = server_request('mesg', 'prefs','__POST__', 'prefs', JSON.stringify(g_prefs));
-
- if (ret == 1)
- $('preferences').style.visibility = 'hidden';
-}
-
-function prefs_update()
-{
- var i;
- var prefs_new;
- var relo = false;
-
- if (typeof(g_prefs) == 'undefined')
- return false;
-
- prefs_new = new client_prefs();
-
- /* listen management */
- for (i = 0 ; i < prefs_list_idx.length ; i++) {
- prefs_new.listen = get_checked_value($('ra_listen_'+prefs_list_id[i]));
- if (prefs_new.listen != '')
- break;
- }
-
- /* from form to struct */
- prefs_apply(prefs_new, true, true);
-}
-
-function list_set(what, is_update, info)
-{
- var i;
- var relo = false;
- var old_st = readCookie("CO_list");
-
- if (what == 'auth') {
- $('list_auth').style.color = 'red';
- $('list_isol').style.color = 'black';
- $('list_all').style.color = 'black';
- if (old_st == 'isolation')
- relo = true;
- g_listen = l_list_auth;
- }
- else if (what == 'isolation') {
- $('list_auth').style.color = 'black';
- $('list_isol').style.color = 'red';
- $('list_all').style.color = 'black';
- if (old_st != 'isolation')
- relo = true;
- g_listen = l_list_isol;
- }
- else {
- $('list_auth').style.color = 'black';
- $('list_isol').style.color = 'black';
- $('list_all').style.color = 'red';
- if (old_st == 'isolation')
- relo = true;
- g_listen = l_list_all;
- }
-
- set_checked_value($('ra_listen_auth'), what);
- set_checked_value($('ra_listen_isol'), what);
- set_checked_value($('ra_listen_all'), what);
-
- $('list_info').innerHTML = info;
- if (is_update) {
- createCookie("CO_list", what, 24*365, cookiepath);
- }
-
-
- if (relo || !is_update) {
- for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
-
- if (i % 4 == 0) {
- $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
- }
-
- $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
- }
- if (what == 'isolation') {
- tra.hide_noauth();
- }
- else {
- tra.show_noauth();
- }
-
- if (false) {
- // ricalculation of standup area
- if (standup_data_old != null) {
- standup_data = standup_data_old;
- standup_data_old = null;
- j_stand_cont(standup_data);
- }
- }
- }
-}
function sideslide(domobj, height, step)
{
--- /dev/null
+<?php
+$comps = $_GET['comp'];
+$c = array();
+
+if (mb_strlen($comps, "ASCII") != 12)
+ exit;
+
+for ($i = 0, $idx = 0 ; $i < 12 ; $i++) {
+ if (($comps[$i] >= '0' && $comps[$i] <= '9') ||
+ ($comps[$i] >= 'a' && $comps[$i] <= 'f')) {
+ if (($i % 2) == 1) {
+ $c[$idx] = hexdec(substr($comps, $i-1, 2));
+ $idx++;
+ }
+ continue;
+ }
+ exit;
+}
+
+header ('Content-type: image/png');
+$img_r = @imagecreatefrompng("img/sup_msk_r.png");
+$img_y = @imagecreatefrompng("img/sup_msk_y.png");
+
+$ret = imagefilter($img_r, IMG_FILTER_COLORIZE, $c[0], $c[1], $c[2], 0);
+$ret = imagefilter($img_y, IMG_FILTER_COLORIZE, $c[3], $c[4], $c[5], 0);
+
+imagecopy($img_r, $img_y, 0,0, 0,0, 21, 16);
+
+imagesavealpha($img_r, TRUE);
+
+imagepng($img_r);
+?>