introduced 'page_id' in index.php
[brisk.git] / web / Obj / user.phh
index 573883c..6335832 100644 (file)
@@ -28,8 +28,8 @@ require_once("${G_base}Obj/transports.phh");
 define('USER_FLAG_AUTH',     0x02);
 
 define('USER_FLAG_MAP_AUTH', 0x0c);
-define('USER_FLAG_LISTAUTH', 0x04);
-define('USER_FLAG_ISOLAUTH', 0x08);
+// DISABLED define('USER_FLAG_LISTAUTH', 0x04);
+define('USER_FLAG_ISOLAUTH', 0x04);
 
 define('USER_FLAG_DBFAILED', 0x10);
 
@@ -112,6 +112,7 @@ class User {
   var $code;       // authentication code
   var $name;       // name of the user
   var $sess;       // session of the user
+  var $page_id;    // id of the latest page connected with this session
   var $ip;         // ip of the user
   var $lacc;       // last access (for the cleanup)
   var $laccwr;     // last access (for the cleanup)
@@ -167,7 +168,7 @@ class User {
   function User() {
   }
 
-  static function create(&$brisk, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
+  static function create(&$brisk, $idx, $name, $sess, $page_id="", $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
     if (($thiz = new User()) == FALSE)
       return (FALSE);
 
@@ -177,6 +178,7 @@ class User {
     $thiz->code       = -1;
     $thiz->name       = $name;
     $thiz->sess       = $sess;
+    $thiz->page_id    = $page_id;
     $thiz->ip         = $ip;
     $thiz->lacc       = time();
     $thiz->laccwr     = time();
@@ -233,6 +235,7 @@ class User {
     $this->code       = $from->code;
     $this->name       = $from->name;
     $this->sess       = $from->sess;
+    $this->page_id    = $from->page_id;
     $this->ip         = $from->ip;
     $this->lacc       = $from->lacc;
     $this->laccwr     = $from->laccwr;
@@ -299,6 +302,7 @@ class User {
     $thiz->code       = $from->code;
     $thiz->name       = $from->name;
     $thiz->sess       = $from->sess;
+    $thiz->page_id    = $from->page_id;
     $thiz->ip         = $from->ip;
     $thiz->lacc       = $from->lacc;
     $thiz->laccwr     = $from->laccwr;
@@ -578,6 +582,7 @@ class User {
 
     $tmp_sess = $this->sess;
     $this->sess = "";
+    $this->page_id = "";
     self::unproxy_step($tmp_sess);
     $this->name = "";  // OK here
     while (array_pop($this->comm) != NULL);
@@ -605,8 +610,9 @@ class User {
               $sp = " ";
           }
       }
-      return (sprintf('$("myname").innerHTML = "<span class=\"%s\">%s</span>";', $cl,
-                      xcape($this->name,ENT_COMPAT,"UTF-8")));
+      $myname = xcape($this->name,ENT_COMPAT,"UTF-8");
+      return (sprintf('window.myname = "%s"; $("myname").innerHTML = "<span class=\"%s\">%s</span>";',
+                      $myname, $cl, $myname));
   }
 
   /* INDEX_RD PORT */
@@ -869,6 +875,11 @@ function stream_close()
     return ($this->rd_transp->close());
 }
 
+function stream_postclose_get($sock, $curtime)
+{
+    return ($this->rd_transp->postclose_get($sock, $curtime));
+}
+
 static function base_get()
 {
     $c = get_called_class();