X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fuser.phh;h=96706b83fa3fd8c7dfe533d569411baba4346d63;hb=7e4dfd67f0e1a1293c6cbbedd88c9100b0204c92;hp=e06c6819f7c5a806ba9d71d99a2854f4e1cbbcb7;hpb=14cd1fc05b5d9148de3c427e43bf60cfdf098e9d;p=brisk.git diff --git a/web/Obj/user.phh b/web/Obj/user.phh index e06c681..96706b8 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -329,6 +329,16 @@ 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 flags_set($flags, $mask) { $flags_old = $this->flags & (~$mask); @@ -549,9 +559,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"))); }