From: Matteo Nastasi (mop) Date: Mon, 23 Nov 2015 18:01:48 +0000 (+0100) Subject: info: error handling refactored X-Git-Tag: v5.3.0~46 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=f95117c9e5506c4cb00e1b5ee02b2e566c837874;p=brisk.git info: error handling refactored --- diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 3e7870d..07cc6de 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1732,7 +1732,6 @@ class Brisk $user_code = -1; $ret = 0; - do { if (($json = json_decode($json_s)) == FALSE) { $ret = 1; @@ -1744,13 +1743,13 @@ class Brisk break; } - if (($user_item = $bdb->usersnet_save($user->code, $json)) == FALSE) { - $ret = 4; + if (($user_item = $bdb->usersnet_save($user->code, $json)) != 0) { + $ret = 4000 + $user_item; break; } - return (TRUE); } while(0); - return (FALSE); + + return ($ret); } function room_outstandup($user) @@ -2115,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) { diff --git a/web/index_wr.php b/web/index_wr.php index 20f4167..b266abb 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -358,13 +358,11 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) if (!isset($post['info'])) { return FALSE; } - - if (($ret = $brisk->info_save($user, $post['info'])) == TRUE) { - if ($ret == TRUE) { - echo "1"; - return TRUE; - } + if (($ret = $brisk->info_save($user, $post['info'])) == 0) { + echo "1"; + return TRUE; } + printf($mlang_indwr['info_err'][$G_lang], $ret); return FALSE; } diff --git a/web/info.js b/web/info.js index fb9e087..8587e98 100644 --- a/web/info.js +++ b/web/info.js @@ -21,6 +21,10 @@ * */ +var mlang_info = { 'btn_close' : { 'it' : 'Chiudi.', + 'en' : 'Close.' } + }; + function info_fld(dobj) { var fields = { login: { type: 'value' }, @@ -49,7 +53,7 @@ function info_show(username) info.visible(true); } else { - alert("error: open info window failed"); + var noti = new notify(gst, info_in.mesg, 0, mlang_info['btn_close'][g_lang], 400, 150); } }