本帖最后由 家俊 于 2011-11-19 15:18 编辑
jnthts 发表于 2011-11-17 20:53 
v1.1 2011-11-17更新
1.增加内容显示图片、FLASH等媒体功能。
2.增加远程封面图片功能。
作者, 可否加"堆送到記錄"功能?
例如:
jnthts 發表了了一個小說
[主題名稱(連接形式)]
[小說簡介(頭255字)]
提供一下相關信息 source\function\function_feed.php文件的- function feed_add($icon, $title_template='', $title_data=array(), $body_template='', $body_data=array(), $body_general='', $images=array(), $image_links=array(), $target_ids='', $friend='', $appid='', $returnid=0, $id=0, $idtype='', $uid=0, $username='') {
- global $_G;
- //語言包
- $title_template = $title_template?lang('feed', $title_template):'';
- $body_template = $body_template?lang('feed', $body_template):'';
- $body_general = $body_general?lang('feed', $body_general):'';
- if(empty($uid) || empty($username)) {
- $uid = $username = '';
- }
-
- $feedarr = array(
- 'appid' => $appid,
- 'icon' => $icon,
- 'uid' => $uid ? intval($uid) : $_G['uid'],
- 'username' => $username ? $username : $_G['username'],
- 'dateline' => $_G['timestamp'],
- 'title_template' => $title_template,
- 'body_template' => $body_template,
- 'body_general' => $body_general,
- 'image_1' => empty($images[0])?'':$images[0],
- 'image_1_link' => empty($image_links[0])?'':$image_links[0],
- 'image_2' => empty($images[1])?'':$images[1],
- 'image_2_link' => empty($image_links[1])?'':$image_links[1],
- 'image_3' => empty($images[2])?'':$images[2],
- 'image_3_link' => empty($image_links[2])?'':$image_links[2],
- 'image_4' => empty($images[3])?'':$images[3],
- 'image_4_link' => empty($image_links[3])?'':$image_links[3],
- 'target_ids' => $target_ids,
- 'friend' => $friend,
- 'id' => $id,
- 'idtype' => $idtype
- );
- $feedarr = dstripslashes($feedarr);//去掉轉義
- $feedarr['title_data'] = serialize(dstripslashes($title_data));//數組轉化
- $feedarr['body_data'] = serialize(dstripslashes($body_data));//數組轉化
- //$feedarr['hash_template'] = md5($feedarr['title_template']."\t".$feedarr['body_template']);//喜好hash
- //$feedarr['hash_data'] = md5($feedarr['title_template']."\t".$feedarr['title_data']."\t".$feedarr['body_template']."\t".$feedarr['body_data']);//合并hash
- $feedarr['hash_data'] = empty($title_data['hash_data'])?'':$title_data['hash_data'];
- $feedarr = daddslashes($feedarr);//增加轉義
- //去重
- if(is_numeric($icon)) {
- //應用動態
- $feed_table = 'home_feed_app';
- unset($feedarr['id'], $feedarr['idtype']);
- } else {
- if($feedarr['hash_data']) {
- $query = DB::query("SELECT feedid FROM ".DB::table('home_feed')." WHERE uid='$feedarr[uid]' AND hash_data='$feedarr[hash_data]' LIMIT 0,1");
- if($oldfeed = DB::fetch($query)) {
- return 0;
- }
- }
- $feed_table = 'home_feed';
- }
- //插入
- if($returnid) {
- return DB::insert($feed_table, $feedarr, $returnid);
- } else {
- DB::insert($feed_table, $feedarr);
- return 1;
- }
- }
- //整理feed
复制代码 |