public function feed()
{
$feed_id = intval($_GET['feed_id']);
if (empty($feed_id)) {
$this->error(L('PUBLIC_INFO_ALREADY_DELETE_TIPS'));
}
// 获取用户信息
$user_info = model('User')->getUserInfo($this->uid);
// 个人空间头部
$this->_top();
// 判断隐私设置
$userPrivacy = $this->privacy($this->uid);
if ($userPrivacy['space'] !== 1) {
$this->_sidebar();
$feedInfo = model('Feed')->get($feed_id);
if (!$feedInfo) {
$this->error('该分享不存在或已被删除');
}
// if (intval ( $_GET ['uid'] ) != $feedInfo ['uid'])
// $this->error ( '参数错误' );
if ($feedInfo['is_audit'] == '0' && $feedInfo['uid'] != $this->mid) {
$this->error('此分享正在审核');
exit;
}
if ($feedInfo['is_del'] == '1') {
$this->error(L('PUBLIC_NO_RELATE_WEIBO'));
exit;
}
$weiboSet = model('Xdata')->get('admin_Config:feed');
$a['initNums'] = $weiboSet['weibo_nums'];
$a['weibo_type'] = $weiboSet['weibo_type'];
$a['weibo_premission'] = $weiboSet['weibo_premission'];
$this->assign($a);
if ($feedInfo['from'] == '1') {
$feedInfo['from'] = getFromClient(6, $feedInfo['app'], '3G版');
} else {
switch ($feedInfo['app']) {
case 'weiba':
$feedInfo['from'] = getFromClient(0, $feedInfo['app'], '微吧');
break;
default:
$feedInfo['from'] = getFromClient($feedInfo['from'], $feedInfo['app']);
break;
}
}
// $feedInfo['from'] = getFromClient( $feedInfo['from'] , $feedInfo['app']);
// 分享图片
if ($feedInfo['type'] === 'postimage') {
$var = unserialize($feedInfo['feed_data']);
$feedInfo['image_body'] = $var['body'];
if (!empty($var['attach_id'])) {
$var['attachInfo'] = model('Attach')->getAttachByIds($var['attach_id']);
foreach ($var['attachInfo'] as $ak => $av) {
$_attach = array('attach_id' => $av['attach_id'], 'attach_name' => $av['name'], 'attach_url' => getImageUrl($av['save_path'] . $av['save_name'], 580), 'extension' => $av['extension'], 'size' => $av['size']);
// $_attach ['attach_small'] = getImageUrl ( $av ['save_path'] . $av ['save_name'], 100, 100, true );
// $_attach ['attach_middle'] = getImageUrl ( $av ['save_path'] . $av ['save_name'], 740 );
$feedInfo['attachInfo'][$ak] = $_attach;
}
}
} elseif ($feedInfo['type'] === 'postvideo') {
$var = unserialize($feedInfo['feed_data']);
$feedInfo['videoInfo'] = $var;
} elseif ($feedInfo['type'] === 'postfile') {
$var = unserialize($feedInfo['feed_data']);
$feedInfo['fileInfo'] = $var;
$feedInfo['fileInfo']['files'] = array();
$files = model('Attach')->getAttachByIds($var['attach_id']);
if ($files) {
$feedInfo['fileInfo']['files'] = $files;
}
}
$this->assign('feedInfo', $feedInfo);
} else {
$this->_assignUserInfo($this->uid);
}
// seo
$feedContent = unserialize($feedInfo['feed_data']);
$seo = model('Xdata')->get('admin_Config:seo_feed_detail');
$replace['content'] = $feedContent['content'];
$replace['uname'] = $feedInfo['user_info']['uname'];
$replaces = array_keys($replace);
foreach ($replaces as &$v) {
$v = '{' . $v . '}';
}
$seo['title'] = str_replace($replaces, $replace, $seo['title']);
$seo['keywords'] = str_replace($replaces, $replace, $seo['keywords']);
$seo['des'] = str_replace($replaces, $replace, $seo['des']);
!empty($seo['title']) && $this->setTitle($seo['title']);
!empty($seo['keywords']) && $this->setKeywords($seo['keywords']);
!empty($seo['des']) && $this->setDescription($seo['des']);
$this->assign('userPrivacy', $userPrivacy);
// 赞功能
$diggArr = model('FeedDigg')->checkIsDigg($feed_id, $this->mid);
$this->assign('diggArr', $diggArr);
$cancomment_old_type = array('post', 'repost', 'postimage', 'postfile', 'weiba_post', 'weiba_repost', 'blog_post', 'blog_repost', 'event_post', 'event_repost', 'vote_post', 'vote_repost', 'photo_post', 'photo_repost');
$this->assign('cancomment_old_type', $cancomment_old_type);
$appRow = model('Source')->getSourceInfo($feedInfo['app_row_table'], $feedInfo['app_row_id']);
$appUid = $appRow['source_user_info']['uid'];
$this->assign('appUid', $appUid);
$this->display();
}