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

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