search_data = $search_data_array; if (!empty($_GET['sort_by'])) { $PeopleModule->sort_by = $_GET['sort_by']; } $PeopleModule->Paging = $paging; $PeopleModule->Paging["show"] = ($rows*FACEWALL_COLUMN_COUNT); $PeopleModule->get_links(); $users_data = $PeopleModule->users_data; if (count($users_data)) { $xml_obj = new DomDocument(); $buddylist = $xml_obj->createElement('buddylist'); foreach ($users_data as $user) { $profile_data = User::load_user_profile($user['user_id'], $viewer_uid); $profile_data = sanitize_user_data($profile_data); $buddy = $xml_obj->createElement("buddy"); //adding idbuddy to the xml $idbuddy = $xml_obj->createElement("idbuddy"); $idbuddy->appendChild($xml_obj->createTextNode($user['user_id'])); $buddy->appendChild($idbuddy); //adding thumbnail to the xml if (empty($user['picture'])) { $user['picture'] = $current_theme_path.'/images/default.png'; } else { $img = uihelper_resize_mk_user_img($user['picture'], 80, 80, 'alt="PA"'); preg_match("/src=\"([^']*?)\"/", $img, $match);//preg_match to get the src of the image $user['picture'] = $match[1]; } $thumbnail = $xml_obj->createElement("thumbnail"); $thumbnail->appendChild($xml_obj->createTextNode($user['picture'])); $buddy->appendChild($thumbnail); //adding presence to the xml $presence = $xml_obj->createElement("presence"); $personaIds = Persona::get_user_persona_ids_with_service($user['user_id'], 'AIM'); $pp = PersonaHelper::can_see($personaIds[0], $user['user_id'], $viewer_uid); if ($pp) { // we are allowed to see it $presence_image = 'offline.png'; $Screen_name = $pp->configuration_data->userName; } else { $presence_image = 'white.png'; $Screen_name = 1; } // if the user had set it in the old settings // this code should be removed for production // as the AIM field was never in a public release if (!empty($profile_data['aim'])) { $presence_image = 'offline.png'; $Screen_name = $profile_data['aim']; } //adding screenname to the xml $screenname = $xml_obj->createElement("screenname"); $screenname->appendChild($xml_obj->createTextNode($Screen_name)); $buddy->appendChild($screenname); $presence->appendChild($xml_obj->createTextNode($presence_image)); $buddy->appendChild($presence); //adding username to the xml $username = $xml_obj->createElement("username"); $username->appendChild($xml_obj->createTextNode($user['login_name'])); $buddy->appendChild($username); //adding location to the xml $location = $xml_obj->createElement("location"); $location->appendChild($xml_obj->createTextNode(field_value($profile_data['city'], ' '))); $buddy->appendChild($location); //adding age to the xml $age = $xml_obj->createElement("age"); //$gender->appendChild($xml_obj->createTextNode(field_value($profile_data['sex'], 'Not Specified'))); $Age = ' '; if (!empty($profile_data['dob'])) { $Age = convert_birthDate2Age($profile_data['dob']); } $age->appendChild($xml_obj->createTextNode($Age)); $buddy->appendChild($age); //adding gender to the xml $gender = $xml_obj->createElement("sex"); $gender->appendChild($xml_obj->createTextNode(field_value($profile_data['sex'],' '))); //$gender->appendChild($xml_obj->createTextNode('M')); $buddy->appendChild($gender); //adding effect to the xml $effect = $xml_obj->createElement("effect"); $event = $xml_obj->createElement("event"); $event->appendChild($xml_obj->createTextNode('baloon.say')); $effect->appendChild($event); $shoutout = $xml_obj->createElement("shoutout"); if(empty($profile_data['sub_caption'])) { $profile_data['sub_caption'] = 'Hi.'; } $shoutout->appendChild($xml_obj->createTextNode($profile_data['sub_caption'])); $effect->appendChild($shoutout); $buddy->appendChild($effect); $buddylist->appendChild($buddy); } $xml_obj->appendChild($buddylist); $xml = $xml_obj->saveXml(); /*$file_name = $path_prefix.'/web/blist.xml'; $handle = fopen($file_name, "w"); fwrite($handle, $xml); */ echo $xml; } ?>