Ejemplo n.º 1
0
 function generate_inner_html()
 {
     switch ($this->mode) {
         case PRI:
             $this->outer_template = 'outer_private_side_module.tpl';
             $tmp_file = dirname(__FILE__) . '/side_inner_public.tpl';
             break;
         default:
             $tmp_file = dirname(__FILE__) . '/side_inner_public.tpl';
             break;
     }
     $inner_html_gen =& new Template($tmp_file);
     // See if we have a Flickr ID for $this->uid.
     $flickr_id = Cache::getExtCache($this->uid, "flickr_id");
     if ($flickr_id === NULL) {
         // fetch all personas from the flickr service, and see if one of them has a filled in flickr_username_email field.
         $persona = new Persona();
         $flickr_persona_ids = $persona->get_user_persona_ids_with_service($this->uid, "Flickr");
         foreach ($flickr_persona_ids as $flickr_persona_id) {
             $persona = new Persona();
             $persona->load((int) $flickr_persona_id);
             $data = $persona->get_configuration_data();
             if (!empty($data->flickr_username_email)) {
                 // found one!
                 $flickr_id = $data->flickr_username_email;
                 break;
             }
         }
         if (!empty($flickr_id)) {
             Cache::setExtCache($this->uid, "flickr_id", $flickr_id);
         }
     }
     if (empty($flickr_id)) {
         $pics = NULL;
     } else {
         // Fetch pics from cache if possible.  If not cached, the inner HTML will call ajax/flickr_pics.php to fetch them.
         $pics = Cache::getExtCache(0, "flickr_pics:{$flickr_id}");
     }
     $inner_html_gen->set('pics', $pics);
     $inner_html_gen->set('flickr_id', $flickr_id);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
Ejemplo n.º 2
0
 $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'];
Ejemplo n.º 3
0
require_once dirname(__FILE__) . '/../../config.inc';
require_once "{$path_prefix}/api/User/User.php";
require_once "{$path_prefix}/api/Persona/Persona.php";
require_once "{$path_prefix}/api/Persona/PersonaProperty.php";
require_once "{$path_prefix}/api/Persona/PersonaService.php";
require_once "{$path_prefix}/api/Persona/PersonaServicePath.php";
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;
}