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

212 lines
7.2KB

  1. <?php
  2. /**
  3. * 图集编辑
  4. *
  5. * @version $Id: album_edit.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeCMS.Member
  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. CheckRank(0,0);
  13. if($cfg_mb_lit=='Y')
  14. {
  15. ShowMsg("由于系统开启了精简版会员空间,你访问的功能不可用!","-1");
  16. exit();
  17. }
  18. if($cfg_mb_album=='N')
  19. {
  20. ShowMsg("对不起,由于系统关闭了图集功能,你访问的功能不可用!","-1");
  21. exit();
  22. }
  23. require_once(DEDEINC."/dedetag.class.php");
  24. require_once(DEDEINC."/customfields.func.php");
  25. require_once(DEDEMEMBER."/inc/inc_catalog_options.php");
  26. require_once(DEDEMEMBER."/inc/inc_archives_functions.php");
  27. $channelid = isset($channelid) && is_numeric($channelid) ? $channelid : 2;
  28. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  29. $menutype = 'content';
  30. if(empty($formhtml)) $formhtml = 0;
  31. /*-------------
  32. function _ShowForm(){ }
  33. --------------*/
  34. if(empty($dopost))
  35. {
  36. //读取归档信息
  37. $arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,ch.arcsta
  38. FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel
  39. WHERE arc.id='$aid' AND arc.mid='".$cfg_ml->M_ID."'; ";
  40. $row = $dsql->GetOne($arcQuery);
  41. if(!is_array($row))
  42. {
  43. ShowMsg("读取文档信息出错!","-1");
  44. exit();
  45. }
  46. else if($row['arcrank']>=0)
  47. {
  48. $dtime = time();
  49. $maxtime = $cfg_mb_editday * 24 *3600;
  50. if($dtime - $row['senddate'] > $maxtime)
  51. {
  52. ShowMsg("这篇文档已经锁定,你不能再修改它!","-1");
  53. exit();
  54. }
  55. }
  56. $addRow = $dsql->GetOne("SELECT * FROM `{$row['addtable']}` WHERE aid='$aid'; ");
  57. $dtp = new DedeTagParse();
  58. $dtp->LoadSource($addRow['imgurls']);
  59. $abinfo = $dtp->GetTagByName('pagestyle');
  60. $row=XSSClean($row);$addRow=XSSClean($addRow);
  61. include(DEDEMEMBER."/templets/album_edit.htm");
  62. exit();
  63. }
  64. /*------------------------------
  65. function _Save(){ }
  66. ------------------------------*/
  67. else if($dopost=='save')
  68. {
  69. $svali = GetCkVdValue();
  70. if(preg_match("/1/",$safe_gdopen)){
  71. if(strtolower($vdcode)!=$svali || $svali=='')
  72. {
  73. ResetVdValue();
  74. ShowMsg('验证码错误!', '-1');
  75. exit();
  76. }
  77. }
  78. $cInfos = $dsql->GetOne("Select * From `#@__channeltype` where id='$channelid'; ");
  79. $maxwidth = isset($maxwidth) && is_numeric($maxwidth) ? $maxwidth : 800;
  80. $pagepicnum = isset($pagepicnum) && is_numeric($pagepicnum) ? $pagepicnum : 12;
  81. $ddmaxwidth = isset($ddmaxwidth) && is_numeric($ddmaxwidth) ? $ddmaxwidth : 200;
  82. $prow = isset($prow) && is_numeric($prow) ? $prow : 3;
  83. $pcol = isset($pcol) && is_numeric($pcol) ? $pcol : 3;
  84. $pagestyle = in_array($pagestyle,array('1','2','3')) ? $pagestyle : 2;
  85. include(DEDEMEMBER.'/inc/archives_check_edit.php');
  86. $imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum'
  87. ddmaxwidth='$ddmaxwidth' row='$prow' col='$pcol' value='$pagestyle'/}\r\n";
  88. $hasone = false;
  89. $ddisfirst=1;
  90. //只支持填写地址
  91. for($i=1;$i<=120;$i++)
  92. {
  93. if (!isset(${'imgfile'.$i})) {
  94. continue;
  95. }
  96. $f = ${'imgfile'.$i};
  97. $msg = isset(${'imgmsg'.$i})? ${'imgmsg'.$i} : "";
  98. if (!empty($f) && filter_var($f, FILTER_VALIDATE_URL)) {
  99. $u = str_replace(array("\"","'"), "`", $f);
  100. $info = str_replace(array("\"","'"), "`", $msg);
  101. $imgurls .= "{dede:img ddimg='' text='$info'} $u {/dede:img}\r\n";
  102. }
  103. }//循环结束
  104. $imgurls = addslashes($imgurls);
  105. //分析处理附加表数据
  106. $inadd_f = '';
  107. if(!empty($dede_addonfields))
  108. {
  109. $addonfields = explode(';',$dede_addonfields);
  110. if(is_array($addonfields))
  111. {
  112. foreach($addonfields as $v)
  113. {
  114. if($v=='')
  115. {
  116. continue;
  117. }
  118. $vs = explode(',',$v);
  119. if(!isset(${$vs[0]}))
  120. {
  121. ${$vs[0]} = '';
  122. }
  123. ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$aid);
  124. $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
  125. }
  126. }
  127. if (empty($dede_fieldshash) || $dede_fieldshash != md5($dede_addonfields.$cfg_cookie_encode))
  128. {
  129. showMsg('数据校验不对,程序返回', '-1');
  130. exit();
  131. }
  132. // 这里对前台提交的附加数据进行一次校验
  133. $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE);
  134. if ($fontiterm != $inadd_f)
  135. {
  136. ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1");
  137. exit();
  138. }
  139. }
  140. $description = HtmlReplace($description, -1);
  141. //更新数据库的SQL语句
  142. //更新数据库的SQL语句
  143. $upQuery = "UPDATE `#@__archives` SET
  144. ismake='$ismake',
  145. arcrank='$arcrank',
  146. typeid='$typeid',
  147. title='$title',
  148. description='$description',
  149. keywords='$keywords',
  150. mtype='$mtypesid',
  151. flag='$flag'
  152. WHERE id='$aid' AND mid='$mid'; ";
  153. if(!$dsql->ExecuteNoneQuery($upQuery))
  154. {
  155. ShowMsg("把数据保存到数据库主表时出错,请联系管理员!".$dsql->GetError(),"-1");
  156. exit();
  157. }
  158. $isrm = 0;
  159. if($addtable!='')
  160. {
  161. $query = "UPDATE `$addtable`
  162. set typeid='$typeid',
  163. pagestyle='$pagestyle',
  164. maxwidth = '$maxwidth',
  165. ddmaxwidth = '$ddmaxwidth',
  166. pagepicnum = '$pagepicnum',
  167. imgurls='$imgurls',
  168. row='$prow',
  169. col='$pcol',
  170. userip='$userip',
  171. isrm='$isrm'{$inadd_f}
  172. WHERE aid='$aid'; ";
  173. if(!$dsql->ExecuteNoneQuery($query))
  174. {
  175. ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!".$dsql->GetError(),"javascript:;");
  176. exit();
  177. }
  178. }
  179. UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags);
  180. $artUrl = MakeArt($aid, TRUE);
  181. if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$aid";
  182. //---------------------------------
  183. //返回成功信息
  184. //----------------------------------
  185. $msg = "  请选择你的后续操作:
  186. <a href='album_add.php?cid=$typeid'><u>发布新图集</u></a>
  187. &nbsp;&nbsp;
  188. <a href='archives_do.php?channelid=$channelid&aid=".$aid."&dopost=edit'><u>查看更改</u></a>
  189. &nbsp;&nbsp;
  190. <a href='$artUrl' target='_blank'><u>查看图集</u></a>
  191. &nbsp;&nbsp;
  192. <a href='content_list.php?channelid=$channelid'><u>管理图集</u></a> ";
  193. $wintitle = "成功更改图集!";
  194. $wecome_info = "图集管理::更改图集";
  195. $win = new OxWindow();
  196. $win->AddTitle("成功更改图集:");
  197. $win->AddMsgItem($msg);
  198. $winform = $win->GetWindow("hand","&nbsp;",false);
  199. $win->Display();
  200. }