misc_mobile.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: misc_mobile.php 36284 2016-12-12 00:47:50Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if($mod == 'mobile' && defined('IN_MOBILE')) {
  12. if($_G['setting']['domain']['app']['mobile']) {
  13. dheader("Location:http://".$_G['setting']['domain']['app']['mobile']);
  14. } else {
  15. dheader("Location:".$_G['siteurl'].'forum.php?mobile=yes');
  16. }
  17. } elseif(!$_G['setting']['mobile']['allowmobile']) {
  18. dheader("Location:".($_G['setting']['domain']['app']['default'] ? "http://".$_G['setting']['domain']['app']['default'] : $_G['siteurl']));
  19. }
  20. include DISCUZ_ROOT.'./source/language/mobile/lang_template.php';
  21. $_G['lang'] = array_merge($_G['lang'], $lang);
  22. $navtitle = $_G['lang']['misc_mobile_title'];
  23. if($_GET['view'] == true) {
  24. include libfile('forum/forum_index_mobile', 'module');
  25. include libfile('function/forumlist');
  26. loadcache('userstats');
  27. $query = C::t('forum_forum')->fetch_all_forum(1);
  28. foreach($query as $forum) {
  29. if($forum['type'] != 'group') {
  30. $threads += $forum['threads'];
  31. $posts += $forum['posts'];
  32. $todayposts += $forum['todayposts'];
  33. if($forum['type'] == 'forum' && isset($catlist[$forum['fup']])) {
  34. if(forum($forum)) {
  35. $catlist[$forum['fup']]['forums'][] = $forum['fid'];
  36. $forum['orderid'] = $catlist[$forum['fup']]['forumscount']++;
  37. $forum['subforums'] = '';
  38. $forumlist[$forum['fid']] = $forum;
  39. }
  40. } elseif(isset($forumlist[$forum['fup']])) {
  41. $forumlist[$forum['fup']]['threads'] += $forum['threads'];
  42. $forumlist[$forum['fup']]['posts'] += $forum['posts'];
  43. $forumlist[$forum['fup']]['todayposts'] += $forum['todayposts'];
  44. }
  45. } else {
  46. $forum['forumscount'] = 0;
  47. $catlist[$forum['fid']] = $forum;
  48. }
  49. }
  50. ob_start();
  51. include template('mobile/forum/discuz');
  52. } else {
  53. include template('mobile/common/preview');
  54. }
  55. function output_preview() {
  56. $content = ob_get_contents();
  57. ob_end_clean();
  58. ob_start();
  59. $content = preg_replace_callback("/\<a href=\"(.*?)\"[\s]?\>(.*?)\<\/a\>/", 'output_preview_callback_replace_href_21', $content);
  60. echo $content;
  61. exit;
  62. }
  63. function output_preview_callback_replace_href_21($matches) {
  64. return replace_href($matches[2]);
  65. }
  66. function replace_href($html_str) {
  67. $string = "<span class='lkcss'>".stripslashes($html_str)."</span>";
  68. return $string;
  69. }
  70. ?>