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

100 lines
3.2KB

  1. <?php
  2. /**
  3. * 文档验证
  4. *
  5. * @version $Id: archives_check.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. if (!defined('DEDEMEMBER')) exit('dedecms');
  12. include_once(DEDEINC . '/image.func.php');
  13. include_once(DEDEINC . '/oxwindow.class.php');
  14. $svali = GetCkVdValue();
  15. if (preg_match("/3/", $safe_gdopen)) {
  16. if (strtolower($vdcode) != $svali || $svali == '') {
  17. ResetVdValue();
  18. ShowMsg('验证码错误!', '-1');
  19. exit();
  20. }
  21. }
  22. // 校验CSRF
  23. CheckCSRF();
  24. $faqkey = isset($faqkey) && is_numeric($faqkey) ? $faqkey : 0;
  25. $safe_faq_send = isset($safe_faq_send) && is_numeric($safe_faq_send) ? $safe_faq_send : 0;
  26. if ($safe_faq_send == '1') {
  27. if ($safefaqs[$faqkey]['answer'] != $safeanswer || $safeanswer == '') {
  28. ShowMsg('验证问题答案错误', '-1');
  29. exit();
  30. }
  31. }
  32. $flag = '';
  33. $autokey = $remote = $dellink = $autolitpic = 0;
  34. $userip = GetIP();
  35. if ($typeid == 0) {
  36. ShowMsg('请指定文档隶属的栏目!', '-1');
  37. exit();
  38. }
  39. $query = "Select tp.ispart,tp.channeltype,tp.issend,ch.issend as cissend,ch.sendrank,ch.arcsta,ch.addtable,ch.fieldset,ch.usertype
  40. From `#@__arctype` tp left join `#@__channeltype` ch on ch.id=tp.channeltype where tp.id='$typeid' ";
  41. $cInfos = $dsql->GetOne($query);
  42. //检测栏目是否有投稿权限
  43. if ($cInfos['issend'] != 1 || $cInfos['ispart'] != 0 || $cInfos['channeltype'] != $channelid || $cInfos['cissend'] != 1) {
  44. ShowMsg("你所选择的栏目不支持投稿!", "-1");
  45. exit();
  46. }
  47. //检查频道设定的投稿许可权限
  48. if ($cInfos['sendrank'] > $cfg_ml->M_Rank) {
  49. $row = $dsql->GetOne("Select membername From #@__arcrank where rank='" . $cInfos['sendrank'] . "' ");
  50. ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000);
  51. exit();
  52. }
  53. if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) {
  54. ShowMsg("对不起,需要[" . $cInfos['usertype'] . "]才能在这个频道发布文档!", "-1", "0", 5000);
  55. exit();
  56. }
  57. //文档的默认状态
  58. if ($cInfos['arcsta'] == 0) {
  59. $ismake = 0;
  60. $arcrank = 0;
  61. } else if ($cInfos['arcsta'] == 1) {
  62. $ismake = -1;
  63. $arcrank = 0;
  64. } else {
  65. $ismake = 0;
  66. $arcrank = -1;
  67. }
  68. //对保存的内容进行处理
  69. $money = 0;
  70. $flag = $shorttitle = $color = $source = '';
  71. $sortrank = $senddate = $pubdate = time();
  72. $title = cn_substrR(HtmlReplace($title, 1), $cfg_title_maxlen);
  73. $writer = cn_substrR(HtmlReplace($writer, 1), 20);
  74. if (empty($description)) $description = '';
  75. $description = cn_substrR(HtmlReplace($description, 1), 250);
  76. $keywords = cn_substrR(HtmlReplace($tags, 1), 30);
  77. $mid = $cfg_ml->M_ID;
  78. //检测文档是否重复
  79. if ($cfg_mb_cktitle == 'Y') {
  80. $row = $dsql->GetOne("SELECT * FROM `#@__archives` WHERE title LIKE '$title' ");
  81. if (is_array($row)) {
  82. ShowMsg("对不起,请不要发布重复文档!", "-1", "0", 5000);
  83. exit();
  84. }
  85. }