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

77 lines
2.8KB

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