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

181 lines
6.0KB

  1. <?php
  2. /**
  3. * 单表模型文档编辑
  4. *
  5. * @version $Id: archives_sg_edit.php 1 8:26 2010年7月12日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2019, 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 = intval($aid);
  22. //读取归档信息
  23. $arcQuery = "SELECT ch.*,arc.* FROM `#@__arctiny` arc
  24. LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
  25. $cInfos = $dsql->GetOne($arcQuery);
  26. if(!is_array($cInfos))
  27. {
  28. ShowMsg("读频道模型信息出错!","-1");
  29. exit();
  30. }
  31. $addtable = $cInfos['addtable'];
  32. $addRow = $dsql->GetOne("SELECT arc.*,ar.membername as rankname FROM `$addtable` arc LEFT JOIN `#@__arcrank` ar on ar.rank=arc.arcrank WHERE arc.aid='$aid'");
  33. $channelid = $cInfos['channel'];
  34. $tags = GetTags($aid);
  35. include DedeInclude('templets/archives_sg_edit.htm');
  36. exit();
  37. }
  38. /*--------------------------------
  39. function __save(){ }
  40. -------------------------------*/
  41. else if($dopost=='save')
  42. {
  43. require_once(DEDEINC.'/image.func.php');
  44. require_once(DEDEINC.'/oxwindow.class.php');
  45. if($typeid==0)
  46. {
  47. ShowMsg("请指定文档的栏目!","-1");
  48. exit();
  49. }
  50. if(empty($channelid))
  51. {
  52. ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
  53. exit();
  54. }
  55. if(!CheckChannel($typeid,$channelid))
  56. {
  57. ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
  58. exit();
  59. }
  60. if(!TestPurview('a_Edit'))
  61. {
  62. if(TestPurview('a_AccEdit'))
  63. {
  64. CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!");
  65. }
  66. else
  67. {
  68. CheckArcAdmin($id,$cuserLogin->getUserID());
  69. }
  70. }
  71. //对保存的内容进行处理
  72. if(empty($flags)) $flag = '';
  73. else $flag = join(',', $flags);
  74. $title = cn_substrR($title, $cfg_title_maxlen);
  75. $isremote = (empty($isremote)? 0 : $isremote);
  76. $serviterm=empty($serviterm)? "" : $serviterm;
  77. if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
  78. $adminid = $cuserLogin->getUserID();
  79. //处理上传的缩略图
  80. if(empty($ddisremote)) $ddisremote = 0;
  81. $litpic = GetDDImage('none', $picname, $ddisremote);
  82. //分析处理附加表数据
  83. $inadd_f = '';
  84. $inadd_v = '';
  85. if(!empty($dede_addonfields))
  86. {
  87. $addonfields = explode(';', $dede_addonfields);
  88. $inadd_f = '';
  89. $inadd_v = '';
  90. if(is_array($addonfields))
  91. {
  92. foreach($addonfields as $v)
  93. {
  94. if($v=='')
  95. {
  96. continue;
  97. }
  98. $vs = explode(',',$v);
  99. if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
  100. {
  101. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
  102. }else
  103. {
  104. if(!isset(${$vs[0]}))
  105. {
  106. ${$vs[0]} = '';
  107. }
  108. ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id);
  109. }
  110. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  111. }
  112. }
  113. }
  114. //处理图片文档的自定义属性
  115. if($litpic!='' && !preg_match("#p#", $flag))
  116. {
  117. $flag = ($flag=='' ? 'p' : $flag.',p');
  118. }
  119. $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
  120. $addtable = trim($cts['addtable']);
  121. if($addtable!='')
  122. {
  123. $iquery = "UPDATE `$addtable` SET typeid='$typeid',arcrank='$arcrank',title='$title',flag='$flag',litpic='$litpic'{$inadd_f} WHERE aid='$id' ";
  124. if(!$dsql->ExecuteNoneQuery($iquery))
  125. {
  126. ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;");
  127. exit();
  128. }
  129. }
  130. //生成HTML
  131. UpIndexKey($id, $arcrank, $typeid, $sortrank, '');
  132. if($cfg_remote_site=='Y' && $isremote=="1")
  133. {
  134. if($serviterm!="")
  135. {
  136. list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
  137. $config = array( 'hostname' => $servurl, 'username' => $servuser,
  138. 'password' => $servpwd,'debug' => 'TRUE');
  139. } else {
  140. $config = array();
  141. }
  142. if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
  143. }
  144. $artUrl = MakeArt($id, TRUE, TRUE, $isremote);
  145. if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$id";
  146. ClearMyAddon($id, $title);
  147. //返回成功信息
  148. $msg = "
  149.   请选择你的后续操作:
  150. <a href='archives_sg_add.php?cid=$typeid'><u>发布新文档</u></a>
  151. &nbsp;&nbsp;
  152. <a href='archives_do.php?aid=".$id."&dopost=editArchives'><u>查看更改</u></a>
  153. &nbsp;&nbsp;
  154. <a href='$artUrl' target='_blank'><u>查看文档</u></a>
  155. &nbsp;&nbsp;
  156. <a href='catalog_do.php?cid=$typeid&channelid={$channelid}&dopost=listArchives'><u>管理文档</u></a>
  157. &nbsp;&nbsp;
  158. <a href='catalog_main.php'><u>网站栏目管理</u></a>
  159. ";
  160. $wintitle = "成功更改文档!";
  161. $wecome_info = "文档管理::更改文档";
  162. $win = new OxWindow();
  163. $win->AddTitle("成功更改文档:");
  164. $win->AddMsgItem($msg);
  165. $winform = $win->GetWindow("hand","&nbsp;",false);
  166. $win->Display();
  167. }