国内流行的内容管理系统(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.

archives_sg_edit.php 5.5KB

1 年之前
2 年之前
2 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
2 年之前
1 年之前
2 年之前
2 年之前
2 年之前
1 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /**
  3. * 单表模型修改器
  4. *
  5. * @version $id:archives_sg_add.php 13:52 2010年7月9日 tianya $
  6. * @package DedeBIZ.User
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckRank(0, 0);
  13. require_once(DEDEINC."/dedetag.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. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  19. $mtypesid = isset($mtypesid) && is_numeric($mtypesid) ? $mtypesid : 0;
  20. $menutype = 'content';
  21. if ($cfg_ml->IsSendLimited()) {
  22. ShowMsg("文档发布失败,投稿已经超出投稿限制次数:{$cfg_ml->M_SendMax}次", "-1", "0", 5000);
  23. exit();
  24. }
  25. /*-------------
  26. function _ShowForm(){ }
  27. --------------*/
  28. if (empty($dopost)) {
  29. //读取归档信息
  30. $arcQuery = "SELECT ch.*,arc.* FROM `#@__arctiny` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel WHERE arc.id='$aid' ";
  31. $cInfos = $dsql->GetOne($arcQuery);
  32. if (!is_array($cInfos)) {
  33. ShowMsg("读取文档信息出错", "-1");
  34. exit();
  35. }
  36. $addRow = $dsql->GetOne("SELECT * FROM `{$cInfos['addtable']}` WHERE aid='$aid'; ");
  37. if ($addRow['mid'] != $cfg_ml->M_ID) {
  38. ShowMsg("您没权限操作此文档", "-1");
  39. exit();
  40. }
  41. $addRow['id'] = $addRow['aid'];
  42. include(DEDEMEMBER."/templets/archives_sg_edit.htm");
  43. exit();
  44. }
  45. /*------------------------------
  46. function _SaveArticle(){ }
  47. ------------------------------*/
  48. else if ($dopost == 'save') {
  49. require_once(DEDEINC."/image.func.php");
  50. require_once(DEDEINC."/libraries/oxwindow.class.php");
  51. $flag = '';
  52. $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0;
  53. $userip = GetIP();
  54. if ($typeid == 0) {
  55. ShowMsg('您还没选择栏目,请选择发布文档栏目', '-1');
  56. exit();
  57. }
  58. $query = "SELECT tp.ispart,tp.channeltype,tp.issend,ch.issend AS cissend,ch.sendrank,ch.arcsta,ch.addtable,ch.fieldset,ch.usertype FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$typeid' ";
  59. $cInfos = $dsql->GetOne($query);
  60. $addtable = $cInfos['addtable'];
  61. //检测栏目是否有投稿权限
  62. if ($cInfos['issend'] != 1 || $cInfos['ispart'] != 0 || $cInfos['channeltype'] != $channelid || $cInfos['cissend'] != 1) {
  63. ShowMsg("您所选择的栏目不支持投稿", "-1");
  64. exit();
  65. }
  66. //校验CSRF
  67. CheckCSRF();
  68. //文档的默认状态
  69. if ($cInfos['arcsta'] == 0) {
  70. $arcrank = 0;
  71. } else if ($cInfos['arcsta'] == 1) {
  72. $arcrank = 0;
  73. } else {
  74. $arcrank = -1;
  75. }
  76. //对保存的文档进行处理
  77. $title = cn_substrR(HtmlReplace($title, 1), $cfg_title_maxlen);
  78. $mid = $cfg_ml->M_ID;
  79. //分析处理附加表数据
  80. $inadd_f = $inadd_m = '';
  81. if (!empty($dede_addonfields)) {
  82. $addonfields = explode(';', $dede_addonfields);
  83. if (is_array($addonfields)) {
  84. foreach ($addonfields as $v) {
  85. if ($v == '') {
  86. continue;
  87. }
  88. $vs = explode(',', $v);
  89. if (!isset(${$vs[0]})) {
  90. ${$vs[0]} = '';
  91. }
  92. //自动摘要和远程图片本地化
  93. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
  94. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]);
  95. }
  96. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid);
  97. $inadd_f .= ',`'.$vs[0]."` ='".${$vs[0]}."' ";
  98. $inadd_m .= ','.$vs[0];
  99. }
  100. }
  101. //这里对前台提交的附加数据进行一次校验
  102. $fontiterm = PrintAutoFieldsAdd(stripslashes($cInfos['fieldset']), 'autofield', FALSE);
  103. if ($fontiterm != $inadd_m) {
  104. ShowMsg("提交表单同系统配置不相符,请重新提交", "-1");
  105. exit();
  106. }
  107. }
  108. if ($addtable != '') {
  109. $upQuery = "UPDATE `$addtable` SET `title`='$title',`typeid`='$typeid',`arcrank`='$arcrank',userip='$userip'{$inadd_f} WHERE aid='$aid' ";
  110. if (!$dsql->ExecuteNoneQuery($upQuery)) {
  111. ShowMsg("数据保存到数据库附加表时出错,请联系管理员", "javascript:;");
  112. exit();
  113. }
  114. }
  115. UpIndexKey($aid, 0, $typeid, $sortrank, '');
  116. $artUrl = MakeArt($aid, true);
  117. if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$aid";
  118. //返回成功信息
  119. $msg = "请选择您的后续操作:<a href='archives_sg_add.php?cid=$typeid' class='btn btn-success'>发布新文档</a><a href='archives_do.php?channelid=$channelid&aid=".$aid."&dopost=edit' class='btn btn-success'>查看修改</a><a href='$artUrl' target='_blank' class='btn btn-success'>查看文档</a><a href='content_sg_list.php?channelid=$channelid' class='btn btn-success'>管理文档</a>";
  120. $wintitle = "成功修改文档";
  121. $wecome_info = "文档管理::修改文档";
  122. $win = new OxWindow();
  123. $win->AddTitle("成功修改文档");
  124. $win->AddMsgItem($msg);
  125. $winform = $win->GetWindow("hand", "&nbsp;", false);
  126. $win->Display(DEDEMEMBER."/templets/win_templet.htm");
  127. }
  128. ?>