comment_api.class.php 919 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * 获取专题评论类
  4. */
  5. defined('IN_PHPCMS') or exit('No permission resources.');
  6. if (!module_exists('comment')) showmessage(L('module_not_exists'));
  7. class comment_api {
  8. private $db;
  9. function __construct() {
  10. $this->db = pc_base::load_model('special_model');
  11. }
  12. /**
  13. * 获取评论信息
  14. * @param $module 模型
  15. * @param $contentid 文章ID
  16. * @param $siteid 站点ID
  17. */
  18. function get_info($module, $contentid, $siteid) {
  19. if ($module=='special') {
  20. $r = $this->db->get_one(array('id'=>$contentid, 'siteid'=>$siteid), 'title, url');
  21. return array('title'=>$r['title'], 'url'=>$r['url']);
  22. } elseif ($module=='special_content') {
  23. $this->db = pc_base::load_model('special_content_model');
  24. $r = $this->db->get_one(array('id'=>$contentid), 'title, url');
  25. if ($r) {
  26. return array('title'=>$r['title'], 'url'=>$r['url']);
  27. } else {
  28. return false;
  29. }
  30. }
  31. }
  32. }