PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/phpBB3/points.php

https://gitlab.com/perioner/mfhs
PHP | 139 lines | 98 code | 21 blank | 20 comment | 7 complexity | 3e440015db2c5405dae6528a8e6f492b MD5 | raw file
  1. <?php
  2. /**
  3. *
  4. * @package Ultimate Points
  5. * @version $Id: points.php 665 2010-11-14 04:30:21Z femu $
  6. * @copyright (c) 2009 wuerzi & femu & el_teniente
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. *
  9. */
  10. /**
  11. * @ignore
  12. */
  13. define('IN_PHPBB', true);
  14. $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
  15. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  16. include($phpbb_root_path . 'common.' . $phpEx);
  17. include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
  18. include($phpbb_root_path . 'includes/functions_module.' . $phpEx);
  19. include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  20. include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
  21. $mode = request_var('mode', '');
  22. // Start session management
  23. $user->session_begin();
  24. $auth->acl($user->data);
  25. $user->setup('mods/points');
  26. // Exclude Bots
  27. if ($user->data['is_bot'])
  28. {
  29. redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
  30. }
  31. // Disable Ultimate Points if the points_install file is still present
  32. if (file_exists($phpbb_root_path . 'install_ultimate_points.php'))
  33. {
  34. // Adjust the message slightly according to the permissions
  35. if ($auth->acl_gets('a_'))
  36. {
  37. $message = $user->lang['POINTS_REMOVE_INSTALL'];
  38. }
  39. else
  40. {
  41. $message = $points_config['points_disablemsg'];
  42. }
  43. trigger_error($message);
  44. }
  45. //Check if you are locked or not
  46. if (!$auth->acl_get('u_use_points'))
  47. {
  48. trigger_error('NOT_AUTHORISED');
  49. }
  50. // Get user's information
  51. $check_user = request_var('i', 0);
  52. $check_user = ($check_user == 0) ? $user->data['user_id'] : $check_user;
  53. $sql_array = array(
  54. 'SELECT' => '*',
  55. 'FROM' => array(
  56. USERS_TABLE => 'u',
  57. ),
  58. 'WHERE' => 'u.user_id = ' . (int) $check_user,
  59. );
  60. $sql = $db->sql_build_query('SELECT', $sql_array);
  61. $result = $db->sql_query($sql);
  62. $checked_user = $db->sql_fetchrow($result);
  63. $db->sql_freeresult($result);
  64. $check_auth = new auth();
  65. $check_auth->acl($checked_user);
  66. if (!$checked_user)
  67. {
  68. trigger_error('POINTS_NO_USER');
  69. }
  70. // Ultimate Points Version
  71. $version = $config['ultimate_points_version'];
  72. // Check if points system is enabled
  73. if (!$config['points_enable'])
  74. {
  75. trigger_error($points_config['points_disablemsg']);
  76. }
  77. // Add the base entry into the Nav Bar at top
  78. $template->assign_block_vars('navlinks', array(
  79. 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}points.$phpEx"),
  80. 'FORUM_NAME' => sprintf($user->lang['POINTS_TITLE_MAIN'], $config['points_name']),
  81. ));
  82. $template->assign_vars(array_change_key_case($checked_user, CASE_UPPER));
  83. $user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour'], $user->data['username']);
  84. $template->assign_vars(array_merge(array_change_key_case($points_config, CASE_UPPER), array(
  85. 'USER_POINTS' => number_format_points ($user->data['user_points']),
  86. 'U_USE_POINTS' => $check_auth->acl_get('u_use_points'),
  87. 'U_CHG_POINTS' => $check_auth->acl_get('m_chg_points'),
  88. 'POINT_VERS' => $version,
  89. 'U_USE_TRANSFER' => $check_auth->acl_get('u_use_transfer'),
  90. 'U_USE_LOGS' => $check_auth->acl_get('u_use_logs'),
  91. 'U_USE_LOTTERY' => $check_auth->acl_get('u_use_lottery'),
  92. 'U_USE_BANK' => $check_auth->acl_get('u_use_bank'),
  93. 'U_USE_ROBBERY' => $check_auth->acl_get('u_use_robbery'),
  94. )));
  95. $module = new p_master();
  96. switch($mode)
  97. {
  98. case 'transfer_user':
  99. $module->load('points', 'transfer_user');
  100. $module->display("{L_POINTS_TRANSFER}");
  101. break;
  102. case 'logs':
  103. case 'lottery':
  104. case 'transfer':
  105. case 'robbery':
  106. case 'points_edit':
  107. case 'bank':
  108. case 'bank_edit':
  109. case 'info':
  110. $module->load('points', $mode);
  111. $module->display("{L_POINTS_}" . strtoupper($mode));
  112. break;
  113. default:
  114. $module->load('points', 'main');
  115. $module->display("{L_POINTS_OVERVIEW}");
  116. break;
  117. }
  118. ?>