table_forum_faq.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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: table_forum_faq.php 30560 2012-06-04 03:03:56Z svn_project_zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_faq extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_faq';
  15. $this->_pk = 'id';
  16. parent::__construct();
  17. }
  18. public function fetch_all_by_fpid($fpid = '', $srchkw = '') {
  19. $sql = array();
  20. if($fpid !== '' && $fpid) {
  21. $sql[] = DB::field('fpid', $fpid);
  22. }
  23. if($srchkw) {
  24. $sql[] = DB::field('title', '%'.$srchkw.'%', 'like').' OR '.DB::field('message', '%'.$srchkw.'%', 'like');
  25. }
  26. $sql = implode(' AND ', $sql);
  27. if($sql) {
  28. $sql = 'WHERE '.$sql;
  29. }
  30. return DB::fetch_all("SELECT * FROM %t %i ORDER BY displayorder", array($this->_table, $sql));
  31. }
  32. public function check_identifier($identifier, $id) {
  33. return DB::result_first("SELECT COUNT(*) FROM %t WHERE identifier=%s AND id!=%s", array($this->_table, $identifier, $id));
  34. }
  35. }
  36. ?>