ROEmulator/docker/apache2/www/data/back3a631fed9543b261a4f1ada7396b68c0/Discuz! X2.5 Release[20140603]/source/plugin/mobile/api/1/toplist.php
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: toplist.php 28687 2012-03-08 03:30:54Z monkey $
 */

if(!defined('IN_MOBILE_API')) {
	exit('Access Denied');
}

$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';

class mobile_api {

	function common() {
	}

	function output() {
		global $_G;
		$threads = array();
		loadcache('mobile_toplist_'.$_G['fid']);
		if(!$_G['cache']['mobile_toplist_'.$_G['fid']] || TIMESTAMP - $_G['cache']['mobile_toplist_'.$_G['fid']]['expiration'] > 3600) {
			$query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE tid IN (".dimplode($GLOBALS['stickytids']).") ORDER BY lastpost DESC");
			while($thread = DB::fetch($query)) {
				$threads[] = $thread;
			}
			$query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE `fid`='".$_G['fid']."' AND `displayorder`='1' ORDER BY lastpost DESC");
			while($thread = DB::fetch($query)) {
				$threads[] = $thread;
			}
			savecache('mobile_toplist_'.$_G['fid'], array('variable' => $threads, 'expiration' => TIMESTAMP));
		} else {
			$threads = $_G['cache']['mobile_toplist_'.$_G['fid']]['variable'];
		}
		$variable = array(
			'forum_threadlist' => mobile_core::getvalues($threads, array('/^\d+$/'), array('tid', 'author', 'authorid', 'subject', 'subject', 'dateline', 'lastpost', 'lastposter', 'attachment', 'replies', 'views')),
		);
		$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
		mobile_core::result(mobile_core::variable($variable));
	}

}

?>