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

263 lines
8.6KB

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