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

338 line
11KB

  1. <?php
  2. /**
  3. * 软件编辑
  4. *
  5. * @version $Id: soft_edit.php 1 16:09 2010年7月20日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
  13. require_once(DEDEINC."/customfields.func.php");
  14. require_once(DEDEADMIN."/inc/inc_archives_functions.php");
  15. if(empty($dopost)) $dopost = '';
  16. if($dopost!='save')
  17. {
  18. require_once(DEDEADMIN."/inc/inc_catalog_options.php");
  19. require_once(DEDEINC."/dedetag.class.php");
  20. ClearMyAddon();
  21. $aid = preg_replace("#[^0-9]#", '', $aid);
  22. $channelid="3";
  23. //读取归档信息
  24. $arcQuery = "SELECT
  25. #@__channeltype.typename as channelname,
  26. #@__arcrank.membername as rankname,
  27. #@__archives.*
  28. FROM #@__archives
  29. LEFT JOIN #@__channeltype ON #@__channeltype.id=#@__archives.channel
  30. LEFT JOIN #@__arcrank ON #@__arcrank.rank=#@__archives.arcrank
  31. WHERE #@__archives.id='$aid'";
  32. $dsql->SetQuery($arcQuery);
  33. $arcRow = $dsql->GetOne($arcQuery);
  34. if(!is_array($arcRow))
  35. {
  36. ShowMsg("读取档案基本信息出错!","-1");
  37. exit();
  38. }
  39. $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
  40. $cInfos = $dsql->GetOne($query);
  41. if(!is_array($cInfos))
  42. {
  43. ShowMsg("读取频道配置信息出错!","javascript:;");
  44. exit();
  45. }
  46. $addtable = $cInfos['addtable'];
  47. $addQuery = "SELECT * FROM `$addtable` WHERE aid='$aid'";
  48. $addRow = $dsql->GetOne($addQuery);
  49. $newRowStart = 1;
  50. $nForm = '';
  51. $daccess = $addRow['daccess'];
  52. $needmoney = $addRow['needmoney'];
  53. if($addRow['softlinks'] != '')
  54. {
  55. $dtp = new DedeTagParse();
  56. $dtp->LoadSource($addRow['softlinks']);
  57. if(is_array($dtp->CTags))
  58. {
  59. foreach($dtp->CTags as $ctag)
  60. {
  61. if($ctag->GetName()=='link')
  62. {
  63. $islocal = $ctag->GetAtt('islocal');
  64. if($islocal != 1) $needmsg = "<input type='checkbox' name='del{$newRowStart}' value='1' />删除";
  65. else $needmsg = '<input name="sel1" type="button" id="sel1" value="选取" onClick="SelectSoft(\'form1.softurl'.$newRowStart.'\')" />';
  66. $nForm .= "<div style='line-height:36px'>软件地址{$newRowStart}:<input type='text' name='softurl{$newRowStart}' style='width:280px' value='".trim($ctag->GetInnerText())."' />
  67. 服务器名称:<input type='text' name='servermsg{$newRowStart}' value='".$ctag->GetAtt("text")."' style='width:150px' />
  68. <input type='hidden' name='islocal{$newRowStart}' value='{$islocal}' />
  69. $needmsg
  70. </div>\r\n";
  71. $newRowStart++;
  72. }
  73. }
  74. }
  75. $dtp->Clear();
  76. }
  77. $channelid = $arcRow['channel'];
  78. $tags = GetTags($aid);
  79. $arcRow=XSSClean($arcRow);$addRow=XSSClean($addRow);
  80. include DedeInclude("templets/soft_edit.htm");
  81. exit();
  82. }
  83. /*--------------------------------
  84. function __save(){ }
  85. -------------------------------*/
  86. else if($dopost=='save')
  87. {
  88. require_once(DEDEINC.'/image.func.php');
  89. require_once(DEDEINC.'/oxwindow.class.php');
  90. $flag = isset($flags) ? join(',',$flags) : '';
  91. $notpost = isset($notpost) && $notpost == 1 ? 1: 0;
  92. if(empty($typeid2)) $typeid2 = 0;
  93. if(!isset($autokey)) $autokey = 0;
  94. if(!isset($remote)) $remote = 0;
  95. if(!isset($dellink)) $dellink = 0;
  96. if(!isset($autolitpic)) $autolitpic = 0;
  97. if($typeid==0)
  98. {
  99. ShowMsg("请指定文档的栏目!","-1");
  100. exit();
  101. }
  102. if(empty($channelid))
  103. {
  104. ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
  105. exit();
  106. }
  107. if(!CheckChannel($typeid,$channelid))
  108. {
  109. ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
  110. exit();
  111. }
  112. if(!TestPurview('a_Edit'))
  113. {
  114. if(TestPurview('a_AccEdit'))
  115. {
  116. CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的文档权限!");
  117. }
  118. else
  119. {
  120. CheckArcAdmin($id,$cuserLogin->getUserID());
  121. }
  122. }
  123. //对保存的内容进行处理
  124. $pubdate = GetMkTime($pubdate);
  125. $senddate = time();
  126. $sortrank = AddDay($pubdate,$sortup);
  127. if($ishtml==0)
  128. {
  129. $ismake = -1;
  130. }
  131. else
  132. {
  133. $ismake = 0;
  134. }
  135. $title = cn_substrR($title,$cfg_title_maxlen);
  136. $shorttitle = cn_substrR($shorttitle,36);
  137. $color = cn_substrR($color,7);
  138. $writer = cn_substrR($writer,20);
  139. $source = cn_substrR($source,30);
  140. $description = cn_substrR($description,$cfg_auot_description);
  141. $keywords = cn_substrR($keywords,60);
  142. $filename = trim(cn_substrR($filename,40));
  143. $isremote = (empty($isremote)? 0 : $isremote);
  144. $serviterm=empty($serviterm)? "" : $serviterm;
  145. if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
  146. {
  147. $arcrank = -1;
  148. }
  149. $adminid = $cuserLogin->getUserID();
  150. //处理上传的缩略图
  151. if(empty($ddisremote))
  152. {
  153. $ddisremote = 0;
  154. }
  155. $litpic = GetDDImage('litpic',$picname,$ddisremote);
  156. //分析处理附加表数据
  157. $inadd_f = '';
  158. $inadd_v = '';
  159. if(!empty($dede_addonfields))
  160. {
  161. $addonfields = explode(';',$dede_addonfields);
  162. $inadd_f = '';
  163. $inadd_v = '';
  164. if(is_array($addonfields))
  165. {
  166. foreach($addonfields as $v)
  167. {
  168. if($v=='')
  169. {
  170. continue;
  171. }
  172. $vs = explode(',',$v);
  173. if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
  174. {
  175. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
  176. }
  177. else
  178. {
  179. if(!isset(${$vs[0]}))
  180. {
  181. ${$vs[0]} = '';
  182. }
  183. ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id);
  184. }
  185. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  186. }
  187. }
  188. }
  189. //处理图片文档的自定义属性
  190. if($litpic!='' && !preg_match('#p#',$flag))
  191. {
  192. $flag = ($flag=='' ? 'p' : $flag.',p');
  193. }
  194. if($redirecturl!='' && !preg_match('#j#', $flag))
  195. {
  196. $flag = ($flag=='' ? 'j' : $flag.',j');
  197. }
  198. //跳转网址的文档强制为动态
  199. if(preg_match('#j#', $flag)) $ismake = -1;
  200. //更改主档案表
  201. $inQuery = "UPDATE `#@__archives` SET
  202. typeid='$typeid',
  203. typeid2='$typeid2',
  204. sortrank='$sortrank',
  205. flag='$flag',
  206. click='$click',
  207. ismake='$ismake',
  208. arcrank='$arcrank',
  209. money='$money',
  210. title='$title',
  211. color='$color',
  212. source='$source',
  213. writer='$writer',
  214. litpic='$litpic',
  215. pubdate='$pubdate',
  216. notpost='$notpost',
  217. description='$description',
  218. keywords='$keywords',
  219. shorttitle='$shorttitle',
  220. filename='$filename',
  221. dutyadmin='$adminid',
  222. weight='$weight'
  223. WHERE id='$id'; ";
  224. if(!$dsql->ExecuteNoneQuery($inQuery))
  225. {
  226. ShowMsg("更新数据库archives表时出错,请检查!","-1");
  227. exit();
  228. }
  229. //软件链接列表
  230. $urls = '';
  231. for($i=1; $i<=30; $i++)
  232. {
  233. if(!empty(${'softurl'.$i}))
  234. {
  235. $islocal = empty(${'islocal'.$i}) ? '' : 1;
  236. $isneed = empty(${'del'.$i}) ? true : false;
  237. $servermsg = str_replace("'",'',stripslashes(${'servermsg'.$i}));
  238. $softurl = stripslashes(${'softurl'.$i});
  239. if($servermsg=='')
  240. {
  241. $servermsg = '下载地址'.$i;
  242. }
  243. if($softurl != 'http://')
  244. {
  245. if($islocal==1) $urls .= "{dede:link islocal='$islocal' text='{$servermsg}'} $softurl {/dede:link}\r\n" ;
  246. else if($isneed) $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n";
  247. else continue;
  248. }
  249. }
  250. }
  251. $urls = addslashes($urls);
  252. //更新附加表
  253. $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
  254. $addtable = trim($cts['addtable']);
  255. if($addtable!='')
  256. {
  257. $useip = GetIP();
  258. $inQuery = "UPDATE `$addtable`
  259. SET typeid ='$typeid',
  260. filetype ='$filetype',
  261. language ='$language',
  262. softtype ='$softtype',
  263. accredit ='$accredit',
  264. os ='$os',
  265. softrank ='$softrank',
  266. officialUrl ='$officialUrl',
  267. officialDemo ='$officialDemo',
  268. softsize ='$softsize',
  269. softlinks ='$urls',
  270. redirecturl='$redirecturl',
  271. userip = '$useip',
  272. daccess = '$daccess',
  273. needmoney = '$needmoney',
  274. introduce='$body'
  275. {$inadd_f}
  276. WHERE aid='$id';";
  277. if(!$dsql->ExecuteNoneQuery($inQuery))
  278. {
  279. ShowMsg("更新数据库附加表 addonsoft 时出错,请检查原因!","-1");
  280. exit();
  281. }
  282. }
  283. //生成HTML
  284. UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
  285. if($cfg_remote_site=='Y' && $isremote=="1")
  286. {
  287. if($serviterm!="")
  288. {
  289. list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
  290. $config = array( 'hostname' => $servurl, 'username' => $servuser,
  291. 'password' => $servpwd, 'debug' => 'TRUE');
  292. } else {
  293. $config = array();
  294. }
  295. if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
  296. }
  297. $arcUrl = MakeArt($id, TRUE, TRUE, $isremote);
  298. if($arcUrl=="")
  299. {
  300. $arcUrl = $cfg_phpurl."/view.php?aid=$id";
  301. }
  302. ClearMyAddon($id, $title);
  303. //返回成功信息
  304. $msg = "
  305.   请选择你的后续操作:
  306. <a href='soft_add.php?cid=$typeid'><u>发布新软件</u></a>
  307. &nbsp;&nbsp;
  308. <a href='archives_do.php?aid=".$id."&dopost=editArchives'><u>继续修改</u></a>
  309. &nbsp;&nbsp;
  310. <a href='$arcUrl' target='_blank'><u>查看软件</u></a>
  311. &nbsp;&nbsp;
  312. <a href='catalog_do.php?cid=$typeid&dopost=listArchives'><u>已发布软件管理</u></a>
  313. &nbsp;&nbsp;
  314. <a href='catalog_main.php'><u>网站栏目管理</u></a>
  315. ";
  316. $wintitle = "成功修改一个软件!";
  317. $wecome_info = "文章管理::修改软件";
  318. $win = new OxWindow();
  319. $win->AddTitle("成功修改软件:");
  320. $win->AddMsgItem($msg);
  321. $winform = $win->GetWindow("hand", "&nbsp;", FALSE);
  322. $win->Display();
  323. }