X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex_wr.php;h=001b51fdb18de4b6295e62d67c076a0c25216e52;hb=refs%2Fheads%2Fmeet-appr;hp=2d514af4e45413ca39960658e2bb25258f619888;hpb=bbd72460bcf4269ffd21cfb97e0ab616ac7276e7;p=brisk.git diff --git a/web/index_wr.php b/web/index_wr.php index 2d514af..001b51f 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -120,6 +120,8 @@ Ciò è necessario per ottenere la password.

Saluti e buone partite, mop.
', 'en' => 'EN mhtml [%s] [%s]'), 'info_err' => array( 'it' => 'E\' occorso un errore (%d), riprova più tardi.', + 'en' => 'Some error occurs (%d), retry later.'), + 'info_auth' => array('it' => 'Non essendo autenticato non puoi costruire una rete di preferenze.', 'en' => 'Some error occurs (%d), retry later.') ); @@ -228,9 +230,6 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) echo show_notify(str_replace("\n", " ", placings_show(FALSE)), 0, $mlang_indwr['btn_close'][$G_lang], 800, 600); } - else if ($argz[0] == 'whysupport') { - echo show_notify(str_replace("\n", " ", $G_room_whysupport[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lng], 400, 200); - } else if ($argz[0] == 'apprentice') { if (($cli_name = gpcs_var('cli_name', $get, $post, $cookie)) === FALSE) $cli_name = ""; @@ -362,20 +361,91 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) log_wr("PING RECEIVED"); } else if ($argz[0] == 'info') { + if ($user->is_auth()) { + if ($argz[1] == 'save') { + if (!isset($post['info'])) { + return FALSE; + } + if (($ret = $brisk->info_save($user, $post['info'])) == 0) { + echo "1"; + return TRUE; + } + + printf($mlang_indwr['info_err'][$G_lang], $ret); + return FALSE; + } + } + else { + printf($mlang_indwr['info_auth'][$G_lang]); + return FALSE; + } + } + else if ($argz[0] == 'prefsf') { + fprintf(STDERR, "INFO: prefsf case [%s]\n", $post['F_act']); + if (!isset($post['model_name']) || !isset($post['json'])) + return FALSE; + + /* [F_act] => update + [model_name] => prefsf + [counter] => 1 + [json] => {"listen":{"act":"1"}} + */ + if ($post['model_name'] == 'prefsf') { + if ($post['F_act'] == 'update' || $post['F_act'] == 'store') { + $cont = json_decode($post['json']); + $leaf = ($post['F_act'] == 'update' ? 'cur' : 'val'); + + $listen_flags = (($cont->listen->$leaf == '1' ? USER_FLAG_LISTAUTH : 0) | + ($cont->listen->$leaf == '2' ? USER_FLAG_ISOLAUTH : 0)); + $user->flags_set($listen_flags, USER_FLAG_MAP_AUTH); + if ($post['F_act'] == 'store' + && $user->flags_db_get(USER_FLAG_MAP_AUTH) != $user->flags_get(USER_FLAG_MAP_AUTH)) { + $user->prefs_store(); + } + } + if ($user->stat == 'room' && $user->subst == 'standup') { + $brisk->standup_update($user); + } + else if ($user->stat == 'room' && $user->subst == 'sitdown') { + $brisk->table_update($user); + } + echo "1"; + return TRUE; + } + } + else if ($argz[0] == 'prefs') { if ($argz[1] == 'save') { - if (!isset($post['info'])) { + if (!isset($post['prefs'])) { return FALSE; } - if (($ret = $brisk->info_save($user, $post['info'])) == 0) { - echo "1"; - return TRUE; + + if (($prefs = Client_prefs::from_json($post['prefs'])) == FALSE) { + $prefs = Client_prefs::from_user($user); } + $prefs->store($user, TRUE); + } + else { // reset case as default + $prefs = Client_prefs::from_user($user); + } + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] .= sprintf('prefs_load(\'%s\', true, %s);', json_encode($prefs), + 'false'); + $user->step_inc(); - printf($mlang_indwr['info_err'][$G_lang], $ret); - return FALSE; + if ($argz[1] == 'save') { + if ($user->stat == 'room' && $user->subst == 'standup') { + $brisk->standup_update($user); + } + else if ($user->stat == 'room' && $user->subst == 'sitdown') { + log_main("chatt_send pre table update"); + $brisk->table_update($user); + log_main("chatt_send post table update"); + } } + echo "1"; + return TRUE; } - else if ($argz[0] == 'prefs') { + else if ($argz[0] == 'prefsn') { if ($argz[1] == 'save') { if (!isset($post['prefs'])) { return FALSE; @@ -390,8 +460,8 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) $prefs = Client_prefs::from_user($user); } $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= sprintf('prefs_load(\'%s\', true, %s);', json_encode($prefs), - 'false'); + $user->comm[$user->step % COMM_N] .= sprintf('prefs_load(\'%s\', true, %s);', json_encode($prefs), + 'false'); $user->step_inc(); if ($argz[1] == 'save') { @@ -760,17 +830,9 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) log_wr($user->comm[$user->step % COMM_N]); $user->step_inc(); - } - else if ($argz[0] == 'whysupport') { - $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= show_notify(str_replace("\n", " ", $G_room_whysupport[$G_lang]), 0, $mlang_indwr['btn_backtotab'][$G_lang], 400, 200); - - log_wr($user->comm[$user->step % COMM_N]); - $user->step_inc(); - } else if ($argz[0] == 'chatt') { - $brisk->chatt_send(&$user, xcapemesg($mesg)); + $brisk->chatt_send(&$user, xcapemesg($mesg), $mlang_indwr); } else if ($argz[0] == 'tosmgr') { // check IF is authnticated user, both terms of service versions matches