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

74 lines
2.7KB

  1. <?php
  2. if (!defined('DEDEMEMBER')) exit ('dedebiz');
  3. /**
  4. * 文档验证
  5. *
  6. * @version $id:archives_check.php 13:52 2010年7月9日 tianya $
  7. * @package DedeBIZ.User
  8. * @copyright Copyright (c) 2022 DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license
  10. * @link https://www.dedebiz.com
  11. */
  12. include_once(DEDEINC.'/image.func.php');
  13. include_once(DEDEINC.'/libraries/oxwindow.class.php');
  14. //校验CSRF
  15. CheckCSRF();
  16. $flag = '';
  17. $autokey = $remote = $dellink = $autolitpic = 0;
  18. $userip = GetIP();
  19. if (trim($title) == '') {
  20. ShowMsg("文档标题不能为空", "-1");
  21. exit();
  22. }
  23. if (empty($typeid)) {
  24. ShowMsg("请选择文档栏目", "-1");
  25. exit();
  26. }
  27. $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' ";
  28. $cInfos = $dsql->GetOne($query);
  29. //检测栏目是否有投稿权限
  30. if ($cInfos['issend'] != 1 || $cInfos['ispart'] != 0 || $cInfos['channeltype'] != $channelid || $cInfos['cissend'] != 1) {
  31. ShowMsg("您所选择的栏目不支持投稿", "-1");
  32. exit();
  33. }
  34. //检查栏目设定的投稿许可权限
  35. if ($cInfos['sendrank'] > $cfg_ml->M_Rank) {
  36. $row = $dsql->GetOne("SELECT membername FROM `#@__arcrank` WHERE `rank`='".$cInfos['sendrank']."' ");
  37. ShowMsg("需要<span class='text-primary'>".$row['membername']."</span>才能在这个栏目发布文档", "-1", "0", 5000);
  38. exit();
  39. }
  40. if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) {
  41. ShowMsg("需要<span class='text-primary'>".$cInfos['usertype']."</span>才能在这个栏目发布文档", "-1", "0", 5000);
  42. exit();
  43. }
  44. //文档的默认状态
  45. if ($cInfos['arcsta'] == 0) {
  46. $ismake = 0;
  47. $arcrank = 0;
  48. } else if ($cInfos['arcsta'] == 1) {
  49. $ismake = -1;
  50. $arcrank = 0;
  51. } else {
  52. $ismake = 0;
  53. $arcrank = -1;
  54. }
  55. //对保存的文档进行处理
  56. $money = 0;
  57. $flag = $shorttitle = $color = '';
  58. $source = isset($source)? HtmlReplace($source, 1) : '';
  59. $sortrank = $senddate = $pubdate = time();
  60. $title = cn_substrR(HtmlReplace($title, 1), $cfg_title_maxlen);
  61. $writer = cn_substrR(HtmlReplace($writer, 1), 20);
  62. if (empty($description)) $description = '';
  63. $description = cn_substrR(HtmlReplace($description, 1), 250);
  64. $keywords = cn_substrR(HtmlReplace($tags, 1), 30);
  65. $mid = $cfg_ml->M_ID;
  66. //检测文档是否重复
  67. if ($cfg_mb_cktitle == 'Y') {
  68. $row = $dsql->GetOne("SELECT * FROM `#@__archives` WHERE title LIKE '$title' ");
  69. if (is_array($row)) {
  70. ShowMsg("请不要发布重复文档", "-1", "0", 5000);
  71. exit();
  72. }
  73. }
  74. ?>