-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
+ALTER TABLE #PFX#users ADD COLUMN last_dona integer DEFAULT 0; -- last donate
+ALTER TABLE #PFX#users ADD COLUMN supp_comp text DEFAULT 'ff0000ffff00' -- fg/bg supporter color
\ No newline at end of file
{
$thiz = new Client_prefs();
if ($thiz->json_load($json) == FALSE) {
+ unset($thiz);
return (FALSE);
}
function json_load($json_s)
{
- if (gettype($json_s) == "string") {
- if (($json = json_decode($json_s)) == FALSE)
- return FALSE;
- }
- else {
- $json = $json_s;
- }
- $this->listen = $json->listen;
- $this->supp_comp = $json->supp_comp;
+ $ret = FALSE;
+
+ do {
+ if (gettype($json_s) == "string") {
+ if (($json = json_decode($json_s)) == FALSE)
+ break;
+ }
+ else {
+ $json = $json_s;
+ }
+ if ($this->listen < 0 || $this->listen > 2)
+ break;
+ $this->listen = $json->listen;
+
+ if (mb_strlen($json->supp_comp, "ASCII") != 12)
+ break;
- return TRUE;
+ for ($i = 0, $idx = 0 ; $i < 12 ; $i++) {
+ if (($json->supp_comp[$i] >= '0' && $json->supp_comp[$i] <= '9') ||
+ ($json->supp_comp[$i] >= 'a' && $json->supp_comp[$i] <= 'f'))
+ continue;
+ break;
+ }
+ if ($i < 12)
+ break;
+ $this->supp_comp = $json->supp_comp;
+ $ret = TRUE;
+ } while (FALSE);
+
+ return ($ret);
}
function store($user, $is_save)
$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 ($user->rec != FALSE && $user->rec->last_dona > 1356994800) {
+ $user->rec->supp_comp = $this->supp_comp;
+ }
if ($is_save)
$user->store_set();
}
$content = ' j_stand_cont( [ ';
+ $user_cur_id = $user->idx_get();
for ($i = 0 , $ct = 0 ; $i < MAX_PLAYERS ; $i++) {
if ($this->user[$i]->sess == "" || $this->user[$i]->stat != "room" || $this->user[$i]->name == "")
continue;
$flags = $this->user[$i]->flags;
-
+
+ // sql record exists AND last donate > 2013-01-01
+ if ($this->user[$i]->rec != FALSE && $this->user[$i]->rec->last_dona > 1356994800) {
+ $supp_comp_s = sprintf(', "%s"', $this->user[$i]->rec->supp_comp);
+ }
+ else {
+ $supp_comp_s = '';
+ }
+
if ($this->user[$i]->subst == "standup") {
- if ($user->idx_get() == $i) {
+ if ($user_cur_id == $i) {
$flags |= 1;
}
- $content .= sprintf('%s[ %d, "%s" ]',($ct > 0 ? ', ' : ''), $flags, xcape($this->user[$i]->name));
+ $content .= sprintf('%s[ %d, "%s"%s ]',($ct > 0 ? ', ' : ''), $flags,
+ xcape($this->user[$i]->name), $supp_comp_s);
$ct++;
}
}
if ($user->stat != 'room')
return;
+ $user_cur_id = $user->idx_get();
$content = "[ ";
for ($i = 0 ; $i < $table->player_n ; $i++) {
$user_cur = $this->user[$table->player[$i]];
$flags = $user_cur->flags;
- if ($user->idx_get() == $table->player[$i])
+ if ($user_cur_id == $table->player[$i])
$flags |= 1;
log_main($user_cur->name. sprintf(" IN TABLE [%d]", $table_idx));
-
- $content .= sprintf('%s[ %d, "%s" ]',($i == 0 ? '' : ', '), $flags, xcape($user_cur->name));
+ if ($user_cur->rec != FALSE && $user_cur->rec->last_dona > 1356994800)
+ $supp_comp_s = sprintf(', "%s"', $user_cur->rec->supp_comp);
+ else
+ $supp_comp_s = '';
+
+ $content .= sprintf('%s[ %d, "%s"%s ]',($i == 0 ? '' : ', '), $flags,
+ xcape($user_cur->name), $supp_comp_s);
}
$content .= ' ]';
var val_el;
content = user_decorator(el);
- content += state_add(el[0]);
+ content += state_add(el[0],(typeof(el[2]) != 'undefined' ? el[2] : null));
return (content);
}
'listaut_desc' => array('it' => 'leggi soltanto i messaggi degli utenti con password',
'en' => 'listen messages only from authenticated users'),
'listisol_desc'=> array('it' => 'visualizza Brisk come se fosse solo per utenti con password',
- 'en' => 'show Brisk like an authenticated user only site'),
+ 'en' => 'show Brisk like an authenticated user only site'),
+ 'suppcomp_tit' => array('it' => 'personalizza la tua S',
+ 'en' => 'customize your S'),
+ 'suppcomp_r' => array('it' => 'rosso',
+ 'en' => 'red'),
+ 'suppcomp_g' => array('it' => 'verde',
+ 'en' => 'green'),
+ 'suppcomp_b' => array('it' => 'blu',
+ 'en' => 'blue'),
+ 'suppcomp_fg' => array('it' => 'colore',
+ 'en' => 'color'),
+ 'suppcomp_bg' => array('it' => 'sfondo',
+ 'en' => 'background'),
+ 'suppcomp_range' => array('it' => '(0-255)',
+ 'en' => '(0-255)'),
'tit_splash' => array('it' => 'splash',
'en' => 'splash'),
'splash_desc' => array('it' => 'attiva la finestra di splash',
</table>
</div>
+<?php
+if ($user->rec != FALSE && $user->rec->last_dona > 1356994800) {
+?>
<!--#
# 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];?>
+<table style="border: 1px solid gray;"><tr><th colspan="4" style="background-color: #cccccc;">
+<?php echo $mlang_room['suppcomp_tit'][$G_lang];?>
</th></tr>
<tr>
-<td><input style="width: 3em;" id="s_fg_r" type="text" maxlength="3" size="3" name="s_fg_r"
+<th>
+<?php echo $mlang_room['suppcomp_fg'][$G_lang];?>
+</th><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>
+ title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
+ <span id="list_all"><?php echo $mlang_room['suppcomp_r'][$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>
+ title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
+ <span id="list_all"><?php echo $mlang_room['suppcomp_g'][$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>
+ title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
+ <span id="list_all"><?php echo $mlang_room['suppcomp_b'][$G_lang];?></span></td>
</tr>
<tr>
+<th>
+<?php echo $mlang_room['suppcomp_bg'][$G_lang];?>
+</th>
<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>
+ title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
+ <span id="list_all"><?php echo $mlang_room['suppcomp_r'][$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>
+ title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
+ <span id="list_all"><?php echo $mlang_room['suppcomp_g'][$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>
+ title="'<?php echo $mlang_room['suppcomp_range'][$G_lang];?>'">
+ <span id="list_all"><?php echo $mlang_room['suppcomp_b'][$G_lang];?></span></td>
</tr>
-<tr><td colspan="3">
+<tr><td colspan="4">
<img id="s_img" class="nobo" src="img/noimg.png">
</td></tr>
</table>
</div>
-
-
+<?php
+}
+else {
+?>
+<input id="s_fg_r" type="hidden" name="s_fg_r">
+<input id="s_fg_g" type="hidden" name="s_fg_g">
+<input id="s_fg_b" type="hidden" name="s_fg_b">
+<input id="s_bg_r" type="hidden" name="s_bg_r">
+<input id="s_bg_g" type="hidden" name="s_bg_g">
+<input id="s_bg_b" type="hidden" name="s_bg_b">
+<input id="s_img" type="hidden" name="s_bg_b">
+<?php
+}
+?>
<div style="width: 95%; /* background-color: red; */ margin: auto; text-align: left;">
<br><br>
<!-- <input type="checkbox" name="pref_ring_endauct" id="pref_ring_endauct" onclick="pref_ring_endauct_set(this);"><?php /* echo $mlang_room['itm_ringauc'][$G_lang]; */ ?> -->
return FALSE;
}
- $prefs = Client_prefs::from_json($post['prefs']);
+ if (($prefs = Client_prefs::from_json($post['prefs'])) == FALSE) {
+ $prefs = Client_prefs::from_user($user);
+ }
fprintf(STDERR, "\n\n PREFS [%s]\n\n", print_r($prefs, TRUE));
$prefs->store($user, TRUE);
$user->comm[$user->step % COMM_N] .= sprintf('prefs_load(\'%s\', true, %s);', json_encode($prefs),
'false');
$user->step_inc();
+
+ if ($user->stat == 'room' && $user->subst == 'standup') {
+ $room->standup_update($user);
+ }
+ else if ($user->stat == 'room' && $user->subst == 'sitdown') {
+ log_main("chatt_send pre table update");
+ $room->table_update($user);
+ log_main("chatt_send post table update");
+ }
+
echo "1";
return TRUE;
}
-var l_list_all = 0x00;
+var l_list_all = 0x00;
var l_list_auth = 0x01;
var l_list_isol = 0x02;
+var prefs_list_idx = new Array( 0x00, 0x01, 0x02 );
+var prefs_list_id = new Array( "all", "auth", "isol" );
+var comps_name = new Array('s_fg_r', 's_fg_g', 's_fg_b', 's_bg_r', 's_bg_g', 's_bg_b');
+
function client_prefs(old)
{
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;
// supporter component management
if (g_prefs.supp_comp != prefs_new.supp_comp || is_update) {
+
+ for (i = 0 ; i < 6 ; i++) {
+ $(comps_name[i]).value = parseInt(prefs_new.supp_comp.substr(i*2,2), 16);
+ }
$('s_img').src = 'suprend.php?comp='+prefs_new.supp_comp;
}
var i;
var prefs_new;
var relo = false;
-
// console.log("prefs_update("+field+")");
if (typeof(g_prefs) == 'undefined')
}
}
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);
+ for (i = 0 ; i < 6 ; i++) {
+ if (parseInt($(comps_name[i]).value) < 0 || parseInt($(comps_name[i]).value) > 255 ||
+ isNaN(parseInt($(comps_name[i]).value))) {
+ break;
+ }
+ }
+
+ if (i == 6) {
+ prefs_new.supp_comp = "";
+ for (i = 0 ; i < 6 ; i++) {
+ prefs_new.supp_comp += dec2hex(parseInt($(comps_name[i]).value), 2);
+ }
+ }
+
+ // console.log("prefs_update:: i break "+i+" ["+prefs_new.supp_comp+"]");
+
+ for (i = 0 ; i < 6 ; i++) {
+ $(comps_name[i]).value = parseInt(prefs_new.supp_comp.substr(i*2, 2), 16);
+ }
}
/* from form to struct */
*/
-function state_add(flags)
+function state_add(flags, comp)
{
var content = "", supercont = "";
var st, superst, name = "", supername = "", supersfx = "";
switch (superst) {
case 0x20000:
- supername = "superuser"+supersfx+".png";
+ if (comp != null) {
+ supername = "suprend.php?comp="+comp+"&sfx="+supersfx;
+ }
+ else {
+ supername = "img/superuser"+supersfx+".png";
+ }
supertit = (g_lang == 'en' ? "Brisk Supporter" : "Brisk Supporter");
break;
}
}
if (supername != "") {
- content += ' <img title="'+supertit+'" class="inline" src="img/'+supername+'">';
+ content += ' <img title="'+supertit+'" class="inline" src="'+supername+'">';
}
if (name != "") {
<?php
+if (isset($_GET['comp']) == FALSE)
+ exit;
+
+if (isset($_GET['sfx']) && $_GET['sfx'] == '_side') {
+ $is_side = TRUE;
+}
+else {
+ $is_side = FALSE;
+}
+
+
$comps = $_GET['comp'];
+
$c = array();
if (mb_strlen($comps, "ASCII") != 12)
}
header ('Content-type: image/png');
-$img_r = @imagecreatefrompng("img/sup_msk_r.png");
-$img_y = @imagecreatefrompng("img/sup_msk_y.png");
+if ($is_side == TRUE) {
+ $img_r = @imagecreatefrompng("img/sup_msk_side_r.png");
+ $img_y = @imagecreatefrompng("img/sup_msk_side_y.png");
+}
+else {
+ $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);
+if ($is_side == TRUE)
+ imagecopy($img_r, $img_y, 0,0, 0,0, 6, 16);
+else
+ imagecopy($img_r, $img_y, 0,0, 0,0, 21, 16);
imagesavealpha($img_r, TRUE);