From: Matteo Nastasi (mop) Date: Sat, 21 Nov 2015 17:34:53 +0000 (+0100) Subject: mapping id <-> kind of friend X-Git-Tag: v5.3.0~49 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=8c2d162e7c87e54a07e174570196f62321231808;p=brisk.git mapping id <-> kind of friend --- diff --git a/web/Obj/user.phh b/web/Obj/user.phh index 99952e4..fde4a57 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -933,9 +933,23 @@ function usersnet_friend_getlabel($id) $id_i = intval($id); - if ($id_i < 0 || $id_i >= count($__usersnet_friend_map)) { + if ($id_i < 1 || $id_i > count($__usersnet_friend_map)) { return FALSE; } - return ($__usersnet_friend_map[$id_i]); + 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; } ?>