index.php 4.4 KB

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