portal_comment.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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: portal_comment.php 33660 2013-07-29 07:51:05Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $id = empty($_GET['id']) ? 0 : intval($_GET['id']);
  12. $idtype = in_array($_GET['idtype'], array('aid', 'topicid')) ? $_GET['idtype'] : 'aid';
  13. $url = '';
  14. if(empty($id)) {
  15. showmessage('comment_no_'.$idtype.'_id');
  16. }
  17. if($idtype == 'aid') {
  18. $csubject = C::t('portal_article_title')->fetch($id);
  19. if($csubject) {
  20. $csubject = array_merge($csubject, C::t('portal_article_count')->fetch($id));
  21. }
  22. $url = fetch_article_url($csubject);
  23. } elseif($idtype == 'topicid') {
  24. $csubject = C::t('portal_topic')->fetch($id);
  25. $url = fetch_topic_url($csubject);
  26. }
  27. if(empty($csubject)) {
  28. showmessage('comment_'.$idtype.'_no_exist');
  29. } elseif(empty($csubject['allowcomment'])) {
  30. showmessage($idtype.'_comment_is_forbidden');
  31. }
  32. $perpage = 25;
  33. $page = intval($_GET['page']);
  34. if($page<1) $page = 1;
  35. $start = ($page-1)*$perpage;
  36. $commentlist = array();
  37. $multi = '';
  38. if($csubject['commentnum']) {
  39. $pricount = 0;
  40. $query = C::t('portal_comment')->fetch_all_by_id_idtype($id, $idtype, 'dateline', 'DESC', $start, $perpage);
  41. foreach($query as $value) {
  42. if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
  43. $commentlist[] = $value;
  44. } else {
  45. $pricount ++;
  46. }
  47. }
  48. }
  49. $multi = multi($csubject['commentnum'], $perpage, $page, "portal.php?mod=comment&id=$id&idtype=$idtype");
  50. list($seccodecheck, $secqaacheck) = seccheck('publish');
  51. include_once template("diy:portal/comment");
  52. ?>