forumindex.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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: forumindex.php 34398 2014-04-14 07:11:22Z nemohou $
  7. */
  8. if (!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. $_GET['mod'] = 'index';
  12. include_once 'forum.php';
  13. class mobile_api {
  14. function common() {
  15. }
  16. function output() {
  17. global $_G;
  18. $forums = $GLOBALS['forums'] ? $GLOBALS['forums'] : C::t('forum_forum')->fetch_all_by_status(1);
  19. foreach ($forums as $forum) {
  20. if ($forum['fup'] && $GLOBALS['forumlist'][$forum['fup']]) {
  21. $GLOBALS['forumlist'][$forum['fup']]['sublist'][] = mobile_core::getvalues($forum, array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description'));
  22. }
  23. if ($GLOBALS['forumlist'][$forum['fid']]['icon']) {
  24. $icon = preg_match('/src="(.+?)"/', $GLOBALS['forumlist'][$forum['fid']]['icon'], $r) ? $r[1] : '';
  25. if (!preg_match('/^http:\//', $icon)) {
  26. $icon = $_G['siteurl'] . $icon;
  27. }
  28. $GLOBALS['forumlist'][$forum['fid']]['icon'] = $icon;
  29. }
  30. }
  31. if ($_GET['checknotice']) {
  32. $variable = array();
  33. } else {
  34. $variable = array(
  35. 'member_email' => $_G['member']['email'],
  36. 'member_credits' => $_G['member']['credits'],
  37. 'setting_bbclosed' => $_G['setting']['bbclosed'],
  38. 'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle', '/^allow.+?$/')),
  39. 'catlist' => array_values(mobile_core::getvalues($GLOBALS['catlist'], array('/^\d+$/'), array('fid', 'name', 'forums'))),
  40. 'forumlist' => array_values(mobile_core::getvalues($GLOBALS['forumlist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description', 'sublist', 'icon'))),
  41. );
  42. }
  43. mobile_core::result(mobile_core::variable($variable));
  44. }
  45. }
  46. ?>