mapping id <-> kind of friend
[brisk.git] / web / Obj / user.phh
index 4e716d0..fde4a57 100644 (file)
@@ -58,6 +58,7 @@ define('USER_FLAG_TY_ALL',     0xff0000); // done
 define('USER_FLAG_TY_NORM',    0x010000); // done
 define('USER_FLAG_TY_SUPER',   0x020000); // done
 define('USER_FLAG_TY_CERT',    0x040000); // done
+define('USER_FLAG_TY_APPR',    0x080000); // done
 //  ... other usefull status ...
 define('USER_FLAG_TY_FIRONLY', 0x200000); // done
 define('USER_FLAG_TY_ADMIN',   0x400000); // done
@@ -344,6 +345,11 @@ class User {
     return ($thiz);
   }
 
+  function is_appr()
+  {
+      return ($this->flags & USER_FLAG_TY_APPR);
+  }
+
   function is_auth()
   {
       return ($this->flags & USER_FLAG_AUTH);
@@ -917,5 +923,33 @@ function chunked_fini()
 
 } // end class User
 
+if (!isset($__usersnet_friend_map)) {
+    $__usersnet_friend_map = array("black", "unknown", "test", "friend", "bff");
+}
 
+function usersnet_friend_getlabel($id)
+{
+    GLOBAL $__usersnet_friend_map;
+
+    $id_i = intval($id);
+
+    if ($id_i < 1 || $id_i > count($__usersnet_friend_map)) {
+        return FALSE;
+    }
+    return ($__usersnet_friend_map[$id_i - 1]);
+}
+
+/* return index + 1 of friend label */
+function usersnet_friend_getid($label_in)
+{
+    GLOBAL $__usersnet_friend_map;
+
+    foreach ($__usersnet_friend_map as $id => $label) {
+        if ($label == $label_in) {
+            return ($id + 1);
+        }
+    }
+
+    return FALSE;
+}
 ?>