enable 'usersnet' table with indexes and reading info from it
[brisk.git] / web / Obj / brisk.phh
index b61a450..7d82d56 100644 (file)
@@ -152,10 +152,10 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi',
 $G_lng = langtolng($G_lang);
 
 $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "5.0.0";
+$G_brisk_version = "5.1.3";
 
 /* MLANG: ALL THE INFO STRINGS IN brisk.phh */
-$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: comando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti.',
+$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: comando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti, info su numero di mani e di partite.',
                                        'Se vuoi iscriverti alla <a target="_blank" href="mailto:ml-briscola+subscribe@milug.org">Mailing List</a>, cliccala!' ),
                        'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: ENcomando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti.',
                                        'If you want to subscribe our <a target="_blank" href="ml-briscola+subscribe@milug.org">Mailing List</a>, click it!' ) );
@@ -1660,13 +1660,13 @@ class Brisk
               $ret = 2;
               break;
           }
-          if (($user_item = $bdb->getitem_bylogin($user_login, $user_code)) == FALSE) {
+          if ($user_login == $user->name) {
               $ret = 3;
+              $mesg = sprintf($mlang_brisk['inf_self'][$G_lang]);
               break;
           }
-          if ($user_login == $user->name) {
+          if (($user_item = $bdb->getitem_bylogin($user_login, $user_code)) == FALSE) {
               $ret = 4;
-              $mesg = sprintf($mlang_brisk['inf_self'][$G_lang]);
               break;
           }
           if (($guar_item = $bdb->getitem_bycode($user_item->guar_code_get())) != FALSE) {
@@ -1677,6 +1677,10 @@ class Brisk
           }
           $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);
+          }
+
           if (versions_cmp($user_tos_vers, "1.2") < 0) {
               $mesg = sprintf($mlang_brisk['tos_old'][$G_lang], xcape($user_login));
           }
@@ -1704,9 +1708,11 @@ class Brisk
                                        "Normale" : "Stato sconosciuto"))),
                                     "guar" => ($user_item->type & USER_FLAG_TY_APPR ?
                                                "" : $guar_login),
-                                    "match" => $user_item->match_cnt,
-                                    "game" => $user_item->game_cnt,
-                                    "friend" => "unknown"));
+                                    "match" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->match_cnt) ,
+                                    "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));
       }
 
       return $jret;
@@ -2169,7 +2175,9 @@ class Brisk
         $to_user = sprintf('chatt_sub("%s",[%d,"%s"],"%s");', $dt, $user->flags, xcape($user->name), xcape("== chat ban =="));
       }
       else {
-          if ( TRUE && (! $user->is_auth()) ) {
+          // TEMPORARY DISABLED UNTIL test user option will be available
+          // if ( TRUE && (!$user->is_auth() || $user->is_appr()) ) {
+          if (!$user->is_auth()) {
               $to_user = nickserv_msg($dt, xcape("Visto l'elevato numero di molestatori che ultimamente hanno preso dimora su Brisk abbiamo deciso"));
               $to_user .= nickserv_msg($dt, xcape("di disattivare temporaneamente la chat in room per i non registrati, non ce ne vogliate e buone feste."));
               if (FALSE) {