This handles users.
1720 $login_user = isset($in_query) && is_array($in_query) && isset($in_query[
'login_user']);
1721 $show_parents = isset($in_query) && is_array($in_query) && isset($in_query[
'show_parents']);
1722 $show_details = $show_parents || (isset($in_query) && is_array($in_query) && isset($in_query[
'show_details']));
1723 $logged_in = isset($in_query) && is_array($in_query) && isset($in_query[
'logged_in']) && $in_andisol_instance->manager();
1724 $my_info = isset($in_path) && is_array($in_path) && (0 < count($in_path) && (
'my_info' == $in_path[0]));
1725 $writeable = isset($in_query) && is_array($in_query) && isset($in_query[
'writeable']);
1732 if (!$in_andisol_instance->logged_in()) {
1735 $show_details =
true;
1738 if (isset($in_query[
'get_all_visible_users'])) {
1739 $ret[
'get_all_visible_users'] = $in_andisol_instance->get_all_visible_users();
1740 } elseif (isset($in_query[
'get_all_visible_logins'])) {
1741 $ret[
'get_all_visible_logins'] = $in_andisol_instance->get_all_visible_logins();
1742 } elseif (isset($my_info) && $my_info) {
1743 if ($in_andisol_instance->logged_in()) {
1744 $user = $in_andisol_instance->current_user();
1748 header(
'HTTP/1.1 400 No Logged-In User');
1752 header(
'HTTP/1.1 403 Forbidden');
1755 } elseif (isset($in_path) && is_array($in_path) && (1 < count($in_path) && (
'login_ids' == $in_path[0]))) {
1757 $login_id_list = array_map(
'trim', explode(
',', $in_path[1]));
1759 $is_numeric = array_reduce($login_id_list,
function($carry, $item){
return $carry && ctype_digit($item); },
true);
1761 $login_id_list = $is_numeric ? array_map(
'intval', $login_id_list) : $login_id_list;
1763 foreach ($login_id_list as $login_id) {
1764 $login_instance = $is_numeric ? $in_andisol_instance->get_login_item($login_id) : $in_andisol_instance->get_login_item_by_login_string($login_id);
1767 if (!$logged_in || ($logged_in && $login_instance->get_api_key())) {
1768 $id_string = $login_instance->login_id;
1769 $user = $in_andisol_instance->get_user_from_login_string($id_string);
1770 if (isset($user) && ($user instanceof
CO_User_Collection) && (!$writeable || $user->user_can_write())) {
1771 if ($show_details) {
1780 } elseif (isset($in_path) && is_array($in_path) && (0 < count($in_path))) {
1781 $user_nums = strtolower($in_path[0]);
1783 $single_user_id = (ctype_digit($user_nums) && (1 < intval($user_nums))) ? intval($user_nums) : NULL;
1785 $user_list = explode(
',', $user_nums);
1788 if ($single_user_id || (1 < count($user_list))) {
1789 $user_list = ($single_user_id ? [$single_user_id] : array_map(
'intval', $user_list));
1791 foreach ($user_list as $id) {
1793 $user = $in_andisol_instance->get_single_data_record_by_id($id);
1794 if (isset($user) && ($user instanceof
CO_User_Collection) && (!$writeable || $user->user_can_write())) {
1795 if (!$login_user || ($login_user && $user->has_login())) {
1797 $login_instance = $user->get_login_instance();
1799 if (!isset($login_instance) || !($login_instance instanceof
CO_Security_Login) || !$login_instance->get_api_key()) {
1803 if ($show_details) {
1814 $radius = isset($in_query) && is_array($in_query) && isset($in_query[
'search_radius']) && (0.0 < floatval($in_query[
'search_radius'])) ? floatval($in_query[
'search_radius']) : NULL;
1815 $longitude = isset($in_query) && is_array($in_query) && isset($in_query[
'search_longitude']) ? floatval($in_query[
'search_longitude']) : NULL;
1816 $latitude = isset($in_query) && is_array($in_query) && isset($in_query[
'search_latitude']) ? floatval($in_query[
'search_latitude']) : NULL;
1817 $search_page_size = isset($in_query) && is_array($in_query) && isset($in_query[
'search_page_size']) ? abs(intval($in_query[
'search_page_size'])) : 0;
1818 $search_page_number = isset($in_query) && is_array($in_query) && isset($in_query[
'search_page_number']) ? abs(intval($in_query[
'search_page_number'])) : 0;
1819 $search_name = isset($in_query) && is_array($in_query) && isset($in_query[
'search_name']) ? trim($in_query[
'search_name']) : NULL;
1820 $search_surname = isset($in_query) && is_array($in_query) && isset($in_query[
'search_surname']) ? trim($in_query[
'search_surname']) : NULL;
1821 $search_middle_name = isset($in_query) && is_array($in_query) && isset($in_query[
'search_middle_name']) ? trim($in_query[
'search_middle_name']) : NULL;
1822 $search_given_name = isset($in_query) && is_array($in_query) && isset($in_query[
'search_given_name']) ? trim($in_query[
'search_given_name']) : NULL;
1823 $search_nickname = isset($in_query) && is_array($in_query) && isset($in_query[
'search_nickname']) ? trim($in_query[
'search_nickname']) : NULL;
1824 $search_prefix = isset($in_query) && is_array($in_query) && isset($in_query[
'search_prefix']) ? trim($in_query[
'search_prefix']) : NULL;
1825 $search_suffix = isset($in_query) && is_array($in_query) && isset($in_query[
'search_suffix']) ? trim($in_query[
'search_suffix']) : NULL;
1826 $search_tag7 = isset($in_query) && is_array($in_query) && isset($in_query[
'search_tag7']) ? trim($in_query[
'search_tag7']) : NULL;
1827 $search_tag8 = isset($in_query) && is_array($in_query) && isset($in_query[
'search_tag8']) ? trim($in_query[
'search_tag8']) : NULL;
1828 $search_tag9 = isset($in_query) && is_array($in_query) && isset($in_query[
'search_tag9']) ? trim($in_query[
'search_tag9']) : NULL;
1830 $location_search = NULL;
1831 $string_search = ($search_name !== NULL)
1832 || ($search_surname !== NULL)
1833 || ($search_middle_name !== NULL)
1834 || ($search_given_name !== NULL)
1835 || ($search_nickname !== NULL)
1836 || ($search_prefix !== NULL)
1837 || ($search_suffix !== NULL)
1838 || ($search_tag7 !== NULL)
1839 || ($search_tag8 !== NULL)
1840 || ($search_tag9 !== NULL);
1843 if (isset($radius) && isset($longitude) && isset($latitude)) {
1844 $location_search = Array(
'radius' => $radius,
'longitude' => $longitude,
'latitude' => $latitude);
1845 } elseif (isset($radius) || isset($longitude) || isset($latitude)) {
1846 header(
'HTTP/1.1 400 Incomplete Distance Search');
1851 if ((isset($location_search) && is_array($location_search) && (3 == count($location_search))) || (0 < $search_page_size) || $string_search) {
1852 $class_search = Array(
'%_User_Collection',
'use_like' => 1);
1853 $search_array[
'access_class'] = $class_search;
1854 $search_array[
'location'] = $location_search;
1855 if (isset($search_name)) {
1856 $search_array[
'name'] = Array($search_name,
'use_like' => 1);
1859 $tags_array = [NULL];
1861 $tags_array[] = isset($search_surname) ? $search_surname : NULL;
1862 $tags_array[] = isset($search_middle_name) ? $search_middle_name : NULL;
1863 $tags_array[] = isset($search_given_name) ? $search_given_name : NULL;
1864 $tags_array[] = isset($search_nickname) ? $search_nickname : NULL;
1865 $tags_array[] = isset($search_prefix) ? $search_prefix : NULL;
1866 $tags_array[] = isset($search_suffix) ? $search_suffix : NULL;
1867 $tags_array[] = isset($search_tag7) ? $search_tag7 : NULL;
1868 $tags_array[] = isset($search_tag8) ? $search_tag8 : NULL;
1869 $tags_array[] = isset($search_tag9) ? $search_tag9 : NULL;
1872 foreach ($tags_array as $tag) {
1873 if (NULL !== $tag) {
1880 $tags_array[
'use_like'] = 1;
1881 $search_array[
'tags'] = $tags_array;
1884 $userlist = $in_andisol_instance->generic_search($search_array,
false, $search_page_size, $search_page_number, $writeable);
1886 $userlist = $in_andisol_instance->get_all_users();
1889 if (isset($userlist) && is_array($userlist) && count($userlist)) {
1890 foreach ($userlist as $user) {
1891 if (isset($user) && ($user instanceof
CO_User_Collection) && (!$writeable || $user->user_can_write())) {
1892 if (!$login_user || ($login_user && $user->has_login())) {
1894 $login_instance = $user->get_login_instance();
1896 if (!isset($login_instance) || !($login_instance instanceof
CO_Security_Login) || !$login_instance->get_api_key()) {
1900 if ($show_details) {
1909 if ($location_search) {
1910 $ret[
'search_location'] = $location_search;