hotforum.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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: hotforum.php 34314 2014-02-20 01:04:24Z nemohou $
  7. */
  8. if(!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. include_once 'forum.php';
  12. class mobile_api {
  13. function common() {
  14. global $_G;
  15. loadcache('mobile_hotforum');
  16. if(!$_G['cache']['mobile_hotforum'] || TIMESTAMP - $_G['cache']['mobile_hotforum']['expiration'] > 3600) {
  17. $query = DB::query("SELECT f.*, ff.redirect FROM ".DB::table('forum_forum')." f LEFT JOIN ".DB::table('forum_forumfield')." ff ON ff.fid=f.fid WHERE f.status='1' AND f.type='forum' ORDER BY f.todayposts DESC");
  18. $data = array();
  19. while($row = DB::fetch($query)) {
  20. if($row['redirect']) {
  21. continue;
  22. }
  23. list($row['lastpost_tid'], $row['lastpost_subject'], $row['lastpost'], $row['lastposter']) = explode("\t", $row['lastpost']);
  24. $row['lastpost'] = dgmdate($row['lastpost']);
  25. $data[] = mobile_core::getvalues($row, array('fid', 'name', 'threads', 'posts', 'lastpost', 'lastposter', 'lastpost_tid', 'lastpost_subject', 'todayposts'));
  26. }
  27. $variable = array(
  28. 'data' => $data,
  29. );
  30. savecache('mobile_hotforum', array('variable' => $variable, 'expiration' => TIMESTAMP));
  31. } else {
  32. $variable = $_G['cache']['mobile_hotforum']['variable'];
  33. }
  34. mobile_core::result(mobile_core::variable($variable));
  35. }
  36. function output() {
  37. }
  38. }
  39. ?>