X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=5ae7486828d4f5685591cdd9a86e84a04b77ff48;hb=0bd03dfcf85e7eefee56283b814be84aff59bffa;hp=b61a4507862042f35e4a3668dbb79c538a887676;hpb=20c4c572b23645456e1fcca939c107a9d1b7d138;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index b61a450..5ae7486 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -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.'), NOVITA\': comando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti.', +$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': comando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti, info su numero di mani e di partite.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ), 'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NEWS: ENcomando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti.', 'If you want to subscribe our Mailing List, click it!' ) ); @@ -1643,7 +1643,13 @@ class Brisk } } - function info_show($user, $user_login, $dt) + /* + function info_show($user, $target, $dt) + + if success return assoc. array with "ret" => 0 and other fields + else return an assoc. array with "ret: != 0 and "mesg" with an error description + */ + function info_show($user, $target, $dt) { GLOBAL $G_lang, $mlang_brisk, $G_base; @@ -1652,7 +1658,7 @@ class Brisk $ret = 0; do { - if ($user_login == "") { + if ($target == "") { $ret = 1; break; } @@ -1660,13 +1666,13 @@ class Brisk $ret = 2; break; } - if (($user_item = $bdb->getitem_bylogin($user_login, $user_code)) == FALSE) { + if ($target == $user->name) { $ret = 3; + $mesg = sprintf($mlang_brisk['inf_self'][$G_lang]); break; } - if ($user_login == $user->name) { + if (($user_item = $bdb->getitem_bylogin($target, $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,11 +1683,15 @@ 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)); + $mesg = sprintf($mlang_brisk['tos_old'][$G_lang], xcape($target)); } else if ($guar_login == "") { - $mesg = sprintf($mlang_brisk['inf_nfd'][$G_lang], xcape($user_login)); + $mesg = sprintf($mlang_brisk['inf_nfd'][$G_lang], xcape($target)); } } while (0); @@ -1695,7 +1705,7 @@ class Brisk else { $jret = json_encode(array("ret" => 0, "mesg" => "", - "login" => $user_login, + "login" => $target, // FIXME: state internationalization "state" => ($user_item->type & USER_FLAG_TY_APPR ? "Apprendista" : @@ -1704,9 +1714,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; @@ -2059,7 +2071,7 @@ class Brisk if (($bdb = BriskDB::create()) != FALSE) { $bdb->users_load(); /* MLANG: "Il nickname \'%s\' è già registrato, se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghostN." */ - if ($bdb->login_exists($name_new)) { + if ($bdb->login_exists(strtolower($name_new))) { $prestr = sprintf($mlang_brisk['nickjust'][$G_lang], xcape($name_new)); $to_user .= nickserv_msg($dt, $prestr); } @@ -2072,10 +2084,10 @@ class Brisk } while (0); } // nick chat command else if (strncmp($msg, "/info ", 6) == 0) { - $guar_user = substr($msg, 6); + $info_user = substr($msg, 6); - error_log("here [" . $guar_user."]"); - echo $this->info_show($user, $guar_user, $dt); + error_log("here [" . $info_user."][".escsql(urldecode($info_user)). "]"); + echo $this->info_show($user, urldecode($info_user), $dt); } else if (strncmp($msg, "/st ", 4) == 0) { log_main("chatt_send BEGIN"); @@ -2169,7 +2181,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) { @@ -2356,7 +2370,7 @@ class Brisk $bdb->users_load(); if ($pass != FALSE) { // TODO: here add a method to $bdb to check if the db is available. log_auth("XXX", "auth2"); - $authenticate = $bdb->login_verify($name_new, $pass, $code); + $authenticate = $bdb->login_verify(strtolower($name_new), $pass, $code); log_auth("XXX", "authenticate: ".($authenticate != FALSE ? "TRUE" : "FALSE")); if ($authenticate != FALSE) { @@ -2368,7 +2382,7 @@ class Brisk } } else { - $login_exists = $bdb->login_exists($name_new); + $login_exists = $bdb->login_exists(strtolower($name_new)); } } else {