From: Matteo Nastasi (mop) Date: Thu, 19 Nov 2015 18:13:25 +0000 (+0100) Subject: js: add info_save() function X-Git-Tag: v5.3.0~52 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=611729e22280bfa6801521e6d115469d01756c6f;p=brisk.git js: add info_save() function --- diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 5ae7486..3e7870d 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1724,6 +1724,35 @@ 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)) == FALSE) { + $ret = 4; + break; + } + return (TRUE); + } while(0); + return (FALSE); + } + function room_outstandup($user) { $this->room_sitdown($user, -1); diff --git a/web/prefs.js b/web/prefs.js index 51b7eba..87d84c8 100644 --- a/web/prefs.js +++ b/web/prefs.js @@ -114,8 +114,12 @@ function prefs_save() ret = server_request('mesg', 'prefs|save','__POST__', 'prefs', JSON.stringify(g_prefs)); - if (ret == 1) + if (ret == 1) { $('preferences').style.visibility = 'hidden'; + } + else { + alert(ret); + } } function prefs_reset()