index.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. // Send main headers
  9. header('Last-Modified: ' . date('r'));
  10. header("Cache-Control: no-store, no-cache, must-revalidate");
  11. header("Pragma: no-cache");
  12. // LOAD LIBS:
  13. define('USERSTATS_LIBS_PATH', 'modules/engine/');
  14. require_once(USERSTATS_LIBS_PATH . 'api.mysql.php');
  15. require_once(USERSTATS_LIBS_PATH . 'api.compat.php');
  16. require_once(USERSTATS_LIBS_PATH . 'api.userstatsinit.php');
  17. $userstatsEngineLibs = rcms_scandir(USERSTATS_LIBS_PATH, '*.php');
  18. if (!empty($userstatsEngineLibs)) {
  19. foreach ($userstatsEngineLibs as $io => $eachUserstatLib) {
  20. require_once(USERSTATS_LIBS_PATH . $eachUserstatLib);
  21. }
  22. }
  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. //web app manifest rendering
  35. zbs_ManifestCatchRequest();
  36. if ($user_ip) {
  37. if (!ubRouting::checkGet('module')) {
  38. if ($us_config['UBA_ENABLED']) {
  39. // UBAgent SUPPORT:
  40. if (ubRouting::checkGet('ubagent')) {
  41. zbs_UserShowAgentData($user_login);
  42. }
  43. // XMLAgent SUPPORT:
  44. if (ubRouting::checkGet('xmlagent')) {
  45. //zbs_UserShowXmlAgentData($user_login);
  46. new XMLAgent($user_login);
  47. }
  48. } else {
  49. //REST API disabled by configuration
  50. if (ubRouting::checkGet('xmlagent')) {
  51. $errorOutputFormat = 'xml';
  52. if (ubRouting::checkGet('json')) {
  53. $errorOutputFormat = 'json';
  54. }
  55. //zbs_XMLAgentRender(array(array('reason' => 'disabled')), 'error', '', $errorOutputFormat, false);
  56. XMLAgent::renderResponse(array(array('reason' => 'disabled')), 'error', '', $errorOutputFormat);
  57. }
  58. }
  59. //announcements notice
  60. if (isset($us_config['AN_ENABLED'])) {
  61. if ($us_config['AN_ENABLED']) {
  62. zbs_AnnouncementsNotice($user_login);
  63. }
  64. }
  65. //top intro
  66. if (isset($us_config['INTRO_MODE'])) {
  67. if ($us_config['INTRO_MODE'] == '3') {
  68. show_window('', zbs_IntroLoadText());
  69. }
  70. }
  71. //Aerial alerts notification
  72. if (@$us_config['AIR_RAID_ALERT_ENABLED']) {
  73. zbs_AerialAlertNotification();
  74. }
  75. //shows user profile by default
  76. show_window(__('User profile'), zbs_UserShowProfile($user_login));
  77. // load poll form
  78. if ($us_config['POLLS_ENABLED']) {
  79. $poll = new Polls($user_login);
  80. if (ubRouting::checkPost(array('vote', 'poll_id'))) {
  81. $poll->createUserVoteOnDB(ubRouting::post('vote', 'int'), ubRouting::post('poll_id', 'int'));
  82. }
  83. show_window('', $poll->renderVotingForm());
  84. }
  85. //bottom intro
  86. if (isset($us_config['INTRO_MODE'])) {
  87. if ($us_config['INTRO_MODE'] == '1') {
  88. show_window('', zbs_IntroLoadText());
  89. }
  90. }
  91. } else {
  92. zbs_LoadModule(ubRouting::get('module'));
  93. }
  94. //render logout form if user already signed in
  95. if (isset($us_config['INLINE_LOGOUT']) and $us_config['INLINE_LOGOUT']) {
  96. if ($us_config['auth'] == 'login' or $us_config['auth'] == 'both') {
  97. zbs_LogoutForm();
  98. }
  99. }
  100. } else {
  101. if ($us_config['auth'] == 'login' or $us_config['auth'] == 'both') {
  102. zbs_LoginForm();
  103. //bottom auth intro
  104. if (isset($us_config['INTRO_MODE'])) {
  105. if ($us_config['INTRO_MODE'] == '4') {
  106. show_window('', zbs_IntroLoadText());
  107. }
  108. }
  109. }
  110. }
  111. // LOAD TEMPLATE:
  112. zbs_ShowTemplate();