info: error handling refactored
[brisk.git] / web / Obj / brisk.phh
index 5ae7486..07cc6de 100644 (file)
@@ -1724,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);
@@ -2086,7 +2114,6 @@ class Brisk
     else if (strncmp($msg, "/info ", 6) == 0) {
         $info_user = substr($msg, 6);
 
-        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) {