}
$user_tos_vers = $user_item->tos_vers_get();
- if (($usersnet_item = $bdb->usersnet_bycode($user->code, $user_item->code)) == FALSE) {
- $usersnet_item = $bdb->usersnet_default($user->code, $user_item->code);
+ $widefriend = $bdb->usersnet_widefriend($user->code, $user_item->code);
+ $narrowfriend = $bdb->usersnet_narrowfriend($user->code, $user_item->code);
+
+ if (($usersnet_item = $bdb->usersnet_bycode($user->code, $user_item->code,
+ $widefriend, $narrowfriend)) == FALSE) {
+ $usersnet_item = $bdb->usersnet_default($user->code, $user_item->code,
+ $widefriend, $narrowfriend);
}
if (versions_cmp($user_tos_vers, "1.2") < 0) {
"game" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->game_cnt),
"friend" => usersnet_friend_getlabel($usersnet_item->friend),
"skill" => $usersnet_item->skill,
- "trust" => $usersnet_item->trust));
+ "trust" => $usersnet_item->trust,
+ "widefriend" => $usersnet_item->widefriend,
+ "narrowfriend" => $usersnet_item->narrowfriend
+ ));
}
return $jret;
var $from_db;
- function UsersNetItem($owner, $target, $friend, $skill, $trust, $from_db)
+ function UsersNetItem($owner, $target, $friend, $skill, $trust,
+ $widefriend, $narrowfriend, $from_db)
{
$this->owner = $owner;
$this->target = $target;
$this->friend = $friend;
$this->skill = $skill;
$this->trust = $trust;
+ $this->widefriend = $widefriend;
+ $this->narrowfriend = $narrowfriend;
$this->from_db = $from_db;
}
- static function UsersNetItemFromRecord($rec)
+ static function UsersNetItemFromRecord($rec, $widefriend, $narrowfriend)
{
$ret = new UsersNetItem($rec->owner, $rec->target, $rec->friend,
- $rec->skill, $rec->trust, TRUE);
+ $rec->skill, $rec->trust,
+ $widefriend, $narrowfriend, TRUE);
return ($ret);
}
- static function UsersNetItemDefaults($owner, $target)
+ static function UsersNetItemDefaults($owner, $target, $widefriend, $narrowfriend)
{
$ret = new UsersNetItem($owner, $target, USERSNET_FRIEND,
- USERSNET_SKILL, USERSNET_TRUST, FALSE);
+ USERSNET_SKILL, USERSNET_TRUST,
+ $widefriend, $narrowfriend, FALSE);
return ($ret);
}
return (TRUE);
}
- function usersnet_bycode($owner, $target)
+ function usersnet_widefriend($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $widefriend = array(1 => "//", 2 => "//", 3 => "//", 4 => "//", 5 => "//");
+
+ $wfri_sql = sprintf("SELECT * FROM %susersnet_widefriend WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($wfri_pg = $this->query($wfri_sql)) == FALSE) {
+ return ($widefriend);
+ }
+
+ for ($i = 0 ; $i < pg_numrows($wfri_pg) ; $i++) {
+ $wfri_obj = pg_fetch_object($wfri_pg, $i);
+ $widefriend[intval($wfri_obj->friend)] = $wfri_obj->count;
+ }
+
+ return ($widefriend);
+ }
+
+ function usersnet_narrowfriend($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $narrowfriend = array(1 => "//", 2 => "//", 3 => "//", 4 => "//", 5 => "//");
+
+ $nfri_sql = sprintf("SELECT * FROM %susersnet_narrowfriend WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($nfri_pg = $this->query($nfri_sql)) == FALSE) {
+ return $narrowfriend;
+ }
+
+ for ($i = 0 ; $i < pg_numrows($nfri_pg) ; $i++) {
+ $nfri_obj = pg_fetch_object($nfri_pg, $i);
+ $narrowfriend[intval($nfri_obj->friend)] = $nfri_obj->count;
+ }
+ return ($narrowfriend);
+ }
+
+ function usersnet_bycode($owner, $target, $widefriend, $narrowfriend)
{
GLOBAL $G_dbpfx;
$ret = FALSE;
$net_sql = sprintf("SELECT * FROM %susersnet WHERE owner = %d AND target = %d;",
- $G_dbpfx, $owner, $target);
- if (($net_pg = $this->query($net_sql)) == FALSE) {
+ $G_dbpfx, $owner, $target);
+ if (($net_pg = $this->query($net_sql)) == FALSE)
return FALSE;
- }
+
if (pg_numrows($net_pg) != 1)
return FALSE;
$net_obj = pg_fetch_object($net_pg, 0);
- return (UsersNetItem::UsersNetItemFromRecord($net_obj));
+ return (UsersNetItem::UsersNetItemFromRecord($net_obj, $widefriend, $narrowfriend));
}
- function usersnet_default($owner, $target)
+ function usersnet_default($owner, $target, $widefriend, $narrowfriend)
{
- return (UsersNetItem::UsersNetItemDefaults($owner, $target));
+ return (UsersNetItem::UsersNetItemDefaults($owner, $target, $widefriend, $narrowfriend));
}
+
function usersnet_save($owner_id, $json)
{
GLOBAL $G_dbpfx;
GLOBAL $G_splash_h, $G_splash_idx, $G_splash_interval, $G_splash_timeout;
GLOBAL $G_splash_w, $G_topbanner, $G_with_donors, $G_with_poll;
GLOBAL $G_with_splash, $G_sidebanner, $G_sidebanner_idx;
- GLOBAL $G_with_topbanner, $G_selfreg_tout;
+ GLOBAL $G_with_topbanner, $G_selfreg_tout, $G_selfreg_mask;
fprintf(STDERR, "G_alarm_passwd = [%s]\n", print_r($G_alarm_passwd, TRUE));
fprintf(STDERR, "G_ban_list = [%s]\n", print_r($G_ban_list, TRUE));
'en' => 'State:'),
'info_guar' => array('it' => 'Garante:',
'en' => 'Guarantee:'),
- 'info_match' => array('it' => 'Partite:',
+ 'info_match' => array('it' => '<span title="Partite giocate ai tavoli riservati.">Partite:</span>',
'en' => 'Matches:'),
- 'info_game' => array('it' => 'Mani:',
+ 'info_game' => array('it' => '<span title="Mani giocate ai tavoli riservati.">Mani:</span>',
'en' => 'Hands:'),
'info_frie' => array('it' => 'Conoscenza:',
'en' => 'Friendship:'),
<div id="info" class="notify" style="z-index: 200; width: 400px; margin-left: -200px; height: 340px; top: 150px; visibility: hidden;">
<table class="info">
-<tr><td class="le"><b><?php echo $mlang_room['info_login'][$G_lang]; ?></b></td><td class="ri"><span class="login_id"></span></td></tr>
-<tr><td class="le"><b><?php echo $mlang_room['info_state'][$G_lang]; ?></b></td><td class="ri"><span class="state_id"></span></td></tr>
-<tr><td class="le"><b><?php echo $mlang_room['info_guar'][$G_lang]; ?></b></td><td class="ri"><span class="guar_id"></span></td></tr>
-<tr><td class="le"><b><?php echo $mlang_room['info_match'][$G_lang]; ?></b></td><td class="ri"><span class="match_id"></span></td></tr>
-<tr><td class="le"><b><?php echo $mlang_room['info_game'][$G_lang]; ?></b></td><td class="ri"><span class="game_id"></span></td></tr>
-<tr><td colspan="2" style="background-color: pink;">di seguito le opzioni che verranno attivate successivamente:</td></tr>
+<tr><td><b><?php echo $mlang_room['info_login'][$G_lang]; ?></b></td><td class="ri"><span class="login_id"></span></td>
+<td><b><?php echo $mlang_room['info_state'][$G_lang]; ?></b></td><td class="ri"><span class="state_id"></span></td></tr>
+<tr><td><b><?php echo $mlang_room['info_guar'][$G_lang]; ?></b></td><td class="ri"><span class="guar_id"></span></td><td></td><td></td></tr>
+<tr><td><b><?php echo $mlang_room['info_match'][$G_lang]; ?></b></td><td class="ri"><span class="match_id"></span></td>
+<td><b><?php echo $mlang_room['info_game'][$G_lang]; ?></b></td><td class="ri"><span class="game_id"></span></td></tr>
+<tr><td colspan="4"><b>Cosa ne pensano gli amici.</b></td></tr>
+
+<tr><td class="le info-opt">Da evitare:<span class="frie_black"></span></td>
+<td class="le info-opt">In prova:<span class="frie_test"></span></td>
+<td class="le info-opt">Amico:<span class="frie_friend"></span></td>
+<td class="le info-opt">Amico fidato:<span class="frie_bff"></span></td></tr>
+
+<tr><td colspan="4"><b>Cosa ne pensano gli amici fidati:</b></td></tr>
+<tr><td class="le info-opt">Da evitare:<span class="frie_black"></span></td>
+<td class="le info-opt">In prova:<span class="frie_test"></span></td>
+<td class="le info-opt">Amico:<span class="frie_friend"></span></td>
+<td class="le info-opt">Amico fidato:<span class="frie_bff"></span></td></tr>
+<!--
<tr><td class="le ri" colspan="2"><b><?php echo $mlang_room['info_frie'][$G_lang]; ?></b></td></tr>
<tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="black">Da evitare</td>
<td class="ri info-opt"><input type="radio" name="friend" class="friend_id" value="friend">Amico</td></tr>
</tr>
</table>
</td></tr>
+-->
+<tr><td colspan="4" style="background-color: pink;">di seguito le opzioni che verranno attivate successivamente:</td></tr>
</table>
<div style="position: absolute; bottom: 8px; margin: auto; width: 100%;">
<input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('info').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_close'][$G_lang]; ?>"/>
table.info td {
border-top: 1px solid grey;
padding: 4px;
- width: 50%;
+ width: 25%;
}