public function output() { global $_G; if (true === BigAppConf::$debug) { $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__; } loadcache('forums'); foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => &$thread) { if (!isset($_G['cache']['stamps'][$thread['icon']]['url'])) { $thread['icon'] = -1; } $thread['forum_name'] = $_G['cache']['forums'][$thread['fid']]['name']; } //echo json_encode($GLOBALS['data']['hot']['threadlist']); //die(0); unset($thread); $GLOBALS['data']['hot']['threadlist'] = bigapp_core::getvalues($GLOBALS['data']['hot']['threadlist'], array('/^\\d+$/'), array('tid', 'attachment', 'avatar', 'subject', 'author', 'views', 'replies', 'forum_name', 'authorid', 'dateline')); if (is_null($GLOBALS['data']['hot']['threadlist']) || !is_array($GLOBALS['data']['hot']['threadlist'])) { $GLOBALS['data']['hot']['threadlist'] = array(); } foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => $thread) { $GLOBALS['data']['hot']['threadlist'][$tid]['avatar'] = avatar($thread['authorid'], 'big', true); $GLOBALS['data']['hot']['threadlist'][$tid]['dateline'] = str_replace(' ', '', $GLOBALS['data']['hot']['threadlist'][$tid]['dateline']); } ///////////////////////////////////////////////////////////////// BigAppAPI::_getDetails($GLOBALS['data']['hot']['threadlist']); ///////////////////////////////////////////////////////////////// $variable = array('data' => array_values($GLOBALS['data']['hot']['threadlist']), 'perpage' => $GLOBALS['perpage']); bigapp_core::result(bigapp_core::variable($variable)); }
function output() { global $_G; $perpage = 20; $page = isset($_G['page']) ? $_G['page'] : 1; $start = $perpage * ($page - 1); $view = $_GET['view']; $data[$view] = BigAppAPI::get_guide_list($view, $start, $perpage); $threadsInfo = isset($data[$view]['threadlist']) ? $data[$view]['threadlist'] : array(); //数据映射 foreach ($threadsInfo as $tid => &$thread) { if (!isset($_G['cache']['stamps'][$thread['icon']]['url'])) { $thread['icon'] = -1; } $thread['forum_name'] = $_G['cache']['forums'][$thread['fid']]['name']; } unset($thread); $threadsInfo = bigapp_core::getvalues($threadsInfo, array('/^\\d+$/'), array('tid', 'fid', 'posttableid', 'attachment', 'avatar', 'subject', 'author', 'views', 'replies', 'forum_name', 'authorid', 'icon', 'digest', 'dateline')); if (is_null($threadsInfo) || !is_array($threadsInfo)) { $threadsInfo = array(); } foreach ($threadsInfo as $tid => $thread) { $threadsInfo[$tid]['avatar'] = avatar($thread['authorid'], 'big', true); $threadsInfo[$tid]['dateline'] = str_replace(' ', '', $threadsInfo[$tid]['dateline']); $threadsInfo[$tid]['dateline'] = preg_replace('/<.*?\\>/', '', $threadsInfo[$tid]['dateline']); } //filter " foreach ($threadsInfo as &$thread) { $thread['subject'] = str_replace('"', '"', $thread['subject']); } BigAppAPI::_getDetails($threadsInfo); $thread_count = isset($data[$view]['threadcount']) ? $data[$view]['threadcount'] : 0; $need_more = $perpage * $page < $thread_count ? '1' : '0'; $pic_mode = isset($_GET['style']) ? $_GET['style'] : '2'; foreach ($threadsInfo as $tid => &$thread) { if ('2' == $pic_mode) { //无图模式 $thread['attachment_urls'] = array(); $thread['message_abstract'] = ""; } } $variable = array("data" => array_values($threadsInfo), "count" => $thread_count, "page" => $page, "need_more" => $need_more, "pic_mode" => $pic_mode); bigapp_core::result(bigapp_core::variable($variable)); }
function output() { global $_G; $type = $_GET['view']; foreach ($GLOBALS['data'][$type]['threadlist'] as $tid => &$thread) { if (!isset($_G['cache']['stamps'][$thread['icon']]['url'])) { $thread['icon'] = -1; } $thread['forum_name'] = $_G['cache']['forums'][$thread['fid']]['name']; } unset($thread); $GLOBALS['data'][$type]['threadlist'] = bigapp_core::getvalues($GLOBALS['data'][$type]['threadlist'], array('/^\\d+$/'), array('tid', 'fid', 'attachment', 'avatar', 'subject', 'author', 'views', 'replies', 'forum_name', 'authorid', 'dateline')); if (is_null($GLOBALS['data'][$type]['threadlist']) || !is_array($GLOBALS['data'][$type]['threadlist'])) { $GLOBALS['data'][$type]['threadlist'] = array(); } foreach ($GLOBALS['data'][$type]['threadlist'] as $tid => $thread) { $GLOBALS['data'][$type]['threadlist'][$tid]['avatar'] = avatar($thread['authorid'], 'big', true); $GLOBALS['data'][$type]['threadlist'][$tid]['dateline'] = str_replace(' ', '', $GLOBALS['data'][$type]['threadlist'][$tid]['dateline']); $GLOBALS['data'][$type]['threadlist'][$tid]['dateline'] = preg_replace('/<.*?\\>/', '', $GLOBALS['data'][$type]['threadlist'][$tid]['dateline']); } //filter " foreach ($GLOBALS['data'][$type]['threadlist'] as &$thread) { $thread['subject'] = str_replace('"', '"', $thread['subject']); } BigAppAPI::_getDetails($GLOBALS['data'][$type]['threadlist']); $variable = array('data' => array_values($GLOBALS['data'][$type]['threadlist']), 'perpage' => $GLOBALS['perpage']); if (isset($_G['setting']['bigapp_settings']['threadlist_image_mode']) && !$_G['setting']['bigapp_settings']['threadlist_image_mode']) { $variable['open_image_mode'] = 0; } //$tmp = array(); //foreach ($variable['data'] as $_v){ //if(isset($_v['fid']) && in_array($_v['fid'], array(4, 217))){ //韬客论坛 //if(isset($_v['fid']) && !in_array($_v['fid'], array(28, 81, 18, 19, 33, 17))){ //中羽论坛 //continue; //} //$tmp[] = $_v; //} //$variable['data'] = $tmp; bigapp_core::result(mobile_core::variable($variable)); }
function output() { global $_G; if (true === BigAppConf::$debug) { $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__; } $needMore = 1; $total = $_G['forum_threadcount']; $start = $_G['tpp'] * ($_G['page'] - 1); if ($start + count($_G['forum_threadlist']) >= $total) { $needMore = 0; } $tids = array(); $threadList = array(); BigAppAPI::_getDetails($_G['forum_threadlist']); foreach ($_G['forum_threadlist'] as $k => $thread) { $_G['forum_threadlist'][$k]['tid'] = $thread['icontid']; if ($thread['displayorder'] <= 0) { unset($_G['forum_threadlist'][$k]); continue; } if (!isset($_G['cache']['stamps'][$thread['icon']])) { $_G['forum_threadlist'][$k]['icon'] = -1; } $typeIcon = ''; if (isset($_G['forum']['threadtypes']['icons'][$thread['typeid']])) { $typeIcon = $_G['forum']['threadtypes']['icons'][$thread['typeid']]; } $tids[] = $thread['tid']; $threadList[$thread['tid']] = $_G['forum_threadlist'][$k]; $threadList[$thread['tid']]['avatar'] = avatar($_G['forum_threadlist'][$k]['authorid'], 'big', 'true'); $threadList[$thread['tid']]['avatar'] = str_replace("\r", '', $threadList[$thread['tid']]['avatar']); $threadList[$thread['tid']]['avatar'] = str_replace("\n", '', $threadList[$thread['tid']]['avatar']); $threadList[$thread['tid']]['lastpost'] = str_replace(' ', '', $threadList[$thread['tid']]['lastpost']); $threadList[$thread['tid']]['dateline'] = str_replace(' ', '', $threadList[$thread['tid']]['dateline']); $threadList[$thread['tid']]['typeicon'] = $typeIcon; } $_G['forum_threadlist'] = array_values($threadList); $moderators = explode("\t", $_G['forum']['moderators']); if (!is_array($moderators) || 0 === count($moderators)) { $_G['forum']['moderators'] = array(); } else { foreach ($moderators as &$_v) { $_v = "'{$_v}'"; } unset($_v); $sql = 'SELECT username, uid FROM ' . DB::table('common_member') . ' WHERE username IN (' . implode(', ', $moderators) . ')'; $subQuery = DB::query($sql); $_G['forum']['moderators'] = array(); while ($moderator = DB::fetch($subQuery)) { $_G['forum']['moderators'][] = array('uid' => $moderator['uid'], 'username' => $moderator['username']); } } $variable = array('forum' => bigapp_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password', 'todayposts', 'yesterdayposts', 'moderators')), 'group' => bigapp_core::getvalues($_G['group'], array('groupid', 'grouptitle')), 'forum_threadlist' => bigapp_core::getvalues(array_values($_G['forum_threadlist']), array('/^\\d+$/'), array('fid', 'tid', 'author', 'authorid', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'heats', 'icon', 'threadimage', 'avatar', 'message_abstract', 'attachment_urls', 'typeid', 'typename', 'typeicon', 'mobile', 'highlight', 'digest')), 'sublist' => bigapp_core::getvalues($GLOBALS['sublist'], array('/^\\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts')), 'tpp' => $_G['tpp'], 'page' => $GLOBALS['page'], 'need_more' => $needMore); if (!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) { $variable['threadtypes'] = $_G['forum']['threadtypes']; unset($variable['threadtypes']['types']); foreach ($_G['forum']['threadtypes']['types'] as $typeId => $typeValue) { $variable['threadtypes']['types'][] = array('typeid' => $typeId, 'typename' => $typeValue); } unset($variable['threadtypes']['icons']); foreach ($_G['forum']['threadtypes']['icons'] as $typeId => $icon) { $variable['threadtypes']['icons'][] = array('typeid' => $typeId, 'typeicon' => $icon); } } if (isset($variable['threadtypes']) && (empty($variable['threadtypes']) || isset($variable['threadtypes'][0]) && empty($variable['threadtypes'][0]) || isset($variable['threadtypes']['types']) && empty($variable['threadtypes']['types']) || isset($variable['threadtypes']['icons']) && empty($variable['threadtypes']['icons']))) { unset($variable['threadtypes']); } if (!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) { $variable['threadsorts'] = $_G['forum']['threadsorts']; } $variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0'; bigapp_core::result(bigapp_core::variable($variable)); }
function output() { global $_G; if (true === BigAppConf::$debug) { $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__; } $needMore = 1; if ('1' == $_G['page'] && count($_G['forum_threadlist']) < $_G['tpp']) { $needMore = 0; } $total = $_G['forum_threadcount']; $start = $_G['tpp'] * ($_G['page'] - 1); if ($start + count($_G['forum_threadlist']) >= $total) { $needMore = 0; } $tids = array(); $threadList = array(); BigAppAPI::_getDetails($_G['forum_threadlist']); foreach ($_G['forum_threadlist'] as $k => $thread) { $_G['forum_threadlist'][$k]['tid'] = $thread['icontid']; if ($thread['displayorder'] > 0) { unset($_G['forum_threadlist'][$k]); continue; } if (!isset($_G['cache']['stamps'][$thread['icon']])) { $_G['forum_threadlist'][$k]['icon'] = -1; } $typeIcon = ''; if (isset($_G['forum']['threadtypes']['icons'][$thread['typeid']])) { $typeIcon = $_G['forum']['threadtypes']['icons'][$thread['typeid']]; } $tids[] = $thread['tid']; $threadList[$thread['tid']] = $_G['forum_threadlist'][$k]; $threadList[$thread['tid']]['avatar'] = avatar($_G['forum_threadlist'][$k]['authorid'], 'big', 'true'); $threadList[$thread['tid']]['avatar'] = str_replace("\r", '', $threadList[$thread['tid']]['avatar']); $threadList[$thread['tid']]['avatar'] = str_replace("\n", '', $threadList[$thread['tid']]['avatar']); $threadList[$thread['tid']]['lastpost'] = str_replace(' ', '', $threadList[$thread['tid']]['lastpost']); $threadList[$thread['tid']]['dateline'] = str_replace(' ', '', $threadList[$thread['tid']]['dateline']); $threadList[$thread['tid']]['dateline'] = preg_replace('/<.*?\\>/', '', $threadList[$thread['tid']]['dateline']); $threadList[$thread['tid']]['typeicon'] = $typeIcon; $threadList[$thread['tid']]['forum_name'] = isset($_G['forum']['name']) ? $_G['forum']['name'] : ""; if (!isset($thread['subject'])) { $threadList[$thread['tid']]['subject'] = ""; //hack } else { //filter " $threadList[$thread['tid']]['subject'] = str_replace('"', '"', $thread['subject']); } } $_G['forum_threadlist'] = array_values($threadList); $moderators = explode("\t", $_G['forum']['moderators']); if (!is_array($moderators) || 0 === count($moderators)) { $_G['forum']['moderators'] = array(); } else { foreach ($moderators as &$_v) { $_v = "'{$_v}'"; } unset($_v); $sql = 'SELECT username, uid FROM ' . DB::table('common_member') . ' WHERE username IN (' . implode(', ', $moderators) . ')'; $subQuery = DB::query($sql); $_G['forum']['moderators'] = array(); while ($moderator = DB::fetch($subQuery)) { $_G['forum']['moderators'][] = array('uid' => $moderator['uid'], 'username' => $moderator['username']); } } $variable = array('forum' => bigapp_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password', 'todayposts', 'yesterdayposts', 'moderators', 'allowspecialonly')), 'group' => bigapp_core::getvalues($_G['group'], array('groupid', 'grouptitle')), 'open_image_mode' => 1, 'forum_threadlist' => bigapp_core::getvalues(array_values($_G['forum_threadlist']), array('/^\\d+$/'), array('fid', 'tid', 'author', 'authorid', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'heats', 'icon', 'threadimage', 'avatar', 'message_abstract', 'attachment_urls', 'typeid', 'typename', 'typeicon', 'mobile', 'highlight', 'digest', 'forum_name')), 'sublist' => bigapp_core::getvalues($GLOBALS['sublist'], array('/^\\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts')), 'tpp' => $_G['tpp'], 'page' => $GLOBALS['page'], 'need_more' => $needMore); $variable['activity_config'] = array('allowpostactivity' => 0, 'credit_title' => '', 'activitytype' => array(), 'activityfield' => array(), 'activityextnum' => 0, 'activitypp' => 1); if (isset($_G['group']['allowpostactivity']) && $_G['group']['allowpostactivity'] && $_G['forum']['allowpostspecial'] & 8) { $variable['activity_config']['allowpostactivity'] = 1; if (isset($_G['setting']['activitycredit']) && isset($_G['setting']['extcredits'][$_G['setting']['activitycredit']]['title'])) { $variable['activity_config']['credit_title'] = $_G['setting']['extcredits'][$_G['setting']['activitycredit']]['title']; } if (isset($_G['setting']['activitytype'])) { $variable['activity_config']['activitytype'] = explode("\r\n", $_G['setting']['activitytype']); } if (isset($_G['setting']['activityfield'])) { $variable['activity_config']['activityfield'] = unserialize($_G['setting']['activityfield']); $tmp = array(); foreach ($variable['activity_config']['activityfield'] as $k => $v) { $tmp[] = array('fieldid' => $k, 'fieldtext' => $v); } $variable['activity_config']['activityfield'] = $tmp; } if (isset($_G['setting']['activityextnum'])) { $variable['activity_config']['activityextnum'] = $_G['setting']['activityextnum']; } if (isset($_G['setting']['activitypp'])) { $variable['activity_config']['activitypp'] = $_G['setting']['activitypp']; } } $variable['poll_config']['allowpostpoll'] = 0; if (isset($_G['group']['allowpostpoll'])) { $variable['poll_config']['allowpostpoll'] = intval($_G['group']['allowpostpoll']); } if (isset($_G['setting']['maxpolloptions']) && $_G['setting']['maxpolloptions'] > 0) { $variable['poll_config']['maxpolloptions'] = intval($_G['setting']['maxpolloptions']); } else { $variable['poll_config']['maxpolloptions'] = 0; $variable['poll_config']['allowpostpoll'] = 0; } if (isset($_G['setting']['bigapp_settings']['threadlist_image_mode']) && !$_G['setting']['bigapp_settings']['threadlist_image_mode']) { $variable['open_image_mode'] = 0; } if (!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) { $variable['threadtypes'] = $_G['forum']['threadtypes']; unset($variable['threadtypes']['types']); foreach ($_G['forum']['threadtypes']['types'] as $typeId => $typeValue) { $typeValue = preg_replace('/<.*?>/', '', $typeValue); $variable['threadtypes']['types'][] = array('typeid' => $typeId, 'typename' => $typeValue); } unset($variable['threadtypes']['icons']); foreach ($_G['forum']['threadtypes']['icons'] as $typeId => $icon) { $variable['threadtypes']['icons'][] = array('typeid' => $typeId, 'typeicon' => $icon); } } if (!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) { $variable['threadsorts'] = $_G['forum']['threadsorts']; } foreach ($variable['forum_threadlist'] as &$tl) { if (!isset($tl['message_abstract'])) { $tl['message_abstract'] = ''; } if (!isset($tl['attachment_urls'])) { $tl['attachment_urls'] = array(); } $tl['typename'] = preg_replace('/<.*?>/', '', $tl['typename']); $tl['author_display'] = $tl['author']; } unset($tl); $variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0'; $variable['forum']['icon'] = ''; if (!empty($_G['forum']['icon'])) { $variable['forum']['icon'] = ApiUtils::getDzRoot() . $_G['setting']['attachurl'] . 'common/' . $_G['forum']['icon']; } if (isset($variable['threadtypes']) && (empty($variable['threadtypes']) || isset($variable['threadtypes'][0]) && empty($variable['threadtypes'][0]) || isset($variable['threadtypes']['types']) && empty($variable['threadtypes']['types']) || isset($variable['threadtypes']['icons']) && empty($variable['threadtypes']['icons']))) { unset($variable['threadtypes']); } bigapp_core::result(bigapp_core::variable($variable)); }