*/ $cidReset = true; $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php'; api_block_anonymous_users(); if (api_get_setting('social.allow_social_tool') != 'true') { api_not_allowed(); } $this_section = SECTION_SOCIAL; $tool_name = get_lang('Search'); $user_id = api_get_user_id(); $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null; $query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null; $extra_fields = UserManager::get_extra_filtrable_fields(); $query_vars = array('q' => $query, 'search_type' => $query_search_type); if (!empty($extra_fields)) { foreach ($extra_fields as $extra_field) { $field_name = 'field_' . $extra_field['variable']; if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') { $query_vars[$field_name] = $_GET[$field_name]; } } } //Block Social Menu $social_menu_block = SocialManager::show_social_menu('search'); $block_search = ''; $searchForm = UserManager::get_search_form($query); $groups = array(); $totalGroups = array(); $users = array(); $totalUsers = array(); $usergroup = new UserGroup(); // I'm searching something if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) { $itemPerPage = 8; if ($_GET['search_type']=='0' || $_GET['search_type']=='1') { $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1; $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true); $from = intval(($page - 1) * $itemPerPage); // Get users from tags $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage); } if ($_GET['search_type']=='0' || $_GET['search_type']=='2') { $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1; // Groups $fromGroups = intval(($pageGroup - 1) * $itemPerPage); $totalGroups = count($usergroup->get_all_group_tags($_GET['q'], 0, $itemPerPage, true)); $groups = $usergroup->get_all_group_tags($_GET['q'], $fromGroups); } if (empty($users) && empty($groups)) { Display::addFlash(Display::return_message(get_lang('SorryNoResults'))); } $results = '