国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
6.7KB

  1. <?php
  2. /**
  3. * 文档发布器
  4. *
  5. * @version $Id: archives_add.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeBIZ.Member
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__) . "/config.php");
  12. require_once(DEDEINC . "/dedetag.class.php");
  13. require_once(DEDEINC . "/userlogin.class.php");
  14. require_once(DEDEINC . "/customfields.func.php");
  15. require_once(DEDEMEMBER . "/inc/inc_catalog_options.php");
  16. require_once(DEDEMEMBER . "/inc/inc_archives_functions.php");
  17. $channelid = isset($channelid) && is_numeric($channelid) ? $channelid : 1;
  18. $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0;
  19. $mtypesid = isset($mtypesid) && is_numeric($mtypesid) ? $mtypesid : 0;
  20. $menutype = 'content';
  21. /*-------------
  22. function _ShowForm(){ }
  23. --------------*/
  24. if (empty($dopost)) {
  25. $cInfos = $dsql->GetOne("Select * From `#@__channeltype` where id='$channelid'; ");
  26. if (!is_array($cInfos)) {
  27. ShowMsg('模型不存在', '-1');
  28. exit();
  29. }
  30. //如果限制了会员级别或类型,则允许游客投稿选项无效
  31. if ($cInfos['sendrank'] > 0 || $cInfos['usertype'] != '') {
  32. CheckRank(0, 0);
  33. }
  34. //检查会员等级和类型限制
  35. if ($cInfos['sendrank'] > $cfg_ml->M_Rank) {
  36. $row = $dsql->GetOne("Select membername From `#@__arcrank` where rank='" . $cInfos['sendrank'] . "' ");
  37. ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000);
  38. exit();
  39. }
  40. if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) {
  41. ShowMsg("对不起,需要[" . $cInfos['usertype'] . "帐号]才能在这个频道发布文档!", "-1", "0", 5000);
  42. exit();
  43. }
  44. include(DEDEMEMBER . "/templets/archives_add.htm");
  45. exit();
  46. }
  47. /*------------------------------
  48. function _SaveArticle(){ }
  49. ------------------------------*/ else if ($dopost == 'save') {
  50. include(dirname(__FILE__) . '/inc/archives_check.php');
  51. //分析处理附加表数据
  52. $inadd_f = $inadd_v = '';
  53. if (!empty($dede_addonfields)) {
  54. $addonfields = explode(';', $dede_addonfields);
  55. $inadd_f = '';
  56. $inadd_v = '';
  57. if (is_array($addonfields)) {
  58. foreach ($addonfields as $v) {
  59. if ($v == '') {
  60. continue;
  61. }
  62. $vs = explode(',', $v);
  63. if (!isset(${$vs[0]})) {
  64. ${$vs[0]} = '';
  65. }
  66. //自动摘要和远程图片本地化
  67. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
  68. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]);
  69. }
  70. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], 0);
  71. $inadd_f .= ',' . $vs[0];
  72. $inadd_v .= " ,'" . ${$vs[0]} . "' ";
  73. }
  74. }
  75. // 这里对前台提交的附加数据进行一次校验
  76. $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE);
  77. if ($fontiterm != $inadd_f) {
  78. ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1");
  79. exit();
  80. }
  81. }
  82. //处理图片文档的自定义属性
  83. if ($litpic != '') $flag = 'p';
  84. //生成文档ID
  85. $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $mid);
  86. if (empty($arcID)) {
  87. ShowMsg("无法获得主键,因此无法进行后续操作!", "-1");
  88. exit();
  89. }
  90. //保存到主表
  91. $inQuery = "INSERT INTO `#@__archives`(id,typeid,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,
  92. color,writer,source,litpic,pubdate,senddate,mid,description,keywords,mtype)
  93. VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank','0','$money','$title','$shorttitle',
  94. '$color','$writer','$source','$litpic','$pubdate','$senddate','$mid','$description','$keywords','$mtypesid'); ";
  95. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  96. $gerr = $dsql->GetError();
  97. $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID' ");
  98. ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。", "javascript:;");
  99. exit();
  100. }
  101. //保存到附加表
  102. $addtable = trim($cInfos['addtable']);
  103. if (empty($addtable)) {
  104. $dsql->ExecuteNoneQuery("Delete From `#@__archives` where id='$arcID'");
  105. $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID'");
  106. ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。", "javascript:;");
  107. exit();
  108. } else {
  109. $inquery = "INSERT INTO `{$addtable}`(aid,typeid,userip,redirecturl,templet{$inadd_f}) Values('$arcID','$typeid','$userip','',''{$inadd_v})";
  110. if (!$dsql->ExecuteNoneQuery($inquery)) {
  111. $gerr = $dsql->GetError();
  112. $dsql->ExecuteNoneQuery("Delete From `#@__archives` where id='$arcID'");
  113. $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID'");
  114. ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错<br>error:{$gerr},请联系管理员!", "javascript:;");
  115. exit();
  116. }
  117. }
  118. //增加积分
  119. $dsql->ExecuteNoneQuery("Update `#@__member` set scores=scores+{$cfg_sendarc_scores} where mid='" . $cfg_ml->M_ID . "' ; ");
  120. //更新统计
  121. countArchives($channelid);
  122. //生成HTML
  123. InsertTags($tags, $arcID);
  124. $artUrl = MakeArt($arcID, true);
  125. if ($artUrl == '') {
  126. $artUrl = $cfg_phpurl . "/view.php?aid=$arcID";
  127. }
  128. ClearMyAddon($arcID, $title);
  129. //返回成功信息
  130. $msg = "
  131.   请选择你的后续操作:
  132. <a href='archives_add.php?cid=$typeid&channelid=$channelid' class='btn btn-secondary btn-sm'>继续发布内容</a>
  133. &nbsp;&nbsp;
  134. <a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看内容</a>
  135. &nbsp;&nbsp;
  136. <a href='archives_edit.php?channelid=$channelid&aid=$arcID' class='btn btn-secondary btn-sm'>更改内容</a>
  137. &nbsp;&nbsp;
  138. <a href='content_list.php?channelid={$channelid}' class='btn btn-secondary btn-sm'>已发布内容管理</a>
  139. ";
  140. $wintitle = "成功发布内容!";
  141. $wecome_info = "内容管理::发布内容";
  142. $win = new OxWindow();
  143. $win->AddTitle("成功发布内容:");
  144. $win->AddMsgItem($msg);
  145. $winform = $win->GetWindow("hand", "&nbsp;", false);
  146. $win->Display();
  147. }