Browse Source

feat(article): 添加迅流新闻文章发布功能

- 集成文章发布模块,支持自定义字段和属性处理
- 实现文章基本属性设置和状态管理
- 添加远程图片保存和链接清理功能
- 集成微博同步发布功能
- 实现积分扣费和权限验证机制
- 支持文章审核流程和HTML页面生成功能
master
zhangf@suq.cn 2 days ago
parent
commit
8c819b6aa7
  1. 83
      member/xunliuAddNews.php

83
member/xunliuAddNews.php

@ -0,0 +1,83 @@
<?php
require '../common.inc.php'; // 根据实际目录结构调整路径
defined('IN_DESTOON') or exit('Access Denied');
$post = $_POST;
$module = 'article';
$moduleid = 21;
// 后续代码保持不变
require DT_ROOT.'/include/post.func.php';
include load($module.'.lang');
include load('my.lang');
require DT_ROOT.'/module/'.$module.'/'.$module.'.class.php';
$do = new $module($moduleid);
// 处理自定义字段和属性
$FD = cache_read('fields-'.substr($table, strlen($DT_PRE)).'.php');
if($FD) require DT_ROOT.'/include/fields.func.php';
isset($post_fields) or $post_fields = array();
$CP = $MOD['cat_property'];
if($CP) require DT_ROOT.'/include/property.func.php';
isset($post_ppt) or $post_ppt = array();
// 新增文章逻辑
$fee_currency = $MOD['fee_currency'];
$fee_unit = $fee_currency == 'money' ? $DT['money_unit'] : $DT['credit_unit'];
$need_password = $fee_add && $fee_currency == 'money' && $fee_add > $DT['quick_pay'];
$need_captcha = $MOD['captcha_add'] == 2 ? $MG['captcha'] : $MOD['captcha_add'];
$need_question = $MOD['question_add'] == 2 ? $MG['question'] : $MOD['question_add'];
$could_color = check_group($_groupid, $MOD['group_color']) && $MOD['credit_color'] && $_userid;
if(isset($post['islink'])) unset($post['islink']);
if($do->pass($post)) {
$CAT = get_cat($post['catid']);
if(!$CAT || !check_group($_groupid, $CAT['group_add'])) {
dalert(lang($L['group_add'], array($CAT['catname'])));
}
// 设置文章基本属性
$post['addtime'] = $post['level'] = $post['fee'] = 0;
$post['style'] = $post['template'] = $post['note'] = $post['filepath'] = '';
$need_check = $MOD['check_add'] == 2 ? $MG['check'] : $MOD['check_add'];
$post['status'] = get_status(3, $need_check);
$post['hits'] = 0;
$post['username'] = $_username;
$post['save_remotepic'] = $MOD['save_remotepic'] ? 1 : 0;
$post['clear_link'] = $MOD['clear_link'] ? 1 : 0;
$post['introduce_length'] = $MOD['introduce_length'] ? $MOD['introduce_length'] : 0;
$post['areaid'] = $cityid;
// 处理自定义字段和属性
if($FD) fields_check($post_fields);
if($CP) property_check($post_ppt);
// 处理颜色样式
if($could_color && $color && $_credit > $MOD['credit_color']) {
$post['style'] = $color;
credit_add($_username, -$MOD['credit_color']);
credit_record($_username, -$MOD['credit_color'], 'system', $L['title_color'], '['.$MOD['name'].']'.$post['title']);
}
$do->table = get_table(21);
$MOD = cache_read('module-21.php');
$table = $do->table;
// 添加文章
$do->add($post);
// 更新自定义字段和属性
if($FD) fields_update($post_fields, $table, $do->itemid);
if($CP) property_update($post_ppt, $moduleid, $post['catid'], $do->itemid);
// 生成HTML页面
if($MOD['show_html'] && $post['status'] > 2) $do->tohtml($do->itemid);
$msg = $post['status'] == 2 ? $L['success_check'] : $L['success_add'];
$js = '';
if(isset($post['sync_sina']) && $post['sync_sina']) {
$js .= sync_weibo('sina', $moduleid, $do->itemid);
}
}
?>
Loading…
Cancel
Save