国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

189 行
6.9KB

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