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

121 lines
5.1KB

  1. <?php
  2. /**
  3. * 单表模型文档修改
  4. *
  5. * @version $id:archives_sg_edit.php 8:26 2010年7月12日 tianya $
  6. * @package DedeBIZ.Administrator
  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. 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. require_once(DEDEADMIN."/inc/inc_catalog_options.php");
  18. require_once(DEDEINC."/dedetag.class.php");
  19. ClearMyAddon();
  20. $aid = intval($aid);
  21. //读取归档信息
  22. $arcQuery = "SELECT ch.*,arc.* FROM `#@__arctiny` arc LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
  23. $cInfos = $dsql->GetOne($arcQuery);
  24. if (!is_array($cInfos)) {
  25. ShowMsg("读栏目模型信息出错", "-1");
  26. exit();
  27. }
  28. $addtable = $cInfos['addtable'];
  29. $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'");
  30. $channelid = $cInfos['channel'];
  31. $tags = GetTags($aid);
  32. include DedeInclude('templets/archives_sg_edit.htm');
  33. exit();
  34. }
  35. /*--------------------------------
  36. function __save(){ }
  37. -------------------------------*/
  38. else if ($dopost == 'save') {
  39. require_once(DEDEINC.'/image.func.php');
  40. require_once(DEDEINC.'/libraries/oxwindow.class.php');
  41. if ($typeid == 0) {
  42. ShowMsg("请指定文档的栏目", "-1");
  43. exit();
  44. }
  45. if (empty($channelid)) {
  46. ShowMsg("文档为非指定的类型,请检查您发布文档的表单是否合法", "-1");
  47. exit();
  48. }
  49. if (!CheckChannel($typeid, $channelid)) {
  50. ShowMsg("您所选择的栏目与当前模型不相符,请重新选择", "-1");
  51. exit();
  52. }
  53. if (!TestPurview('a_Edit')) {
  54. CheckCatalog($typeid, "您没有操作栏目<span class='text-primary'>{$typeid}</span>文档权限");
  55. }
  56. //对保存的文档进行处理
  57. if (empty($flags)) $flag = '';
  58. else $flag = join(',', $flags);
  59. $title = cn_substrR($title, $cfg_title_maxlen);
  60. $isremote = 0;
  61. $serviterm = empty($serviterm) ? "" : $serviterm;
  62. if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
  63. $adminid = $cuserLogin->getUserID();
  64. //处理上传的缩略图
  65. if (empty($ddisremote)) $ddisremote = 0;
  66. $litpic = GetDDImage('none', $picname, $ddisremote);
  67. //分析处理附加表数据
  68. $inadd_f = '';
  69. $inadd_v = '';
  70. if (!empty($dede_addonfields)) {
  71. $addonfields = explode(';', $dede_addonfields);
  72. $inadd_f = '';
  73. $inadd_v = '';
  74. if (is_array($addonfields)) {
  75. foreach ($addonfields as $v) {
  76. if ($v == '') {
  77. continue;
  78. }
  79. $vs = explode(',', $v);
  80. if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //网页文本特殊处理
  81. {
  82. ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
  83. } else {
  84. if (!isset(${$vs[0]})) {
  85. ${$vs[0]} = '';
  86. }
  87. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
  88. }
  89. $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
  90. }
  91. }
  92. }
  93. //处理图片文档的自定义属性
  94. if ($litpic != '' && !preg_match("#p#", $flag)) {
  95. $flag = ($flag == '' ? 'p' : $flag.',p');
  96. }
  97. $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
  98. $addtable = trim($cts['addtable']);
  99. if ($addtable != '') {
  100. $iquery = "UPDATE `$addtable` SET typeid='$typeid',arcrank='$arcrank',title='$title',flag='$flag',litpic='$litpic'{$inadd_f} WHERE aid='$id' ";
  101. if (!$dsql->ExecuteNoneQuery($iquery)) {
  102. ShowMsg("数据保存到数据库附加表时出错,请检查数据库字段", "javascript:;");
  103. exit();
  104. }
  105. }
  106. //生成网页
  107. UpIndexKey($id, $arcrank, $typeid, $sortrank, '');
  108. $artUrl = MakeArt($id, TRUE, TRUE, $isremote);
  109. if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$id";
  110. ClearMyAddon($id, $title);
  111. //返回成功信息
  112. $msg = "请选择您的后续操作:<a href='archives_sg_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新分类</a><a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>修改分类</a><a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看分类</a><a href='catalog_do.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>管理分类</a><a href='catalog_main.php' class='btn btn-success btn-sm'>网站栏目管理</a>";
  113. $wintitle = "成功修改分类";
  114. $wecome_info = "文档管理::修改分类";
  115. $win = new OxWindow();
  116. $win->AddTitle("成功修改分类");
  117. $win->AddMsgItem($msg);
  118. $winform = $win->GetWindow("hand", "&nbsp;", false);
  119. $win->Display();
  120. }
  121. ?>