index.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. error_reporting(E_ALL);
  3. /**
  4. * Page generation time counters begins
  5. */
  6. $pageGenStartTime = explode(' ', microtime());
  7. $pageGenStartTime = $pageGenStartTime[1] + $pageGenStartTime[0];
  8. // LOAD LIBS:
  9. require_once('modules/engine/api.mysql.php');
  10. require_once('modules/engine/api.compat.php');
  11. require_once('modules/engine/api.lightastral.php');
  12. require_once('modules/engine/api.usconfig.php');
  13. require_once('modules/engine/api.xmlagent.php');
  14. require_once('modules/engine/api.userstats.php');
  15. require_once('modules/engine/api.agents.php');
  16. require_once('modules/engine/api.megogo.php');
  17. require_once('modules/engine/api.polls.php');
  18. require_once('modules/engine/api.extmobiles.php');
  19. require_once('modules/engine/api.ubrouting.php');
  20. require_once('modules/engine/api.nyanorm.php');
  21. require_once('modules/engine/api.omegatv.php');
  22. require_once('modules/engine/api.trinitytv.php');
  23. require_once('modules/engine/api.usreminder.php');
  24. // ACTIONS HANDLING:
  25. $user_ip = zbs_UserDetectIp('debug');
  26. $user_login = zbs_UserGetLoginByIp($user_ip);
  27. $us_config = zbs_LoadConfig();
  28. $us_access = zbs_GetUserStatsDeniedAll();
  29. if (!empty($us_access)) {
  30. if (isset($us_access[$user_login])) {
  31. $accDeniedBody = file_get_contents('modules/jsc/youshallnotpass.html');
  32. die($accDeniedBody);
  33. }
  34. }
  35. if ($user_ip) {
  36. if (!isset($_GET['module'])) {
  37. if ($us_config['UBA_ENABLED']) {
  38. // UBAgent SUPPORT:
  39. if (ubRouting::checkGet('ubagent')) {
  40. zbs_UserShowAgentData($user_login);
  41. }
  42. // XMLAgent SUPPORT:
  43. if (ubRouting::checkGet('xmlagent')) {
  44. //zbs_UserShowXmlAgentData($user_login);
  45. new XMLAgent($user_login);
  46. }
  47. } else {
  48. //REST API disabled by configuration
  49. if (ubRouting::checkGet('xmlagent')) {
  50. $errorOutputFormat = 'xml';
  51. if (ubRouting::checkGet('json')) {
  52. $errorOutputFormat = 'json';
  53. }
  54. //zbs_XMLAgentRender(array(array('reason' => 'disabled')), 'error', '', $errorOutputFormat, false);
  55. XMLAgent::renderResponse(array(array('reason' => 'disabled')), 'error', '', $errorOutputFormat);
  56. }
  57. }
  58. //announcements notice
  59. if (isset($us_config['AN_ENABLED'])) {
  60. if ($us_config['AN_ENABLED']) {
  61. zbs_AnnouncementsNotice($user_login);
  62. }
  63. }
  64. //top intro
  65. if (isset($us_config['INTRO_MODE'])) {
  66. if ($us_config['INTRO_MODE'] == '3') {
  67. show_window('', zbs_IntroLoadText());
  68. }
  69. }
  70. //Aerial alerts notification
  71. if (@$us_config['AIR_RAID_ALERT_ENABLED']) {
  72. zbs_AerialAlertNotification();
  73. }
  74. //shows user profile by default
  75. show_window(__('User profile'), zbs_UserShowProfile($user_login));
  76. // load poll form
  77. if ($us_config['POLLS_ENABLED']) {
  78. $poll = new Polls($user_login);
  79. if (la_CheckPost(array('vote', 'poll_id'))) {
  80. $poll->createUserVoteOnDB(vf($_POST['vote'], 3), vf($_POST['poll_id'], 3));
  81. }
  82. show_window('', $poll->renderVotingForm());
  83. }
  84. //bottom intro
  85. if (isset($us_config['INTRO_MODE'])) {
  86. if ($us_config['INTRO_MODE'] == '1') {
  87. show_window('', zbs_IntroLoadText());
  88. }
  89. }
  90. } else {
  91. zbs_LoadModule($_GET['module']);
  92. }
  93. //render logout form if user already signed in
  94. if (isset($us_config['INLINE_LOGOUT']) AND $us_config['INLINE_LOGOUT']) {
  95. if ($us_config['auth'] == 'login' OR $us_config['auth'] == 'both') {
  96. zbs_LogoutForm();
  97. }
  98. }
  99. } else {
  100. if ($us_config['auth'] == 'login' OR $us_config['auth'] == 'both') {
  101. zbs_LoginForm();
  102. //bottom auth intro
  103. if (isset($us_config['INTRO_MODE'])) {
  104. if ($us_config['INTRO_MODE'] == '4') {
  105. show_window('', zbs_IntroLoadText());
  106. }
  107. }
  108. }
  109. }
  110. //Page generation timings and query count output
  111. if (isset($us_config['DEBUG_COUNTERS'])) {
  112. if ($us_config['DEBUG_COUNTERS']) {
  113. $mtNowTime = explode(' ', microtime());
  114. $totalPageGenTime = $mtNowTime[0] + $mtNowTime[1] - $pageGenStartTime;
  115. show_window('', __('GT:') . round($totalPageGenTime, 3) . ' QC: ' . $query_counter);
  116. }
  117. }
  118. // LOAD TEMPLATE:
  119. zbs_ShowTemplate();
  120. ?>