complete function stream_display
[code]
function stream_display($row = array(),$type = '',$hide_form=0) {
global $client, $config;
if (!$row['avatar']) {
$res = sql_query("select avatar from ".tb()."accounts where id='{$row['uid']}'");
$row2 = sql_fetch_array($res);
if (!$row2['avatar'])
$row['avatar'] = 'undefined.jpg';
else
$row['avatar'] = $row2['avatar'];
};
if (!$row['fullname']) {
$res = sql_query("select fullname from ".tb()."accounts where id='{$row['uid']}'");
$row2 = sql_fetch_array($res);
if (!$row2['fullname'])
$row['fullname'] = $row['username'];
else
$row['fullname'] = $row2['fullname'];
};
if (count($row['attachment']) > 1) {
$attachment = $row['attachment'];
if ($attachment['cwall_id'] == 'none') {
$no_comment = 1;
}
$att = '<div class="att_box">';
if (strlen($attachment['name'])) {
if (strlen($attachment['uri'])) {
$att .= '<div class="att_name">'.url($attachment['uri'],h($attachment['name'])).'</div>';
}
else {
$att .= '<div class="att_name">'.h($attachment['name']).'</div>';
}
}
if (strlen($attachment['title'])) {
$att .= '<div class="att_title">'.url($attachment['uri'],h($attachment['title']) ).'</div>';
}
if (is_array($attachment['thumb']) && $type != 'simple') {
foreach ($attachment['thumb'] as $thumb) {
$thumbs .= url($attachment['uri'],'<img src="'.uhome().'/'.$thumb.'" />');
}
}
if (strlen($attachment['des']) || strlen($thumbs)) {
$att .= '<div class="att_des">'.$thumbs.h($attachment['des']).'</div>';
}
$att .= '</div>';
}
if ($row['app']) {
$row['cwall_id'] = $row['app'].$row['aid'];
$icon = '/modules/'.$row['app'].'/icon';
if ($row['app'] == 'pcomment') {
$icon = '/files/appicons/pcomment';
}
}
else {
$row['cwall_id'] = $row['id'];
$icon = '/files/appicons/status';
$row['message'] = $row['message'].' '.url('u/'.$row['username'].'/status/'.$row['id'], t('View status'));
}
if ($client['id'] && $type != 'simple' && !$hide_form && !$no_comment) {
$comment_form = comment_form($row['id']);
}
if (!$hide_form && $type != 'simple' && !$no_comment) {
if (!$config['stream_delete_form_displayed']) {
$config['stream_delete_form_displayed'] = 1;
c('<script>
$(document).ready( function(){
$("a[class=stream_delete]").click( function () {
var parentdd = $(this).parents(".user_post_1");
var sid = $(this).prev()[0].value;
$(this).after("<img src=\''.uhome().'/files/loading.gif\' /> hiding..");
$(this).hide();
$.get(\''.uhome().'/index.php?p=jquery/stream_delete/\'+sid, function(data) {
parentdd.hide("slow");
});
return false;
});
});
</script>');
}
if ($row['uid'] == $client['id'] || in_array('3',$client['roles']) ) {
$row['message'] = $row['message'].' |
<input type="hidden" name="streamid" value="'.$row['id'].'" /><a href="#" class="stream_delete">'.t('Hide').'</a>';
}
}
if ($type == 'simple' && !$no_comment) {
$avatar_size = 50;
$avatar_box_size = 60;
$comment_get = '';
}
else {
$avatar_size = 50;
$avatar_box_size = 60;
$comment_get = comment_get($row['id'],5);
}
if ($row['likes'] > 0) {
$likes = ' ('.t('{1} people like this','<strong>'.$row['likes'].'</strong>').')';
}
$icon = '<img src="'.uhome().$icon.'.png" />';
if ($row['app'] == 'photo') {
$icon = '';
}
return '
<div class="user_post_1">
<table width="100%">
<tr>
<td class="user_post_left" width="'.$avatar_box_size.'" valign="top">'.avatar($row,$avatar_size).'</td>
<td class="user_post_right" valign="top">
<strong>'.url('u/'.$row['username'],$row['fullname']).'</strong>
'.$row['message'].
$att.'
<div class="att_bottom">'.$icon.' '.get_date($row['created']).$likes.'</div>
'.$comment_form.$comment_get.
'</td>
</tr>
</table>
</div>
';
}
[/code] |