示例#1
0
 $page_start = $page * $perpage;
 // get avatar for this user
 $av = $db->getArray('SELECT file, isCustom FROM ' . db_avatars . ' WHERE owner_id=' . $USERID . ' AND type=1;');
 if (!empty($av)) {
     if ($av['isCustom'] == 1) {
         $file = 'avatars/';
     } else {
         $file = 'avatars/default/';
     }
     $file .= $av['file'];
     $ets->avatar_url = script_path . $file;
     $ets->avatar = '<img src="' . script_path . $file . '" />';
 }
 // get list of friends
 $list = $db->getAllArray('SELECT friend_id FROM ' . db_friends . ' WHERE owner_id = ' . $USERID . ';');
 if ($db->getRowCount() == 0) {
     // This user has no friends.
     $ets->blog[0]->body = $l['no-friends'];
     $ets->blog[0]->comments = false;
     $ets->blog[0]->author = $u->get('username');
     $ets->blog[0]->date = date('M jS, Y g:i a');
 } else {
     // this user does have friends.
     // build it into an IN() paramater
     $in = '';
     foreach ($list as $row) {
         $in .= $row['friend_id'] . ', ';
     }
     $in = substr($in, 0, -2);
     // get avatars of friends.
     $results = $db->query('SELECT owner_id, file, isCustom, type FROM ' . db_avatars . ' WHERE owner_id IN(' . $in . ') AND type IN(2,1);');