X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fuser.phh;h=ebb81f112acb99dd1a97fe15f441dd60ca84fe77;hb=e246dc1e59ed187a121f0cae319881f40e1fd426;hp=e06c6819f7c5a806ba9d71d99a2854f4e1cbbcb7;hpb=ffe7c5f4e251654501bc5a2bdd690944076ef131;p=brisk.git diff --git a/web/Obj/user.phh b/web/Obj/user.phh index e06c681..ebb81f1 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -119,6 +119,7 @@ class User { var $subst; // substatus for each status var $step; // step of the current status var $trans_step; // step to enable transition between pages (disable == -1) + var $cl_step; // current step returned by client var $rd_socket; // socket handle of push stream var $rd_endtime; // end time for push stream @@ -129,6 +130,7 @@ class User { var $rd_scristp; // current script step (for each session) var $rd_kalive; // if no message are sent after RD_KEEPALIVE_TOUT secs we send a keepalive from server var $rd_cache; // place where store failed fwrite data + var $rd_toflush; // bool to inform about unfflushed socket var $rd_zls; // zlibstream object handle if compressed stream, else FALSE var $rd_transp; // class that define stream encapsulation type (iframe, xhr, ...) var $rd_is_chunked; // is the transport chunked or not ? @@ -179,6 +181,7 @@ class User { $thiz->subst = $subst; $thiz->step = 1; $thiz->trans_step = -1; + $thiz->cl_step = -1; $thiz->comm = array(); $thiz->rd_socket = NULL; @@ -190,6 +193,7 @@ class User { $thiz->rd_scristp = -1; $thiz->rd_kalive = -1; $thiz->rd_cache = ""; + $thiz->td_toflush = FALSE; $thiz->rd_zls = FALSE; $thiz->rd_transp = NULL; $thiz->rd_is_chunked = FALSE; @@ -231,6 +235,7 @@ class User { $this->subst = $from->subst; $this->step = $from->step; $this->trans_step = $from->trans_step; + $this->cl_step = $from->cl_step; $this->comm = array(); $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N)); @@ -294,6 +299,7 @@ class User { $thiz->subst = $from->subst; $thiz->step = $from->step; $thiz->trans_step = $from->trans_step; + $thiz->cl_step = $from->cl_step; $thiz->comm = array(); /* @@ -329,6 +335,28 @@ class User { return ($thiz); } + function is_auth() + { + return ($this->flags & USER_FLAG_AUTH); + } + + function is_cert() + { + return (($this->flags & USER_FLAG_AUTH) && ($this->flags & USER_FLAG_TY_CERT)); + } + + function is_empty() + { + return ($this->sess == ""); + } + + function is_active() + { + if ($this->sess != "" && !$this->the_end) // OK: is_active() + return TRUE; + return FALSE; + } + function flags_set($flags, $mask) { $flags_old = $this->flags & (~$mask); @@ -368,7 +396,7 @@ class User { $this->rd_endtime = $curtime + RD_ENDTIME_DELTA; $this->rd_stat = $stat; $this->rd_subst = $subst; - $this->rd_step = $step; + $this->rd_step = $step; // TRACKED $this->rd_from = $from; $this->rd_scristp = 0; $this->rd_kalive = $curtime + RD_KEEPALIVE_TOUT; @@ -549,9 +577,20 @@ class User { function myname_innerHTML() { - $class_id = ($this->flags & USER_FLAG_AUTH) + 1; - - return (sprintf('$("myname").innerHTML = "%s";', $class_id, + // 4 -> is certified + // 2 -> is authorized + // 1 -> is myself + $class_ids = (($this->flags & USER_FLAG_TY_CERT) >> 16) | ($this->flags & USER_FLAG_AUTH) | 1; + $sp = ""; + $cl = ""; + + for ($i = 0 ; $i < 3 ; $i++) { + if ($class_ids & (1 << $i)) { + $cl .= sprintf("%sau%d", $sp, $i); + $sp = " "; + } + } + return (sprintf('$("myname").innerHTML = "%s";', $cl, xcape($this->name,ENT_COMPAT,"UTF-8"))); } @@ -590,9 +629,9 @@ class User { log_rd("maincheck begin"); - $ret = FALSE; + $ret = ""; $curtime = time(); - + /* Nothing changed, return. */ if ($this->rd_step == $this->step) return (FALSE); @@ -600,19 +639,13 @@ class User { log_rd2("do other cur_stat[".$this->rd_stat."] user->stat[".$this->stat."] cur_step[".$this->rd_step."] user_step[".$this->step."]"); if ($this->rd_step == -1) { - /* - * if $this->rd_step == -1 load the current state from the main struct - */ - + /* if $this->rd_step == -1 load the current state from the main struct */ $S_load_stat['wR_minusone']++; - - // if ($this->the_end == TRUE) { - // log_rd2("main_check: the end".var_export(debug_backtrace())); - // } - + if ($this->trans_step != -1) { log_rd2("TRANS USATO ".$this->trans_step); - $this->rd_step = $this->trans_step; + $this->rd_step = $this->step = $this->trans_step; // TRACKED + $ret .= $this->room->show_room($this->step, $this); $this->trans_step = -1; } else { @@ -627,7 +660,6 @@ class User { if ($this->stat == 'room') { log_rd("roomma ".$this->step); - $curtime = time(); if ($this->rec !== FALSE) { $doc_filepath = $G_base.$G_doc_path.sprintf($G_tos_fname, $G_tos_vers, $G_lang); $doc_filename = basename($doc_filepath); @@ -675,7 +707,7 @@ class User { /* NOTE the sets went common */ $this->rd_stat = $this->stat; $this->rd_subst = $this->subst; - $this->rd_step = $this->step; + $this->rd_step = $this->step; // TRACKED } /*************** * * @@ -719,32 +751,18 @@ class User { } $this->rd_stat = $this->stat; $this->rd_subst = $this->subst; - $this->rd_step = $this->step; + $this->rd_step = $this->step; } while (0); log_rd2($this->step, 'index_rd.php: after ret set'); - - if ($this->the_end == TRUE) { - log_rd2("LOGOUT BYE BYE!!"); - log_auth($this->sess, "Explicit logout."); - - if ($this->the_end == TRUE) { - $this->reset(); - - if ($this->subst == 'sitdown') { - log_load("ROOM WAKEUP"); - $this->room->room_wakeup($this); - } - else if ($this->subst == 'standup') - $this->room->room_outstandup($this); - else - log_rd2("LOGOUT FROM WHAT ???"); - - } /* if ($this->the_end == TRUE) { ... */ - } /* if ($this->the_end == TRUE) { ... */ + + // if ($this->the_end == TRUE) { management is moved + // in the spush scope } /* if ($this->rd_step < $this->step) { */ } /* else of if ($this->rd_step == -1) { */ - + + if ($ret == "") + $ret = FALSE; return ($ret); } // function maincheck(...