PageRenderTime 57ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/e107_plugins/online/online_menu.php

https://github.com/CasperGemini/e107
PHP | 126 lines | 87 code | 21 blank | 18 comment | 13 complexity | ed3fa86396ae7d4cb299c35e2fe34151 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /*
  3. * e107 website system
  4. *
  5. * Copyright (C) 2008-2009 e107 Inc (e107.org)
  6. * Released under the terms and conditions of the
  7. * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
  8. *
  9. * e107 Main
  10. *
  11. * $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_menu.php,v $
  12. * $Revision$
  13. * $Date$
  14. * $Author$
  15. */
  16. if (!defined('e107_INIT')) { exit; }
  17. //global $pref;
  18. global $menu_pref;
  19. $tp = e107::getParser();
  20. include_lan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
  21. require_once(e_PLUGIN.'online/online_shortcodes.php');
  22. if (is_readable(THEME.'online_menu_template.php'))
  23. {
  24. require(THEME.'online_menu_template.php');
  25. }
  26. else
  27. {
  28. require(e_PLUGIN.'online/online_menu_template.php');
  29. }
  30. //if(!defined('e_TRACKING_DISABLED') && varsettrue($pref['track_online']))
  31. if(!defined('e_TRACKING_DISABLED'))
  32. {
  33. //display list of 'member viewing page'
  34. if (e107::getConfig('menu')->get('online_show_memberlist_extended'))
  35. {
  36. if (MEMBERS_ONLINE)
  37. {
  38. // global $listuserson;
  39. $listuserson = e107::getOnline()->userList();
  40. $ret='';
  41. foreach($listuserson as $uinfo => $row)
  42. {
  43. $pinfo = $row['user_location'];
  44. $online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1));
  45. if ($pinfo == 'log.php' || $pinfo == 'error.php')
  46. {
  47. $pinfo = 'news.php';
  48. $online_location_page = 'news';
  49. }
  50. elseif ($online_location_page == 'request.php')
  51. {
  52. $pinfo = 'download.php';
  53. $online_location_page = 'news';
  54. }
  55. elseif (strstr($online_location_page, 'forum'))
  56. {
  57. $pinfo = e_PLUGIN.'forum/forum.php';
  58. $online_location_page = 'forum';
  59. }
  60. elseif (strstr($online_location_page, 'content'))
  61. {
  62. $pinfo = 'content.php';
  63. $online_location_page = 'content';
  64. }
  65. elseif (strstr($online_location_page, 'comment'))
  66. {
  67. $pinfo = 'comment.php';
  68. $online_location_page = 'comment';
  69. }
  70. list($oid, $oname) = explode('.', $uinfo, 2);
  71. $data = array(
  72. 'oid' => $row['user_id'],
  73. 'oname' =>$row['user_name'],
  74. 'page' => $online_location_page,
  75. 'pinfo' => $pinfo,
  76. 'oimage' => $row['user_image']
  77. );
  78. setScVar('online_shortcodes', 'currentMember', $data);
  79. $ret .= $tp->parseTemplate($ONLINE_TEMPLATE['online_members_list_extended'], TRUE);
  80. }
  81. setScVar('online_shortcodes', 'onlineMembersList', $ret);
  82. }
  83. }
  84. $text = $tp->parseTemplate($ONLINE_TEMPLATE['enabled'], TRUE);
  85. }
  86. else
  87. {
  88. if (ADMIN)
  89. {
  90. $text = $tp->parseTemplate($ONLINE_TEMPLATE['disabled'], TRUE);
  91. }
  92. else
  93. {
  94. return;
  95. }
  96. }
  97. $img = (is_readable(THEME.'images/online_menu.png') ? "<img src='".THEME_ABS."images/online_menu.png' alt='' />" : '');
  98. $caption = $img.' '.varsettrue($menu_pref['online_caption'],LAN_ONLINE_10);
  99. if (getperms('1'))
  100. {
  101. $path = e_PLUGIN_ABS."online/config.php";
  102. $caption .= "<a class='pull-right' href='".$path."' title='Configure'><i class='icon-cog'></i></a>";
  103. }
  104. $ns->tablerender($caption, $text, 'online_extended');
  105. ?>