//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']; }
require_once dirname(__FILE__) . '/PersonaHelper.php'; echo "<h1>User</h1>"; $user = new User(); echo "Loading user: "******"<br/>"; $user_id = intval($_GET['u']) ? intval($_GET['u']) : 1; $viewer = intval($_GET['v']) ? intval($_GET['v']) : 2; $user->load($user_id); echo "User: "******"<br/>"; echo "<h2>AIM Personas</h2>"; $personaIds = Persona::get_user_persona_ids_with_service($user->user_id, 'AIM'); $personaCount = count($personaIds); echo "AIM Persona Count: {$personaCount} <br/>"; if ($personaCount > 0) { echo "<h3>Configuration data from first AIM account:</h3>"; echo "can_see\n"; $pp = PersonaHelper::can_see($personaIds[0], $user_id, $viewer); // print_r($pp); if ($pp) { // we are allowed to see it echo "AIM username is: " . $pp->configuration_data->userName . "\n"; } else { echo "User {$viewer} may not see Persona {$personaIds['0']}\n"; } die; } echo "<h2>Personas</h2>"; $personaCount = Persona::count_user_personas($user->user_id); echo "Persona Count: " . $personaCount . "<br/>"; $personas =& Persona::load_user_personas($user->user_id); echo "Personas: " . $personas . " count " . count($personas) . "<br/>"; echo "<hr/>";