class mobileplugin_xinrui_list_pic_search extends plugin_xinrui_list_pic_base { // 使用 Discuz! 手机版标准的全局底部钩子 function global_footer_mobile(){ global $_G; // 1. 检查用户组权限与开关 $xinrui_groups = dunserialize($_G['cache']['plugin']['xinrui_list_pic']['xinrui_groups']); if(!is_array($xinrui_groups) || !in_array($_G['groupid'], $xinrui_groups)){ return ''; } if($_G['cache']['plugin']['xinrui_list_pic']['xinrui_mobileview'] != 1){ return ''; } // 2. 兼容获取搜索结果列表 ($GLOBALS['threadlist']) $threadlist = !empty($GLOBALS['threadlist']) ? $GLOBALS['threadlist'] : (!empty($_G['threadlist']) ? $_G['threadlist'] : array()); if(empty($threadlist)) return ''; $id = $arrs = $htmls = array(); foreach($threadlist as $val){ if(!empty($val['tid'])){ $id[] = intval($val['tid']); } } if($id){ // 批量获取搜索结果的主楼内容 $rs = DB::fetch_all('SELECT tid, message FROM '.DB::table('forum_post').' WHERE tid IN ('.dimplode($id).') AND first = 1'); foreach($rs as $val){ $arrs[$val['tid']] = $val; } require_once libfile('function/post'); foreach($threadlist as $thread) { if(isset($arrs[$thread['tid']])) { $html = $this->messagehtml($arrs[$thread['tid']]['message'], $arrs[$thread['tid']]['tid']); if($html) { $htmls[$thread['tid']] = $html; } } } } if(empty($htmls)) return ''; // 3. 将图片 HTML 序列化为 JSON,由 JS 注入到搜索列表中 $json = json_encode($htmls); return ''; } }
|
5| 0
|
魔术时钟 |