Esempio n. 1
0
 /**
  * Get {html_options} formated friends array
  *
  * @return array
  */
 function getFriends()
 {
     // Cache
     static $tmp = null;
     if (is_array($tmp)) {
         return $tmp;
     }
     $tmp = array();
     $soc = new suxSocialNetwork();
     $user = new suxUser();
     $rel = $soc->getRelationships($_SESSION['users_id']);
     if (!$rel) {
         return $tmp;
     }
     foreach ($rel as $val) {
         $u = $user->getByID($val['friend_users_id']);
         if (!$u) {
             continue;
         }
         // Skip
         $tmp[$val['friend_users_id']] = $u['nickname'];
     }
     return $tmp;
 }
Esempio n. 2
0
 /**
  * Get the stalkers
  *
  * @param int $users_id
  * @return string html
  */
 function stalkers($users_id)
 {
     if (!filter_var($users_id, FILTER_VALIDATE_INT) || $users_id < 1) {
         return null;
     }
     // Cache
     static $html = null;
     if ($html != null) {
         return $html;
     }
     $html = '';
     $soc = new suxSocialNetwork();
     $rel = $soc->getStalkers($users_id);
     if (!$rel) {
         return $html;
     }
     $tpl = new suxTemplate('user');
     $tpl->configLoad('my.conf', 'user');
     $tw = $tpl->getConfigVars('thumbnailWidth');
     $th = $tpl->getConfigVars('thumbnailHeight');
     foreach ($rel as $val) {
         $u = $this->user->getByID($val['users_id'], true);
         if (!$u) {
             continue;
         }
         // Skip
         $url = suxFunct::makeUrl('/user/profile/' . $u['nickname']);
         if (empty($u['image'])) {
             $img = suxFunct::makeUrl('/') . "/media/{$this->partition}/assets/proletariat.gif";
         } else {
             $u['image'] = rawurlencode($u['image']);
             $img = suxFunct::makeUrl('/') . "/data/user/{$u['image']}";
         }
         $html .= "<a href='{$url}' class='stalker'>";
         $html .= "<img src='{$img}' class='stalker' width='{$tw}' height='{$th}' alt='{$u['nickname']}' title = '{$u['nickname']}' />";
         $html .= "</a>";
     }
     return $html;
 }