spacecp_comment.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: spacecp_comment.php 28261 2012-02-27 02:26:09Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $tospace = $pic = $blog = $album = $share = $poll = array();
  12. include_once libfile('class/bbcode');
  13. $bbcode = & bbcode::instance();
  14. if($_POST['idtype'] == 'uid' && ($seccodecheck || $secqaacheck)) {
  15. $seccodecheck = 0;
  16. $secqaacheck = 0;
  17. }
  18. if(submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
  19. if(!checkperm('allowcomment')) {
  20. showmessage('no_privilege_comment', '', array(), array('return' => true));
  21. }
  22. cknewuser();
  23. $waittime = interval_check('post');
  24. if($waittime > 0) {
  25. showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
  26. }
  27. $id = intval($_POST['id']);
  28. $idtype = $_POST['idtype'];
  29. $message = getstr($_POST['message'], 0, 0, 0, 2);
  30. $cid = empty($_POST['cid'])?0:intval($_POST['cid']);
  31. if(strlen($message) < 2) {
  32. showmessage('content_is_too_short', '', array(), array());
  33. }
  34. require_once libfile('function/comment');
  35. $cidarr = add_comment($message, $id, $idtype, $cid);
  36. if($cidarr['cid'] != 0) {
  37. showmessage($cidarr['msg'], dreferer(), $cidarr['magvalues'], $_GET['quickcomment'] ? array('msgtype' => 3, 'showmsg' => true) : array('showdialog' => 3, 'showmsg' => true, 'closetime' => true));
  38. } else {
  39. showmessage('no_privilege_comment', '', array(), array('return' => true));
  40. }
  41. }
  42. $cid = empty($_GET['cid'])?0:intval($_GET['cid']);
  43. if($_GET['op'] == 'edit') {
  44. if($_G['adminid'] != 1 && $_GET['modcommentkey'] != modauthkey($_GET['cid'])) {
  45. $authorid = intval($_G['uid']);
  46. } else {
  47. $authorid = '';
  48. }
  49. if(!$comment = C::t('home_comment')->fetch($cid, $authorid)) {
  50. showmessage('no_privilege_comment_edit');
  51. }
  52. if(submitcheck('editsubmit')) {
  53. $message = getstr($_POST['message'], 0, 0, 0, 2);
  54. if(strlen($message) < 2) showmessage('content_is_too_short');
  55. $message = censor($message);
  56. if(censormod($message)) {
  57. $comment_status = 1;
  58. } else {
  59. $comment_status = 0;
  60. }
  61. if($comment_status == 1) {
  62. manage_addnotify('verifycommontes');
  63. }
  64. C::t('home_comment')->update($comment['cid'], array('message'=>$message, 'status'=>$comment_status));
  65. showmessage('do_success', dreferer(), array('cid' => $comment['cid']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
  66. }
  67. $comment['message'] = $bbcode->html2bbcode($comment['message']);
  68. } elseif($_GET['op'] == 'delete') {
  69. if(submitcheck('deletesubmit')) {
  70. require_once libfile('function/delete');
  71. if(deletecomments(array($cid))) {
  72. showmessage('do_success', dreferer(), array('cid' => $cid), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
  73. } else {
  74. showmessage('no_privilege_comment_del');
  75. }
  76. }
  77. } elseif($_GET['op'] == 'reply') {
  78. if(!$comment = C::t('home_comment')->fetch($cid)) {
  79. showmessage('comments_do_not_exist');
  80. }
  81. if($comment['idtype'] == 'uid' && ($seccodecheck || $secqaacheck)) {
  82. $seccodecheck = 0;
  83. $secqaacheck = 0;
  84. }
  85. $config = urlencode(getsiteurl().'home.php?mod=misc&ac=swfupload&op=config&doodle=1');
  86. } else {
  87. showmessage('undefined_action');
  88. }
  89. include template('home/spacecp_comment');
  90. ?>