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

231 lines
8.4KB

  1. <?php
  2. /**
  3. * 软件编辑
  4. *
  5. * @version $Id: soft_edit.php 2 14:16 2010-11-11 tianya $
  6. * @package DedeBIZ.Member
  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 : 3;
  18. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  19. $menutype = 'content';
  20. /*-------------
  21. function _ShowForm(){ }
  22. --------------*/
  23. if (empty($dopost)) {
  24. //读取归档信息
  25. $arcQuery = "SELECT
  26. #@__channeltype.typename as channelname,
  27. #@__arcrank.membername as rankname,
  28. #@__channeltype.arcsta,
  29. #@__archives.*
  30. FROM #@__archives
  31. LEFT JOIN #@__channeltype ON #@__channeltype.id=#@__archives.channel
  32. LEFT JOIN #@__arcrank ON #@__arcrank.rank=#@__archives.arcrank
  33. WHERE #@__archives.id='$aid'";
  34. $dsql->SetQuery($arcQuery);
  35. $row = $dsql->GetOne($arcQuery);
  36. if (!is_array($row)) {
  37. ShowMsg("读取档案基本信息出错!", "-1");
  38. exit();
  39. } else if ($row['arcrank'] >= 0) {
  40. $dtime = time();
  41. $maxtime = $cfg_mb_editday * 24 * 3600;
  42. if ($dtime - $row['senddate'] > $maxtime) {
  43. ShowMsg("这篇文档已经锁定,您不能再修改它", "-1");
  44. exit();
  45. }
  46. }
  47. $query = "SELECT * FROM `#@__channeltype` WHERE id='".$row['channel']."'";
  48. $cInfos = $dsql->GetOne($query);
  49. if (!is_array($cInfos)) {
  50. ShowMsg("读取频道配置信息出错!", "javascript:;");
  51. exit();
  52. }
  53. $addtable = $cInfos['addtable'];
  54. $addQuery = "SELECT * FROM `$addtable` WHERE aid='$aid'";
  55. $addRow = $dsql->GetOne($addQuery);
  56. $newRowStart = 1;
  57. $nForm = '';
  58. if (isset($addRow['softlinks']) && $addRow['softlinks'] != '') {
  59. $dtp = new DedeTagParse();
  60. $dtp->LoadSource($addRow['softlinks']);
  61. if (is_array($dtp->CTags)) {
  62. foreach ($dtp->CTags as $ctag) {
  63. if ($ctag->GetName() == 'link') {
  64. $nForm .= "软件地址".$newRowStart.":<input class='form-control' type='text' name='softurl".$newRowStart."' value='".trim($ctag->GetInnerText())."' />
  65. 服务器名称:<input class='form-control' type='text' name='servermsg".$newRowStart."' value='".$ctag->GetAtt("text")."' />
  66. <br />";
  67. $newRowStart++;
  68. }
  69. }
  70. }
  71. $dtp->Clear();
  72. }
  73. $row = XSSClean($row);
  74. $addRow = XSSClean($addRow);
  75. $channelid = $row['channel'];
  76. $tags = GetTags($aid);
  77. include(DEDEMEMBER."/templets/soft_edit.htm");
  78. exit();
  79. }
  80. /*------------------------------
  81. function _SaveArticle(){ }
  82. ------------------------------*/ else if ($dopost == 'save') {
  83. $description = '';
  84. include(DEDEMEMBER.'/inc/archives_check_edit.php');
  85. //分析处理附加表数据
  86. $inadd_f = '';
  87. if (!empty($dede_addonfields)) {
  88. $addonfields = explode(';', $dede_addonfields);
  89. if (is_array($addonfields)) {
  90. foreach ($addonfields as $v) {
  91. if ($v == '') {
  92. continue;
  93. }
  94. $vs = explode(',', $v);
  95. if (!isset(${$vs[0]})) {
  96. ${$vs[0]} = '';
  97. }
  98. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid);
  99. $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
  100. }
  101. }
  102. }
  103. $body = AnalyseHtmlBody($body, $description);
  104. $body = HtmlReplace($body, -1);
  105. //处理图片文档的自定义属性
  106. if ($litpic != '') $flag = 'p';
  107. //分析处理附加表数据
  108. $inadd_f = '';
  109. $inadd_v = '';
  110. if (!empty($dede_addonfields)) {
  111. $addonfields = explode(';', $dede_addonfields);
  112. $inadd_f = '';
  113. $inadd_v = '';
  114. if (is_array($addonfields)) {
  115. foreach ($addonfields as $v) {
  116. if ($v == '') {
  117. continue;
  118. }
  119. $vs = explode(',', $v);
  120. //HTML文本特殊处理
  121. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
  122. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
  123. } else {
  124. if (!isset(${$vs[0]})) {
  125. ${$vs[0]} = '';
  126. }
  127. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
  128. }
  129. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  130. }
  131. }
  132. //这里对前台提交的附加数据进行一次校验
  133. $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE);
  134. if ($fontiterm != $inadd_f) {
  135. ShowMsg("提交表单同系统配置不相符,请重新提交", "-1");
  136. exit();
  137. }
  138. }
  139. //修改主档案表
  140. $upQuery = "UPDATE `#@__archives` set
  141. ismake='$ismake',
  142. arcrank='$arcrank',
  143. typeid='$typeid',
  144. title='$title',
  145. litpic='$litpic',
  146. description='$description',
  147. keywords='$keywords',
  148. flag='$flag'
  149. WHERE id='$aid' AND mid='$mid'; ";
  150. if (!$dsql->ExecuteNoneQuery($upQuery)) {
  151. ShowMsg("更新数据库archives表时出错,请检查", "-1");
  152. exit();
  153. }
  154. //软件链接列表
  155. $urls = '';
  156. for ($i = 1; $i <= 9; $i++) {
  157. if (!empty(${'softurl'.$i})) {
  158. $servermsg = str_replace("'", '', stripslashes(${'servermsg'.$i}));
  159. $servermsg = str_replace(array("{dede:", "{/dede:", "}"), "#", $servermsg);
  160. $softurl = stripslashes(${'softurl'.$i});
  161. $softurl = str_replace(array("{dede:", "{/dede:", "}"), "#", $softurl);
  162. if ($servermsg == '') {
  163. $servermsg = '下载地址'.$i;
  164. }
  165. if ($softurl != '' && $softurl != 'http://') {
  166. $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n";
  167. }
  168. }
  169. }
  170. $urls = addslashes($urls);
  171. //更新附加表
  172. $needmoney = @intval($needmoney);
  173. if ($needmoney > 100) $needmoney = 100;
  174. $cts = $dsql->GetOne("SELECT addtable From `#@__channeltype` where id='$channelid' ");
  175. $addtable = trim($cts['addtable']);
  176. if ($addtable != '') {
  177. $inQuery = "UPDATE `$addtable`
  178. set typeid ='$typeid',
  179. filetype ='$filetype',
  180. language ='$language',
  181. softtype ='$softtype',
  182. accredit ='$accredit',
  183. os ='$os',
  184. softrank ='$softrank',
  185. officialUrl ='$officialUrl',
  186. officialDemo ='$officialDemo',
  187. softsize ='$softsize',
  188. softlinks ='$urls',
  189. userip='$userip',
  190. needmoney='$needmoney',
  191. introduce='$body'{$inadd_f}
  192. WHERE aid='$aid'; ";
  193. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  194. ShowMsg("更新数据库附加表 addonsoft 时出错,请检查原因", "-1");
  195. exit();
  196. }
  197. }
  198. UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags);
  199. $artUrl = MakeArt($aid, TRUE);
  200. if ($artUrl == '') {
  201. $artUrl = $cfg_phpurl."/view.php?aid=$aid";
  202. }
  203. //返回成功信息
  204. $msg = "  请选择您的后续操作:
  205. <a href='soft_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>发布新软件</a>
  206. &nbsp;&nbsp;
  207. <a href='soft_edit.php?channelid=$channelid&aid=".$aid."' class='btn btn-secondary btn-sm'>查看修改</a>
  208. &nbsp;&nbsp;
  209. <a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看软件</a>
  210. &nbsp;&nbsp;
  211. <a href='content_list.php?channelid=$channelid' class='btn btn-secondary btn-sm'>管理软件</a>
  212. ";
  213. $wintitle = "成功修改软件";
  214. $wecome_info = "软件管理::修改软件";
  215. $win = new OxWindow();
  216. $win->AddTitle("成功修改软件:");
  217. $win->AddMsgItem($msg);
  218. $winform = $win->GetWindow("hand", "&nbsp;", FALSE);
  219. $win->Display();
  220. }