国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

181 рядки
8.0KB

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