+ else {
+ ignore_user_abort(TRUE);
+ $sem = Bin5::lock_data(TRUE, $table_idx);
+ // if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
+ if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) {
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+ if ($cur_step < $user->step) {
+ do {
+ if ($cur_step + COMM_N < $user->step) {
+ if (($cur_stat != $user->stat)) {
+ $to_stat = $user->stat;
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (page_sync($user->sess, $to_stat == "table" ? "index.php" : "../index.php"));
+ }
+ log_rd2("lost history, refresh from scratch");
+ $new_step = -1;
+ break;
+ }
+ for ($i = $cur_step ; $i < $user->step ; $i++) {
+ $ii = $i % COMM_N;
+ log_wr("TRY RET ".$i." COMM_N ".COMM_N." II ".$ii);
+ $ret .= $user->comm[$ii];
+ }
+ $new_stat = $user->stat;
+ $new_subst = $user->subst;
+ $new_step = $user->step;
+ } while (0);
+
+ log_rd2($user->step, 'bin::index_rd.php: after ret set');
+
+ if ($user->the_end == TRUE) {
+ log_rd2("LOGOUT BYE BYE!!");
+ log_auth($user->sess, "Explicit logout.");
+
+ unset($user);
+
+ $S_load_stat['wR_the_end']++;
+ if (($bri = Bin5::load_data($table_idx, $table_token)) == FALSE) {
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+ if (($user = $bri->get_user($sess, $idx)) == FALSE) {
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+
+ $tmp_sess = $user->sess;
+ $user->sess = "";
+ Bin5_user::unproxy_step($tmp_sess);
+ $user->name = "";
+ $user->the_end = FALSE;
+
+ /* FIXME - and now ??
+ if ($user->subst == 'sitdown')
+ $bri->room_wakeup($user);
+ else if ($user->subst == 'standup')
+ $bri->room_outstandup($user);
+ else
+ log_rd2("LOGOUT FROM WHAT ???");
+ */
+ Bin5::save_data($bri);
+ }
+ }
+
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);