X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=07cc6dec72cdbce217e5b5f39358cd87d284e2c6;hb=f95117c9e5506c4cb00e1b5ee02b2e566c837874;hp=efb360ef12244c407ba864d18ffc202e254bc5db;hpb=ab8d1f71caed7bf1a7f02660fb12b28177811ad7;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index efb360e..07cc6de 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -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,12 +1666,12 @@ class Brisk $ret = 2; break; } - if ($user_login == $user->name) { + if ($target == $user->name) { $ret = 3; $mesg = sprintf($mlang_brisk['inf_self'][$G_lang]); break; } - if (($user_item = $bdb->getitem_bylogin($user_login, $user_code)) == FALSE) { + if (($user_item = $bdb->getitem_bylogin($target, $user_code)) == FALSE) { $ret = 4; break; } @@ -1682,10 +1688,10 @@ class Brisk } 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); @@ -1699,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" : @@ -1718,6 +1724,34 @@ class Brisk return $jret; } + function info_save($user, $json_s) + { + GLOBAL $G_lang, $mlang_brisk, $G_base; + + $mesg = ""; + $user_code = -1; + $ret = 0; + + do { + if (($json = json_decode($json_s)) == FALSE) { + $ret = 1; + break; + } + + if (($bdb = BriskDB::create()) == FALSE) { + $ret = 2; + break; + } + + if (($user_item = $bdb->usersnet_save($user->code, $json)) != 0) { + $ret = 4000 + $user_item; + break; + } + } while(0); + + return ($ret); + } + function room_outstandup($user) { $this->room_sitdown($user, -1); @@ -2078,10 +2112,9 @@ 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); + echo $this->info_show($user, urldecode($info_user), $dt); } else if (strncmp($msg, "/st ", 4) == 0) { log_main("chatt_send BEGIN");