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

167 lines
8.0KB

  1. <?php
  2. /**
  3. * 图集发布
  4. *
  5. * @version $id:album_add.php 13:52 2010年7月9日 tianya $
  6. * @package DedeBIZ.User
  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. //考虑安全原因不管是否开启游客投稿功能,都不允许用户对图集投稿
  13. CheckRank(0, 0);
  14. if ($cfg_mb_lit == 'Y') {
  15. ShowMsg("由于系统开启了精简版会员空间,您访问的功能不可用", "-1");
  16. exit();
  17. }
  18. if ($cfg_mb_album == 'N') {
  19. ShowMsg("对不起,由于系统关闭了图集功能,您访问的功能不可用", "-1");
  20. exit();
  21. }
  22. require_once(DEDEINC."/dedetag.class.php");
  23. require_once(DEDEINC."/userlogin.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. $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0;
  29. $menutype = 'content';
  30. if (empty($formhtml)) $formhtml = 0;
  31. /*-------------
  32. function _ShowForm(){ }
  33. --------------*/
  34. if (empty($dopost)) {
  35. $query = "SELECT * FROM `#@__channeltype` WHERE id='$channelid'; ";
  36. $cInfos = $dsql->GetOne($query);
  37. if (!is_array($cInfos)) {
  38. ShowMsg('模型参数不正确', '-1');
  39. exit();
  40. }
  41. //检查会员等级和类型限制
  42. if ($cInfos['sendrank'] > $cfg_ml->M_Rank) {
  43. $row = $dsql->GetOne("Select membername From `#@__arcrank` where `rank`='".$cInfos['sendrank']."' ");
  44. ShowMsg("对不起,需要[".$row['membername']."]才能在这个栏目发布文档", "-1", "0", 5000);
  45. exit();
  46. }
  47. if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) {
  48. ShowMsg("对不起,需要[".$cInfos['usertype']."帐号]才能在这个栏目发布文档", "-1", "0", 5000);
  49. exit();
  50. }
  51. include(DEDEMEMBER."/templets/album_add.htm");
  52. exit();
  53. }
  54. /*------------------------------
  55. function _SaveArticle(){ }
  56. ------------------------------*/
  57. else if ($dopost == 'save') {
  58. include(DEDEMEMBER.'/inc/archives_check.php');
  59. $cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'; ");
  60. $maxwidth = isset($maxwidth) && is_numeric($maxwidth) ? $maxwidth : 800;
  61. $pagepicnum = isset($pagepicnum) && is_numeric($pagepicnum) ? $pagepicnum : 12;
  62. $ddmaxwidth = isset($ddmaxwidth) && is_numeric($ddmaxwidth) ? $ddmaxwidth : 200;
  63. $prow = isset($prow) && is_numeric($prow) ? $prow : 3;
  64. $pcol = isset($pcol) && is_numeric($pcol) ? $pcol : 3;
  65. $pagestyle = in_array($pagestyle, array('1', '2', '3')) ? $pagestyle : 2;
  66. include(DEDEMEMBER.'/inc/archives_check.php');
  67. $imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$prow' col='$pcol' value='$pagestyle'/}\r\n";
  68. $hasone = false;
  69. $ddisfirst = 1;
  70. //只支持填写地址
  71. for ($i = 1; $i <= 120; $i++) {
  72. if (!isset(${'imgfile'.$i})) {
  73. continue;
  74. }
  75. $f = ${'imgfile'.$i};
  76. $msg = isset(${'imgmsg'.$i}) ? ${'imgmsg'.$i} : "";
  77. if (!empty($f) && filter_var($f, FILTER_VALIDATE_URL)) {
  78. $u = str_replace(array("\"", "'"), "`", $f);
  79. $info = str_replace(array("\"", "'"), "`", $msg);
  80. $imgurls .= "{dede:img ddimg='' text='$info'} $u {/dede:img}\r\n";
  81. }
  82. } //循环结束
  83. $imgurls = addslashes($imgurls);
  84. //分析处理附加表数据
  85. $isrm = 1;
  86. if (!isset($formhtml)) {
  87. $formhtml = 0;
  88. }
  89. $inadd_f = $inadd_v = '';
  90. if (!empty($dede_addonfields)) {
  91. $addonfields = explode(';', $dede_addonfields);
  92. $inadd_f = '';
  93. $inadd_v = '';
  94. if (is_array($addonfields)) {
  95. foreach ($addonfields as $v) {
  96. if ($v == '') {
  97. continue;
  98. }
  99. $vs = explode(',', $v);
  100. if (!isset(${$vs[0]})) {
  101. ${$vs[0]} = '';
  102. }
  103. ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], 0);
  104. $inadd_f .= ','.$vs[0];
  105. $inadd_v .= " ,'".${$vs[0]}."' ";
  106. }
  107. }
  108. //这里对前台提交的附加数据进行一次校验
  109. $fontiterm = PrintAutoFieldsAdd(stripslashes($cInfos['fieldset']), 'autofield', FALSE);
  110. if ($fontiterm != $inadd_f) {
  111. ShowMsg("提交表单同系统配置不相符,请重新提交", "-1");
  112. exit();
  113. }
  114. }
  115. //生成文档id
  116. $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $mid);
  117. if (empty($arcID)) {
  118. ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
  119. exit();
  120. }
  121. $description = HtmlReplace($description, -1);
  122. $mtypesid = intval($mtypesid); //对输入参数mtypesid未进行int整型转义,导致SQL注入的发生
  123. //保存到主表
  124. $inQuery = "INSERT INTO `#@__archives` (id,typeid,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,description,keywords,mtype) VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank','0','$money','$title','$shorttitle','$color','$writer','$source','','$pubdate','$senddate','$mid','$description','$keywords','$mtypesid'); ";
  125. if (!$dsql->ExecuteNoneQuery($inQuery)) {
  126. $gerr = $dsql->GetError();
  127. $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID' ");
  128. ShowMsg("数据保存到数据库主表`#@__archives`时出错,请联系管理员", "javascript:;");
  129. exit();
  130. }
  131. //保存到附加表
  132. $addtable = trim($cInfos['addtable']);
  133. if (empty($addtable)) {
  134. $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
  135. $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
  136. ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作", "javascript:;");
  137. exit();
  138. } else {
  139. $query = "INSERT INTO `$addtable` (aid,typeid,userip,redirecturl,templet,pagestyle,maxwidth,imgurls,`row`,col,isrm,ddmaxwidth,pagepicnum{$inadd_f}) VALUES ('$arcID','$typeid','$userip','','','$pagestyle','$maxwidth','$imgurls','$prow','$pcol','$isrm','$ddmaxwidth','$pagepicnum'{$inadd_v}); ";
  140. if (!$dsql->ExecuteNoneQuery($query)) {
  141. $gerr = $dsql->GetError();
  142. $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
  143. $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
  144. ShowMsg("数据保存到数据库附加表时出错,请联系管理员".$gerr, "javascript:;");
  145. exit();
  146. }
  147. }
  148. //增加积分
  149. $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_sendarc_scores} WHERE mid='".$cfg_ml->M_ID."' ; ");
  150. //更新统计
  151. countArchives($channelid);
  152. //生成网页
  153. InsertTags($tags, $arcID);
  154. $artUrl = MakeArt($arcID, true);
  155. if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$arcID";
  156. ClearMyAddon($arcID, $title);
  157. //返回成功信息
  158. $msg = "请选择您的后续操作:<a href='album_add.php?cid=$typeid' class='btn btn-success'>继续发布图集</a><a href='$artUrl' target='_blank' class='btn btn-success'>查看图集</a><a href='album_edit.php?aid=".$arcID."&channelid=$channelid' class='btn btn-success'>修改图集</a><a href='content_list.php?channelid={$channelid}' class='btn btn-success'>已发布图集管理</a>";
  159. $wintitle = "成功发布图集";
  160. $wecome_info = "图集管理::发布图集";
  161. $win = new OxWindow();
  162. $win->AddTitle("成功发布图集:");
  163. $win->AddMsgItem($msg);
  164. $winform = $win->GetWindow("hand", "&nbsp;", false);
  165. $win->Display(DEDEMEMBER."/templets/win_templet.htm");
  166. }
  167. ?>